Files
ianitor/docs/domi-ui.md
T

88 lines
5.4 KiB
Markdown

# Ianitor on @domi/ui
The web UI's controls and roles come from **@domi/ui**, the shared Domi design system (Gitea `mnovak/domi-design`,
its `docs/INTEGRATE.md` §6a and `docs/MIGRATION.md`). It is **vendored** at a tag in `packages/domi-ui` (MPL-2.0,
like Ianitor; `VERSION` names the tag, v1.0.2) and used as a workspace package by `apps/web` and `packages/ui`:
```json
"@domi/ui": "workspace:*"
```
Why vendored: domi-design is private on Gitea, and the Nix build (`deploy/nixos/web.nix`) fetches the pnpm
dependencies in a sandbox without credentials. A token there would land in the world-readable Nix store and be needed
on every builder. The vendored copy is offline, reproducible and secret-free; the lockfile names no Gitea repository.
**Do not edit `packages/domi-ui`.** Changes go to domi-design as a PR. To upgrade, read the next tag's CHANGELOG.md,
then from a clone of domi-design run `node tools/vendor.mjs <this repo>/packages/domi-ui vX.Y.Z`, `pnpm install`, and
update `fetchPnpmDeps`'s hash in `deploy/nixos/web.nix` (`lib.fakeHash`, build, paste the hash Nix reports).
## What comes from where
| Part | From | Notes |
| :-- | :-- | :-- |
| Fonts (Cinzel, Cormorant Garamond, Manrope; latin and latin-ext) | @domi/ui `domi.css` | bundled from npm, nothing fetched at run time. The `@fontsource` packages are gone |
| Roles: ground, text, accent, leaf, ok, warning, danger | @domi/ui, `data-domi-room="ianitor"` on `<html>` | the same hex as before (domi-design PALETTE.md). Ianitor's old names are renamed to `--domi-*` (MIGRATION.md, ianitor table); no legacy alias file |
| Buttons | @domi/ui `Button`, through Ianitor's `Button.svelte` | see the mapping below |
| Text fields | @domi/ui `TextField`, every one with its seal | see the actions below |
| Checkboxes, the secret picker, segmented controls | @domi/ui `Checkbox`, `Select`, `Segmented` | Ianitor's `Segmented.svelte` keeps the visible name above the choices |
| Banners, dialogs, status, chips, lists, menus, toasts, the number and file inputs | Ianitor (`packages/ui`, `ia-*`) | Ianitor's own tokens (status names, washes, type sizes, spacing, radii) stay in `packages/ui/src/tokens.css` |
`packages/ui` is now Ianitor's own components on top of @domi/ui. Its old `.domi-btn`, `.domi-field` and
`.domi-input` rules are gone (they had the same class names as @domi/ui's); the link-style button is `.ia-link`.
## Buttons
| Ianitor | @domi/ui | Desktop height |
| :-- | :-- | :-- |
| default (`quiet`), `outline` | `plate`, size `lg` | 44 px, as before |
| `primary` | `primary` (the leaf), size `xl` | 50 px, as before |
| `danger` | `danger`, size `lg` | 44 px |
| `small` | size `md` | 34 px (was 36) |
| `full` | `block` | |
| `pending` | `status="loading"` (the interpuncts) | |
| `label` | the accessible name, through `aria-labelledby` | "+ Host" is still "Add a host" |
On a touch screen every button is at least 48 px (@domi/ui). An `onclick` that returns a Promise shows loading,
then a check or a refusal, by itself.
**A change in behaviour:** a disabled button is now natively disabled, so it is skipped by Tab. Before, it was
`aria-disabled` and stayed focusable so its reason could be read. Every disabled button with a reason (Apply,
Restore this version, + Host while changes are blocked) shows that reason as visible text beside it, which is
@domi/ui's rule ("say elsewhere why"). Copy link is *working*, not disabled, while the link is being made, so the
share dialog still opens with the focus on it.
## Text fields and their seals
| Field | Seal | Enter |
| :-- | :-- | :-- |
| Host form: every text field but the last | `next` | goes to the next field |
| Host form: the last text field shown | `save`, "Apply this host" | applies the form, as Apply does |
| Share link: only addresses starting with | `save`, "Make the link for these addresses" | makes a new link (as leaving the field did) |
| Share link: password | `save`, "Ask for this password on the link" | as Use this password |
| Device name | `send`, "Request the certificate" | as Issue |
| New token's name | `save`, "Rename the token" | renames it now (before, only when the dialog closed) |
| Signed certificate (pasted) | `send`, "Use the pasted certificate" | a new line (`enterSends="never"`); Ctrl+Enter or the seal uses it |
The host form still checks a field when the focus leaves it, now when it leaves the field and its seal.
## Type checking
@domi/ui's `Strike.svelte` has no `<script lang="ts">`, so TypeScript reads it as JavaScript. `apps/web/tsconfig.json`
sets `allowJs` (with `checkJs` off), as domi-design's own tsconfig does; without it a strict svelte-check refuses the
import (implicit any).
## Risks
- **The Nix hash is not filled in yet.** `fetchPnpmDeps`'s hash in `deploy/nixos/web.nix` is `lib.fakeHash` because
no machine here has Nix. The first `nix build .#ianitor-web` fails and prints the hash to paste. **Do not merge
before it is pasted and the build passes.**
- A visual change Mark has not seen beyond the asked-for controls: the field labels are @domi/ui's (13 px, 600),
and Ianitor's group labels (Certificate, Visit log, What is it) follow them so a form reads as one; the
segmented controls are as wide as their choices, not the panel.
## Atrium Domi
Ianitor runs on the home server; Atrium Domi lists programs on Mark's PC (Atrium `docs/APP_CONTRACT.md`), so
Ianitor has no room there and no `domi-app.toml`. If it ever gets one: `free = true` (Mark's pricing: Ianitor is
free).