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/testing/quality.ts
CHANGED
|
@@ -560,6 +560,191 @@ async function focusNotObscured(
|
|
|
560
560
|
return { stops }
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
+
// ── text overflow ─────────────────────────────────────────────────────────────────────────────
|
|
564
|
+
|
|
565
|
+
export interface TextOverflowOptions {
|
|
566
|
+
/** CSS selectors whose boxes, and everything in them, cut their text on purpose. */
|
|
567
|
+
allow?: readonly string[]
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/** The in-page body of {@link textOverflow}: one line per box whose text does not fit it. */
|
|
571
|
+
function inspectTextOverflow(allow: readonly string[]): Promise<string[]> {
|
|
572
|
+
// A pixel of slack: a fractional layout rounds scroll and client sizes apart.
|
|
573
|
+
const SLACK = 1
|
|
574
|
+
const clips = (v: string): boolean => v === 'hidden' || v === 'clip'
|
|
575
|
+
const scrolls = (v: string): boolean => v === 'auto' || v === 'scroll'
|
|
576
|
+
const px = Math.round
|
|
577
|
+
const allowed = allow.join(',')
|
|
578
|
+
const canvas = document.createElement('canvas').getContext('2d')
|
|
579
|
+
// `from` and the boxes around it that can clip it: an absolute box is held by its positioned
|
|
580
|
+
// ancestor, not by the static boxes in between, and a fixed one by none.
|
|
581
|
+
const holders = (from: Element | null): [Element, CSSStyleDeclaration][] => {
|
|
582
|
+
const held: [Element, CSSStyleDeclaration][] = []
|
|
583
|
+
let escaped = false
|
|
584
|
+
for (let n = from; n !== null && n !== document.body; n = n.parentElement) {
|
|
585
|
+
const s = getComputedStyle(n)
|
|
586
|
+
if (escaped && s.position === 'static') continue
|
|
587
|
+
escaped = s.position === 'absolute'
|
|
588
|
+
held.push([n, s])
|
|
589
|
+
if (s.position === 'fixed') break
|
|
590
|
+
}
|
|
591
|
+
return held
|
|
592
|
+
}
|
|
593
|
+
// Not on screen at all, so nothing of it is cut: the content of a collapsed panel, and text for
|
|
594
|
+
// assistive technology (`sr-only`, a box pushed off to the left).
|
|
595
|
+
const unseen = (el: Element): boolean => {
|
|
596
|
+
const collapsed = holders(el).some(([n, s]) => {
|
|
597
|
+
const box = n.getBoundingClientRect()
|
|
598
|
+
return (clips(s.overflowX) || clips(s.overflowY)) && (box.width <= 1 || box.height <= 1)
|
|
599
|
+
})
|
|
600
|
+
if (collapsed) return true
|
|
601
|
+
for (let n: Element | null = el; n !== null && n !== document.body; n = n.parentElement) {
|
|
602
|
+
const s = getComputedStyle(n)
|
|
603
|
+
if (s.position !== 'absolute' && s.position !== 'fixed') continue
|
|
604
|
+
if (s.clip === 'rect(0px, 0px, 0px, 0px)' || /inset\(50%\)/.test(s.clipPath)) return true
|
|
605
|
+
if (parseFloat(s.width) <= 1 && parseFloat(s.height) <= 1) return true
|
|
606
|
+
if (n.getBoundingClientRect().right <= 0) return true
|
|
607
|
+
}
|
|
608
|
+
return false
|
|
609
|
+
}
|
|
610
|
+
const findings = new Set<string>()
|
|
611
|
+
|
|
612
|
+
const nameOf = (el: Element): string => {
|
|
613
|
+
const tag = el.tagName.toLowerCase()
|
|
614
|
+
const own = el.closest('[data-testid]')
|
|
615
|
+
if (own !== null) {
|
|
616
|
+
const id = own.getAttribute('data-testid') ?? ''
|
|
617
|
+
return own === el ? id : `${id} > ${tag}`
|
|
618
|
+
}
|
|
619
|
+
const slot = el.getAttribute('data-slot')
|
|
620
|
+
const text = (el.textContent ?? '').trim().slice(0, 40)
|
|
621
|
+
return `${tag}${slot === null ? '' : `[${slot}]`} "${text}" (no data-testid)`
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// Reports the first box, from `from` up, that cuts the text drawn at `rects`, and the screen edge
|
|
625
|
+
// when none does. A scroller reveals what lies beyond it, so it ends the walk on its axis.
|
|
626
|
+
const cut = (from: Element | null, named: Element, rects: DOMRect[], size: number): void => {
|
|
627
|
+
let across = true
|
|
628
|
+
let down = true
|
|
629
|
+
// A field is no part of its own walk, so `named` still says whether the walk starts escaped.
|
|
630
|
+
for (const [up, s] of holders(named).filter(([n]) => from !== null && n.contains(from))) {
|
|
631
|
+
const box = up.getBoundingClientRect()
|
|
632
|
+
if (across && scrolls(s.overflowX)) across = false
|
|
633
|
+
if (across && clips(s.overflowX)) {
|
|
634
|
+
const r = rects.find((t) => t.right > box.right + SLACK || t.left < box.left - SLACK)
|
|
635
|
+
if (r !== undefined) {
|
|
636
|
+
const kind = s.textOverflow === 'ellipsis' ? 'ellipsised' : 'clipped'
|
|
637
|
+
findings.add(
|
|
638
|
+
`${nameOf(named)}: ${kind} (${px(r.left)} to ${px(r.right)} px, room ${px(box.left)} to ${px(box.right)} px)`,
|
|
639
|
+
)
|
|
640
|
+
across = false
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (down && scrolls(s.overflowY)) down = false
|
|
644
|
+
if (down && clips(s.overflowY)) {
|
|
645
|
+
// Half a letter or more: a tight line height cuts a few pixels of empty glyph box, no text.
|
|
646
|
+
const r = rects.find(
|
|
647
|
+
(t) => t.bottom - box.bottom >= size / 2 || box.top - t.top >= size / 2,
|
|
648
|
+
)
|
|
649
|
+
if (r !== undefined) {
|
|
650
|
+
findings.add(
|
|
651
|
+
`${nameOf(named)}: clipped (${px(r.top)} to ${px(r.bottom)} px of height, room ${px(box.top)} to ${px(box.bottom)} px)`,
|
|
652
|
+
)
|
|
653
|
+
down = false
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (!across) return
|
|
658
|
+
const screen = document.documentElement.clientWidth
|
|
659
|
+
const r = rects.find((t) => t.right > screen + SLACK || t.left < -SLACK)
|
|
660
|
+
if (r !== undefined)
|
|
661
|
+
findings.add(
|
|
662
|
+
`${nameOf(named)}: leaves the screen (${px(r.left)} to ${px(r.right)} px of ${screen} px)`,
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
const check = (el: HTMLElement): void => {
|
|
667
|
+
if (el.closest('svg, option, script, style') !== null) return
|
|
668
|
+
if (allowed !== '' && el.closest(allowed) !== null) return
|
|
669
|
+
const style = getComputedStyle(el)
|
|
670
|
+
const box = el.getBoundingClientRect()
|
|
671
|
+
if (style.visibility === 'hidden' || box.width <= 1 || box.height <= 1 || unseen(el)) return
|
|
672
|
+
|
|
673
|
+
const field = el instanceof HTMLInputElement || el instanceof HTMLSelectElement
|
|
674
|
+
const control = field || el instanceof HTMLTextAreaElement
|
|
675
|
+
// The text's own rects, never scrollWidth: a decoration or an enlarged hit area overflows on
|
|
676
|
+
// purpose and cuts no text.
|
|
677
|
+
const rects = control
|
|
678
|
+
? []
|
|
679
|
+
: Array.from(el.childNodes)
|
|
680
|
+
.filter((n) => n.nodeType === Node.TEXT_NODE && (n.textContent ?? '').trim() !== '')
|
|
681
|
+
.flatMap((node) => {
|
|
682
|
+
const range = document.createRange()
|
|
683
|
+
range.selectNodeContents(node)
|
|
684
|
+
return Array.from(range.getClientRects())
|
|
685
|
+
})
|
|
686
|
+
|
|
687
|
+
// A placeholder or a shown option is no DOM text: measured against the room inside the field.
|
|
688
|
+
if (field && canvas !== null) {
|
|
689
|
+
const shown =
|
|
690
|
+
el instanceof HTMLSelectElement
|
|
691
|
+
? (el.selectedOptions[0]?.text ?? '')
|
|
692
|
+
: el.value === ''
|
|
693
|
+
? el.placeholder
|
|
694
|
+
: ''
|
|
695
|
+
canvas.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`
|
|
696
|
+
const room = el.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight)
|
|
697
|
+
if (canvas.measureText(shown).width > room + SLACK)
|
|
698
|
+
findings.add(`${nameOf(el)}: "${shown}" is clipped in its field`)
|
|
699
|
+
}
|
|
700
|
+
if (!control && rects.length === 0) return
|
|
701
|
+
|
|
702
|
+
if (
|
|
703
|
+
style.overflowX === 'visible' &&
|
|
704
|
+
rects.some((r) => r.right > box.right + SLACK || r.left < box.left - SLACK)
|
|
705
|
+
) {
|
|
706
|
+
const width = Math.max(...rects.map((r) => r.width))
|
|
707
|
+
findings.add(`${nameOf(el)}: wider than its box (${px(width)} px in ${px(box.width)} px)`)
|
|
708
|
+
}
|
|
709
|
+
// A label wider than the box around it: a button that does not wrap in a narrow column.
|
|
710
|
+
const parent = el.parentElement
|
|
711
|
+
if (parent !== null && parent !== document.body && style.position === 'static') {
|
|
712
|
+
const outer = getComputedStyle(parent)
|
|
713
|
+
const around = parent.getBoundingClientRect()
|
|
714
|
+
const laidOut = outer.display !== 'inline' && outer.display !== 'contents'
|
|
715
|
+
if (laidOut && !scrolls(outer.overflowX) && box.width > around.width + SLACK)
|
|
716
|
+
findings.add(
|
|
717
|
+
`${nameOf(el)}: wider than its box (${px(box.width)} px in ${px(around.width)} px)`,
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
const size = parseFloat(style.fontSize)
|
|
722
|
+
if (control) cut(parent, el, [box], size)
|
|
723
|
+
else cut(el, el, rects, size)
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// A fallback font measures differently: read once the page's own faces are in.
|
|
727
|
+
return document.fonts.ready.then(() => {
|
|
728
|
+
for (const el of document.body.querySelectorAll<HTMLElement>('*')) check(el)
|
|
729
|
+
return Array.from(findings)
|
|
730
|
+
})
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Fails on text that does not fit: ellipsised, clipped, wider than its box, or off the screen, and on
|
|
735
|
+
* a placeholder or shown option wider than its field. Each line names the element's `data-testid`
|
|
736
|
+
* (the nearest one around it), else its tag and `data-slot`. A box that scrolls is not a finding.
|
|
737
|
+
*/
|
|
738
|
+
async function textOverflow(page: PageLike, options: TextOverflowOptions = {}): Promise<void> {
|
|
739
|
+
await expectScheme(page)
|
|
740
|
+
const found = await run(page, inspectTextOverflow, options.allow ?? [])
|
|
741
|
+
if (found.length === 0) return
|
|
742
|
+
const shown = found.slice(0, 20)
|
|
743
|
+
const rest = found.length - shown.length
|
|
744
|
+
if (rest > 0) shown.push(`and ${rest} more`)
|
|
745
|
+
throw new Error(`quality.textOverflow:\n ${shown.join('\n ')}`)
|
|
746
|
+
}
|
|
747
|
+
|
|
563
748
|
// ── text spacing ──────────────────────────────────────────────────────────────────────────────
|
|
564
749
|
|
|
565
750
|
/**
|
|
@@ -629,6 +814,7 @@ export interface Quality {
|
|
|
629
814
|
ringWalk(page: PageLike, options?: WalkOptions): Promise<{ stops: number }>
|
|
630
815
|
focusNotObscured(page: PageLike, options?: WalkOptions): Promise<{ stops: number }>
|
|
631
816
|
textSpacing(page: PageLike): Promise<void>
|
|
817
|
+
textOverflow(page: PageLike, options?: TextOverflowOptions): Promise<void>
|
|
632
818
|
}
|
|
633
819
|
|
|
634
820
|
/**
|
|
@@ -646,6 +832,7 @@ export interface Quality {
|
|
|
646
832
|
* await quality.ringWalk(page) // Tab through every stop: solid ring, 3:1, not clipped
|
|
647
833
|
* await quality.focusNotObscured(page) // 2.4.11: no focused element sits under sticky chrome
|
|
648
834
|
* await quality.textSpacing(page) // 1.4.12: nothing clips at line-height 1.5, 0.12em, 0.16em
|
|
835
|
+
* await quality.textOverflow(page) // no label is ellipsised, clipped or wider than its box
|
|
649
836
|
* // Last, it resizes the viewport: after its sweep headless Chrome can hang in a later hit test.
|
|
650
837
|
* await quality.overflow(page) // 320, 390, 768, 1440, 1800: the document never scrolls sideways
|
|
651
838
|
* })
|
|
@@ -664,4 +851,5 @@ export const quality: Quality = Object.freeze({
|
|
|
664
851
|
ringWalk,
|
|
665
852
|
focusNotObscured,
|
|
666
853
|
textSpacing,
|
|
854
|
+
textOverflow,
|
|
667
855
|
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `bridge.css` adds on top of `tailwind.css`: the Tailwind scale names the theme clears and the
|
|
3
|
+
* shadcn color names it does not carry, each on a `--basalt-*` token. One table for the sheet
|
|
4
|
+
* (`css/generate.ts`) and for the `migrate` scan that says which dead classes it restores.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** In px, as `md` and `xl` are: Tailwind sorts breakpoints per unit, so a rem one would sort apart. */
|
|
8
|
+
export const BRIDGE_BREAKPOINTS = { sm: '640px', lg: '1024px', '2xl': '1536px' } as const
|
|
9
|
+
|
|
10
|
+
const CHIP = 'var(--basalt-radius-chip)'
|
|
11
|
+
const CARD = 'var(--basalt-radius-card)'
|
|
12
|
+
|
|
13
|
+
/** Suffix to value; `''` is the bare `rounded`. A shadcn card is `rounded-xl`. */
|
|
14
|
+
export const BRIDGE_RADII: Readonly<Record<string, string>> = {
|
|
15
|
+
'': CHIP,
|
|
16
|
+
xs: CHIP,
|
|
17
|
+
sm: CHIP,
|
|
18
|
+
md: CHIP,
|
|
19
|
+
lg: 'var(--basalt-radius-ctrl)',
|
|
20
|
+
xl: CARD,
|
|
21
|
+
'2xl': CARD,
|
|
22
|
+
'3xl': CARD,
|
|
23
|
+
'4xl': 'calc(infinity * 1px)',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const RAISED = 'var(--basalt-shadow-raised)'
|
|
27
|
+
const OVERLAY = 'var(--basalt-shadow-overlay)'
|
|
28
|
+
|
|
29
|
+
export const BRIDGE_SHADOWS: Readonly<Record<string, string>> = {
|
|
30
|
+
'': RAISED,
|
|
31
|
+
'2xs': RAISED,
|
|
32
|
+
xs: RAISED,
|
|
33
|
+
sm: RAISED,
|
|
34
|
+
md: OVERLAY,
|
|
35
|
+
lg: OVERLAY,
|
|
36
|
+
xl: OVERLAY,
|
|
37
|
+
'2xl': OVERLAY,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Tailwind's own sizes and line heights: basalt's scale has no step to map them to. */
|
|
41
|
+
export const BRIDGE_TYPE_STEPS: Readonly<
|
|
42
|
+
Record<string, readonly [size: string, lineHeight: string]>
|
|
43
|
+
> = {
|
|
44
|
+
xl: ['1.25rem', 'calc(1.75 / 1.25)'],
|
|
45
|
+
'2xl': ['1.5rem', 'calc(2 / 1.5)'],
|
|
46
|
+
'3xl': ['1.875rem', 'calc(2.25 / 1.875)'],
|
|
47
|
+
'4xl': ['2.25rem', 'calc(2.5 / 2.25)'],
|
|
48
|
+
'5xl': ['3rem', '1'],
|
|
49
|
+
'6xl': ['3.75rem', '1'],
|
|
50
|
+
'7xl': ['4.5rem', '1'],
|
|
51
|
+
'8xl': ['6rem', '1'],
|
|
52
|
+
'9xl': ['8rem', '1'],
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** shadcn's color names. `primary` is its filled button, so it moves from ink to the brand fill. */
|
|
56
|
+
export const BRIDGE_COLORS: Readonly<Record<string, string>> = {
|
|
57
|
+
primary: 'brand-fill',
|
|
58
|
+
'primary-foreground': 'on-brand',
|
|
59
|
+
'card-foreground': 'ink',
|
|
60
|
+
'popover-foreground': 'ink',
|
|
61
|
+
'secondary-foreground': 'ink',
|
|
62
|
+
'accent-foreground': 'ink',
|
|
63
|
+
'destructive-foreground': 'canvas',
|
|
64
|
+
sidebar: 'card',
|
|
65
|
+
'sidebar-foreground': 'ink',
|
|
66
|
+
'sidebar-primary': 'brand-fill',
|
|
67
|
+
'sidebar-primary-foreground': 'on-brand',
|
|
68
|
+
'sidebar-accent': 'hover',
|
|
69
|
+
'sidebar-accent-foreground': 'ink',
|
|
70
|
+
'sidebar-border': 'hairline',
|
|
71
|
+
'sidebar-ring': 'brand',
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** `--color-*` names whose text sits on a fill: the pairs a contrast test holds. */
|
|
75
|
+
export const BRIDGE_PAIRS: readonly (readonly [foreground: string, fill: string])[] = [
|
|
76
|
+
['on-brand', 'brand-fill'],
|
|
77
|
+
['canvas', 'bad'],
|
|
78
|
+
['ink', 'card'],
|
|
79
|
+
['ink', 'raised'],
|
|
80
|
+
]
|
package/src/tokens/emit.ts
CHANGED
|
@@ -44,6 +44,11 @@ export type EmitOptions = {
|
|
|
44
44
|
* above the default sheet's 0-2-0 whatever the source order.
|
|
45
45
|
*/
|
|
46
46
|
selector?: string
|
|
47
|
+
/**
|
|
48
|
+
* Cut the full sheet down to these tokens (named without the `--basalt-` prefix) and the ones their
|
|
49
|
+
* values reference, for a standalone document that loads no basalt sheet. Not for a tenant sheet.
|
|
50
|
+
*/
|
|
51
|
+
pick?: readonly string[]
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
type Side = 'light' | 'dark'
|
|
@@ -165,12 +170,14 @@ export function emitDerived(derived: DerivedV3, options: EmitOptions): string {
|
|
|
165
170
|
const tokens = resolveTokens(undefined, derived)
|
|
166
171
|
const header = provenanceHeader(options.version, options.command ?? 'basalt-ui tokens:css')
|
|
167
172
|
|
|
173
|
+
if (options.selector !== undefined && options.pick !== undefined)
|
|
174
|
+
throw new Error('pick cuts the full sheet; a tenant sheet (selector) takes none')
|
|
175
|
+
|
|
168
176
|
if (options.selector !== undefined)
|
|
169
177
|
return header + tenantBlocks(tokens, resolveTokens(DEFAULT_DERIVE_V3_CONFIG), options.selector)
|
|
170
178
|
|
|
171
179
|
const pairs = tokens.filter((t) => isPair(t.value))
|
|
172
|
-
|
|
173
|
-
header +
|
|
180
|
+
const sheet =
|
|
174
181
|
colorBlocks(
|
|
175
182
|
{
|
|
176
183
|
light: ":root,\n:root[data-theme='light']",
|
|
@@ -179,9 +186,41 @@ export function emitDerived(derived: DerivedV3, options: EmitOptions): string {
|
|
|
179
186
|
},
|
|
180
187
|
pairs,
|
|
181
188
|
true,
|
|
182
|
-
) +
|
|
183
|
-
|
|
184
|
-
|
|
189
|
+
) + scalarBlocks(tokens)
|
|
190
|
+
return header + (options.pick === undefined ? sheet : pickDeclarations(sheet, options.pick))
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** One emitted `--basalt-*` declaration line: the name and its value. */
|
|
194
|
+
const DECLARATION = /^[ \t]*(--basalt-[\w-]+): (.*);\n/gm
|
|
195
|
+
/** A rule or at-rule with nothing left inside, a multi-line selector included. */
|
|
196
|
+
const EMPTY_RULE = /(?:^[^\n{};]*,\n)*^[^\n{};]*\{\n(?:[ \t]*\n)*[ \t]*\}\n/gm
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The sheet cut down to `names` and every token their values reference, so each `var()` still resolves.
|
|
200
|
+
* Selectors, scheme blocks and `color-scheme` stay as in the full sheet; rules left empty are dropped.
|
|
201
|
+
* @throws Error naming each name the sheet does not declare.
|
|
202
|
+
*/
|
|
203
|
+
function pickDeclarations(sheet: string, names: readonly string[]): string {
|
|
204
|
+
const values = new Map<string, string>()
|
|
205
|
+
for (const [, name = '', value = ''] of sheet.matchAll(DECLARATION))
|
|
206
|
+
values.set(name, `${values.get(name) ?? ''} ${value}`)
|
|
207
|
+
const unknown = names.filter((n) => !values.has(`--basalt-${n}`))
|
|
208
|
+
if (unknown.length > 0)
|
|
209
|
+
throw new Error(
|
|
210
|
+
`--pick: no such token: ${unknown.join(', ')} (name them without --basalt-, as in canvas,ink)`,
|
|
211
|
+
)
|
|
212
|
+
const keep = new Set(names.map((n) => `--basalt-${n}`))
|
|
213
|
+
// A Set visits what is added while it is walked, so this closes over references of references.
|
|
214
|
+
for (const name of keep)
|
|
215
|
+
for (const [, ref = ''] of (values.get(name) ?? '').matchAll(/var\(\s*(--basalt-[\w-]+)/g))
|
|
216
|
+
if (values.has(ref)) keep.add(ref)
|
|
217
|
+
let out = sheet.replace(DECLARATION, (line, name: string) => (keep.has(name) ? line : ''))
|
|
218
|
+
// Repeated: dropping the rules inside an at-rule is what empties the at-rule.
|
|
219
|
+
for (let previous = ''; previous !== out;) {
|
|
220
|
+
previous = out
|
|
221
|
+
out = out.replace(EMPTY_RULE, '')
|
|
222
|
+
}
|
|
223
|
+
return out
|
|
185
224
|
}
|
|
186
225
|
|
|
187
226
|
/** The color roles of `tokens` that differ from `baseline`, scoped to `selector`; empty when none do. */
|
|
@@ -195,7 +234,7 @@ function tenantBlocks(
|
|
|
195
234
|
return changed.length === 0 ? '' : colorBlocks(selectors, changed, false)
|
|
196
235
|
}
|
|
197
236
|
|
|
198
|
-
export type EmitAccentsOptions = Omit<EmitOptions, 'selector'> & {
|
|
237
|
+
export type EmitAccentsOptions = Omit<EmitOptions, 'selector' | 'pick'> & {
|
|
199
238
|
/** The accents the app ships, by name; each becomes one `:root[data-accent='<name>']` block. */
|
|
200
239
|
accents: readonly AccentName[]
|
|
201
240
|
}
|
package/src/ui/accordion.tsx
CHANGED
|
@@ -132,7 +132,7 @@ export function AccordionContent({
|
|
|
132
132
|
{...props}
|
|
133
133
|
data-slot="accordion-content"
|
|
134
134
|
className={cn(
|
|
135
|
-
'h-(--accordion-panel-height)
|
|
135
|
+
'flow-root h-(--accordion-panel-height) text-sm text-muted-foreground transition-[height,overflow] transition-discrete ease-standard [transition-delay:0s,var(--basalt-dur-fast)] [transition-duration:var(--basalt-dur-fast),0s] data-closed:overflow-hidden data-closed:[transition-delay:0s] data-ending-style:overflow-hidden data-starting-style:overflow-hidden motion-reduce:transition-none [&[hidden]:not([hidden="until-found"])]:hidden data-ending-style:h-0 data-starting-style:h-0',
|
|
136
136
|
className,
|
|
137
137
|
)}
|
|
138
138
|
>
|
package/src/ui/card.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
import { FrameHeadBand, ICON_TILE } from '../core/frame-head'
|
|
22
22
|
import { PhaseBoundary } from '../core/phase-boundary'
|
|
23
23
|
import { RetryElsewhere, useRetryRole } from '../core/retry-owner'
|
|
24
|
-
import type { Box, BoxSlot } from '../core/ports'
|
|
24
|
+
import type { Box, BoxSlot, LinkHref } from '../core/ports'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* The `Card` cva table: the ringed card surface. `flush` drops the padding so a band sits on the
|
|
@@ -45,7 +45,14 @@ export const cardVariants = cva(
|
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
/** Every `data-slot` this module renders, in export order. Read by the generator for `SLOTS`. */
|
|
48
|
-
export const cardParts = [
|
|
48
|
+
export const cardParts = [
|
|
49
|
+
'card',
|
|
50
|
+
'card-band',
|
|
51
|
+
'icon-tile',
|
|
52
|
+
'inset',
|
|
53
|
+
'card-phase',
|
|
54
|
+
'card-link',
|
|
55
|
+
] as const
|
|
49
56
|
|
|
50
57
|
export type CardProps = Omit<useRender.ComponentProps<'div'>, 'className'> &
|
|
51
58
|
VariantProps<typeof cardVariants> & {
|
|
@@ -55,7 +62,9 @@ export type CardProps = Omit<useRender.ComponentProps<'div'>, 'className'> &
|
|
|
55
62
|
|
|
56
63
|
/**
|
|
57
64
|
* The base card: a surface with a radius and a ring. Works with no provider; polymorphism only
|
|
58
|
-
* through `render`.
|
|
65
|
+
* through `render`. A card with a header band, a body and a footer is `Card flush` with `CardBand`
|
|
66
|
+
* (or a header row of your own), an `Inset` and `CardFooter` (`basalt-ui/cards`); `CardLink` makes
|
|
67
|
+
* the whole card one link.
|
|
59
68
|
*
|
|
60
69
|
* @useWhen a group of content needs a surface of its own in a hand-built layout
|
|
61
70
|
* @neverWhen a part already frames the content (ChartCard, StatCard, Section), or the content is page text (no surface)
|
|
@@ -73,7 +82,8 @@ export function Card({ flush, className, render, ref, ...props }: CardProps): Re
|
|
|
73
82
|
...props,
|
|
74
83
|
'data-slot': 'card',
|
|
75
84
|
'data-surface': 'card',
|
|
76
|
-
|
|
85
|
+
// A `CardLink` child positions the card; the class is the part's, not the surface recipe's.
|
|
86
|
+
className: cn(cardVariants({ flush }), 'has-[>[data-slot=card-link]]:relative', className),
|
|
77
87
|
},
|
|
78
88
|
})
|
|
79
89
|
}
|
|
@@ -101,7 +111,7 @@ export function Inset({ className, ...props }: PartProps<'div'>): ReactElement {
|
|
|
101
111
|
data-slot="inset"
|
|
102
112
|
data-surface="inset"
|
|
103
113
|
className={cn(
|
|
104
|
-
'mx-(--basalt-card-gutter) rounded-inset bg-inset px-[calc(var(--basalt-card-edge)_-_var(--basalt-card-gutter))] py-3 first:mt-(--basalt-card-gutter) last:mb-(--basalt-card-gutter)',
|
|
114
|
+
'mx-(--basalt-card-gutter) rounded-inset bg-inset px-[calc(var(--basalt-card-edge)_-_var(--basalt-card-gutter))] py-3 first:mt-(--basalt-card-gutter) last:mb-(--basalt-card-gutter) [[data-slot=card-link]:first-child+&]:mt-(--basalt-card-gutter)',
|
|
105
115
|
className,
|
|
106
116
|
)}
|
|
107
117
|
/>
|
|
@@ -135,21 +145,61 @@ export type CardBandProps = Omit<FrameHead, 'title'> & {
|
|
|
135
145
|
menu?: CardMenuEntries | undefined
|
|
136
146
|
/** Whether a right click, a long press or Shift+F10 on the card opens its menu at the pointer. Default true. */
|
|
137
147
|
contextMenu?: boolean | undefined
|
|
148
|
+
/** The title wraps onto further lines instead of ending in an ellipsis: set it where the title is a sentence. */
|
|
149
|
+
wrap?: boolean | undefined
|
|
138
150
|
}
|
|
139
151
|
|
|
140
152
|
/**
|
|
141
153
|
* The head every frame shares, for a hand-built card: the icon tile, the title with its definition
|
|
142
154
|
* glyph and badge, a subtitle of facts, up to three actions, up to two controls and the menu, on the
|
|
143
155
|
* card's left edge. `StatCard`, `ChartCard` and `DataPanel` draw this same part, so a hand-built frame
|
|
144
|
-
* reads as a shipped one. Data only: no node, no class.
|
|
156
|
+
* reads as a shipped one. Data only: no node, no class. The title is one line that ends in an ellipsis;
|
|
157
|
+
* `wrap` lets a title that is a sentence take as many lines as it needs.
|
|
145
158
|
*
|
|
146
159
|
* @example
|
|
147
160
|
* <CardBand icon={GitMerge} title="Shipped" subtitle={['vs last week', '12 repos']} badge={{ label: 'Live', tone: 'good', dot: true }} />
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* <CardBand wrap title="This page is out of date: reload to see the latest room" />
|
|
148
164
|
*/
|
|
149
165
|
export function CardBand(props: CardBandProps): ReactElement {
|
|
150
166
|
return <FrameHeadBand slot="card" {...props} />
|
|
151
167
|
}
|
|
152
168
|
|
|
169
|
+
export type CardLinkProps = {
|
|
170
|
+
href: LinkHref
|
|
171
|
+
/** The link's accessible name, usually the card's title. */
|
|
172
|
+
label: string
|
|
173
|
+
/** Layout only. */
|
|
174
|
+
className?: string
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The stretched link of a hand-built card: one transparent link over the whole card, named by
|
|
179
|
+
* `label`, with its focus ring inside the edge. Place it as a direct child of `Card`, first. It
|
|
180
|
+
* covers the card's content, a `CardPhase` body included; a second target after it (a link, a
|
|
181
|
+
* button) needs `relative z-1` to sit above it; `CardBand`'s actions and menu already do.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* <Card flush>
|
|
185
|
+
* <CardLink href="/issues/4" label="Fix the login redirect" />
|
|
186
|
+
* <Inset>Fix the login redirect</Inset>
|
|
187
|
+
* </Card>
|
|
188
|
+
*/
|
|
189
|
+
export function CardLink({ href, label, className }: CardLinkProps): ReactElement {
|
|
190
|
+
return (
|
|
191
|
+
<AppLink
|
|
192
|
+
data-slot="card-link"
|
|
193
|
+
href={href}
|
|
194
|
+
aria-label={label}
|
|
195
|
+
className={cn(
|
|
196
|
+
'absolute inset-0 z-1 rounded-[inherit] focus-ring focus-visible:-outline-offset-2',
|
|
197
|
+
className,
|
|
198
|
+
)}
|
|
199
|
+
/>
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
153
203
|
// ── Phase ────────────────────────────────────────────────────────────────────────────────────────
|
|
154
204
|
|
|
155
205
|
const ACTION =
|
package/src/ui/collapsible.tsx
CHANGED
|
@@ -37,7 +37,8 @@ export type CollapsibleTriggerProps = Omit<BaseCollapsible.Trigger.Props, 'class
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* The button that toggles the region. It has no look of its own: it owns focus and the pointer-tier
|
|
40
|
-
* hit floor, and the caller styles the content (or passes a `Button` through `render`).
|
|
40
|
+
* hit floor, and the caller styles the content (or passes a `Button` through `render`). Base UI sets
|
|
41
|
+
* its `aria-controls` only while the region is open, also with `keepMounted`: read `aria-expanded`.
|
|
41
42
|
*
|
|
42
43
|
* @example
|
|
43
44
|
* <CollapsibleTrigger className="text-sm font-medium">Advanced options</CollapsibleTrigger>
|
|
@@ -59,7 +60,8 @@ export type CollapsibleContentProps = Omit<BaseCollapsible.Panel.Props, 'classNa
|
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* The region. It animates its height from the measured content and skips the animation under
|
|
62
|
-
* reduced motion.
|
|
63
|
+
* reduced motion. It clips only while closed or moving, so an open region shows a focus ring, a
|
|
64
|
+
* shadow or a tooltip that reaches past its edge. `hiddenUntilFound` lets the browser's find in page open it on a match;
|
|
63
65
|
* `keepMounted` keeps it in the DOM while closed so inner state survives.
|
|
64
66
|
*
|
|
65
67
|
* @example
|
|
@@ -71,7 +73,7 @@ export function CollapsibleContent({ className, ...props }: CollapsibleContentPr
|
|
|
71
73
|
{...props}
|
|
72
74
|
data-slot="collapsible-content"
|
|
73
75
|
className={cn(
|
|
74
|
-
'h-(--collapsible-panel-height) overflow-
|
|
76
|
+
'flow-root h-(--collapsible-panel-height) transition-[height,overflow] transition-discrete ease-standard [transition-delay:0s,var(--basalt-dur-fast)] [transition-duration:var(--basalt-dur-fast),0s] data-closed:overflow-hidden data-closed:[transition-delay:0s] data-ending-style:overflow-hidden data-starting-style:overflow-hidden motion-reduce:transition-none [&[hidden]:not([hidden="until-found"])]:hidden data-ending-style:h-0 data-starting-style:h-0',
|
|
75
77
|
className,
|
|
76
78
|
)}
|
|
77
79
|
/>
|
package/src/ui/combobox.tsx
CHANGED
|
@@ -1022,7 +1022,7 @@ export function AutocompleteContent({
|
|
|
1022
1022
|
slot="autocomplete-content"
|
|
1023
1023
|
className={cn(autocompleteContentVariants(), className)}
|
|
1024
1024
|
container={container}
|
|
1025
|
-
popupProps={props}
|
|
1025
|
+
popupProps={{ role: 'presentation', ...props }}
|
|
1026
1026
|
>
|
|
1027
1027
|
{empty !== undefined && (
|
|
1028
1028
|
<BaseAutocomplete.Empty className="px-2 py-1.5 text-sm text-muted-foreground empty:hidden">
|
package/src/ui/meter.guard.ts
CHANGED
|
@@ -40,6 +40,29 @@ export const oneZone: Pick<MeterProps, 'zones'> = { zones: [{ to: 2, tone: 'good
|
|
|
40
40
|
// @ts-expect-error ticks are a range's two ends or one limit, never a scale
|
|
41
41
|
export const threeTicks: Pick<MeterProps, 'ticks'> = { ticks: [1, 2, 3] }
|
|
42
42
|
|
|
43
|
+
const FINE_HIGH: NonNullable<MeterProps['zones']> = [
|
|
44
|
+
{ to: 1, tone: 'good', label: 'Fine' },
|
|
45
|
+
{ to: 2, tone: 'bad', label: 'High' },
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
// @ts-expect-error a bare scale has no zone word, so no zones: a verdict is never color alone
|
|
49
|
+
export const bareZones: MeterProps = {
|
|
50
|
+
bare: true,
|
|
51
|
+
sentence: 'Load',
|
|
52
|
+
value: 1,
|
|
53
|
+
max: 2,
|
|
54
|
+
zones: FINE_HIGH,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// @ts-expect-error a bare scale prints nothing, so no caption
|
|
58
|
+
export const bareCaption: MeterProps = {
|
|
59
|
+
bare: true,
|
|
60
|
+
sentence: 'Load',
|
|
61
|
+
value: 1,
|
|
62
|
+
max: 2,
|
|
63
|
+
caption: 'spent',
|
|
64
|
+
}
|
|
65
|
+
|
|
43
66
|
// @ts-expect-error a meter needs its sentence
|
|
44
67
|
export const unnamed: MeterProps = { value: 1, max: 2 }
|
|
45
68
|
|