@rien7/seji 0.0.0 → 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 (412) 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 +106 -1
  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
@@ -0,0 +1,510 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { ComponentIcon } from 'lucide-react';
4
+ import { useI18n } from './i18n';
5
+ import { PromoteToken } from './PromoteToken';
6
+ import { PromoteComponent } from './PromoteComponent';
7
+ import { alreadyComponent, extractSourceOf } from '../shared/componentExtract.mjs';
8
+ import { byPath, deprecationOf, isTransparent, pxOf, semanticFor, suggestToken, toHex, tokenPath, tokenKindOf, tokensOfKind, } from './tokenMatch';
9
+ import { Button } from './ui/Button';
10
+ import { Glyph } from './Glyph';
11
+ import { Icon } from './ui/Icon';
12
+ import { NumberInput } from './ui/NumberInput';
13
+ import { Select } from './ui/Select';
14
+ import { ScrubLabel, ValueCombo } from './ValueCombo';
15
+ import { heightEdits } from '../shared/sizeModes.mjs';
16
+ import { sourceKind } from '../shared/sketches.mjs';
17
+ const TEXT_TAGS = ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'label', 'strong', 'em', 'code'];
18
+ const VERTICAL_GLYPH = { fixed: 'fixedV', fill: 'fillV', hug: 'hugV' };
19
+ const HINT_KINDS = ['space', 'radius', 'color', 'font-size', 'border-width'];
20
+ const boxOf = (value) => {
21
+ const parts = value
22
+ .split('/')[0]
23
+ .trim()
24
+ .split(/\s+/)
25
+ .map((part) => pxOf(part) ?? 0);
26
+ const [a = 0, b = a, c = a, d = b] = parts;
27
+ return [a, b, c, d];
28
+ };
29
+ const percent = (value) => {
30
+ const number = Number.parseFloat(value);
31
+ return Number.isFinite(number) ? Math.round(number * 100) : null;
32
+ };
33
+ const fromPercent = (number) => String(Math.min(100, Math.max(0, number)) / 100);
34
+ const same = (values) => values.every((value) => value === values[0]);
35
+ export function Inspector({ targets, drafts, editState, running, variant, variants, frameDraftCount, boardCount, message, tokens, tokenValues, componentPages, componentSources, onOpenComponent, onStopRunning, onEdit, onPreview, onRevert, onRevertNode, onSaveChanges, onSaveToComponent, onSaveVariant, onUseVariant, onCreateToken, onFreeRect, componentNames, takenComponentNames, componentDirs = [], onPromoteComponent, onSuggestToken, suggestedTokens, }) {
36
+ const { t } = useI18n();
37
+ const [expanded, setExpanded] = useState({});
38
+ const [promote, setPromote] = useState(null);
39
+ const [promoteComponent, setPromoteComponent] = useState(false);
40
+ const primary = targets[0];
41
+ if (running) {
42
+ return (_jsxs("div", { className: "inspector", children: [_jsxs("section", { className: "ins-sec", children: [_jsxs("div", { className: "ins-title", children: [_jsx("b", { children: t('inspect.runningTitle') }), _jsxs("span", { className: "ins-pill is-running", children: [_jsx(Glyph, { name: "play", size: 9 }), " ", t('frame.play')] })] }), _jsx("p", { className: "ins-note", children: t('inspect.runningBody') }), _jsx(Button, { className: "button", type: "button", onClick: onStopRunning, children: t('inspect.backToInspect') })] }), _jsxs("section", { className: "ins-sec", children: [_jsx("h4", { children: t('inspect.runningDrafts') }), _jsx("p", { className: "ins-note", children: t('inspect.runningDraftCount', { count: frameDraftCount }) })] })] }));
43
+ }
44
+ if (!primary) {
45
+ return (_jsxs("div", { className: "inspector", children: [_jsxs("div", { className: "inspector-empty", children: [_jsx("span", { className: "inspector-empty-mark", children: _jsx(Icon, { icon: ComponentIcon, size: 18 }) }), _jsx("p", { children: t('inspector.empty') }), _jsx("p", { className: "ins-note", children: t('inspect.multiHint') })] }), frameDraftCount && !variant ? (_jsxs("div", { className: "ins-head", children: [_jsx("div", { className: "ins-sub", children: message ?? t('inspect.draftCount', { count: frameDraftCount }) }), _jsxs("div", { className: "ins-actions", children: [_jsx("span", { className: "ins-spacer" }), _jsx(Button, { className: "primary-button ins-save", type: "button", onClick: onSaveChanges, children: t('inspect.saveChanges') })] })] })) : message ? (_jsx("div", { className: "ins-head", children: _jsx("div", { className: "ins-sub", children: message }) })) : null] }));
46
+ }
47
+ const node = primary.node;
48
+ const multi = targets.length > 1;
49
+ const styles = node.styles;
50
+ const resolve = (token) => tokenValues[token.name] || token.value || '';
51
+ const tokenByName = (name) => tokens.find((token) => token.name === name) ?? null;
52
+ const draftsOn = (target) => drafts.filter((entry) => entry.frame === target.frame &&
53
+ entry.node.path === target.node.path &&
54
+ entry.state === editState);
55
+ const nodeDrafts = drafts.filter((entry) => entry.frame === primary.frame &&
56
+ (entry.node.path === node.path || entry.node.path.startsWith(`${node.path} > `)));
57
+ const componentName = node.component ?? null;
58
+ const hasComponentPage = Boolean(componentName && componentPages && componentName in componentPages);
59
+ const source = node.source ?? (componentName ? componentSources[componentName] : undefined);
60
+ const subtitle = multi
61
+ ? t('inspect.selectedSummary', {
62
+ names: [...new Set(targets.map((item) => item.node.component ?? item.node.name))].join(', '),
63
+ boards: boardCount,
64
+ })
65
+ : !node.componentRoot && componentName
66
+ ? t('inspect.inside', { name: componentName })
67
+ : '';
68
+ // One line for drafts: those on this element, and the board total when it is larger.
69
+ const draftLine = multi || !nodeDrafts.length
70
+ ? frameDraftCount
71
+ ? t(multi ? 'inspect.draftCount' : 'inspect.draftsOnBoard', { count: frameDraftCount })
72
+ : t('inspect.noDrafts')
73
+ : [
74
+ t('inspect.changedHere', { count: nodeDrafts.length }),
75
+ frameDraftCount > nodeDrafts.length ? t('inspect.changedBoard', { count: frameDraftCount }) : '',
76
+ ]
77
+ .filter(Boolean)
78
+ .join(' · ');
79
+ const title = node.componentRoot && componentName ? componentName : node.ownAnchor ?? node.name;
80
+ const names = componentNames ?? new Set();
81
+ const isComponent = alreadyComponent(node, names);
82
+ const extractSource = { label: title, ...extractSourceOf(node, names) };
83
+ const header = (_jsxs("div", { className: "ins-head", children: [_jsxs("div", { className: "ins-title", children: [multi ? (_jsx("b", { children: t('inspect.selectedCount', { count: targets.length }) })) : (_jsxs(_Fragment, { children: [_jsx("b", { title: source ?? undefined, children: title }), _jsx("span", { className: node.componentRoot ? 'ins-pill is-component' : 'ins-pill', children: node.componentRoot ? t('inspect.component') : node.tag })] })), editState !== 'default' ? (_jsx("span", { className: "ins-pill is-state", children: t(`inspect.state.${editState}`) })) : null, _jsx("span", { className: "ins-spacer" }), _jsx("button", { className: "ins-icon", disabled: !nodeDrafts.length || running, title: t('inspect.revertHere'), type: "button", onClick: onRevertNode, children: _jsx(Glyph, { name: "reset" }) }), _jsx("button", { className: "ins-icon", disabled: !componentName || !nodeDrafts.length || running || variant, title: t('inspect.toComponent'), type: "button", onClick: onSaveToComponent, children: _jsx(Glyph, { name: "up" }) }), _jsx("button", { className: "ins-icon", disabled: multi || Boolean(isComponent) || !onPromoteComponent, title: isComponent ? t('inspect.alreadyComponent', { name: isComponent }) : t('inspect.promoteComponent'), "aria-label": t('inspect.promoteComponent'), "data-ds-action": "promote-component", "data-ds-from": isComponent ? 'root' : extractSource.from, type: "button", onClick: () => setPromoteComponent(true), children: _jsx(Glyph, { name: "component" }) }), _jsx("button", { className: "ins-icon", disabled: !hasComponentPage, title: t('inspect.openComponent'), type: "button", onClick: () => componentName && onOpenComponent?.(componentName), children: _jsx(Glyph, { name: "out" }) })] }), subtitle ? _jsx("div", { className: "ins-sub", children: subtitle }) : null, !multi && source ? (_jsxs("div", { className: "ins-source-row", children: [_jsx("code", { className: "ins-source", title: source, children: source }), _jsx("span", { className: `source-kind is-${sourceKind(source)}`, "data-ds-source-kind": sourceKind(source) ?? undefined, title: t(sourceKind(source) === 'sketch' ? 'source.sketchHint' : 'source.productHint'), children: t(sourceKind(source) === 'sketch' ? 'source.sketch' : 'source.product') })] })) : null, _jsx("div", { className: "ins-rule" }), _jsx("div", { className: "ins-sub", children: message ?? (variant ? t('inspect.variantHint') : draftLine) }), _jsxs("div", { className: "ins-actions", children: [_jsx("button", { className: "ins-icon", disabled: variant || running, title: t('inspect.saveVariant'), type: "button", onClick: onSaveVariant, children: _jsx(Glyph, { name: "dup" }) }), _jsx("span", { className: "ins-spacer" }), _jsx(Button, { className: "primary-button ins-save", disabled: !frameDraftCount || variant, type: "button", onClick: onSaveChanges, children: t('inspect.saveChanges') })] })] }));
84
+ /* ---------------- field rows ---------------- */
85
+ const bindingOf = (target, field) => {
86
+ // A shorthand such as `border` carries both a width and a color token; only a token of
87
+ // the field's own kind binds (the color token is not the stroke width).
88
+ const candidates = field.bindings ?? [field.property];
89
+ const isColor = field.kind === 'color';
90
+ for (const variable of target.node.variables ?? []) {
91
+ if (!candidates.includes(variable.property))
92
+ continue;
93
+ const token = tokenByName(variable.token);
94
+ if (token && (tokenKindOf(token) === 'color') === isColor)
95
+ return token;
96
+ }
97
+ return null;
98
+ };
99
+ const changedProps = (field) => {
100
+ const props = field.properties ?? [field.property];
101
+ return targets.some((target) => draftsOn(target).some((entry) => props.includes(entry.property)));
102
+ };
103
+ const commit = (field) => (next) => onEdit([{ property: field.property, value: next.value, token: next.token?.name ?? null }]);
104
+ const preview = (field) => (value) => onPreview(value === null ? null : [{ property: field.property, value }]);
105
+ const hint = (field, value, token) => {
106
+ if (multi)
107
+ return null;
108
+ if (token) {
109
+ const deprecated = deprecationOf(token);
110
+ if (deprecated) {
111
+ const replacement = byPath(tokens, deprecated.replacement);
112
+ return (_jsxs("div", { className: "ins-fix is-warn", children: [t('inspect.deprecated'), replacement ? (_jsxs(_Fragment, { children: [' ', t('inspect.useInstead'), " ", _jsx("code", { className: "ins-tok", children: tokenPath(replacement) }), _jsx("button", { className: "ins-fix-action is-primary", type: "button", onClick: () => commit(field)({ value: `var(${replacement.name})`, token: replacement }), children: t('inspect.useReplacement') })] })) : null, deprecated.reason ? _jsx("span", { className: "ins-fix-reason", children: deprecated.reason }) : null] }));
113
+ }
114
+ const semantic = componentName ? semanticFor(token, tokens) : null;
115
+ if (semantic) {
116
+ return (_jsxs("div", { className: "ins-fix is-warn", children: [t('inspect.crossLayer'), " ", _jsx("code", { className: "ins-tok", children: tokenPath(semantic) }), _jsx("button", { className: "ins-fix-action is-primary", type: "button", onClick: () => commit(field)({ value: `var(${semantic.name})`, token: semantic }), children: t('inspect.switchOver') })] }));
117
+ }
118
+ return null;
119
+ }
120
+ if (!HINT_KINDS.includes(field.kind))
121
+ return null;
122
+ if (field.kind === 'color' ? isTransparent(value) : !pxOf(value))
123
+ return null;
124
+ const candidates = tokensOfKind(tokens, field.kind);
125
+ if (!candidates.length)
126
+ return null;
127
+ const suggestion = suggestToken(field.kind, value, candidates, resolve);
128
+ if (suggestion.type === 'none') {
129
+ return (_jsxs("div", { className: "ins-fix", children: [t(`inspect.noNear.${field.kind}`), _jsx("button", { className: "ins-fix-action", type: "button", onClick: () => setPromote({
130
+ label: field.title,
131
+ node: primary.ref,
132
+ frame: primary.frame,
133
+ property: field.property,
134
+ value: field.kind === 'color' ? toHex(value) : value,
135
+ kind: field.kind,
136
+ }), children: t('inspect.promote') })] }));
137
+ }
138
+ return (_jsxs("div", { className: "ins-fix", children: [suggestion.type === 'exact'
139
+ ? t('inspect.exactly')
140
+ : t('inspect.nearest'), ' ', _jsx("code", { className: "ins-tok", children: tokenPath(suggestion.token) }), suggestion.type === 'near'
141
+ ? field.kind === 'color'
142
+ ? t('inspect.sameToEye')
143
+ : t('inspect.offBy', { diff: suggestion.diff })
144
+ : null, _jsx("button", { className: "ins-fix-action is-primary", type: "button", onClick: () => commit(field)({ value: `var(${suggestion.token.name})`, token: suggestion.token }), children: t('inspect.useIt') })] }));
145
+ };
146
+ const revertButton = (field) => changedProps(field) ? (_jsx("button", { className: "ins-icon is-small", title: t('inspect.revertField'), type: "button", onClick: () => onRevert(field.properties ?? [field.property]), children: _jsx(Glyph, { name: "reset", size: 12 }) })) : null;
147
+ // A hard-coded (unbound) value: one click hands it to the agent as a token suggestion.
148
+ const suggestButton = (field, value, token, mixed) => {
149
+ if (!onSuggestToken || token || mixed || multi || !HINT_KINDS.includes(field.kind))
150
+ return null;
151
+ if (field.kind === 'color' ? isTransparent(value) : !pxOf(value))
152
+ return null;
153
+ const literal = field.kind === 'color' ? toHex(value) : value;
154
+ const done = Boolean(suggestedTokens?.has(`${primary.frame}|${primary.node.path}|${field.property}`));
155
+ return (_jsx("button", { "aria-label": t('inspect.suggestToken'), "aria-pressed": done, className: done ? 'ins-icon is-small is-on' : 'ins-icon is-small', "data-ds-action": "suggest-token", title: done ? t('inspect.suggestedToken') : t('inspect.suggestToken'), type: "button", onClick: () => onSuggestToken(primary, field.property, literal), children: _jsx(Glyph, { name: "tokenUp", size: 12 }) }));
156
+ };
157
+ const label = (field, value) => {
158
+ const content = (_jsxs(_Fragment, { children: [changedProps(field) ? _jsx("i", { className: "field-dot" }) : null, field.glyph ? _jsx(Glyph, { name: field.glyph }) : _jsx("span", { className: "field-text", children: field.text })] }));
159
+ if (!field.numeric) {
160
+ return _jsx("span", { className: "field-label", title: field.title, children: content });
161
+ }
162
+ return (_jsx(ScrubLabel, { title: t('inspect.scrubTitle', { label: field.title }), toCss: field.toCss, toNumber: field.toNumber, value: value, onCommit: (next) => onEdit([{ property: field.property, value: next, token: null }]), onPreview: preview(field), children: content }));
163
+ };
164
+ const row = (field) => {
165
+ const values = targets.map((target) => target.node.styles?.[field.key] ?? '');
166
+ const bindings = targets.map((target) => bindingOf(target, field)?.name ?? '');
167
+ const mixed = !same(values) || !same(bindings);
168
+ const value = values[0] ?? '';
169
+ const token = mixed ? null : bindingOf(primary, field);
170
+ const candidates = tokensOfKind(tokens, field.kind);
171
+ const deprecated = token ? deprecationOf(token) : null;
172
+ const cross = token && componentName ? semanticFor(token, tokens) : null;
173
+ const sides = field.sides;
174
+ const isExpanded = sides ? expanded[field.id] ?? (!mixed && !same(boxOf(value).map(String))) : false;
175
+ const nearest = !token && !mixed && candidates.length
176
+ ? (() => {
177
+ const suggestion = suggestToken(field.kind, value, candidates, resolve);
178
+ return suggestion.type === 'none' ? null : suggestion.token;
179
+ })()
180
+ : null;
181
+ return (_jsxs("div", { className: "field", children: [_jsxs("div", { className: "field-row", children: [label(field, value), sides && isExpanded ? (_jsx("div", { className: "field-sides", children: boxOf(value).map((side, index) => (_jsxs("label", { className: "field-side", title: sides.names[index], children: [_jsx("span", { children: sides.names[index] }), _jsx(SideInput, { value: side, onCommit: (next) => {
182
+ const box = boxOf(value);
183
+ box[index] = next;
184
+ onEdit([{ property: field.property, value: box.map((item) => `${item}px`).join(' '), token: null }]);
185
+ } })] }, sides.names[index]))) })) : (_jsx(ValueCombo, { isPrimitive: (item) => Boolean(componentName && semanticFor(item, tokens)), kind: field.kind, label: field.title, mixed: mixed, nearest: nearest, numeric: field.numeric, resolve: resolve, toCss: field.toCss, toNumber: field.toNumber, token: token, tokens: candidates, unit: field.unit, min: field.numeric ? 0 : undefined, value: value, warn: deprecated ? 'deprecated' : cross ? 'cross' : null, onCommit: commit(field), onPreview: preview(field) })), sides ? (_jsx("button", { "aria-pressed": isExpanded, className: isExpanded ? 'ins-icon is-on' : 'ins-icon', title: sides.title, type: "button", onClick: () => setExpanded((current) => ({ ...current, [field.id]: !isExpanded })), children: _jsx(Glyph, { name: "sides" }) })) : null, suggestButton(field, value, token, mixed), revertButton(field)] }), !isExpanded && !mixed ? hint(field, value, token) : null] }, field.id));
186
+ };
187
+ const selectRow = (id, text, key, property, options) => {
188
+ const field = { id, title: text, text, property, key, kind: 'other' };
189
+ const values = targets.map((target) => target.node.styles?.[key] ?? '');
190
+ const mixed = !same(values);
191
+ const value = mixed ? '' : values[0] ?? '';
192
+ const list = value && !options.includes(value) ? [value, ...options] : options;
193
+ return (_jsx("div", { className: "field", children: _jsxs("div", { className: "field-row", children: [label(field, value), _jsx(Select, { className: mixed ? 'input select-field field-select is-mixed' : 'input select-field field-select', label: text, options: list.map((option) => ({ value: option, label: option })), placeholder: mixed ? t('inspect.mixed') : undefined, value: value, onChange: (next) => onEdit([{ property, value: next, token: null }]) }), revertButton(field)] }) }, id));
194
+ };
195
+ const segmentRow = (id, text, key, property, options, normalize = (value) => value) => {
196
+ const field = { id, title: text, text, property, key, kind: 'other' };
197
+ const values = targets.map((target) => normalize(target.node.styles?.[key] ?? ''));
198
+ const mixed = !same(values);
199
+ const value = mixed ? '' : values[0] ?? '';
200
+ return (_jsx("div", { className: "field", children: _jsxs("div", { className: "field-row", children: [label(field, value), _jsx("span", { className: mixed ? 'ins-seg is-mixed' : 'ins-seg', role: "group", "aria-label": text, title: mixed ? t('inspect.mixed') : undefined, children: options.map((option) => (_jsx("button", { "aria-pressed": value === option.value, className: value === option.value ? 'is-on' : '', title: option.title, type: "button", onClick: () => onEdit([{ property, value: option.value, token: null }]), children: _jsx(Glyph, { name: option.glyph, size: 12 }) }, option.value))) }), revertButton(field)] }) }, id));
201
+ };
202
+ /* ---------------- width ---------------- */
203
+ const layouts = targets.map((target) => target.node.layout);
204
+ const widthModes = layouts.map((layout) => layout?.widthMode ?? 'fixed');
205
+ const widthMode = same(widthModes) ? widthModes[0] : null;
206
+ const widths = layouts.map((layout) => String(Math.round(layout?.width ?? 0)));
207
+ const parentRow = Boolean(node.layout?.parentRow);
208
+ const widthField = {
209
+ id: 'width',
210
+ title: t('inspect.width'),
211
+ text: 'W',
212
+ property: 'width',
213
+ properties: ['width', 'flex-grow', 'flex-basis'],
214
+ key: 'display',
215
+ kind: 'size',
216
+ numeric: true,
217
+ };
218
+ const widthEdits = (mode) => {
219
+ if (mode === 'fixed') {
220
+ return [
221
+ { property: 'width', value: `${Math.round(node.layout?.width ?? 0)}px` },
222
+ ...(parentRow ? [{ property: 'flex-grow', value: '0' }] : []),
223
+ ];
224
+ }
225
+ if (mode === 'fill') {
226
+ return parentRow
227
+ ? [
228
+ { property: 'flex-grow', value: '1' },
229
+ { property: 'flex-basis', value: '0%' },
230
+ { property: 'width', value: 'auto' },
231
+ ]
232
+ : [{ property: 'width', value: '100%' }];
233
+ }
234
+ return [
235
+ { property: 'width', value: 'fit-content' },
236
+ ...(parentRow ? [{ property: 'flex-grow', value: '0' }] : []),
237
+ ];
238
+ };
239
+ const widthRow = (_jsx("div", { className: "field", children: _jsxs("div", { className: "field-row", children: [label(widthField, `${widths[0]}px`), _jsx("span", { className: "ins-seg", role: "group", "aria-label": t('inspect.width'), children: ['fixed', 'fill', 'hug'].map((mode) => (_jsx("button", { "aria-pressed": widthMode === mode, className: widthMode === mode ? 'is-on' : '', title: t(`inspect.width.${mode}`), type: "button", onClick: () => onEdit(widthEdits(mode)), children: _jsx(Glyph, { name: mode, size: 12 }) }, mode))) }), _jsx("span", { className: "field-width", children: _jsx(ValueCombo, { kind: "size", label: t('inspect.width'), mixed: !same(widths), numeric: true, resolve: resolve, token: null, tokens: [], value: `${widths[0]}px`, min: 0, disabled: widthMode !== 'fixed', onCommit: (next) => onEdit([{ property: 'width', value: next.value, token: null }]), onPreview: (value) => onPreview(value === null ? null : [{ property: 'width', value }]) }) }), revertButton(widthField)] }) }, "width"));
240
+ /* ---------------- height ---------------- */
241
+ const heightModes = layouts.map((layout) => layout?.heightMode ?? 'hug');
242
+ const heightMode = same(heightModes) ? heightModes[0] : null;
243
+ const heights = layouts.map((layout) => String(Math.round(layout?.height ?? 0)));
244
+ const parentKind = node.layout?.parentKind ?? 'block';
245
+ const heightField = {
246
+ id: 'height',
247
+ title: t('inspect.height'),
248
+ text: 'H',
249
+ property: 'height',
250
+ properties: ['height', 'flex-grow', 'flex-basis', 'align-self'],
251
+ key: 'display',
252
+ kind: 'size',
253
+ numeric: true,
254
+ };
255
+ const heightRow = (_jsx("div", { className: "field", children: _jsxs("div", { className: "field-row", children: [label(heightField, `${heights[0]}px`), _jsx("span", { className: "ins-seg", role: "group", "aria-label": t('inspect.height'), children: ['fixed', 'fill', 'hug'].map((mode) => (_jsx("button", { "aria-pressed": heightMode === mode, className: heightMode === mode ? 'is-on' : '', title: t(`inspect.height.${mode}`), type: "button", onClick: () => onEdit(heightEdits(mode, parentKind, node.layout?.height ?? 0)), children: _jsx(Glyph, { name: VERTICAL_GLYPH[mode], size: 12 }) }, mode))) }), _jsx("span", { className: "field-width", children: _jsx(ValueCombo, { kind: "size", label: t('inspect.height'), mixed: !same(heights), numeric: true, resolve: resolve, token: null, tokens: [], value: `${heights[0]}px`, min: 0, disabled: heightMode !== 'fixed', onCommit: (next) => onEdit([{ property: 'height', value: next.value, token: null }]), onPreview: (value) => onPreview(value === null ? null : [{ property: 'height', value }]) }) }), revertButton(heightField)] }) }, "height"));
256
+ /* ---------------- sections ---------------- */
257
+ const pureText = !node.component && TEXT_TAGS.includes(node.tag);
258
+ const hasText = pureText ||
259
+ node.tag === 'button' ||
260
+ (Boolean(node.text?.trim()) && (node.children?.length ?? 0) === 0);
261
+ // With several selected, a section shows (as Mixed when they differ) if any of them has it.
262
+ const anyTarget = (test) => targets.some((target) => Boolean(target.node.styles && test(target.node.styles)));
263
+ const hasFill = anyTarget((item) => !isTransparent(item.backgroundColor));
264
+ const hasStroke = anyTarget((item) => item.borderStyle !== 'none' && Number.parseFloat(item.borderWidth) > 0);
265
+ const hasShadow = anyTarget((item) => item.boxShadow !== 'none');
266
+ const isFlex = Boolean(styles?.display.includes('flex'));
267
+ const isGrid = Boolean(styles?.display.includes('grid'));
268
+ const padding = {
269
+ id: 'padding',
270
+ title: t('style.padding'),
271
+ glyph: 'pad',
272
+ property: 'padding',
273
+ properties: ['padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left'],
274
+ bindings: ['padding', 'padding-top', 'padding-inline', 'padding-block'],
275
+ key: 'padding',
276
+ kind: 'space',
277
+ numeric: true,
278
+ sides: {
279
+ names: [t('inspect.side.top'), t('inspect.side.right'), t('inspect.side.bottom'), t('inspect.side.left')],
280
+ title: t('inspect.sides'),
281
+ },
282
+ };
283
+ const gap = {
284
+ id: 'gap',
285
+ title: t('style.gap'),
286
+ glyph: 'gap',
287
+ property: 'gap',
288
+ properties: ['gap', 'row-gap', 'column-gap'],
289
+ key: 'gap',
290
+ kind: 'space',
291
+ numeric: true,
292
+ };
293
+ const radius = {
294
+ id: 'radius',
295
+ title: t('style.radius'),
296
+ glyph: 'radius',
297
+ property: 'border-radius',
298
+ bindings: ['border-radius'],
299
+ key: 'borderRadius',
300
+ kind: 'radius',
301
+ numeric: true,
302
+ sides: {
303
+ names: [
304
+ t('inspect.corner.topLeft'),
305
+ t('inspect.corner.topRight'),
306
+ t('inspect.corner.bottomRight'),
307
+ t('inspect.corner.bottomLeft'),
308
+ ],
309
+ title: t('inspect.corners'),
310
+ },
311
+ };
312
+ const opacity = {
313
+ id: 'opacity',
314
+ title: t('style.opacity'),
315
+ glyph: 'opacity',
316
+ property: 'opacity',
317
+ key: 'opacity',
318
+ kind: 'other',
319
+ numeric: true,
320
+ unit: '%',
321
+ toNumber: percent,
322
+ toCss: fromPercent,
323
+ };
324
+ const background = {
325
+ id: 'background',
326
+ title: t('style.fill'),
327
+ text: t('inspect.background'),
328
+ property: 'background-color',
329
+ bindings: ['background-color', 'background'],
330
+ key: 'backgroundColor',
331
+ kind: 'color',
332
+ };
333
+ const strokeColor = {
334
+ id: 'stroke-color',
335
+ title: t('style.borderColor'),
336
+ text: t('style.color'),
337
+ property: 'border-color',
338
+ bindings: ['border-color', 'border', 'border-top', 'border-bottom'],
339
+ key: 'borderColor',
340
+ kind: 'color',
341
+ };
342
+ const strokeWidth = {
343
+ id: 'stroke-width',
344
+ title: t('style.borderWidth'),
345
+ glyph: 'stroke',
346
+ property: 'border-width',
347
+ bindings: ['border-width', 'border'],
348
+ key: 'borderWidth',
349
+ kind: 'border-width',
350
+ numeric: true,
351
+ };
352
+ const shadow = {
353
+ id: 'shadow',
354
+ title: t('style.shadow'),
355
+ text: t('inspect.shadow'),
356
+ property: 'box-shadow',
357
+ key: 'boxShadow',
358
+ kind: 'shadow',
359
+ };
360
+ const textColor = {
361
+ id: 'color',
362
+ title: t('style.color'),
363
+ text: t('style.color'),
364
+ property: 'color',
365
+ key: 'color',
366
+ kind: 'color',
367
+ };
368
+ const fontSize = {
369
+ id: 'font-size',
370
+ title: t('style.fontSize'),
371
+ glyph: 'type',
372
+ property: 'font-size',
373
+ key: 'fontSize',
374
+ kind: 'font-size',
375
+ numeric: true,
376
+ };
377
+ const lineHeight = {
378
+ id: 'line-height',
379
+ title: t('style.lineHeight'),
380
+ glyph: 'lineHeight',
381
+ property: 'line-height',
382
+ key: 'lineHeight',
383
+ kind: 'line-height',
384
+ numeric: true,
385
+ };
386
+ const section = (key, heading, body, onAdd) => (_jsxs("section", { className: "ins-sec", children: [_jsxs("h4", { children: [heading, onAdd ? (_jsx("button", { className: "ins-add", title: t('inspect.addStyle'), type: "button", onClick: onAdd, children: "+" })) : null] }), body] }, key));
387
+ const colors = !multi ? node.colors ?? [] : [];
388
+ const literalColors = colors.filter((color) => !color.token);
389
+ const colorTokens = tokensOfKind(tokens, 'color');
390
+ const nearestColor = (color) => {
391
+ const suggestion = suggestToken('color', color.value, colorTokens, resolve);
392
+ return suggestion.type === 'none' ? null : suggestion.token;
393
+ };
394
+ const colorTarget = (color) => ({
395
+ frame: primary.frame,
396
+ node: { id: color.id, anchor: color.anchor, tag: '', name: color.label, path: color.path, html: '' },
397
+ });
398
+ const replaceable = literalColors
399
+ .map((color) => ({ color, token: nearestColor(color) }))
400
+ .filter((entry) => Boolean(entry.token));
401
+ const propertyLabel = (property) => property === 'color'
402
+ ? t('inspect.textColor')
403
+ : property === 'background-color'
404
+ ? t('inspect.background')
405
+ : t('inspect.strokeColor');
406
+ return (_jsxs("div", { className: "inspector", children: [header, styles ? (_jsxs("div", { className: "ins-body", children: [!pureText
407
+ ? section('layout', t('inspector.layout'), _jsxs(_Fragment, { children: [widthRow, heightRow, selectRow('display', t('style.display'), 'display', 'display', ['block', 'flex', 'grid', 'inline-flex', 'inline-block', 'none']), isFlex
408
+ ? segmentRow('direction', t('style.direction'), 'flexDirection', 'flex-direction', [
409
+ { value: 'row', glyph: 'row', title: t('inspect.direction.row') },
410
+ { value: 'column', glyph: 'column', title: t('inspect.direction.column') },
411
+ ])
412
+ : null, isFlex
413
+ ? segmentRow('justify', t('style.justify'), 'justifyContent', 'justify-content', [
414
+ { value: 'flex-start', glyph: 'justifyStart', title: t('inspect.justify.start') },
415
+ { value: 'center', glyph: 'justifyCenter', title: t('inspect.justify.center') },
416
+ { value: 'flex-end', glyph: 'justifyEnd', title: t('inspect.justify.end') },
417
+ { value: 'space-between', glyph: 'justifyBetween', title: t('inspect.justify.between') },
418
+ ], (value) => value === 'normal' || value === 'start' || value === 'left'
419
+ ? 'flex-start'
420
+ : value === 'end' || value === 'right'
421
+ ? 'flex-end'
422
+ : value)
423
+ : null, isFlex
424
+ ? segmentRow('align', t('style.align'), 'alignItems', 'align-items', [
425
+ { value: 'stretch', glyph: 'itemsStretch', title: t('inspect.items.stretch') },
426
+ { value: 'flex-start', glyph: 'itemsStart', title: t('inspect.items.start') },
427
+ { value: 'center', glyph: 'itemsCenter', title: t('inspect.items.center') },
428
+ { value: 'flex-end', glyph: 'itemsEnd', title: t('inspect.items.end') },
429
+ { value: 'baseline', glyph: 'itemsBaseline', title: t('inspect.items.baseline') },
430
+ ], (value) => value === 'normal'
431
+ ? 'stretch'
432
+ : value === 'start' || value === 'self-start'
433
+ ? 'flex-start'
434
+ : value === 'end' || value === 'self-end'
435
+ ? 'flex-end'
436
+ : value)
437
+ : null, row(padding), isFlex || isGrid ? row(gap) : null] }))
438
+ : null, !pureText
439
+ ? section('appearance', t('inspector.appearance'), _jsxs(_Fragment, { children: [row(radius), row(opacity)] }))
440
+ : null, !pureText
441
+ ? section('fill', t('inspector.fill'), hasFill ? row(background) : null, hasFill ? undefined : () => onEdit([{ property: 'background-color', value: '#ffffff' }]))
442
+ : null, !pureText
443
+ ? section('stroke', t('inspector.stroke'), hasStroke ? (_jsxs(_Fragment, { children: [row(strokeColor), row(strokeWidth)] })) : null, hasStroke
444
+ ? undefined
445
+ : () => onEdit([
446
+ { property: 'border-width', value: '1px' },
447
+ { property: 'border-style', value: 'solid' },
448
+ { property: 'border-color', value: styles.color },
449
+ ]))
450
+ : null, !pureText
451
+ ? section('effects', t('inspector.effects'), hasShadow ? row(shadow) : null, hasShadow
452
+ ? undefined
453
+ : () => onEdit([{ property: 'box-shadow', value: '0px 2px 8px rgba(0, 0, 0, 0.12)' }]))
454
+ : null, hasText
455
+ ? section('text', t('inspector.typography'), _jsxs(_Fragment, { children: [row(textColor), row(fontSize), row(lineHeight), selectRow('weight', t('style.fontWeight'), 'fontWeight', 'font-weight', [
456
+ '300', '400', '500', '600', '700', '800',
457
+ ]), segmentRow('text-align', t('style.textAlign'), 'textAlign', 'text-align', [
458
+ { value: 'left', glyph: 'alignLeft', title: t('inspect.align.left') },
459
+ { value: 'center', glyph: 'alignCenter', title: t('inspect.align.center') },
460
+ { value: 'right', glyph: 'alignRight', title: t('inspect.align.right') },
461
+ ])] }))
462
+ : null, colors.length ? (_jsxs("section", { className: "ins-sec", children: [_jsxs("h4", { children: [t('inspect.selectionColors'), _jsx("span", { className: "ins-muted", children: t('inspect.selectionColorsCount', { count: colors.length, literal: literalColors.length }) })] }), colors.map((color) => {
463
+ const token = tokenByName(color.token);
464
+ const near = token ? null : nearestColor(color);
465
+ const cross = token && componentName ? semanticFor(token, tokens) : null;
466
+ return (_jsxs("div", { className: "ins-color", children: [_jsx("span", { className: "combo-swatch", style: { background: color.value } }), token ? (_jsx("code", { className: cross ? 'ins-tok is-cross' : 'ins-tok', children: tokenPath(token) })) : (_jsx("code", { className: "ins-lit", children: toHex(color.value) })), _jsxs("span", { className: "ins-color-label", title: color.path, children: [color.label, " \u00B7 ", propertyLabel(color.property)] }), near ? (_jsxs("button", { className: "ins-link", title: t('inspect.replaceWith', { token: tokenPath(near) }), type: "button", onClick: () => onEdit([{ property: color.property, value: `var(${near.name})`, token: near.name, from: color.value }], [colorTarget(color)]), children: ["\u2192 ", tokenPath(near)] })) : null] }, `${color.path}|${color.property}`));
467
+ }), replaceable.length ? (_jsx("button", { className: "ins-fix-action is-primary is-block", type: "button", onClick: () => {
468
+ for (const { color, token } of replaceable) {
469
+ onEdit([{ property: color.property, value: `var(${token.name})`, token: token.name, from: color.value }], [colorTarget(color)]);
470
+ }
471
+ }, children: t('inspect.replaceAll') })) : null] })) : null, variants.length ? (_jsxs("section", { className: "ins-sec", children: [_jsxs("h4", { children: [t('inspect.variants'), _jsx("span", { className: "ins-muted", children: t('inspect.variantsHint') })] }), _jsx("div", { className: "ins-variant", children: _jsxs("span", { children: [_jsx("b", { children: t('inspect.current') }), " ", _jsxs("span", { className: "ins-muted", children: ["\u00B7 ", t('inspect.draftShort', { count: frameDraftCount })] })] }) }), variants.map((item) => (_jsxs("div", { className: "ins-variant", children: [_jsxs("span", { children: [item.name, " ", _jsxs("span", { className: "ins-muted", children: ["\u00B7 ", t('inspect.draftShort', { count: item.changes })] })] }), _jsx("button", { className: "ins-link", type: "button", onClick: () => onUseVariant(item.key), children: t('inspect.useVariant') })] }, item.key)))] })) : null, node.free && !multi ? (_jsxs("section", { className: "ins-sec", children: [_jsx("h4", { children: t('inspector.free') }), _jsx("div", { className: "free-grid", children: ['x', 'y', 'width', 'height'].map((key) => {
472
+ const base = node.freeRect ?? node.rect ?? { x: 0, y: 0, width: 0, height: 0 };
473
+ const text = key === 'x'
474
+ ? t('inspector.freeX')
475
+ : key === 'y'
476
+ ? t('inspector.freeY')
477
+ : key === 'width'
478
+ ? t('inspector.freeW')
479
+ : t('inspector.freeH');
480
+ return (_jsxs("label", { children: [_jsx("span", { children: text }), _jsx(NumberInput, { label: text, value: Math.round(base[key]), onChange: (next) => onFreeRect({ ...base, [key]: next }) })] }, key));
481
+ }) }), _jsx("p", { className: "ins-note", children: t('inspector.freeHint') })] })) : null] })) : null, _jsx(PromoteToken, { open: Boolean(promote), target: promote, tokens: tokens, onOpenChange: (open) => {
482
+ if (!open)
483
+ setPromote(null);
484
+ }, onCreate: (target, draft) => {
485
+ onCreateToken(target, draft);
486
+ setPromote(null);
487
+ } }), _jsx(PromoteComponent, { open: promoteComponent, source: extractSource, dirs: componentDirs, taken: takenComponentNames ?? names, onOpenChange: setPromoteComponent, onCreate: (draft) => {
488
+ onPromoteComponent?.(primary, draft);
489
+ setPromoteComponent(false);
490
+ } })] }));
491
+ }
492
+ function SideInput({ value, onCommit }) {
493
+ const [text, setText] = useState(null);
494
+ const commit = (raw) => {
495
+ const number = Number.parseFloat(raw);
496
+ setText(null);
497
+ if (Number.isFinite(number) && number !== value)
498
+ onCommit(Math.max(0, number));
499
+ };
500
+ return (_jsx("input", { className: "field-side-input", inputMode: "decimal", value: text ?? String(value), onBlur: (event) => commit(event.target.value), onChange: (event) => setText(event.target.value), onKeyDown: (event) => {
501
+ if (event.key === 'Enter')
502
+ commit(event.currentTarget.value);
503
+ if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
504
+ event.preventDefault();
505
+ const step = (event.shiftKey ? 10 : 1) * (event.key === 'ArrowUp' ? 1 : -1);
506
+ onCommit(Math.max(0, value + step));
507
+ }
508
+ } }));
509
+ }
510
+ //# sourceMappingURL=Inspector.js.map