@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
@@ -1,11 +1,42 @@
1
1
  import { MAX_BOARD_BYTES, MAX_ELEMENTS } from './annotations/constants.ts';
2
+ import { fanOut, stackLanding, stackMembers } from './annotations/elements/sticky.model.ts';
3
+ import { type HostRects, resolverFromRects } from './annotations/hosts.ts';
2
4
  import { guardLockedOps, isAllLocked, lockedStrokeIds } from './annotations/lock.ts';
3
5
  import { v1ToV2 } from './annotations/migrate-v1.ts';
4
6
  import { type Op as AnnotationOp, applyOps, diffToOps } from './annotations/ops.ts';
5
7
  import { defOf } from './annotations/registry.ts';
6
8
  import { observeReplica } from './annotations/replica.ts';
9
+ import { createArrowRouter } from './annotations/route.ts';
7
10
  import { parseBoard, validateElements } from './annotations/schema.ts';
11
+ import { withTimePins } from './annotations/time-marks.ts';
8
12
  import type { AnnotationElement } from './annotations/types.ts';
13
+ import { AI_MARKS_CSS } from './annotations/ui/ai-marks.tsx';
14
+ import { AiSeenRings } from './annotations/ui/ai-seen.tsx';
15
+ import {
16
+ type AimRects,
17
+ asHostRects,
18
+ attachHosts,
19
+ type BindCandidate,
20
+ type BoundEnd,
21
+ bindEnd,
22
+ bindNow,
23
+ edgeBand,
24
+ hostRefOf,
25
+ pickCandidate,
26
+ type StampFn,
27
+ } from './annotations/ui/arrow-bind.ts';
28
+ import {
29
+ AimOverlay,
30
+ type AimState,
31
+ ArrowLabelEditor,
32
+ BoundTag,
33
+ type DanglingCardModel,
34
+ danglingCard,
35
+ HostMarks,
36
+ nearbyOutlines,
37
+ rewrittenFor,
38
+ } from './annotations/ui/arrow-cards.tsx';
39
+ import { labelPatch, NEW_ARROW } from './annotations/ui/arrow-kinds.ts';
9
40
  import { BoardStore } from './annotations/ui/board.ts';
10
41
  import {
11
42
  Containment,
@@ -15,22 +46,84 @@ import {
15
46
  marqueeHits,
16
47
  } from './annotations/ui/containment.ts';
17
48
  import type { EditRequest } from './annotations/ui/element-node.tsx';
49
+ import {
50
+ danglingOf,
51
+ hasHosts,
52
+ hostSignature,
53
+ markDangling,
54
+ rectsReady,
55
+ viewStrokes,
56
+ } from './annotations/ui/host-view.ts';
57
+ import { LockedDragTip, QUIET_MOVE_TIP } from './annotations/ui/locked.tsx';
18
58
  import { AnnotationPipelineContext } from './annotations/ui/pipeline-context.ts';
59
+ import { PlacementGhost, postStampDisarmed, StickerSizeChip } from './annotations/ui/placement.tsx';
19
60
  import { type Claim, PointerPipeline } from './annotations/ui/pointer-pipeline.ts';
20
- import { type RenderItem, renderItemsFromStrokes } from './annotations/ui/render-model.ts';
61
+ import { quietStrokeAt } from './annotations/ui/quiet-tip.ts';
62
+ import {
63
+ type RenderItem,
64
+ type ResolvedEnds,
65
+ renderItemsFromStrokes,
66
+ } from './annotations/ui/render-model.ts';
67
+ import { type BoardRect, labelPoint, routeElbowsAtRest } from './annotations/ui/rest-route.ts';
68
+ import {
69
+ createDomRideSink,
70
+ createRideController,
71
+ hostBoxesAfter,
72
+ type RideController,
73
+ riderOps,
74
+ withMembership,
75
+ } from './annotations/ui/ride.ts';
21
76
  import { AnnotationScene } from './annotations/ui/scene.tsx';
77
+ import {
78
+ foldSummary,
79
+ foldVerb,
80
+ membersOf,
81
+ SECTION_TONES,
82
+ setFolded,
83
+ withoutFolded,
84
+ } from './annotations/ui/section-fold.ts';
85
+ import { postToShell, scopeKey, selectionScope } from './annotations/ui/shell-asks.ts';
86
+ import { stampElement, stampTargetAt, upsertStampStroke } from './annotations/ui/stamps.ts';
87
+ import {
88
+ dropSticker,
89
+ isGallerySticker,
90
+ opensPhotoInspector,
91
+ type Pending,
92
+ pendingFor,
93
+ placementOf,
94
+ replacePatch,
95
+ stickerRefOf,
96
+ toolForTemplate,
97
+ } from './annotations/ui/sticker-drop.ts';
98
+ import { rememberStickerPreview, resolveStickerHref } from './annotations/ui/sticker-preview.ts';
99
+ import {
100
+ NO_RESOLVED_LINE,
101
+ resolveVerb,
102
+ selectResolvedIds,
103
+ toggleResolved,
104
+ trashedLine,
105
+ withoutResolvedStickies,
106
+ } from './annotations/ui/sticky-resolve.ts';
107
+ import { expandTemplate, templateExtent } from './annotations/ui/template-place.ts';
22
108
  import {
23
109
  aimCommitOps,
24
110
  draftOp,
111
+ draftWriteId,
25
112
  markSent,
26
113
  openSession,
27
114
  remotelyEdited,
28
115
  restoreOp,
116
+ sessionWriteId,
29
117
  type TextSession,
30
118
  } from './annotations/ui/text-session.ts';
31
119
  import { TEXT_LAYER_CSS } from './annotations/ui/text-style.ts';
120
+ import { TIME_PIN_CSS } from './annotations/ui/time-pins.tsx';
121
+ // S4.14 — a formal vote: your dots on the voted artboards, the counts once it has ended.
122
+ import { VoteDots } from './annotations/ui/vote-dots.tsx';
32
123
  import { projectStrokes, type StrokeCache } from './annotations/ui/world.ts';
33
124
  import { elementsToStrokes, strokesToElementMap } from './annotations/v1-adapter.ts';
125
+ import { reasonProps } from './client/v2/access/disabled-reason.js';
126
+ import { setStickerSelected } from './toolbars/shell-panels.ts';
34
127
  /**
35
128
  * @file annotations-layer.tsx — FigJam-style annotation overlay
36
129
  * @scope apps/studio/annotations-layer.tsx
@@ -64,12 +157,33 @@ import {
64
157
  useCallback,
65
158
  useContext,
66
159
  useEffect,
160
+ useLayoutEffect,
67
161
  useMemo,
68
162
  useRef,
69
163
  useState,
70
164
  useSyncExternalStore,
71
165
  } from 'react';
72
166
  import { createPortal } from 'react-dom';
167
+ import { inMosaic, LOD_CSS, LodMosaic, lodModel, type Rect } from './annotations/ui/lod.tsx';
168
+ import {
169
+ annotationMarquees,
170
+ annotationPicks,
171
+ annotationPosture,
172
+ } from './annotations/ui/posture.ts';
173
+ import { resolveInk } from './annotations/ui/tool-prefs.ts';
174
+ import {
175
+ eraseTargetIndex,
176
+ isSelectableStrokeTool,
177
+ readChromeTheme,
178
+ useCanvasChromeTheme,
179
+ useToolState,
180
+ } from './annotations/ui/tool-state.ts';
181
+ import {
182
+ filterByAuthors,
183
+ knownIds,
184
+ reportAnnotationsVisibility,
185
+ withoutResolved,
186
+ } from './annotations/ui/visibility.ts';
73
187
  import {
74
188
  type AlignEdge,
75
189
  alignStrokes,
@@ -81,7 +195,7 @@ import {
81
195
  BIND_THRESHOLD_PX,
82
196
  bindCandidate,
83
197
  isBindable,
84
- recomputeBoundArrows,
198
+ recomputeBoundArrows as recomputeBoundArrowsBase,
85
199
  } from './annotations-bindings.ts';
86
200
  import { AnnotationContextToolbar } from './annotations-context-toolbar.tsx';
87
201
  import {
@@ -100,20 +214,13 @@ import {
100
214
  applyDrawModifiers,
101
215
  clampLinkTitle,
102
216
  DEFAULT_FONT_SIZE,
103
- DEFAULT_HIGHLIGHTER_COLOR,
104
- DEFAULT_HIGHLIGHTER_WIDTH,
105
217
  DEFAULT_SECTION_COLOR,
106
- DEFAULT_STICKY_COLOR,
107
218
  type DrawMods,
108
219
  defaultFillFor,
109
220
  type EditorFmt,
110
221
  type EllipseStroke,
111
- FILL_PALETTE,
112
222
  fmtEqual,
113
- grownStickyBox,
114
223
  HALO_PAD_PX,
115
- HIGHLIGHTER_PALETTE,
116
- HIGHLIGHTER_WIDTHS,
117
224
  IMAGE_MAX_DROP_SIDE,
118
225
  IMAGE_MIN_SIZE,
119
226
  type ImageStroke,
@@ -160,14 +267,12 @@ import {
160
267
  STICKY_DEFAULT_H,
161
268
  STICKY_DEFAULT_W,
162
269
  STICKY_MIN_SIZE,
163
- STICKY_PALETTE,
164
- STROKE_PALETTE,
165
- STROKE_WIDTH_THICK,
166
270
  STROKE_WIDTH_THIN,
167
271
  type StickyStroke,
168
272
  type Stroke,
169
273
  splitTextLines,
170
274
  stickyCornerPath,
275
+ stickyEditNext,
171
276
  stripEditorMarkers,
172
277
  strokeBBox,
173
278
  strokeCenter,
@@ -177,7 +282,6 @@ import {
177
282
  TEXT_LINE_HEIGHT,
178
283
  type TextAlign,
179
284
  type TextStroke,
180
- type Thickness,
181
285
  textDecoCss,
182
286
  textLineDy,
183
287
  translateOne,
@@ -189,19 +293,26 @@ import {
189
293
  SNAP_THRESHOLD_PX,
190
294
  type SnapGuide,
191
295
  } from './annotations-snap.ts';
296
+ import { canvasModeStore, canvasSingleKeys } from './bridge/canvas-mode-store.ts';
297
+ import { modeShows } from './bridge/mode-shows.ts';
192
298
  import { arrowPrimitives, type SvgPrimitive } from './canvas-arrowheads.ts';
193
- import { IconLineThick, IconLineThin } from './canvas-icons.tsx';
194
299
  import {
195
300
  countRender,
196
301
  getLiveViewport,
302
+ useArtboardsContext,
303
+ useDragBusRide,
197
304
  useLiveViewport,
198
305
  useViewportControllerContext,
199
306
  useWorldRefContext,
200
307
  } from './canvas-lib.tsx';
201
308
  import { buildAnnotationOpsRecord } from './commands/annotation-ops-command.ts';
202
309
  import { ensureMenuStyles as ensureCtxMenuStyles } from './context-menu.tsx';
203
- import { crossedDragThreshold, type Tool } from './input-router.tsx';
310
+ import { clickToType } from './editing/click-to-type.ts';
311
+ import { runEditOp } from './editing/edit-op.ts';
312
+ import { selectWhenRendered as selectElementsWhenRendered } from './editing/object-actions.ts';
313
+ import { crossedDragThreshold, postModeRequest, type Tool } from './input-router.tsx';
204
314
  import { createMediaCommitChain, type MediaCommitResult } from './media-commit-chain.ts';
315
+ import { currentCanvasFile } from './shell-canvas-file.ts';
205
316
  import {
206
317
  AnnotationResizeOverlay,
207
318
  bboxResize,
@@ -212,6 +323,7 @@ import {
212
323
  } from './use-annotation-resize.tsx';
213
324
  import { useAnnotationSelectionOptional } from './use-annotation-selection.tsx';
214
325
  import { useAnnotationsVisibility } from './use-annotations-visibility.tsx';
326
+ import { useCanvasKeys } from './use-canvas-keys.ts';
215
327
  import {
216
328
  BATCH_DROP_CASCADE_PX,
217
329
  isHttpUrl,
@@ -222,10 +334,17 @@ import {
222
334
  useCanvasMediaDrop,
223
335
  } from './use-canvas-media-drop.tsx';
224
336
  import { useChromeVisibility } from './use-chrome-visibility.tsx';
225
- import { type AnnotationGesture, colorForName, useCollab } from './use-collab.tsx';
337
+ import {
338
+ type AnnotationGesture,
339
+ colorForName,
340
+ useCollab,
341
+ useForeignAwareness,
342
+ } from './use-collab.tsx';
343
+ import { useGovernedMode } from './use-governed-mode.ts';
226
344
  import { useSelectionSetOptional } from './use-selection-set.tsx';
227
345
  import { type ShapeKind, useToolMode } from './use-tool-mode.tsx';
228
346
  import { useUndoSinks, useUndoStackOptional } from './use-undo-stack.tsx';
347
+ import { playheadOf } from './video-comp.tsx';
229
348
 
230
349
  // FigJam v3 — the pure data model (Stroke types, palettes, serialize/parse,
231
350
  // geometry) lives in annotations-model.ts: React-free, importable headlessly
@@ -266,38 +385,33 @@ type EditingTarget =
266
385
  | { kind: 'pending'; x: number; y: number }
267
386
  | null;
268
387
 
269
- /**
270
- * The canvas-shell CHROME theme — `data-maude-theme` on `<html>`, default
271
- * 'dark'. This (NOT the DS `data-theme`, which is deliberately separate and
272
- * themes only artboard palettes — canvas-shell.tsx) is what flips the canvas
273
- * BACKGROUND the annotation ink sits on, so the theme-aware default ink follows
274
- * it. Re-resolves on `data-maude-theme` mutation (the dark/light toggle posts it
275
- * into the iframe after mount, so we re-read once on mount too).
276
- */
277
- function readChromeTheme(): 'light' | 'dark' {
278
- if (typeof document === 'undefined') return 'dark';
279
- return document.documentElement.dataset.maudeTheme === 'light' ? 'light' : 'dark';
280
- }
281
- function useCanvasChromeTheme(): 'light' | 'dark' {
282
- const [theme, setTheme] = useState<'light' | 'dark'>(readChromeTheme);
283
- useEffect(() => {
284
- if (typeof document === 'undefined') return;
285
- const sync = () => setTheme(readChromeTheme());
286
- sync(); // catch a value stamped between the initializer and this effect
287
- const obs = new MutationObserver(sync);
288
- obs.observe(document.documentElement, {
289
- attributes: true,
290
- attributeFilter: ['data-maude-theme'],
291
- });
292
- return () => obs.disconnect();
293
- }, []);
294
- return theme;
295
- }
296
-
297
388
  // Phase 24 — moved to canvas-arrowheads.ts (single source for shaft + heads).
298
389
  // Re-exported so the existing test import (`from './annotations/annotations-layer.tsx'`)
299
390
  // and the byte-identical canary keep working.
300
391
 
392
+ /** How long the last Assets-tile drag point stays good for the drop that follows it (ms). */
393
+ const DROP_POINT_MS = 2000;
394
+
395
+ /**
396
+ * r4 #2 — the last point (frame coordinates) an Assets tile was dragged over, from the shell's `asset-drag-over`.
397
+ * A tile dropped in Preview arrives as `insert-annotation-media` right after it, and lands there; a drag that left
398
+ * the canvas (`x: null`) or a point older than DROP_POINT_MS is not reused, and one drop uses it once.
399
+ */
400
+ export function annotationDropPoint() {
401
+ let last: { x: number; y: number; t: number } | null = null;
402
+ return {
403
+ see(p: { x: number; y: number } | null, now: number) {
404
+ last = p ? { x: p.x, y: p.y, t: now } : null;
405
+ },
406
+ take(now: number): { x: number; y: number } | null {
407
+ const p = last;
408
+ last = null;
409
+ return p && now - p.t <= DROP_POINT_MS ? { x: p.x, y: p.y } : null;
410
+ },
411
+ };
412
+ }
413
+ const ASSET_DROP_POINT = annotationDropPoint();
414
+
301
415
  /** A whiteboard clipboard payload (v2 elements, or a pre-v2 strokes list). */
302
416
  function isBoardClipboard(txt: string): boolean {
303
417
  // The clipboard is foreign input (any page the user copied from can set it):
@@ -315,22 +429,69 @@ function isEditable(t: EventTarget | null): boolean {
315
429
  return false;
316
430
  }
317
431
 
318
- function deriveFile(): string | undefined {
319
- if (typeof window === 'undefined') return undefined;
432
+ /** S4.13 - the name an artboard wears on the canvas ("Směr B"), for the stamp card; '' when it cannot be read. */
433
+ function artboardLabelNow(id: string): string {
320
434
  try {
321
- const p = window.location.pathname;
322
- if (p === '/_canvas-shell.html' || p === '/_canvas-shell') {
323
- const qs = new URLSearchParams(window.location.search);
324
- const canvas = qs.get('canvas') ?? '';
325
- const designRel = (qs.get('designRel') ?? '.design').replace(/^\/+|\/+$/g, '');
326
- return `${designRel}/${canvas}`;
327
- }
328
- return decodeURIComponent(p).replace(/^\//, '');
435
+ const sel = `[data-dc-screen="${id.replace(/["\\]/g, '')}"] .dc-artboard-label`;
436
+ return document.querySelector(sel)?.textContent?.trim() ?? '';
329
437
  } catch {
330
- return undefined;
438
+ return '';
331
439
  }
332
440
  }
333
441
 
442
+ /** S4.10 — one `__maudeCanvasRects()` snapshot (artboards + elements, world coords), or null. */
443
+ function canvasRectsNow(): HostRects | null {
444
+ try {
445
+ const w = window as unknown as { __maudeCanvasRects?: () => HostRects };
446
+ return w.__maudeCanvasRects?.() ?? null;
447
+ } catch {
448
+ return null;
449
+ }
450
+ }
451
+
452
+ /**
453
+ * S4.11 — `recomputeBoundArrows` with the live canvas as the resolver for `ab:` / `el:` ends. Every
454
+ * commit that re-derives bound arrows refreshes the cache of a canvas-bound end from where its host
455
+ * IS (hosts.ts: the cache is what a 1.x peer draws). Nothing is derived until the canvas has
456
+ * painted, and a host the canvas cannot find keeps its cached point (dangling is derived).
457
+ */
458
+ function recomputeBoundArrows(list: readonly Stroke[]): Stroke[] {
459
+ if (!hasHosts(list)) return recomputeBoundArrowsBase(list);
460
+ const rects = canvasRectsNow() as AimRects | null;
461
+ return recomputeBoundArrowsBase(
462
+ list,
463
+ rectsReady(rects) ? resolverFromRects(asHostRects(rects)) : undefined
464
+ );
465
+ }
466
+
467
+ /** S4.11 — stamp an element through the S2.1 edit-op relay (Q12, `element.stamp`). */
468
+ const stampViaEditOp: StampFn = async ({ artboard, element, occurrence, expectRev }) => {
469
+ const r = await runEditOp({
470
+ op: 'element.stamp',
471
+ targets: [{ artboard, element, ...(occurrence ? { occurrence } : {}) }],
472
+ ...(expectRev ? { expectRev } : {}),
473
+ });
474
+ return r.ok ? { ok: true, refs: r.refs } : { ok: false, code: r.code, message: r.message };
475
+ };
476
+
477
+ /** S4.10 — an artboard's visible label (the refused-straight tag names it), else its id. */
478
+ function artboardLabel(id: string): string {
479
+ if (typeof document === 'undefined') return id;
480
+ const el = document.querySelector(`[data-dc-screen="${CSS.escape(id)}"] .dc-artboard-label`);
481
+ return el?.textContent?.trim() || id;
482
+ }
483
+
484
+ function prefersReducedMotion(): boolean {
485
+ return (
486
+ typeof window !== 'undefined' &&
487
+ !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
488
+ );
489
+ }
490
+
491
+ function deriveFile(): string | undefined {
492
+ return currentCanvasFile() ?? undefined;
493
+ }
494
+
334
495
  /**
335
496
  * Phase 23 — the served designRoot prefix for the current canvas document. An
336
497
  * image stroke persists its href as a RELATIVE `assets/<sha8>.<ext>` path (the
@@ -360,6 +521,9 @@ function canvasDesignRel(): string {
360
521
  * optimistic `blob:`/`data:` preview href (pre-upload) is used verbatim.
361
522
  */
362
523
  function resolveAssetHref(href: string): string {
524
+ // r4 #16 - a gallery sticker just picked draws from the picture the shell sent along, not from a second load
525
+ const preview = resolveStickerHref(href);
526
+ if (preview) return preview;
363
527
  return /^assets\//.test(href) ? `/${canvasDesignRel()}/${href}` : href;
364
528
  }
365
529
 
@@ -430,7 +594,11 @@ function classifyAssetPathKind(path: string): 'image' | 'video' | 'audio' | null
430
594
  */
431
595
  function isMediaPlayerTarget(e: Event): boolean {
432
596
  const t = e.target as Element | null;
433
- return !!(t && typeof t.closest === 'function' && t.closest('[data-mediaref-player]'));
597
+ return !!(
598
+ t &&
599
+ typeof t.closest === 'function' &&
600
+ t.closest('[data-mediaref-player], [data-vplay]')
601
+ );
434
602
  }
435
603
 
436
604
  /**
@@ -500,121 +668,117 @@ function findTextStrokeAt(
500
668
  // ─────────────────────────────────────────────────────────────────────────────
501
669
  // Styles
502
670
 
671
+ /** The stickies as plain boxes in paint order (the stack / fan-out maths of sticky.model.ts). */
672
+ function stickyBoxes(list: readonly Stroke[]) {
673
+ return list
674
+ .filter((x): x is StickyStroke => x.tool === 'sticky')
675
+ .map((x) => ({
676
+ id: x.id,
677
+ x: Math.min(x.x, x.x + x.w),
678
+ y: Math.min(x.y, x.y + x.h),
679
+ w: Math.abs(x.w),
680
+ h: Math.abs(x.h),
681
+ }));
682
+ }
683
+
684
+ /** S4.12 - the registry actions the layer answers on the `run-action` lane. */
685
+ const STICKY_RUN_ACTIONS: ReadonlySet<string> = new Set([
686
+ 'annotation.resolve',
687
+ 'annotation.fan-out',
688
+ 'annotation.fold',
689
+ 'annotation.to-comment',
690
+ 'annotation.ask-ai',
691
+ 'annotations.trash-resolved',
692
+ 'annotations.select-resolved',
693
+ ]);
694
+
503
695
  const ANNOT_CSS = `
504
- .dc-annot-chrome {
505
- /* Stacks directly above the centered tool toolbar (which is bottom:16px,
506
- 32px tall → top edge ~ bottom:48px). 8 px gap → chrome at bottom:60px.
507
- Phase 21 — dark "marker tray" matching the FigJam selection bar. */
696
+ /* S4.9 - Edit's posture (annotations/ui/posture.ts): the ink fades, a sticky's paper is mixed with grey in
697
+ JS (quietPaper) so its words keep their contrast, and nothing in the scene takes a pointer: a click
698
+ reaches the design under it. */
699
+ .dc-annot-scene[data-an-quiet] .dc-annot-el:not([data-tool="sticky"]):not([data-type="section"]) { opacity: 0.45; }
700
+ /* a11y (15 an-section) - a section's title chip is WORDS: it stays at full ink in Edit (a faded chip read 1.5:1);
701
+ its body is already a 7 % wash, so nothing of the section needs fading. */
702
+ .dc-annot-scene[data-an-quiet], .dc-annot-scene[data-an-quiet] * { pointer-events: none !important; }
703
+ /* …except an OPEN text editor (a double-click opens a sticky's words in Edit too): it is where the person types,
704
+ and its caret-at-the-click mirror (text-editor.tsx offsetFromPoint, same class) must be hit-testable. */
705
+ .dc-annot-scene[data-an-quiet] .dc-annot-editor { pointer-events: auto !important; }
706
+ .dc-annot-input {
508
707
  position: absolute;
509
- left: 50%;
510
- bottom: 64px;
511
- transform: translateX(-50%);
512
- display: flex;
513
- align-items: center;
514
- gap: 2px;
515
- background: #26262b;
516
- border: 1px solid rgba(255,255,255,0.08);
517
- border-radius: 12px;
518
- padding: 5px 8px;
519
- font-family: var(--maude-chrome-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
520
- font-size: 11px;
521
- color: rgba(255,255,255,0.85);
522
- z-index: 6;
523
- box-shadow: 0 8px 28px rgba(0,0,0,0.34), 0 2px 6px rgba(0,0,0,0.22);
524
- user-select: none;
525
- }
526
- .dc-annot-chrome .dc-annot-swatches { display: flex; align-items: center; gap: 1px; }
527
- .dc-annot-chrome .dc-annot-sw {
528
- width: 20px;
529
- height: 20px;
530
- border-radius: 50%;
531
- border: 1px solid rgba(255,255,255,0.16);
532
- cursor: pointer;
533
- padding: 0;
534
- appearance: none;
535
- transition: transform 80ms ease;
536
- }
537
- .dc-annot-chrome .dc-annot-sw:hover { transform: scale(1.1); }
538
- .dc-annot-chrome .dc-annot-sw[aria-pressed="true"] {
539
- box-shadow: 0 0 0 2px #26262b, 0 0 0 3px rgba(255,255,255,0.92);
540
- border-color: transparent;
541
- }
542
- .dc-annot-chrome .dc-annot-sw:focus-visible {
543
- outline: 2px solid #ffffff;
544
- outline-offset: 1px;
545
- }
546
- .dc-annot-chrome .dc-annot-sep {
547
- width: 1px;
548
- height: 16px;
549
- align-self: center;
550
- background: rgba(255,255,255,0.09);
551
- margin: 0 4px;
708
+ inset: 0;
709
+ z-index: 4;
552
710
  }
553
- .dc-annot-chrome .dc-annot-fill {
554
- width: 20px;
555
- height: 20px;
556
- border-radius: 50%;
557
- border: 1px solid rgba(255,255,255,0.16);
558
- cursor: pointer;
559
- padding: 0;
560
- appearance: none;
561
- position: relative;
562
- transition: transform 80ms ease;
711
+ /* S4.12 - a sticky up close (canvas 15 an-sticky): the author line shows on hover and when selected; a
712
+ resolved one is struck through in place with a tick; a folded section keeps its title chip and count. */
713
+ .dc-annot-who { opacity: 0; pointer-events: none; transition: opacity var(--dur-fast, 100ms) var(--ease-out, ease-out); }
714
+ .dc-annot-el:hover > .dc-annot-who, .dc-annot-who[data-an-who="sel"] { opacity: 1; }
715
+ .dc-annot-done {
716
+ position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; display: grid; place-items: center;
717
+ border-radius: 50%; background: var(--maude-hud-accent, #2f7d4f); color: #fff; pointer-events: none;
563
718
  }
564
- .dc-annot-chrome .dc-annot-fill:hover { transform: scale(1.1); }
565
- .dc-annot-chrome .dc-annot-fill:focus-visible {
566
- outline: 2px solid #ffffff;
567
- outline-offset: 1px;
719
+ .dc-annot-scene[data-an-quiet] .dc-annot-who { display: none; }
720
+ .dc-annot-fold { position: absolute; font: 600 11px/1 var(--font-ui, system-ui); white-space: nowrap; pointer-events: none; }
721
+ /* S4.10 - ride with the artboard: the live re-route overlay (world coords, no hit area), the
722
+ refused-straight chip, and the outline of the artboard a selection belongs to. The settled route
723
+ eases in on --dur-soft (160 ms); reduced motion collapses the token, and the sink skips the fade. */
724
+ .dc-annot-ride { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; z-index: 3; }
725
+ .dc-annot-ride-svg { position: absolute; left: 0; top: 0; width: 200000px; height: 200000px; overflow: visible; pointer-events: none; }
726
+ .dc-annot-ride-svg g.is-settling { opacity: 0; transition: opacity var(--dur-soft, 160ms) var(--ease-out, ease-out); }
727
+ .dc-annot-ride-svg g.is-settling.is-in { opacity: 1; }
728
+ .dc-annot-ride-svg g.is-leaving { opacity: 0; transition: opacity var(--dur-soft, 160ms) var(--ease-out, ease-out); }
729
+ .dc-annot-route {
730
+ position: absolute; white-space: nowrap; pointer-events: none;
731
+ font: 500 12px/1.3 var(--font-ui, system-ui, sans-serif); padding: 2px 8px; border-radius: 4px;
732
+ color: var(--maude-hud-bg, #fff); background: var(--maude-hud-fg, #1a1a1a);
568
733
  }
569
- .dc-annot-chrome .dc-annot-fill--none {
570
- background: #3a3a40;
734
+ .dc-annot-cross {
735
+ position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
736
+ font: 500 12px/1.3 var(--font-ui, system-ui, sans-serif); padding: 2px 8px; border-radius: 999px;
737
+ color: var(--maude-hud-fg, #1a1a1a); background: var(--maude-hud-bg, #fff);
738
+ box-shadow: 0 0 0 1px color-mix(in oklab, var(--maude-hud-danger, #c4321b) 50%, transparent);
571
739
  }
572
- .dc-annot-chrome .dc-annot-fill--none::after {
573
- content: "";
574
- position: absolute; inset: 4px;
575
- border-radius: 50%;
576
- background:
577
- linear-gradient(135deg, transparent 44%, rgba(255,255,255,0.55) 44%, rgba(255,255,255,0.55) 56%, transparent 56%);
740
+ /* S4.11 - arrow aiming, dangling cards, labels (annotations/ui/arrow-cards.tsx). World space; the
741
+ interactive pieces take pointers (CHROME_SELECTOR), the rest never do. */
742
+ .dc-annot-arrowui { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; z-index: 6; }
743
+ .dc-annot-arrowui-live { pointer-events: auto; }
744
+ .dc-annot-cand { position: absolute; border-radius: 4px; outline-style: dashed; outline-color: color-mix(in oklab, var(--maude-hud-accent, oklch(0.53 0.175 238)) 55%, transparent); pointer-events: none; }
745
+ .dc-annot-snap, .dc-annot-edge { position: absolute; border-radius: 4px; pointer-events: none; }
746
+ .dc-annot-snap-tag {
747
+ position: absolute; display: inline-flex; gap: 3px; transform-origin: 0 0; white-space: nowrap; pointer-events: none;
748
+ font: 500 12px/1.3 var(--font-ui, system-ui, sans-serif); padding: 2px 8px; border-radius: 4px;
749
+ color: var(--maude-hud-accent-fg, #fff); background: var(--maude-hud-accent, oklch(0.53 0.175 238));
578
750
  }
579
- .dc-annot-chrome .dc-annot-fill[aria-pressed="true"] {
580
- box-shadow: 0 0 0 2px #26262b, 0 0 0 3px rgba(255,255,255,0.92);
581
- border-color: transparent;
751
+ .dc-annot-snap-tag b { font-weight: 600; }
752
+ .dc-annot-gone { position: absolute; box-sizing: border-box; border-style: dashed; border-color: var(--maude-chrome-fg-2, #6e6660); pointer-events: none; }
753
+ .dc-annot-open { position: absolute; box-sizing: border-box; transform: translate(-50%, -50%); border-style: solid; border-radius: 50%; border-color: var(--maude-hud-accent, oklch(0.53 0.175 238)); background: var(--maude-hud-bg, #fff); pointer-events: none; }
754
+ .dc-annot-dg {
755
+ position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 228px; transform-origin: 0 0;
756
+ padding: 10px; border-radius: 10px; box-sizing: border-box;
757
+ font: 400 12px/1.4 var(--font-ui, system-ui, sans-serif); color: var(--maude-hud-fg, #1a1a1a); background: var(--maude-hud-bg, #fff);
758
+ box-shadow: 0 6px 24px rgb(0 0 0 / 0.18), 0 0 0 0.5px rgb(0 0 0 / 0.12);
582
759
  }
583
- /* Phase 21 — icon buttons (light glyph on dark, white-tint active). */
584
- .dc-annot-chrome .dc-annot-ibtn {
585
- appearance: none;
586
- background: transparent;
587
- border: 0;
588
- border-radius: 7px;
589
- width: 26px;
590
- height: 26px;
591
- display: inline-flex;
592
- align-items: center;
593
- justify-content: center;
594
- color: rgba(255,255,255,0.78);
595
- cursor: pointer;
596
- padding: 0;
597
- transition: background-color 80ms linear, color 80ms linear;
760
+ .dc-annot-dg p { margin: 0; }
761
+ .dc-annot-dg-btn {
762
+ font: 500 12px/1 var(--font-ui, system-ui, sans-serif); padding: 5px 10px; border: 0; border-radius: 6px; cursor: pointer;
763
+ color: var(--maude-hud-accent-fg, #fff); background: var(--maude-hud-accent, oklch(0.53 0.175 238));
598
764
  }
599
- .dc-annot-chrome .dc-annot-ibtn:hover {
600
- background: rgba(255,255,255,0.1);
601
- color: #ffffff;
765
+ .dc-annot-alabel {
766
+ position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
767
+ font: 600 13px/1.3 var(--font-ui, system-ui, sans-serif); padding: 1px 6px; border-radius: 3px;
768
+ color: var(--maude-hud-fg, #1a1a1a); background: var(--maude-hud-bg, #fff);
602
769
  }
603
- .dc-annot-chrome .dc-annot-ibtn[aria-pressed="true"] {
604
- background: rgba(255,255,255,0.18);
605
- color: #ffffff;
770
+ .dc-annot-alabel--edit { pointer-events: auto; border: 0; outline: 1.5px solid var(--maude-hud-accent, oklch(0.53 0.175 238)); min-width: 80px; text-align: center; transform-origin: 0 0; }
771
+ .dc-annot-belongs {
772
+ position: absolute; pointer-events: none; border-radius: 6px;
773
+ outline: 1.5px dashed var(--maude-hud-accent, oklch(0.53 0.175 238)); outline-offset: 0;
606
774
  }
607
- .dc-annot-chrome .dc-annot-ibtn:focus-visible {
608
- outline: 2px solid #ffffff;
609
- outline-offset: -2px;
775
+ .dc-annot-belongs-t {
776
+ position: absolute; left: 0; top: -24px; white-space: nowrap;
777
+ font: 500 12px/1.3 var(--font-ui, system-ui, sans-serif); padding: 2px 8px; border-radius: 999px;
778
+ color: var(--maude-hud-accent-fg, #fff); background: var(--maude-hud-accent, oklch(0.53 0.175 238));
610
779
  }
611
780
  @media (prefers-reduced-motion: reduce) {
612
- .dc-annot-chrome .dc-annot-ibtn, .dc-annot-chrome .dc-annot-sw, .dc-annot-chrome .dc-annot-fill { transition: none; }
613
- }
614
- .dc-annot-input {
615
- position: absolute;
616
- inset: 0;
617
- z-index: 4;
781
+ .dc-annot-ride-svg g.is-settling, .dc-annot-ride-svg g.is-leaving { transition-duration: 1ms; }
618
782
  }
619
783
  .dc-annot-svg {
620
784
  position: absolute;
@@ -636,8 +800,8 @@ const ANNOT_CSS = `
636
800
  /* Drag-select marquee — rendered while user is dragging to select strokes. */
637
801
  .dc-annot-marquee {
638
802
  pointer-events: none;
639
- fill: color-mix(in oklab, var(--maude-hud-accent, #d63b1f) 8%, transparent);
640
- stroke: var(--maude-hud-accent, #d63b1f);
803
+ fill: color-mix(in oklab, var(--maude-hud-accent, oklch(0.53 0.175 238)) 8%, transparent);
804
+ stroke: var(--maude-hud-accent, oklch(0.53 0.175 238));
641
805
  stroke-width: 1;
642
806
  stroke-dasharray: 4 3;
643
807
  }
@@ -660,6 +824,8 @@ const ANNOT_CSS = `
660
824
  beats use-tool-mode's blanket star-cursor rule (same fight as the editor +
661
825
  resize handles — DDR-067). */
662
826
  .dc-annot-conn-dot { cursor: crosshair !important; }
827
+ .dc-annot-conn-vis { opacity: 0; transition: opacity 80ms linear; }
828
+ .dc-annot-conn:hover .dc-annot-conn-vis { opacity: 1; }
663
829
  `.trim();
664
830
 
665
831
  function ensureAnnotStyles(): void {
@@ -667,7 +833,7 @@ function ensureAnnotStyles(): void {
667
833
  if (document.getElementById('dc-annot-css')) return;
668
834
  const s = document.createElement('style');
669
835
  s.id = 'dc-annot-css';
670
- s.textContent = `${ANNOT_CSS}\n${TEXT_LAYER_CSS}`;
836
+ s.textContent = `${ANNOT_CSS}\n${AI_MARKS_CSS}\n${LOD_CSS}\n${TEXT_LAYER_CSS}\n${TIME_PIN_CSS}`;
671
837
  document.head.appendChild(s);
672
838
  }
673
839
 
@@ -731,6 +897,11 @@ export interface StrokesStoreValue {
731
897
  previewStroke: (id: string, patch: Partial<Stroke>) => void;
732
898
  /** Wave H — single undo record from a preview gesture's start snapshot. */
733
899
  commitGesture: (before: readonly Stroke[], label?: string) => void;
900
+ /**
901
+ * S4.12 - run a sticky / section action by its registry id (`annotation.resolve`, `annotation.fan-out`,
902
+ * `annotation.fold`, `annotation.to-comment`) on the current selection. False when it does not apply.
903
+ */
904
+ runAction?: (id: string) => boolean;
734
905
  /** The host a dragged arrow endpoint would bind to (halo), or null. */
735
906
  setBindHint?: (hostId: string | null) => void;
736
907
  /** Live size label + dimension-match halos while resizing, or null. */
@@ -739,6 +910,14 @@ export interface StrokesStoreValue {
739
910
  ) => void;
740
911
  }
741
912
 
913
+ /** V2-5 A4 (S2.6) — the board's own document-capture chords (⌘G group, ⇧⌘L lock, ⌘D, ] [ order, ⌘C/⌘X,
914
+ * ⌘Enter) are Preview's: in Edit the same chords are the OBJECT's (editing/object-keys.ts), so this
915
+ * listener stands down there. A canvas that never got a `set-mode` (null) keeps v1's behaviour. */
916
+ export function boardChordsLive(win: Window): boolean {
917
+ const mode = canvasModeStore(win).get().mode;
918
+ return !mode || !modeShows(mode, 'object-tools');
919
+ }
920
+
742
921
  export const StrokesStoreContext = createContext<StrokesStoreValue | null>(null);
743
922
 
744
923
  export function useStrokesStore(): StrokesStoreValue | null {
@@ -754,7 +933,7 @@ export function useStrokesStore(): StrokesStoreValue | null {
754
933
  // the main tool palette, the in-canvas draw chrome, the minimap, and the
755
934
  // right-click menu. Clicks on these route to their own handlers.
756
935
  const CHROME_SELECTOR =
757
- '.dc-annot-conn-dot, .dc-annot-ctx, .dc-tool-palette, .dc-annot-chrome, .dc-mm, .dc-context-menu, .dc-tp-popover, .dc-multi-artboard-tb, .dc-elem-ctx-tb, .dc-cv-eq-spacing-layer, .cm-composer, .cm-thread, .cm-mention-popup, .cm-pin, .dc-annot-resize-handle, .dc-annot-rotate-zone, .dc-annot-editor, [data-group-resize-corner]';
936
+ '.dc-annot-conn-dot, .dc-annot-arrowui-live, .dc-annot-ctx, .dc-tool-palette, .dc-mm, .dc-context-menu, .dc-tp-popover, .dc-multi-artboard-tb, .dc-elem-ctx-tb, .dc-cv-eq-spacing-layer, .cm-composer, .cm-thread, .cm-mention-popup, .cm-pin, .dc-annot-resize-handle, .dc-annot-rotate-zone, .dc-annot-editor, [data-group-resize-corner]';
758
937
 
759
938
  const HINTS_KEY = 'maude-annot-hints-v1';
760
939
 
@@ -909,6 +1088,8 @@ export function AnnotationsLayer() {
909
1088
  countRender('annotationRenders');
910
1089
  ensureAnnotStyles();
911
1090
  const { tool, setTool, resetTool, sticky, tools, shapeKind } = useToolMode();
1091
+ const setToolRef = useRef(setTool);
1092
+ setToolRef.current = setTool;
912
1093
  const theme = useCanvasChromeTheme();
913
1094
  const controller = useViewportControllerContext();
914
1095
  const vp = controller?.viewport ?? null;
@@ -930,6 +1111,9 @@ export function AnnotationsLayer() {
930
1111
  const publishGesture = useCallback((g: AnnotationGesture | null) => {
931
1112
  collabRef.current?.publishAwareness({ annotationGesture: g });
932
1113
  }, []);
1114
+ // S4.12 - the layer's own routes into the shell (filled below, read by the message listener and the menu).
1115
+ const runAnnotationActionRef = useRef<(id: string) => boolean>(() => false);
1116
+ const askAiRef = useRef<() => void>(() => {});
933
1117
  const [gestureState, setGestureState] = useState('idle');
934
1118
  useEffect(() => {
935
1119
  if (typeof document === 'undefined') return;
@@ -966,6 +1150,66 @@ export function AnnotationsLayer() {
966
1150
  () => projectStrokes(board.scene(), strokeCacheRef.current),
967
1151
  [board, boardVersion]
968
1152
  );
1153
+ // S4.10 — ride with the artboard (contract S2-S4-artboard-motion-ids.md §1–§2). Drag frames
1154
+ // move the members on screen and re-route bound arrows through an imperative sink (never React
1155
+ // state per frame); the commit rider hands the bus ONE op batch in the move's undo group.
1156
+ const rideRef = useRef<RideController | null>(null);
1157
+ // S4.11 — artboards moved: an elbow arrow re-reads the layout to keep its route (rest-route.ts).
1158
+ const [layoutTick, setLayoutTick] = useState(0);
1159
+ const dragBus = useDragBusRide({
1160
+ frame: (f) => {
1161
+ rideRef.current?.onFrame(f);
1162
+ if (f.phase === 'end') setTimeout(() => setLayoutTick((t) => t + 1), 0);
1163
+ },
1164
+ rider: (moved) => {
1165
+ const els = [...board.committed.values()];
1166
+ const layout = dragBusRef.current?.layoutRects() ?? [];
1167
+ const needsEls = els.some(
1168
+ (e) =>
1169
+ e.type === 'arrow' &&
1170
+ [e.startHost, e.endHost].some(
1171
+ (h) =>
1172
+ !!h &&
1173
+ typeof (h as { ref?: unknown }).ref === 'string' &&
1174
+ (h as { ref: string }).ref.startsWith('el:')
1175
+ )
1176
+ );
1177
+ return riderOps(
1178
+ els,
1179
+ moved,
1180
+ hostBoxesAfter(layout, moved, needsEls ? canvasRectsNow() : null)
1181
+ );
1182
+ },
1183
+ });
1184
+ const dragBusRef = useRef(dragBus);
1185
+ dragBusRef.current = dragBus;
1186
+ useEffect(() => {
1187
+ if (!dragBus) return;
1188
+ const ctl = createRideController({
1189
+ elements: () => [...board.scene().byId.values()],
1190
+ layoutRects: () => dragBus.layoutRects(),
1191
+ elementRects: canvasRectsNow,
1192
+ labelOf: artboardLabel,
1193
+ router: createArrowRouter(),
1194
+ sink: createDomRideSink(
1195
+ () => worldRef?.current ?? null,
1196
+ prefersReducedMotion,
1197
+ () => getLiveViewport()?.zoom ?? 1
1198
+ ),
1199
+ // read at every frame: the theme can flip between two drags
1200
+ defaultInk: () => resolveDefaultInk(readChromeTheme()),
1201
+ schedule: (fn) => requestAnimationFrame(fn),
1202
+ });
1203
+ rideRef.current = ctl;
1204
+ return () => {
1205
+ ctl.dispose();
1206
+ if (rideRef.current === ctl) rideRef.current = null;
1207
+ };
1208
+ }, [dragBus, board, worldRef]);
1209
+ // biome-ignore lint/correctness/useExhaustiveDependencies: a new board version may be the committed move
1210
+ useEffect(() => {
1211
+ rideRef.current?.boardChanged();
1212
+ }, [boardVersion]);
969
1213
  // Images still uploading (a `blob:` href) — shown, never on the board.
970
1214
  const [uploading, setUploading] = useState<Stroke[]>([]);
971
1215
  // A gesture in flight (drag, resize): the strokes as the gesture shows them.
@@ -976,42 +1220,17 @@ export function AnnotationsLayer() {
976
1220
  [preview, uploading, boardStrokes]
977
1221
  );
978
1222
  const [drawing, setDrawing] = useState<Stroke | null>(null);
979
- // Theme-aware live default ink (items 3/5/6). Initialized from the current
980
- // theme; tracked-untouched until the user picks a swatch, after which it
981
- // sticks (colorTouchedRef). The themed-default effect lives below.
982
- const [color, setColorState] = useState<string>(() => resolveDefaultInk(theme));
983
- const colorTouchedRef = useRef(false);
984
- const setColor = useCallback((c: string) => {
985
- colorTouchedRef.current = true;
986
- setColorState(c);
987
- }, []);
988
- // While the user hasn't picked an ink swatch yet, follow the theme — so a
989
- // dark canvas arms a light-reading default and a light canvas a dark one.
990
- useEffect(() => {
991
- if (!colorTouchedRef.current) setColorState(resolveDefaultInk(theme));
992
- }, [theme]);
993
- // Shape default fill (item 2). A freshly-armed Shape tool gets a fill (not
994
- // outline-only); the index-paired tint of the active ink. Untouched until the
995
- // user picks a fill swatch (incl. "No fill"), after which it sticks.
996
- const [fill, setFillState] = useState<string | null>(null);
997
- const fillTouchedRef = useRef(false);
998
- const setFill = useCallback((f: string | null) => {
999
- fillTouchedRef.current = true;
1000
- setFillState(f);
1001
- }, []);
1002
- // While the Shape tool is armed and the fill is untouched, follow the ink
1003
- // (and theme) so a square/circle/diamond lands with a paired-tint wash. Once
1004
- // the user picks a fill swatch (or "No fill"), this stops.
1005
- useEffect(() => {
1006
- if (tool === 'shape' && !fillTouchedRef.current) setFillState(defaultFillFor(color, theme));
1007
- }, [tool, color, theme]);
1008
- const [thickness, setThickness] = useState<Thickness>(STROKE_WIDTH_THIN);
1009
- // Phase 21 — draw-time paper tint for the sticky tool (recolor-after via the
1010
- // context toolbar). Separate from `color` (ink for pen/rect/text/arrow).
1011
- const [stickyColor, setStickyColor] = useState<string>(DEFAULT_STICKY_COLOR);
1012
- // Annotation polish (item 8) — draw-time highlighter marker hue + nib width.
1013
- const [highlighterColor, setHighlighterColor] = useState<string>(DEFAULT_HIGHLIGHTER_COLOR);
1014
- const [highlighterWidth, setHighlighterWidth] = useState<number>(DEFAULT_HIGHLIGHTER_WIDTH);
1223
+ // S4.8 — colour, ink, thickness, Marker tip and the Highlighter's hue / nib are the tool state
1224
+ // (annotations/ui/tool-state.ts): the toolbar's popovers set them, and they are the person's own,
1225
+ // remembered across reloads. The default ink (the palette's black) renders themed so it reads on
1226
+ // a dark canvas; every other ink is the hex picked.
1227
+ const toolSnap = useToolState();
1228
+ const { thickness, stickyColor, highlighterColor, highlighterWidth } = toolSnap;
1229
+ const color = resolveInk(toolSnap.ink, resolveDefaultInk(theme));
1230
+ // Shape default fill (item 2). A freshly-armed Shape gets a fill (not outline-only): the
1231
+ // index-paired tint of the active ink. Fill and stroke are picked apart afterwards, on the small
1232
+ // toolbar above the selection (annotations-context-toolbar.tsx) — the draw-time tray is retired.
1233
+ const fill: string | null = tool === 'shape' ? defaultFillFor(color, theme) : null;
1015
1234
  // Phase 21 — a standalone-text caret waiting for its first keystroke. No
1016
1235
  // stroke exists yet (mirrors anchored text: the stroke is born on commit,
1017
1236
  // so an abandoned empty caret leaves nothing behind / no undo record).
@@ -1020,10 +1239,36 @@ export function AnnotationsLayer() {
1020
1239
  // shape/sticky/text tool is armed and nothing is being drawn yet. Pure chrome
1021
1240
  // (low-opacity, pointer-events:none) — never selectable, hit-tested, or saved.
1022
1241
  const [ghost, setGhost] = useState<{ x: number; y: number } | null>(null);
1242
+ // S4.13 - a gallery pick, a stamp or a template that trails the pointer until a click (placement.tsx).
1243
+ const [placing, setPlacing] = useState<Pending | null>(null);
1244
+ // S4.V4 G4 - while a pick is armed the pointer pipeline stands down (the ghost's click places it).
1245
+ const placingRef = useRef(false);
1246
+ placingRef.current = placing !== null;
1247
+ pipeline.holdOff = () => placingRef.current;
1248
+ // S4.19 G5 (canvas 15 `an-layers`) - a drag begun on a locked annotation says why nothing moves.
1249
+ const [lockedTip, setLockedTip] = useState<{ x: number; y: number } | null>(null);
1250
+ const clearLockedTip = useCallback(() => setLockedTip(null), []);
1251
+ // r1 item 14 - a press in Edit on a quiet annotation says where it moves (Preview), at the pointer.
1252
+ const [quietTip, setQuietTip] = useState<{ x: number; y: number } | null>(null);
1253
+ const clearQuietTip = useCallback(() => setQuietTip(null), []);
1023
1254
  // FigJam v3 — smart-guide lines painted while a drag is snapping, and the
1024
1255
  // id of the host a dragged arrow endpoint would bind to (accent halo).
1025
1256
  const [snapGuides, setSnapGuides] = useState<SnapGuide[] | null>(null);
1026
1257
  const [bindHintId, setBindHintId] = useState<string | null>(null);
1258
+ // S4.11 — aiming an arrow at an artboard edge / a canvas element (an-arrow-bind): the candidate
1259
+ // under the pointer and the outlines around it. The `canvas-rects` snapshot is taken when the
1260
+ // aim starts (never per move) and dropped when it ends.
1261
+ const [aim, setAim] = useState<AimState | null>(null);
1262
+ const aimRef = useRef<AimState | null>(null);
1263
+ const aimRectsRef = useRef<AimRects | null>(null);
1264
+ // An unstamped target is being named (Q12): the drawn arrow waits for its bind, and the pointer
1265
+ // is not a draw in the meantime.
1266
+ const finishingRef = useRef(false);
1267
+ const [boundTag, setBoundTag] = useState<{ text: string; at: [number, number] } | null>(null);
1268
+ // Point to… (an-dangling): the arrow end being re-aimed; the next click on a target binds it.
1269
+ const [pointTo, setPointTo] = useState<{ arrowId: string; end: 'start' | 'end' } | null>(null);
1270
+ // Double-click an arrow: the id whose words are being written (an-arrow-kinds 3).
1271
+ const [labelEdit, setLabelEdit] = useState<string | null>(null);
1027
1272
  // FigJam v3 — live size label + dimension-match halos while resizing (the
1028
1273
  // resize overlay sets it through the strokes store; the SVG layer paints).
1029
1274
  const [resizeInfo, setResizeInfo] = useState<{
@@ -1055,7 +1300,23 @@ export function AnnotationsLayer() {
1055
1300
  // Presentation Mode hides annotations without mutating the user's own
1056
1301
  // visibility toggle — render/input gate folds `present` in, the stored value
1057
1302
  // (visibilityCtx.visible) is left untouched so exiting restores it.
1058
- const visible = (visibilityCtx?.visible ?? true) && !(chrome?.present ?? false);
1303
+ const mode = useGovernedMode();
1304
+ // S4.16 (an-viewer) - a person who may not annotate sees everyone's notes and cannot change them, in any mode.
1305
+ const posture = annotationPosture(
1306
+ mode,
1307
+ visibilityCtx?.visible ?? true,
1308
+ chrome?.present ?? false,
1309
+ typeof window === 'undefined' ? null : canvasModeStore(window).get().caps
1310
+ );
1311
+ const visible = posture !== 'hidden';
1312
+ const quiet = posture === 'quiet';
1313
+ // S4.9 - what the list and the ⌘K rows ask the layer to leave out of view (a view, never a delete).
1314
+ const [authorFilter, setAuthorFilter] = useState<readonly string[]>([]);
1315
+ const [hideResolved, setHideResolved] = useState(false);
1316
+ // ⇧⌘A pressed in Edit: the layer asks the shell for Preview and selects once it has landed.
1317
+ const selectAllPending = useRef(false);
1318
+ const visiblePrefRef = useRef(true);
1319
+ visiblePrefRef.current = visibilityCtx?.visible ?? true;
1059
1320
  const setVisible = useCallback(
1060
1321
  (next: boolean | ((cur: boolean) => boolean)) => {
1061
1322
  if (!visibilityCtx) return;
@@ -1161,11 +1422,12 @@ export function AnnotationsLayer() {
1161
1422
  tool === 'arrow' ||
1162
1423
  tool === 'sticky' ||
1163
1424
  tool === 'section' ||
1164
- tool === 'text';
1425
+ tool === 'text' ||
1426
+ tool === 'el-text'; // S2.12b — click to type owns the pointer, draws nothing
1165
1427
  const isErase = tool === 'eraser';
1166
1428
  const isActive = isDraw || isErase;
1167
1429
  // T20 / Phase 24 — every shape primitive carries stroke weight (FigJam ships
1168
- // thickness on all of them). The annotation toolbar reads supportsThickness
1430
+ // thickness on all of them). The Marker popover owns the thickness; supportsThickness
1169
1431
  // to decide whether to render the Thin / Thick chips.
1170
1432
  const supportsThickness = tool === 'pen' || tool === 'arrow' || tool === 'shape';
1171
1433
  const supportsFill = tool === 'shape';
@@ -1200,7 +1462,8 @@ export function AnnotationsLayer() {
1200
1462
  void fetch(`/_api/annotations?file=${encodeURIComponent(file)}`, {
1201
1463
  headers: { Accept: 'application/json' },
1202
1464
  })
1203
- .then((r) => (r.ok ? r.text() : ''))
1465
+ // A refused read is still read to its end (an unread body keeps the request open — gate-b-c4f).
1466
+ .then((r) => r.text().then((text) => (r.ok ? text : '')))
1204
1467
  .then((text) => {
1205
1468
  if (cancelled || annotationsChangedRef.current) return;
1206
1469
  board.setAll(parseBoard(text).elements);
@@ -1252,64 +1515,69 @@ export function AnnotationsLayer() {
1252
1515
  * batch before it. `local` marks a batch already applied to the store: it
1253
1516
  * stays pending (re-applied over replica snapshots) until its echo arrives.
1254
1517
  */
1255
- const sendOps = useCallback((ops: readonly AnnotationOp[], local = false): Promise<void> => {
1256
- const file = fileRef.current;
1257
- if (!file || !ops.length) return putChainRef.current;
1258
- const actionId = crypto.randomUUID();
1259
- const pending = pendingRef.current;
1260
- if (local) {
1261
- pending.push({ actionId, ops });
1262
- if (pending.length > 64) pending.splice(0, pending.length - 64);
1263
- }
1264
- const settle = () => {
1265
- const i = pending.findIndex((p) => p.actionId === actionId);
1266
- if (i >= 0) pending.splice(i, 1);
1267
- };
1268
- const dispatch = () =>
1269
- fetch('/_api/annotations/ops', {
1270
- method: 'POST',
1271
- headers: { 'Content-Type': 'application/json' },
1272
- body: JSON.stringify({ file, actionId, ops }),
1273
- })
1274
- .then(async (r) => {
1275
- // A refused save (403 read-only, 405 at a proxy door) previously
1276
- // dissolved without a trace — the user kept drawing on state that
1277
- // never reached disk, a peer, or a reload (the cloud canvas-writes
1278
- // RCA). Optimistic local state is still the right UX; a persistence
1279
- // failure being INVISIBLE is not.
1280
- if (!r.ok) {
1281
- settle();
1282
- console.warn(`[annotations] save refused (${r.status}) — strokes are local-only`);
1283
- return undefined;
1284
- }
1285
- const res = (await r.json().catch(() => null)) as {
1286
- rejected?: Array<{ id?: string; reason: string }>;
1287
- } | null;
1288
- if (res?.rejected?.length) {
1289
- console.warn('[annotations] some changes were not applied', res.rejected);
1290
- }
1291
- // Without a replica no echo will come; with one, the echo settles
1292
- // it — unless the board had nothing to change (no echo either).
1293
- if (!collabRef.current || res?.rejected?.length) settle();
1294
- else setTimeout(settle, 10_000);
1295
- return undefined;
1518
+ const sendOps = useCallback(
1519
+ (ops: readonly AnnotationOp[], local = false, draft = false, sid?: string): Promise<void> => {
1520
+ const file = fileRef.current;
1521
+ if (!file || !ops.length) return putChainRef.current;
1522
+ // p8-fix-d F13 — a draft's id says so: the home records it with the session's commit, one step.
1523
+ // p8-hub-drafts — and every write of a text session names it (a hub's ⌘Z stack folds them).
1524
+ const actionId = draft ? draftWriteId(sid) : sid ? sessionWriteId(sid) : crypto.randomUUID();
1525
+ const pending = pendingRef.current;
1526
+ if (local) {
1527
+ pending.push({ actionId, ops });
1528
+ if (pending.length > 64) pending.splice(0, pending.length - 64);
1529
+ }
1530
+ const settle = () => {
1531
+ const i = pending.findIndex((p) => p.actionId === actionId);
1532
+ if (i >= 0) pending.splice(i, 1);
1533
+ };
1534
+ const dispatch = () =>
1535
+ fetch('/_api/annotations/ops', {
1536
+ method: 'POST',
1537
+ headers: { 'Content-Type': 'application/json' },
1538
+ body: JSON.stringify({ file, actionId, ops }),
1296
1539
  })
1297
- .catch(() => {
1298
- settle();
1299
- /* Pending persistence UX is handled by the project outbox work. */
1300
- });
1301
- const chained = putChainRef.current.then(dispatch, dispatch);
1302
- putChainRef.current = chained;
1303
- return chained;
1304
- }, []);
1540
+ .then(async (r) => {
1541
+ // A refused save (403 read-only, 405 at a proxy door) previously
1542
+ // dissolved without a trace — the user kept drawing on state that
1543
+ // never reached disk, a peer, or a reload (the cloud canvas-writes
1544
+ // RCA). Optimistic local state is still the right UX; a persistence
1545
+ // failure being INVISIBLE is not.
1546
+ if (!r.ok) {
1547
+ settle();
1548
+ console.warn(`[annotations] save refused (${r.status}) — strokes are local-only`);
1549
+ return undefined;
1550
+ }
1551
+ const res = (await r.json().catch(() => null)) as {
1552
+ rejected?: Array<{ id?: string; reason: string }>;
1553
+ } | null;
1554
+ if (res?.rejected?.length) {
1555
+ console.warn('[annotations] some changes were not applied', res.rejected);
1556
+ }
1557
+ // Without a replica no echo will come; with one, the echo settles
1558
+ // it — unless the board had nothing to change (no echo either).
1559
+ if (!collabRef.current || res?.rejected?.length) settle();
1560
+ else setTimeout(settle, 10_000);
1561
+ return undefined;
1562
+ })
1563
+ .catch(() => {
1564
+ settle();
1565
+ /* Pending persistence UX is handled by the project outbox work. */
1566
+ });
1567
+ const chained = putChainRef.current.then(dispatch, dispatch);
1568
+ putChainRef.current = chained;
1569
+ return chained;
1570
+ },
1571
+ []
1572
+ );
1305
1573
 
1306
1574
  /** Apply a batch here (optimistic) and send it. Returns what undoes it. */
1307
1575
  const applyOpsLocal = useCallback(
1308
- (ops: readonly AnnotationOp[]): AnnotationOp[] => {
1576
+ (ops: readonly AnnotationOp[], sid?: string): AnnotationOp[] => {
1309
1577
  if (!ops.length) return [];
1310
1578
  annotationsChangedRef.current = true;
1311
1579
  const r = board.apply(ops);
1312
- void sendOps(ops, true);
1580
+ void sendOps(ops, true, false, sid);
1313
1581
  return r.inverse;
1314
1582
  },
1315
1583
  [board, sendOps]
@@ -1355,7 +1623,16 @@ export function AnnotationsLayer() {
1355
1623
  list.some(isEphemeralHref) ? list.filter((s) => !isEphemeralHref(s)) : list;
1356
1624
  const committed = board.committed;
1357
1625
  const prevMap = strokesToElementMap(persist(prev), committed);
1358
- const nextMap = strokesToElementMap(persist(next), committed);
1626
+ // S4.10 — what this commit created or dropped joins the artboard under its centre (Q3).
1627
+ const nextMap = withTimePins(
1628
+ prevMap, // S4.16 — a new sticky over a video is pinned to the playhead (annotations/time-marks.ts)
1629
+ withMembership(
1630
+ prevMap,
1631
+ strokesToElementMap(persist(next), committed),
1632
+ dragBusRef.current?.layoutRects() ?? []
1633
+ ),
1634
+ playheadOf
1635
+ );
1359
1636
  // #137 — the lock safety net: whatever tool produced this commit, a
1360
1637
  // locked element (as of `prevMap`) is not moved, resized, re-texted or
1361
1638
  // deleted. The board re-renders from the store, so a blocked change
@@ -1368,7 +1645,7 @@ export function AnnotationsLayer() {
1368
1645
  if (session) {
1369
1646
  commitSessionRef.current = null;
1370
1647
  sessionCommittedRef.current = true;
1371
- applyOpsLocal(aimCommitOps(ops, session));
1648
+ applyOpsLocal(aimCommitOps(ops, session), session.sid);
1372
1649
  const baseMap = strokesToElementMap(persist(withSlotText(prev, session)), committed);
1373
1650
  const redo = guardLockedOps(baseMap, diffToOps(baseMap, nextMap)).ops;
1374
1651
  if (!redo.length) return;
@@ -1586,6 +1863,7 @@ export function AnnotationsLayer() {
1586
1863
  distributeSelection,
1587
1864
  previewStroke,
1588
1865
  commitGesture,
1866
+ runAction: (id: string) => runAnnotationActionRef.current(id),
1589
1867
  };
1590
1868
  }, [strokes, setStrokes, commitStrokes, rememberDeletedIds]);
1591
1869
 
@@ -1682,9 +1960,65 @@ export function AnnotationsLayer() {
1682
1960
  [commitStrokes, annotSel]
1683
1961
  );
1684
1962
 
1963
+ // S4.9 - tell the shell the board changed (a local write, a peer's, an undo) so the Preview annotation list
1964
+ // re-reads it. Trailing, so a drag's burst of versions is one message. The first version is a load, not a change.
1965
+ const announcedVersion = useRef(boardVersion);
1966
+ // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the board version
1967
+ useEffect(() => {
1968
+ if (announcedVersion.current === boardVersion) return;
1969
+ announcedVersion.current = boardVersion;
1970
+ const file = fileRef.current;
1971
+ if (!file || typeof window === 'undefined' || window.parent === window) return;
1972
+ const t = window.setTimeout(() => {
1973
+ try {
1974
+ window.parent.postMessage({ dgn: 'annotations-changed', file }, '*');
1975
+ } catch {
1976
+ /* detached */
1977
+ }
1978
+ }, 120);
1979
+ return () => window.clearTimeout(t);
1980
+ }, [boardVersion]);
1981
+ // S4.9 - Edit shows the layer quiet, and a quiet layer holds no selection: a chord (⇧⌘L, ⌘G, ] [ ...) can
1982
+ // never land on a sticky the user cannot see as selectable.
1983
+ useEffect(() => {
1984
+ if (posture === 'quiet' && annotSel && annotSel.selectedIds.length > 0) annotSel.clear();
1985
+ }, [posture, annotSel]);
1986
+ // ⇧⌘A from Edit: Preview has landed, select them all (the bar says "N annotations").
1987
+ useEffect(() => {
1988
+ if (posture !== 'drawn' || !selectAllPending.current || !annotSel) return;
1989
+ selectAllPending.current = false;
1990
+ annotSel.replace(strokesRef.current.map((s) => s.id));
1991
+ }, [posture, annotSel]);
1992
+
1993
+ // S4.9 - annotations are Preview's to change: in Edit the layer asks for Preview first and selects them
1994
+ // once it has landed (the effect above). One routine for the shell's run-action and the canvas's own
1995
+ // ⇧⌘A (S4.18: the key pressed inside the canvas never reached it).
1996
+ const selectAllAnnotationsRef = useRef<() => void>(() => {});
1997
+ selectAllAnnotationsRef.current = () => {
1998
+ const governed = canvasModeStore(window).get().mode;
1999
+ if (governed && !modeShows(governed, 'annotations-editable')) {
2000
+ selectAllPending.current = true;
2001
+ postModeRequest({ mode: 'preview', cause: 'key' });
2002
+ window.setTimeout(() => {
2003
+ selectAllPending.current = false;
2004
+ }, 2000);
2005
+ return;
2006
+ }
2007
+ if (annotSel) annotSel.replace(strokesRef.current.map((s) => s.id));
2008
+ };
2009
+ useCanvasKeys(
2010
+ {
2011
+ 'select.all-annotations': (e) => {
2012
+ e.preventDefault();
2013
+ selectAllAnnotationsRef.current();
2014
+ },
2015
+ },
2016
+ { target: 'document', capture: true }
2017
+ );
2018
+
1685
2019
  // Menubar bridge (Phase 5.1 Task 10) — listen for postMessages from the
1686
- // dev-server shell. `selection-clear` + `tool-set` live in canvas-shell
1687
- // (those providers are above us); we own visibility + annotation-select-all
2020
+ // dev-server shell. `run-action` select.none + `tool-set` live in canvas-shell
2021
+ // (those providers are above us); we own visibility + select.all-annotations
1688
2022
  // because they read this layer's local state.
1689
2023
  useEffect(() => {
1690
2024
  if (typeof window === 'undefined') return;
@@ -1692,12 +2026,84 @@ export function AnnotationsLayer() {
1692
2026
  if (e.source !== window.parent) return;
1693
2027
  const m = e.data as { dgn?: string; visible?: boolean } | null;
1694
2028
  if (!m || typeof m !== 'object' || !m.dgn) return;
2029
+ // r4 #2 — an Assets tile over the canvas: where it is (the shell sends the drop point before an
2030
+ // `insert-annotation-media` in Preview), so the picture lands where it was dropped
2031
+ if (m.dgn === 'asset-drag-over') {
2032
+ const { x, y } = m as { x?: unknown; y?: unknown };
2033
+ ASSET_DROP_POINT.see(
2034
+ typeof x === 'number' && typeof y === 'number' && Number.isFinite(x) && Number.isFinite(y)
2035
+ ? { x, y }
2036
+ : null,
2037
+ Date.now()
2038
+ );
2039
+ return;
2040
+ }
1695
2041
  if (m.dgn === 'view-annotations') {
1696
2042
  if (typeof m.visible === 'boolean') setVisible(m.visible);
1697
2043
  return;
1698
2044
  }
1699
- if (m.dgn === 'annotation-select-all') {
1700
- if (annotSel) annotSel.replace(strokes.map((s) => s.id));
2045
+ // S4.9 - the Preview annotation list (client/v2/annotations/annotation-list.jsx) selects and filters.
2046
+ if (m.dgn === 'annotation-filter') {
2047
+ const a = (m as { v?: unknown; authors?: unknown }).authors;
2048
+ if ((m as { v?: unknown }).v !== 1 || !Array.isArray(a)) return;
2049
+ setAuthorFilter(
2050
+ a.filter((x): x is string => typeof x === 'string' && x.length <= 200).slice(0, 64)
2051
+ );
2052
+ return;
2053
+ }
2054
+ if (m.dgn === 'annotation-select') {
2055
+ const ids = (m as { v?: unknown; ids?: unknown }).ids;
2056
+ if ((m as { v?: unknown }).v !== 1 || !Array.isArray(ids) || !annotSel) return;
2057
+ annotSel.replace(
2058
+ knownIds(
2059
+ ids.filter((x): x is string => typeof x === 'string').slice(0, 5000),
2060
+ strokesRef.current
2061
+ )
2062
+ );
2063
+ return;
2064
+ }
2065
+ if (
2066
+ m.dgn === 'run-action' &&
2067
+ (m as { v?: unknown; id?: unknown }).v === 1 &&
2068
+ (m as { id?: unknown }).id === 'annotations.hide-resolved'
2069
+ ) {
2070
+ setHideResolved((h) => !h);
2071
+ return;
2072
+ }
2073
+ // S4.11 — Point to… (an-dangling): re-aim the selected arrow's lost end (else its end).
2074
+ if (
2075
+ m.dgn === 'run-action' &&
2076
+ (m as { v?: unknown; id?: unknown }).v === 1 &&
2077
+ (m as { id?: unknown }).id === 'annotation.point-to'
2078
+ ) {
2079
+ const sel = annotSel?.selectedIds ?? [];
2080
+ const arrow = strokesRef.current.find((s) => s.tool === 'arrow' && sel.includes(s.id));
2081
+ if (arrow) {
2082
+ const lost = danglingRef.current.find((d) => d.arrowId === arrow.id);
2083
+ setPointTo({ arrowId: arrow.id, end: lost?.end ?? 'end' });
2084
+ }
2085
+ return;
2086
+ }
2087
+ // S4.12 - Resolve, Fan out, Fold, Turn into a comment, Ask AI about it and the ⌘K clean-up of resolved
2088
+ // stickies ride the same lane (registry rows in actions/defs/annotation.ts).
2089
+ if (
2090
+ m.dgn === 'run-action' &&
2091
+ (m as { v?: unknown }).v === 1 &&
2092
+ typeof (m as { id?: unknown }).id === 'string' &&
2093
+ STICKY_RUN_ACTIONS.has((m as { id: string }).id)
2094
+ ) {
2095
+ const rid = (m as { id: string }).id;
2096
+ if (rid === 'annotation.ask-ai') askAiRef.current();
2097
+ else runAnnotationActionRef.current(rid);
2098
+ return;
2099
+ }
2100
+ // V2-2.4 — Select all annotations rides the `run-action` lane (V2-1.3 §5.7).
2101
+ if (
2102
+ m.dgn === 'run-action' &&
2103
+ (m as { v?: unknown; id?: unknown }).v === 1 &&
2104
+ (m as { id?: unknown }).id === 'select.all-annotations'
2105
+ ) {
2106
+ selectAllAnnotationsRef.current();
1701
2107
  return;
1702
2108
  }
1703
2109
  // Stage F3 — the shell's AssetPicker (main-origin, DDR-054) resolved a new
@@ -1716,10 +2122,12 @@ export function AnnotationsLayer() {
1716
2122
  const before = strokesRef.current;
1717
2123
  const target = before.find((s) => s.id === id);
1718
2124
  if (!target || (target.tool !== 'image' && target.tool !== 'mediaref')) return;
2125
+ // S4.13 - Replace… on a gallery sticker names the new one; any other pick clears the sticker identity.
2126
+ const ref = stickerRefOf((m as { sticker?: unknown }).sticker);
1719
2127
  const after = before.map((s) => {
1720
2128
  if (s.id !== id) return s;
1721
2129
  return target.tool === 'image'
1722
- ? ({ ...s, href: path } as ImageStroke)
2130
+ ? ({ ...s, ...replacePatch(target, { path, sticker: ref }) } as ImageStroke)
1723
2131
  : ({ ...s, src: path } as MediaRefStroke);
1724
2132
  });
1725
2133
  commitStrokes(before, after, 'replace media');
@@ -1734,28 +2142,31 @@ export function AnnotationsLayer() {
1734
2142
  // cursor position to reuse. Inlines the screenToWorld formula (that
1735
2143
  // callback isn't declared until below this effect) against vpRef, which
1736
2144
  // is.
1737
- if (m.dgn === 'insert-sticker' && typeof (m as { path?: unknown }).path === 'string') {
1738
- const path = (m as { path: string }).path;
1739
- const v = vpRef.current ?? { x: 0, y: 0, zoom: 1 };
1740
- const z = v.zoom || 1;
2145
+ // S4.13 - a gallery pick / stamp / template trails the pointer until a click (`follow`), and a stamp stays
2146
+ // armed; without `follow` a sticker or template lands mid-view at once, as before. One Pending, three kinds.
2147
+ // r4 #17 - the Blank section tile is "draw it, name it": it arms the Section tool (a drag sizes it, a tap
2148
+ // is the default) instead of dropping a default-sized ghost.
2149
+ if (m.dgn === 'insert-template') {
2150
+ const armTool = toolForTemplate((m as { id?: unknown }).id);
2151
+ if (armTool) {
2152
+ setToolRef.current(armTool);
2153
+ return;
2154
+ }
2155
+ }
2156
+ const placement =
2157
+ m.dgn === 'insert-sticker' || m.dgn === 'insert-template' ? placementOf(m) : null;
2158
+ if (placement) {
2159
+ if (placement.kind === 'sticker' && placement.preview)
2160
+ rememberStickerPreview(placement.path, placement.preview);
2161
+ const armed =
2162
+ placement.kind === 'stamp' || ('follow' in placement && placement.follow === true);
2163
+ if (armed) {
2164
+ setPlacing(placement);
2165
+ return;
2166
+ }
1741
2167
  const cx = typeof window !== 'undefined' ? window.innerWidth / 2 : 0;
1742
2168
  const cy = typeof window !== 'undefined' ? window.innerHeight / 2 : 0;
1743
- const wx = (cx - v.x) / z;
1744
- const wy = (cy - v.y) / z;
1745
- const size = STICKER_DROP_SIZE;
1746
- const id = rid();
1747
- const stroke: ImageStroke = {
1748
- id,
1749
- tool: 'image',
1750
- x: wx - size / 2,
1751
- y: wy - size / 2,
1752
- w: size,
1753
- h: size,
1754
- href: path,
1755
- };
1756
- const before = strokesRef.current;
1757
- commitStrokes(before, [...before, stroke], 'add sticker');
1758
- annotSel?.replace([id]);
2169
+ placeRef.current(placement, { x: cx, y: cy });
1759
2170
  }
1760
2171
  // feature-bulk-media-insert Task 11 — the shell's AssetPicker (main-
1761
2172
  // origin) multi-select "Add as annotation" confirm. Every path is
@@ -1769,8 +2180,10 @@ export function AnnotationsLayer() {
1769
2180
  if (paths.length) {
1770
2181
  const v = vpRef.current ?? { x: 0, y: 0, zoom: 1 };
1771
2182
  const z = v.zoom || 1;
1772
- const cx = typeof window !== 'undefined' ? window.innerWidth / 2 : 0;
1773
- const cy = typeof window !== 'undefined' ? window.innerHeight / 2 : 0;
2183
+ // r4 #2 — a tile dropped in Preview: at the drop point the shell just sent, else mid-view
2184
+ const at = ASSET_DROP_POINT.take(Date.now());
2185
+ const cx = at ? at.x : typeof window !== 'undefined' ? window.innerWidth / 2 : 0;
2186
+ const cy = at ? at.y : typeof window !== 'undefined' ? window.innerHeight / 2 : 0;
1774
2187
  const wx = (cx - v.x) / z;
1775
2188
  const wy = (cy - v.y) / z;
1776
2189
  createMediaFromAssetPaths(paths, [wx, wy]);
@@ -1789,8 +2202,14 @@ export function AnnotationsLayer() {
1789
2202
  const onKey = (e: KeyboardEvent) => {
1790
2203
  if (isEditable(e.target)) return;
1791
2204
  if (e.key === 'P' && e.shiftKey && !e.metaKey && !e.ctrlKey && !e.altKey) {
2205
+ // V2-4 gate (WCAG 2.1.4): ⇧P is a character key — off with the "Single-key shortcuts" switch.
2206
+ if (!canvasSingleKeys()) return;
1792
2207
  e.preventDefault();
1793
- setVisible((v) => !v);
2208
+ const next = !visiblePrefRef.current;
2209
+ setVisible(next);
2210
+ // S4.18 (an-visibility) - the shell keeps the pref and owns the "Annotations hidden" toast
2211
+ // (decision v2-S4.9-shell-owns-hidden-toast): tell it what ⇧P did here.
2212
+ reportAnnotationsVisibility(window, next);
1794
2213
  }
1795
2214
  };
1796
2215
  document.addEventListener('keydown', onKey, true);
@@ -1808,6 +2227,60 @@ export function AnnotationsLayer() {
1808
2227
  [vp]
1809
2228
  );
1810
2229
 
2230
+ // r1 item 14 - Edit keeps the layer quiet (S4.9: clicks reach the design), so a picture dropped on bare canvas
2231
+ // could be neither clicked nor dragged, with no word why. A press there, over a quiet annotation, shows the tip.
2232
+ // Passive: the press still goes where it went.
2233
+ useEffect(() => {
2234
+ if (!quiet || !visible || typeof document === 'undefined') return undefined;
2235
+ const down = (e: PointerEvent) => {
2236
+ if (e.button !== 0) return;
2237
+ const [wx, wy] = screenToWorld(e.clientX, e.clientY);
2238
+ const tol = 4 / (vpRef.current?.zoom || 1);
2239
+ const target = e.target instanceof Element ? e.target : null;
2240
+ if (quietStrokeAt(strokesRef.current, wx, wy, tol, target))
2241
+ setQuietTip({ x: e.clientX, y: e.clientY });
2242
+ };
2243
+ document.addEventListener('pointerdown', down, true);
2244
+ return () => document.removeEventListener('pointerdown', down, true);
2245
+ }, [quiet, visible, screenToWorld]);
2246
+
2247
+ // S4.13 - what a click (or a mid-view drop) makes of a pick. Kept in a ref so the message effect above, which
2248
+ // is declared first, calls the latest closure. Returns true when the pick is spent (a stamp stays armed).
2249
+ const placeRef = useRef<(p: Pending, client: { x: number; y: number }) => boolean>(() => true);
2250
+ placeRef.current = (p, client) => {
2251
+ const [wx, wy] = screenToWorld(client.x, client.y);
2252
+ const before = strokesRef.current;
2253
+ const name = collab?.myName ?? '';
2254
+ if (p.kind === 'sticker') {
2255
+ const stroke = dropSticker(
2256
+ p,
2257
+ { x: wx, y: wy },
2258
+ rid(),
2259
+ name ? { name, id: collab?.myConnId } : undefined
2260
+ );
2261
+ commitStrokes(before, [...before, stroke], 'add sticker');
2262
+ annotSel?.replace([stroke.id]);
2263
+ return true;
2264
+ }
2265
+ if (p.kind === 'stamp') {
2266
+ const target = stampTargetAt({ x: wx, y: wy }, before, canvasRectsNow()?.artboards ?? []);
2267
+ const el = stampElement({
2268
+ kind: p.stampKind,
2269
+ who: { name: name || 'Someone' },
2270
+ target,
2271
+ x: wx,
2272
+ y: wy,
2273
+ });
2274
+ commitStrokes(before, upsertStampStroke(before, el), 'add stamp');
2275
+ return false;
2276
+ }
2277
+ const placed = expandTemplate(p.id, { x: wx, y: wy }, name || null);
2278
+ if (!placed) return true;
2279
+ commitStrokes(before, [...before, ...placed.strokes], `add ${p.id} template`);
2280
+ annotSel?.replace(placed.selectIds);
2281
+ return true;
2282
+ };
2283
+
1811
2284
  // ── Phase 23 — media intake (drag-drop / paste / file-picker / link input) ──
1812
2285
  // Image: optimistic blob: preview stroke (LOCAL only — never persisted) →
1813
2286
  // POST /_api/asset → swap href to assets/… and commit (one undo record) →
@@ -1976,18 +2449,15 @@ export function AnnotationsLayer() {
1976
2449
  const tol = 8 / zoom;
1977
2450
  const prev = strokesRef.current;
1978
2451
  const locked = lockedStrokeIds(prev); // #137 — the eraser passes over a locked element
1979
- for (let i = prev.length - 1; i >= 0; i--) {
1980
- const candidate = prev[i];
1981
- if (candidate && !locked.has(candidate.id) && strokeHitTest(candidate, wx, wy, tol)) {
1982
- const removedId = candidate.id;
1983
- const next = prev
1984
- .slice(0, i)
1985
- .concat(prev.slice(i + 1))
1986
- .filter((s) => !(s.tool === 'text' && s.anchorId === removedId));
1987
- commitStrokes(prev, next, 'erase 1 stroke');
1988
- return;
1989
- }
1990
- }
2452
+ // S4.8 — it rubs out Marker strokes only: never a sticky, a shape, a section or text.
2453
+ const i = eraseTargetIndex(prev, locked, wx, wy, tol);
2454
+ if (i < 0) return;
2455
+ const removedId = (prev[i] as Stroke).id;
2456
+ const next = prev
2457
+ .slice(0, i)
2458
+ .concat(prev.slice(i + 1))
2459
+ .filter((s) => !(s.tool === 'text' && s.anchorId === removedId));
2460
+ commitStrokes(prev, next, 'erase 1 stroke');
1991
2461
  },
1992
2462
  [vp, commitStrokes]
1993
2463
  );
@@ -1998,6 +2468,8 @@ export function AnnotationsLayer() {
1998
2468
  if (e.button !== 0) return false;
1999
2469
  if (spaceHeld) return false;
2000
2470
  if (e.metaKey || e.ctrlKey) return false;
2471
+ if (finishingRef.current) return true;
2472
+ if (tool === 'arrow') aimRectsRef.current = canvasRectsNow() as AimRects | null;
2001
2473
  // We do NOT stopPropagation — viewport-controller listens on the host
2002
2474
  // ancestor and never claims a bare-left/no-space pointerdown anyway.
2003
2475
  e.preventDefault();
@@ -2076,6 +2548,7 @@ export function AnnotationsLayer() {
2076
2548
  });
2077
2549
  }
2078
2550
  } else if (tool === 'arrow') {
2551
+ // S4.11 (an-arrow-kinds): a new arrow is Curved with a filled head.
2079
2552
  setDrawing({
2080
2553
  id,
2081
2554
  tool: 'arrow',
@@ -2085,6 +2558,7 @@ export function AnnotationsLayer() {
2085
2558
  y1: wy,
2086
2559
  x2: wx,
2087
2560
  y2: wy,
2561
+ ...NEW_ARROW,
2088
2562
  });
2089
2563
  } else if (tool === 'sticky') {
2090
2564
  // Phase 21 — drag-create a paper card. Default size if the user just
@@ -2103,6 +2577,7 @@ export function AnnotationsLayer() {
2103
2577
  text: '',
2104
2578
  fontSize: DEFAULT_FONT_SIZE,
2105
2579
  cornerRadius: STICKY_CORNER_RADIUS,
2580
+ at: new Date().toISOString(), // S4.13 — when it was made (the author line's "2 h ago")
2106
2581
  ...(collab?.myName ? { authorName: collab.myName, authorId: collab.myConnId } : null),
2107
2582
  });
2108
2583
  } else if (tool === 'section') {
@@ -2118,6 +2593,23 @@ export function AnnotationsLayer() {
2118
2593
  label: 'Section',
2119
2594
  color: DEFAULT_SECTION_COLOR,
2120
2595
  });
2596
+ } else if (tool === 'el-text') {
2597
+ // S2.12b — Edit's Text is click to type: editable text under the click types in place, a
2598
+ // click on nothing adds a text element (the toolbar insert verb), never an annotation.
2599
+ // r2-text-tool — nothing under it: a text at the pointer, selected and open for typing.
2600
+ const how = clickToType(document, findEditableElementAt(e.clientX, e.clientY), e, {
2601
+ toast: (m) => showCanvasToast(m),
2602
+ record: (rec) => undoStackRef.current?.record(rec),
2603
+ select: (refs) =>
2604
+ elementSel && selectElementsWhenRendered(refs, (s) => elementSel.replace(s)),
2605
+ });
2606
+ if (how === 'code')
2607
+ showCanvasToast(
2608
+ 'This text is filled in from code (a variable) — edit it via chat or /design:edit.'
2609
+ );
2610
+ // Editing ARTBOARD content is an edit-mode activity: back to Select, as the Text tool does.
2611
+ setTool('move');
2612
+ return true;
2121
2613
  } else if (tool === 'text') {
2122
2614
  // Dogfood fix + Phase 4 (unified-text-editing) — the Text tool
2123
2615
  // clicking EXISTING editable text edits it in place rather than
@@ -2193,9 +2685,43 @@ export function AnnotationsLayer() {
2193
2685
  ]
2194
2686
  );
2195
2687
 
2688
+ /** S4.11 — what the pointer is over, for the ring / edge light / outlines (null = not aiming). */
2689
+ const updateAim = useCallback((wx: number, wy: number, on: boolean) => {
2690
+ if (!on) {
2691
+ if (aimRef.current) {
2692
+ aimRef.current = null;
2693
+ setAim(null);
2694
+ }
2695
+ return;
2696
+ }
2697
+ if (!aimRectsRef.current) aimRectsRef.current = canvasRectsNow() as AimRects | null;
2698
+ const rects = aimRectsRef.current;
2699
+ if (!rectsReady(rects)) return;
2700
+ const zoom = getLiveViewport()?.zoom || 1;
2701
+ const hot = pickCandidate(rects, wx, wy, { band: edgeBand(zoom), labelOf: artboardLabel });
2702
+ const near = nearbyOutlines(rects, wx, wy, 240 / zoom);
2703
+ const prev = aimRef.current;
2704
+ const same =
2705
+ prev &&
2706
+ !!prev.hot === !!hot &&
2707
+ (!hot ||
2708
+ !prev.hot ||
2709
+ (prev.hot.box.x === hot.box.x &&
2710
+ prev.hot.box.y === hot.box.y &&
2711
+ prev.hot.box.w === hot.box.w &&
2712
+ prev.hot.edge === hot.edge)) &&
2713
+ prev.near.length === near.length &&
2714
+ prev.near.every((b, i) => b.x === near[i]?.x && b.y === near[i]?.y && b.w === near[i]?.w);
2715
+ if (same) return;
2716
+ const next: AimState = { hot, near };
2717
+ aimRef.current = next;
2718
+ setAim(next);
2719
+ }, []);
2720
+
2196
2721
  const moveStroke = useCallback(
2197
2722
  (e: ReactPointerEvent<HTMLDivElement>) => {
2198
2723
  if (!isActive || !visible) return;
2724
+ if (finishingRef.current) return;
2199
2725
  const [wx, wy] = screenToWorld(e.clientX, e.clientY);
2200
2726
  cmdHeldRef.current = e.metaKey || e.ctrlKey;
2201
2727
  if (isErase) {
@@ -2207,6 +2733,8 @@ export function AnnotationsLayer() {
2207
2733
  // cursor so a translucent preview can follow it; an active draw hides it.
2208
2734
  if (drawingRef.current == null) {
2209
2735
  if (ghostCapable) setGhost({ x: wx, y: wy });
2736
+ // S4.11 — an armed Arrow tool shows what it would point at before the drag starts.
2737
+ if (tool === 'arrow') updateAim(wx, wy, !cmdHeldRef.current);
2210
2738
  return;
2211
2739
  }
2212
2740
  setGhost(null);
@@ -2221,6 +2749,8 @@ export function AnnotationsLayer() {
2221
2749
  ? null
2222
2750
  : bindCandidate(wx, wy, strokesRef.current, BIND_THRESHOLD_PX / zoom);
2223
2751
  setBindHintId(cand?.hostId ?? null);
2752
+ // A board item under the pointer wins over the canvas (the shipped behaviour); else aim.
2753
+ updateAim(wx, wy, !cand && !cmdHeldRef.current);
2224
2754
  }
2225
2755
  setDrawing((cur) => {
2226
2756
  if (!cur) return cur;
@@ -2236,7 +2766,7 @@ export function AnnotationsLayer() {
2236
2766
  return applyDrawModifiers(cur, anchor, wx, wy, mods);
2237
2767
  });
2238
2768
  },
2239
- [isActive, isErase, visible, screenToWorld, eraseAt, ghostCapable]
2769
+ [isActive, isErase, visible, screenToWorld, eraseAt, ghostCapable, tool, updateAim]
2240
2770
  );
2241
2771
 
2242
2772
  const endStroke = useCallback(() => {
@@ -2273,6 +2803,15 @@ export function AnnotationsLayer() {
2273
2803
  Math.abs(norm.w) < STICKY_MIN_SIZE || Math.abs(norm.h) < STICKY_MIN_SIZE
2274
2804
  ? { ...norm, w: STICKY_DEFAULT_W, h: STICKY_DEFAULT_H }
2275
2805
  : norm;
2806
+ // S4.12 (an-sticky cell 3) - a drop on another sticky lands 12 px down and right, so the one under it
2807
+ // still shows. A drag-sized card keeps its drawn corner; only a tap (the default card) stacks.
2808
+ if (
2809
+ final.tool === 'sticky' &&
2810
+ (final.w === STICKY_DEFAULT_W || final.h === STICKY_DEFAULT_H)
2811
+ ) {
2812
+ const hit = stackLanding({ x: cur.x, y: cur.y }, stickyBoxes(strokesRef.current), cur.id);
2813
+ if (hit) final = { ...final, x: hit.x, y: hit.y };
2814
+ }
2276
2815
  } else if (cur.tool === 'section') {
2277
2816
  const norm = normalizeBox(cur);
2278
2817
  final =
@@ -2312,81 +2851,228 @@ export function AnnotationsLayer() {
2312
2851
  }
2313
2852
  }
2314
2853
  setBindHintId(null);
2315
- if (final) {
2316
- const committed = final;
2317
- const prev = strokesRef.current;
2318
- // FigJam — sections are CONTAINERS: they slot in at the BACK of the
2319
- // z-order so content placed on them keeps rendering above — and a
2320
- // section drawn INSIDE another goes right above that one (Task 20), so
2321
- // it renders in front of its outer section and adopts what sits on it.
2322
- let next: Stroke[];
2323
- if (committed.tool === 'section') {
2324
- const bb = strokeBBox(committed);
2325
- const outer = bb
2326
- ? new Containment(strokesToElementMap(prev, board.committed).values()).containerAt(
2327
- bb.x + bb.w / 2,
2328
- bb.y + bb.h / 2
2329
- )
2330
- : null;
2331
- next = insertSection(prev, committed, outer);
2332
- } else {
2333
- next = [...prev, committed];
2854
+ updateAim(0, 0, false);
2855
+ const finish = (final: Stroke | null): void => {
2856
+ if (final) {
2857
+ const committed = final;
2858
+ const prev = strokesRef.current;
2859
+ // FigJam — sections are CONTAINERS: they slot in at the BACK of the
2860
+ // z-order so content placed on them keeps rendering above — and a
2861
+ // section drawn INSIDE another goes right above that one (Task 20), so
2862
+ // it renders in front of its outer section and adopts what sits on it.
2863
+ let next: Stroke[];
2864
+ if (committed.tool === 'section') {
2865
+ const bb = strokeBBox(committed);
2866
+ const outer = bb
2867
+ ? new Containment(strokesToElementMap(prev, board.committed).values()).containerAt(
2868
+ bb.x + bb.w / 2,
2869
+ bb.y + bb.h / 2
2870
+ )
2871
+ : null;
2872
+ next = insertSection(prev, committed, outer);
2873
+ } else {
2874
+ next = [...prev, committed];
2875
+ }
2876
+ commitStrokes(prev, next, `draw ${committed.tool}`);
2877
+ // T18 — auto-select the freshly drawn shape so the user can immediately
2878
+ // see + adjust it. annotSel is optional (some test harnesses mount
2879
+ // AnnotationsLayer without the provider), so guard the call.
2880
+ if (annotSel) annotSel.replace(committed.id);
2881
+ // Phase 21 — a fresh sticky opens in edit mode (FigJam parity: drop a
2882
+ // note, type immediately). Phase 1 whiteboard-improvements — shapes get
2883
+ // the same treatment (rect/ellipse/polygon are all AnchorHost, so
2884
+ // setEditingId resolves them via editingTarget's 'anchored' branch same
2885
+ // as a double-click would).
2886
+ if (
2887
+ committed.tool === 'sticky' ||
2888
+ committed.tool === 'rect' ||
2889
+ committed.tool === 'ellipse' ||
2890
+ committed.tool === 'polygon'
2891
+ ) {
2892
+ setEditingId(committed.id);
2893
+ showOnceHint('chain', '⌘Enter commits and creates the next one beside it.');
2894
+ }
2334
2895
  }
2335
- commitStrokes(prev, next, `draw ${committed.tool}`);
2336
- // T18 — auto-select the freshly drawn shape so the user can immediately
2337
- // see + adjust it. annotSel is optional (some test harnesses mount
2338
- // AnnotationsLayer without the provider), so guard the call.
2339
- if (annotSel) annotSel.replace(committed.id);
2340
- // Phase 21 — a fresh sticky opens in edit mode (FigJam parity: drop a
2341
- // note, type immediately). Phase 1 whiteboard-improvements — shapes get
2342
- // the same treatment (rect/ellipse/polygon are all AnchorHost, so
2343
- // setEditingId resolves them via editingTarget's 'anchored' branch same
2344
- // as a double-click would).
2345
- if (
2346
- committed.tool === 'sticky' ||
2347
- committed.tool === 'rect' ||
2348
- committed.tool === 'ellipse' ||
2349
- committed.tool === 'polygon'
2350
- ) {
2351
- setEditingId(committed.id);
2352
- showOnceHint('chain', '⌘Enter commits and creates the next one beside it.');
2896
+ // T18 / T19 — flip the tool back to the MODE's resting tool after every
2897
+ // commit UNLESS sticky mode is locked on this tool (DDR-223: move in edit
2898
+ // — byte-identical to the old hardcode — browse in preview, so drawing an
2899
+ // annotation never silently exits the alive posture). Sticky lets the user
2900
+ // draw many shapes in a row (canonical pattern: tldraw double-click to
2901
+ // lock). Map a highlighter pen (a 'pen' stroke with the flag) back to the
2902
+ // 'highlighter' tool id so its sticky-lock check matches the active tool.
2903
+ //
2904
+ // No eraser case here: an eraser commits no stroke, so `cur.tool` (a stroke
2905
+ // KIND, off `drawingRef`) can never be 'eraser' — erase leaves through the
2906
+ // `isErase` branch above. It stays armed by being unreachable from here,
2907
+ // not by a guard. The typecheck surface completion (A2) proved the old
2908
+ // `!== 'eraser'` test was dead.
2909
+ const toolJustUsed = cur.tool === 'pen' && cur.highlighter ? 'highlighter' : cur.tool;
2910
+ const stickyOnThis = sticky.locked && sticky.tool === toolJustUsed;
2911
+ if (!stickyOnThis) resetTool();
2912
+ drawAnchorRef.current = null;
2913
+ lastDrawPointRef.current = null;
2914
+ setDrawing(null);
2915
+ };
2916
+ // S4.11 (an-arrow-bind) — an end dropped on a canvas element, or on an artboard's edge, binds to
2917
+ // THAT: `el:<artboard>/<id>` / `ab:<artboard>`. An element without an authored id is named first
2918
+ // through the edit-op `element.stamp` (Q12); busy, it falls back to the artboard with the tag
2919
+ // "Bound to the artboard". A board item under the end already won above (the shipped bind).
2920
+ const rects =
2921
+ aimRectsRef.current ??
2922
+ (final?.tool === 'arrow' ? (canvasRectsNow() as AimRects | null) : null);
2923
+ aimRectsRef.current = null;
2924
+ if (final && final.tool === 'arrow' && !cmdHeldRef.current && rectsReady(rects)) {
2925
+ const arrow = final;
2926
+ const band = edgeBand(vpRef.current?.zoom || 1);
2927
+ const pick = (x: number, y: number) =>
2928
+ pickCandidate(rects, x, y, { band, labelOf: artboardLabel });
2929
+ const jobs: Array<{ end: 'start' | 'end'; cand: BindCandidate }> = [];
2930
+ const sc = arrow.startBind ? null : pick(arrow.x1, arrow.y1);
2931
+ const ec = arrow.endBind ? null : pick(arrow.x2, arrow.y2);
2932
+ if (sc) jobs.push({ end: 'start', cand: sc });
2933
+ // Both ends on one host is a loop: the end stays free.
2934
+ if (ec && !(sc && hostRefOf(sc) === hostRefOf(ec))) jobs.push({ end: 'end', cand: ec });
2935
+ if (jobs.length) {
2936
+ const resolve = resolverFromRects(asHostRects(rects));
2937
+ const attach = (done: Array<{ end: 'start' | 'end'; bound: BoundEnd | null }>): Stroke =>
2938
+ attachHosts(
2939
+ arrow,
2940
+ {
2941
+ start: done.find((d) => d.end === 'start')?.bound?.bind,
2942
+ end: done.find((d) => d.end === 'end')?.bound?.bind,
2943
+ },
2944
+ resolve
2945
+ );
2946
+ const now = jobs.map((j) => ({ end: j.end, bound: bindNow(j.cand) }));
2947
+ if (now.every((j) => j.bound)) {
2948
+ finish(attach(now));
2949
+ return;
2950
+ }
2951
+ finishingRef.current = true;
2952
+ void Promise.all(
2953
+ jobs.map(async (j) => ({ end: j.end, bound: await bindEnd(j.cand, stampViaEditOp) }))
2954
+ ).then((done) => {
2955
+ finishingRef.current = false;
2956
+ const tag = done.find((d) => d.bound?.tag)?.bound?.tag;
2957
+ if (tag) {
2958
+ setBoundTag({ text: tag, at: [arrow.x2, arrow.y2] });
2959
+ setTimeout(() => setBoundTag(null), 2400);
2960
+ }
2961
+ finish(done.some((d) => d.bound) ? attach(done) : arrow);
2962
+ });
2963
+ return;
2353
2964
  }
2354
2965
  }
2355
- // T18 / T19 — flip the tool back to the MODE's resting tool after every
2356
- // commit UNLESS sticky mode is locked on this tool (DDR-223: move in edit
2357
- // — byte-identical to the old hardcode — browse in preview, so drawing an
2358
- // annotation never silently exits the alive posture). Sticky lets the user
2359
- // draw many shapes in a row (canonical pattern: tldraw double-click to
2360
- // lock). Map a highlighter pen (a 'pen' stroke with the flag) back to the
2361
- // 'highlighter' tool id so its sticky-lock check matches the active tool.
2362
- //
2363
- // No eraser case here: an eraser commits no stroke, so `cur.tool` (a stroke
2364
- // KIND, off `drawingRef`) can never be 'eraser' — erase leaves through the
2365
- // `isErase` branch above. It stays armed by being unreachable from here,
2366
- // not by a guard. The typecheck surface completion (A2) proved the old
2367
- // `!== 'eraser'` test was dead.
2368
- const toolJustUsed = cur.tool === 'pen' && cur.highlighter ? 'highlighter' : cur.tool;
2369
- const stickyOnThis = sticky.locked && sticky.tool === toolJustUsed;
2370
- if (!stickyOnThis) resetTool();
2371
- drawAnchorRef.current = null;
2372
- lastDrawPointRef.current = null;
2373
- setDrawing(null);
2374
- }, [isActive, isErase, visible, commitStrokes, annotSel, resetTool, sticky]);
2966
+ finish(final);
2967
+ }, [isActive, isErase, visible, commitStrokes, annotSel, resetTool, sticky, updateAim]);
2968
+
2969
+ // S4.11 — Point to…: while it is armed, the next click on a canvas element / artboard edge binds
2970
+ // that end of the arrow (stamping the element first when it has no authored id); Esc cancels.
2971
+ // Capture-phase on the window so the click never also selects or draws.
2972
+ // biome-ignore lint/correctness/useExhaustiveDependencies: armed by `pointTo` only
2973
+ useEffect(() => {
2974
+ if (!pointTo) return;
2975
+ const { arrowId, end } = pointTo;
2976
+ aimRectsRef.current = canvasRectsNow() as AimRects | null;
2977
+ const stop = () => {
2978
+ aimRectsRef.current = null;
2979
+ updateAim(0, 0, false);
2980
+ setPointTo(null);
2981
+ };
2982
+ const onMove = (e: PointerEvent) => {
2983
+ const [x, y] = screenToWorld(e.clientX, e.clientY);
2984
+ updateAim(x, y, true);
2985
+ };
2986
+ const onDown = (e: PointerEvent) => {
2987
+ const t = e.target as Element | null;
2988
+ if (t?.closest?.(CHROME_SELECTOR)) return;
2989
+ e.preventDefault();
2990
+ e.stopPropagation();
2991
+ e.stopImmediatePropagation();
2992
+ const rects = aimRectsRef.current;
2993
+ if (!rectsReady(rects)) return;
2994
+ const [x, y] = screenToWorld(e.clientX, e.clientY);
2995
+ const cand = pickCandidate(rects, x, y, {
2996
+ band: edgeBand(getLiveViewport()?.zoom || 1),
2997
+ labelOf: artboardLabel,
2998
+ });
2999
+ if (!cand) return; // empty canvas: keep aiming
3000
+ void bindEnd(cand, stampViaEditOp).then((bound) => {
3001
+ stop();
3002
+ if (!bound) return;
3003
+ const prev = strokesRef.current;
3004
+ const a = prev.find((st) => st.id === arrowId);
3005
+ if (!a || a.tool !== 'arrow') return;
3006
+ const placed = attachHosts(
3007
+ a,
3008
+ end === 'start' ? { start: bound.bind } : { end: bound.bind },
3009
+ resolverFromRects(asHostRects(rects))
3010
+ );
3011
+ commitStrokes(
3012
+ prev,
3013
+ prev.map((st) => (st.id === arrowId ? placed : st)),
3014
+ 'point arrow'
3015
+ );
3016
+ if (bound.tag) {
3017
+ setBoundTag({ text: bound.tag, at: [placed.x2, placed.y2] });
3018
+ setTimeout(() => setBoundTag(null), 2400);
3019
+ }
3020
+ });
3021
+ };
3022
+ const onKey = (e: KeyboardEvent) => {
3023
+ if (e.key !== 'Escape') return;
3024
+ e.preventDefault();
3025
+ e.stopPropagation();
3026
+ stop();
3027
+ };
3028
+ window.addEventListener('pointermove', onMove, true);
3029
+ window.addEventListener('pointerdown', onDown, true);
3030
+ window.addEventListener('keydown', onKey, true);
3031
+ return () => {
3032
+ window.removeEventListener('pointermove', onMove, true);
3033
+ window.removeEventListener('pointerdown', onDown, true);
3034
+ window.removeEventListener('keydown', onKey, true);
3035
+ };
3036
+ }, [pointTo, commitStrokes]);
3037
+
3038
+ /** S4.11 — the words written on an arrow commit as one undoable edit; empty removes them. */
3039
+ const commitLabel = useCallback(
3040
+ (id: string, text: string) => {
3041
+ setLabelEdit(null);
3042
+ const prev = strokesRef.current;
3043
+ const a = prev.find((st) => st.id === id);
3044
+ if (!a || a.tool !== 'arrow') return;
3045
+ const patch = labelPatch(text);
3046
+ if ((a.label || undefined) === patch.label) return;
3047
+ commitStrokes(
3048
+ prev,
3049
+ prev.map((st) => (st.id === id ? ({ ...st, ...patch } as Stroke) : st)),
3050
+ patch.label ? 'label arrow' : 'clear arrow label'
3051
+ );
3052
+ },
3053
+ [commitStrokes]
3054
+ );
2375
3055
 
2376
3056
  // T21 — abort a mid-stroke draw without committing. Dispatched by the
2377
3057
  // canvas-shell Esc handler (`maude:cancel-stroke`). Safe to call when
2378
3058
  // nothing is being drawn — the early-return on drawingRef keeps it
2379
3059
  // a no-op.
2380
- const cancelStroke = useCallback(() => {
2381
- if (!drawingRef.current) return;
3060
+ const cancelStroke = useCallback((): boolean => {
3061
+ if (!drawingRef.current) return false;
2382
3062
  drawAnchorRef.current = null;
2383
3063
  lastDrawPointRef.current = null;
2384
3064
  setDrawing(null);
3065
+ return true;
2385
3066
  }, []);
2386
3067
 
2387
3068
  useEffect(() => {
2388
3069
  if (typeof document === 'undefined') return;
2389
- const onCancel = () => cancelStroke();
3070
+ // S3.12 — the event carries `{ cancelled }` so the esc ladder knows this press WAS the stroke's rung.
3071
+ const onCancel = (e: Event) => {
3072
+ const hit = cancelStroke();
3073
+ const detail = (e as CustomEvent<{ cancelled?: boolean } | null>).detail;
3074
+ if (hit && detail && typeof detail === 'object') detail.cancelled = true;
3075
+ };
2390
3076
  document.addEventListener('maude:cancel-stroke', onCancel);
2391
3077
  return () => document.removeEventListener('maude:cancel-stroke', onCancel);
2392
3078
  }, [cancelStroke]);
@@ -2415,10 +3101,105 @@ export function AnnotationsLayer() {
2415
3101
  };
2416
3102
  }, []);
2417
3103
 
3104
+ // S4.11 — the live canvas under bound arrows (host-view.ts). The manifest is re-read on a board
3105
+ // change and every 1.5 s while any arrow is bound (an element moved, AI rewrote it, it left the
3106
+ // canvas), and kept only when a bound host's box (or its absence) changed — so a quiet canvas
3107
+ // re-renders nothing. Nothing is derived until the canvas has painted an artboard.
3108
+ const [liveRects, setLiveRects] = useState<AimRects | null>(null);
3109
+ const liveSigRef = useRef('');
3110
+ const bound = useMemo(() => hasHosts(strokes), [strokes]);
3111
+ const strokesForRects = useRef(strokes);
3112
+ strokesForRects.current = strokes;
3113
+ // biome-ignore lint/correctness/useExhaustiveDependencies: re-read per board version
3114
+ useEffect(() => {
3115
+ if (!bound) {
3116
+ liveSigRef.current = '';
3117
+ setLiveRects(null);
3118
+ return;
3119
+ }
3120
+ const tick = () => {
3121
+ const r = canvasRectsNow() as AimRects | null;
3122
+ const sig = hostSignature(strokesForRects.current, r);
3123
+ if (sig === liveSigRef.current) return;
3124
+ liveSigRef.current = sig;
3125
+ setLiveRects(rectsReady(r) ? r : null);
3126
+ };
3127
+ tick();
3128
+ const first = [60, 250, 800].map((ms) => setTimeout(tick, ms));
3129
+ const id = setInterval(tick, 1500);
3130
+ return () => {
3131
+ for (const t of first) clearTimeout(t);
3132
+ clearInterval(id);
3133
+ };
3134
+ }, [bound, boardVersion]);
3135
+ const viewedStrokes = useMemo(() => viewStrokes(strokes, liveRects), [strokes, liveRects]);
3136
+ const danglingCards = useMemo<DanglingCardModel[]>(
3137
+ () => (liveRects ? danglingOf(strokes, liveRects).map((d) => danglingCard(d, liveRects)) : []),
3138
+ [strokes, liveRects]
3139
+ );
3140
+ const danglingRef = useRef(danglingCards);
3141
+ danglingRef.current = danglingCards;
3142
+ // S4.11 — the artboards an elbow arrow routes around at rest. Read from the layout (drag bus)
3143
+ // when there is one, else the manifest; refreshed on a board change and after an artboard move.
3144
+ const [boards, setBoards] = useState<BoardRect[]>([]);
3145
+ const boardsSigRef = useRef('');
3146
+ const anyElbow = useMemo(
3147
+ () => strokes.some((s) => s.tool === 'arrow' && s.lineType === 'elbow'),
3148
+ [strokes]
3149
+ );
3150
+ // biome-ignore lint/correctness/useExhaustiveDependencies: layoutTick / boardVersion are the triggers
3151
+ useEffect(() => {
3152
+ if (!anyElbow) {
3153
+ if (boardsSigRef.current) {
3154
+ boardsSigRef.current = '';
3155
+ setBoards([]);
3156
+ }
3157
+ return;
3158
+ }
3159
+ const layout = dragBusRef.current?.layoutRects() ?? [];
3160
+ const list: BoardRect[] = layout.length
3161
+ ? layout.map((a) => ({ id: a.id, x: a.x, y: a.y, w: a.w, h: a.h }))
3162
+ : (canvasRectsNow()?.artboards ?? []).map((a) => ({
3163
+ id: a.id,
3164
+ x: a.x,
3165
+ y: a.y,
3166
+ w: a.w,
3167
+ h: a.h,
3168
+ }));
3169
+ const sig = list.map((a) => `${a.id}:${a.x},${a.y},${a.w},${a.h}`).join('|');
3170
+ if (sig === boardsSigRef.current) return;
3171
+ boardsSigRef.current = sig;
3172
+ setBoards(list);
3173
+ }, [anyElbow, layoutTick, boardVersion]);
2418
3174
  const renderStrokes = useMemo(
2419
- () => (drawing ? [...strokes, drawing] : strokes),
2420
- [strokes, drawing]
3175
+ () => (drawing ? [...viewedStrokes, drawing] : viewedStrokes),
3176
+ [viewedStrokes, drawing]
2421
3177
  );
3178
+ // S4.9 - the person filter and C29's Hide resolved stickies leave elements out of the DRAWING only.
3179
+ // S4.12 - a folded section's members are left out of the drawing too (they stay in the file).
3180
+ const shownStrokes = useMemo(() => {
3181
+ const seen = withoutResolved(
3182
+ filterByAuthors(renderStrokes, authorFilter, collab?.myName),
3183
+ hideResolved
3184
+ );
3185
+ return withoutFolded(seen, (id) =>
3186
+ new Containment(strokesToElementMap(renderStrokes, board.committed).values()).contentsOf(id)
3187
+ );
3188
+ }, [renderStrokes, authorFilter, hideResolved, collab?.myName, board.committed]);
3189
+ // S4.12 - the count line on a folded section's chip: what is inside, and how many people wrote it.
3190
+ // S4.13 - and an open section says how many it holds (canvas 15 an-plan: "Nápady 4"): its value is just the number.
3191
+ const foldNotes = useMemo(() => {
3192
+ const m = new Map<string, string>();
3193
+ if (!viewedStrokes.some((s) => s.tool === 'section')) return m;
3194
+ const c = new Containment(strokesToElementMap(viewedStrokes, board.committed).values());
3195
+ for (const s of viewedStrokes) {
3196
+ if (s.tool !== 'section') continue;
3197
+ const members = membersOf(viewedStrokes, s.id, (id) => c.contentsOf(id));
3198
+ if (s.folded) m.set(s.id, foldSummary(members, collab?.myName));
3199
+ else if (members.length > 0) m.set(s.id, String(members.length));
3200
+ }
3201
+ return m;
3202
+ }, [viewedStrokes, board.committed, collab?.myName]);
2422
3203
  // Task 22 — what is being drawn, live for peers (pen ink tail, or the box).
2423
3204
  const drawPublishedRef = useRef(false);
2424
3205
  useEffect(() => {
@@ -2478,9 +3259,9 @@ export function AnnotationsLayer() {
2478
3259
 
2479
3260
  const strokesById = useMemo(() => {
2480
3261
  const map = new Map<string, Stroke>();
2481
- for (const s of strokes) map.set(s.id, s);
3262
+ for (const s of viewedStrokes) map.set(s.id, s);
2482
3263
  return map;
2483
- }, [strokes]);
3264
+ }, [viewedStrokes]);
2484
3265
 
2485
3266
  // ──────────────────────────────────────────────────────────────────────────
2486
3267
  // Move-tool selection + drag (Phase 5.1 Tasks 6 + 7). Single doc-level
@@ -2536,28 +3317,14 @@ export function AnnotationsLayer() {
2536
3317
  // biome-ignore lint/correctness/useExhaustiveDependencies: commitStrokes/strokesStore are stable refs from parent context; manual dep list reflects effect-trigger semantics, not internal callbacks
2537
3318
  useEffect(() => {
2538
3319
  if (typeof document === 'undefined') return;
2539
- if (tool !== 'move') return;
3320
+ if (!annotationPicks(tool, posture)) return;
2540
3321
  if (!annotSel) return;
2541
3322
 
2542
3323
  const findStrokeId = (el: Element | null): string | null => {
2543
3324
  const node = el?.closest?.('[data-id][data-tool]') ?? null;
2544
3325
  const id = node?.getAttribute('data-id') ?? null;
2545
3326
  const t = node?.getAttribute('data-tool') ?? null;
2546
- if (
2547
- id &&
2548
- t &&
2549
- (t === 'pen' ||
2550
- t === 'rect' ||
2551
- t === 'ellipse' ||
2552
- t === 'polygon' ||
2553
- t === 'arrow' ||
2554
- t === 'text' ||
2555
- t === 'sticky' ||
2556
- t === 'image' ||
2557
- t === 'link' ||
2558
- t === 'mediaref' ||
2559
- t === 'section')
2560
- ) {
3327
+ if (id && t && isSelectableStrokeTool(t)) {
2561
3328
  return id;
2562
3329
  }
2563
3330
  return null;
@@ -2590,7 +3357,9 @@ export function AnnotationsLayer() {
2590
3357
  // isn't needed (photoSel already takes precedence in tab resolution) and
2591
3358
  // is the only case that races with a still-in-flight photo-tab request.
2592
3359
  const strokeTool = target?.closest?.('[data-id][data-tool]')?.getAttribute('data-tool');
2593
- if (strokeTool !== 'image') elementSel?.clear();
3360
+ // S4.19 G6 - a gallery sticker never rides the Photo tab, so it clears the DOM selection like any other.
3361
+ const hitStroke = strokesStoreRef.current.strokes.find((x) => x.id === strokeId);
3362
+ if (strokeTool !== 'image' || !opensPhotoInspector(hitStroke)) elementSel?.clear();
2594
3363
  // FigJam v3 — clicking a group member acts on the WHOLE outermost
2595
3364
  // group. Double-click deep-selects the member (see the dblclick
2596
3365
  // handler); an already-selected stroke keeps the current selection, so
@@ -2646,7 +3415,7 @@ export function AnnotationsLayer() {
2646
3415
  canvasEl &&
2647
3416
  (!focused ||
2648
3417
  !canvasEl.contains(focused) ||
2649
- focused.closest?.('.dc-annot-ctx, .dc-context-menu, .dc-annot-chrome'))
3418
+ focused.closest?.('.dc-annot-ctx, .dc-context-menu, .dc-tool-palette'))
2650
3419
  ) {
2651
3420
  canvasEl.focus({ preventScroll: true });
2652
3421
  }
@@ -2655,7 +3424,10 @@ export function AnnotationsLayer() {
2655
3424
  // unlocked COPIES and leaves the originals where they are.
2656
3425
  if (!e.altKey) {
2657
3426
  const locked = lockedStrokeIds(strokesRef.current);
2658
- if (locked.size && ids.some((id) => locked.has(id))) return { kind: 'locked' };
3427
+ if (locked.size && ids.some((id) => locked.has(id))) {
3428
+ setLockedTip({ x: e.clientX, y: e.clientY });
3429
+ return { kind: 'locked' };
3430
+ }
2659
3431
  }
2660
3432
  // Capture a snapshot of all strokes at drag start. Every pointermove
2661
3433
  // re-translates FROM the snapshot using the cumulative cursor delta
@@ -2796,9 +3568,27 @@ export function AnnotationsLayer() {
2796
3568
  if (st.altDup) annotSel.replace(preAltIds);
2797
3569
  return;
2798
3570
  }
3571
+ // S4.12 (an-sticky cell 3) - one sticky dropped onto another lands 12 px down and right of it.
3572
+ let landed = final;
3573
+ const lone = st.movedIds.length === 1 ? final.find((x) => x.id === st.movedIds[0]) : null;
3574
+ if (lone?.tool === 'sticky' && !st.altDup) {
3575
+ const [uwx, uwy] = screenToWorld(up.clientX, up.clientY);
3576
+ const hit = stackLanding({ x: uwx, y: uwy }, stickyBoxes(final), lone.id);
3577
+ if (hit) {
3578
+ const bx = Math.min(lone.x, lone.x + lone.w);
3579
+ const by = Math.min(lone.y, lone.y + lone.h);
3580
+ landed = recomputeBoundArrows(
3581
+ final.map((x) =>
3582
+ x.id === lone.id
3583
+ ? ({ ...lone, x: lone.x + (hit.x - bx), y: lone.y + (hit.y - by) } as Stroke)
3584
+ : x
3585
+ )
3586
+ );
3587
+ }
3588
+ }
2799
3589
  commitStrokes(
2800
3590
  st.undoBase,
2801
- final,
3591
+ landed,
2802
3592
  `${st.altDup ? 'duplicate' : 'move'} ${st.movedIds.length} stroke${
2803
3593
  st.movedIds.length === 1 ? '' : 's'
2804
3594
  }`
@@ -2821,6 +3611,25 @@ export function AnnotationsLayer() {
2821
3611
  // sitting ON an artboard instead of falling through to artboard-drag.
2822
3612
  if (!strokeId && !e.shiftKey && target?.closest?.('[data-dc-screen]')) return;
2823
3613
 
3614
+ // S4.18b - the Hand (Preview's resting tool) picks stickies but never rubber-bands: a drag on empty
3615
+ // canvas is the canvas's pan, so this stage claims nothing. A bare click still lets go of the selection.
3616
+ if (!annotationMarquees(tool, posture, mode)) {
3617
+ if (!e.shiftKey && annotSel.selectedIds.length > 0) {
3618
+ const letGo = (up: PointerEvent) => {
3619
+ document.removeEventListener('pointerup', letGo, true);
3620
+ document.removeEventListener('pointercancel', letGo, true);
3621
+ if (
3622
+ up.type === 'pointerup' &&
3623
+ !crossedDragThreshold(startClientX, startClientY, up.clientX, up.clientY)
3624
+ )
3625
+ annotSel.clear();
3626
+ };
3627
+ document.addEventListener('pointerup', letGo, true);
3628
+ document.addEventListener('pointercancel', letGo, true);
3629
+ }
3630
+ return;
3631
+ }
3632
+
2824
3633
  // Empty world — start a drag-select gesture. A bare click without
2825
3634
  // moving clears annotation selection (post-Wave-3 feedback: click-to-
2826
3635
  // deselect is back; Esc also still works).
@@ -2872,7 +3681,17 @@ export function AnnotationsLayer() {
2872
3681
  // commitStrokes is included defensively (it is a stable useCallback([]) ref,
2873
3682
  // so this never re-registers the stage) to remove the latent stale-closure
2874
3683
  // trap flagged in the Phase 24 frontend review.
2875
- }, [pipeline, tool, annotSel, elementSel, screenToWorld, strokesStore, commitStrokes]);
3684
+ }, [
3685
+ pipeline,
3686
+ tool,
3687
+ posture,
3688
+ mode,
3689
+ annotSel,
3690
+ elementSel,
3691
+ screenToWorld,
3692
+ strokesStore,
3693
+ commitStrokes,
3694
+ ]);
2876
3695
 
2877
3696
  // Latest marquee + strokes refs for the doc-level pointerup callback
2878
3697
  // (avoids re-binding the listener on every state tick).
@@ -2894,7 +3713,7 @@ export function AnnotationsLayer() {
2894
3713
  // use-annotation-resize.tsx.
2895
3714
  useEffect(() => {
2896
3715
  if (typeof document === 'undefined') return;
2897
- if (tool !== 'move') return;
3716
+ if (!annotationPicks(tool, posture)) return;
2898
3717
  if (!annotSel) return;
2899
3718
 
2900
3719
  const onDown = (e: PointerEvent): Claim => {
@@ -2989,14 +3808,14 @@ export function AnnotationsLayer() {
2989
3808
  commitStrokes(d.undoBase, final, `resize ${d.ids.length} strokes`);
2990
3809
  };
2991
3810
  return pipeline.add({ priority: 3, name: 'group-resize', down: onDown });
2992
- }, [pipeline, tool, annotSel, screenToWorld, anchorsById, commitStrokes]);
3811
+ }, [pipeline, tool, posture, annotSel, screenToWorld, anchorsById, commitStrokes]);
2993
3812
 
2994
3813
  // Double-click enters text-edit mode: rect/ellipse (anchored text), sticky
2995
3814
  // (its own body), or a standalone text node (re-edit in place). Anchored text
2996
3815
  // nodes are edited via their host, so a data-anchor-id text node is skipped.
2997
3816
  useEffect(() => {
2998
3817
  if (typeof document === 'undefined') return;
2999
- if (tool !== 'move') return;
3818
+ if (!annotationPicks(tool, posture)) return;
3000
3819
  const onDbl = (e: MouseEvent) => {
3001
3820
  if (isMediaPlayerTarget(e)) return; // mediaref inline player owns this event
3002
3821
  const target = e.target as Element | null;
@@ -3036,6 +3855,14 @@ export function AnnotationsLayer() {
3036
3855
  e.stopPropagation();
3037
3856
  annotSel.replace(id);
3038
3857
  }
3858
+ if (t === 'arrow') {
3859
+ // S4.11 (an-arrow-kinds 3): the words on the line. Claimed so the canvas-shell
3860
+ // dblclick-empty→fit() handler does not jump the view.
3861
+ e.preventDefault();
3862
+ e.stopPropagation();
3863
+ setLabelEdit(id);
3864
+ return;
3865
+ }
3039
3866
  if (t === 'rect' || t === 'ellipse' || t === 'polygon' || t === 'sticky' || t === 'section') {
3040
3867
  // A double-click we've claimed for editing must not also reach the
3041
3868
  // canvas-shell dblclick-empty→fit() handler (bubble phase, below us) —
@@ -3054,7 +3881,7 @@ export function AnnotationsLayer() {
3054
3881
  };
3055
3882
  document.addEventListener('dblclick', onDbl, true);
3056
3883
  return () => document.removeEventListener('dblclick', onDbl, true);
3057
- }, [tool, annotSel]);
3884
+ }, [tool, posture, annotSel]);
3058
3885
 
3059
3886
  const commitText = useCallback(
3060
3887
  (anchorId: string, text: string, fmt?: EditorFmt) => {
@@ -3103,18 +3930,18 @@ export function AnnotationsLayer() {
3103
3930
  | StickyStroke
3104
3931
  | undefined;
3105
3932
  if (!existing) return;
3106
- // issue-106 — grow the card to whatever the editor actually rendered, so
3107
- // the lines the user just typed survive the return to the clipped read
3108
- // view. Null when the text already fits (the common case).
3109
- // The growth rides along with a real edit — it is NOT itself a reason to
3110
- // write. Otherwise opening a peer's already-overflowing note and clicking
3111
- // away, having typed nothing, would produce an undo entry, a
3112
- // full-document PUT and a sync broadcast.
3113
- if (existing.text === text && fmtEqual(existing, fmt)) return;
3114
- const grown = measuredH == null ? null : grownStickyBox(existing, measuredH);
3115
- const next = prev.map((s) =>
3116
- s.id === id ? { ...existing, text, ...normFmt(fmt), ...(grown ?? {}) } : s
3933
+ // issue-106 / S4.12 / S4.V4 G1 - grow the card to fit the words (annotations-model.ts
3934
+ // stickyEditNext). The edit session's base text decides "nothing was typed": an idle draft has
3935
+ // usually put the final words on the board already, so the stored text alone would skip the fit.
3936
+ const edited = stickyEditNext(
3937
+ existing,
3938
+ text,
3939
+ fmt,
3940
+ measuredH,
3941
+ commitSessionRef.current?.base ?? existing.text
3117
3942
  );
3943
+ if (!edited) return;
3944
+ const next = prev.map((s) => (s.id === id ? edited : s));
3118
3945
  commitStrokes(prev, next, 'edit sticky');
3119
3946
  },
3120
3947
  [commitStrokes]
@@ -3204,6 +4031,13 @@ export function AnnotationsLayer() {
3204
4031
  editingTargetRef.current = editingTarget;
3205
4032
  const editingIdRef = useRef(editingId);
3206
4033
  editingIdRef.current = editingId;
4034
+ // S4.12 - while a sticky is typed in, the peers see it edged in this person's colour (awareness only).
4035
+ const typingStickyId = editingTarget?.kind === 'sticky' ? editingTarget.sticky.id : null;
4036
+ useEffect(() => {
4037
+ if (!typingStickyId) return;
4038
+ publishGesture({ kind: 'type', ids: [typingStickyId] });
4039
+ return () => publishGesture(null);
4040
+ }, [typingStickyId, publishGesture]);
3207
4041
 
3208
4042
  // One edit session per opened element (Task 19). Opened from the board as
3209
4043
  // last delivered, so its base is what everyone agreed on at that moment.
@@ -3244,7 +4078,7 @@ export function AnnotationsLayer() {
3244
4078
  if (!session) return;
3245
4079
  const op = draftOp(session, board.committed.get(id), text);
3246
4080
  if (!op) return;
3247
- void sendOps([op]);
4081
+ void sendOps([op], false, true, session.sid);
3248
4082
  textSessionRef.current = markSent(session, text);
3249
4083
  },
3250
4084
  [sessionFor, sendOps]
@@ -3271,15 +4105,18 @@ export function AnnotationsLayer() {
3271
4105
  if (!session || !lastKnown || !stored.trim()) return;
3272
4106
  const parentExists = !!lastKnown.parent && board.committed.has(lastKnown.parent);
3273
4107
  const bb = strokeBBox(editTargetStroke(target));
3274
- applyOpsLocal([
3275
- restoreOp(
3276
- session,
3277
- lastKnown,
3278
- stored,
3279
- parentExists,
3280
- bb ? { x: bb.x, y: bb.y } : undefined
3281
- ),
3282
- ]);
4108
+ applyOpsLocal(
4109
+ [
4110
+ restoreOp(
4111
+ session,
4112
+ lastKnown,
4113
+ stored,
4114
+ parentExists,
4115
+ bb ? { x: bb.x, y: bb.y } : undefined
4116
+ ),
4117
+ ],
4118
+ session.sid
4119
+ );
3283
4120
  return;
3284
4121
  }
3285
4122
  commitSessionRef.current = session;
@@ -3300,7 +4137,7 @@ export function AnnotationsLayer() {
3300
4137
  // back to the text the element keeps (no undo step: nothing changed).
3301
4138
  if (session && !sessionCommittedRef.current) {
3302
4139
  const op = draftOp(session, board.committed.get(id), stored);
3303
- if (op) applyOpsLocal([op]);
4140
+ if (op) applyOpsLocal([op], session.sid);
3304
4141
  }
3305
4142
  textSessionRef.current = null;
3306
4143
  },
@@ -3527,6 +4364,7 @@ export function AnnotationsLayer() {
3527
4364
  if (typeof document === 'undefined') return;
3528
4365
  if (!annotSel) return;
3529
4366
  const onKey = (e: KeyboardEvent) => {
4367
+ if (!boardChordsLive(window)) return;
3530
4368
  if (isEditable(e.target)) return;
3531
4369
  const store = strokesStoreRef.current;
3532
4370
  const sel = annotSel.selectedIds;
@@ -3602,6 +4440,23 @@ export function AnnotationsLayer() {
3602
4440
  return () => document.removeEventListener('keydown', onKey, true);
3603
4441
  }, [annotSel, chainCreate, copySelection]);
3604
4442
 
4443
+ // V2-4.2 — the project menu's Cut / Copy / Paste on the `run-action` lane (V2-1.3 §5.7), only from
4444
+ // the shell itself. They reach the same functions ⌘X / ⌘C / the context menu's Paste do.
4445
+ useEffect(() => {
4446
+ if (typeof window === 'undefined') return;
4447
+ const onRunAction = (e: MessageEvent) => {
4448
+ if (e.source !== window.parent) return;
4449
+ const m = e.data as { dgn?: string; v?: unknown; id?: unknown } | null;
4450
+ if (!m || m.dgn !== 'run-action' || m.v !== 1) return;
4451
+ if (m.id === 'edit.copy') copySelection(false);
4452
+ else if (m.id === 'edit.cut') copySelection(true);
4453
+ // Paste is not read here: the frame may not read the clipboard (DDR-054). The shell's Edit › Paste
4454
+ // forwards what it read as `paste-data`, replayed as a paste event (canvas-shell.tsx).
4455
+ };
4456
+ window.addEventListener('message', onRunAction);
4457
+ return () => window.removeEventListener('message', onRunAction);
4458
+ }, [copySelection]);
4459
+
3605
4460
  // FigJam v3 — paste strokes. ⌘C serialized the selection as a JSON text
3606
4461
  // payload; this CAPTURE-phase listener claims it before the media-intake
3607
4462
  // hook (bubble phase) so a strokes payload never falls through to the URL/
@@ -3668,7 +4523,7 @@ export function AnnotationsLayer() {
3668
4523
  const [addTextHintId, setAddTextHintId] = useState<string | null>(null);
3669
4524
  useEffect(() => {
3670
4525
  if (typeof document === 'undefined') return;
3671
- if (tool !== 'move') {
4526
+ if (!annotationPicks(tool, posture)) {
3672
4527
  setAddTextHintId(null);
3673
4528
  return;
3674
4529
  }
@@ -3687,7 +4542,7 @@ export function AnnotationsLayer() {
3687
4542
  };
3688
4543
  document.addEventListener('pointermove', onMove, { passive: true });
3689
4544
  return () => document.removeEventListener('pointermove', onMove);
3690
- }, [tool]);
4545
+ }, [tool, posture]);
3691
4546
 
3692
4547
  // FigJam v3 — connector draft: dragging from a connection dot (the side
3693
4548
  // magnets shown on a selected bindable shape) draws a BOUND curved
@@ -3705,7 +4560,7 @@ export function AnnotationsLayer() {
3705
4560
  connDraftRef.current = connDraft;
3706
4561
  useEffect(() => {
3707
4562
  if (typeof document === 'undefined') return;
3708
- if (tool !== 'move') return;
4563
+ if (!annotationPicks(tool, posture)) return;
3709
4564
  const onDown = (e: PointerEvent): Claim => {
3710
4565
  if (isMediaPlayerTarget(e)) return; // mediaref inline player owns this event
3711
4566
  if (e.button !== 0) return;
@@ -3787,16 +4642,35 @@ export function AnnotationsLayer() {
3787
4642
  };
3788
4643
  };
3789
4644
  return pipeline.add({ priority: 2, name: 'connector', down: onDown });
3790
- }, [pipeline, tool, screenToWorld, commitStrokes, annotSel, theme]);
4645
+ }, [pipeline, tool, posture, screenToWorld, commitStrokes, annotSel, theme]);
3791
4646
 
3792
4647
  // FigJam v3 — right-click on a stroke SELECTS it (keeping a multi-selection
3793
4648
  // the press lands inside) and opens the annotation context menu (z-order,
3794
4649
  // group, copy/paste, delete). Capture phase on document so it claims the
3795
4650
  // event before the input-router's host-level contextmenu handler.
3796
4651
  const [ctxMenu, setCtxMenu] = useState<{ x: number; y: number } | null>(null);
4652
+ // S4.12 - what the menu offers a sole sticky / section (canvas 15 an-convert, an-section).
4653
+ const soleSelected =
4654
+ annotSel?.selectedIds.length === 1
4655
+ ? strokesById.get(annotSel.selectedIds[0] as string)
4656
+ : undefined;
4657
+ const stickyMenu =
4658
+ soleSelected?.tool === 'sticky'
4659
+ ? {
4660
+ resolveWord:
4661
+ resolveVerb(strokes, [soleSelected.id]) === 'reopen'
4662
+ ? ('Reopen' as const)
4663
+ : ('Resolve' as const),
4664
+ canFanOut: stackMembers(stickyBoxes(strokes), soleSelected.id).length > 1,
4665
+ }
4666
+ : null;
4667
+ const sectionMenu =
4668
+ soleSelected?.tool === 'section'
4669
+ ? { foldWord: soleSelected.folded ? ('Unfold' as const) : ('Fold' as const) }
4670
+ : null;
3797
4671
  useEffect(() => {
3798
4672
  if (typeof document === 'undefined') return;
3799
- if (tool !== 'move') return;
4673
+ if (!annotationPicks(tool, posture)) return;
3800
4674
  if (!annotSel) return;
3801
4675
  const strokeAt = (target: Element | null): string | null => {
3802
4676
  if (target?.closest?.(CHROME_SELECTOR)) return null;
@@ -3834,7 +4708,7 @@ export function AnnotationsLayer() {
3834
4708
  document.removeEventListener('contextmenu', onCtx, true);
3835
4709
  unstage();
3836
4710
  };
3837
- }, [pipeline, tool, annotSel]);
4711
+ }, [pipeline, tool, posture, annotSel]);
3838
4712
 
3839
4713
  // Keyboard: arrow nudge + Backspace/Delete remove selected strokes.
3840
4714
  useEffect(() => {
@@ -3883,20 +4757,8 @@ export function AnnotationsLayer() {
3883
4757
  const sel = annotSel.selectedIds;
3884
4758
  if (action === 'copy') copySelection(false);
3885
4759
  else if (action === 'cut') copySelection(true);
3886
- else if (action === 'paste') {
3887
- try {
3888
- void navigator.clipboard
3889
- ?.readText()
3890
- .then((t) => {
3891
- pasteStrokesText(t);
3892
- })
3893
- .catch(() => {
3894
- /* clipboard read blocked — paste is best-effort from the menu */
3895
- });
3896
- } catch {
3897
- /* clipboard API absent */
3898
- }
3899
- } else if (action === 'duplicate') {
4760
+ // 'paste' rests in the menu (no in-frame clipboard read — PASTE_KEY_REASON); ⌘V is the paste event
4761
+ else if (action === 'duplicate') {
3900
4762
  const ids = store.duplicateSelection(sel, 16, 16);
3901
4763
  if (ids.length) annotSel.replace(ids);
3902
4764
  } else if (action === 'delete') {
@@ -3916,6 +4778,19 @@ export function AnnotationsLayer() {
3916
4778
  store.ungroupSelection(sel);
3917
4779
  } else if (action === 'lock' || action === 'unlock') {
3918
4780
  store.setLocked(sel, action === 'lock');
4781
+ } else if (
4782
+ action === 'resolve' ||
4783
+ action === 'fan-out' ||
4784
+ action === 'fold' ||
4785
+ action === 'to-comment'
4786
+ ) {
4787
+ runAnnotationActionRef.current(`annotation.${action}`);
4788
+ } else if (action === 'history') {
4789
+ // the sticky menu shows for a sole sticky, so the shell already heard it in `annotation-selection`
4790
+ // (object-history-ask.js checks that); the shell runs `history.object`
4791
+ if (sel.length === 1) postToShell({ dgn: 'object-history', annotation: sel[0] });
4792
+ } else if (action === 'ask-ai') {
4793
+ askAiRef.current();
3919
4794
  } else if (action === 'replace') {
3920
4795
  // Stage F3 — "Replace…" on an ImageStroke/MediaRefStroke. The canvas
3921
4796
  // REQUESTS (untrusted-origin postMessage, DDR-054); the main-origin shell
@@ -3951,9 +4826,121 @@ export function AnnotationsLayer() {
3951
4826
  }
3952
4827
  }
3953
4828
  },
3954
- [annotSel, copySelection, pasteStrokesText, strokesById]
4829
+ [annotSel, copySelection, strokesById]
3955
4830
  );
3956
4831
 
4832
+ // S4.12 - stickies and sections up close. One entry point for the menu rows, the small toolbar and the
4833
+ // registry actions (`run-action` from ⌘K / the keyboard): resolve, fan out, fold, turn into a comment, and
4834
+ // the ⌘K clean-up of resolved stickies. Every write is one `commitStrokes` = one undo step.
4835
+ const runAnnotationAction = useCallback(
4836
+ (id: string): boolean => {
4837
+ const cur = strokesRef.current;
4838
+ const sel = annotSel?.selectedIds ?? [];
4839
+ const me = collab?.myName ?? 'Someone';
4840
+ const say = (message: string, undo: boolean) => {
4841
+ if (!postToShell({ dgn: 'annotation-toast', v: 1, message, undo }))
4842
+ showCanvasToast(message);
4843
+ };
4844
+ switch (id) {
4845
+ case 'annotation.resolve': {
4846
+ const verb = resolveVerb(cur, sel);
4847
+ if (!verb) return false;
4848
+ const next = toggleResolved(cur, sel, me, new Date().toISOString());
4849
+ commitStrokes(cur, next, verb === 'reopen' ? 'reopen sticky' : 'resolve sticky');
4850
+ return true;
4851
+ }
4852
+ case 'annotation.fan-out': {
4853
+ const placed = stickyBoxes(cur);
4854
+ const picked = placed.filter((p) => sel.includes(p.id));
4855
+ const ids =
4856
+ picked.length >= 2
4857
+ ? picked.map((p) => p.id)
4858
+ : stackMembers(placed, picked[0]?.id ?? '');
4859
+ const row = fanOut(placed.filter((p) => ids.includes(p.id)));
4860
+ if (row.length === 0) return false;
4861
+ const at = new Map(row.map((r) => [r.id, r]));
4862
+ const next = cur.map((x) => {
4863
+ const r = at.get(x.id);
4864
+ return r && x.tool === 'sticky' ? ({ ...x, x: r.x, y: r.y } as Stroke) : x;
4865
+ });
4866
+ commitStrokes(cur, recomputeBoundArrows(next), 'fan out stickies');
4867
+ return true;
4868
+ }
4869
+ case 'annotation.fold': {
4870
+ const verb = foldVerb(cur, sel);
4871
+ if (!verb) return false;
4872
+ let next = cur;
4873
+ for (const sid of sel) next = setFolded(next, sid, verb === 'fold');
4874
+ commitStrokes(cur, next, verb === 'fold' ? 'fold section' : 'unfold section');
4875
+ return true;
4876
+ }
4877
+ case 'annotation.to-comment': {
4878
+ const only = sel.length === 1 ? cur.find((x) => x.id === sel[0]) : undefined;
4879
+ if (!only || only.tool !== 'sticky') return false;
4880
+ return postToShell({ dgn: 'annotation-to-comment', id: only.id });
4881
+ }
4882
+ case 'annotations.select-resolved': {
4883
+ const ids = selectResolvedIds(cur);
4884
+ if (ids.length === 0) say(NO_RESOLVED_LINE, false);
4885
+ else annotSel?.replace(ids);
4886
+ return true;
4887
+ }
4888
+ case 'annotations.trash-resolved': {
4889
+ const ids = withoutResolvedStickies(cur).ids;
4890
+ if (ids.length === 0) {
4891
+ say(NO_RESOLVED_LINE, false);
4892
+ return true;
4893
+ }
4894
+ // The same delete ⌫ does (arrows bound to a removed sticky keep their end), so ⌘Z restores all.
4895
+ strokesStoreRef.current.deleteStrokes(ids);
4896
+ annotSel?.clear();
4897
+ say(trashedLine(ids.length), true);
4898
+ return true;
4899
+ }
4900
+ default:
4901
+ return false;
4902
+ }
4903
+ },
4904
+ [annotSel, collab?.myName, commitStrokes]
4905
+ );
4906
+ runAnnotationActionRef.current = runAnnotationAction;
4907
+ // ⌘/ with annotations selected asks the AI about them (registry `annotation.ask-ai`, Preview only; in Edit
4908
+ // ⌘/ is `ai.ask-selection`'s). The shell opens the chat; the scope is the `annotation-selection` above.
4909
+ askAiRef.current = () => {
4910
+ if ((annotSel?.selectedIds.length ?? 0) === 0) return;
4911
+ postToShell({ dgn: 'annotation-ask-ai', v: 1 });
4912
+ };
4913
+ useEffect(() => {
4914
+ if (typeof document === 'undefined' || posture !== 'drawn') return;
4915
+ const onKey = (e: KeyboardEvent) => {
4916
+ if (e.key !== '/' || !(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return;
4917
+ if (isEditable(e.target) || (annotSel?.selectedIds.length ?? 0) === 0) return;
4918
+ e.preventDefault();
4919
+ askAiRef.current();
4920
+ };
4921
+ document.addEventListener('keydown', onKey, true);
4922
+ return () => document.removeEventListener('keydown', onKey, true);
4923
+ }, [annotSel, posture]);
4924
+
4925
+ // S4.12 - the AI chat's scope: what is selected, coalesced to one message per 50 ms (S4-S5 §1).
4926
+ const scopeSentRef = useRef('');
4927
+ const selIdsKey = (annotSel?.selectedIds ?? []).join(',');
4928
+ // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the selection ids + board
4929
+ useEffect(() => {
4930
+ const t = window.setTimeout(() => {
4931
+ const scope = selectionScope(
4932
+ strokesRef.current,
4933
+ annotSel?.selectedIds ?? [],
4934
+ (sid) => board.committed.get(sid)?.parentArtboard as string | undefined
4935
+ );
4936
+ const key = scopeKey(scope);
4937
+ if (key === scopeSentRef.current) return;
4938
+ scopeSentRef.current = key;
4939
+ postToShell({ dgn: 'annotation-selection', ...scope });
4940
+ }, 50);
4941
+ return () => window.clearTimeout(t);
4942
+ }, [selIdsKey, boardVersion]);
4943
+
3957
4944
  // FigJam v3 — first time a multi-selection lands, surface the group /
3958
4945
  // duplicate affordances once (behaviour-triggered, never a tour).
3959
4946
  const selCount = annotSel?.selectedIds.length ?? 0;
@@ -3976,8 +4963,9 @@ export function AnnotationsLayer() {
3976
4963
  // requiring a right-click detour to reach it was pure friction. Same
3977
4964
  // `edit-annotation-photo-request` message + confused-deputy gate (DDR-054)
3978
4965
  // the context-menu action already used.
4966
+ // S4.19 G6 - a gallery sticker is annotation chrome: it selects with the small toolbar, not the Photo tab.
3979
4967
  const singleSelectedImageId =
3980
- selCount === 1 && strokesById.get(annotSel?.selectedIds[0] as string)?.tool === 'image'
4968
+ selCount === 1 && opensPhotoInspector(strokesById.get(annotSel?.selectedIds[0] as string))
3981
4969
  ? (annotSel?.selectedIds[0] as string)
3982
4970
  : null;
3983
4971
  useEffect(() => {
@@ -3994,6 +4982,15 @@ export function AnnotationsLayer() {
3994
4982
  }
3995
4983
  }, [singleSelectedImageId, strokesById]);
3996
4984
 
4985
+ // 15 an-stk-drop - the dock keeps Stickers (E) pressed while exactly one gallery sticker is selected (the drop
4986
+ // selects what it placed); the palette reads this through toolbars/shell-panels.ts.
4987
+ const oneStickerSelected =
4988
+ selCount === 1 && isGallerySticker(strokesById.get(annotSel?.selectedIds[0] as string));
4989
+ useEffect(() => {
4990
+ setStickerSelected(oneStickerSelected);
4991
+ return () => setStickerSelected(false);
4992
+ }, [oneStickerSelected]);
4993
+
3997
4994
  // Selected stroke halos — bboxes in world coords, vector-effect non-scaling-stroke.
3998
4995
  const selectedStrokes = useMemo(() => {
3999
4996
  if (!annotSel || annotSel.selectedIds.length === 0) return [] as Stroke[];
@@ -4011,9 +5008,49 @@ export function AnnotationsLayer() {
4011
5008
  return selectedStrokes.some((s) => locked.has(s.id));
4012
5009
  }, [selectedStrokes, strokes]);
4013
5010
 
5011
+ // S4.11 — what the arrow cards draw: the aim, the lost ends, the selected arrow's rewritten rings.
5012
+ const selectedArrow =
5013
+ selectedStrokes.length === 1 && selectedStrokes[0]?.tool === 'arrow'
5014
+ ? (selectedStrokes[0] as ArrowStroke)
5015
+ : null;
5016
+ const arrowUi: ArrowUi = {
5017
+ aim: aim && (tool === 'arrow' || pointTo) ? aim : null,
5018
+ boundTag,
5019
+ dangling: danglingCards,
5020
+ selectedArrowId: selectedArrow?.id ?? null,
5021
+ rewritten: selectedArrow && liveRects ? rewrittenFor(selectedArrow, liveRects) : [],
5022
+ onPointTo: (arrowId, end) => setPointTo({ arrowId, end }),
5023
+ canEdit: !quiet,
5024
+ labelEditId: labelEdit,
5025
+ onLabelCommit: commitLabel,
5026
+ onLabelCancel: () => setLabelEdit(null),
5027
+ boards,
5028
+ };
5029
+
4014
5030
  return (
4015
5031
  <AnnotationPipelineContext.Provider value={pipeline}>
4016
5032
  <StrokesStoreContext.Provider value={strokesStore}>
5033
+ <LockedDragTip at={lockedTip} onDone={clearLockedTip} />
5034
+ <LockedDragTip
5035
+ at={quiet ? quietTip : null}
5036
+ onDone={clearQuietTip}
5037
+ text={QUIET_MOVE_TIP}
5038
+ testId="annotation-quiet-tip"
5039
+ holdMs={2400}
5040
+ />
5041
+ <PlacementGhost
5042
+ pending={pendingFor(placing, visible)}
5043
+ zoom={vp?.zoom || 1}
5044
+ resolveAsset={resolveAssetHref}
5045
+ templateSize={templateExtent}
5046
+ onPlace={(at) => {
5047
+ if (placing && placeRef.current(placing, at)) setPlacing(null);
5048
+ }}
5049
+ onCancel={() => {
5050
+ postStampDisarmed(placing);
5051
+ setPlacing(null);
5052
+ }}
5053
+ />
4017
5054
  <AnnotationsInput
4018
5055
  isActive={isActive}
4019
5056
  visible={visible}
@@ -4021,14 +5058,19 @@ export function AnnotationsLayer() {
4021
5058
  beginStroke={beginStroke}
4022
5059
  moveStroke={moveStroke}
4023
5060
  endStroke={endStroke}
4024
- onLeave={() => setGhost(null)}
5061
+ onLeave={() => {
5062
+ setGhost(null);
5063
+ aimRectsRef.current = null;
5064
+ updateAim(0, 0, false);
5065
+ }}
4025
5066
  />
4026
5067
  {visible ? (
4027
5068
  <AnnotationsSvg
4028
5069
  worldRef={worldRef}
4029
- strokes={renderStrokes}
5070
+ strokes={shownStrokes}
5071
+ quiet={quiet}
4030
5072
  anchorsById={anchorsById}
4031
- selectMode={tool === 'move'}
5073
+ selectMode={annotationPicks(tool, posture) && !quiet}
4032
5074
  selectedStrokes={selectedStrokes}
4033
5075
  selectionLocked={selectionLocked}
4034
5076
  marquee={marquee}
@@ -4048,12 +5090,20 @@ export function AnnotationsLayer() {
4048
5090
  gestureState={gestureState}
4049
5091
  editNotice={editGone ? 'deleted' : remoteEdited ? 'edited' : null}
4050
5092
  unknownElements={unknownElements}
5093
+ arrowUi={arrowUi}
5094
+ foldNotes={foldNotes}
5095
+ />
5096
+ ) : null}
5097
+ {visible && !quiet ? (
5098
+ <BelongsOutline
5099
+ worldRef={worldRef}
5100
+ artboard={belongsTo(selectedStrokes, board.committed)}
4051
5101
  />
4052
5102
  ) : null}
4053
5103
  {/* DDR-150 dogfood #8 — inline players for media-reference chips (HTML
4054
5104
  overlay in the world div; see MediaRefPlayers for why not
4055
5105
  foreignObject). */}
4056
- <MediaRefPlayers worldRef={worldRef} strokes={renderStrokes} visible={visible} />
5106
+ <MediaRefPlayers worldRef={worldRef} strokes={shownStrokes} visible={visible} />
4057
5107
  <AnnotationContextToolbar
4058
5108
  editingId={
4059
5109
  editingTarget?.kind === 'anchored'
@@ -4080,30 +5130,14 @@ export function AnnotationsLayer() {
4080
5130
  selectedStrokes[0]?.tool === 'image' &&
4081
5131
  /assets\/[0-9a-f]{8}\.[a-z0-9]+/i.test((selectedStrokes[0] as ImageStroke).href || '')
4082
5132
  }
5133
+ sticky={stickyMenu}
5134
+ section={sectionMenu}
4083
5135
  onAction={onMenuAction}
4084
5136
  onClose={() => setCtxMenu(null)}
4085
5137
  />
4086
5138
  ) : null}
4087
- {visible && tool === 'move' ? <AnnotationResizeOverlay store={strokesStore} /> : null}
4088
- {isActive ? (
4089
- <AnnotationsChrome
4090
- tool={tool}
4091
- theme={theme}
4092
- color={color}
4093
- setColor={setColor}
4094
- stickyColor={stickyColor}
4095
- setStickyColor={setStickyColor}
4096
- highlighterColor={highlighterColor}
4097
- setHighlighterColor={setHighlighterColor}
4098
- highlighterWidth={highlighterWidth}
4099
- setHighlighterWidth={setHighlighterWidth}
4100
- supportsFill={supportsFill}
4101
- fill={fill}
4102
- setFill={setFill}
4103
- supportsThickness={supportsThickness}
4104
- thickness={thickness}
4105
- setThickness={setThickness}
4106
- />
5139
+ {visible && !quiet && annotationPicks(tool, posture) ? (
5140
+ <AnnotationResizeOverlay store={strokesStore} />
4107
5141
  ) : null}
4108
5142
  </StrokesStoreContext.Provider>
4109
5143
  </AnnotationPipelineContext.Provider>
@@ -4199,6 +5233,7 @@ function AnnotationsSvg({
4199
5233
  strokes,
4200
5234
  anchorsById,
4201
5235
  selectMode,
5236
+ quiet,
4202
5237
  selectedStrokes,
4203
5238
  selectionLocked,
4204
5239
  marquee,
@@ -4218,9 +5253,15 @@ function AnnotationsSvg({
4218
5253
  editNotice,
4219
5254
  gestureState,
4220
5255
  unknownElements,
5256
+ arrowUi,
5257
+ foldNotes,
4221
5258
  }: {
4222
5259
  worldRef: ReturnType<typeof useWorldRefContext>;
5260
+ /** S4.12 - folded section id -> its count line. */
5261
+ foldNotes: ReadonlyMap<string, string>;
4223
5262
  strokes: readonly Stroke[];
5263
+ /** S4.11 — aiming, lost ends, labels and the artboards an elbow routes around. */
5264
+ arrowUi: ArrowUi;
4224
5265
  /** Elements of a type this build does not know — drawn as placeholders, never dropped. */
4225
5266
  unknownElements: readonly AnnotationElement[];
4226
5267
  /** Idle-typing draft of the open editor (Task 19). */
@@ -4233,6 +5274,8 @@ function AnnotationsSvg({
4233
5274
  editNotice: 'edited' | 'deleted' | null;
4234
5275
  anchorsById: Map<string, AnchorHost>;
4235
5276
  selectMode: boolean;
5277
+ /** S4.9 - Edit's posture: faded, readable, click-through (annotations/ui/posture.ts). */
5278
+ quiet: boolean;
4236
5279
  selectedStrokes: readonly Stroke[];
4237
5280
  /** #137 — a locked member pins the selection: no handles, a lock badge. */
4238
5281
  selectionLocked: boolean;
@@ -4274,10 +5317,35 @@ function AnnotationsSvg({
4274
5317
  return () => clearTimeout(id);
4275
5318
  }, [worldRef]);
4276
5319
  // DDR-242 AD7/AD8 — one node per element, text as HTML (annotations/ui/).
5320
+ const restRouter = useMemo(() => createArrowRouter(), []);
5321
+ const zoomNow = useLiveViewport().zoom || 1;
5322
+ const { boards: restBoards, dangling: lostEnds } = arrowUi;
5323
+ const moving = gestureState !== 'idle';
4277
5324
  const baseItems = useMemo(
4278
- () => renderItemsFromStrokes(strokes, unknownElements),
4279
- [strokes, unknownElements]
5325
+ () =>
5326
+ markDangling(
5327
+ routeElbowsAtRest(
5328
+ renderItemsFromStrokes(strokes, unknownElements),
5329
+ restBoards,
5330
+ restRouter,
5331
+ moving ? 'drag' : 'settle'
5332
+ ),
5333
+ lostEnds
5334
+ ),
5335
+ [strokes, unknownElements, restBoards, restRouter, moving, lostEnds]
4280
5336
  );
5337
+ // S4.13 - the stamps gather into clusters on their target: where an artboard sits and what it is called.
5338
+ const stampHosts = useMemo(() => {
5339
+ if (!baseItems.some((it) => it.el.type === 'stamp')) return undefined;
5340
+ const boards = canvasRectsNow()?.artboards ?? [];
5341
+ return {
5342
+ box: (t: string) => {
5343
+ const a = t.startsWith('ab:') ? boards.find((b) => b.id === t.slice(3)) : undefined;
5344
+ return a ? { x: a.x, y: a.y, w: a.w, h: a.h } : null;
5345
+ },
5346
+ label: (t: string | null) => (t?.startsWith('ab:') ? artboardLabelNow(t.slice(3)) : ''),
5347
+ };
5348
+ }, [baseItems]);
4281
5349
  // The element whose text slot is open: a shape's label edits on the shape,
4282
5350
  // everything else on itself; `pending` is a caret not yet backed by an element.
4283
5351
  const editingId =
@@ -4338,21 +5406,93 @@ function AnnotationsSvg({
4338
5406
  onCancel: () => cancelRef.current(),
4339
5407
  };
4340
5408
  }, [sessionKey, editNotice]);
5409
+ // S4.9 (an-crowd) - below 25 % the stickies and sections draw as a mosaic (annotations/ui/lod.tsx).
5410
+ // The PUBLISHED zoom (settle cadence), so a pinch never flips it mid-gesture.
5411
+ const lodCtl = useViewportControllerContext();
5412
+ const lodZoom = lodCtl?.viewport?.zoom ?? 1;
5413
+ const lod = useMemo(
5414
+ () => (inMosaic(lodZoom) && !editingId ? lodModel(strokes) : null),
5415
+ [lodZoom, editingId, strokes]
5416
+ );
5417
+ if (lod) items = items.filter((it) => !lod.covered.has(it.el.id));
5418
+ const zoomToRect = useCallback(
5419
+ (r: Rect) => {
5420
+ lodCtl?.jumpTo(r as unknown as Parameters<NonNullable<typeof lodCtl>['jumpTo']>[0]);
5421
+ },
5422
+ [lodCtl]
5423
+ );
4341
5424
  const target = worldRef?.current ?? null;
5425
+ // S4.12 - the author line follows the selection; a collaborator typing in a sticky edges it in their colour.
5426
+ const selectedIdSet = useMemo(() => new Set(selectedStrokes.map((s) => s.id)), [selectedStrokes]);
5427
+ const collab = useCollab();
5428
+ const peers = useForeignAwareness();
5429
+ const typists = useMemo(() => {
5430
+ const m = new Map<string, string>();
5431
+ for (const p of peers) {
5432
+ const g = p.annotationGesture;
5433
+ if (g?.kind !== 'type') continue;
5434
+ for (const id of g.ids.slice(0, 4)) m.set(id, colorForName(p.name ?? ''));
5435
+ }
5436
+ return m;
5437
+ }, [peers]);
5438
+ const labelItem = arrowUi.labelEditId
5439
+ ? items.find((it) => it.el.id === arrowUi.labelEditId && it.ends)
5440
+ : undefined;
4342
5441
  if (!target) return null;
4343
5442
  return (
4344
5443
  <>
5444
+ <AiSeenRings />
5445
+ {lod
5446
+ ? createPortal(
5447
+ <LodMosaic model={lod} zoom={lodZoom} quiet={quiet} onZoomTo={zoomToRect} />,
5448
+ target
5449
+ )
5450
+ : null}
4345
5451
  {createPortal(
4346
5452
  <AnnotationScene
4347
5453
  items={items}
4348
5454
  interactive={selectMode}
5455
+ quiet={quiet}
4349
5456
  editingId={editingId}
4350
5457
  edit={edit}
4351
5458
  pending={pending}
4352
5459
  resolveAsset={resolveAssetHref}
5460
+ selectedIds={selectedIdSet}
5461
+ me={collab?.myName ?? null}
5462
+ typists={typists}
5463
+ foldNotes={foldNotes}
5464
+ stampHosts={stampHosts}
4353
5465
  />,
4354
5466
  target
4355
5467
  )}
5468
+ {createPortal(
5469
+ <div className="dc-annot-arrowui">
5470
+ {arrowUi.aim ? <AimOverlay aim={arrowUi.aim} zoom={zoomNow} /> : null}
5471
+ {arrowUi.boundTag ? (
5472
+ <BoundTag text={arrowUi.boundTag.text} at={arrowUi.boundTag.at} zoom={zoomNow} />
5473
+ ) : null}
5474
+ <HostMarks
5475
+ zoom={zoomNow}
5476
+ dangling={arrowUi.dangling}
5477
+ selectedId={arrowUi.selectedArrowId}
5478
+ rewritten={arrowUi.rewritten}
5479
+ onPointTo={arrowUi.onPointTo}
5480
+ canEdit={arrowUi.canEdit}
5481
+ />
5482
+ {labelItem ? (
5483
+ <ArrowLabelEditor
5484
+ key={labelItem.el.id}
5485
+ at={labelPoint(labelItem.el, labelItem.ends as ResolvedEnds)}
5486
+ initial={typeof labelItem.el.label === 'string' ? labelItem.el.label : ''}
5487
+ zoom={zoomNow}
5488
+ onCommit={(text) => arrowUi.onLabelCommit(labelItem.el.id, text)}
5489
+ onCancel={arrowUi.onLabelCancel}
5490
+ />
5491
+ ) : null}
5492
+ <VoteDots zoom={zoomNow} />
5493
+ </div>,
5494
+ target
5495
+ )}
4356
5496
  {createPortal(
4357
5497
  <svg
4358
5498
  className="dc-annot-svg"
@@ -4410,7 +5550,7 @@ function AnnotationsSvg({
4410
5550
  y1={g.axis === 'x' ? g.from : g.at}
4411
5551
  x2={g.axis === 'x' ? g.at : g.to}
4412
5552
  y2={g.axis === 'x' ? g.to : g.at}
4413
- stroke="var(--maude-hud-accent, #d63b1f)"
5553
+ stroke="var(--maude-hud-accent, oklch(0.53 0.175 238))"
4414
5554
  strokeWidth={1}
4415
5555
  vectorEffect="non-scaling-stroke"
4416
5556
  pointerEvents="none"
@@ -4470,7 +5610,7 @@ function AnnotationsSvg({
4470
5610
  width={bb.w + 4}
4471
5611
  height={bb.h + 4}
4472
5612
  fill="none"
4473
- stroke="var(--maude-hud-accent, #d63b1f)"
5613
+ stroke="var(--maude-hud-accent, oklch(0.53 0.175 238))"
4474
5614
  strokeWidth={1.5}
4475
5615
  strokeDasharray="5 3"
4476
5616
  vectorEffect="non-scaling-stroke"
@@ -4483,7 +5623,7 @@ function AnnotationsSvg({
4483
5623
  y={resizeInfo.box.y + resizeInfo.box.h + 18}
4484
5624
  textAnchor="middle"
4485
5625
  fontSize={11}
4486
- fill="var(--maude-hud-accent, #d63b1f)"
5626
+ fill="var(--maude-hud-accent, oklch(0.53 0.175 238))"
4487
5627
  style={{
4488
5628
  fontFamily: 'var(--u-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)',
4489
5629
  }}
@@ -4493,6 +5633,13 @@ function AnnotationsSvg({
4493
5633
  </g>
4494
5634
  ) : null}
4495
5635
  {ghost ? <GhostPreview ghost={ghost} /> : null}
5636
+ {/* S4.13 - a sticker from the gallery says how big it is: "160 × 160" (corners keep it square). */}
5637
+ {selectedStrokes.length === 1 && isGallerySticker(selectedStrokes[0]) ? (
5638
+ <StickerSizeChip
5639
+ box={strokeBBox(selectedStrokes[0]) ?? { x: 0, y: 0, w: 0, h: 0 }}
5640
+ zoom={zoomNow}
5641
+ />
5642
+ ) : null}
4496
5643
  </svg>,
4497
5644
  target
4498
5645
  )}
@@ -4664,21 +5811,35 @@ function ConnectorDots({ stroke }: { stroke: Stroke }) {
4664
5811
  const dx = pt[0] - center[0];
4665
5812
  const dy = pt[1] - center[1];
4666
5813
  const len = Math.hypot(dx, dy) || 1;
5814
+ const cx = pt[0] + (dx / len) * offset;
5815
+ const cy = pt[1] + (dy / len) * offset;
5816
+ // 15 an-stk-drop: the board draws no dots beside a selected sticker/shape until a connector is
5817
+ // dragged. The magnet stays (a transparent hit circle carries the gesture) and its dot shows
5818
+ // under the pointer only.
4667
5819
  return (
4668
- <circle
4669
- key={`${nx}-${ny}`}
4670
- className="dc-annot-conn-dot"
4671
- data-host={stroke.id}
4672
- data-nx={nx}
4673
- data-ny={ny}
4674
- cx={pt[0] + (dx / len) * offset}
4675
- cy={pt[1] + (dy / len) * offset}
4676
- r={5 / zoom}
4677
- fill="var(--maude-hud-accent, #d63b1f)"
4678
- stroke="var(--maude-chrome-bg-0, #ffffff)"
4679
- strokeWidth={1.5 / zoom}
4680
- pointerEvents="all"
4681
- />
5820
+ <g key={`${nx}-${ny}`} className="dc-annot-conn">
5821
+ <circle
5822
+ className="dc-annot-conn-dot"
5823
+ data-host={stroke.id}
5824
+ data-nx={nx}
5825
+ data-ny={ny}
5826
+ cx={cx}
5827
+ cy={cy}
5828
+ r={11 / zoom}
5829
+ fill="transparent"
5830
+ pointerEvents="all"
5831
+ />
5832
+ <circle
5833
+ className="dc-annot-conn-vis"
5834
+ cx={cx}
5835
+ cy={cy}
5836
+ r={5 / zoom}
5837
+ fill="var(--maude-hud-accent, oklch(0.53 0.175 238))"
5838
+ stroke="var(--maude-chrome-bg-0, #ffffff)"
5839
+ strokeWidth={1.5 / zoom}
5840
+ pointerEvents="none"
5841
+ />
5842
+ </g>
4682
5843
  );
4683
5844
  })}
4684
5845
  </g>
@@ -4690,16 +5851,25 @@ function ConnectorDots({ stroke }: { stroke: Stroke }) {
4690
5851
  * `.dc-context-menu` visual language (stylesheet injected by context-menu.tsx)
4691
5852
  * so the annotation menu and the canvas menu read as one product surface.
4692
5853
  */
4693
- function AnnotationContextMenu({
5854
+ /** The annotation menu's Paste reason — CONTRACT.md's Edit-menu words (no in-frame clipboard read). */
5855
+ export const PASTE_KEY_REASON = 'Paste ⌘V';
5856
+
5857
+ export function AnnotationContextMenu({
4694
5858
  pos,
4695
5859
  selCount,
4696
5860
  canUngroup,
4697
5861
  allLocked,
4698
5862
  canReplace,
4699
5863
  canEditPhoto,
5864
+ sticky,
5865
+ section,
4700
5866
  onAction,
4701
5867
  onClose,
4702
5868
  }: {
5869
+ /** S4.12 - the sticky rows (canvas 15 an-convert): only for a sole sticky / section. */
5870
+ sticky?: { resolveWord: 'Resolve' | 'Reopen'; canFanOut: boolean } | null;
5871
+ /** S4.12 - the section rows: Fold / Unfold, and the AI question. */
5872
+ section?: { foldWord: 'Fold' | 'Unfold' } | null;
4703
5873
  pos: { x: number; y: number };
4704
5874
  selCount: number;
4705
5875
  canUngroup: boolean;
@@ -4746,13 +5916,15 @@ function AnnotationContextMenu({
4746
5916
  id: string,
4747
5917
  label: string,
4748
5918
  shortcut?: string,
4749
- opts?: { destructive?: boolean; disabled?: boolean }
5919
+ opts?: { destructive?: boolean; disabled?: boolean; reason?: string }
4750
5920
  ) => (
4751
5921
  <button
4752
5922
  type="button"
4753
5923
  role="menuitem"
4754
5924
  data-action={id}
5925
+ data-testid={`annot-menu-${id}`}
4755
5926
  disabled={opts?.disabled}
5927
+ {...reasonProps(!!opts?.disabled && !!opts?.reason, opts?.reason)}
4756
5928
  className={`dc-menu-item${opts?.destructive ? ' is-destructive' : ''}`}
4757
5929
  onClick={() => {
4758
5930
  if (opts?.disabled) return;
@@ -4772,9 +5944,29 @@ function AnnotationContextMenu({
4772
5944
  aria-label="Annotation actions"
4773
5945
  style={{ left: at.x, top: at.y }}
4774
5946
  >
5947
+ {sticky ? (
5948
+ <>
5949
+ {item('to-comment', 'Turn into a comment')}
5950
+ {item('resolve', sticky.resolveWord)}
5951
+ {sticky.canFanOut ? item('fan-out', 'Fan out') : null}
5952
+ {/* p8-dead-reasons — `history.object`: the shell opens Version history filtered to this sticky */}
5953
+ {item('history', 'Version history of this object')}
5954
+ <div className="dc-menu-sep" aria-hidden="true" />
5955
+ </>
5956
+ ) : null}
5957
+ {section ? (
5958
+ <>
5959
+ {item('fold', section.foldWord)}
5960
+ <div className="dc-menu-sep" aria-hidden="true" />
5961
+ </>
5962
+ ) : null}
4775
5963
  {item('copy', 'Copy', '⌘C')}
4776
5964
  {item('cut', 'Cut', '⌘X', { disabled: allLocked })}
4777
- {item('paste', 'Paste', '⌘V')}
5965
+ {/* p8-sweep-leftovers — this menu lives in the untrusted canvas frame, which may not read the clipboard
5966
+ (iframe `allow="clipboard-write"` only, DDR-054) and must not get the shell to read it on its own say
5967
+ (planted code could spam it). The row rests and points at the key: ⌘V raises a real paste event the
5968
+ frame does receive. Words: CONTRACT.md's Edit-menu entry "Paste ⌘V". */}
5969
+ {item('paste', 'Paste', '⌘V', { disabled: true, reason: PASTE_KEY_REASON })}
4778
5970
  {item('duplicate', 'Duplicate', '⌘D')}
4779
5971
  {canReplace ? item('replace', 'Replace…') : null}
4780
5972
  {canEditPhoto ? item('edit-photo', 'Edit Photo…') : null}
@@ -4787,12 +5979,33 @@ function AnnotationContextMenu({
4787
5979
  {item('group', 'Group selection', '⌘G', { disabled: selCount < 2 })}
4788
5980
  {canUngroup ? item('ungroup', 'Ungroup', '⌘⇧G') : null}
4789
5981
  {allLocked ? item('unlock', 'Unlock', '⌘⇧L') : item('lock', 'Lock', '⌘⇧L')}
5982
+ {sticky || section ? (
5983
+ <>
5984
+ <div className="dc-menu-sep" aria-hidden="true" />
5985
+ {item('ask-ai', sticky ? 'Ask AI about this sticky' : 'Ask AI about it', '⌘/')}
5986
+ </>
5987
+ ) : null}
4790
5988
  <div className="dc-menu-sep" aria-hidden="true" />
4791
- {item('delete', 'Delete', '⌫', { destructive: true, disabled: allLocked })}
5989
+ {item('delete', 'Move to trash', '⌫', { destructive: true, disabled: allLocked })}
4792
5990
  </div>
4793
5991
  );
4794
5992
  }
4795
5993
 
5994
+ /** S4.11 — everything the arrow cards need from the layer (annotations/ui/arrow-cards.tsx). */
5995
+ interface ArrowUi {
5996
+ aim: AimState | null;
5997
+ boundTag: { text: string; at: [number, number] } | null;
5998
+ dangling: DanglingCardModel[];
5999
+ selectedArrowId: string | null;
6000
+ rewritten: ReturnType<typeof rewrittenFor>;
6001
+ onPointTo: (arrowId: string, end: 'start' | 'end') => void;
6002
+ canEdit: boolean;
6003
+ labelEditId: string | null;
6004
+ onLabelCommit: (id: string, text: string) => void;
6005
+ onLabelCancel: () => void;
6006
+ boards: BoardRect[];
6007
+ }
6008
+
4796
6009
  /**
4797
6010
  * FigJam v3 — accent halo on the host a dragged arrow endpoint would bind to.
4798
6011
  * Pure chrome (pointer-events:none); renders nothing when no candidate.
@@ -4817,7 +6030,7 @@ function BindHintHalo({
4817
6030
  width={bbox.w + pad * 2}
4818
6031
  height={bbox.h + pad * 2}
4819
6032
  fill="none"
4820
- stroke="var(--maude-hud-accent, #d63b1f)"
6033
+ stroke="var(--maude-hud-accent, oklch(0.53 0.175 238))"
4821
6034
  strokeWidth={2}
4822
6035
  strokeOpacity={0.8}
4823
6036
  vectorEffect="non-scaling-stroke"
@@ -4863,7 +6076,7 @@ function SelectionHalo({
4863
6076
  width={bbox.w + pad * 2}
4864
6077
  height={bbox.h + pad * 2}
4865
6078
  fill="none"
4866
- stroke="var(--maude-hud-accent, #d63b1f)"
6079
+ stroke="var(--maude-hud-accent, oklch(0.53 0.175 238))"
4867
6080
  strokeWidth={multi ? 1.5 : 2}
4868
6081
  vectorEffect="non-scaling-stroke"
4869
6082
  pointerEvents="none"
@@ -4882,6 +6095,73 @@ function SelectionHalo({
4882
6095
  * #137 — a lock glyph at the selection's top-right corner: says why the
4883
6096
  * resize handles are missing. Counter-scaled to a constant screen size.
4884
6097
  */
6098
+ /**
6099
+ * S4.10 — the artboard a selection rides with: every selected element is top-level and names
6100
+ * the same `parentArtboard`. A section's items answer through their section (section wins).
6101
+ */
6102
+ export function belongsTo(
6103
+ selected: readonly { id: string }[],
6104
+ committed: ReadonlyMap<string, { parent?: string; parentArtboard?: unknown }>
6105
+ ): string | null {
6106
+ let ab: string | null = null;
6107
+ for (const s of selected) {
6108
+ let el = committed.get(s.id);
6109
+ for (let i = 0; el?.parent !== undefined && i < 64; i++) el = committed.get(el.parent);
6110
+ const p = el && typeof el.parentArtboard === 'string' ? el.parentArtboard : null;
6111
+ if (!p || (ab !== null && ab !== p)) return null;
6112
+ ab = p;
6113
+ }
6114
+ return ab;
6115
+ }
6116
+
6117
+ /**
6118
+ * S4.10 — membership you can see: the artboard a selection belongs to, outlined, with
6119
+ * "On <artboard> · moves with it" (canvas 15 `an-follow`). It follows a drag through the bus
6120
+ * imperatively (a translate per frame, no render).
6121
+ */
6122
+ function BelongsOutline({
6123
+ worldRef,
6124
+ artboard,
6125
+ }: {
6126
+ worldRef: RefObject<HTMLDivElement | null> | null;
6127
+ artboard: string | null;
6128
+ }) {
6129
+ const world = useArtboardsContext();
6130
+ const rect = artboard ? (world?.rectFor(artboard) ?? null) : null;
6131
+ const ref = useRef<HTMLSpanElement | null>(null);
6132
+ const idRef = useRef(artboard);
6133
+ idRef.current = artboard;
6134
+ useDragBusRide({
6135
+ frame: (f) => {
6136
+ const n = ref.current;
6137
+ if (!n) return;
6138
+ const m = f.moved.find((x) => x.id === idRef.current);
6139
+ if (f.phase === 'cancel' || !m || f.alt) n.style.translate = '';
6140
+ else if (f.phase !== 'end') n.style.translate = `${m.dx}px ${m.dy}px`;
6141
+ },
6142
+ });
6143
+ // The committed layout landed: the rect itself is the new position.
6144
+ // biome-ignore lint/correctness/useExhaustiveDependencies: reset on a new rect
6145
+ useLayoutEffect(() => {
6146
+ if (ref.current) ref.current.style.translate = '';
6147
+ }, [rect?.x, rect?.y]);
6148
+ const target = worldRef?.current ?? null;
6149
+ if (!artboard || !rect || !target) return null;
6150
+ return createPortal(
6151
+ <span
6152
+ ref={ref}
6153
+ className="dc-annot-belongs"
6154
+ data-testid="annot-belongs"
6155
+ data-artboard={artboard}
6156
+ aria-hidden="true"
6157
+ style={{ left: rect.x - 4, top: rect.y - 4, width: rect.w + 8, height: rect.h + 8 }}
6158
+ >
6159
+ <span className="dc-annot-belongs-t">On {artboardLabel(artboard)} · moves with it</span>
6160
+ </span>,
6161
+ target
6162
+ );
6163
+ }
6164
+
4885
6165
  function LockBadge({
4886
6166
  selectedStrokes,
4887
6167
  anchorsById,
@@ -4907,7 +6187,14 @@ function LockBadge({
4907
6187
  data-testid="annot-lock-badge"
4908
6188
  transform={`translate(${xMax + pad} ${yMin - size - pad}) scale(${size / 24})`}
4909
6189
  >
4910
- <rect x={-2} y={-2} width={28} height={28} rx={6} fill="var(--maude-hud-accent, #d63b1f)" />
6190
+ <rect
6191
+ x={-2}
6192
+ y={-2}
6193
+ width={28}
6194
+ height={28}
6195
+ rx={6}
6196
+ fill="var(--maude-hud-accent, oklch(0.53 0.175 238))"
6197
+ />
4911
6198
  <g fill="none" stroke="#fff" strokeWidth={2.2} strokeLinecap="round" strokeLinejoin="round">
4912
6199
  <rect x="5" y="11" width="14" height="9" rx="2" />
4913
6200
  <path d="M8 11V8a4 4 0 018 0v3" />
@@ -4979,7 +6266,7 @@ function AnnotGroupBbox({
4979
6266
  width={w}
4980
6267
  height={h}
4981
6268
  fill="none"
4982
- stroke="var(--maude-hud-accent, #d63b1f)"
6269
+ stroke="var(--maude-hud-accent, oklch(0.53 0.175 238))"
4983
6270
  strokeWidth={1}
4984
6271
  strokeDasharray="4 3"
4985
6272
  vectorEffect="non-scaling-stroke"
@@ -5011,7 +6298,7 @@ function AnnotGroupBbox({
5011
6298
  y={c.y}
5012
6299
  width={handle}
5013
6300
  height={handle}
5014
- fill="var(--maude-hud-accent, #d63b1f)"
6301
+ fill="var(--maude-hud-accent, oklch(0.53 0.175 238))"
5015
6302
  stroke="var(--maude-chrome-bg-0, #ffffff)"
5016
6303
  strokeWidth={1}
5017
6304
  vectorEffect="non-scaling-stroke"
@@ -5121,196 +6408,3 @@ function renderArrowPrimitive(p: SvgPrimitive, key: number): JSX.Element {
5121
6408
  return <circle key={key} cx={p.cx} cy={p.cy} r={p.r} fill={p.fill} />;
5122
6409
  }
5123
6410
  }
5124
-
5125
- // ─────────────────────────────────────────────────────────────────────────────
5126
- // Chrome — color swatches + (optional fill picker) + (optional thickness chip)
5127
- // + presentation toggle + help button.
5128
-
5129
- function AnnotationsChrome({
5130
- tool,
5131
- theme,
5132
- color,
5133
- setColor,
5134
- stickyColor,
5135
- setStickyColor,
5136
- highlighterColor,
5137
- setHighlighterColor,
5138
- highlighterWidth,
5139
- setHighlighterWidth,
5140
- supportsFill,
5141
- fill,
5142
- setFill,
5143
- supportsThickness,
5144
- thickness,
5145
- setThickness,
5146
- }: {
5147
- tool: Tool;
5148
- /** Canvas theme — the ink swatch (slot 8) renders the themed default so the
5149
- * active default reads true on dark canvases. */
5150
- theme: string;
5151
- color: string;
5152
- setColor: (c: string) => void;
5153
- stickyColor: string;
5154
- setStickyColor: (c: string) => void;
5155
- highlighterColor: string;
5156
- setHighlighterColor: (c: string) => void;
5157
- highlighterWidth: number;
5158
- setHighlighterWidth: (w: number) => void;
5159
- supportsFill: boolean;
5160
- fill: string | null;
5161
- setFill: (f: string | null) => void;
5162
- supportsThickness: boolean;
5163
- thickness: Thickness;
5164
- setThickness: (t: Thickness) => void;
5165
- }) {
5166
- // Sticky tool picks a paper tint (its own palette); every other draw tool
5167
- // picks ink from the stroke PALETTE.
5168
- if (tool === 'sticky') {
5169
- return (
5170
- <div className="dc-annot-chrome" role="toolbar" aria-label="Sticky note tools">
5171
- <div className="dc-annot-swatches" role="radiogroup" aria-label="Sticky color">
5172
- {STICKY_PALETTE.map((c) => (
5173
- <button
5174
- key={c}
5175
- type="button"
5176
- className="dc-annot-sw"
5177
- aria-pressed={c === stickyColor}
5178
- aria-label={`Sticky color ${c}`}
5179
- title={`Sticky color ${c}`}
5180
- style={{ background: c }}
5181
- onClick={() => setStickyColor(c)}
5182
- />
5183
- ))}
5184
- </div>
5185
- </div>
5186
- );
5187
- }
5188
- // Highlighter picks a translucent marker hue (item 8) — its own palette,
5189
- // mirroring sticky. Each swatch previews on a dark chip via its alpha.
5190
- if (tool === 'highlighter') {
5191
- return (
5192
- <div className="dc-annot-chrome" role="toolbar" aria-label="Highlighter tools">
5193
- <div className="dc-annot-swatches" role="radiogroup" aria-label="Highlighter color">
5194
- {HIGHLIGHTER_PALETTE.map((c) => (
5195
- <button
5196
- key={c}
5197
- type="button"
5198
- className="dc-annot-sw"
5199
- aria-pressed={c === highlighterColor}
5200
- aria-label={`Highlighter color ${c}`}
5201
- title={`Highlighter color ${c}`}
5202
- style={{ background: c }}
5203
- onClick={() => setHighlighterColor(c)}
5204
- />
5205
- ))}
5206
- </div>
5207
- <div className="dc-annot-sep" />
5208
- {/* Nib width — three filled dots of increasing size (item 8). */}
5209
- <div className="dc-annot-swatches" role="radiogroup" aria-label="Highlighter width">
5210
- {HIGHLIGHTER_WIDTHS.map((w) => {
5211
- const dot = Math.round(6 + (w / 28) * 8); // 8–14 px preview dot
5212
- return (
5213
- <button
5214
- key={w}
5215
- type="button"
5216
- className="dc-annot-ibtn"
5217
- aria-pressed={w === highlighterWidth}
5218
- aria-label={`Highlighter width ${w}`}
5219
- title={`Width ${w}px`}
5220
- onClick={() => setHighlighterWidth(w)}
5221
- >
5222
- <span
5223
- aria-hidden="true"
5224
- style={{
5225
- width: dot,
5226
- height: dot,
5227
- borderRadius: '50%',
5228
- background: 'currentColor',
5229
- display: 'inline-block',
5230
- }}
5231
- />
5232
- </button>
5233
- );
5234
- })}
5235
- </div>
5236
- </div>
5237
- );
5238
- }
5239
- return (
5240
- <div className="dc-annot-chrome" role="toolbar" aria-label="Annotation tools">
5241
- <div className="dc-annot-swatches" role="radiogroup" aria-label="Stroke color">
5242
- {STROKE_PALETTE.map((base, i) => {
5243
- // The last slot is the default ink — render it themed so the active
5244
- // default reads true on dark canvases (white-ish ink) without
5245
- // touching the other hues. Key by the immutable base hex so a theme
5246
- // flip recolours the swatch in place rather than remounting.
5247
- const c = i === STROKE_PALETTE.length - 1 ? resolveDefaultInk(theme) : base;
5248
- return (
5249
- <button
5250
- key={base}
5251
- type="button"
5252
- className="dc-annot-sw"
5253
- aria-pressed={c === color}
5254
- aria-label={`Color ${c}`}
5255
- title={`Color ${c}`}
5256
- style={{ background: c }}
5257
- onClick={() => setColor(c)}
5258
- />
5259
- );
5260
- })}
5261
- </div>
5262
- {supportsFill ? (
5263
- <>
5264
- <div className="dc-annot-sep" />
5265
- <div className="dc-annot-swatches" role="radiogroup" aria-label="Fill color">
5266
- <button
5267
- type="button"
5268
- className="dc-annot-fill dc-annot-fill--none"
5269
- aria-pressed={fill == null}
5270
- aria-label="No fill"
5271
- title="No fill"
5272
- onClick={() => setFill(null)}
5273
- />
5274
- {FILL_PALETTE.map((c) => (
5275
- <button
5276
- key={c}
5277
- type="button"
5278
- className="dc-annot-fill"
5279
- aria-pressed={c === fill}
5280
- aria-label={`Fill ${c}`}
5281
- title={`Fill ${c}`}
5282
- style={{ background: c }}
5283
- onClick={() => setFill(c)}
5284
- />
5285
- ))}
5286
- </div>
5287
- </>
5288
- ) : null}
5289
- {supportsThickness ? (
5290
- <>
5291
- <div className="dc-annot-sep" />
5292
- <button
5293
- type="button"
5294
- className="dc-annot-ibtn"
5295
- aria-label="Thin stroke"
5296
- aria-pressed={thickness === STROKE_WIDTH_THIN}
5297
- title="Thin (3px)"
5298
- onClick={() => setThickness(STROKE_WIDTH_THIN)}
5299
- >
5300
- <IconLineThin />
5301
- </button>
5302
- <button
5303
- type="button"
5304
- className="dc-annot-ibtn"
5305
- aria-label="Thick stroke"
5306
- aria-pressed={thickness === STROKE_WIDTH_THICK}
5307
- title="Thick (6px)"
5308
- onClick={() => setThickness(STROKE_WIDTH_THICK)}
5309
- >
5310
- <IconLineThick />
5311
- </button>
5312
- </>
5313
- ) : null}
5314
- </div>
5315
- );
5316
- }