nigig-org/crates/apps/makepad_table/Cargo.toml
andodeki a2b05c56c9
Some checks failed
repo hygiene / hygiene (push) Has been cancelled
makepad-table / model (push) Has been cancelled
makepad-table / widget (push) Has been cancelled
makepad-table / hygiene (push) Has been cancelled
feat(makepad-table): opt-in capabilities feature, and raise the matrix_client defect
The two caveats from the dependency investigation.

## The capabilities feature

Camera and location attachments are now available behind
`features = ["capabilities"]`, which pulls `nigig-uikit` and supplies
`UikitAttachmentProvider`.

Measured: 89 crates by default, 275 with the feature on. That cost is real
and it is inherent, not packaging waste. `camera_widget` imports
`send_geocode_request` and `request_map_tile` from `nigig-core`, both of
which call `spawn_async` — the shared Tokio runtime — and the first makes an
HTTPS call to Nominatim. A camera that geocodes needs an async runtime and an
HTTP client; there is no lighter honest version.

It is affordable because it is opt-in, and because any app enabling it
already depends on `nigig-core`, so that app's own tree grows by nothing.

Everything touching `nigig-uikit` is in one module, so the boundary is a file
rather than `#[cfg]` scattered through the widget. The provider holds no
widgets of its own: the host owns the `CameraWidget` already in its tree and
this asks it to open, because a provider that instantiated a second camera
would fight the first for the device.

A second request while one is outstanding is refused rather than overwriting.
The table turns that refusal into `AttachmentUnavailable`, so the user is
told the camera is busy instead of watching their first request vanish.

File picking is deliberately declined here — `robius-file-picker` already
ships unconditionally and costs nothing, and two paths for one job is one too
many.

Two CI gates, both verified to fail when they should: the opt-in build must
keep compiling, and the default build must pull none of `tokio`, `reqwest`,
`hyper`, `clap`, `csv`, `image`, `nigig-uikit` or `nigig-core`. The second
checks the resolved `cargo tree` rather than the manifest, because feature
unification can switch an optional dependency on from a sibling crate.

Tests 99 default, 105 with the feature. Both clippy-clean.

## The matrix_client defect

Raised in REVIEWS/MATRIX_CLIENT_FEATURE_GATE.md rather than fixed. It is not
my crate, nothing depends on the broken combination, and a blind fix could
change behaviour someone relies on.

`matrix_client` declares `native = ["dep:tokio", "dep:reqwest",
"dep:rusqlite"]` but its source gates on `#[cfg(not(target_arch =
"wasm32"))]`. Two switches for the same modules, so on a native target with
the feature off the modules compile and their dependencies do not — 19
errors, 26 ungated uses across 7 files. There is no CI job for the crate,
which is why it rotted unnoticed.

The note corrects an overstatement I made while arguing for the trait hook.
I said fixing this would unblock wasm. It would not: `matrix_client` already
builds clean for wasm32 with `--no-default-features`, and `nigig-core` has 8
wasm errors of its own (`crate::platform::spawn` missing) that have nothing
to do with it. The only broken combination is native-target-with-feature-off,
which nothing builds.

I also said earlier that `matrix_client` was heavy — it is a 7-dependency
local crate, not matrix-sdk. That was wrong and it inflated the case for the
trait hook; the note records the measured numbers instead.
2026-08-18 18:03:26 +00:00

63 lines
3 KiB
TOML

[package]
name = "makepad-table"
version = "0.1.0"
edition = "2021"
authors = ["Makepad Table Scaffold <info@example.com>"]
description = "Notion-style manipulable table widget for Makepad + receipt/quote/invoice platform"
license = "MIT OR Apache-2.0"
[dependencies]
# Pinned to the same fork revision the rest of the repo uses. This crate
# previously tracked `github.com/makepad/makepad` branch `dev`, which is a
# moving target: the same commit of this repo would build against a
# different makepad from one day to the next, and against a *different*
# makepad from every other crate here. Verified to compile against the pin.
# For local makepad dev, replace with:
# makepad-widgets = { path = "../../widgets" }
makepad-widgets = { git = "https://gitdab.com/andodeki/makepad", rev = "ecf5a572ab62a1c1598909971f602f99083671cc" }
# Image format sniffing for attached cells, matching what the Robrix-derived
# app in this repo (`pageflipnav/src/utils.rs`) uses. Zero transitive
# dependencies: it reads a header and names a format, nothing more.
imghdr = "0.7.0"
# ---------------------------------------------------------------------------
# Optional: the host capabilities behind `CellAttachmentProvider`.
# ---------------------------------------------------------------------------
#
# `nigig-uikit` supplies the camera and location widgets that item 6's cell
# menu offers. It is optional because it is expensive: measured, it takes the
# dependency tree from 88 crates to 274.
#
# That is not packaging waste. `camera_widget` imports `send_geocode_request`
# and `request_map_tile` from `nigig-core`, both of which call `spawn_async`
# -- the shared Tokio runtime -- and the first makes an HTTPS call to
# Nominatim. The widget genuinely needs an async runtime and an HTTP client.
#
# So the cost is real and it is opt-in. With the feature off the widget
# depends on `makepad-widgets` and `imghdr` alone, and the attachment menu
# reports camera and location as unavailable rather than pretending. Any app
# turning it on already depends on `nigig-core`, so its own tree grows by
# nothing.
nigig-uikit = { path = "../../nigig-uikit", optional = true }
[features]
default = []
## Camera and location attachments, via `nigig-uikit`. See the dependency
## comment above for what this costs and why.
capabilities = ["dep:nigig-uikit"]
[workspace]
# Workspace members: the table widget lib itself + the doc-model and pdf-export
# crates + the invoicer makepad app.
#
# The table_demo demo lives at apps/invoicer/examples/table_demo.rs and runs
# via `cargo run -p makepad-invoicer --example table_demo` — it inherits
# makepad-invoicer's [dependencies], so no separate Cargo.toml is needed.
members = [
".", # makepad-table lib (the Table widget)
"crates/doc-model", # shared data types
"crates/pdf-export", # pdf-writer based exporter
"apps/invoicer", # makepad UI app (also hosts the table_demo example)
"examples/table_demo", # standalone demo; the drop-into-makepad template
]