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
@@ -17,19 +17,23 @@ import {
17
17
  import { dirname, relative, resolve } from 'node:path'
18
18
 
19
19
  import { sha256 } from '../index'
20
+ import { AGENTS_FILE, agentsPath } from '../manifest'
20
21
  import type { Manifest } from '../manifest'
21
22
  import { scanBlock, spliceBlock } from './block'
22
23
  import { unitPath } from './sibling'
23
24
  import type { Unit } from './render'
24
25
 
25
- export const AGENTS_FILE = 'AGENTS.md'
26
+ export { AGENTS_FILE }
26
27
 
27
28
  export type State = 'current' | 'missing' | 'stale' | 'edited'
28
- export type Item = Unit & { state: State }
29
+ /** `shadows`: an edited file at a shipped path that basalt never placed (no ledger digest), a file of the consumer's own. */
30
+ export type Item = Unit & { state: State; shadows: boolean }
29
31
  export type Retired = { path: string; state: 'untouched' | 'edited' | 'gone' }
30
32
  export type Plan = {
31
33
  items: Item[]
32
34
  retired: Retired[]
35
+ /** The file the block lives in, relative to the install root (`manifest.agents`). */
36
+ agents: string
33
37
  /** Generated files no longer placed that are still on disk (the shim, a hook file basalt alone filled). */
34
38
  drops: string[]
35
39
  /** `text` is the whole host after the splice; `''` deletes a host the block alone filled. */
@@ -59,10 +63,14 @@ export function planSync(
59
63
  repo: string = root,
60
64
  drops: readonly string[] = [],
61
65
  ): Plan {
62
- const items = units.map((unit) => ({
63
- ...unit,
64
- state: stateOf(unit, readText(root, unit.path, repo), manifest.managed[unit.path]),
65
- }))
66
+ const items = units.map((unit): Item => {
67
+ const state = stateOf(unit, readText(root, unit.path, repo), manifest.managed[unit.path])
68
+ return {
69
+ ...unit,
70
+ state,
71
+ shadows: state === 'edited' && manifest.managed[unit.path] === undefined,
72
+ }
73
+ })
66
74
  const wanted = new Set(units.map((unit) => unit.path))
67
75
  const retired = Object.entries(manifest.managed)
68
76
  .filter(([path]) => !wanted.has(path))
@@ -74,23 +82,25 @@ export function planSync(
74
82
  })
75
83
 
76
84
  const dropped = drops.filter((path) => readText(root, path, repo) !== null)
77
- const host = readText(root, AGENTS_FILE, repo) ?? ''
78
- const scan = scanBlock(host, AGENTS_FILE)
85
+ const agents = agentsPath(manifest)
86
+ const host = readText(root, agents, repo) ?? ''
87
+ const scan = scanBlock(host, agents)
79
88
  if (typeof scan === 'object' && 'error' in scan) {
80
- return { items, retired, drops: dropped, block: scan }
89
+ return { items, retired, agents, drops: dropped, block: scan }
81
90
  }
82
91
  if (block === null) {
83
92
  const text = scan === 'absent' ? host : cutBlock(host, scan)
84
93
  return {
85
94
  items,
86
95
  retired,
96
+ agents,
87
97
  drops: dropped,
88
98
  block: { state: text === host ? 'current' : 'stale', text },
89
99
  }
90
100
  }
91
101
  const text = spliceBlock(host, scan, block)
92
102
  const state = scan === 'absent' ? 'missing' : text === host ? 'current' : 'stale'
93
- return { items, retired, drops: dropped, block: { state, text } }
103
+ return { items, retired, agents, drops: dropped, block: { state, text } }
94
104
  }
95
105
 
96
106
  /** The host without the block and the blank lines around it; `''` when nothing else is left. */
@@ -104,19 +114,25 @@ function cutBlock(host: string, scan: { start: number; end: number }): string {
104
114
  return text === '' ? '' : `${text}\n`
105
115
  }
106
116
 
117
+ /** What `sync` and `doctor` say for a consumer's own file that sits at a shipped path: the name is taken by the shipped layer. */
118
+ export function shadowNote(path: string): string {
119
+ const kind = path.includes('/rules/') ? 'rule' : 'file'
120
+ return `your file shadows a shipped ${kind}: rename it, then sync --force`
121
+ }
122
+
107
123
  /** Every path a plan would change; `--check` is red on any, a locally edited file included. */
108
124
  export function differences(plan: Plan): string[] {
109
125
  const how = { missing: 'missing', stale: 'out of date', edited: 'edited locally', current: '' }
110
126
  const lines = plan.items
111
127
  .filter((i) => i.state !== 'current')
112
- .map((i) => `${i.path}: ${how[i.state]}`)
128
+ .map((i) => (i.shadows ? `${i.path}: ${shadowNote(i.path)}` : `${i.path}: ${how[i.state]}`))
113
129
  for (const r of plan.retired) {
114
130
  if (r.state !== 'gone')
115
131
  lines.push(`${r.path}: retired${r.state === 'edited' ? ' (edited locally)' : ''}`)
116
132
  }
117
133
  for (const path of plan.drops) lines.push(`${path}: no longer placed`)
118
134
  if ('state' in plan.block && plan.block.state !== 'current') {
119
- lines.push(`${AGENTS_FILE}: basalt block ${how[plan.block.state]}`)
135
+ lines.push(`${plan.agents}: basalt block ${how[plan.block.state]}`)
120
136
  }
121
137
  return lines
122
138
  }
@@ -181,8 +197,8 @@ export function applySync(
181
197
  applied.removed++
182
198
  }
183
199
  if ('state' in plan.block && plan.block.state !== 'current') {
184
- if (plan.block.text === '') remove(root, AGENTS_FILE, repo)
185
- else put(root, AGENTS_FILE, plan.block.text, repo)
200
+ if (plan.block.text === '') remove(root, plan.agents, repo)
201
+ else put(root, plan.agents, plan.block.text, repo)
186
202
  applied.written++
187
203
  }
188
204
  return applied
@@ -15,7 +15,7 @@ import { BUDGET_FORMAT, BUDGET_PATH, migrateBudget, readBudget } from '../budget
15
15
  import { staleRecord } from '../lint/record'
16
16
  import { MANIFEST_FORMAT, MANIFEST_PATH, readManifest, writeManifest } from '../manifest'
17
17
  import type { Manifest } from '../manifest'
18
- import { applySync, differences, planSync } from './engine'
18
+ import { applySync, differences, planSync, shadowNote } from './engine'
19
19
  import { lintSettingsUnits } from '../lint-settings'
20
20
  import { presetFilesFor } from '../presets'
21
21
  import { coveredByRoots, undeclaredInstall } from '../resolver'
@@ -147,7 +147,8 @@ export function sync(opts: SyncOptions = {}, invocationCwd: string = process.cwd
147
147
  }
148
148
 
149
149
  const bases = repo === root ? [root] : [root, repo]
150
- const before = agentFiles(bases)
150
+ const agents = [plan.agents]
151
+ const before = agentFiles(bases, agents)
151
152
  const applied = applySync(root, manifest, plan, opts.force === true, repo)
152
153
  applyEjected(root, ejects)
153
154
  migrateBudget(root)
@@ -158,10 +159,12 @@ export function sync(opts: SyncOptions = {}, invocationCwd: string = process.cwd
158
159
  )
159
160
  if (applied.left.length > 0) {
160
161
  console.log('Locally edited files were left as they are (run with --force to overwrite):')
161
- for (const path of applied.left) console.log(` ${path}`)
162
+ const shadowed = new Set(plan.items.filter((i) => i.shadows).map((i) => i.path))
163
+ for (const path of applied.left)
164
+ console.log(` ${path}${shadowed.has(path) ? `: ${shadowNote(path)}` : ''}`)
162
165
  }
163
166
  for (const problem of install.problems) console.error(`✖ basalt-ui sync: ${problem}`)
164
- const note = opts.note === false ? null : sessionNote(before, bases)
167
+ const note = opts.note === false ? null : sessionNote(before, bases, agents)
165
168
  if (note !== null) console.log(`\n${note}`)
166
169
  return ejects.conflicts.length + ejects.errors.length + install.problems.length === 0 ? 0 : 1
167
170
  }
@@ -19,10 +19,10 @@ import { renderRulePaths } from '../index'
19
19
  import { HARNESS_NAMES, HOOK_ADAPTERS, HOOK_TARGETS, harnessesOf, placementFor } from '../harness'
20
20
  import type { Harness, HookAdapter } from '../harness'
21
21
  import { hooksObject, mergeSettings, SHIM, stripHookEntries } from '../lint/settings'
22
- import { isSiteManifest } from '../manifest'
22
+ import { DEFAULT_REPORT, designPath, isSiteManifest } from '../manifest'
23
23
  import type { Manifest, Profile } from '../manifest'
24
24
  import { renderTokens } from '../tokens-css'
25
- import { portableSkill, rulePaths, subagentFor } from './formats'
25
+ import { portableSkill, subagentFor } from './formats'
26
26
  import { REPO, renameRefs, siblingName } from './sibling'
27
27
  import type { Sibling } from './sibling'
28
28
 
@@ -252,7 +252,7 @@ export function renderBlock(
252
252
  .replace(/\n{3,}/g, '\n\n')
253
253
  .trim()
254
254
  // A mixed install places the site skill for its site roots: the app block names it beside the app skills.
255
- if (!site && profiles.includes('site')) block = withSiteSkill(block, pkgRoot)
255
+ if (!site && profiles.includes('site')) block = withSiteSkill(block)
256
256
  return sibling === null ? block : renameRefs(block, sibling.prefix, skillNames(pkgRoot))
257
257
  }
258
258
 
@@ -286,13 +286,13 @@ function layerVars(
286
286
  const harnesses = harnessesOf(manifest)
287
287
  const placement = placementFor(manifest)
288
288
  const site = isSiteManifest(manifest)
289
- const rules = units
290
- .filter((u) => u.source?.startsWith('agent/rules/') === true)
291
- .map((u) => {
292
- const scope = rulePaths(u.content)
293
- const stem = posixRepo(u.path).split('/').at(-1)?.replace(/\.md$/, '') ?? ''
294
- return `- ${code(stem)} (${scope.length === 0 ? 'every file' : scope.map(code).join(', ')}): ${code(posixRepo(u.path))}`
295
- })
289
+ const ruleDirs = [
290
+ ...new Set(
291
+ units
292
+ .filter((u) => u.source?.startsWith('agent/rules/') === true)
293
+ .map((u) => posixRepo(u.path).split('/').slice(0, -1).join('/')),
294
+ ),
295
+ ]
296
296
  const skillDirs = placement.skills.map((dir) => {
297
297
  const readers = (SKILL_READERS[dir] ?? []).filter((h) => harnesses.includes(h))
298
298
  // OpenCode reads both: it is named beside the one placed for it alone.
@@ -302,10 +302,11 @@ function layerVars(
302
302
  : readers
303
303
  return `${code(`${dir}/`)} (${names(shown)})`
304
304
  })
305
- const reviewer = units
306
- .filter((u) => u.source?.startsWith('agent/reviewer/') === true)
307
- .filter((u) => (u.source?.includes('basalt-site-reviewer') === true) === site)
308
- .map((u) => code(posixRepo(u.path)))
305
+ const placedReviewer = units.some(
306
+ (u) =>
307
+ u.source?.startsWith('agent/reviewer/') === true &&
308
+ (u.source.includes('basalt-site-reviewer') === true) === site,
309
+ )
309
310
  const hooked: Harness[] = unhookedInstall
310
311
  ? []
311
312
  : [...placement.hooks, ...placement.adapters]
@@ -321,11 +322,9 @@ function layerVars(
321
322
  ? ''
322
323
  : `\`.basalt/hook.mjs\` lints each edit in ${names(hooked)} as it is written and refuses an edit of a managed file.`,
323
324
  hooked.includes('codex') ? 'Codex runs it once you trust it in `/hooks`.' : '',
324
- hooked.includes('pi')
325
- ? 'Pi runs it when started in this directory, once you trust the project.'
326
- : '',
325
+ hooked.includes('pi') ? 'Pi runs it once you trust the project.' : '',
327
326
  hooked.includes('opencode')
328
- ? `OpenCode 2 has no end-of-turn re-check and OpenCode 1 loads no hook: there, ${lintFirst}.`
327
+ ? `OpenCode 1 loads no hook and OpenCode 2 has no end-of-turn re-check: there, ${lintFirst}.`
329
328
  : '',
330
329
  unhooked.length === 0
331
330
  ? ''
@@ -335,31 +334,24 @@ function layerVars(
335
334
  .filter((s) => s !== '')
336
335
  .join(' ')
337
336
  const load = harnesses.includes('claude-code')
338
- ? 'Claude Code loads each by its paths; any other agent reads the rule whose paths match a file before it edits that file'
339
- : 'read the rule whose paths match a file before you edit that file'
337
+ ? 'Claude Code loads each by its paths; any other agent reads the one whose paths match before it edits'
338
+ : 'each names its paths: read the one that matches before you edit'
340
339
  return {
341
- RULES: rules.length === 0 ? '' : `**Rules** (one file each; ${load}):\n\n${rules.join('\n')}`,
340
+ RULES_AT: ruleDirs.map((dir) => code(`${dir}/`)).join(' and '),
341
+ LOAD: load,
342
+ DESIGN: designPath(manifest),
343
+ REPORT: manifest.report ?? DEFAULT_REPORT,
342
344
  SKILLS_AT: skillDirs.join(' and '),
343
- SKILL_DIR: placement.skills[0] ?? '.agents/skills',
344
- REVIEWER_AT:
345
- reviewer.length === 0
346
- ? `no subagent in Pi: hand \`node_modules/basalt-ui/agent/reviewer/${site ? 'basalt-site-reviewer' : 'basalt-design-reviewer'}.md\` to a fresh session`
347
- : reviewer.join(', '),
345
+ REVIEWER: placedReviewer
346
+ ? `; the \`basalt-${site ? 'site' : 'design'}-reviewer\` subagent`
347
+ : '',
348
348
  HOOK: hook,
349
349
  }
350
350
  }
351
351
 
352
- /** The app block with the site block's skill bullet after the last skill bullet. */
353
- function withSiteSkill(block: string, pkgRoot: string): string {
354
- const siteBlock = resolve(pkgRoot, SITE_BLOCK_TEMPLATE)
355
- const bullet = existsSync(siteBlock)
356
- ? /^- `\/basalt-site`:.*$/m.exec(readFileSync(siteBlock, 'utf8'))?.[0]
357
- : undefined
358
- if (bullet === undefined) return block
359
- const skills = [...block.matchAll(/^- `\/basalt-[a-z-]+`:.*$/gm)].at(-1)
360
- if (skills === undefined) return `${block}\n\n${bullet}`
361
- const at = (skills.index ?? 0) + skills[0].length
362
- return `${block.slice(0, at)}\n${bullet}${block.slice(at)}`
352
+ /** The app block with the site skill named after the app skills. */
353
+ function withSiteSkill(block: string): string {
354
+ return block.replace('`/basalt-app`', (app) => `${app}, \`/basalt-site\``)
363
355
  }
364
356
 
365
357
  export const HOOK_TEMPLATE = 'agent/templates/hook.mjs.tpl'
@@ -32,7 +32,7 @@ function flagValue(flags: string[], name: string): string | undefined {
32
32
  * basalt starts reporting its own output again (116 findings in rollhook's token sheet).
33
33
  */
34
34
  function generatedHeader(version: string, command: string, flags: string[]): string {
35
- const shown = flags.filter((f) => f !== '--check')
35
+ const shown = recordedFlags(flags)
36
36
  const invocation = shown.length === 0 ? command : `${command} ${shown.join(' ')}`
37
37
  return `${GENERATED_HEADER_LINE}\n/* basalt-ui ${version} — \`basalt-ui ${invocation}\` */\n`
38
38
  }
@@ -123,6 +123,7 @@ const VALUE_FLAGS = [
123
123
  '--vibrancy',
124
124
  '--selector',
125
125
  '--accents',
126
+ '--pick',
126
127
  '--extra',
127
128
  '--format',
128
129
  '--out',
@@ -197,10 +198,23 @@ function readAccents(flags: string[]): { names: AccentName[] } | { error: string
197
198
 
198
199
  /** `tokens:css <flags minus --check>`: the invocation line 2 of the header (and `$provenance`) records. */
199
200
  function invocationOf(flags: string[]): string {
200
- const shown = flags.filter((f) => f !== '--check')
201
+ const shown = recordedFlags(flags)
201
202
  return shown.length === 0 ? 'basalt-ui tokens:css' : `basalt-ui tokens:css ${shown.join(' ')}`
202
203
  }
203
204
 
205
+ /**
206
+ * The flags line 2 records. `--out` and `--extra` take paths read from the cwd, so neither is recorded as
207
+ * typed (a check from another directory would drift): `--out` is dropped, `--extra` shows `<file>`.
208
+ */
209
+ function recordedFlags(flags: string[]): string[] {
210
+ return flags.flatMap((f, i) => {
211
+ const prev = flags[i - 1]
212
+ if (f === '--check' || f === '--out' || prev === '--out') return []
213
+ if (prev === '--extra') return []
214
+ return f === '--extra' ? ['--extra', '<file>'] : [f]
215
+ })
216
+ }
217
+
204
218
  /** What one `tokens:css` run emits: files to `--out` (paths as given), or the stylesheet for stdout. */
205
219
  export type TokenEmit = { files: { out: string; content: string }[] } | { stdout: string }
206
220
 
@@ -214,9 +228,15 @@ function extraOutput(flags: string[], cwd: string, version: string): TokenEmit |
214
228
  'tokens:css --extra needs --out <path>: the app sheet is a committed file, so there is no stdout form.',
215
229
  }
216
230
  }
217
- const clash = ['--accent', '--neutral', '--vibrancy', '--selector', '--accents', '--format'].find(
218
- (f) => flags.includes(f),
219
- )
231
+ const clash = [
232
+ '--accent',
233
+ '--neutral',
234
+ '--vibrancy',
235
+ '--selector',
236
+ '--accents',
237
+ '--pick',
238
+ '--format',
239
+ ].find((f) => flags.includes(f))
220
240
  if (clash !== undefined) {
221
241
  return {
222
242
  error: `tokens:css --extra emits the app-owned sheet only; ${clash} belongs to the basalt-ui sheet — run it without --extra.`,
@@ -272,11 +292,26 @@ export function renderTokens(
272
292
  }
273
293
  }
274
294
 
295
+ const pick = flagValue(flags, '--pick')
296
+ ?.split(',')
297
+ .map((n) => n.trim())
298
+ .filter((n) => n !== '')
299
+ if (
300
+ pick !== undefined &&
301
+ (selector !== undefined || accents !== null || format === 'json' || pick.length === 0)
302
+ ) {
303
+ return {
304
+ error:
305
+ 'tokens:css: --pick <name,…> cuts the full stylesheet down; drop --selector, --accents and --format.',
306
+ }
307
+ }
308
+
275
309
  const options = {
276
310
  version,
277
311
  command: invocationOf(flags),
278
312
  ...(Object.keys(read.config).length === 0 ? {} : { config: read.config }),
279
313
  ...(selector === undefined ? {} : { selector }),
314
+ ...(pick === undefined ? {} : { pick }),
280
315
  }
281
316
  let content: string
282
317
  try {
@@ -305,6 +340,8 @@ export function renderTokens(
305
340
  * - `--accent --neutral --vibrancy` retune the identity; a config that fails a gate exits 1 with
306
341
  * the gate, the scheme and the ratio.
307
342
  * - `--selector ":root[<attr>]"` emits a tenant sheet: only the roles that differ from the default.
343
+ * - `--pick canvas,ink` cuts the sheet down to those tokens and what they reference, for a standalone
344
+ * document that loads no basalt sheet.
308
345
  * - `--extra <file>` emits the app-owned tokens instead (see `./tokens-css-extra`).
309
346
  * - `--check` writes nothing and exits 1 on any byte of drift in what `--out` names.
310
347
  */
@@ -94,6 +94,7 @@ export type ControlHome =
94
94
  | 'sheet'
95
95
  | 'side-panel'
96
96
  | 'overlay'
97
+ | 'command'
97
98
 
98
99
  export type ControlPresentation = 'pill' | 'row' | 'inline'
99
100
 
@@ -109,6 +110,7 @@ export type HomePresentation = {
109
110
  sheet: 'row'
110
111
  'side-panel': 'row'
111
112
  overlay: 'row'
113
+ command: 'row'
112
114
  }
113
115
 
114
116
  export type ControlHomeProps = { home: ControlHome; children?: ReactNode }
@@ -6,7 +6,10 @@
6
6
  * |-|-|
7
7
  * | `page-bar`, `section-header`, `view-mode` | `pill` |
8
8
  * | `card-header`, `tool` | `inline` |
9
- * | `form-row`, `aside`, `sheet`, `side-panel`, `overlay` | `row` |
9
+ * | `form-row`, `aside`, `sheet`, `side-panel`, `overlay`, `command` | `row` |
10
+ *
11
+ * `command` is the one home whose controls hold no filter: using one sends a request (a volume
12
+ * released, a lamp switched), so it draws a plain box, not the group named "Filters".
10
13
  *
11
14
  * `view-mode` and `tool` sit in a toolbar row, so they draw a `Toolbar` with one `ToolbarGroup`. A pill that a
12
15
  * fold moves into a popover draws the `row` form (`FoldedControls`): a pill inside a pill would nest
@@ -41,6 +44,7 @@ export const HOME_PRESENTATION = {
41
44
  sheet: 'row',
42
45
  'side-panel': 'row',
43
46
  overlay: 'row',
47
+ command: 'row',
44
48
  } as const satisfies HomePresentation
45
49
 
46
50
  /** Homes whose controls share a toolbar row with buttons, and so draw through `ToolbarGroup`. */
@@ -73,7 +77,9 @@ const SLOT: Record<ControlPresentation, string> = {
73
77
  /**
74
78
  * Hosts controls and gives them the presentation of its `home`. A `FilterSet` or a `filterSlot`
75
79
  * inside reads it; with no home around, a control is a `pill`. A home with nothing to draw renders
76
- * nothing, so an empty slot leaves no gap.
80
+ * nothing, so an empty slot leaves no gap. A control that sends a request and holds no stored value
81
+ * (an absolute volume sent on release) goes in `home="command"`: it is named by its own label, and
82
+ * the app owns the shown value (the reported one, or the pick until the request answers).
77
83
  *
78
84
  * @useWhen you place controls in a surface that is not a slot of a composite (an aside, a sheet, a toolbar)
79
85
  * @neverWhen you want a different look for one control: the home decides the look, never a prop
@@ -89,10 +95,15 @@ export function ControlHome({ home, children }: ControlHomeProps): ReactElement
89
95
  const presentation = folded ? 'row' : presentationOf(home)
90
96
  const toolbar = TOOLBAR_HOMES.has(home) && !folded
91
97
  const slotHome = !folded && FOLDING_HOMES.has(home) ? (home as FoldingHome) : undefined
98
+ const frame = cn('m-0 border-0 p-0 empty:hidden', FRAME[presentation])
92
99
  return (
93
100
  <ControlPresentationContext value={presentation}>
94
101
  <SlotHomeContext value={slotHome}>
95
- {toolbar ? (
102
+ {home === 'command' ? (
103
+ <div data-slot="control-command" data-home={home} className={frame}>
104
+ {children}
105
+ </div>
106
+ ) : toolbar ? (
96
107
  <Toolbar
97
108
  aria-label={t('common.filters')}
98
109
  data-home={home}
@@ -107,7 +118,7 @@ export function ControlHome({ home, children }: ControlHomeProps): ReactElement
107
118
  data-slot={SLOT[presentation]}
108
119
  data-home={home}
109
120
  aria-label={t('common.filters')}
110
- className={cn('m-0 border-0 p-0 empty:hidden', FRAME[presentation])}
121
+ className={frame}
111
122
  >
112
123
  {children}
113
124
  </fieldset>
@@ -1,4 +1,5 @@
1
1
  import { useState } from 'react'
2
+ import type { ControlHandle } from '../core/ports'
2
3
 
3
4
  /**
4
5
  * A value that lives as long as the component that owns it (a dialog's draft, a popover's choice),
@@ -11,24 +12,69 @@ export type LocalControl<T> = {
11
12
  readonly isDefault: boolean
12
13
  }
13
14
 
15
+ /**
16
+ * What a local value needs to stand as a card's control: the identity and the kind a `spec` is drawn
17
+ * from, as `externalField` takes them.
18
+ */
19
+ export type LocalFieldOptions<T> = {
20
+ /** Stable identity of the control within its slot (`ControlHandle.key`). */
21
+ key: string
22
+ kind: ControlHandle<T>['kind']
23
+ options?: ControlHandle<T>['options']
24
+ }
25
+
26
+ /**
27
+ * A local value as a widget-scoped `ControlHandle`: `spec(handle, label)` makes a spec a card's
28
+ * `controls` slot takes (`ChartCard`, `StatCard`, `DataPanel`). It has no lane and `clear()` writes
29
+ * the starting value back.
30
+ */
31
+ export type LocalField<T> = ControlHandle<T> & { readonly scope: 'widget' }
32
+
14
33
  /**
15
34
  * The handle of a value that lives in the calling component: it starts at `initial`, resets when the
16
35
  * component unmounts (a closed dialog) and is shared with nothing. Call it where a hook may be
17
36
  * called and pass the result to `FormField control=`.
18
37
  *
19
- * @useWhen a control's value lives as long as one dialog, sheet or popover and nothing outside it reads it
38
+ * Given `{ key, kind }` it is a card's own control instead: a window or a mode that only that card
39
+ * reads, drawn through `filterSlot([spec(handle, 'Window')])` in the card's `controls`.
40
+ *
41
+ * @useWhen a control's value lives as long as one dialog, sheet, popover or card and nothing outside it reads it
20
42
  * @neverWhen the value should survive a reload (use `persisted`), appear in a shared link (use a router field) or is another store's (use `externalField`)
21
43
  * @instead externalField
22
44
  *
23
45
  * @example
24
46
  * const view = useLocalControl<'list' | 'grid'>('list')
25
47
  * <FormField label="Layout" control={view}>{(bind) => <Segmented {...bind} options={LAYOUTS} />}</FormField>
48
+ *
49
+ * @example
50
+ * const window = useLocalControl('24h', { key: 'window', kind: 'enum', options: WINDOWS })
51
+ * <ChartCard title="Throughput" controls={filterSlot([spec(window, 'Window', { as: 'segmented' })])} chart={…} />
26
52
  */
27
- export function useLocalControl<T>(initial: T | (() => T)): LocalControl<T> {
53
+ export function useLocalControl<T>(initial: T | (() => T)): LocalControl<T>
54
+ export function useLocalControl<T>(
55
+ initial: T | (() => T),
56
+ field: LocalFieldOptions<T>,
57
+ ): LocalField<T>
58
+ export function useLocalControl<T>(
59
+ initial: T | (() => T),
60
+ field?: LocalFieldOptions<T>,
61
+ ): LocalControl<T> | LocalField<T> {
28
62
  const [start] = useState(initial)
29
63
  const [value, set] = useState(start)
64
+ const control = {
65
+ useValue: () => [value, set] as const,
66
+ isDefault: Object.is(value, start),
67
+ }
68
+ if (field === undefined) return control
69
+ const source = { source: 'own', inherited: undefined } as const
30
70
  return {
71
+ key: field.key,
72
+ kind: field.kind,
73
+ ...(field.options === undefined ? {} : { options: field.options }),
74
+ scope: 'widget',
31
75
  useValue: () => [value, set],
32
- isDefault: Object.is(value, start),
76
+ useSource: () => source,
77
+ clear: () => set(start),
78
+ isDefault: control.isDefault,
33
79
  }
34
80
  }
package/src/core/cn.ts CHANGED
@@ -92,7 +92,11 @@ exact('border-collapse', 'border-collapse border-separate')
92
92
  const LENGTH = /^\[(?:[-+]?[\d.]+[a-z%]*|(?:calc|min|max|clamp)\(.*)\]$/
93
93
  const NUMBER = /^(?:\d+(?:\.\d+)?|px|\[.*\])$/
94
94
  const STRICT_NUMBER = /^\d+(?:\.\d+)?$/
95
- const PALETTE = /^(?:[a-z]+-\d{2,3}|black|white|transparent|current|inherit)$/
95
+ // `sidebar*` and `*-foreground` are the shadcn names `bridge.css` adds.
96
+ const PALETTE =
97
+ /^(?:[a-z]+-\d{2,3}|black|white|transparent|current|inherit|sidebar.*|.+-foreground)$/
98
+ // Tailwind's scale steps: `bridge.css` restores the ones the theme clears.
99
+ const STEP = /^(?:2?xs|sm|md|lg|\d?xl)$/
96
100
  const BG_KEYWORD: Record<string, string> = {
97
101
  fixed: 'bg-attachment',
98
102
  local: 'bg-attachment',
@@ -246,7 +250,7 @@ rule('transition', (rest) =>
246
250
  rest === 'discrete' || rest === 'normal' ? 'transition-behavior' : 'transition',
247
251
  )
248
252
  rule('font', (rest) => {
249
- if (THEME.fonts.has(rest)) return 'font-family'
253
+ if (THEME.fonts.has(rest) || rest === 'heading') return 'font-family'
250
254
  return arbitraryKind(rest) === 'family-name' ? 'font-family' : 'font-weight'
251
255
  })
252
256
  rule('flex', (rest) => {
@@ -259,7 +263,7 @@ rule('object', (rest) =>
259
263
  /^(?:contain|cover|fill|none|scale-down)$/.test(rest) ? 'object-fit' : 'object-position',
260
264
  )
261
265
  rule('text', (rest) => {
262
- if (THEME.sizes.has(rest)) return 'font-size'
266
+ if (THEME.sizes.has(rest) || STEP.test(rest)) return 'font-size'
263
267
  if (/^(?:left|center|right|justify|start|end)$/.test(rest)) return 'text-align'
264
268
  if (/^(?:wrap|nowrap|balance|pretty)$/.test(rest)) return 'text-wrap'
265
269
  if (rest === 'ellipsis' || rest === 'clip') return 'text-overflow'
@@ -285,14 +289,14 @@ rule('border', (rest) => {
285
289
  })
286
290
  for (const s of ['x', 'y', ...SIDES, 's', 'e']) rule(`border-${s}`, side('border', s))
287
291
  rule('rounded', (rest) =>
288
- rest === '' || THEME.radii.has(rest) || /^(?:xs|sm|md|lg|\d?xl)$/.test(rest) || rest[0] === '['
292
+ rest === '' || THEME.radii.has(rest) || STEP.test(rest) || rest[0] === '['
289
293
  ? 'rounded'
290
294
  : undefined,
291
295
  )
292
296
  for (const s of ['t', 'r', 'b', 'l', 's', 'e', 'tl', 'tr', 'br', 'bl', 'ss', 'se', 'ee', 'es'])
293
297
  rule(`rounded-${s}`, always(`rounded-${s}`))
294
298
  rule('shadow', (rest) => {
295
- if (rest === '' || THEME.shadows.has(rest)) return 'shadow'
299
+ if (rest === '' || THEME.shadows.has(rest) || STEP.test(rest)) return 'shadow'
296
300
  if (!rest.startsWith('[')) return 'shadow-color'
297
301
  return /^\[(?:color:|#|rgb|hsl|oklch|var\()/.test(rest) ? 'shadow-color' : 'shadow'
298
302
  })
@@ -34,6 +34,12 @@ const DOT: Record<Verdict['tone'], string> = {
34
34
  const MONO = 'font-mono tabular-nums'
35
35
  /** A figure longer than this steps down a size where the card is narrower than `regular`. */
36
36
  const LONG_FIGURE = 10
37
+ /** The unit counts for 0.4 of a character (13 px beside the 30 px figure), so `39.7` + `of 64 GB` keeps the display size. */
38
+ const UNIT_WEIGHT = 0.4
39
+
40
+ /** True when the figure and its unit are long enough to step down a size in a card narrower than `regular`. */
41
+ export const isLongFigure = (text: string | null, unit: string | undefined): boolean =>
42
+ (text?.length ?? 0) + (unit?.length ?? 0) * UNIT_WEIGHT > LONG_FIGURE
37
43
  /**
38
44
  * The readout line: the status and the period, the one place in the figure row a hover may change.
39
45
  * Its box takes the rest of the row from `regular` up and a line of its own, one line tall even while
@@ -121,7 +127,7 @@ export function FigureRow({
121
127
  className={cn(
122
128
  // The answer is never cut: the figure keeps its width and the delta beside it gives way.
123
129
  'shrink-0 text-display font-semibold whitespace-nowrap tabular-nums',
124
- (text?.length ?? 0) + (unit?.length ?? 0) > LONG_FIGURE && '@max-regular:text-lg',
130
+ isLongFigure(text, unit) && '@max-regular:text-lg',
125
131
  text === null && 'text-muted-foreground',
126
132
  )}
127
133
  >