@1agh/maude 1.9.1 → 2.0.0-rc.1

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 (1986) hide show
  1. package/README.md +4 -4
  2. package/apps/hub/src/project-transactions/baseline.mjs +276 -0
  3. package/apps/hub/src/project-transactions/kernel.mjs +1756 -0
  4. package/apps/hub/src/project-transactions/lanes.mjs +287 -0
  5. package/apps/hub/src/project-transactions/runs-core.mjs +639 -0
  6. package/apps/hub/src/project-transactions/store-core.mjs +831 -0
  7. package/apps/studio/access/closure.ts +1075 -0
  8. package/apps/studio/access/filters.ts +1193 -0
  9. package/apps/studio/access/frame.ts +365 -0
  10. package/apps/studio/access/known-canvases.ts +82 -0
  11. package/apps/studio/access/request.ts +637 -0
  12. package/apps/studio/access/roles.ts +187 -0
  13. package/apps/studio/access/scope.ts +407 -0
  14. package/apps/studio/access/share-map.ts +434 -0
  15. package/apps/studio/acp/adapter-stderr.ts +22 -0
  16. package/apps/studio/acp/agent-path.ts +39 -0
  17. package/apps/studio/acp/ask-queue.ts +238 -0
  18. package/apps/studio/acp/audience.ts +615 -0
  19. package/apps/studio/acp/bootstrap-brief.ts +32 -15
  20. package/apps/studio/acp/bridge.ts +890 -114
  21. package/apps/studio/acp/chat-search.ts +195 -0
  22. package/apps/studio/acp/connected-fact.ts +83 -0
  23. package/apps/studio/acp/design-write-verb.ts +71 -0
  24. package/apps/studio/acp/env.ts +86 -0
  25. package/apps/studio/acp/index.ts +775 -58
  26. package/apps/studio/acp/login-state.ts +15 -1
  27. package/apps/studio/acp/may-scope.ts +771 -0
  28. package/apps/studio/acp/plugin-bootstrap.ts +90 -5
  29. package/apps/studio/acp/probe.ts +18 -4
  30. package/apps/studio/acp/repo-private.ts +73 -0
  31. package/apps/studio/acp/running.ts +50 -5
  32. package/apps/studio/acp/transcript.ts +356 -21
  33. package/apps/studio/acp/write-scope.ts +141 -11
  34. package/apps/studio/actions/agents.ts +2068 -0
  35. package/apps/studio/actions/canvas-keys.ts +41 -0
  36. package/apps/studio/actions/ctx.ts +118 -0
  37. package/apps/studio/actions/defs/_v1.ts +55 -0
  38. package/apps/studio/actions/defs/ai-runs.ts +56 -0
  39. package/apps/studio/actions/defs/annotation.ts +164 -0
  40. package/apps/studio/actions/defs/app.ts +269 -0
  41. package/apps/studio/actions/defs/canvas.ts +281 -0
  42. package/apps/studio/actions/defs/chat.ts +158 -0
  43. package/apps/studio/actions/defs/diagnostics.ts +52 -0
  44. package/apps/studio/actions/defs/ds.ts +139 -0
  45. package/apps/studio/actions/defs/edit.ts +986 -0
  46. package/apps/studio/actions/defs/export.ts +221 -0
  47. package/apps/studio/actions/defs/history.ts +175 -0
  48. package/apps/studio/actions/defs/native.ts +264 -0
  49. package/apps/studio/actions/defs/presence.ts +53 -0
  50. package/apps/studio/actions/defs/search.ts +90 -0
  51. package/apps/studio/actions/defs/sync.ts +47 -0
  52. package/apps/studio/actions/defs/timeline.ts +254 -0
  53. package/apps/studio/actions/defs/tool.ts +152 -0
  54. package/apps/studio/actions/defs/ui.ts +38 -0
  55. package/apps/studio/actions/defs/video.ts +115 -0
  56. package/apps/studio/actions/defs/view.ts +556 -0
  57. package/apps/studio/actions/documents.ts +32 -0
  58. package/apps/studio/actions/forward.ts +48 -0
  59. package/apps/studio/actions/help.ts +115 -0
  60. package/apps/studio/actions/index.ts +51 -0
  61. package/apps/studio/actions/keymap.gen.ts +1170 -0
  62. package/apps/studio/actions/keys.ts +271 -0
  63. package/apps/studio/actions/legacy.ts +250 -0
  64. package/apps/studio/actions/manifest-version.ts +18 -0
  65. package/apps/studio/actions/menu.ts +203 -0
  66. package/apps/studio/actions/native-menu.ts +132 -0
  67. package/apps/studio/actions/resolve.ts +118 -0
  68. package/apps/studio/actions/types.ts +266 -0
  69. package/apps/studio/actions/uniqueness.ts +119 -0
  70. package/apps/studio/actions/verbs.ts +306 -0
  71. package/apps/studio/actions.manifest.json +7826 -0
  72. package/apps/studio/actions.parity.json +268 -0
  73. package/apps/studio/activity.ts +4 -31
  74. package/apps/studio/agent-runs.ts +676 -0
  75. package/apps/studio/ai/attach-grants.ts +497 -0
  76. package/apps/studio/ai/copy-meta.ts +204 -0
  77. package/apps/studio/ai/create-claim.ts +88 -0
  78. package/apps/studio/ai/lease-home.ts +202 -0
  79. package/apps/studio/ai/run-doing.ts +106 -0
  80. package/apps/studio/ai/run-lifecycle.ts +320 -0
  81. package/apps/studio/ai/run-progress.ts +154 -0
  82. package/apps/studio/ai/runs.ts +1180 -0
  83. package/apps/studio/ai/save-hold.ts +565 -0
  84. package/apps/studio/ai/watch-progress.ts +182 -0
  85. package/apps/studio/ai/write-claim-scope.ts +39 -0
  86. package/apps/studio/ai/write-claim.ts +193 -0
  87. package/apps/studio/ai-banner.tsx +8 -14
  88. package/apps/studio/annotations/ai-read.ts +289 -1
  89. package/apps/studio/annotations/ai-write.ts +281 -23
  90. package/apps/studio/annotations/artboard-members.ts +86 -0
  91. package/apps/studio/annotations/board-ops.ts +358 -0
  92. package/apps/studio/annotations/board-schema.ts +81 -0
  93. package/apps/studio/annotations/constants.ts +2 -0
  94. package/apps/studio/annotations/elements/_shared.ts +290 -1
  95. package/apps/studio/annotations/elements/arrow.model.ts +29 -2
  96. package/apps/studio/annotations/elements/ballot.model.ts +110 -0
  97. package/apps/studio/annotations/elements/media.model.ts +11 -1
  98. package/apps/studio/annotations/elements/section.model.ts +3 -1
  99. package/apps/studio/annotations/elements/stamp.model.ts +83 -0
  100. package/apps/studio/annotations/elements/sticky.model.ts +235 -0
  101. package/apps/studio/annotations/elements/vote.model.ts +71 -0
  102. package/apps/studio/annotations/fields.ts +51 -0
  103. package/apps/studio/annotations/figjam-into.ts +119 -0
  104. package/apps/studio/annotations/hosts.ts +231 -0
  105. package/apps/studio/annotations/migrate-v1.ts +21 -2
  106. package/apps/studio/annotations/ops.ts +23 -0
  107. package/apps/studio/annotations/registry.ts +154 -16
  108. package/apps/studio/annotations/route.ts +268 -0
  109. package/apps/studio/annotations/run-tag.ts +150 -0
  110. package/apps/studio/annotations/stamp-kinds.ts +66 -0
  111. package/apps/studio/annotations/templates.ts +154 -0
  112. package/apps/studio/annotations/text-steps.ts +253 -0
  113. package/apps/studio/annotations/time-marks.ts +140 -0
  114. package/apps/studio/annotations/types.ts +22 -0
  115. package/apps/studio/annotations/ui/ai-marks.tsx +64 -0
  116. package/apps/studio/annotations/ui/ai-seen.tsx +117 -0
  117. package/apps/studio/annotations/ui/arrow-bind.ts +347 -0
  118. package/apps/studio/annotations/ui/arrow-cards.tsx +396 -0
  119. package/apps/studio/annotations/ui/arrow-kinds.ts +90 -0
  120. package/apps/studio/annotations/ui/bar-place.ts +18 -0
  121. package/apps/studio/annotations/ui/element-node.tsx +300 -52
  122. package/apps/studio/annotations/ui/host-view.ts +99 -0
  123. package/apps/studio/annotations/ui/locked.tsx +83 -0
  124. package/apps/studio/annotations/ui/lod.tsx +246 -0
  125. package/apps/studio/annotations/ui/placement.tsx +270 -0
  126. package/apps/studio/annotations/ui/pointer-pipeline.ts +10 -0
  127. package/apps/studio/annotations/ui/posture.ts +124 -0
  128. package/apps/studio/annotations/ui/quiet-tip.ts +28 -0
  129. package/apps/studio/annotations/ui/render-model.ts +27 -2
  130. package/apps/studio/annotations/ui/rest-route.ts +152 -0
  131. package/apps/studio/annotations/ui/ride.ts +957 -0
  132. package/apps/studio/annotations/ui/scene.tsx +59 -11
  133. package/apps/studio/annotations/ui/section-fold.ts +95 -0
  134. package/apps/studio/annotations/ui/shell-asks.ts +62 -0
  135. package/apps/studio/annotations/ui/stamps.ts +221 -0
  136. package/apps/studio/annotations/ui/stamps.tsx +272 -0
  137. package/apps/studio/annotations/ui/sticker-drop.ts +147 -0
  138. package/apps/studio/annotations/ui/sticker-preview.ts +41 -0
  139. package/apps/studio/annotations/ui/sticky-resolve.ts +106 -0
  140. package/apps/studio/annotations/ui/template-place.ts +108 -0
  141. package/apps/studio/annotations/ui/text-editor.tsx +6 -4
  142. package/apps/studio/annotations/ui/text-session.ts +63 -1
  143. package/apps/studio/annotations/ui/text-style.ts +11 -3
  144. package/apps/studio/annotations/ui/time-pins.tsx +134 -0
  145. package/apps/studio/annotations/ui/tool-prefs.ts +242 -0
  146. package/apps/studio/annotations/ui/tool-state.ts +211 -0
  147. package/apps/studio/annotations/ui/visibility.ts +76 -0
  148. package/apps/studio/annotations/ui/vote-dots.tsx +283 -0
  149. package/apps/studio/annotations/v1-adapter.ts +88 -5
  150. package/apps/studio/annotations/validate-board.ts +257 -0
  151. package/apps/studio/annotations/vote-guard.ts +48 -0
  152. package/apps/studio/annotations/votes-local.ts +481 -0
  153. package/apps/studio/annotations-bindings.ts +54 -8
  154. package/apps/studio/annotations-context-toolbar.tsx +612 -150
  155. package/apps/studio/annotations-layer.tsx +1768 -674
  156. package/apps/studio/annotations-model.ts +80 -5
  157. package/apps/studio/api.ts +1522 -454
  158. package/apps/studio/artboard-activity-overlay.tsx +530 -3
  159. package/apps/studio/artboard-ai-copies.tsx +187 -0
  160. package/apps/studio/artboard-convert-marks.tsx +142 -0
  161. package/apps/studio/artboard-gap-mark.tsx +177 -0
  162. package/apps/studio/artboard-ghosts-overlay.tsx +106 -0
  163. package/apps/studio/artboard-growth-memory.ts +56 -0
  164. package/apps/studio/artboard-growth-tag.tsx +115 -0
  165. package/apps/studio/artboard-guides-overlay.tsx +86 -26
  166. package/apps/studio/artboard-marquee.tsx +21 -6
  167. package/apps/studio/artboard-new-section.tsx +188 -0
  168. package/apps/studio/artboard-warn-mark.tsx +330 -0
  169. package/apps/studio/asset-details.ts +339 -0
  170. package/apps/studio/asset-generated.ts +99 -0
  171. package/apps/studio/asset-origins.ts +147 -0
  172. package/apps/studio/asset-placeholder.tsx +481 -0
  173. package/apps/studio/asset-rename.ts +171 -0
  174. package/apps/studio/asset-trash.ts +176 -0
  175. package/apps/studio/asset-upload-bars.tsx +167 -0
  176. package/apps/studio/asset-upload.ts +145 -1
  177. package/apps/studio/attribute-artboards.ts +327 -0
  178. package/apps/studio/bin/_ab-headless.sh +35 -0
  179. package/apps/studio/bin/_ab-park.sh +83 -0
  180. package/apps/studio/bin/_agent-browser-safe.mjs +36 -3
  181. package/apps/studio/bin/_annotate-post.mjs +137 -0
  182. package/apps/studio/bin/_assets.mjs +213 -0
  183. package/apps/studio/bin/_brand-colours.mjs +189 -0
  184. package/apps/studio/bin/_brand-fonts.mjs +158 -0
  185. package/apps/studio/bin/_brand-site.mjs +309 -0
  186. package/apps/studio/bin/_canvas-errors.mjs +143 -0
  187. package/apps/studio/bin/_canvas-rects-playwright.mjs +6 -3
  188. package/apps/studio/bin/_canvas-rects-static.mjs +1 -1
  189. package/apps/studio/bin/_check.mjs +122 -0
  190. package/apps/studio/bin/_comments.mjs +274 -0
  191. package/apps/studio/bin/_curl-local.mjs +122 -3
  192. package/apps/studio/bin/_decode-webaudio.mjs +120 -0
  193. package/apps/studio/bin/_describe.mjs +220 -0
  194. package/apps/studio/bin/_ds-check.mjs +26 -0
  195. package/apps/studio/bin/_ds-prove-playwright.mjs +327 -0
  196. package/apps/studio/bin/_ds-upgrade.mjs +14 -0
  197. package/apps/studio/bin/_ds.mjs +82 -0
  198. package/apps/studio/bin/_enumerate-artboards-playwright.mjs +6 -3
  199. package/apps/studio/bin/_exports.mjs +244 -0
  200. package/apps/studio/bin/_fetch-asset.mjs +209 -15
  201. package/apps/studio/bin/_history.mjs +509 -0
  202. package/apps/studio/bin/_html-playwright.mjs +10 -3
  203. package/apps/studio/bin/_import-asset.mjs +446 -15
  204. package/apps/studio/bin/_import-brand.mjs +40 -156
  205. package/apps/studio/bin/_import-figma.mjs +878 -20
  206. package/apps/studio/bin/_import-tokens.mjs +8 -118
  207. package/apps/studio/bin/_index-cli.mjs +126 -0
  208. package/apps/studio/bin/_layout-check.mjs +35 -0
  209. package/apps/studio/bin/_logs.mjs +130 -0
  210. package/apps/studio/bin/_motion-sample-playwright.mjs +6 -3
  211. package/apps/studio/bin/_no-egress.sh +36 -0
  212. package/apps/studio/bin/_pdf-playwright.mjs +9 -3
  213. package/apps/studio/bin/_perf-probe-safari.mjs +327 -37
  214. package/apps/studio/bin/_perf-probe-studio.mjs +259 -0
  215. package/apps/studio/bin/_perf-probe.mjs +35 -1
  216. package/apps/studio/bin/_perf-shared.mjs +377 -12
  217. package/apps/studio/bin/_place.mjs +35 -0
  218. package/apps/studio/bin/_png-playwright.mjs +27 -7
  219. package/apps/studio/bin/_pptx-playwright.mjs +4 -3
  220. package/apps/studio/bin/_pw-launch.mjs +124 -2
  221. package/apps/studio/bin/_record-shot.sh +65 -0
  222. package/apps/studio/bin/_rects-input.mjs +69 -0
  223. package/apps/studio/bin/_reel-place.mjs +160 -0
  224. package/apps/studio/bin/_region.mjs +37 -1
  225. package/apps/studio/bin/_runs.mjs +178 -0
  226. package/apps/studio/bin/_screenshot-playwright.mjs +6 -3
  227. package/apps/studio/bin/_studio-verb.mjs +220 -0
  228. package/apps/studio/bin/_svg-playwright.mjs +4 -3
  229. package/apps/studio/bin/_sync.mjs +179 -0
  230. package/apps/studio/bin/_thumbs-playwright.mjs +704 -0
  231. package/apps/studio/bin/_tile-draw.mjs +74 -0
  232. package/apps/studio/bin/_transcribe-local.mjs +243 -0
  233. package/apps/studio/bin/_transcribe.mjs +48 -56
  234. package/apps/studio/bin/_trash.mjs +287 -0
  235. package/apps/studio/bin/_url-guard.mjs +88 -0
  236. package/apps/studio/bin/_url-guard.sh +16 -0
  237. package/apps/studio/bin/_video-playwright.mjs +9 -3
  238. package/apps/studio/bin/_video-verbs.mjs +403 -0
  239. package/apps/studio/bin/_write-claim.mjs +124 -0
  240. package/apps/studio/bin/annotate.mjs +348 -330
  241. package/apps/studio/bin/assets.sh +28 -0
  242. package/apps/studio/bin/beats.mjs +237 -0
  243. package/apps/studio/bin/beats.sh +24 -0
  244. package/apps/studio/bin/bootstrap-check.sh +2 -1
  245. package/apps/studio/bin/canvas-edit.sh +17 -9
  246. package/apps/studio/bin/canvas-errors.sh +18 -0
  247. package/apps/studio/bin/canvas-rects.sh +14 -0
  248. package/apps/studio/bin/canvas-source.sh +18 -0
  249. package/apps/studio/bin/captions.sh +13 -0
  250. package/apps/studio/bin/chat-open.sh +2 -2
  251. package/apps/studio/bin/check.sh +27 -0
  252. package/apps/studio/bin/comments.sh +20 -0
  253. package/apps/studio/bin/cut-to-beat.sh +13 -0
  254. package/apps/studio/bin/cut-words.sh +13 -0
  255. package/apps/studio/bin/describe.sh +28 -0
  256. package/apps/studio/bin/draw-proof.sh +41 -8
  257. package/apps/studio/bin/ds-check.sh +30 -0
  258. package/apps/studio/bin/ds-upgrade.sh +30 -0
  259. package/apps/studio/bin/ds.sh +29 -0
  260. package/apps/studio/bin/exports.sh +19 -0
  261. package/apps/studio/bin/generate.sh +45 -3
  262. package/apps/studio/bin/handoff.sh +60 -1
  263. package/apps/studio/bin/history.sh +24 -0
  264. package/apps/studio/bin/import-brand.sh +5 -3
  265. package/apps/studio/bin/index.sh +26 -0
  266. package/apps/studio/bin/layout-check.sh +20 -0
  267. package/apps/studio/bin/logs.sh +17 -0
  268. package/apps/studio/bin/perf.sh +93 -3
  269. package/apps/studio/bin/photo-bg-remove.sh +49 -7
  270. package/apps/studio/bin/place.sh +20 -0
  271. package/apps/studio/bin/read-annotations.mjs +52 -1
  272. package/apps/studio/bin/reel-place.sh +15 -0
  273. package/apps/studio/bin/runs.sh +19 -0
  274. package/apps/studio/bin/screenshot.sh +37 -21
  275. package/apps/studio/bin/server-up.sh +50 -13
  276. package/apps/studio/bin/smoke.sh +10 -0
  277. package/apps/studio/bin/sync.sh +18 -0
  278. package/apps/studio/bin/to-lottie.sh +1 -1
  279. package/apps/studio/bin/transcribe-local.sh +27 -0
  280. package/apps/studio/bin/trash.sh +23 -0
  281. package/apps/studio/bin/visual-sanity.sh +1 -0
  282. package/apps/studio/bridge/canvas-mode-store.ts +301 -0
  283. package/apps/studio/bridge/canvas-modes.ts +548 -0
  284. package/apps/studio/bridge/dgn-protocol.ts +2671 -0
  285. package/apps/studio/bridge/esc-ladder.ts +98 -0
  286. package/apps/studio/bridge/link-target.ts +157 -0
  287. package/apps/studio/bridge/mode-shows.ts +167 -0
  288. package/apps/studio/bridge/occlusion.ts +108 -0
  289. package/apps/studio/bridge/paste-data.ts +101 -0
  290. package/apps/studio/build.ts +12 -1
  291. package/apps/studio/bunfig.toml +4 -0
  292. package/apps/studio/canvas-build-sandbox.ts +34 -5
  293. package/apps/studio/canvas-build-worker.ts +23 -1
  294. package/apps/studio/canvas-build.ts +419 -15
  295. package/apps/studio/canvas-comment-mount.tsx +113 -25
  296. package/apps/studio/canvas-create.ts +285 -49
  297. package/apps/studio/canvas-cursors.ts +12 -0
  298. package/apps/studio/canvas-ds-icons.tsx +241 -0
  299. package/apps/studio/canvas-edit.ts +1188 -172
  300. package/apps/studio/canvas-hud-tokens.gen.ts +120 -0
  301. package/apps/studio/canvas-icons.tsx +47 -0
  302. package/apps/studio/canvas-lib-inline.ts +57 -3
  303. package/apps/studio/canvas-lib.tsx +1033 -263
  304. package/apps/studio/canvas-list-watch.ts +73 -2
  305. package/apps/studio/canvas-meta.schema.json +11 -0
  306. package/apps/studio/canvas-notifications.tsx +28 -3
  307. package/apps/studio/canvas-pipeline.ts +43 -8
  308. package/apps/studio/canvas-replay-keys.ts +65 -0
  309. package/apps/studio/canvas-rows.ts +116 -0
  310. package/apps/studio/canvas-shell.tsx +784 -698
  311. package/apps/studio/canvas-source/errors.ts +315 -0
  312. package/apps/studio/canvas-source/source-map.ts +69 -0
  313. package/apps/studio/canvas-theme-pill.tsx +164 -0
  314. package/apps/studio/canvas-theme.ts +133 -0
  315. package/apps/studio/canvas-top-level.ts +69 -0
  316. package/apps/studio/check/ids.ts +28 -0
  317. package/apps/studio/check/index.ts +586 -0
  318. package/apps/studio/check/link-resolver.ts +75 -0
  319. package/apps/studio/check/meta.ts +79 -0
  320. package/apps/studio/check/video.ts +352 -0
  321. package/apps/studio/client/actions/shell-key-handlers.js +450 -0
  322. package/apps/studio/client/app.jsx +2914 -1203
  323. package/apps/studio/client/canvas-url.js +241 -5
  324. package/apps/studio/client/clipboard-relay.ts +144 -0
  325. package/apps/studio/client/command-palette-match.js +4 -2
  326. package/apps/studio/client/comments-overlay.css +529 -144
  327. package/apps/studio/client/dialogs/asset-picker.jsx +77 -32
  328. package/apps/studio/client/dialogs/command-palette.jsx +453 -67
  329. package/apps/studio/client/dialogs/export-dialog.jsx +6 -781
  330. package/apps/studio/client/dialogs/help-modal.jsx +31 -2
  331. package/apps/studio/client/dialogs/shortcuts-overlay.jsx +201 -106
  332. package/apps/studio/client/edit-op-relay.ts +77 -0
  333. package/apps/studio/client/embed-view.jsx +25 -5
  334. package/apps/studio/client/export-bridge-scope.js +72 -0
  335. package/apps/studio/client/export-center.jsx +179 -369
  336. package/apps/studio/client/export-lane.js +117 -0
  337. package/apps/studio/client/export-region.ts +25 -0
  338. package/apps/studio/client/file-tree.jsx +4 -4
  339. package/apps/studio/client/frame-cap.js +132 -0
  340. package/apps/studio/client/generate-dialog.jsx +38 -36
  341. package/apps/studio/client/github.js +85 -26
  342. package/apps/studio/client/home/HomeAsk.jsx +220 -0
  343. package/apps/studio/client/home/InviteSheet.jsx +150 -0
  344. package/apps/studio/client/home/Shelves.jsx +216 -0
  345. package/apps/studio/client/home/Starters.jsx +42 -0
  346. package/apps/studio/client/home/TargetChip.jsx +152 -0
  347. package/apps/studio/client/home/home-api.js +275 -0
  348. package/apps/studio/client/home/home-app.jsx +1884 -0
  349. package/apps/studio/client/home/home-icons.jsx +143 -0
  350. package/apps/studio/client/home/home-menu.js +43 -0
  351. package/apps/studio/client/home/home-model.js +514 -0
  352. package/apps/studio/client/home/home-starters.js +136 -0
  353. package/apps/studio/client/home/home.css +1681 -0
  354. package/apps/studio/client/home/invite-flow.js +422 -0
  355. package/apps/studio/client/home/shell-mode.js +49 -0
  356. package/apps/studio/client/hooks/annotations-hidden-toast.js +21 -0
  357. package/apps/studio/client/hooks/canvas-origin-probe.js +26 -0
  358. package/apps/studio/client/hooks/edit-scope-query.js +16 -0
  359. package/apps/studio/client/hooks/use-action-keys.jsx +121 -0
  360. package/apps/studio/client/hooks/use-canvas-bridge.jsx +881 -247
  361. package/apps/studio/client/hooks/use-git-actions.jsx +33 -12
  362. package/apps/studio/client/hooks/use-palette-and-panels.jsx +722 -287
  363. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +268 -307
  364. package/apps/studio/client/hooks/use-project-data.jsx +23 -2
  365. package/apps/studio/client/hooks/use-shell-core.jsx +582 -126
  366. package/apps/studio/client/hooks/use-tabs.jsx +268 -126
  367. package/apps/studio/client/index-loader.ts +3 -1
  368. package/apps/studio/client/inspector/color-picker.jsx +29 -18
  369. package/apps/studio/client/inspector/css-knobs.jsx +765 -436
  370. package/apps/studio/client/inspector/css-vocab.jsx +37 -4
  371. package/apps/studio/client/inspector/ds-tokens.js +127 -15
  372. package/apps/studio/client/inspector/grid-tracks-editor.jsx +21 -15
  373. package/apps/studio/client/inspector/inspect-computed.jsx +17 -15
  374. package/apps/studio/client/inspector/inspector-panel.jsx +314 -207
  375. package/apps/studio/client/inspector/layers.jsx +90 -65
  376. package/apps/studio/client/inspector/selection.js +20 -0
  377. package/apps/studio/client/inspector/token-popover.jsx +42 -28
  378. package/apps/studio/client/inspector-controls.jsx +453 -106
  379. package/apps/studio/client/panels/BrandUploadPanel.jsx +8 -229
  380. package/apps/studio/client/panels/ChatPanel.jsx +391 -1674
  381. package/apps/studio/client/panels/CloudBar.jsx +548 -252
  382. package/apps/studio/client/panels/CollabModelInfographic.jsx +77 -20
  383. package/apps/studio/client/panels/CreateProject.jsx +224 -40
  384. package/apps/studio/client/panels/DiffView.jsx +27 -10
  385. package/apps/studio/client/panels/ElicitationPrompt.jsx +4 -3
  386. package/apps/studio/client/panels/FigmaImportPanel.jsx +12 -263
  387. package/apps/studio/client/panels/IdentityBar.jsx +262 -74
  388. package/apps/studio/client/panels/IntroVideoDialog.jsx +6 -1
  389. package/apps/studio/client/panels/PermissionPrompt.jsx +85 -9
  390. package/apps/studio/client/panels/ReadinessList.jsx +71 -46
  391. package/apps/studio/client/panels/RepoBranchSwitcher.jsx +124 -745
  392. package/apps/studio/client/panels/SettingsPanel.jsx +492 -608
  393. package/apps/studio/client/panels/SetupChecklist.jsx +10 -3
  394. package/apps/studio/client/panels/SourceConflictPanel.jsx +96 -20
  395. package/apps/studio/client/panels/SyncConsentDialog.jsx +14 -13
  396. package/apps/studio/client/panels/TeamProjects.jsx +365 -119
  397. package/apps/studio/client/panels/ToolGroup.jsx +6 -2
  398. package/apps/studio/client/panels/acp-runtime.js +127 -22
  399. package/apps/studio/client/panels/acp-usage.js +4 -1
  400. package/apps/studio/client/panels/chat-context.js +74 -5
  401. package/apps/studio/client/panels/chat-header.jsx +67 -0
  402. package/apps/studio/client/panels/chat-markdown.jsx +6 -2
  403. package/apps/studio/client/panels/file-deep-link-dialog.jsx +88 -17
  404. package/apps/studio/client/panels/file-preview.jsx +50 -24
  405. package/apps/studio/client/panels/git-grouping.js +9 -2
  406. package/apps/studio/client/panels/slash-commands.gen.js +171 -0
  407. package/apps/studio/client/panels/slash-commands.js +65 -25
  408. package/apps/studio/client/panels/timeline-media-cache.js +68 -2
  409. package/apps/studio/client/panels/timeline-parse.js +62 -22
  410. package/apps/studio/client/panels/timeline-snap.js +4 -1
  411. package/apps/studio/client/panels/transcript-view.js +9 -0
  412. package/apps/studio/client/photo-knobs.jsx +225 -46
  413. package/apps/studio/client/prefs-migrate.js +79 -0
  414. package/apps/studio/client/report-bug.jsx +59 -26
  415. package/apps/studio/client/selection-scope.js +215 -0
  416. package/apps/studio/client/share-link.js +104 -8
  417. package/apps/studio/client/shell/account-tone.js +28 -0
  418. package/apps/studio/client/shell/banners.jsx +21 -188
  419. package/apps/studio/client/shell/comments-panel.jsx +5 -176
  420. package/apps/studio/client/shell/constants.js +1 -0
  421. package/apps/studio/client/shell/dock.jsx +217 -31
  422. package/apps/studio/client/shell/drop-guard.js +52 -0
  423. package/apps/studio/client/shell/icons.jsx +165 -23
  424. package/apps/studio/client/shell/util.js +20 -33
  425. package/apps/studio/client/shell/viewport.jsx +249 -95
  426. package/apps/studio/client/shell-bus.js +82 -0
  427. package/apps/studio/client/shell-events.js +251 -0
  428. package/apps/studio/client/stamp-follow.js +62 -0
  429. package/apps/studio/client/stores/shell-store.jsx +15 -0
  430. package/apps/studio/client/styles/0-reset.css +79 -16
  431. package/apps/studio/client/styles/1-tokens-maude-v2.css +367 -0
  432. package/apps/studio/client/styles/1-tokens-shell.css +374 -0
  433. package/apps/studio/client/styles/2-layout.css +404 -24
  434. package/apps/studio/client/styles/3-kit-maude-v2.css +683 -0
  435. package/apps/studio/client/styles/_index.css +183 -18
  436. package/apps/studio/client/system/system-view.jsx +52 -6
  437. package/apps/studio/client/tour/collab-tour.js +43 -38
  438. package/apps/studio/client/tour/overlay.jsx +61 -19
  439. package/apps/studio/client/tour/quick-setup-tour.js +27 -20
  440. package/apps/studio/client/tour/tour-model.js +36 -0
  441. package/apps/studio/client/tour/usage-tour.js +43 -24
  442. package/apps/studio/client/tree/tree.jsx +661 -409
  443. package/apps/studio/client/tree-expansion.js +5 -2
  444. package/apps/studio/client/tree-row-menu.jsx +43 -29
  445. package/apps/studio/client/ui-open.js +104 -0
  446. package/apps/studio/client/use-tree-drag.js +2 -0
  447. package/apps/studio/client/v2/access/access-card.jsx +54 -0
  448. package/apps/studio/client/v2/access/access-client.js +525 -0
  449. package/apps/studio/client/v2/access/access-host.jsx +328 -0
  450. package/apps/studio/client/v2/access/access.css +163 -0
  451. package/apps/studio/client/v2/access/ask-to-edit.jsx +97 -0
  452. package/apps/studio/client/v2/access/disabled-reason.js +50 -0
  453. package/apps/studio/client/v2/access/link-off-card.jsx +37 -0
  454. package/apps/studio/client/v2/access/trashed-banner.jsx +123 -0
  455. package/apps/studio/client/v2/advanced/where-matrix.js +231 -0
  456. package/apps/studio/client/v2/ai/AChip.jsx +158 -0
  457. package/apps/studio/client/v2/ai/Advanced.jsx +640 -0
  458. package/apps/studio/client/v2/ai/AiChatIsland.jsx +108 -0
  459. package/apps/studio/client/v2/ai/AskSelectionHost.jsx +173 -0
  460. package/apps/studio/client/v2/ai/AttachMenu.jsx +190 -0
  461. package/apps/studio/client/v2/ai/BigChat.jsx +195 -0
  462. package/apps/studio/client/v2/ai/ChatList.jsx +614 -0
  463. package/apps/studio/client/v2/ai/ChatUndo.jsx +164 -0
  464. package/apps/studio/client/v2/ai/ChoiceCard.jsx +178 -0
  465. package/apps/studio/client/v2/ai/Composer.jsx +655 -0
  466. package/apps/studio/client/v2/ai/ConnectSheet.jsx +118 -0
  467. package/apps/studio/client/v2/ai/Consent.jsx +66 -0
  468. package/apps/studio/client/v2/ai/DropOverlay.jsx +113 -0
  469. package/apps/studio/client/v2/ai/Feed.jsx +589 -0
  470. package/apps/studio/client/v2/ai/FoldNeeds.jsx +23 -0
  471. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +250 -0
  472. package/apps/studio/client/v2/ai/NotReady.jsx +110 -0
  473. package/apps/studio/client/v2/ai/OfferCard.jsx +165 -0
  474. package/apps/studio/client/v2/ai/PermissionCard.jsx +168 -0
  475. package/apps/studio/client/v2/ai/PickedShots.jsx +33 -0
  476. package/apps/studio/client/v2/ai/ProblemCard.jsx +41 -0
  477. package/apps/studio/client/v2/ai/QuitDialog.jsx +127 -0
  478. package/apps/studio/client/v2/ai/RawLog.jsx +68 -0
  479. package/apps/studio/client/v2/ai/Result.jsx +144 -0
  480. package/apps/studio/client/v2/ai/RunList.jsx +352 -0
  481. package/apps/studio/client/v2/ai/RunSurface.jsx +248 -0
  482. package/apps/studio/client/v2/ai/ScopeChip.jsx +239 -0
  483. package/apps/studio/client/v2/ai/SentStrip.jsx +70 -0
  484. package/apps/studio/client/v2/ai/StoppedDivider.jsx +84 -0
  485. package/apps/studio/client/v2/ai/Suggest.jsx +153 -0
  486. package/apps/studio/client/v2/ai/TurnResult.jsx +95 -0
  487. package/apps/studio/client/v2/ai/WaitingCard.jsx +133 -0
  488. package/apps/studio/client/v2/ai/WillChange.jsx +40 -0
  489. package/apps/studio/client/v2/ai/Working.jsx +74 -0
  490. package/apps/studio/client/v2/ai/advanced-handlers.js +56 -0
  491. package/apps/studio/client/v2/ai/advanced-model.js +214 -0
  492. package/apps/studio/client/v2/ai/ai-list-advanced.css +625 -0
  493. package/apps/studio/client/v2/ai/ai-may.js +75 -0
  494. package/apps/studio/client/v2/ai/ai-offer.js +178 -0
  495. package/apps/studio/client/v2/ai/ai-run.css +281 -0
  496. package/apps/studio/client/v2/ai/ai-send.js +164 -0
  497. package/apps/studio/client/v2/ai/ai.css +261 -0
  498. package/apps/studio/client/v2/ai/answer-note.js +44 -0
  499. package/apps/studio/client/v2/ai/ask-frame.js +131 -0
  500. package/apps/studio/client/v2/ai/ask-selection-lane.js +100 -0
  501. package/apps/studio/client/v2/ai/ask-selection.css +142 -0
  502. package/apps/studio/client/v2/ai/ask-selection.js +84 -0
  503. package/apps/studio/client/v2/ai/attach.css +366 -0
  504. package/apps/studio/client/v2/ai/attach.js +186 -0
  505. package/apps/studio/client/v2/ai/chat-list-model.js +333 -0
  506. package/apps/studio/client/v2/ai/chat-store-api.js +93 -0
  507. package/apps/studio/client/{styles/6-acp-chat.css → v2/ai/chat.css} +1152 -797
  508. package/apps/studio/client/v2/ai/connect-flow.js +75 -0
  509. package/apps/studio/client/v2/ai/gate-lines.js +121 -0
  510. package/apps/studio/client/v2/ai/icons.jsx +66 -0
  511. package/apps/studio/client/v2/ai/jump-model.js +61 -0
  512. package/apps/studio/client/v2/ai/made-by-ai.js +179 -0
  513. package/apps/studio/client/v2/ai/needs-you-store.js +112 -0
  514. package/apps/studio/client/v2/ai/needs-you-toast.js +104 -0
  515. package/apps/studio/client/v2/ai/needs-you.css +554 -0
  516. package/apps/studio/client/v2/ai/needs-you.js +391 -0
  517. package/apps/studio/client/v2/ai/panel-focus.js +71 -0
  518. package/apps/studio/client/v2/ai/panel.css +88 -0
  519. package/apps/studio/client/v2/ai/paste-chips.jsx +108 -0
  520. package/apps/studio/client/v2/ai/picked-shots.js +48 -0
  521. package/apps/studio/client/v2/ai/quit.css +64 -0
  522. package/apps/studio/client/v2/ai/result-shown.js +50 -0
  523. package/apps/studio/client/v2/ai/ring-relay.js +143 -0
  524. package/apps/studio/client/v2/ai/row-slots-lane.js +67 -0
  525. package/apps/studio/client/v2/ai/run-api.js +137 -0
  526. package/apps/studio/client/v2/ai/run-cards.js +31 -0
  527. package/apps/studio/client/v2/ai/run-compare.js +60 -0
  528. package/apps/studio/client/v2/ai/run-icons.jsx +53 -0
  529. package/apps/studio/client/v2/ai/run-model.js +348 -0
  530. package/apps/studio/client/v2/ai/runs-model.js +568 -0
  531. package/apps/studio/client/v2/ai/runs-store.js +161 -0
  532. package/apps/studio/client/v2/ai/runs.css +226 -0
  533. package/apps/studio/client/v2/ai/scope.js +298 -0
  534. package/apps/studio/client/v2/ai/seen-relay.js +95 -0
  535. package/apps/studio/client/v2/ai/sent-attachments.js +77 -0
  536. package/apps/studio/client/v2/ai/stopped.js +69 -0
  537. package/apps/studio/client/v2/ai/suggest-why.js +200 -0
  538. package/apps/studio/client/v2/ai/use-ai-scope.js +198 -0
  539. package/apps/studio/client/v2/ai/use-ask-ai.js +63 -0
  540. package/apps/studio/client/v2/ai/use-ask-selection.js +41 -0
  541. package/apps/studio/client/v2/ai/use-attachments.js +239 -0
  542. package/apps/studio/client/v2/ai/use-chat-runs.js +32 -0
  543. package/apps/studio/client/v2/ai/use-run-versions.js +39 -0
  544. package/apps/studio/client/v2/ai/video/ClipsAttached.jsx +23 -0
  545. package/apps/studio/client/v2/ai/video/LeftOut.jsx +29 -0
  546. package/apps/studio/client/v2/ai/video/WatchProgress.jsx +65 -0
  547. package/apps/studio/client/v2/ai/video/card-model.js +107 -0
  548. package/apps/studio/client/v2/ai/video/cards.jsx +51 -0
  549. package/apps/studio/client/v2/ai/video/clip-pic.js +12 -0
  550. package/apps/studio/client/v2/ai/video/video-cards.css +168 -0
  551. package/apps/studio/client/v2/annotations/annotation-asks.js +171 -0
  552. package/apps/studio/client/v2/annotations/annotation-list-model.js +238 -0
  553. package/apps/studio/client/v2/annotations/annotation-list.css +277 -0
  554. package/apps/studio/client/v2/annotations/annotation-list.jsx +433 -0
  555. package/apps/studio/client/v2/annotations/recent-stickers.js +64 -0
  556. package/apps/studio/client/v2/annotations/stamp-row.jsx +66 -0
  557. package/apps/studio/client/v2/annotations/stamps-glyphs.jsx +35 -0
  558. package/apps/studio/client/v2/annotations/sticker-preload.js +44 -0
  559. package/apps/studio/client/v2/annotations/sticker-search.js +155 -0
  560. package/apps/studio/client/v2/annotations/stickers-gallery.css +295 -0
  561. package/apps/studio/client/v2/annotations/stickers-gallery.jsx +454 -0
  562. package/apps/studio/client/v2/annotations/templates-panel.css +344 -0
  563. package/apps/studio/client/v2/annotations/templates-panel.jsx +240 -0
  564. package/apps/studio/client/v2/annotations/v2-scope.js +20 -0
  565. package/apps/studio/client/v2/annotations/vote-bar.jsx +212 -0
  566. package/apps/studio/client/v2/annotations/vote-sheet.jsx +200 -0
  567. package/apps/studio/client/v2/annotations/vote-store.js +392 -0
  568. package/apps/studio/client/v2/annotations/vote.css +153 -0
  569. package/apps/studio/client/v2/assets/ask-once.js +65 -0
  570. package/apps/studio/client/v2/assets/asset-drop-session.js +238 -0
  571. package/apps/studio/client/v2/assets/asset-state-lane.js +267 -0
  572. package/apps/studio/client/v2/assets/assets-bus.js +109 -0
  573. package/apps/studio/client/v2/assets/browse-model.js +90 -0
  574. package/apps/studio/client/v2/assets/browse-view.jsx +202 -0
  575. package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +114 -0
  576. package/apps/studio/client/v2/assets/connect-key-sheet.jsx +69 -0
  577. package/apps/studio/client/v2/assets/copy-asset.js +37 -0
  578. package/apps/studio/client/v2/assets/describe-client.js +156 -0
  579. package/apps/studio/client/v2/assets/describe-consent.jsx +184 -0
  580. package/apps/studio/client/v2/assets/describe.css +72 -0
  581. package/apps/studio/client/v2/assets/details-advanced.jsx +76 -0
  582. package/apps/studio/client/v2/assets/details-model.js +233 -0
  583. package/apps/studio/client/v2/assets/details.jsx +292 -0
  584. package/apps/studio/client/v2/assets/generate-ask.jsx +506 -0
  585. package/apps/studio/client/v2/assets/generated.js +83 -0
  586. package/apps/studio/client/v2/assets/import-lines.js +228 -0
  587. package/apps/studio/client/v2/assets/import-offline.js +32 -0
  588. package/apps/studio/client/v2/assets/import-toast.js +56 -0
  589. package/apps/studio/client/v2/assets/just-added.js +32 -0
  590. package/apps/studio/client/v2/assets/kinds-chip.jsx +77 -0
  591. package/apps/studio/client/v2/assets/library-foot.js +42 -0
  592. package/apps/studio/client/v2/assets/missing-frame.css +60 -0
  593. package/apps/studio/client/v2/assets/missing-frame.jsx +218 -0
  594. package/apps/studio/client/v2/assets/multi-select.js +58 -0
  595. package/apps/studio/client/v2/assets/place-asset.js +128 -0
  596. package/apps/studio/client/v2/assets/relink.js +96 -0
  597. package/apps/studio/client/v2/assets/rename-asset.js +83 -0
  598. package/apps/studio/client/v2/assets/search-marks.jsx +75 -0
  599. package/apps/studio/client/v2/assets/takes-overlay.jsx +86 -0
  600. package/apps/studio/client/v2/assets/takes.css +177 -0
  601. package/apps/studio/client/v2/assets/takes.js +224 -0
  602. package/apps/studio/client/v2/assets/tidy.jsx +144 -0
  603. package/apps/studio/client/v2/assets/tile-drag.js +53 -0
  604. package/apps/studio/client/v2/assets/tile-menu.jsx +119 -0
  605. package/apps/studio/client/v2/assets/tile.jsx +131 -0
  606. package/apps/studio/client/v2/assets/trash-assets.js +98 -0
  607. package/apps/studio/client/v2/assets/use-asset-details.js +58 -0
  608. package/apps/studio/client/v2/assets/use-assets.js +121 -0
  609. package/apps/studio/client/v2/assets/use-takes-lane.js +150 -0
  610. package/apps/studio/client/v2/canvases/canvas-icons.jsx +107 -0
  611. package/apps/studio/client/v2/canvases/canvases-panel.jsx +1466 -0
  612. package/apps/studio/client/v2/canvases/canvases.css +699 -0
  613. package/apps/studio/client/v2/canvases/covers.js +32 -0
  614. package/apps/studio/client/v2/canvases/inline-rename.jsx +122 -0
  615. package/apps/studio/client/v2/canvases/jump-list.jsx +100 -0
  616. package/apps/studio/client/v2/canvases/jump-model.js +102 -0
  617. package/apps/studio/client/v2/canvases/kept-on-this-mac.jsx +192 -0
  618. package/apps/studio/client/v2/canvases/last-canvas.js +36 -0
  619. package/apps/studio/client/v2/canvases/move-model.js +45 -0
  620. package/apps/studio/client/v2/canvases/move-sheet.jsx +91 -0
  621. package/apps/studio/client/v2/canvases/open-link.js +154 -0
  622. package/apps/studio/client/v2/canvases/panel-search.js +156 -0
  623. package/apps/studio/client/v2/canvases/rename-model.js +134 -0
  624. package/apps/studio/client/v2/canvases/row-menu.jsx +145 -0
  625. package/apps/studio/client/v2/canvases/row-slots.js +224 -0
  626. package/apps/studio/client/v2/canvases/sort.js +132 -0
  627. package/apps/studio/client/v2/canvases/support-model.js +68 -0
  628. package/apps/studio/client/v2/canvases/trash-canvas.js +120 -0
  629. package/apps/studio/client/v2/canvases/tree-model.js +760 -0
  630. package/apps/studio/client/v2/canvases/use-canvas-index.js +50 -0
  631. package/apps/studio/client/v2/canvases/use-canvases-sort.js +59 -0
  632. package/apps/studio/client/v2/canvases/use-move.js +61 -0
  633. package/apps/studio/client/v2/canvases/use-pins.js +80 -0
  634. package/apps/studio/client/v2/cloud/browser-door.js +152 -0
  635. package/apps/studio/client/v2/cloud/cloud-name.js +38 -0
  636. package/apps/studio/client/v2/code/canvas-error-card.jsx +407 -0
  637. package/apps/studio/client/v2/code/canvas-imports-card.jsx +31 -0
  638. package/apps/studio/client/v2/code/code-bus.js +63 -0
  639. package/apps/studio/client/v2/code/code-view.jsx +277 -0
  640. package/apps/studio/client/v2/code/code.css +373 -0
  641. package/apps/studio/client/v2/code/highlight.js +163 -0
  642. package/apps/studio/client/v2/code/use-canvas-source.js +338 -0
  643. package/apps/studio/client/v2/comments/comment-bridge.js +154 -0
  644. package/apps/studio/client/v2/comments/comment-client.js +84 -0
  645. package/apps/studio/client/v2/comments/comment-tool.js +18 -0
  646. package/apps/studio/client/v2/comments/comments-model.js +213 -0
  647. package/apps/studio/client/v2/comments/comments-panel.jsx +400 -0
  648. package/apps/studio/client/v2/comments/comments.css +305 -0
  649. package/apps/studio/client/v2/comments/mention-callouts.jsx +90 -0
  650. package/apps/studio/client/v2/comments/mention-model.js +118 -0
  651. package/apps/studio/client/v2/comments/native-mention-notice.js +73 -0
  652. package/apps/studio/client/v2/comments/reply-focus.js +30 -0
  653. package/apps/studio/client/v2/comments/use-comments-shell.jsx +176 -0
  654. package/apps/studio/client/v2/create/NameDialog.jsx +95 -0
  655. package/apps/studio/client/v2/create/NameDialogHost.jsx +141 -0
  656. package/apps/studio/client/v2/create/create-project.css +260 -0
  657. package/apps/studio/client/v2/create/duplicate-done.js +45 -0
  658. package/apps/studio/client/v2/create/empty-project.css +113 -0
  659. package/apps/studio/client/v2/create/empty-project.jsx +162 -0
  660. package/apps/studio/client/v2/create/first-draft.js +30 -0
  661. package/apps/studio/client/v2/create/intent-host.jsx +40 -0
  662. package/apps/studio/client/v2/create/name-dialog-bus.js +41 -0
  663. package/apps/studio/client/v2/create/name-dialog.css +36 -0
  664. package/apps/studio/client/v2/create/new-canvas.js +64 -0
  665. package/apps/studio/client/v2/create/open-sizes.js +41 -0
  666. package/apps/studio/client/v2/create/render-error.css +29 -0
  667. package/apps/studio/client/v2/create/render-error.jsx +107 -0
  668. package/apps/studio/client/v2/create/repair-offer.js +36 -0
  669. package/apps/studio/client/v2/create/take-intent.js +154 -0
  670. package/apps/studio/client/v2/create/use-project-empty.js +85 -0
  671. package/apps/studio/client/v2/create/use-render-error.js +116 -0
  672. package/apps/studio/client/v2/diagnostics/diagnostics-bus.js +47 -0
  673. package/apps/studio/client/v2/diagnostics/diagnostics-handlers.js +108 -0
  674. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +196 -0
  675. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +253 -0
  676. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +557 -0
  677. package/apps/studio/client/v2/diagnostics/diagnostics.css +612 -0
  678. package/apps/studio/client/v2/diagnostics/resync-model.js +51 -0
  679. package/apps/studio/client/v2/diagnostics/resync-run.js +79 -0
  680. package/apps/studio/client/v2/diagnostics/sync-actions.js +38 -0
  681. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +241 -0
  682. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +392 -0
  683. package/apps/studio/client/v2/diagnostics/use-diagnostics-menu.js +58 -0
  684. package/apps/studio/client/v2/ds/advanced-bus.js +40 -0
  685. package/apps/studio/client/v2/ds/advanced-host.jsx +228 -0
  686. package/apps/studio/client/v2/ds/advanced-model.js +110 -0
  687. package/apps/studio/client/v2/ds/advanced-store.js +47 -0
  688. package/apps/studio/client/v2/ds/advanced.css +277 -0
  689. package/apps/studio/client/v2/ds/advanced.jsx +203 -0
  690. package/apps/studio/client/v2/ds/check-card.jsx +80 -0
  691. package/apps/studio/client/v2/ds/colour-picker.jsx +121 -0
  692. package/apps/studio/client/v2/ds/colour-words.js +48 -0
  693. package/apps/studio/client/v2/ds/conflict-pick.jsx +151 -0
  694. package/apps/studio/client/v2/ds/contrast-warning.jsx +80 -0
  695. package/apps/studio/client/v2/ds/contrast.js +137 -0
  696. package/apps/studio/client/v2/ds/convert-dialog.jsx +133 -0
  697. package/apps/studio/client/v2/ds/convert-host.jsx +143 -0
  698. package/apps/studio/client/v2/ds/convert-model.js +221 -0
  699. package/apps/studio/client/v2/ds/default-write.js +69 -0
  700. package/apps/studio/client/v2/ds/direction-bar.jsx +287 -0
  701. package/apps/studio/client/v2/ds/door-write.js +163 -0
  702. package/apps/studio/client/v2/ds/edge-model.js +151 -0
  703. package/apps/studio/client/v2/ds/edge-write.js +91 -0
  704. package/apps/studio/client/v2/ds/edges.css +152 -0
  705. package/apps/studio/client/v2/ds/follower-swap.js +88 -0
  706. package/apps/studio/client/v2/ds/go-to.js +71 -0
  707. package/apps/studio/client/v2/ds/kinds/master.jsx +214 -0
  708. package/apps/studio/client/v2/ds/kinds/token.jsx +546 -0
  709. package/apps/studio/client/v2/ds/library-bus.js +43 -0
  710. package/apps/studio/client/v2/ds/library-card.jsx +379 -0
  711. package/apps/studio/client/v2/ds/library-host.jsx +436 -0
  712. package/apps/studio/client/v2/ds/library-model.js +305 -0
  713. package/apps/studio/client/v2/ds/library-store.js +45 -0
  714. package/apps/studio/client/v2/ds/library.css +148 -0
  715. package/apps/studio/client/v2/ds/make-host.jsx +244 -0
  716. package/apps/studio/client/v2/ds/make-model.js +208 -0
  717. package/apps/studio/client/v2/ds/make-sheet.jsx +264 -0
  718. package/apps/studio/client/v2/ds/make-write.js +90 -0
  719. package/apps/studio/client/v2/ds/make.css +242 -0
  720. package/apps/studio/client/v2/ds/master-write.js +145 -0
  721. package/apps/studio/client/v2/ds/new-canvas-default.js +89 -0
  722. package/apps/studio/client/v2/ds/off-system-host.jsx +107 -0
  723. package/apps/studio/client/v2/ds/off-system.jsx +101 -0
  724. package/apps/studio/client/v2/ds/outside-banner.jsx +153 -0
  725. package/apps/studio/client/v2/ds/pinned-rows.js +138 -0
  726. package/apps/studio/client/v2/ds/pins.js +102 -0
  727. package/apps/studio/client/v2/ds/preview-bar.jsx +220 -0
  728. package/apps/studio/client/v2/ds/preview-doors.js +47 -0
  729. package/apps/studio/client/v2/ds/preview-mode.js +163 -0
  730. package/apps/studio/client/v2/ds/reach-data.js +68 -0
  731. package/apps/studio/client/v2/ds/reach-model.js +184 -0
  732. package/apps/studio/client/v2/ds/reach-view.jsx +577 -0
  733. package/apps/studio/client/v2/ds/reach.css +298 -0
  734. package/apps/studio/client/v2/ds/rename-write.js +88 -0
  735. package/apps/studio/client/v2/ds/review-bus.js +41 -0
  736. package/apps/studio/client/v2/ds/review-host.jsx +438 -0
  737. package/apps/studio/client/v2/ds/review-model.js +307 -0
  738. package/apps/studio/client/v2/ds/review-sheet.jsx +390 -0
  739. package/apps/studio/client/v2/ds/review.css +894 -0
  740. package/apps/studio/client/v2/ds/row-dots.js +41 -0
  741. package/apps/studio/client/v2/ds/switch-bus.js +56 -0
  742. package/apps/studio/client/v2/ds/switch-host.jsx +241 -0
  743. package/apps/studio/client/v2/ds/switch-model.js +254 -0
  744. package/apps/studio/client/v2/ds/switch-sheet.jsx +364 -0
  745. package/apps/studio/client/v2/ds/switch.css +263 -0
  746. package/apps/studio/client/v2/ds/system-menu.jsx +81 -0
  747. package/apps/studio/client/v2/ds/system-rename.jsx +102 -0
  748. package/apps/studio/client/v2/ds/token-write.js +241 -0
  749. package/apps/studio/client/v2/ds/token.css +185 -0
  750. package/apps/studio/client/v2/ds/trash-token-sheet.jsx +112 -0
  751. package/apps/studio/client/v2/ds/truth-card.jsx +85 -0
  752. package/apps/studio/client/v2/ds/truth-host.jsx +239 -0
  753. package/apps/studio/client/v2/ds/truth-model.js +315 -0
  754. package/apps/studio/client/v2/ds/truth-store.js +45 -0
  755. package/apps/studio/client/v2/ds/truth.css +143 -0
  756. package/apps/studio/client/v2/ds/update-available.jsx +261 -0
  757. package/apps/studio/client/v2/ds/update-dots.js +103 -0
  758. package/apps/studio/client/v2/ds/update-model.js +295 -0
  759. package/apps/studio/client/v2/ds/upgrade-bus.js +40 -0
  760. package/apps/studio/client/v2/ds/upgrade-host.jsx +185 -0
  761. package/apps/studio/client/v2/ds/upgrade-model.js +266 -0
  762. package/apps/studio/client/v2/ds/upgrade-offers.js +34 -0
  763. package/apps/studio/client/v2/ds/upgrade-sheet.jsx +277 -0
  764. package/apps/studio/client/v2/ds/upgrade.css +166 -0
  765. package/apps/studio/client/v2/ds/use-covers.js +27 -0
  766. package/apps/studio/client/v2/ds/use-ds-frames.js +165 -0
  767. package/apps/studio/client/v2/ds/use-ds-model.js +61 -0
  768. package/apps/studio/client/v2/ds/use-ds-search.js +61 -0
  769. package/apps/studio/client/v2/ds/use-ds-state.js +65 -0
  770. package/apps/studio/client/v2/ds/uses-link.jsx +58 -0
  771. package/apps/studio/client/v2/empty/all-trashed-model.js +321 -0
  772. package/apps/studio/client/v2/empty/all-trashed-relay.js +65 -0
  773. package/apps/studio/client/v2/empty/all-trashed.jsx +229 -0
  774. package/apps/studio/client/v2/empty/arriving.jsx +180 -0
  775. package/apps/studio/client/v2/empty/artboard-hint.jsx +47 -0
  776. package/apps/studio/client/v2/empty/ask-button.jsx +35 -0
  777. package/apps/studio/client/v2/empty/confetti.jsx +46 -0
  778. package/apps/studio/client/v2/empty/empty-canvas.jsx +96 -0
  779. package/apps/studio/client/v2/empty/empty-copy.js +265 -0
  780. package/apps/studio/client/v2/empty/empty-hint-store.js +31 -0
  781. package/apps/studio/client/v2/empty/empty-host.jsx +168 -0
  782. package/apps/studio/client/v2/empty/empty.css +440 -0
  783. package/apps/studio/client/v2/empty/empty.jsx +162 -0
  784. package/apps/studio/client/v2/empty/fill-ask.js +22 -0
  785. package/apps/studio/client/v2/empty/free-centre.js +11 -0
  786. package/apps/studio/client/v2/empty/index.js +40 -0
  787. package/apps/studio/client/v2/empty/layers-empty.jsx +22 -0
  788. package/apps/studio/client/v2/empty/not-local.jsx +111 -0
  789. package/apps/studio/client/v2/empty/select-new-artboard.js +32 -0
  790. package/apps/studio/client/v2/empty/skeleton.jsx +51 -0
  791. package/apps/studio/client/v2/empty/spot-art.jsx +923 -0
  792. package/apps/studio/client/v2/empty/spot.jsx +96 -0
  793. package/apps/studio/client/v2/empty/suggestions.jsx +18 -0
  794. package/apps/studio/client/v2/empty/use-empty-canvas.js +251 -0
  795. package/apps/studio/client/v2/export/access-line.jsx +48 -0
  796. package/apps/studio/client/v2/export/advanced/advanced-copy.js +77 -0
  797. package/apps/studio/client/v2/export/advanced/advanced.css +252 -0
  798. package/apps/studio/client/v2/export/advanced/advanced.jsx +148 -0
  799. package/apps/studio/client/v2/export/advanced/command.js +128 -0
  800. package/apps/studio/client/v2/export/advanced/command.jsx +50 -0
  801. package/apps/studio/client/v2/export/advanced/fields.jsx +132 -0
  802. package/apps/studio/client/v2/export/advanced/image.jsx +124 -0
  803. package/apps/studio/client/v2/export/advanced/model.js +199 -0
  804. package/apps/studio/client/v2/export/advanced/names.jsx +65 -0
  805. package/apps/studio/client/v2/export/advanced/print.jsx +99 -0
  806. package/apps/studio/client/v2/export/advanced/render.jsx +63 -0
  807. package/apps/studio/client/v2/export/advanced/video.jsx +76 -0
  808. package/apps/studio/client/v2/export/annotations-policy.js +28 -0
  809. package/apps/studio/client/v2/export/cloud-queue.js +69 -0
  810. package/apps/studio/client/v2/export/copy-command.js +72 -0
  811. package/apps/studio/client/v2/export/copy-png.js +144 -0
  812. package/apps/studio/client/v2/export/done-toast.jsx +89 -0
  813. package/apps/studio/client/v2/export/edges.css +74 -0
  814. package/apps/studio/client/v2/export/export-copy.js +352 -0
  815. package/apps/studio/client/v2/export/export-sheet.jsx +804 -0
  816. package/apps/studio/client/v2/export/export-sizes.js +217 -0
  817. package/apps/studio/client/v2/export/export.css +832 -0
  818. package/apps/studio/client/v2/export/exports-model.js +383 -0
  819. package/apps/studio/client/v2/export/exports-panel.css +192 -0
  820. package/apps/studio/client/v2/export/exports-panel.jsx +164 -0
  821. package/apps/studio/client/v2/export/file-rows.jsx +84 -0
  822. package/apps/studio/client/v2/export/inspector-export.jsx +335 -0
  823. package/apps/studio/client/v2/export/job-row.jsx +358 -0
  824. package/apps/studio/client/v2/export/last-finished.js +34 -0
  825. package/apps/studio/client/v2/export/native-save.js +160 -0
  826. package/apps/studio/client/v2/export/other-formats.jsx +199 -0
  827. package/apps/studio/client/v2/export/parts.jsx +117 -0
  828. package/apps/studio/client/v2/export/preflight/fonts.js +27 -0
  829. package/apps/studio/client/v2/export/preflight/paper.jsx +177 -0
  830. package/apps/studio/client/v2/export/preflight/safe-margin.js +24 -0
  831. package/apps/studio/client/v2/export/preflight/use-preflight.js +74 -0
  832. package/apps/studio/client/v2/export/preview.jsx +79 -0
  833. package/apps/studio/client/v2/export/print.css +219 -0
  834. package/apps/studio/client/v2/export/run-export.js +177 -0
  835. package/apps/studio/client/v2/export/scope-bar.jsx +70 -0
  836. package/apps/studio/client/v2/export/sections/batch-model.js +224 -0
  837. package/apps/studio/client/v2/export/sections/batch.jsx +235 -0
  838. package/apps/studio/client/v2/export/sections/image.jsx +93 -0
  839. package/apps/studio/client/v2/export/sections/print-copy.js +41 -0
  840. package/apps/studio/client/v2/export/sections/print.jsx +285 -0
  841. package/apps/studio/client/v2/export/sections/render-row.jsx +81 -0
  842. package/apps/studio/client/v2/export/sections/version.jsx +176 -0
  843. package/apps/studio/client/v2/export/sections/video-copy.js +92 -0
  844. package/apps/studio/client/v2/export/sections/video-model.js +127 -0
  845. package/apps/studio/client/v2/export/sections/video.jsx +397 -0
  846. package/apps/studio/client/v2/export/sections/web.jsx +151 -0
  847. package/apps/studio/client/v2/export/share-hint.jsx +51 -0
  848. package/apps/studio/client/v2/export/use-export-spec.js +546 -0
  849. package/apps/studio/client/v2/export/video-content.js +75 -0
  850. package/apps/studio/client/v2/export/video.css +221 -0
  851. package/apps/studio/client/v2/fold/advanced-fold.jsx +96 -0
  852. package/apps/studio/client/v2/fold/fold-store.js +151 -0
  853. package/apps/studio/client/v2/fold/fold.css +59 -0
  854. package/apps/studio/client/v2/fold/use-fold.js +36 -0
  855. package/apps/studio/client/v2/handoff/edges.jsx +74 -0
  856. package/apps/studio/client/v2/handoff/handoff-sheet.jsx +469 -0
  857. package/apps/studio/client/v2/handoff/handoff.css +181 -0
  858. package/apps/studio/client/v2/handoff/ready-card.jsx +84 -0
  859. package/apps/studio/client/v2/handoff/targets.js +111 -0
  860. package/apps/studio/client/v2/help/add-guides.js +43 -0
  861. package/apps/studio/client/v2/help/help.css +995 -0
  862. package/apps/studio/client/v2/history/blame.js +161 -0
  863. package/apps/studio/client/v2/history/branch-actions.js +214 -0
  864. package/apps/studio/client/v2/history/change-list.jsx +102 -0
  865. package/apps/studio/client/v2/history/clear-band.js +144 -0
  866. package/apps/studio/client/v2/history/compare-store.js +80 -0
  867. package/apps/studio/client/v2/history/compare-view.jsx +318 -0
  868. package/apps/studio/client/v2/history/compare-words.js +8 -0
  869. package/apps/studio/client/v2/history/git-advanced.jsx +580 -0
  870. package/apps/studio/client/v2/history/git-io.js +58 -0
  871. package/apps/studio/client/v2/history/git-model.js +526 -0
  872. package/apps/studio/client/v2/history/git-parts.jsx +662 -0
  873. package/apps/studio/client/v2/history/history-host.jsx +78 -0
  874. package/apps/studio/client/v2/history/history-panel.jsx +599 -0
  875. package/apps/studio/client/v2/history/history.css +1477 -0
  876. package/apps/studio/client/v2/history/name-dialog.jsx +109 -0
  877. package/apps/studio/client/v2/history/object-filter.js +143 -0
  878. package/apps/studio/client/v2/history/object-history-ask.js +62 -0
  879. package/apps/studio/client/v2/history/object-view.jsx +236 -0
  880. package/apps/studio/client/v2/history/rows.ts +445 -0
  881. package/apps/studio/client/v2/history/use-versions.js +391 -0
  882. package/apps/studio/client/v2/history/view-bar.jsx +80 -0
  883. package/apps/studio/client/v2/import/brand-model.js +145 -0
  884. package/apps/studio/client/v2/import/brand-result.jsx +197 -0
  885. package/apps/studio/client/v2/import/brand-sheet.jsx +434 -0
  886. package/apps/studio/client/v2/import/brand.css +378 -0
  887. package/apps/studio/client/v2/import/figma-artboard.jsx +121 -0
  888. package/apps/studio/client/v2/import/figma-model.js +237 -0
  889. package/apps/studio/client/v2/import/figma-prefill.js +23 -0
  890. package/apps/studio/client/v2/import/figma-sheet.jsx +525 -0
  891. package/apps/studio/client/v2/import/figma-summary.jsx +62 -0
  892. package/apps/studio/client/v2/import/figma.css +179 -0
  893. package/apps/studio/client/v2/import/frame-picker.jsx +57 -0
  894. package/apps/studio/client/v2/inspect/inspect-host.jsx +53 -0
  895. package/apps/studio/client/v2/inspect/inspect-model.js +132 -0
  896. package/apps/studio/client/v2/inspect/inspect-panel.jsx +214 -0
  897. package/apps/studio/client/v2/inspect/inspect.css +87 -0
  898. package/apps/studio/client/v2/inspector/advanced-rows-default.jsx +773 -0
  899. package/apps/studio/client/v2/inspector/advanced-rows.js +106 -0
  900. package/apps/studio/client/v2/inspector/advanced.jsx +286 -0
  901. package/apps/studio/client/v2/inspector/blocks.js +57 -0
  902. package/apps/studio/client/v2/inspector/colour-groups.js +129 -0
  903. package/apps/studio/client/v2/inspector/component-picker.css +133 -0
  904. package/apps/studio/client/v2/inspector/component-picker.jsx +367 -0
  905. package/apps/studio/client/v2/inspector/crumbs.jsx +89 -0
  906. package/apps/studio/client/v2/inspector/css-text.js +179 -0
  907. package/apps/studio/client/v2/inspector/css-write.js +204 -0
  908. package/apps/studio/client/v2/inspector/element-code.js +39 -0
  909. package/apps/studio/client/v2/inspector/element-id.js +70 -0
  910. package/apps/studio/client/v2/inspector/formats-ui.js +101 -0
  911. package/apps/studio/client/v2/inspector/formats-write.js +60 -0
  912. package/apps/studio/client/v2/inspector/frame.jsx +336 -0
  913. package/apps/studio/client/v2/inspector/inspector-actions.js +60 -0
  914. package/apps/studio/client/v2/inspector/inspector.css +2872 -0
  915. package/apps/studio/client/v2/inspector/jsx-slice.js +219 -0
  916. package/apps/studio/client/v2/inspector/kinds/add-width.js +55 -0
  917. package/apps/studio/client/v2/inspector/kinds/artboard-advanced-rows.jsx +89 -0
  918. package/apps/studio/client/v2/inspector/kinds/artboard-advanced.jsx +62 -0
  919. package/apps/studio/client/v2/inspector/kinds/artboard-fixed.jsx +111 -0
  920. package/apps/studio/client/v2/inspector/kinds/artboard-kinds-model.js +171 -0
  921. package/apps/studio/client/v2/inspector/kinds/artboard-model.js +155 -0
  922. package/apps/studio/client/v2/inspector/kinds/artboard-multi.jsx +142 -0
  923. package/apps/studio/client/v2/inspector/kinds/artboard-print-advanced.jsx +210 -0
  924. package/apps/studio/client/v2/inspector/kinds/artboard-print-model.js +112 -0
  925. package/apps/studio/client/v2/inspector/kinds/artboard-print.jsx +268 -0
  926. package/apps/studio/client/v2/inspector/kinds/artboard-rows.jsx +124 -0
  927. package/apps/studio/client/v2/inspector/kinds/artboard-video.jsx +144 -0
  928. package/apps/studio/client/v2/inspector/kinds/artboard-web.jsx +170 -0
  929. package/apps/studio/client/v2/inspector/kinds/artboard.jsx +168 -0
  930. package/apps/studio/client/v2/inspector/kinds/caption.jsx +203 -0
  931. package/apps/studio/client/v2/inspector/kinds/clip-model.js +190 -0
  932. package/apps/studio/client/v2/inspector/kinds/clip.css +157 -0
  933. package/apps/studio/client/v2/inspector/kinds/clip.jsx +447 -0
  934. package/apps/studio/client/v2/inspector/kinds/frame.jsx +118 -0
  935. package/apps/studio/client/v2/inspector/kinds/image.jsx +267 -0
  936. package/apps/studio/client/v2/inspector/kinds/index.js +180 -0
  937. package/apps/studio/client/v2/inspector/kinds/instance.jsx +377 -0
  938. package/apps/studio/client/v2/inspector/kinds/multi-artboard.jsx +129 -0
  939. package/apps/studio/client/v2/inspector/kinds/multi.jsx +220 -0
  940. package/apps/studio/client/v2/inspector/kinds/music.jsx +294 -0
  941. package/apps/studio/client/v2/inspector/kinds/path.jsx +174 -0
  942. package/apps/studio/client/v2/inspector/kinds/shape.jsx +59 -0
  943. package/apps/studio/client/v2/inspector/kinds/text.jsx +518 -0
  944. package/apps/studio/client/v2/inspector/kinds/title-rows.jsx +135 -0
  945. package/apps/studio/client/v2/inspector/kinds/video-facts.js +142 -0
  946. package/apps/studio/client/v2/inspector/layers-row-tools.jsx +93 -0
  947. package/apps/studio/client/v2/inspector/layers-slot.jsx +93 -0
  948. package/apps/studio/client/v2/inspector/link-write.js +52 -0
  949. package/apps/studio/client/v2/inspector/live-size.js +96 -0
  950. package/apps/studio/client/v2/inspector/model.js +228 -0
  951. package/apps/studio/client/v2/inspector/path-point.js +104 -0
  952. package/apps/studio/client/v2/inspector/print-write.js +85 -0
  953. package/apps/studio/client/v2/inspector/safe-zones-write.js +88 -0
  954. package/apps/studio/client/v2/inspector/sections/add-requests.js +35 -0
  955. package/apps/studio/client/v2/inspector/sections/border.jsx +141 -0
  956. package/apps/studio/client/v2/inspector/sections/color-control.jsx +246 -0
  957. package/apps/studio/client/v2/inspector/sections/colour-custom.jsx +826 -0
  958. package/apps/studio/client/v2/inspector/sections/colour-model.js +404 -0
  959. package/apps/studio/client/v2/inspector/sections/colour-popover.jsx +631 -0
  960. package/apps/studio/client/v2/inspector/sections/colour-words.js +131 -0
  961. package/apps/studio/client/v2/inspector/sections/corners.jsx +177 -0
  962. package/apps/studio/client/v2/inspector/sections/effects.jsx +67 -0
  963. package/apps/studio/client/v2/inspector/sections/export-slot.jsx +60 -0
  964. package/apps/studio/client/v2/inspector/sections/fill.jsx +187 -0
  965. package/apps/studio/client/v2/inspector/sections/formats.jsx +209 -0
  966. package/apps/studio/client/v2/inspector/sections/index.js +74 -0
  967. package/apps/studio/client/v2/inspector/sections/interaction.jsx +204 -0
  968. package/apps/studio/client/v2/inspector/sections/layout.jsx +314 -0
  969. package/apps/studio/client/v2/inspector/sections/opacity-row.jsx +37 -0
  970. package/apps/studio/client/v2/inspector/sections/point.jsx +102 -0
  971. package/apps/studio/client/v2/inspector/sections/position.jsx +259 -0
  972. package/apps/studio/client/v2/inspector/sections/recent-colours.js +106 -0
  973. package/apps/studio/client/v2/inspector/sections/row.jsx +91 -0
  974. package/apps/studio/client/v2/inspector/sections/safe-zones.jsx +174 -0
  975. package/apps/studio/client/v2/inspector/sections/sections.css +1474 -0
  976. package/apps/studio/client/v2/inspector/sections/size.jsx +104 -0
  977. package/apps/studio/client/v2/inspector/sections/type.jsx +168 -0
  978. package/apps/studio/client/v2/inspector/sections/warnings.css +44 -0
  979. package/apps/studio/client/v2/inspector/sections/warnings.jsx +137 -0
  980. package/apps/studio/client/v2/inspector/sections.js +226 -0
  981. package/apps/studio/client/v2/inspector/slots.js +110 -0
  982. package/apps/studio/client/v2/inspector/token-chip.jsx +315 -0
  983. package/apps/studio/client/v2/inspector/view-mode.jsx +193 -0
  984. package/apps/studio/client/v2/inspector/warning-fix.js +111 -0
  985. package/apps/studio/client/v2/kinds/ConvertDialog.jsx +183 -0
  986. package/apps/studio/client/v2/kinds/KindChips.jsx +60 -0
  987. package/apps/studio/client/v2/kinds/KindDimHost.jsx +35 -0
  988. package/apps/studio/client/v2/kinds/LayersKindFilter.jsx +108 -0
  989. package/apps/studio/client/v2/kinds/SizePicker.jsx +566 -0
  990. package/apps/studio/client/v2/kinds/SizePickerHost.jsx +104 -0
  991. package/apps/studio/client/v2/kinds/advanced-rows.js +40 -0
  992. package/apps/studio/client/v2/kinds/convert-api.js +116 -0
  993. package/apps/studio/client/v2/kinds/convert.css +87 -0
  994. package/apps/studio/client/v2/kinds/kind-dim-relay.js +93 -0
  995. package/apps/studio/client/v2/kinds/kind-filter-model.js +106 -0
  996. package/apps/studio/client/v2/kinds/kind-filter-store.js +71 -0
  997. package/apps/studio/client/v2/kinds/kind-filter.css +105 -0
  998. package/apps/studio/client/v2/kinds/layers-kind-model.js +99 -0
  999. package/apps/studio/client/v2/kinds/size-picker-model.js +189 -0
  1000. package/apps/studio/client/v2/kinds/size-picker.css +393 -0
  1001. package/apps/studio/client/v2/layers/artboard-layers.jsx +105 -0
  1002. package/apps/studio/client/v2/layers/layers.css +94 -0
  1003. package/apps/studio/client/v2/left-panel/advanced-model.js +98 -0
  1004. package/apps/studio/client/v2/left-panel/assets-panel.jsx +1203 -0
  1005. package/apps/studio/client/v2/left-panel/canvas-file-menu.js +115 -0
  1006. package/apps/studio/client/v2/left-panel/canvases-advanced.jsx +270 -0
  1007. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +274 -0
  1008. package/apps/studio/client/v2/left-panel/layers-advanced.jsx +179 -0
  1009. package/apps/studio/client/v2/left-panel/left-panel-bus.js +83 -0
  1010. package/apps/studio/client/v2/left-panel/left-panel-model.js +184 -0
  1011. package/apps/studio/client/v2/left-panel/left-panel.css +1846 -0
  1012. package/apps/studio/client/v2/left-panel/selector-scope.js +42 -0
  1013. package/apps/studio/client/v2/left-panel/trash-model.js +282 -0
  1014. package/apps/studio/client/v2/left-panel/trash-view.jsx +257 -0
  1015. package/apps/studio/client/v2/left-panel/use-trash.js +172 -0
  1016. package/apps/studio/client/v2/left-panel/view-prefs.js +84 -0
  1017. package/apps/studio/client/v2/onboarding/AdvSheet.jsx +114 -0
  1018. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +239 -0
  1019. package/apps/studio/client/v2/onboarding/CliSheet.jsx +101 -0
  1020. package/apps/studio/client/v2/onboarding/ConnectAiSheet.jsx +60 -0
  1021. package/apps/studio/client/v2/onboarding/FigmaSheet.jsx +96 -0
  1022. package/apps/studio/client/v2/onboarding/FolderGithubSheet.jsx +77 -0
  1023. package/apps/studio/client/v2/onboarding/GithubSegment.jsx +241 -0
  1024. package/apps/studio/client/v2/onboarding/HubSheet.jsx +244 -0
  1025. package/apps/studio/client/v2/onboarding/connect-ai-home.js +94 -0
  1026. package/apps/studio/client/v2/onboarding/github-home.js +84 -0
  1027. package/apps/studio/client/v2/onboarding/onboarding-model.js +106 -0
  1028. package/apps/studio/client/v2/onboarding/onboarding.css +546 -0
  1029. package/apps/studio/client/v2/photo/apply-every-use-sheet.jsx +196 -0
  1030. package/apps/studio/client/v2/photo/canvas-rel.js +20 -0
  1031. package/apps/studio/client/v2/photo/looks.js +129 -0
  1032. package/apps/studio/client/v2/photo/photo-section.jsx +625 -0
  1033. package/apps/studio/client/v2/photo/photo.css +218 -0
  1034. package/apps/studio/client/v2/portal-scope.jsx +14 -0
  1035. package/apps/studio/client/v2/presence/faces.jsx +356 -0
  1036. package/apps/studio/client/v2/presence/presence.css +187 -0
  1037. package/apps/studio/client/v2/presence/use-presence-host.js +83 -0
  1038. package/apps/studio/client/v2/present/audience-window.js +63 -0
  1039. package/apps/studio/client/v2/present/canvas-pill.jsx +55 -0
  1040. package/apps/studio/client/v2/present/copy-link.js +82 -0
  1041. package/apps/studio/client/v2/present/follow-location.js +82 -0
  1042. package/apps/studio/client/v2/present/follow-model.js +68 -0
  1043. package/apps/studio/client/v2/present/follow-view.jsx +354 -0
  1044. package/apps/studio/client/v2/present/follow.css +91 -0
  1045. package/apps/studio/client/v2/present/order-map.jsx +64 -0
  1046. package/apps/studio/client/v2/present/order-notes-artboards.js +88 -0
  1047. package/apps/studio/client/v2/present/order-notes-model.js +141 -0
  1048. package/apps/studio/client/v2/present/order-notes-mount.jsx +26 -0
  1049. package/apps/studio/client/v2/present/order-notes-sheet.jsx +293 -0
  1050. package/apps/studio/client/v2/present/order-notes.css +150 -0
  1051. package/apps/studio/client/v2/present/present-chrome-host.jsx +95 -0
  1052. package/apps/studio/client/v2/present/present-controls-model.js +114 -0
  1053. package/apps/studio/client/v2/present/present-controls.jsx +263 -0
  1054. package/apps/studio/client/v2/present/present-zoom-store.js +33 -0
  1055. package/apps/studio/client/v2/present/present.css +258 -0
  1056. package/apps/studio/client/v2/present/presenter-button.jsx +25 -0
  1057. package/apps/studio/client/v2/present/presenter-host.jsx +246 -0
  1058. package/apps/studio/client/v2/present/presenter-model.js +167 -0
  1059. package/apps/studio/client/v2/present/presenter-store.js +140 -0
  1060. package/apps/studio/client/v2/present/presenter-view.css +298 -0
  1061. package/apps/studio/client/v2/present/presenter-view.jsx +241 -0
  1062. package/apps/studio/client/v2/present/video-present-model.js +92 -0
  1063. package/apps/studio/client/v2/present/video-present.css +164 -0
  1064. package/apps/studio/client/v2/present/video-present.jsx +331 -0
  1065. package/apps/studio/client/v2/preview/external-link-confirm.jsx +245 -0
  1066. package/apps/studio/client/v2/preview/link-follow.js +109 -0
  1067. package/apps/studio/client/v2/preview/open-in-app.jsx +46 -0
  1068. package/apps/studio/client/v2/preview/preview-back.js +21 -0
  1069. package/apps/studio/client/v2/preview/preview-bar.jsx +86 -0
  1070. package/apps/studio/client/v2/preview/preview-chrome-host.jsx +234 -0
  1071. package/apps/studio/client/v2/preview/preview-history.js +61 -0
  1072. package/apps/studio/client/v2/preview/preview.css +262 -0
  1073. package/apps/studio/client/v2/preview/zoom-only.jsx +58 -0
  1074. package/apps/studio/client/v2/search/help-model.js +275 -0
  1075. package/apps/studio/client/v2/search/moved-keys.js +74 -0
  1076. package/apps/studio/client/v2/search/palette-icons.js +45 -0
  1077. package/apps/studio/client/v2/search/search-ds.js +142 -0
  1078. package/apps/studio/client/v2/search/search-env.js +110 -0
  1079. package/apps/studio/client/v2/search/search-keywords.js +162 -0
  1080. package/apps/studio/client/v2/search/search-model.js +623 -0
  1081. package/apps/studio/client/v2/search/search-projects.js +214 -0
  1082. package/apps/studio/client/v2/search/search-recent.js +94 -0
  1083. package/apps/studio/client/v2/search/search-remote.js +30 -0
  1084. package/apps/studio/client/v2/search/search.css +519 -0
  1085. package/apps/studio/client/v2/settings/account.jsx +164 -0
  1086. package/apps/studio/client/v2/settings/advanced-prefs.js +91 -0
  1087. package/apps/studio/client/v2/settings/advanced-section.jsx +308 -0
  1088. package/apps/studio/client/v2/settings/connection-row.jsx +79 -0
  1089. package/apps/studio/client/v2/settings/connections-model.js +138 -0
  1090. package/apps/studio/client/v2/settings/connections-section.jsx +663 -0
  1091. package/apps/studio/client/v2/settings/general-section.jsx +155 -0
  1092. package/apps/studio/client/v2/settings/parts.jsx +48 -0
  1093. package/apps/studio/client/v2/settings/prefs-migrate.js +141 -0
  1094. package/apps/studio/client/v2/settings/project-sync-settings.jsx +255 -0
  1095. package/apps/studio/client/v2/settings/reset-section.jsx +164 -0
  1096. package/apps/studio/client/v2/settings/settings-handlers.js +46 -0
  1097. package/apps/studio/client/v2/settings/settings-model.js +523 -0
  1098. package/apps/studio/client/v2/settings/settings-sheet.jsx +204 -0
  1099. package/apps/studio/client/v2/settings/settings.css +975 -0
  1100. package/apps/studio/client/v2/settings/theme-auto.js +75 -0
  1101. package/apps/studio/client/v2/settings/use-advanced-prefs.js +32 -0
  1102. package/apps/studio/client/v2/settings/use-connections.js +485 -0
  1103. package/apps/studio/client/v2/share/glyphs.jsx +92 -0
  1104. package/apps/studio/client/v2/share/invite-row.jsx +68 -0
  1105. package/apps/studio/client/v2/share/link-dialog.js +53 -0
  1106. package/apps/studio/client/v2/share/link-row.jsx +38 -0
  1107. package/apps/studio/client/v2/share/move-to-cloud.jsx +88 -0
  1108. package/apps/studio/client/v2/share/people-list.jsx +151 -0
  1109. package/apps/studio/client/v2/share/person.jsx +26 -0
  1110. package/apps/studio/client/v2/share/role-menu.jsx +145 -0
  1111. package/apps/studio/client/v2/share/share-advanced.jsx +411 -0
  1112. package/apps/studio/client/v2/share/share-model.js +469 -0
  1113. package/apps/studio/client/v2/share/share-sheet.jsx +602 -0
  1114. package/apps/studio/client/v2/share/share.css +828 -0
  1115. package/apps/studio/client/v2/shell/account-card-model.js +114 -0
  1116. package/apps/studio/client/v2/shell/account-card.jsx +177 -0
  1117. package/apps/studio/client/v2/shell/annotation-prefs-store.js +105 -0
  1118. package/apps/studio/client/v2/shell/ask-to-edit.js +33 -0
  1119. package/apps/studio/client/v2/shell/callouts-host.jsx +151 -0
  1120. package/apps/studio/client/v2/shell/callouts-model.js +358 -0
  1121. package/apps/studio/client/v2/shell/callouts.css +164 -0
  1122. package/apps/studio/client/v2/shell/callouts.jsx +162 -0
  1123. package/apps/studio/client/v2/shell/canvas-mode.js +393 -0
  1124. package/apps/studio/client/v2/shell/contrast.css +37 -0
  1125. package/apps/studio/client/v2/shell/corner-icons.jsx +153 -0
  1126. package/apps/studio/client/v2/shell/dock-rail-homes.js +106 -0
  1127. package/apps/studio/client/v2/shell/f6-cycle.js +124 -0
  1128. package/apps/studio/client/v2/shell/floating-panels.css +2858 -0
  1129. package/apps/studio/client/v2/shell/fold-ghost.js +70 -0
  1130. package/apps/studio/client/v2/shell/format-update.css +43 -0
  1131. package/apps/studio/client/v2/shell/format-update.js +487 -0
  1132. package/apps/studio/client/v2/shell/format-update.jsx +479 -0
  1133. package/apps/studio/client/v2/shell/held-conflict.js +51 -0
  1134. package/apps/studio/client/v2/shell/image-pick.js +140 -0
  1135. package/apps/studio/client/v2/shell/insets-now.js +35 -0
  1136. package/apps/studio/client/v2/shell/inspector-follow.js +113 -0
  1137. package/apps/studio/client/v2/shell/menu-runner.js +711 -0
  1138. package/apps/studio/client/v2/shell/modal-focus.js +259 -0
  1139. package/apps/studio/client/v2/shell/mode-switch.jsx +418 -0
  1140. package/apps/studio/client/v2/shell/native-doors.js +121 -0
  1141. package/apps/studio/client/v2/shell/occlusion-insets.js +116 -0
  1142. package/apps/studio/client/v2/shell/panel-availability.js +27 -0
  1143. package/apps/studio/client/v2/shell/panel-layout.js +144 -0
  1144. package/apps/studio/client/v2/shell/panel-sizes.js +150 -0
  1145. package/apps/studio/client/v2/shell/paste-forward.js +43 -0
  1146. package/apps/studio/client/v2/shell/present-from-label.js +19 -0
  1147. package/apps/studio/client/v2/shell/project-menu-model.js +216 -0
  1148. package/apps/studio/client/v2/shell/project-pill.css +214 -0
  1149. package/apps/studio/client/v2/shell/project-pill.jsx +456 -0
  1150. package/apps/studio/client/v2/shell/recovery-store.js +139 -0
  1151. package/apps/studio/client/v2/shell/role-denial.js +73 -0
  1152. package/apps/studio/client/v2/shell/role-gate.js +29 -0
  1153. package/apps/studio/client/v2/shell/save-hold-notice.js +69 -0
  1154. package/apps/studio/client/v2/shell/save-status.js +191 -0
  1155. package/apps/studio/client/v2/shell/scroll-lock.js +49 -0
  1156. package/apps/studio/client/v2/shell/share-cluster-host.jsx +389 -0
  1157. package/apps/studio/client/v2/shell/share-cluster.css +608 -0
  1158. package/apps/studio/client/v2/shell/share-cluster.jsx +255 -0
  1159. package/apps/studio/client/v2/shell/shell-error-boundary.jsx +81 -0
  1160. package/apps/studio/client/v2/shell/shell-panels-relay.js +95 -0
  1161. package/apps/studio/client/v2/shell/shell-parity.js +457 -0
  1162. package/apps/studio/client/v2/shell/shell-parity.json +2106 -0
  1163. package/apps/studio/client/v2/shell/single-keys-store.js +49 -0
  1164. package/apps/studio/client/v2/shell/tool-panels.css +39 -0
  1165. package/apps/studio/client/v2/shell/tool-panels.js +156 -0
  1166. package/apps/studio/client/v2/shell/use-account.js +59 -0
  1167. package/apps/studio/client/v2/shell/use-annotation-prefs.js +77 -0
  1168. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +388 -0
  1169. package/apps/studio/client/v2/shell/use-dismiss-outside.js +35 -0
  1170. package/apps/studio/client/v2/shell/use-fit-on-ai-pin.js +42 -0
  1171. package/apps/studio/client/v2/shell/use-fit-while-ai-drafts.js +37 -0
  1172. package/apps/studio/client/v2/shell/use-occluded-insets.js +107 -0
  1173. package/apps/studio/client/v2/shell/use-panel-layout.js +45 -0
  1174. package/apps/studio/client/v2/shell/use-single-keys.js +56 -0
  1175. package/apps/studio/client/v2/shell/use-tool-panels.js +205 -0
  1176. package/apps/studio/client/v2/signin/CreateLocalSheet.jsx +155 -0
  1177. package/apps/studio/client/v2/signin/SignInCard.jsx +284 -0
  1178. package/apps/studio/client/v2/signin/SignInToast.jsx +22 -0
  1179. package/apps/studio/client/v2/signin/WhatsNewLine.jsx +64 -0
  1180. package/apps/studio/client/v2/signin/advanced-rows.js +40 -0
  1181. package/apps/studio/client/v2/signin/signin-model.js +138 -0
  1182. package/apps/studio/client/v2/signin/signin.css +484 -0
  1183. package/apps/studio/client/v2/signin/use-signin.js +209 -0
  1184. package/apps/studio/client/v2/signin/use-whats-new-line.js +94 -0
  1185. package/apps/studio/client/v2/sync-states/back-online.jsx +61 -0
  1186. package/apps/studio/client/v2/sync-states/conflict-card.jsx +326 -0
  1187. package/apps/studio/client/v2/sync-states/offline-foot.jsx +79 -0
  1188. package/apps/studio/client/v2/sync-states/row-words.js +83 -0
  1189. package/apps/studio/client/v2/sync-states/sync-states-model.js +264 -0
  1190. package/apps/studio/client/v2/sync-states/sync-states.css +232 -0
  1191. package/apps/studio/client/v2/timeline/Timeline.jsx +3194 -0
  1192. package/apps/studio/client/v2/timeline/TimelineHost.jsx +360 -0
  1193. package/apps/studio/client/v2/timeline/advanced/actions.js +27 -0
  1194. package/apps/studio/client/v2/timeline/advanced/advanced-store.js +116 -0
  1195. package/apps/studio/client/v2/timeline/advanced/advanced.css +323 -0
  1196. package/apps/studio/client/v2/timeline/advanced/cut-as-code.jsx +127 -0
  1197. package/apps/studio/client/v2/timeline/advanced/easing-curve.jsx +200 -0
  1198. package/apps/studio/client/v2/timeline/advanced/foot.jsx +210 -0
  1199. package/apps/studio/client/v2/timeline/advanced/model.js +121 -0
  1200. package/apps/studio/client/v2/timeline/advanced/render-settings.jsx +62 -0
  1201. package/apps/studio/client/v2/timeline/advanced/video-cap.js +174 -0
  1202. package/apps/studio/client/v2/timeline/ai-edge-model.js +111 -0
  1203. package/apps/studio/client/v2/timeline/ai-edge.css +104 -0
  1204. package/apps/studio/client/v2/timeline/ai-edge.jsx +113 -0
  1205. package/apps/studio/client/v2/timeline/anchor-lane.js +80 -0
  1206. package/apps/studio/client/v2/timeline/anchor.js +80 -0
  1207. package/apps/studio/client/v2/timeline/assemble-video.js +64 -0
  1208. package/apps/studio/client/v2/timeline/clip-search.js +88 -0
  1209. package/apps/studio/client/v2/timeline/clip-verb.js +224 -0
  1210. package/apps/studio/client/v2/timeline/comment-strip-host.jsx +93 -0
  1211. package/apps/studio/client/v2/timeline/comment-strip-model.js +103 -0
  1212. package/apps/studio/client/v2/timeline/comment-strip.jsx +82 -0
  1213. package/apps/studio/client/v2/timeline/edit/clip-menu.js +118 -0
  1214. package/apps/studio/client/v2/timeline/edit/clip-menu.jsx +48 -0
  1215. package/apps/studio/client/v2/timeline/edit/drop.jsx +101 -0
  1216. package/apps/studio/client/v2/timeline/edit/move.jsx +43 -0
  1217. package/apps/studio/client/v2/timeline/edit/ripple.js +43 -0
  1218. package/apps/studio/client/v2/timeline/edit/trim.jsx +52 -0
  1219. package/apps/studio/client/v2/timeline/edit/words.js +65 -0
  1220. package/apps/studio/client/v2/timeline/fit-fill.jsx +172 -0
  1221. package/apps/studio/client/v2/timeline/fit-model.js +137 -0
  1222. package/apps/studio/client/v2/timeline/fold.js +128 -0
  1223. package/apps/studio/client/v2/timeline/footage-rows.jsx +46 -0
  1224. package/apps/studio/client/v2/timeline/footage-state.js +135 -0
  1225. package/apps/studio/client/v2/timeline/glyphs.jsx +118 -0
  1226. package/apps/studio/client/v2/timeline/island-context.js +29 -0
  1227. package/apps/studio/client/v2/timeline/island-controls.jsx +83 -0
  1228. package/apps/studio/client/v2/timeline/island.jsx +54 -0
  1229. package/apps/studio/client/v2/timeline/joins/join-model.js +133 -0
  1230. package/apps/studio/client/v2/timeline/joins/joins.css +277 -0
  1231. package/apps/studio/client/v2/timeline/joins/transition-picker.jsx +240 -0
  1232. package/apps/studio/client/v2/timeline/keys.js +74 -0
  1233. package/apps/studio/client/v2/timeline/lanes/caption-lane.jsx +149 -0
  1234. package/apps/studio/client/v2/timeline/lanes/music-lane.jsx +294 -0
  1235. package/apps/studio/client/v2/timeline/lanes/music-media.js +200 -0
  1236. package/apps/studio/client/v2/timeline/lanes/music-model.js +190 -0
  1237. package/apps/studio/client/v2/timeline/loop-handle.jsx +70 -0
  1238. package/apps/studio/client/v2/timeline/marker-store.js +117 -0
  1239. package/apps/studio/client/v2/timeline/markers.js +79 -0
  1240. package/apps/studio/client/v2/timeline/marks.jsx +152 -0
  1241. package/apps/studio/client/v2/timeline/music-hint.jsx +98 -0
  1242. package/apps/studio/client/v2/timeline/other-takes-model.js +103 -0
  1243. package/apps/studio/client/v2/timeline/other-takes-store.js +49 -0
  1244. package/apps/studio/client/v2/timeline/other-takes.css +98 -0
  1245. package/apps/studio/client/v2/timeline/other-takes.jsx +269 -0
  1246. package/apps/studio/client/v2/timeline/peers.jsx +246 -0
  1247. package/apps/studio/client/v2/timeline/playhead.js +97 -0
  1248. package/apps/studio/client/v2/timeline/poster.js +109 -0
  1249. package/apps/studio/client/v2/timeline/reframe-island.jsx +478 -0
  1250. package/apps/studio/client/v2/timeline/reframe-model.js +135 -0
  1251. package/apps/studio/client/v2/timeline/reframe.css +150 -0
  1252. package/apps/studio/client/v2/timeline/ruler.js +61 -0
  1253. package/apps/studio/client/v2/timeline/selection.js +110 -0
  1254. package/apps/studio/client/v2/timeline/timeline-empty.jsx +108 -0
  1255. package/apps/studio/client/v2/timeline/timeline-store.js +147 -0
  1256. package/apps/studio/client/v2/timeline/timeline.css +2879 -0
  1257. package/apps/studio/client/v2/timeline/together.css +85 -0
  1258. package/apps/studio/client/v2/timeline/track-toggle.js +56 -0
  1259. package/apps/studio/client/v2/timeline/tracks.js +68 -0
  1260. package/apps/studio/client/v2/timeline/transport.js +66 -0
  1261. package/apps/studio/client/v2/timeline/zoom.js +37 -0
  1262. package/apps/studio/client/v2/transcript/TranscriptHost.jsx +162 -0
  1263. package/apps/studio/client/v2/transcript/TranscriptPanel.jsx +358 -0
  1264. package/apps/studio/client/v2/transcript/captions-api.js +297 -0
  1265. package/apps/studio/client/v2/transcript/captions-file-flag.js +38 -0
  1266. package/apps/studio/client/v2/transcript/comp-media-store.js +89 -0
  1267. package/apps/studio/client/v2/transcript/transcript-model.js +240 -0
  1268. package/apps/studio/client/v2/transcript/transcript.css +262 -0
  1269. package/apps/studio/client/v2/undo/projection.js +291 -0
  1270. package/apps/studio/client/v2/undo/undo-history.jsx +286 -0
  1271. package/apps/studio/client/v2/undo/undo.css +81 -0
  1272. package/apps/studio/client/v2/undo/use-undo-mode-lane.js +96 -0
  1273. package/apps/studio/client/v2/undo/use-undo-projection.jsx +460 -0
  1274. package/apps/studio/client/v2/undo/zoom-undo.jsx +79 -0
  1275. package/apps/studio/client/whats-new-seen.js +40 -0
  1276. package/apps/studio/client/whats-new.jsx +65 -62
  1277. package/apps/studio/clip-ops.ts +38 -6
  1278. package/apps/studio/cloud/config-path.ts +42 -0
  1279. package/apps/studio/cloud/endpoints.ts +212 -50
  1280. package/apps/studio/cloud/renew.ts +29 -16
  1281. package/apps/studio/collab/ai-activity.ts +19 -0
  1282. package/apps/studio/collab/awareness-bridge.ts +131 -4
  1283. package/apps/studio/collab/git-lifecycle.ts +52 -20
  1284. package/apps/studio/collab/holds.ts +69 -0
  1285. package/apps/studio/collab/index.ts +25 -0
  1286. package/apps/studio/collab/protocol.ts +64 -0
  1287. package/apps/studio/collab/registry.ts +59 -6
  1288. package/apps/studio/collab/room.ts +374 -16
  1289. package/apps/studio/collab/timeline-awareness.ts +123 -0
  1290. package/apps/studio/collab/timeline-presence.tsx +219 -0
  1291. package/apps/studio/commands/move-artboards-command.ts +45 -4
  1292. package/apps/studio/comments/anchors.ts +147 -0
  1293. package/apps/studio/comments/author-face.ts +41 -0
  1294. package/apps/studio/comments/from-line.ts +43 -0
  1295. package/apps/studio/comments/imported-from.ts +113 -0
  1296. package/apps/studio/comments/local-author.ts +41 -0
  1297. package/apps/studio/comments/mentions.ts +115 -0
  1298. package/apps/studio/comments/mine-stamp.ts +78 -0
  1299. package/apps/studio/comments/ops.ts +293 -0
  1300. package/apps/studio/comments/people.ts +66 -0
  1301. package/apps/studio/comments/where.ts +136 -0
  1302. package/apps/studio/comments-overlay.tsx +1220 -253
  1303. package/apps/studio/config.schema.json +33 -0
  1304. package/apps/studio/context-menu.tsx +126 -42
  1305. package/apps/studio/context.ts +178 -13
  1306. package/apps/studio/cursors-overlay.tsx +28 -11
  1307. package/apps/studio/debug-bundle.ts +21 -5
  1308. package/apps/studio/describe/batch.ts +414 -0
  1309. package/apps/studio/describe/budget.ts +147 -0
  1310. package/apps/studio/describe/claude.ts +273 -0
  1311. package/apps/studio/describe/consent.ts +120 -0
  1312. package/apps/studio/describe/validate.ts +192 -0
  1313. package/apps/studio/design-setup-readiness.ts +2 -2
  1314. package/apps/studio/diagnostics/store.ts +220 -0
  1315. package/apps/studio/dist/client.bundle.js +2429 -2329
  1316. package/apps/studio/dist/comment-mount.js +12 -9
  1317. package/apps/studio/dist/styles.css +1 -1
  1318. package/apps/studio/dom-selection.ts +239 -23
  1319. package/apps/studio/drag-bus.ts +211 -0
  1320. package/apps/studio/draw/serialize-animate.ts +4 -4
  1321. package/apps/studio/ds/board/board-specimen.css +199 -0
  1322. package/apps/studio/ds/board/board.css +674 -0
  1323. package/apps/studio/ds/board/brand-notes.ts +92 -0
  1324. package/apps/studio/ds/board/build-model.ts +418 -0
  1325. package/apps/studio/ds/board/component-states.ts +111 -0
  1326. package/apps/studio/ds/board/directions-model.ts +145 -0
  1327. package/apps/studio/ds/board/directions.css +169 -0
  1328. package/apps/studio/ds/board/directions.tsx +100 -0
  1329. package/apps/studio/ds/board/ds-bar.tsx +107 -0
  1330. package/apps/studio/ds/board/index.tsx +71 -0
  1331. package/apps/studio/ds/board/logo-paint.ts +118 -0
  1332. package/apps/studio/ds/board/outline.tsx +127 -0
  1333. package/apps/studio/ds/board/parts.tsx +160 -0
  1334. package/apps/studio/ds/board/section-brand.tsx +148 -0
  1335. package/apps/studio/ds/board/section-colour.tsx +160 -0
  1336. package/apps/studio/ds/board/section-components.tsx +146 -0
  1337. package/apps/studio/ds/board/section-motion.tsx +106 -0
  1338. package/apps/studio/ds/board/section-patterns.tsx +89 -0
  1339. package/apps/studio/ds/board/section-space.tsx +109 -0
  1340. package/apps/studio/ds/board/section-type.tsx +129 -0
  1341. package/apps/studio/ds/board/specimen.tsx +61 -0
  1342. package/apps/studio/ds/board/state.ts +105 -0
  1343. package/apps/studio/ds/board/template.ts +152 -0
  1344. package/apps/studio/ds/board/types.ts +346 -0
  1345. package/apps/studio/ds/canvas-check.ts +914 -0
  1346. package/apps/studio/ds/canvas-cli.ts +346 -0
  1347. package/apps/studio/ds/check-system-verb.ts +88 -0
  1348. package/apps/studio/ds/check-system.ts +293 -0
  1349. package/apps/studio/ds/check.ts +541 -0
  1350. package/apps/studio/ds/cli.ts +348 -0
  1351. package/apps/studio/ds/component-list.ts +150 -0
  1352. package/apps/studio/ds/contrast.ts +438 -0
  1353. package/apps/studio/ds/convert-map.ts +126 -0
  1354. package/apps/studio/ds/convert.ts +603 -0
  1355. package/apps/studio/ds/css-scan.ts +292 -0
  1356. package/apps/studio/ds/default-components.tsx +377 -0
  1357. package/apps/studio/ds/default.ts +58 -0
  1358. package/apps/studio/ds/design-system.tsx.tpl +40 -0
  1359. package/apps/studio/ds/ds-resolver.ts +205 -0
  1360. package/apps/studio/ds/ds-verb.ts +563 -0
  1361. package/apps/studio/ds/edges.ts +412 -0
  1362. package/apps/studio/ds/emit.ts +217 -0
  1363. package/apps/studio/ds/engine.ts +1652 -0
  1364. package/apps/studio/ds/fallbacks.ts +116 -0
  1365. package/apps/studio/ds/generate.ts +746 -0
  1366. package/apps/studio/ds/head.ts +372 -0
  1367. package/apps/studio/ds/instance-info.ts +90 -0
  1368. package/apps/studio/ds/library.ts +1137 -0
  1369. package/apps/studio/ds/make.ts +726 -0
  1370. package/apps/studio/ds/migrate-emitter.ts +42 -0
  1371. package/apps/studio/ds/nearest.ts +163 -0
  1372. package/apps/studio/ds/outside.ts +343 -0
  1373. package/apps/studio/ds/override-map.ts +213 -0
  1374. package/apps/studio/ds/pairing-css.ts +145 -0
  1375. package/apps/studio/ds/pin-scope.ts +268 -0
  1376. package/apps/studio/ds/registry.ts +228 -0
  1377. package/apps/studio/ds/rename.ts +104 -0
  1378. package/apps/studio/ds/render-rev.ts +144 -0
  1379. package/apps/studio/ds/revision.ts +268 -0
  1380. package/apps/studio/ds/shell-fallbacks.ts +84 -0
  1381. package/apps/studio/ds/switch.ts +426 -0
  1382. package/apps/studio/ds/system-files.ts +251 -0
  1383. package/apps/studio/ds/system.ts +312 -0
  1384. package/apps/studio/ds/undo-hook.ts +46 -0
  1385. package/apps/studio/ds/upgrade-apply.ts +258 -0
  1386. package/apps/studio/ds/upgrade-cli.ts +216 -0
  1387. package/apps/studio/ds/upgrade-codemod.ts +116 -0
  1388. package/apps/studio/ds/upgrade-progress.ts +153 -0
  1389. package/apps/studio/ds/upgrade-prove.ts +429 -0
  1390. package/apps/studio/ds/upgrade-stage.ts +387 -0
  1391. package/apps/studio/ds/upgrade.ts +394 -0
  1392. package/apps/studio/ds/value-types.ts +190 -0
  1393. package/apps/studio/edit-ops/align.ts +43 -0
  1394. package/apps/studio/edit-ops/arrange.ts +93 -0
  1395. package/apps/studio/edit-ops/artboard-facts.ts +70 -0
  1396. package/apps/studio/edit-ops/artboard-resize.ts +50 -0
  1397. package/apps/studio/edit-ops/artboard-trash.ts +77 -0
  1398. package/apps/studio/edit-ops/clear-link.ts +16 -0
  1399. package/apps/studio/edit-ops/clip/captions.ts +154 -0
  1400. package/apps/studio/edit-ops/clip/comp.ts +124 -0
  1401. package/apps/studio/edit-ops/clip/cut-source-range.ts +100 -0
  1402. package/apps/studio/edit-ops/clip/cut-to-beat.ts +136 -0
  1403. package/apps/studio/edit-ops/clip/duck.ts +123 -0
  1404. package/apps/studio/edit-ops/clip/easing.ts +76 -0
  1405. package/apps/studio/edit-ops/clip/formats.ts +163 -0
  1406. package/apps/studio/edit-ops/clip/gestures.ts +161 -0
  1407. package/apps/studio/edit-ops/clip/index.ts +543 -0
  1408. package/apps/studio/edit-ops/clip/jsx.ts +251 -0
  1409. package/apps/studio/edit-ops/clip/place.ts +127 -0
  1410. package/apps/studio/edit-ops/clip/reframe.ts +194 -0
  1411. package/apps/studio/edit-ops/clip/take-swap.ts +53 -0
  1412. package/apps/studio/edit-ops/clip/title-motion.ts +103 -0
  1413. package/apps/studio/edit-ops/clip/title-style.ts +177 -0
  1414. package/apps/studio/edit-ops/clip/track.ts +102 -0
  1415. package/apps/studio/edit-ops/clipboard.ts +482 -0
  1416. package/apps/studio/edit-ops/combine.ts +264 -0
  1417. package/apps/studio/edit-ops/constraints.ts +148 -0
  1418. package/apps/studio/edit-ops/convert-kind.ts +203 -0
  1419. package/apps/studio/edit-ops/corner-radius.ts +86 -0
  1420. package/apps/studio/edit-ops/crop.ts +303 -0
  1421. package/apps/studio/edit-ops/czech-ties.ts +84 -0
  1422. package/apps/studio/edit-ops/detach-instance.ts +119 -0
  1423. package/apps/studio/edit-ops/dispatch.ts +552 -0
  1424. package/apps/studio/edit-ops/distribute.ts +31 -0
  1425. package/apps/studio/edit-ops/ds-instance-update.ts +46 -0
  1426. package/apps/studio/edit-ops/ds-use-nearest.ts +72 -0
  1427. package/apps/studio/edit-ops/duplicate-at-width.ts +241 -0
  1428. package/apps/studio/edit-ops/frame.ts +68 -0
  1429. package/apps/studio/edit-ops/guides.ts +67 -0
  1430. package/apps/studio/edit-ops/hide.ts +30 -0
  1431. package/apps/studio/edit-ops/hover-rules.ts +94 -0
  1432. package/apps/studio/edit-ops/image-fit.ts +571 -0
  1433. package/apps/studio/edit-ops/insert-component.ts +344 -0
  1434. package/apps/studio/edit-ops/insert-preset.ts +151 -0
  1435. package/apps/studio/edit-ops/insert-shape.ts +326 -0
  1436. package/apps/studio/edit-ops/instance-model.ts +286 -0
  1437. package/apps/studio/edit-ops/instance-tree.ts +215 -0
  1438. package/apps/studio/edit-ops/layout-patch.ts +81 -0
  1439. package/apps/studio/edit-ops/lock.ts +30 -0
  1440. package/apps/studio/edit-ops/op-label.ts +155 -0
  1441. package/apps/studio/edit-ops/path-model.ts +671 -0
  1442. package/apps/studio/edit-ops/path.ts +172 -0
  1443. package/apps/studio/edit-ops/photo-every-use.ts +64 -0
  1444. package/apps/studio/edit-ops/photo-use.ts +41 -0
  1445. package/apps/studio/edit-ops/place-freely.ts +47 -0
  1446. package/apps/studio/edit-ops/place-plan.ts +60 -0
  1447. package/apps/studio/edit-ops/print.ts +104 -0
  1448. package/apps/studio/edit-ops/references.ts +231 -0
  1449. package/apps/studio/edit-ops/relink.ts +49 -0
  1450. package/apps/studio/edit-ops/reorder.ts +104 -0
  1451. package/apps/studio/edit-ops/reset-overrides.ts +75 -0
  1452. package/apps/studio/edit-ops/revert.ts +63 -0
  1453. package/apps/studio/edit-ops/rotate.ts +58 -0
  1454. package/apps/studio/edit-ops/safe-zones.ts +38 -0
  1455. package/apps/studio/edit-ops/scope-names.ts +151 -0
  1456. package/apps/studio/edit-ops/select-matching.ts +48 -0
  1457. package/apps/studio/edit-ops/set-gap.ts +65 -0
  1458. package/apps/studio/edit-ops/set-id.ts +42 -0
  1459. package/apps/studio/edit-ops/set-link.ts +39 -0
  1460. package/apps/studio/edit-ops/siblings.ts +105 -0
  1461. package/apps/studio/edit-ops/slot-defaults.ts +48 -0
  1462. package/apps/studio/edit-ops/stamp.ts +27 -0
  1463. package/apps/studio/edit-ops/swap-variant.ts +163 -0
  1464. package/apps/studio/edit-ops/text-copy.ts +146 -0
  1465. package/apps/studio/edit-ops/text-detach.ts +62 -0
  1466. package/apps/studio/edit-ops/text-style-ops.ts +131 -0
  1467. package/apps/studio/edit-ops/text-style.ts +141 -0
  1468. package/apps/studio/edit-ops/tidy.ts +72 -0
  1469. package/apps/studio/edit-ops/types.ts +229 -0
  1470. package/apps/studio/edit-ops/unframe.ts +53 -0
  1471. package/apps/studio/edit-ops/words-css.ts +487 -0
  1472. package/apps/studio/edit-ops/words-paint.ts +521 -0
  1473. package/apps/studio/edit-ops/z-order.ts +81 -0
  1474. package/apps/studio/editing/ai-point-ring.tsx +158 -0
  1475. package/apps/studio/editing/ai-scope-outline.tsx +180 -0
  1476. package/apps/studio/editing/align-bar.tsx +510 -0
  1477. package/apps/studio/editing/anchor-report.ts +123 -0
  1478. package/apps/studio/editing/anchor-reporter.tsx +64 -0
  1479. package/apps/studio/editing/aria-live.tsx +162 -0
  1480. package/apps/studio/editing/arrange.ts +345 -0
  1481. package/apps/studio/editing/artboard-actions.ts +275 -0
  1482. package/apps/studio/editing/artboard-commands.tsx +232 -0
  1483. package/apps/studio/editing/artboard-guides.tsx +265 -0
  1484. package/apps/studio/editing/artboard-handles.tsx +524 -0
  1485. package/apps/studio/editing/artboard-menu.tsx +153 -0
  1486. package/apps/studio/editing/artboard-resize.ts +306 -0
  1487. package/apps/studio/editing/ask-bubble.tsx +161 -0
  1488. package/apps/studio/editing/asset-drag.ts +70 -0
  1489. package/apps/studio/editing/click-to-type.ts +207 -0
  1490. package/apps/studio/editing/clipboard-actions.ts +91 -0
  1491. package/apps/studio/editing/clipboard.ts +194 -0
  1492. package/apps/studio/editing/clipped-grab.ts +45 -0
  1493. package/apps/studio/editing/corner-dots.tsx +394 -0
  1494. package/apps/studio/editing/crop-geometry.ts +128 -0
  1495. package/apps/studio/editing/crop-mode.tsx +522 -0
  1496. package/apps/studio/editing/crumbs.ts +158 -0
  1497. package/apps/studio/editing/draw-geometry.ts +151 -0
  1498. package/apps/studio/editing/draw-tools.tsx +490 -0
  1499. package/apps/studio/editing/drop-chip.tsx +105 -0
  1500. package/apps/studio/editing/duplicate-rhythm.ts +166 -0
  1501. package/apps/studio/editing/edit-chrome-gate.tsx +58 -0
  1502. package/apps/studio/editing/edit-op.ts +90 -0
  1503. package/apps/studio/editing/empty-report.ts +182 -0
  1504. package/apps/studio/editing/empty-reporter.tsx +74 -0
  1505. package/apps/studio/editing/figma-paste.ts +71 -0
  1506. package/apps/studio/editing/finder-drop-model.ts +130 -0
  1507. package/apps/studio/editing/finder-drop.tsx +400 -0
  1508. package/apps/studio/editing/focus-model.tsx +429 -0
  1509. package/apps/studio/editing/gap-bands.tsx +257 -0
  1510. package/apps/studio/editing/hold-rings.tsx +461 -0
  1511. package/apps/studio/editing/image-drop.tsx +193 -0
  1512. package/apps/studio/editing/index.tsx +402 -0
  1513. package/apps/studio/editing/instance-actions.ts +152 -0
  1514. package/apps/studio/editing/kids-summary.ts +75 -0
  1515. package/apps/studio/editing/kind-dim.tsx +54 -0
  1516. package/apps/studio/editing/layout-actions.ts +159 -0
  1517. package/apps/studio/editing/lock-badge.tsx +178 -0
  1518. package/apps/studio/editing/long-page.ts +102 -0
  1519. package/apps/studio/editing/minimap-context.tsx +161 -0
  1520. package/apps/studio/editing/nudge.tsx +212 -0
  1521. package/apps/studio/editing/object-actions.ts +156 -0
  1522. package/apps/studio/editing/object-keys.ts +58 -0
  1523. package/apps/studio/editing/object-menu.tsx +216 -0
  1524. package/apps/studio/editing/object-ops.ts +114 -0
  1525. package/apps/studio/editing/paste-bar.tsx +388 -0
  1526. package/apps/studio/editing/pen/combine-run.ts +113 -0
  1527. package/apps/studio/editing/pen/draw.tsx +364 -0
  1528. package/apps/studio/editing/pen/index.tsx +48 -0
  1529. package/apps/studio/editing/pen/overlay.tsx +147 -0
  1530. package/apps/studio/editing/pen/pen-geometry.ts +234 -0
  1531. package/apps/studio/editing/pen/point-store.ts +64 -0
  1532. package/apps/studio/editing/pen/points.tsx +421 -0
  1533. package/apps/studio/editing/place-freely.tsx +389 -0
  1534. package/apps/studio/editing/place-ghost.tsx +418 -0
  1535. package/apps/studio/editing/place-image.tsx +219 -0
  1536. package/apps/studio/editing/preset-ruler.tsx +218 -0
  1537. package/apps/studio/editing/rename-order.ts +58 -0
  1538. package/apps/studio/editing/reorder-slot.tsx +567 -0
  1539. package/apps/studio/editing/rotate-handle.tsx +353 -0
  1540. package/apps/studio/editing/selection.tsx +319 -0
  1541. package/apps/studio/editing/set-gap.ts +55 -0
  1542. package/apps/studio/editing/size-ghost.tsx +343 -0
  1543. package/apps/studio/editing/space-tap.ts +56 -0
  1544. package/apps/studio/editing/sticky-name.tsx +112 -0
  1545. package/apps/studio/editing/tab-order.tsx +298 -0
  1546. package/apps/studio/editing/take-keys.ts +115 -0
  1547. package/apps/studio/editing/text-actions.ts +214 -0
  1548. package/apps/studio/editing/text-in-place.tsx +187 -0
  1549. package/apps/studio/editing/tidy-preview.tsx +83 -0
  1550. package/apps/studio/editing/token-ruler.tsx +231 -0
  1551. package/apps/studio/editing/type-role.ts +122 -0
  1552. package/apps/studio/editing/undo-preview.tsx +120 -0
  1553. package/apps/studio/editing/video-label.ts +66 -0
  1554. package/apps/studio/editing/video-play.ts +65 -0
  1555. package/apps/studio/editing/world-menu.ts +36 -0
  1556. package/apps/studio/element-ids.ts +1030 -0
  1557. package/apps/studio/equal-spacing-handles.tsx +1 -1
  1558. package/apps/studio/exporters/_runtime.ts +64 -24
  1559. package/apps/studio/exporters/audio.ts +136 -0
  1560. package/apps/studio/exporters/door-fingerprint.ts +202 -0
  1561. package/apps/studio/exporters/estimate.ts +314 -0
  1562. package/apps/studio/exporters/file-names.ts +197 -0
  1563. package/apps/studio/exporters/format-scopes.ts +7 -1
  1564. package/apps/studio/exporters/hub-render-door.ts +368 -0
  1565. package/apps/studio/exporters/index.ts +53 -7
  1566. package/apps/studio/exporters/jobs.ts +484 -80
  1567. package/apps/studio/exporters/jpg.ts +21 -0
  1568. package/apps/studio/exporters/pdf-fonts.ts +102 -0
  1569. package/apps/studio/exporters/pdf.ts +133 -14
  1570. package/apps/studio/exporters/png.ts +136 -9
  1571. package/apps/studio/exporters/print-back.ts +92 -0
  1572. package/apps/studio/exporters/print-preflight.ts +373 -0
  1573. package/apps/studio/exporters/rects-runner.ts +130 -0
  1574. package/apps/studio/exporters/remote.ts +726 -3
  1575. package/apps/studio/exporters/render-seconds.ts +57 -0
  1576. package/apps/studio/exporters/replay.ts +48 -0
  1577. package/apps/studio/exporters/scope.ts +560 -15
  1578. package/apps/studio/exporters/spec-run.ts +270 -0
  1579. package/apps/studio/exporters/spec-v2.ts +408 -0
  1580. package/apps/studio/exporters/video-cap.ts +280 -0
  1581. package/apps/studio/exporters/wait-ai.ts +192 -0
  1582. package/apps/studio/figma/client.ts +67 -0
  1583. package/apps/studio/figma/comments-to-pins.ts +249 -0
  1584. package/apps/studio/figma/comments-to-strokes.ts +6 -1
  1585. package/apps/studio/figma/into-board.ts +141 -0
  1586. package/apps/studio/figma/to-strokes.ts +54 -0
  1587. package/apps/studio/format.ts +172 -30
  1588. package/apps/studio/fs-watch.ts +28 -1
  1589. package/apps/studio/generation/adapters/gemini.ts +3 -0
  1590. package/apps/studio/generation/adapters/stub.ts +133 -0
  1591. package/apps/studio/generation/gen-sidecar.ts +108 -0
  1592. package/apps/studio/generation/registry.ts +16 -5
  1593. package/apps/studio/generation/takes.ts +398 -0
  1594. package/apps/studio/generation/types.ts +7 -0
  1595. package/apps/studio/git/service.ts +143 -14
  1596. package/apps/studio/github/endpoints.ts +1 -1
  1597. package/apps/studio/github/identity-cache.ts +53 -14
  1598. package/apps/studio/handoff/blockers.ts +120 -0
  1599. package/apps/studio/handoff/run.ts +233 -0
  1600. package/apps/studio/handoff/targets.ts +334 -0
  1601. package/apps/studio/handoff/write-scopes.ts +57 -0
  1602. package/apps/studio/handoff.ts +24 -5
  1603. package/apps/studio/history/changes.ts +199 -0
  1604. package/apps/studio/history/describe-annotations.ts +216 -0
  1605. package/apps/studio/history/describe-css.ts +592 -0
  1606. package/apps/studio/history/describe-match.ts +866 -0
  1607. package/apps/studio/history/describe-meta.ts +281 -0
  1608. package/apps/studio/history/describe-version.ts +89 -0
  1609. package/apps/studio/history/describe-words.ts +513 -0
  1610. package/apps/studio/history/describe.ts +1452 -0
  1611. package/apps/studio/history/last-good.ts +123 -0
  1612. package/apps/studio/history/links.ts +112 -0
  1613. package/apps/studio/history/object-history.ts +535 -0
  1614. package/apps/studio/history/render-ok-signal.ts +81 -0
  1615. package/apps/studio/history/restore-artboard-action.ts +183 -0
  1616. package/apps/studio/history/restore-artboard.ts +607 -0
  1617. package/apps/studio/history/restore-object.ts +168 -0
  1618. package/apps/studio/history/run-label.ts +18 -0
  1619. package/apps/studio/history/surface-requests.ts +115 -0
  1620. package/apps/studio/history/titles.ts +259 -0
  1621. package/apps/studio/history/trash.ts +314 -0
  1622. package/apps/studio/history/version-lanes.ts +115 -0
  1623. package/apps/studio/history/versions.ts +458 -0
  1624. package/apps/studio/hmr-broadcast.ts +55 -1
  1625. package/apps/studio/home/ai.ts +79 -0
  1626. package/apps/studio/home/cli.ts +221 -0
  1627. package/apps/studio/home/cloud.ts +297 -0
  1628. package/apps/studio/home/create-local.ts +164 -0
  1629. package/apps/studio/home/github.ts +99 -0
  1630. package/apps/studio/home/hub.ts +340 -0
  1631. package/apps/studio/home/index-gc.ts +288 -0
  1632. package/apps/studio/home/index-reader.ts +338 -0
  1633. package/apps/studio/home/invite.ts +204 -0
  1634. package/apps/studio/home/main.ts +159 -0
  1635. package/apps/studio/home/pid.ts +12 -0
  1636. package/apps/studio/home/routes.ts +591 -0
  1637. package/apps/studio/home/signin.ts +285 -0
  1638. package/apps/studio/home/user-state.ts +177 -0
  1639. package/apps/studio/home/whats-new.ts +42 -0
  1640. package/apps/studio/http.ts +2589 -947
  1641. package/apps/studio/index/assets-response.ts +34 -0
  1642. package/apps/studio/index/assets.ts +335 -0
  1643. package/apps/studio/index/ds-usage.ts +983 -0
  1644. package/apps/studio/index/extract.ts +348 -0
  1645. package/apps/studio/index/extractors/asset-usage.ts +349 -0
  1646. package/apps/studio/index/extractors/attribution-cache.ts +225 -0
  1647. package/apps/studio/index/history-refs.ts +301 -0
  1648. package/apps/studio/index/history-source.ts +39 -0
  1649. package/apps/studio/index/match.ts +307 -0
  1650. package/apps/studio/index/scan-kick.ts +47 -0
  1651. package/apps/studio/index/service.ts +367 -0
  1652. package/apps/studio/index/snapshot.ts +135 -0
  1653. package/apps/studio/index/types.ts +139 -0
  1654. package/apps/studio/index/version-feed.ts +71 -0
  1655. package/apps/studio/input-router.tsx +522 -55
  1656. package/apps/studio/inspect-canvas.ts +86 -0
  1657. package/apps/studio/inspect-overlay.tsx +192 -0
  1658. package/apps/studio/inspect.ts +96 -33
  1659. package/apps/studio/kinds/convert.ts +175 -0
  1660. package/apps/studio/kinds/export-defaults.ts +42 -0
  1661. package/apps/studio/kinds/meta.ts +237 -0
  1662. package/apps/studio/kinds/physical.ts +84 -0
  1663. package/apps/studio/kinds/presets.ts +452 -0
  1664. package/apps/studio/kinds/print-custom.ts +165 -0
  1665. package/apps/studio/kinds/print-edit.ts +130 -0
  1666. package/apps/studio/kinds/print-guides.ts +23 -0
  1667. package/apps/studio/kinds/safe-zones.ts +250 -0
  1668. package/apps/studio/kinds/warnings.ts +422 -0
  1669. package/apps/studio/layer-name.ts +148 -0
  1670. package/apps/studio/layout/free-space.ts +131 -0
  1671. package/apps/studio/link-chip-overlay.tsx +175 -0
  1672. package/apps/studio/link-import.ts +617 -0
  1673. package/apps/studio/loopback-listen.ts +105 -0
  1674. package/apps/studio/macro-guard.ts +67 -0
  1675. package/apps/studio/managed-projects.ts +63 -14
  1676. package/apps/studio/marquee-overlay.tsx +2 -2
  1677. package/apps/studio/measure-overlay.tsx +10 -4
  1678. package/apps/studio/migrate/cli.ts +164 -0
  1679. package/apps/studio/migrate/ds-registry.ts +42 -0
  1680. package/apps/studio/migrate/engine.ts +926 -0
  1681. package/apps/studio/migrate/hub.ts +219 -0
  1682. package/apps/studio/migrate/steps.ts +627 -0
  1683. package/apps/studio/notifications.tsx +197 -52
  1684. package/apps/studio/outbox/content.ts +139 -0
  1685. package/apps/studio/outbox/drain.ts +269 -0
  1686. package/apps/studio/outbox/hub-reachability.ts +58 -0
  1687. package/apps/studio/outbox/index.ts +57 -0
  1688. package/apps/studio/outbox/policy.ts +859 -0
  1689. package/apps/studio/outbox/senders/export-cloud.ts +116 -0
  1690. package/apps/studio/outbox/store.ts +336 -0
  1691. package/apps/studio/outbox/types.ts +160 -0
  1692. package/apps/studio/participants-chrome.tsx +178 -60
  1693. package/apps/studio/paths.ts +8 -0
  1694. package/apps/studio/photo-store.ts +230 -1
  1695. package/apps/studio/port.ts +93 -0
  1696. package/apps/studio/presence/canvas-presence.tsx +522 -0
  1697. package/apps/studio/presence/fields.ts +93 -0
  1698. package/apps/studio/presence/model.ts +296 -0
  1699. package/apps/studio/presence/tones.ts +39 -0
  1700. package/apps/studio/present/fit.ts +138 -0
  1701. package/apps/studio/present/follow.ts +142 -0
  1702. package/apps/studio/present/media-presence.ts +105 -0
  1703. package/apps/studio/present/meta-schema.ts +612 -0
  1704. package/apps/studio/present/order.ts +153 -0
  1705. package/apps/studio/present/pointer-dot.tsx +379 -0
  1706. package/apps/studio/present/pointer-point.ts +24 -0
  1707. package/apps/studio/present/present-media.ts +446 -0
  1708. package/apps/studio/present/present-stage.tsx +1018 -0
  1709. package/apps/studio/present/present-zoom.ts +63 -0
  1710. package/apps/studio/present/relay-strip.ts +136 -0
  1711. package/apps/studio/preview/preview-camera.tsx +442 -0
  1712. package/apps/studio/preview/wheel-scroll.ts +85 -0
  1713. package/apps/studio/print/units.ts +3 -0
  1714. package/apps/studio/print-overlay-content.tsx +127 -10
  1715. package/apps/studio/read-only-mode.ts +83 -0
  1716. package/apps/studio/readiness.ts +18 -3
  1717. package/apps/studio/ripple.ts +19 -1
  1718. package/apps/studio/routes/agent.ts +1025 -0
  1719. package/apps/studio/routes/ai.ts +422 -0
  1720. package/apps/studio/routes/annotations.ts +649 -0
  1721. package/apps/studio/routes/asset-details.ts +87 -0
  1722. package/apps/studio/routes/asset-rename.ts +60 -0
  1723. package/apps/studio/routes/asset-state.ts +137 -0
  1724. package/apps/studio/routes/asset-trash.ts +77 -0
  1725. package/apps/studio/routes/assets.ts +217 -0
  1726. package/apps/studio/routes/availability.ts +94 -0
  1727. package/apps/studio/routes/canvas-meta-rider.ts +304 -0
  1728. package/apps/studio/routes/canvas-origin.ts +88 -0
  1729. package/apps/studio/routes/canvas-source.ts +315 -0
  1730. package/apps/studio/routes/chat-attach.ts +335 -0
  1731. package/apps/studio/routes/chat.ts +137 -0
  1732. package/apps/studio/routes/cloud-move.ts +364 -0
  1733. package/apps/studio/routes/cloud-plan.ts +36 -0
  1734. package/apps/studio/routes/comments.ts +118 -0
  1735. package/apps/studio/routes/connections.ts +132 -0
  1736. package/apps/studio/routes/describe.ts +122 -0
  1737. package/apps/studio/routes/diagnostics.ts +118 -0
  1738. package/apps/studio/routes/ds-check.ts +124 -0
  1739. package/apps/studio/routes/ds-convert.ts +55 -0
  1740. package/apps/studio/routes/ds-edges.ts +136 -0
  1741. package/apps/studio/routes/ds-library.ts +194 -0
  1742. package/apps/studio/routes/ds-make.ts +91 -0
  1743. package/apps/studio/routes/ds-switch.ts +68 -0
  1744. package/apps/studio/routes/ds-upgrade.ts +139 -0
  1745. package/apps/studio/routes/ds.ts +808 -0
  1746. package/apps/studio/routes/edit.ts +658 -0
  1747. package/apps/studio/routes/element-links.ts +155 -0
  1748. package/apps/studio/routes/export.ts +486 -0
  1749. package/apps/studio/routes/figma.ts +200 -0
  1750. package/apps/studio/routes/generate.ts +443 -0
  1751. package/apps/studio/routes/handoff.ts +319 -0
  1752. package/apps/studio/routes/help-guides.ts +37 -0
  1753. package/apps/studio/routes/history.ts +739 -0
  1754. package/apps/studio/routes/import-link.ts +186 -0
  1755. package/apps/studio/routes/index.ts +293 -0
  1756. package/apps/studio/routes/kinds.ts +257 -0
  1757. package/apps/studio/routes/links.ts +72 -0
  1758. package/apps/studio/routes/outbox.ts +87 -0
  1759. package/apps/studio/routes/photo-every-use.ts +241 -0
  1760. package/apps/studio/routes/pins.ts +66 -0
  1761. package/apps/studio/routes/present.ts +187 -0
  1762. package/apps/studio/routes/project-format.ts +148 -0
  1763. package/apps/studio/routes/project-undo.ts +497 -0
  1764. package/apps/studio/routes/settings.ts +179 -0
  1765. package/apps/studio/routes/share.ts +463 -0
  1766. package/apps/studio/routes/shell.ts +137 -0
  1767. package/apps/studio/routes/sync-conflicts.ts +150 -0
  1768. package/apps/studio/routes/sync.ts +172 -0
  1769. package/apps/studio/routes/table.ts +224 -0
  1770. package/apps/studio/routes/trash.ts +393 -0
  1771. package/apps/studio/routes/video.ts +395 -0
  1772. package/apps/studio/routes/votes.ts +486 -0
  1773. package/apps/studio/safe-zones-overlay.tsx +269 -0
  1774. package/apps/studio/scaffold-design.ts +72 -124
  1775. package/apps/studio/schema/annotations.v2.schema.json +2303 -0
  1776. package/apps/studio/schema/beats.v1.schema.json +94 -0
  1777. package/apps/studio/schema/canvas-meta.v2.schema.json +264 -0
  1778. package/apps/studio/schema/canvas-tsx.md +357 -0
  1779. package/apps/studio/schema/comments.v2.schema.json +125 -0
  1780. package/apps/studio/schema/ds-components-v1.schema.json +96 -0
  1781. package/apps/studio/schema/ds-formats.md +146 -0
  1782. package/apps/studio/schema/ds-head-v1.schema.json +67 -0
  1783. package/apps/studio/schema/ds-revision-v1.schema.json +31 -0
  1784. package/apps/studio/schema/ds-schema-v1.fallbacks.css +118 -0
  1785. package/apps/studio/schema/ds-schema-v1.json +2029 -0
  1786. package/apps/studio/schema/ds-schema-v1.schema.json +663 -0
  1787. package/apps/studio/schema/ds-tokens-v1.schema.json +210 -0
  1788. package/apps/studio/schema/edl.v1.schema.json +124 -0
  1789. package/apps/studio/schema/formats.ts +175 -0
  1790. package/apps/studio/schema/gen.v1.schema.json +33 -0
  1791. package/apps/studio/schema/transcript.v1.schema.json +133 -0
  1792. package/apps/studio/server.ts +454 -166
  1793. package/apps/studio/shell/info-file.ts +54 -0
  1794. package/apps/studio/shell/parent-watch.ts +97 -0
  1795. package/apps/studio/shell/profile.ts +61 -0
  1796. package/apps/studio/shell-canvas-file.ts +36 -0
  1797. package/apps/studio/skip-dirs.ts +455 -0
  1798. package/apps/studio/spoof-chars.ts +17 -0
  1799. package/apps/studio/static-lane.ts +212 -0
  1800. package/apps/studio/sync/accepted-cold-start.ts +35 -13
  1801. package/apps/studio/sync/accepted-link.ts +524 -27
  1802. package/apps/studio/sync/access-notices.ts +143 -0
  1803. package/apps/studio/sync/action-feed.ts +145 -0
  1804. package/apps/studio/sync/action-stage.ts +831 -165
  1805. package/apps/studio/sync/asset-push.ts +24 -2
  1806. package/apps/studio/sync/asset-state.ts +391 -0
  1807. package/apps/studio/sync/atomic-write.ts +42 -1
  1808. package/apps/studio/sync/availability.ts +185 -0
  1809. package/apps/studio/sync/canvas-path.ts +70 -6
  1810. package/apps/studio/sync/cell-pairing.ts +5 -24
  1811. package/apps/studio/sync/comment-door.ts +104 -0
  1812. package/apps/studio/sync/conflict-record.ts +186 -0
  1813. package/apps/studio/sync/create-collision.ts +297 -0
  1814. package/apps/studio/sync/ctl-provider.ts +13 -1
  1815. package/apps/studio/sync/file-membership.ts +95 -10
  1816. package/apps/studio/sync/file-plane.ts +76 -7
  1817. package/apps/studio/sync/format-sync.ts +13 -7
  1818. package/apps/studio/sync/history-fields.ts +61 -0
  1819. package/apps/studio/sync/hub-link.ts +24 -4
  1820. package/apps/studio/sync/hub-text-undo.ts +178 -0
  1821. package/apps/studio/sync/hubs-config.ts +122 -20
  1822. package/apps/studio/sync/index.ts +1444 -127
  1823. package/apps/studio/sync/journal-client.ts +44 -0
  1824. package/apps/studio/sync/keep-both.ts +187 -0
  1825. package/apps/studio/sync/link-consent.ts +390 -0
  1826. package/apps/studio/sync/local-kernel.ts +2725 -0
  1827. package/apps/studio/sync/media-gate.ts +97 -0
  1828. package/apps/studio/sync/object-conflict.ts +199 -0
  1829. package/apps/studio/sync/poke.ts +20 -0
  1830. package/apps/studio/sync/presentation.ts +14 -1
  1831. package/apps/studio/sync/project-config-push.ts +5 -2
  1832. package/apps/studio/sync/projection.ts +201 -34
  1833. package/apps/studio/sync/resync-trace.ts +220 -0
  1834. package/apps/studio/sync/status.ts +8 -1
  1835. package/apps/studio/sync/supervisor.ts +20 -2
  1836. package/apps/studio/sync/transaction-client.ts +364 -34
  1837. package/apps/studio/sync/trash-clear-copies.ts +120 -0
  1838. package/apps/studio/sync/trash-watch.ts +157 -0
  1839. package/apps/studio/sync/trash.ts +50 -2
  1840. package/apps/studio/sync/undo-target.ts +110 -0
  1841. package/apps/studio/sync/workspace-signin.ts +14 -3
  1842. package/apps/studio/sync/write-hold.ts +238 -0
  1843. package/apps/studio/sync/writer-registry.ts +380 -5
  1844. package/apps/studio/sync-name-key.ts +59 -0
  1845. package/apps/studio/thumbs/keys.ts +147 -0
  1846. package/apps/studio/thumbs/routes.ts +68 -0
  1847. package/apps/studio/thumbs/service.ts +884 -0
  1848. package/apps/studio/thumbs/store.ts +114 -0
  1849. package/apps/studio/thumbs/validate.ts +62 -0
  1850. package/apps/studio/tool-palette.tsx +782 -563
  1851. package/apps/studio/toolbars/marker-tip.ts +22 -0
  1852. package/apps/studio/toolbars/shell-panels.ts +55 -0
  1853. package/apps/studio/toolbars/tool-panel.ts +89 -0
  1854. package/apps/studio/toolbars/toolbar-css.ts +283 -0
  1855. package/apps/studio/toolbars/toolbar-icons.tsx +135 -0
  1856. package/apps/studio/toolbars/toolbar-rect.ts +82 -0
  1857. package/apps/studio/ui-prefs-migrate.ts +467 -0
  1858. package/apps/studio/ui-prefs.ts +305 -3
  1859. package/apps/studio/undo-stack.ts +10 -0
  1860. package/apps/studio/use-annotation-resize.tsx +23 -17
  1861. package/apps/studio/use-artboard-drag.tsx +156 -15
  1862. package/apps/studio/use-canvas-keys.ts +58 -0
  1863. package/apps/studio/use-chrome-visibility.tsx +13 -0
  1864. package/apps/studio/use-collab.tsx +556 -56
  1865. package/apps/studio/use-element-resize.tsx +13 -9
  1866. package/apps/studio/use-governed-mode.ts +23 -0
  1867. package/apps/studio/use-keyboard-discipline.tsx +114 -49
  1868. package/apps/studio/use-selection-set.tsx +110 -9
  1869. package/apps/studio/use-snap-guides.tsx +74 -5
  1870. package/apps/studio/use-spacing-handles.tsx +90 -27
  1871. package/apps/studio/use-tool-mode.tsx +204 -10
  1872. package/apps/studio/use-undo-stack.tsx +19 -23
  1873. package/apps/studio/video/beats.ts +484 -0
  1874. package/apps/studio/video/decode-webaudio.ts +115 -0
  1875. package/apps/studio/video/decode.ts +288 -0
  1876. package/apps/studio/video/derive.ts +647 -0
  1877. package/apps/studio/video/format-ids.ts +158 -0
  1878. package/apps/studio/video/framing.ts +246 -0
  1879. package/apps/studio/video/inject.ts +324 -0
  1880. package/apps/studio/video/keyframes.ts +356 -0
  1881. package/apps/studio/video/link-groups.ts +40 -0
  1882. package/apps/studio/video/linked-formats.ts +142 -0
  1883. package/apps/studio/video/mask-comments.ts +36 -0
  1884. package/apps/studio/video/media-analysis.ts +169 -0
  1885. package/apps/studio/video/reel-place.ts +286 -0
  1886. package/apps/studio/video/reframe-read.ts +90 -0
  1887. package/apps/studio/video/schema.ts +422 -0
  1888. package/apps/studio/video/speech.ts +129 -0
  1889. package/apps/studio/video/title-motion.ts +85 -0
  1890. package/apps/studio/video/transcript-cut.ts +91 -0
  1891. package/apps/studio/video/whisper-parse.ts +123 -0
  1892. package/apps/studio/video/words-run.ts +210 -0
  1893. package/apps/studio/video/words-timing.ts +222 -0
  1894. package/apps/studio/video-comp.tsx +238 -9
  1895. package/apps/studio/video-links-overlay.tsx +272 -0
  1896. package/apps/studio/video-natural.ts +73 -0
  1897. package/apps/studio/video-play-chrome.tsx +229 -0
  1898. package/apps/studio/video-play-overlay.tsx +190 -0
  1899. package/apps/studio/video-vocab.tsx +460 -0
  1900. package/apps/studio/view-only-gesture.tsx +101 -0
  1901. package/apps/studio/viewport-fit.ts +28 -0
  1902. package/apps/studio/web-overlay-content.tsx +4 -2
  1903. package/apps/studio/whats-new.json +55 -20
  1904. package/apps/studio/whats-new.schema.json +10 -0
  1905. package/apps/studio/whats-new.ts +4 -0
  1906. package/apps/studio/workspace-mode.ts +10 -0
  1907. package/apps/studio/ws.ts +299 -8
  1908. package/cli/bin/maude.mjs +2 -0
  1909. package/cli/commands/design.mjs +401 -72
  1910. package/cli/commands/flow.mjs +73 -0
  1911. package/cli/commands/help.mjs +14 -1
  1912. package/cli/commands/init.mjs +1 -1
  1913. package/cli/commands/migrate.mjs +55 -0
  1914. package/cli/lib/bash-guard.mjs +1691 -0
  1915. package/cli/lib/cache.mjs +1 -1
  1916. package/cli/lib/confine-out.mjs +150 -0
  1917. package/cli/lib/confine-read.mjs +179 -0
  1918. package/cli/lib/confine-root.mjs +157 -0
  1919. package/cli/lib/ddr-to-kgai.mjs +2 -2
  1920. package/cli/lib/design-help.gen.mjs +119 -0
  1921. package/cli/lib/design-hook.mjs +1764 -0
  1922. package/cli/lib/design-link.mjs +68 -4
  1923. package/cli/lib/design-open.mjs +238 -0
  1924. package/cli/lib/export-spec.mjs +394 -0
  1925. package/cli/lib/finding-text.mjs +63 -0
  1926. package/cli/lib/flow-usage.mjs +133 -0
  1927. package/cli/lib/gitignore-block.mjs +1 -0
  1928. package/cli/lib/handoff.mjs +285 -0
  1929. package/cli/lib/handoff.schema.json +336 -0
  1930. package/cli/lib/hubs-config.mjs +10 -0
  1931. package/cli/lib/json-schema-lite.mjs +260 -0
  1932. package/cli/lib/project-links.mjs +88 -0
  1933. package/cli/lib/studio-locate.mjs +83 -0
  1934. package/cli/lib/sub-verbs.mjs +111 -0
  1935. package/cli/lib/workspace-plan.mjs +16 -3
  1936. package/package.json +30 -11
  1937. package/plugins/design/README.md +46 -0
  1938. package/plugins/design/templates/_shell.html +749 -69
  1939. package/plugins/design/templates/blank-canvas.tsx.template +26 -0
  1940. package/plugins/design/templates/brief-board.tsx.template +12 -11
  1941. package/plugins/design/templates/canvas.tsx.template +3 -3
  1942. package/plugins/design/templates/design-system-inspiration/core/README.philosophy.md.tpl +104 -0
  1943. package/plugins/design/templates/design-system-inspiration/core/colors_and_type.css.tpl +38 -3
  1944. package/plugins/design/templates/design-system-inspiration/core/components.json.tpl +127 -0
  1945. package/plugins/design/templates/design-system-inspiration/core/config.json.tpl +1 -0
  1946. package/plugins/design/templates/design-system-inspiration/core/preview/_components.css.tpl +111 -0
  1947. package/plugins/flow/.claude-plugin/config.schema.json +170 -9
  1948. package/plugins/flow/README.md +18 -17
  1949. package/plugins/flow/dependencies.json +25 -26
  1950. package/plugins/flow/templates/ai-skeleton/INDEX.md +3 -3
  1951. package/plugins/flow/templates/ai-skeleton/README.md +5 -5
  1952. package/plugins/flow/templates/ai-skeleton/context/README.md +1 -1
  1953. package/plugins/flow/templates/ai-skeleton/logs/README.md +1 -1
  1954. package/plugins/flow/templates/ai-skeleton/plans/README.md +1 -1
  1955. package/plugins/flow/templates/ai-skeleton/reviews/README.md +2 -2
  1956. package/plugins/flow/templates/ai-skeleton/scenario-guide.md +4 -4
  1957. package/plugins/flow/templates/ai-skeleton/scenarios/README.md +2 -2
  1958. package/plugins/flow/templates/ai-skeleton/templates/HANDOFF.md +1 -1
  1959. package/apps/studio/annotations/ui/edit-actions.ts +0 -551
  1960. package/apps/studio/canvas-header.ts +0 -165
  1961. package/apps/studio/client/hmr.mjs +0 -113
  1962. package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +0 -297
  1963. package/apps/studio/client/iframe-lazy.mjs +0 -121
  1964. package/apps/studio/client/inspector/artboard-knobs.jsx +0 -456
  1965. package/apps/studio/client/menus/menubar.jsx +0 -856
  1966. package/apps/studio/client/panels/CapabilityBar.jsx +0 -101
  1967. package/apps/studio/client/panels/ClipInspector.jsx +0 -409
  1968. package/apps/studio/client/panels/GitPanel.jsx +0 -1026
  1969. package/apps/studio/client/panels/OnboardingWizard.jsx +0 -642
  1970. package/apps/studio/client/panels/StickerPicker.jsx +0 -160
  1971. package/apps/studio/client/panels/SyncPanel.jsx +0 -1190
  1972. package/apps/studio/client/panels/TimelinePanel.jsx +0 -2259
  1973. package/apps/studio/client/share-dialog.jsx +0 -91
  1974. package/apps/studio/client/shell/collapsed-rail.jsx +0 -23
  1975. package/apps/studio/client/shell/status-bar.jsx +0 -215
  1976. package/apps/studio/client/styles/1-tokens-maude.css +0 -296
  1977. package/apps/studio/client/styles/1-tokens.css +0 -304
  1978. package/apps/studio/client/styles/3-shell-maude.css +0 -3158
  1979. package/apps/studio/client/styles/3-shell.css +0 -1036
  1980. package/apps/studio/client/styles/4-components-maude.css +0 -134
  1981. package/apps/studio/client/styles/4-components.css +0 -2204
  1982. package/apps/studio/client/styles/5-maude-overrides.css +0 -162
  1983. package/apps/studio/client/styles.css +0 -1264
  1984. package/apps/studio/contextual-toolbar.tsx +0 -512
  1985. package/apps/studio/export-dialog.tsx +0 -827
  1986. package/apps/studio/undo-hud.tsx +0 -16
@@ -27,12 +27,35 @@
27
27
  // (matches the locator.ts pattern). Two parallel edits against different
28
28
  // canvases run in parallel.
29
29
 
30
+ import { AsyncLocalStorage } from 'node:async_hooks';
31
+ import { existsSync, realpathSync } from 'node:fs';
30
32
  import { mkdir, open, stat, unlink } from 'node:fs/promises';
31
33
  import { tmpdir } from 'node:os';
32
34
  import path from 'node:path';
33
35
 
34
36
  import MagicString from 'magic-string';
35
37
  import { parseSync } from 'oxc-parser';
38
+ import { fileText } from '../../cli/lib/finding-text.mjs';
39
+ import { saveHold } from './ai/save-hold.ts';
40
+ import { formatLinkTarget, type LinkTarget, parseLinkTarget } from './bridge/link-target.ts';
41
+ import { slotCss } from './edit-ops/slot-defaults.ts';
42
+ import {
43
+ attrRemovalSpan,
44
+ copyWithoutIds,
45
+ type ElementId,
46
+ generateElementId,
47
+ type IdElement,
48
+ insertIds,
49
+ isValidElementId,
50
+ seedOf,
51
+ usedIds,
52
+ walkIdElements,
53
+ withIdAttr,
54
+ } from './element-ids.ts';
55
+ import { isSafeZoneId } from './kinds/safe-zones.ts';
56
+ import { sourceHold } from './sync/write-hold.ts';
57
+ import { maskComments } from './video/mask-comments.ts';
58
+ import { type ReframeRead, reframeOf } from './video/reframe-read.ts';
36
59
 
37
60
  export class CanvasEditError extends Error {
38
61
  readonly canvas: string;
@@ -290,6 +313,65 @@ export interface EditResult {
290
313
  previous?: AttributeState;
291
314
  }
292
315
 
316
+ /**
317
+ * S11.17 (C37) — the canvas as every edit here sees it: the bytes a full disk is holding
318
+ * (sync/write-hold.ts), else the file. An edit made while the disk is full builds on the last one.
319
+ */
320
+ async function readCanvasSource(file: { text(): Promise<string> }, abs: string): Promise<string> {
321
+ // p8-a1-save-hold — a person's save held behind an AI interpreter call is what the file WILL hold
322
+ const waiting = saveHold().read(abs);
323
+ if (waiting !== undefined) return waiting;
324
+ const held = sourceHold().read(abs);
325
+ if (held !== undefined) return typeof held === 'string' ? held : new TextDecoder().decode(held);
326
+ const text = await file.text();
327
+ readBase.set(abs, text);
328
+ return text;
329
+ }
330
+
331
+ /** p8-a1-save-hold — the disk bytes each canvas's last edit was made on (a held save's merge base). */
332
+ const readBase = new Map<string, string>();
333
+
334
+ /**
335
+ * Every write here: tmp + rename in the same folder (a reader never sees half a file). On a full
336
+ * disk the bytes wait in the studio's hold and land once there is room (S11.17).
337
+ */
338
+ async function writeCanvasSource(abs: string, source: string): Promise<void> {
339
+ const say = writeSaying.getStore();
340
+ // p8-a1-save-hold — a person's save to a file a running interpreter call names waits until the call is
341
+ // done (+ settle), then lands as theirs (ai/save-hold.ts). Nothing is said now: the landing says it.
342
+ if (saveHold().holds(abs)) {
343
+ const base = readBase.get(abs) ?? source;
344
+ readBase.delete(abs);
345
+ saveHold().hold(abs, source, { base, ...(say?.label ? { label: say.label } : {}) });
346
+ return;
347
+ }
348
+ readBase.delete(abs);
349
+ say?.writing(abs, source);
350
+ try {
351
+ await sourceHold().put(abs, source);
352
+ } catch (e) {
353
+ say?.failed(abs, source);
354
+ throw e;
355
+ }
356
+ }
357
+
358
+ /** F4 — what a caller is told about each canvas write it makes: before the bytes land, and if they never do. */
359
+ export interface CanvasWriteSaying {
360
+ writing(abs: string, source: string): void;
361
+ failed(abs: string, source: string): void;
362
+ /** the history line the write says (a held save's landing says it) */
363
+ label?: string;
364
+ }
365
+ const writeSaying = new AsyncLocalStorage<CanvasWriteSaying>();
366
+
367
+ /**
368
+ * F4 — run `fn` with every canvas write it makes said to `say` BEFORE the bytes land (api.ts's legacy
369
+ * write path says `source-writing` this way, like routes/edit.ts), and taken back when the write throws.
370
+ */
371
+ export function sayingCanvasWrites<T>(say: CanvasWriteSaying, fn: () => Promise<T>): Promise<T> {
372
+ return writeSaying.run(say, fn);
373
+ }
374
+
293
375
  /**
294
376
  * Apply a single-attribute edit to the JSX element with the given `data-cd-id`.
295
377
  * Reads the canvas, rewrites in memory, writes atomically (via Bun.write to a
@@ -311,7 +393,7 @@ export async function editAttribute(
311
393
  id,
312
394
  });
313
395
  }
314
- const source = await file.text();
396
+ const source = await readCanvasSource(file, canvasAbsPath);
315
397
  // Read under the same per-file lock as the write — no gap between the read
316
398
  // that proves the precondition (and records what is replaced) and the rename.
317
399
  const previous = readAttributeState(canvasAbsPath, source, id, attr, occurrence);
@@ -323,10 +405,7 @@ export async function editAttribute(
323
405
  }
324
406
  const next = applyEdit(canvasAbsPath, source, id, attr, value, occurrence);
325
407
  if (next.source === source) return { source, delta: 0, changed: false, previous };
326
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
327
- await Bun.write(tmp, next.source);
328
- const { rename } = await import('node:fs/promises');
329
- await rename(tmp, canvasAbsPath);
408
+ await writeCanvasSource(canvasAbsPath, next.source);
330
409
  return { ...next, changed: true, previous };
331
410
  });
332
411
  }
@@ -354,7 +433,7 @@ export async function removeAttribute(
354
433
  id,
355
434
  });
356
435
  }
357
- const source = await file.text();
436
+ const source = await readCanvasSource(file, canvasAbsPath);
358
437
  const previous = readAttributeState(canvasAbsPath, source, id, attr, occurrence);
359
438
  if (
360
439
  precondition &&
@@ -364,10 +443,7 @@ export async function removeAttribute(
364
443
  }
365
444
  const next = applyRemove(canvasAbsPath, source, id, attr, occurrence);
366
445
  if (next.source === source) return { source, delta: 0, changed: false, previous };
367
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
368
- await Bun.write(tmp, next.source);
369
- const { rename } = await import('node:fs/promises');
370
- await rename(tmp, canvasAbsPath);
446
+ await writeCanvasSource(canvasAbsPath, next.source);
371
447
  return { ...next, changed: true, previous };
372
448
  });
373
449
  }
@@ -476,6 +552,19 @@ function checkPrecondition(
476
552
  });
477
553
  }
478
554
 
555
+ /**
556
+ * V2-2.19 (contract V2-1.4 §5.2 / §4.6): every `data-cd-*` attribute is canvas-only — written by its
557
+ * own gesture (stamp, lock, hide), never by the generic attribute writer or a D18 raw row.
558
+ */
559
+ function refuseCanvasOnlyAttr(canvasAbsPath: string, id: string, attr: string): void {
560
+ if (attr.startsWith('data-cd-')) {
561
+ throw new CanvasEditError(
562
+ `"${attr}" is canvas-only — it is written by its own gesture (lock, hide, element id), not as an attribute`,
563
+ { canvas: canvasAbsPath, id }
564
+ );
565
+ }
566
+ }
567
+
479
568
  /** Pure variant of `removeAttribute` — exposed for tests. */
480
569
  export function applyRemove(
481
570
  canvasAbsPath: string,
@@ -484,6 +573,7 @@ export function applyRemove(
484
573
  attr: string,
485
574
  occurrence?: number
486
575
  ): EditResult {
576
+ refuseCanvasOnlyAttr(canvasAbsPath, id, attr);
487
577
  const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
488
578
  if (parsed.errors && parsed.errors.length > 0) {
489
579
  const first = parsed.errors[0];
@@ -545,7 +635,7 @@ export async function editText(
545
635
  id,
546
636
  });
547
637
  }
548
- const source = await file.text();
638
+ const source = await readCanvasSource(file, canvasAbsPath);
549
639
  // Byte cap before the AST walk (ethical-hacker F-C) — a real canvas is well
550
640
  // under this; a pathologically large attacker-authored file that would make
551
641
  // the resolver's per-candidate walk expensive is refused up front.
@@ -557,10 +647,7 @@ export async function editText(
557
647
  }
558
648
  const next = applyTextEdit(canvasAbsPath, source, id, text, opts);
559
649
  if (next.source === source) return { source, delta: 0, changed: false };
560
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
561
- await Bun.write(tmp, next.source);
562
- const { rename } = await import('node:fs/promises');
563
- await rename(tmp, canvasAbsPath);
650
+ await writeCanvasSource(canvasAbsPath, next.source);
564
651
  return { ...next, changed: true };
565
652
  });
566
653
  }
@@ -578,6 +665,7 @@ export function applyEdit(
578
665
  value: string,
579
666
  occurrence?: number
580
667
  ): EditResult {
668
+ refuseCanvasOnlyAttr(canvasAbsPath, id, attr);
581
669
  const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
582
670
  if (parsed.errors && parsed.errors.length > 0) {
583
671
  const first = parsed.errors[0];
@@ -1318,6 +1406,22 @@ function resolveUsageId(
1318
1406
  return usages[i]?.id ?? domId;
1319
1407
  }
1320
1408
 
1409
+ /**
1410
+ * p8-lock-reasons — the `<Component>` usage an instance write lands on (resolveUsageId), for the lock lookup: a
1411
+ * whole-instance move / detach writes THAT usage, so its `data-cd-locked` is the one that refuses. `domId` itself
1412
+ * when there is no splittable usage, or the source does not parse.
1413
+ */
1414
+ export function usageIdOf(
1415
+ canvasAbsPath: string,
1416
+ source: string,
1417
+ domId: string,
1418
+ occurrenceIndex: number | undefined
1419
+ ): string {
1420
+ const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
1421
+ if (parsed.errors?.length) return domId;
1422
+ return resolveUsageId(parsed.program, domId, occurrenceIndex);
1423
+ }
1424
+
1321
1425
  /**
1322
1426
  * Edit-scope verdict for the INV-3 predictability badge (feature-element-editing-
1323
1427
  * robustness Stage H). Tells the Inspector whether a style/attr edit to `domId`
@@ -1410,13 +1514,10 @@ export async function moveElement(
1410
1514
  id,
1411
1515
  });
1412
1516
  }
1413
- const source = await file.text();
1517
+ const source = await readCanvasSource(file, canvasAbsPath);
1414
1518
  const next = applyMove(canvasAbsPath, source, id, refId, position, idIndex, refIndex);
1415
1519
  if (next.source === source) return next;
1416
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
1417
- await Bun.write(tmp, next.source);
1418
- const { rename } = await import('node:fs/promises');
1419
- await rename(tmp, canvasAbsPath);
1520
+ await writeCanvasSource(canvasAbsPath, next.source);
1420
1521
  return next;
1421
1522
  });
1422
1523
  }
@@ -1688,13 +1789,10 @@ export async function retimeSequence(
1688
1789
  id: String(seqIndex),
1689
1790
  });
1690
1791
  }
1691
- const source = await file.text();
1792
+ const source = await readCanvasSource(file, canvasAbsPath);
1692
1793
  const next = applyRetimeSequence(canvasAbsPath, source, seqIndex, patch);
1693
1794
  if (next.source === source) return next;
1694
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
1695
- await Bun.write(tmp, next.source);
1696
- const { rename } = await import('node:fs/promises');
1697
- await rename(tmp, canvasAbsPath);
1795
+ await writeCanvasSource(canvasAbsPath, next.source);
1698
1796
  return next;
1699
1797
  });
1700
1798
  }
@@ -1776,7 +1874,7 @@ export async function retimeSequenceByClip(
1776
1874
  id: stableId,
1777
1875
  });
1778
1876
  }
1779
- const source = await file.text();
1877
+ const source = await readCanvasSource(file, canvasAbsPath);
1780
1878
  const next = applyRetimeSequenceByClip(
1781
1879
  canvasAbsPath,
1782
1880
  source,
@@ -1786,10 +1884,7 @@ export async function retimeSequenceByClip(
1786
1884
  patch
1787
1885
  );
1788
1886
  if (next.source === source) return next;
1789
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
1790
- await Bun.write(tmp, next.source);
1791
- const { rename } = await import('node:fs/promises');
1792
- await rename(tmp, canvasAbsPath);
1887
+ await writeCanvasSource(canvasAbsPath, next.source);
1793
1888
  return next;
1794
1889
  });
1795
1890
  }
@@ -2268,6 +2363,71 @@ function hashSpan(source: string, start: number, end: number): string {
2268
2363
  return Bun.hash(source.slice(start, end)).toString(16).padStart(16, '0').slice(0, 12);
2269
2364
  }
2270
2365
 
2366
+ /** S7.10 — `<TitleMotion preset="slide-up" frames={20}>` inside a clip's span (literal props only). */
2367
+ function titleMotionOf(span: string): { preset: string; frames: number | null } | null {
2368
+ const tag = /<TitleMotion\b[^>]*>/.exec(span)?.[0];
2369
+ if (!tag) return null;
2370
+ const preset = /\bpreset="([a-z-]+)"/.exec(tag)?.[1];
2371
+ if (!preset) return null;
2372
+ const frames = /\bframes=\{(\d+)\}/.exec(tag)?.[1];
2373
+ return { preset, frames: frames ? Number(frames) : null };
2374
+ }
2375
+
2376
+ /**
2377
+ * S7.11b — the font and colour of a title: the `style` literal of the element holding the clip's first `{"…"}` string
2378
+ * (the same literal `clip.set-text` rewrites), read as text. Null when the clip holds no such text. The walk and the
2379
+ * rules mirror `edit-ops/clip/title-style.ts` (which writes it); kept here because that module imports this one.
2380
+ */
2381
+ function titleStyleOfClip(node: AnyNode): { font: string | null; color: string | null } | null {
2382
+ const isStr = (n: AnyNode) =>
2383
+ (n?.type === 'Literal' || n?.type === 'StringLiteral') && typeof n.value === 'string';
2384
+ const holder = (el: AnyNode): AnyNode | null => {
2385
+ if (!el || el.type !== 'JSXElement') return null;
2386
+ // document order: the nearest text child of this element comes before the text of a child element after it
2387
+ for (const ch of el.children ?? []) {
2388
+ if (ch?.type === 'JSXExpressionContainer' && isStr(ch.expression)) return el;
2389
+ if (ch?.type === 'JSXElement') {
2390
+ const inner = holder(ch);
2391
+ if (inner) return inner;
2392
+ }
2393
+ }
2394
+ return null;
2395
+ };
2396
+ const el = holder(node);
2397
+ if (!el) return null;
2398
+ const out = { font: null as string | null, color: null as string | null };
2399
+ const expr = findAttribute(el.openingElement, 'style')?.value;
2400
+ const obj = expr?.type === 'JSXExpressionContainer' ? expr.expression : null;
2401
+ if (obj?.type !== 'ObjectExpression') return out;
2402
+ for (const p of obj.properties ?? []) {
2403
+ if ((p?.type !== 'Property' && p?.type !== 'ObjectProperty') || p.computed) continue;
2404
+ const k = p.key?.type === 'Identifier' ? p.key.name : isStr(p.key) ? p.key.value : null;
2405
+ if (!isStr(p.value)) continue;
2406
+ if (k === 'fontFamily') out.font = p.value.value;
2407
+ else if (k === 'color') out.color = p.value.value;
2408
+ }
2409
+ return out;
2410
+ }
2411
+
2412
+ /** S7.10 — the text `applySetClipText` would rewrite (same pattern), or null. */
2413
+ function literalTextOf(span: string): string | null {
2414
+ const m = span.match(/\{("(?:[^"\\]|\\.)*")\}/);
2415
+ if (!m?.[1]) return null;
2416
+ try {
2417
+ const v = JSON.parse(m[1]);
2418
+ return typeof v === 'string' ? v : null;
2419
+ } catch {
2420
+ return null;
2421
+ }
2422
+ }
2423
+
2424
+ /** S7.10 — the `fit` literal of the clip's `<Reframe>`. */
2425
+ function fitOf(span: string): 'fill' | 'fit' | 'blur' | null {
2426
+ const tag = /<Reframe\b[^>]*>/.exec(span)?.[0];
2427
+ const fit = tag ? /\bfit="(fill|fit|blur)"/.exec(tag)?.[1] : undefined;
2428
+ return (fit as 'fill' | 'fit' | 'blur' | undefined) ?? null;
2429
+ }
2430
+
2271
2431
  /** One clip (timeline row) + everything an op needs to address + label it. */
2272
2432
  export interface ClipInfo {
2273
2433
  /** Durable identity: `name:<Sequence name>` → `mclip:<sentinel>` → `<comp>#<indexInComp>`. */
@@ -2309,6 +2469,19 @@ export interface ClipInfo {
2309
2469
  /** Crop/reposition wrapper marker (`data-mframe="scale,x,y"`). */
2310
2470
  framing: { scale: number; x: number; y: number } | null;
2311
2471
  } | null;
2472
+ /** S7.10 — the title's entrance (`<TitleMotion preset frames>` around its content), read as literal text
2473
+ * like `data-mframe`; null when the clip has none. The clip inspector's Motion row shows it. */
2474
+ titleMotion: { preset: string; frames: number | null } | null;
2475
+ /** S7.11b — the font and colour the title's own `style` literal says (the Title inspector's Font and Colour rows);
2476
+ * null parts are not set. Null when the clip holds no text at all. */
2477
+ titleStyle: { font: string | null; color: string | null } | null;
2478
+ /** S7.10 — the clip's editable text: its first `{"…"}` literal (a Title overlay's child, an AI slate's prompt) —
2479
+ * what `clip.set-text` rewrites, so the inspector's Text row starts from what is there. */
2480
+ text: string | null;
2481
+ /** S7.10 — the picture's `fit` on the clip's `<Reframe>` (Fill · Fit · Blur behind); null = not set. */
2482
+ fit: 'fill' | 'fit' | 'blur' | null;
2483
+ /** S7.13 — the clip's framing keyframes (`<Reframe focus formats zoom>`, in source time) for the Re-frame island; null = centred. */
2484
+ reframe: ReframeRead | null;
2312
2485
  /** The clip's stacked layers (mp4 background + title/lower-third + …) for the
2313
2486
  * expandable timeline rows. Empty for a pure inline card. */
2314
2487
  layers: ClipLayer[];
@@ -2333,6 +2506,10 @@ export interface LooseMediaInfo {
2333
2506
  src: string | null;
2334
2507
  cdId: string | null;
2335
2508
  contentHash: string;
2509
+ /** S7.4 — the element's source span, so `video/derive.ts` can read a music bed's literal timing
2510
+ * props (`trimBefore`, a fractional `playbackRate`, `volume={0}`) without a second parse. */
2511
+ start: number;
2512
+ end: number;
2336
2513
  }
2337
2514
 
2338
2515
  export interface CompClips {
@@ -2483,6 +2660,8 @@ export function enumerateClips(
2483
2660
  const componentBodies = collectComponentBodies(program);
2484
2661
  const arrays = collectArrayLiterals(program);
2485
2662
  const scoped = targetComp == null ? [] : clips.filter((c) => c.comp === targetComp);
2663
+ // a comment that names <TitleMotion> / <Reframe> is not one (the `@mclip` sentinel above still reads the raw text)
2664
+ const masked = maskComments(source);
2486
2665
  const clipInfos: ClipInfo[] = scoped.map((c) => {
2487
2666
  const opening = c.node.openingElement;
2488
2667
  const nameAttr = getStringAttr(opening, 'name');
@@ -2544,6 +2723,11 @@ export function enumerateClips(
2544
2723
  mediaShared: m ? m.shared : false,
2545
2724
  clipCdId: cdIdOf.get(c.node) ?? null,
2546
2725
  mediaProps,
2726
+ text: literalTextOf(source.slice(c.start, c.end)),
2727
+ titleMotion: titleMotionOf(masked.slice(c.start, c.end)),
2728
+ titleStyle: titleStyleOfClip(c.node),
2729
+ fit: fitOf(masked.slice(c.start, c.end)),
2730
+ reframe: reframeOf(masked.slice(c.start, c.end)),
2547
2731
  placeholder: (() => {
2548
2732
  // Direct <AIPlaceholder> child → a slate clip (Task 21). The prompt is
2549
2733
  // authored as `prompt={"…"}` (JSON.stringify — DDR-150 P1), so read
@@ -2607,6 +2791,8 @@ export function enumerateClips(
2607
2791
  src: getStringAttr(mel.node.openingElement, 'src'),
2608
2792
  cdId: cdIdOf.get(mel.node) ?? null,
2609
2793
  contentHash: hashSpan(source, mel.start, mel.end),
2794
+ start: mel.start,
2795
+ end: mel.end,
2610
2796
  }));
2611
2797
 
2612
2798
  return {
@@ -2793,13 +2979,10 @@ export async function removeClip(
2793
2979
  id: stableId,
2794
2980
  });
2795
2981
  }
2796
- const source = await file.text();
2982
+ const source = await readCanvasSource(file, canvasAbsPath);
2797
2983
  const nextSrc = applyRemoveClip(canvasAbsPath, source, artboardId, stableId, expectedHash);
2798
2984
  if (nextSrc.source === source) return nextSrc;
2799
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
2800
- await Bun.write(tmp, nextSrc.source);
2801
- const { rename } = await import('node:fs/promises');
2802
- await rename(tmp, canvasAbsPath);
2985
+ await writeCanvasSource(canvasAbsPath, nextSrc.source);
2803
2986
  return nextSrc;
2804
2987
  });
2805
2988
  }
@@ -2899,7 +3082,7 @@ export async function reorderClip(
2899
3082
  id: movedStableId,
2900
3083
  });
2901
3084
  }
2902
- const source = await file.text();
3085
+ const source = await readCanvasSource(file, canvasAbsPath);
2903
3086
  const next = applyReorderClip(
2904
3087
  canvasAbsPath,
2905
3088
  source,
@@ -2911,10 +3094,7 @@ export async function reorderClip(
2911
3094
  position
2912
3095
  );
2913
3096
  if (next.source === source) return next;
2914
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
2915
- await Bun.write(tmp, next.source);
2916
- const { rename } = await import('node:fs/promises');
2917
- await rename(tmp, canvasAbsPath);
3097
+ await writeCanvasSource(canvasAbsPath, next.source);
2918
3098
  return next;
2919
3099
  });
2920
3100
  }
@@ -3020,13 +3200,10 @@ export async function toggleClipHidden(
3020
3200
  id: stableId,
3021
3201
  });
3022
3202
  }
3023
- const source = await file.text();
3203
+ const source = await readCanvasSource(file, canvasAbsPath);
3024
3204
  const next = applyToggleClipHidden(canvasAbsPath, source, artboardId, stableId, expectedHash);
3025
3205
  if (next.source === source) return next;
3026
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3027
- await Bun.write(tmp, next.source);
3028
- const { rename } = await import('node:fs/promises');
3029
- await rename(tmp, canvasAbsPath);
3206
+ await writeCanvasSource(canvasAbsPath, next.source);
3030
3207
  return next;
3031
3208
  });
3032
3209
  }
@@ -3144,13 +3321,10 @@ export async function insertClip(
3144
3321
  id: artboardId ?? '',
3145
3322
  });
3146
3323
  }
3147
- const source = await file.text();
3324
+ const source = await readCanvasSource(file, canvasAbsPath);
3148
3325
  const next = applyInsertClip(canvasAbsPath, source, artboardId, opts);
3149
3326
  if (next.source === source) return next;
3150
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3151
- await Bun.write(tmp, next.source);
3152
- const { rename } = await import('node:fs/promises');
3153
- await rename(tmp, canvasAbsPath);
3327
+ await writeCanvasSource(canvasAbsPath, next.source);
3154
3328
  return next;
3155
3329
  });
3156
3330
  }
@@ -3251,13 +3425,10 @@ export async function editArrayElementString(
3251
3425
  id: arrayName,
3252
3426
  });
3253
3427
  }
3254
- const source = await file.text();
3428
+ const source = await readCanvasSource(file, canvasAbsPath);
3255
3429
  const next = applyEditArrayElementString(canvasAbsPath, source, arrayName, index, field, value);
3256
3430
  if (next.source === source) return next;
3257
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3258
- await Bun.write(tmp, next.source);
3259
- const { rename } = await import('node:fs/promises');
3260
- await rename(tmp, canvasAbsPath);
3431
+ await writeCanvasSource(canvasAbsPath, next.source);
3261
3432
  return next;
3262
3433
  });
3263
3434
  }
@@ -3272,20 +3443,41 @@ export async function editArrayElementString(
3272
3443
  // and Cmd+Z reverts by whole-file swap through /_api/reorder-revert). Each runs
3273
3444
  // the same reparse gate as `applyMove`: never write source that doesn't parse.
3274
3445
 
3446
+ /**
3447
+ * r2-text-tool (UX audit GD-10) — a new text's font when nothing names one: the system's body font token, the
3448
+ * system UI sans behind it. Never the browser's default serif (a canvas with no design system inherits Times).
3449
+ */
3450
+ export const TEXT_FONT_FALLBACK = 'var(--font-body, system-ui, -apple-system, sans-serif)';
3451
+
3275
3452
  /** Kind of element the insert palette can synthesize. */
3276
3453
  export type InsertKind = 'div' | 'text' | 'image';
3277
3454
 
3278
- /** Synthesize a minimal, self-styled JSX element for an insert. No `data-cd-id`
3279
- * — the pipeline stamps it on the next transpile (canvas-pipeline stamping is
3280
- * unconditional). The new element lands selectable + immediately styleable. */
3455
+ /** Synthesize a minimal, self-styled JSX element for an insert. The new element
3456
+ * lands selectable + immediately styleable; `stampSynthElement` gives it its
3457
+ * stable id (V2-2.19). */
3281
3458
  function synthInsertElement(kind: InsertKind, src?: string): string {
3282
- if (kind === 'text') return `<p style={{ margin: 0 }}>Text</p>`;
3459
+ if (kind === 'text')
3460
+ return `<p style={{ margin: 0, color: '${slotCss('text')}', fontFamily: '${TEXT_FONT_FALLBACK}' }}>Text</p>`;
3283
3461
  if (kind === 'image') {
3284
3462
  const s = (src ?? '').trim();
3285
3463
  return `<img src="${escapeAttr(s)}" alt="" style={{ width: 160, height: 120, objectFit: 'cover', borderRadius: 8 }} />`;
3286
3464
  }
3287
- // div — a visible neutral placeholder box the user can immediately restyle.
3288
- return `<div style={{ width: 120, height: 80, background: 'var(--bg-2)', borderRadius: 8 }} />`;
3465
+ // div — a visible neutral placeholder box the user can immediately restyle. TD3: the same neutral role + literal
3466
+ // as a drawn shape (`edit-ops/slot-defaults.ts`).
3467
+ return `<div style={{ width: 120, height: 80, background: '${slotCss('fill')}', borderRadius: 8 }} />`;
3468
+ }
3469
+
3470
+ /**
3471
+ * V2-2.19 (contract V2-1.4 §4.3 / §5.2): a studio writer that CREATES an element stamps it, so the
3472
+ * new element's id is stable from its first write. The readable id comes from the synthesized
3473
+ * element (`div`, `text`, `img`, then `-2`, `-3` …), unique against every id already in the file.
3474
+ */
3475
+ function stampSynthElement(canvasAbsPath: string, source: string, jsx: string): string {
3476
+ const walk = walkIdElements(source, canvasAbsPath);
3477
+ if (!walk.ok) return jsx; // the caller's own parse gate reports it
3478
+ const tag = /^<([A-Za-z][\w.:-]*)/.exec(jsx)?.[1] ?? 'el';
3479
+ const text = /^<[^>]*>([^<]*)</.exec(jsx)?.[1] ?? '';
3480
+ return withIdAttr(jsx, generateElementId({ tag, text }, usedIds(walk.elements)));
3289
3481
  }
3290
3482
 
3291
3483
  /**
@@ -3349,13 +3541,10 @@ export async function deleteElement(
3349
3541
  id,
3350
3542
  });
3351
3543
  }
3352
- const source = await file.text();
3544
+ const source = await readCanvasSource(file, canvasAbsPath);
3353
3545
  const next = applyDeleteElement(canvasAbsPath, source, id, occurrence);
3354
3546
  if (next.source === source) return next;
3355
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3356
- await Bun.write(tmp, next.source);
3357
- const { rename } = await import('node:fs/promises');
3358
- await rename(tmp, canvasAbsPath);
3547
+ await writeCanvasSource(canvasAbsPath, next.source);
3359
3548
  return next;
3360
3549
  });
3361
3550
  }
@@ -3415,7 +3604,7 @@ export function applyInsertElement(
3415
3604
  }
3416
3605
 
3417
3606
  const indentUnit = detectIndentUnit(source);
3418
- const newText = synthInsertElement(kind, opts?.src);
3607
+ const newText = stampSynthElement(canvasAbsPath, source, synthInsertElement(kind, opts?.src));
3419
3608
 
3420
3609
  let targetIndent: string;
3421
3610
  let anchor: number;
@@ -3496,13 +3685,10 @@ export async function insertElement(
3496
3685
  id: refId,
3497
3686
  });
3498
3687
  }
3499
- const source = await file.text();
3688
+ const source = await readCanvasSource(file, canvasAbsPath);
3500
3689
  const next = applyInsertElement(canvasAbsPath, source, refId, position, kind, opts);
3501
3690
  if (next.source === source) return next;
3502
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3503
- await Bun.write(tmp, next.source);
3504
- const { rename } = await import('node:fs/promises');
3505
- await rename(tmp, canvasAbsPath);
3691
+ await writeCanvasSource(canvasAbsPath, next.source);
3506
3692
  return next;
3507
3693
  });
3508
3694
  }
@@ -3559,7 +3745,7 @@ export function applyInsertElementIntoArtboard(
3559
3745
 
3560
3746
  const rStart = target.start as number;
3561
3747
  const indentUnit = detectIndentUnit(source);
3562
- const newText = synthInsertElement(kind, opts?.src);
3748
+ const newText = stampSynthElement(canvasAbsPath, source, synthInsertElement(kind, opts?.src));
3563
3749
  const targetIndent = lineStartInfo(source, rStart).indent + indentUnit;
3564
3750
 
3565
3751
  let anchor: number;
@@ -3621,7 +3807,7 @@ export async function insertElementIntoArtboard(
3621
3807
  id: artboardId,
3622
3808
  });
3623
3809
  }
3624
- const source = await file.text();
3810
+ const source = await readCanvasSource(file, canvasAbsPath);
3625
3811
  const next = applyInsertElementIntoArtboard(
3626
3812
  canvasAbsPath,
3627
3813
  source,
@@ -3631,10 +3817,7 @@ export async function insertElementIntoArtboard(
3631
3817
  opts
3632
3818
  );
3633
3819
  if (next.source === source) return next;
3634
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3635
- await Bun.write(tmp, next.source);
3636
- const { rename } = await import('node:fs/promises');
3637
- await rename(tmp, canvasAbsPath);
3820
+ await writeCanvasSource(canvasAbsPath, next.source);
3638
3821
  return next;
3639
3822
  });
3640
3823
  }
@@ -3673,7 +3856,20 @@ export function applyDuplicateElement(
3673
3856
  const elEnd = el.end as number;
3674
3857
  // The clone is the element's own source, placed at the same indent as the next
3675
3858
  // sibling (its internal lines are already indented relative to that level).
3676
- const cloneText = source.slice(elStart, elEnd);
3859
+ // V2-2.19 (contract V2-1.4 §5.2): a copy never inherits an id or a lock — every
3860
+ // `data-cd-id` / `data-cd-locked` inside it is dropped. A root that carried an
3861
+ // authored id gets a fresh readable one (by the §4.2 rule, never its own); an
3862
+ // unstamped root stays lazy like its original (its copy keeps the positional
3863
+ // newId — the v1 key golden pins that id in the inspector). A component usage
3864
+ // never renders the attribute, so it is never stamped. Descendants stay lazy.
3865
+ const walk = walkIdElements(source, canvasAbsPath);
3866
+ let cloneText = walk.ok
3867
+ ? copyWithoutIds(source, walk.elements, elStart, elEnd)
3868
+ : source.slice(elStart, elEnd);
3869
+ const root = walk.ok ? walk.elements.find((e) => e.start === elStart) : undefined;
3870
+ if (walk.ok && root && root.id !== null && /^[a-z]/.test(root.tag)) {
3871
+ cloneText = withIdAttr(cloneText, generateElementId(seedOf(root), usedIds(walk.elements)));
3872
+ }
3677
3873
  const targetIndent = lineStartInfo(source, elStart).indent;
3678
3874
  const insertText = `\n${targetIndent}${cloneText}`;
3679
3875
  const s = new MagicString(source);
@@ -3714,13 +3910,10 @@ export async function duplicateElement(
3714
3910
  id,
3715
3911
  });
3716
3912
  }
3717
- const source = await file.text();
3913
+ const source = await readCanvasSource(file, canvasAbsPath);
3718
3914
  const next = applyDuplicateElement(canvasAbsPath, source, id, occurrence);
3719
3915
  if (next.source === source) return next;
3720
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3721
- await Bun.write(tmp, next.source);
3722
- const { rename } = await import('node:fs/promises');
3723
- await rename(tmp, canvasAbsPath);
3916
+ await writeCanvasSource(canvasAbsPath, next.source);
3724
3917
  return next;
3725
3918
  });
3726
3919
  }
@@ -3837,13 +4030,10 @@ export async function resizeArtboard(
3837
4030
  id: artboardId,
3838
4031
  });
3839
4032
  }
3840
- const source = await file.text();
4033
+ const source = await readCanvasSource(file, canvasAbsPath);
3841
4034
  const next = applyResizeArtboard(canvasAbsPath, source, artboardId, width, height);
3842
4035
  if (next.source === source) return next;
3843
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3844
- await Bun.write(tmp, next.source);
3845
- const { rename } = await import('node:fs/promises');
3846
- await rename(tmp, canvasAbsPath);
4036
+ await writeCanvasSource(canvasAbsPath, next.source);
3847
4037
  return next;
3848
4038
  });
3849
4039
  }
@@ -3934,13 +4124,10 @@ export async function setArtboardHug(
3934
4124
  id: artboardId,
3935
4125
  });
3936
4126
  }
3937
- const source = await file.text();
4127
+ const source = await readCanvasSource(file, canvasAbsPath);
3938
4128
  const next = applySetArtboardHug(canvasAbsPath, source, artboardId, fixed, freezeHeight);
3939
4129
  if (next.source === source) return next;
3940
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
3941
- await Bun.write(tmp, next.source);
3942
- const { rename } = await import('node:fs/promises');
3943
- await rename(tmp, canvasAbsPath);
4130
+ await writeCanvasSource(canvasAbsPath, next.source);
3944
4131
  return next;
3945
4132
  });
3946
4133
  }
@@ -4034,13 +4221,10 @@ export async function setArtboardStyle(
4034
4221
  id: artboardId,
4035
4222
  });
4036
4223
  }
4037
- const source = await file.text();
4224
+ const source = await readCanvasSource(file, canvasAbsPath);
4038
4225
  const next = applySetArtboardStyle(canvasAbsPath, source, artboardId, patch);
4039
4226
  if (next.source === source) return next;
4040
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4041
- await Bun.write(tmp, next.source);
4042
- const { rename } = await import('node:fs/promises');
4043
- await rename(tmp, canvasAbsPath);
4227
+ await writeCanvasSource(canvasAbsPath, next.source);
4044
4228
  return next;
4045
4229
  });
4046
4230
  }
@@ -4097,6 +4281,55 @@ export function applySetArtboardKind(
4097
4281
  return { source: out };
4098
4282
  }
4099
4283
 
4284
+ /**
4285
+ * S7.22 — write/clear the DCArtboard `safeZones` prop (`safeZones="instagram-reels"`). A plain string
4286
+ * prop like `kind`, so it shares that toolkit: `editStringAttr` / `removeStringAttr`, addressed by the
4287
+ * `id` prop. `safeZones: null` removes the prop. The id must be one this build knows
4288
+ * (`kinds/safe-zones.ts`); a typo is refused rather than written, because a stored unknown id would draw
4289
+ * nothing and say nothing. Pure; reparse-gated.
4290
+ */
4291
+ export function applySetArtboardSafeZones(
4292
+ canvasAbsPath: string,
4293
+ source: string,
4294
+ artboardId: string,
4295
+ safeZones: string | null
4296
+ ): { source: string } {
4297
+ if (safeZones !== null && !isSafeZoneId(safeZones)) {
4298
+ throw new CanvasEditError(`unknown safe zone "${safeZones}"`, {
4299
+ canvas: canvasAbsPath,
4300
+ id: artboardId,
4301
+ });
4302
+ }
4303
+ const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
4304
+ if (parsed.errors && parsed.errors.length > 0) {
4305
+ throw new CanvasEditError(
4306
+ `oxc-parser failed on ${canvasAbsPath}: ${parsed.errors[0]?.message ?? 'unknown'}`,
4307
+ { canvas: canvasAbsPath, id: artboardId }
4308
+ );
4309
+ }
4310
+ const target = collectJsxByTag(parsed.program, 'DCArtboard').find(
4311
+ (a) => getStringAttr(a.openingElement, 'id') === artboardId
4312
+ );
4313
+ if (!target) {
4314
+ throw new CanvasEditError(`<DCArtboard id="${artboardId}"> not found in ${canvasAbsPath}`, {
4315
+ canvas: canvasAbsPath,
4316
+ id: artboardId,
4317
+ });
4318
+ }
4319
+ const s = new MagicString(source);
4320
+ if (safeZones === null) removeStringAttr(s, target.openingElement, 'safeZones', source);
4321
+ else editStringAttr(s, target.openingElement, 'safeZones', safeZones, canvasAbsPath, artboardId);
4322
+ const out = s.toString();
4323
+ const check = parseSync(canvasAbsPath, out, { sourceType: 'module' });
4324
+ if (check.errors && check.errors.length > 0) {
4325
+ throw new CanvasEditError(
4326
+ `safe zone edit produced invalid source (${check.errors[0]?.message ?? 'parse error'})`,
4327
+ { canvas: canvasAbsPath, id: artboardId }
4328
+ );
4329
+ }
4330
+ return { source: out };
4331
+ }
4332
+
4100
4333
  /** Longest artboard name the label edit accepts (the chrome truncates long ones). */
4101
4334
  export const MAX_ARTBOARD_LABEL = 80;
4102
4335
 
@@ -4166,13 +4399,10 @@ export async function setArtboardLabel(
4166
4399
  id: artboardId,
4167
4400
  });
4168
4401
  }
4169
- const source = await file.text();
4402
+ const source = await readCanvasSource(file, canvasAbsPath);
4170
4403
  const next = applySetArtboardLabel(canvasAbsPath, source, artboardId, label);
4171
4404
  if (next.source === source) return next;
4172
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4173
- await Bun.write(tmp, next.source);
4174
- const { rename } = await import('node:fs/promises');
4175
- await rename(tmp, canvasAbsPath);
4405
+ await writeCanvasSource(canvasAbsPath, next.source);
4176
4406
  return next;
4177
4407
  });
4178
4408
  }
@@ -4191,13 +4421,10 @@ export async function setArtboardKind(
4191
4421
  id: artboardId,
4192
4422
  });
4193
4423
  }
4194
- const source = await file.text();
4424
+ const source = await readCanvasSource(file, canvasAbsPath);
4195
4425
  const next = applySetArtboardKind(canvasAbsPath, source, artboardId, kind);
4196
4426
  if (next.source === source) return next;
4197
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4198
- await Bun.write(tmp, next.source);
4199
- const { rename } = await import('node:fs/promises');
4200
- await rename(tmp, canvasAbsPath);
4427
+ await writeCanvasSource(canvasAbsPath, next.source);
4201
4428
  return next;
4202
4429
  });
4203
4430
  }
@@ -4290,13 +4517,10 @@ async function setArtboardObjectProp(
4290
4517
  id: artboardId,
4291
4518
  });
4292
4519
  }
4293
- const source = await file.text();
4520
+ const source = await readCanvasSource(file, canvasAbsPath);
4294
4521
  const next = applySetArtboardObjectProp(canvasAbsPath, source, artboardId, propName, value);
4295
4522
  if (next.source === source) return next;
4296
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4297
- await Bun.write(tmp, next.source);
4298
- const { rename } = await import('node:fs/promises');
4299
- await rename(tmp, canvasAbsPath);
4523
+ await writeCanvasSource(canvasAbsPath, next.source);
4300
4524
  return next;
4301
4525
  });
4302
4526
  }
@@ -4343,6 +4567,32 @@ export function setArtboardPrint(
4343
4567
  return setArtboardObjectProp(canvasAbsPath, artboardId, 'print', print);
4344
4568
  }
4345
4569
 
4570
+ /**
4571
+ * S7.20 — an array literal of plain string / number / boolean literals (`sizeMm: [99, 210]`), or null when it holds
4572
+ * anything else (an identifier, a spread, a hole, a nested array) or is longer than 16. Same no-eval rule as the
4573
+ * object reader below.
4574
+ */
4575
+ function plainLiteralArray(node: AnyNode): Array<string | number | boolean> | null {
4576
+ const els: AnyNode[] = node?.elements ?? [];
4577
+ if (els.length > 16) return null;
4578
+ const out: Array<string | number | boolean> = [];
4579
+ for (const e of els) {
4580
+ if (
4581
+ !e ||
4582
+ !(
4583
+ e.type === 'Literal' ||
4584
+ e.type === 'StringLiteral' ||
4585
+ e.type === 'NumericLiteral' ||
4586
+ e.type === 'BooleanLiteral'
4587
+ ) ||
4588
+ !(typeof e.value === 'string' || typeof e.value === 'number' || typeof e.value === 'boolean')
4589
+ )
4590
+ return null;
4591
+ out.push(e.value);
4592
+ }
4593
+ return out;
4594
+ }
4595
+
4346
4596
  /**
4347
4597
  * Read a JS object-literal AST node into a plain object WITHOUT eval —
4348
4598
  * `print` (like every other canvas-authored JSX prop) is part of the
@@ -4354,7 +4604,11 @@ export function setArtboardPrint(
4354
4604
  * degrade to "field absent" rather than guess. Depth-capped defensively,
4355
4605
  * though `print`'s own shape never nests past marginsMm (depth 2).
4356
4606
  */
4357
- function objectExpressionToPlain(node: AnyNode, depth = 0): Record<string, unknown> {
4607
+ function objectExpressionToPlain(
4608
+ node: AnyNode,
4609
+ depth = 0,
4610
+ arrays = false
4611
+ ): Record<string, unknown> {
4358
4612
  const out: Record<string, unknown> = {};
4359
4613
  if (depth > 6 || node?.type !== 'ObjectExpression') return out;
4360
4614
  for (const p of node.properties ?? []) {
@@ -4369,7 +4623,10 @@ function objectExpressionToPlain(node: AnyNode, depth = 0): Record<string, unkno
4369
4623
  const v = p.value;
4370
4624
  if (!v) continue;
4371
4625
  if (v.type === 'ObjectExpression') {
4372
- out[key] = objectExpressionToPlain(v, depth + 1);
4626
+ out[key] = objectExpressionToPlain(v, depth + 1, arrays);
4627
+ } else if (arrays && v.type === 'ArrayExpression') {
4628
+ const items = plainLiteralArray(v);
4629
+ if (items) out[key] = items;
4373
4630
  } else if (
4374
4631
  (v.type === 'Literal' ||
4375
4632
  v.type === 'StringLiteral' ||
@@ -4406,11 +4663,16 @@ function objectExpressionToPlain(node: AnyNode, depth = 0): Record<string, unkno
4406
4663
  * file. Anything else genuinely computed (an import, a function call, a
4407
4664
  * spread) still returns null rather than guessing (RCA
4408
4665
  * issue-pdf-print-export-marks-missing).
4666
+ *
4667
+ * `opts.arrays` (S7.20, decision maude/v2-S7.20-print-reader-arrays-opt-in): also reads an array of plain literals
4668
+ * (`sizeMm: [99, 210]`). Off by default, so every existing caller (the PDF exporter, and the test that models what a
4669
+ * v1.9.1 peer reads) sees the bytes it always did; v2 readers of a custom print size ask for it.
4409
4670
  */
4410
4671
  export function readArtboardPrintProp(
4411
4672
  canvasAbsPath: string,
4412
4673
  source: string,
4413
- artboardId: string
4674
+ artboardId: string,
4675
+ opts: { arrays?: boolean } = {}
4414
4676
  ): Record<string, unknown> | null {
4415
4677
  const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
4416
4678
  if (parsed.errors && parsed.errors.length > 0) return null;
@@ -4424,7 +4686,7 @@ export function readArtboardPrintProp(
4424
4686
  if (!expr) return null;
4425
4687
  const resolved = resolveValueNode(parsed.program, expr);
4426
4688
  if (resolved?.type !== 'ObjectExpression') return null;
4427
- return objectExpressionToPlain(resolved);
4689
+ return objectExpressionToPlain(resolved, 0, opts.arrays === true);
4428
4690
  }
4429
4691
 
4430
4692
  /**
@@ -4521,13 +4783,10 @@ export async function deleteArtboard(
4521
4783
  id: artboardId,
4522
4784
  });
4523
4785
  }
4524
- const source = await file.text();
4786
+ const source = await readCanvasSource(file, canvasAbsPath);
4525
4787
  const next = applyDeleteArtboard(canvasAbsPath, source, artboardId);
4526
4788
  if (next.source === source) return next;
4527
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4528
- await Bun.write(tmp, next.source);
4529
- const { rename } = await import('node:fs/promises');
4530
- await rename(tmp, canvasAbsPath);
4789
+ await writeCanvasSource(canvasAbsPath, next.source);
4531
4790
  return next;
4532
4791
  });
4533
4792
  }
@@ -4535,6 +4794,111 @@ export async function deleteArtboard(
4535
4794
  /** Artboard id must be a safe JSX-attribute identifier (no quotes/markup). */
4536
4795
  const ARTBOARD_ID_RE = /^[A-Za-z][\w-]*$/;
4537
4796
 
4797
+ /** The leading whitespace of the line `pos` sits on. */
4798
+ function lineIndentAt(source: string, pos: number): string {
4799
+ const ls = source.lastIndexOf('\n', pos - 1) + 1;
4800
+ return /^[ \t]*/.exec(source.slice(ls, pos))?.[0] ?? '';
4801
+ }
4802
+
4803
+ /** Put `names` into the file's `@maude/canvas-lib` import (or a new one), skipping any it already imports. */
4804
+ function ensureCanvasLibImports(
4805
+ s: MagicString,
4806
+ source: string,
4807
+ program: AnyNode,
4808
+ names: string[]
4809
+ ): void {
4810
+ const imports = ((program.body ?? []) as AnyNode[]).filter(
4811
+ (st) => st.type === 'ImportDeclaration'
4812
+ );
4813
+ const have = new Set<string>();
4814
+ for (const st of imports)
4815
+ for (const sp of (st.specifiers ?? []) as AnyNode[])
4816
+ if (sp.local?.name) have.add(sp.local.name);
4817
+ const missing = names.filter((n) => !have.has(n));
4818
+ if (missing.length === 0) return;
4819
+ const own = imports.find(
4820
+ (st) =>
4821
+ st.source?.value === '@maude/canvas-lib' &&
4822
+ st.importKind !== 'type' &&
4823
+ ((st.specifiers ?? []) as AnyNode[]).some((sp) => sp.type === 'ImportSpecifier')
4824
+ );
4825
+ if (own) {
4826
+ const named = ((own.specifiers ?? []) as AnyNode[]).filter(
4827
+ (sp) => sp.type === 'ImportSpecifier'
4828
+ );
4829
+ s.appendLeft((named[named.length - 1] as AnyNode).end as number, `, ${missing.join(', ')}`);
4830
+ return;
4831
+ }
4832
+ const first = imports[0];
4833
+ const raw = first ? source.slice(first.source.start, first.source.end) : '';
4834
+ const quote = raw.startsWith("'") ? "'" : '"';
4835
+ const line = `import { ${missing.join(', ')} } from ${quote}@maude/canvas-lib${quote};`;
4836
+ const lastImport = imports[imports.length - 1];
4837
+ if (lastImport) s.appendLeft(lastImport.end as number, `\n${line}`);
4838
+ else s.prepend(`${line}\n`);
4839
+ }
4840
+
4841
+ /** True when an element's children are only whitespace and empty `{/* … *\/}` comments. */
4842
+ function hasOnlyEmptyChildren(el: AnyNode): boolean {
4843
+ return ((el.children ?? []) as AnyNode[]).every(
4844
+ (c) =>
4845
+ (c.type === 'JSXText' && String(c.value ?? c.raw ?? '').trim() === '') ||
4846
+ (c.type === 'JSXExpressionContainer' && c.expression?.type === 'JSXEmptyExpression')
4847
+ );
4848
+ }
4849
+
4850
+ /**
4851
+ * G4 — the first artboard of a canvas that has none. Into the last `<DCSection>` when there is one (its
4852
+ * closing tag is the anchor); otherwise into `<DesignCanvas>` inside a new `<DCSection id="main"
4853
+ * title="Main">`, which is what a scaffolded canvas looks like. Adds the `@maude/canvas-lib` names it
4854
+ * needs (a ⌘N canvas imports only `DesignCanvas`). Throws when the file has no canvas at all.
4855
+ */
4856
+ function placeFirstArtboard(
4857
+ s: MagicString,
4858
+ source: string,
4859
+ program: AnyNode,
4860
+ artboardText: string,
4861
+ canvasAbsPath: string,
4862
+ id: string
4863
+ ): void {
4864
+ const unit = detectIndentUnit(source);
4865
+ const sections = collectJsxByTag(program, 'DCSection');
4866
+ const host = (sections.length > 0 ? sections[sections.length - 1] : null) as AnyNode | null;
4867
+ const canvas = host ? null : (collectJsxByTag(program, 'DesignCanvas')[0] as AnyNode | undefined);
4868
+ if (!host && !canvas) {
4869
+ throw new CanvasEditError('there is no canvas in this file to add an artboard to', {
4870
+ canvas: canvasAbsPath,
4871
+ id,
4872
+ });
4873
+ }
4874
+ const el = (host ?? canvas) as AnyNode;
4875
+ const tag = host ? 'DCSection' : 'DesignCanvas';
4876
+ const indent = lineIndentAt(source, el.start as number);
4877
+ const child = `${indent}${unit}`;
4878
+ const body = host
4879
+ ? artboardText
4880
+ : `<DCSection id="main" title="Main">\n${child}${unit}${artboardText}\n${child}</DCSection>`;
4881
+ ensureCanvasLibImports(s, source, program, host ? ['DCArtboard'] : ['DCSection', 'DCArtboard']);
4882
+ const open = el.openingElement as AnyNode;
4883
+ const close = el.closingElement as AnyNode | null;
4884
+ if (!close) {
4885
+ // <DCSection … /> becomes <DCSection …> + the artboard + </DCSection>
4886
+ let from = (open.end as number) - 2;
4887
+ while (from > (open.start as number) && /\s/.test(source[from - 1] ?? '')) from--;
4888
+ s.overwrite(from, open.end, `>\n${child}${body}\n${indent}</${tag}>`);
4889
+ return;
4890
+ }
4891
+ if (!host && hasOnlyEmptyChildren(el)) {
4892
+ // the blank canvas's "Empty. Add <DCSection> here." comment goes: the section is what it asked for
4893
+ if (open.end === close.start) s.appendLeft(open.end, `\n${child}${body}\n${indent}`);
4894
+ else s.overwrite(open.end, close.start, `\n${child}${body}\n${indent}`);
4895
+ return;
4896
+ }
4897
+ const closeLine = lineStartInfo(source, close.start as number);
4898
+ if (closeLine.newlineBefore) s.appendLeft(closeLine.indentStart, `${child}${body}\n`);
4899
+ else s.appendLeft(close.start as number, `\n${child}${body}\n${indent}`);
4900
+ }
4901
+
4538
4902
  /**
4539
4903
  * Insert a new EMPTY `<DCArtboard>` after the canvas's last artboard (Stage I4).
4540
4904
  * Pure. The size props (`width`/`height`) are JSX-authoritative (DDR-027); the
@@ -4560,18 +4924,13 @@ export function applyInsertArtboard(
4560
4924
  }
4561
4925
  const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
4562
4926
  if (parsed.errors && parsed.errors.length > 0) {
4563
- throw new CanvasEditError(
4564
- `oxc-parser failed on ${canvasAbsPath}: ${parsed.errors[0]?.message ?? 'unknown'}`,
4565
- { canvas: canvasAbsPath, id }
4566
- );
4927
+ // plain words: the shell puts this after "Couldn't add an artboard — "
4928
+ throw new CanvasEditError('this canvas does not parse; fix it before editing', {
4929
+ canvas: canvasAbsPath,
4930
+ id,
4931
+ });
4567
4932
  }
4568
4933
  const artboards = collectJsxByTag(parsed.program, 'DCArtboard');
4569
- if (artboards.length === 0) {
4570
- throw new CanvasEditError(
4571
- 'no <DCArtboard> to anchor a new artboard — scaffold a canvas first',
4572
- { canvas: canvasAbsPath, id }
4573
- );
4574
- }
4575
4934
  for (const a of artboards) {
4576
4935
  if (getStringAttr(a.openingElement, 'id') === id) {
4577
4936
  throw new CanvasEditError(`artboard id "${id}" already exists`, {
@@ -4580,11 +4939,17 @@ export function applyInsertArtboard(
4580
4939
  });
4581
4940
  }
4582
4941
  }
4583
- const last = artboards[artboards.length - 1] as AnyNode;
4584
- const indent = lineStartInfo(source, last.start as number).indent;
4585
4942
  const newText = `<DCArtboard id="${escapeAttr(id)}" label="${escapeAttr(label)}" width={${width}} height={${height}}></DCArtboard>`;
4586
4943
  const s = new MagicString(source);
4587
- s.appendLeft(last.end as number, `\n${indent}${newText}`);
4944
+ if (artboards.length > 0) {
4945
+ const last = artboards[artboards.length - 1] as AnyNode;
4946
+ const indent = lineStartInfo(source, last.start as number).indent;
4947
+ s.appendLeft(last.end as number, `\n${indent}${newText}`);
4948
+ } else {
4949
+ // G4 (gate B) — a blank (⌘N) canvas has no artboard to sit beside: anchor in its last section, or in
4950
+ // the canvas itself with a section of its own, the way a scaffolded canvas is laid out.
4951
+ placeFirstArtboard(s, source, parsed.program, newText, canvasAbsPath, id);
4952
+ }
4588
4953
  const out = s.toString();
4589
4954
  const check = parseSync(canvasAbsPath, out, { sourceType: 'module' });
4590
4955
  if (check.errors && check.errors.length > 0) {
@@ -4609,13 +4974,10 @@ export async function insertArtboard(
4609
4974
  id: opts.id,
4610
4975
  });
4611
4976
  }
4612
- const source = await file.text();
4977
+ const source = await readCanvasSource(file, canvasAbsPath);
4613
4978
  const next = applyInsertArtboard(canvasAbsPath, source, opts);
4614
4979
  if (next.source === source) return next;
4615
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4616
- await Bun.write(tmp, next.source);
4617
- const { rename } = await import('node:fs/promises');
4618
- await rename(tmp, canvasAbsPath);
4980
+ await writeCanvasSource(canvasAbsPath, next.source);
4619
4981
  return next;
4620
4982
  });
4621
4983
  }
@@ -4656,7 +5018,10 @@ export function applyDuplicateArtboard(
4656
5018
  canvasAbsPath: string,
4657
5019
  source: string,
4658
5020
  artboardId: string,
4659
- newWidth: number
5021
+ /** `null` (S2.10 ⌘D, with `names`): the copy keeps the source's width attribute verbatim. */
5022
+ newWidth: number | null,
5023
+ /** S2.10 — the copy's own id / label (⌘D: "Desktop 2"); absent = the v1 width-suffixed names. */
5024
+ names?: { id?: string; label?: string }
4660
5025
  ): { source: string; artboardId: string } {
4661
5026
  const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
4662
5027
  if (parsed.errors && parsed.errors.length > 0) {
@@ -4673,22 +5038,36 @@ export function applyDuplicateArtboard(
4673
5038
  id: artboardId,
4674
5039
  });
4675
5040
  }
4676
- const width = Math.max(1, Math.round(newWidth));
5041
+ const width = newWidth === null ? null : Math.max(1, Math.round(newWidth));
5042
+ if (width === null && !(names?.id && names.label))
5043
+ throw new CanvasEditError('A copy at the same width needs its own id and label.', {
5044
+ canvas: canvasAbsPath,
5045
+ id: artboardId,
5046
+ });
4677
5047
 
4678
5048
  const existingIds = new Set(
4679
5049
  artboards
4680
5050
  .map((a) => getStringAttr(a.openingElement, 'id'))
4681
5051
  .filter((x): x is string => typeof x === 'string')
4682
5052
  );
4683
- let newId = `${artboardId}-${width}`;
4684
- let suffix = 2;
4685
- while (existingIds.has(newId)) {
4686
- newId = `${artboardId}-${width}-${suffix}`;
4687
- suffix += 1;
5053
+ let newId = names?.id ?? `${artboardId}-${width}`;
5054
+ if (names?.id) {
5055
+ if (existingIds.has(newId)) {
5056
+ throw new CanvasEditError(`<DCArtboard id="${newId}"> already exists in ${canvasAbsPath}`, {
5057
+ canvas: canvasAbsPath,
5058
+ id: newId,
5059
+ });
5060
+ }
5061
+ } else {
5062
+ let suffix = 2;
5063
+ while (existingIds.has(newId)) {
5064
+ newId = `${artboardId}-${width}-${suffix}`;
5065
+ suffix += 1;
5066
+ }
4688
5067
  }
4689
5068
 
4690
5069
  const sourceLabel = getStringAttr(target.openingElement, 'label') ?? artboardId;
4691
- const newLabel = `${sourceLabel} (${width}px)`;
5070
+ const newLabel = names?.label ?? `${sourceLabel} (${width}px)`;
4692
5071
 
4693
5072
  const elStart = target.start as number;
4694
5073
  const elEnd = target.end as number;
@@ -4715,18 +5094,31 @@ export function applyDuplicateArtboard(
4715
5094
  } else {
4716
5095
  cs.appendLeft(idAttr.end - elStart, ` label="${escapeAttr(newLabel)}"`);
4717
5096
  }
4718
- if (widthAttr && typeof widthAttr.start === 'number' && typeof widthAttr.end === 'number') {
5097
+ if (width === null) {
5098
+ // same width: the attribute (a number or an expression) is copied as it was
5099
+ } else if (
5100
+ widthAttr &&
5101
+ typeof widthAttr.start === 'number' &&
5102
+ typeof widthAttr.end === 'number'
5103
+ ) {
4719
5104
  cs.overwrite(widthAttr.start - elStart, widthAttr.end - elStart, `width={${width}}`);
4720
5105
  } else {
4721
5106
  cs.appendLeft(idAttr.end - elStart, ` width={${width}}`);
4722
5107
  }
4723
5108
  const patchedClone = cs.toString();
4724
5109
 
4725
- const targetIndent = lineStartInfo(source, elStart).indent;
4726
- const insertText = `\n${targetIndent}${patchedClone}`;
4727
- const s = new MagicString(source);
4728
- s.appendLeft(elEnd, insertText);
4729
- const out = s.toString();
5110
+ let out = spliceBesideArtboard(source, elStart, elEnd, patchedClone);
5111
+ // V2-1.4 §5.2: a copy never inherits an element id or a lock — every `data-cd-id` / `data-cd-locked`
5112
+ // inside the clone is dropped (its elements are named lazily, like a duplicated element's).
5113
+ const copyWalk = walkIdElements(out, canvasAbsPath);
5114
+ if (copyWalk.ok) {
5115
+ const board = copyWalk.elements.find((e) => e.tag === 'DCArtboard' && e.artboard === newId);
5116
+ if (board)
5117
+ out =
5118
+ out.slice(0, board.start) +
5119
+ copyWithoutIds(out, copyWalk.elements, board.start, board.end) +
5120
+ out.slice(board.end);
5121
+ }
4730
5122
  const check = parseSync(canvasAbsPath, out, { sourceType: 'module' });
4731
5123
  if (check.errors && check.errors.length > 0) {
4732
5124
  throw new CanvasEditError(
@@ -4737,6 +5129,137 @@ export function applyDuplicateArtboard(
4737
5129
  return { source: out, artboardId: newId };
4738
5130
  }
4739
5131
 
5132
+ /**
5133
+ * The one "beside the source" placement every artboard copy uses ("Duplicate at width…", Run on a
5134
+ * copy): the clone is spliced as the original's NEXT sibling in source order, at its indent — the
5135
+ * next default-grid cell (DDR-027, see applyDuplicateArtboard).
5136
+ */
5137
+ function spliceBesideArtboard(
5138
+ source: string,
5139
+ elStart: number,
5140
+ elEnd: number,
5141
+ cloneText: string
5142
+ ): string {
5143
+ const targetIndent = lineStartInfo(source, elStart).indent;
5144
+ const s = new MagicString(source);
5145
+ s.appendLeft(elEnd, `\n${targetIndent}${cloneText}`);
5146
+ return s.toString();
5147
+ }
5148
+
5149
+ /**
5150
+ * S5.11b — Run on a copy (V2-1.15 §5.7): duplicate `<DCArtboard id={artboardId}>` FROM `accepted`
5151
+ * (the project's accepted source — never a busy run's staged bytes, which sit on disk until that
5152
+ * run publishes) into `source` (the disk), beside the original (`spliceBesideArtboard`). The copy
5153
+ * gets `copy.id` + `copy.label`; every `data-cd-id` / `data-cd-locked` inside it is dropped and
5154
+ * each DOM element that carried an id gets a fresh readable one (V2-1.4 §4.3: a copy always gets
5155
+ * new ids and starts unlocked). An artboard `copy.id` already in `source` is this ask's earlier
5156
+ * copy: answered as is (`existed`), so a retry never makes two.
5157
+ */
5158
+ export function applyCopyArtboard(
5159
+ canvasAbsPath: string,
5160
+ source: string,
5161
+ accepted: string,
5162
+ artboardId: string,
5163
+ copy: { id: string; label?: string }
5164
+ ): { source: string; artboardId: string; existed: boolean } {
5165
+ const fail = (m: string) => new CanvasEditError(m, { canvas: canvasAbsPath, id: artboardId });
5166
+ const disk = parseSync(canvasAbsPath, source, { sourceType: 'module' });
5167
+ if (disk.errors && disk.errors.length > 0)
5168
+ throw fail(`oxc-parser failed on ${canvasAbsPath}: ${disk.errors[0]?.message ?? 'unknown'}`);
5169
+ const onDisk = collectJsxByTag(disk.program, 'DCArtboard');
5170
+ const idOf = (a: AnyNode) => getStringAttr(a.openingElement, 'id');
5171
+ if (onDisk.some((a) => idOf(a) === copy.id))
5172
+ return { source, artboardId: copy.id, existed: true };
5173
+ const here = onDisk.find((a) => idOf(a) === artboardId);
5174
+ if (!here) throw fail(`<DCArtboard id="${artboardId}"> not found in ${canvasAbsPath}`);
5175
+
5176
+ const acc = parseSync(canvasAbsPath, accepted, { sourceType: 'module' });
5177
+ if (acc.errors && acc.errors.length > 0)
5178
+ throw fail(`the accepted ${canvasAbsPath} does not parse`);
5179
+ const target = collectJsxByTag(acc.program, 'DCArtboard').find((a) => idOf(a) === artboardId);
5180
+ if (!target) throw fail(`<DCArtboard id="${artboardId}"> is not in the accepted version yet`);
5181
+ const walkAcc = walkIdElements(accepted, canvasAbsPath);
5182
+ if (!walkAcc.ok) throw fail(walkAcc.error);
5183
+ const elStart = target.start as number;
5184
+ const elEnd = target.end as number;
5185
+ const idAttr = findAttribute(target.openingElement, 'id');
5186
+ if (!idAttr || typeof idAttr.start !== 'number' || typeof idAttr.end !== 'number')
5187
+ throw fail(`<DCArtboard id="${artboardId}"> has no readable id attribute`);
5188
+
5189
+ // one MagicString over the ACCEPTED text: drop ids + locks, rename the artboard, then slice
5190
+ const ms = new MagicString(accepted);
5191
+ const inside = walkAcc.elements.filter((e) => e.start >= elStart && e.end <= elEnd);
5192
+ for (const e of inside) {
5193
+ for (const a of [e.idAttr, e.lockAttr]) {
5194
+ if (!a) continue;
5195
+ const sp = attrRemovalSpan(accepted, a);
5196
+ ms.remove(sp.start, sp.end);
5197
+ }
5198
+ }
5199
+ ms.overwrite(idAttr.start, idAttr.end, `id="${escapeAttr(copy.id)}"`);
5200
+ const label =
5201
+ copy.label ?? `${getStringAttr(target.openingElement, 'label') ?? artboardId} · copy`;
5202
+ const labelAttr = findAttribute(target.openingElement, 'label');
5203
+ if (labelAttr && typeof labelAttr.start === 'number' && typeof labelAttr.end === 'number')
5204
+ ms.overwrite(labelAttr.start, labelAttr.end, `label="${escapeAttr(label)}"`);
5205
+ else ms.appendLeft(idAttr.end, ` label="${escapeAttr(label)}"`);
5206
+ const cloneText = ms.slice(elStart, elEnd);
5207
+
5208
+ let out = spliceBesideArtboard(source, here.start as number, here.end as number, cloneText);
5209
+ // fresh ids where the original carried one: the copy's elements, pre-order, pair with the
5210
+ // original's (the clone is the same tree minus attributes)
5211
+ const walkOut = walkIdElements(out, canvasAbsPath);
5212
+ if (walkOut.ok) {
5213
+ const was = inside.filter((e) => e.artboard === artboardId);
5214
+ const now = walkOut.elements.filter((e) => e.artboard === copy.id);
5215
+ if (was.length === now.length) {
5216
+ const used = usedIds(walkOut.elements);
5217
+ for (const e of inside) if (e.id) used.add(e.id); // never hand the original's id out again
5218
+ const stamps: Array<{ nameEnd: number; id: ElementId }> = [];
5219
+ was.forEach((w, i) => {
5220
+ const n = now[i] as (typeof now)[number];
5221
+ if (w.id !== null && /^[a-z]/.test(n.tag))
5222
+ stamps.push({ nameEnd: n.nameEnd, id: generateElementId(seedOf(n), used) });
5223
+ });
5224
+ out = insertIds(out, stamps);
5225
+ }
5226
+ }
5227
+ const check = parseSync(canvasAbsPath, out, { sourceType: 'module' });
5228
+ if (check.errors && check.errors.length > 0)
5229
+ throw fail(
5230
+ `run-on-copy produced invalid source (${check.errors[0]?.message ?? 'parse error'})`
5231
+ );
5232
+ return { source: out, artboardId: copy.id, existed: false };
5233
+ }
5234
+
5235
+ /**
5236
+ * Run on a copy on disk (atomic write + cross-process lock). `accepted` defaults to the disk (a
5237
+ * canvas no run has staged). `beforeWrite` sees the new bytes before they land — the caller
5238
+ * claims them for the run's stage there, so the watcher never files them under the busy run.
5239
+ */
5240
+ export async function copyArtboard(
5241
+ canvasAbsPath: string,
5242
+ artboardId: string,
5243
+ copy: { id: string; label?: string },
5244
+ o: { accepted?: string | null; beforeWrite?: (next: string) => void } = {}
5245
+ ): Promise<{ source: string; artboardId: string; existed: boolean }> {
5246
+ return withLock(canvasAbsPath, async () => {
5247
+ const file = Bun.file(canvasAbsPath);
5248
+ if (!(await file.exists())) {
5249
+ throw new CanvasEditError(`Canvas not found: ${canvasAbsPath}`, {
5250
+ canvas: canvasAbsPath,
5251
+ id: artboardId,
5252
+ });
5253
+ }
5254
+ const source = await readCanvasSource(file, canvasAbsPath);
5255
+ const next = applyCopyArtboard(canvasAbsPath, source, o.accepted ?? source, artboardId, copy);
5256
+ if (next.existed || next.source === source) return next;
5257
+ o.beforeWrite?.(next.source);
5258
+ await writeCanvasSource(canvasAbsPath, next.source);
5259
+ return next;
5260
+ });
5261
+ }
5262
+
4740
5263
  /** Duplicate an artboard on disk (atomic write + cross-process lock). */
4741
5264
  export async function duplicateArtboard(
4742
5265
  canvasAbsPath: string,
@@ -4751,13 +5274,10 @@ export async function duplicateArtboard(
4751
5274
  id: artboardId,
4752
5275
  });
4753
5276
  }
4754
- const source = await file.text();
5277
+ const source = await readCanvasSource(file, canvasAbsPath);
4755
5278
  const next = applyDuplicateArtboard(canvasAbsPath, source, artboardId, newWidth);
4756
5279
  if (next.source === source) return next;
4757
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
4758
- await Bun.write(tmp, next.source);
4759
- const { rename } = await import('node:fs/promises');
4760
- await rename(tmp, canvasAbsPath);
5280
+ await writeCanvasSource(canvasAbsPath, next.source);
4761
5281
  return next;
4762
5282
  });
4763
5283
  }
@@ -5396,13 +5916,10 @@ export async function convertToAbsolute(
5396
5916
  id: spec.containerId ?? 'artboard',
5397
5917
  });
5398
5918
  }
5399
- const source = await file.text();
5919
+ const source = await readCanvasSource(file, canvasAbsPath);
5400
5920
  const next = applyConvertToAbsolute(canvasAbsPath, source, spec);
5401
5921
  if (next.source === source) return { source, delta: 0, changed: false };
5402
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
5403
- await Bun.write(tmp, next.source);
5404
- const { rename } = await import('node:fs/promises');
5405
- await rename(tmp, canvasAbsPath);
5922
+ await writeCanvasSource(canvasAbsPath, next.source);
5406
5923
  return { ...next, changed: true };
5407
5924
  });
5408
5925
  }
@@ -5538,15 +6055,12 @@ export async function detachComponent(
5538
6055
  id,
5539
6056
  });
5540
6057
  }
5541
- const source = await file.text();
6058
+ const source = await readCanvasSource(file, canvasAbsPath);
5542
6059
  const next = applyDetachComponent(canvasAbsPath, source, id, occurrence);
5543
6060
  if (next.source === source) {
5544
6061
  return { source, delta: 0, changed: false, detachedName: next.detachedName };
5545
6062
  }
5546
- const tmp = `${canvasAbsPath}.tmp.${Math.random().toString(36).slice(2, 10)}`;
5547
- await Bun.write(tmp, next.source);
5548
- const { rename } = await import('node:fs/promises');
5549
- await rename(tmp, canvasAbsPath);
6063
+ await writeCanvasSource(canvasAbsPath, next.source);
5550
6064
  return { ...next, changed: true };
5551
6065
  });
5552
6066
  }
@@ -5623,19 +6137,129 @@ function jsKey(prop: string): string {
5623
6137
  //
5624
6138
  // Layout: bun run canvas-edit.ts --invoke <canvas> <id> <attr> <value>
5625
6139
 
6140
+ /** A refusal of the CLI path, with the exit code `canvas-edit.sh` passes through. */
6141
+ export class CliRefusal extends Error {
6142
+ constructor(
6143
+ message: string,
6144
+ readonly exitCode: 1 | 2
6145
+ ) {
6146
+ super(message);
6147
+ }
6148
+ }
6149
+
6150
+ const PICK_CANVAS = "Pick a canvas inside the project's design folder";
6151
+
6152
+ /**
6153
+ * V2-2.4b gate — where the CLI may write. `maude design canvas-edit` is an
6154
+ * auto-tier verb (the AI reaches it with no prompt), so the canvas must
6155
+ * resolve — symlinks followed — to a `.tsx`/`.jsx` inside THIS project's
6156
+ * `.design/` (the nearest `.design/config.json` at or above
6157
+ * `$CLAUDE_PROJECT_DIR`, else the cwd), outside its `_*` runtime dirs and
6158
+ * dot-folders. A relative path is tried design-root-relative first (`ui/C.tsx`,
6159
+ * as the verbs take it), then cwd-relative. Returns the real path to edit.
6160
+ */
6161
+ export function resolveCliCanvas(
6162
+ arg: string,
6163
+ { cwd = process.cwd(), projectDir = process.env.CLAUDE_PROJECT_DIR } = {}
6164
+ ): { abs: string; rel: string } {
6165
+ let cur = path.resolve(projectDir || cwd);
6166
+ let root: string | null = null;
6167
+ for (;;) {
6168
+ if (existsSync(path.join(cur, '.design', 'config.json'))) {
6169
+ root = cur;
6170
+ break;
6171
+ }
6172
+ const up = path.dirname(cur);
6173
+ if (up === cur) break;
6174
+ cur = up;
6175
+ }
6176
+ if (!root) throw new CliRefusal(`${PICK_CANVAS} — no .design/ found from ${cwd}.`, 2);
6177
+ const designRoot = realpathSync(path.join(root, '.design'));
6178
+ const candidates = path.isAbsolute(arg)
6179
+ ? [arg]
6180
+ : [path.join(root, '.design', arg), path.resolve(cwd, arg)];
6181
+ const found = candidates.find((c) => existsSync(c));
6182
+ if (!found) throw new CliRefusal(`file not found: ${arg}`, 1);
6183
+ const abs = realpathSync(found);
6184
+ const rel = path.relative(designRoot, abs).split(path.sep).join('/');
6185
+ const segs = rel.split('/');
6186
+ if (
6187
+ !rel ||
6188
+ rel.startsWith('..') ||
6189
+ path.isAbsolute(rel) ||
6190
+ segs[0]?.startsWith('_') ||
6191
+ segs.some((s) => s.startsWith('.')) ||
6192
+ !/\.[jt]sx$/.test(rel)
6193
+ )
6194
+ throw new CliRefusal(
6195
+ `${PICK_CANVAS} (${designRoot}/…, not a _ runtime folder) — ${arg} is outside it.`,
6196
+ 2
6197
+ );
6198
+ return { abs, rel };
6199
+ }
6200
+
6201
+ /** An id a refusal names bare (routes/agent.ts AGENT_ID_RE — a test holds them equal). */
6202
+ export const MESSAGE_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/;
6203
+
6204
+ /**
6205
+ * V2-2.19 — a locked element (`data-cd-locked`), or anything inside one, is the
6206
+ * person's: the CLI refuses it with the same `soft-locked` wording the
6207
+ * pre-edit hook's `edit/check` uses. The innermost element whose span holds the
6208
+ * first changed byte is the edit's target (an attribute edit only rewrites that
6209
+ * element's opening tag); it and its ancestors are checked.
6210
+ */
6211
+ export function assertCliEditUnlocked(rel: string, before: string, after: string): void {
6212
+ let at = 0;
6213
+ while (at < before.length && before.charCodeAt(at) === after.charCodeAt(at)) at++;
6214
+ if (at === before.length && before.length === after.length) return;
6215
+ const w = walkIdElements(before, rel);
6216
+ if (!w.ok) return;
6217
+ let target = -1;
6218
+ for (const e of w.elements) if (e.start <= at && at < e.end) target = e.i;
6219
+ for (let i = target; i >= 0; i = w.elements[i]?.parent ?? -1) {
6220
+ const e = w.elements[i];
6221
+ if (!e) break;
6222
+ if (!e.locked) continue;
6223
+ // file text (a planted id / artboard id): cleaned, capped and quoted unless it is an id
6224
+ const idText = (s: string) => (MESSAGE_ID_RE.test(s) ? s : fileText(s));
6225
+ const name = e.id ? idText(e.id) : `<${e.tag}>`;
6226
+ const where = e.artboard ? ` in ${idText(e.artboard)}` : '';
6227
+ const inside = i === target ? '' : ' (the element is inside it)';
6228
+ throw new CliRefusal(
6229
+ `soft-locked: ${name}${where} is locked${inside} — leave it as it is. ` +
6230
+ 'Undo the change to it, or ask the person to unlock it (⇧⌘L). Change the rest without touching it.',
6231
+ 1
6232
+ );
6233
+ }
6234
+ }
6235
+
5626
6236
  if (import.meta.main) {
5627
6237
  const argv = process.argv.slice(2);
5628
6238
  if (argv[0] === '--invoke' && argv.length === 5) {
5629
- const [, canvas, id, attr, value] = argv;
5630
- if (!canvas || !id || !attr || value === undefined) {
6239
+ const [, arg, id, attr, value] = argv;
6240
+ if (!arg || !id || !attr || value === undefined) {
5631
6241
  console.error('canvas-edit: --invoke needs <canvas> <id> <attr> <value>');
5632
6242
  process.exit(2);
5633
6243
  }
5634
6244
  try {
6245
+ const { abs: canvas, rel } = resolveCliCanvas(arg);
6246
+ const before = await Bun.file(canvas).text();
6247
+ const after = applyEdit(canvas, before, id, attr, value).source;
6248
+ assertCliEditUnlocked(rel, before, after);
6249
+ // p8-a1-claims — inside a Maude chat these bytes are claimed for its run before they land
6250
+ // (bin/_write-claim.mjs); a person's own save meanwhile is different bytes and stays theirs
6251
+ if (after !== before) {
6252
+ const { claimWrites } = await import('./bin/_write-claim.mjs');
6253
+ await claimWrites(path.dirname(canvas), [{ rel, content: after }]);
6254
+ }
5635
6255
  const r = await editAttribute(canvas, id, attr, value);
5636
6256
  console.log(JSON.stringify({ canvas, id, delta: r.delta }));
5637
6257
  process.exit(0);
5638
6258
  } catch (err) {
6259
+ if (err instanceof CliRefusal) {
6260
+ console.error(`canvas-edit: ${err.message}`);
6261
+ process.exit(err.exitCode);
6262
+ }
5639
6263
  const msg = err instanceof Error ? err.message : String(err);
5640
6264
  console.error(`canvas-edit: ${msg}`);
5641
6265
  process.exit(2);
@@ -5815,3 +6439,395 @@ export function printUniqueness(
5815
6439
  for (const e of all) counts.set(key(e.print), (counts.get(key(e.print)) ?? 0) + 1);
5816
6440
  return { elements: all.length, unique: all.filter((e) => counts.get(key(e.print)) === 1).length };
5817
6441
  }
6442
+
6443
+ // ---------------------------------------------------------------------------
6444
+ // V2-2.19 — lazy stamping of stable element ids (contract V2-1.4 §4.3 / §5.2).
6445
+ //
6446
+ // A durable reference (comment pin, arrow bind, lock, ⌘/ scope, undo record) to an element that has
6447
+ // no authored id yet is captured as `{ hint, print }` (`PendingElementRef`); the next write an
6448
+ // editor's studio makes to the file stamps every queued element through `stampIds`. Pure: it
6449
+ // returns the new source and never touches disk, so the caller decides WHEN to write (never from
6450
+ // the file watcher, never while a run or an external editor holds the file).
6451
+
6452
+ export interface StampTarget {
6453
+ /** Computed (or authored) id at capture time — a hint, never the key. */
6454
+ hint: string;
6455
+ print: ElementPrint;
6456
+ occurrence?: number;
6457
+ }
6458
+
6459
+ /**
6460
+ * Stamp a readable `data-cd-id` on every target that has none (contract §5.2). Each target is
6461
+ * found by `hint` when the element there still carries `print`, else by the ONE element carrying
6462
+ * `print`; an ambiguous or missing target is left out of `ids`. An element that already has a
6463
+ * valid authored id returns it unchanged. `reserved` holds ids a durable reference still points
6464
+ * at (detached ones included), so a removed element's comments can't land on a newcomer.
6465
+ * Throws on an expression-valued or malformed `data-cd-id` (refused by every writer).
6466
+ */
6467
+ export function stampIds(
6468
+ source: string,
6469
+ targets: StampTarget[],
6470
+ opts: { path?: string; reserved?: Iterable<string> } = {}
6471
+ ): { source: string; ids: Map<string, ElementId> } {
6472
+ const file = opts.path ?? 'canvas.tsx';
6473
+ const walk = walkIdElements(source, file);
6474
+ if (!walk.ok) {
6475
+ throw new CanvasEditError(`oxc-parser failed on ${file}: ${walk.error}`, {
6476
+ canvas: file,
6477
+ id: '',
6478
+ });
6479
+ }
6480
+ const els = walk.elements;
6481
+ const prints = new Map<boolean, Array<{ id: string; print: ElementPrint }>>();
6482
+ const printsFor = (withText: boolean) => {
6483
+ let p = prints.get(withText);
6484
+ if (!p) {
6485
+ p = printAll(file, source, null, withText);
6486
+ prints.set(withText, p);
6487
+ }
6488
+ return p;
6489
+ };
6490
+ const used = usedIds(els);
6491
+ for (const r of opts.reserved ?? []) used.add(r);
6492
+ const ids = new Map<string, ElementId>();
6493
+ const stamped = new Map<number, ElementId>();
6494
+ for (const t of targets) {
6495
+ const all = printsFor(t.print.text !== undefined);
6496
+ if (all.length !== els.length) break; // walkers disagree — stamp nothing rather than guess
6497
+ let at = all.findIndex((e) => e.id === t.hint && samePrint(e.print, t.print));
6498
+ if (at < 0) {
6499
+ const hits: number[] = [];
6500
+ all.forEach((e, k) => {
6501
+ if (samePrint(e.print, t.print)) hits.push(k);
6502
+ });
6503
+ if (hits.length !== 1) continue;
6504
+ at = hits[0] as number;
6505
+ }
6506
+ const el = els[at] as (typeof els)[number];
6507
+ if (el.idKind === 'expression') {
6508
+ throw new CanvasEditError(
6509
+ `data-cd-id must be a plain string ("…"), line ${el.line} — an expression can't be a stable id`,
6510
+ { canvas: file, id: t.hint }
6511
+ );
6512
+ }
6513
+ if (el.id !== null) {
6514
+ if (!isValidElementId(el.id)) {
6515
+ throw new CanvasEditError(
6516
+ `data-cd-id="${el.id}" (line ${el.line}) is not a valid element id — use lowercase words joined by "-"`,
6517
+ { canvas: file, id: t.hint }
6518
+ );
6519
+ }
6520
+ ids.set(t.hint, el.id);
6521
+ continue;
6522
+ }
6523
+ let id = stamped.get(at);
6524
+ if (!id) {
6525
+ id = generateElementId(seedOf(el), used);
6526
+ stamped.set(at, id);
6527
+ }
6528
+ ids.set(t.hint, id);
6529
+ }
6530
+ if (!stamped.size) return { source, ids };
6531
+ const out = insertIds(
6532
+ source,
6533
+ [...stamped].map(([k, id]) => ({ nameEnd: (els[k] as (typeof els)[number]).nameEnd, id }))
6534
+ );
6535
+ const check = parseSync(file, out, { sourceType: 'module' });
6536
+ if (check.errors && check.errors.length > 0) {
6537
+ throw new CanvasEditError(
6538
+ `stamping ids would produce invalid source (${check.errors[0]?.message ?? 'parse error'}); aborted`,
6539
+ { canvas: file, id: '' }
6540
+ );
6541
+ }
6542
+ return { source: out, ids };
6543
+ }
6544
+
6545
+ // ---------------------------------------------------------------------------
6546
+ // V2-2.19 — canvas-only metadata (contract V2-1.4 §5.5). Lock and the Hide marker are `data-cd-*`
6547
+ // attributes on the element in the VERSIONED TSX (no sidecar, no runtime path): shared, visible to
6548
+ // Claude where it edits, and stripped by every markup / code exporter (`stripCanvasOnly`). Each
6549
+ // gesture stamps the element first (a gesture is a studio write, §4.3) and returns its stable id.
6550
+
6551
+ /** The element `id` (+ `occurrence`) addresses, stamped if it has no authored id yet. */
6552
+ export function ensureStamped(
6553
+ canvasAbsPath: string,
6554
+ source: string,
6555
+ id: string,
6556
+ occurrence?: number,
6557
+ reserved?: Iterable<string>
6558
+ ): { source: string; id: ElementId } {
6559
+ const { el, walk, targetId } = locateWalked(canvasAbsPath, source, id, occurrence);
6560
+ if (el.idKind === 'expression') {
6561
+ throw new CanvasEditError(
6562
+ `data-cd-id must be a plain string ("…"), line ${el.line} — an expression can't be a stable id`,
6563
+ { canvas: canvasAbsPath, id: targetId }
6564
+ );
6565
+ }
6566
+ if (el.id !== null) {
6567
+ if (!isValidElementId(el.id)) {
6568
+ throw new CanvasEditError(
6569
+ `data-cd-id="${el.id}" (line ${el.line}) is not a valid element id — use lowercase words joined by "-"`,
6570
+ { canvas: canvasAbsPath, id: targetId }
6571
+ );
6572
+ }
6573
+ return { source, id: el.id };
6574
+ }
6575
+ const used = usedIds(walk);
6576
+ for (const r of reserved ?? []) used.add(r);
6577
+ const sid = generateElementId(seedOf(el), used);
6578
+ return { source: insertIds(source, [{ nameEnd: el.nameEnd, id: sid }]), id: sid };
6579
+ }
6580
+
6581
+ /** The walked element `id` (+ `occurrence`) addresses — never stamps. Throws when it is not there. */
6582
+ function locateWalked(canvasAbsPath: string, source: string, id: string, occurrence?: number) {
6583
+ const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
6584
+ if (parsed.errors && parsed.errors.length > 0) {
6585
+ throw new CanvasEditError(
6586
+ `oxc-parser failed on ${canvasAbsPath}: ${parsed.errors[0]?.message ?? 'unknown'}`,
6587
+ { canvas: canvasAbsPath, id }
6588
+ );
6589
+ }
6590
+ const targetId =
6591
+ typeof occurrence === 'number' ? resolveUsageId(parsed.program, id, occurrence) : id;
6592
+ const hit = findOpening(parsed.program, targetId);
6593
+ const walk = walkIdElements(source, canvasAbsPath);
6594
+ const el = hit && walk.ok ? walk.elements.find((e) => e.start === hit.element.start) : undefined;
6595
+ if (!el) {
6596
+ throw new CanvasEditError(`data-cd-id "${targetId}" not found in ${canvasAbsPath}`, {
6597
+ canvas: canvasAbsPath,
6598
+ id: targetId,
6599
+ });
6600
+ }
6601
+ return { el, walk: (walk as { elements: IdElement[] }).elements, targetId };
6602
+ }
6603
+
6604
+ /** The walked element carrying the authored id `id` (it exists — callers stamp first). */
6605
+ function stampedElement(canvasAbsPath: string, source: string, id: ElementId) {
6606
+ const walk = walkIdElements(source, canvasAbsPath);
6607
+ const el = walk.ok ? walk.elements.find((e) => e.id === id) : undefined;
6608
+ if (!el) {
6609
+ throw new CanvasEditError(`data-cd-id "${id}" not found in ${canvasAbsPath}`, {
6610
+ canvas: canvasAbsPath,
6611
+ id,
6612
+ });
6613
+ }
6614
+ return el;
6615
+ }
6616
+
6617
+ /** A single-quoted JS string literal (the style writer takes raw JS source). */
6618
+ function jsString(v: string): string {
6619
+ return `'${v.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
6620
+ }
6621
+
6622
+ /** Insert ` <attr>` right after the element's `data-cd-id` attribute (or its tag name). */
6623
+ function addCdAttr(
6624
+ source: string,
6625
+ el: { idAttr: { end: number } | null; nameEnd: number },
6626
+ attr: string
6627
+ ): string {
6628
+ const s = new MagicString(source);
6629
+ s.appendLeft(el.idAttr ? el.idAttr.end : el.nameEnd, ` ${attr}`);
6630
+ return s.toString();
6631
+ }
6632
+
6633
+ function removeSpan(source: string, span: { start: number; end: number }): string {
6634
+ return source.slice(0, span.start) + source.slice(span.end);
6635
+ }
6636
+
6637
+ /**
6638
+ * Lock ⇧⌘L / Layers lock (`locked: true`): stamp + `data-cd-locked`. Unlock: remove it (anyone with
6639
+ * edit rights; never Claude — the id check blocks it). Idempotent. A copy of a locked element
6640
+ * starts unlocked (`applyDuplicateElement`).
6641
+ */
6642
+ export function applySetLocked(
6643
+ canvasAbsPath: string,
6644
+ source: string,
6645
+ id: string,
6646
+ locked: boolean,
6647
+ opts: { occurrence?: number; reserved?: Iterable<string> } = {}
6648
+ ): { source: string; id: ElementId } {
6649
+ const st = ensureStamped(canvasAbsPath, source, id, opts.occurrence, opts.reserved);
6650
+ const el = stampedElement(canvasAbsPath, st.source, st.id);
6651
+ if (el.locked === locked) return st;
6652
+ const out = locked
6653
+ ? addCdAttr(st.source, el, 'data-cd-locked')
6654
+ : removeSpan(
6655
+ st.source,
6656
+ attrRemovalSpan(st.source, el.lockAttr as { start: number; end: number })
6657
+ );
6658
+ return { source: out, id: st.id };
6659
+ }
6660
+
6661
+ /**
6662
+ * Hide (Layers eye, object menu): stamp + `style.display = "none"` + `data-cd-hidden="<previous
6663
+ * inline display, or empty>"`. Show: restore the inline display from the marker (remove it when
6664
+ * the marker is empty) and drop the marker — so an element that had `display: flex` inline keeps
6665
+ * it. Idempotent; Show on an element the eye did not hide is a no-op.
6666
+ */
6667
+ export function applySetHidden(
6668
+ canvasAbsPath: string,
6669
+ source: string,
6670
+ id: string,
6671
+ hidden: boolean,
6672
+ opts: { occurrence?: number; reserved?: Iterable<string> } = {}
6673
+ ): { source: string; id: ElementId } {
6674
+ const st = ensureStamped(canvasAbsPath, source, id, opts.occurrence, opts.reserved);
6675
+ const el = stampedElement(canvasAbsPath, st.source, st.id);
6676
+ const isHidden = el.hiddenPrevDisplay !== null;
6677
+ if (isHidden === hidden) return st;
6678
+ if (hidden) {
6679
+ const display = readAttributeState(canvasAbsPath, st.source, st.id, 'style.display');
6680
+ if (display.kind === 'expression') {
6681
+ throw new CanvasEditError(
6682
+ `"${st.id}" sets display from an expression — hiding it would lose that; edit the code instead`,
6683
+ { canvas: canvasAbsPath, id: st.id }
6684
+ );
6685
+ }
6686
+ const prev = display.kind === 'literal' ? display.value : '';
6687
+ const styled = applyEdit(canvasAbsPath, st.source, st.id, 'style.display', "'none'").source;
6688
+ const after = stampedElement(canvasAbsPath, styled, st.id);
6689
+ return { source: addCdAttr(styled, after, `data-cd-hidden="${escapeAttr(prev)}"`), id: st.id };
6690
+ }
6691
+ const prev = el.hiddenPrevDisplay as string;
6692
+ const restored = prev
6693
+ ? applyEdit(canvasAbsPath, st.source, st.id, 'style.display', jsString(prev)).source
6694
+ : applyRemove(canvasAbsPath, st.source, st.id, 'style.display').source;
6695
+ const marker = stampedElement(canvasAbsPath, restored, st.id).hiddenAttr;
6696
+ return {
6697
+ source: marker ? removeSpan(restored, attrRemovalSpan(restored, marker)) : restored,
6698
+ id: st.id,
6699
+ };
6700
+ }
6701
+
6702
+ // ---------------------------------------------------------------------------
6703
+ // S3.10a — on-click links (contract client/v2/contracts/S3-links-format.md §3). A link is ONE
6704
+ // attribute, `data-cd-link="<target>"`, next to the element's `data-cd-id`: writing it stamps the id
6705
+ // (when missing) and sets the link in the same returned source — one write, one undo step. It is
6706
+ // canvas-only metadata (stripped by every exporter) but, unlike `data-cd-locked`, a copy keeps it.
6707
+
6708
+ /** A `data-cd-link` value outside the grammar (bridge/link-target.ts). The dispatcher answers `invalid`. */
6709
+ export class LinkTargetError extends CanvasEditError {
6710
+ readonly code = 'link-format' as const;
6711
+ constructor(canvas: string, id: string) {
6712
+ super('A link goes to "#<artboard>", "<canvas>.tsx#<artboard>" or an "https://" address.', {
6713
+ canvas,
6714
+ id,
6715
+ });
6716
+ this.name = 'LinkTargetError';
6717
+ }
6718
+ }
6719
+
6720
+ /**
6721
+ * Stamp `id` if needed + set `data-cd-link` in ONE returned source. Idempotent; replaces an existing
6722
+ * value in place. External values are written in `href` form. Throws LinkTargetError on an invalid target.
6723
+ */
6724
+ export function applySetLink(
6725
+ canvasAbsPath: string,
6726
+ source: string,
6727
+ id: string,
6728
+ target: string,
6729
+ opts: { occurrence?: number; reserved?: Iterable<string> } = {}
6730
+ ): { source: string; id: ElementId } {
6731
+ const parsed = parseLinkTarget(target);
6732
+ if (!parsed) throw new LinkTargetError(canvasAbsPath, id);
6733
+ const value = formatLinkTarget(parsed);
6734
+ const st = ensureStamped(canvasAbsPath, source, id, opts.occurrence, opts.reserved);
6735
+ const el = stampedElement(canvasAbsPath, st.source, st.id);
6736
+ if (el.linkKind === 'literal' && el.link === value) return st;
6737
+ const attr = `data-cd-link="${value}"`;
6738
+ if (el.linkAttr) {
6739
+ const s = new MagicString(st.source);
6740
+ s.overwrite(el.linkAttr.start, el.linkAttr.end, attr);
6741
+ return { source: s.toString(), id: st.id };
6742
+ }
6743
+ return { source: addCdAttr(st.source, el, attr), id: st.id };
6744
+ }
6745
+
6746
+ /** Remove `data-cd-link`. The id stays (ids are never removed). No-op (no stamp either) when absent. */
6747
+ export function applyClearLink(
6748
+ canvasAbsPath: string,
6749
+ source: string,
6750
+ id: string,
6751
+ opts: { occurrence?: number } = {}
6752
+ ): { source: string; id: ElementId } {
6753
+ const { el } = locateWalked(canvasAbsPath, source, id, opts.occurrence);
6754
+ if (!el.linkAttr) return { source, id: el.id && isValidElementId(el.id) ? el.id : id };
6755
+ const st = ensureStamped(canvasAbsPath, source, id, opts.occurrence);
6756
+ const after = stampedElement(canvasAbsPath, st.source, st.id);
6757
+ if (!after.linkAttr) return st;
6758
+ return { source: removeSpan(st.source, attrRemovalSpan(st.source, after.linkAttr)), id: st.id };
6759
+ }
6760
+
6761
+ export interface LinkRow {
6762
+ /** the element's authored id; null when it has none (check: `link-no-id`) */
6763
+ id: ElementId | null;
6764
+ /** the DCArtboard the element sits in */
6765
+ artboardId: string | null;
6766
+ line: number;
6767
+ /** the cooked value, or the expression's source text */
6768
+ raw: string;
6769
+ /** null = invalid (reported, never followed) */
6770
+ target: LinkTarget | null;
6771
+ }
6772
+
6773
+ /** Every link in a file, in source order. Throws CanvasEditError when the file does not parse. */
6774
+ export function readLinks(source: string, path: string): LinkRow[] {
6775
+ const walk = walkIdElements(source, path);
6776
+ if (!walk.ok) {
6777
+ throw new CanvasEditError(`oxc-parser failed on ${path}: ${walk.error}`, {
6778
+ canvas: path,
6779
+ id: '',
6780
+ });
6781
+ }
6782
+ const out: LinkRow[] = [];
6783
+ for (const e of walk.elements) {
6784
+ if (!e.linkAttr) continue;
6785
+ const literal = e.linkKind === 'literal';
6786
+ const raw = literal
6787
+ ? (e.link as string)
6788
+ : source.slice(source.indexOf('=', e.linkAttr.start) + 1, e.linkAttr.end).trim();
6789
+ out.push({
6790
+ id: e.idKind === 'literal' && e.id && isValidElementId(e.id) ? e.id : null,
6791
+ artboardId: e.artboard,
6792
+ line: e.line,
6793
+ raw,
6794
+ target: literal ? parseLinkTarget(e.link) : null,
6795
+ });
6796
+ }
6797
+ return out;
6798
+ }
6799
+
6800
+ /**
6801
+ * S7.25 — wrap everything inside `<DCArtboard id="…">…</DCArtboard>` in one element: `open` goes right after the
6802
+ * artboard's opening tag, `close` right before its closing tag, and nothing else in the file moves (the children keep
6803
+ * their own bytes, so an element id or a lock inside survives). Change kind uses it to put a design inside a scaling
6804
+ * `<div>`. An artboard with no children (self-closing) is refused: there is nothing to wrap. Pure; reparse-gated.
6805
+ */
6806
+ export function applyWrapArtboardChildren(
6807
+ canvasAbsPath: string,
6808
+ source: string,
6809
+ artboardId: string,
6810
+ open: string,
6811
+ close: string
6812
+ ): { source: string } {
6813
+ const fail = (m: string) => new CanvasEditError(m, { canvas: canvasAbsPath, id: artboardId });
6814
+ const parsed = parseSync(canvasAbsPath, source, { sourceType: 'module' });
6815
+ if (parsed.errors && parsed.errors.length > 0)
6816
+ throw fail(`oxc-parser failed on ${canvasAbsPath}: ${parsed.errors[0]?.message ?? 'unknown'}`);
6817
+ const target = collectJsxByTag(parsed.program, 'DCArtboard').find(
6818
+ (a) => getStringAttr(a.openingElement, 'id') === artboardId
6819
+ );
6820
+ if (!target) throw fail(`<DCArtboard id="${artboardId}"> not found in ${canvasAbsPath}`);
6821
+ if (target.openingElement?.selfClosing || !target.closingElement)
6822
+ throw fail('That artboard has nothing inside it to scale.');
6823
+ const s = new MagicString(source);
6824
+ s.appendLeft(target.openingElement.end as number, `\n${open}`);
6825
+ s.prependRight(target.closingElement.start as number, `${close}\n`);
6826
+ const out = s.toString();
6827
+ const check = parseSync(canvasAbsPath, out, { sourceType: 'module' });
6828
+ if (check.errors && check.errors.length > 0)
6829
+ throw fail(
6830
+ `wrap-artboard-children produced invalid source (${check.errors[0]?.message ?? 'parse error'})`
6831
+ );
6832
+ return { source: out };
6833
+ }