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/src/ui/meter.tsx
CHANGED
|
@@ -65,6 +65,7 @@ type MeterShared = {
|
|
|
65
65
|
export type MeterScaleProps = MeterSpec &
|
|
66
66
|
MeterShared &
|
|
67
67
|
VariantProps<typeof meterVariants> & {
|
|
68
|
+
bare?: never
|
|
68
69
|
/**
|
|
69
70
|
* One or two values marked across the track, each with its `format`ted number under it: a
|
|
70
71
|
* range's two ends or one limit.
|
|
@@ -86,6 +87,30 @@ export type MeterScaleProps = MeterSpec &
|
|
|
86
87
|
focus?: never
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
/**
|
|
91
|
+
* A scale drawn as the bar alone, for a table cell or a status strip where the words sit elsewhere:
|
|
92
|
+
* no readout, no zone word, no ticks. The `sentence` is its accessible name; a value above `min`
|
|
93
|
+
* keeps a visible stub of fill. A verdict is never color alone, so zones are not offered.
|
|
94
|
+
*/
|
|
95
|
+
export type MeterBareProps = Omit<MeterSpec, 'zones' | 'caption'> &
|
|
96
|
+
Pick<MeterShared, 'className'> &
|
|
97
|
+
VariantProps<typeof meterVariants> & {
|
|
98
|
+
bare: true
|
|
99
|
+
/** The bar a value is read against: one tall tick across the track. */
|
|
100
|
+
target?: number | undefined
|
|
101
|
+
zones?: never
|
|
102
|
+
caption?: never
|
|
103
|
+
ticks?: never
|
|
104
|
+
cause?: never
|
|
105
|
+
layout?: never
|
|
106
|
+
segments?: never
|
|
107
|
+
parts?: never
|
|
108
|
+
verdict?: never
|
|
109
|
+
legend?: never
|
|
110
|
+
common?: never
|
|
111
|
+
focus?: never
|
|
112
|
+
}
|
|
113
|
+
|
|
89
114
|
/** One segment of a status meter: what it is and the state it is in. */
|
|
90
115
|
export type MeterSegment = { label: string; tone: Tone }
|
|
91
116
|
|
|
@@ -105,6 +130,7 @@ type MeterStripShared = MeterShared & {
|
|
|
105
130
|
ticks?: never
|
|
106
131
|
target?: never
|
|
107
132
|
tone?: never
|
|
133
|
+
bare?: never
|
|
108
134
|
}
|
|
109
135
|
|
|
110
136
|
/** Several states side by side, one equal segment each, under a count ("2/3 met"). */
|
|
@@ -121,8 +147,12 @@ export type MeterSegmentsProps = MeterStripShared & {
|
|
|
121
147
|
legend?: never
|
|
122
148
|
}
|
|
123
149
|
|
|
124
|
-
/**
|
|
125
|
-
|
|
150
|
+
/**
|
|
151
|
+
* One part of a whole: its name, its size and its state. `quiet` sets the strength of its tone
|
|
152
|
+
* against the rule (the `common` tone and `neutral` quiet, the rest full): `true` draws any tone at
|
|
153
|
+
* the quiet strength, so two parts of one hue read apart; `false` draws it at full strength.
|
|
154
|
+
*/
|
|
155
|
+
export type MeterPart = { label: string; value: number; tone: Tone; quiet?: boolean | undefined }
|
|
126
156
|
|
|
127
157
|
/** Parts of a total on one track, each as wide as its share. */
|
|
128
158
|
export type MeterPartsProps = MeterStripShared & {
|
|
@@ -145,7 +175,7 @@ export type MeterProps = Omit<
|
|
|
145
175
|
ComponentProps<'div'>,
|
|
146
176
|
'className' | 'children' | 'role' | 'defaultValue' | 'color'
|
|
147
177
|
> &
|
|
148
|
-
(MeterScaleProps | MeterSegmentsProps | MeterPartsProps)
|
|
178
|
+
(MeterScaleProps | MeterBareProps | MeterSegmentsProps | MeterPartsProps)
|
|
149
179
|
|
|
150
180
|
type Segment = { zone: MeterZone; start: number; end: number }
|
|
151
181
|
|
|
@@ -190,7 +220,10 @@ const pct = (fraction: number): string => `${fraction * 100}%`
|
|
|
190
220
|
* meter shows and is its accessible name; the track is hidden from assistive tech. `format` prints
|
|
191
221
|
* a value (default the page locale's number) and `caption` the words after it that name it on screen
|
|
192
222
|
* ("US$13.89 spent", "of 150 listed"). `ticks` mark a range's ends or a limit on the track, `cause`
|
|
193
|
-
* says why in a line under the readout.
|
|
223
|
+
* says why in a line under the readout. `bare` draws a scale as the track alone, with no readout
|
|
224
|
+
* and no zones, for a table cell or a status strip whose words sit elsewhere; a value above the
|
|
225
|
+
* minimum always keeps a 4 px stub of fill. A part's `quiet` overrides the strength its tone gets
|
|
226
|
+
* from the rule above, so two parts of one hue read apart. A stacked scale is an 8 px track and a 16 px readout under a
|
|
194
227
|
* 4 px gap, so 28 px (a tick row adds 20, a `cause` its lines); a `StatCard` `height` below that
|
|
195
228
|
* clips the readout, so a meter in its chart slot sets `height={28}` at least. A list of meters
|
|
196
229
|
* joins one `useChartFocus` through the seam: the list spreads `focus.target`, each meter
|
|
@@ -356,7 +389,7 @@ function PartMeter({
|
|
|
356
389
|
data-tone={part.tone}
|
|
357
390
|
{...markItem(focus, i)}
|
|
358
391
|
style={{ '--part': pct(drawn[i]! / scale) } as CSSProperties}
|
|
359
|
-
className={cn('h-full w-(--part) shrink-0', markFill(part.tone, common))}
|
|
392
|
+
className={cn('h-full w-(--part) shrink-0', markFill(part.tone, common, part.quiet))}
|
|
360
393
|
/>
|
|
361
394
|
),
|
|
362
395
|
)}
|
|
@@ -384,7 +417,9 @@ function PartMeter({
|
|
|
384
417
|
>
|
|
385
418
|
{parts.map((part, i) => (
|
|
386
419
|
<span key={part.label} className="inline-flex items-center gap-1 whitespace-nowrap">
|
|
387
|
-
<span
|
|
420
|
+
<span
|
|
421
|
+
className={cn('size-1.5 rounded-full', markFill(part.tone, common, part.quiet))}
|
|
422
|
+
/>
|
|
388
423
|
<span className="tabular-nums">{print(drawn[i]!)}</span> {part.label}
|
|
389
424
|
</span>
|
|
390
425
|
))}
|
|
@@ -412,6 +447,7 @@ function ScaleMeter({
|
|
|
412
447
|
layout,
|
|
413
448
|
cause,
|
|
414
449
|
tone,
|
|
450
|
+
bare,
|
|
415
451
|
className,
|
|
416
452
|
segments: _segments,
|
|
417
453
|
parts: _parts,
|
|
@@ -420,7 +456,7 @@ function ScaleMeter({
|
|
|
420
456
|
common: _common,
|
|
421
457
|
focus: _focus,
|
|
422
458
|
...props
|
|
423
|
-
}: DivProps & MeterScaleProps): ReactElement {
|
|
459
|
+
}: DivProps & (MeterScaleProps | MeterBareProps)): ReactElement {
|
|
424
460
|
const intl = useFormat()
|
|
425
461
|
const causeId = useId()
|
|
426
462
|
const present = typeof value === 'number' && Number.isFinite(value)
|
|
@@ -434,6 +470,7 @@ function ScaleMeter({
|
|
|
434
470
|
const marker = Math.min(0.99, Math.max(0.01, fraction))
|
|
435
471
|
// A zone word needs its own line, so a zoned meter stays stacked unless the page says otherwise.
|
|
436
472
|
const inline =
|
|
473
|
+
bare !== true &&
|
|
437
474
|
(layout ?? (target !== undefined && zones === undefined ? 'inline' : 'stacked')) === 'inline'
|
|
438
475
|
return (
|
|
439
476
|
<BaseMeter.Root
|
|
@@ -445,6 +482,7 @@ function ScaleMeter({
|
|
|
445
482
|
aria-describedby={cause === undefined ? undefined : causeId}
|
|
446
483
|
getAriaValueText={() => (active ? `${said}, ${active.label}` : said)}
|
|
447
484
|
data-slot="meter"
|
|
485
|
+
data-form={bare === true ? 'bare' : undefined}
|
|
448
486
|
data-layout={inline ? 'inline' : undefined}
|
|
449
487
|
className={cn(
|
|
450
488
|
meterVariants({ tone }),
|
|
@@ -455,7 +493,16 @@ function ScaleMeter({
|
|
|
455
493
|
<div aria-hidden="true" className={cn('relative', inline && 'min-w-6 flex-1')}>
|
|
456
494
|
<BaseMeter.Track className="relative block h-2 w-full overflow-hidden rounded-full bg-selected">
|
|
457
495
|
{zones === undefined ? (
|
|
458
|
-
present &&
|
|
496
|
+
present && (
|
|
497
|
+
<BaseMeter.Indicator
|
|
498
|
+
data-fill=""
|
|
499
|
+
// A bare bar has no readout to say the value, so a few percent of a narrow one keeps a stub.
|
|
500
|
+
className={cn(
|
|
501
|
+
'block h-full rounded-full',
|
|
502
|
+
bare === true && fraction > 0 && 'min-w-1',
|
|
503
|
+
)}
|
|
504
|
+
/>
|
|
505
|
+
)
|
|
459
506
|
) : (
|
|
460
507
|
<svg
|
|
461
508
|
className="absolute inset-0 size-full"
|
|
@@ -501,7 +548,7 @@ function ScaleMeter({
|
|
|
501
548
|
/>
|
|
502
549
|
)}
|
|
503
550
|
</div>
|
|
504
|
-
{ticks !== undefined && (
|
|
551
|
+
{bare !== true && ticks !== undefined && (
|
|
505
552
|
<div
|
|
506
553
|
aria-hidden="true"
|
|
507
554
|
className={cn(
|
|
@@ -524,24 +571,26 @@ function ScaleMeter({
|
|
|
524
571
|
))}
|
|
525
572
|
</div>
|
|
526
573
|
)}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
<span className="
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
574
|
+
{bare !== true && (
|
|
575
|
+
<div
|
|
576
|
+
data-readout=""
|
|
577
|
+
className={cn(
|
|
578
|
+
'flex items-baseline justify-between gap-2 text-xs',
|
|
579
|
+
inline && 'shrink-0 whitespace-nowrap',
|
|
580
|
+
)}
|
|
581
|
+
>
|
|
582
|
+
{active ? (
|
|
583
|
+
<span className={cn('font-medium', ZONE_WORD[active.tone])}>{active.label}</span>
|
|
584
|
+
) : (
|
|
585
|
+
!inline && <span />
|
|
586
|
+
)}
|
|
587
|
+
<span className="min-w-0 text-end text-muted-foreground">
|
|
588
|
+
<span className="tabular-nums">{text}</span>
|
|
589
|
+
{caption !== undefined && <span data-meter-caption=""> {caption}</span>}
|
|
590
|
+
</span>
|
|
591
|
+
</div>
|
|
592
|
+
)}
|
|
593
|
+
{bare !== true && cause !== undefined && (
|
|
545
594
|
<div className={cn(inline && 'basis-full')}>
|
|
546
595
|
<Cause id={causeId} cause={cause} />
|
|
547
596
|
</div>
|
|
@@ -408,6 +408,14 @@
|
|
|
408
408
|
"deny": ["h-*", "min-h-*", "size-*", "hidden", "flex", "block", "grid", "inline-flex"],
|
|
409
409
|
"message": "Radio owns its height and display: eject it (basalt-ui eject radio-group) to change them."
|
|
410
410
|
},
|
|
411
|
+
{
|
|
412
|
+
"module": "remote-pad",
|
|
413
|
+
"part": "remote-pad",
|
|
414
|
+
"pattern": "^RemotePad$",
|
|
415
|
+
"allow": ["layout"],
|
|
416
|
+
"deny": ["h-*", "min-h-*", "size-*", "hidden", "flex", "block", "grid", "inline-flex"],
|
|
417
|
+
"message": "RemotePad owns its height and display: eject it (basalt-ui eject remote-pad) to change them."
|
|
418
|
+
},
|
|
411
419
|
{
|
|
412
420
|
"module": "scroll-area",
|
|
413
421
|
"part": "scroll-area",
|
|
@@ -294,6 +294,13 @@ const PART_PROPS: Record<string, Record<string, unknown>> = {
|
|
|
294
294
|
'checkbox-matrix': { rows: [], columns: [], 'aria-label': 'x' },
|
|
295
295
|
'swatch-picker': { options: [], 'aria-label': 'x' },
|
|
296
296
|
'quick-picks': { options: [], 'aria-label': 'x' },
|
|
297
|
+
'remote-pad': {
|
|
298
|
+
dpad: Object.fromEntries(
|
|
299
|
+
['up', 'left', 'select', 'right', 'down'].map((key) => [key, { key, label: key }]),
|
|
300
|
+
),
|
|
301
|
+
onKey: () => undefined,
|
|
302
|
+
'aria-label': 'x',
|
|
303
|
+
},
|
|
297
304
|
'virtual-list': { count: 0, estimateSize: () => 32, getItemKey: (i: number) => i },
|
|
298
305
|
tree: {
|
|
299
306
|
label: 'x',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RemotePadProps } from './remote-pad'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hand-authored guard for `remote-pad` (docs/v3/ARCHITECTURE.md 4.2). `requires` survives eject;
|
|
5
|
+
* `closed` is dropped on eject. The guard pins the props a caller binds.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// basalt:guard requires
|
|
9
|
+
type CalledKey = { key: string; label: string; repeat?: boolean }
|
|
10
|
+
type CalledRemotePad = {
|
|
11
|
+
dpad: Record<'up' | 'left' | 'select' | 'right' | 'down', CalledKey>
|
|
12
|
+
rows?: readonly (readonly CalledKey[])[]
|
|
13
|
+
onKey: (key: string) => void
|
|
14
|
+
disabled?: boolean
|
|
15
|
+
'aria-label': string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const requiresRemotePad = (
|
|
19
|
+
c: CalledRemotePad,
|
|
20
|
+
): Pick<RemotePadProps, 'dpad' | 'rows' | 'onKey' | 'disabled' | 'aria-label'> => c
|
|
21
|
+
|
|
22
|
+
// basalt:guard closed
|
|
23
|
+
// @ts-expect-error a key is named: an icon alone has no accessible name
|
|
24
|
+
export const nameless: RemotePadProps['dpad']['up'] = { key: 'up' }
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority'
|
|
2
|
+
import { useEffect, useRef } from 'react'
|
|
3
|
+
import type { KeyboardEvent, MouseEvent, PointerEvent, ReactElement, ReactNode } from 'react'
|
|
4
|
+
import { cn } from '../core/cn'
|
|
5
|
+
import { Button } from './button'
|
|
6
|
+
import type { ButtonProps } from './button'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The `RemotePad` cva table: the D-pad and the key rows in one column. No axes.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* remotePadVariants() // class string for a hand-built pad
|
|
13
|
+
*/
|
|
14
|
+
export const remotePadVariants = cva('flex flex-col gap-6')
|
|
15
|
+
|
|
16
|
+
// A coarse pointer opens the rows up to a 44 px pitch, so the hit areas of two keys never overlap.
|
|
17
|
+
const DPAD = 'grid grid-cols-3 gap-2 pointer-coarse:gap-y-4'
|
|
18
|
+
const ROW = 'grid auto-cols-fr grid-flow-col gap-2'
|
|
19
|
+
|
|
20
|
+
/** Every `data-slot` this module renders, in export order. Read by the generator for `SLOTS`. */
|
|
21
|
+
export const remotePadParts = ['remote-pad'] as const
|
|
22
|
+
|
|
23
|
+
/** How long a repeating key is held before it repeats, and the pause between two repeats. */
|
|
24
|
+
const REPEAT_DELAY = 400
|
|
25
|
+
const REPEAT_INTERVAL = 150
|
|
26
|
+
|
|
27
|
+
export type RemoteKey<K extends string = string> = {
|
|
28
|
+
/** What `onKey` receives. */
|
|
29
|
+
key: K
|
|
30
|
+
/** The key's accessible name, and its text when it has no icon. */
|
|
31
|
+
label: string
|
|
32
|
+
/** Drawn instead of the label. Decorative: the label stays the name. */
|
|
33
|
+
icon?: ReactNode
|
|
34
|
+
/** Holding the key down presses it again and again. On by default for the four arrows only. */
|
|
35
|
+
repeat?: boolean
|
|
36
|
+
variant?: ButtonProps['variant']
|
|
37
|
+
disabled?: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type RemoteDirection = 'up' | 'left' | 'select' | 'right' | 'down'
|
|
41
|
+
|
|
42
|
+
export type RemotePadProps<K extends string = string> = {
|
|
43
|
+
/** The D-pad cluster. An arrow without an `icon` draws its own. */
|
|
44
|
+
dpad: Readonly<Record<RemoteDirection, RemoteKey<K>>>
|
|
45
|
+
/** Rows of keys under the D-pad (back, home, play; volume); a row splits its width evenly. */
|
|
46
|
+
rows?: readonly (readonly RemoteKey<K>[])[] | undefined
|
|
47
|
+
/** One press of any key, repeats included. */
|
|
48
|
+
onKey: (key: K) => void
|
|
49
|
+
disabled?: boolean
|
|
50
|
+
/** Names the pad: "TV remote". */
|
|
51
|
+
'aria-label': string
|
|
52
|
+
/** Layout only (`max-w-xs`). */
|
|
53
|
+
className?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The arrow's turn from pointing up. */
|
|
57
|
+
const ARROWS = { up: '', right: 'rotate-90', down: 'rotate-180', left: '-rotate-90' } as const
|
|
58
|
+
|
|
59
|
+
const PLACE: Record<RemoteDirection, string> = {
|
|
60
|
+
up: 'col-start-2',
|
|
61
|
+
left: 'col-start-1',
|
|
62
|
+
select: '',
|
|
63
|
+
right: '',
|
|
64
|
+
down: 'col-start-2',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function Arrow({ turn }: { turn: string }): ReactElement {
|
|
68
|
+
return (
|
|
69
|
+
<svg viewBox="0 0 16 16" className={cn('size-icon', turn)} fill="none" aria-hidden="true">
|
|
70
|
+
<path
|
|
71
|
+
d="M8 13V3M3.5 7.5 8 3l4.5 4.5"
|
|
72
|
+
stroke="currentColor"
|
|
73
|
+
strokeWidth="1.5"
|
|
74
|
+
strokeLinecap="round"
|
|
75
|
+
strokeLinejoin="round"
|
|
76
|
+
/>
|
|
77
|
+
</svg>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Press and hold. A tap stays a plain click, so a scroll that starts on a key presses nothing; a
|
|
83
|
+
* held pointer presses after the delay and then at the interval, and the click that ends the hold
|
|
84
|
+
* is swallowed. A held Enter repeats the click by itself, so a key that does not repeat refuses it.
|
|
85
|
+
*/
|
|
86
|
+
function useHoldRepeat(press: () => void, repeat: boolean) {
|
|
87
|
+
const latest = useRef(press)
|
|
88
|
+
const release = useRef<(() => void) | null>(null)
|
|
89
|
+
const repeated = useRef(false)
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
latest.current = press
|
|
92
|
+
})
|
|
93
|
+
useEffect(() => () => release.current?.(), [])
|
|
94
|
+
|
|
95
|
+
const stop = (): void => release.current?.()
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
onPointerDown(event: PointerEvent<HTMLElement>): void {
|
|
99
|
+
stop()
|
|
100
|
+
repeated.current = false
|
|
101
|
+
if (!repeat || event.button !== 0) return
|
|
102
|
+
const node = event.currentTarget
|
|
103
|
+
const { pointerId } = event
|
|
104
|
+
let timer = setTimeout(function again() {
|
|
105
|
+
if (node.matches(':disabled')) return stop()
|
|
106
|
+
repeated.current = true
|
|
107
|
+
timer = setTimeout(again, REPEAT_INTERVAL)
|
|
108
|
+
latest.current()
|
|
109
|
+
}, REPEAT_DELAY)
|
|
110
|
+
// Another finger lifting is not the end of this hold.
|
|
111
|
+
const lifted = (end: globalThis.PointerEvent): void => {
|
|
112
|
+
if (end.pointerId === pointerId) stop()
|
|
113
|
+
}
|
|
114
|
+
window.addEventListener('pointerup', lifted)
|
|
115
|
+
window.addEventListener('pointercancel', lifted)
|
|
116
|
+
window.addEventListener('blur', stop)
|
|
117
|
+
release.current = () => {
|
|
118
|
+
clearTimeout(timer)
|
|
119
|
+
window.removeEventListener('pointerup', lifted)
|
|
120
|
+
window.removeEventListener('pointercancel', lifted)
|
|
121
|
+
window.removeEventListener('blur', stop)
|
|
122
|
+
release.current = null
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onPointerLeave: stop,
|
|
126
|
+
onKeyDown(event: KeyboardEvent): void {
|
|
127
|
+
if (!repeat && event.repeat && event.key === 'Enter') event.preventDefault()
|
|
128
|
+
},
|
|
129
|
+
onClick(event: MouseEvent): void {
|
|
130
|
+
// `detail` is 0 for a keyboard or scripted click, which no hold ever ends in.
|
|
131
|
+
const endsHold = repeated.current && event.detail !== 0
|
|
132
|
+
repeated.current = false
|
|
133
|
+
if (!endsHold) press()
|
|
134
|
+
},
|
|
135
|
+
// A long press must not open the system's menu while the key is repeating.
|
|
136
|
+
onContextMenu(event: MouseEvent): void {
|
|
137
|
+
if (release.current !== null) event.preventDefault()
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
type KeyProps = {
|
|
143
|
+
spec: RemoteKey
|
|
144
|
+
press: (key: string) => void
|
|
145
|
+
repeat: boolean
|
|
146
|
+
disabled: boolean
|
|
147
|
+
glyph?: ReactNode
|
|
148
|
+
className?: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function PadKey({ spec, press, repeat, disabled, glyph, className }: KeyProps): ReactElement {
|
|
152
|
+
const hold = useHoldRepeat(() => press(spec.key), repeat)
|
|
153
|
+
const icon = spec.icon ?? glyph
|
|
154
|
+
return (
|
|
155
|
+
<Button
|
|
156
|
+
{...hold}
|
|
157
|
+
type="button"
|
|
158
|
+
variant={spec.variant}
|
|
159
|
+
disabled={disabled || spec.disabled === true}
|
|
160
|
+
aria-label={icon === undefined ? undefined : spec.label}
|
|
161
|
+
data-key={spec.key}
|
|
162
|
+
className={cn('w-full min-w-0 touch-manipulation [-webkit-touch-callout:none]', className)}
|
|
163
|
+
>
|
|
164
|
+
{icon === undefined ? (
|
|
165
|
+
<span className="truncate">{spec.label}</span>
|
|
166
|
+
) : (
|
|
167
|
+
<span className="inline-flex" aria-hidden="true">
|
|
168
|
+
{icon}
|
|
169
|
+
</span>
|
|
170
|
+
)}
|
|
171
|
+
</Button>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A remote control: a D-pad (up, left, select, right, down) over rows of keys, with one `onKey`
|
|
177
|
+
* handler. It sends and shows nothing else: a key is never busy, so three taps are three presses,
|
|
178
|
+
* and what became of a command belongs to the page. Arrows repeat while held; another key repeats
|
|
179
|
+
* with `repeat`.
|
|
180
|
+
*
|
|
181
|
+
* @useWhen the page drives a device or a cursor key by key: a TV, a player, a camera mount
|
|
182
|
+
* @neverWhen the actions have no spatial or remote layout (use Button in a row or a Toolbar)
|
|
183
|
+
* @instead Button, Toolbar
|
|
184
|
+
* @example
|
|
185
|
+
* <RemotePad
|
|
186
|
+
* aria-label="TV remote"
|
|
187
|
+
* onKey={send}
|
|
188
|
+
* dpad={{
|
|
189
|
+
* up: { key: 'up', label: 'Up' },
|
|
190
|
+
* left: { key: 'left', label: 'Left' },
|
|
191
|
+
* select: { key: 'select', label: 'Select', variant: 'primary' },
|
|
192
|
+
* right: { key: 'right', label: 'Right' },
|
|
193
|
+
* down: { key: 'down', label: 'Down' },
|
|
194
|
+
* }}
|
|
195
|
+
* rows={[[{ key: 'back', label: 'Back' }, { key: 'home', label: 'Home' }]]}
|
|
196
|
+
* />
|
|
197
|
+
*/
|
|
198
|
+
export function RemotePad<K extends string = string>({
|
|
199
|
+
dpad,
|
|
200
|
+
rows = [],
|
|
201
|
+
onKey,
|
|
202
|
+
disabled = false,
|
|
203
|
+
'aria-label': name,
|
|
204
|
+
className,
|
|
205
|
+
}: RemotePadProps<K>): ReactElement {
|
|
206
|
+
// Every key that reaches here is one of the specs, so it is a K.
|
|
207
|
+
const press = (key: string): void => onKey(key as K)
|
|
208
|
+
const directions = ['up', 'left', 'select', 'right', 'down'] as const
|
|
209
|
+
return (
|
|
210
|
+
<div
|
|
211
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a named set of keys, not a form fieldset
|
|
212
|
+
role="group"
|
|
213
|
+
aria-label={name}
|
|
214
|
+
data-slot="remote-pad"
|
|
215
|
+
className={cn(remotePadVariants(), className)}
|
|
216
|
+
>
|
|
217
|
+
<div className={DPAD}>
|
|
218
|
+
{directions.map((direction) => (
|
|
219
|
+
<PadKey
|
|
220
|
+
key={direction}
|
|
221
|
+
spec={dpad[direction]}
|
|
222
|
+
press={press}
|
|
223
|
+
repeat={dpad[direction].repeat ?? direction !== 'select'}
|
|
224
|
+
disabled={disabled}
|
|
225
|
+
glyph={direction === 'select' ? undefined : <Arrow turn={ARROWS[direction]} />}
|
|
226
|
+
className={PLACE[direction]}
|
|
227
|
+
/>
|
|
228
|
+
))}
|
|
229
|
+
</div>
|
|
230
|
+
{rows.length > 0 && (
|
|
231
|
+
<div className="flex flex-col gap-4">
|
|
232
|
+
{rows.map((row) => (
|
|
233
|
+
<div key={row.map((spec) => spec.key).join(' ')} className={ROW}>
|
|
234
|
+
{row.map((spec) => (
|
|
235
|
+
<PadKey
|
|
236
|
+
key={spec.key}
|
|
237
|
+
spec={spec}
|
|
238
|
+
press={press}
|
|
239
|
+
repeat={spec.repeat ?? false}
|
|
240
|
+
disabled={disabled}
|
|
241
|
+
/>
|
|
242
|
+
))}
|
|
243
|
+
</div>
|
|
244
|
+
))}
|
|
245
|
+
</div>
|
|
246
|
+
)}
|
|
247
|
+
</div>
|
|
248
|
+
)
|
|
249
|
+
}
|
package/src/ui/segmented.tsx
CHANGED
|
@@ -134,6 +134,11 @@ export type SegmentedProps<V extends string = string> = Shared &
|
|
|
134
134
|
|
|
135
135
|
const ARROWS = new Set(['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'])
|
|
136
136
|
|
|
137
|
+
/** The `data-*` attributes a caller passed: a test id or a hook, read off the root. Other props belong to the group. */
|
|
138
|
+
function dataAttributes(props: object): Record<string, unknown> {
|
|
139
|
+
return Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith('data-')))
|
|
140
|
+
}
|
|
141
|
+
|
|
137
142
|
/**
|
|
138
143
|
* A row of options on Base UI's toggle group. Single select (the default) keeps exactly one option
|
|
139
144
|
* on and draws it raised; the arrow keys move the selection through the options in DOM order.
|
|
@@ -196,6 +201,7 @@ export function Segmented<V extends string = string>(props: SegmentedProps<V>):
|
|
|
196
201
|
return (
|
|
197
202
|
<GroupContext value={{ size, select: multiple ? undefined : select, viaArrow }}>
|
|
198
203
|
<div
|
|
204
|
+
{...dataAttributes(rest)}
|
|
199
205
|
data-slot="segmented"
|
|
200
206
|
data-fill={fill}
|
|
201
207
|
data-multiple={multiple ? '' : undefined}
|
package/src/ui/skeleton.guard.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { SkeletonProps, SpinnerProps } from './skeleton'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Hand-authored guard for `skeleton` (docs/v3/ARCHITECTURE.md 4.2). `requires` survives eject;
|
|
5
|
-
* `closed` is dropped on eject. The module has no cva axes:
|
|
6
|
-
* surrounding text, so the guard pins that neither part takes a child
|
|
5
|
+
* `closed` is dropped on eject. The module has no cva axes: a height is one line of the
|
|
6
|
+
* surrounding text or the Skeleton's `height` in px, so the guard pins that neither part takes a child.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
// basalt:guard requires
|
|
@@ -13,9 +13,14 @@ export const requires = (
|
|
|
13
13
|
c: Called,
|
|
14
14
|
): Pick<SkeletonProps, 'className' | 'id'> & Pick<SpinnerProps, 'className' | 'id'> => c
|
|
15
15
|
|
|
16
|
+
export const requiresHeight = (c: { height?: number }): Pick<SkeletonProps, 'height'> => c
|
|
17
|
+
|
|
16
18
|
// basalt:guard closed
|
|
17
19
|
// @ts-expect-error a skeleton draws its own box, not children
|
|
18
20
|
export const skeletonChild: Pick<SkeletonProps, 'children'> = { children: 'x' }
|
|
19
21
|
|
|
22
|
+
// @ts-expect-error a skeleton height is a number of px
|
|
23
|
+
export const skeletonHeight: Pick<SkeletonProps, 'height'> = { height: '3rem' }
|
|
24
|
+
|
|
20
25
|
// @ts-expect-error a spinner draws its own ring, not children
|
|
21
26
|
export const spinnerChild: Pick<SpinnerProps, 'children'> = { children: 'x' }
|
package/src/ui/skeleton.tsx
CHANGED
|
@@ -33,26 +33,32 @@ export const spinnerVariants = cva(
|
|
|
33
33
|
export const skeletonParts = ['skeleton', 'spinner'] as const
|
|
34
34
|
|
|
35
35
|
export type SkeletonProps = Omit<ComponentProps<'div'>, 'className' | 'children'> & {
|
|
36
|
-
/** Layout only (`w-32`, `w-2/3`).
|
|
36
|
+
/** Layout only (`w-32`, `w-2/3`). */
|
|
37
37
|
className?: string
|
|
38
|
+
/**
|
|
39
|
+
* The final height in px of a block that is not a line of text (a chart, a card), so nothing
|
|
40
|
+
* moves when it lands. Without it the height is one line of the surrounding text style.
|
|
41
|
+
*/
|
|
42
|
+
height?: number
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
|
-
* A placeholder for one line of loading content. Match the content's text style on the skeleton or
|
|
46
|
+
* A placeholder for one line of loading content, or with `height` for a block of that height. Match the content's text style on the skeleton or
|
|
42
47
|
* its parent (`text-sm`, `text-lg`) and its height equals the content's; set the width with
|
|
43
48
|
* `className`. Stack several for a paragraph. It is hidden from assistive tech: name the loading
|
|
44
49
|
* region with `aria-busy` and a status, not each box.
|
|
45
50
|
*
|
|
46
|
-
* @useWhen a
|
|
51
|
+
* @useWhen a placeholder holds the place of loading text or a block in a hand-built layout
|
|
47
52
|
* @neverWhen a basalt part already draws its own loading state (give it `phase`), or the wait is an action (use a Spinner or a Button `loading`)
|
|
48
53
|
* @instead StatCard, Button
|
|
49
54
|
* @example
|
|
50
55
|
* <Skeleton className="w-40 text-lg" />
|
|
51
56
|
*/
|
|
52
|
-
export function Skeleton({ className, ...props }: SkeletonProps): ReactElement {
|
|
57
|
+
export function Skeleton({ className, height, style, ...props }: SkeletonProps): ReactElement {
|
|
53
58
|
return (
|
|
54
59
|
<div
|
|
55
60
|
{...props}
|
|
61
|
+
style={height === undefined ? style : { ...style, height }}
|
|
56
62
|
aria-hidden="true"
|
|
57
63
|
data-slot="skeleton"
|
|
58
64
|
className={cn(skeletonVariants(), className)}
|
package/src/ui/slots.ts
CHANGED
|
@@ -9,7 +9,7 @@ export const SLOTS = {
|
|
|
9
9
|
badge: ['badge', 'count-badge', 'delta-badge'],
|
|
10
10
|
button: ['button', 'pressable'],
|
|
11
11
|
calendar: ['calendar'],
|
|
12
|
-
card: ['card', 'card-band', 'icon-tile', 'inset', 'card-phase'],
|
|
12
|
+
card: ['card', 'card-band', 'icon-tile', 'inset', 'card-phase', 'card-link'],
|
|
13
13
|
'checkbox-matrix': ['checkbox-matrix'],
|
|
14
14
|
checkbox: ['checkbox-group', 'checkbox'],
|
|
15
15
|
'choice-card': ['choice-card'],
|
|
@@ -73,6 +73,7 @@ export const SLOTS = {
|
|
|
73
73
|
progress: ['progress', 'ring'],
|
|
74
74
|
'quick-picks': ['quick-picks'],
|
|
75
75
|
'radio-group': ['radio-group', 'radio'],
|
|
76
|
+
'remote-pad': ['remote-pad'],
|
|
76
77
|
resizable: ['resizable-panel-group', 'resizable-panel', 'resizable-handle'],
|
|
77
78
|
'scroll-area': ['scroll-area'],
|
|
78
79
|
segmented: ['segmented', 'segmented-item'],
|
package/src/vite/allotment.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type Allotment = {
|
|
|
20
20
|
subpaths: Record<string, SubpathAllotment>
|
|
21
21
|
/** The L4 composite subpaths: `optimizeDeps.exclude` targets once an app ejects. */
|
|
22
22
|
composites: string[]
|
|
23
|
-
/** Every
|
|
23
|
+
/** Every shipped primitive (`basalt-ui/ui/<name>`). */
|
|
24
24
|
primitives: string[]
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -127,5 +127,19 @@ export const ALLOTMENT: Allotment = {
|
|
|
127
127
|
'virtual-list',
|
|
128
128
|
'sortable-list',
|
|
129
129
|
'tree',
|
|
130
|
+
'remote-pad',
|
|
131
|
+
'avatar',
|
|
132
|
+
'checkbox-matrix',
|
|
133
|
+
'choice-card',
|
|
134
|
+
'control-group',
|
|
135
|
+
'copy-button',
|
|
136
|
+
'entity',
|
|
137
|
+
'file-upload',
|
|
138
|
+
'info-hint',
|
|
139
|
+
'one-time-code',
|
|
140
|
+
'password-input',
|
|
141
|
+
'quick-picks',
|
|
142
|
+
'swatch-picker',
|
|
143
|
+
'tag-input',
|
|
130
144
|
],
|
|
131
145
|
}
|
package/src/vite/doc.ts
CHANGED
|
@@ -69,8 +69,18 @@ The head (transformIndexHtml), replacing 2.x basaltAppPlugin:
|
|
|
69
69
|
There is no anti-FOUC <style>: the script stamps data-theme before paint, tokens.css paints.
|
|
70
70
|
app: { name, shortName, description, display, startUrl, scope, id, backgroundColor, icons,
|
|
71
71
|
darkreader, seo, manifest, serviceWorker } adds site.webmanifest, its link, the icons
|
|
72
|
-
that name rel, the apple and darkreader metas, SEO tags, and
|
|
73
|
-
|
|
72
|
+
that name rel, the apple and darkreader metas, SEO tags, and the service worker.
|
|
73
|
+
|
|
74
|
+
app.serviceWorker (off by default):
|
|
75
|
+
'shell' basalt's own worker, no dependency. A build emits sw.js and registers it from
|
|
76
|
+
index.html; a dev server gets neither. It precaches the page and the built scripts,
|
|
77
|
+
styles, fonts and images. The page is network first, the precached copy offline; a
|
|
78
|
+
precached asset is cache first. Every other request, public/ files and /api
|
|
79
|
+
included, is left to the browser, and nothing is cached at runtime. A new build's
|
|
80
|
+
worker takes over once the app's tabs are closed. An app that has its own
|
|
81
|
+
public/sw.js deletes it and its register() call.
|
|
82
|
+
true | object workbox through the optional peer vite-plugin-pwa; the object is merged over the
|
|
83
|
+
defaults. Absent peer: one warning, no worker.
|
|
74
84
|
|
|
75
85
|
Open: F9 (HMR on an edited ejected file in a real dev server, with optimizeDeps.exclude) is not
|
|
76
86
|
claimed here; it is recorded open for v3-spike-f3-eject. Until it passes, restart the dev server
|