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
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* which basalt-ui presets it extends and which basalt-ui commands it runs.
|
|
6
6
|
*/
|
|
7
7
|
import { readFileSync, readdirSync, statSync } from 'node:fs'
|
|
8
|
-
import { join, relative, sep } from 'node:path'
|
|
8
|
+
import { join, posix, relative, sep } from 'node:path'
|
|
9
|
+
|
|
10
|
+
import { parseHeader } from '../merge/header'
|
|
9
11
|
|
|
10
12
|
const EXTENSIONS = ['.ts', '.tsx', '.astro', '.css']
|
|
11
13
|
const SKIP_DIRS = new Set([
|
|
@@ -250,6 +252,38 @@ export function findCommand(census: Census, verb: string, words: readonly string
|
|
|
250
252
|
return places
|
|
251
253
|
}
|
|
252
254
|
|
|
255
|
+
/** A module specifier of an import, re-export or dynamic import, relative ones included. */
|
|
256
|
+
const SPECIFIER = /\b(?:from|import)\s*\(?\s*(['"])([^'"\n]+)\1/g
|
|
257
|
+
|
|
258
|
+
const bare = (name: string): string => name.replace(/\.tsx$/, '')
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The app's own files ending in `path`, then every `file:line` importing one, by a relative
|
|
262
|
+
* specifier or an alias ending in `path`. A file under a `basalt:ejected` header is not the app's
|
|
263
|
+
* copy: it is owned through the manifest.
|
|
264
|
+
*/
|
|
265
|
+
export function findFile(census: Census, path: string): string[] {
|
|
266
|
+
const own = census.files.filter(
|
|
267
|
+
(file) =>
|
|
268
|
+
(file === path || file.endsWith(`/${path}`)) &&
|
|
269
|
+
parseHeader((census.text.get(file) ?? '').split('\n', 1)[0] ?? '') === null,
|
|
270
|
+
)
|
|
271
|
+
if (own.length === 0) return []
|
|
272
|
+
const targets = new Set(own.map(bare))
|
|
273
|
+
const alias = bare(path)
|
|
274
|
+
const imports: string[] = []
|
|
275
|
+
for (const [file, text] of census.text) {
|
|
276
|
+
for (const m of text.matchAll(SPECIFIER)) {
|
|
277
|
+
const spec = bare(m[2] ?? '')
|
|
278
|
+
const hit = spec.startsWith('.')
|
|
279
|
+
? targets.has(posix.join(posix.dirname(file), spec))
|
|
280
|
+
: spec === alias || spec.endsWith(`/${alias}`)
|
|
281
|
+
if (hit) imports.push(`${file}:${lineOf(text, m.index)}`)
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return [...own.map((file) => `${file}:1`), ...imports]
|
|
285
|
+
}
|
|
286
|
+
|
|
253
287
|
/** `file:line` of every occurrence of `needle` in the scanned sources. */
|
|
254
288
|
export function findText(census: Census, needle: string): string[] {
|
|
255
289
|
const places: string[] = []
|
package/src/cli/migrate/index.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* (docs/v3/concepts/migration-release.md 3.3).
|
|
4
4
|
*
|
|
5
5
|
* Reads the app's imports (the census), selects the migration rows newer than `--from` whose
|
|
6
|
-
* `from` (`parseFrom` in rows.ts) the app matches, and prints what changes.
|
|
6
|
+
* `from` (`parseFrom` in rows.ts) the app matches, and prints what changes. A `file:` row (a copy
|
|
7
|
+
* the app holds) applies at any `--from`. Never writes, never touches the network.
|
|
7
8
|
* `--check` exits 1 while a removed symbol is still imported, a legacy scheme-attribute
|
|
8
9
|
* selector remains, or a legacy-namespace storage or url key has no row.
|
|
9
10
|
*
|
|
@@ -11,7 +12,9 @@
|
|
|
11
12
|
*/
|
|
12
13
|
import { parseArgs } from 'node:util'
|
|
13
14
|
|
|
14
|
-
import { findCommand, findText, takeCensus } from './census'
|
|
15
|
+
import { findCommand, findFile, findText, takeCensus } from './census'
|
|
16
|
+
import { BRIDGE_IMPORT, lostClasses } from './lost-classes'
|
|
17
|
+
import type { ClassUse, LostClass } from './lost-classes'
|
|
15
18
|
import type { Census } from './census'
|
|
16
19
|
import { PROFILES, inRange, loadMigrationFiles, newerFiles, parseFrom, parseVersion } from './rows'
|
|
17
20
|
import type {
|
|
@@ -78,6 +81,10 @@ export interface MigrateReport {
|
|
|
78
81
|
attrs: (LegacySelector & { at: string[] })[]
|
|
79
82
|
/** Passed through: a lint rule row has no import to census. */
|
|
80
83
|
rules: RuleRow[]
|
|
84
|
+
/** Class names the app writes that the 3.x theme does not emit; empty at `tokens`. */
|
|
85
|
+
lostClasses: LostClass[]
|
|
86
|
+
/** `md:` and `xl:` uses, which emit at other widths than Tailwind's; empty at `tokens`. */
|
|
87
|
+
movedBreakpoints: ClassUse[]
|
|
81
88
|
/** Imported basalt-ui symbols (`module#name`) that no row of any version mentions. */
|
|
82
89
|
unmapped: { symbol: string; at: string[] }[]
|
|
83
90
|
/** Legacy-namespace keys (the 2.x and `basalt-*` prefixes) the app uses that no row maps. */
|
|
@@ -135,6 +142,7 @@ function memberStillUsed(census: Census, key: string, member: string, kind: stri
|
|
|
135
142
|
/** Where the app matches the row's `from`, and whether that is a removed basalt-ui thing still in use. */
|
|
136
143
|
function matchRow(row: MigrationRow, census: Census): { at: string[]; removed: boolean } {
|
|
137
144
|
const from = parseFrom(row.from) ?? { form: 'text' as const, needle: row.from }
|
|
145
|
+
if (from.form === 'file') return { at: findFile(census, from.path), removed: false }
|
|
138
146
|
if (from.form === 'peer') return { at: census.peers.get(from.name) ?? [], removed: false }
|
|
139
147
|
if (from.form === 'command') {
|
|
140
148
|
return { at: findCommand(census, from.verb, from.words), removed: false }
|
|
@@ -169,6 +177,9 @@ function mapped(key: string, rows: readonly MigrationRow[]): boolean {
|
|
|
169
177
|
})
|
|
170
178
|
}
|
|
171
179
|
|
|
180
|
+
/** A `file:` row states what the tree holds, not what a version changed: any `--from` has it. */
|
|
181
|
+
const standing = (row: MigrationRow): boolean => parseFrom(row.from)?.form === 'file'
|
|
182
|
+
|
|
172
183
|
export interface ReportInput {
|
|
173
184
|
from: string
|
|
174
185
|
profile: Profile
|
|
@@ -187,8 +198,13 @@ export function buildReport(input: ReportInput, cwd: string, pkgRoot: string): M
|
|
|
187
198
|
(f) => rowApplies(input.profile, f.profiles) && inRange(f, input.from),
|
|
188
199
|
)
|
|
189
200
|
const files: MigrationFile[] = newerFiles(known, input.from)
|
|
190
|
-
const allRows = files.flatMap((f) => f.rows.map((r) => ({ ...r, source: f.source })))
|
|
191
201
|
const knownRows = known.flatMap((f) => f.rows)
|
|
202
|
+
const allRows = [
|
|
203
|
+
...files.flatMap((f) =>
|
|
204
|
+
f.rows.filter((r) => !standing(r)).map((r) => ({ ...r, source: f.source })),
|
|
205
|
+
),
|
|
206
|
+
...known.flatMap((f) => f.rows.filter(standing).map((r) => ({ ...r, source: f.source }))),
|
|
207
|
+
]
|
|
192
208
|
const failures: Failure[] = []
|
|
193
209
|
|
|
194
210
|
const rows: ReportRow[] = []
|
|
@@ -257,6 +273,8 @@ export function buildReport(input: ReportInput, cwd: string, pkgRoot: string): M
|
|
|
257
273
|
.filter(([key]) => isBasalt(key) && !mapped(key, knownRows))
|
|
258
274
|
.map(([symbol, at]) => ({ symbol, at }))
|
|
259
275
|
.toSorted((a, b) => a.symbol.localeCompare(b.symbol))
|
|
276
|
+
// A tokens app keeps its own Tailwind theme, or has none.
|
|
277
|
+
const classes = input.profile === 'tokens' ? { lost: [], moved: [] } : lostClasses(census)
|
|
260
278
|
|
|
261
279
|
return {
|
|
262
280
|
schema: 1,
|
|
@@ -282,7 +300,31 @@ export function buildReport(input: ReportInput, cwd: string, pkgRoot: string): M
|
|
|
282
300
|
unmapped,
|
|
283
301
|
unknownKeys,
|
|
284
302
|
failures,
|
|
303
|
+
lostClasses: classes.lost,
|
|
304
|
+
movedBreakpoints: classes.moved,
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function classLines(report: MigrateReport): string[] {
|
|
309
|
+
const lines: string[] = []
|
|
310
|
+
const section = (title: string, uses: readonly ClassUse[]): void => {
|
|
311
|
+
if (uses.length === 0) return
|
|
312
|
+
lines.push(title)
|
|
313
|
+
for (const u of uses) lines.push(` ${u.name} ${u.count} at ${u.at[0] ?? ''}`)
|
|
285
314
|
}
|
|
315
|
+
section(
|
|
316
|
+
`classes that no longer emit, restored by @import '${BRIDGE_IMPORT}' after tailwind.css:`,
|
|
317
|
+
report.lostClasses.filter((c) => c.bridge),
|
|
318
|
+
)
|
|
319
|
+
section(
|
|
320
|
+
'classes that no longer emit, rewrite each on a basalt theme name:',
|
|
321
|
+
report.lostClasses.filter((c) => !c.bridge),
|
|
322
|
+
)
|
|
323
|
+
section(
|
|
324
|
+
'breakpoints that moved (md is 840px, not 768px; xl is 1200px, not 1280px):',
|
|
325
|
+
report.movedBreakpoints,
|
|
326
|
+
)
|
|
327
|
+
return lines
|
|
286
328
|
}
|
|
287
329
|
|
|
288
330
|
function formatReport(report: MigrateReport): string {
|
|
@@ -318,6 +360,7 @@ function formatReport(report: MigrateReport): string {
|
|
|
318
360
|
lines.push(
|
|
319
361
|
` selector ${a.from}]${a.to === undefined ? '' : ` -> ${a.to}`} at ${a.at[0] ?? ''}`,
|
|
320
362
|
)
|
|
363
|
+
lines.push(...classLines(report))
|
|
321
364
|
if (report.unmapped.length > 0) {
|
|
322
365
|
lines.push(`unmapped (imported, no row): ${report.unmapped.map((u) => u.symbol).join(', ')}`)
|
|
323
366
|
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The class names an app writes that the 3.x theme does not emit: `tailwind.css` clears the color,
|
|
3
|
+
* shadow, radius, text and breakpoint namespaces, so a dead class builds green and draws nothing.
|
|
4
|
+
* Read by regex from string literals and `@apply` lines, so it reports and never fails a gate.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
BRIDGE_BREAKPOINTS,
|
|
8
|
+
BRIDGE_COLORS,
|
|
9
|
+
BRIDGE_RADII,
|
|
10
|
+
BRIDGE_SHADOWS,
|
|
11
|
+
BRIDGE_TYPE_STEPS,
|
|
12
|
+
} from '../../tokens/bridge-sheet'
|
|
13
|
+
import type { Census } from './census'
|
|
14
|
+
|
|
15
|
+
export const BRIDGE_IMPORT = 'basalt-ui/bridge.css'
|
|
16
|
+
|
|
17
|
+
export interface ClassUse {
|
|
18
|
+
/** The utility without variants (`rounded-lg`), or the variant (`sm:`). */
|
|
19
|
+
name: string
|
|
20
|
+
count: number
|
|
21
|
+
/** `file:line` places. */
|
|
22
|
+
at: string[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface LostClass extends ClassUse {
|
|
26
|
+
/** Whether `@import '${BRIDGE_IMPORT}'` makes it emit again. */
|
|
27
|
+
bridge: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ClassReport {
|
|
31
|
+
lost: LostClass[]
|
|
32
|
+
/** `md:` and `xl:` uses: they emit, at the size classes instead of Tailwind's widths. */
|
|
33
|
+
moved: ClassUse[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type Theme = 'breakpoint' | 'radius' | 'shadow' | 'text' | 'color' | 'font'
|
|
37
|
+
|
|
38
|
+
const PALETTE =
|
|
39
|
+
'slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|mauve|olive|mist|taupe'
|
|
40
|
+
const COLOR_HEAD =
|
|
41
|
+
'(?:bg|text|border(?:-[trblxyse])?|ring-offset|ring|outline|fill|stroke|from|via|to|divide|placeholder|decoration|accent|caret|inset-ring|inset-shadow|drop-shadow|shadow)'
|
|
42
|
+
const PALETTE_CLASS = new RegExp(`^${COLOR_HEAD}-((?:${PALETTE})-(?:50|[1-9]00|950)|white|black)$`)
|
|
43
|
+
/** `primary` and `primary-foreground` emit without the bridge (as ink and canvas). */
|
|
44
|
+
const SHADCN_NAMES = Object.keys(BRIDGE_COLORS).filter((n) => !/^primary(?:-foreground)?$/.test(n))
|
|
45
|
+
const SHADCN_CLASS = new RegExp(`^${COLOR_HEAD}-(${SHADCN_NAMES.join('|')})$`)
|
|
46
|
+
const RADIUS_CLASS =
|
|
47
|
+
/^rounded(?:-(?:t|r|b|l|s|e|tl|tr|br|bl|ss|se|ee|es))?(?:-(xs|sm|md|lg|xl|[234]xl))?$/
|
|
48
|
+
const SHADOW_CLASS = /^shadow(?:-(2xs|xs|sm|md|lg|xl|2xl))?$/
|
|
49
|
+
const TEXT_CLASS = /^text-(xl|[2-9]xl)$/
|
|
50
|
+
const SCREEN_CLASS = /^(?:min-|max-)?w-screen-(sm|lg|2xl)$/
|
|
51
|
+
const BREAKPOINT_VARIANT = /^(?:max-|min-)?(sm|md|lg|xl|2xl)$/
|
|
52
|
+
|
|
53
|
+
/** The theme variable a utility reads, and whether the bridge defines it; undefined when it emits. */
|
|
54
|
+
function deadUtility(base: string): { theme: Theme; step: string; bridge: boolean } | undefined {
|
|
55
|
+
const radius = RADIUS_CLASS.exec(base)
|
|
56
|
+
if (radius !== null) {
|
|
57
|
+
const step = radius[1] ?? ''
|
|
58
|
+
return { theme: 'radius', step, bridge: step in BRIDGE_RADII }
|
|
59
|
+
}
|
|
60
|
+
const shadow = SHADOW_CLASS.exec(base)
|
|
61
|
+
if (shadow !== null) {
|
|
62
|
+
const step = shadow[1] ?? ''
|
|
63
|
+
return { theme: 'shadow', step, bridge: step in BRIDGE_SHADOWS }
|
|
64
|
+
}
|
|
65
|
+
const text = TEXT_CLASS.exec(base)?.[1]
|
|
66
|
+
if (text !== undefined) return { theme: 'text', step: text, bridge: text in BRIDGE_TYPE_STEPS }
|
|
67
|
+
const screen = SCREEN_CLASS.exec(base)?.[1]
|
|
68
|
+
if (screen !== undefined) {
|
|
69
|
+
return { theme: 'breakpoint', step: screen, bridge: screen in BRIDGE_BREAKPOINTS }
|
|
70
|
+
}
|
|
71
|
+
const palette = PALETTE_CLASS.exec(base)?.[1]
|
|
72
|
+
if (palette !== undefined) return { theme: 'color', step: palette, bridge: false }
|
|
73
|
+
const shadcn = SHADCN_CLASS.exec(base)?.[1]
|
|
74
|
+
if (shadcn !== undefined) return { theme: 'color', step: shadcn, bridge: true }
|
|
75
|
+
if (base === 'font-heading') return { theme: 'font', step: 'heading', bridge: true }
|
|
76
|
+
return undefined
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** `a:b:c` split at the top level only: a colon inside `[...]` or `(...)` belongs to its segment. */
|
|
80
|
+
function segments(token: string): string[] {
|
|
81
|
+
const out: string[] = []
|
|
82
|
+
let depth = 0
|
|
83
|
+
let start = 0
|
|
84
|
+
for (let i = 0; i < token.length; i++) {
|
|
85
|
+
const c = token[i]
|
|
86
|
+
if (c === '[' || c === '(') depth++
|
|
87
|
+
else if (c === ']' || c === ')') depth--
|
|
88
|
+
else if (c === ':' && depth === 0) {
|
|
89
|
+
out.push(token.slice(start, i))
|
|
90
|
+
start = i + 1
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
out.push(token.slice(start))
|
|
94
|
+
return out
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const STRING = /"([^"\\\n]*)"|'([^'\\\n]*)'|`([^`\\]*)`/g
|
|
98
|
+
const APPLY = /@apply\s+([^;{}]+)/g
|
|
99
|
+
const CLASS_CONTEXT = /class|\bcn\(|clsx|cva\(|\btv\(|@apply/
|
|
100
|
+
/** `rounded` and `shadow` are also English words: alone they count only where a class list is written. */
|
|
101
|
+
const BARE_WORD = /^(?:rounded|shadow)$/
|
|
102
|
+
|
|
103
|
+
interface List {
|
|
104
|
+
tokens: string[]
|
|
105
|
+
index: number
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function classLists(file: string, text: string): List[] {
|
|
109
|
+
const css = file.endsWith('.css')
|
|
110
|
+
return [...text.matchAll(css ? APPLY : STRING)].map((m) => ({
|
|
111
|
+
// A template literal holds its branches' own quotes, so quotes split too.
|
|
112
|
+
tokens: (m[1] ?? m[2] ?? m[3] ?? '')
|
|
113
|
+
.split(m[3] === undefined ? /\s+/ : /[\s'"]+/)
|
|
114
|
+
.filter(Boolean),
|
|
115
|
+
index: m.index,
|
|
116
|
+
}))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const DECLARED = /--(breakpoint|radius|shadow|text|color|font)(?:-([\w-]+))?\s*:/g
|
|
120
|
+
const THEME_BLOCK = /@theme\b[^{;]*\{/g
|
|
121
|
+
|
|
122
|
+
/** The bodies of a sheet's `@theme` blocks: a `--radius` on `:root` is no theme key. */
|
|
123
|
+
function themeBodies(css: string): string[] {
|
|
124
|
+
return [...css.matchAll(THEME_BLOCK)].map((m) => {
|
|
125
|
+
const start = m.index + m[0].length
|
|
126
|
+
let end = start
|
|
127
|
+
for (let depth = 1; end < css.length; end++) {
|
|
128
|
+
if (css[end] === '{') depth++
|
|
129
|
+
else if (css[end] === '}' && --depth === 0) break
|
|
130
|
+
}
|
|
131
|
+
return css.slice(start, end)
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The theme variables the app's own `@theme` blocks declare, as `namespace-step`: those classes emit. */
|
|
136
|
+
function declared(census: Census): Set<string> {
|
|
137
|
+
const names = new Set<string>()
|
|
138
|
+
for (const [file, text] of census.text) {
|
|
139
|
+
if (!file.endsWith('.css')) continue
|
|
140
|
+
for (const body of themeBodies(text)) {
|
|
141
|
+
for (const m of body.matchAll(DECLARED)) names.add(`${m[1]}-${m[2] ?? ''}`)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return names
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function add(into: Map<string, ClassUse>, name: string, place: string): ClassUse {
|
|
148
|
+
const use = into.get(name) ?? { name, count: 0, at: [] }
|
|
149
|
+
use.count++
|
|
150
|
+
if (!use.at.includes(place)) use.at.push(place)
|
|
151
|
+
into.set(name, use)
|
|
152
|
+
return use
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const byCount = (a: ClassUse, b: ClassUse): number =>
|
|
156
|
+
b.count - a.count || a.name.localeCompare(b.name)
|
|
157
|
+
|
|
158
|
+
export function lostClasses(census: Census): ClassReport {
|
|
159
|
+
const own = declared(census)
|
|
160
|
+
const bridged = census.modules.has(BRIDGE_IMPORT)
|
|
161
|
+
const lost = new Map<string, ClassUse>()
|
|
162
|
+
const restorable = new Set<string>()
|
|
163
|
+
const moved = new Map<string, ClassUse>()
|
|
164
|
+
for (const [file, text] of census.text) {
|
|
165
|
+
const lines = text.split('\n')
|
|
166
|
+
let line = 1
|
|
167
|
+
let seen = 0
|
|
168
|
+
for (const { tokens, index } of classLists(file, text)) {
|
|
169
|
+
for (; seen < index; seen++) if (text[seen] === '\n') line++
|
|
170
|
+
const place = `${file}:${line}`
|
|
171
|
+
const listLike =
|
|
172
|
+
tokens.some((t) => /[-:]/.test(t)) || CLASS_CONTEXT.test(lines[line - 1] ?? '')
|
|
173
|
+
const report = (name: string, theme: Theme, step: string, bridge: boolean): void => {
|
|
174
|
+
if (own.has(`${theme}-${step}`) || (bridge && bridged)) return
|
|
175
|
+
add(lost, name, place)
|
|
176
|
+
if (bridge) restorable.add(name)
|
|
177
|
+
}
|
|
178
|
+
for (const token of tokens) {
|
|
179
|
+
const parts = segments(token)
|
|
180
|
+
const base = (parts.pop() ?? '')
|
|
181
|
+
.replace(/^!|!$/g, '')
|
|
182
|
+
.replace(/^-/, '')
|
|
183
|
+
.replace(/\/[^\]]*$/, '')
|
|
184
|
+
if (base === '' || (BARE_WORD.test(base) && !listLike)) continue
|
|
185
|
+
for (const variant of parts) {
|
|
186
|
+
const step = BREAKPOINT_VARIANT.exec(variant)?.[1]
|
|
187
|
+
if (step === undefined) continue
|
|
188
|
+
if (step !== 'md' && step !== 'xl') {
|
|
189
|
+
report(`${variant}:`, 'breakpoint', step, step in BRIDGE_BREAKPOINTS)
|
|
190
|
+
} else if (!own.has(`breakpoint-${step}`)) add(moved, `${variant}:`, place)
|
|
191
|
+
}
|
|
192
|
+
const dead = deadUtility(base)
|
|
193
|
+
if (dead !== undefined) report(base, dead.theme, dead.step, dead.bridge)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
lost: [...lost.values()]
|
|
199
|
+
.map((u) => ({ ...u, bridge: restorable.has(u.name) }))
|
|
200
|
+
.toSorted(byCount),
|
|
201
|
+
moved: [...moved.values()].toSorted(byCount),
|
|
202
|
+
}
|
|
203
|
+
}
|
package/src/cli/migrate/rows.ts
CHANGED
|
@@ -43,12 +43,15 @@ export type RowFrom =
|
|
|
43
43
|
| { form: 'import'; module: string; symbol?: string; member?: string }
|
|
44
44
|
/** `basalt-ui <verb> [--flag [value]]`: one line of a source or config file runs it. */
|
|
45
45
|
| { form: 'command'; verb: string; words: string[] }
|
|
46
|
+
/** `file:<path>`: the app has its own source file whose path ends in `<path>`. */
|
|
47
|
+
| { form: 'file'; path: string }
|
|
46
48
|
/** `peer:<package>`: a package.json of the app declares it. */
|
|
47
49
|
| { form: 'peer'; name: string }
|
|
48
50
|
/** One word searched in the app's sources; a trailing `*` makes it a prefix. */
|
|
49
51
|
| { form: 'text'; needle: string }
|
|
50
52
|
|
|
51
53
|
const PEER = /^peer:((?:@[a-z\d][\w.-]*\/)?[a-z\d][\w.-]*)$/
|
|
54
|
+
const FILE = /^file:((?:[a-z\d][\w.-]*\/)*[a-z\d][\w.-]*\.tsx)$/
|
|
52
55
|
const BASALT = /^basalt-ui(?=$|[/# ])/
|
|
53
56
|
const COMMAND = /^basalt-ui ([a-z][a-z:-]*)((?: --[a-z][a-z-]*(?: [a-z][a-z-]*)?)*)$/
|
|
54
57
|
const MODULE_NAME = /^(?:@[\w*.-]+\/)?[\w*.-]+(?:\/[\w*.-]+)*$/
|
|
@@ -60,6 +63,10 @@ const TEXT = /^[^*]+\*?$/
|
|
|
60
63
|
|
|
61
64
|
/** The form of a row's `from`, or null when no app can ever match it. */
|
|
62
65
|
export function parseFrom(from: string): RowFrom | null {
|
|
66
|
+
if (from.startsWith('file:')) {
|
|
67
|
+
const path = FILE.exec(from)?.[1]
|
|
68
|
+
return path === undefined ? null : { form: 'file', path }
|
|
69
|
+
}
|
|
63
70
|
if (from.startsWith('peer:')) {
|
|
64
71
|
const name = PEER.exec(from)?.[1]
|
|
65
72
|
return name === undefined ? null : { form: 'peer', name }
|
|
@@ -311,6 +318,20 @@ export function loadMigrationFiles(pkgRoot: string): MigrationFile[] {
|
|
|
311
318
|
)
|
|
312
319
|
}
|
|
313
320
|
|
|
321
|
+
/**
|
|
322
|
+
* The app files a `file:` row replaces: file name without `.tsx` to the shipped import its `to`
|
|
323
|
+
* names.
|
|
324
|
+
*/
|
|
325
|
+
export function replacedFiles(pkgRoot: string): Map<string, string> {
|
|
326
|
+
const found = new Map<string, string>()
|
|
327
|
+
for (const row of loadMigrationFiles(pkgRoot).flatMap((f) => f.rows)) {
|
|
328
|
+
const from = parseFrom(row.from)
|
|
329
|
+
if (from?.form !== 'file' || row.to === undefined) continue
|
|
330
|
+
found.set(from.path.slice(from.path.lastIndexOf('/') + 1, -'.tsx'.length), row.to)
|
|
331
|
+
}
|
|
332
|
+
return found
|
|
333
|
+
}
|
|
334
|
+
|
|
314
335
|
/** Every entry of a file, across its lists. */
|
|
315
336
|
export function entriesOf(file: MigrationFile): Dated[] {
|
|
316
337
|
return [
|
|
@@ -41,7 +41,10 @@ export function addCommand(
|
|
|
41
41
|
const [x, sx] = exact ? [['--exact'], ['--save-exact']] : [[], []]
|
|
42
42
|
if (pm === 'bun') return ['bun', 'add', ...(dev ? ['--dev'] : []), ...x, ...specs]
|
|
43
43
|
if (pm === 'pnpm') {
|
|
44
|
-
|
|
44
|
+
// `-w` adds at the workspace root; an install run in a workspace package adds to that package.
|
|
45
|
+
const at = found?.at ?? dir
|
|
46
|
+
const workspace =
|
|
47
|
+
resolve(dir) === at && existsSync(resolve(at, 'pnpm-workspace.yaml')) ? ['-w'] : []
|
|
45
48
|
return ['pnpm', 'add', ...(dev ? ['--save-dev'] : []), ...sx, ...workspace, ...specs]
|
|
46
49
|
}
|
|
47
50
|
if (pm === 'yarn') return ['yarn', 'add', ...(dev ? ['--dev'] : []), ...x, ...specs]
|
package/src/cli/peers.ts
CHANGED
|
@@ -88,6 +88,17 @@ export function satisfiesRange(installed: string, range: string): boolean {
|
|
|
88
88
|
})
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/** Whether `installed` is outside `range` on a newer major than any it allows from below. */
|
|
92
|
+
export function aboveRange(installed: string, range: string): boolean {
|
|
93
|
+
const version = parseBase(installed)
|
|
94
|
+
if (version === null || satisfiesRange(installed, range)) return false
|
|
95
|
+
const majors = range
|
|
96
|
+
.split(/\s+|\|\|/)
|
|
97
|
+
.filter((c) => c !== '' && !c.startsWith('<'))
|
|
98
|
+
.flatMap((c) => parseBase(c.replace(/^(?:\^|~|>=|>|=)/, ''))?.base[0] ?? [])
|
|
99
|
+
return majors.length > 0 && version.base[0] > Math.max(...majors)
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
/** `name@spec`, shell-quoted when the spec holds a space, `|`, `<` or `>`. */
|
|
92
103
|
export function peerSpec(name: string, range: string | undefined): string {
|
|
93
104
|
if (range === undefined) return name
|
package/src/cli/presets.ts
CHANGED
|
@@ -75,20 +75,27 @@ const posixRelative = (from: string, path: string): string => {
|
|
|
75
75
|
* The base an app's preset extends, as a path from `root` (the folder the preset is written to). The
|
|
76
76
|
* path goes through the `basalt-ui` link and up one, `APP_BASE_PRESET`: the OS follows the link, so the
|
|
77
77
|
* `basalt-config` beside the installed package is found whether the install is flat or isolated. A
|
|
78
|
-
* hoisted install keeps the link in an ancestor's `node_modules`, and the path climbs to it
|
|
78
|
+
* hoisted install keeps the link in an ancestor's `node_modules`, and the path climbs to it; an isolated
|
|
79
|
+
* workspace keeps it in the app that depends on the package, which the declared roots lead to. A workspace
|
|
79
80
|
* links the package folder itself, which has no such sibling: there the path is the one to the
|
|
80
81
|
* `basalt-config` the package has installed, in its own `node_modules` or one above. `existsSync` takes the `..` unnormalized, as oxlint does.
|
|
81
82
|
*/
|
|
82
|
-
function appBase(pkgRoot: string, root: string | undefined): string {
|
|
83
|
+
function appBase(pkgRoot: string, root: string | undefined, roots: readonly string[]): string {
|
|
83
84
|
if (root === undefined) return APP_BASE_PRESET
|
|
84
85
|
// oxlint reads `extends` from the config's real folder, so every path is cut from there.
|
|
85
86
|
const real = realpathSync(root)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
// The install root's own chain first; then each declared root's, since an isolated workspace links
|
|
88
|
+
// the package into the app that depends on it (`apps/room/node_modules`), never into the root.
|
|
89
|
+
// Either way the path goes through the link, so it carries no install hash.
|
|
90
|
+
const starts = [real, ...roots.flatMap((r) => (existsSync(join(real, r)) ? [join(real, r)] : []))]
|
|
91
|
+
for (const start of starts) {
|
|
92
|
+
for (let dir = start; ; dir = dirname(dir)) {
|
|
93
|
+
const link = join(dir, 'node_modules/basalt-ui')
|
|
94
|
+
if (existsSync(`${link}/../basalt-config/oxlint.json`)) {
|
|
95
|
+
return `${posixRelative(real, link)}/../basalt-config/oxlint.json`
|
|
96
|
+
}
|
|
97
|
+
if (dirname(dir) === dir) break
|
|
90
98
|
}
|
|
91
|
-
if (dirname(dir) === dir) break
|
|
92
99
|
}
|
|
93
100
|
for (let dir = realpathSync(pkgRoot); ; dir = dirname(dir)) {
|
|
94
101
|
const own = join(dir, 'node_modules/basalt-config/oxlint.json')
|
|
@@ -116,9 +123,9 @@ export function renderOxlintPreset(
|
|
|
116
123
|
const [base] = above
|
|
117
124
|
if (base === undefined) return null
|
|
118
125
|
const pins = readShippedPreset(pkgRoot, base).settings?.basalt?.pins
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
)
|
|
126
|
+
// The preset covers the declared roots only (`src` at the manifest profile when none are declared).
|
|
127
|
+
const declared = rootsOf(manifest).filter(([, profile]) => profile !== 'tokens')
|
|
128
|
+
const roots = Object.fromEntries(declared) as Record<string, Exclude<Profile, 'tokens'>>
|
|
122
129
|
const preset = buildPreset({
|
|
123
130
|
table: tableOf(plugin),
|
|
124
131
|
pins: { oxlint: pins?.['oxlint'] ?? '', shadcnLint: pins?.['@shadcn/lint'] ?? '' },
|
|
@@ -127,13 +134,26 @@ export function renderOxlintPreset(
|
|
|
127
134
|
profile: base,
|
|
128
135
|
roots,
|
|
129
136
|
ejected: ejectedPaths(manifest),
|
|
137
|
+
scoped: true,
|
|
130
138
|
classPrefixes: manifest.classPrefixes ?? [],
|
|
131
139
|
bespoke: manifest.bespoke ?? [],
|
|
132
140
|
translated: isTranslated(manifest),
|
|
141
|
+
wordModules: manifest.wordModules ?? [],
|
|
133
142
|
})
|
|
134
143
|
return preset === undefined
|
|
135
144
|
? null
|
|
136
|
-
: `${JSON.stringify(
|
|
145
|
+
: `${JSON.stringify(
|
|
146
|
+
overBase(
|
|
147
|
+
preset,
|
|
148
|
+
appBase(
|
|
149
|
+
pkgRoot,
|
|
150
|
+
root,
|
|
151
|
+
declared.map(([path]) => path),
|
|
152
|
+
),
|
|
153
|
+
),
|
|
154
|
+
null,
|
|
155
|
+
2,
|
|
156
|
+
)}\n`
|
|
137
157
|
}
|
|
138
158
|
|
|
139
159
|
const scrolls = (profile: Profile): boolean =>
|
|
@@ -147,6 +167,7 @@ const scrolls = (profile: Profile): boolean =>
|
|
|
147
167
|
export function renderStylelintPreset(manifest: Manifest): string {
|
|
148
168
|
return renderStylelintConfig({
|
|
149
169
|
ignoreFiles: manifest.tokens.map((t) => t.out),
|
|
170
|
+
bespoke: manifest.bespoke ?? [],
|
|
150
171
|
scroll: {
|
|
151
172
|
base: scrolls(manifest.profile),
|
|
152
173
|
roots: Object.fromEntries(
|
package/src/cli/resolver.ts
CHANGED
|
@@ -5,9 +5,17 @@
|
|
|
5
5
|
* sibling-app cutover; docs/v3/concepts/migration-release.md 6.1). Any other second install is
|
|
6
6
|
* refused. A leaf over `./index`'s workspace walk, shared by `sync`, `init` and `doctor`.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { existsSync } from 'node:fs'
|
|
9
|
+
import { dirname, join, relative, resolve, sep } from 'node:path'
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
+
import { filesUnder, readText } from './doctor/types'
|
|
12
|
+
import {
|
|
13
|
+
collectWorkspacePackages,
|
|
14
|
+
findRepoRoot,
|
|
15
|
+
hasViteEntry,
|
|
16
|
+
readBasaltConfig,
|
|
17
|
+
resolveAppDir,
|
|
18
|
+
} from './index'
|
|
11
19
|
import type { Manifest } from './manifest'
|
|
12
20
|
import { hasDependency } from './source-text'
|
|
13
21
|
|
|
@@ -15,8 +23,32 @@ import { hasDependency } from './source-text'
|
|
|
15
23
|
export const isSiblingApp = (dir: string): boolean =>
|
|
16
24
|
readBasaltConfig(dir).sibling === true && findRepoRoot(dir) !== dir
|
|
17
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The package the peers belong in: a sibling install is its own package; else the workspace package
|
|
28
|
+
* that holds the first declared root (the nearest `package.json` between it and the install root),
|
|
29
|
+
* else the app `resolveAppDir` names, else the install root. A dependency declared at a workspace
|
|
30
|
+
* root is invisible to an app under an isolated linker, so it never lands there for a workspace app.
|
|
31
|
+
*/
|
|
32
|
+
export function peerHome(root: string, roots: readonly string[]): string {
|
|
33
|
+
if (isSiblingApp(root)) return root
|
|
34
|
+
const [first = '.'] = roots
|
|
35
|
+
for (let at = resolve(root, first); ; at = dirname(at)) {
|
|
36
|
+
if (at === root || relative(root, at).split(sep)[0] === '..') break
|
|
37
|
+
if (existsSync(join(at, 'package.json'))) return at
|
|
38
|
+
}
|
|
39
|
+
const app = resolveAppDir(root)
|
|
40
|
+
return 'error' in app ? root : app.dir
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Why the app of the workspace at `root` cannot be told, so no peer line may name the root; else null. */
|
|
44
|
+
export function unplacedPeers(root: string, home: string): string | null {
|
|
45
|
+
if (home !== root) return null
|
|
46
|
+
const app = resolveAppDir(root)
|
|
47
|
+
return 'error' in app && collectWorkspacePackages(root).hasWorkspacesField ? app.error : null
|
|
48
|
+
}
|
|
49
|
+
|
|
18
50
|
/** True when `rel` (below the install root) is, holds or sits inside a declared root. */
|
|
19
|
-
export const coveredByRoots = (manifest: Manifest, rel: string): boolean =>
|
|
51
|
+
export const coveredByRoots = (manifest: Pick<Manifest, 'roots'>, rel: string): boolean =>
|
|
20
52
|
Object.keys(manifest.roots).some((raw) => {
|
|
21
53
|
const root = raw.replace(/^(?:\.\/)+/, '').replace(/\/+$/, '')
|
|
22
54
|
return root === '.' || rel === root || rel.startsWith(`${root}/`) || root.startsWith(`${rel}/`)
|
|
@@ -24,13 +56,28 @@ export const coveredByRoots = (manifest: Manifest, rel: string): boolean =>
|
|
|
24
56
|
|
|
25
57
|
const posixRel = (root: string, dir: string): string => relative(root, dir).replaceAll('\\', '/')
|
|
26
58
|
|
|
59
|
+
/** What a package may import and still be no more than a reader of the one install's tokens. */
|
|
60
|
+
const TOKEN_SPECIFIERS = new Set(
|
|
61
|
+
['tokens', 'tokens.css', 'fonts.css', 'theme-script'].map((sub) => `basalt-ui/${sub}`),
|
|
62
|
+
)
|
|
63
|
+
const BASALT_SPECIFIER =
|
|
64
|
+
/(?:from\s*|import\s*\(?\s*|@import\s+(?:url\(\s*)?)['"](basalt-ui(?:\/[^'"]+)?)['"]/g
|
|
65
|
+
|
|
66
|
+
/** True when no source of the package at `dir` imports basalt-ui beyond its tokens. */
|
|
67
|
+
const takesTokensOnly = (dir: string): boolean =>
|
|
68
|
+
filesUnder(dir, '.', /\.(?:[cm]?[jt]sx?|css|astro|mdx)$/).every((file) =>
|
|
69
|
+
[...(readText(dir, file) ?? '').matchAll(BASALT_SPECIFIER)].every(([, spec = '']) =>
|
|
70
|
+
TOKEN_SPECIFIERS.has(spec),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
|
|
27
74
|
/**
|
|
28
75
|
* The refusal for an undeclared second install in the workspace under `root`, or null. Candidates
|
|
29
76
|
* are workspace packages that depend on basalt-ui and have a Vite entry; a declared sibling is not
|
|
30
|
-
* one. The root-owned install
|
|
31
|
-
*
|
|
77
|
+
* one. The root-owned install holds what the manifest's roots cover, `basalt.app` and every package that
|
|
78
|
+
* takes only the tokens. A candidate outside it is the undeclared one.
|
|
32
79
|
*/
|
|
33
|
-
export function undeclaredInstall(root: string, manifest: Manifest): string | null {
|
|
80
|
+
export function undeclaredInstall(root: string, manifest: Pick<Manifest, 'roots'>): string | null {
|
|
34
81
|
const owned = collectWorkspacePackages(root).packages.filter(
|
|
35
82
|
(pkg) =>
|
|
36
83
|
pkg.dir !== root &&
|
|
@@ -41,14 +88,15 @@ export function undeclaredInstall(root: string, manifest: Manifest): string | nu
|
|
|
41
88
|
if (owned.length < 2) return null
|
|
42
89
|
const named = readBasaltConfig(root).app
|
|
43
90
|
const isOwner = (dir: string): boolean =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
91
|
+
coveredByRoots(manifest, posixRel(root, dir)) ||
|
|
92
|
+
(named !== undefined && dir === resolve(root, named)) ||
|
|
93
|
+
takesTokensOnly(dir)
|
|
47
94
|
if (owned.filter((pkg) => isOwner(pkg.dir)).length === owned.length) return null
|
|
48
95
|
const names = owned.map((pkg) => posixRel(root, pkg.dir)).join(', ')
|
|
49
96
|
return (
|
|
50
97
|
`${owned.length} workspace packages depend on basalt-ui and have a Vite entry (${names}) — ` +
|
|
51
98
|
'cannot tell which is the app. Set `basalt.app` (e.g. `"basalt": { "app": "apps/web" }`) in the ' +
|
|
52
|
-
'root package.json
|
|
99
|
+
'root package.json. Another app is then either a root of this install (`basalt-ui init --profile <profile> ' +
|
|
100
|
+
'--root <its source>`) or an install of its own (`"basalt": { "sibling": true }` in its package.json).'
|
|
53
101
|
)
|
|
54
102
|
}
|
package/src/cli/router-wiring.ts
CHANGED
|
@@ -10,7 +10,9 @@ import { hasDependency, readIfExists, tokenize } from './source-text'
|
|
|
10
10
|
/** Relative-import hops (static or dynamic) `callsIn` follows from the entry; a router often lives in a singleton module. */
|
|
11
11
|
const IMPORT_DEPTH = 3
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/** Every name Vite looks for, in the order it does: the first that exists is the config it loads. */
|
|
14
|
+
export const VITE_CONFIGS = ['js', 'mjs', 'ts', 'cjs', 'mts', 'cts'].map((e) => `vite.config.${e}`)
|
|
15
|
+
|
|
14
16
|
/** The first local `<script type="module" src>` in index.html (comments and remote src skipped). */
|
|
15
17
|
function htmlEntry(html: string): string | undefined {
|
|
16
18
|
for (const [, attrs = ''] of html
|