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.
Files changed (512) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +72 -39
  3. package/MIGRATING.md +44 -2
  4. package/README.md +39 -12
  5. package/agent/rules/basalt-tokens.md +1 -1
  6. package/agent/rules/basalt-ui.md +3 -3
  7. package/agent/skills/basalt-app/references/live.md +4 -4
  8. package/agent/skills/basalt-app/references/migrate.md +2 -2
  9. package/agent/skills/basalt-app/references/setup.md +17 -8
  10. package/agent/skills/basalt-app/references/testing.md +8 -6
  11. package/agent/skills/basalt-design/SKILL.md +2 -1
  12. package/agent/skills/basalt-design/references/controls.md +1 -0
  13. package/agent/skills/basalt-design/references/parts.md +5 -1
  14. package/agent/templates/AGENTS-block.md.tpl +6 -23
  15. package/agent/templates/AGENTS-block.site.md.tpl +5 -18
  16. package/agent/templates/AGENTS-block.tokens.md.tpl +3 -7
  17. package/agent/templates/DESIGN.md.tpl +1 -1
  18. package/agent/templates/_app-error.i18n.tpl +8 -32
  19. package/agent/templates/_app-error.tpl +8 -32
  20. package/agent/templates/_app-pending.i18n.tpl +5 -3
  21. package/agent/templates/_app-pending.tpl +5 -4
  22. package/agent/templates/main.i18n.tpl +8 -3
  23. package/agent/templates/main.tpl +8 -3
  24. package/agent/templates/router.start.tpl +8 -3
  25. package/agent/templates/seed-messages.json +0 -30
  26. package/configs/oxlint-app.json +9 -1
  27. package/configs/oxlint-bridge.json +3 -1
  28. package/configs/oxlint-parts.json +9 -1
  29. package/configs/oxlint-site.json +3 -1
  30. package/dist/astro/shiki.d.ts +3 -2
  31. package/dist/astro/shiki.d.ts.map +1 -1
  32. package/dist/cards/bar-list.d.ts.map +1 -1
  33. package/dist/cards/bar-list.js +2 -1
  34. package/dist/cards/chain-view.d.ts +37 -8
  35. package/dist/cards/chain-view.d.ts.map +1 -1
  36. package/dist/cards/chain-view.js +105 -38
  37. package/dist/cards/contract.d.ts +8 -1
  38. package/dist/cards/contract.d.ts.map +1 -1
  39. package/dist/cards/data-panel.d.ts.map +1 -1
  40. package/dist/cards/data-panel.js +1 -0
  41. package/dist/cards/event-list.d.ts.map +1 -1
  42. package/dist/cards/event-list.js +3 -2
  43. package/dist/cards/index.d.ts +1 -1
  44. package/dist/cards/index.d.ts.map +1 -1
  45. package/dist/cards/row-list.d.ts.map +1 -1
  46. package/dist/cards/row-list.js +2 -1
  47. package/dist/cards/stat-card-parts.d.ts +3 -3
  48. package/dist/cards/stat-card-parts.d.ts.map +1 -1
  49. package/dist/cards/stat-card-parts.js +8 -2
  50. package/dist/cards/stat-card.d.ts.map +1 -1
  51. package/dist/cards/stat-card.js +34 -9
  52. package/dist/charts/core/compile.d.ts +2 -0
  53. package/dist/charts/core/compile.d.ts.map +1 -1
  54. package/dist/charts/core/compile.js +16 -8
  55. package/dist/charts/core/cursor.d.ts +2 -1
  56. package/dist/charts/core/cursor.d.ts.map +1 -1
  57. package/dist/charts/core/cursor.js +8 -1
  58. package/dist/charts/core/tooltip-said.d.ts +16 -0
  59. package/dist/charts/core/tooltip-said.d.ts.map +1 -0
  60. package/dist/charts/core/tooltip-said.js +39 -0
  61. package/dist/charts/focus.d.ts.map +1 -1
  62. package/dist/charts/focus.js +1 -1
  63. package/dist/charts/parts/chart-card.d.ts.map +1 -1
  64. package/dist/charts/parts/chart-card.js +1 -0
  65. package/dist/cli/agent-note.d.ts +3 -3
  66. package/dist/cli/agent-note.d.ts.map +1 -1
  67. package/dist/cli/agent-note.js +5 -5
  68. package/dist/cli/budget/index.d.ts +7 -0
  69. package/dist/cli/budget/index.d.ts.map +1 -1
  70. package/dist/cli/budget/index.js +11 -5
  71. package/dist/cli/config.d.ts +1 -1
  72. package/dist/cli/doctor/app.d.ts.map +1 -1
  73. package/dist/cli/doctor/app.js +53 -24
  74. package/dist/cli/doctor/eject.d.ts.map +1 -1
  75. package/dist/cli/doctor/eject.js +16 -9
  76. package/dist/cli/doctor/guards.d.ts.map +1 -1
  77. package/dist/cli/doctor/guards.js +11 -8
  78. package/dist/cli/doctor/hook.js +1 -1
  79. package/dist/cli/doctor/install.d.ts.map +1 -1
  80. package/dist/cli/doctor/install.js +46 -22
  81. package/dist/cli/doctor/translations.d.ts.map +1 -1
  82. package/dist/cli/doctor/translations.js +11 -4
  83. package/dist/cli/doctor/types.d.ts +2 -2
  84. package/dist/cli/doctor/types.d.ts.map +1 -1
  85. package/dist/cli/doctor/types.js +1 -1
  86. package/dist/cli/doctor/wiring.d.ts.map +1 -1
  87. package/dist/cli/doctor/wiring.js +26 -15
  88. package/dist/cli/eject/dropped-slots.d.ts +6 -0
  89. package/dist/cli/eject/dropped-slots.d.ts.map +1 -0
  90. package/dist/cli/eject/dropped-slots.js +9 -0
  91. package/dist/cli/eject/index.d.ts.map +1 -1
  92. package/dist/cli/eject/index.js +9 -8
  93. package/dist/cli/help.d.ts.map +1 -1
  94. package/dist/cli/help.js +7 -2
  95. package/dist/cli/index.d.ts +6 -5
  96. package/dist/cli/index.d.ts.map +1 -1
  97. package/dist/cli/index.js +38 -7
  98. package/dist/cli/init/index.d.ts +10 -0
  99. package/dist/cli/init/index.d.ts.map +1 -1
  100. package/dist/cli/init/index.js +61 -10
  101. package/dist/cli/init/locales.d.ts +7 -0
  102. package/dist/cli/init/locales.d.ts.map +1 -1
  103. package/dist/cli/init/locales.js +21 -6
  104. package/dist/cli/init/router-seeds.d.ts.map +1 -1
  105. package/dist/cli/init/router-seeds.js +16 -3
  106. package/dist/cli/init/steps.d.ts +36 -3
  107. package/dist/cli/init/steps.d.ts.map +1 -1
  108. package/dist/cli/init/steps.js +201 -34
  109. package/dist/cli/lint/baseline.d.ts +27 -0
  110. package/dist/cli/lint/baseline.d.ts.map +1 -0
  111. package/dist/cli/lint/baseline.js +96 -0
  112. package/dist/cli/lint/engine.d.ts +2 -0
  113. package/dist/cli/lint/engine.d.ts.map +1 -1
  114. package/dist/cli/lint/engine.js +18 -8
  115. package/dist/cli/lint/hook.d.ts.map +1 -1
  116. package/dist/cli/lint/hook.js +8 -3
  117. package/dist/cli/lint/index.d.ts +3 -0
  118. package/dist/cli/lint/index.d.ts.map +1 -1
  119. package/dist/cli/lint/index.js +67 -8
  120. package/dist/cli/manifest.d.ts +46 -3
  121. package/dist/cli/manifest.d.ts.map +1 -1
  122. package/dist/cli/manifest.js +71 -1
  123. package/dist/cli/migrate/census.d.ts +6 -0
  124. package/dist/cli/migrate/census.d.ts.map +1 -1
  125. package/dist/cli/migrate/census.js +22 -1
  126. package/dist/cli/migrate/index.d.ts +5 -0
  127. package/dist/cli/migrate/index.d.ts.map +1 -1
  128. package/dist/cli/migrate/index.js +36 -3
  129. package/dist/cli/migrate/lost-classes.d.ts +20 -0
  130. package/dist/cli/migrate/lost-classes.d.ts.map +1 -0
  131. package/dist/cli/migrate/lost-classes.js +145 -0
  132. package/dist/cli/migrate/rows.d.ts +10 -0
  133. package/dist/cli/migrate/rows.d.ts.map +1 -1
  134. package/dist/cli/migrate/rows.js +15 -0
  135. package/dist/cli/package-manager.d.ts.map +1 -1
  136. package/dist/cli/package-manager.js +2 -1
  137. package/dist/cli/peers.d.ts +2 -0
  138. package/dist/cli/peers.d.ts.map +1 -1
  139. package/dist/cli/peers.js +7 -0
  140. package/dist/cli/presets.d.ts.map +1 -1
  141. package/dist/cli/presets.js +27 -11
  142. package/dist/cli/resolver.d.ts +13 -4
  143. package/dist/cli/resolver.d.ts.map +1 -1
  144. package/dist/cli/resolver.js +39 -5
  145. package/dist/cli/router-wiring.d.ts +1 -0
  146. package/dist/cli/router-wiring.d.ts.map +1 -1
  147. package/dist/cli/router-wiring.js +1 -1
  148. package/dist/cli/sync/engine.d.ts +8 -1
  149. package/dist/cli/sync/engine.d.ts.map +1 -1
  150. package/dist/cli/sync/engine.js +25 -14
  151. package/dist/cli/sync/index.d.ts.map +1 -1
  152. package/dist/cli/sync/index.js +7 -4
  153. package/dist/cli/sync/render.d.ts.map +1 -1
  154. package/dist/cli/sync/render.js +21 -28
  155. package/dist/cli/tokens-css.d.ts +2 -0
  156. package/dist/cli/tokens-css.d.ts.map +1 -1
  157. package/dist/cli/tokens-css.js +28 -6
  158. package/dist/controls/contract.d.ts +2 -1
  159. package/dist/controls/contract.d.ts.map +1 -1
  160. package/dist/controls/control-home.d.ts +4 -1
  161. package/dist/controls/control-home.d.ts.map +1 -1
  162. package/dist/controls/control-home.js +5 -3
  163. package/dist/controls/local-control.d.ts +28 -1
  164. package/dist/controls/local-control.d.ts.map +1 -1
  165. package/dist/controls/local-control.js +14 -2
  166. package/dist/core/cn.d.ts.map +1 -1
  167. package/dist/core/cn.js +6 -5
  168. package/dist/core/frame-figure.d.ts +2 -0
  169. package/dist/core/frame-figure.d.ts.map +1 -1
  170. package/dist/core/frame-figure.js +5 -2
  171. package/dist/core/frame-head.d.ts +3 -1
  172. package/dist/core/frame-head.d.ts.map +1 -1
  173. package/dist/core/frame-head.js +28 -7
  174. package/dist/core/frame-regions.d.ts +1 -1
  175. package/dist/core/frame-regions.d.ts.map +1 -1
  176. package/dist/core/frame-regions.js +18 -8
  177. package/dist/core/info-hint.d.ts +5 -0
  178. package/dist/core/info-hint.d.ts.map +1 -1
  179. package/dist/core/info-hint.js +22 -1
  180. package/dist/core/mark-tone.d.ts +6 -2
  181. package/dist/core/mark-tone.d.ts.map +1 -1
  182. package/dist/core/mark-tone.js +1 -1
  183. package/dist/core/mark-types.d.ts +4 -2
  184. package/dist/core/mark-types.d.ts.map +1 -1
  185. package/dist/core/messages/chain.d.ts +2 -1
  186. package/dist/core/messages/chain.d.ts.map +1 -1
  187. package/dist/core/messages/chain.js +1 -0
  188. package/dist/core/messages/index.d.ts +2 -1
  189. package/dist/core/messages/index.d.ts.map +1 -1
  190. package/dist/core/messages/index.js +2 -0
  191. package/dist/core/messages/runs.d.ts +20 -0
  192. package/dist/core/messages/runs.d.ts.map +1 -0
  193. package/dist/core/messages/runs.js +18 -0
  194. package/dist/core/phase.d.ts +25 -2
  195. package/dist/core/phase.d.ts.map +1 -1
  196. package/dist/core/ports.d.ts +4 -1
  197. package/dist/core/ports.d.ts.map +1 -1
  198. package/dist/core/provider.d.ts +3 -1
  199. package/dist/core/provider.d.ts.map +1 -1
  200. package/dist/core/provider.js +5 -3
  201. package/dist/core/scheme.d.ts +2 -1
  202. package/dist/core/scheme.d.ts.map +1 -1
  203. package/dist/core/scheme.js +1 -0
  204. package/dist/core/spark/mini-bars.d.ts +6 -4
  205. package/dist/core/spark/mini-bars.d.ts.map +1 -1
  206. package/dist/core/spark/mini-bars.js +36 -11
  207. package/dist/core/spark/sparkline.d.ts +2 -2
  208. package/dist/core/spark/sparkline.d.ts.map +1 -1
  209. package/dist/core/spark/sparkline.js +21 -2
  210. package/dist/css/bridge.css +63 -0
  211. package/dist/css/generate.d.ts +2 -2
  212. package/dist/css/generate.d.ts.map +1 -1
  213. package/dist/css/generate.js +25 -0
  214. package/dist/data/live/live-query.d.ts +2 -2
  215. package/dist/data/live/live-query.d.ts.map +1 -1
  216. package/dist/data/live/live-query.js +2 -1
  217. package/dist/lint/preset.d.ts +12 -3
  218. package/dist/lint/preset.d.ts.map +1 -1
  219. package/dist/lint/preset.js +30 -10
  220. package/dist/lint/rules/class/table.d.ts.map +1 -1
  221. package/dist/lint/rules/class/table.js +3 -1
  222. package/dist/lint/rules/structure/control-home.js +1 -1
  223. package/dist/lint/rules/structure/import-boundary.d.ts.map +1 -1
  224. package/dist/lint/rules/structure/import-boundary.js +2 -0
  225. package/dist/lint/rules/structure/label-literal.d.ts.map +1 -1
  226. package/dist/lint/rules/structure/label-literal.js +1 -1
  227. package/dist/lint/shadcn.d.ts +562 -0
  228. package/dist/lint/shadcn.d.ts.map +1 -0
  229. package/dist/lint/shadcn.js +52 -0
  230. package/dist/lint/stylelint/render.d.ts +3 -1
  231. package/dist/lint/stylelint/render.d.ts.map +1 -1
  232. package/dist/lint/stylelint/render.js +23 -2
  233. package/dist/lint/stylelint/rules.d.ts +3 -2
  234. package/dist/lint/stylelint/rules.d.ts.map +1 -1
  235. package/dist/lint/stylelint/rules.js +11 -6
  236. package/dist/lint/weakened.d.ts +8 -0
  237. package/dist/lint/weakened.d.ts.map +1 -1
  238. package/dist/lint/weakened.js +44 -1
  239. package/dist/messages/de.d.ts.map +1 -1
  240. package/dist/messages/de.js +15 -0
  241. package/dist/messages/es.d.ts.map +1 -1
  242. package/dist/messages/es.js +15 -0
  243. package/dist/messages/fr.d.ts.map +1 -1
  244. package/dist/messages/fr.js +15 -0
  245. package/dist/messages/zh-hans.d.ts.map +1 -1
  246. package/dist/messages/zh-hans.js +15 -0
  247. package/dist/page/bar-title.d.ts +25 -0
  248. package/dist/page/bar-title.d.ts.map +1 -0
  249. package/dist/page/bar-title.js +10 -0
  250. package/dist/page/contract.d.ts +11 -1
  251. package/dist/page/contract.d.ts.map +1 -1
  252. package/dist/page/empty-state.d.ts +5 -2
  253. package/dist/page/empty-state.d.ts.map +1 -1
  254. package/dist/page/empty-state.js +14 -3
  255. package/dist/page/facts.d.ts +19 -2
  256. package/dist/page/facts.d.ts.map +1 -1
  257. package/dist/page/facts.js +26 -5
  258. package/dist/page/index.d.ts +8 -0
  259. package/dist/page/index.d.ts.map +1 -1
  260. package/dist/page/index.js +9 -0
  261. package/dist/page/page-bar.d.ts.map +1 -1
  262. package/dist/page/page-bar.js +2 -7
  263. package/dist/page/page-summary.d.ts +2 -1
  264. package/dist/page/page-summary.d.ts.map +1 -1
  265. package/dist/page/page-summary.js +1 -1
  266. package/dist/page/run-button.d.ts +26 -0
  267. package/dist/page/run-button.d.ts.map +1 -0
  268. package/dist/page/run-button.js +31 -0
  269. package/dist/page/run-list.d.ts +28 -0
  270. package/dist/page/run-list.d.ts.map +1 -0
  271. package/dist/page/run-list.js +88 -0
  272. package/dist/page/run-queue.d.ts +78 -0
  273. package/dist/page/run-queue.d.ts.map +1 -0
  274. package/dist/page/run-queue.js +93 -0
  275. package/dist/page/section.d.ts +6 -1
  276. package/dist/page/section.d.ts.map +1 -1
  277. package/dist/page/section.js +34 -16
  278. package/dist/shell/commands/command-palette.d.ts.map +1 -1
  279. package/dist/shell/commands/command-palette.js +5 -1
  280. package/dist/shell/parts/header.js +1 -1
  281. package/dist/surfaces.d.ts +15 -1
  282. package/dist/surfaces.d.ts.map +1 -1
  283. package/dist/surfaces.js +19 -2
  284. package/dist/testing/index.d.ts +1 -0
  285. package/dist/testing/index.d.ts.map +1 -1
  286. package/dist/testing/index.js +3 -0
  287. package/dist/testing/pseudo-locale.d.ts +41 -0
  288. package/dist/testing/pseudo-locale.d.ts.map +1 -0
  289. package/dist/testing/pseudo-locale.js +74 -0
  290. package/dist/testing/quality.d.ts +6 -0
  291. package/dist/testing/quality.d.ts.map +1 -1
  292. package/dist/testing/quality.js +139 -1
  293. package/dist/tokens/bridge-sheet.d.ts +21 -0
  294. package/dist/tokens/bridge-sheet.d.ts.map +1 -0
  295. package/dist/tokens/bridge-sheet.js +68 -0
  296. package/dist/tokens/emit.d.ts +6 -1
  297. package/dist/tokens/emit.d.ts.map +1 -1
  298. package/dist/tokens/emit.js +26 -1
  299. package/dist/ui/accordion.js +1 -1
  300. package/dist/ui/card.d.ts +32 -4
  301. package/dist/ui/card.d.ts.map +1 -1
  302. package/dist/ui/card.js +26 -3
  303. package/dist/ui/collapsible.d.ts +4 -2
  304. package/dist/ui/collapsible.d.ts.map +1 -1
  305. package/dist/ui/collapsible.js +1 -1
  306. package/dist/ui/combobox.js +1 -1
  307. package/dist/ui/meter.d.ts +34 -3
  308. package/dist/ui/meter.d.ts.map +1 -1
  309. package/dist/ui/meter.guard.d.ts +2 -0
  310. package/dist/ui/meter.guard.d.ts.map +1 -1
  311. package/dist/ui/meter.guard.js +20 -0
  312. package/dist/ui/meter.js +23 -7
  313. package/dist/ui/primitive.contract.d.ts.map +1 -1
  314. package/dist/ui/primitive.contract.js +7 -0
  315. package/dist/ui/remote-pad.d.ts +62 -0
  316. package/dist/ui/remote-pad.d.ts.map +1 -0
  317. package/dist/ui/remote-pad.guard.d.ts +21 -0
  318. package/dist/ui/remote-pad.guard.d.ts.map +1 -0
  319. package/dist/ui/remote-pad.guard.js +6 -0
  320. package/dist/ui/remote-pad.js +148 -0
  321. package/dist/ui/segmented.d.ts.map +1 -1
  322. package/dist/ui/segmented.js +4 -0
  323. package/dist/ui/skeleton.d.ts +9 -4
  324. package/dist/ui/skeleton.d.ts.map +1 -1
  325. package/dist/ui/skeleton.guard.d.ts +6 -2
  326. package/dist/ui/skeleton.guard.d.ts.map +1 -1
  327. package/dist/ui/skeleton.guard.js +4 -0
  328. package/dist/ui/skeleton.js +2 -1
  329. package/dist/ui/slots.d.ts +2 -1
  330. package/dist/ui/slots.d.ts.map +1 -1
  331. package/dist/ui/slots.js +2 -1
  332. package/dist/vite/allotment.d.ts +1 -1
  333. package/dist/vite/allotment.d.ts.map +1 -1
  334. package/dist/vite/allotment.js +15 -1
  335. package/dist/vite/doc.d.ts +1 -1
  336. package/dist/vite/doc.d.ts.map +1 -1
  337. package/dist/vite/doc.js +12 -2
  338. package/dist/vite/head.d.ts +4 -3
  339. package/dist/vite/head.d.ts.map +1 -1
  340. package/dist/vite/index.d.ts.map +1 -1
  341. package/dist/vite/index.js +4 -1
  342. package/dist/vite/shell-worker.d.ts +6 -0
  343. package/dist/vite/shell-worker.d.ts.map +1 -0
  344. package/dist/vite/shell-worker.js +92 -0
  345. package/docs/astro.md +19 -4
  346. package/docs/bar-list.md +3 -2
  347. package/docs/bar-title.md +33 -0
  348. package/docs/basalt-provider.md +2 -1
  349. package/docs/card.md +24 -4
  350. package/docs/chain-view.md +12 -7
  351. package/docs/chart-card.md +3 -2
  352. package/docs/collapsible.md +4 -2
  353. package/docs/control-home.md +4 -2
  354. package/docs/create-run-queue.md +40 -0
  355. package/docs/data-panel.md +3 -2
  356. package/docs/de.md +1 -1
  357. package/docs/empty-state.md +3 -1
  358. package/docs/es.md +1 -1
  359. package/docs/event-list.md +3 -2
  360. package/docs/fact.md +6 -1
  361. package/docs/facts.md +5 -1
  362. package/docs/fr.md +1 -1
  363. package/docs/live-query.md +1 -1
  364. package/docs/meter.md +17 -13
  365. package/docs/mini-bars.md +7 -5
  366. package/docs/pseudo-basalt-messages.md +30 -0
  367. package/docs/pseudo-messages.md +27 -0
  368. package/docs/quality.md +2 -1
  369. package/docs/recipes/localise-app.md +2 -2
  370. package/docs/remote-pad.md +40 -0
  371. package/docs/row-list.md +3 -2
  372. package/docs/run-button.md +45 -0
  373. package/docs/run-list.md +71 -0
  374. package/docs/section.md +7 -1
  375. package/docs/set-scheme.md +2 -2
  376. package/docs/skeleton.md +4 -3
  377. package/docs/slots.md +1 -1
  378. package/docs/sparkline.md +5 -2
  379. package/docs/stat-card.md +6 -4
  380. package/docs/testing.md +64 -0
  381. package/docs/use-local-control.md +8 -1
  382. package/docs/use-runs.md +32 -0
  383. package/docs/vite.md +12 -2
  384. package/docs/zh-hans.md +1 -1
  385. package/llms.txt +88 -21
  386. package/migrations/areas/shadcn.json +338 -0
  387. package/package.json +9 -2
  388. package/src/astro/shiki.ts +3 -1
  389. package/src/cards/bar-list.tsx +2 -1
  390. package/src/cards/chain-view.tsx +167 -55
  391. package/src/cards/contract.ts +8 -1
  392. package/src/cards/data-panel.tsx +1 -0
  393. package/src/cards/event-list.tsx +2 -1
  394. package/src/cards/index.ts +1 -0
  395. package/src/cards/row-list.tsx +2 -1
  396. package/src/cards/stat-card-parts.tsx +9 -7
  397. package/src/cards/stat-card.tsx +39 -12
  398. package/src/charts/core/compile.ts +31 -19
  399. package/src/charts/core/cursor.ts +11 -3
  400. package/src/charts/core/tooltip-said.ts +55 -0
  401. package/src/charts/focus.tsx +4 -1
  402. package/src/charts/parts/chart-card.tsx +1 -0
  403. package/src/cli/agent-note.ts +12 -5
  404. package/src/cli/budget/index.ts +22 -5
  405. package/src/cli/config.ts +1 -1
  406. package/src/cli/doctor/app.ts +75 -23
  407. package/src/cli/doctor/eject.ts +30 -10
  408. package/src/cli/doctor/guards.ts +11 -8
  409. package/src/cli/doctor/hook.ts +1 -1
  410. package/src/cli/doctor/install.ts +61 -24
  411. package/src/cli/doctor/translations.ts +13 -4
  412. package/src/cli/doctor/types.ts +2 -3
  413. package/src/cli/doctor/wiring.ts +30 -16
  414. package/src/cli/eject/dropped-slots.ts +11 -0
  415. package/src/cli/eject/index.ts +13 -9
  416. package/src/cli/help.ts +34 -10
  417. package/src/cli/index.ts +56 -14
  418. package/src/cli/init/index.ts +64 -5
  419. package/src/cli/init/locales.ts +41 -8
  420. package/src/cli/init/router-seeds.ts +17 -3
  421. package/src/cli/init/steps.ts +308 -41
  422. package/src/cli/lint/baseline.ts +141 -0
  423. package/src/cli/lint/engine.ts +33 -10
  424. package/src/cli/lint/hook.ts +11 -3
  425. package/src/cli/lint/index.ts +77 -12
  426. package/src/cli/manifest.ts +132 -4
  427. package/src/cli/migrate/census.ts +35 -1
  428. package/src/cli/migrate/index.ts +46 -3
  429. package/src/cli/migrate/lost-classes.ts +203 -0
  430. package/src/cli/migrate/rows.ts +21 -0
  431. package/src/cli/package-manager.ts +4 -1
  432. package/src/cli/peers.ts +11 -0
  433. package/src/cli/presets.ts +32 -11
  434. package/src/cli/resolver.ts +58 -10
  435. package/src/cli/router-wiring.ts +3 -1
  436. package/src/cli/sync/engine.ts +30 -14
  437. package/src/cli/sync/index.ts +7 -4
  438. package/src/cli/sync/render.ts +29 -37
  439. package/src/cli/tokens-css.ts +42 -5
  440. package/src/controls/contract.ts +2 -0
  441. package/src/controls/control-home.tsx +15 -4
  442. package/src/controls/local-control.ts +49 -3
  443. package/src/core/cn.ts +9 -5
  444. package/src/core/frame-figure.tsx +7 -1
  445. package/src/core/frame-head.tsx +32 -6
  446. package/src/core/frame-regions.tsx +18 -8
  447. package/src/core/info-hint.tsx +26 -0
  448. package/src/core/mark-tone.ts +10 -3
  449. package/src/core/mark-types.ts +4 -2
  450. package/src/core/messages/chain.ts +2 -1
  451. package/src/core/messages/index.ts +4 -0
  452. package/src/core/messages/runs.ts +40 -0
  453. package/src/core/phase.ts +22 -2
  454. package/src/core/ports.ts +13 -1
  455. package/src/core/provider.tsx +7 -3
  456. package/src/core/scheme.ts +6 -2
  457. package/src/core/spark/mini-bars.tsx +59 -15
  458. package/src/core/spark/sparkline.tsx +26 -4
  459. package/src/css/bridge.css +63 -0
  460. package/src/css/generate.ts +40 -3
  461. package/src/data/live/live-query.ts +4 -3
  462. package/src/lint/preset.ts +52 -13
  463. package/src/lint/rules/class/table.ts +3 -1
  464. package/src/lint/rules/structure/control-home.ts +1 -1
  465. package/src/lint/rules/structure/import-boundary.ts +2 -0
  466. package/src/lint/rules/structure/label-literal.ts +3 -1
  467. package/src/lint/shadcn.ts +91 -0
  468. package/src/lint/stylelint/render.ts +31 -1
  469. package/src/lint/stylelint/rules.ts +19 -7
  470. package/src/lint/weakened.ts +59 -1
  471. package/src/messages/de.ts +20 -0
  472. package/src/messages/es.ts +20 -0
  473. package/src/messages/fr.ts +20 -0
  474. package/src/messages/zh-hans.ts +20 -0
  475. package/src/page/bar-title.tsx +35 -0
  476. package/src/page/contract.ts +11 -1
  477. package/src/page/empty-state.tsx +18 -8
  478. package/src/page/facts.tsx +43 -5
  479. package/src/page/index.ts +8 -0
  480. package/src/page/page-bar.tsx +2 -9
  481. package/src/page/page-summary.tsx +4 -3
  482. package/src/page/run-button.tsx +52 -0
  483. package/src/page/run-list.tsx +151 -0
  484. package/src/page/run-queue.ts +185 -0
  485. package/src/page/section.tsx +30 -5
  486. package/src/shell/commands/command-palette.tsx +10 -1
  487. package/src/shell/parts/header.tsx +1 -1
  488. package/src/surfaces.ts +18 -1
  489. package/src/testing/index.ts +1 -0
  490. package/src/testing/pseudo-locale.ts +149 -0
  491. package/src/testing/quality.ts +188 -0
  492. package/src/tokens/bridge-sheet.ts +80 -0
  493. package/src/tokens/emit.ts +45 -6
  494. package/src/ui/accordion.tsx +1 -1
  495. package/src/ui/card.tsx +56 -6
  496. package/src/ui/collapsible.tsx +5 -3
  497. package/src/ui/combobox.tsx +1 -1
  498. package/src/ui/meter.guard.ts +23 -0
  499. package/src/ui/meter.tsx +76 -27
  500. package/src/ui/no-restyle.generated.json +8 -0
  501. package/src/ui/primitive.contract.ts +7 -0
  502. package/src/ui/remote-pad.guard.ts +24 -0
  503. package/src/ui/remote-pad.tsx +249 -0
  504. package/src/ui/segmented.tsx +6 -0
  505. package/src/ui/skeleton.guard.ts +7 -2
  506. package/src/ui/skeleton.tsx +10 -4
  507. package/src/ui/slots.ts +2 -1
  508. package/src/vite/allotment.ts +15 -1
  509. package/src/vite/doc.ts +12 -2
  510. package/src/vite/head.ts +4 -3
  511. package/src/vite/index.ts +4 -1
  512. 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[] = []
@@ -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. Never writes, never touches the network.
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
+ }
@@ -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
- const workspace = existsSync(resolve(found?.at ?? dir, 'pnpm-workspace.yaml')) ? ['-w'] : []
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
@@ -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. A workspace
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
- for (let dir = real; ; dir = dirname(dir)) {
87
- const link = join(dir, 'node_modules/basalt-ui')
88
- if (existsSync(`${link}/../basalt-config/oxlint.json`)) {
89
- return `${posixRelative(real, link)}/../basalt-config/oxlint.json`
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
- const roots = Object.fromEntries(
120
- Object.entries(manifest.roots).filter(([, profile]) => profile !== 'tokens'),
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(overBase(preset, appBase(pkgRoot, root)), null, 2)}\n`
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(
@@ -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 { relative, resolve } from 'node:path'
8
+ import { existsSync } from 'node:fs'
9
+ import { dirname, join, relative, resolve, sep } from 'node:path'
9
10
 
10
- import { collectWorkspacePackages, findRepoRoot, hasViteEntry, readBasaltConfig } from './index'
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 is `basalt.app` when set, else whatever the manifest's roots cover; a
31
- * second candidate that neither names covers is the undeclared one.
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
- named === undefined
45
- ? coveredByRoots(manifest, posixRel(root, dir))
46
- : dir === resolve(root, named)
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, and declare a second install with `"basalt": { "sibling": true }` in its own 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
  }
@@ -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
- export const VITE_CONFIGS = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs'].map((e) => `vite.config.${e}`)
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