basalt-ui 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -0
- package/CHANGELOG.md +72 -39
- package/MIGRATING.md +44 -2
- package/README.md +39 -12
- package/agent/rules/basalt-tokens.md +1 -1
- package/agent/rules/basalt-ui.md +3 -3
- package/agent/skills/basalt-app/references/live.md +4 -4
- package/agent/skills/basalt-app/references/migrate.md +2 -2
- package/agent/skills/basalt-app/references/setup.md +17 -8
- package/agent/skills/basalt-app/references/testing.md +8 -6
- package/agent/skills/basalt-design/SKILL.md +2 -1
- package/agent/skills/basalt-design/references/controls.md +1 -0
- package/agent/skills/basalt-design/references/parts.md +5 -1
- package/agent/templates/AGENTS-block.md.tpl +6 -23
- package/agent/templates/AGENTS-block.site.md.tpl +5 -18
- package/agent/templates/AGENTS-block.tokens.md.tpl +3 -7
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/agent/templates/_app-error.i18n.tpl +8 -32
- package/agent/templates/_app-error.tpl +8 -32
- package/agent/templates/_app-pending.i18n.tpl +5 -3
- package/agent/templates/_app-pending.tpl +5 -4
- package/agent/templates/main.i18n.tpl +8 -3
- package/agent/templates/main.tpl +8 -3
- package/agent/templates/router.start.tpl +8 -3
- package/agent/templates/seed-messages.json +0 -30
- package/configs/oxlint-app.json +9 -1
- package/configs/oxlint-bridge.json +3 -1
- package/configs/oxlint-parts.json +9 -1
- package/configs/oxlint-site.json +3 -1
- package/dist/astro/shiki.d.ts +3 -2
- package/dist/astro/shiki.d.ts.map +1 -1
- package/dist/cards/bar-list.d.ts.map +1 -1
- package/dist/cards/bar-list.js +2 -1
- package/dist/cards/chain-view.d.ts +37 -8
- package/dist/cards/chain-view.d.ts.map +1 -1
- package/dist/cards/chain-view.js +105 -38
- package/dist/cards/contract.d.ts +8 -1
- package/dist/cards/contract.d.ts.map +1 -1
- package/dist/cards/data-panel.d.ts.map +1 -1
- package/dist/cards/data-panel.js +1 -0
- package/dist/cards/event-list.d.ts.map +1 -1
- package/dist/cards/event-list.js +3 -2
- package/dist/cards/index.d.ts +1 -1
- package/dist/cards/index.d.ts.map +1 -1
- package/dist/cards/row-list.d.ts.map +1 -1
- package/dist/cards/row-list.js +2 -1
- package/dist/cards/stat-card-parts.d.ts +3 -3
- package/dist/cards/stat-card-parts.d.ts.map +1 -1
- package/dist/cards/stat-card-parts.js +8 -2
- package/dist/cards/stat-card.d.ts.map +1 -1
- package/dist/cards/stat-card.js +34 -9
- package/dist/charts/core/compile.d.ts +2 -0
- package/dist/charts/core/compile.d.ts.map +1 -1
- package/dist/charts/core/compile.js +16 -8
- package/dist/charts/core/cursor.d.ts +2 -1
- package/dist/charts/core/cursor.d.ts.map +1 -1
- package/dist/charts/core/cursor.js +8 -1
- package/dist/charts/core/tooltip-said.d.ts +16 -0
- package/dist/charts/core/tooltip-said.d.ts.map +1 -0
- package/dist/charts/core/tooltip-said.js +39 -0
- package/dist/charts/focus.d.ts.map +1 -1
- package/dist/charts/focus.js +1 -1
- package/dist/charts/parts/chart-card.d.ts.map +1 -1
- package/dist/charts/parts/chart-card.js +1 -0
- package/dist/cli/agent-note.d.ts +3 -3
- package/dist/cli/agent-note.d.ts.map +1 -1
- package/dist/cli/agent-note.js +5 -5
- package/dist/cli/budget/index.d.ts +7 -0
- package/dist/cli/budget/index.d.ts.map +1 -1
- package/dist/cli/budget/index.js +11 -5
- package/dist/cli/config.d.ts +1 -1
- package/dist/cli/doctor/app.d.ts.map +1 -1
- package/dist/cli/doctor/app.js +53 -24
- package/dist/cli/doctor/eject.d.ts.map +1 -1
- package/dist/cli/doctor/eject.js +16 -9
- package/dist/cli/doctor/guards.d.ts.map +1 -1
- package/dist/cli/doctor/guards.js +11 -8
- package/dist/cli/doctor/hook.js +1 -1
- package/dist/cli/doctor/install.d.ts.map +1 -1
- package/dist/cli/doctor/install.js +46 -22
- package/dist/cli/doctor/translations.d.ts.map +1 -1
- package/dist/cli/doctor/translations.js +11 -4
- package/dist/cli/doctor/types.d.ts +2 -2
- package/dist/cli/doctor/types.d.ts.map +1 -1
- package/dist/cli/doctor/types.js +1 -1
- package/dist/cli/doctor/wiring.d.ts.map +1 -1
- package/dist/cli/doctor/wiring.js +26 -15
- package/dist/cli/eject/dropped-slots.d.ts +6 -0
- package/dist/cli/eject/dropped-slots.d.ts.map +1 -0
- package/dist/cli/eject/dropped-slots.js +9 -0
- package/dist/cli/eject/index.d.ts.map +1 -1
- package/dist/cli/eject/index.js +9 -8
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +7 -2
- package/dist/cli/index.d.ts +6 -5
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +38 -7
- package/dist/cli/init/index.d.ts +10 -0
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/index.js +61 -10
- package/dist/cli/init/locales.d.ts +7 -0
- package/dist/cli/init/locales.d.ts.map +1 -1
- package/dist/cli/init/locales.js +21 -6
- package/dist/cli/init/router-seeds.d.ts.map +1 -1
- package/dist/cli/init/router-seeds.js +16 -3
- package/dist/cli/init/steps.d.ts +36 -3
- package/dist/cli/init/steps.d.ts.map +1 -1
- package/dist/cli/init/steps.js +201 -34
- package/dist/cli/lint/baseline.d.ts +27 -0
- package/dist/cli/lint/baseline.d.ts.map +1 -0
- package/dist/cli/lint/baseline.js +96 -0
- package/dist/cli/lint/engine.d.ts +2 -0
- package/dist/cli/lint/engine.d.ts.map +1 -1
- package/dist/cli/lint/engine.js +18 -8
- package/dist/cli/lint/hook.d.ts.map +1 -1
- package/dist/cli/lint/hook.js +8 -3
- package/dist/cli/lint/index.d.ts +3 -0
- package/dist/cli/lint/index.d.ts.map +1 -1
- package/dist/cli/lint/index.js +67 -8
- package/dist/cli/manifest.d.ts +46 -3
- package/dist/cli/manifest.d.ts.map +1 -1
- package/dist/cli/manifest.js +71 -1
- package/dist/cli/migrate/census.d.ts +6 -0
- package/dist/cli/migrate/census.d.ts.map +1 -1
- package/dist/cli/migrate/census.js +22 -1
- package/dist/cli/migrate/index.d.ts +5 -0
- package/dist/cli/migrate/index.d.ts.map +1 -1
- package/dist/cli/migrate/index.js +36 -3
- package/dist/cli/migrate/lost-classes.d.ts +20 -0
- package/dist/cli/migrate/lost-classes.d.ts.map +1 -0
- package/dist/cli/migrate/lost-classes.js +145 -0
- package/dist/cli/migrate/rows.d.ts +10 -0
- package/dist/cli/migrate/rows.d.ts.map +1 -1
- package/dist/cli/migrate/rows.js +15 -0
- package/dist/cli/package-manager.d.ts.map +1 -1
- package/dist/cli/package-manager.js +2 -1
- package/dist/cli/peers.d.ts +2 -0
- package/dist/cli/peers.d.ts.map +1 -1
- package/dist/cli/peers.js +7 -0
- package/dist/cli/presets.d.ts.map +1 -1
- package/dist/cli/presets.js +27 -11
- package/dist/cli/resolver.d.ts +13 -4
- package/dist/cli/resolver.d.ts.map +1 -1
- package/dist/cli/resolver.js +39 -5
- package/dist/cli/router-wiring.d.ts +1 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +1 -1
- package/dist/cli/sync/engine.d.ts +8 -1
- package/dist/cli/sync/engine.d.ts.map +1 -1
- package/dist/cli/sync/engine.js +25 -14
- package/dist/cli/sync/index.d.ts.map +1 -1
- package/dist/cli/sync/index.js +7 -4
- package/dist/cli/sync/render.d.ts.map +1 -1
- package/dist/cli/sync/render.js +21 -28
- package/dist/cli/tokens-css.d.ts +2 -0
- package/dist/cli/tokens-css.d.ts.map +1 -1
- package/dist/cli/tokens-css.js +28 -6
- package/dist/controls/contract.d.ts +2 -1
- package/dist/controls/contract.d.ts.map +1 -1
- package/dist/controls/control-home.d.ts +4 -1
- package/dist/controls/control-home.d.ts.map +1 -1
- package/dist/controls/control-home.js +5 -3
- package/dist/controls/local-control.d.ts +28 -1
- package/dist/controls/local-control.d.ts.map +1 -1
- package/dist/controls/local-control.js +14 -2
- package/dist/core/cn.d.ts.map +1 -1
- package/dist/core/cn.js +6 -5
- package/dist/core/frame-figure.d.ts +2 -0
- package/dist/core/frame-figure.d.ts.map +1 -1
- package/dist/core/frame-figure.js +5 -2
- package/dist/core/frame-head.d.ts +3 -1
- package/dist/core/frame-head.d.ts.map +1 -1
- package/dist/core/frame-head.js +28 -7
- package/dist/core/frame-regions.d.ts +1 -1
- package/dist/core/frame-regions.d.ts.map +1 -1
- package/dist/core/frame-regions.js +18 -8
- package/dist/core/info-hint.d.ts +5 -0
- package/dist/core/info-hint.d.ts.map +1 -1
- package/dist/core/info-hint.js +22 -1
- package/dist/core/mark-tone.d.ts +6 -2
- package/dist/core/mark-tone.d.ts.map +1 -1
- package/dist/core/mark-tone.js +1 -1
- package/dist/core/mark-types.d.ts +4 -2
- package/dist/core/mark-types.d.ts.map +1 -1
- package/dist/core/messages/chain.d.ts +2 -1
- package/dist/core/messages/chain.d.ts.map +1 -1
- package/dist/core/messages/chain.js +1 -0
- package/dist/core/messages/index.d.ts +2 -1
- package/dist/core/messages/index.d.ts.map +1 -1
- package/dist/core/messages/index.js +2 -0
- package/dist/core/messages/runs.d.ts +20 -0
- package/dist/core/messages/runs.d.ts.map +1 -0
- package/dist/core/messages/runs.js +18 -0
- package/dist/core/phase.d.ts +25 -2
- package/dist/core/phase.d.ts.map +1 -1
- package/dist/core/ports.d.ts +4 -1
- package/dist/core/ports.d.ts.map +1 -1
- package/dist/core/provider.d.ts +3 -1
- package/dist/core/provider.d.ts.map +1 -1
- package/dist/core/provider.js +5 -3
- package/dist/core/scheme.d.ts +2 -1
- package/dist/core/scheme.d.ts.map +1 -1
- package/dist/core/scheme.js +1 -0
- package/dist/core/spark/mini-bars.d.ts +6 -4
- package/dist/core/spark/mini-bars.d.ts.map +1 -1
- package/dist/core/spark/mini-bars.js +36 -11
- package/dist/core/spark/sparkline.d.ts +2 -2
- package/dist/core/spark/sparkline.d.ts.map +1 -1
- package/dist/core/spark/sparkline.js +21 -2
- package/dist/css/bridge.css +63 -0
- package/dist/css/generate.d.ts +2 -2
- package/dist/css/generate.d.ts.map +1 -1
- package/dist/css/generate.js +25 -0
- package/dist/data/live/live-query.d.ts +2 -2
- package/dist/data/live/live-query.d.ts.map +1 -1
- package/dist/data/live/live-query.js +2 -1
- package/dist/lint/preset.d.ts +12 -3
- package/dist/lint/preset.d.ts.map +1 -1
- package/dist/lint/preset.js +30 -10
- package/dist/lint/rules/class/table.d.ts.map +1 -1
- package/dist/lint/rules/class/table.js +3 -1
- package/dist/lint/rules/structure/control-home.js +1 -1
- package/dist/lint/rules/structure/import-boundary.d.ts.map +1 -1
- package/dist/lint/rules/structure/import-boundary.js +2 -0
- package/dist/lint/rules/structure/label-literal.d.ts.map +1 -1
- package/dist/lint/rules/structure/label-literal.js +1 -1
- package/dist/lint/shadcn.d.ts +562 -0
- package/dist/lint/shadcn.d.ts.map +1 -0
- package/dist/lint/shadcn.js +52 -0
- package/dist/lint/stylelint/render.d.ts +3 -1
- package/dist/lint/stylelint/render.d.ts.map +1 -1
- package/dist/lint/stylelint/render.js +23 -2
- package/dist/lint/stylelint/rules.d.ts +3 -2
- package/dist/lint/stylelint/rules.d.ts.map +1 -1
- package/dist/lint/stylelint/rules.js +11 -6
- package/dist/lint/weakened.d.ts +8 -0
- package/dist/lint/weakened.d.ts.map +1 -1
- package/dist/lint/weakened.js +44 -1
- package/dist/messages/de.d.ts.map +1 -1
- package/dist/messages/de.js +15 -0
- package/dist/messages/es.d.ts.map +1 -1
- package/dist/messages/es.js +15 -0
- package/dist/messages/fr.d.ts.map +1 -1
- package/dist/messages/fr.js +15 -0
- package/dist/messages/zh-hans.d.ts.map +1 -1
- package/dist/messages/zh-hans.js +15 -0
- package/dist/page/bar-title.d.ts +25 -0
- package/dist/page/bar-title.d.ts.map +1 -0
- package/dist/page/bar-title.js +10 -0
- package/dist/page/contract.d.ts +11 -1
- package/dist/page/contract.d.ts.map +1 -1
- package/dist/page/empty-state.d.ts +5 -2
- package/dist/page/empty-state.d.ts.map +1 -1
- package/dist/page/empty-state.js +14 -3
- package/dist/page/facts.d.ts +19 -2
- package/dist/page/facts.d.ts.map +1 -1
- package/dist/page/facts.js +26 -5
- package/dist/page/index.d.ts +8 -0
- package/dist/page/index.d.ts.map +1 -1
- package/dist/page/index.js +9 -0
- package/dist/page/page-bar.d.ts.map +1 -1
- package/dist/page/page-bar.js +2 -7
- package/dist/page/page-summary.d.ts +2 -1
- package/dist/page/page-summary.d.ts.map +1 -1
- package/dist/page/page-summary.js +1 -1
- package/dist/page/run-button.d.ts +26 -0
- package/dist/page/run-button.d.ts.map +1 -0
- package/dist/page/run-button.js +31 -0
- package/dist/page/run-list.d.ts +28 -0
- package/dist/page/run-list.d.ts.map +1 -0
- package/dist/page/run-list.js +88 -0
- package/dist/page/run-queue.d.ts +78 -0
- package/dist/page/run-queue.d.ts.map +1 -0
- package/dist/page/run-queue.js +93 -0
- package/dist/page/section.d.ts +6 -1
- package/dist/page/section.d.ts.map +1 -1
- package/dist/page/section.js +34 -16
- package/dist/shell/commands/command-palette.d.ts.map +1 -1
- package/dist/shell/commands/command-palette.js +5 -1
- package/dist/shell/parts/header.js +1 -1
- package/dist/surfaces.d.ts +15 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +19 -2
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +3 -0
- package/dist/testing/pseudo-locale.d.ts +41 -0
- package/dist/testing/pseudo-locale.d.ts.map +1 -0
- package/dist/testing/pseudo-locale.js +74 -0
- package/dist/testing/quality.d.ts +6 -0
- package/dist/testing/quality.d.ts.map +1 -1
- package/dist/testing/quality.js +139 -1
- package/dist/tokens/bridge-sheet.d.ts +21 -0
- package/dist/tokens/bridge-sheet.d.ts.map +1 -0
- package/dist/tokens/bridge-sheet.js +68 -0
- package/dist/tokens/emit.d.ts +6 -1
- package/dist/tokens/emit.d.ts.map +1 -1
- package/dist/tokens/emit.js +26 -1
- package/dist/ui/accordion.js +1 -1
- package/dist/ui/card.d.ts +32 -4
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +26 -3
- package/dist/ui/collapsible.d.ts +4 -2
- package/dist/ui/collapsible.d.ts.map +1 -1
- package/dist/ui/collapsible.js +1 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/meter.d.ts +34 -3
- package/dist/ui/meter.d.ts.map +1 -1
- package/dist/ui/meter.guard.d.ts +2 -0
- package/dist/ui/meter.guard.d.ts.map +1 -1
- package/dist/ui/meter.guard.js +20 -0
- package/dist/ui/meter.js +23 -7
- package/dist/ui/primitive.contract.d.ts.map +1 -1
- package/dist/ui/primitive.contract.js +7 -0
- package/dist/ui/remote-pad.d.ts +62 -0
- package/dist/ui/remote-pad.d.ts.map +1 -0
- package/dist/ui/remote-pad.guard.d.ts +21 -0
- package/dist/ui/remote-pad.guard.d.ts.map +1 -0
- package/dist/ui/remote-pad.guard.js +6 -0
- package/dist/ui/remote-pad.js +148 -0
- package/dist/ui/segmented.d.ts.map +1 -1
- package/dist/ui/segmented.js +4 -0
- package/dist/ui/skeleton.d.ts +9 -4
- package/dist/ui/skeleton.d.ts.map +1 -1
- package/dist/ui/skeleton.guard.d.ts +6 -2
- package/dist/ui/skeleton.guard.d.ts.map +1 -1
- package/dist/ui/skeleton.guard.js +4 -0
- package/dist/ui/skeleton.js +2 -1
- package/dist/ui/slots.d.ts +2 -1
- package/dist/ui/slots.d.ts.map +1 -1
- package/dist/ui/slots.js +2 -1
- package/dist/vite/allotment.d.ts +1 -1
- package/dist/vite/allotment.d.ts.map +1 -1
- package/dist/vite/allotment.js +15 -1
- package/dist/vite/doc.d.ts +1 -1
- package/dist/vite/doc.d.ts.map +1 -1
- package/dist/vite/doc.js +12 -2
- package/dist/vite/head.d.ts +4 -3
- package/dist/vite/head.d.ts.map +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +4 -1
- package/dist/vite/shell-worker.d.ts +6 -0
- package/dist/vite/shell-worker.d.ts.map +1 -0
- package/dist/vite/shell-worker.js +92 -0
- package/docs/astro.md +19 -4
- package/docs/bar-list.md +3 -2
- package/docs/bar-title.md +33 -0
- package/docs/basalt-provider.md +2 -1
- package/docs/card.md +24 -4
- package/docs/chain-view.md +12 -7
- package/docs/chart-card.md +3 -2
- package/docs/collapsible.md +4 -2
- package/docs/control-home.md +4 -2
- package/docs/create-run-queue.md +40 -0
- package/docs/data-panel.md +3 -2
- package/docs/de.md +1 -1
- package/docs/empty-state.md +3 -1
- package/docs/es.md +1 -1
- package/docs/event-list.md +3 -2
- package/docs/fact.md +6 -1
- package/docs/facts.md +5 -1
- package/docs/fr.md +1 -1
- package/docs/live-query.md +1 -1
- package/docs/meter.md +17 -13
- package/docs/mini-bars.md +7 -5
- package/docs/pseudo-basalt-messages.md +30 -0
- package/docs/pseudo-messages.md +27 -0
- package/docs/quality.md +2 -1
- package/docs/recipes/localise-app.md +2 -2
- package/docs/remote-pad.md +40 -0
- package/docs/row-list.md +3 -2
- package/docs/run-button.md +45 -0
- package/docs/run-list.md +71 -0
- package/docs/section.md +7 -1
- package/docs/set-scheme.md +2 -2
- package/docs/skeleton.md +4 -3
- package/docs/slots.md +1 -1
- package/docs/sparkline.md +5 -2
- package/docs/stat-card.md +6 -4
- package/docs/testing.md +64 -0
- package/docs/use-local-control.md +8 -1
- package/docs/use-runs.md +32 -0
- package/docs/vite.md +12 -2
- package/docs/zh-hans.md +1 -1
- package/llms.txt +88 -21
- package/migrations/areas/shadcn.json +338 -0
- package/package.json +9 -2
- package/src/astro/shiki.ts +3 -1
- package/src/cards/bar-list.tsx +2 -1
- package/src/cards/chain-view.tsx +167 -55
- package/src/cards/contract.ts +8 -1
- package/src/cards/data-panel.tsx +1 -0
- package/src/cards/event-list.tsx +2 -1
- package/src/cards/index.ts +1 -0
- package/src/cards/row-list.tsx +2 -1
- package/src/cards/stat-card-parts.tsx +9 -7
- package/src/cards/stat-card.tsx +39 -12
- package/src/charts/core/compile.ts +31 -19
- package/src/charts/core/cursor.ts +11 -3
- package/src/charts/core/tooltip-said.ts +55 -0
- package/src/charts/focus.tsx +4 -1
- package/src/charts/parts/chart-card.tsx +1 -0
- package/src/cli/agent-note.ts +12 -5
- package/src/cli/budget/index.ts +22 -5
- package/src/cli/config.ts +1 -1
- package/src/cli/doctor/app.ts +75 -23
- package/src/cli/doctor/eject.ts +30 -10
- package/src/cli/doctor/guards.ts +11 -8
- package/src/cli/doctor/hook.ts +1 -1
- package/src/cli/doctor/install.ts +61 -24
- package/src/cli/doctor/translations.ts +13 -4
- package/src/cli/doctor/types.ts +2 -3
- package/src/cli/doctor/wiring.ts +30 -16
- package/src/cli/eject/dropped-slots.ts +11 -0
- package/src/cli/eject/index.ts +13 -9
- package/src/cli/help.ts +34 -10
- package/src/cli/index.ts +56 -14
- package/src/cli/init/index.ts +64 -5
- package/src/cli/init/locales.ts +41 -8
- package/src/cli/init/router-seeds.ts +17 -3
- package/src/cli/init/steps.ts +308 -41
- package/src/cli/lint/baseline.ts +141 -0
- package/src/cli/lint/engine.ts +33 -10
- package/src/cli/lint/hook.ts +11 -3
- package/src/cli/lint/index.ts +77 -12
- package/src/cli/manifest.ts +132 -4
- package/src/cli/migrate/census.ts +35 -1
- package/src/cli/migrate/index.ts +46 -3
- package/src/cli/migrate/lost-classes.ts +203 -0
- package/src/cli/migrate/rows.ts +21 -0
- package/src/cli/package-manager.ts +4 -1
- package/src/cli/peers.ts +11 -0
- package/src/cli/presets.ts +32 -11
- package/src/cli/resolver.ts +58 -10
- package/src/cli/router-wiring.ts +3 -1
- package/src/cli/sync/engine.ts +30 -14
- package/src/cli/sync/index.ts +7 -4
- package/src/cli/sync/render.ts +29 -37
- package/src/cli/tokens-css.ts +42 -5
- package/src/controls/contract.ts +2 -0
- package/src/controls/control-home.tsx +15 -4
- package/src/controls/local-control.ts +49 -3
- package/src/core/cn.ts +9 -5
- package/src/core/frame-figure.tsx +7 -1
- package/src/core/frame-head.tsx +32 -6
- package/src/core/frame-regions.tsx +18 -8
- package/src/core/info-hint.tsx +26 -0
- package/src/core/mark-tone.ts +10 -3
- package/src/core/mark-types.ts +4 -2
- package/src/core/messages/chain.ts +2 -1
- package/src/core/messages/index.ts +4 -0
- package/src/core/messages/runs.ts +40 -0
- package/src/core/phase.ts +22 -2
- package/src/core/ports.ts +13 -1
- package/src/core/provider.tsx +7 -3
- package/src/core/scheme.ts +6 -2
- package/src/core/spark/mini-bars.tsx +59 -15
- package/src/core/spark/sparkline.tsx +26 -4
- package/src/css/bridge.css +63 -0
- package/src/css/generate.ts +40 -3
- package/src/data/live/live-query.ts +4 -3
- package/src/lint/preset.ts +52 -13
- package/src/lint/rules/class/table.ts +3 -1
- package/src/lint/rules/structure/control-home.ts +1 -1
- package/src/lint/rules/structure/import-boundary.ts +2 -0
- package/src/lint/rules/structure/label-literal.ts +3 -1
- package/src/lint/shadcn.ts +91 -0
- package/src/lint/stylelint/render.ts +31 -1
- package/src/lint/stylelint/rules.ts +19 -7
- package/src/lint/weakened.ts +59 -1
- package/src/messages/de.ts +20 -0
- package/src/messages/es.ts +20 -0
- package/src/messages/fr.ts +20 -0
- package/src/messages/zh-hans.ts +20 -0
- package/src/page/bar-title.tsx +35 -0
- package/src/page/contract.ts +11 -1
- package/src/page/empty-state.tsx +18 -8
- package/src/page/facts.tsx +43 -5
- package/src/page/index.ts +8 -0
- package/src/page/page-bar.tsx +2 -9
- package/src/page/page-summary.tsx +4 -3
- package/src/page/run-button.tsx +52 -0
- package/src/page/run-list.tsx +151 -0
- package/src/page/run-queue.ts +185 -0
- package/src/page/section.tsx +30 -5
- package/src/shell/commands/command-palette.tsx +10 -1
- package/src/shell/parts/header.tsx +1 -1
- package/src/surfaces.ts +18 -1
- package/src/testing/index.ts +1 -0
- package/src/testing/pseudo-locale.ts +149 -0
- package/src/testing/quality.ts +188 -0
- package/src/tokens/bridge-sheet.ts +80 -0
- package/src/tokens/emit.ts +45 -6
- package/src/ui/accordion.tsx +1 -1
- package/src/ui/card.tsx +56 -6
- package/src/ui/collapsible.tsx +5 -3
- package/src/ui/combobox.tsx +1 -1
- package/src/ui/meter.guard.ts +23 -0
- package/src/ui/meter.tsx +76 -27
- package/src/ui/no-restyle.generated.json +8 -0
- package/src/ui/primitive.contract.ts +7 -0
- package/src/ui/remote-pad.guard.ts +24 -0
- package/src/ui/remote-pad.tsx +249 -0
- package/src/ui/segmented.tsx +6 -0
- package/src/ui/skeleton.guard.ts +7 -2
- package/src/ui/skeleton.tsx +10 -4
- package/src/ui/slots.ts +2 -1
- package/src/vite/allotment.ts +15 -1
- package/src/vite/doc.ts +12 -2
- package/src/vite/head.ts +4 -3
- package/src/vite/index.ts +4 -1
- package/src/vite/shell-worker.ts +115 -0
package/agent/rules/basalt-ui.md
CHANGED
|
@@ -19,11 +19,11 @@ Compose the shipped surface; each bullet names the lint id or type that holds it
|
|
|
19
19
|
|
|
20
20
|
- Use the primitive for a control, a checkable input, a heading and a table; never the raw element. [lint:primitive-bypass]
|
|
21
21
|
- A static table is the table primitive; data is `DataTable`; hand-drawn chart marks are a chart kind. [lint:primitive-bypass]
|
|
22
|
-
- A surface the app draws itself (a game table, a seating plan) lives in one directory listed under `bespoke` in `.basalt/manifest.json`, then `basalt-ui sync`; there a mark is placed from state through a custom property a class reads (`style={{ '--x': … }}` with `left-(--x)`) or drawn as SVG, and every other rule still runs, so an inline `left
|
|
22
|
+
- A surface the app draws itself (a game table, a seating plan) lives in one directory listed under `bespoke` in `.basalt/manifest.json`, then `basalt-ui sync`; there a mark is placed from state through a custom property a class reads (`style={{ '--x': … }}` with `left-(--x)`) or drawn as SVG, a stylesheet may paint a background, border, outline or shadow with a status, chart or brand token and size a grid track by a length, and every other rule still runs, so an inline `left`, a raw control or a hex still fails. [lint:primitive-bypass]
|
|
23
23
|
- A scroll region is the scroll primitive, or the page owns the scroll; never a raw overflow box. [lint:raw-scroll]
|
|
24
24
|
- An icon prop takes any component with the `IconComponent` shape; the recommended set is `lucide-react`, passed as its component (`icon={Users}`). [type:IconComponent]
|
|
25
25
|
- A figure, date or list a reader sees goes through `useFormat()` (`createFormat` outside React); never `Intl`, `toFixed`, `toLocaleString` or a date library's format call. [lint:format-home]
|
|
26
|
-
- With two or more manifest `locales`, every visible word comes from the app's catalogue, in a declaration's label too; never a literal. [lint:label-literal]
|
|
26
|
+
- With two or more manifest `locales`, every visible word comes from the app's catalogue, in a declaration's label too; never a literal. A `site` root has no catalogue: its words sit in the `.ts` modules named in manifest `wordModules`. [lint:label-literal]
|
|
27
27
|
- A link prop takes `LinkHref`; install `routerDefaults().link` once on `BasaltProvider link`, never per prop; without it a target is a plain anchor. [type:LinkComponent]
|
|
28
28
|
|
|
29
29
|
## Layout
|
|
@@ -34,7 +34,7 @@ Compose the shipped surface; each bullet names the lint id or type that holds it
|
|
|
34
34
|
|
|
35
35
|
## Waivers and gates
|
|
36
36
|
|
|
37
|
-
- A waiver is `// oxlint-disable-next-line basalt/<id> -- <why>` on the line; a file-level waiver exists only for the deep-render paths the manifest declares. Every waiver and seam use (own cell, custom marks or series, own frame content, a hand-built card frame, custom field, filter slot, shell entry, declared control kind, form control, a tree row's own icon, badge or trailing) is a line of `.basalt/record.txt` that review reads, with no ceiling: use one only where no shipped part fits, then run `basalt-ui lint --stats` and commit the file (`sync --check` fails while it is stale). [lint:waiver-needs-reason]
|
|
37
|
+
- A waiver is `// oxlint-disable-next-line basalt/<id> -- <why>` on the line; a file-level waiver exists only for the deep-render paths the manifest declares. Every waiver and seam use (own cell, custom marks or series, own frame content, a hand-built card frame, custom field, filter slot, shell entry, declared control kind, form control, a tree row's own icon, badge or trailing) is a line of `.basalt/record.txt` that review reads, with no ceiling: use one only where no shipped part fits, then run `basalt-ui lint --stats` and commit the file (`sync --check` fails while it is stale). `.basalt/baseline.json` holds what an app had when it adopted the guards and only goes down: never write one to pass your own code, and after fixing a held finding run `lint --stats` and commit it. [lint:waiver-needs-reason]
|
|
38
38
|
|
|
39
39
|
not guarded:
|
|
40
40
|
|
|
@@ -8,12 +8,12 @@ Define every query under `src/queries/`, one file per domain: `runsQuery`, or `r
|
|
|
8
8
|
|
|
9
9
|
## The ladder
|
|
10
10
|
|
|
11
|
-
Pick the least live class
|
|
11
|
+
Pick the least live class true for the data; each rung costs more than the one above.
|
|
12
12
|
|
|
13
13
|
- `liveQuery(options, 'static')` for data that changes only when the user changes it: staleTime is `Infinity`, so a global refresh or an explicit invalidate still reaches it; a push reaches only `pushed` queries. [lint:data-primitive]
|
|
14
14
|
- `liveQuery(options, 'standard')` for cross-device data: refetch on focus when older than 30 s.
|
|
15
15
|
- `{ class: 'ticker', every }` when the server cannot push: `every` counts from the previous result (a number or `(query) => number | false`), the tick pauses while hidden, offline, mutating (`pauseWhileMutating`) or after a 401/403. `external: true` for a third-party source; `background: true` only for a wall display.
|
|
16
|
-
- `{ class: 'pushed', fallback, safety }` when a channel carries
|
|
16
|
+
- `{ class: 'pushed', fallback, safety }` when a channel carries changes: `fallback` polls while the stream is down, `safety` polls while it is (`false`: never), and it is the only bound on a silent lag.
|
|
17
17
|
- Never write `refetchInterval` or `refetchIntervalInBackground`, on a query or as a spread at the call site; the cadence belongs to the class in the query factory. [lint:data-primitive]
|
|
18
18
|
- Never write a timer that invalidates or refetches; a plain `setInterval` for a clock is fine. [lint:data-primitive]
|
|
19
19
|
- Never write `staleTime: 'static'` inside a `liveQuery` argument: a `'static'` observer makes the query immune to `invalidateQueries`, so a pushed invalidation, a global refresh and a deploy all skip it. [lint:data-primitive]
|
|
@@ -81,8 +81,8 @@ export function useLive(): void {
|
|
|
81
81
|
## Cursorless mode
|
|
82
82
|
|
|
83
83
|
- No `resume` and no ids: every reconnect after the stream was live is a `reset: 'gap'`, and `onGap` decides what that invalidates (default `'all'`; pass a predicate to spare an expensive root).
|
|
84
|
-
- `pushed.safety` is mandatory here and the only bound on silent loss; set it to the longest age the page may show
|
|
85
|
-
- Two optional server changes
|
|
84
|
+
- `pushed.safety` is mandatory here and the only bound on silent loss; set it to the longest age the page may show, never `false`.
|
|
85
|
+
- Two optional server changes make that bound a detected gap: an `id:` per event and a `lagged` signal.
|
|
86
86
|
|
|
87
87
|
## Offline semantics
|
|
88
88
|
|
|
@@ -32,7 +32,7 @@ In a sibling app, import nothing from the old app into the new one; the new app'
|
|
|
32
32
|
|
|
33
33
|
1. Choose the shape, then put the app on the last 2.x release with its gate green.
|
|
34
34
|
2. Set up the 3.x install: a sibling app by [setup](setup.md), a branch by [From a 2.x install](#from-a-2x-install-to-a-3x-one).
|
|
35
|
-
3. List the rows: `./node_modules/.bin/basalt-ui migrate --from <version> --profile <profile>`. It reads the tree and never writes. `--json` gives the same report as data (`schema: 1`: `rows`, `tokens`, `storage`, `urls`, `attrs`, `rules`, `unmapped`, `unknownKeys`, `failures`). Each row carries `at`, the `file:line` sites the census found.
|
|
35
|
+
3. List the rows: `./node_modules/.bin/basalt-ui migrate --from <version> --profile <profile>`. It reads the tree and never writes. `--json` gives the same report as data (`schema: 1`: `rows`, `tokens`, `storage`, `urls`, `attrs`, `rules`, `unmapped`, `unknownKeys`, `failures`, `lostClasses`, `movedBreakpoints`). Each row carries `at`, the `file:line` sites the census found.
|
|
36
36
|
4. Keep a ledger in the app, `MIGRATION.md` at its root. It has one line per row id: `<id> done`, `<id> waived: <why>` or `<id> n/a: <why>`. Commit it with each area and delete it in the cutover PR; a port that a basalt-ui verdict will judge keeps it until the verdict has read it.
|
|
37
37
|
5. Work the areas in this order, because an earlier area's errors cascade into every later one: specifier moves and renames, tokens, wiring (vite, router, shell), removed exports, then components, controls and forms, charts, tables, content and state.
|
|
38
38
|
6. After each area, run `tsc`, `basalt-ui lint`, `basalt-ui doctor` and `./node_modules/.bin/basalt-ui migrate --from <version> --profile <profile> --check`, then commit the area. Run that check before every push: it exits 1 while a removed symbol is still imported, a legacy scheme selector remains, or a legacy storage or URL key has no row.
|
|
@@ -99,7 +99,7 @@ A row that does not fit a site is never forced. Write the site by hand against `
|
|
|
99
99
|
|
|
100
100
|
- `valueShifts`: a token whose value moved on purpose (line heights close to the scale: 12, 13, 15, 16 and 18 px keep their size and lose the 1.55 ratio). It is a density change, not a defect; the baseline commit names each image and its row.
|
|
101
101
|
- Size names collide: 2.x `md` is 15 px and `lg` is 16 px, while 3.x `base` is 16 px and `md` is 15 px. Map by pixels, not by name.
|
|
102
|
-
-
|
|
102
|
+
- Classes that emit nothing: the theme clears Tailwind's names, so `sm:`, `rounded-lg` or `bg-blue-500` build green and draw nothing. `migrate` counts them; each ends rewritten (`@narrow:`, a theme name) or restored by `@import 'basalt-ui/bridge.css';` (colors are not). `md:` and `xl:` emit at 840px and 1200px.
|
|
103
103
|
- Storage and URL rows: a `storage` row names the legacy key and what reads it (`read-legacy` keeps an old value alive); a key with no row fails `--check`. Migrate the key in the cutover PR itself.
|
|
104
104
|
- Margin and padding in app code become `Inset`, `Section` and `Card` slots, because the app-spacing rule denies a margin outside a primitive.
|
|
105
105
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Set up a basalt-ui app
|
|
2
2
|
|
|
3
|
-
The CLI places files and checks; you make the edits. `init` writes what does not exist yet, and edits a file the app owns only while that file is still untouched stock: create-vite 9 `react-ts`, create-astro `minimal` or `framework-react`, or what `init` itself wrote before. It leaves any other file as it is and prints a `kept` line for it. Two edits are structural instead: an ignore file gains the lines it lacks, and a strict-JSON `.oxlintrc.json` or `.oxfmtrc.json` gains the keys it lacks; a commented one is left, with a `to do` line. `doctor` then names each step still open. Never edit a file back to the stock form so that `init` patches it. On a create-vite app it also deletes the demo files nothing uses (`App.*`, `src/assets`, `public/icons.svg`, the Vite favicon and its link), each only while its bytes are create-vite's.
|
|
3
|
+
The CLI places files and checks; you make the edits. `init` writes what does not exist yet, and edits a file the app owns only while that file is still untouched stock: create-vite 9 `react-ts`, create-astro `minimal` or `framework-react`, or what `init` itself wrote before. It leaves any other file as it is and prints a `kept` line for it. Two edits are structural instead: an ignore file gains the lines it lacks, and a strict-JSON `.oxlintrc.json` or `.oxfmtrc.json` gains the keys it lacks; a commented one is left, with a `to do` line; so are an `oxfmt.config.ts` and a Makefile gate. `doctor` then names each step still open. Never edit a file back to the stock form so that `init` patches it. On a create-vite app it also deletes the demo files nothing uses (`App.*`, `src/assets`, `public/icons.svg`, the Vite favicon and its link), each only while its bytes are create-vite's.
|
|
4
4
|
|
|
5
5
|
## 1. Install and init
|
|
6
6
|
|
|
7
7
|
On a 2.x repo, start at [migrate](migrate.md#from-a-2x-install-to-a-3x-one).
|
|
8
8
|
|
|
9
|
-
1. `bun add basalt-ui`, then `./node_modules/.bin/basalt-ui init --profile <profile> [--root src]` once, at the git or workspace
|
|
10
|
-
2. Install basalt-ui and your framework: the engines ship with it. `init` adds the profile's peers; a further export's doc names its `peers` (`basalt-ui/form`: `@tanstack/react-form`). Declare an engine only if your source imports it
|
|
11
|
-
3. `init` writes `tokens.css` (`tokens:css --out`, in the first `--root`) and the series file `src/basalt.tokens.ts`.
|
|
9
|
+
1. `bun add basalt-ui`, then `./node_modules/.bin/basalt-ui init --profile <profile> [--root src]` once, at the git root or in a workspace package. An app in a plain folder of the repo declares `"basalt": { "sibling": true }` first ([migrate](migrate.md#the-sibling-app)), else `init` refuses. Never run it through `bunx`, `init` included. In a workspace, use the app package's own `node_modules/.bin/basalt-ui`. `--no-install` writes the files and prints the install commands instead of running them. An app in a monorepo keeps its block and design record beside it with `--agents <app dir>/AGENTS.md --design <app dir>/DESIGN.md` (manifest keys `agents`, `design`); `report` replaces the block's sentence on where a basalt-ui defect goes.
|
|
10
|
+
2. Install basalt-ui and your framework: the engines ship with it. `init` adds the profile's peers; a further export's doc names its `peers` (`basalt-ui/form`: `@tanstack/react-form`). Declare an engine only if your source imports it, in its range.
|
|
11
|
+
3. `init` writes `tokens.css` (`tokens:css --out`, in the first `--root`) and the series file `src/basalt.tokens.ts`. A `tokens` app imports `tokens.css` and stops here. To retune, run `tokens:css` again with `--accent` or `--neutral`. To change the font stacks, write `fonts:css --out` beside it, imported after `tokens.css`. A standalone HTML document (a template, a report) inlines `tokens:css --pick canvas,ink,…`: those tokens and what they reference, in every scheme block.
|
|
12
12
|
4. Read `init` to its last line. It runs `doctor` and ends by sending you here.
|
|
13
13
|
|
|
14
14
|
## 2. The doctor loop
|
|
@@ -32,13 +32,15 @@ The app has one entry, which its main module imports. It begins exactly like thi
|
|
|
32
32
|
|
|
33
33
|
`tailwind.css` already brings `tailwindcss`, the shipped tokens and the fonts, so import none of them again. The sources path ends at the Vite root. The app's own rules follow the imports. Outside Vite, list your own Tailwind sources.
|
|
34
34
|
|
|
35
|
+
An app that keeps its own components (shadcn, a kit) imports `basalt-ui/bridge.css` straight after `tailwind.css`: it restores the cleared Tailwind names and adds the shadcn ones. Write no app `@theme` block for them; stylelint refuses it.
|
|
36
|
+
|
|
35
37
|
### Viewport
|
|
36
38
|
|
|
37
39
|
`index.html` carries `<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />`: the safe-area insets need `viewport-fit=cover`, and the page never locks zoom.
|
|
38
40
|
|
|
39
41
|
### Router entry
|
|
40
42
|
|
|
41
|
-
`app` profile. Every entry mounts `BasaltProvider` from `basalt-ui/router` once. An app that builds its route tree in code keeps it; under a declared root it needs one `createRouter` call that spreads `routerDefaults().options` and sets `defaultPendingComponent`, `defaultErrorComponent` and `defaultNotFoundComponent` (
|
|
43
|
+
`app` profile. Every entry mounts `BasaltProvider` from `basalt-ui/router` once. An app that builds its route tree in code keeps it; under a declared root it needs one `createRouter` call that spreads `routerDefaults().options` and sets `defaultPendingComponent`, `defaultErrorComponent` and `defaultNotFoundComponent` (as `main.tpl` does), and the `Register` interface. A file-routed app builds its router from `routerDefaults` and declares `Register` ([basalt-provider](node_modules/basalt-ui/docs/basalt-provider.md)). The seeds are in `node_modules/basalt-ui/agent/templates/`: `main.tpl` for the entry, `__root.tpl` and `_app.tpl` for the routes. `basalt-ui/page` (80 kB gzip) stays out of the entry: pending imports none of it, the rest is lazy. Mount the frame once in the `_app` layout route ([app-shell recipe](recipes.md)) and declare `NAV` once with [defineNav](node_modules/basalt-ui/docs/define-nav.md). Gate an authenticated app in the `beforeLoad` of the `_app` layout route, never in the root's, since `login` sits outside `_app` and loaders fire before any gate component renders. A TanStack Start host is `init --profile app --start`. The app owns `@tanstack/react-start` (`bun add` it) and reads `window` and storage only in effects or behind `ClientOnly`.
|
|
42
44
|
|
|
43
45
|
### Lint script
|
|
44
46
|
|
|
@@ -46,7 +48,7 @@ Something runs `basalt-ui lint`, for example `"lint": "<what it ran> && basalt-u
|
|
|
46
48
|
|
|
47
49
|
### Formatter and test lane
|
|
48
50
|
|
|
49
|
-
`init` writes `.oxfmtrc.json` (
|
|
51
|
+
`init` writes `.oxfmtrc.json` (`configs/oxfmt.json` plus the managed paths; none beside `oxfmt.config.ts`), a `format` script (none under a Makefile or `check` gate) and, with oxfmt installed, formats what it wrote; a Prettier repo keeps Prettier. With the `_app` layout it also writes the pages lane: `playwright.config.ts`, `e2e/app.spec.ts` (`quality.axe`, `expectShellInvariants` on `/`) and a `test` script. Run the `install the pages lane` line it prints once (it downloads a browser), then `test`; add routes as the app grows ([testing](testing.md)).
|
|
50
52
|
|
|
51
53
|
### Gate
|
|
52
54
|
|
|
@@ -58,7 +60,7 @@ A file-routed app's `build` runs Vite before `tsc`: `vite build && tsc -b`. `tsc
|
|
|
58
60
|
|
|
59
61
|
### Translations
|
|
60
62
|
|
|
61
|
-
Only with two or more manifest `locales`. `init --profile app --locales en,de` wires the catalogue itself (Lingui, a `.po` per language, `LocalizedProvider`) and starts `check` with `lingui extract --clean && lingui compile --strict`;
|
|
63
|
+
Only with two or more manifest `locales`. `init --profile app --locales en,de` wires the catalogue itself (Lingui, a `.po` per language, `LocalizedProvider`) and starts `check` with `lingui extract --clean && lingui compile --strict`; else, or with `--catalogs`, see [localise-app](recipes.md). Every catalogue holds every message, except a language in the manifest's `partialLocales` that falls back to the source one, and each `BasaltProvider` takes `locale={…}` from one source.
|
|
62
64
|
|
|
63
65
|
### Astro integration
|
|
64
66
|
|
|
@@ -98,4 +100,11 @@ It holds the app's deltas on the shipped rules: at most 150 lines, no color valu
|
|
|
98
100
|
|
|
99
101
|
## 3. After doctor passes
|
|
100
102
|
|
|
101
|
-
Fill in `DESIGN.md` (identity, series dictionary, deviations), then run `bun run check` and fix each finding at its source. In CI, `sync --check`, `doctor` and `tokens:css --out <file> --check` each fail on a stale file.
|
|
103
|
+
Fill in `DESIGN.md` (identity, series dictionary, deviations), then run `bun run check` and fix each finding at its source. In CI, `sync --check`, `doctor` and `tokens:css --out <file> --check` each fail on a stale file. A shallow CI checkout has no base ref for `doctor`'s budget ratchet, which then fails the run. Fetch the base before `doctor`; on a pull request `<base>` is `$GITHUB_BASE_REF`, and a default branch other than `main` or `master` also runs `git remote set-head origin <base>`:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
git fetch --no-tags --depth=1 origin +refs/heads/<base>:refs/remotes/origin/<base>
|
|
107
|
+
git remote set-head origin <base> # a default branch other than main or master
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Screens written before basalt: `basalt-ui lint --baseline` once, then commit `.basalt/baseline.json`; run `lint --stats` after rewriting each screen. The check must call `basalt-ui lint`, and a directory that draws its own surface goes in `bespoke` instead.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Testing: the kit rules
|
|
2
2
|
|
|
3
|
-
`basalt-ui/testing` is for
|
|
3
|
+
`basalt-ui/testing` is for tests and preloads, never an app bundle. See `node_modules/basalt-ui/docs/testing.md` for the kit.
|
|
4
4
|
|
|
5
5
|
## Two lanes
|
|
6
6
|
|
|
@@ -9,23 +9,25 @@
|
|
|
9
9
|
| Parts | `bun test` with a DOM (happy-dom or jsdom) | structure, roles, state, commit counts | `installDomShims`, `settled`, `SLOTS`, `expectCatalog` |
|
|
10
10
|
| Pages | plain Playwright against the built app | geometry, contrast, focus, overflow, the shell frame | `quality` (needs the `@axe-core/playwright` peer), `expectShellInvariants` |
|
|
11
11
|
|
|
12
|
+
- Named-state screenshots, cut labels, pseudo-locale: "Interface tests" in `node_modules/basalt-ui/docs/testing.md`.
|
|
13
|
+
|
|
12
14
|
- Parts lane setup: a preload named in `bunfig.toml` (`[test] preload`) that registers the DOM (`GlobalRegistrator.register()` from `@happy-dom/global-registrator` for happy-dom), then calls `installDomShims()`, before any test imports a component.
|
|
13
15
|
- Pages lane setup: `init --profile app` seeds it and prints the install line. It is `vite build`, `vite preview` as Playwright's `webServer`, and one spec over your route list: [quality](node_modules/basalt-ui/docs/quality.md) per route and scheme, [expectShellInvariants](node_modules/basalt-ui/docs/expect-shell-invariants.md) once per rail state.
|
|
16
|
+
- The default parts lane cannot transform Lingui macros (`@lingui/react/macro`) in localised components. Test them in the pages lane against the Vite-built app, mocking API responses as needed; parts tests still work without macros or with an app's own Bun macro and catalogue transforms.
|
|
14
17
|
|
|
15
18
|
## Setup
|
|
16
19
|
|
|
17
|
-
-
|
|
18
|
-
- Pass the router and the query client when the test has them: `await settled({ router, queryClient })`. With no options it is the Base UI mount tick alone.
|
|
20
|
+
- Pass the router and query client to `await settled({ router, queryClient })` when present; otherwise it waits for the Base UI mount tick alone.
|
|
19
21
|
- Select parts with `SLOTS` (`data-slot`), never by class.
|
|
20
22
|
|
|
21
23
|
## Rules
|
|
22
24
|
|
|
23
|
-
- A popup needs `findBy
|
|
25
|
+
- A popup needs `findBy*`: Dialog, Popover, Select, Menu and Tooltip mount later. Press, `await screen.findByRole(...)`, then `await settled()`.
|
|
24
26
|
- Press with the whole sequence. Base UI opens a Menu on pointer down and a Dialog on click: fire `pointerDown`, `mouseDown`, `pointerUp`, `mouseUp`, `click` on the trigger.
|
|
25
27
|
- A Tooltip needs `delay={0}` in a test, or the hover waits 600 ms.
|
|
26
28
|
- `Select.Value` shows the raw value unless `items` is passed. The `options` form passes them; the parts form must.
|
|
27
|
-
- An open modal hides the
|
|
28
|
-
- Geometry is a browser assertion
|
|
29
|
+
- An open modal hides the page (`aria-hidden`); find outside it with `{ hidden: true }`.
|
|
30
|
+
- Geometry is a browser assertion: DOM runners have zero rects. Test overflow, placement, focus-not-obscured and print in a real browser.
|
|
29
31
|
- ScrollArea, Slider and virtual lists are not testable in a DOM runner. Test the state they feed and check the rest in the browser.
|
|
30
32
|
- One route module that throws at load (a module-scope `defineControls`, `c.codec` or column list with a bad id) blanks the whole built app, not only its route, so every route's cell fails with an empty page. Read the console of the first failing route, fix that module, and only then read the other failures.
|
|
31
33
|
- Under `bun test`, Testing Library's auto-cleanup does not run. Unmount in `afterEach`.
|
|
@@ -25,6 +25,7 @@ This file is the order of work and a map. The law is the `basalt-*` rules and `.
|
|
|
25
25
|
- **Loading, empty, error and stale:** [states](references/states.md).
|
|
26
26
|
- **Any string a viewer reads:** [copy](references/copy.md).
|
|
27
27
|
- **A filter, a tab or a range:** [controls](references/controls.md); where its value lives is [state](references/state.md).
|
|
28
|
+
- **A button that runs work, or the result of one:** a command's result is `notify` ([parts](references/parts.md) `ToastHost`, `Toast`) unless it must stay, then inline; and an action button takes an icon ([parts](references/parts.md) `Tooltip` names an icon-only one).
|
|
28
29
|
- **A form, a wizard or a settings page:** [forms](references/forms.md).
|
|
29
30
|
- **Anything that enters, leaves or moves:** [motion](references/motion.md), never a number; **model output** (chat parts, generated text): [ai](references/ai.md).
|
|
30
31
|
|
|
@@ -47,4 +48,4 @@ A page is done when each of these holds, run and not recalled. A small change (o
|
|
|
47
48
|
- **Gates.** The typecheck, `basalt-ui lint` and `bun run check` pass, every figure the ask names is on the page, and every control has a name.
|
|
48
49
|
- **Words.** `basalt-ui shot detect --facts <page dir>` reports no `communication-5` finding, and reading the 1800 rest shot aloud finds no fact in two slots ([copy](references/copy.md) § The fact count).
|
|
49
50
|
- **Every frame opened.** Rest, loading, empty and error, in light and dark, at 1800 and 390, plus one keyboard frame (`basalt-ui shot <route> --states keys`). Run the self-check and the device checklist of [anti-defaults](references/anti-defaults.md) against them, and `basalt-ui shot detect` on the out dir.
|
|
50
|
-
- **Review.** The `basalt-design-reviewer` subagent, given the out dir and the plan's path, scores them; fix every P1 it reports and shoot again. Without it, hand
|
|
51
|
+
- **Review.** The `basalt-design-reviewer` subagent, given the out dir and the plan's path, scores them; fix every P1 it reports and shoot again. Without it, hand `node_modules/basalt-ui/agent/reviewer/basalt-design-reviewer.md` to a general agent that did not write the page, or say "reviewer not run".
|
|
@@ -8,6 +8,7 @@ Every control has a home; the home draws it and the handle holds its state. Prop
|
|
|
8
8
|
- A list page's [PageBar](node_modules/basalt-ui/docs/page-bar.md) is its view row, one line: `tabs` with `badges` (a count per named view, `attention` for the one that needs the reader) on the left; `search`, the filters, `layout`, `settings` and the one primary on the right, in the order the bar fixes. A fill page puts `StatGroup variant="flush"` under it, every cell with a sub-line. `basalt-ui add list-page` writes this row.
|
|
9
9
|
- A view switch of the same data is [ViewTabs](node_modules/basalt-ui/docs/view-tabs.md) bound to an enum handle, with `history: 'push'` when Back should walk the tabs. A list of sections beside the page is an inner nav.
|
|
10
10
|
- A control in a surface that is not a slot of a composite (an aside, a sheet, a toolbar) goes inside [ControlHome](node_modules/basalt-ui/docs/control-home.md) with a `home` name; the home sets the look, never a prop.
|
|
11
|
+
- A control that sends a request and stores nothing (a volume, a lamp switch) goes inside `<ControlHome home="command">`: name the control itself, show the reported value or the pick until the request answers, send once per choice (a slider on `onValueCommitted`, a switch on `onCheckedChange`).
|
|
11
12
|
- A card head holds at most two controls through [filterSlot](node_modules/basalt-ui/docs/filter-slot.md); a `DataPanel` `toolbar` takes the rest, any number of widget fields on one widget, and `useReset({ only })` clears them. A global control lives in the shell's global controls or the page bar; a global handle in a card slot is a type error.
|
|
12
13
|
|
|
13
14
|
## Handles and cues
|
|
@@ -26,6 +26,7 @@ Every shipped part, grouped by the question it answers; open `node_modules/basal
|
|
|
26
26
|
## Lay out a page, a panel or a record view
|
|
27
27
|
|
|
28
28
|
- `ArticleLayout` (`basalt-ui/page`): a docs or note page needs a title header, a table of contents and prev/next links around its body
|
|
29
|
+
- `BarTitle` (`basalt-ui/page`): a game, kiosk or other single-screen app draws its own top bar and needs to name the screen with a heading
|
|
29
30
|
- `Callout` (`basalt-ui/page`): an article or reply carries a note, tip, warning or error beside its prose
|
|
30
31
|
- `CardGrid` (`basalt-ui/page`): cards of one kind sit side by side and the column count should follow the space they get
|
|
31
32
|
- `ConnectionIndicator` (`basalt-ui/page`): a live surface shows whether its data is streaming, polling or cut off, in the end slot of the page bar
|
|
@@ -44,6 +45,8 @@ Every shipped part, grouped by the question it answers; open `node_modules/basal
|
|
|
44
45
|
- `Prose` (`basalt-ui/page`): long-form or chat text is rendered as HTML or Markdown and needs the article typography
|
|
45
46
|
- `QueryState` (`basalt-ui/page`): a page or region renders the result of one query and must tell loading, failure, offline and empty apart
|
|
46
47
|
- `RefreshButton` (`basalt-ui/page`): a page or the shell header offers a refresh of live data, with how old it is
|
|
48
|
+
- `RunButton` (`basalt-ui/page`): a press sends a command that takes seconds
|
|
49
|
+
- `RunList` (`basalt-ui/page`): commands started with `RunButton` or a queue need their outcome on the page
|
|
47
50
|
- `Section` (`basalt-ui/page`): a page has several parts that each need a heading, their own controls or an anchor
|
|
48
51
|
- `SettingsLayout` (`basalt-ui/page`): a page is settings: sections of rows under one title, with rows a link can point at
|
|
49
52
|
- `SplitPage` (`basalt-ui/page`): a page is a list of things plus the pane for the chosen one (settings sections, a record browser)
|
|
@@ -176,13 +179,14 @@ Every shipped part, grouped by the question it answers; open `node_modules/basal
|
|
|
176
179
|
- `basalt-ui/ui/progress` (`Progress`, `Ring`): a task has a measure (an upload, an import) or is running with an unknown end (`value={null}`)
|
|
177
180
|
- `basalt-ui/ui/quick-picks` (`QuickPicks`): a field has a few common values worth one click: dates, durations, amounts
|
|
178
181
|
- `basalt-ui/ui/radio-group` (`Radio`): one value of a few (up to about five) that the user should see all at once
|
|
182
|
+
- `basalt-ui/ui/remote-pad` (`RemotePad`): the page drives a device or a cursor key by key: a TV, a player, a camera mount
|
|
179
183
|
- `basalt-ui/ui/resizable` (`ResizableHandle`, `ResizablePanel`): two or more regions share one box and the reader should choose how much room each gets (a list and its detail, an editor and its output)
|
|
180
184
|
- `basalt-ui/ui/scroll-area` (`ScrollArea`): a bounded region (a log, a list in a panel) scrolls on its own and must stay keyboard-reachable
|
|
181
185
|
- `basalt-ui/ui/segmented` (`Segmented`): a view or a range is one of two to five short options switched in place
|
|
182
186
|
- `basalt-ui/ui/select` (`NativeSelect`, `Select`): a person picks one of fewer than 10 known values
|
|
183
187
|
- `basalt-ui/ui/separator` (`Separator`): a hairline divides two groups that are not already apart by a gap or a surface
|
|
184
188
|
- `basalt-ui/ui/sheet` (`Sheet`): a record is edited or inspected beside the page and the page behind stays in view (modal decision: `Dialog`)
|
|
185
|
-
- `basalt-ui/ui/skeleton` (`Skeleton`, `Spinner`): a
|
|
189
|
+
- `basalt-ui/ui/skeleton` (`Skeleton`, `Spinner`): a placeholder holds the place of loading text or a block in a hand-built layout
|
|
186
190
|
- `basalt-ui/ui/slider` (`Slider`): a number or a low-high range is picked on a bounded scale and approximate is fine
|
|
187
191
|
- `basalt-ui/ui/sortable-list` (`SortableList`): the user sets an order by hand: a settings list, the order of tabs or columns
|
|
188
192
|
- `basalt-ui/ui/status` (`Status`, `Swatch`): one entity has a verdict word with a dot (Healthy, Degraded) in a row or a header
|
|
@@ -2,33 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## basalt-ui (managed — do not hand-edit)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Refreshed by `basalt-ui sync`, profile `{{PROFILE}}`. Edit `{{DESIGN}}`, not this block.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Precedence** (highest wins): `{{DESIGN}}` > the `basalt-*` rules > the `basalt-*` skills > any other skill or general design advice. Restraint over a bold aesthetic; basalt charts over general charting advice.
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Installed:** the `basalt-*` rules in {{RULES_AT}} ({{LOAD}}); skills `/basalt-design`, `/basalt-charts`, `/basalt-app` in {{SKILLS_AT}}{{REVIEWER}}.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
**Feedback and icons.** A command's result is a `notify` toast, never a line in the page flow; a result that must stay is inline. An action button takes an icon (`lucide-react`).
|
|
12
12
|
|
|
13
|
-
**
|
|
13
|
+
**Run the local bin** (`./node_modules/.bin/basalt-ui`; in a workspace the app package's), never `bunx`, `init` included. **The edit hook.** {{HOOK}}
|
|
14
14
|
|
|
15
|
-
**
|
|
16
|
-
|
|
17
|
-
**Skills and subagent** (skills in {{SKILLS_AT}}; invoke one by name, or open its `SKILL.md`):
|
|
18
|
-
|
|
19
|
-
- `/basalt-design`: build or restyle a screen: question first, then the form, then the marks, then a look at 1800 and 390 wide. Reads `DESIGN.md`; its Direction is never yours to write.
|
|
20
|
-
- `/basalt-charts`: any chart, sparkline, heat grid or data mark, and a list that follows a chart's focus; load it together with `/basalt-design`.
|
|
21
|
-
- `/basalt-app`: set up, upgrade or migrate the app (`init`, `doctor`, `sync`), wire the shell, the router or a live query.
|
|
22
|
-
- `basalt-design-reviewer` (subagent, {{REVIEWER_AT}}): scores a `basalt-ui shot` out dir per component; run it after every round, never on your own work. Without it, say "reviewer not run".
|
|
23
|
-
|
|
24
|
-
**Run the local bin** (`./node_modules/.bin/basalt-ui` or a package script), never `bunx`, `init` included: install `basalt-ui` first, then run `init` once from the local bin. In a workspace: the app package's `node_modules/.bin/basalt-ui`. Run `bun run check` before reporting done.
|
|
25
|
-
|
|
26
|
-
**The edit hook.** {{HOOK}}
|
|
27
|
-
|
|
28
|
-
**Never `shadcn add` a primitive basalt ships.** Eject it (`basalt-ui eject <name> --reason`) to change it.
|
|
29
|
-
|
|
30
|
-
**Where no part fits**, climb the ladder (`{{SKILL_DIR}}/basalt-design/references/ladder.md`): a shipped part, a typed seam, a frame built from the card parts, then a report that names what you built in its place. Every lint rule holds on each step. **A defect in basalt-ui** (a documented export missing, a rule that refuses a legitimate shape): tell the person, with an issue drafted for the package's tracker (`bugs.url` in `node_modules/basalt-ui/package.json`) that holds the minimal reproduction (the smallest file, the command and what it printed); they decide whether to file it. Never patch it locally: no edit under `node_modules`, no local copy of a part, no waiver standing in for the fix.
|
|
31
|
-
|
|
32
|
-
**Overrides.** Restraint over any push for a bold aesthetic: neutral by default, the single accent spent only when earned. Basalt charts over general charting advice: compose `CartesianChart` or a shipped kind.
|
|
15
|
+
**A defect in basalt-ui:** {{REPORT}} Never patch it locally: no edit under `node_modules`, no local copy of a part, no waiver.
|
|
33
16
|
|
|
34
17
|
<!-- basalt:end -->
|
|
@@ -2,27 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## basalt-ui (managed — do not hand-edit)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Refreshed by `basalt-ui sync`, profile `site`. Edit `{{DESIGN}}`, not this block.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Precedence** (highest wins): `{{DESIGN}}` > the `basalt-*` rules > the `basalt-site` skill > any other skill or general design advice. Restraint over a bold aesthetic.
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Installed:** the `basalt-*` rules in {{RULES_AT}} ({{LOAD}}); the `/basalt-site` skill in {{SKILLS_AT}}{{REVIEWER}}.
|
|
10
10
|
|
|
11
|
-
{{
|
|
11
|
+
**Run the local bin** (`./node_modules/.bin/basalt-ui`; in a workspace the app package's), never `bunx`, `init` included. **The edit hook.** {{HOOK}}
|
|
12
12
|
|
|
13
|
-
**
|
|
14
|
-
|
|
15
|
-
**Skill** (in {{SKILLS_AT}}; invoke it by name, or open its `SKILL.md`):
|
|
16
|
-
|
|
17
|
-
- `/basalt-site`: set up the site, pick a page type (landing, guide or article, docs), add an island, verify a static page ships no script.
|
|
18
|
-
- `basalt-site-reviewer` (subagent, {{REVIEWER_AT}}): scores a `basalt-ui shot` out dir of the built site (`basalt-ui shot <routes> --dist dist --out <fresh dir>`) by the content rubric, per article, section and block; run it after every round, never on your own pages. Without it, say "reviewer not run".
|
|
19
|
-
|
|
20
|
-
**Run the local bin** (`./node_modules/.bin/basalt-ui` or a package script), never `bunx`, `init` included: install `basalt-ui` first, then run `init` once from the local bin. In a workspace: the app package's `node_modules/.bin/basalt-ui`. Run `bun run check` before reporting.
|
|
21
|
-
|
|
22
|
-
**The edit hook.** {{HOOK}}
|
|
23
|
-
|
|
24
|
-
**Where no part fits**, take the next step and keep every lint rule: a `basalt-ui/static` part (`basalt-ui parts --json`, `basalt-ui docs <Name>`), an island of a shipped app part, your own markup on the `--basalt-*` tokens, then a report that names what you built in its place. **A defect in basalt-ui** (a documented export missing, a rule that refuses a legitimate shape): tell the person, with an issue drafted for the package's tracker (`bugs.url` in `node_modules/basalt-ui/package.json`) that holds the minimal reproduction (the smallest file, the command and what it printed); they decide whether to file it. Never patch it locally: no edit under `node_modules`, no local copy of a part, no waiver standing in for the fix.
|
|
25
|
-
|
|
26
|
-
**Overrides.** Restraint over any push for a bold aesthetic: neutral by default, the single accent spent only when earned.
|
|
13
|
+
**A defect in basalt-ui:** {{REPORT}} Never patch it locally: no edit under `node_modules`, no local copy of a part, no waiver.
|
|
27
14
|
|
|
28
15
|
<!-- basalt:end -->
|
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## basalt-ui (managed — do not hand-edit)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Refreshed by `basalt-ui sync`, profile `tokens`: CSS entries and `basalt-ui tokens:css` only. Edit `{{DESIGN}}`, not this block.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Precedence** (highest wins): `{{DESIGN}}` > any skill or general design advice. Color comes from a `--basalt-*` token, never a literal; read `node_modules/basalt-ui/docs/<name>.md` before guessing one.
|
|
8
8
|
|
|
9
|
-
**
|
|
10
|
-
|
|
11
|
-
**Before guessing a token**, read `node_modules/basalt-ui/docs/<name>.md` (`basalt-ui doctor` prints where it is installed).
|
|
12
|
-
|
|
13
|
-
**Run the local bin** (`./node_modules/.bin/basalt-ui` or a package script), never `bunx`, `init` included: install `basalt-ui` first, then run `init` once from the local bin. Run the app's own checks before reporting done. **Where no token or CSS entry fits**, write your own CSS on the `--basalt-*` tokens, then a report that names what you built in its place. **A defect in basalt-ui** (a documented token or entry missing or wrong): tell the person, with an issue drafted for the package's tracker (`bugs.url` in `node_modules/basalt-ui/package.json`) that holds the minimal reproduction (the smallest file, the command and what it printed); they decide whether to file it. Never patch it locally: no edit under `node_modules`, no local copy of a part, no waiver standing in for the fix.
|
|
9
|
+
**Run the local bin** (`./node_modules/.bin/basalt-ui`; in a workspace the app package's), never `bunx`, `init` included. **A defect in basalt-ui:** {{REPORT}} Never patch it locally: no edit under `node_modules`, no local copy of a part, no waiver.
|
|
14
10
|
|
|
15
11
|
<!-- basalt:end -->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Seeded by `basalt-ui init`, then yours: `sync` never rewrites it and no version is stamped here
|
|
4
4
|
> (run `basalt-ui doctor` for the version). It records this app's intent and its narrow deltas; the law is in
|
|
5
|
-
> the `basalt-*` rules the `AGENTS.md` block
|
|
5
|
+
> the `basalt-*` rules the `AGENTS.md` block points at. The managed `AGENTS.md` block states the precedence once and does not
|
|
6
6
|
> import this file, so an agent reads it by name before it designs a screen.
|
|
7
7
|
|
|
8
8
|
## Identity
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `defaultErrorComponent`:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `defaultErrorComponent`: the crash copy with a retry. The entry loads it through
|
|
3
|
+
* `lazyRouteComponent`, so `basalt-ui/page` stays out of the first load.
|
|
4
|
+
*
|
|
5
|
+
* An app with accounts takes `error` too and branches on its numeric `status` before the crash copy:
|
|
6
|
+
* 403 is an `EmptyState` saying the page is not theirs, 401 one whose `action` is the sign-in link
|
|
7
|
+
* (`href: navTarget(linkOptions({ to: '/sign-in' }))`).
|
|
5
8
|
*
|
|
6
9
|
* Scaffold written by `basalt-ui init --locales` to `src/components/route-error.tsx`. This file is yours — `basalt-ui sync` will not overwrite it.
|
|
7
10
|
*/
|
|
8
11
|
import { useLingui } from '@lingui/react/macro'
|
|
9
|
-
import {
|
|
12
|
+
import { useRouter } from '@tanstack/react-router'
|
|
10
13
|
import type { ErrorComponentProps } from '@tanstack/react-router'
|
|
11
14
|
import { EmptyState, Page, PageBar } from 'basalt-ui/page'
|
|
12
|
-
import { navTarget } from 'basalt-ui/router'
|
|
13
|
-
|
|
14
|
-
/** Where a 401 goes: the start page until you point it at the app's sign-in route. */
|
|
15
|
-
const SIGN_IN = navTarget(linkOptions({ to: '/' }))
|
|
16
|
-
|
|
17
|
-
function statusOf(error: unknown): number | undefined {
|
|
18
|
-
if (typeof error !== 'object' || error === null || !('status' in error)) return undefined
|
|
19
|
-
return typeof error.status === 'number' ? error.status : undefined
|
|
20
|
-
}
|
|
21
15
|
|
|
22
16
|
/** The shell's scrollport, the skip link's target: where focus goes once the retry has replaced this screen. */
|
|
23
17
|
const MAIN_ID = 'shell-main'
|
|
24
18
|
|
|
25
|
-
export function RouteError({
|
|
19
|
+
export function RouteError({ reset }: ErrorComponentProps) {
|
|
26
20
|
const { t } = useLingui()
|
|
27
21
|
// `reset` alone re-renders the boundary over the same failed match; invalidating first re-runs the loader.
|
|
28
22
|
const router = useRouter()
|
|
@@ -38,25 +32,7 @@ export function RouteError({ error, reset }: ErrorComponentProps) {
|
|
|
38
32
|
}),
|
|
39
33
|
)
|
|
40
34
|
}
|
|
41
|
-
const status = statusOf(error)
|
|
42
35
|
// The bar names the screen once, as every page does: the shell's crumb and title, the `h1`.
|
|
43
|
-
if (status === 403)
|
|
44
|
-
return (
|
|
45
|
-
<Page>
|
|
46
|
-
<PageBar title={t`No access`} />
|
|
47
|
-
<EmptyState cause={t`You do not have access to this page.`} />
|
|
48
|
-
</Page>
|
|
49
|
-
)
|
|
50
|
-
if (status === 401)
|
|
51
|
-
return (
|
|
52
|
-
<Page>
|
|
53
|
-
<PageBar title={t`Signed out`} />
|
|
54
|
-
<EmptyState
|
|
55
|
-
cause={t`Your session ended. Sign in again to continue.`}
|
|
56
|
-
action={{ label: t`Sign in`, href: SIGN_IN }}
|
|
57
|
-
/>
|
|
58
|
-
</Page>
|
|
59
|
-
)
|
|
60
36
|
return (
|
|
61
37
|
<Page>
|
|
62
38
|
<PageBar title={t`Something went wrong`} />
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `defaultErrorComponent`:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `defaultErrorComponent`: the crash copy with a retry. The entry loads it through
|
|
3
|
+
* `lazyRouteComponent`, so `basalt-ui/page` stays out of the first load.
|
|
4
|
+
*
|
|
5
|
+
* An app with accounts takes `error` too and branches on its numeric `status` before the crash copy:
|
|
6
|
+
* 403 is an `EmptyState` saying the page is not theirs, 401 one whose `action` is the sign-in link
|
|
7
|
+
* (`href: navTarget(linkOptions({ to: '/sign-in' }))`).
|
|
5
8
|
*
|
|
6
9
|
* Scaffold written by `basalt-ui init` to `src/components/route-error.tsx`. This file is yours — `basalt-ui sync` will not overwrite it.
|
|
7
10
|
*/
|
|
8
|
-
import {
|
|
11
|
+
import { useRouter } from '@tanstack/react-router'
|
|
9
12
|
import type { ErrorComponentProps } from '@tanstack/react-router'
|
|
10
13
|
import { EmptyState, Page, PageBar } from 'basalt-ui/page'
|
|
11
|
-
import { navTarget } from 'basalt-ui/router'
|
|
12
|
-
|
|
13
|
-
/** Where a 401 goes: the start page until you point it at the app's sign-in route. */
|
|
14
|
-
const SIGN_IN = navTarget(linkOptions({ to: '/' }))
|
|
15
|
-
|
|
16
|
-
function statusOf(error: unknown): number | undefined {
|
|
17
|
-
if (typeof error !== 'object' || error === null || !('status' in error)) return undefined
|
|
18
|
-
return typeof error.status === 'number' ? error.status : undefined
|
|
19
|
-
}
|
|
20
14
|
|
|
21
15
|
/** The shell's scrollport, the skip link's target: where focus goes once the retry has replaced this screen. */
|
|
22
16
|
const MAIN_ID = 'shell-main'
|
|
23
17
|
|
|
24
|
-
export function RouteError({
|
|
18
|
+
export function RouteError({ reset }: ErrorComponentProps) {
|
|
25
19
|
// `reset` alone re-renders the boundary over the same failed match; invalidating first re-runs the loader.
|
|
26
20
|
const router = useRouter()
|
|
27
21
|
const retry = async () => {
|
|
@@ -36,25 +30,7 @@ export function RouteError({ error, reset }: ErrorComponentProps) {
|
|
|
36
30
|
}),
|
|
37
31
|
)
|
|
38
32
|
}
|
|
39
|
-
const status = statusOf(error)
|
|
40
33
|
// The bar names the screen once, as every page does: the shell's crumb and title, the `h1`.
|
|
41
|
-
if (status === 403)
|
|
42
|
-
return (
|
|
43
|
-
<Page>
|
|
44
|
-
<PageBar title="No access" />
|
|
45
|
-
<EmptyState cause="You do not have access to this page." />
|
|
46
|
-
</Page>
|
|
47
|
-
)
|
|
48
|
-
if (status === 401)
|
|
49
|
-
return (
|
|
50
|
-
<Page>
|
|
51
|
-
<PageBar title="Signed out" />
|
|
52
|
-
<EmptyState
|
|
53
|
-
cause="Your session ended. Sign in again to continue."
|
|
54
|
-
action={{ label: 'Sign in', href: SIGN_IN }}
|
|
55
|
-
/>
|
|
56
|
-
</Page>
|
|
57
|
-
)
|
|
58
34
|
return (
|
|
59
35
|
<Page>
|
|
60
36
|
<PageBar title="Something went wrong" />
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* `defaultPendingComponent`: shown after 300 ms of loading, and for at least 300 ms once shown, so a
|
|
3
3
|
* fast route never flashes it. Without this component the router never arms that timer.
|
|
4
4
|
*
|
|
5
|
+
* The entry imports it, so it takes nothing from the package: `basalt-ui/page` would add about
|
|
6
|
+
* 80 kB gzip to the first load.
|
|
7
|
+
*
|
|
5
8
|
* Scaffold written by `basalt-ui init --locales` to `src/components/route-pending.tsx`. This file is yours — `basalt-ui sync` will not overwrite it.
|
|
6
9
|
*/
|
|
7
10
|
import { useLingui } from '@lingui/react/macro'
|
|
8
|
-
import { EmptyState } from 'basalt-ui/page'
|
|
9
11
|
|
|
10
12
|
export function RoutePending() {
|
|
11
13
|
const { t } = useLingui()
|
|
12
14
|
return (
|
|
13
|
-
<output>
|
|
14
|
-
|
|
15
|
+
<output className="block px-6 py-16 text-center text-md text-muted-foreground">
|
|
16
|
+
{t`Loading this page.`}
|
|
15
17
|
</output>
|
|
16
18
|
)
|
|
17
19
|
}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* `defaultPendingComponent`: shown after 300 ms of loading, and for at least 300 ms once shown, so a
|
|
3
3
|
* fast route never flashes it. Without this component the router never arms that timer.
|
|
4
4
|
*
|
|
5
|
+
* The entry imports it, so it takes nothing from the package: `basalt-ui/page` would add about
|
|
6
|
+
* 80 kB gzip to the first load.
|
|
7
|
+
*
|
|
5
8
|
* Scaffold written by `basalt-ui init` to `src/components/route-pending.tsx`. This file is yours — `basalt-ui sync` will not overwrite it.
|
|
6
9
|
*/
|
|
7
|
-
import { EmptyState } from 'basalt-ui/page'
|
|
8
|
-
|
|
9
10
|
export function RoutePending() {
|
|
10
11
|
return (
|
|
11
|
-
<output>
|
|
12
|
-
|
|
12
|
+
<output className="block px-6 py-16 text-center text-md text-muted-foreground">
|
|
13
|
+
Loading this page.
|
|
13
14
|
</output>
|
|
14
15
|
)
|
|
15
16
|
}
|
|
@@ -12,18 +12,23 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import './index.css'
|
|
14
14
|
import { QueryClientProvider } from '@tanstack/react-query'
|
|
15
|
-
import { RouterProvider, createRouter } from '@tanstack/react-router'
|
|
15
|
+
import { RouterProvider, createRouter, lazyRouteComponent } from '@tanstack/react-router'
|
|
16
16
|
import type { ReactNode } from 'react'
|
|
17
17
|
import { createRoot } from 'react-dom/client'
|
|
18
18
|
import { createQueryClient } from 'basalt-ui/data'
|
|
19
19
|
import { routerDefaults } from 'basalt-ui/router'
|
|
20
20
|
import { LucideProvider } from 'lucide-react'
|
|
21
|
-
import { RouteError } from './components/route-error'
|
|
22
|
-
import { RouteMissing } from './components/route-missing'
|
|
23
21
|
import { LocalizedProvider } from './lib/localized-provider'
|
|
24
22
|
import { RoutePending } from './components/route-pending'
|
|
25
23
|
import { routeTree } from './routeTree.gen'
|
|
26
24
|
|
|
25
|
+
// The error and not-found screens compose `basalt-ui/page` (about 80 kB gzip), so each is its own
|
|
26
|
+
// chunk, fetched at start: a loader that fails offline still has its screen.
|
|
27
|
+
const RouteError = lazyRouteComponent(() => import('./components/route-error'), 'RouteError')
|
|
28
|
+
const RouteMissing = lazyRouteComponent(() => import('./components/route-missing'), 'RouteMissing')
|
|
29
|
+
void RouteError.preload?.()
|
|
30
|
+
void RouteMissing.preload?.()
|
|
31
|
+
|
|
27
32
|
const queryClient = createQueryClient()
|
|
28
33
|
const defaults = routerDefaults()
|
|
29
34
|
|
package/agent/templates/main.tpl
CHANGED
|
@@ -9,17 +9,22 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import './index.css'
|
|
11
11
|
import { QueryClientProvider } from '@tanstack/react-query'
|
|
12
|
-
import { RouterProvider, createRouter } from '@tanstack/react-router'
|
|
12
|
+
import { RouterProvider, createRouter, lazyRouteComponent } from '@tanstack/react-router'
|
|
13
13
|
import type { ReactNode } from 'react'
|
|
14
14
|
import { createRoot } from 'react-dom/client'
|
|
15
15
|
import { createQueryClient } from 'basalt-ui/data'
|
|
16
16
|
import { BasaltProvider, routerDefaults } from 'basalt-ui/router'
|
|
17
17
|
import { LucideProvider } from 'lucide-react'
|
|
18
|
-
import { RouteError } from './components/route-error'
|
|
19
|
-
import { RouteMissing } from './components/route-missing'
|
|
20
18
|
import { RoutePending } from './components/route-pending'
|
|
21
19
|
import { routeTree } from './routeTree.gen'
|
|
22
20
|
|
|
21
|
+
// The error and not-found screens compose `basalt-ui/page` (about 80 kB gzip), so each is its own
|
|
22
|
+
// chunk, fetched at start: a loader that fails offline still has its screen.
|
|
23
|
+
const RouteError = lazyRouteComponent(() => import('./components/route-error'), 'RouteError')
|
|
24
|
+
const RouteMissing = lazyRouteComponent(() => import('./components/route-missing'), 'RouteMissing')
|
|
25
|
+
void RouteError.preload?.()
|
|
26
|
+
void RouteMissing.preload?.()
|
|
27
|
+
|
|
23
28
|
const queryClient = createQueryClient()
|
|
24
29
|
const defaults = routerDefaults()
|
|
25
30
|
|