@agent-native/core-corpus 0.213.1 → 0.216.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1108) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/actions/references/action-fields.md +1 -1
  3. package/corpus/templates/analytics/CHANGELOG.md +1 -0
  4. package/corpus/templates/analytics/changelog/2026-10-21-session-replay-quotas-count-the-compressed-size-analytics-st.md +6 -0
  5. package/corpus/templates/analytics/server/lib/session-replay.ts +40 -9
  6. package/corpus/templates/assets/.agents/skills/actions/references/action-fields.md +1 -1
  7. package/corpus/templates/brain/.agents/skills/actions/references/action-fields.md +1 -1
  8. package/corpus/templates/calendar/.agents/skills/actions/references/action-fields.md +1 -1
  9. package/corpus/templates/chat/.agents/skills/actions/references/action-fields.md +1 -1
  10. package/corpus/templates/clips/.agents/skills/actions/references/action-fields.md +1 -1
  11. package/corpus/templates/community/qr/package.json +1 -1
  12. package/corpus/templates/content/.agents/skills/actions/references/action-fields.md +1 -1
  13. package/corpus/templates/content/.agents/skills/content-product-development/references/verification.md +36 -0
  14. package/corpus/templates/content/.agents/skills/document-editing/SKILL.md +10 -0
  15. package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +26 -1
  16. package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +4 -2
  17. package/corpus/templates/content/CHANGELOG.md +51 -0
  18. package/corpus/templates/content/acceptance/_writers.ts +604 -0
  19. package/corpus/templates/content/acceptance/generate-action-registry.ts +10 -0
  20. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/create-document.json +75 -0
  21. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/duplicate-page.json +75 -0
  22. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/edit-document-find-and-replace-without-a-revision.json +75 -0
  23. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/edit-document-find-and-replace.json +75 -0
  24. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/edit-document-initializecontent.json +75 -0
  25. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/import-content.json +75 -0
  26. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-import-content-source-existing-page.json +75 -0
  27. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-import-content-source-new-page.json +75 -0
  28. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-sync-local-folder-source-changed-file.json +75 -0
  29. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-sync-local-folder-source-new-file.json +75 -0
  30. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/restore-document-version.json +75 -0
  31. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/set-document-property-primary-blocks-field.json +75 -0
  32. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/set-image-alt-text.json +75 -0
  33. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/undo-content-import.json +75 -0
  34. package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/update-document-browser-full-rewrite.json +75 -0
  35. package/corpus/templates/content/acceptance/known-loss.ts +69 -0
  36. package/corpus/templates/content/acceptance/round-trip-corpus.ts +1397 -0
  37. package/corpus/templates/content/actions/_blocks-field-identity.ts +35 -1
  38. package/corpus/templates/content/actions/_content-database-lifecycle.ts +11 -11
  39. package/corpus/templates/content/actions/_content-database-personal-view.ts +2 -0
  40. package/corpus/templates/content/actions/_content-favorites.ts +37 -0
  41. package/corpus/templates/content/actions/_database-membership-lock.ts +39 -8
  42. package/corpus/templates/content/actions/_database-navigation.ts +19 -21
  43. package/corpus/templates/content/actions/_database-row-batch.ts +41 -18
  44. package/corpus/templates/content/actions/_database-row-mutation.ts +17 -28
  45. package/corpus/templates/content/actions/_database-source-utils.ts +18 -1
  46. package/corpus/templates/content/actions/_database-utils.ts +3 -0
  47. package/corpus/templates/content/actions/_database-view-setup.ts +321 -11
  48. package/corpus/templates/content/actions/_document-edit-mutation.ts +33 -32
  49. package/corpus/templates/content/actions/_document-flush.ts +593 -171
  50. package/corpus/templates/content/actions/_document-save-locks.ts +54 -0
  51. package/corpus/templates/content/actions/_document-save-row.ts +133 -0
  52. package/corpus/templates/content/actions/_github-source.ts +18 -8
  53. package/corpus/templates/content/actions/_move-page-to-space.ts +189 -25
  54. package/corpus/templates/content/actions/_nfm-syntax.ts +2 -0
  55. package/corpus/templates/content/actions/_property-utils.ts +3 -0
  56. package/corpus/templates/content/actions/_row-lock-order.ts +115 -0
  57. package/corpus/templates/content/actions/create-content-database.ts +11 -0
  58. package/corpus/templates/content/actions/create-document.ts +13 -1
  59. package/corpus/templates/content/actions/delete-content-database.ts +17 -14
  60. package/corpus/templates/content/actions/delete-document-property.ts +5 -0
  61. package/corpus/templates/content/actions/delete-document.ts +270 -97
  62. package/corpus/templates/content/actions/edit-document.ts +18 -5
  63. package/corpus/templates/content/actions/export-document.ts +3 -0
  64. package/corpus/templates/content/actions/get-blocks-field-word-count.ts +22 -5
  65. package/corpus/templates/content/actions/import-content-source.ts +170 -54
  66. package/corpus/templates/content/actions/move-document.ts +191 -73
  67. package/corpus/templates/content/actions/pull-document.ts +8 -2
  68. package/corpus/templates/content/actions/remove-database-items.ts +23 -4
  69. package/corpus/templates/content/actions/restore-content-database.ts +76 -55
  70. package/corpus/templates/content/actions/restore-document-version.ts +19 -35
  71. package/corpus/templates/content/actions/restore-document.ts +65 -53
  72. package/corpus/templates/content/actions/rollback-created-slash-document.ts +11 -16
  73. package/corpus/templates/content/actions/set-document-property.ts +15 -1
  74. package/corpus/templates/content/actions/share-local-file-document.ts +18 -14
  75. package/corpus/templates/content/actions/suggest-document-edit.ts +2 -3
  76. package/corpus/templates/content/actions/sync-local-folder-source.ts +35 -1
  77. package/corpus/templates/content/actions/undo-content-import.ts +16 -12
  78. package/corpus/templates/content/actions/update-content-database-view.ts +20 -2
  79. package/corpus/templates/content/actions/update-document.ts +19 -14
  80. package/corpus/templates/content/actions/view-screen.ts +12 -0
  81. package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +1 -6
  82. package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +49 -3
  83. package/corpus/templates/content/app/components/editor/ContentImportDialog.tsx +2 -0
  84. package/corpus/templates/content/app/components/editor/DocumentBlockFields.tsx +53 -11
  85. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +608 -353
  86. package/corpus/templates/content/app/components/editor/StaticDocumentBody.tsx +765 -0
  87. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +233 -80
  88. package/corpus/templates/content/app/components/editor/blockFieldSaveController.ts +32 -3
  89. package/corpus/templates/content/app/components/editor/blockFieldSaveRegistry.ts +88 -23
  90. package/corpus/templates/content/app/components/editor/comment-anchors.ts +19 -0
  91. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +296 -87
  92. package/corpus/templates/content/app/components/editor/database/ListItemLayout.tsx +410 -0
  93. package/corpus/templates/content/app/components/editor/database/ListItemRow.tsx +426 -0
  94. package/corpus/templates/content/app/components/editor/database/ListView.tsx +136 -18
  95. package/corpus/templates/content/app/components/editor/database/navigation-state.ts +3 -0
  96. package/corpus/templates/content/app/components/editor/database/settings.tsx +3 -3
  97. package/corpus/templates/content/app/components/editor/database/view-config.ts +4 -0
  98. package/corpus/templates/content/app/components/editor/document-flush-participant.ts +253 -0
  99. package/corpus/templates/content/app/components/editor/editor-transaction-meta.ts +28 -0
  100. package/corpus/templates/content/app/components/editor/extensions/AudioBlock.tsx +2 -1
  101. package/corpus/templates/content/app/components/editor/extensions/ImageBlock.tsx +27 -6
  102. package/corpus/templates/content/app/components/editor/extensions/LocalMdxComponentNode.tsx +0 -1
  103. package/corpus/templates/content/app/components/editor/extensions/NotionExtensions.tsx +4 -4
  104. package/corpus/templates/content/app/components/editor/extensions/SuggestionHighlight.ts +24 -2
  105. package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +25 -6
  106. package/corpus/templates/content/app/components/editor/pending-document-persistence.ts +59 -1
  107. package/corpus/templates/content/app/components/editor/stored-body-images.ts +27 -0
  108. package/corpus/templates/content/app/components/editor/suggestions/presentation-rebase.ts +17 -0
  109. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +11 -4
  110. package/corpus/templates/content/app/components/trash/TrashBrowser.tsx +4 -1
  111. package/corpus/templates/content/app/global.css +34 -0
  112. package/corpus/templates/content/app/hooks/use-content-trash.ts +8 -0
  113. package/corpus/templates/content/app/i18n-data.ts +32 -0
  114. package/corpus/templates/content/app/import-messages.ts +25 -0
  115. package/corpus/templates/content/app/trash-messages.ts +16 -0
  116. package/corpus/templates/content/changelog/2026-10-16-a-page-open-in-a-tab-that-shows-it-s-in-the-trash-reopens-wi.md +6 -0
  117. package/corpus/templates/content/changelog/2026-10-16-a-page-restored-from-trash-returns-to-its-place-in-its-colle.md +6 -0
  118. package/corpus/templates/content/changelog/2026-10-16-agent-written-markdown-keeps-nested-lists-indented-with-spac.md +6 -0
  119. package/corpus/templates/content/changelog/2026-10-16-opening-a-page-you-can-edit-no-longer-rebuilds-its-editor-on.md +6 -0
  120. package/corpus/templates/content/changelog/2026-10-16-pages-moved-or-imported-at-the-same-time-can-no-longer-end-u.md +6 -0
  121. package/corpus/templates/content/changelog/2026-10-16-re-importing-a-markdown-export-of-a-page-no-longer-reports-t.md +6 -0
  122. package/corpus/templates/content/changelog/2026-10-16-saving-a-page-or-restoring-one-of-its-versions-no-longer-fai.md +6 -0
  123. package/corpus/templates/content/changelog/2026-10-17-agents-reading-a-page-you-have-open-no-longer-wait-or-fail-w.md +6 -0
  124. package/corpus/templates/content/changelog/2026-10-19-fresh-document-reads-require-confirmation-from-every-open-ed.md +6 -0
  125. package/corpus/templates/content/changelog/2026-10-19-list-rows-can-be-customized.md +6 -0
  126. package/corpus/templates/content/changelog/2026-10-19-list-views-fit-phone-screens.md +6 -0
  127. package/corpus/templates/content/changelog/2026-10-20-html-table-cells-preserve-a-trailing-backslash-when-opening-.md +6 -0
  128. package/corpus/templates/content/changelog/2026-10-20-preserve-empty-paragraph-colors-and-refuse-unsupported-inlin.md +6 -0
  129. package/corpus/templates/content/changelog/2026-10-20-the-advanced-filter-and-each-filter-group-inside-it-have-the.md +6 -0
  130. package/corpus/templates/content/changelog/2026-10-21-blocks-fields-keep-unconfirmed-saves-visible-and-agent-reads.md +6 -0
  131. package/corpus/templates/content/changelog/2026-10-21-preserve-compact-table-row-groups-and-report-invalid-block-colors.md +6 -0
  132. package/corpus/templates/content/changelog/2026-10-21-suggested-edits-show-an-agent-s-whole-reason-open-a-group-to.md +6 -0
  133. package/corpus/templates/content/changelog/2026-10-21-suggestions-keep-refusing-unmatched-emphasis-in-stored-markd.md +6 -0
  134. package/corpus/templates/content/changelog/2026-10-22-accept-remaining-and-reject-remaining-show-the-result-for-ev.md +6 -0
  135. package/corpus/templates/content/changelog/2026-10-22-accepting-a-group-of-suggested-edits-saves-faster-and-adds-o.md +6 -0
  136. package/corpus/templates/content/changelog/2026-10-22-agents-read-saved-page-text-after-failed-icon-change.md +6 -0
  137. package/corpus/templates/content/changelog/2026-10-22-changes-made-from-a-menu-or-popover-such-as-an-image-s-alt-t.md +6 -0
  138. package/corpus/templates/content/changelog/2026-10-22-text-an-agent-writes-inside-a-callout-column-or-synced-block.md +6 -0
  139. package/corpus/templates/content/e2e/auth-files.ts +28 -0
  140. package/corpus/templates/content/e2e/convergence-summary.ts +84 -29
  141. package/corpus/templates/content/e2e/gate-arm.ts +15 -0
  142. package/corpus/templates/content/e2e/global-setup.ts +43 -75
  143. package/corpus/templates/content/e2e/global-teardown.ts +34 -0
  144. package/corpus/templates/content/e2e/helpers.ts +598 -92
  145. package/corpus/templates/content/e2e/live-body-gate.ts +188 -0
  146. package/corpus/templates/content/e2e/playwright.config.ts +12 -3
  147. package/corpus/templates/content/e2e/server-identity.ts +47 -0
  148. package/corpus/templates/content/e2e/stored-form/collab-blocks.ts +123 -0
  149. package/corpus/templates/content/package.json +1 -1
  150. package/corpus/templates/content/scripts/_stored-form-census-kinds.ts +30 -2
  151. package/corpus/templates/content/scripts/historical-icon-apply.ts +9 -1
  152. package/corpus/templates/content/scripts/trace-startup.mjs +460 -133
  153. package/corpus/templates/content/server/db/exec.ts +58 -0
  154. package/corpus/templates/content/server/db/schema.ts +1 -0
  155. package/corpus/templates/content/server/lib/content-trash-purge.ts +208 -144
  156. package/corpus/templates/content/server/lib/document-metadata-updated-at.ts +43 -1
  157. package/corpus/templates/content/server/lib/document-revision.ts +23 -0
  158. package/corpus/templates/content/server/lib/live-body-writer.ts +199 -0
  159. package/corpus/templates/content/server/lib/notion-sync.ts +63 -29
  160. package/corpus/templates/content/server/lib/notion.ts +5 -5
  161. package/corpus/templates/content/server/lib/suggested-edits.ts +357 -230
  162. package/corpus/templates/content/server/plugins/db.ts +5 -0
  163. package/corpus/templates/content/server/routes/api/documents/[id]/move.patch.ts +50 -168
  164. package/corpus/templates/content/shared/api.ts +20 -0
  165. package/corpus/templates/content/shared/blocks-fields-manifest.ts +106 -0
  166. package/corpus/templates/content/shared/database-item-layout.ts +591 -0
  167. package/corpus/templates/content/shared/database-query.ts +192 -30
  168. package/corpus/templates/content/shared/document-export.ts +12 -14
  169. package/corpus/templates/content/shared/document-flush-protocol.ts +88 -0
  170. package/corpus/templates/content/shared/editor-save-state.ts +97 -0
  171. package/corpus/templates/content/shared/feature-flags.ts +10 -0
  172. package/corpus/templates/content/shared/import/markdown.ts +91 -7
  173. package/corpus/templates/content/shared/import/types.ts +2 -0
  174. package/corpus/templates/content/shared/inline-math.ts +6 -4
  175. package/corpus/templates/content/shared/nfm-fidelity.ts +247 -0
  176. package/corpus/templates/content/shared/nfm.ts +1933 -340
  177. package/corpus/templates/content/shared/suggestion-diff.ts +13 -0
  178. package/corpus/templates/content/shared/suggestion-formatting.ts +143 -20
  179. package/corpus/templates/content/shared/suggestion-text.ts +39 -0
  180. package/corpus/templates/content/vitest.config.ts +10 -0
  181. package/corpus/templates/crm/.agents/skills/actions/references/action-fields.md +1 -1
  182. package/corpus/templates/design/.agents/skills/actions/references/action-fields.md +1 -1
  183. package/corpus/templates/design/.agents/skills/native-effects/SKILL.md +9 -2
  184. package/corpus/templates/design/.generated/bridge/shader-fill-preview.generated.ts +3 -249
  185. package/corpus/templates/design/.generated/bridge/shader-runtime.generated.ts +5 -88
  186. package/corpus/templates/design/AGENTS.md +1 -3
  187. package/corpus/templates/design/CHANGELOG.md +32 -0
  188. package/corpus/templates/design/CODE_NATIVE_DESIGN_STUDIO_IMPLEMENTATION_PLAN.md +1 -6
  189. package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +5 -7
  190. package/corpus/templates/design/actions/_native-local-export-server.ts +44 -31
  191. package/corpus/templates/design/actions/_native-render-contexts.ts +76 -21
  192. package/corpus/templates/design/actions/claim-native-local-export.ts +5 -0
  193. package/corpus/templates/design/actions/finish-native-local-export.ts +13 -2
  194. package/corpus/templates/design/actions/get-native-shader-approvals.ts +35 -0
  195. package/corpus/templates/design/actions/get-shader.ts +134 -219
  196. package/corpus/templates/design/actions/list-design-extensions.ts +3 -58
  197. package/corpus/templates/design/actions/request-native-local-export.ts +32 -6
  198. package/corpus/templates/design/actions/run-design-extension-action.ts +0 -29
  199. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +131 -108
  200. package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +0 -218
  201. package/corpus/templates/design/app/components/design/DesignThumbnail.tsx +59 -3
  202. package/corpus/templates/design/app/components/design/EditPanel.tsx +35 -47
  203. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +242 -62
  204. package/corpus/templates/design/app/components/design/NativePreviewErrorBoundary.tsx +53 -0
  205. package/corpus/templates/design/app/components/design/bridge/codegen.ts +18 -3
  206. package/corpus/templates/design/app/components/design/bridge/native-composition-clock.ts +5 -4
  207. package/corpus/templates/design/app/components/design/bridge/native-dom.ts +37 -0
  208. package/corpus/templates/design/app/components/design/bridge/native-intrinsic-image.ts +2 -1
  209. package/corpus/templates/design/app/components/design/bridge/native-mesh-grid.ts +90 -0
  210. package/corpus/templates/design/app/components/design/bridge/native-opaque-public-asset.ts +363 -0
  211. package/corpus/templates/design/app/components/design/bridge/native-opaque-worker-lease.ts +179 -0
  212. package/corpus/templates/design/app/components/design/bridge/native-preview-geometry.ts +132 -7
  213. package/corpus/templates/design/app/components/design/bridge/native-preview-policy.ts +4 -0
  214. package/corpus/templates/design/app/components/design/bridge/native-preview-viewport-transport.ts +378 -0
  215. package/corpus/templates/design/app/components/design/bridge/native-scene-body-transform.ts +62 -0
  216. package/corpus/templates/design/app/components/design/bridge/native-scene-presentation-element.ts +10 -0
  217. package/corpus/templates/design/app/components/design/bridge/native-shader-runtime.bridge.ts +646 -167
  218. package/corpus/templates/design/app/components/design/bridge/native-source-provider.ts +246 -192
  219. package/corpus/templates/design/app/components/design/bridge/native-stateful-resource.ts +2 -2
  220. package/corpus/templates/design/app/components/design/bridge/native-stateless-compute.ts +5 -2
  221. package/corpus/templates/design/app/components/design/bridge/native-svg-source.ts +11 -1
  222. package/corpus/templates/design/app/components/design/bridge/native-worker-broker.ts +6 -0
  223. package/corpus/templates/design/app/components/design/bridge/native-worker-entry.ts +761 -303
  224. package/corpus/templates/design/app/components/design/bridge/native-worker-fill.ts +16 -6
  225. package/corpus/templates/design/app/components/design/bridge/native-worker-gpu.ts +854 -91
  226. package/corpus/templates/design/app/components/design/bridge/native-worker-host.ts +15 -1
  227. package/corpus/templates/design/app/components/design/bridge/native-worker-input-assets.ts +200 -0
  228. package/corpus/templates/design/app/components/design/bridge/native-worker-protocol.ts +40 -1
  229. package/corpus/templates/design/app/components/design/bridge/native-worker-scene-host.ts +425 -126
  230. package/corpus/templates/design/app/components/design/bridge/native-worker-source-snapshot.ts +21 -0
  231. package/corpus/templates/design/app/components/design/bridge/shader-fill-preview.bridge.ts +5 -371
  232. package/corpus/templates/design/app/components/design/bridge/shader-runtime.bridge.ts +4 -146
  233. package/corpus/templates/design/app/components/design/design-canvas/interact-document.ts +5 -9
  234. package/corpus/templates/design/app/components/design/design-canvas/native-preview-surface.ts +150 -0
  235. package/corpus/templates/design/app/components/design/design-canvas/native-public-asset-preview.ts +409 -0
  236. package/corpus/templates/design/app/components/design/design-canvas/native-public-worker-preview.ts +1086 -0
  237. package/corpus/templates/design/app/components/design/design-canvas/private-replay-screenshot-preview.ts +2 -2
  238. package/corpus/templates/design/app/components/design/edit-panel/effects-properties.tsx +15 -26
  239. package/corpus/templates/design/app/components/design/edit-panel/fill-properties.tsx +74 -67
  240. package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +7 -19
  241. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +39 -30
  242. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +4 -0
  243. package/corpus/templates/design/app/components/design/inspector/NativeShaderColorControls.tsx +3 -7
  244. package/corpus/templates/design/app/components/design/inspector/NativeShaderPaintControls.tsx +12 -5
  245. package/corpus/templates/design/app/components/design/inspector/NativeShaderPanel.tsx +705 -190
  246. package/corpus/templates/design/app/components/design/inspector/fill-field-reading.ts +1 -2
  247. package/corpus/templates/design/app/components/design/inspector/index.ts +0 -6
  248. package/corpus/templates/design/app/components/design/inspector/native-catalog-display.ts +26 -5
  249. package/corpus/templates/design/app/components/design/inspector/native-shader-catalog-fixture.ts +42 -0
  250. package/corpus/templates/design/app/components/design/inspector/native-shader-catalog-preview.ts +51 -33
  251. package/corpus/templates/design/app/components/design/inspector/native-shader-paint.ts +1 -0
  252. package/corpus/templates/design/app/components/design/inspector/native-shader-property-draft.ts +89 -23
  253. package/corpus/templates/design/app/components/design/inspector/saved-glsl-shader.tsx +243 -0
  254. package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +54 -5
  255. package/corpus/templates/design/app/components/design/shader-source-coordination.ts +66 -0
  256. package/corpus/templates/design/app/components/design/use-native-shader-approvals.ts +36 -8
  257. package/corpus/templates/design/app/components/templates/TemplatePreview.tsx +60 -3
  258. package/corpus/templates/design/app/i18n/en-US.ts +78 -2
  259. package/corpus/templates/design/app/pages/Present.tsx +36 -1
  260. package/corpus/templates/design/app/pages/design-editor/commands/apply-file-content-update.ts +1 -1
  261. package/corpus/templates/design/app/pages/design-editor/commands/apply-local-content-update.ts +1 -1
  262. package/corpus/templates/design/app/pages/design-editor/commands/commit-visual-styles.ts +2 -3
  263. package/corpus/templates/design/app/pages/design-editor/commands/cross-screen-element-drop.ts +1 -1
  264. package/corpus/templates/design/app/pages/design-editor/commands/layer-move-to-screen.ts +1 -1
  265. package/corpus/templates/design/app/pages/design-editor/commands/paste-selection.ts +1 -1
  266. package/corpus/templates/design/app/pages/design-editor/commands/paste-svg-layer.ts +1 -1
  267. package/corpus/templates/design/app/pages/design-editor/commands/prepare-content-history-replay.ts +1 -1
  268. package/corpus/templates/design/app/pages/design-editor/commands/redo.ts +1 -1
  269. package/corpus/templates/design/app/pages/design-editor/commands/render-png-blob.ts +84 -41
  270. package/corpus/templates/design/app/pages/design-editor/commands/shader-source-edit.ts +1 -1
  271. package/corpus/templates/design/app/pages/design-editor/commands/undo.ts +1 -1
  272. package/corpus/templates/design/app/pages/design-editor/design-editor-view.tsx +0 -2
  273. package/corpus/templates/design/app/pages/design-editor/domains/use-editor-content-and-components.ts +4 -33
  274. package/corpus/templates/design/app/pages/design-editor/domains/use-editor-export-and-handoff.ts +2 -2
  275. package/corpus/templates/design/app/pages/design-editor/domains/use-editor-history.ts +0 -11
  276. package/corpus/templates/design/app/pages/design-editor/domains/use-editor-layer-models.ts +2 -55
  277. package/corpus/templates/design/app/pages/design-editor/domains/use-editor-screen-rendering.tsx +0 -3
  278. package/corpus/templates/design/app/pages/design-editor/domains/use-editor-selection-and-styles.ts +0 -24
  279. package/corpus/templates/design/app/pages/design-editor/text-edit-utils.ts +0 -16
  280. package/corpus/templates/design/app/pages/design-editor/use-native-local-export-requests.ts +70 -11
  281. package/corpus/templates/design/app/pages/design-editor/view/single-screen-canvas.tsx +0 -2
  282. package/corpus/templates/design/changelog/2026-10-20-folded-mesh-adds-an-animated-sculpted-fill-with-editable-col.md +6 -0
  283. package/corpus/templates/design/changelog/2026-10-20-read-only-design-views-render-native-shader-previews-in-nest.md +6 -0
  284. package/corpus/templates/design/changelog/2026-10-20-selected-screens-with-shader-effects-can-be-exported-togethe.md +6 -0
  285. package/corpus/templates/design/changelog/2026-10-20-shader-previews-reuse-validated-scene-data-while-panning-inc.md +6 -0
  286. package/corpus/templates/design/changelog/2026-10-20-shader-previews-stay-aligned-while-you-zoom.md +6 -0
  287. package/corpus/templates/design/changelog/2026-10-20-signed-out-sessions-no-longer-watch-for-private-png-export-r.md +6 -0
  288. package/corpus/templates/design/changelog/2026-10-21-effect-thumbnails-show-richer-previews.md +6 -0
  289. package/corpus/templates/design/changelog/2026-10-21-native-effects-render-across-previews.md +6 -0
  290. package/corpus/templates/design/changelog/2026-10-21-native-shader-previews-use-less-gpu-memory-when-many-mesh-ef.md +6 -0
  291. package/corpus/templates/design/changelog/2026-10-21-opening-design-no-longer-shows-png-export-errors-when-no-exp.md +6 -0
  292. package/corpus/templates/design/changelog/2026-10-21-pulsing-border-controls-grouped.md +6 -0
  293. package/corpus/templates/design/changelog/2026-10-21-pulsing-border-follows-element-outlines.md +6 -0
  294. package/corpus/templates/design/changelog/2026-10-21-remove-obsolete-shader-fills.md +6 -0
  295. package/corpus/templates/design/changelog/2026-10-21-shader-previews-recover-from-temporary-gpu-and-image-failure.md +6 -0
  296. package/corpus/templates/design/changelog/2026-10-22-shader-fills-and-effects-render-correctly-on-canvas-elements.md +6 -0
  297. package/corpus/templates/design/package.json +0 -1
  298. package/corpus/templates/design/playwright.config.ts +1 -1
  299. package/corpus/templates/design/scripts/runtime-budget-zoom.ts +9 -21
  300. package/corpus/templates/design/scripts/runtime-budget.ts +10 -24
  301. package/corpus/templates/design/server/plugins/agent-chat.ts +0 -2
  302. package/corpus/templates/design/shared/effect-graph.ts +46 -1
  303. package/corpus/templates/design/shared/generation-output-receipt.ts +0 -1
  304. package/corpus/templates/design/shared/native-effect-animation-capability.ts +6 -0
  305. package/corpus/templates/design/shared/native-effect-folded-mesh-v1.ts +268 -0
  306. package/corpus/templates/design/shared/native-effect-folded-mesh-v2.ts +310 -0
  307. package/corpus/templates/design/shared/native-effect-folded-mesh.ts +489 -0
  308. package/corpus/templates/design/shared/native-effect-gallery-additions.ts +2 -2
  309. package/corpus/templates/design/shared/native-effect-paint.ts +8 -0
  310. package/corpus/templates/design/shared/native-effect-parameter-constraints.ts +8 -1
  311. package/corpus/templates/design/shared/native-effect-presets.ts +18 -1
  312. package/corpus/templates/design/shared/native-effect-property-presentation.ts +81 -0
  313. package/corpus/templates/design/shared/native-effect-pulsing-border-v3.ts +281 -0
  314. package/corpus/templates/design/shared/native-effect-pulsing-border-v4.ts +284 -0
  315. package/corpus/templates/design/shared/native-effect-pulsing-border.ts +300 -0
  316. package/corpus/templates/design/shared/native-effect-trust.ts +6 -0
  317. package/corpus/templates/design/shared/native-effect-wgsl.ts +12 -0
  318. package/corpus/templates/design/shared/native-effects.ts +528 -15
  319. package/corpus/templates/design/shared/native-input-resources.ts +36 -0
  320. package/corpus/templates/design/shared/native-local-export.ts +14 -0
  321. package/corpus/templates/design/shared/native-parameter-animation.ts +1 -0
  322. package/corpus/templates/design/shared/native-pointer-input.ts +9 -11
  323. package/corpus/templates/design/shared/shader-fills.ts +0 -513
  324. package/corpus/templates/design/vitest.setup.ts +7 -1
  325. package/corpus/templates/dispatch/.agents/skills/actions/references/action-fields.md +1 -1
  326. package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +20 -18
  327. package/corpus/templates/factory/.agents/skills/actions/references/action-fields.md +1 -1
  328. package/corpus/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +36 -80
  329. package/corpus/templates/factory/.agents/skills/review-latest-feedback/references/channel-inventory.md +54 -16
  330. package/corpus/templates/factory/.agents/skills/review-latest-feedback/references/slack-reaction-replies.md +50 -73
  331. package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +20 -18
  332. package/corpus/templates/forms/.agents/skills/actions/references/action-fields.md +1 -1
  333. package/corpus/templates/mail/.agents/skills/actions/references/action-fields.md +1 -1
  334. package/corpus/templates/plan/.agents/skills/actions/references/action-fields.md +1 -1
  335. package/corpus/templates/slides/.agents/skills/actions/references/action-fields.md +1 -1
  336. package/corpus/templates/slides-2/.agents/skills/actions/SKILL.md +199 -0
  337. package/corpus/templates/slides-2/.agents/skills/actions/references/action-fields.md +145 -0
  338. package/corpus/templates/slides-2/.agents/skills/actions/references/examples.md +96 -0
  339. package/corpus/templates/slides-2/.agents/skills/actions/references/provider-apis.md +95 -0
  340. package/corpus/templates/slides-2/.agents/skills/adding-a-feature/SKILL.md +235 -0
  341. package/corpus/templates/slides-2/.agents/skills/agent-native-docs/SKILL.md +161 -0
  342. package/corpus/templates/slides-2/.agents/skills/agent-native-toolkit/SKILL.md +314 -0
  343. package/corpus/templates/slides-2/.agents/skills/analytics-data-for-decks/SKILL.md +44 -0
  344. package/corpus/templates/slides-2/.agents/skills/apply-slide-comments/SKILL.md +63 -0
  345. package/corpus/templates/slides-2/.agents/skills/client-side-routing/SKILL.md +87 -0
  346. package/corpus/templates/slides-2/.agents/skills/context-awareness/SKILL.md +282 -0
  347. package/corpus/templates/slides-2/.agents/skills/create-deck/SKILL.md +263 -0
  348. package/corpus/templates/slides-2/.agents/skills/create-deck/references/reference-inputs.md +72 -0
  349. package/corpus/templates/slides-2/.agents/skills/create-deck/references/slide-templates.md +93 -0
  350. package/corpus/templates/slides-2/.agents/skills/create-deck/references/source-material.md +16 -0
  351. package/corpus/templates/slides-2/.agents/skills/creative-context/SKILL.md +134 -0
  352. package/corpus/templates/slides-2/.agents/skills/customizing-agent-native/SKILL.md +219 -0
  353. package/corpus/templates/slides-2/.agents/skills/deck-management/SKILL.md +182 -0
  354. package/corpus/templates/slides-2/.agents/skills/delegate-to-agent/SKILL.md +62 -0
  355. package/corpus/templates/slides-2/.agents/skills/design-systems/SKILL.md +233 -0
  356. package/corpus/templates/slides-2/.agents/skills/external-agents/SKILL.md +549 -0
  357. package/corpus/templates/slides-2/.agents/skills/external-agents/references/mcp-apps-embedding.md +169 -0
  358. package/corpus/templates/slides-2/.agents/skills/frontend-design/SKILL.md +102 -0
  359. package/corpus/templates/slides-2/.agents/skills/frontend-design/references/visual-direction.md +102 -0
  360. package/corpus/templates/slides-2/.agents/skills/image-generation-via-a2a/SKILL.md +134 -0
  361. package/corpus/templates/slides-2/.agents/skills/performance/SKILL.md +79 -0
  362. package/corpus/templates/slides-2/.agents/skills/portability/SKILL.md +108 -0
  363. package/corpus/templates/slides-2/.agents/skills/real-time-sync/SKILL.md +146 -0
  364. package/corpus/templates/slides-2/.agents/skills/reliable-mutations/SKILL.md +72 -0
  365. package/corpus/templates/slides-2/.agents/skills/secrets/SKILL.md +82 -0
  366. package/corpus/templates/slides-2/.agents/skills/security/SKILL.md +80 -0
  367. package/corpus/templates/slides-2/.agents/skills/self-modifying-code/SKILL.md +123 -0
  368. package/corpus/templates/slides-2/.agents/skills/shadcn-ui/SKILL.md +71 -0
  369. package/corpus/templates/slides-2/.agents/skills/sharing/SKILL.md +286 -0
  370. package/corpus/templates/slides-2/.agents/skills/slide-design/SKILL.md +144 -0
  371. package/corpus/templates/slides-2/.agents/skills/slide-editing/SKILL.md +284 -0
  372. package/corpus/templates/slides-2/.agents/skills/slide-editing/references/animations.md +33 -0
  373. package/corpus/templates/slides-2/.agents/skills/slide-editing/references/freeform-objects.md +22 -0
  374. package/corpus/templates/slides-2/.agents/skills/slide-editing/references/restyling.md +69 -0
  375. package/corpus/templates/slides-2/.agents/skills/slide-editing/references/transitions.md +26 -0
  376. package/corpus/templates/slides-2/.agents/skills/slide-editing/references/video.md +45 -0
  377. package/corpus/templates/slides-2/.agents/skills/slide-images/SKILL.md +136 -0
  378. package/corpus/templates/slides-2/.agents/skills/storing-data/SKILL.md +234 -0
  379. package/corpus/templates/slides-2/.agents/skills/turn-into-skill/SKILL.md +112 -0
  380. package/corpus/templates/slides-2/.agents/skills/turn-into-skill/agents/openai.yaml +4 -0
  381. package/corpus/templates/slides-2/.agents/skills/workspace-conventions/SKILL.md +103 -0
  382. package/corpus/templates/slides-2/.builder/rules/deploy-app.mdc +22 -0
  383. package/corpus/templates/slides-2/.builder/rules/organize-ui.mdc +9 -0
  384. package/corpus/templates/slides-2/.dockerignore +61 -0
  385. package/corpus/templates/slides-2/.env.example +23 -0
  386. package/corpus/templates/slides-2/.ignore +3 -0
  387. package/corpus/templates/slides-2/.mcp.json +8 -0
  388. package/corpus/templates/slides-2/.oxfmtrc.json +8 -0
  389. package/corpus/templates/slides-2/AGENTS.md +66 -0
  390. package/corpus/templates/slides-2/CHANGELOG.md +76 -0
  391. package/corpus/templates/slides-2/DEVELOPING.md +157 -0
  392. package/corpus/templates/slides-2/README.md +58 -0
  393. package/corpus/templates/slides-2/THIRD_PARTY_NOTICES.md +33 -0
  394. package/corpus/templates/slides-2/_gitignore +38 -0
  395. package/corpus/templates/slides-2/actions/_agent-presence.ts +29 -0
  396. package/corpus/templates/slides-2/actions/_app-url.ts +37 -0
  397. package/corpus/templates/slides-2/actions/_deck-app-scope.ts +30 -0
  398. package/corpus/templates/slides-2/actions/_deck-tracking.ts +260 -0
  399. package/corpus/templates/slides-2/actions/_deck-write.ts +206 -0
  400. package/corpus/templates/slides-2/actions/_imported-slide-source.ts +162 -0
  401. package/corpus/templates/slides-2/actions/_inline-image-storage.ts +1013 -0
  402. package/corpus/templates/slides-2/actions/_linked-design-system.ts +83 -0
  403. package/corpus/templates/slides-2/actions/_presenter-notes.ts +83 -0
  404. package/corpus/templates/slides-2/actions/_render-artifacts.ts +111 -0
  405. package/corpus/templates/slides-2/actions/_slide-source.ts +344 -0
  406. package/corpus/templates/slides-2/actions/_tab-state.ts +51 -0
  407. package/corpus/templates/slides-2/actions/_test-brandfetch.ts +31 -0
  408. package/corpus/templates/slides-2/actions/_uploaded-files.ts +114 -0
  409. package/corpus/templates/slides-2/actions/add-deck.ts +123 -0
  410. package/corpus/templates/slides-2/actions/add-slide-comment.ts +267 -0
  411. package/corpus/templates/slides-2/actions/add-slide.ts +888 -0
  412. package/corpus/templates/slides-2/actions/analyze-brand-assets.ts +66 -0
  413. package/corpus/templates/slides-2/actions/apply-design-system.ts +111 -0
  414. package/corpus/templates/slides-2/actions/approve-deck-access-request.ts +287 -0
  415. package/corpus/templates/slides-2/actions/audit-contrast.ts +143 -0
  416. package/corpus/templates/slides-2/actions/check-image-gen.ts +17 -0
  417. package/corpus/templates/slides-2/actions/clone-context-slide.ts +340 -0
  418. package/corpus/templates/slides-2/actions/clone-creative-context-deck.ts +143 -0
  419. package/corpus/templates/slides-2/actions/control-deck-history.ts +186 -0
  420. package/corpus/templates/slides-2/actions/control-presenter.ts +117 -0
  421. package/corpus/templates/slides-2/actions/control-slide-editor.ts +267 -0
  422. package/corpus/templates/slides-2/actions/create-deck-from-template.ts +274 -0
  423. package/corpus/templates/slides-2/actions/create-deck.ts +1243 -0
  424. package/corpus/templates/slides-2/actions/create-design-system.ts +131 -0
  425. package/corpus/templates/slides-2/actions/create-share-link.ts +127 -0
  426. package/corpus/templates/slides-2/actions/db-health.ts +22 -0
  427. package/corpus/templates/slides-2/actions/delete-asset.ts +154 -0
  428. package/corpus/templates/slides-2/actions/delete-deck.ts +427 -0
  429. package/corpus/templates/slides-2/actions/delete-design-system.ts +167 -0
  430. package/corpus/templates/slides-2/actions/delete-slide-comment.ts +143 -0
  431. package/corpus/templates/slides-2/actions/delete-staged-dataset.ts +30 -0
  432. package/corpus/templates/slides-2/actions/duplicate-deck.ts +299 -0
  433. package/corpus/templates/slides-2/actions/export-google-slides.ts +41 -0
  434. package/corpus/templates/slides-2/actions/export-html.ts +770 -0
  435. package/corpus/templates/slides-2/actions/export-pptx.ts +2203 -0
  436. package/corpus/templates/slides-2/actions/extract-pdf.ts +49 -0
  437. package/corpus/templates/slides-2/actions/generate-image-api.ts +671 -0
  438. package/corpus/templates/slides-2/actions/generate-image.ts +492 -0
  439. package/corpus/templates/slides-2/actions/get-agent-access-deck.ts +52 -0
  440. package/corpus/templates/slides-2/actions/get-deck-access-status.ts +130 -0
  441. package/corpus/templates/slides-2/actions/get-deck-design-tokens.ts +62 -0
  442. package/corpus/templates/slides-2/actions/get-deck-reference-context.ts +232 -0
  443. package/corpus/templates/slides-2/actions/get-deck-template.ts +38 -0
  444. package/corpus/templates/slides-2/actions/get-deck-version.ts +85 -0
  445. package/corpus/templates/slides-2/actions/get-deck.ts +562 -0
  446. package/corpus/templates/slides-2/actions/get-design-system-decode-job-status.ts +57 -0
  447. package/corpus/templates/slides-2/actions/get-design-system-tier-limit.ts +12 -0
  448. package/corpus/templates/slides-2/actions/get-design-system.ts +453 -0
  449. package/corpus/templates/slides-2/actions/get-google-docs-status.ts +106 -0
  450. package/corpus/templates/slides-2/actions/get-google-picker-token.ts +84 -0
  451. package/corpus/templates/slides-2/actions/get-home-suggestions.ts +52 -0
  452. package/corpus/templates/slides-2/actions/get-layout-overflows.ts +192 -0
  453. package/corpus/templates/slides-2/actions/get-slide-render.ts +125 -0
  454. package/corpus/templates/slides-2/actions/get-slide-source.ts +115 -0
  455. package/corpus/templates/slides-2/actions/get-slide-theme-preview.ts +64 -0
  456. package/corpus/templates/slides-2/actions/get-slide-theme.ts +44 -0
  457. package/corpus/templates/slides-2/actions/get-slides-2-upload-storage-status.ts +17 -0
  458. package/corpus/templates/slides-2/actions/get-slides-notification-prefs.ts +37 -0
  459. package/corpus/templates/slides-2/actions/get-workspace-defaults.ts +51 -0
  460. package/corpus/templates/slides-2/actions/image-gen-status.ts +35 -0
  461. package/corpus/templates/slides-2/actions/import-code.ts +26 -0
  462. package/corpus/templates/slides-2/actions/import-design-project.ts +49 -0
  463. package/corpus/templates/slides-2/actions/import-document.ts +125 -0
  464. package/corpus/templates/slides-2/actions/import-docx.ts +57 -0
  465. package/corpus/templates/slides-2/actions/import-file.ts +1273 -0
  466. package/corpus/templates/slides-2/actions/import-from-url.ts +25 -0
  467. package/corpus/templates/slides-2/actions/import-google-doc.ts +208 -0
  468. package/corpus/templates/slides-2/actions/import-google-font.ts +110 -0
  469. package/corpus/templates/slides-2/actions/import-google-slides-reference.ts +667 -0
  470. package/corpus/templates/slides-2/actions/import-pptx.ts +564 -0
  471. package/corpus/templates/slides-2/actions/import-svgl-logo.ts +115 -0
  472. package/corpus/templates/slides-2/actions/index-design-system-with-builder.ts +181 -0
  473. package/corpus/templates/slides-2/actions/index-uploaded-design-system-files.ts +77 -0
  474. package/corpus/templates/slides-2/actions/list-assets.ts +286 -0
  475. package/corpus/templates/slides-2/actions/list-deck-templates.ts +83 -0
  476. package/corpus/templates/slides-2/actions/list-deck-versions.ts +185 -0
  477. package/corpus/templates/slides-2/actions/list-decks.ts +591 -0
  478. package/corpus/templates/slides-2/actions/list-design-systems.ts +180 -0
  479. package/corpus/templates/slides-2/actions/list-slide-comments.ts +128 -0
  480. package/corpus/templates/slides-2/actions/list-slide-themes.ts +17 -0
  481. package/corpus/templates/slides-2/actions/list-staged-datasets.ts +14 -0
  482. package/corpus/templates/slides-2/actions/logo-config.ts +13 -0
  483. package/corpus/templates/slides-2/actions/navigate.ts +158 -0
  484. package/corpus/templates/slides-2/actions/patch-deck.ts +2378 -0
  485. package/corpus/templates/slides-2/actions/provider-api-catalog.ts +25 -0
  486. package/corpus/templates/slides-2/actions/provider-api-docs.ts +83 -0
  487. package/corpus/templates/slides-2/actions/provider-api-request.ts +222 -0
  488. package/corpus/templates/slides-2/actions/query-staged-dataset.ts +83 -0
  489. package/corpus/templates/slides-2/actions/read-composer-source.ts +108 -0
  490. package/corpus/templates/slides-2/actions/request-deck-access.ts +803 -0
  491. package/corpus/templates/slides-2/actions/restore-deck-version.ts +203 -0
  492. package/corpus/templates/slides-2/actions/run.ts +2 -0
  493. package/corpus/templates/slides-2/actions/save-deck.ts +313 -0
  494. package/corpus/templates/slides-2/actions/search-google-fonts.ts +61 -0
  495. package/corpus/templates/slides-2/actions/search-images.ts +30 -0
  496. package/corpus/templates/slides-2/actions/search-logos.ts +23 -0
  497. package/corpus/templates/slides-2/actions/search-svgl-logos.ts +42 -0
  498. package/corpus/templates/slides-2/actions/set-default-design-system.ts +88 -0
  499. package/corpus/templates/slides-2/actions/set-workspace-defaults.ts +61 -0
  500. package/corpus/templates/slides-2/actions/start-design-system-upload.ts +80 -0
  501. package/corpus/templates/slides-2/actions/sync-design-system-with-builder.ts +84 -0
  502. package/corpus/templates/slides-2/actions/toggle-slide-comment-reaction.ts +150 -0
  503. package/corpus/templates/slides-2/actions/transform-slide-objects.ts +1528 -0
  504. package/corpus/templates/slides-2/actions/update-asset.ts +499 -0
  505. package/corpus/templates/slides-2/actions/update-deck-aspect-ratio.ts +95 -0
  506. package/corpus/templates/slides-2/actions/update-deck-design-tokens.ts +175 -0
  507. package/corpus/templates/slides-2/actions/update-design-system.ts +95 -0
  508. package/corpus/templates/slides-2/actions/update-slide-comment.ts +213 -0
  509. package/corpus/templates/slides-2/actions/update-slide-source.ts +353 -0
  510. package/corpus/templates/slides-2/actions/update-slide.ts +850 -0
  511. package/corpus/templates/slides-2/actions/update-slides-notification-prefs.ts +55 -0
  512. package/corpus/templates/slides-2/actions/view-screen.ts +1098 -0
  513. package/corpus/templates/slides-2/agent-native.app-skill.json +165 -0
  514. package/corpus/templates/slides-2/agent-native.config.ts +20 -0
  515. package/corpus/templates/slides-2/agent-native.json +18 -0
  516. package/corpus/templates/slides-2/app/components/ThemeToggle.tsx +47 -0
  517. package/corpus/templates/slides-2/app/components/comments/SlideCommentPins.tsx +781 -0
  518. package/corpus/templates/slides-2/app/components/comments/SlideCommentsPanel.tsx +1075 -0
  519. package/corpus/templates/slides-2/app/components/deck/DeckCard.tsx +304 -0
  520. package/corpus/templates/slides-2/app/components/deck/DeckFilterMenu.tsx +83 -0
  521. package/corpus/templates/slides-2/app/components/deck/ExcalidrawSlide.tsx +183 -0
  522. package/corpus/templates/slides-2/app/components/deck/MermaidRenderer.tsx +126 -0
  523. package/corpus/templates/slides-2/app/components/deck/SlideRenderer.tsx +1553 -0
  524. package/corpus/templates/slides-2/app/components/design-system/DesignSystemCard.tsx +235 -0
  525. package/corpus/templates/slides-2/app/components/design-system/DesignSystemSetup.tsx +2021 -0
  526. package/corpus/templates/slides-2/app/components/design-system/builder-design-system-upload.ts +200 -0
  527. package/corpus/templates/slides-2/app/components/design-system/builder-index-response.ts +104 -0
  528. package/corpus/templates/slides-2/app/components/editor/AddSlidePopover.tsx +461 -0
  529. package/corpus/templates/slides-2/app/components/editor/AiEditingMarker.tsx +24 -0
  530. package/corpus/templates/slides-2/app/components/editor/AlignmentGuides.tsx +82 -0
  531. package/corpus/templates/slides-2/app/components/editor/AnimationsPanel.tsx +698 -0
  532. package/corpus/templates/slides-2/app/components/editor/AppMenu.tsx +356 -0
  533. package/corpus/templates/slides-2/app/components/editor/AssetLibraryPanel.tsx +508 -0
  534. package/corpus/templates/slides-2/app/components/editor/BlockBubbleMenu.tsx +548 -0
  535. package/corpus/templates/slides-2/app/components/editor/DeckAccessDeniedPage.tsx +173 -0
  536. package/corpus/templates/slides-2/app/components/editor/DeckEditorSkeleton.tsx +35 -0
  537. package/corpus/templates/slides-2/app/components/editor/DeferredPopoverFallback.tsx +148 -0
  538. package/corpus/templates/slides-2/app/components/editor/EditorActionCluster.tsx +217 -0
  539. package/corpus/templates/slides-2/app/components/editor/EditorSidebar.tsx +1047 -0
  540. package/corpus/templates/slides-2/app/components/editor/EditorToolbar.tsx +1285 -0
  541. package/corpus/templates/slides-2/app/components/editor/ExportMenu.tsx +579 -0
  542. package/corpus/templates/slides-2/app/components/editor/GeneratingOverlay.tsx +21 -0
  543. package/corpus/templates/slides-2/app/components/editor/GeneratingSlidePreview.tsx +73 -0
  544. package/corpus/templates/slides-2/app/components/editor/GoogleDocImportHint.tsx +378 -0
  545. package/corpus/templates/slides-2/app/components/editor/GoogleDriveConnectionCta.tsx +154 -0
  546. package/corpus/templates/slides-2/app/components/editor/GoogleSlidesReferenceImport.tsx +299 -0
  547. package/corpus/templates/slides-2/app/components/editor/HistoryPanel.tsx +354 -0
  548. package/corpus/templates/slides-2/app/components/editor/HomeQuickStartDialog.tsx +202 -0
  549. package/corpus/templates/slides-2/app/components/editor/ImageCropOverlay.tsx +820 -0
  550. package/corpus/templates/slides-2/app/components/editor/ImageDropPromptPopover.tsx +280 -0
  551. package/corpus/templates/slides-2/app/components/editor/ImageGenPanel.tsx +244 -0
  552. package/corpus/templates/slides-2/app/components/editor/ImageOverlay.tsx +280 -0
  553. package/corpus/templates/slides-2/app/components/editor/ImageSearchPanel.tsx +183 -0
  554. package/corpus/templates/slides-2/app/components/editor/ImportDeckButton.tsx +247 -0
  555. package/corpus/templates/slides-2/app/components/editor/LogoSearchPanel.tsx +366 -0
  556. package/corpus/templates/slides-2/app/components/editor/MermaidToExcalidrawPanel.tsx +99 -0
  557. package/corpus/templates/slides-2/app/components/editor/MissingDeckAccessPane.tsx +219 -0
  558. package/corpus/templates/slides-2/app/components/editor/NewDeckReferenceStep.tsx +812 -0
  559. package/corpus/templates/slides-2/app/components/editor/PromptDialog.tsx +963 -0
  560. package/corpus/templates/slides-2/app/components/editor/QuestionFlow.tsx +119 -0
  561. package/corpus/templates/slides-2/app/components/editor/RequestDeckAccessDialog.tsx +101 -0
  562. package/corpus/templates/slides-2/app/components/editor/ShareDialog.tsx +126 -0
  563. package/corpus/templates/slides-2/app/components/editor/SlideContextToolbar.tsx +1471 -0
  564. package/corpus/templates/slides-2/app/components/editor/SlideEditor.tsx +11183 -0
  565. package/corpus/templates/slides-2/app/components/editor/SlideOverflowWarning.tsx +82 -0
  566. package/corpus/templates/slides-2/app/components/editor/SlideScrollStack.tsx +307 -0
  567. package/corpus/templates/slides-2/app/components/editor/SlideSlashCommandMenu.tsx +692 -0
  568. package/corpus/templates/slides-2/app/components/editor/SlideThumbnailContextMenu.tsx +52 -0
  569. package/corpus/templates/slides-2/app/components/editor/SlideTransitionControl.tsx +184 -0
  570. package/corpus/templates/slides-2/app/components/editor/SlidesComposerContext.tsx +789 -0
  571. package/corpus/templates/slides-2/app/components/editor/SlidesComposerContextProvider.tsx +74 -0
  572. package/corpus/templates/slides-2/app/components/editor/SlidesLayersPanel.tsx +377 -0
  573. package/corpus/templates/slides-2/app/components/editor/SpeakerNotesPanel.tsx +119 -0
  574. package/corpus/templates/slides-2/app/components/editor/TweaksPanel.tsx +77 -0
  575. package/corpus/templates/slides-2/app/components/editor/UploadStorageGate.tsx +37 -0
  576. package/corpus/templates/slides-2/app/components/editor/bullet-editing.ts +880 -0
  577. package/corpus/templates/slides-2/app/components/editor/canvas-interactions/index.ts +12 -0
  578. package/corpus/templates/slides-2/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +119 -0
  579. package/corpus/templates/slides-2/app/components/editor/commit-active-edit.ts +14 -0
  580. package/corpus/templates/slides-2/app/components/editor/editor-command-model.ts +35 -0
  581. package/corpus/templates/slides-2/app/components/editor/fit-text-object.ts +31 -0
  582. package/corpus/templates/slides-2/app/components/editor/in-place-text-session.browser-cases.json +983 -0
  583. package/corpus/templates/slides-2/app/components/editor/in-place-text-session.browser-host.ts +747 -0
  584. package/corpus/templates/slides-2/app/components/editor/in-place-text-session.ts +6891 -0
  585. package/corpus/templates/slides-2/app/components/editor/inline-edit-session.ts +26 -0
  586. package/corpus/templates/slides-2/app/components/editor/list-editing.ts +501 -0
  587. package/corpus/templates/slides-2/app/components/editor/rich-text-selection.ts +975 -0
  588. package/corpus/templates/slides-2/app/components/editor/rte-test-utils.ts +265 -0
  589. package/corpus/templates/slides-2/app/components/editor/selection-overlay-measurement.ts +191 -0
  590. package/corpus/templates/slides-2/app/components/editor/slide-escape-arbiter.ts +34 -0
  591. package/corpus/templates/slides-2/app/components/editor/slide-object-interactions.ts +6362 -0
  592. package/corpus/templates/slides-2/app/components/editor/slide-object-transform.browser-host.ts +19 -0
  593. package/corpus/templates/slides-2/app/components/editor/slide-pointer-target.ts +432 -0
  594. package/corpus/templates/slides-2/app/components/editor/slide-presence.ts +13 -0
  595. package/corpus/templates/slides-2/app/components/editor/slide-style.ts +243 -0
  596. package/corpus/templates/slides-2/app/components/editor/slide-text-targets.ts +540 -0
  597. package/corpus/templates/slides-2/app/components/editor/style-clipboard.ts +102 -0
  598. package/corpus/templates/slides-2/app/components/editor/use-prompt-import.ts +159 -0
  599. package/corpus/templates/slides-2/app/components/home/SlidesHomeLibrary.tsx +79 -0
  600. package/corpus/templates/slides-2/app/components/layout/AgentWorkIndicator.tsx +193 -0
  601. package/corpus/templates/slides-2/app/components/layout/Header.tsx +110 -0
  602. package/corpus/templates/slides-2/app/components/layout/Layout.tsx +492 -0
  603. package/corpus/templates/slides-2/app/components/layout/Sidebar.tsx +109 -0
  604. package/corpus/templates/slides-2/app/components/layout/layout-route-policy.ts +28 -0
  605. package/corpus/templates/slides-2/app/components/presentation/PresentationView.tsx +1116 -0
  606. package/corpus/templates/slides-2/app/components/presentation/PresenterView.tsx +526 -0
  607. package/corpus/templates/slides-2/app/components/presentation/SlideTransitionStage.tsx +297 -0
  608. package/corpus/templates/slides-2/app/components/presentation/present-channel.ts +31 -0
  609. package/corpus/templates/slides-2/app/components/presentation/slide-build-steps.ts +231 -0
  610. package/corpus/templates/slides-2/app/components/presentation/slide-navigation.ts +273 -0
  611. package/corpus/templates/slides-2/app/components/presentation/slide-transition-motion.ts +258 -0
  612. package/corpus/templates/slides-2/app/components/presentation/voice-navigation.ts +61 -0
  613. package/corpus/templates/slides-2/app/components/settings/notification-settings.tsx +93 -0
  614. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2AssetBrowser.tsx +726 -0
  615. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2CommandMenu.tsx +453 -0
  616. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2Comments.tsx +571 -0
  617. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2DesignTokens.tsx +345 -0
  618. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2Editor.tsx +4804 -0
  619. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2ExportMenu.tsx +671 -0
  620. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2FontBrowser.tsx +342 -0
  621. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2ImageCropControls.tsx +487 -0
  622. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2Inspector.tsx +950 -0
  623. package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2SvglLogoSearchDialog.tsx +332 -0
  624. package/corpus/templates/slides-2/app/components/slides-2-editor/cross-slide-edit-history.ts +151 -0
  625. package/corpus/templates/slides-2/app/components/slides-2-editor/design-token-presets.ts +140 -0
  626. package/corpus/templates/slides-2/app/components/slides-2-editor/editor-action-errors.ts +47 -0
  627. package/corpus/templates/slides-2/app/components/slides-2-editor/editor-export-errors.ts +60 -0
  628. package/corpus/templates/slides-2/app/components/slides-2-editor/geometry.ts +275 -0
  629. package/corpus/templates/slides-2/app/components/slides-2-editor/image-crop-style.ts +82 -0
  630. package/corpus/templates/slides-2/app/components/slides-2-editor/inline-text-editor.tsx +631 -0
  631. package/corpus/templates/slides-2/app/components/slides-2-editor/keyboard-shortcuts.ts +104 -0
  632. package/corpus/templates/slides-2/app/components/slides-2-editor/object-insertion.ts +13 -0
  633. package/corpus/templates/slides-2/app/components/slides-2-editor/preview-patches.ts +54 -0
  634. package/corpus/templates/slides-2/app/components/slides-2-editor/sandbox-render-errors.ts +23 -0
  635. package/corpus/templates/slides-2/app/components/slides-2-editor/source-structure.ts +634 -0
  636. package/corpus/templates/slides-2/app/components/slides-2-editor/types.ts +85 -0
  637. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2BlackoutOverlay.tsx +13 -0
  638. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2ControlBar.tsx +285 -0
  639. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2HelpDialog.tsx +72 -0
  640. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2JumpInput.tsx +38 -0
  641. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2LaserPointer.tsx +67 -0
  642. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2Overview.tsx +161 -0
  643. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2Player.tsx +839 -0
  644. package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2ProgressBar.tsx +23 -0
  645. package/corpus/templates/slides-2/app/components/slides-2-presenter/keyboard.ts +36 -0
  646. package/corpus/templates/slides-2/app/components/slides-2-presenter/presenter-channel.ts +131 -0
  647. package/corpus/templates/slides-2/app/components/slides-2-presenter/use-presenter-action-bridge.ts +296 -0
  648. package/corpus/templates/slides-2/app/components/slides-2-presenter/useSlides2TouchSwipe.ts +80 -0
  649. package/corpus/templates/slides-2/app/components/slides-2-runtime/SandboxedSlide.tsx +724 -0
  650. package/corpus/templates/slides-2/app/components/slides-2-runtime/SlideContentRenderer.tsx +137 -0
  651. package/corpus/templates/slides-2/app/components/slides-2-runtime/Slides2Canvas.tsx +99 -0
  652. package/corpus/templates/slides-2/app/components/slides-2-runtime/constants.ts +4 -0
  653. package/corpus/templates/slides-2/app/components/slides-2-runtime/protocol.ts +1400 -0
  654. package/corpus/templates/slides-2/app/components/slides-2-runtime/transition-frame.ts +439 -0
  655. package/corpus/templates/slides-2/app/components/templates/DeckTemplateLibrary.tsx +314 -0
  656. package/corpus/templates/slides-2/app/components/templates/DeckTemplatePreview.tsx +60 -0
  657. package/corpus/templates/slides-2/app/components/templates/DeckTemplateStage.tsx +45 -0
  658. package/corpus/templates/slides-2/app/components/ui/alert-dialog.tsx +1 -0
  659. package/corpus/templates/slides-2/app/components/ui/avatar.tsx +1 -0
  660. package/corpus/templates/slides-2/app/components/ui/button-group.tsx +1 -0
  661. package/corpus/templates/slides-2/app/components/ui/button.tsx +1 -0
  662. package/corpus/templates/slides-2/app/components/ui/card.tsx +1 -0
  663. package/corpus/templates/slides-2/app/components/ui/command.tsx +1 -0
  664. package/corpus/templates/slides-2/app/components/ui/context-menu.tsx +32 -0
  665. package/corpus/templates/slides-2/app/components/ui/dialog.tsx +1 -0
  666. package/corpus/templates/slides-2/app/components/ui/dropdown-menu.tsx +1 -0
  667. package/corpus/templates/slides-2/app/components/ui/filter-trigger.tsx +1 -0
  668. package/corpus/templates/slides-2/app/components/ui/input.tsx +1 -0
  669. package/corpus/templates/slides-2/app/components/ui/label.tsx +1 -0
  670. package/corpus/templates/slides-2/app/components/ui/popover.tsx +1 -0
  671. package/corpus/templates/slides-2/app/components/ui/progress.tsx +1 -0
  672. package/corpus/templates/slides-2/app/components/ui/scroll-area.tsx +1 -0
  673. package/corpus/templates/slides-2/app/components/ui/select.tsx +1 -0
  674. package/corpus/templates/slides-2/app/components/ui/separator.tsx +1 -0
  675. package/corpus/templates/slides-2/app/components/ui/sheet.tsx +1 -0
  676. package/corpus/templates/slides-2/app/components/ui/skeleton.tsx +1 -0
  677. package/corpus/templates/slides-2/app/components/ui/slider.tsx +1 -0
  678. package/corpus/templates/slides-2/app/components/ui/spinner.tsx +1 -0
  679. package/corpus/templates/slides-2/app/components/ui/switch.tsx +1 -0
  680. package/corpus/templates/slides-2/app/components/ui/tabs.tsx +59 -0
  681. package/corpus/templates/slides-2/app/components/ui/textarea.tsx +1 -0
  682. package/corpus/templates/slides-2/app/components/ui/toggle-group.tsx +1 -0
  683. package/corpus/templates/slides-2/app/components/ui/toolkit-provider.tsx +17 -0
  684. package/corpus/templates/slides-2/app/components/ui/tooltip.tsx +1 -0
  685. package/corpus/templates/slides-2/app/components/visual-editor/CanvasCommentPins.tsx +46 -0
  686. package/corpus/templates/slides-2/app/components/visual-editor/DrawOverlay.tsx +27 -0
  687. package/corpus/templates/slides-2/app/components/visual-editor/MultiSelectChip.tsx +97 -0
  688. package/corpus/templates/slides-2/app/components/visual-editor/SaveStatusIndicator.tsx +273 -0
  689. package/corpus/templates/slides-2/app/components/visual-editor/index.ts +4 -0
  690. package/corpus/templates/slides-2/app/context/DeckContext.tsx +7486 -0
  691. package/corpus/templates/slides-2/app/design-system.ts +3 -0
  692. package/corpus/templates/slides-2/app/entry.client.tsx +10 -0
  693. package/corpus/templates/slides-2/app/entry.server.tsx +10 -0
  694. package/corpus/templates/slides-2/app/global.css +1626 -0
  695. package/corpus/templates/slides-2/app/hooks/use-agent-generating.ts +517 -0
  696. package/corpus/templates/slides-2/app/hooks/use-compact-editor-layout.ts +26 -0
  697. package/corpus/templates/slides-2/app/hooks/use-contrast-audit-bridge.ts +49 -0
  698. package/corpus/templates/slides-2/app/hooks/use-deck-access-reload.ts +70 -0
  699. package/corpus/templates/slides-2/app/hooks/use-deck-access.ts +50 -0
  700. package/corpus/templates/slides-2/app/hooks/use-deck-design-system.ts +146 -0
  701. package/corpus/templates/slides-2/app/hooks/use-deck-history-action-bridge.ts +266 -0
  702. package/corpus/templates/slides-2/app/hooks/use-deck-presence.ts +89 -0
  703. package/corpus/templates/slides-2/app/hooks/use-deck-role.ts +46 -0
  704. package/corpus/templates/slides-2/app/hooks/use-deck-versions.ts +43 -0
  705. package/corpus/templates/slides-2/app/hooks/use-design-system-workflows.ts +11 -0
  706. package/corpus/templates/slides-2/app/hooks/use-design-systems.ts +31 -0
  707. package/corpus/templates/slides-2/app/hooks/use-generating-slide-preview.ts +115 -0
  708. package/corpus/templates/slides-2/app/hooks/use-navigation-state.ts +229 -0
  709. package/corpus/templates/slides-2/app/hooks/use-new-deck-generation-signal.ts +46 -0
  710. package/corpus/templates/slides-2/app/hooks/use-new-deck-generation.ts +710 -0
  711. package/corpus/templates/slides-2/app/hooks/use-sidebar-collapsed.ts +95 -0
  712. package/corpus/templates/slides-2/app/hooks/use-slide-comments.ts +202 -0
  713. package/corpus/templates/slides-2/app/hooks/use-slide-file-storage-status.ts +55 -0
  714. package/corpus/templates/slides-2/app/hooks/use-undo-selection.ts +66 -0
  715. package/corpus/templates/slides-2/app/hooks/use-workspace-defaults.ts +31 -0
  716. package/corpus/templates/slides-2/app/i18n/en-US.ts +1507 -0
  717. package/corpus/templates/slides-2/app/i18n/index.ts +19 -0
  718. package/corpus/templates/slides-2/app/lib/agent-visible-message.ts +21 -0
  719. package/corpus/templates/slides-2/app/lib/aspect-ratios.ts +7 -0
  720. package/corpus/templates/slides-2/app/lib/asset-error-copy.ts +59 -0
  721. package/corpus/templates/slides-2/app/lib/canvas-zoom.ts +47 -0
  722. package/corpus/templates/slides-2/app/lib/composer-context.ts +152 -0
  723. package/corpus/templates/slides-2/app/lib/composer-draft.ts +34 -0
  724. package/corpus/templates/slides-2/app/lib/contrast-audit.ts +390 -0
  725. package/corpus/templates/slides-2/app/lib/contrast-resolve.ts +240 -0
  726. package/corpus/templates/slides-2/app/lib/create-deck-generation.ts +938 -0
  727. package/corpus/templates/slides-2/app/lib/deck-access-lost.ts +4 -0
  728. package/corpus/templates/slides-2/app/lib/deck-backup.ts +186 -0
  729. package/corpus/templates/slides-2/app/lib/deck-editor-loading.ts +91 -0
  730. package/corpus/templates/slides-2/app/lib/deck-export-file-client.ts +77 -0
  731. package/corpus/templates/slides-2/app/lib/deck-filter.ts +52 -0
  732. package/corpus/templates/slides-2/app/lib/deck-list-loading.ts +16 -0
  733. package/corpus/templates/slides-2/app/lib/deck-preview-frame.ts +15 -0
  734. package/corpus/templates/slides-2/app/lib/deck-share-links.ts +9 -0
  735. package/corpus/templates/slides-2/app/lib/deck-sorting.ts +19 -0
  736. package/corpus/templates/slides-2/app/lib/deferred-editor-surfaces.ts +24 -0
  737. package/corpus/templates/slides-2/app/lib/design-system-selection.ts +11 -0
  738. package/corpus/templates/slides-2/app/lib/design-systems.ts +231 -0
  739. package/corpus/templates/slides-2/app/lib/dynamic-import.ts +50 -0
  740. package/corpus/templates/slides-2/app/lib/editor-agent-handoff.ts +92 -0
  741. package/corpus/templates/slides-2/app/lib/editor-shortcuts.ts +153 -0
  742. package/corpus/templates/slides-2/app/lib/export-google-slides-client.ts +168 -0
  743. package/corpus/templates/slides-2/app/lib/export-pdf-client.ts +684 -0
  744. package/corpus/templates/slides-2/app/lib/export-pptx-client.ts +2420 -0
  745. package/corpus/templates/slides-2/app/lib/generation-lifecycle.ts +24 -0
  746. package/corpus/templates/slides-2/app/lib/generation-state.ts +247 -0
  747. package/corpus/templates/slides-2/app/lib/google-docs-client.ts +110 -0
  748. package/corpus/templates/slides-2/app/lib/google-slides-export-availability-client.ts +53 -0
  749. package/corpus/templates/slides-2/app/lib/google-slides-reference-source.ts +18 -0
  750. package/corpus/templates/slides-2/app/lib/image-download.ts +85 -0
  751. package/corpus/templates/slides-2/app/lib/image-drop-to-agent.ts +210 -0
  752. package/corpus/templates/slides-2/app/lib/import-uploaded-deck.ts +132 -0
  753. package/corpus/templates/slides-2/app/lib/inline-edit-remote.ts +55 -0
  754. package/corpus/templates/slides-2/app/lib/localize-slides-changelog.ts +47 -0
  755. package/corpus/templates/slides-2/app/lib/mermaid-blocks.ts +18 -0
  756. package/corpus/templates/slides-2/app/lib/new-deck-reference-selection.ts +174 -0
  757. package/corpus/templates/slides-2/app/lib/normalize-slide-padding.ts +74 -0
  758. package/corpus/templates/slides-2/app/lib/pending-deck-changes.ts +33 -0
  759. package/corpus/templates/slides-2/app/lib/portaled-layer.ts +7 -0
  760. package/corpus/templates/slides-2/app/lib/pptx-google-slides.ts +204 -0
  761. package/corpus/templates/slides-2/app/lib/prompt-attachment-adapter.ts +37 -0
  762. package/corpus/templates/slides-2/app/lib/prompt-file-uploads.ts +557 -0
  763. package/corpus/templates/slides-2/app/lib/recent-references.ts +106 -0
  764. package/corpus/templates/slides-2/app/lib/reference-document-hydration.ts +406 -0
  765. package/corpus/templates/slides-2/app/lib/register-chat-renderers.tsx +645 -0
  766. package/corpus/templates/slides-2/app/lib/reveal-after-delete.ts +55 -0
  767. package/corpus/templates/slides-2/app/lib/sanitize-slide-html.ts +752 -0
  768. package/corpus/templates/slides-2/app/lib/slide-agent-context.ts +148 -0
  769. package/corpus/templates/slides-2/app/lib/slide-animation-elements.ts +900 -0
  770. package/corpus/templates/slides-2/app/lib/slide-clipboard.ts +534 -0
  771. package/corpus/templates/slides-2/app/lib/slide-comment-anchor.ts +286 -0
  772. package/corpus/templates/slides-2/app/lib/slide-content-merge.ts +295 -0
  773. package/corpus/templates/slides-2/app/lib/slide-image-replacement.ts +1919 -0
  774. package/corpus/templates/slides-2/app/lib/slide-live-remote.ts +215 -0
  775. package/corpus/templates/slides-2/app/lib/slide-scroll.ts +56 -0
  776. package/corpus/templates/slides-2/app/lib/slide-source-map.ts +1099 -0
  777. package/corpus/templates/slides-2/app/lib/slide-video.ts +390 -0
  778. package/corpus/templates/slides-2/app/lib/slides-relay-tracking.ts +114 -0
  779. package/corpus/templates/slides-2/app/lib/streaming-slide-html.ts +77 -0
  780. package/corpus/templates/slides-2/app/lib/tab-id.ts +3 -0
  781. package/corpus/templates/slides-2/app/lib/template-navigation.ts +15 -0
  782. package/corpus/templates/slides-2/app/lib/text-tool-shortcut.ts +75 -0
  783. package/corpus/templates/slides-2/app/lib/undo-reveal.ts +332 -0
  784. package/corpus/templates/slides-2/app/lib/upload-response.ts +107 -0
  785. package/corpus/templates/slides-2/app/lib/utils.ts +38 -0
  786. package/corpus/templates/slides-2/app/lib/validate-native-slide-html.ts +177 -0
  787. package/corpus/templates/slides-2/app/lib/video-upload.ts +354 -0
  788. package/corpus/templates/slides-2/app/pages/DeckEditor.tsx +6158 -0
  789. package/corpus/templates/slides-2/app/pages/DesignSystems.tsx +363 -0
  790. package/corpus/templates/slides-2/app/pages/Index.tsx +3254 -0
  791. package/corpus/templates/slides-2/app/pages/NotFound.tsx +33 -0
  792. package/corpus/templates/slides-2/app/pages/Presentation.tsx +120 -0
  793. package/corpus/templates/slides-2/app/pages/SharedPresentation.tsx +174 -0
  794. package/corpus/templates/slides-2/app/pages/SlideThemeDetail.tsx +227 -0
  795. package/corpus/templates/slides-2/app/pages/SlideThemes.tsx +155 -0
  796. package/corpus/templates/slides-2/app/pages/Slides2EditorPage.tsx +1618 -0
  797. package/corpus/templates/slides-2/app/pages/Slides2PresenterConsolePage.tsx +937 -0
  798. package/corpus/templates/slides-2/app/pages/Slides2PresenterPage.tsx +979 -0
  799. package/corpus/templates/slides-2/app/pages/Templates.tsx +32 -0
  800. package/corpus/templates/slides-2/app/root.tsx +391 -0
  801. package/corpus/templates/slides-2/app/routes/$.tsx +10 -0
  802. package/corpus/templates/slides-2/app/routes/_index.tsx +1 -0
  803. package/corpus/templates/slides-2/app/routes/access-request.approve.tsx +276 -0
  804. package/corpus/templates/slides-2/app/routes/agent.tsx +19 -0
  805. package/corpus/templates/slides-2/app/routes/chat.$threadId.tsx +1 -0
  806. package/corpus/templates/slides-2/app/routes/chat.tsx +190 -0
  807. package/corpus/templates/slides-2/app/routes/deck.$id.tsx +10 -0
  808. package/corpus/templates/slides-2/app/routes/deck.$id_.present.tsx +10 -0
  809. package/corpus/templates/slides-2/app/routes/design-systems.tsx +10 -0
  810. package/corpus/templates/slides-2/app/routes/extensions.$id.$slug.tsx +2 -0
  811. package/corpus/templates/slides-2/app/routes/extensions.$id.tsx +5 -0
  812. package/corpus/templates/slides-2/app/routes/extensions._index.tsx +5 -0
  813. package/corpus/templates/slides-2/app/routes/extensions.tsx +5 -0
  814. package/corpus/templates/slides-2/app/routes/home-layout.tsx +31 -0
  815. package/corpus/templates/slides-2/app/routes/home.tsx +22 -0
  816. package/corpus/templates/slides-2/app/routes/p.$id.tsx +195 -0
  817. package/corpus/templates/slides-2/app/routes/settings.$.tsx +1 -0
  818. package/corpus/templates/slides-2/app/routes/settings.tsx +131 -0
  819. package/corpus/templates/slides-2/app/routes/share.$token.tsx +137 -0
  820. package/corpus/templates/slides-2/app/routes/slide.tsx +209 -0
  821. package/corpus/templates/slides-2/app/routes/team.tsx +11 -0
  822. package/corpus/templates/slides-2/app/routes/templates.tsx +1 -0
  823. package/corpus/templates/slides-2/app/routes/themes.$id.tsx +1 -0
  824. package/corpus/templates/slides-2/app/routes/themes.tsx +1 -0
  825. package/corpus/templates/slides-2/app/routes.ts +24 -0
  826. package/corpus/templates/slides-2/app/vite-env.d.ts +24 -0
  827. package/corpus/templates/slides-2/changelog/2026-10-17-find-and-switch-decks-from-the-presenter-console.md +6 -0
  828. package/corpus/templates/slides-2/changelog/2026-10-17-meet-slides-2-create-and-refine-editable-slide-decks-with-an.md +6 -0
  829. package/corpus/templates/slides-2/changelog/2026-10-17-pptx-image-export.md +6 -0
  830. package/corpus/templates/slides-2/changelog/2026-10-17-visual-editor.md +6 -0
  831. package/corpus/templates/slides-2/changelog/2026-10-18-apply-an-accessible-design-system-to-an-existing-deck-before.md +6 -0
  832. package/corpus/templates/slides-2/changelog/2026-10-18-choose-a-template-or-start-a-new-presentation-from-the-slide.md +6 -0
  833. package/corpus/templates/slides-2/changelog/2026-10-18-generate-decks-from-a-prompt-then-edit-slide-elements-direct.md +6 -0
  834. package/corpus/templates/slides-2/changelog/2026-10-18-generate-presentation-decks-from-a-prompt-and-edit-every-sli.md +6 -0
  835. package/corpus/templates/slides-2/changelog/2026-10-18-new-presentation-drafts-save-before-generation-starts-so-you.md +6 -0
  836. package/corpus/templates/slides-2/changelog/2026-10-18-the-assistant-can-undo-redo-and-save-pending-edits-in-the-vi.md +6 -0
  837. package/corpus/templates/slides-2/changelog/2026-10-19-agents-can-insert-duplicate-and-delete-canvas-objects-in-sou.md +6 -0
  838. package/corpus/templates/slides-2/changelog/2026-10-19-browse-slide-themes.md +6 -0
  839. package/corpus/templates/slides-2/changelog/2026-10-19-clicking-a-slide-preview-in-overview-selects-that-slide.md +6 -0
  840. package/corpus/templates/slides-2/changelog/2026-10-19-create-decks-from-a-prompt-and-edit-slides-directly-on-the-c.md +6 -0
  841. package/corpus/templates/slides-2/changelog/2026-10-19-creating-and-editing-decks-now-starts-with-the-tools-most-re.md +6 -0
  842. package/corpus/templates/slides-2/changelog/2026-10-19-deleting-decks-revokes-public-links.md +7 -0
  843. package/corpus/templates/slides-2/changelog/2026-10-19-escape-cancels-an-in-progress-slide-drag-without-losing-earl.md +6 -0
  844. package/corpus/templates/slides-2/changelog/2026-10-19-import-failures-now-show-clear-localized-descriptions-instea.md +6 -0
  845. package/corpus/templates/slides-2/changelog/2026-10-19-presenter-controls-stay-responsive-when-moving-over-the-slid.md +6 -0
  846. package/corpus/templates/slides-2/changelog/2026-10-19-presenter-notes-stay-private-from-viewers-and-commenters.md +6 -0
  847. package/corpus/templates/slides-2/changelog/2026-10-19-preview-generated-slides-in-chat.md +6 -0
  848. package/corpus/templates/slides-2/changelog/2026-10-19-remote-image-previews-accept-supported-raster-formats.md +6 -0
  849. package/corpus/templates/slides-2/changelog/2026-10-19-search-the-svgl-catalog-and-add-svg-logos-to-a-deck-or-the-g.md +6 -0
  850. package/corpus/templates/slides-2/changelog/2026-10-19-slide-generation-explains-when-react-effect-hooks-cannot-run.md +6 -0
  851. package/corpus/templates/slides-2/changelog/2026-10-19-the-editor-highlights-hovered-objects-and-keeps-image-replac.md +6 -0
  852. package/corpus/templates/slides-2/changelog/2026-10-19-the-slide-editor-uses-the-shared-agent-native-controls.md +6 -0
  853. package/corpus/templates/slides-2/changelog/2026-10-20-deck-editing-controls-match-the-workspace.md +6 -0
  854. package/corpus/templates/slides-2/changelog/2026-10-20-google-slides-imports-now-report-missing-image-data-instead-.md +6 -0
  855. package/corpus/templates/slides-2/changelog/2026-10-20-imports-and-previews-handle-large-content-safely.md +6 -0
  856. package/corpus/templates/slides-2/changelog/2026-10-20-public-deck-pages-can-export-source-backed-slides-to-pdf.md +6 -0
  857. package/corpus/templates/slides-2/changelog/2026-10-20-saved-slide-images-stay-available.md +6 -0
  858. package/corpus/templates/slides-2/changelog/2026-10-20-scope-global-media-picks-to-assets-the-current-deck-can-reso.md +6 -0
  859. package/corpus/templates/slides-2/components.json +20 -0
  860. package/corpus/templates/slides-2/drizzle.config.ts +3 -0
  861. package/corpus/templates/slides-2/learnings.defaults.md +5 -0
  862. package/corpus/templates/slides-2/netlify.toml +24 -0
  863. package/corpus/templates/slides-2/package.json +147 -0
  864. package/corpus/templates/slides-2/public/agent-native-icon-dark.svg +10 -0
  865. package/corpus/templates/slides-2/public/agent-native-icon-light.svg +10 -0
  866. package/corpus/templates/slides-2/public/agent-native-logo-dark.svg +21 -0
  867. package/corpus/templates/slides-2/public/agent-native-logo-light.svg +21 -0
  868. package/corpus/templates/slides-2/public/assets/builder-logo-white.svg +15 -0
  869. package/corpus/templates/slides-2/public/assets/generated/preview.html +61 -0
  870. package/corpus/templates/slides-2/public/assets/intuit-logo-white.svg +6 -0
  871. package/corpus/templates/slides-2/public/assets/walmart-logo-white.svg +6 -0
  872. package/corpus/templates/slides-2/public/chatgpt-plugin-icon.svg +7 -0
  873. package/corpus/templates/slides-2/public/favicon.svg +1 -0
  874. package/corpus/templates/slides-2/public/icon-180.svg +1 -0
  875. package/corpus/templates/slides-2/public/icon-192.svg +1 -0
  876. package/corpus/templates/slides-2/public/icon-512.svg +1 -0
  877. package/corpus/templates/slides-2/public/manifest.json +20 -0
  878. package/corpus/templates/slides-2/public/placeholder.svg +1 -0
  879. package/corpus/templates/slides-2/public/robots.txt +14 -0
  880. package/corpus/templates/slides-2/public/visual-edit-structure-proof.html +99 -0
  881. package/corpus/templates/slides-2/react-router.config.ts +7 -0
  882. package/corpus/templates/slides-2/scripts/edit-fidelity/README.md +499 -0
  883. package/corpus/templates/slides-2/scripts/edit-fidelity/authoring-fuzz.ts +9517 -0
  884. package/corpus/templates/slides-2/scripts/edit-fidelity/baseline.json +16427 -0
  885. package/corpus/templates/slides-2/scripts/edit-fidelity/dev-server-url.ts +10 -0
  886. package/corpus/templates/slides-2/scripts/edit-fidelity/lib/in-page.ts +1975 -0
  887. package/corpus/templates/slides-2/scripts/edit-fidelity/lib/metrics.ts +1401 -0
  888. package/corpus/templates/slides-2/scripts/edit-fidelity/retry-infra.ts +7 -0
  889. package/corpus/templates/slides-2/scripts/edit-fidelity/run-options.ts +21 -0
  890. package/corpus/templates/slides-2/scripts/edit-fidelity/run-outcomes.ts +127 -0
  891. package/corpus/templates/slides-2/scripts/edit-fidelity/run.ts +8451 -0
  892. package/corpus/templates/slides-2/scripts/export-fidelity/README.md +116 -0
  893. package/corpus/templates/slides-2/scripts/export-fidelity/compare-layout-lib.ts +241 -0
  894. package/corpus/templates/slides-2/scripts/export-fidelity/compare-layout.ts +30 -0
  895. package/corpus/templates/slides-2/scripts/export-fidelity/diff.ts +222 -0
  896. package/corpus/templates/slides-2/scripts/export-fidelity/export.ts +765 -0
  897. package/corpus/templates/slides-2/scripts/export-fidelity/fixtures/agent-dark-deck.json +48 -0
  898. package/corpus/templates/slides-2/scripts/export-fidelity/generate-calibration.ts +765 -0
  899. package/corpus/templates/slides-2/scripts/export-fidelity/google-export.ts +137 -0
  900. package/corpus/templates/slides-2/scripts/export-fidelity/google-layout.ts +82 -0
  901. package/corpus/templates/slides-2/scripts/export-fidelity/resolve-pkg.ts +29 -0
  902. package/corpus/templates/slides-2/scripts/migrate-production.ts +22 -0
  903. package/corpus/templates/slides-2/server/db/index.ts +73 -0
  904. package/corpus/templates/slides-2/server/db/schema.ts +189 -0
  905. package/corpus/templates/slides-2/server/handlers/assets-url.ts +13 -0
  906. package/corpus/templates/slides-2/server/handlers/assets.ts +3217 -0
  907. package/corpus/templates/slides-2/server/handlers/decks.ts +185 -0
  908. package/corpus/templates/slides-2/server/handlers/demo.ts +9 -0
  909. package/corpus/templates/slides-2/server/handlers/design-systems.ts +219 -0
  910. package/corpus/templates/slides-2/server/handlers/google-docs-auth.ts +165 -0
  911. package/corpus/templates/slides-2/server/handlers/image-gen.ts +153 -0
  912. package/corpus/templates/slides-2/server/handlers/image-providers/gemini.ts +209 -0
  913. package/corpus/templates/slides-2/server/handlers/image-providers/index.ts +61 -0
  914. package/corpus/templates/slides-2/server/handlers/image-providers/openai.ts +288 -0
  915. package/corpus/templates/slides-2/server/handlers/image-providers/types.ts +35 -0
  916. package/corpus/templates/slides-2/server/handlers/import/docx-parser.ts +31 -0
  917. package/corpus/templates/slides-2/server/handlers/import/html-converter.ts +1534 -0
  918. package/corpus/templates/slides-2/server/handlers/import/pdf-fidelity-parser.ts +1039 -0
  919. package/corpus/templates/slides-2/server/handlers/import/pdf-sidecar-reader.ts +81 -0
  920. package/corpus/templates/slides-2/server/handlers/import/pdf-style-digest.ts +187 -0
  921. package/corpus/templates/slides-2/server/handlers/import/pptx-assets.ts +155 -0
  922. package/corpus/templates/slides-2/server/handlers/import/pptx-parser.ts +57 -0
  923. package/corpus/templates/slides-2/server/handlers/request-auth-context.ts +108 -0
  924. package/corpus/templates/slides-2/server/handlers/share.ts +52 -0
  925. package/corpus/templates/slides-2/server/handlers/uploads-chunked.ts +1066 -0
  926. package/corpus/templates/slides-2/server/handlers/uploads.ts +457 -0
  927. package/corpus/templates/slides-2/server/lib/access-request-email.ts +66 -0
  928. package/corpus/templates/slides-2/server/lib/assets-image-delegation.ts +331 -0
  929. package/corpus/templates/slides-2/server/lib/bounded-multipart.ts +49 -0
  930. package/corpus/templates/slides-2/server/lib/builder-design-system-proxy.ts +122 -0
  931. package/corpus/templates/slides-2/server/lib/chat-attachments.ts +425 -0
  932. package/corpus/templates/slides-2/server/lib/chatgpt-directory-tools.ts +246 -0
  933. package/corpus/templates/slides-2/server/lib/chunked-upload-session.ts +195 -0
  934. package/corpus/templates/slides-2/server/lib/comment-notifications.ts +184 -0
  935. package/corpus/templates/slides-2/server/lib/deck-access-requests.ts +102 -0
  936. package/corpus/templates/slides-2/server/lib/deck-asset-scope.ts +150 -0
  937. package/corpus/templates/slides-2/server/lib/deck-export-tracking.ts +119 -0
  938. package/corpus/templates/slides-2/server/lib/deck-templates/a-case-study.ts +154 -0
  939. package/corpus/templates/slides-2/server/lib/deck-templates/a-company.ts +160 -0
  940. package/corpus/templates/slides-2/server/lib/deck-templates/a-pitch.ts +151 -0
  941. package/corpus/templates/slides-2/server/lib/deck-templates/a-quarterly.ts +264 -0
  942. package/corpus/templates/slides-2/server/lib/deck-templates/a-shared.ts +35 -0
  943. package/corpus/templates/slides-2/server/lib/deck-templates/a-update.ts +188 -0
  944. package/corpus/templates/slides-2/server/lib/deck-templates/a-workshop.ts +196 -0
  945. package/corpus/templates/slides-2/server/lib/deck-templates/b-keynote.ts +131 -0
  946. package/corpus/templates/slides-2/server/lib/deck-templates/b-lesson.ts +209 -0
  947. package/corpus/templates/slides-2/server/lib/deck-templates/b-manifesto.ts +149 -0
  948. package/corpus/templates/slides-2/server/lib/deck-templates/b-portfolio.ts +144 -0
  949. package/corpus/templates/slides-2/server/lib/deck-templates/b-research.ts +221 -0
  950. package/corpus/templates/slides-2/server/lib/deck-templates/b-roadmap.ts +264 -0
  951. package/corpus/templates/slides-2/server/lib/deck-templates/b-shared.ts +44 -0
  952. package/corpus/templates/slides-2/server/lib/deck-templates/group-a.ts +16 -0
  953. package/corpus/templates/slides-2/server/lib/deck-templates/group-b.ts +16 -0
  954. package/corpus/templates/slides-2/server/lib/deck-templates/legacy.ts +567 -0
  955. package/corpus/templates/slides-2/server/lib/deck-templates.ts +60 -0
  956. package/corpus/templates/slides-2/server/lib/deck-versions.ts +233 -0
  957. package/corpus/templates/slides-2/server/lib/design-system-workflows.ts +22 -0
  958. package/corpus/templates/slides-2/server/lib/emails.ts +84 -0
  959. package/corpus/templates/slides-2/server/lib/env-config.ts +15 -0
  960. package/corpus/templates/slides-2/server/lib/fetch-remote-image.ts +245 -0
  961. package/corpus/templates/slides-2/server/lib/generation-completion.ts +278 -0
  962. package/corpus/templates/slides-2/server/lib/google-docs-access.ts +51 -0
  963. package/corpus/templates/slides-2/server/lib/google-docs-error.ts +54 -0
  964. package/corpus/templates/slides-2/server/lib/google-docs-oauth.ts +422 -0
  965. package/corpus/templates/slides-2/server/lib/google-fonts.ts +509 -0
  966. package/corpus/templates/slides-2/server/lib/google-oauth-preflight.ts +119 -0
  967. package/corpus/templates/slides-2/server/lib/google-slides-export-availability.ts +55 -0
  968. package/corpus/templates/slides-2/server/lib/image-proxy-response.ts +16 -0
  969. package/corpus/templates/slides-2/server/lib/image-proxy-url.ts +155 -0
  970. package/corpus/templates/slides-2/server/lib/import-asset-storage.ts +214 -0
  971. package/corpus/templates/slides-2/server/lib/imported-asset-batch.ts +218 -0
  972. package/corpus/templates/slides-2/server/lib/legacy-slide-source.ts +692 -0
  973. package/corpus/templates/slides-2/server/lib/media-search-providers.ts +216 -0
  974. package/corpus/templates/slides-2/server/lib/native-creative-context.ts +295 -0
  975. package/corpus/templates/slides-2/server/lib/pdf-parse-setup.ts +115 -0
  976. package/corpus/templates/slides-2/server/lib/provider-api.ts +57 -0
  977. package/corpus/templates/slides-2/server/lib/request-wait-until.ts +30 -0
  978. package/corpus/templates/slides-2/server/lib/shared-deck.ts +29 -0
  979. package/corpus/templates/slides-2/server/lib/slide-asset-references.ts +309 -0
  980. package/corpus/templates/slides-2/server/lib/slide-content-patch.ts +1004 -0
  981. package/corpus/templates/slides-2/server/lib/slide-hygiene.ts +731 -0
  982. package/corpus/templates/slides-2/server/lib/slide-image-insertion.ts +136 -0
  983. package/corpus/templates/slides-2/server/lib/slide-reveal-issues.ts +41 -0
  984. package/corpus/templates/slides-2/server/lib/slide-source-editing/babel-walk.ts +117 -0
  985. package/corpus/templates/slides-2/server/lib/slide-source-editing/batch-edit.ts +152 -0
  986. package/corpus/templates/slides-2/server/lib/slide-source-editing/edit-ops.ts +1478 -0
  987. package/corpus/templates/slides-2/server/lib/slide-source-editing/image-target.ts +128 -0
  988. package/corpus/templates/slides-2/server/lib/slide-source-editing/text-diff.ts +23 -0
  989. package/corpus/templates/slides-2/server/lib/slide-source-limits.ts +9 -0
  990. package/corpus/templates/slides-2/server/lib/slide-source.ts +1786 -0
  991. package/corpus/templates/slides-2/server/lib/slide-theme-demo-sources.ts +2106 -0
  992. package/corpus/templates/slides-2/server/lib/slide-themes.ts +2174 -0
  993. package/corpus/templates/slides-2/server/lib/slide-worker-runtime.ts +1995 -0
  994. package/corpus/templates/slides-2/server/lib/slides-tracking.ts +73 -0
  995. package/corpus/templates/slides-2/server/lib/source-import.ts +213 -0
  996. package/corpus/templates/slides-2/server/lib/svgl.ts +364 -0
  997. package/corpus/templates/slides-2/server/lib/tenant-files.ts +179 -0
  998. package/corpus/templates/slides-2/server/lib/upload-storage-status.ts +9 -0
  999. package/corpus/templates/slides-2/server/lib/uploaded-asset-cleanup-outbox.ts +521 -0
  1000. package/corpus/templates/slides-2/server/lib/uploaded-asset-object-lifecycle.ts +404 -0
  1001. package/corpus/templates/slides-2/server/lib/uploaded-fonts.ts +696 -0
  1002. package/corpus/templates/slides-2/server/lib/uploaded-reference-storage.ts +77 -0
  1003. package/corpus/templates/slides-2/server/lib/validate-slide-animations.ts +341 -0
  1004. package/corpus/templates/slides-2/server/middleware/auth.ts +6 -0
  1005. package/corpus/templates/slides-2/server/plugins/_dev-upload-stub.ts +6 -0
  1006. package/corpus/templates/slides-2/server/plugins/agent-chat.ts +402 -0
  1007. package/corpus/templates/slides-2/server/plugins/auth.ts +31 -0
  1008. package/corpus/templates/slides-2/server/plugins/collab.ts +30 -0
  1009. package/corpus/templates/slides-2/server/plugins/config.ts +6 -0
  1010. package/corpus/templates/slides-2/server/plugins/core-routes.ts +30 -0
  1011. package/corpus/templates/slides-2/server/plugins/creative-context.ts +187 -0
  1012. package/corpus/templates/slides-2/server/plugins/db.ts +462 -0
  1013. package/corpus/templates/slides-2/server/plugins/feature-flags.ts +5 -0
  1014. package/corpus/templates/slides-2/server/plugins/labs.ts +8 -0
  1015. package/corpus/templates/slides-2/server/plugins/orphaned-asset-cleanup.ts +17 -0
  1016. package/corpus/templates/slides-2/server/plugins/otel.ts +6 -0
  1017. package/corpus/templates/slides-2/server/plugins/transactional-emails.ts +5 -0
  1018. package/corpus/templates/slides-2/server/register-secrets.ts +209 -0
  1019. package/corpus/templates/slides-2/server/routes/[...page].get.ts +5 -0
  1020. package/corpus/templates/slides-2/server/routes/[...page].head.ts +1 -0
  1021. package/corpus/templates/slides-2/server/routes/[base]/_agent-native/google-docs/auth-url.get.ts +1 -0
  1022. package/corpus/templates/slides-2/server/routes/[base]/_agent-native/google-docs/callback.get.ts +1 -0
  1023. package/corpus/templates/slides-2/server/routes/_agent-native/google-docs/auth-url.get.ts +1 -0
  1024. package/corpus/templates/slides-2/server/routes/_agent-native/google-docs/callback.get.ts +1 -0
  1025. package/corpus/templates/slides-2/server/routes/api/assets/upload-video.post.ts +1 -0
  1026. package/corpus/templates/slides-2/server/routes/api/assets/upload.post.ts +1 -0
  1027. package/corpus/templates/slides-2/server/routes/api/assets/video-uploads.delete.ts +1 -0
  1028. package/corpus/templates/slides-2/server/routes/api/deck-agent-context.json.get.ts +105 -0
  1029. package/corpus/templates/slides-2/server/routes/api/decks/events.get.ts +1 -0
  1030. package/corpus/templates/slides-2/server/routes/api/demo.get.ts +1 -0
  1031. package/corpus/templates/slides-2/server/routes/api/exports/[filename].get.ts +221 -0
  1032. package/corpus/templates/slides-2/server/routes/api/exports/google-slides.post.ts +240 -0
  1033. package/corpus/templates/slides-2/server/routes/api/exports/html.post.ts +67 -0
  1034. package/corpus/templates/slides-2/server/routes/api/exports/pptx.post.ts +100 -0
  1035. package/corpus/templates/slides-2/server/routes/api/gen-preview/[...].get.ts +24 -0
  1036. package/corpus/templates/slides-2/server/routes/api/generated/[...].get.ts +24 -0
  1037. package/corpus/templates/slides-2/server/routes/api/image-proxy.get.ts +518 -0
  1038. package/corpus/templates/slides-2/server/routes/api/import-assets/[token].get.ts +70 -0
  1039. package/corpus/templates/slides-2/server/routes/api/preview-images.get.ts +20 -0
  1040. package/corpus/templates/slides-2/server/routes/api/share/[token].get.ts +1 -0
  1041. package/corpus/templates/slides-2/server/routes/api/uploads-chunked/[sessionId]/chunk.post.ts +1 -0
  1042. package/corpus/templates/slides-2/server/routes/api/uploads-chunked/[sessionId]/status.get.ts +1 -0
  1043. package/corpus/templates/slides-2/server/routes/api/uploads-chunked/[sessionId].delete.ts +1 -0
  1044. package/corpus/templates/slides-2/server/routes/api/uploads-chunked/start.post.ts +1 -0
  1045. package/corpus/templates/slides-2/server/routes/api/uploads.delete.ts +1 -0
  1046. package/corpus/templates/slides-2/server/routes/api/uploads.post.ts +1 -0
  1047. package/corpus/templates/slides-2/server/workspace-defaults.ts +196 -0
  1048. package/corpus/templates/slides-2/shared/action-ui.ts +147 -0
  1049. package/corpus/templates/slides-2/shared/agent-readable.ts +2 -0
  1050. package/corpus/templates/slides-2/shared/api.ts +406 -0
  1051. package/corpus/templates/slides-2/shared/app-state-tabs.ts +30 -0
  1052. package/corpus/templates/slides-2/shared/app-storage.ts +9 -0
  1053. package/corpus/templates/slides-2/shared/aspect-ratios.ts +49 -0
  1054. package/corpus/templates/slides-2/shared/blank-slide.ts +179 -0
  1055. package/corpus/templates/slides-2/shared/client-compatibility.ts +2 -0
  1056. package/corpus/templates/slides-2/shared/contrast-audit.ts +255 -0
  1057. package/corpus/templates/slides-2/shared/deck-access.ts +26 -0
  1058. package/corpus/templates/slides-2/shared/deck-app-scope.ts +14 -0
  1059. package/corpus/templates/slides-2/shared/deck-content.ts +37 -0
  1060. package/corpus/templates/slides-2/shared/deck-history-control.ts +79 -0
  1061. package/corpus/templates/slides-2/shared/deck-scope.ts +5 -0
  1062. package/corpus/templates/slides-2/shared/deck-title.ts +199 -0
  1063. package/corpus/templates/slides-2/shared/deck-write.ts +61 -0
  1064. package/corpus/templates/slides-2/shared/design-flags.ts +7 -0
  1065. package/corpus/templates/slides-2/shared/design-system-validation.ts +88 -0
  1066. package/corpus/templates/slides-2/shared/editor-control.ts +120 -0
  1067. package/corpus/templates/slides-2/shared/generation-timing.ts +19 -0
  1068. package/corpus/templates/slides-2/shared/google-docs.ts +69 -0
  1069. package/corpus/templates/slides-2/shared/labs.ts +10 -0
  1070. package/corpus/templates/slides-2/shared/overview-navigation.ts +34 -0
  1071. package/corpus/templates/slides-2/shared/ownership.ts +6 -0
  1072. package/corpus/templates/slides-2/shared/pdf-sidecar.ts +130 -0
  1073. package/corpus/templates/slides-2/shared/presenter-control.ts +111 -0
  1074. package/corpus/templates/slides-2/shared/representative-slide.ts +89 -0
  1075. package/corpus/templates/slides-2/shared/slide-background.ts +30 -0
  1076. package/corpus/templates/slides-2/shared/slide-comment-anchor.ts +117 -0
  1077. package/corpus/templates/slides-2/shared/slide-comment-reactions.ts +47 -0
  1078. package/corpus/templates/slides-2/shared/slide-design-tokens.ts +92 -0
  1079. package/corpus/templates/slides-2/shared/slide-fit.ts +78 -0
  1080. package/corpus/templates/slides-2/shared/slide-ids.ts +133 -0
  1081. package/corpus/templates/slides-2/shared/slide-number.ts +124 -0
  1082. package/corpus/templates/slides-2/shared/slide-object-structure.ts +790 -0
  1083. package/corpus/templates/slides-2/shared/slide-text-range-selection.ts +50 -0
  1084. package/corpus/templates/slides-2/shared/slide-transitions.ts +70 -0
  1085. package/corpus/templates/slides-2/shared/slides-2-transition.ts +194 -0
  1086. package/corpus/templates/slides-2/shared/slides-user-prefs.ts +22 -0
  1087. package/corpus/templates/slides-2/shared/source-import-errors.ts +12 -0
  1088. package/corpus/templates/slides-2/shared/source-runtime-export.ts +76 -0
  1089. package/corpus/templates/slides-2/shared/upload-types.ts +41 -0
  1090. package/corpus/templates/slides-2/ssr-entry.ts +11 -0
  1091. package/corpus/templates/slides-2/tsconfig.json +27 -0
  1092. package/corpus/templates/slides-2/vite.config.ts +77 -0
  1093. package/corpus/templates/slides-2/vitest.config.ts +28 -0
  1094. package/corpus/templates/tasks/.agents/skills/actions/references/action-fields.md +1 -1
  1095. package/package.json +1 -1
  1096. package/corpus/templates/design/.agents/skills/shader-fills/SKILL.md +0 -182
  1097. package/corpus/templates/design/actions/apply-shader-fill.ts +0 -450
  1098. package/corpus/templates/design/actions/apply-shader.ts +0 -257
  1099. package/corpus/templates/design/actions/preview-shader-fill.ts +0 -157
  1100. package/corpus/templates/design/app/components/design/inspector/GlslShaderPanel.tsx +0 -1144
  1101. package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +0 -450
  1102. package/corpus/templates/design/app/components/design/inspector/ShaderControls.stories.tsx +0 -71
  1103. package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +0 -555
  1104. package/corpus/templates/design/app/components/design/inspector/ShaderEffectRow.tsx +0 -105
  1105. package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +0 -433
  1106. package/corpus/templates/design/app/components/design/inspector/color-picker-shader-pane.tsx +0 -648
  1107. package/corpus/templates/design/shared/shader-fill.ts +0 -174
  1108. package/corpus/templates/design/shared/shader-presets.ts +0 -1523
@@ -0,0 +1,1478 @@
1
+ import * as t from "@babel/types";
2
+
3
+ import {
4
+ findJsxAncestors,
5
+ parseSource,
6
+ walkAll,
7
+ walkJsx,
8
+ } from "./babel-walk.js";
9
+ import { textDiff } from "./text-diff.js";
10
+
11
+ export type EditOp =
12
+ | { kind: "set-style"; key: string; value: string | null; prevText?: string }
13
+ | { kind: "set-text"; value: string; prevText?: string }
14
+ | {
15
+ kind: "set-text-range-style";
16
+ start: number;
17
+ end: number;
18
+ key: string;
19
+ value: string | null;
20
+ prevText?: string;
21
+ }
22
+ | { kind: "set-attr-asset"; attr: string; assetId: string }
23
+ | { kind: "replace-placeholder-with-image"; assetId: string }
24
+ | { kind: "insert-image-asset"; assetId: string; alt: string };
25
+
26
+ export type ApplyEditResult =
27
+ | { ok: true; source: string }
28
+ | { ok: false; status: number; error: string };
29
+
30
+ export type Splice = { from: number; to: number; text: string };
31
+
32
+ export function jsString(s: string): string {
33
+ return `'${s.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n")}'`;
34
+ }
35
+
36
+ export function spliceRange(node: t.Node, text: string): Splice {
37
+ return { from: node.start ?? 0, to: node.end ?? 0, text };
38
+ }
39
+
40
+ // Splices are applied back-to-front so earlier offsets stay valid, then the
41
+ // result is re-parsed — a rewrite that cannot be parsed is rejected whole.
42
+ export function applySplices(
43
+ source: string,
44
+ splices: Splice[],
45
+ ): ApplyEditResult {
46
+ const ordered = [...splices].sort((a, b) => b.from - a.from);
47
+ let next = source;
48
+ for (const sp of ordered) {
49
+ next = next.slice(0, sp.from) + sp.text + next.slice(sp.to);
50
+ }
51
+ if (!parseSource(next)) {
52
+ return {
53
+ ok: false,
54
+ status: 422,
55
+ error: "edit would produce invalid source",
56
+ };
57
+ }
58
+ return { ok: true, source: next };
59
+ }
60
+
61
+ // Emit a JSX attribute value: `"foo"` when the value is round-trip-safe
62
+ // inside double quotes; otherwise wrap in `{...}` so escapes work.
63
+ export function formatJsxAttrValue(value: string): string {
64
+ if (/^[^"\\<>&{}\n\r]*$/.test(value)) return `"${value}"`;
65
+ return `{${jsString(value)}}`;
66
+ }
67
+
68
+ function jsxAttrName(attr: t.JSXAttribute): string | null {
69
+ return t.isJSXIdentifier(attr.name) ? attr.name.name : null;
70
+ }
71
+
72
+ export function findJsxAttr(
73
+ opening: t.JSXOpeningElement,
74
+ name: string,
75
+ ): t.JSXAttribute | null {
76
+ for (const attr of opening.attributes) {
77
+ if (t.isJSXAttribute(attr) && jsxAttrName(attr) === name) return attr;
78
+ }
79
+ return null;
80
+ }
81
+
82
+ export function readJsxStringAttr(
83
+ opening: t.JSXOpeningElement,
84
+ name: string,
85
+ ): string | null {
86
+ const attr = findJsxAttr(opening, name);
87
+ const v = attr?.value;
88
+ if (!v) return null;
89
+ if (t.isStringLiteral(v)) return v.value;
90
+ if (t.isJSXExpressionContainer(v) && t.isStringLiteral(v.expression))
91
+ return v.expression.value;
92
+ return null;
93
+ }
94
+
95
+ function readJsxNumberAttr(
96
+ opening: t.JSXOpeningElement,
97
+ name: string,
98
+ ): number | null {
99
+ const attr = findJsxAttr(opening, name);
100
+ const v = attr?.value;
101
+ if (!v || !t.isJSXExpressionContainer(v)) return null;
102
+ if (!t.isNumericLiteral(v.expression)) return null;
103
+ const n = v.expression.value;
104
+ return Number.isFinite(n) ? n : null;
105
+ }
106
+
107
+ export type ImportInfo = {
108
+ node: t.ImportDeclaration;
109
+ source: string;
110
+ defaultIdent: string | null;
111
+ };
112
+
113
+ export function findImports(ast: t.File): ImportInfo[] {
114
+ const out: ImportInfo[] = [];
115
+ for (const node of ast.program.body) {
116
+ if (!t.isImportDeclaration(node)) continue;
117
+ let def: string | null = null;
118
+ for (const spec of node.specifiers) {
119
+ if (t.isImportDefaultSpecifier(spec)) {
120
+ def = spec.local.name;
121
+ break;
122
+ }
123
+ }
124
+ out.push({ node, source: node.source.value, defaultIdent: def });
125
+ }
126
+ return out;
127
+ }
128
+
129
+ export function safeAssetIdentifier(
130
+ filename: string,
131
+ taken: Set<string>,
132
+ ): string {
133
+ const stem = filename.replace(/\.[^.]+$/, "");
134
+ let camel = "";
135
+ let upper = false;
136
+ for (const ch of stem) {
137
+ if (/[A-Za-z0-9]/.test(ch)) {
138
+ camel += upper ? ch.toUpperCase() : ch;
139
+ upper = false;
140
+ } else {
141
+ upper = camel.length > 0;
142
+ }
143
+ }
144
+ let base = camel;
145
+ if (!base || !/^[A-Za-z_$]/.test(base)) {
146
+ base = `asset${base.charAt(0).toUpperCase()}${base.slice(1)}` || "asset";
147
+ }
148
+ base = base.charAt(0).toLowerCase() + base.slice(1);
149
+ let candidate = base;
150
+ let i = 2;
151
+ while (taken.has(candidate)) {
152
+ candidate = `${base}${i}`;
153
+ i += 1;
154
+ }
155
+ return candidate;
156
+ }
157
+
158
+ function findJsxByStart(
159
+ ast: t.Node,
160
+ line: number,
161
+ column: number,
162
+ ): t.JSXElement | null {
163
+ let hit: t.JSXElement | null = null;
164
+ walkJsx(ast, (n) => {
165
+ if (!t.isJSXElement(n) || !n.loc) return;
166
+ const s = n.loc.start;
167
+ if (s.line === line && s.column === column) {
168
+ hit = n;
169
+ return "stop";
170
+ }
171
+ });
172
+ return hit;
173
+ }
174
+
175
+ function findInnermostJsxElement(
176
+ ast: t.Node,
177
+ line: number,
178
+ column: number,
179
+ ): t.JSXElement | null {
180
+ // Prefer exact `loc.start` match (what `data-slide-loc` sends) so
181
+ // we don't accidentally hit an outer JSX whose range happens to
182
+ // enclose the click point.
183
+ const exact = findJsxByStart(ast, line, column);
184
+ if (exact) return exact;
185
+
186
+ // Fallback for fiber-walked clicks whose column may not align with
187
+ // the opening `<`.
188
+ for (const n of findJsxAncestors(ast, line, column)) {
189
+ if (t.isJSXElement(n)) return n;
190
+ }
191
+ return null;
192
+ }
193
+
194
+ function findUniqueElementByText(
195
+ ast: t.Node,
196
+ prevText: string,
197
+ ): t.JSXElement | null {
198
+ const hits: Array<{ node: t.JSXElement; size: number }> = [];
199
+ walkJsx(ast, (n) => {
200
+ if (!t.isJSXElement(n)) return;
201
+ if (textRangeContent(collectTextRangeParts(n)) !== prevText) return;
202
+ hits.push({ node: n, size: (n.end ?? 0) - (n.start ?? 0) });
203
+ });
204
+ if (hits.length === 0) return null;
205
+ hits.sort((a, b) => a.size - b.size);
206
+ const best = hits[0];
207
+ const bestStart = best.node.start ?? 0;
208
+ const bestEnd = best.node.end ?? 0;
209
+ const hasSiblingMatch = hits
210
+ .slice(1)
211
+ .some(
212
+ ({ node }) => (node.start ?? 0) > bestStart || (node.end ?? 0) < bestEnd,
213
+ );
214
+ return hasSiblingMatch ? null : best.node;
215
+ }
216
+
217
+ function fallbackTextForOps(ops: EditOp[]): string | null {
218
+ for (const op of ops) {
219
+ if (
220
+ (op.kind === "set-style" ||
221
+ op.kind === "set-text" ||
222
+ op.kind === "set-text-range-style") &&
223
+ op.prevText !== undefined
224
+ ) {
225
+ return op.prevText;
226
+ }
227
+ }
228
+ return null;
229
+ }
230
+
231
+ function hasOnlyTextOps(ops: EditOp[]): boolean {
232
+ return ops.length > 0 && ops.every((op) => op.kind === "set-text");
233
+ }
234
+
235
+ function elementTextMatches(element: t.JSXElement, prevText: string): boolean {
236
+ return textRangeContent(collectTextRangeParts(element)) === prevText;
237
+ }
238
+
239
+ export function findElementForEdit(
240
+ ast: t.File,
241
+ line: number,
242
+ column: number,
243
+ ops: EditOp[],
244
+ ): t.JSXElement | null {
245
+ const element = findInnermostJsxElement(ast, line, column);
246
+ const prevText = fallbackTextForOps(ops);
247
+ if (prevText === null) return element;
248
+ if (
249
+ hasOnlyTextOps(ops) &&
250
+ element &&
251
+ (elementTextMatches(element, prevText) ||
252
+ elementTextCandidateMatches(ast, element, prevText))
253
+ ) {
254
+ return element;
255
+ }
256
+ return findUniqueElementByText(ast, prevText) ?? element;
257
+ }
258
+
259
+ function buildStyleSplice(
260
+ source: string,
261
+ element: t.JSXElement,
262
+ ops: Array<{ key: string; value: string | null }>,
263
+ ): Splice | { error: string } | null {
264
+ const opening = element.openingElement;
265
+ const existing = findJsxAttr(opening, "style");
266
+ type StyleEntry =
267
+ | { kind: "prop"; key: string; keyText: string; valueText: string }
268
+ | { kind: "raw"; text: string };
269
+ const entries: StyleEntry[] = [];
270
+ let hasRawEntry = false;
271
+
272
+ if (existing) {
273
+ const value = existing.value;
274
+ if (!value || !t.isJSXExpressionContainer(value)) {
275
+ return { error: "style attribute has unsupported form" };
276
+ }
277
+ const expr = value.expression;
278
+ if (!t.isObjectExpression(expr)) {
279
+ if (typeof expr.start !== "number" || typeof expr.end !== "number") {
280
+ return { error: "style value missing source range" };
281
+ }
282
+ entries.push({
283
+ kind: "raw",
284
+ text: `...(${source.slice(expr.start, expr.end)})`,
285
+ });
286
+ hasRawEntry = true;
287
+ } else {
288
+ for (const prop of expr.properties) {
289
+ if (t.isObjectProperty(prop) && !prop.computed) {
290
+ let keyName: string | null = null;
291
+ if (t.isIdentifier(prop.key)) keyName = prop.key.name;
292
+ else if (t.isStringLiteral(prop.key)) keyName = prop.key.value;
293
+ if (!keyName) return { error: "style has unsupported key" };
294
+ const v = prop.value;
295
+ if (
296
+ typeof prop.key.start !== "number" ||
297
+ typeof prop.key.end !== "number" ||
298
+ typeof v.start !== "number" ||
299
+ typeof v.end !== "number"
300
+ ) {
301
+ return { error: "style value missing source range" };
302
+ }
303
+ entries.push({
304
+ kind: "prop",
305
+ key: keyName,
306
+ keyText: source.slice(prop.key.start, prop.key.end),
307
+ valueText: source.slice(v.start, v.end),
308
+ });
309
+ } else {
310
+ if (typeof prop.start !== "number" || typeof prop.end !== "number") {
311
+ return { error: "style value missing source range" };
312
+ }
313
+ entries.push({
314
+ kind: "raw",
315
+ text: source.slice(prop.start, prop.end),
316
+ });
317
+ hasRawEntry = true;
318
+ }
319
+ }
320
+ }
321
+ }
322
+
323
+ for (const op of ops) {
324
+ const matching = entries.filter(
325
+ (entry): entry is Extract<StyleEntry, { kind: "prop" }> =>
326
+ entry.kind === "prop" && entry.key === op.key,
327
+ );
328
+ if (op.value === null) {
329
+ for (const entry of matching) entries.splice(entries.indexOf(entry), 1);
330
+ if (hasRawEntry) {
331
+ entries.push({
332
+ kind: "prop",
333
+ key: op.key,
334
+ keyText: op.key,
335
+ valueText: "undefined",
336
+ });
337
+ }
338
+ } else if (matching.length > 0) {
339
+ matching[matching.length - 1].valueText = jsString(op.value);
340
+ } else {
341
+ entries.push({
342
+ kind: "prop",
343
+ key: op.key,
344
+ keyText: op.key,
345
+ valueText: jsString(op.value),
346
+ });
347
+ }
348
+ }
349
+
350
+ if (entries.length === 0) {
351
+ if (!existing) return null;
352
+ let from = existing.start ?? 0;
353
+ if (from > 0 && source[from - 1] === " ") from -= 1;
354
+ return { from, to: existing.end ?? 0, text: "" };
355
+ }
356
+
357
+ const propsText = entries
358
+ .map((entry) =>
359
+ entry.kind === "prop"
360
+ ? `${entry.keyText}: ${entry.valueText}`
361
+ : entry.text,
362
+ )
363
+ .join(", ");
364
+ const newAttr = `style={{ ${propsText} }}`;
365
+
366
+ if (existing) {
367
+ const lastAttr = opening.attributes[opening.attributes.length - 1];
368
+ if (lastAttr && lastAttr !== existing && typeof lastAttr.end === "number") {
369
+ const attrsAfterStyle = source
370
+ .slice(existing.end ?? 0, lastAttr.end)
371
+ .replace(/^[ \t]+/, "");
372
+ return {
373
+ from: existing.start ?? 0,
374
+ to: lastAttr.end,
375
+ text: `${attrsAfterStyle} ${newAttr}`,
376
+ };
377
+ }
378
+ return { from: existing.start ?? 0, to: existing.end ?? 0, text: newAttr };
379
+ }
380
+ const lastAttr = opening.attributes[opening.attributes.length - 1];
381
+ const at = lastAttr?.end ?? opening.name.end ?? 0;
382
+ return { from: at, to: at, text: ` ${newAttr}` };
383
+ }
384
+
385
+ function formatJsxText(value: string): string {
386
+ // JSXText can't hold `{}<>` and collapses leading/trailing whitespace,
387
+ // so wrap the value in an expression container when it would lose info.
388
+ if (/[{}<>]/.test(value) || /^\s|\s$/.test(value) || value === "") {
389
+ return `{${jsString(value)}}`;
390
+ }
391
+ return value;
392
+ }
393
+
394
+ type TextCandidate = {
395
+ // Normalized current text the candidate represents — what an
396
+ // unambiguous DOM `textContent` would render here. Used to match
397
+ // against the client-supplied `prevText` when there's more than one.
398
+ current: string;
399
+ splice: (value: string) => Splice;
400
+ };
401
+
402
+ type JsxParent = t.JSXElement | t.JSXFragment;
403
+ type TextRangeLeaf = {
404
+ node: t.JSXText | t.JSXExpressionContainer;
405
+ parent: JsxParent;
406
+ current: string;
407
+ raw: string;
408
+ text: (value: string) => string;
409
+ offsets: Array<number | null>;
410
+ };
411
+ type TextRangeBreak = { node: t.JSXElement; current: "\n" };
412
+ type TextRangePart = TextRangeLeaf | TextRangeBreak;
413
+
414
+ function meaningfulChildren(parent: JsxParent): t.Node[] {
415
+ return parent.children.filter((c) => {
416
+ if (t.isJSXText(c)) return c.value.trim() !== "";
417
+ return true;
418
+ });
419
+ }
420
+
421
+ function isOnlyMeaningfulChild(parent: JsxParent, child: t.Node): boolean {
422
+ const meaningful = meaningfulChildren(parent);
423
+ return meaningful.length === 1 && meaningful[0] === child;
424
+ }
425
+
426
+ // Wrap-style splice: rewrite the whole children span of `parent`. Used
427
+ // when the candidate is the parent's only meaningful child, so old
428
+ // surrounding whitespace nodes don't leak into the new value.
429
+ function wrapSplice(parent: JsxParent, text: string): Splice {
430
+ const first = parent.children[0];
431
+ const last = parent.children[parent.children.length - 1];
432
+ return { from: first.start ?? 0, to: last.end ?? 0, text };
433
+ }
434
+
435
+ function splitLinesWithOffsets(
436
+ value: string,
437
+ ): Array<{ text: string; start: number }> {
438
+ const lines: Array<{ text: string; start: number }> = [];
439
+ let start = 0;
440
+ for (let i = 0; i < value.length; i++) {
441
+ const ch = value[i];
442
+ if (ch !== "\n" && ch !== "\r") continue;
443
+ lines.push({ text: value.slice(start, i), start });
444
+ if (ch === "\r" && value[i + 1] === "\n") i += 1;
445
+ start = i + 1;
446
+ }
447
+ lines.push({ text: value.slice(start), start });
448
+ return lines;
449
+ }
450
+
451
+ function cleanJsxTextWithOffsets(value: string): {
452
+ text: string;
453
+ offsets: Array<number | null>;
454
+ } {
455
+ const lines = splitLinesWithOffsets(value);
456
+ let lastNonEmptyLine = 0;
457
+ for (let i = 0; i < lines.length; i++) {
458
+ if (lines[i].text.trim()) lastNonEmptyLine = i;
459
+ }
460
+
461
+ let text = "";
462
+ const offsets: Array<number | null> = [];
463
+ for (let i = 0; i < lines.length; i++) {
464
+ const chars = Array.from(lines[i].text, (ch, j) => ({
465
+ ch: ch === "\t" ? " " : ch,
466
+ offset: lines[i].start + j,
467
+ }));
468
+ let from = 0;
469
+ let to = chars.length;
470
+ if (i !== 0) {
471
+ while (from < to && chars[from].ch === " ") from += 1;
472
+ }
473
+ if (i !== lines.length - 1) {
474
+ while (to > from && chars[to - 1].ch === " ") to -= 1;
475
+ }
476
+ if (from >= to) continue;
477
+ for (const item of chars.slice(from, to)) {
478
+ text += item.ch;
479
+ offsets.push(item.offset);
480
+ }
481
+ if (i !== lastNonEmptyLine) {
482
+ text += " ";
483
+ offsets.push(null);
484
+ }
485
+ }
486
+ return { text, offsets };
487
+ }
488
+
489
+ function isJsxBrElement(node: t.Node): node is t.JSXElement {
490
+ if (!t.isJSXElement(node)) return false;
491
+ const name = node.openingElement.name;
492
+ return t.isJSXIdentifier(name) && name.name.toLowerCase() === "br";
493
+ }
494
+
495
+ function collectTextCandidates(element: JsxParent, out: TextCandidate[]): void {
496
+ const meaningful = meaningfulChildren(element);
497
+ const isSole = meaningful.length === 1;
498
+ for (const child of meaningful) {
499
+ if (t.isJSXText(child)) {
500
+ const current = child.value.trim();
501
+ if (!current) continue;
502
+ out.push({
503
+ current,
504
+ splice: (v) =>
505
+ isSole
506
+ ? wrapSplice(element, formatJsxText(v))
507
+ : {
508
+ from: child.start ?? 0,
509
+ to: child.end ?? 0,
510
+ text: formatJsxText(v),
511
+ },
512
+ });
513
+ } else if (t.isJSXExpressionContainer(child)) {
514
+ const expr = child.expression;
515
+ if (t.isStringLiteral(expr) || t.isNumericLiteral(expr)) {
516
+ const current = String(expr.value);
517
+ out.push({
518
+ current,
519
+ splice: (v) =>
520
+ isSole
521
+ ? wrapSplice(element, `{${jsString(v)}}`)
522
+ : {
523
+ from: child.start ?? 0,
524
+ to: child.end ?? 0,
525
+ text: `{${jsString(v)}}`,
526
+ },
527
+ });
528
+ }
529
+ } else if (t.isJSXElement(child) || t.isJSXFragment(child)) {
530
+ collectTextCandidates(child, out);
531
+ }
532
+ }
533
+ }
534
+
535
+ function collectTextRangeParts(element: JsxParent): TextRangePart[] {
536
+ const parts: TextRangePart[] = [];
537
+ collectTextRangePartsRaw(element, parts);
538
+ return normalizeTextRangeParts(parts);
539
+ }
540
+
541
+ function collectTextRangePartsRaw(
542
+ element: JsxParent,
543
+ out: TextRangePart[],
544
+ ): void {
545
+ for (const child of element.children) {
546
+ if (t.isJSXText(child)) {
547
+ const { text: current, offsets } = cleanJsxTextWithOffsets(child.value);
548
+ if (current) {
549
+ out.push({
550
+ node: child,
551
+ parent: element,
552
+ current,
553
+ raw: child.value,
554
+ text: formatJsxText,
555
+ offsets,
556
+ });
557
+ }
558
+ } else if (t.isJSXExpressionContainer(child)) {
559
+ const expression = child.expression;
560
+ if (t.isStringLiteral(expression) || t.isNumericLiteral(expression)) {
561
+ const raw = String(expression.value);
562
+ const current = raw;
563
+ if (current) {
564
+ out.push({
565
+ node: child,
566
+ parent: element,
567
+ current,
568
+ raw,
569
+ text: (value) => `{${jsString(value)}}`,
570
+ offsets: Array.from({ length: current.length }, (_, i) => i),
571
+ });
572
+ }
573
+ }
574
+ } else if (isJsxBrElement(child)) {
575
+ out.push({ node: child, current: "\n" });
576
+ } else if (t.isJSXElement(child) || t.isJSXFragment(child)) {
577
+ collectTextRangePartsRaw(child, out);
578
+ }
579
+ }
580
+ }
581
+
582
+ function normalizeTextRangeParts(parts: TextRangePart[]): TextRangePart[] {
583
+ return parts.flatMap((part, index): TextRangePart[] => {
584
+ if (!("raw" in part)) return [part];
585
+ let start = 0;
586
+ let end = part.current.length;
587
+ if (parts[index - 1]?.current === "\n") {
588
+ while (start < end && /\s/.test(part.current[start] ?? "")) start++;
589
+ }
590
+ if (parts[index + 1]?.current === "\n") {
591
+ while (end > start && /\s/.test(part.current[end - 1] ?? "")) end--;
592
+ }
593
+ if (start === 0 && end === part.current.length) return [part];
594
+ if (start >= end) return [];
595
+ return [
596
+ {
597
+ ...part,
598
+ current: part.current.slice(start, end),
599
+ offsets: part.offsets.slice(start, end),
600
+ },
601
+ ];
602
+ });
603
+ }
604
+
605
+ function resetValueForRangeStyle(key: string): string | null {
606
+ if (key === "fontWeight") return "400";
607
+ if (key === "fontStyle") return "normal";
608
+ return null;
609
+ }
610
+
611
+ function styleSpanForText(
612
+ text: string,
613
+ key: string,
614
+ value: string | null,
615
+ ): string {
616
+ const styleValue = value ?? resetValueForRangeStyle(key);
617
+ if (styleValue === null) return formatJsxText(text);
618
+ return `<span style={{ ${key}: ${jsString(styleValue)} }}>${formatJsxText(text)}</span>`;
619
+ }
620
+
621
+ function textRangeContent(parts: TextRangePart[]): string {
622
+ return parts.map((part) => part.current).join("");
623
+ }
624
+
625
+ function compactText(value: string): string {
626
+ return value.replace(/\s+/g, "");
627
+ }
628
+
629
+ function textMatchesExpected(current: string, expected: string): boolean {
630
+ return current === expected || compactText(current) === compactText(expected);
631
+ }
632
+
633
+ function formatRichText(value: string, formatText = formatJsxText): string {
634
+ return value
635
+ .split("\n")
636
+ .map((part) => formatText(part))
637
+ .join("<br />");
638
+ }
639
+
640
+ function formatOptionalText(
641
+ value: string,
642
+ formatText: (v: string) => string,
643
+ ): string {
644
+ return value ? formatText(value) : "";
645
+ }
646
+
647
+ function textLeafSplice(part: TextRangeLeaf, value: string): Splice {
648
+ const rawRange = textLeafRawRange(part, 0, part.current.length);
649
+ if (!rawRange) return spliceRange(part.node, part.text(value));
650
+ const { rawStart, rawEnd } = rawRange;
651
+ return {
652
+ from: part.node.start ?? 0,
653
+ to: part.node.end ?? 0,
654
+ text: `${part.raw.slice(0, rawStart)}${formatRichText(value, part.text)}${part.raw.slice(rawEnd)}`,
655
+ };
656
+ }
657
+
658
+ function textLeafRawRange(
659
+ part: TextRangeLeaf,
660
+ start: number,
661
+ end: number,
662
+ ): { rawStart: number; rawEnd: number } | null {
663
+ if (start >= end) return null;
664
+ let first: number | null = null;
665
+ let last: number | null = null;
666
+ for (let i = start; i < end; i++) {
667
+ const offset = part.offsets[i];
668
+ if (offset === undefined) return null;
669
+ if (offset === null) continue;
670
+ first ??= offset;
671
+ last = offset;
672
+ }
673
+ if (first === null || last === null) return null;
674
+ return { rawStart: first, rawEnd: last + 1 };
675
+ }
676
+
677
+ function buildTextRangeReplaceSplices(
678
+ parts: TextRangePart[],
679
+ start: number,
680
+ end: number,
681
+ value: string,
682
+ ): Splice[] | { error: string } {
683
+ const splices: Splice[] = [];
684
+ let offset = 0;
685
+ let inserted = false;
686
+
687
+ for (const part of parts) {
688
+ const partStart = offset;
689
+ const partEnd = partStart + part.current.length;
690
+ offset = partEnd;
691
+
692
+ const overlaps = start < partEnd && end > partStart;
693
+ const insertsHere =
694
+ start === end && !inserted && start >= partStart && start <= partEnd;
695
+ if (!overlaps && !insertsHere) continue;
696
+
697
+ if ("raw" in part) {
698
+ const localStart = Math.max(start, partStart) - partStart;
699
+ const localEnd = overlaps
700
+ ? Math.min(end, partEnd) - partStart
701
+ : localStart;
702
+ const nextText = `${part.current.slice(0, localStart)}${inserted ? "" : value}${part.current.slice(localEnd)}`;
703
+ splices.push(textLeafSplice(part, nextText));
704
+ } else if (overlaps) {
705
+ splices.push(
706
+ spliceRange(part.node, inserted ? "" : formatRichText(value)),
707
+ );
708
+ } else if (insertsHere) {
709
+ const at =
710
+ start === partStart ? (part.node.start ?? 0) : (part.node.end ?? 0);
711
+ splices.push({ from: at, to: at, text: formatRichText(value) });
712
+ }
713
+
714
+ inserted = true;
715
+ }
716
+
717
+ if (!inserted && start === end && start === offset) {
718
+ const last = parts[parts.length - 1];
719
+ if (!last) return { error: "element has no editable text" };
720
+ if ("raw" in last) {
721
+ splices.push(textLeafSplice(last, `${last.current}${value}`));
722
+ } else {
723
+ splices.push({
724
+ from: last.node.end ?? 0,
725
+ to: last.node.end ?? 0,
726
+ text: formatRichText(value),
727
+ });
728
+ }
729
+ }
730
+
731
+ return splices;
732
+ }
733
+
734
+ function buildTextContentSplices(
735
+ element: t.JSXElement,
736
+ value: string,
737
+ prevText: string,
738
+ ): Splice[] | { error: string } {
739
+ const parts = collectTextRangeParts(element);
740
+ const current = textRangeContent(parts);
741
+ if (!textMatchesExpected(current, prevText)) {
742
+ return { error: "no text candidate matches the current value" };
743
+ }
744
+ const diff = textDiff(current, value);
745
+ if (diff.start === diff.end && diff.value === "") return [];
746
+ return buildTextRangeReplaceSplices(parts, diff.start, diff.end, diff.value);
747
+ }
748
+
749
+ function buildTextRangeStyleSplices(
750
+ ast: t.File,
751
+ source: string,
752
+ element: t.JSXElement,
753
+ start: number,
754
+ end: number,
755
+ op: { key: string; value: string | null },
756
+ prevText?: string,
757
+ ): Splice[] | { error: string } | null {
758
+ if (
759
+ !Number.isInteger(start) ||
760
+ !Number.isInteger(end) ||
761
+ start < 0 ||
762
+ end <= start
763
+ ) {
764
+ return { error: "invalid text range" };
765
+ }
766
+
767
+ const parts = collectTextRangeParts(element);
768
+ const renderedText = textRangeContent(parts);
769
+ const current = prevText ?? renderedText;
770
+ if (!current) return { error: "element has no editable text" };
771
+ if (end > current.length) return { error: "text range is out of bounds" };
772
+ if (prevText !== undefined && renderedText !== prevText) {
773
+ if (elementTextCandidateMatches(ast, element, prevText)) {
774
+ const result = buildStyleSplice(source, element, [op]);
775
+ if (result && "error" in result) return result;
776
+ return result ? [result] : [];
777
+ }
778
+ return { error: "no text candidate matches the current value" };
779
+ }
780
+
781
+ const splices: Splice[] = [];
782
+ let leafStart = 0;
783
+ for (const leaf of parts) {
784
+ const leafEnd = leafStart + leaf.current.length;
785
+ if (!("raw" in leaf)) {
786
+ leafStart = leafEnd;
787
+ continue;
788
+ }
789
+ const selectedStart = Math.max(start, leafStart);
790
+ const selectedEnd = Math.min(end, leafEnd);
791
+ if (selectedStart >= selectedEnd) {
792
+ leafStart = leafEnd;
793
+ continue;
794
+ }
795
+
796
+ if (
797
+ selectedStart === leafStart &&
798
+ selectedEnd === leafEnd &&
799
+ t.isJSXElement(leaf.parent) &&
800
+ leaf.parent !== element &&
801
+ isOnlyMeaningfulChild(leaf.parent, leaf.node)
802
+ ) {
803
+ const result = buildStyleSplice(source, leaf.parent, [op]);
804
+ if (result && "error" in result) return result;
805
+ if (result) splices.push(result);
806
+ leafStart = leafEnd;
807
+ continue;
808
+ }
809
+
810
+ const localStart = selectedStart - leafStart;
811
+ const localEnd = selectedEnd - leafStart;
812
+ const rawRange = textLeafRawRange(leaf, localStart, localEnd);
813
+ if (!rawRange) return { error: "text range source mismatch" };
814
+ const raw = leaf.raw;
815
+ const { rawStart, rawEnd } = rawRange;
816
+ const before = raw.slice(0, rawStart);
817
+ const selected = leaf.current.slice(localStart, localEnd);
818
+ const after = raw.slice(rawEnd);
819
+ const beforeText = t.isJSXText(leaf.node)
820
+ ? before
821
+ : formatOptionalText(before, leaf.text);
822
+ const afterText = t.isJSXText(leaf.node)
823
+ ? after
824
+ : formatOptionalText(after, leaf.text);
825
+ splices.push(
826
+ spliceRange(
827
+ leaf.node,
828
+ `${beforeText}${styleSpanForText(selected, op.key, op.value)}${afterText}`,
829
+ ),
830
+ );
831
+ leafStart = leafEnd;
832
+ }
833
+
834
+ return splices.length > 0 ? splices : null;
835
+ }
836
+
837
+ // `<Wrap>{children}</Wrap>` and `<h2>{title}</h2>` — sole child is a
838
+ // JSXExpressionContainer wrapping a bare Identifier. Returns the identifier
839
+ // name; callers branch on `'children'` vs. a generic prop passthrough.
840
+ function propPassthroughName(element: t.JSXElement): string | null {
841
+ const meaningful = meaningfulChildren(element);
842
+ if (meaningful.length !== 1) return null;
843
+ const child = meaningful[0];
844
+ if (!t.isJSXExpressionContainer(child)) return null;
845
+ return t.isIdentifier(child.expression) ? child.expression.name : null;
846
+ }
847
+
848
+ type EnclosingComponent = {
849
+ name: string;
850
+ fn: t.FunctionDeclaration | t.FunctionExpression | t.ArrowFunctionExpression;
851
+ };
852
+
853
+ // Smallest top-level capitalized function whose body covers `target`.
854
+ function findEnclosingComponent(
855
+ ast: t.File,
856
+ target: t.Node,
857
+ ): EnclosingComponent | null {
858
+ let best: EnclosingComponent | null = null;
859
+ let bestSize = Number.POSITIVE_INFINITY;
860
+ const targetStart = target.start ?? 0;
861
+ const targetEnd = target.end ?? 0;
862
+ const consider = (name: string, fn: EnclosingComponent["fn"]) => {
863
+ if (!/^[A-Z]/.test(name)) return;
864
+ const fnStart = fn.start ?? 0;
865
+ const fnEnd = fn.end ?? 0;
866
+ if (fnStart > targetStart || fnEnd < targetEnd) return;
867
+ const size = fnEnd - fnStart;
868
+ if (size < bestSize) {
869
+ best = { name, fn };
870
+ bestSize = size;
871
+ }
872
+ };
873
+ const visitDecl = (decl: t.Statement) => {
874
+ if (t.isFunctionDeclaration(decl) && decl.id) {
875
+ consider(decl.id.name, decl);
876
+ } else if (t.isVariableDeclaration(decl)) {
877
+ for (const d of decl.declarations) {
878
+ if (!t.isVariableDeclarator(d) || !t.isIdentifier(d.id) || !d.init)
879
+ continue;
880
+ if (
881
+ t.isArrowFunctionExpression(d.init) ||
882
+ t.isFunctionExpression(d.init)
883
+ ) {
884
+ consider(d.id.name, d.init);
885
+ }
886
+ }
887
+ }
888
+ };
889
+ for (const decl of ast.program.body) {
890
+ visitDecl(decl);
891
+ if (
892
+ t.isExportNamedDeclaration(decl) ||
893
+ t.isExportDefaultDeclaration(decl)
894
+ ) {
895
+ const inner = decl.declaration;
896
+ if (inner && (t.isStatement(inner) || t.isFunctionDeclaration(inner))) {
897
+ visitDecl(inner as t.Statement);
898
+ }
899
+ }
900
+ }
901
+ return best;
902
+ }
903
+
904
+ function componentDestructuresProp(
905
+ fn: EnclosingComponent["fn"],
906
+ propName: string,
907
+ ): boolean {
908
+ if (fn.params.length === 0) return false;
909
+ let first: t.Node = fn.params[0];
910
+ // Handle `({ title }: Props = defaults)` — strip the default-value wrapper.
911
+ if (t.isAssignmentPattern(first)) first = first.left;
912
+ if (!t.isObjectPattern(first)) return false;
913
+ for (const prop of first.properties) {
914
+ if (!t.isObjectProperty(prop)) continue;
915
+ if (t.isIdentifier(prop.key) && prop.key.name === propName) return true;
916
+ if (t.isStringLiteral(prop.key) && prop.key.value === propName) return true;
917
+ }
918
+ return false;
919
+ }
920
+
921
+ function collectCallSiteCandidates(
922
+ ast: t.Node,
923
+ componentName: string,
924
+ ): TextCandidate[] {
925
+ const out: TextCandidate[] = [];
926
+ walkJsx(ast, (n) => {
927
+ if (!t.isJSXElement(n)) return;
928
+ const elName = n.openingElement.name;
929
+ if (t.isJSXIdentifier(elName) && elName.name === componentName) {
930
+ collectTextCandidates(n, out);
931
+ }
932
+ });
933
+ return out;
934
+ }
935
+
936
+ function collectPropCallSiteCandidates(
937
+ ast: t.Node,
938
+ componentName: string,
939
+ propName: string,
940
+ ): TextCandidate[] {
941
+ const out: TextCandidate[] = [];
942
+ walkJsx(ast, (n) => {
943
+ if (!t.isJSXElement(n)) return;
944
+ const elName = n.openingElement.name;
945
+ if (!t.isJSXIdentifier(elName) || elName.name !== componentName) return;
946
+ const attr = findJsxAttr(n.openingElement, propName);
947
+ if (!attr?.value) return; // shorthand-true: not editable text.
948
+ const v = attr.value;
949
+ if (t.isStringLiteral(v)) {
950
+ out.push({
951
+ current: v.value,
952
+ splice: (s) => spliceRange(v, formatJsxAttrValue(s)),
953
+ });
954
+ } else if (t.isJSXExpressionContainer(v)) {
955
+ const expr = v.expression;
956
+ if (t.isStringLiteral(expr) || t.isNumericLiteral(expr)) {
957
+ out.push({
958
+ current: String(expr.value),
959
+ splice: (s) => spliceRange(v, formatJsxAttrValue(s)),
960
+ });
961
+ }
962
+ }
963
+ });
964
+ return out;
965
+ }
966
+
967
+ // Smallest enclosing `arr.map((p) => …)` callback (or `.flatMap`) that
968
+ // covers `target`. Returns the callback fn plus the array argument node.
969
+ function findEnclosingMapCallback(
970
+ ast: t.Node,
971
+ target: t.Node,
972
+ ): {
973
+ fn: t.ArrowFunctionExpression | t.FunctionExpression;
974
+ arrayArg: t.Expression;
975
+ } | null {
976
+ type Best = {
977
+ fn: t.ArrowFunctionExpression | t.FunctionExpression;
978
+ arrayArg: t.Expression;
979
+ size: number;
980
+ };
981
+ let best: Best | null = null;
982
+ const targetStart = target.start ?? 0;
983
+ const targetEnd = target.end ?? 0;
984
+ walkAll(ast, (node) => {
985
+ if (!t.isCallExpression(node)) return;
986
+ const callee = node.callee;
987
+ if (!t.isMemberExpression(callee) || callee.computed) return;
988
+ if (!t.isIdentifier(callee.property)) return;
989
+ if (callee.property.name !== "map" && callee.property.name !== "flatMap")
990
+ return;
991
+ const fn = node.arguments[0];
992
+ if (
993
+ !fn ||
994
+ (!t.isArrowFunctionExpression(fn) && !t.isFunctionExpression(fn))
995
+ )
996
+ return;
997
+ const fnStart = fn.start ?? 0;
998
+ const fnEnd = fn.end ?? 0;
999
+ if (fnStart > targetStart || fnEnd < targetEnd) return;
1000
+ if (!t.isExpression(callee.object)) return;
1001
+ const size = fnEnd - fnStart;
1002
+ if (!best || size < best.size) best = { fn, arrayArg: callee.object, size };
1003
+ });
1004
+ if (!best) return null;
1005
+ const found: Best = best;
1006
+ return { fn: found.fn, arrayArg: found.arrayArg };
1007
+ }
1008
+
1009
+ type ArrayElement = t.Expression | t.SpreadElement;
1010
+
1011
+ // `[ {...}, {...} ]` literal, either inline or via a `const x = [ ... ]`
1012
+ // declaration the receiver resolves to. Returns the ArrayExpression's
1013
+ // element list, or null if we can't resolve to a literal.
1014
+ function resolveArrayLiteralElements(
1015
+ ast: t.Node,
1016
+ expr: t.Expression,
1017
+ ): ArrayElement[] | null {
1018
+ const dropHoles = (arr: t.ArrayExpression): ArrayElement[] =>
1019
+ arr.elements.filter((e): e is ArrayElement => e != null);
1020
+ if (t.isArrayExpression(expr)) return dropHoles(expr);
1021
+ if (!t.isIdentifier(expr)) return null;
1022
+ const name = expr.name;
1023
+ const useStart = expr.start ?? 0;
1024
+ let init: t.ArrayExpression | null = null;
1025
+ walkAll(ast, (node) => {
1026
+ if (!t.isVariableDeclarator(node)) return;
1027
+ if (!t.isIdentifier(node.id) || node.id.name !== name) return;
1028
+ if (!node.init || !t.isArrayExpression(node.init)) return;
1029
+ // Must be declared before the use site; pick the most local match.
1030
+ if ((node.init.start ?? 0) > useStart) return;
1031
+ init = node.init;
1032
+ });
1033
+ return init ? dropHoles(init) : null;
1034
+ }
1035
+
1036
+ function findObjectProperty(
1037
+ obj: t.Node,
1038
+ name: string,
1039
+ ): t.ObjectProperty | null {
1040
+ if (!t.isObjectExpression(obj)) return null;
1041
+ for (const prop of obj.properties) {
1042
+ if (!t.isObjectProperty(prop) || prop.computed) continue;
1043
+ if (t.isIdentifier(prop.key) && prop.key.name === name) return prop;
1044
+ if (t.isStringLiteral(prop.key) && prop.key.value === name) return prop;
1045
+ }
1046
+ return null;
1047
+ }
1048
+
1049
+ // Decode `{p.field}` (MemberExpression) or `{field}` (Identifier
1050
+ // destructured from the callback param) into a single field name.
1051
+ function decodeMapPassthrough(
1052
+ element: t.JSXElement,
1053
+ callbackParam: t.Node | undefined,
1054
+ ): string | null {
1055
+ const meaningful = meaningfulChildren(element);
1056
+ if (meaningful.length !== 1) return null;
1057
+ const child = meaningful[0];
1058
+ if (!t.isJSXExpressionContainer(child)) return null;
1059
+ const expr = child.expression;
1060
+
1061
+ if (t.isMemberExpression(expr)) {
1062
+ if (expr.computed) return null;
1063
+ if (!t.isIdentifier(expr.object) || !t.isIdentifier(expr.property))
1064
+ return null;
1065
+ if (!callbackParam || !t.isIdentifier(callbackParam)) return null;
1066
+ if (callbackParam.name !== expr.object.name) return null;
1067
+ return expr.property.name;
1068
+ }
1069
+
1070
+ if (t.isIdentifier(expr)) {
1071
+ const fieldName = expr.name;
1072
+ // Param is `{ field, ... }` destructuring — the identifier names the
1073
+ // destructured property. Skip alias/rename forms (`{ field: alias }`).
1074
+ if (!callbackParam || !t.isObjectPattern(callbackParam)) return null;
1075
+ for (const prop of callbackParam.properties) {
1076
+ if (!t.isObjectProperty(prop) || prop.computed) continue;
1077
+ if (!t.isIdentifier(prop.key) || prop.key.name !== fieldName) continue;
1078
+ // Shorthand `{ field }` → value is also an Identifier with same name.
1079
+ // Aliased `{ field: other }` → value is a different identifier; skip.
1080
+ return t.isIdentifier(prop.value) && prop.value.name === fieldName
1081
+ ? fieldName
1082
+ : null;
1083
+ }
1084
+ }
1085
+
1086
+ return null;
1087
+ }
1088
+
1089
+ function collectArrayMapCandidates(
1090
+ ast: t.Node,
1091
+ element: t.JSXElement,
1092
+ ): TextCandidate[] {
1093
+ const ctx = findEnclosingMapCallback(ast, element);
1094
+ if (!ctx) return [];
1095
+ const fieldName = decodeMapPassthrough(element, ctx.fn.params[0]);
1096
+ if (!fieldName) return [];
1097
+ const elements = resolveArrayLiteralElements(ast, ctx.arrayArg);
1098
+ if (!elements) return [];
1099
+ const out: TextCandidate[] = [];
1100
+ for (const obj of elements) {
1101
+ const prop = findObjectProperty(obj, fieldName);
1102
+ if (!prop) continue;
1103
+ const v = prop.value;
1104
+ if (t.isStringLiteral(v)) {
1105
+ out.push({
1106
+ current: v.value,
1107
+ splice: (s) => spliceRange(v, jsString(s)),
1108
+ });
1109
+ } else if (t.isNumericLiteral(v)) {
1110
+ out.push({
1111
+ current: String(v.value),
1112
+ splice: (s) => spliceRange(v, jsString(s)),
1113
+ });
1114
+ }
1115
+ }
1116
+ return out;
1117
+ }
1118
+
1119
+ function collectElementTextCandidates(
1120
+ ast: t.File,
1121
+ element: t.JSXElement,
1122
+ ): TextCandidate[] {
1123
+ const candidates: TextCandidate[] = [];
1124
+ collectTextCandidates(element, candidates);
1125
+ if (candidates.length === 0) {
1126
+ const passthrough = propPassthroughName(element);
1127
+ const enclosing = passthrough ? findEnclosingComponent(ast, element) : null;
1128
+ if (passthrough === "children" && enclosing) {
1129
+ candidates.push(...collectCallSiteCandidates(ast, enclosing.name));
1130
+ } else if (
1131
+ passthrough &&
1132
+ enclosing &&
1133
+ componentDestructuresProp(enclosing.fn, passthrough)
1134
+ ) {
1135
+ candidates.push(
1136
+ ...collectPropCallSiteCandidates(ast, enclosing.name, passthrough),
1137
+ );
1138
+ }
1139
+ }
1140
+ if (candidates.length === 0) {
1141
+ candidates.push(...collectArrayMapCandidates(ast, element));
1142
+ }
1143
+ return candidates;
1144
+ }
1145
+
1146
+ function elementTextCandidateMatches(
1147
+ ast: t.File,
1148
+ element: t.JSXElement,
1149
+ prevText: string,
1150
+ ): boolean {
1151
+ const norm = prevText.trim();
1152
+ return collectElementTextCandidates(ast, element).some(
1153
+ (candidate) => candidate.current === norm,
1154
+ );
1155
+ }
1156
+
1157
+ function buildTextSplice(
1158
+ ast: t.File,
1159
+ element: t.JSXElement,
1160
+ value: string,
1161
+ prevText?: string,
1162
+ ): Splice | { error: string } {
1163
+ const candidates = collectElementTextCandidates(ast, element);
1164
+ if (candidates.length === 0) {
1165
+ return { error: "element has no editable text" };
1166
+ }
1167
+ if (candidates.length === 1) {
1168
+ return candidates[0].splice(value);
1169
+ }
1170
+ if (prevText === undefined) {
1171
+ return { error: "element has multiple text candidates; missing prevText" };
1172
+ }
1173
+ // Trim: JSX collapses surrounding whitespace at render time, so the
1174
+ // DOM `prevText` won't have leading/trailing space the source might.
1175
+ const norm = prevText.trim();
1176
+ const matches = candidates.filter((c) => c.current === norm);
1177
+ if (matches.length === 0) {
1178
+ return { error: "no text candidate matches the current value" };
1179
+ }
1180
+ if (matches.length > 1) {
1181
+ return {
1182
+ error:
1183
+ "multiple text candidates share the same value; cannot disambiguate",
1184
+ };
1185
+ }
1186
+ return matches[0].splice(value);
1187
+ }
1188
+
1189
+ type AssetEditPlan = {
1190
+ attrSplice: Splice;
1191
+ };
1192
+
1193
+ function planAssetAttr(
1194
+ element: t.JSXElement,
1195
+ attr: string,
1196
+ assetId: string,
1197
+ ): AssetEditPlan | { error: string } {
1198
+ if (
1199
+ attr !== "src" ||
1200
+ !t.isJSXIdentifier(element.openingElement.name) ||
1201
+ element.openingElement.name.name !== "img"
1202
+ ) {
1203
+ return { error: "uploaded assets can only set img src" };
1204
+ }
1205
+ if (!/^[A-Za-z0-9_-]{1,200}$/.test(assetId)) {
1206
+ return { error: "invalid uploaded asset id" };
1207
+ }
1208
+
1209
+ const opening = element.openingElement;
1210
+ const assetRef = `asset://${assetId}`;
1211
+ const newAttr = `${attr}=${formatJsxAttrValue(assetRef)}`;
1212
+ const existing = findJsxAttr(opening, attr);
1213
+ const attrSplice: Splice = existing
1214
+ ? { from: existing.start ?? 0, to: existing.end ?? 0, text: newAttr }
1215
+ : {
1216
+ from: opening.name.end ?? 0,
1217
+ to: opening.name.end ?? 0,
1218
+ text: ` ${newAttr}`,
1219
+ };
1220
+ return { attrSplice };
1221
+ }
1222
+
1223
+ type PlaceholderEditPlan = {
1224
+ elementSplice: Splice;
1225
+ };
1226
+
1227
+ function planReplacePlaceholder(
1228
+ element: t.JSXElement,
1229
+ assetId: string,
1230
+ ): PlaceholderEditPlan | { error: string } {
1231
+ const opening = element.openingElement;
1232
+ if (
1233
+ !t.isJSXIdentifier(opening.name) ||
1234
+ opening.name.name !== "ImagePlaceholder"
1235
+ ) {
1236
+ return { error: "not a placeholder" };
1237
+ }
1238
+ if (!/^[A-Za-z0-9_-]{1,200}$/.test(assetId))
1239
+ return { error: "invalid uploaded asset id" };
1240
+
1241
+ const hint =
1242
+ readJsxStringAttr(opening, "label") ??
1243
+ readJsxStringAttr(opening, "hint") ??
1244
+ "";
1245
+ const width = readJsxNumberAttr(opening, "width");
1246
+ const height = readJsxNumberAttr(opening, "height");
1247
+
1248
+ const styleParts: string[] = [];
1249
+ if (width != null) styleParts.push(`width: ${width}`);
1250
+ else if (height != null) styleParts.push(`width: '100%'`);
1251
+ if (height != null) styleParts.push(`height: ${height}`);
1252
+ else if (width != null) styleParts.push(`height: '100%'`);
1253
+ styleParts.push(`objectFit: 'cover'`);
1254
+ styleParts.push(`objectPosition: '50% 50%'`);
1255
+ const replacement =
1256
+ `<img src=${formatJsxAttrValue(`asset://${assetId}`)} alt=${jsString(hint)} ` +
1257
+ `style={{ ${styleParts.join(", ")} }} />`;
1258
+
1259
+ return { elementSplice: spliceRange(element, replacement) };
1260
+ }
1261
+
1262
+ function planInsertImageAsset(
1263
+ source: string,
1264
+ element: t.JSXElement,
1265
+ assetId: string,
1266
+ alt: string,
1267
+ ): Splice[] | { error: string } {
1268
+ if (!/^[A-Za-z0-9_-]{1,200}$/.test(assetId)) {
1269
+ return { error: "invalid uploaded asset id" };
1270
+ }
1271
+ if (!t.isJSXIdentifier(element.openingElement.name)) {
1272
+ return { error: "image can only be inserted into a named JSX element" };
1273
+ }
1274
+
1275
+ const opening = element.openingElement;
1276
+ const img =
1277
+ `<img src=${formatJsxAttrValue(`asset://${assetId}`)} alt=${formatJsxAttrValue(alt)} ` +
1278
+ `style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', zIndex: -1 }} />`;
1279
+ const stylePosition = findJsxAttr(opening, "style");
1280
+ let needsRelativePosition = !stylePosition;
1281
+ let needsIsolation = !stylePosition;
1282
+ if (
1283
+ stylePosition &&
1284
+ t.isJSXExpressionContainer(stylePosition.value) &&
1285
+ t.isObjectExpression(stylePosition.value.expression)
1286
+ ) {
1287
+ let hasPosition = false;
1288
+ let existingPosition: string | undefined;
1289
+ let hasIsolation = false;
1290
+ for (const property of stylePosition.value.expression.properties) {
1291
+ if (!t.isObjectProperty(property) || property.computed) continue;
1292
+ const key = t.isIdentifier(property.key)
1293
+ ? property.key.name
1294
+ : t.isStringLiteral(property.key)
1295
+ ? property.key.value
1296
+ : undefined;
1297
+ if (key === "position") {
1298
+ hasPosition = true;
1299
+ if (t.isStringLiteral(property.value)) {
1300
+ existingPosition = property.value.value;
1301
+ }
1302
+ }
1303
+ if (key === "isolation") hasIsolation = true;
1304
+ }
1305
+ needsRelativePosition = !hasPosition || existingPosition === "static";
1306
+ needsIsolation = !hasIsolation;
1307
+ } else if (stylePosition) {
1308
+ needsRelativePosition = false;
1309
+ needsIsolation = false;
1310
+ }
1311
+ const styleOps = [
1312
+ ...(needsRelativePosition ? [{ key: "position", value: "relative" }] : []),
1313
+ ...(needsIsolation ? [{ key: "isolation", value: "isolate" }] : []),
1314
+ ];
1315
+ const style = styleOps.length
1316
+ ? buildStyleSplice(source, element, styleOps)
1317
+ : null;
1318
+ if (style && "error" in style) return { error: style.error };
1319
+ const styleSplice = style && !("error" in style) ? style : null;
1320
+
1321
+ if (opening.selfClosing) {
1322
+ const tagName = element.openingElement.name.name;
1323
+ let openingText = source.slice(opening.start ?? 0, opening.end ?? 0);
1324
+ if (styleSplice) {
1325
+ const from = (styleSplice.from ?? 0) - (opening.start ?? 0);
1326
+ const to = (styleSplice.to ?? 0) - (opening.start ?? 0);
1327
+ openingText =
1328
+ openingText.slice(0, from) + styleSplice.text + openingText.slice(to);
1329
+ }
1330
+ const expandedOpening = openingText.replace(/\/\s*>$/, ">");
1331
+ if (expandedOpening === openingText) {
1332
+ return { error: "could not expand the slide root element" };
1333
+ }
1334
+ return [
1335
+ {
1336
+ from: element.start ?? 0,
1337
+ to: element.end ?? 0,
1338
+ text: `${expandedOpening}${img}</${tagName}>`,
1339
+ },
1340
+ ];
1341
+ }
1342
+
1343
+ if (!element.closingElement) {
1344
+ return { error: "slide root has no closing element" };
1345
+ }
1346
+ return [
1347
+ ...(styleSplice ? [styleSplice] : []),
1348
+ { from: opening.end ?? 0, to: opening.end ?? 0, text: img },
1349
+ ];
1350
+ }
1351
+
1352
+ export function applyEdit(
1353
+ source: string,
1354
+ line: number,
1355
+ column: number,
1356
+ ops: EditOp[],
1357
+ ): ApplyEditResult {
1358
+ const plan = planEdit(source, line, column, ops);
1359
+ if (!plan.ok) return plan;
1360
+ return plan.splices.length
1361
+ ? applySplices(source, plan.splices)
1362
+ : { ok: true, source };
1363
+ }
1364
+
1365
+ export function planEdit(
1366
+ source: string,
1367
+ line: number,
1368
+ column: number,
1369
+ ops: EditOp[],
1370
+ exactLocation = false,
1371
+ ):
1372
+ | { ok: true; splices: Splice[] }
1373
+ | { ok: false; status: number; error: string } {
1374
+ if (ops.length === 0) return { ok: true, splices: [] };
1375
+
1376
+ const ast = parseSource(source);
1377
+ if (!ast) return { ok: false, status: 422, error: "could not parse source" };
1378
+ const element = exactLocation
1379
+ ? findJsxByStart(ast, line, column)
1380
+ : findElementForEdit(ast, line, column, ops);
1381
+ if (!element)
1382
+ return { ok: false, status: 422, error: "no JSX element at location" };
1383
+
1384
+ const splices: Splice[] = [];
1385
+
1386
+ const styleOps = ops.flatMap((op) =>
1387
+ op.kind === "set-style" ? [{ key: op.key, value: op.value }] : [],
1388
+ );
1389
+ if (styleOps.length > 0) {
1390
+ const result = buildStyleSplice(source, element, styleOps);
1391
+ if (result && "error" in result) {
1392
+ return { ok: false, status: 422, error: result.error };
1393
+ }
1394
+ if (result) splices.push(result);
1395
+ }
1396
+
1397
+ for (const op of ops) {
1398
+ if (op.kind !== "set-text-range-style") continue;
1399
+ const result = buildTextRangeStyleSplices(
1400
+ ast,
1401
+ source,
1402
+ element,
1403
+ op.start,
1404
+ op.end,
1405
+ { key: op.key, value: op.value },
1406
+ op.prevText,
1407
+ );
1408
+ if (result && "error" in result)
1409
+ return { ok: false, status: 422, error: result.error };
1410
+ if (result) splices.push(...result);
1411
+ }
1412
+
1413
+ for (const op of ops) {
1414
+ if (op.kind !== "set-text") continue;
1415
+ if (
1416
+ op.prevText !== undefined &&
1417
+ (op.value.includes("\n") || op.prevText.includes("\n"))
1418
+ ) {
1419
+ const richResult = buildTextContentSplices(
1420
+ element,
1421
+ op.value,
1422
+ op.prevText,
1423
+ );
1424
+ if (!("error" in richResult)) {
1425
+ splices.push(...richResult);
1426
+ continue;
1427
+ }
1428
+ }
1429
+ const result = buildTextSplice(ast, element, op.value, op.prevText);
1430
+ if ("error" in result) {
1431
+ if (op.prevText === undefined)
1432
+ return { ok: false, status: 422, error: result.error };
1433
+ const richResult = buildTextContentSplices(
1434
+ element,
1435
+ op.value,
1436
+ op.prevText,
1437
+ );
1438
+ if ("error" in richResult)
1439
+ return { ok: false, status: 422, error: result.error };
1440
+ splices.push(...richResult);
1441
+ } else {
1442
+ splices.push(result);
1443
+ }
1444
+ }
1445
+
1446
+ const assetOps = ops.flatMap((op) =>
1447
+ op.kind === "set-attr-asset" ? [op] : [],
1448
+ );
1449
+ const placeholderOps = ops.flatMap((op) =>
1450
+ op.kind === "replace-placeholder-with-image" ? [op] : [],
1451
+ );
1452
+ const insertImageOps = ops.flatMap((op) =>
1453
+ op.kind === "insert-image-asset" ? [op] : [],
1454
+ );
1455
+ if (
1456
+ assetOps.length > 0 ||
1457
+ placeholderOps.length > 0 ||
1458
+ insertImageOps.length > 0
1459
+ ) {
1460
+ for (const op of assetOps) {
1461
+ const plan = planAssetAttr(element, op.attr, op.assetId);
1462
+ if ("error" in plan) return { ok: false, status: 422, error: plan.error };
1463
+ splices.push(plan.attrSplice);
1464
+ }
1465
+ for (const op of placeholderOps) {
1466
+ const plan = planReplacePlaceholder(element, op.assetId);
1467
+ if ("error" in plan) return { ok: false, status: 422, error: plan.error };
1468
+ splices.push(plan.elementSplice);
1469
+ }
1470
+ for (const op of insertImageOps) {
1471
+ const plan = planInsertImageAsset(source, element, op.assetId, op.alt);
1472
+ if ("error" in plan) return { ok: false, status: 422, error: plan.error };
1473
+ splices.push(...plan);
1474
+ }
1475
+ }
1476
+
1477
+ return { ok: true, splices };
1478
+ }