@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,2021 @@
1
+ import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
2
+ import {
3
+ isDesignSystemCodeIndexingAllowed,
4
+ isDesignSystemTierAtMax,
5
+ readDesignSystemTierLimitFailure,
6
+ type DesignSystemTierLimit,
7
+ } from "@agent-native/core/client/design-system-tier-limit";
8
+ import {
9
+ actionErrorMessage,
10
+ useActionQuery,
11
+ useActionMutation,
12
+ } from "@agent-native/core/client/hooks";
13
+ import { useT } from "@agent-native/core/client/i18n";
14
+ import { withBuilderUtmTrackingParams } from "@agent-native/core/shared";
15
+ import { openAgentSidebar } from "@agent-native/toolkit/app/shared";
16
+ import {
17
+ IconWorld,
18
+ IconComponents,
19
+ IconLoader2,
20
+ IconBrandGithub,
21
+ IconBrandFigma,
22
+ IconFolder,
23
+ IconX,
24
+ IconFileDescription,
25
+ IconPhoto,
26
+ IconCheck,
27
+ IconExternalLink,
28
+ IconChevronDown,
29
+ IconRefresh,
30
+ IconLock,
31
+ } from "@tabler/icons-react";
32
+ import { useState, useCallback, useEffect, useRef, useMemo } from "react";
33
+ import { toast } from "sonner";
34
+
35
+ import {
36
+ AlertDialog,
37
+ AlertDialogAction,
38
+ AlertDialogCancel,
39
+ AlertDialogContent,
40
+ AlertDialogDescription,
41
+ AlertDialogFooter,
42
+ AlertDialogHeader,
43
+ AlertDialogTitle,
44
+ } from "@/components/ui/alert-dialog";
45
+ import { Button } from "@/components/ui/button";
46
+ import {
47
+ Dialog,
48
+ DialogContent,
49
+ DialogHeader,
50
+ DialogTitle,
51
+ DialogDescription,
52
+ } from "@/components/ui/dialog";
53
+ import { Input } from "@/components/ui/input";
54
+ import { Label } from "@/components/ui/label";
55
+ import { Progress } from "@/components/ui/progress";
56
+ import { ScrollArea } from "@/components/ui/scroll-area";
57
+ import { Skeleton } from "@/components/ui/skeleton";
58
+ import { Textarea } from "@/components/ui/textarea";
59
+ import { useDesignSystemWorkflows } from "@/hooks/use-design-system-workflows";
60
+ import { cn } from "@/lib/utils";
61
+
62
+ import {
63
+ DECODE_JOB_MAX_POLLS,
64
+ DECODE_JOB_POLL_INTERVAL_MS,
65
+ DECODE_JOB_TIMEOUT_MESSAGE,
66
+ uploadAndIndexFigmaFiles,
67
+ type DecodeJobStatus,
68
+ } from "./builder-design-system-upload";
69
+ import {
70
+ MAX_BUILDER_INDEX_UPLOAD_BYTES,
71
+ formatFileSize,
72
+ type BuilderIndexResult,
73
+ } from "./builder-index-response";
74
+
75
+ interface DesignSystemSetupProps {
76
+ open: boolean;
77
+ onClose: () => void;
78
+ onComplete: () => void;
79
+ editingId?: string;
80
+ }
81
+
82
+ interface GitHubLink {
83
+ id: string;
84
+ url: string;
85
+ ref?: string;
86
+ include?: string[];
87
+ }
88
+
89
+ interface UploadedFile {
90
+ id: string;
91
+ name: string;
92
+ type: string;
93
+ size: number;
94
+ textContent?: string;
95
+ }
96
+
97
+ type BuilderSourceKind = "figma" | "code" | "github" | "mixed";
98
+
99
+ interface BuilderSourceDetails {
100
+ builderDesignSystemId: string;
101
+ builderJobId: string;
102
+ builderUrl?: string;
103
+ builderStatus?: string;
104
+ sourceKind?: BuilderSourceKind;
105
+ tokenValues?: Record<string, string>;
106
+ docCount?: number | null;
107
+ warning?: string;
108
+ githubSources?: Array<{
109
+ repoUrl: string;
110
+ ref?: string;
111
+ include?: string[];
112
+ exclude?: string[];
113
+ }>;
114
+ syncedAt?: string;
115
+ }
116
+
117
+ interface ExistingDesignSystem {
118
+ title?: string;
119
+ description?: string;
120
+ data?: string | null;
121
+ customInstructions?: string;
122
+ builder?: BuilderSourceDetails | null;
123
+ }
124
+
125
+ interface BuilderIndexInput {
126
+ projectName?: string;
127
+ description?: string;
128
+ githubSources?: Array<{
129
+ repoUrl: string;
130
+ ref?: string;
131
+ include?: string[];
132
+ exclude?: string[];
133
+ }>;
134
+ githubRepoUrl?: string;
135
+ codeFiles?: Array<{
136
+ filename: string;
137
+ content: string;
138
+ mimeType?: string;
139
+ encoding?: "utf8" | "base64";
140
+ }>;
141
+ designMd?: string;
142
+ }
143
+
144
+ type OtherSource = "brand" | "code" | "files" | "existing" | "context";
145
+
146
+ function normalizeWebsiteUrlInput(input: string): string | null {
147
+ const trimmed = input.trim();
148
+ if (!trimmed) return null;
149
+
150
+ const withProtocol = /^[a-z][a-z\d+.-]*:\/\//i.test(trimmed)
151
+ ? trimmed
152
+ : /^[a-z\d-]+$/i.test(trimmed)
153
+ ? `https://${trimmed}.com`
154
+ : `https://${trimmed}`;
155
+
156
+ try {
157
+ const parsed = new URL(withProtocol);
158
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
159
+ return null;
160
+ }
161
+ if (!parsed.hostname || /\s/.test(parsed.hostname)) return null;
162
+ const normalized = parsed.toString();
163
+ return normalized.endsWith("/") && !parsed.pathname.slice(1)
164
+ ? normalized.slice(0, -1)
165
+ : normalized;
166
+ } catch {
167
+ // coercion-ok: malformed website input is the form's existing invalid-value result.
168
+ return null;
169
+ }
170
+ }
171
+
172
+ function isDesignMdFile(file: UploadedFile) {
173
+ const name = file.name.split(/[\\/]/).pop()?.toLowerCase() ?? file.name;
174
+ return name === "design.md" || name === "design.mdx";
175
+ }
176
+
177
+ export function DesignSystemSetup(props: DesignSystemSetupProps) {
178
+ const enabled = useDesignSystemWorkflows();
179
+ return enabled || props.editingId ? (
180
+ <DesignSystemSetupContent {...props} />
181
+ ) : null;
182
+ }
183
+
184
+ function DesignSystemSetupContent({
185
+ open,
186
+ onClose,
187
+ onComplete,
188
+ editingId,
189
+ }: DesignSystemSetupProps) {
190
+ const t = useT();
191
+ const [companyName, setCompanyName] = useState("");
192
+ const [websiteUrl, setWebsiteUrl] = useState("");
193
+ const [websiteUrls, setWebsiteUrls] = useState<string[]>([]);
194
+ const [githubUrl, setGithubUrl] = useState("");
195
+ const [githubRef, setGithubRef] = useState("");
196
+ const [githubPaths, setGithubPaths] = useState("");
197
+ const [githubLinks, setGithubLinks] = useState<GitHubLink[]>([]);
198
+ const [codeFiles, setCodeFiles] = useState<UploadedFile[]>([]);
199
+ const [docFiles, setDocFiles] = useState<UploadedFile[]>([]);
200
+ const [imageFiles, setImageFiles] = useState<UploadedFile[]>([]);
201
+ const [brandNotes, setBrandNotes] = useState("");
202
+ const [customInstructions, setCustomInstructions] = useState("");
203
+ const [generating, setGenerating] = useState(false);
204
+ const [builderIndexing, setBuilderIndexing] = useState(false);
205
+ const [builderUploadProgress, setBuilderUploadProgress] = useState<
206
+ number | null
207
+ >(null);
208
+ const [builderIndexResult, setBuilderIndexResult] =
209
+ useState<BuilderIndexResult | null>(null);
210
+ const [builderIndexError, setBuilderIndexError] = useState<string | null>(
211
+ null,
212
+ );
213
+ const [sourcePanel, setSourcePanel] = useState<"figma" | "other">("figma");
214
+ const [otherSource, setOtherSource] = useState<OtherSource | null>(null);
215
+ const [decodeStatus, setDecodeStatus] = useState<DecodeJobStatus | null>(
216
+ null,
217
+ );
218
+ const [decodeDesignSystemId, setDecodeDesignSystemId] = useState<
219
+ string | null
220
+ >(null);
221
+ const decodeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
222
+
223
+ const stopDecodePolling = useCallback(() => {
224
+ if (decodeTimeoutRef.current) clearTimeout(decodeTimeoutRef.current);
225
+ decodeTimeoutRef.current = null;
226
+ setDecodeDesignSystemId(null);
227
+ }, []);
228
+
229
+ const startDecodePolling = useCallback(
230
+ (designSystemId: string) => {
231
+ stopDecodePolling();
232
+ setDecodeStatus({
233
+ status: "pending",
234
+ branchUrl: null,
235
+ error: null,
236
+ framesProcessed: 0,
237
+ totalFrames: 0,
238
+ });
239
+ setDecodeDesignSystemId(designSystemId);
240
+ decodeTimeoutRef.current = setTimeout(() => {
241
+ decodeTimeoutRef.current = null;
242
+ setDecodeStatus((prev) => ({
243
+ status: "error",
244
+ branchUrl: prev?.branchUrl ?? null,
245
+ error: DECODE_JOB_TIMEOUT_MESSAGE,
246
+ framesProcessed: prev?.framesProcessed ?? 0,
247
+ totalFrames: prev?.totalFrames ?? 0,
248
+ }));
249
+ setBuilderIndexing(false);
250
+ setDecodeDesignSystemId(null);
251
+ }, DECODE_JOB_POLL_INTERVAL_MS * DECODE_JOB_MAX_POLLS);
252
+ },
253
+ [stopDecodePolling],
254
+ );
255
+
256
+ useEffect(
257
+ () => () => {
258
+ if (decodeTimeoutRef.current) clearTimeout(decodeTimeoutRef.current);
259
+ },
260
+ [],
261
+ );
262
+
263
+ const codeInputRef = useRef<HTMLInputElement>(null);
264
+ const docInputRef = useRef<HTMLInputElement>(null);
265
+ const imageInputRef = useRef<HTMLInputElement>(null);
266
+ const figInputRef = useRef<HTMLInputElement>(null);
267
+ const updateSystemMutation = useActionMutation("update-design-system");
268
+ const syncSystemMutation = useActionMutation(
269
+ "sync-design-system-with-builder",
270
+ );
271
+ const indexUploadedFilesMutation = useActionMutation(
272
+ "index-uploaded-design-system-files",
273
+ );
274
+ const indexSystemMutation = useActionMutation<
275
+ BuilderIndexResult,
276
+ BuilderIndexInput
277
+ >("index-design-system-with-builder");
278
+
279
+ const decodeStatusQuery = useActionQuery(
280
+ "get-design-system-decode-job-status",
281
+ { designSystemId: decodeDesignSystemId ?? "" },
282
+ {
283
+ enabled: Boolean(decodeDesignSystemId) && builderIndexing,
284
+ retry: false,
285
+ queryKeyScope: builderIndexResult?.jobId
286
+ ? [builderIndexResult.jobId]
287
+ : [],
288
+ refetchInterval: (query) => {
289
+ if (query.state.status === "error") return false;
290
+ if (query.state.dataUpdateCount >= DECODE_JOB_MAX_POLLS) return false;
291
+ const status = query.state.data as DecodeJobStatus | undefined;
292
+ return status?.branchUrl ||
293
+ status?.status === "complete" ||
294
+ status?.status === "error"
295
+ ? false
296
+ : DECODE_JOB_POLL_INTERVAL_MS;
297
+ },
298
+ },
299
+ );
300
+
301
+ useEffect(() => {
302
+ if (!decodeDesignSystemId) return;
303
+ const status = decodeStatusQuery.data as DecodeJobStatus | undefined;
304
+ if (status) {
305
+ setDecodeStatus(status);
306
+ if (
307
+ status.branchUrl ||
308
+ status.status === "complete" ||
309
+ status.status === "error"
310
+ ) {
311
+ setBuilderIndexResult((current) =>
312
+ status.branchUrl && current
313
+ ? { ...current, builderUrl: status.branchUrl }
314
+ : current,
315
+ );
316
+ setBuilderIndexing(false);
317
+ stopDecodePolling();
318
+ }
319
+ }
320
+ if (decodeStatusQuery.isError) {
321
+ const message =
322
+ actionErrorMessage(decodeStatusQuery.error) ??
323
+ t("designSystemSetup.figParseFailed");
324
+ setDecodeStatus((previous) => ({
325
+ status: "error",
326
+ branchUrl: previous?.branchUrl ?? null,
327
+ error: message,
328
+ framesProcessed: previous?.framesProcessed ?? 0,
329
+ totalFrames: previous?.totalFrames ?? 0,
330
+ }));
331
+ setBuilderIndexing(false);
332
+ stopDecodePolling();
333
+ }
334
+ }, [
335
+ decodeDesignSystemId,
336
+ decodeStatusQuery.data,
337
+ decodeStatusQuery.error,
338
+ decodeStatusQuery.isError,
339
+ stopDecodePolling,
340
+ t,
341
+ ]);
342
+
343
+ const {
344
+ data: existingDs,
345
+ isLoading: existingDsLoading,
346
+ isError: existingDsError,
347
+ } = useActionQuery<ExistingDesignSystem>(
348
+ "get-design-system",
349
+ editingId ? { id: editingId } : undefined,
350
+ {
351
+ enabled: !!editingId && open,
352
+ refetchInterval: (query) =>
353
+ query.state.data?.builder?.docCount === 0 ? 5_000 : false,
354
+ },
355
+ );
356
+
357
+ const { data: designSystemsData } = useActionQuery<{
358
+ designSystems: Array<{ id: string; title: string }>;
359
+ }>("list-design-systems");
360
+
361
+ const existingSystems = designSystemsData?.designSystems ?? [];
362
+ const [selectedSystemId, setSelectedSystemId] = useState("");
363
+
364
+ const { data: tierLimit } = useActionQuery<DesignSystemTierLimit>(
365
+ "get-design-system-tier-limit",
366
+ undefined,
367
+ { enabled: open && !editingId },
368
+ );
369
+ const atMax = isDesignSystemTierAtMax(tierLimit);
370
+ const codeIndexingAllowed = isDesignSystemCodeIndexingAllowed(tierLimit);
371
+ const [tierLimitUpgradeUrl, setTierLimitUpgradeUrl] = useState<string | null>(
372
+ null,
373
+ );
374
+
375
+ useEffect(() => {
376
+ if (existingDs && editingId) {
377
+ const builder = existingDs.builder;
378
+ setCompanyName(existingDs.title ?? "");
379
+ const parsed = parseDesignSystemData(existingDs.data);
380
+ const generatedDescription = builder
381
+ ? `Builder indexed design system ${builder.builderDesignSystemId}`
382
+ : null;
383
+ setBrandNotes(
384
+ builder
385
+ ? existingDs.description !== generatedDescription
386
+ ? (existingDs.description ?? "")
387
+ : ""
388
+ : parsed.ok && typeof parsed.value.notes === "string"
389
+ ? parsed.value.notes
390
+ : (existingDs.description ?? ""),
391
+ );
392
+ setCustomInstructions(
393
+ builder &&
394
+ isGeneratedBuilderInstructions(existingDs.customInstructions, builder)
395
+ ? ""
396
+ : (existingDs.customInstructions ?? ""),
397
+ );
398
+ }
399
+ }, [existingDs, editingId]);
400
+
401
+ useEffect(() => {
402
+ if (!open) {
403
+ setCompanyName("");
404
+ setWebsiteUrl("");
405
+ setWebsiteUrls([]);
406
+ setGithubUrl("");
407
+ setGithubRef("");
408
+ setGithubPaths("");
409
+ setGithubLinks([]);
410
+ setCodeFiles([]);
411
+ setDocFiles([]);
412
+ setImageFiles([]);
413
+ setBrandNotes("");
414
+ setCustomInstructions("");
415
+ setSelectedSystemId("");
416
+ setBuilderIndexing(false);
417
+ setBuilderIndexResult(null);
418
+ setBuilderIndexError(null);
419
+ stopDecodePolling();
420
+ setDecodeStatus(null);
421
+ }
422
+ }, [open, stopDecodePolling]);
423
+
424
+ const hasAnySources = useMemo(() => {
425
+ return (
426
+ companyName.trim() ||
427
+ websiteUrls.length > 0 ||
428
+ githubLinks.length > 0 ||
429
+ codeFiles.length > 0 ||
430
+ builderIndexResult ||
431
+ docFiles.length > 0 ||
432
+ imageFiles.length > 0 ||
433
+ selectedSystemId ||
434
+ brandNotes.trim() ||
435
+ customInstructions.trim()
436
+ );
437
+ }, [
438
+ companyName,
439
+ websiteUrls,
440
+ githubLinks,
441
+ codeFiles,
442
+ builderIndexResult,
443
+ docFiles,
444
+ imageFiles,
445
+ selectedSystemId,
446
+ brandNotes,
447
+ customInstructions,
448
+ ]);
449
+
450
+ const selectOtherSource = useCallback((source: OtherSource) => {
451
+ setSourcePanel("other");
452
+ setOtherSource((current) => (current === source ? null : source));
453
+ }, []);
454
+
455
+ const addWebsiteUrl = useCallback(() => {
456
+ const url = normalizeWebsiteUrlInput(websiteUrl);
457
+ if (!url) return;
458
+ setWebsiteUrls((prev) => (prev.includes(url) ? prev : [...prev, url]));
459
+ setWebsiteUrl("");
460
+ }, [websiteUrl]);
461
+
462
+ const addGithubLink = useCallback(() => {
463
+ const url = githubUrl.trim();
464
+ if (!url) return;
465
+ const include = githubPaths
466
+ .split(/[\n,]/)
467
+ .map((path) => path.trim().replace(/^\/+|\/+$/g, ""))
468
+ .filter(Boolean);
469
+ setGithubLinks((prev) => [
470
+ ...prev,
471
+ {
472
+ id: crypto.randomUUID(),
473
+ url,
474
+ ...(githubRef.trim() ? { ref: githubRef.trim() } : {}),
475
+ ...(include.length > 0 ? { include: [...new Set(include)] } : {}),
476
+ },
477
+ ]);
478
+ setGithubUrl("");
479
+ setGithubRef("");
480
+ setGithubPaths("");
481
+ }, [githubPaths, githubRef, githubUrl]);
482
+
483
+ const readTextFiles = useCallback(
484
+ (
485
+ fileList: FileList,
486
+ setter: React.Dispatch<React.SetStateAction<UploadedFile[]>>,
487
+ ) => {
488
+ const newFiles: UploadedFile[] = [];
489
+ const promises: Promise<void>[] = [];
490
+ Array.from(fileList).forEach((f) => {
491
+ const file: UploadedFile = {
492
+ id: crypto.randomUUID(),
493
+ name: f.name,
494
+ type: f.type,
495
+ size: f.size,
496
+ };
497
+ if (
498
+ f.size < 200 * 1024 &&
499
+ (f.name.match(
500
+ /\.(css|scss|sass|less|ts|tsx|js|jsx|json|html|svg|xml|md|markdown|mdx|txt)$/i,
501
+ ) ||
502
+ f.type.startsWith("text/"))
503
+ ) {
504
+ promises.push(
505
+ f.text().then((text) => {
506
+ file.textContent = text;
507
+ }),
508
+ );
509
+ }
510
+ newFiles.push(file);
511
+ });
512
+ void Promise.all(promises).then(() => {
513
+ setter((prev) => [...prev, ...newFiles]);
514
+ });
515
+ },
516
+ [],
517
+ );
518
+
519
+ const processBuilderIndexFile = useCallback(
520
+ async (file: File | undefined) => {
521
+ if (!file) return;
522
+ if (!file.name.toLowerCase().endsWith(".fig")) {
523
+ setBuilderIndexError(t("designSystemSetup.figFileRequired"));
524
+ return;
525
+ }
526
+ if (file.size > MAX_BUILDER_INDEX_UPLOAD_BYTES) {
527
+ setBuilderIndexError(
528
+ t("designSystemSetup.figFileTooLarge", {
529
+ maxSize: formatFileSize(MAX_BUILDER_INDEX_UPLOAD_BYTES),
530
+ }),
531
+ );
532
+ return;
533
+ }
534
+
535
+ setBuilderIndexError(null);
536
+ setBuilderIndexResult(null);
537
+ setBuilderUploadProgress(null);
538
+ stopDecodePolling();
539
+ setDecodeStatus(null);
540
+ setBuilderIndexing(true);
541
+ try {
542
+ const suggestedTitle =
543
+ file.name
544
+ .replace(/\.fig$/i, "")
545
+ .replace(/[-_]+/g, " ")
546
+ .trim() || "Imported brand";
547
+ const parsed = await uploadAndIndexFigmaFiles([file], {
548
+ projectName: companyName.trim() || suggestedTitle,
549
+ onProgress: setBuilderUploadProgress,
550
+ indexUploadedFiles: (input) =>
551
+ indexUploadedFilesMutation.mutateAsync(input),
552
+ });
553
+ setBuilderUploadProgress(null);
554
+ if (parsed.jobId) {
555
+ if (!parsed.localDesignSystemId) {
556
+ throw new Error(
557
+ "Builder indexing started without a local design-system id.",
558
+ );
559
+ }
560
+ setBuilderIndexResult(parsed);
561
+ startDecodePolling(parsed.localDesignSystemId);
562
+ } else {
563
+ setBuilderIndexResult(parsed);
564
+ setBuilderIndexing(false);
565
+ }
566
+ } catch (err) {
567
+ setBuilderUploadProgress(null);
568
+ setBuilderIndexError(
569
+ actionErrorMessage(err) ??
570
+ (err instanceof Error
571
+ ? err.message
572
+ : t("designSystemSetup.figParseFailed")),
573
+ );
574
+ setBuilderIndexing(false);
575
+ }
576
+ },
577
+ [
578
+ companyName,
579
+ indexUploadedFilesMutation.mutateAsync,
580
+ t,
581
+ startDecodePolling,
582
+ stopDecodePolling,
583
+ ],
584
+ );
585
+
586
+ const handleBuilderIndexUpload = useCallback(
587
+ (event: React.ChangeEvent<HTMLInputElement>) => {
588
+ void processBuilderIndexFile(event.target.files?.[0]);
589
+ event.target.value = "";
590
+ },
591
+ [processBuilderIndexFile],
592
+ );
593
+
594
+ const handleBuilderIndexDrop = useCallback(
595
+ (event: React.DragEvent<HTMLButtonElement>) => {
596
+ event.preventDefault();
597
+ event.stopPropagation();
598
+ void processBuilderIndexFile(event.dataTransfer.files?.[0]);
599
+ },
600
+ [processBuilderIndexFile],
601
+ );
602
+
603
+ const addImageFiles = useCallback((files: FileList) => {
604
+ const newFiles = Array.from(files).map((file) => ({
605
+ id: crypto.randomUUID(),
606
+ name: file.name,
607
+ type: file.type,
608
+ size: file.size,
609
+ }));
610
+ setImageFiles((previous) => [...previous, ...newFiles]);
611
+ }, []);
612
+
613
+ const handleEditSave = async () => {
614
+ if (!editingId || !existingDs) return;
615
+ setGenerating(true);
616
+ try {
617
+ await updateSystemMutation.mutateAsync({
618
+ id: editingId,
619
+ title: companyName || "My Brand",
620
+ description: brandNotes,
621
+ customInstructions,
622
+ });
623
+ onComplete();
624
+ toast.success(t("designSystemSetup.updated"));
625
+ } catch {
626
+ toast.error(t("designSystemSetup.updateFailed"));
627
+ } finally {
628
+ setGenerating(false);
629
+ }
630
+ };
631
+
632
+ const handleSync = useCallback(async () => {
633
+ if (!editingId || !existingDs?.builder?.githubSources?.length) return;
634
+ setGenerating(true);
635
+ try {
636
+ await syncSystemMutation.mutateAsync({ id: editingId });
637
+ toast.success(t("designSystemSetup.syncStarted"));
638
+ } catch (error) {
639
+ toast.error(t("designSystemSetup.syncFailed"), {
640
+ description:
641
+ error instanceof Error
642
+ ? error.message
643
+ : t("designSystemSetup.syncFailed"),
644
+ });
645
+ } finally {
646
+ setGenerating(false);
647
+ }
648
+ }, [editingId, existingDs, syncSystemMutation, t]);
649
+
650
+ const handleGenerate = useCallback(async () => {
651
+ if (editingId) {
652
+ await handleEditSave();
653
+ return;
654
+ }
655
+
656
+ const isGithubOnlySource =
657
+ githubLinks.length > 0 &&
658
+ websiteUrls.length === 0 &&
659
+ codeFiles.length === 0 &&
660
+ !builderIndexResult &&
661
+ docFiles.length === 0 &&
662
+ imageFiles.length === 0 &&
663
+ !selectedSystemId &&
664
+ !brandNotes.trim() &&
665
+ !customInstructions.trim();
666
+ if (isGithubOnlySource) {
667
+ setGenerating(true);
668
+ setTierLimitUpgradeUrl(null);
669
+ try {
670
+ await indexSystemMutation.mutateAsync({
671
+ projectName: companyName.trim() || undefined,
672
+ githubSources: githubLinks.map((link) => ({
673
+ repoUrl: link.url,
674
+ ...(link.ref ? { ref: link.ref } : {}),
675
+ ...(link.include?.length ? { include: link.include } : {}),
676
+ })),
677
+ });
678
+ toast.success(t("designSystemSetup.generationStarted"));
679
+ onComplete();
680
+ } catch (error) {
681
+ const tierFailure = readDesignSystemTierLimitFailure(
682
+ error,
683
+ t("designSystemSetup.updateFailed"),
684
+ );
685
+ if (tierFailure) {
686
+ setTierLimitUpgradeUrl(tierFailure.upgradeUrl);
687
+ }
688
+ toast.error(t("designSystemSetup.updateFailed"), {
689
+ description:
690
+ tierFailure?.message ??
691
+ (error instanceof Error
692
+ ? error.message
693
+ : t("designSystemSetup.updateFailed")),
694
+ });
695
+ } finally {
696
+ setGenerating(false);
697
+ }
698
+ return;
699
+ }
700
+
701
+ const requestedTitle = companyName.trim();
702
+ const localDesignSystemId = builderIndexResult?.localDesignSystemId;
703
+ if (requestedTitle && localDesignSystemId) {
704
+ try {
705
+ await updateSystemMutation.mutateAsync({
706
+ id: localDesignSystemId,
707
+ title: requestedTitle,
708
+ });
709
+ } catch (error) {
710
+ toast.error(t("designSystemSetup.updateFailed"), {
711
+ description:
712
+ error instanceof Error
713
+ ? error.message
714
+ : t("designSystemSetup.updateFailed"),
715
+ });
716
+ return;
717
+ }
718
+ }
719
+
720
+ const TEXT_INLINE_MAX = 5000;
721
+ const inlineText = (text: string) =>
722
+ text.length > TEXT_INLINE_MAX
723
+ ? `${text.slice(0, TEXT_INLINE_MAX)}\n…[truncated, ${text.length - TEXT_INLINE_MAX} more chars]`
724
+ : text;
725
+
726
+ const parts: string[] = [];
727
+ parts.push(
728
+ "Set up a design system from the following sources. Use Builder Design System Intelligence (DSI) as the source of truth for reusable Figma/code/design.md indexing. Analyze each source, extract design tokens (colors, fonts, spacing, borders), and create a cohesive design system for my slide decks.",
729
+ );
730
+
731
+ if (companyName.trim()) {
732
+ parts.push(
733
+ `\n## Company / Brand\n${companyName.trim()}\n\nUse exactly this as the design system name. Never replace it with the uploaded Figma filename.`,
734
+ );
735
+ }
736
+
737
+ if (websiteUrls.length > 0) {
738
+ parts.push(
739
+ `\n## Website URLs\nAnalyze these websites for design tokens. Call \`import-from-url\` for each:\n${websiteUrls.map((u) => `- ${u}`).join("\n")}\n\nThe shared action uses the layered real-browser renderer so hydrated React, CSS-in-JS, Tailwind, SPA content, loaded fonts, computed colors, component styles, CSS variables, and desktop/mobile screenshot evidence are captured consistently. It falls back explicitly to SSRF-safe static extraction only when a browser is unavailable. Use its design.md-style result as the source of truth for the deck style.`,
740
+ );
741
+ }
742
+
743
+ if (githubLinks.length > 0) {
744
+ parts.push(
745
+ `\n## Connect Code: GitHub Repositories\nMake one call to \`index-design-system-with-builder\` with \`githubSources\` set to this JSON array:\n\n\`\`\`json\n${JSON.stringify(
746
+ githubLinks.map((link) => ({
747
+ repoUrl: link.url,
748
+ ...(link.ref ? { ref: link.ref } : {}),
749
+ ...(link.include?.length ? { include: link.include } : {}),
750
+ })),
751
+ null,
752
+ 2,
753
+ )}\n\`\`\`\n\nBuilder is the source of truth for repo/code design-system indexing. The action creates one local selectable proxy design system for Slides flows. If Builder is not connected, stop and tell me to use Builder.io (free tier available) from Settings.`,
754
+ );
755
+ }
756
+
757
+ const designMdFiles = [...codeFiles, ...docFiles].filter(
758
+ (file) => file.textContent && isDesignMdFile(file),
759
+ );
760
+
761
+ if (codeFiles.length > 0) {
762
+ const withContent = codeFiles.filter(
763
+ (f) => f.textContent && !isDesignMdFile(f),
764
+ );
765
+ if (withContent.length > 0) {
766
+ parts.push(
767
+ `\n## Connect Code: Code Files (${withContent.length} files)\nStart Builder DSI indexing with \`index-design-system-with-builder\` using these files as the \`codeFiles\` argument:`,
768
+ );
769
+ for (const f of withContent) {
770
+ parts.push(
771
+ `\n### ${f.name}\n\`\`\`\n${inlineText(f.textContent!)}\n\`\`\``,
772
+ );
773
+ }
774
+ }
775
+ }
776
+
777
+ if (designMdFiles.length > 0) {
778
+ parts.push(
779
+ `\n## Optional design.md (${designMdFiles.length} file${designMdFiles.length === 1 ? "" : "s"})\nPass this content as the \`designMd\` argument to \`index-design-system-with-builder\` alongside any Figma/code sources:`,
780
+ );
781
+ for (const f of designMdFiles) {
782
+ parts.push(
783
+ `\n### ${f.name}\n\`\`\`md\n${inlineText(f.textContent!)}\n\`\`\``,
784
+ );
785
+ }
786
+ }
787
+
788
+ if (builderIndexResult) {
789
+ parts.push(
790
+ `\n## Connect Figma: Builder-Indexed Figma File\nBuilder DSI indexing has already started.\n- Design system: ${builderIndexResult.designSystemId}\n- Local selectable design system: ${builderIndexResult.localDesignSystemId ?? "(not returned)"}\n- Project: ${builderIndexResult.projectId}\n- Job: ${builderIndexResult.jobId}\n- URL: ${builderIndexResult.builderUrl}\n\nUse Builder as the source of truth for indexed tokens, assets, components, and guidance. Do not call \`create-design-system\` again for this Builder-indexed source.`,
791
+ );
792
+ }
793
+
794
+ if (docFiles.length > 0) {
795
+ const inlined = docFiles.filter(
796
+ (f) => f.textContent && !isDesignMdFile(f),
797
+ );
798
+ const binary = docFiles.filter((f) => !f.textContent);
799
+ if (inlined.length > 0) {
800
+ parts.push(
801
+ `\n## Documents (${inlined.length} text files — content inlined)\nExtract brand cues from the content below.`,
802
+ );
803
+ for (const f of inlined) {
804
+ parts.push(
805
+ `\n### ${f.name}\n\`\`\`\n${inlineText(f.textContent!)}\n\`\`\``,
806
+ );
807
+ }
808
+ }
809
+ if (binary.length > 0) {
810
+ parts.push(
811
+ `\n## Documents\nExtract brand cues. Call \`import-document\` with metadata:\n${binary.map((f) => `- ${f.name} (${f.type}, ${formatSize(f.size)})`).join("\n")}`,
812
+ );
813
+ }
814
+ }
815
+
816
+ if (imageFiles.length > 0) {
817
+ parts.push(
818
+ `\n## Visual References\n${imageFiles.map((f) => `- ${f.name}`).join("\n")}`,
819
+ );
820
+ }
821
+
822
+ if (selectedSystemId) {
823
+ const system = existingSystems.find((s) => s.id === selectedSystemId);
824
+ if (system) {
825
+ parts.push(
826
+ `\n## Fork Existing Design System\nClone "${system.title}" as a starting point. Call \`import-design-project --designSystemId ${selectedSystemId}\``,
827
+ );
828
+ }
829
+ }
830
+
831
+ if (brandNotes.trim()) {
832
+ parts.push(`\n## Additional Notes\n${brandNotes.trim()}`);
833
+ }
834
+
835
+ if (customInstructions.trim()) {
836
+ parts.push(
837
+ `\n## Custom Instructions (durable — store on the design system)\nIf you create a local design system from non-Builder sources, pass these verbatim as the \`customInstructions\` argument. They will be re-applied every time the design system is used to generate slides:\n\n${customInstructions.trim()}`,
838
+ );
839
+ }
840
+
841
+ parts.push(
842
+ `\n---\nAfter processing all sources, if you started Builder DSI indexing, report the Builder job/design-system URL plus the local selectable design-system id returned by \`index-design-system-with-builder\`. Do not call \`create-design-system\` again for sources Builder indexed successfully. If \`index-design-system-with-builder\` fails or reports Builder DSI unavailable, do not finish with nothing created: call \`create-design-system\` with tokens and guidance derived from those same sources, and tell me Builder indexing was skipped and why. If you processed non-Builder sources into concrete tokens, call \`create-design-system\` with the combined tokens${
843
+ customInstructions.trim()
844
+ ? " AND the verbatim --customInstructions string from above"
845
+ : ""
846
+ }. Present a summary for review.`,
847
+ );
848
+
849
+ const message =
850
+ parts[0] ?? "Set up a design system from the selected sources.";
851
+ const contextParts = parts.slice(1);
852
+ openAgentSidebar();
853
+ sendToAgentChat({
854
+ message,
855
+ context: contextParts.join("\n"),
856
+ submit: true,
857
+ });
858
+ toast(t("designSystemSetup.generationStarted"), {
859
+ description: t("designSystemSetup.generationStartedDescription"),
860
+ });
861
+ onComplete();
862
+ }, [
863
+ editingId,
864
+ companyName,
865
+ websiteUrls,
866
+ githubLinks,
867
+ codeFiles,
868
+ builderIndexResult,
869
+ docFiles,
870
+ imageFiles,
871
+ selectedSystemId,
872
+ existingSystems,
873
+ brandNotes,
874
+ customInstructions,
875
+ onComplete,
876
+ t,
877
+ updateSystemMutation,
878
+ indexSystemMutation,
879
+ existingDs,
880
+ ]);
881
+
882
+ if (!editingId && atMax) {
883
+ return (
884
+ <AlertDialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
885
+ <AlertDialogContent>
886
+ <AlertDialogHeader>
887
+ <AlertDialogTitle>
888
+ {t("designSystems.tierLimitTitle")}
889
+ </AlertDialogTitle>
890
+ <AlertDialogDescription>
891
+ {tierLimit?.current != null &&
892
+ tierLimit?.max != null &&
893
+ tierLimit?.plan
894
+ ? t("designSystems.tierLimitDescriptionWithCount", {
895
+ current: tierLimit.current,
896
+ max: tierLimit.max,
897
+ plan: tierLimit.plan,
898
+ })
899
+ : t("designSystems.tierLimitDescription")}
900
+ </AlertDialogDescription>
901
+ </AlertDialogHeader>
902
+ <AlertDialogFooter>
903
+ <AlertDialogCancel className="cursor-pointer">
904
+ {t("designSystemSetup.cancel")}
905
+ </AlertDialogCancel>
906
+ <AlertDialogAction asChild>
907
+ <a
908
+ href={
909
+ tierLimit?.upgradeUrl ??
910
+ "https://builder.io/account/subscription"
911
+ }
912
+ target="_blank"
913
+ rel="noopener noreferrer"
914
+ className="cursor-pointer"
915
+ >
916
+ <IconExternalLink className="w-3.5 h-3.5" />
917
+ {t("designSystems.tierLimitUpgrade")}
918
+ </a>
919
+ </AlertDialogAction>
920
+ </AlertDialogFooter>
921
+ </AlertDialogContent>
922
+ </AlertDialog>
923
+ );
924
+ }
925
+
926
+ const brandNotesForm = (
927
+ <div
928
+ className={cn(
929
+ "space-y-2 rounded-lg border border-border bg-card p-4",
930
+ !editingId &&
931
+ (sourcePanel !== "other" || otherSource !== "context") &&
932
+ "hidden",
933
+ )}
934
+ >
935
+ {editingId && (
936
+ <Label
937
+ htmlFor="slides-design-system-brand-notes"
938
+ className="text-foreground/80"
939
+ >
940
+ {t("designSystemSetup.brandNotes")}
941
+ </Label>
942
+ )}
943
+ <Textarea
944
+ id="slides-design-system-brand-notes"
945
+ aria-label={t(
946
+ editingId
947
+ ? "designSystemSetup.brandNotes"
948
+ : "designSystemSetup.additionalNotes",
949
+ )}
950
+ value={brandNotes}
951
+ onChange={(e) => setBrandNotes(e.target.value)}
952
+ placeholder={t("designSystemSetup.notesPlaceholder")}
953
+ rows={3}
954
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70 resize-none"
955
+ />
956
+ </div>
957
+ );
958
+ const customInstructionsForm = (
959
+ <div
960
+ className={cn(
961
+ "space-y-2 rounded-lg border border-border bg-card p-4",
962
+ !editingId &&
963
+ (sourcePanel !== "other" || otherSource !== "context") &&
964
+ "hidden",
965
+ )}
966
+ >
967
+ <Label
968
+ htmlFor="slides-design-system-custom-instructions"
969
+ className="text-foreground/80"
970
+ >
971
+ {t("designSystemSetup.customInstructions")}
972
+ </Label>
973
+ <Textarea
974
+ id="slides-design-system-custom-instructions"
975
+ value={customInstructions}
976
+ onChange={(e) => setCustomInstructions(e.target.value)}
977
+ placeholder={t("designSystemSetup.customInstructionsPlaceholder")}
978
+ rows={4}
979
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70 resize-none"
980
+ />
981
+ <p className="text-xs text-foreground/80">
982
+ {t("designSystemSetup.customInstructionsDescription")}
983
+ </p>
984
+ </div>
985
+ );
986
+
987
+ return (
988
+ <Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
989
+ <DialogContent className="sm:max-w-2xl max-h-[85vh] p-0 bg-card border-border">
990
+ <DialogHeader className="px-6 pt-6 pb-0">
991
+ <DialogTitle className="text-foreground">
992
+ {editingId
993
+ ? t("designSystemSetup.editTitle")
994
+ : t("designSystemSetup.newTitle")}
995
+ </DialogTitle>
996
+ <DialogDescription className="text-foreground/80">
997
+ {editingId
998
+ ? t("designSystemSetup.editDescription")
999
+ : t("designSystemSetup.newDescription")}
1000
+ </DialogDescription>
1001
+ </DialogHeader>
1002
+
1003
+ <ScrollArea className="max-h-[calc(85vh-160px)] px-6">
1004
+ {editingId &&
1005
+ (existingDsLoading || (!existingDs && !existingDsError)) ? (
1006
+ <DesignSystemEditSkeleton />
1007
+ ) : editingId && existingDsError ? (
1008
+ <DesignSystemEditError />
1009
+ ) : (
1010
+ <div className="space-y-5 py-4">
1011
+ {/* Company Name */}
1012
+ {editingId && (
1013
+ <div className="space-y-2">
1014
+ <Label
1015
+ htmlFor="slides-design-system-company-name"
1016
+ className="text-foreground/80"
1017
+ >
1018
+ {t("designSystemSetup.companyBrand")}
1019
+ </Label>
1020
+ <Input
1021
+ id="slides-design-system-company-name"
1022
+ value={companyName}
1023
+ onChange={(e) => setCompanyName(e.target.value)}
1024
+ placeholder={t("designSystemSetup.companyBrandPlaceholder")}
1025
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70"
1026
+ />
1027
+ </div>
1028
+ )}
1029
+
1030
+ {editingId && existingDs?.builder ? (
1031
+ <BuilderSourceStatus
1032
+ builder={existingDs.builder}
1033
+ onSync={
1034
+ existingDs.builder.githubSources?.length &&
1035
+ existingDs.builder.sourceKind !== "mixed"
1036
+ ? handleSync
1037
+ : undefined
1038
+ }
1039
+ syncing={syncSystemMutation.isPending}
1040
+ />
1041
+ ) : null}
1042
+
1043
+ {!editingId && (
1044
+ <>
1045
+ <SourceAccordionRow
1046
+ icon={IconBrandFigma}
1047
+ title={t("designSystemSetup.figmaFile")}
1048
+ description={t("designSystemSetup.uploadFigDescription")}
1049
+ expanded={sourcePanel === "figma"}
1050
+ onClick={() => setSourcePanel("figma")}
1051
+ panelId="slides-design-system-figma-source"
1052
+ />
1053
+
1054
+ {/* Figma .fig */}
1055
+ <div
1056
+ id="slides-design-system-figma-source"
1057
+ className={cn(
1058
+ "space-y-2 rounded-lg border border-border bg-card p-4",
1059
+ sourcePanel !== "figma" && "hidden",
1060
+ )}
1061
+ >
1062
+ {!builderIndexResult ? (
1063
+ <>
1064
+ <button
1065
+ type="button"
1066
+ onClick={() => figInputRef.current?.click()}
1067
+ onDragOver={(event) => event.preventDefault()}
1068
+ onDrop={handleBuilderIndexDrop}
1069
+ disabled={builderIndexing}
1070
+ className="w-full border border-dashed border-border rounded-lg p-4 text-center hover:border-foreground/20 cursor-pointer disabled:cursor-wait"
1071
+ >
1072
+ {builderIndexing ? (
1073
+ <span className="inline-flex items-center gap-2 text-xs text-foreground/80">
1074
+ <IconLoader2 className="w-3.5 h-3.5 animate-spin" />
1075
+ {t("designSystemSetup.parsingFigmaFile")}
1076
+ </span>
1077
+ ) : (
1078
+ <span className="text-xs text-foreground/80">
1079
+ {t("designSystemSetup.uploadFigDescription")}
1080
+ </span>
1081
+ )}
1082
+ </button>
1083
+ {builderUploadProgress !== null && (
1084
+ <Progress
1085
+ aria-label={t("designSystemSetup.parsingFigmaFile")}
1086
+ value={Math.round(builderUploadProgress * 100)}
1087
+ className="h-1.5"
1088
+ />
1089
+ )}
1090
+ <input
1091
+ ref={figInputRef}
1092
+ type="file"
1093
+ accept=".fig"
1094
+ onChange={handleBuilderIndexUpload}
1095
+ className="hidden"
1096
+ />
1097
+ {builderIndexError && (
1098
+ <div
1099
+ role="alert"
1100
+ className="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive"
1101
+ >
1102
+ {builderIndexError}
1103
+ </div>
1104
+ )}
1105
+ </>
1106
+ ) : (
1107
+ <BuilderIndexPreview
1108
+ result={builderIndexResult}
1109
+ decodeStatus={decodeStatus}
1110
+ isIndexing={builderIndexing}
1111
+ displayTitle={companyName.trim()}
1112
+ onReset={() => {
1113
+ stopDecodePolling();
1114
+ setDecodeStatus(null);
1115
+ setBuilderIndexResult(null);
1116
+ setBuilderIndexError(null);
1117
+ setBuilderIndexing(false);
1118
+ setBuilderUploadProgress(null);
1119
+ }}
1120
+ />
1121
+ )}
1122
+ </div>
1123
+
1124
+ <SourceAccordionRow
1125
+ icon={IconComponents}
1126
+ title={t("designSystemSetup.otherSources")}
1127
+ description={t("designSystemSetup.otherSourcesDescription")}
1128
+ expanded={sourcePanel === "other"}
1129
+ onClick={() => setSourcePanel("other")}
1130
+ panelId="slides-design-system-other-sources"
1131
+ />
1132
+ {sourcePanel === "other" && (
1133
+ <div
1134
+ id="slides-design-system-other-sources"
1135
+ className="space-y-2"
1136
+ >
1137
+ <p className="px-1 py-1 text-xs font-medium text-foreground/80">
1138
+ {t("designSystemSetup.chooseSourcePrompt")}
1139
+ </p>
1140
+ <div className="space-y-2">
1141
+ <SourceAccordionRow
1142
+ icon={IconComponents}
1143
+ title={t("designSystemSetup.companyBrand")}
1144
+ description={t(
1145
+ "designSystemSetup.companyBrandPlaceholder",
1146
+ )}
1147
+ expanded={otherSource === "brand"}
1148
+ onClick={() => selectOtherSource("brand")}
1149
+ panelId="slides-design-system-brand-source"
1150
+ />
1151
+ {otherSource === "brand" && (
1152
+ <div
1153
+ id="slides-design-system-brand-source"
1154
+ className={cn(
1155
+ "space-y-4 rounded-lg border border-border bg-card p-4",
1156
+ otherSource !== "brand" && "hidden",
1157
+ )}
1158
+ >
1159
+ <div className="space-y-2">
1160
+ <Input
1161
+ id="slides-design-system-company-name"
1162
+ aria-label={t("designSystemSetup.companyBrand")}
1163
+ value={companyName}
1164
+ onChange={(e) => setCompanyName(e.target.value)}
1165
+ placeholder={t(
1166
+ "designSystemSetup.companyBrandPlaceholder",
1167
+ )}
1168
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70"
1169
+ />
1170
+ </div>
1171
+ <div className="space-y-2">
1172
+ <Label className="text-foreground/80 flex items-center gap-1.5">
1173
+ <IconWorld className="w-3.5 h-3.5" />
1174
+ {t("designSystemSetup.websiteUrl")}
1175
+ </Label>
1176
+ <div className="flex gap-2">
1177
+ <Input
1178
+ value={websiteUrl}
1179
+ onChange={(e) =>
1180
+ setWebsiteUrl(e.target.value)
1181
+ }
1182
+ placeholder={t(
1183
+ "designSystemSetup.websitePlaceholder",
1184
+ )}
1185
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70"
1186
+ onBlur={() => {
1187
+ const normalized =
1188
+ normalizeWebsiteUrlInput(websiteUrl);
1189
+ if (normalized) setWebsiteUrl(normalized);
1190
+ }}
1191
+ onKeyDown={(e) => {
1192
+ if (e.key === "Enter") addWebsiteUrl();
1193
+ }}
1194
+ />
1195
+ <Button
1196
+ variant="outline"
1197
+ size="sm"
1198
+ onClick={addWebsiteUrl}
1199
+ className="shrink-0 cursor-pointer"
1200
+ >
1201
+ {t("designSystemSetup.add")}
1202
+ </Button>
1203
+ </div>
1204
+ <TagList
1205
+ items={websiteUrls}
1206
+ onRemove={(i) =>
1207
+ setWebsiteUrls((p) =>
1208
+ p.filter((_, j) => j !== i),
1209
+ )
1210
+ }
1211
+ />
1212
+ </div>
1213
+ </div>
1214
+ )}
1215
+ <SourceAccordionRow
1216
+ icon={IconBrandGithub}
1217
+ title={t("designSystemSetup.githubRepository")}
1218
+ description={t("designSystemSetup.codeFilesDrop")}
1219
+ expanded={otherSource === "code"}
1220
+ onClick={() => selectOtherSource("code")}
1221
+ panelId="slides-design-system-code-source"
1222
+ locked={!codeIndexingAllowed}
1223
+ lockedMessage={t(
1224
+ "designSystemSetup.codeIndexingEnterpriseOnly",
1225
+ )}
1226
+ />
1227
+ {otherSource === "code" && (
1228
+ <>
1229
+ <div
1230
+ id="slides-design-system-code-source"
1231
+ className={cn(
1232
+ "space-y-2 rounded-lg border border-border bg-card p-4",
1233
+ otherSource !== "code" && "hidden",
1234
+ )}
1235
+ >
1236
+ <Label className="text-foreground/80 flex items-center gap-1.5">
1237
+ <IconBrandGithub className="w-3.5 h-3.5" />
1238
+ {t("designSystemSetup.githubRepository")}
1239
+ </Label>
1240
+ <div className="flex gap-2">
1241
+ <Input
1242
+ value={githubUrl}
1243
+ onChange={(e) => setGithubUrl(e.target.value)}
1244
+ placeholder="https://github.com/org/repo"
1245
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70"
1246
+ onKeyDown={(e) => {
1247
+ if (e.key === "Enter") addGithubLink();
1248
+ }}
1249
+ />
1250
+ <Button
1251
+ variant="outline"
1252
+ size="sm"
1253
+ onClick={addGithubLink}
1254
+ className="shrink-0 cursor-pointer"
1255
+ >
1256
+ {t("designSystemSetup.add")}
1257
+ </Button>
1258
+ </div>
1259
+ <div className="grid gap-2 sm:grid-cols-2">
1260
+ <Input
1261
+ value={githubRef}
1262
+ onChange={(e) => setGithubRef(e.target.value)}
1263
+ placeholder={t("designSystemSetup.githubRef")}
1264
+ aria-label={t("designSystemSetup.githubRef")}
1265
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70"
1266
+ />
1267
+ <Input
1268
+ value={githubPaths}
1269
+ onChange={(e) =>
1270
+ setGithubPaths(e.target.value)
1271
+ }
1272
+ placeholder={t(
1273
+ "designSystemSetup.githubPaths",
1274
+ )}
1275
+ aria-label={t(
1276
+ "designSystemSetup.githubPaths",
1277
+ )}
1278
+ className="bg-accent border-border text-foreground placeholder:text-foreground/70"
1279
+ />
1280
+ </div>
1281
+ <TagList
1282
+ items={githubLinks.map((l) =>
1283
+ [l.url, l.ref, l.include?.join(", ")]
1284
+ .filter(Boolean)
1285
+ .join(" · "),
1286
+ )}
1287
+ onRemove={(i) =>
1288
+ setGithubLinks((p) =>
1289
+ p.filter((_, j) => j !== i),
1290
+ )
1291
+ }
1292
+ />
1293
+ </div>
1294
+
1295
+ <div
1296
+ className={cn(
1297
+ "space-y-2 rounded-lg border border-border bg-card p-4",
1298
+ otherSource !== "code" && "hidden",
1299
+ )}
1300
+ >
1301
+ <Label className="text-foreground/80 flex items-center gap-1.5">
1302
+ <IconFolder className="w-3.5 h-3.5" />
1303
+ {t("designSystemSetup.codeFiles")}
1304
+ </Label>
1305
+ <button
1306
+ onClick={() => codeInputRef.current?.click()}
1307
+ onDrop={(e) => {
1308
+ e.preventDefault();
1309
+ if (e.dataTransfer.files)
1310
+ readTextFiles(
1311
+ e.dataTransfer.files,
1312
+ setCodeFiles,
1313
+ );
1314
+ }}
1315
+ onDragOver={(e) => e.preventDefault()}
1316
+ className="w-full border border-dashed border-border rounded-lg p-4 text-center hover:border-foreground/20 cursor-pointer"
1317
+ >
1318
+ <p className="text-xs text-foreground/80">
1319
+ {t("designSystemSetup.codeFilesDrop")}
1320
+ </p>
1321
+ </button>
1322
+ <input
1323
+ ref={codeInputRef}
1324
+ type="file"
1325
+ multiple
1326
+ accept=".css,.scss,.sass,.less,.ts,.tsx,.js,.jsx,.json,.html,.svg,.xml,.md,.markdown,.mdx,.txt"
1327
+ onChange={(e) => {
1328
+ if (e.target.files)
1329
+ readTextFiles(e.target.files, setCodeFiles);
1330
+ e.target.value = "";
1331
+ }}
1332
+ className="hidden"
1333
+ />
1334
+ <FileList
1335
+ files={codeFiles}
1336
+ onRemove={(id) =>
1337
+ setCodeFiles((p) =>
1338
+ p.filter((f) => f.id !== id),
1339
+ )
1340
+ }
1341
+ />
1342
+ </div>
1343
+ </>
1344
+ )}
1345
+ <SourceAccordionRow
1346
+ icon={IconFileDescription}
1347
+ title={t("designSystemSetup.documents")}
1348
+ description={t("designSystemSetup.documentsDrop")}
1349
+ expanded={otherSource === "files"}
1350
+ onClick={() => selectOtherSource("files")}
1351
+ panelId="slides-design-system-file-source"
1352
+ />
1353
+ {otherSource === "files" && (
1354
+ <>
1355
+ <div
1356
+ id="slides-design-system-file-source"
1357
+ className={cn(
1358
+ "space-y-2 rounded-lg border border-border bg-card p-4",
1359
+ otherSource !== "files" && "hidden",
1360
+ )}
1361
+ >
1362
+ <Label className="text-foreground/80 flex items-center gap-1.5">
1363
+ <IconFileDescription className="w-3.5 h-3.5" />
1364
+ {t("designSystemSetup.documents")}
1365
+ </Label>
1366
+ <button
1367
+ onClick={() => docInputRef.current?.click()}
1368
+ onDrop={(e) => {
1369
+ e.preventDefault();
1370
+ if (e.dataTransfer.files)
1371
+ readTextFiles(
1372
+ e.dataTransfer.files,
1373
+ setDocFiles,
1374
+ );
1375
+ }}
1376
+ onDragOver={(e) => e.preventDefault()}
1377
+ className="w-full border border-dashed border-border rounded-lg p-4 text-center hover:border-foreground/20 cursor-pointer"
1378
+ >
1379
+ <p className="text-xs text-foreground/80">
1380
+ {t("designSystemSetup.documentsDrop")}
1381
+ </p>
1382
+ </button>
1383
+ <input
1384
+ ref={docInputRef}
1385
+ type="file"
1386
+ accept=".pptx,.ppt,.docx,.doc,.pdf,.xlsx,.xls,.md,.markdown,.mdx,.txt"
1387
+ multiple
1388
+ onChange={(e) => {
1389
+ if (e.target.files)
1390
+ readTextFiles(e.target.files, setDocFiles);
1391
+ e.target.value = "";
1392
+ }}
1393
+ className="hidden"
1394
+ />
1395
+ <FileList
1396
+ files={docFiles}
1397
+ onRemove={(id) =>
1398
+ setDocFiles((p) =>
1399
+ p.filter((f) => f.id !== id),
1400
+ )
1401
+ }
1402
+ />
1403
+ </div>
1404
+
1405
+ <div
1406
+ className={cn(
1407
+ "space-y-2 rounded-lg border border-border bg-card p-4",
1408
+ otherSource !== "files" && "hidden",
1409
+ )}
1410
+ >
1411
+ <Label className="text-foreground/80 flex items-center gap-1.5">
1412
+ <IconPhoto className="w-3.5 h-3.5" />
1413
+ {t("designSystemSetup.visualReferences")}
1414
+ </Label>
1415
+ <button
1416
+ onClick={() => imageInputRef.current?.click()}
1417
+ onDragOver={(event) => event.preventDefault()}
1418
+ onDrop={(event) => {
1419
+ event.preventDefault();
1420
+ event.stopPropagation();
1421
+ addImageFiles(event.dataTransfer.files);
1422
+ }}
1423
+ className="w-full border border-dashed border-border rounded-lg p-4 text-center hover:border-foreground/20 cursor-pointer"
1424
+ >
1425
+ <p className="text-xs text-foreground/80">
1426
+ {t("designSystemSetup.visualReferencesDrop")}
1427
+ </p>
1428
+ </button>
1429
+ <input
1430
+ ref={imageInputRef}
1431
+ type="file"
1432
+ accept="image/*,.svg"
1433
+ multiple
1434
+ onChange={(e) => {
1435
+ if (e.target.files)
1436
+ addImageFiles(e.target.files);
1437
+ e.target.value = "";
1438
+ }}
1439
+ className="hidden"
1440
+ />
1441
+ <FileList
1442
+ files={imageFiles}
1443
+ onRemove={(id) =>
1444
+ setImageFiles((p) =>
1445
+ p.filter((f) => f.id !== id),
1446
+ )
1447
+ }
1448
+ />
1449
+ </div>
1450
+ </>
1451
+ )}
1452
+ {existingSystems.length > 0 && (
1453
+ <>
1454
+ <SourceAccordionRow
1455
+ icon={IconComponents}
1456
+ title={t("designSystemSetup.forkExisting")}
1457
+ description={t(
1458
+ "designSystemSetup.customInstructionsDescription",
1459
+ )}
1460
+ expanded={otherSource === "existing"}
1461
+ onClick={() => selectOtherSource("existing")}
1462
+ panelId="slides-design-system-existing-source"
1463
+ />
1464
+ {otherSource === "existing" && (
1465
+ <div
1466
+ id="slides-design-system-existing-source"
1467
+ className="space-y-2 rounded-lg border border-border bg-card p-4"
1468
+ >
1469
+ <Label className="text-foreground/80">
1470
+ {t("designSystemSetup.forkExisting")}
1471
+ </Label>
1472
+ <div className="grid grid-cols-2 gap-2">
1473
+ {existingSystems
1474
+ .filter((s) => s.id !== editingId)
1475
+ .map((ds) => (
1476
+ <button
1477
+ key={ds.id}
1478
+ onClick={() =>
1479
+ setSelectedSystemId((prev) =>
1480
+ prev === ds.id ? "" : ds.id,
1481
+ )
1482
+ }
1483
+ className={`text-left p-3 rounded-lg border cursor-pointer ${
1484
+ selectedSystemId === ds.id
1485
+ ? "border-primary/40 bg-primary/5"
1486
+ : "border-border bg-accent hover:border-foreground/20"
1487
+ }`}
1488
+ >
1489
+ <div className="flex items-center gap-2">
1490
+ <IconComponents className="w-3.5 h-3.5 text-muted-foreground" />
1491
+ <span className="text-sm text-foreground/80 truncate">
1492
+ {ds.title}
1493
+ </span>
1494
+ </div>
1495
+ </button>
1496
+ ))}
1497
+ </div>
1498
+ </div>
1499
+ )}
1500
+ </>
1501
+ )}
1502
+ <SourceAccordionRow
1503
+ icon={IconFileDescription}
1504
+ title={t("designSystemSetup.additionalNotes")}
1505
+ description={t(
1506
+ "designSystemSetup.customInstructionsDescription",
1507
+ )}
1508
+ expanded={otherSource === "context"}
1509
+ onClick={() => selectOtherSource("context")}
1510
+ panelId="slides-design-system-context-source"
1511
+ />
1512
+ {otherSource === "context" && (
1513
+ <div
1514
+ id="slides-design-system-context-source"
1515
+ className="space-y-2"
1516
+ >
1517
+ {brandNotesForm}
1518
+ {customInstructionsForm}
1519
+ </div>
1520
+ )}
1521
+ </div>
1522
+ </div>
1523
+ )}
1524
+ </>
1525
+ )}
1526
+
1527
+ {editingId && (
1528
+ <>
1529
+ {brandNotesForm}
1530
+ {customInstructionsForm}
1531
+ </>
1532
+ )}
1533
+ </div>
1534
+ )}
1535
+ </ScrollArea>
1536
+
1537
+ {tierLimitUpgradeUrl && (
1538
+ <div className="mx-6 mb-2 flex items-center justify-between gap-3 rounded-md border border-border bg-accent/40 px-3 py-2 text-sm text-foreground/80">
1539
+ <span>{t("designSystems.tierLimitTitle")}</span>
1540
+ <a
1541
+ href={tierLimitUpgradeUrl}
1542
+ target="_blank"
1543
+ rel="noreferrer"
1544
+ className="inline-flex shrink-0 items-center gap-1.5 font-medium text-primary hover:underline"
1545
+ >
1546
+ <IconExternalLink className="w-3.5 h-3.5" />
1547
+ {t("designSystems.tierLimitUpgrade")}
1548
+ </a>
1549
+ </div>
1550
+ )}
1551
+
1552
+ {/* Actions */}
1553
+ <div className="flex justify-end gap-3 px-6 pb-6 pt-2 border-t border-border">
1554
+ <Button
1555
+ variant="ghost"
1556
+ onClick={onClose}
1557
+ disabled={generating}
1558
+ className="text-muted-foreground hover:text-foreground cursor-pointer"
1559
+ >
1560
+ {t("designSystemSetup.cancel")}
1561
+ </Button>
1562
+ <Button
1563
+ onClick={handleGenerate}
1564
+ disabled={
1565
+ editingId
1566
+ ? generating || !existingDs || existingDsLoading
1567
+ : builderIndexing || !hasAnySources
1568
+ }
1569
+ className="cursor-pointer"
1570
+ >
1571
+ {generating ? (
1572
+ <>
1573
+ <IconLoader2 className="w-4 h-4 animate-spin" />
1574
+ {t("designSystemSetup.saving")}
1575
+ </>
1576
+ ) : editingId ? (
1577
+ t("designSystemSetup.saveChanges")
1578
+ ) : (
1579
+ t("designSystemSetup.continueToGeneration")
1580
+ )}
1581
+ </Button>
1582
+ </div>
1583
+ </DialogContent>
1584
+ </Dialog>
1585
+ );
1586
+ }
1587
+
1588
+ function parseDesignSystemData(
1589
+ data?: string | null,
1590
+ ): { ok: true; value: Record<string, unknown> } | { ok: false } {
1591
+ if (!data) return { ok: false };
1592
+ try {
1593
+ const parsed: unknown = JSON.parse(data);
1594
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
1595
+ return { ok: false };
1596
+ }
1597
+ return { ok: true, value: parsed as Record<string, unknown> };
1598
+ } catch {
1599
+ return { ok: false };
1600
+ }
1601
+ }
1602
+
1603
+ function isGeneratedBuilderInstructions(
1604
+ value: string | undefined,
1605
+ builder: BuilderSourceDetails,
1606
+ ): boolean {
1607
+ const instructions = value?.trim();
1608
+ if (!instructions) return false;
1609
+ return (
1610
+ instructions.startsWith(
1611
+ "This design system is indexed by Builder Design System Intelligence (DSI).",
1612
+ ) &&
1613
+ instructions.includes(
1614
+ `Builder design system id: ${builder.builderDesignSystemId}`,
1615
+ ) &&
1616
+ instructions.includes("Call get-design-system for this local id")
1617
+ );
1618
+ }
1619
+
1620
+ function SourceAccordionRow({
1621
+ icon: Icon,
1622
+ title,
1623
+ description,
1624
+ expanded,
1625
+ onClick,
1626
+ panelId,
1627
+ className,
1628
+ locked,
1629
+ lockedMessage,
1630
+ }: {
1631
+ icon: React.ComponentType<{ className?: string }>;
1632
+ title: string;
1633
+ description?: string;
1634
+ expanded: boolean;
1635
+ onClick: () => void;
1636
+ panelId: string;
1637
+ className?: string;
1638
+ locked?: boolean;
1639
+ lockedMessage?: string;
1640
+ }) {
1641
+ const secondaryText = locked ? lockedMessage : description;
1642
+
1643
+ return (
1644
+ <button
1645
+ type="button"
1646
+ aria-controls={panelId}
1647
+ aria-expanded={expanded}
1648
+ aria-disabled={locked}
1649
+ title={locked ? lockedMessage : undefined}
1650
+ onClick={locked ? undefined : onClick}
1651
+ className={cn(
1652
+ "flex w-full items-center gap-3 rounded-lg border border-border px-4 py-3 text-left transition-[background-color,border-color] duration-150 hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1653
+ expanded && "bg-accent/40",
1654
+ locked && "opacity-60 cursor-not-allowed hover:bg-transparent",
1655
+ className,
1656
+ )}
1657
+ >
1658
+ <Icon className="size-4 shrink-0 text-muted-foreground" />
1659
+ <span className="min-w-0 flex-1">
1660
+ <span className="block text-sm font-medium text-foreground/90">
1661
+ {title}
1662
+ </span>
1663
+ {secondaryText ? (
1664
+ <span className="mt-0.5 block truncate text-xs text-foreground/80">
1665
+ {secondaryText}
1666
+ </span>
1667
+ ) : null}
1668
+ </span>
1669
+ {locked ? (
1670
+ <IconLock className="size-4 shrink-0 text-muted-foreground" />
1671
+ ) : (
1672
+ <IconChevronDown
1673
+ className={cn(
1674
+ "size-4 shrink-0 text-muted-foreground transition-transform duration-150",
1675
+ expanded && "rotate-180",
1676
+ )}
1677
+ />
1678
+ )}
1679
+ </button>
1680
+ );
1681
+ }
1682
+
1683
+ function BuilderSourceStatus({
1684
+ builder,
1685
+ onSync,
1686
+ syncing = false,
1687
+ }: {
1688
+ builder: BuilderSourceDetails;
1689
+ onSync?: () => void;
1690
+ syncing?: boolean;
1691
+ }) {
1692
+ const t = useT();
1693
+ const docCount = builder.docCount;
1694
+ const docs = docCount ?? 0;
1695
+ const tokens = Object.keys(builder.tokenValues ?? {}).length;
1696
+ const hasIndexedResults = docs > 0 || tokens > 0;
1697
+ const state = hasIndexedResults
1698
+ ? "indexed"
1699
+ : builder.warning
1700
+ ? "unavailable"
1701
+ : "indexing";
1702
+ const sourceKind = builder.sourceKind;
1703
+ const SourceIcon =
1704
+ sourceKind === "figma"
1705
+ ? IconBrandFigma
1706
+ : sourceKind === "github"
1707
+ ? IconBrandGithub
1708
+ : sourceKind === "code"
1709
+ ? IconFolder
1710
+ : IconComponents;
1711
+ const sourceTitle =
1712
+ sourceKind === "figma"
1713
+ ? t("designSystemSetup.sourceFigma")
1714
+ : sourceKind === "github"
1715
+ ? t("designSystemSetup.sourceGitHub")
1716
+ : sourceKind === "code"
1717
+ ? t("designSystemSetup.sourceCode")
1718
+ : sourceKind === "mixed"
1719
+ ? t("designSystemSetup.sourceMixed")
1720
+ : t("designSystemSetup.sourceBuilder");
1721
+ const statusDescription =
1722
+ state === "unavailable"
1723
+ ? t("designSystemSetup.sourceUnavailableDescription")
1724
+ : state === "indexing"
1725
+ ? t("designSystemSetup.sourceIndexingDescription")
1726
+ : docs > 0 && tokens > 0
1727
+ ? t("designSystemSetup.sourceIndexedDescription", { docs, tokens })
1728
+ : docs > 0
1729
+ ? t("designSystemSetup.sourceIndexedDocsOnly", { docs })
1730
+ : tokens > 0
1731
+ ? t("designSystemSetup.sourceIndexedTokensOnly", { tokens })
1732
+ : t("designSystemSetup.sourceIndexedDescription", {
1733
+ docs,
1734
+ tokens,
1735
+ });
1736
+
1737
+ return (
1738
+ <section
1739
+ aria-label={t("designSystemSetup.sourceLabel")}
1740
+ className="rounded-lg border border-border bg-accent/30 px-4 py-3"
1741
+ >
1742
+ <div className="flex items-start gap-3">
1743
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-md bg-background text-muted-foreground">
1744
+ <SourceIcon className="size-4" />
1745
+ </div>
1746
+ <div className="min-w-0 flex-1">
1747
+ <p className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
1748
+ {t("designSystemSetup.sourceLabel")}
1749
+ </p>
1750
+ <p className="mt-0.5 truncate text-sm font-medium text-foreground">
1751
+ {sourceTitle}
1752
+ </p>
1753
+ <p className="mt-1 text-xs leading-relaxed text-muted-foreground">
1754
+ {statusDescription}
1755
+ </p>
1756
+ </div>
1757
+ </div>
1758
+ {builder.builderUrl || onSync ? (
1759
+ <div className="mt-3 flex flex-wrap items-center gap-3 border-t border-border pt-3">
1760
+ {builder.builderUrl ? (
1761
+ <a
1762
+ href={withBuilderUtmTrackingParams(builder.builderUrl, {
1763
+ campaign: "product",
1764
+ content: "design_system_intelligence",
1765
+ })}
1766
+ target="_blank"
1767
+ rel="noreferrer"
1768
+ className="inline-flex items-center gap-1.5 text-xs font-medium text-foreground underline-offset-4 hover:underline"
1769
+ >
1770
+ {t("designSystemSetup.sourceOpenInBuilder")}
1771
+ <IconExternalLink className="size-3.5" />
1772
+ </a>
1773
+ ) : null}
1774
+ {onSync ? (
1775
+ <Button
1776
+ type="button"
1777
+ variant="ghost"
1778
+ size="sm"
1779
+ onClick={onSync}
1780
+ disabled={syncing}
1781
+ className="h-7 gap-1.5 px-2 text-xs"
1782
+ >
1783
+ <IconRefresh
1784
+ className={cn("size-3.5", syncing && "animate-spin")}
1785
+ />
1786
+ {syncing
1787
+ ? t("designSystemSetup.syncingSource")
1788
+ : t("designSystemSetup.syncSource")}
1789
+ </Button>
1790
+ ) : null}
1791
+ </div>
1792
+ ) : null}
1793
+ </section>
1794
+ );
1795
+ }
1796
+
1797
+ function DesignSystemEditSkeleton() {
1798
+ const t = useT();
1799
+ return (
1800
+ <div
1801
+ aria-busy="true"
1802
+ aria-label={t("designSystemSetup.loading")}
1803
+ className="space-y-5 py-4"
1804
+ >
1805
+ <div className="space-y-2">
1806
+ <Skeleton className="h-4 w-28" />
1807
+ <Skeleton className="h-10 w-full rounded-md" />
1808
+ </div>
1809
+ <div className="space-y-3 rounded-lg border border-border bg-accent/30 px-4 py-3">
1810
+ <div className="flex items-center gap-3">
1811
+ <Skeleton className="size-9 rounded-md" />
1812
+ <div className="flex-1 space-y-2">
1813
+ <Skeleton className="h-3 w-16" />
1814
+ <Skeleton className="h-4 w-32" />
1815
+ </div>
1816
+ <Skeleton className="h-4 w-24" />
1817
+ </div>
1818
+ <Skeleton className="h-3 w-4/5" />
1819
+ <Skeleton className="h-3 w-24" />
1820
+ </div>
1821
+ <div className="space-y-2">
1822
+ <Skeleton className="h-4 w-24" />
1823
+ <Skeleton className="h-24 w-full rounded-md" />
1824
+ </div>
1825
+ <div className="space-y-2">
1826
+ <Skeleton className="h-4 w-36" />
1827
+ <Skeleton className="h-32 w-full rounded-md" />
1828
+ <Skeleton className="h-3 w-64" />
1829
+ </div>
1830
+ </div>
1831
+ );
1832
+ }
1833
+
1834
+ function DesignSystemEditError() {
1835
+ const t = useT();
1836
+ return (
1837
+ <div
1838
+ role="alert"
1839
+ className="flex min-h-64 items-center justify-center py-8 text-center text-sm text-destructive"
1840
+ >
1841
+ {t("designSystemSetup.loadFailed")}
1842
+ </div>
1843
+ );
1844
+ }
1845
+
1846
+ function TagList({
1847
+ items,
1848
+ onRemove,
1849
+ }: {
1850
+ items: string[];
1851
+ onRemove: (index: number) => void;
1852
+ }) {
1853
+ const t = useT();
1854
+ if (items.length === 0) return null;
1855
+ return (
1856
+ <div className="space-y-1">
1857
+ {items.map((item, i) => (
1858
+ <div
1859
+ key={i}
1860
+ className="flex items-center gap-2 text-sm text-foreground/80 bg-accent rounded-md px-3 py-1.5"
1861
+ >
1862
+ <IconCheck className="w-3.5 h-3.5 text-primary shrink-0" />
1863
+ <span className="truncate flex-1">{item}</span>
1864
+ <button
1865
+ onClick={() => onRemove(i)}
1866
+ aria-label={t("designSystemSetup.removeItem", { item })}
1867
+ className="text-muted-foreground hover:text-foreground/70 shrink-0 cursor-pointer"
1868
+ >
1869
+ <IconX className="w-3.5 h-3.5" />
1870
+ </button>
1871
+ </div>
1872
+ ))}
1873
+ </div>
1874
+ );
1875
+ }
1876
+
1877
+ function BuilderIndexPreview({
1878
+ result,
1879
+ decodeStatus,
1880
+ isIndexing,
1881
+ displayTitle,
1882
+ onReset,
1883
+ }: {
1884
+ result: BuilderIndexResult;
1885
+ decodeStatus: DecodeJobStatus | null;
1886
+ isIndexing: boolean;
1887
+ displayTitle?: string;
1888
+ onReset: () => void;
1889
+ }) {
1890
+ const t = useT();
1891
+ const decodeDone =
1892
+ decodeStatus == null
1893
+ ? !result.jobId
1894
+ : Boolean(decodeStatus.branchUrl) || decodeStatus.status === "complete";
1895
+ const decodeFailed = decodeStatus?.status === "error";
1896
+ const frameProgress =
1897
+ decodeStatus && decodeStatus.totalFrames > 0
1898
+ ? Math.min(
1899
+ Math.round(
1900
+ (decodeStatus.framesProcessed / decodeStatus.totalFrames) * 100,
1901
+ ),
1902
+ 100,
1903
+ )
1904
+ : null;
1905
+ const decodeText = decodeFailed
1906
+ ? t("designSystemSetup.decodeFailed", { error: decodeStatus?.error ?? "" })
1907
+ : null;
1908
+ return (
1909
+ <div className="space-y-4 rounded-lg border border-border bg-accent/40 p-4">
1910
+ <div className="flex items-start gap-3">
1911
+ <div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-[hsl(var(--slides-accent)/0.1)]">
1912
+ <IconBrandFigma className="h-5 w-5 text-[hsl(var(--slides-accent))]" />
1913
+ </div>
1914
+ <div className="min-w-0 flex-1 space-y-1.5">
1915
+ <h4 className="text-sm font-medium text-foreground">
1916
+ {t("designSystemSetup.builderIndexingStarted")}
1917
+ </h4>
1918
+ <p className="text-xs text-foreground/80">
1919
+ {t("designSystemSetup.builderIndexingDescription", {
1920
+ title:
1921
+ displayTitle ||
1922
+ result.suggestedTitle ||
1923
+ t("designSystemSetup.importedBrand"),
1924
+ })}
1925
+ </p>
1926
+ </div>
1927
+ </div>
1928
+
1929
+ {decodeText && (
1930
+ <div className="border-t border-border pt-3 text-xs text-destructive">
1931
+ {decodeText}
1932
+ </div>
1933
+ )}
1934
+
1935
+ {isIndexing && !decodeFailed && (
1936
+ <div className="border-t border-border pt-3">
1937
+ {frameProgress === null ? (
1938
+ <span className="inline-flex items-center gap-2 text-xs text-foreground/80">
1939
+ <IconLoader2 className="w-3.5 h-3.5 animate-spin" />
1940
+ {t("designSystemSetup.parsingFigmaFile")}
1941
+ </span>
1942
+ ) : (
1943
+ <Progress
1944
+ aria-label={t("designSystemSetup.parsingFigmaFile")}
1945
+ value={frameProgress}
1946
+ className="h-1.5"
1947
+ />
1948
+ )}
1949
+ </div>
1950
+ )}
1951
+
1952
+ {(decodeDone || decodeFailed) && (
1953
+ <div className="flex flex-wrap items-center gap-2 border-t border-border pt-3">
1954
+ {decodeDone && !decodeFailed && (
1955
+ <Button size="sm" asChild className="cursor-pointer">
1956
+ <a
1957
+ href={withBuilderUtmTrackingParams(result.builderUrl, {
1958
+ campaign: "product",
1959
+ content: "design_system_intelligence",
1960
+ })}
1961
+ target="_blank"
1962
+ rel="noreferrer"
1963
+ >
1964
+ <IconExternalLink className="w-3.5 h-3.5" />
1965
+ {t("designSystemSetup.openInBuilder")}
1966
+ </a>
1967
+ </Button>
1968
+ )}
1969
+ <Button
1970
+ size="sm"
1971
+ variant="ghost"
1972
+ onClick={onReset}
1973
+ className="cursor-pointer"
1974
+ >
1975
+ {t("designSystemSetup.chooseAnotherFile")}
1976
+ </Button>
1977
+ </div>
1978
+ )}
1979
+ </div>
1980
+ );
1981
+ }
1982
+
1983
+ function FileList({
1984
+ files,
1985
+ onRemove,
1986
+ }: {
1987
+ files: UploadedFile[];
1988
+ onRemove: (id: string) => void;
1989
+ }) {
1990
+ const t = useT();
1991
+ if (files.length === 0) return null;
1992
+ return (
1993
+ <div className="space-y-1">
1994
+ {files.map((f) => (
1995
+ <div
1996
+ key={f.id}
1997
+ className="flex items-center gap-2 text-sm text-foreground/80 bg-accent rounded-md px-3 py-1.5"
1998
+ >
1999
+ <IconCheck className="w-3.5 h-3.5 text-primary shrink-0" />
2000
+ <span className="truncate flex-1">{f.name}</span>
2001
+ <span className="text-[10px] text-muted-foreground shrink-0">
2002
+ {formatSize(f.size)}
2003
+ </span>
2004
+ <button
2005
+ onClick={() => onRemove(f.id)}
2006
+ aria-label={t("designSystemSetup.removeItem", { item: f.name })}
2007
+ className="text-muted-foreground hover:text-foreground/70 shrink-0 cursor-pointer"
2008
+ >
2009
+ <IconX className="w-3.5 h-3.5" />
2010
+ </button>
2011
+ </div>
2012
+ ))}
2013
+ </div>
2014
+ );
2015
+ }
2016
+
2017
+ function formatSize(bytes: number): string {
2018
+ if (bytes < 1024) return `${bytes}B`;
2019
+ if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)}KB`;
2020
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
2021
+ }