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/dist/cli/sync/engine.js
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
} from "node:fs";
|
|
10
10
|
import { dirname, relative, resolve } from "node:path";
|
|
11
11
|
import { sha256 } from "../index.js";
|
|
12
|
+
import { AGENTS_FILE, agentsPath } from "../manifest.js";
|
|
12
13
|
import { scanBlock, spliceBlock } from "./block.js";
|
|
13
14
|
import { unitPath } from "./sibling.js";
|
|
14
|
-
const AGENTS_FILE = "AGENTS.md";
|
|
15
15
|
const readText = (root, path, repo) => {
|
|
16
16
|
try {
|
|
17
17
|
return readFileSync(unitPath(root, repo, path), "utf8");
|
|
@@ -25,10 +25,14 @@ function stateOf(unit, current, digest) {
|
|
|
25
25
|
return unit.generated === true || digest === sha256(current) ? "stale" : "edited";
|
|
26
26
|
}
|
|
27
27
|
function planSync(root, manifest, units, block, repo = root, drops = []) {
|
|
28
|
-
const items = units.map((unit) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const items = units.map((unit) => {
|
|
29
|
+
const state2 = stateOf(unit, readText(root, unit.path, repo), manifest.managed[unit.path]);
|
|
30
|
+
return {
|
|
31
|
+
...unit,
|
|
32
|
+
state: state2,
|
|
33
|
+
shadows: state2 === "edited" && manifest.managed[unit.path] === void 0
|
|
34
|
+
};
|
|
35
|
+
});
|
|
32
36
|
const wanted = new Set(units.map((unit) => unit.path));
|
|
33
37
|
const retired = Object.entries(manifest.managed).filter(([path]) => !wanted.has(path)).toSorted(([a], [b]) => a.localeCompare(b)).map(([path, digest]) => {
|
|
34
38
|
const current = readText(root, path, repo);
|
|
@@ -36,23 +40,25 @@ function planSync(root, manifest, units, block, repo = root, drops = []) {
|
|
|
36
40
|
return { path, state: state2 };
|
|
37
41
|
});
|
|
38
42
|
const dropped = drops.filter((path) => readText(root, path, repo) !== null);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
43
|
+
const agents = agentsPath(manifest);
|
|
44
|
+
const host = readText(root, agents, repo) ?? "";
|
|
45
|
+
const scan = scanBlock(host, agents);
|
|
41
46
|
if (typeof scan === "object" && "error" in scan) {
|
|
42
|
-
return { items, retired, drops: dropped, block: scan };
|
|
47
|
+
return { items, retired, agents, drops: dropped, block: scan };
|
|
43
48
|
}
|
|
44
49
|
if (block === null) {
|
|
45
50
|
const text2 = scan === "absent" ? host : cutBlock(host, scan);
|
|
46
51
|
return {
|
|
47
52
|
items,
|
|
48
53
|
retired,
|
|
54
|
+
agents,
|
|
49
55
|
drops: dropped,
|
|
50
56
|
block: { state: text2 === host ? "current" : "stale", text: text2 }
|
|
51
57
|
};
|
|
52
58
|
}
|
|
53
59
|
const text = spliceBlock(host, scan, block);
|
|
54
60
|
const state = scan === "absent" ? "missing" : text === host ? "current" : "stale";
|
|
55
|
-
return { items, retired, drops: dropped, block: { state, text } };
|
|
61
|
+
return { items, retired, agents, drops: dropped, block: { state, text } };
|
|
56
62
|
}
|
|
57
63
|
function cutBlock(host, scan) {
|
|
58
64
|
const before = host.slice(0, scan.start).trimEnd();
|
|
@@ -61,16 +67,20 @@ function cutBlock(host, scan) {
|
|
|
61
67
|
return text === "" ? "" : `${text}
|
|
62
68
|
`;
|
|
63
69
|
}
|
|
70
|
+
function shadowNote(path) {
|
|
71
|
+
const kind = path.includes("/rules/") ? "rule" : "file";
|
|
72
|
+
return `your file shadows a shipped ${kind}: rename it, then sync --force`;
|
|
73
|
+
}
|
|
64
74
|
function differences(plan) {
|
|
65
75
|
const how = { missing: "missing", stale: "out of date", edited: "edited locally", current: "" };
|
|
66
|
-
const lines = plan.items.filter((i) => i.state !== "current").map((i) => `${i.path}: ${how[i.state]}`);
|
|
76
|
+
const lines = plan.items.filter((i) => i.state !== "current").map((i) => i.shadows ? `${i.path}: ${shadowNote(i.path)}` : `${i.path}: ${how[i.state]}`);
|
|
67
77
|
for (const r of plan.retired) {
|
|
68
78
|
if (r.state !== "gone")
|
|
69
79
|
lines.push(`${r.path}: retired${r.state === "edited" ? " (edited locally)" : ""}`);
|
|
70
80
|
}
|
|
71
81
|
for (const path of plan.drops) lines.push(`${path}: no longer placed`);
|
|
72
82
|
if ("state" in plan.block && plan.block.state !== "current") {
|
|
73
|
-
lines.push(`${
|
|
83
|
+
lines.push(`${plan.agents}: basalt block ${how[plan.block.state]}`);
|
|
74
84
|
}
|
|
75
85
|
return lines;
|
|
76
86
|
}
|
|
@@ -120,8 +130,8 @@ function applySync(root, manifest, plan, force, repo = root) {
|
|
|
120
130
|
applied.removed++;
|
|
121
131
|
}
|
|
122
132
|
if ("state" in plan.block && plan.block.state !== "current") {
|
|
123
|
-
if (plan.block.text === "") remove(root,
|
|
124
|
-
else put(root,
|
|
133
|
+
if (plan.block.text === "") remove(root, plan.agents, repo);
|
|
134
|
+
else put(root, plan.agents, plan.block.text, repo);
|
|
125
135
|
applied.written++;
|
|
126
136
|
}
|
|
127
137
|
return applied;
|
|
@@ -130,5 +140,6 @@ export {
|
|
|
130
140
|
AGENTS_FILE,
|
|
131
141
|
applySync,
|
|
132
142
|
differences,
|
|
133
|
-
planSync
|
|
143
|
+
planSync,
|
|
144
|
+
shadowNote
|
|
134
145
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/sync/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAK3C,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gFAAgF;IAChF,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,yGAAyG;IACzG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,0GAA0G;IAC1G,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AA2CD,wBAAgB,IAAI,CAAC,IAAI,GAAE,WAAgB,EAAE,aAAa,GAAE,MAAsB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/sync/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAK3C,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gFAAgF;IAChF,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,yGAAyG;IACzG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,0GAA0G;IAC1G,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AA2CD,wBAAgB,IAAI,CAAC,IAAI,GAAE,WAAgB,EAAE,aAAa,GAAE,MAAsB,GAAG,MAAM,CAsF1F"}
|
package/dist/cli/sync/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { findManifestAbove } from "../install-root.js";
|
|
|
6
6
|
import { BUDGET_FORMAT, BUDGET_PATH, migrateBudget, readBudget } from "../budget/index.js";
|
|
7
7
|
import { staleRecord } from "../lint/record.js";
|
|
8
8
|
import { MANIFEST_FORMAT, MANIFEST_PATH, readManifest, writeManifest } from "../manifest.js";
|
|
9
|
-
import { applySync, differences, planSync } from "./engine.js";
|
|
9
|
+
import { applySync, differences, planSync, shadowNote } from "./engine.js";
|
|
10
10
|
import { lintSettingsUnits } from "../lint-settings.js";
|
|
11
11
|
import { presetFilesFor } from "../presets.js";
|
|
12
12
|
import { coveredByRoots, undeclaredInstall } from "../resolver.js";
|
|
@@ -102,7 +102,8 @@ function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
|
102
102
|
return 1;
|
|
103
103
|
}
|
|
104
104
|
const bases = repo === root ? [root] : [root, repo];
|
|
105
|
-
const
|
|
105
|
+
const agents = [plan.agents];
|
|
106
|
+
const before = agentFiles(bases, agents);
|
|
106
107
|
const applied = applySync(root, manifest, plan, opts.force === true, repo);
|
|
107
108
|
applyEjected(root, ejects);
|
|
108
109
|
migrateBudget(root);
|
|
@@ -113,10 +114,12 @@ function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
|
113
114
|
);
|
|
114
115
|
if (applied.left.length > 0) {
|
|
115
116
|
console.log("Locally edited files were left as they are (run with --force to overwrite):");
|
|
116
|
-
|
|
117
|
+
const shadowed = new Set(plan.items.filter((i) => i.shadows).map((i) => i.path));
|
|
118
|
+
for (const path of applied.left)
|
|
119
|
+
console.log(` ${path}${shadowed.has(path) ? `: ${shadowNote(path)}` : ""}`);
|
|
117
120
|
}
|
|
118
121
|
for (const problem of install.problems) console.error(`✖ basalt-ui sync: ${problem}`);
|
|
119
|
-
const note = opts.note === false ? null : sessionNote(before, bases);
|
|
122
|
+
const note = opts.note === false ? null : sessionNote(before, bases, agents);
|
|
120
123
|
if (note !== null) console.log(`
|
|
121
124
|
${note}`);
|
|
122
125
|
return ejects.conflicts.length + ejects.errors.length + install.problems.length === 0 ? 0 : 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","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4BxD"}
|
package/dist/cli/sync/render.js
CHANGED
|
@@ -3,9 +3,9 @@ import { join, relative, resolve, sep } from "node:path";
|
|
|
3
3
|
import { renderRulePaths } from "../index.js";
|
|
4
4
|
import { HARNESS_NAMES, HOOK_ADAPTERS, HOOK_TARGETS, harnessesOf, placementFor } from "../harness.js";
|
|
5
5
|
import { hooksObject, mergeSettings, SHIM, stripHookEntries } from "../lint/settings.js";
|
|
6
|
-
import { isSiteManifest } from "../manifest.js";
|
|
6
|
+
import { DEFAULT_REPORT, designPath, isSiteManifest } from "../manifest.js";
|
|
7
7
|
import { renderTokens } from "../tokens-css.js";
|
|
8
|
-
import { portableSkill,
|
|
8
|
+
import { portableSkill, subagentFor } from "./formats.js";
|
|
9
9
|
import { REPO, renameRefs, siblingName } from "./sibling.js";
|
|
10
10
|
function profiledRoots(manifest) {
|
|
11
11
|
const roots = Object.entries(manifest.roots).filter(([, profile]) => profile !== "tokens").map(([root, profile]) => [
|
|
@@ -148,7 +148,7 @@ function renderBlock(pkgRoot, manifest, version, sibling = null) {
|
|
|
148
148
|
};
|
|
149
149
|
const fill = (_, key) => vars[key] ?? `{{${key}}}`;
|
|
150
150
|
let block = readFileSync(template, "utf8").replace(/\{\{(\w+)\}\}/g, fill).replace(/\n{3,}/g, "\n\n").trim();
|
|
151
|
-
if (!site && profiles.includes("site")) block = withSiteSkill(block
|
|
151
|
+
if (!site && profiles.includes("site")) block = withSiteSkill(block);
|
|
152
152
|
return sibling === null ? block : renameRefs(block, sibling.prefix, skillNames(pkgRoot));
|
|
153
153
|
}
|
|
154
154
|
const placesBlock = (manifest) => harnessesOf(manifest).length > 0;
|
|
@@ -166,50 +166,43 @@ function layerVars(units, manifest, unhookedInstall) {
|
|
|
166
166
|
const harnesses = harnessesOf(manifest);
|
|
167
167
|
const placement = placementFor(manifest);
|
|
168
168
|
const site = isSiteManifest(manifest);
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
const ruleDirs = [
|
|
170
|
+
...new Set(
|
|
171
|
+
units.filter((u) => u.source?.startsWith("agent/rules/") === true).map((u) => posixRepo(u.path).split("/").slice(0, -1).join("/"))
|
|
172
|
+
)
|
|
173
|
+
];
|
|
174
174
|
const skillDirs = placement.skills.map((dir) => {
|
|
175
175
|
const readers = (SKILL_READERS[dir] ?? []).filter((h) => harnesses.includes(h));
|
|
176
176
|
const shown = placement.skills.length > 1 ? readers.filter((h) => h !== "opencode" || dir === ".claude/skills") : readers;
|
|
177
177
|
return `${code(`${dir}/`)} (${names(shown)})`;
|
|
178
178
|
});
|
|
179
|
-
const
|
|
179
|
+
const placedReviewer = units.some(
|
|
180
|
+
(u) => u.source?.startsWith("agent/reviewer/") === true && u.source.includes("basalt-site-reviewer") === true === site
|
|
181
|
+
);
|
|
180
182
|
const hooked = unhookedInstall ? [] : [...placement.hooks, ...placement.adapters].map((t) => t.harness).toSorted((a, b) => harnesses.indexOf(a) - harnesses.indexOf(b));
|
|
181
183
|
const unhooked = harnesses.filter((h) => !hooked.includes(h));
|
|
182
184
|
const lintFirst = "run `basalt-ui lint --changed` before reporting done";
|
|
183
185
|
const hook = manifest.hook === false ? `Off (\`hook: false\` in \`.basalt/manifest.json\`): ${lintFirst}.` : [
|
|
184
186
|
hooked.length === 0 ? "" : `\`.basalt/hook.mjs\` lints each edit in ${names(hooked)} as it is written and refuses an edit of a managed file.`,
|
|
185
187
|
hooked.includes("codex") ? "Codex runs it once you trust it in `/hooks`." : "",
|
|
186
|
-
hooked.includes("pi") ? "Pi runs it
|
|
187
|
-
hooked.includes("opencode") ? `OpenCode 2 has no end-of-turn re-check
|
|
188
|
+
hooked.includes("pi") ? "Pi runs it once you trust the project." : "",
|
|
189
|
+
hooked.includes("opencode") ? `OpenCode 1 loads no hook and OpenCode 2 has no end-of-turn re-check: there, ${lintFirst}.` : "",
|
|
188
190
|
unhooked.length === 0 ? "" : `${names(unhooked)} ${unhooked.length === 1 ? "runs" : "run"} no edit hook here: ${lintFirst}.`,
|
|
189
191
|
"`bun run check` is the gate."
|
|
190
192
|
].filter((s) => s !== "").join(" ");
|
|
191
|
-
const load = harnesses.includes("claude-code") ? "Claude Code loads each by its paths; any other agent reads the
|
|
193
|
+
const load = harnesses.includes("claude-code") ? "Claude Code loads each by its paths; any other agent reads the one whose paths match before it edits" : "each names its paths: read the one that matches before you edit";
|
|
192
194
|
return {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
RULES_AT: ruleDirs.map((dir) => code(`${dir}/`)).join(" and "),
|
|
196
|
+
LOAD: load,
|
|
197
|
+
DESIGN: designPath(manifest),
|
|
198
|
+
REPORT: manifest.report ?? DEFAULT_REPORT,
|
|
196
199
|
SKILLS_AT: skillDirs.join(" and "),
|
|
197
|
-
|
|
198
|
-
REVIEWER_AT: reviewer.length === 0 ? `no subagent in Pi: hand \`node_modules/basalt-ui/agent/reviewer/${site ? "basalt-site-reviewer" : "basalt-design-reviewer"}.md\` to a fresh session` : reviewer.join(", "),
|
|
200
|
+
REVIEWER: placedReviewer ? `; the \`basalt-${site ? "site" : "design"}-reviewer\` subagent` : "",
|
|
199
201
|
HOOK: hook
|
|
200
202
|
};
|
|
201
203
|
}
|
|
202
|
-
function withSiteSkill(block
|
|
203
|
-
|
|
204
|
-
const bullet = existsSync(siteBlock) ? /^- `\/basalt-site`:.*$/m.exec(readFileSync(siteBlock, "utf8"))?.[0] : void 0;
|
|
205
|
-
if (bullet === void 0) return block;
|
|
206
|
-
const skills = [...block.matchAll(/^- `\/basalt-[a-z-]+`:.*$/gm)].at(-1);
|
|
207
|
-
if (skills === void 0) return `${block}
|
|
208
|
-
|
|
209
|
-
${bullet}`;
|
|
210
|
-
const at = (skills.index ?? 0) + skills[0].length;
|
|
211
|
-
return `${block.slice(0, at)}
|
|
212
|
-
${bullet}${block.slice(at)}`;
|
|
204
|
+
function withSiteSkill(block) {
|
|
205
|
+
return block.replace("`/basalt-app`", (app) => `${app}, \`/basalt-site\``);
|
|
213
206
|
}
|
|
214
207
|
const HOOK_TEMPLATE = "agent/templates/hook.mjs.tpl";
|
|
215
208
|
const ADAPTER_RUNNER_TEMPLATE = "agent/templates/hook-run.js.tpl";
|
package/dist/cli/tokens-css.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare function renderTokens(argv: readonly string[], cwd: string, versi
|
|
|
31
31
|
* - `--accent --neutral --vibrancy` retune the identity; a config that fails a gate exits 1 with
|
|
32
32
|
* the gate, the scheme and the ratio.
|
|
33
33
|
* - `--selector ":root[<attr>]"` emits a tenant sheet: only the roles that differ from the default.
|
|
34
|
+
* - `--pick canvas,ink` cuts the sheet down to those tokens and what they reference, for a standalone
|
|
35
|
+
* document that loads no basalt sheet.
|
|
34
36
|
* - `--extra <file>` emits the app-owned tokens instead (see `./tokens-css-extra`).
|
|
35
37
|
* - `--check` writes nothing and exits 1 on any byte of drift in what `--out` names.
|
|
36
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens-css.d.ts","sourceRoot":"","sources":["../../src/cli/tokens-css.ts"],"names":[],"mappings":"AAuCA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK3D;
|
|
1
|
+
{"version":3,"file":"tokens-css.d.ts","sourceRoot":"","sources":["../../src/cli/tokens-css.ts"],"names":[],"mappings":"AAuCA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK3D;AAuKD,wGAAwG;AACxG,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAyC1F;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA+D/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAa7E;AAkBD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAa7E"}
|
package/dist/cli/tokens-css.js
CHANGED
|
@@ -13,7 +13,7 @@ function flagValue(flags, name) {
|
|
|
13
13
|
return value === void 0 || value.startsWith("--") ? void 0 : value;
|
|
14
14
|
}
|
|
15
15
|
function generatedHeader(version, command, flags) {
|
|
16
|
-
const shown = flags
|
|
16
|
+
const shown = recordedFlags(flags);
|
|
17
17
|
const invocation = shown.length === 0 ? command : `${command} ${shown.join(" ")}`;
|
|
18
18
|
return `${GENERATED_HEADER_LINE}
|
|
19
19
|
/* basalt-ui ${version} — \`basalt-ui ${invocation}\` */
|
|
@@ -84,6 +84,7 @@ const VALUE_FLAGS = [
|
|
|
84
84
|
"--vibrancy",
|
|
85
85
|
"--selector",
|
|
86
86
|
"--accents",
|
|
87
|
+
"--pick",
|
|
87
88
|
"--extra",
|
|
88
89
|
"--format",
|
|
89
90
|
"--out"
|
|
@@ -143,9 +144,17 @@ function readAccents(flags) {
|
|
|
143
144
|
return { names };
|
|
144
145
|
}
|
|
145
146
|
function invocationOf(flags) {
|
|
146
|
-
const shown = flags
|
|
147
|
+
const shown = recordedFlags(flags);
|
|
147
148
|
return shown.length === 0 ? "basalt-ui tokens:css" : `basalt-ui tokens:css ${shown.join(" ")}`;
|
|
148
149
|
}
|
|
150
|
+
function recordedFlags(flags) {
|
|
151
|
+
return flags.flatMap((f, i) => {
|
|
152
|
+
const prev = flags[i - 1];
|
|
153
|
+
if (f === "--check" || f === "--out" || prev === "--out") return [];
|
|
154
|
+
if (prev === "--extra") return [];
|
|
155
|
+
return f === "--extra" ? ["--extra", "<file>"] : [f];
|
|
156
|
+
});
|
|
157
|
+
}
|
|
149
158
|
function extraOutput(flags, cwd, version) {
|
|
150
159
|
const file = flagValue(flags, "--extra");
|
|
151
160
|
const out = flagValue(flags, "--out");
|
|
@@ -154,9 +163,15 @@ function extraOutput(flags, cwd, version) {
|
|
|
154
163
|
error: "tokens:css --extra needs --out <path>: the app sheet is a committed file, so there is no stdout form."
|
|
155
164
|
};
|
|
156
165
|
}
|
|
157
|
-
const clash = [
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
const clash = [
|
|
167
|
+
"--accent",
|
|
168
|
+
"--neutral",
|
|
169
|
+
"--vibrancy",
|
|
170
|
+
"--selector",
|
|
171
|
+
"--accents",
|
|
172
|
+
"--pick",
|
|
173
|
+
"--format"
|
|
174
|
+
].find((f) => flags.includes(f));
|
|
160
175
|
if (clash !== void 0) {
|
|
161
176
|
return {
|
|
162
177
|
error: `tokens:css --extra emits the app-owned sheet only; ${clash} belongs to the basalt-ui sheet — run it without --extra.`
|
|
@@ -197,11 +212,18 @@ function renderTokens(argv, cwd, version) {
|
|
|
197
212
|
};
|
|
198
213
|
}
|
|
199
214
|
}
|
|
215
|
+
const pick = flagValue(flags, "--pick")?.split(",").map((n) => n.trim()).filter((n) => n !== "");
|
|
216
|
+
if (pick !== void 0 && (selector !== void 0 || accents !== null || format === "json" || pick.length === 0)) {
|
|
217
|
+
return {
|
|
218
|
+
error: "tokens:css: --pick <name,…> cuts the full stylesheet down; drop --selector, --accents and --format."
|
|
219
|
+
};
|
|
220
|
+
}
|
|
200
221
|
const options = {
|
|
201
222
|
version,
|
|
202
223
|
command: invocationOf(flags),
|
|
203
224
|
...Object.keys(read.config).length === 0 ? {} : { config: read.config },
|
|
204
|
-
...selector === void 0 ? {} : { selector }
|
|
225
|
+
...selector === void 0 ? {} : { selector },
|
|
226
|
+
...pick === void 0 ? {} : { pick }
|
|
205
227
|
};
|
|
206
228
|
let content;
|
|
207
229
|
try {
|
|
@@ -50,7 +50,7 @@ export type FilterSpec<T, Scope extends FilterScope = FilterScope> = {
|
|
|
50
50
|
export type SpecOptions<T, V = T> = Pick<FilterSpec<T>, 'options' | 'clearable' | 'placeholder' | 'facets' | 'unit' | 'now' | 'timeZone'> & {
|
|
51
51
|
as?: ControlForm<V>;
|
|
52
52
|
};
|
|
53
|
-
export type ControlHome = 'page-bar' | 'section-header' | 'view-mode' | 'card-header' | 'tool' | 'form-row' | 'aside' | 'sheet' | 'side-panel' | 'overlay';
|
|
53
|
+
export type ControlHome = 'page-bar' | 'section-header' | 'view-mode' | 'card-header' | 'tool' | 'form-row' | 'aside' | 'sheet' | 'side-panel' | 'overlay' | 'command';
|
|
54
54
|
export type ControlPresentation = 'pill' | 'row' | 'inline';
|
|
55
55
|
/** Never a `variant` prop. A `FilterSet` outside any `ControlHome` is `pill`. */
|
|
56
56
|
export type HomePresentation = {
|
|
@@ -64,6 +64,7 @@ export type HomePresentation = {
|
|
|
64
64
|
sheet: 'row';
|
|
65
65
|
'side-panel': 'row';
|
|
66
66
|
overlay: 'row';
|
|
67
|
+
command: 'row';
|
|
67
68
|
};
|
|
68
69
|
export type ControlHomeProps = {
|
|
69
70
|
home: ControlHome;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/controls/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAMpG,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEjG,6FAA6F;AAC7F,KAAK,cAAc,GACf,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,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,CAAC,CAAC,EAAE;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,KAAK,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAA"}
|
|
@@ -12,13 +12,16 @@ export declare const HOME_PRESENTATION: {
|
|
|
12
12
|
readonly sheet: "row";
|
|
13
13
|
readonly 'side-panel': "row";
|
|
14
14
|
readonly overlay: "row";
|
|
15
|
+
readonly command: "row";
|
|
15
16
|
};
|
|
16
17
|
/** The presentation a home gives its controls, outside any fold. */
|
|
17
18
|
export declare function presentationOf(home: HomeName): ControlPresentation;
|
|
18
19
|
/**
|
|
19
20
|
* Hosts controls and gives them the presentation of its `home`. A `FilterSet` or a `filterSlot`
|
|
20
21
|
* inside reads it; with no home around, a control is a `pill`. A home with nothing to draw renders
|
|
21
|
-
* nothing, so an empty slot leaves no gap.
|
|
22
|
+
* nothing, so an empty slot leaves no gap. A control that sends a request and holds no stored value
|
|
23
|
+
* (an absolute volume sent on release) goes in `home="command"`: it is named by its own label, and
|
|
24
|
+
* the app owns the shown value (the reported one, or the pick until the request answers).
|
|
22
25
|
*
|
|
23
26
|
* @useWhen you place controls in a surface that is not a slot of a composite (an aside, a sheet, a toolbar)
|
|
24
27
|
* @neverWhen you want a different look for one control: the home decides the look, never a prop
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-home.d.ts","sourceRoot":"","sources":["../../src/controls/control-home.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"control-home.d.ts","sourceRoot":"","sources":["../../src/controls/control-home.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQpD,OAAO,KAAK,EACV,WAAW,IAAI,QAAQ,EACvB,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,YAAY,CAAA;AAGnB,yFAAyF;AACzF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;CAYO,CAAA;AAWrC,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,CAElE;AAeD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,YAAY,GAAG,IAAI,CAsCrF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,YAAY,CAQnF"}
|
|
@@ -17,7 +17,8 @@ const HOME_PRESENTATION = {
|
|
|
17
17
|
aside: "row",
|
|
18
18
|
sheet: "row",
|
|
19
19
|
"side-panel": "row",
|
|
20
|
-
overlay: "row"
|
|
20
|
+
overlay: "row",
|
|
21
|
+
command: "row"
|
|
21
22
|
};
|
|
22
23
|
const TOOLBAR_HOMES = /* @__PURE__ */ new Set(["view-mode", "tool"]);
|
|
23
24
|
const FOLDING_HOMES = /* @__PURE__ */ new Set(["page-bar", "section-header"]);
|
|
@@ -42,7 +43,8 @@ function ControlHome({ home, children }) {
|
|
|
42
43
|
const presentation = folded ? "row" : presentationOf(home);
|
|
43
44
|
const toolbar = TOOLBAR_HOMES.has(home) && !folded;
|
|
44
45
|
const slotHome = !folded && FOLDING_HOMES.has(home) ? home : void 0;
|
|
45
|
-
|
|
46
|
+
const frame = cn("m-0 border-0 p-0 empty:hidden", FRAME[presentation]);
|
|
47
|
+
return /* @__PURE__ */ jsx(ControlPresentationContext, { value: presentation, children: /* @__PURE__ */ jsx(SlotHomeContext, { value: slotHome, children: home === "command" ? /* @__PURE__ */ jsx("div", { "data-slot": "control-command", "data-home": home, className: frame, children }) : toolbar ? /* @__PURE__ */ jsx(
|
|
46
48
|
Toolbar,
|
|
47
49
|
{
|
|
48
50
|
"aria-label": t("common.filters"),
|
|
@@ -56,7 +58,7 @@ function ControlHome({ home, children }) {
|
|
|
56
58
|
"data-slot": SLOT[presentation],
|
|
57
59
|
"data-home": home,
|
|
58
60
|
"aria-label": t("common.filters"),
|
|
59
|
-
className:
|
|
61
|
+
className: frame,
|
|
60
62
|
children
|
|
61
63
|
}
|
|
62
64
|
) }) });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ControlHandle } from '../core/ports.js';
|
|
1
2
|
/**
|
|
2
3
|
* A value that lives as long as the component that owns it (a dialog's draft, a popover's choice),
|
|
3
4
|
* shaped like a handle: `FormField control=` reads it and a control binds to it, so no `persisted`
|
|
@@ -8,18 +9,44 @@ export type LocalControl<T> = {
|
|
|
8
9
|
/** False once the value differs from the one it started with: `FormField` shows its dot. */
|
|
9
10
|
readonly isDefault: boolean;
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* What a local value needs to stand as a card's control: the identity and the kind a `spec` is drawn
|
|
14
|
+
* from, as `externalField` takes them.
|
|
15
|
+
*/
|
|
16
|
+
export type LocalFieldOptions<T> = {
|
|
17
|
+
/** Stable identity of the control within its slot (`ControlHandle.key`). */
|
|
18
|
+
key: string;
|
|
19
|
+
kind: ControlHandle<T>['kind'];
|
|
20
|
+
options?: ControlHandle<T>['options'];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A local value as a widget-scoped `ControlHandle`: `spec(handle, label)` makes a spec a card's
|
|
24
|
+
* `controls` slot takes (`ChartCard`, `StatCard`, `DataPanel`). It has no lane and `clear()` writes
|
|
25
|
+
* the starting value back.
|
|
26
|
+
*/
|
|
27
|
+
export type LocalField<T> = ControlHandle<T> & {
|
|
28
|
+
readonly scope: 'widget';
|
|
29
|
+
};
|
|
11
30
|
/**
|
|
12
31
|
* The handle of a value that lives in the calling component: it starts at `initial`, resets when the
|
|
13
32
|
* component unmounts (a closed dialog) and is shared with nothing. Call it where a hook may be
|
|
14
33
|
* called and pass the result to `FormField control=`.
|
|
15
34
|
*
|
|
16
|
-
*
|
|
35
|
+
* Given `{ key, kind }` it is a card's own control instead: a window or a mode that only that card
|
|
36
|
+
* reads, drawn through `filterSlot([spec(handle, 'Window')])` in the card's `controls`.
|
|
37
|
+
*
|
|
38
|
+
* @useWhen a control's value lives as long as one dialog, sheet, popover or card and nothing outside it reads it
|
|
17
39
|
* @neverWhen the value should survive a reload (use `persisted`), appear in a shared link (use a router field) or is another store's (use `externalField`)
|
|
18
40
|
* @instead externalField
|
|
19
41
|
*
|
|
20
42
|
* @example
|
|
21
43
|
* const view = useLocalControl<'list' | 'grid'>('list')
|
|
22
44
|
* <FormField label="Layout" control={view}>{(bind) => <Segmented {...bind} options={LAYOUTS} />}</FormField>
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const window = useLocalControl('24h', { key: 'window', kind: 'enum', options: WINDOWS })
|
|
48
|
+
* <ChartCard title="Throughput" controls={filterSlot([spec(window, 'Window', { as: 'segmented' })])} chart={…} />
|
|
23
49
|
*/
|
|
24
50
|
export declare function useLocalControl<T>(initial: T | (() => T)): LocalControl<T>;
|
|
51
|
+
export declare function useLocalControl<T>(initial: T | (() => T), field: LocalFieldOptions<T>): LocalField<T>;
|
|
25
52
|
//# sourceMappingURL=local-control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-control.d.ts","sourceRoot":"","sources":["../../src/controls/local-control.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-control.d.ts","sourceRoot":"","sources":["../../src/controls/local-control.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;IAC3C,4FAA4F;IAC5F,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;CACtC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAC3E,wBAAgB,eAAe,CAAC,CAAC,EAC/B,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EACtB,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC1B,UAAU,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
function useLocalControl(initial) {
|
|
2
|
+
function useLocalControl(initial, field) {
|
|
3
3
|
const [start] = useState(initial);
|
|
4
4
|
const [value, set] = useState(start);
|
|
5
|
-
|
|
5
|
+
const control = {
|
|
6
6
|
useValue: () => [value, set],
|
|
7
7
|
isDefault: Object.is(value, start)
|
|
8
8
|
};
|
|
9
|
+
if (field === void 0) return control;
|
|
10
|
+
const source = { source: "own", inherited: void 0 };
|
|
11
|
+
return {
|
|
12
|
+
key: field.key,
|
|
13
|
+
kind: field.kind,
|
|
14
|
+
...field.options === void 0 ? {} : { options: field.options },
|
|
15
|
+
scope: "widget",
|
|
16
|
+
useValue: () => [value, set],
|
|
17
|
+
useSource: () => source,
|
|
18
|
+
clear: () => set(start),
|
|
19
|
+
isDefault: control.isDefault
|
|
20
|
+
};
|
|
9
21
|
}
|
|
10
22
|
export {
|
|
11
23
|
useLocalControl
|
package/dist/core/cn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/core/cn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGtC;;;;;GAKG;AACH,YAAY,EAAE,UAAU,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/core/cn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGtC;;;;;GAKG;AACH,YAAY,EAAE,UAAU,EAAE,CAAA;AA6Y1B,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAGlD"}
|
package/dist/core/cn.js
CHANGED
|
@@ -74,7 +74,8 @@ exact("border-collapse", "border-collapse border-separate");
|
|
|
74
74
|
const LENGTH = /^\[(?:[-+]?[\d.]+[a-z%]*|(?:calc|min|max|clamp)\(.*)\]$/;
|
|
75
75
|
const NUMBER = /^(?:\d+(?:\.\d+)?|px|\[.*\])$/;
|
|
76
76
|
const STRICT_NUMBER = /^\d+(?:\.\d+)?$/;
|
|
77
|
-
const PALETTE = /^(?:[a-z]+-\d{2,3}|black|white|transparent|current|inherit)$/;
|
|
77
|
+
const PALETTE = /^(?:[a-z]+-\d{2,3}|black|white|transparent|current|inherit|sidebar.*|.+-foreground)$/;
|
|
78
|
+
const STEP = /^(?:2?xs|sm|md|lg|\d?xl)$/;
|
|
78
79
|
const BG_KEYWORD = {
|
|
79
80
|
fixed: "bg-attachment",
|
|
80
81
|
local: "bg-attachment",
|
|
@@ -210,7 +211,7 @@ rule(
|
|
|
210
211
|
(rest) => rest === "discrete" || rest === "normal" ? "transition-behavior" : "transition"
|
|
211
212
|
);
|
|
212
213
|
rule("font", (rest) => {
|
|
213
|
-
if (THEME.fonts.has(rest)) return "font-family";
|
|
214
|
+
if (THEME.fonts.has(rest) || rest === "heading") return "font-family";
|
|
214
215
|
return arbitraryKind(rest) === "family-name" ? "font-family" : "font-weight";
|
|
215
216
|
});
|
|
216
217
|
rule("flex", (rest) => {
|
|
@@ -224,7 +225,7 @@ rule(
|
|
|
224
225
|
(rest) => /^(?:contain|cover|fill|none|scale-down)$/.test(rest) ? "object-fit" : "object-position"
|
|
225
226
|
);
|
|
226
227
|
rule("text", (rest) => {
|
|
227
|
-
if (THEME.sizes.has(rest)) return "font-size";
|
|
228
|
+
if (THEME.sizes.has(rest) || STEP.test(rest)) return "font-size";
|
|
228
229
|
if (/^(?:left|center|right|justify|start|end)$/.test(rest)) return "text-align";
|
|
229
230
|
if (/^(?:wrap|nowrap|balance|pretty)$/.test(rest)) return "text-wrap";
|
|
230
231
|
if (rest === "ellipsis" || rest === "clip") return "text-overflow";
|
|
@@ -251,12 +252,12 @@ rule("border", (rest) => {
|
|
|
251
252
|
for (const s of ["x", "y", ...SIDES, "s", "e"]) rule(`border-${s}`, side("border", s));
|
|
252
253
|
rule(
|
|
253
254
|
"rounded",
|
|
254
|
-
(rest) => rest === "" || THEME.radii.has(rest) ||
|
|
255
|
+
(rest) => rest === "" || THEME.radii.has(rest) || STEP.test(rest) || rest[0] === "[" ? "rounded" : void 0
|
|
255
256
|
);
|
|
256
257
|
for (const s of ["t", "r", "b", "l", "s", "e", "tl", "tr", "br", "bl", "ss", "se", "ee", "es"])
|
|
257
258
|
rule(`rounded-${s}`, always(`rounded-${s}`));
|
|
258
259
|
rule("shadow", (rest) => {
|
|
259
|
-
if (rest === "" || THEME.shadows.has(rest)) return "shadow";
|
|
260
|
+
if (rest === "" || THEME.shadows.has(rest) || STEP.test(rest)) return "shadow";
|
|
260
261
|
if (!rest.startsWith("[")) return "shadow-color";
|
|
261
262
|
return /^\[(?:color:|#|rgb|hsl|oklch|var\()/.test(rest) ? "shadow-color" : "shadow";
|
|
262
263
|
});
|
|
@@ -9,6 +9,8 @@ import type { Format } from './format.js';
|
|
|
9
9
|
import type { FrameFigure } from './phase.js';
|
|
10
10
|
/** Numbers print in the provider's locale and grouping; a non-finite number is absent, never `NaN`. */
|
|
11
11
|
export declare function formatValue(value: number | string | null, format: Format): string | null;
|
|
12
|
+
/** True when the figure and its unit are long enough to step down a size in a card narrower than `regular`. */
|
|
13
|
+
export declare const isLongFigure: (text: string | null, unit: string | undefined) => boolean;
|
|
12
14
|
export declare function FigureRow({ figure, loading, failed, blank, }: {
|
|
13
15
|
figure: FrameFigure;
|
|
14
16
|
loading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-figure.d.ts","sourceRoot":"","sources":["../../src/core/frame-figure.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIxF;
|
|
1
|
+
{"version":3,"file":"frame-figure.d.ts","sourceRoot":"","sources":["../../src/core/frame-figure.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIxF;AAkBD,+GAA+G;AAC/G,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,MAAM,GAAG,SAAS,KAAG,OACN,CAAA;AA4CvE,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAc,GACf,EAAE;IACD,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,8GAA8G;IAC9G,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,YAAY,CAsGf"}
|
|
@@ -19,6 +19,8 @@ const DOT = {
|
|
|
19
19
|
};
|
|
20
20
|
const MONO = "font-mono tabular-nums";
|
|
21
21
|
const LONG_FIGURE = 10;
|
|
22
|
+
const UNIT_WEIGHT = 0.4;
|
|
23
|
+
const isLongFigure = (text, unit) => (text?.length ?? 0) + (unit?.length ?? 0) * UNIT_WEIGHT > LONG_FIGURE;
|
|
22
24
|
const READOUT_BOX = "flex min-w-0 flex-1 items-center gap-2 text-xs leading-4 tabular-nums @max-regular:h-4 @max-regular:basis-full";
|
|
23
25
|
const PERIOD_TEXT = "min-w-0 truncate";
|
|
24
26
|
function PeriodHold({
|
|
@@ -78,7 +80,7 @@ function FigureRow({
|
|
|
78
80
|
className: cn(
|
|
79
81
|
// The answer is never cut: the figure keeps its width and the delta beside it gives way.
|
|
80
82
|
"shrink-0 text-display font-semibold whitespace-nowrap tabular-nums",
|
|
81
|
-
(text
|
|
83
|
+
isLongFigure(text, unit) && "@max-regular:text-lg",
|
|
82
84
|
text === null && "text-muted-foreground"
|
|
83
85
|
),
|
|
84
86
|
children: [
|
|
@@ -149,5 +151,6 @@ function FigureRow({
|
|
|
149
151
|
}
|
|
150
152
|
export {
|
|
151
153
|
FigureRow,
|
|
152
|
-
formatValue
|
|
154
|
+
formatValue,
|
|
155
|
+
isLongFigure
|
|
153
156
|
};
|