@rien7/seji 0.0.0-stage → 0.6.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 (413) hide show
  1. package/bin/design-surface.mjs +6 -0
  2. package/bin/postinstall.mjs +19 -0
  3. package/bin/seji.mjs +573 -0
  4. package/dist/agent/host.d.mts +34 -0
  5. package/dist/agent/host.mjs +387 -0
  6. package/dist/agent/messages.d.mts +9 -0
  7. package/dist/agent/messages.mjs +70 -0
  8. package/dist/agent/runtimes.mjs +157 -0
  9. package/dist/cli/app.mjs +321 -0
  10. package/dist/cli/appScan.mjs +284 -0
  11. package/dist/cli/catalog.mjs +78 -0
  12. package/dist/cli/component.mjs +165 -0
  13. package/dist/cli/consolidate.mjs +159 -0
  14. package/dist/cli/cssImport.mjs +68 -0
  15. package/dist/cli/dev.mjs +335 -0
  16. package/dist/cli/doctor.mjs +306 -0
  17. package/dist/cli/init.mjs +338 -0
  18. package/dist/cli/legacyNames.mjs +266 -0
  19. package/dist/cli/migrate.mjs +163 -0
  20. package/dist/cli/prompt.mjs +34 -0
  21. package/dist/cli/propose.mjs +208 -0
  22. package/dist/cli/providers.mjs +344 -0
  23. package/dist/cli/reviewOps.mjs +110 -0
  24. package/dist/cli/semver.mjs +45 -0
  25. package/dist/cli/setup.mjs +357 -0
  26. package/dist/cli/sketches.mjs +47 -0
  27. package/dist/cli/skills.mjs +150 -0
  28. package/dist/cli/snapshot.mjs +107 -0
  29. package/dist/cli/tokenOps.mjs +120 -0
  30. package/dist/cli/types.mjs +191 -0
  31. package/dist/cli/updater.mjs +274 -0
  32. package/dist/components/astIndex.mjs +992 -0
  33. package/dist/components/ops.mjs +1069 -0
  34. package/dist/editor/AgentProposalCard.d.ts +10 -0
  35. package/dist/editor/AgentProposalCard.d.ts.map +1 -0
  36. package/dist/editor/AgentProposalCard.js +31 -0
  37. package/dist/editor/AgentProposalCard.js.map +1 -0
  38. package/dist/editor/App.d.ts +2 -0
  39. package/dist/editor/App.d.ts.map +1 -0
  40. package/dist/editor/App.js +2832 -0
  41. package/dist/editor/App.js.map +1 -0
  42. package/dist/editor/CanvasHud.d.ts +12 -0
  43. package/dist/editor/CanvasHud.d.ts.map +1 -0
  44. package/dist/editor/CanvasHud.js +13 -0
  45. package/dist/editor/CanvasHud.js.map +1 -0
  46. package/dist/editor/CanvasSurface.d.ts +31 -0
  47. package/dist/editor/CanvasSurface.d.ts.map +1 -0
  48. package/dist/editor/CanvasSurface.js +270 -0
  49. package/dist/editor/CanvasSurface.js.map +1 -0
  50. package/dist/editor/CommentPopover.d.ts +17 -0
  51. package/dist/editor/CommentPopover.d.ts.map +1 -0
  52. package/dist/editor/CommentPopover.js +62 -0
  53. package/dist/editor/CommentPopover.js.map +1 -0
  54. package/dist/editor/Comments.d.ts +13 -0
  55. package/dist/editor/Comments.d.ts.map +1 -0
  56. package/dist/editor/Comments.js +41 -0
  57. package/dist/editor/Comments.js.map +1 -0
  58. package/dist/editor/ComponentPage.d.ts +28 -0
  59. package/dist/editor/ComponentPage.d.ts.map +1 -0
  60. package/dist/editor/ComponentPage.js +55 -0
  61. package/dist/editor/ComponentPage.js.map +1 -0
  62. package/dist/editor/ComponentPanel.d.ts +38 -0
  63. package/dist/editor/ComponentPanel.d.ts.map +1 -0
  64. package/dist/editor/ComponentPanel.js +275 -0
  65. package/dist/editor/ComponentPanel.js.map +1 -0
  66. package/dist/editor/Glyph.d.ts +51 -0
  67. package/dist/editor/Glyph.d.ts.map +1 -0
  68. package/dist/editor/Glyph.js +50 -0
  69. package/dist/editor/Glyph.js.map +1 -0
  70. package/dist/editor/History.d.ts +7 -0
  71. package/dist/editor/History.d.ts.map +1 -0
  72. package/dist/editor/History.js +51 -0
  73. package/dist/editor/History.js.map +1 -0
  74. package/dist/editor/Inspector.d.ts +56 -0
  75. package/dist/editor/Inspector.d.ts.map +1 -0
  76. package/dist/editor/Inspector.js +510 -0
  77. package/dist/editor/Inspector.js.map +1 -0
  78. package/dist/editor/LazyMount.d.ts +10 -0
  79. package/dist/editor/LazyMount.d.ts.map +1 -0
  80. package/dist/editor/LazyMount.js +29 -0
  81. package/dist/editor/LazyMount.js.map +1 -0
  82. package/dist/editor/LocaleSwitch.d.ts +3 -0
  83. package/dist/editor/LocaleSwitch.d.ts.map +1 -0
  84. package/dist/editor/LocaleSwitch.js +9 -0
  85. package/dist/editor/LocaleSwitch.js.map +1 -0
  86. package/dist/editor/PreviewFrame.d.ts +10 -0
  87. package/dist/editor/PreviewFrame.d.ts.map +1 -0
  88. package/dist/editor/PreviewFrame.js +22 -0
  89. package/dist/editor/PreviewFrame.js.map +1 -0
  90. package/dist/editor/ProjectIndex.d.ts +12 -0
  91. package/dist/editor/ProjectIndex.d.ts.map +1 -0
  92. package/dist/editor/ProjectIndex.js +43 -0
  93. package/dist/editor/ProjectIndex.js.map +1 -0
  94. package/dist/editor/PromoteComponent.d.ts +28 -0
  95. package/dist/editor/PromoteComponent.d.ts.map +1 -0
  96. package/dist/editor/PromoteComponent.js +33 -0
  97. package/dist/editor/PromoteComponent.js.map +1 -0
  98. package/dist/editor/PromoteForm.d.ts +18 -0
  99. package/dist/editor/PromoteForm.d.ts.map +1 -0
  100. package/dist/editor/PromoteForm.js +35 -0
  101. package/dist/editor/PromoteForm.js.map +1 -0
  102. package/dist/editor/PromoteToken.d.ts +31 -0
  103. package/dist/editor/PromoteToken.d.ts.map +1 -0
  104. package/dist/editor/PromoteToken.js +94 -0
  105. package/dist/editor/PromoteToken.js.map +1 -0
  106. package/dist/editor/StatePreviews.d.ts +28 -0
  107. package/dist/editor/StatePreviews.d.ts.map +1 -0
  108. package/dist/editor/StatePreviews.js +113 -0
  109. package/dist/editor/StatePreviews.js.map +1 -0
  110. package/dist/editor/ValueCombo.d.ts +51 -0
  111. package/dist/editor/ValueCombo.d.ts.map +1 -0
  112. package/dist/editor/ValueCombo.js +260 -0
  113. package/dist/editor/ValueCombo.js.map +1 -0
  114. package/dist/editor/agent/AgentPanel.d.ts +19 -0
  115. package/dist/editor/agent/AgentPanel.d.ts.map +1 -0
  116. package/dist/editor/agent/AgentPanel.js +271 -0
  117. package/dist/editor/agent/AgentPanel.js.map +1 -0
  118. package/dist/editor/agent/Markdown.d.ts +5 -0
  119. package/dist/editor/agent/Markdown.d.ts.map +1 -0
  120. package/dist/editor/agent/Markdown.js +28 -0
  121. package/dist/editor/agent/Markdown.js.map +1 -0
  122. package/dist/editor/agent/agentApi.d.ts +106 -0
  123. package/dist/editor/agent/agentApi.d.ts.map +1 -0
  124. package/dist/editor/agent/agentApi.js +66 -0
  125. package/dist/editor/agent/agentApi.js.map +1 -0
  126. package/dist/editor/agent/toolLines.d.ts +38 -0
  127. package/dist/editor/agent/toolLines.d.ts.map +1 -0
  128. package/dist/editor/agent/toolLines.js +159 -0
  129. package/dist/editor/agent/toolLines.js.map +1 -0
  130. package/dist/editor/agent/useAgent.d.ts +15 -0
  131. package/dist/editor/agent/useAgent.d.ts.map +1 -0
  132. package/dist/editor/agent/useAgent.js +65 -0
  133. package/dist/editor/agent/useAgent.js.map +1 -0
  134. package/dist/editor/api.d.ts +378 -0
  135. package/dist/editor/api.d.ts.map +1 -0
  136. package/dist/editor/api.js +247 -0
  137. package/dist/editor/api.js.map +1 -0
  138. package/dist/editor/camera.d.ts +18 -0
  139. package/dist/editor/camera.d.ts.map +1 -0
  140. package/dist/editor/camera.js +40 -0
  141. package/dist/editor/camera.js.map +1 -0
  142. package/dist/editor/canvas.d.ts +25 -0
  143. package/dist/editor/canvas.d.ts.map +1 -0
  144. package/dist/editor/canvas.js +35 -0
  145. package/dist/editor/canvas.js.map +1 -0
  146. package/dist/editor/changes/ChangesPage.d.ts +25 -0
  147. package/dist/editor/changes/ChangesPage.d.ts.map +1 -0
  148. package/dist/editor/changes/ChangesPage.js +132 -0
  149. package/dist/editor/changes/ChangesPage.js.map +1 -0
  150. package/dist/editor/changes/changeModel.d.ts +25 -0
  151. package/dist/editor/changes/changeModel.d.ts.map +1 -0
  152. package/dist/editor/changes/changeModel.js +81 -0
  153. package/dist/editor/changes/changeModel.js.map +1 -0
  154. package/dist/editor/changes/changeState.d.mts +29 -0
  155. package/dist/editor/changes/changeState.mjs +187 -0
  156. package/dist/editor/chrome/EditorChrome.d.ts +49 -0
  157. package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
  158. package/dist/editor/chrome/EditorChrome.js +21 -0
  159. package/dist/editor/chrome/EditorChrome.js.map +1 -0
  160. package/dist/editor/drafts.d.ts +46 -0
  161. package/dist/editor/drafts.d.ts.map +1 -0
  162. package/dist/editor/drafts.js +38 -0
  163. package/dist/editor/drafts.js.map +1 -0
  164. package/dist/editor/i18n.d.ts +29 -0
  165. package/dist/editor/i18n.d.ts.map +1 -0
  166. package/dist/editor/i18n.js +2320 -0
  167. package/dist/editor/i18n.js.map +1 -0
  168. package/dist/editor/iconStroke.d.ts +6 -0
  169. package/dist/editor/iconStroke.d.ts.map +1 -0
  170. package/dist/editor/iconStroke.js +6 -0
  171. package/dist/editor/iconStroke.js.map +1 -0
  172. package/dist/editor/main.d.ts +2 -0
  173. package/dist/editor/main.d.ts.map +1 -0
  174. package/dist/editor/main.js +14 -0
  175. package/dist/editor/main.js.map +1 -0
  176. package/dist/editor/model.d.ts +16 -0
  177. package/dist/editor/model.d.ts.map +1 -0
  178. package/dist/editor/model.js +11 -0
  179. package/dist/editor/model.js.map +1 -0
  180. package/dist/editor/reasons.d.ts +44 -0
  181. package/dist/editor/reasons.d.ts.map +1 -0
  182. package/dist/editor/reasons.js +131 -0
  183. package/dist/editor/reasons.js.map +1 -0
  184. package/dist/editor/reviewLifecycle.d.ts +8 -0
  185. package/dist/editor/reviewLifecycle.d.ts.map +1 -0
  186. package/dist/editor/reviewLifecycle.js +21 -0
  187. package/dist/editor/reviewLifecycle.js.map +1 -0
  188. package/dist/editor/styles.css +8737 -0
  189. package/dist/editor/tokenMatch.d.ts +59 -0
  190. package/dist/editor/tokenMatch.d.ts.map +1 -0
  191. package/dist/editor/tokenMatch.js +198 -0
  192. package/dist/editor/tokenMatch.js.map +1 -0
  193. package/dist/editor/tokens/ConsolidatePage.d.ts +16 -0
  194. package/dist/editor/tokens/ConsolidatePage.d.ts.map +1 -0
  195. package/dist/editor/tokens/ConsolidatePage.js +244 -0
  196. package/dist/editor/tokens/ConsolidatePage.js.map +1 -0
  197. package/dist/editor/tokens/TokenActivity.d.ts +18 -0
  198. package/dist/editor/tokens/TokenActivity.d.ts.map +1 -0
  199. package/dist/editor/tokens/TokenActivity.js +18 -0
  200. package/dist/editor/tokens/TokenActivity.js.map +1 -0
  201. package/dist/editor/tokens/TokenDialogs.d.ts +26 -0
  202. package/dist/editor/tokens/TokenDialogs.d.ts.map +1 -0
  203. package/dist/editor/tokens/TokenDialogs.js +119 -0
  204. package/dist/editor/tokens/TokenDialogs.js.map +1 -0
  205. package/dist/editor/tokens/TokenList.d.ts +21 -0
  206. package/dist/editor/tokens/TokenList.d.ts.map +1 -0
  207. package/dist/editor/tokens/TokenList.js +98 -0
  208. package/dist/editor/tokens/TokenList.js.map +1 -0
  209. package/dist/editor/tokens/TokenPage.d.ts +25 -0
  210. package/dist/editor/tokens/TokenPage.d.ts.map +1 -0
  211. package/dist/editor/tokens/TokenPage.js +108 -0
  212. package/dist/editor/tokens/TokenPage.js.map +1 -0
  213. package/dist/editor/tokens/tokenModel.d.ts +35 -0
  214. package/dist/editor/tokens/tokenModel.d.ts.map +1 -0
  215. package/dist/editor/tokens/tokenModel.js +72 -0
  216. package/dist/editor/tokens/tokenModel.js.map +1 -0
  217. package/dist/editor/ui/Button.d.ts +3 -0
  218. package/dist/editor/ui/Button.d.ts.map +1 -0
  219. package/dist/editor/ui/Button.js +6 -0
  220. package/dist/editor/ui/Button.js.map +1 -0
  221. package/dist/editor/ui/CommentBox.d.ts +23 -0
  222. package/dist/editor/ui/CommentBox.d.ts.map +1 -0
  223. package/dist/editor/ui/CommentBox.js +41 -0
  224. package/dist/editor/ui/CommentBox.js.map +1 -0
  225. package/dist/editor/ui/Icon.d.ts +8 -0
  226. package/dist/editor/ui/Icon.d.ts.map +1 -0
  227. package/dist/editor/ui/Icon.js +6 -0
  228. package/dist/editor/ui/Icon.js.map +1 -0
  229. package/dist/editor/ui/IconButton.d.ts +11 -0
  230. package/dist/editor/ui/IconButton.d.ts.map +1 -0
  231. package/dist/editor/ui/IconButton.js +6 -0
  232. package/dist/editor/ui/IconButton.js.map +1 -0
  233. package/dist/editor/ui/NumberInput.d.ts +14 -0
  234. package/dist/editor/ui/NumberInput.d.ts.map +1 -0
  235. package/dist/editor/ui/NumberInput.js +6 -0
  236. package/dist/editor/ui/NumberInput.js.map +1 -0
  237. package/dist/editor/ui/PageLine.d.ts +14 -0
  238. package/dist/editor/ui/PageLine.d.ts.map +1 -0
  239. package/dist/editor/ui/PageLine.js +7 -0
  240. package/dist/editor/ui/PageLine.js.map +1 -0
  241. package/dist/editor/ui/SearchPicker.d.ts +41 -0
  242. package/dist/editor/ui/SearchPicker.d.ts.map +1 -0
  243. package/dist/editor/ui/SearchPicker.js +82 -0
  244. package/dist/editor/ui/SearchPicker.js.map +1 -0
  245. package/dist/editor/ui/Select.d.ts +19 -0
  246. package/dist/editor/ui/Select.d.ts.map +1 -0
  247. package/dist/editor/ui/Select.js +12 -0
  248. package/dist/editor/ui/Select.js.map +1 -0
  249. package/dist/editor/ui/TokenField.d.ts +14 -0
  250. package/dist/editor/ui/TokenField.d.ts.map +1 -0
  251. package/dist/editor/ui/TokenField.js +41 -0
  252. package/dist/editor/ui/TokenField.js.map +1 -0
  253. package/dist/editor/ui/TokenPicker.d.ts +31 -0
  254. package/dist/editor/ui/TokenPicker.d.ts.map +1 -0
  255. package/dist/editor/ui/TokenPicker.js +26 -0
  256. package/dist/editor/ui/TokenPicker.js.map +1 -0
  257. package/dist/editor/useBuildError.d.ts +7 -0
  258. package/dist/editor/useBuildError.d.ts.map +1 -0
  259. package/dist/editor/useBuildError.js +30 -0
  260. package/dist/editor/useBuildError.js.map +1 -0
  261. package/dist/editor/useLatestRequest.d.ts +22 -0
  262. package/dist/editor/useLatestRequest.d.ts.map +1 -0
  263. package/dist/editor/useLatestRequest.js +49 -0
  264. package/dist/editor/useLatestRequest.js.map +1 -0
  265. package/dist/editor-bundle/editor.css +2 -0
  266. package/dist/editor-bundle/editor.js +83 -0
  267. package/dist/editor-ui.d.ts +15 -0
  268. package/dist/editor-ui.d.ts.map +1 -0
  269. package/dist/editor-ui.js +14 -0
  270. package/dist/editor-ui.js.map +1 -0
  271. package/dist/inspector/runtime.d.ts +18 -0
  272. package/dist/inspector/runtime.d.ts.map +1 -0
  273. package/dist/inspector/runtime.js +1280 -0
  274. package/dist/inspector/runtime.js.map +1 -0
  275. package/dist/preview/main.d.ts +3 -0
  276. package/dist/preview/main.d.ts.map +1 -0
  277. package/dist/preview/main.js +320 -0
  278. package/dist/preview/main.js.map +1 -0
  279. package/dist/preview/preview.css +40 -0
  280. package/dist/runtime/index.d.ts +3 -0
  281. package/dist/runtime/index.d.ts.map +1 -0
  282. package/dist/runtime/index.js +2 -0
  283. package/dist/runtime/index.js.map +1 -0
  284. package/dist/shared/buildError.d.mts +27 -0
  285. package/dist/shared/buildError.mjs +141 -0
  286. package/dist/shared/cameraFit.d.mts +16 -0
  287. package/dist/shared/cameraFit.mjs +47 -0
  288. package/dist/shared/canvasLayout.d.mts +13 -0
  289. package/dist/shared/canvasLayout.mjs +171 -0
  290. package/dist/shared/commentShots.d.mts +12 -0
  291. package/dist/shared/commentShots.mjs +53 -0
  292. package/dist/shared/componentExtract.d.mts +43 -0
  293. package/dist/shared/componentExtract.mjs +136 -0
  294. package/dist/shared/componentMeta.d.mts +26 -0
  295. package/dist/shared/componentMeta.mjs +87 -0
  296. package/dist/shared/componentOps.d.mts +70 -0
  297. package/dist/shared/componentOps.mjs +407 -0
  298. package/dist/shared/componentTarget.d.mts +15 -0
  299. package/dist/shared/componentTarget.mjs +58 -0
  300. package/dist/shared/components.d.mts +30 -0
  301. package/dist/shared/components.mjs +106 -0
  302. package/dist/shared/consolidateCategories.d.mts +2 -0
  303. package/dist/shared/consolidateCategories.mjs +6 -0
  304. package/dist/shared/env.d.mts +4 -0
  305. package/dist/shared/env.mjs +18 -0
  306. package/dist/shared/gitChanges.d.mts +2 -0
  307. package/dist/shared/gitChanges.mjs +30 -0
  308. package/dist/shared/oklab.d.mts +6 -0
  309. package/dist/shared/oklab.mjs +56 -0
  310. package/dist/shared/optimizeEntries.d.mts +5 -0
  311. package/dist/shared/optimizeEntries.mjs +24 -0
  312. package/dist/shared/packages.d.mts +11 -0
  313. package/dist/shared/packages.mjs +96 -0
  314. package/dist/shared/projectFiles.d.mts +23 -0
  315. package/dist/shared/projectFiles.mjs +72 -0
  316. package/dist/shared/prompt.d.mts +20 -0
  317. package/dist/shared/prompt.mjs +201 -0
  318. package/dist/shared/proposals.d.mts +11 -0
  319. package/dist/shared/proposals.mjs +42 -0
  320. package/dist/shared/protocol.d.ts +122 -0
  321. package/dist/shared/protocol.d.ts.map +1 -0
  322. package/dist/shared/protocol.js +7 -0
  323. package/dist/shared/protocol.js.map +1 -0
  324. package/dist/shared/reviewArchive.d.mts +4 -0
  325. package/dist/shared/reviewArchive.mjs +19 -0
  326. package/dist/shared/reviewStore.d.mts +30 -0
  327. package/dist/shared/reviewStore.mjs +218 -0
  328. package/dist/shared/reviewVerify.d.mts +21 -0
  329. package/dist/shared/reviewVerify.mjs +158 -0
  330. package/dist/shared/sizeModes.d.mts +15 -0
  331. package/dist/shared/sizeModes.mjs +53 -0
  332. package/dist/shared/sketches.d.mts +10 -0
  333. package/dist/shared/sketches.mjs +64 -0
  334. package/dist/shared/snapshotCheck.d.mts +13 -0
  335. package/dist/shared/snapshotCheck.mjs +81 -0
  336. package/dist/shared/timeout.d.mts +1 -0
  337. package/dist/shared/timeout.mjs +15 -0
  338. package/dist/shared/tokens.d.ts +2 -0
  339. package/dist/shared/tokens.d.ts.map +1 -0
  340. package/dist/shared/tokens.js +2 -0
  341. package/dist/shared/tokens.js.map +1 -0
  342. package/dist/shared/types.d.ts +689 -0
  343. package/dist/shared/types.d.ts.map +1 -0
  344. package/dist/shared/types.js +13 -0
  345. package/dist/shared/types.js.map +1 -0
  346. package/dist/shared/wheelRouting.d.mts +9 -0
  347. package/dist/shared/wheelRouting.mjs +31 -0
  348. package/dist/shared/writeScope.mjs +96 -0
  349. package/dist/snapshots/diff.d.mts +28 -0
  350. package/dist/snapshots/diff.mjs +263 -0
  351. package/dist/snapshots/index.d.mts +110 -0
  352. package/dist/snapshots/index.mjs +638 -0
  353. package/dist/snapshots/render.d.mts +24 -0
  354. package/dist/snapshots/render.mjs +250 -0
  355. package/dist/snapshots/toolOps.d.mts +25 -0
  356. package/dist/snapshots/toolOps.mjs +69 -0
  357. package/dist/tokens/adapters/css.mjs +51 -0
  358. package/dist/tokens/adapters/cssInCode.mjs +314 -0
  359. package/dist/tokens/adapters/oxcShared.mjs +80 -0
  360. package/dist/tokens/adapters/preprocessor.mjs +63 -0
  361. package/dist/tokens/adapters/registry.mjs +53 -0
  362. package/dist/tokens/adapters/tailwindcss.mjs +424 -0
  363. package/dist/tokens/adapters/types.mjs +117 -0
  364. package/dist/tokens/consolidate/index.d.mts +42 -0
  365. package/dist/tokens/consolidate/index.mjs +111 -0
  366. package/dist/tokens/consolidate/normalize.mjs +479 -0
  367. package/dist/tokens/consolidate/plan.mjs +726 -0
  368. package/dist/tokens/consolidate/scan.mjs +928 -0
  369. package/dist/tokens/extract.mjs +441 -0
  370. package/dist/tokens/moduleData.d.mts +14 -0
  371. package/dist/tokens/moduleData.mjs +32 -0
  372. package/dist/tokens/opLock.d.mts +4 -0
  373. package/dist/tokens/opLock.mjs +108 -0
  374. package/dist/tokens/ops.d.mts +71 -0
  375. package/dist/tokens/ops.mjs +1511 -0
  376. package/dist/tokens/pipeline.mjs +813 -0
  377. package/dist/tokens/report.d.mts +47 -0
  378. package/dist/tokens/report.mjs +257 -0
  379. package/dist/tokens/rewrite/code.mjs +172 -0
  380. package/dist/tokens/rewrite/css.mjs +154 -0
  381. package/dist/tokens/rewrite/index.mjs +244 -0
  382. package/dist/tokens/rewrite/tailwind.mjs +288 -0
  383. package/dist/tokens/rewrite/text.mjs +116 -0
  384. package/dist/tokens/rewrite/value.mjs +115 -0
  385. package/dist/tokens/usage.d.mts +97 -0
  386. package/dist/tokens/usage.mjs +680 -0
  387. package/dist/vite/agent.d.ts +21 -0
  388. package/dist/vite/agent.d.ts.map +1 -0
  389. package/dist/vite/agent.js +165 -0
  390. package/dist/vite/agent.js.map +1 -0
  391. package/dist/vite/events.d.ts +27 -0
  392. package/dist/vite/events.d.ts.map +1 -0
  393. package/dist/vite/events.js +156 -0
  394. package/dist/vite/events.js.map +1 -0
  395. package/dist/vite/layout.d.ts +2 -0
  396. package/dist/vite/layout.d.ts.map +1 -0
  397. package/dist/vite/layout.js +4 -0
  398. package/dist/vite/layout.js.map +1 -0
  399. package/dist/vite/plugin.d.ts +40 -0
  400. package/dist/vite/plugin.d.ts.map +1 -0
  401. package/dist/vite/plugin.js +1255 -0
  402. package/dist/vite/plugin.js.map +1 -0
  403. package/dist/vite/requestGuard.d.mts +3 -0
  404. package/dist/vite/requestGuard.mjs +43 -0
  405. package/dist/vite/review.d.ts +11 -0
  406. package/dist/vite/review.d.ts.map +1 -0
  407. package/dist/vite/review.js +283 -0
  408. package/dist/vite/review.js.map +1 -0
  409. package/package.json +104 -4
  410. package/skills/seji/SKILL.md +395 -0
  411. package/skills/seji-authoring/SKILL.md +397 -0
  412. package/skills/seji-tokens/SKILL.md +432 -0
  413. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentPage.d.ts","sourceRoot":"","sources":["../../src/editor/ComponentPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAKvF,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAA2C,CAAA;AAGvF,KAAK,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEtD,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;;;IASnD;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,UAAU,EACV,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAA;IACvC,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,+BA4BA;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAA;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,MAAM,CAAA;IACvC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,uEAAuE;IACvE,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5F,sCAgBA"}
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { componentErrorText } from './ComponentPanel';
4
+ import { useI18n } from './i18n';
5
+ import { Button } from './ui/Button';
6
+ export const FRAME_CATEGORIES = ['style', 'state', 'content', 'usage'];
7
+ /** Frames per category, in display order; uncategorized frames count as `none`. */
8
+ export function categoryCounts(frames) {
9
+ const counts = new Map();
10
+ for (const frame of frames) {
11
+ const key = frame.category && FRAME_CATEGORIES.includes(frame.category) ? frame.category : 'none';
12
+ counts.set(key, (counts.get(key) ?? 0) + 1);
13
+ }
14
+ return [...FRAME_CATEGORIES, 'none']
15
+ .filter((key) => counts.has(key))
16
+ .map((key) => ({ category: key, count: counts.get(key) ?? 0 }));
17
+ }
18
+ /** Header above a component page's board: name, layer, status, frame count, categories. */
19
+ export function ComponentPageHead({ name, layer, deprecated, frames, }) {
20
+ const { t } = useI18n();
21
+ return (_jsxs("header", { className: "component-page-chrome component-page-head", "data-canvas-drag": true, children: [_jsx("strong", { children: name }), layer ? _jsx("span", { className: `component-pill is-${layer}`, children: t(`components.layer.${layer}`) }) : null, deprecated ? (_jsxs("span", { className: "component-pill is-deprecated", children: [t('components.status.deprecated'), deprecated.replacement ? ` ${t('components.replacedBy', { name: deprecated.replacement })}` : ''] })) : (_jsx("span", { className: "component-pill is-ok", children: t('components.status.ok') })), _jsx("span", { className: "component-page-meta", children: t('components.frames', { count: frames.length }) }), _jsx("span", { className: "component-page-categories", children: categoryCounts(frames).map(({ category, count }) => (_jsxs("span", { className: `frame-category is-${category}`, "data-category-count": category, children: [t(`components.category.${category}`), " ", count] }, category))) })] }));
22
+ }
23
+ /** Below the board: the agent's tidy proposal, if any. */
24
+ export function ComponentPageAfter({ frames, proposal, open, titleOf, onOpenChange, onDecide, }) {
25
+ if (!proposal)
26
+ return null;
27
+ return (_jsx("div", { className: "component-page-chrome component-page-after", "data-canvas-drag": true, children: _jsx(TidyProposal, { frames: frames, open: open, proposal: proposal, titleOf: titleOf, onDecide: onDecide, onOpenChange: onOpenChange }, proposal.id) }));
28
+ }
29
+ /** The agent's tidy proposal: listed frames move to the page they belong to. */
30
+ function TidyProposal({ proposal, frames, open, titleOf, onOpenChange, onDecide, }) {
31
+ const { t } = useI18n();
32
+ const [note, setNote] = useState('');
33
+ const [busy, setBusy] = useState(false);
34
+ const [failure, setFailure] = useState(null);
35
+ const decide = (decision, text = '') => {
36
+ setBusy(true);
37
+ setFailure(null);
38
+ onDecide(proposal, decision, text)
39
+ .catch((error) => setFailure(componentErrorText(error, t)))
40
+ .finally(() => setBusy(false));
41
+ };
42
+ const counts = categoryCounts(frames).filter((entry) => entry.category !== 'none');
43
+ const separator = t('components.listSeparator');
44
+ const listed = (proposal.frames ?? []).map((id) => ({ id, frame: frames.find((item) => item.id === id) ?? null }));
45
+ const label = (entry) => (entry.frame ? titleOf(entry.frame) || entry.id : entry.id);
46
+ const moves = listed.map(label).join(separator);
47
+ const decided = proposal.author !== 'agent' || Boolean(proposal.proposalDecision);
48
+ const approvedText = t('components.tidy.approved', { frames: moves });
49
+ return (_jsxs("div", { className: "component-tidy", "data-tidy-proposal": proposal.id, children: [_jsxs("p", { children: [_jsx("strong", { children: t('components.tidy.summary', { count: frames.length, kinds: counts.length }) }), t('components.tidy.breakdown', {
50
+ list: counts
51
+ .map(({ category, count }) => t('components.categoryCount', { label: t(`components.category.${category}`), count }))
52
+ .join(separator),
53
+ }), ' ', proposal.rationale ? _jsx("span", { className: "component-tidy-rationale", children: proposal.rationale }) : null] }), decided ? (_jsxs("p", { className: "component-tidy-status", children: [_jsx("span", { className: `proposal-decision is-${proposal.proposalDecision ?? 'approved'}`, children: proposal.proposalDecision === 'rejected' ? t('components.tidy.rejected') : approvedText }), proposal.author === 'agent' ? (_jsx("button", { className: "component-link", type: "button", disabled: busy, onClick: () => decide('reset'), children: t('components.tidy.undo') })) : null] })) : open ? (_jsxs("div", { className: "component-tidy-detail", children: [moves ? _jsx("p", { children: t('components.tidy.moves', { frames: moves }) }) : null, _jsx("input", { "aria-label": t('proposal.noteLabel'), className: "input", placeholder: t('components.tidy.notePlaceholder'), value: note, onChange: (event) => setNote(event.target.value) }), _jsxs("div", { className: "component-row-actions", children: [_jsx(Button, { className: "primary-button", disabled: busy, type: "button", onClick: () => decide('approve', note), children: t('components.tidy.approve') }), _jsx(Button, { className: "button", disabled: busy, type: "button", onClick: () => decide('reject', note), children: t('components.tidy.dismiss') }), _jsx("button", { className: "component-link", type: "button", onClick: () => onOpenChange(false), children: t('components.tidy.hide') })] })] })) : (_jsxs("div", { className: "component-row-actions", children: [_jsx(Button, { className: "primary-button", type: "button", onClick: () => onOpenChange(true), children: t('components.tidy.view') }), _jsx(Button, { className: "button", disabled: busy, type: "button", onClick: () => decide('reject'), children: t('components.tidy.dismiss') })] })), failure ? _jsx("p", { className: "component-note is-error", children: failure }) : null] }));
54
+ }
55
+ //# sourceMappingURL=ComponentPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentPage.js","sourceRoot":"","sources":["../../src/editor/ComponentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,CAAC,MAAM,gBAAgB,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAKvF,mFAAmF;AACnF,MAAM,UAAU,cAAc,CAAC,MAAqB;IAClD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAA;IAC7C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,IAAI,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAA;QACjG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAC7C,CAAC;IACD,OAAO,CAAC,GAAG,gBAAgB,EAAE,MAAe,CAAC;SAC1C,M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AAE,IAAI,EAAE,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,YACrF,CAAC,CAAC,yBAAyB,CAAC,GACtB,IACL,CACP,EACA,OAAO,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,yBAAyB,YAAE,OAAO,GAAK,CAAC,CAAC,CAAC,IAAI,IAClE,CACP,CAAA;AACH,CAAC","sourcesContent":["import { useState } from 'react'\n\nimport type { FrameCategory, FrameConfig } from '@rien7/design-surface-runtime'\nimport type { ComponentDeprecation, ComponentLayer, ReviewItem } from '../shared/types'\nimport { componentErrorText } from './ComponentPanel'\nimport { useI18n } from './i18n'\nimport { Button } from './ui/Button'\n\nexport const FRAME_CATEGORIES: FrameCategory[] = ['style', 'state', 'content', 'usage']\n\ntype CategoryKey = FrameCategory | 'none'\ntype ProposalDecision = 'approve' | 'reject' | 'reset'\n\n/** Frames per category, in display order; uncategorized frames count as `none`. */\nexport function categoryCounts(frames: FrameConfig[]) {\n const counts = new Map<CategoryKey, number>()\n for (const frame of frames) {\n const key = frame.category && FRAME_CATEGORIES.includes(frame.category) ? frame.category : 'none'\n counts.set(key, (counts.get(key) ?? 0) + 1)\n }\n return [...FRAME_CATEGORIES, 'none' as const]\n .filter((key) => counts.has(key))\n .map((key) => ({ category: key, count: counts.get(key) ?? 0 }))\n}\n\n/** Header above a component page's board: name, layer, status, frame count, categories. */\nexport function ComponentPageHead({\n name,\n layer,\n deprecated,\n frames,\n}: {\n name: string\n layer: ComponentLayer | null\n deprecated: ComponentDeprecation | null\n frames: FrameConfig[]\n}) {\n const { t } = useI18n()\n return (\n <header className=\"component-page-chrome component-page-head\" data-canvas-drag>\n <strong>{name}</strong>\n {layer ? <span className={`component-pill is-${layer}`}>{t(`components.layer.${layer}`)}</span> : null}\n {deprecated ? (\n <span className=\"component-pill is-deprecated\">\n {t('components.status.deprecated')}\n {deprecated.replacement ? ` ${t('components.replacedBy', { name: deprecated.replacement })}` : ''}\n </span>\n ) : (\n <span className=\"component-pill is-ok\">{t('components.status.ok')}</span>\n )}\n <span className=\"component-page-meta\">{t('components.frames', { count: frames.length })}</span>\n <span className=\"component-page-categories\">\n {categoryCounts(frames).map(({ category, count }) => (\n <span\n className={`frame-category is-${category}`}\n data-category-count={category}\n key={category}\n >\n {t(`components.category.${category}`)} {count}\n </span>\n ))}\n </span>\n </header>\n )\n}\n\n/** Below the board: the agent's tidy proposal, if any. */\nexport function ComponentPageAfter({\n frames,\n proposal,\n open,\n titleOf,\n onOpenChange,\n onDecide,\n}: {\n frames: FrameConfig[]\n proposal: ReviewItem | null\n open: boolean\n titleOf: (frame: FrameConfig) => string\n onOpenChange: (open: boolean) => void\n /** Approve / reject / reset the proposal (same as `seji proposal`). */\n onDecide: (proposal: ReviewItem, decision: ProposalDecision, note: string) => Promise<void>\n}) {\n if (!proposal) return null\n return (\n <div className=\"component-page-chrome component-page-after\" data-canvas-drag>\n {/* Keyed by the proposal, so a new proposal starts with an empty note. */}\n <TidyProposal\n frames={frames}\n key={proposal.id}\n open={open}\n proposal={proposal}\n titleOf={titleOf}\n onDecide={onDecide}\n onOpenChange={onOpenChange}\n />\n </div>\n )\n}\n\n/** The agent's tidy proposal: listed frames move to the page they belong to. */\nfunction TidyProposal({\n proposal,\n frames,\n open,\n titleOf,\n onOpenChange,\n onDecide,\n}: {\n proposal: ReviewItem\n frames: FrameConfig[]\n open: boolean\n titleOf: (frame: FrameConfig) => string\n onOpenChange: (open: boolean) => void\n onDecide: (proposal: ReviewItem, decision: ProposalDecision, note: string) => Promise<void>\n}) {\n const { t } = useI18n()\n const [note, setNote] = useState('')\n const [busy, setBusy] = useState(false)\n const [failure, setFailure] = useState<string | null>(null)\n const decide = (decision: ProposalDecision, text = '') => {\n setBusy(true)\n setFailure(null)\n onDecide(proposal, decision, text)\n .catch((error: unknown) => setFailure(componentErrorText(error, t)))\n .finally(() => setBusy(false))\n }\n const counts = categoryCounts(frames).filter((entry) => entry.category !== 'none')\n const separator = t('components.listSeparator')\n const listed = (proposal.frames ?? []).map((id) => ({ id, frame: frames.find((item) => item.id === id) ?? null }))\n const label = (entry: { id: string; frame: FrameConfig | null }) => (entry.frame ? titleOf(entry.frame) || entry.id : entry.id)\n const moves = listed.map(label).join(separator)\n const decided = proposal.author !== 'agent' || Boolean(proposal.proposalDecision)\n const approvedText = t('components.tidy.approved', { frames: moves })\n\n return (\n <div className=\"component-tidy\" data-tidy-proposal={proposal.id}>\n <p>\n <strong>{t('components.tidy.summary', { count: frames.length, kinds: counts.length })}</strong>\n {t('components.tidy.breakdown', {\n list: counts\n .map(({ category, count }) =>\n t('components.categoryCount', { label: t(`components.category.${category}`), count }),\n )\n .join(separator),\n })}{' '}\n {proposal.rationale ? <span className=\"component-tidy-rationale\">{proposal.rationale}</span> : null}\n </p>\n {decided ? (\n <p className=\"component-tidy-status\">\n <span className={`proposal-decision is-${proposal.proposalDecision ?? 'approved'}`}>\n {proposal.proposalDecision === 'rejected' ? t('components.tidy.rejected') : approvedText}\n </span>\n {proposal.author === 'agent' ? (\n <button className=\"component-link\" type=\"button\" disabled={busy} onClick={() => decide('reset')}>\n {t('components.tidy.undo')}\n </button>\n ) : null}\n </p>\n ) : open ? (\n <div className=\"component-tidy-detail\">\n {moves ? <p>{t('components.tidy.moves', { frames: moves })}</p> : null}\n <input\n aria-label={t('proposal.noteLabel')}\n className=\"input\"\n placeholder={t('components.tidy.notePlaceholder')}\n value={note}\n onChange={(event) => setNote(event.target.value)}\n />\n <div className=\"component-row-actions\">\n <Button className=\"primary-button\" disabled={busy} type=\"button\" onClick={() => decide('approve', note)}>\n {t('components.tidy.approve')}\n </Button>\n <Button className=\"button\" disabled={busy} type=\"button\" onClick={() => decide('reject', note)}>\n {t('components.tidy.dismiss')}\n </Button>\n <button className=\"component-link\" type=\"button\" onClick={() => onOpenChange(false)}>\n {t('components.tidy.hide')}\n </button>\n </div>\n </div>\n ) : (\n <div className=\"component-row-actions\">\n <Button className=\"primary-button\" type=\"button\" onClick={() => onOpenChange(true)}>\n {t('components.tidy.view')}\n </Button>\n <Button className=\"button\" disabled={busy} type=\"button\" onClick={() => decide('reject')}>\n {t('components.tidy.dismiss')}\n </Button>\n </div>\n )}\n {failure ? <p className=\"component-note is-error\">{failure}</p> : null}\n </div>\n )\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import type { TokenDef } from '../shared/tokens';
2
+ import type { ComponentOpReport, ComponentReport, ComponentSummary, ReviewItem } from '../shared/types';
3
+ import type { ComponentActionInput, ComponentActionResult } from './api';
4
+ import { type TokenPromoteDraft } from './PromoteForm';
5
+ type ActionInput = Omit<ComponentActionInput, 'name'>;
6
+ type Translate = (key: string, vars?: Record<string, string | number>) => string;
7
+ type Props = {
8
+ name: string;
9
+ report: ComponentReport | null;
10
+ loading: boolean;
11
+ error: string | null;
12
+ /** Every component, for the merge / replacement pickers. */
13
+ components: ComponentSummary[];
14
+ /** Pending `component` review items for it, from the report (every design ledger). */
15
+ items: ReviewItem[];
16
+ tokens: TokenDef[];
17
+ onDescribe: (description: string) => Promise<unknown>;
18
+ onAction: (input: ActionInput) => Promise<ComponentActionResult>;
19
+ /** Dry run of a tool action (rename / merge / deprecate + replace): what it would change. */
20
+ onPlan: (input: ActionInput, signal: AbortSignal) => Promise<ComponentOpReport>;
21
+ /** Undo a tool batch (`seji component revert`). */
22
+ onRevert: (item: ReviewItem) => Promise<void>;
23
+ onPromote: (draft: TokenPromoteDraft, files: string[]) => void;
24
+ onOpenComponent: (name: string) => void;
25
+ };
26
+ /**
27
+ * A server error in the reader's language: component errors carry a stable `code`
28
+ * (`components.error.<code>`); anything else shows the server's message.
29
+ */
30
+ export declare function componentErrorText(error: unknown, t: Translate): string;
31
+ /** Right panel of a component page: usage note, tokens, who uses it, status actions. */
32
+ export declare function ComponentPanel({ name, report, loading, error, components, items, tokens, onDescribe, onAction, onPlan, onRevert, onPromote, onOpenComponent, }: Props): import("react").JSX.Element;
33
+ /** Where a Promote to component item comes from: "From the design: new component" / "Split out of X". */
34
+ export declare function extractSourceLine(item: Pick<ReviewItem, 'from' | 'parent'>, t: Translate): string;
35
+ /** One-line description of a component item, shared by the panel and the Changes list. */
36
+ export declare function componentItemDetail(item: ReviewItem, t: Translate): string;
37
+ export {};
38
+ //# sourceMappingURL=ComponentPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentPanel.d.ts","sourceRoot":"","sources":["../../src/editor/ComponentPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACX,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;AAExE,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAKnE,KAAK,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAA;AACrD,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAA;AAEhF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,GAAG,IAAI,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,4DAA4D;IAC5D,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,sFAAsF;IACtF,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,MAAM,EAAE,QAAQ,EAAE,CAAA;IAClB,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACrD,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAChE,6FAA6F;IAC7F,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC/E,mDAAmD;IACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAC9D,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC,CAAA;AAiBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,UAc9D;AAiBD,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,eAAe,GAChB,EAAE,KAAK,+BA8TP;AAED,yGAAyG;AACzG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,UAIxF;AAED,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,UAsBjE"}
@@ -0,0 +1,275 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { Dialog } from '@base-ui/react/dialog';
4
+ import { useI18n } from './i18n';
5
+ import { PromoteForm } from './PromoteForm';
6
+ import { Button } from './ui/Button';
7
+ import { SearchPicker } from './ui/SearchPicker';
8
+ const ROW_LIMIT = 8;
9
+ const PLAN_FILE_LIMIT = 6;
10
+ const PLAN_LEFT_LIMIT = 6;
11
+ const COMPONENT_NAME = /^[A-Z][A-Za-z0-9_]*$/;
12
+ const dateLabel = (value) => {
13
+ if (!value)
14
+ return '—';
15
+ const date = new Date(value);
16
+ if (Number.isNaN(date.getTime()))
17
+ return value;
18
+ return `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
19
+ };
20
+ const propertyLabel = (property, state) => (state ? `${property} :${state}` : property);
21
+ const shortFile = (file) => file.replace(/^(?:\.\.\/)+/, '');
22
+ /**
23
+ * A server error in the reader's language: component errors carry a stable `code`
24
+ * (`components.error.<code>`); anything else shows the server's message.
25
+ */
26
+ export function componentErrorText(error, t) {
27
+ const code = error?.code;
28
+ const details = error?.details ?? {};
29
+ if (typeof code === 'string') {
30
+ const key = `components.error.${code}`;
31
+ const vars = Object.fromEntries(Object.entries(details).filter((entry) => typeof entry[1] === 'string' || typeof entry[1] === 'number'));
32
+ const text = t(key, vars);
33
+ if (text !== key)
34
+ return text;
35
+ }
36
+ return error instanceof Error ? error.message : String(error);
37
+ }
38
+ /** What a finished action did, for the panel's status line. */
39
+ function resultText(result, t) {
40
+ const op = result.op;
41
+ if (op) {
42
+ return t(op.counts.leftovers ? 'components.result.tool' : 'components.result.toolDone', {
43
+ changed: op.counts.changed,
44
+ files: op.counts.files,
45
+ left: op.counts.leftovers,
46
+ });
47
+ }
48
+ if (result.action === 'deprecate')
49
+ return t('components.result.marked');
50
+ if (result.action === 'undeprecate')
51
+ return t('components.result.undeprecated');
52
+ return t('components.result.item');
53
+ }
54
+ /** Right panel of a component page: usage note, tokens, who uses it, status actions. */
55
+ export function ComponentPanel({ name, report, loading, error, components, items, tokens, onDescribe, onAction, onPlan, onRevert, onPromote, onOpenComponent, }) {
56
+ const { t } = useI18n();
57
+ const [editing, setEditing] = useState(false);
58
+ const [draft, setDraft] = useState('');
59
+ const [saving, setSaving] = useState(false);
60
+ const [message, setMessage] = useState(null);
61
+ const [showAllTokens, setShowAllTokens] = useState(false);
62
+ const [promoting, setPromoting] = useState(null);
63
+ const [dialog, setDialog] = useState(null);
64
+ const [busy, setBusy] = useState(false);
65
+ useEffect(() => {
66
+ setEditing(false);
67
+ setShowAllTokens(false);
68
+ setPromoting(null);
69
+ setMessage(null);
70
+ setDialog(null);
71
+ }, [name]);
72
+ if (!report) {
73
+ return (_jsx("div", { className: "component-panel", children: _jsx("div", { className: "panel-empty", children: error ? t('components.panel.error', { error }) : t('components.panel.loading') }) }));
74
+ }
75
+ const deprecated = report.deprecated;
76
+ // One row per token (its properties listed on the row); base-layer tokens used directly first.
77
+ const sortedTokens = [...report.tokenRows].sort((a, b) => Number(Boolean(b.warning)) - Number(Boolean(a.warning)));
78
+ const tokenRows = showAllTokens ? sortedTokens : sortedTokens.slice(0, ROW_LIMIT);
79
+ // Merge / replacement candidates: same layer, not deprecated, not itself.
80
+ const candidates = components.filter((item) => item.name !== name && !item.deprecated && (report.layer === null || item.layer === report.layer));
81
+ const pendingDelete = items.find((item) => item.componentAction === 'delete' && item.status !== 'resolved');
82
+ const run = (input) => onAction(input).then((result) => {
83
+ setMessage(resultText(result, t));
84
+ return result;
85
+ });
86
+ return (_jsxs("div", { className: loading ? 'component-panel is-loading' : 'component-panel', "data-component-panel": name, children: [_jsxs("section", { className: "component-section", children: [_jsxs("h4", { children: [_jsx("span", { children: t('components.panel.usage') }), !editing ? (_jsx("button", { className: "component-link", type: "button", onClick: () => {
87
+ setDraft(report.description ?? '');
88
+ setEditing(true);
89
+ setMessage(null);
90
+ }, children: t('components.panel.edit') })) : null] }), editing ? (_jsxs("div", { className: "component-usage-edit", children: [_jsx("textarea", { "aria-label": t('components.panel.usage'), className: "input", placeholder: t('components.panel.usagePlaceholder'), rows: 4, value: draft, onChange: (event) => setDraft(event.target.value) }), _jsxs("div", { className: "component-row-actions", children: [_jsx(Button, { className: "primary-button", disabled: saving, type: "button", onClick: () => {
91
+ setSaving(true);
92
+ void onDescribe(draft)
93
+ .then(() => {
94
+ setEditing(false);
95
+ setMessage(t('components.panel.usageSaved'));
96
+ })
97
+ .catch((reason) => setMessage(componentErrorText(reason, t)))
98
+ .finally(() => setSaving(false));
99
+ }, children: t('components.panel.save') }), _jsx(Button, { className: "button", type: "button", onClick: () => setEditing(false), children: t('components.dialog.cancel') })] })] })) : report.description ? (_jsx("p", { className: "component-usage", children: report.description })) : (_jsx("p", { className: "component-usage is-empty", children: t('components.panel.usageEmpty') })), deprecated ? (_jsxs("p", { className: "component-usage is-deprecated", children: [t('components.deprecatedNote', { reason: deprecated.reason }), ' ', deprecated.replacement ? (_jsx("button", { className: "component-link", type: "button", onClick: () => deprecated.replacement && onOpenComponent(deprecated.replacement), children: t('components.deprecatedUse', { name: deprecated.replacement }) })) : (t('components.deprecatedNone'))] })) : null, message ? _jsx("p", { className: "component-note", "data-component-message": true, children: message }) : null] }), _jsxs("section", { className: "component-section", children: [_jsxs("h4", { children: [_jsx("span", { children: t('components.panel.tokens') }), _jsx("em", { children: t('components.panel.tokensMeta', {
100
+ count: report.tokenRows.length,
101
+ primitive: report.summary.primitive,
102
+ hardcoded: report.summary.hardcoded,
103
+ }) })] }), report.tokenRows.length === 0 && report.literals.length === 0 ? (_jsx("p", { className: "component-note", children: t('components.panel.noTokens') })) : null, report.literals.map((row) => {
104
+ const key = `${row.property}\0${row.state ?? ''}\0${row.value}`;
105
+ return (_jsxs("div", { className: "component-kv is-literal", title: `${row.file}${row.line ? `:${row.line}` : ''} · ${row.match}`, children: [_jsx("span", { className: "component-kv-key", children: propertyLabel(row.property, row.state) }), _jsxs("span", { className: "component-kv-value", children: [_jsx("code", { className: "component-literal", children: row.value }), _jsx("span", { className: "component-pill is-warning", children: t('components.panel.hardcoded') }), promoting === key ? null : (_jsx("button", { className: "component-link", type: "button", onClick: () => setPromoting(key), children: t('components.panel.promote') }))] }), promoting === key ? (_jsx(PromoteForm, { defaultTier: "component", tokens: tokens, value: row.value, onCancel: () => setPromoting(null), onSubmit: (next) => {
106
+ onPromote(next, [row.file]);
107
+ setPromoting(null);
108
+ setMessage(t('components.panel.promoted'));
109
+ } })) : null] }, key));
110
+ }), tokenRows.map((row) => (_jsxs("div", { className: row.warning ? 'component-kv is-token is-primitive' : 'component-kv is-token', "data-token-row": row.token, title: row.properties
111
+ .map((use) => `${propertyLabel(use.property, use.state)} · ${use.file}${use.line ? `:${use.line}` : ''}`)
112
+ .join('\n'), children: [_jsxs("span", { className: "component-kv-value", children: [_jsx("code", { className: "component-token", children: row.path ?? row.token }), row.warning === 'primitive' ? (_jsx("span", { className: "component-pill is-warning", title: t('components.panel.primitiveHint'), children: t('components.panel.primitive') })) : null] }), _jsx("span", { className: "component-kv-key", children: row.properties.map((use) => propertyLabel(use.property, use.state)).join(t('components.listSeparator')) }), row.warning === 'primitive' ? (_jsx("span", { className: "component-kv-fix", children: row.suggestions?.length ? (_jsxs(_Fragment, { children: [t('components.panel.useInstead'), row.suggestions.map((suggestion) => (_jsx("code", { className: "component-token", title: t(`components.panel.suggestion.${suggestion.via}`), children: suggestion.path }, suggestion.token)))] })) : (t('components.panel.noSemantic')) })) : null] }, row.token))), sortedTokens.length > ROW_LIMIT ? (_jsx("button", { className: "component-link", type: "button", onClick: () => setShowAllTokens((value) => !value), children: showAllTokens
113
+ ? t('components.panel.less')
114
+ : t('components.panel.more', { count: sortedTokens.length - ROW_LIMIT }) })) : null] }), _jsxs("section", { className: "component-section", children: [_jsx("h4", { children: _jsx("span", { children: t('components.panel.status') }) }), _jsxs("div", { className: "component-actions", children: [_jsx(Button, { className: "button", type: "button", onClick: () => setDialog('rename'), children: t('components.action.rename') }), _jsx(Button, { className: "button", disabled: candidates.length === 0, type: "button", onClick: () => setDialog('merge'), children: t('components.action.merge') }), _jsx(Button, { className: "button", type: "button", onClick: () => setDialog('deprecate'), children: t(deprecated ? 'components.action.editDeprecation' : 'components.action.deprecate') }), deprecated ? (_jsx(Button, { className: "button", disabled: busy, type: "button", onClick: () => {
115
+ setBusy(true);
116
+ run({ action: 'undeprecate' })
117
+ .catch((reason) => setMessage(componentErrorText(reason, t)))
118
+ .finally(() => setBusy(false));
119
+ }, children: t('components.action.undeprecate') })) : null, _jsx(Button, { className: "button", disabled: Boolean(pendingDelete), type: "button", onClick: () => setDialog('delete'), children: t('components.action.delete') })] }), pendingDelete ? (_jsx("p", { className: "component-note", children: t('components.action.deletePending') })) : null, report.replaces.map((entry) => (_jsx("p", { className: "component-note", children: t('components.replaces', { name: entry.name, date: dateLabel(entry.at) }) }, entry.name))), items.length > 0 ? (_jsx("div", { className: "component-pending", children: items.map((item) => (_jsxs("div", { className: "component-pending-row", "data-component-item": item.id, children: [_jsx("span", { className: "change-action", children: t(`changes.componentAction.${item.componentAction ?? 'rename'}`) }), _jsx("span", { children: componentItemDetail(item, t) }), _jsx("em", { children: item.author === 'agent' && !item.proposalDecision
120
+ ? t('proposal.badge')
121
+ : item.proposalDecision === 'rejected'
122
+ ? t('proposal.rejected')
123
+ : t(`changes.status.${item.status}`) }), item.componentOp && !item.componentOp.revertedAt ? (_jsx("button", { className: "component-link", disabled: busy, type: "button", onClick: () => {
124
+ setBusy(true);
125
+ onRevert(item)
126
+ .then(() => setMessage(t('components.result.reverted')))
127
+ .catch((reason) => setMessage(componentErrorText(reason, t)))
128
+ .finally(() => setBusy(false));
129
+ }, children: t('components.panel.revert') })) : null] }, item.id))) })) : null, _jsxs("code", { className: "component-source", title: report.file, children: [t('components.panel.source'), ": ", shortFile(report.file), report.line ? `:${report.line}` : ''] })] }), dialog ? (_jsx(ComponentActionDialog, { action: dialog, candidates: candidates, deprecated: deprecated, layer: report.layer, name: name, taken: components.map((item) => item.name), onClose: () => setDialog(null), onPlan: onPlan, onSubmit: (input) => run(input).then(() => setDialog(null)) }, dialog)) : null] }));
130
+ }
131
+ /** Where a Promote to component item comes from: "From the design: new component" / "Split out of X". */
132
+ export function extractSourceLine(item, t) {
133
+ return item.from === 'component'
134
+ ? t('promote.component.fromComponent', { parent: item.parent ?? '' })
135
+ : t('promote.component.fromDesign');
136
+ }
137
+ /** One-line description of a component item, shared by the panel and the Changes list. */
138
+ export function componentItemDetail(item, t) {
139
+ const from = String(item.from ?? '');
140
+ const to = item.to === undefined || item.to === null ? '' : String(item.to);
141
+ const tool = item.componentOp
142
+ ? ` · ${t(item.componentOp.revertedAt ? 'changes.componentOpReverted' : 'changes.componentOp', {
143
+ changed: item.componentOp.changed,
144
+ left: item.componentOp.left,
145
+ })}`
146
+ : '';
147
+ switch (item.componentAction) {
148
+ case 'rename':
149
+ case 'merge':
150
+ return `${from} → ${to}${tool}`;
151
+ case 'deprecate':
152
+ return `${from} → ${to || t('changes.noReplacement')} · ${t(`changes.componentMode.${item.componentMode ?? 'mark'}`)}${tool}`;
153
+ case 'tidy':
154
+ return (item.frames ?? []).join(t('components.listSeparator'));
155
+ case 'extract':
156
+ return `${extractSourceLine(item, t)}${item.dir ? ` · ${item.dir}` : ''}`;
157
+ default:
158
+ return from;
159
+ }
160
+ }
161
+ /**
162
+ * Live dry run for the dialog's current input: each change of the input aborts the
163
+ * previous request and starts a new one (no debounce timer), so the list always matches
164
+ * what is typed.
165
+ */
166
+ function usePlan(input, onPlan, t) {
167
+ const [state, setState] = useState({ status: 'idle' });
168
+ const key = input ? JSON.stringify(input) : '';
169
+ useEffect(() => {
170
+ if (!input) {
171
+ setState({ status: 'idle' });
172
+ return;
173
+ }
174
+ const controller = new AbortController();
175
+ setState((previous) => ({ status: 'loading', report: previous.status === 'ready' ? previous.report : undefined }));
176
+ onPlan(input, controller.signal)
177
+ .then((report) => {
178
+ if (!controller.signal.aborted)
179
+ setState({ status: 'ready', report });
180
+ })
181
+ .catch((error) => {
182
+ if (!controller.signal.aborted)
183
+ setState({ status: 'error', error: componentErrorText(error, t) });
184
+ });
185
+ return () => controller.abort();
186
+ // `key` stands for `input` (a new object every render).
187
+ }, [key]);
188
+ return state;
189
+ }
190
+ /** The plan: how many places in how many files change, the file moves, what is left. */
191
+ function PlanView({ plan }) {
192
+ const { t } = useI18n();
193
+ if (plan.status === 'idle')
194
+ return null;
195
+ if (plan.status === 'error') {
196
+ return _jsx("p", { className: "token-dialog-note is-error component-plan-error", children: plan.error });
197
+ }
198
+ const report = plan.status === 'ready' ? plan.report : plan.report;
199
+ if (!report) {
200
+ return (_jsx("div", { className: "component-plan is-loading", "data-component-plan": "loading", children: _jsx("p", { className: "token-dialog-note", children: t('components.plan.loading') }) }));
201
+ }
202
+ const files = report.files.filter((file) => file.changed > 0);
203
+ return (_jsxs("div", { className: plan.status === 'loading' ? 'component-plan is-loading' : 'component-plan', "data-component-plan": "ready", children: [_jsxs("p", { className: "component-plan-head", children: [_jsx("strong", { children: t('components.plan.title') }), _jsx("span", { children: report.counts.changed
204
+ ? t('components.plan.summary', { changed: report.counts.changed, files: report.counts.files })
205
+ : t('components.plan.none') }), report.counts.leftovers ? (_jsx("span", { className: "component-pill is-warning", children: t('components.plan.left', { count: report.counts.leftovers }) })) : null] }), report.moves.map((move) => (_jsx("p", { className: "component-plan-row", children: t('components.plan.move', { from: shortFile(move.from), to: shortFile(move.to) }) }, move.from))), files.slice(0, PLAN_FILE_LIMIT).map((file) => (_jsxs("p", { className: "component-plan-row", children: [_jsx("code", { children: shortFile(file.file) }), _jsx("em", { children: t('components.plan.fileChanged', { count: file.changed }) })] }, file.file))), files.length > PLAN_FILE_LIMIT ? (_jsx("p", { className: "component-plan-row is-more", children: t('components.plan.moreFiles', { count: files.length - PLAN_FILE_LIMIT }) })) : null, report.leftovers.length ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "component-plan-sub", children: t('components.plan.leftTitle') }), report.leftovers.slice(0, PLAN_LEFT_LIMIT).map((left, index) => {
206
+ const reasonKey = `components.plan.reason.${left.reason ?? ''}`;
207
+ const reason = t(reasonKey);
208
+ return (_jsxs("p", { className: "component-plan-row is-left", children: [_jsxs("code", { children: [shortFile(left.file), ":", left.line] }), _jsx("em", { children: reason === reasonKey ? left.reason ?? '' : reason })] }, `${left.file}:${left.line}:${left.column}:${index}`));
209
+ }), report.leftovers.length > PLAN_LEFT_LIMIT ? (_jsx("p", { className: "component-plan-row is-more", children: t('components.plan.moreLeft', { count: report.leftovers.length - PLAN_LEFT_LIMIT }) })) : null] })) : null] }));
210
+ }
211
+ /**
212
+ * Component flavour of the one searchable picker (ui/SearchPicker, the same as the token
213
+ * dialogs): filters by name and file, shows the layer. Lists only the candidates it is given.
214
+ */
215
+ function ComponentPicker({ id, label, value, candidates, layer, disabled = false, onChange, }) {
216
+ const { t } = useI18n();
217
+ return (_jsx(SearchPicker, { clearable: true, className: "component-picker", disabled: disabled, emptyText: t('components.dialog.noCandidates'), foot: layer
218
+ ? t('components.dialog.pickerHintLayer', { layer: t(`components.layer.${layer}`) })
219
+ : t('components.dialog.pickerHint'), id: id, inline: true, keyOf: componentKey, label: label, matches: componentMatches, optionData: (option) => ({ 'component-option': option.name }), options: candidates, placeholder: t('components.dialog.search'), renderOption: (option) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "combo-option-name", children: option.name }), option.layer ? _jsx("span", { className: "combo-tier", children: t(`components.layer.${option.layer}`) }) : null, _jsx("span", { className: "combo-option-value", children: shortFile(option.file).split('/').pop() })] })), rootData: { 'component-picker': id }, value: value, onChange: onChange }));
220
+ }
221
+ const componentKey = (item) => item.name;
222
+ const componentMatches = (item, query) => !query || `${item.name} ${item.file}`.toLowerCase().includes(query);
223
+ function ComponentActionDialog({ action, name, layer, candidates, taken, deprecated, onClose, onPlan, onSubmit, }) {
224
+ const { t } = useI18n();
225
+ // Editing an existing deprecation starts from it (design/components.json owns it).
226
+ const [to, setTo] = useState(action === 'deprecate' ? deprecated?.replacement ?? '' : '');
227
+ const [noReplacement, setNoReplacement] = useState(action === 'deprecate' && Boolean(deprecated) && !deprecated?.replacement);
228
+ const [mode, setMode] = useState('mark');
229
+ const [reason, setReason] = useState(action === 'deprecate' ? deprecated?.reason ?? '' : '');
230
+ const [busy, setBusy] = useState(false);
231
+ const [failure, setFailure] = useState(null);
232
+ const replacing = action === 'deprecate' && !noReplacement && mode === 'replace';
233
+ const valid = action === 'rename'
234
+ ? COMPONENT_NAME.test(to) && to !== name && !taken.includes(to)
235
+ : action === 'merge'
236
+ ? Boolean(to)
237
+ : action === 'deprecate'
238
+ ? Boolean(reason.trim()) && (noReplacement || Boolean(to))
239
+ : true;
240
+ // The tool actions show what they would change while the input is valid.
241
+ const planInput = (action === 'rename' && valid) || (action === 'merge' && valid) || (replacing && to)
242
+ ? { action, to, ...(action === 'deprecate' ? { mode: 'replace' } : {}) }
243
+ : null;
244
+ const plan = usePlan(planInput, onPlan, t);
245
+ const tool = action === 'rename' || action === 'merge' || replacing;
246
+ const submitLabel = tool
247
+ ? t('components.dialog.apply')
248
+ : action === 'deprecate'
249
+ ? t('components.dialog.save')
250
+ : t('components.dialog.submit');
251
+ return (_jsx(Dialog.Root, { open: true, onOpenChange: (open) => {
252
+ if (!open)
253
+ onClose();
254
+ }, children: _jsxs(Dialog.Portal, { children: [_jsx(Dialog.Backdrop, { className: "token-dialog-backdrop" }), _jsxs(Dialog.Popup, { className: "token-dialog component-dialog", "data-component-dialog": action, children: [_jsx("div", { className: "token-dialog-head", children: _jsxs("div", { children: [_jsx("p", { className: "token-dialog-kicker", children: name }), _jsx("h2", { children: t(`components.dialog.${action}`, { name }) })] }) }), _jsxs("div", { className: "token-dialog-form", children: [_jsx("p", { className: "token-dialog-note", children: t(`components.dialog.${action}Hint`, { name }) }), action === 'rename' ? (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: "component-new-name", children: t('components.dialog.newName') }), _jsx("input", { autoFocus: true, id: "component-new-name", placeholder: name, value: to, onChange: (event) => setTo(event.target.value.trim()) }), to && !COMPONENT_NAME.test(to) ? (_jsx("p", { className: "token-dialog-note is-error", children: t('components.error.invalid-name') })) : to !== name && taken.includes(to) ? (_jsx("p", { className: "token-dialog-note is-error", children: t('components.error.name-taken') })) : null] })) : null, action === 'merge' || action === 'deprecate' ? (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: "component-target", children: t(action === 'merge' ? 'components.dialog.into' : 'components.dialog.replacement') }), _jsx(ComponentPicker, { candidates: candidates, disabled: noReplacement, id: "component-target", label: t(action === 'merge' ? 'components.dialog.into' : 'components.dialog.replacement'), layer: layer, value: to, onChange: setTo })] })) : null, action === 'deprecate' ? (_jsxs(_Fragment, { children: [_jsxs("label", { className: "component-check", children: [_jsx("input", { checked: noReplacement, type: "checkbox", onChange: (event) => {
255
+ setNoReplacement(event.target.checked);
256
+ if (event.target.checked) {
257
+ setTo('');
258
+ setMode('mark');
259
+ }
260
+ } }), t('components.dialog.noReplacement')] }), _jsxs("span", { className: "ins-seg is-text", role: "group", children: [_jsx("button", { "aria-pressed": mode === 'replace', className: mode === 'replace' ? 'is-on' : '', disabled: noReplacement, type: "button", onClick: () => setMode('replace'), children: t('components.dialog.modeReplace') }), _jsx("button", { "aria-pressed": mode === 'mark', className: mode === 'mark' ? 'is-on' : '', type: "button", onClick: () => setMode('mark'), children: t('components.dialog.modeMark') })] })] })) : null, _jsx(PlanView, { plan: plan }), _jsx("label", { htmlFor: "component-reason", children: t(action === 'deprecate' ? 'components.dialog.reason' : 'components.dialog.reasonOptional') }), _jsx("input", { id: "component-reason", value: reason, onChange: (event) => setReason(event.target.value) }), failure ? _jsx("p", { className: "token-dialog-note is-error", children: failure }) : null, _jsxs("div", { className: "token-dialog-actions", children: [_jsx(Button, { className: "primary-button", disabled: !valid || busy || (tool && plan.status === 'error'), type: "button", onClick: () => {
261
+ setBusy(true);
262
+ setFailure(null);
263
+ onSubmit({
264
+ action,
265
+ ...(action === 'rename' || action === 'merge' || (action === 'deprecate' && !noReplacement)
266
+ ? { to }
267
+ : {}),
268
+ ...(action === 'deprecate' ? { mode: noReplacement ? 'mark' : mode } : {}),
269
+ ...(reason.trim() ? { reason: reason.trim() } : {}),
270
+ })
271
+ .catch((error) => setFailure(componentErrorText(error, t)))
272
+ .finally(() => setBusy(false));
273
+ }, children: submitLabel }), _jsx(Button, { className: "button", type: "button", onClick: onClose, children: t('components.dialog.cancel') })] })] })] })] }) }));
274
+ }
275
+ //# sourceMappingURL=ComponentPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentPanel.js","sourceRoot":"","sources":["../../src/editor/ComponentPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAU9C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA0BhD,MAAM,SAAS,GAAG,CAAC,CAAA;AACnB,MAAM,eAAe,GAAG,CAAC,CAAA;AACzB,MAAM,eAAe,GAAG,CAAC,CAAA;AACzB,MAAM,cAAc,GAAG,sBAAsB,CAAA;AAE7C,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAA;IACtB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,KAAK,CAAA;IAC9C,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;AACrG,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,KAAK,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;gDACZ,OAAO,CAAC,IAAI,CAAC,CAAA;gDACb,UAAU,CAAC,IAAI,CAAC,CAAA;gDAChB,QAAQ,CAAC;oDACP,MAAM;oDACN,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,aAAa,CAAC;wDACzF,CAAC,CAAC,EAAE,EAAE,EAAE;wDACR,CAAC,CAAC,EAAE,CAAC;oDACP,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAE,MAAgB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oDACrF,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iDACpD,CAAC;qDACC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;qDACnE,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;4CAClC,CAAC,YAEA,WAAW,GACL,EACT,KAAC,MAAM,IAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YACtD,CAAC,CAAC,0BAA0B,CAAC,GACvB,IACL,IACF,IACO,IACD,GACJ,CACf,CAAA;AACH,CAAC","sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { Dialog } from '@base-ui/react/dialog'\n\nimport type { TokenDef } from '../shared/tokens'\nimport type {\n ComponentOpReport,\n ComponentReport,\n ComponentSummary,\n ReviewItem,\n} from '../shared/types'\nimport type { ComponentActionInput, ComponentActionResult } from './api'\nimport { useI18n } from './i18n'\nimport { PromoteForm, type TokenPromoteDraft } from './PromoteForm'\nimport { Button } from './ui/Button'\nimport { SearchPicker } from './ui/SearchPicker'\n\ntype DialogAction = 'rename' | 'merge' | 'deprecate' | 'delete'\ntype ActionInput = Omit<ComponentActionInput, 'name'>\ntype Translate = (key: string, vars?: Record<string, string | number>) => string\n\ntype Props = {\n name: string\n report: ComponentReport | null\n loading: boolean\n error: string | null\n /** Every component, for the merge / replacement pickers. */\n components: ComponentSummary[]\n /** Pending `component` review items for it, from the report (every design ledger). */\n items: ReviewItem[]\n tokens: TokenDef[]\n onDescribe: (description: string) => Promise<unknown>\n onAction: (input: ActionInput) => Promise<ComponentActionResult>\n /** Dry run of a tool action (rename / merge / deprecate + replace): what it would change. */\n onPlan: (input: ActionInput, signal: AbortSignal) => Promise<ComponentOpReport>\n /** Undo a tool batch (`seji component revert`). */\n onRevert: (item: ReviewItem) => Promise<void>\n onPromote: (draft: TokenPromoteDraft, files: string[]) => void\n onOpenComponent: (name: string) => void\n}\n\nconst ROW_LIMIT = 8\nconst PLAN_FILE_LIMIT = 6\nconst PLAN_LEFT_LIMIT = 6\nconst COMPONENT_NAME = /^[A-Z][A-Za-z0-9_]*$/\n\nconst dateLabel = (value?: string) => {\n if (!value) return '—'\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return value\n return `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`\n}\n\nconst propertyLabel = (property: string, state?: string) => (state ? `${property} :${state}` : property)\nconst shortFile = (file: string) => file.replace(/^(?:\\.\\.\\/)+/, '')\n\n/**\n * A server error in the reader's language: component errors carry a stable `code`\n * (`components.error.<code>`); anything else shows the server's message.\n */\nexport function componentErrorText(error: unknown, t: Translate) {\n const code = (error as { code?: unknown } | null)?.code\n const details = (error as { details?: Record<string, unknown> } | null)?.details ?? {}\n if (typeof code === 'string') {\n const key = `components.error.${code}`\n const vars = Object.fromEntries(\n Object.entries(details).filter((entry): entry is [string, string | number] =>\n typeof entry[1] === 'string' || typeof entry[1] === 'number',\n ),\n )\n const text = t(key, vars)\n if (text !== key) return text\n }\n return error instanceof Error ? error.message : String(error)\n}\n\n/** What a finished action did, for the panel's status line. */\nfunction resultText(result: ComponentActionResult, t: Translate) {\n const op = result.op\n if (op) {\n return t(op.counts.leftovers ? 'components.result.tool' : 'components.result.toolDone', {\n changed: op.counts.changed,\n files: op.counts.files,\n left: op.counts.leftovers,\n })\n }\n if (result.action === 'deprecate') return t('components.result.marked')\n if (result.action === 'undeprecate') return t('components.result.undeprecated')\n return t('components.result.item')\n}\n\n/** Right panel of a component page: usage note, tokens, who uses it, status actions. */\nexport function ComponentPanel({\n name,\n report,\n loading,\n error,\n components,\n items,\n tokens,\n onDescribe,\n onAction,\n onPlan,\n onRevert,\n onPromote,\n onOpenComponent,\n}: Props) {\n const { t } = useI18n()\n const [editing, setEditing] = useState(false)\n const [draft, setDraft] = useState('')\n const [saving, setSaving] = useState(false)\n const [message, setMessage] = useState<string | null>(null)\n const [showAllTokens, setShowAllTokens] = useState(false)\n const [promoting, setPromoting] = useState<string | null>(null)\n const [dialog, setDialog] = useState<DialogAction | null>(null)\n const [busy, setBusy] = useState(false)\n\n useEffect(() => {\n setEditing(false)\n setShowAllTokens(false)\n setPromoting(null)\n setMessage(null)\n setDialog(null)\n }, [name])\n\n if (!report) {\n return (\n <div className=\"component-panel\">\n <div className=\"panel-empty\">\n {error ? t('components.panel.error', { error }) : t('components.panel.loading')}\n </div>\n </div>\n )\n }\n\n const deprecated = report.deprecated\n // One row per token (its properties listed on the row); base-layer tokens used directly first.\n const sortedTokens = [...report.tokenRows].sort((a, b) => Number(Boolean(b.warning)) - Number(Boolean(a.warning)))\n const tokenRows = showAllTokens ? sortedTokens : sortedTokens.slice(0, ROW_LIMIT)\n // Merge / replacement candidates: same layer, not deprecated, not itself.\n const candidates = components.filter(\n (item) => item.name !== name && !item.deprecated && (report.layer === null || item.layer === report.layer),\n )\n const pendingDelete = items.find((item) => item.componentAction === 'delete' && item.status !== 'resolved')\n const run = (input: ActionInput) =>\n onAction(input).then((result) => {\n setMessage(resultText(result, t))\n return result\n })\n\n return (\n <div className={loading ? 'component-panel is-loading' : 'component-panel'} data-component-panel={name}>\n <section className=\"component-section\">\n <h4>\n <span>{t('components.panel.usage')}</span>\n {!editing ? (\n <button\n className=\"component-link\"\n type=\"button\"\n onClick={() => {\n setDraft(report.description ?? '')\n setEditing(true)\n setMessage(null)\n }}\n >\n {t('components.panel.edit')}\n </button>\n ) : null}\n </h4>\n {editing ? (\n <div className=\"component-usage-edit\">\n <textarea\n aria-label={t('components.panel.usage')}\n className=\"input\"\n placeholder={t('components.panel.usagePlaceholder')}\n rows={4}\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n />\n <div className=\"component-row-actions\">\n <Button\n className=\"primary-button\"\n disabled={saving}\n type=\"button\"\n onClick={() => {\n setSaving(true)\n void onDescribe(draft)\n .then(() => {\n setEditing(false)\n setMessage(t('components.panel.usageSaved'))\n })\n .catch((reason: unknown) => setMessage(componentErrorText(reason, t)))\n .finally(() => setSaving(false))\n }}\n >\n {t('components.panel.save')}\n </Button>\n <Button className=\"button\" type=\"button\" onClick={() => setEditing(false)}>\n {t('components.dialog.cancel')}\n </Button>\n </div>\n </div>\n ) : report.description ? (\n <p className=\"component-usage\">{report.description}</p>\n ) : (\n <p className=\"component-usage is-empty\">{t('components.panel.usageEmpty')}</p>\n )}\n {deprecated ? (\n <p className=\"component-usage is-deprecated\">\n {t('components.deprecatedNote', { reason: deprecated.reason })}{' '}\n {deprecated.replacement ? (\n <button\n className=\"component-link\"\n type=\"button\"\n onClick={() => deprecated.replacement && onOpenComponent(deprecated.replacement)}\n >\n {t('components.deprecatedUse', { name: deprecated.replacement })}\n </button>\n ) : (\n t('components.deprecatedNone')\n )}\n </p>\n ) : null}\n {message ? <p className=\"component-note\" data-component-message>{message}</p> : null}\n </section>\n\n <section className=\"component-section\">\n <h4>\n <span>{t('components.panel.tokens')}</span>\n <em>\n {t('components.panel.tokensMeta', {\n count: report.tokenRows.length,\n primitive: report.summary.primitive,\n hardcoded: report.summary.hardcoded,\n })}\n </em>\n </h4>\n {report.tokenRows.length === 0 && report.literals.length === 0 ? (\n <p className=\"component-note\">{t('components.panel.noTokens')}</p>\n ) : null}\n {report.literals.map((row) => {\n const key = `${row.property}\\0${row.state ?? ''}\\0${row.value}`\n return (\n <div className=\"component-kv is-literal\" key={key} title={`${row.file}${row.line ? `:${row.line}` : ''} · ${row.match}`}>\n <span className=\"component-kv-key\">{propertyLabel(row.property, row.state)}</span>\n <span className=\"component-kv-value\">\n <code className=\"component-literal\">{row.value}</code>\n <span className=\"component-pill is-warning\">{t('components.panel.hardcoded')}</span>\n {promoting === key ? null : (\n <button className=\"component-link\" type=\"button\" onClick={() => setPromoting(key)}>\n {t('components.panel.promote')}\n </button>\n )}\n </span>\n {promoting === key ? (\n <PromoteForm\n defaultTier=\"component\"\n tokens={tokens}\n value={row.value}\n onCancel={() => setPromoting(null)}\n onSubmit={(next) => {\n onPromote(next, [row.file])\n setPromoting(null)\n setMessage(t('components.panel.promoted'))\n }}\n />\n ) : null}\n </div>\n )\n })}\n {tokenRows.map((row) => (\n <div\n className={row.warning ? 'component-kv is-token is-primitive' : 'component-kv is-token'}\n data-token-row={row.token}\n key={row.token}\n title={row.properties\n .map((use) => `${propertyLabel(use.property, use.state)} · ${use.file}${use.line ? `:${use.line}` : ''}`)\n .join('\\n')}\n >\n <span className=\"component-kv-value\">\n <code className=\"component-token\">{row.path ?? row.token}</code>\n {row.warning === 'primitive' ? (\n <span className=\"component-pill is-warning\" title={t('components.panel.primitiveHint')}>\n {t('components.panel.primitive')}\n </span>\n ) : null}\n </span>\n <span className=\"component-kv-key\">\n {row.properties.map((use) => propertyLabel(use.property, use.state)).join(t('components.listSeparator'))}\n </span>\n {row.warning === 'primitive' ? (\n <span className=\"component-kv-fix\">\n {row.suggestions?.length ? (\n <>\n {t('components.panel.useInstead')}\n {row.suggestions.map((suggestion) => (\n <code\n className=\"component-token\"\n key={suggestion.token}\n title={t(`components.panel.suggestion.${suggestion.via}`)}\n >\n {suggestion.path}\n </code>\n ))}\n </>\n ) : (\n t('components.panel.noSemantic')\n )}\n </span>\n ) : null}\n </div>\n ))}\n {sortedTokens.length > ROW_LIMIT ? (\n <button className=\"component-link\" type=\"button\" onClick={() => setShowAllTokens((value) => !value)}>\n {showAllTokens\n ? t('components.panel.less')\n : t('components.panel.more', { count: sortedTokens.length - ROW_LIMIT })}\n </button>\n ) : null}\n </section>\n\n <section className=\"component-section\">\n <h4>\n <span>{t('components.panel.status')}</span>\n </h4>\n <div className=\"component-actions\">\n <Button className=\"button\" type=\"button\" onClick={() => setDialog('rename')}>\n {t('components.action.rename')}\n </Button>\n <Button className=\"button\" disabled={candidates.length === 0} type=\"button\" onClick={() => setDialog('merge')}>\n {t('components.action.merge')}\n </Button>\n <Button className=\"button\" type=\"button\" onClick={() => setDialog('deprecate')}>\n {t(deprecated ? 'components.action.editDeprecation' : 'components.action.deprecate')}\n </Button>\n {deprecated ? (\n <Button\n className=\"button\"\n disabled={busy}\n type=\"button\"\n onClick={() => {\n setBusy(true)\n run({ action: 'undeprecate' })\n .catch((reason: unknown) => setMessage(componentErrorText(reason, t)))\n .finally(() => setBusy(false))\n }}\n >\n {t('components.action.undeprecate')}\n </Button>\n ) : null}\n <Button\n className=\"button\"\n disabled={Boolean(pendingDelete)}\n type=\"button\"\n onClick={() => setDialog('delete')}\n >\n {t('components.action.delete')}\n </Button>\n </div>\n {pendingDelete ? (\n <p className=\"component-note\">{t('components.action.deletePending')}</p>\n ) : null}\n {report.replaces.map((entry) => (\n <p className=\"component-note\" key={entry.name}>\n {t('components.replaces', { name: entry.name, date: dateLabel(entry.at) })}\n </p>\n ))}\n {items.length > 0 ? (\n <div className=\"component-pending\">\n {items.map((item) => (\n <div className=\"component-pending-row\" data-component-item={item.id} key={item.id}>\n <span className=\"change-action\">\n {t(`changes.componentAction.${item.componentAction ?? 'rename'}`)}\n </span>\n <span>{componentItemDetail(item, t)}</span>\n <em>\n {item.author === 'agent' && !item.proposalDecision\n ? t('proposal.badge')\n : item.proposalDecision === 'rejected'\n ? t('proposal.rejected')\n : t(`changes.status.${item.status}`)}\n </em>\n {item.componentOp && !item.componentOp.revertedAt ? (\n <button\n className=\"component-link\"\n disabled={busy}\n type=\"button\"\n onClick={() => {\n setBusy(true)\n onRevert(item)\n .then(() => setMessage(t('components.result.reverted')))\n .catch((reason: unknown) => setMessage(componentErrorText(reason, t)))\n .finally(() => setBusy(false))\n }}\n >\n {t('components.panel.revert')}\n </button>\n ) : null}\n </div>\n ))}\n </div>\n ) : null}\n <code className=\"component-source\" title={report.file}>\n {t('components.panel.source')}: {shortFile(report.file)}\n {report.line ? `:${report.line}` : ''}\n </code>\n </section>\n\n {dialog ? (\n <ComponentActionDialog\n action={dialog}\n candidates={candidates}\n deprecated={deprecated}\n key={dialog}\n layer={report.layer}\n name={name}\n taken={components.map((item) => item.name)}\n onClose={() => setDialog(null)}\n onPlan={onPlan}\n onSubmit={(input) => run(input).then(() => setDialog(null))}\n />\n ) : null}\n </div>\n )\n}\n\n/** Where a Promote to component item comes from: \"From the design: new component\" / \"Split out of X\". */\nexport function extractSourceLine(item: Pick<ReviewItem, 'from' | 'parent'>, t: Translate) {\n return item.from === 'component'\n ? t('promote.component.fromComponent', { parent: item.parent ?? '' })\n : t('promote.component.fromDesign')\n}\n\n/** One-line description of a component item, shared by the panel and the Changes list. */\nexport function componentItemDetail(item: ReviewItem, t: Translate) {\n const from = String(item.from ?? '')\n const to = item.to === undefined || item.to === null ? '' : String(item.to)\n const tool = item.componentOp\n ? ` · ${t(item.componentOp.revertedAt ? 'changes.componentOpReverted' : 'changes.componentOp', {\n changed: item.componentOp.changed,\n left: item.componentOp.left,\n })}`\n : ''\n switch (item.componentAction) {\n case 'rename':\n case 'merge':\n return `${from} → ${to}${tool}`\n case 'deprecate':\n return `${from} → ${to || t('changes.noReplacement')} · ${t(`changes.componentMode.${item.componentMode ?? 'mark'}`)}${tool}`\n case 'tidy':\n return (item.frames ?? []).join(t('components.listSeparator'))\n case 'extract':\n return `${extractSourceLine(item, t)}${item.dir ? ` · ${item.dir}` : ''}`\n default:\n return from\n }\n}\n\ntype PlanState =\n | { status: 'idle' }\n | { status: 'loading'; report?: ComponentOpReport }\n | { status: 'ready'; report: ComponentOpReport }\n | { status: 'error'; error: string }\n\n/**\n * Live dry run for the dialog's current input: each change of the input aborts the\n * previous request and starts a new one (no debounce timer), so the list always matches\n * what is typed.\n */\nfunction usePlan(input: ActionInput | null, onPlan: Props['onPlan'], t: Translate): PlanState {\n const [state, setState] = useState<PlanState>({ status: 'idle' })\n const key = input ? JSON.stringify(input) : ''\n useEffect(() => {\n if (!input) {\n setState({ status: 'idle' })\n return\n }\n const controller = new AbortController()\n setState((previous) => ({ status: 'loading', report: previous.status === 'ready' ? previous.report : undefined }))\n onPlan(input, controller.signal)\n .then((report) => {\n if (!controller.signal.aborted) setState({ status: 'ready', report })\n })\n .catch((error: unknown) => {\n if (!controller.signal.aborted) setState({ status: 'error', error: componentErrorText(error, t) })\n })\n return () => controller.abort()\n // `key` stands for `input` (a new object every render).\n }, [key])\n return state\n}\n\n/** The plan: how many places in how many files change, the file moves, what is left. */\nfunction PlanView({ plan }: { plan: PlanState }) {\n const { t } = useI18n()\n if (plan.status === 'idle') return null\n if (plan.status === 'error') {\n return <p className=\"token-dialog-note is-error component-plan-error\">{plan.error}</p>\n }\n const report = plan.status === 'ready' ? plan.report : plan.report\n if (!report) {\n return (\n <div className=\"component-plan is-loading\" data-component-plan=\"loading\">\n <p className=\"token-dialog-note\">{t('components.plan.loading')}</p>\n </div>\n )\n }\n const files = report.files.filter((file) => file.changed > 0)\n return (\n <div className={plan.status === 'loading' ? 'component-plan is-loading' : 'component-plan'} data-component-plan=\"ready\">\n <p className=\"component-plan-head\">\n <strong>{t('components.plan.title')}</strong>\n <span>\n {report.counts.changed\n ? t('components.plan.summary', { changed: report.counts.changed, files: report.counts.files })\n : t('components.plan.none')}\n </span>\n {report.counts.leftovers ? (\n <span className=\"component-pill is-warning\">{t('components.plan.left', { count: report.counts.leftovers })}</span>\n ) : null}\n </p>\n {report.moves.map((move) => (\n <p className=\"component-plan-row\" key={move.from}>\n {t('components.plan.move', { from: shortFile(move.from), to: shortFile(move.to) })}\n </p>\n ))}\n {files.slice(0, PLAN_FILE_LIMIT).map((file) => (\n <p className=\"component-plan-row\" key={file.file}>\n <code>{shortFile(file.file)}</code>\n <em>{t('components.plan.fileChanged', { count: file.changed })}</em>\n </p>\n ))}\n {files.length > PLAN_FILE_LIMIT ? (\n <p className=\"component-plan-row is-more\">{t('components.plan.moreFiles', { count: files.length - PLAN_FILE_LIMIT })}</p>\n ) : null}\n {report.leftovers.length ? (\n <>\n <p className=\"component-plan-sub\">{t('components.plan.leftTitle')}</p>\n {report.leftovers.slice(0, PLAN_LEFT_LIMIT).map((left, index) => {\n const reasonKey = `components.plan.reason.${left.reason ?? ''}`\n const reason = t(reasonKey)\n return (\n <p className=\"component-plan-row is-left\" key={`${left.file}:${left.line}:${left.column}:${index}`}>\n <code>\n {shortFile(left.file)}:{left.line}\n </code>\n <em>{reason === reasonKey ? left.reason ?? '' : reason}</em>\n </p>\n )\n })}\n {report.leftovers.length > PLAN_LEFT_LIMIT ? (\n <p className=\"component-plan-row is-more\">\n {t('components.plan.moreLeft', { count: report.leftovers.length - PLAN_LEFT_LIMIT })}\n </p>\n ) : null}\n </>\n ) : null}\n </div>\n )\n}\n\n/**\n * Component flavour of the one searchable picker (ui/SearchPicker, the same as the token\n * dialogs): filters by name and file, shows the layer. Lists only the candidates it is given.\n */\nfunction ComponentPicker({\n id,\n label,\n value,\n candidates,\n layer,\n disabled = false,\n onChange,\n}: {\n id: string\n label: string\n value: string\n candidates: ComponentSummary[]\n layer: ComponentReport['layer']\n disabled?: boolean\n onChange: (name: string) => void\n}) {\n const { t } = useI18n()\n return (\n <SearchPicker<ComponentSummary>\n clearable\n className=\"component-picker\"\n disabled={disabled}\n emptyText={t('components.dialog.noCandidates')}\n foot={\n layer\n ? t('components.dialog.pickerHintLayer', { layer: t(`components.layer.${layer}`) })\n : t('components.dialog.pickerHint')\n }\n id={id}\n inline\n keyOf={componentKey}\n label={label}\n matches={componentMatches}\n optionData={(option) => ({ 'component-option': option.name })}\n options={candidates}\n placeholder={t('components.dialog.search')}\n renderOption={(option) => (\n <>\n <span className=\"combo-option-name\">{option.name}</span>\n {option.layer ? <span className=\"combo-tier\">{t(`components.layer.${option.layer}`)}</span> : null}\n <span className=\"combo-option-value\">{shortFile(option.file).split('/').pop()}</span>\n </>\n )}\n rootData={{ 'component-picker': id }}\n value={value}\n onChange={onChange}\n />\n )\n}\n\nconst componentKey = (item: ComponentSummary) => item.name\nconst componentMatches = (item: ComponentSummary, query: string) =>\n !query || `${item.name} ${item.file}`.toLowerCase().includes(query)\n\nfunction ComponentActionDialog({\n action,\n name,\n layer,\n candidates,\n taken,\n deprecated,\n onClose,\n onPlan,\n onSubmit,\n}: {\n action: DialogAction\n name: string\n layer: ComponentReport['layer']\n candidates: ComponentSummary[]\n /** Every component name (a rename must pick a free one). */\n taken: string[]\n deprecated: ComponentReport['deprecated']\n onClose: () => void\n onPlan: Props['onPlan']\n onSubmit: (input: ActionInput) => Promise<unknown>\n}) {\n const { t } = useI18n()\n // Editing an existing deprecation starts from it (design/components.json owns it).\n const [to, setTo] = useState(action === 'deprecate' ? deprecated?.replacement ?? '' : '')\n const [noReplacement, setNoReplacement] = useState(action === 'deprecate' && Boolean(deprecated) && !deprecated?.replacement)\n const [mode, setMode] = useState<'mark' | 'replace'>('mark')\n const [reason, setReason] = useState(action === 'deprecate' ? deprecated?.reason ?? '' : '')\n const [busy, setBusy] = useState(false)\n const [failure, setFailure] = useState<string | null>(null)\n\n const replacing = action === 'deprecate' && !noReplacement && mode === 'replace'\n const valid =\n action === 'rename'\n ? COMPONENT_NAME.test(to) && to !== name && !taken.includes(to)\n : action === 'merge'\n ? Boolean(to)\n : action === 'deprecate'\n ? Boolean(reason.trim()) && (noReplacement || Boolean(to))\n : true\n // The tool actions show what they would change while the input is valid.\n const planInput: ActionInput | null =\n (action === 'rename' && valid) || (action === 'merge' && valid) || (replacing && to)\n ? { action, to, ...(action === 'deprecate' ? { mode: 'replace' as const } : {}) }\n : null\n const plan = usePlan(planInput, onPlan, t)\n const tool = action === 'rename' || action === 'merge' || replacing\n const submitLabel = tool\n ? t('components.dialog.apply')\n : action === 'deprecate'\n ? t('components.dialog.save')\n : t('components.dialog.submit')\n\n return (\n <Dialog.Root\n open\n onOpenChange={(open) => {\n if (!open) onClose()\n }}\n >\n <Dialog.Portal>\n <Dialog.Backdrop className=\"token-dialog-backdrop\" />\n <Dialog.Popup className=\"token-dialog component-dialog\" data-component-dialog={action}>\n <div className=\"token-dialog-head\">\n <div>\n <p className=\"token-dialog-kicker\">{name}</p>\n <h2>{t(`components.dialog.${action}`, { name })}</h2>\n </div>\n </div>\n <div className=\"token-dialog-form\">\n <p className=\"token-dialog-note\">{t(`components.dialog.${action}Hint`, { name })}</p>\n {action === 'rename' ? (\n <>\n <label htmlFor=\"component-new-name\">{t('components.dialog.newName')}</label>\n <input\n autoFocus\n id=\"component-new-name\"\n placeholder={name}\n value={to}\n onChange={(event) => setTo(event.target.value.trim())}\n />\n {to && !COMPONENT_NAME.test(to) ? (\n <p className=\"token-dialog-note is-error\">{t('components.error.invalid-name')}</p>\n ) : to !== name && taken.includes(to) ? (\n <p className=\"token-dialog-note is-error\">{t('components.error.name-taken')}</p>\n ) : null}\n </>\n ) : null}\n {action === 'merge' || action === 'deprecate' ? (\n <>\n <label htmlFor=\"component-target\">\n {t(action === 'merge' ? 'components.dialog.into' : 'components.dialog.replacement')}\n </label>\n <ComponentPicker\n candidates={candidates}\n disabled={noReplacement}\n id=\"component-target\"\n label={t(action === 'merge' ? 'components.dialog.into' : 'components.dialog.replacement')}\n layer={layer}\n value={to}\n onChange={setTo}\n />\n </>\n ) : null}\n {action === 'deprecate' ? (\n <>\n <label className=\"component-check\">\n <input\n checked={noReplacement}\n type=\"checkbox\"\n onChange={(event) => {\n setNoReplacement(event.target.checked)\n if (event.target.checked) {\n setTo('')\n setMode('mark')\n }\n }}\n />\n {t('components.dialog.noReplacement')}\n </label>\n <span className=\"ins-seg is-text\" role=\"group\">\n <button\n aria-pressed={mode === 'replace'}\n className={mode === 'replace' ? 'is-on' : ''}\n disabled={noReplacement}\n type=\"button\"\n onClick={() => setMode('replace')}\n >\n {t('components.dialog.modeReplace')}\n </button>\n <button\n aria-pressed={mode === 'mark'}\n className={mode === 'mark' ? 'is-on' : ''}\n type=\"button\"\n onClick={() => setMode('mark')}\n >\n {t('components.dialog.modeMark')}\n </button>\n </span>\n </>\n ) : null}\n <PlanView plan={plan} />\n <label htmlFor=\"component-reason\">\n {t(action === 'deprecate' ? 'components.dialog.reason' : 'components.dialog.reasonOptional')}\n </label>\n <input id=\"component-reason\" value={reason} onChange={(event) => setReason(event.target.value)} />\n {failure ? <p className=\"token-dialog-note is-error\">{failure}</p> : null}\n <div className=\"token-dialog-actions\">\n <Button\n className=\"primary-button\"\n disabled={!valid || busy || (tool && plan.status === 'error')}\n type=\"button\"\n onClick={() => {\n setBusy(true)\n setFailure(null)\n onSubmit({\n action,\n ...(action === 'rename' || action === 'merge' || (action === 'deprecate' && !noReplacement)\n ? { to }\n : {}),\n ...(action === 'deprecate' ? { mode: noReplacement ? ('mark' as const) : mode } : {}),\n ...(reason.trim() ? { reason: reason.trim() } : {}),\n })\n .catch((error: unknown) => setFailure(componentErrorText(error, t)))\n .finally(() => setBusy(false))\n }}\n >\n {submitLabel}\n </Button>\n <Button className=\"button\" type=\"button\" onClick={onClose}>\n {t('components.dialog.cancel')}\n </Button>\n </div>\n </div>\n </Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n )\n}\n"]}