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
|
@@ -751,24 +751,27 @@ export function yTickValues<T>(opts: {
|
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
/**
|
|
754
|
-
*
|
|
755
|
-
* shrink the plot to make room for it
|
|
756
|
-
* (anchor
|
|
757
|
-
* the width is not known.
|
|
754
|
+
* Where a band or category label centred on its tick would hang past a plot edge: past the right one the
|
|
755
|
+
* engine would shrink the plot to make room for it, past the left one it covers the lowest y label. Such a
|
|
756
|
+
* label is aligned to that edge instead (its anchor, and the shift from its centre to the edge, px).
|
|
757
|
+
* `undefined` when it fits or the width is not known.
|
|
758
758
|
*/
|
|
759
|
-
function
|
|
759
|
+
function bandEdge<X extends ChartX>(
|
|
760
760
|
model: XScaleModel<X>,
|
|
761
761
|
value: ChartValue,
|
|
762
762
|
text: string,
|
|
763
763
|
width: number | undefined,
|
|
764
764
|
yRoom: number,
|
|
765
|
-
): number | undefined {
|
|
765
|
+
): { anchor: 'start' | 'end'; dx: number } | undefined {
|
|
766
766
|
if (width === undefined || !Number.isFinite(width)) return undefined
|
|
767
767
|
const plotWidth = Math.max(0, width - yRoom)
|
|
768
768
|
const centre = model.fraction(value as X)
|
|
769
769
|
if (centre === null || plotWidth <= 0) return undefined
|
|
770
|
-
const
|
|
771
|
-
|
|
770
|
+
const half = captionWidth(text, TICK_FONT) / 2
|
|
771
|
+
const toRight = (1 - centre) * plotWidth
|
|
772
|
+
if (half > toRight) return { anchor: 'end', dx: toRight }
|
|
773
|
+
const toLeft = centre * plotWidth
|
|
774
|
+
return half > toLeft ? { anchor: 'start', dx: -toLeft } : undefined
|
|
772
775
|
}
|
|
773
776
|
|
|
774
777
|
/** The buckets of a band Date axis, or `null` for any other axis. */
|
|
@@ -853,6 +856,16 @@ export function fitToSlot(text: string, slot: number): string {
|
|
|
853
856
|
return text
|
|
854
857
|
}
|
|
855
858
|
|
|
859
|
+
/** Whether cutting every name with `cut` keeps as many distinct texts as the names have: no two names read alike after it. */
|
|
860
|
+
export function cutKeepsNamesApart<T>(
|
|
861
|
+
names: readonly T[],
|
|
862
|
+
written: (v: T) => string,
|
|
863
|
+
cut: (v: T) => string,
|
|
864
|
+
): boolean {
|
|
865
|
+
const whole = new Set(names.map((v) => written(v))).size
|
|
866
|
+
return new Set(names.map((v) => cut(v))).size === whole
|
|
867
|
+
}
|
|
868
|
+
|
|
856
869
|
/** What the x axis' tick labels are built from: the scale, the caller's ticks and format, the class and the chart's width. */
|
|
857
870
|
type XTickSetupOpts<X extends ChartX> = {
|
|
858
871
|
model: XScaleModel<X>
|
|
@@ -882,8 +895,7 @@ function xTickSetup<X extends ChartX>(opts: XTickSetupOpts<X>) {
|
|
|
882
895
|
: [Number.NaN, Number.NaN]
|
|
883
896
|
// A label centred on a tick near the plot's left edge hangs left of it, under the gutter's
|
|
884
897
|
// lowest y label: start-anchor it. `+value` is a Date's timestamp, or the number itself.
|
|
885
|
-
//
|
|
886
|
-
// plot: it is right-aligned to the edge instead (see `dx`).
|
|
898
|
+
// A band or category label that hangs over a plot edge is aligned to that edge instead (see `bandEdge`).
|
|
887
899
|
const yRoom = opts.yRoom ?? Y_GUTTER
|
|
888
900
|
const layout = (format: (v: ChartValue) => string) => {
|
|
889
901
|
// With no y gutter (the labels sit inside the plot) and no margin, a label centred nearer an edge than half its
|
|
@@ -899,24 +911,22 @@ function xTickSetup<X extends ChartX>(opts: XTickSetupOpts<X>) {
|
|
|
899
911
|
const anchor = ({ value }: { value: ChartValue }) => {
|
|
900
912
|
const edge = edgeAnchor(value)
|
|
901
913
|
if (edge !== undefined) return edge
|
|
902
|
-
if (model.band)
|
|
903
|
-
return
|
|
904
|
-
? undefined
|
|
905
|
-
: ('end' as const)
|
|
906
|
-
}
|
|
914
|
+
if (model.band || model.kind === 'string')
|
|
915
|
+
return bandEdge(model, value, format(value), opts.width, yRoom)?.anchor
|
|
907
916
|
const share = model.log
|
|
908
917
|
? (model.fraction(value as X) ?? Number.NaN)
|
|
909
918
|
: (+value - leftEdgeX) / spanX
|
|
910
919
|
return share >= 0 && share <= LEFT_EDGE_SHARE ? ('start' as const) : undefined
|
|
911
920
|
}
|
|
912
921
|
const dx = ({ value }: { value: ChartValue }) =>
|
|
913
|
-
model.band && edgeAnchor(value) === undefined
|
|
914
|
-
?
|
|
922
|
+
(model.band || model.kind === 'string') && edgeAnchor(value) === undefined
|
|
923
|
+
? bandEdge(model, value, format(value), opts.width, yRoom)?.dx
|
|
915
924
|
: undefined
|
|
916
925
|
return { anchor, dx }
|
|
917
926
|
}
|
|
918
927
|
// A band axis of names keeps every name: where the engine would thin them (two neighbours' boxes meet), a name
|
|
919
|
-
// wider than its slot is cut to an ellipsis instead, so none is dropped
|
|
928
|
+
// wider than its slot is cut to an ellipsis instead, so none is dropped; where a cut would make two names read alike,
|
|
929
|
+
// the whole axis keeps its whole names instead (see the gate below).
|
|
920
930
|
const named = 'values' in ticks ? ticks.values : model.values
|
|
921
931
|
const places = named.flatMap((v) => model.fraction(v as X) ?? [])
|
|
922
932
|
const plotWidth = Math.max(0, (opts.width ?? 0) - yRoom)
|
|
@@ -946,8 +956,10 @@ function xTickSetup<X extends ChartX>(opts: XTickSetupOpts<X>) {
|
|
|
946
956
|
}
|
|
947
957
|
return false
|
|
948
958
|
}
|
|
959
|
+
// A cut that would make two names read alike is no cut: the whole axis keeps its whole names and the engine thins them.
|
|
960
|
+
const cut = slot === undefined ? undefined : (v: ChartValue) => fitToSlot(written(v), slot)
|
|
949
961
|
const format =
|
|
950
|
-
|
|
962
|
+
cut === undefined || !thins() || !cutKeepsNamesApart(named, written, cut) ? written : cut
|
|
951
963
|
const { anchor, dx } = format === written ? natural : layout(format)
|
|
952
964
|
return { ticks, format, anchor, dx }
|
|
953
965
|
}
|
|
@@ -19,6 +19,7 @@ import { tooltip } from '@tanstack/charts/tooltip'
|
|
|
19
19
|
import type { ChartTooltipExtension } from '@tanstack/charts/tooltip'
|
|
20
20
|
import type { ChartCursorBinding, ChartValue } from '@tanstack/charts/types/core'
|
|
21
21
|
import type { ChartX, CursorResolution } from '../types'
|
|
22
|
+
import { speakTooltip } from './tooltip-said'
|
|
22
23
|
|
|
23
24
|
type CursorState = ReturnType<ChartCursorController['getState']>
|
|
24
25
|
|
|
@@ -366,7 +367,7 @@ export const TOOLTIP_READOUT = '.ts-chart-tooltip'
|
|
|
366
367
|
|
|
367
368
|
/**
|
|
368
369
|
* The engine host stamps `role="status"` on its readout on every paint; a hover readout is a
|
|
369
|
-
* tooltip
|
|
370
|
+
* tooltip, and {@link speakTooltip} says its reading for it. The host hands
|
|
370
371
|
* out no element: the readout is in the chart's container, except in the portal's fallback, which
|
|
371
372
|
* parks it on `<body>` — only then is the owner document searched (and every chart's readout
|
|
372
373
|
* stamped, which is right for each). Idempotent; a pinned custom body's `role="dialog"` is left
|
|
@@ -380,7 +381,8 @@ function stampTooltipRole(container: Element): void {
|
|
|
380
381
|
}
|
|
381
382
|
|
|
382
383
|
/**
|
|
383
|
-
* Decorates a tooltip host so every `paint` is followed by {@link stampTooltipRole}
|
|
384
|
+
* Decorates a tooltip host so every `paint` is followed by {@link stampTooltipRole} and its reading is
|
|
385
|
+
* spoken as one sentence ({@link speakTooltip}). The one
|
|
384
386
|
* stamping seam: `quietWhileFollowing` is built on it, and so is any chart that wires the engine host
|
|
385
387
|
* directly (Donut, Heatmap).
|
|
386
388
|
*/
|
|
@@ -389,11 +391,17 @@ export function withTooltipRole(extension: ChartTooltipExtension): ChartTooltipE
|
|
|
389
391
|
...extension,
|
|
390
392
|
create: (context) => {
|
|
391
393
|
const host = extension.create(context)
|
|
394
|
+
const stamp = (): void => stampTooltipRole(context.container)
|
|
395
|
+
const silence = speakTooltip(context.container, TOOLTIP_READOUT, stamp)
|
|
392
396
|
return {
|
|
393
397
|
...host,
|
|
394
398
|
paint: (paint) => {
|
|
395
399
|
host.paint(paint)
|
|
396
|
-
|
|
400
|
+
stamp()
|
|
401
|
+
},
|
|
402
|
+
destroy: () => {
|
|
403
|
+
silence()
|
|
404
|
+
host.destroy()
|
|
397
405
|
},
|
|
398
406
|
}
|
|
399
407
|
},
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a screen reader hears from the engine's tooltip. The engine makes the readout its own live region,
|
|
3
|
+
* where the rows are `aria-hidden` (only the title is spoken) and the text runs title, label and value
|
|
4
|
+
* together. Here the readout goes quiet and one hidden region beside it says the readout's own accessible
|
|
5
|
+
* name as a sentence: `Dec 15, Rounds: 537`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const HIDDEN =
|
|
9
|
+
'position:absolute;top:0;left:0;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap'
|
|
10
|
+
|
|
11
|
+
/** The engine's accessible name (`title\nlabel: value`), or a plain string readout's text, as one line. */
|
|
12
|
+
export function tooltipSentence(readout: Element): string {
|
|
13
|
+
return (readout.getAttribute('aria-label') ?? readout.textContent ?? '')
|
|
14
|
+
.split('\n')
|
|
15
|
+
.map((line) => line.replace(/^\s*:|:\s*$/g, '').trim())
|
|
16
|
+
.filter(Boolean)
|
|
17
|
+
.join(', ')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Speaks for the readout inside `container`, after every change the engine makes to it (a delayed first
|
|
22
|
+
* paint included, which no `paint` wrapper sees). `stamp` runs first on each change. A pinned dialog and a
|
|
23
|
+
* hidden readout say nothing. A readout the portal parks outside the container keeps the engine's region.
|
|
24
|
+
* Returns the teardown.
|
|
25
|
+
*/
|
|
26
|
+
export function speakTooltip(container: Element, selector: string, stamp: () => void): () => void {
|
|
27
|
+
const view = container.ownerDocument.defaultView
|
|
28
|
+
if (!view?.MutationObserver) return () => {}
|
|
29
|
+
const region = container.ownerDocument.createElement('span')
|
|
30
|
+
region.setAttribute('aria-live', 'polite')
|
|
31
|
+
region.setAttribute('aria-atomic', 'true')
|
|
32
|
+
region.dataset['basaltChartSaid'] = ''
|
|
33
|
+
region.style.cssText = HIDDEN
|
|
34
|
+
container.append(region)
|
|
35
|
+
const sync = (): void => {
|
|
36
|
+
const readout = container.querySelector(selector)
|
|
37
|
+
if (!readout) return
|
|
38
|
+
stamp()
|
|
39
|
+
readout.removeAttribute('aria-live')
|
|
40
|
+
const silent = readout.hasAttribute('hidden') || readout.getAttribute('role') === 'dialog'
|
|
41
|
+
const said = silent ? '' : tooltipSentence(readout)
|
|
42
|
+
if (region.textContent !== said) region.textContent = said
|
|
43
|
+
}
|
|
44
|
+
const observer = new view.MutationObserver(sync)
|
|
45
|
+
observer.observe(container, {
|
|
46
|
+
subtree: true,
|
|
47
|
+
childList: true,
|
|
48
|
+
characterData: true,
|
|
49
|
+
attributeFilter: ['aria-label', 'aria-live', 'role', 'hidden'],
|
|
50
|
+
})
|
|
51
|
+
return () => {
|
|
52
|
+
observer.disconnect()
|
|
53
|
+
region.remove()
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/charts/focus.tsx
CHANGED
|
@@ -148,10 +148,13 @@ export function useCursorFocus<D>(
|
|
|
148
148
|
pinned: false,
|
|
149
149
|
})
|
|
150
150
|
}
|
|
151
|
+
// From rest ArrowLeft enters at the oldest point, as the engine's own keyboard does for a chart
|
|
152
|
+
// without a `focus` (a list or a heat grid, stepping by `focus.step`, still enters it at the last).
|
|
151
153
|
return hostFocusProps(
|
|
152
154
|
focus,
|
|
153
155
|
{ label, role },
|
|
154
|
-
(key, index) =>
|
|
156
|
+
(key, index) =>
|
|
157
|
+
stepInX(focus, x, index === null && key === 'ArrowLeft' ? 'ArrowRight' : key, index),
|
|
155
158
|
publish,
|
|
156
159
|
)
|
|
157
160
|
}
|
package/src/cli/agent-note.ts
CHANGED
|
@@ -47,7 +47,7 @@ function placed(bases: readonly string[]): { skills: string[]; agents: string[]
|
|
|
47
47
|
|
|
48
48
|
/** The note's first line: what a running session already has and what it lacks. */
|
|
49
49
|
export const SESSION_NOTE =
|
|
50
|
-
'Agent sessions: a running session, the one that ran this command included, already has the rules
|
|
50
|
+
'Agent sessions: a running session, the one that ran this command included, already has the path-scoped rules and, where its harness runs one, the edit hook (.basalt/hook.mjs). Skills and the reviewer agent load only when a session starts.'
|
|
51
51
|
|
|
52
52
|
/** The same line for an install that places no reviewer agent (a `site`): it names none. */
|
|
53
53
|
export const SESSION_NOTE_NO_REVIEWER = SESSION_NOTE.replace(
|
|
@@ -129,13 +129,16 @@ function walk(dir: string, skip: string, seen: Set<string>, out: AgentFiles): vo
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/** The agent-read files under each base directory (the install root, and its repo root when a sibling). */
|
|
132
|
-
export function agentFiles(
|
|
132
|
+
export function agentFiles(
|
|
133
|
+
bases: readonly string[],
|
|
134
|
+
agents: readonly string[] = [AGENTS_FILE],
|
|
135
|
+
): AgentFiles {
|
|
133
136
|
const out: AgentFiles = new Map()
|
|
134
137
|
for (const base of new Set(bases)) {
|
|
135
138
|
for (const dir of new Set(MANAGED_DIRS.map((d) => d.split('/')[0] ?? d))) {
|
|
136
139
|
walk(join(base, dir), join(base, WORKTREES), new Set(), out)
|
|
137
140
|
}
|
|
138
|
-
for (const rel of [SHIM,
|
|
141
|
+
for (const rel of [SHIM, ...agents, ...HOOK_ADAPTERS.map((a) => a.path)]) {
|
|
139
142
|
const path = join(base, rel)
|
|
140
143
|
const info = statOf(path)
|
|
141
144
|
if (info !== null && info.isFile()) out.set(path, `${info.size}:${info.mtimeMs}`)
|
|
@@ -145,8 +148,12 @@ export function agentFiles(bases: readonly string[]): AgentFiles {
|
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
/** The session note when any agent-read file was written, changed or removed since `before`; null otherwise. */
|
|
148
|
-
export function sessionNote(
|
|
149
|
-
|
|
151
|
+
export function sessionNote(
|
|
152
|
+
before: AgentFiles,
|
|
153
|
+
bases: readonly string[],
|
|
154
|
+
agents: readonly string[] = [AGENTS_FILE],
|
|
155
|
+
): string | null {
|
|
156
|
+
const after = agentFiles(bases, agents)
|
|
150
157
|
const paths = new Set([...before.keys(), ...after.keys()])
|
|
151
158
|
for (const path of paths) {
|
|
152
159
|
if (before.get(path) !== after.get(path)) return sessionNoteText(bases)
|
package/src/cli/budget/index.ts
CHANGED
|
@@ -26,6 +26,11 @@ export type Budget = {
|
|
|
26
26
|
ejects: number
|
|
27
27
|
adopted: number
|
|
28
28
|
profileFloor: Profile
|
|
29
|
+
/**
|
|
30
|
+
* Root -> the profile it was first declared with, written by `init`: a mixed install's floor per root,
|
|
31
|
+
* so a `tokens` root beside an `app` one does not lower the app's. A root with no entry takes `profileFloor`.
|
|
32
|
+
*/
|
|
33
|
+
rootFloors?: Record<string, Profile>
|
|
29
34
|
/** Written by `eject --raise` only (G1): `{ field, from, to, consumer }`. */
|
|
30
35
|
raises: Record<string, unknown>[]
|
|
31
36
|
/** Fields this version does not know, kept so a newer budget survives an older CLI. */
|
|
@@ -48,7 +53,8 @@ const isRecord = (v: unknown): v is Record<string, unknown> =>
|
|
|
48
53
|
typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
49
54
|
const isCount = (v: unknown): v is number => Number.isInteger(v) && (v as number) >= 0
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
/** Every key of the file but `format`, in the order `serializeBudget` writes them. */
|
|
57
|
+
export const BUDGET_KEYS = ['ejects', 'adopted', 'profileFloor', 'rootFloors', 'raises'] as const
|
|
52
58
|
|
|
53
59
|
const bad = (why: string): BudgetRead => ({ error: `${BUDGET_PATH}: ${why}` })
|
|
54
60
|
|
|
@@ -72,14 +78,23 @@ export function parseBudget(text: string): BudgetRead {
|
|
|
72
78
|
if (!(key in raw)) return bad(`missing \`${key}\``)
|
|
73
79
|
if (!isCount(raw[key])) return bad(`\`${key}\` must be a non-negative integer`)
|
|
74
80
|
}
|
|
75
|
-
const { ejects, adopted, profileFloor, raises } = raw
|
|
81
|
+
const { ejects, adopted, profileFloor, rootFloors, raises } = raw
|
|
76
82
|
if (!PROFILES.includes(profileFloor as Profile)) {
|
|
77
83
|
return bad(`\`profileFloor\` must be one of ${PROFILES.join(' | ')}`)
|
|
78
84
|
}
|
|
85
|
+
if (
|
|
86
|
+
rootFloors !== undefined &&
|
|
87
|
+
!(
|
|
88
|
+
isRecord(rootFloors) &&
|
|
89
|
+
Object.values(rootFloors).every((p) => PROFILES.includes(p as Profile))
|
|
90
|
+
)
|
|
91
|
+
) {
|
|
92
|
+
return bad('`rootFloors` must map a root to a profile')
|
|
93
|
+
}
|
|
79
94
|
if (!Array.isArray(raises) || !raises.every(isRecord)) {
|
|
80
95
|
return bad('`raises` must be an array of objects')
|
|
81
96
|
}
|
|
82
|
-
const known = new Set<unknown>(['format', ...
|
|
97
|
+
const known = new Set<unknown>(['format', ...BUDGET_KEYS, ...RETIRED])
|
|
83
98
|
const rest = Object.fromEntries(Object.entries(raw).filter(([key]) => !known.has(key)))
|
|
84
99
|
return {
|
|
85
100
|
format,
|
|
@@ -87,6 +102,7 @@ export function parseBudget(text: string): BudgetRead {
|
|
|
87
102
|
ejects: ejects as number,
|
|
88
103
|
adopted: adopted as number,
|
|
89
104
|
profileFloor: profileFloor as Profile,
|
|
105
|
+
...(rootFloors === undefined ? {} : { rootFloors: rootFloors as Record<string, Profile> }),
|
|
90
106
|
raises: raises.filter((row) => !RETIRED.has(row['field'])),
|
|
91
107
|
...(Object.keys(rest).length > 0 ? { rest } : {}),
|
|
92
108
|
},
|
|
@@ -95,8 +111,9 @@ export function parseBudget(text: string): BudgetRead {
|
|
|
95
111
|
|
|
96
112
|
/** The canonical bytes: `format` first, fixed key order, unknown keys last, two-space indent, one trailing newline. */
|
|
97
113
|
export function serializeBudget(b: Budget): string {
|
|
98
|
-
const { ejects, adopted, profileFloor, raises, rest } = b
|
|
99
|
-
const
|
|
114
|
+
const { ejects, adopted, profileFloor, rootFloors, raises, rest } = b
|
|
115
|
+
const floors = rootFloors === undefined ? {} : { rootFloors }
|
|
116
|
+
const body = { format: BUDGET_FORMAT, ejects, adopted, profileFloor, ...floors, raises, ...rest }
|
|
100
117
|
return `${JSON.stringify(body, null, 2)}\n`
|
|
101
118
|
}
|
|
102
119
|
|
package/src/cli/config.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type BasaltConfig = {
|
|
|
7
7
|
* The Vite app's directory relative to the install root, for a workspace monorepo whose manifest,
|
|
8
8
|
* `.claude/` and AGENTS block live at the root. App-scoped checks (`tsconfig-base`, `app-wiring`)
|
|
9
9
|
* and the router seeds target it. Default: the single workspace package that depends on basalt-ui
|
|
10
|
-
* and has a Vite entry, else the root itself.
|
|
10
|
+
* and has a Vite entry (among two, the one the manifest declares an app root in), else the root itself.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* { app: 'apps/dashboard' }
|
package/src/cli/doctor/app.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { routePatterns, typechecksBeforeTree } from '../route-tree'
|
|
|
14
14
|
import { filesUnder, need, readJson, readText, rootFiles, rootsOf, verdictOf } from './types'
|
|
15
15
|
import type { Check, Ctx } from './types'
|
|
16
16
|
import { isSiteManifest } from '../manifest'
|
|
17
|
-
import type { Manifest } from '../manifest'
|
|
17
|
+
import type { Manifest, Profile } from '../manifest'
|
|
18
18
|
|
|
19
19
|
const SOURCE = /\.[cm]?[jt]sx?$/
|
|
20
20
|
const HTML_HOSTS = /\.(?:html|[jt]sx)$/
|
|
@@ -31,11 +31,22 @@ const load = (ctx: Ctx, files: readonly string[]): Source[] =>
|
|
|
31
31
|
|
|
32
32
|
const parentOf = (root: string): string =>
|
|
33
33
|
root.includes('/') ? root.slice(0, root.lastIndexOf('/')) : '.'
|
|
34
|
+
/** The install root and `mine`, less a directory only `theirs` names. */
|
|
35
|
+
const lookIn = (mine: readonly string[], theirs: readonly string[]): Set<string> =>
|
|
36
|
+
new Set(['.', ...mine].filter((dir) => mine.includes(dir) || !theirs.includes(dir)))
|
|
37
|
+
/** Where a Vite config is looked for: the install root and beside each declared root. */
|
|
38
|
+
const viteDirs = (roots: readonly string[], others: readonly string[] = []): Set<string> =>
|
|
39
|
+
lookIn(roots.map(parentOf), others.map(parentOf))
|
|
40
|
+
/** Where an `index.html` and an Astro config are looked for: the install root, each declared root and beside it. */
|
|
41
|
+
const rootDirs = (roots: readonly string[], others: readonly string[] = []): Set<string> => {
|
|
42
|
+
const beside = (list: readonly string[]) => list.flatMap((root) => [root, parentOf(root)])
|
|
43
|
+
return lookIn(beside(roots), beside(others))
|
|
44
|
+
}
|
|
34
45
|
const VITE_EXTENSIONS = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs']
|
|
35
46
|
|
|
36
47
|
/** Astro configs at the install root, at each declared root and beside it. */
|
|
37
48
|
function astroConfigs(ctx: Ctx, roots: readonly string[]): Source[] {
|
|
38
|
-
const dirs =
|
|
49
|
+
const dirs = rootDirs(roots)
|
|
39
50
|
const candidates = [...dirs].flatMap((dir) =>
|
|
40
51
|
VITE_EXTENSIONS.map((ext) =>
|
|
41
52
|
dir === '.' ? `astro.config.${ext}` : `${dir}/astro.config.${ext}`,
|
|
@@ -65,10 +76,12 @@ function siteFindings(ctx: Ctx, roots: readonly string[]): string[] {
|
|
|
65
76
|
})
|
|
66
77
|
}
|
|
67
78
|
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Vite configs at the install root and beside each of `roots`. A directory only a root in `others`
|
|
81
|
+
* (a profile this reading is not about) sits in is theirs, the install root included.
|
|
82
|
+
*/
|
|
83
|
+
function viteConfigs(ctx: Ctx, roots: readonly string[], others: readonly string[] = []): Source[] {
|
|
84
|
+
const candidates = [...viteDirs(roots, others)].flatMap((dir) =>
|
|
72
85
|
VITE_EXTENSIONS.map((ext) =>
|
|
73
86
|
dir === '.' ? `vite.config.${ext}` : `${dir}/vite.config.${ext}`,
|
|
74
87
|
),
|
|
@@ -82,8 +95,12 @@ const VIEWPORT_TAG =
|
|
|
82
95
|
'<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />'
|
|
83
96
|
|
|
84
97
|
/** The Vite plugin list: basalt, tailwind and the React plugin in the order `basalt-app` gives. */
|
|
85
|
-
function viteFindings(
|
|
86
|
-
|
|
98
|
+
function viteFindings(
|
|
99
|
+
ctx: Ctx,
|
|
100
|
+
manifest: Manifest,
|
|
101
|
+
configs: readonly Source[],
|
|
102
|
+
appConfigs: ReadonlySet<string>,
|
|
103
|
+
): string[] {
|
|
87
104
|
if (configs.length === 0) return []
|
|
88
105
|
const findings = configs.flatMap(({ file, text }) => {
|
|
89
106
|
const router = ROUTER_PLUGINS.find((name) => new RegExp(`\\b${name}\\s*\\(`).test(text))
|
|
@@ -93,7 +110,7 @@ function viteFindings(ctx: Ctx, manifest: Manifest, roots: readonly string[]): s
|
|
|
93
110
|
/\bbasalt\s*\(/.test(text) &&
|
|
94
111
|
/\btailwindcss\s*\(/.test(text)
|
|
95
112
|
if (!wired) {
|
|
96
|
-
const list = [...(
|
|
113
|
+
const list = [...(appConfigs.has(file) && router ? [`${router}()`] : []), 'react()']
|
|
97
114
|
out.push(
|
|
98
115
|
`${file}: the plugins must be [${[...list, 'tailwindcss()', 'basalt()'].join(', ')}] with basalt from basalt-ui/vite (basalt-app setup: Vite plugins)`,
|
|
99
116
|
)
|
|
@@ -121,9 +138,13 @@ function viteFindings(ctx: Ctx, manifest: Manifest, roots: readonly string[]): s
|
|
|
121
138
|
}
|
|
122
139
|
|
|
123
140
|
/** `<html>` hosts: an `index.html` at the root or beside a declared root, and any JSX with an `<html` tag. */
|
|
124
|
-
function htmlHosts(
|
|
125
|
-
|
|
126
|
-
|
|
141
|
+
function htmlHosts(
|
|
142
|
+
ctx: Ctx,
|
|
143
|
+
roots: readonly string[],
|
|
144
|
+
sources: readonly Source[],
|
|
145
|
+
others: readonly string[] = [],
|
|
146
|
+
): Source[] {
|
|
147
|
+
const indexes = [...rootDirs(roots, others)]
|
|
127
148
|
.map((dir) => (dir === '.' ? 'index.html' : `${dir}/index.html`))
|
|
128
149
|
.filter((f) => readText(ctx.root, f) !== null)
|
|
129
150
|
return [
|
|
@@ -132,6 +153,13 @@ function htmlHosts(ctx: Ctx, roots: readonly string[], sources: readonly Source[
|
|
|
132
153
|
]
|
|
133
154
|
}
|
|
134
155
|
|
|
156
|
+
/** The profile of the deepest declared root holding `file`. */
|
|
157
|
+
function profileOf(declared: readonly [string, Profile][], file: string): Profile | undefined {
|
|
158
|
+
return declared
|
|
159
|
+
.filter(([root]) => root === '.' || file.startsWith(`${root}/`))
|
|
160
|
+
.toSorted(([a], [b]) => b.length - a.length)[0]?.[1]
|
|
161
|
+
}
|
|
162
|
+
|
|
135
163
|
const htmlTag = (text: string): string => /<html\b[^>]*>/s.exec(text)?.[0] ?? ''
|
|
136
164
|
const LITERAL_THEME = /\bdata-theme\s*=\s*(?:"[^"{}]+"|'[^'{}]+')/
|
|
137
165
|
|
|
@@ -217,11 +245,22 @@ const check12 = (name: string): Check => ({
|
|
|
217
245
|
name,
|
|
218
246
|
run: (ctx) => {
|
|
219
247
|
const manifest = need(ctx)
|
|
220
|
-
|
|
221
|
-
const
|
|
248
|
+
// Each root is held to its own profile: a `tokens` root beside an app owes no app wiring.
|
|
249
|
+
const declared = rootsOf(manifest)
|
|
250
|
+
const roots = declared.map(([r]) => r)
|
|
251
|
+
const allSources = load(ctx, rootFiles(ctx, manifest, SOURCE))
|
|
222
252
|
const findings: string[] = []
|
|
253
|
+
const split = (...profiles: Profile[]): [string[], string[]] => [
|
|
254
|
+
declared.filter(([, p]) => profiles.includes(p)).map(([r]) => r),
|
|
255
|
+
declared.filter(([, p]) => !profiles.includes(p)).map(([r]) => r),
|
|
256
|
+
]
|
|
257
|
+
const [appRoots, notApp] = split('app')
|
|
258
|
+
const [viteRoots, notVite] = split('bridge', 'parts', 'app')
|
|
259
|
+
const [siteRoots] = split('site')
|
|
260
|
+
const appSources = allSources.filter((s) => profileOf(declared, s.file) === 'app')
|
|
223
261
|
|
|
224
|
-
if (
|
|
262
|
+
if (appRoots.length > 0) {
|
|
263
|
+
const sources = appSources
|
|
225
264
|
const router = sources.filter((s) => /\bcreateRouter\s*\(/.test(s.text))
|
|
226
265
|
if (router.length === 0)
|
|
227
266
|
findings.push(`app: no createRouter call under the declared roots ${ROUTER_STEP}`)
|
|
@@ -240,13 +279,13 @@ const check12 = (name: string): Check => ({
|
|
|
240
279
|
) {
|
|
241
280
|
findings.push(`app: the router \`Register\` interface is not declared ${ROUTER_STEP}`)
|
|
242
281
|
}
|
|
243
|
-
const configs = viteConfigs(ctx,
|
|
282
|
+
const configs = viteConfigs(ctx, appRoots, notApp)
|
|
244
283
|
const app = resolveAppDir(ctx.root)
|
|
245
284
|
// A code-routed app registers no route plugin, so there is no option to set.
|
|
246
285
|
const coded = !('error' in app) && isCodeRoutedApp(ctx.root, app.rel)
|
|
247
286
|
if (!coded && !configs.some((c) => /autoCodeSplitting\s*:\s*true/.test(c.text))) {
|
|
248
287
|
findings.push(
|
|
249
|
-
|
|
288
|
+
`app: no vite config with autoCodeSplitting enabled; searched for vite.config.* in ${[...viteDirs(appRoots, notApp)].join(', ')} (basalt-app setup: Vite plugins)`,
|
|
250
289
|
)
|
|
251
290
|
}
|
|
252
291
|
findings.push(...navFindings(sources))
|
|
@@ -256,11 +295,19 @@ const check12 = (name: string): Check => ({
|
|
|
256
295
|
}
|
|
257
296
|
}
|
|
258
297
|
|
|
259
|
-
if (
|
|
260
|
-
|
|
298
|
+
if (viteRoots.length > 0) {
|
|
299
|
+
const scoped = {
|
|
300
|
+
...manifest,
|
|
301
|
+
roots: Object.fromEntries(declared.filter(([r]) => viteRoots.includes(r))),
|
|
302
|
+
}
|
|
303
|
+
const appConfigs = new Set(
|
|
304
|
+
appRoots.length > 0 ? viteConfigs(ctx, appRoots, notApp).map((c) => c.file) : [],
|
|
305
|
+
)
|
|
306
|
+
findings.push(...viteFindings(ctx, scoped, viteConfigs(ctx, viteRoots, notVite), appConfigs))
|
|
261
307
|
}
|
|
262
|
-
if (
|
|
308
|
+
if (siteRoots.length > 0) findings.push(...siteFindings(ctx, siteRoots))
|
|
263
309
|
|
|
310
|
+
const sources = allSources
|
|
264
311
|
const notifies = sources.some((s) =>
|
|
265
312
|
/import[^;]*\bnotify\b[^;]*from\s*['"]basalt-ui/s.test(s.text),
|
|
266
313
|
)
|
|
@@ -269,8 +316,13 @@ const check12 = (name: string): Check => ({
|
|
|
269
316
|
}
|
|
270
317
|
|
|
271
318
|
const hosts = htmlHosts(ctx, roots, sources)
|
|
272
|
-
|
|
273
|
-
|
|
319
|
+
const appHosts = new Set(
|
|
320
|
+
appRoots.length > 0 ? htmlHosts(ctx, appRoots, appSources, notApp).map((h) => h.file) : [],
|
|
321
|
+
)
|
|
322
|
+
if (appHosts.size === 0 && appRoots.length > 0)
|
|
323
|
+
findings.push(
|
|
324
|
+
`app: no <html> element found; searched for index.html in ${[...rootDirs(appRoots, notApp)].join(', ')} and the root route`,
|
|
325
|
+
)
|
|
274
326
|
// The vite plugin injects the scheme script unless it is switched off: `basalt()` from
|
|
275
327
|
// `basalt-ui/vite` (`themeScript: false` omits it) or the 2.x `basaltAppPlugin`.
|
|
276
328
|
const bootInjected = viteConfigs(ctx, roots).some(
|
|
@@ -289,7 +341,7 @@ const check12 = (name: string): Check => ({
|
|
|
289
341
|
// A Start root route has no index.html for the plugin to inject into: it runs the shipped script itself.
|
|
290
342
|
/<ScriptOnce\b[^>]*>\s*\{\s*themeScript\s*\(/.test(host.text) ||
|
|
291
343
|
bootInjected
|
|
292
|
-
if (
|
|
344
|
+
if (appHosts.has(host.file) && host.file.endsWith('index.html')) {
|
|
293
345
|
const meta = /<meta\s[^>]*name=["']viewport["'][^>]*>/i.exec(host.text)?.[0] ?? ''
|
|
294
346
|
if (!/viewport-fit\s*=\s*cover/.test(meta)) {
|
|
295
347
|
findings.push(
|
package/src/cli/doctor/eject.ts
CHANGED
|
@@ -6,16 +6,19 @@
|
|
|
6
6
|
* row. Each finding names the command or edit that fixes it.
|
|
7
7
|
*/
|
|
8
8
|
import { existsSync, readFileSync } from 'node:fs'
|
|
9
|
-
import { dirname, resolve } from 'node:path'
|
|
9
|
+
import { basename, dirname, resolve } from 'node:path'
|
|
10
10
|
|
|
11
11
|
import { SLOTS } from '../../ui/slots'
|
|
12
12
|
import { BUDGET_PATH, countedFigure } from '../budget'
|
|
13
13
|
import type { Budget } from '../budget'
|
|
14
|
+
import { droppedSlots } from '../eject/dropped-slots'
|
|
14
15
|
import { basePath, countRows, isBlockRow, rowsOfRoot } from '../eject/ledger'
|
|
15
16
|
import type { EjectedRow } from '../eject/ledger'
|
|
16
17
|
import { appTsconfig } from '../eject/tsconfig'
|
|
18
|
+
import type { Manifest } from '../manifest'
|
|
17
19
|
import { parseHeader } from '../merge/header'
|
|
18
20
|
import { ejectedGuard, readSeed } from '../merge/seed'
|
|
21
|
+
import { replacedFiles } from '../migrate/rows'
|
|
19
22
|
import { parseJsonc } from '../source-text'
|
|
20
23
|
import { filesUnder, readText, rootsOf } from './types'
|
|
21
24
|
import type { Ctx } from './types'
|
|
@@ -41,11 +44,24 @@ function hasPathsRow(tsconfig: string, name: string): boolean {
|
|
|
41
44
|
return typeof paths === 'object' && paths !== null && `basalt-ui/ui/${name}` in paths
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
/**
|
|
48
|
+
* A `components/ui` file with no manifest row. One that stands where a shipped part does (its own
|
|
49
|
+
* name, or the `replacement` a `file:` migration row names) is deleted and imported: doctor does not
|
|
50
|
+
* guess whether `eject --adopt` would take it. Any other name is the app's own code.
|
|
51
|
+
*/
|
|
52
|
+
function strayFinding(manifest: Manifest, file: string, replacement?: string): string {
|
|
53
|
+
const name = basename(file, '.tsx')
|
|
54
|
+
const shipped = replacement ?? (name in SLOTS ? `basalt-ui/ui/${name}` : undefined)
|
|
55
|
+
const stray = `${file} is not in manifest.ejected`
|
|
56
|
+
if (shipped === undefined) {
|
|
57
|
+
return `${stray}: adopt it (\`basalt-ui eject --adopt ${file} --reason "<why>" --raise "<named consumer>"\`) or delete it`
|
|
58
|
+
}
|
|
59
|
+
// `migrate` prints a copy only where a `file:` row names it.
|
|
60
|
+
const props =
|
|
61
|
+
replacement === undefined
|
|
62
|
+
? `\`basalt-ui docs ${name}\` lists its props`
|
|
63
|
+
: `\`basalt-ui migrate --from 3.0.0 --profile ${manifest.profile}\` maps its props`
|
|
64
|
+
return `${stray}: delete it and import ${shipped} (${props}, \`basalt-ui eject --help\` says how to keep a copy)`
|
|
49
65
|
}
|
|
50
66
|
|
|
51
67
|
function rowFindings(ctx: Ctx, root: string, name: string, row: EjectedRow): string[] {
|
|
@@ -66,9 +82,14 @@ function rowFindings(ctx: Ctx, root: string, name: string, row: EjectedRow): str
|
|
|
66
82
|
const line = text.slice(0, marker.index).split('\n').length
|
|
67
83
|
findings.push(`${row.path}:${line} holds conflict markers: resolve them and commit`)
|
|
68
84
|
}
|
|
85
|
+
// An adopted copy was never basalt's source: leaving it is a way out an eject does not have.
|
|
86
|
+
const leave =
|
|
87
|
+
row.origin === 'adopted'
|
|
88
|
+
? `, or \`basalt-ui eject ${name} --undo\`, delete it and import basalt-ui/ui/${name}`
|
|
89
|
+
: ''
|
|
69
90
|
for (const slot of droppedSlots(name, text)) {
|
|
70
91
|
findings.push(
|
|
71
|
-
`${row.path} dropped the data-slot "${slot}" SLOTS lists for ${name}: render it again (slot names are frozen)`,
|
|
92
|
+
`${row.path} dropped the data-slot "${slot}" SLOTS lists for ${name}: render it again (slot names are frozen)${leave}`,
|
|
72
93
|
)
|
|
73
94
|
}
|
|
74
95
|
}
|
|
@@ -114,6 +135,7 @@ export function ejectFindings(ctx: Ctx, budget: Budget): string[] {
|
|
|
114
135
|
if (manifest === null) return []
|
|
115
136
|
const findings: string[] = []
|
|
116
137
|
const keyed = new Set<string>()
|
|
138
|
+
const replacements = replacedFiles(ctx.pkgRoot)
|
|
117
139
|
for (const [root] of rootsOf(manifest)) {
|
|
118
140
|
const { rows, bad } = rowsOfRoot(manifest, root)
|
|
119
141
|
for (const key of bad) findings.push(`ejected ${key} is malformed: fix or remove the row`)
|
|
@@ -134,9 +156,7 @@ export function ejectFindings(ctx: Ctx, budget: Budget): string[] {
|
|
|
134
156
|
for (const file of filesUnder(ctx.root, uiDir(root), /\.tsx$/)) {
|
|
135
157
|
if (file.split('/').length !== uiDir(root).split('/').length + 1) continue
|
|
136
158
|
if (file.endsWith('.test.tsx') || paths.has(file)) continue
|
|
137
|
-
findings.push(
|
|
138
|
-
`${file} is not in manifest.ejected: adopt it (\`basalt-ui eject --adopt ${file} --reason "<why>"\`) or delete it`,
|
|
139
|
-
)
|
|
159
|
+
findings.push(strayFinding(manifest, file, replacements.get(basename(file, '.tsx'))))
|
|
140
160
|
}
|
|
141
161
|
}
|
|
142
162
|
for (const [key, value] of Object.entries(manifest.ejected)) {
|