@agent-native/core-corpus 0.214.0 → 0.217.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.
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +61 -1
- package/corpus/templates/analytics/AGENTS.md +1 -1
- package/corpus/templates/analytics/CHANGELOG.md +2 -0
- package/corpus/templates/analytics/actions/get-session-replay-summary.ts +9 -65
- package/corpus/templates/analytics/actions/list-event-catalog.ts +1 -1
- package/corpus/templates/analytics/actions/list-session-outputs.ts +40 -0
- package/corpus/templates/analytics/actions/list-session-recordings.ts +17 -4
- package/corpus/templates/analytics/actions/view-screen.ts +29 -3
- package/corpus/templates/analytics/app/i18n/en-US.ts +27 -0
- package/corpus/templates/analytics/app/pages/sessions/EventCatalogPage.tsx +18 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +3 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionOutputs.tsx +197 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionsTriagePage.tsx +114 -4
- package/corpus/templates/analytics/changelog/2026-10-15-sessions-can-find-people-who-made-a-slides-deck-but-didn-t-p.md +6 -0
- package/corpus/templates/analytics/changelog/2026-10-16-the-activation-funnel-counts-visitors-who-decline-analytics-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-10-21-session-replay-quotas-count-the-compressed-size-analytics-st.md +6 -0
- package/corpus/templates/analytics/server/db/schema.ts +67 -0
- package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +9 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +28 -22
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +36 -1
- package/corpus/templates/analytics/server/lib/output-outcomes.ts +712 -0
- package/corpus/templates/analytics/server/lib/replay-origins.ts +33 -0
- package/corpus/templates/analytics/server/lib/session-event-index.ts +20 -0
- package/corpus/templates/analytics/server/lib/session-performance.ts +6 -40
- package/corpus/templates/analytics/server/lib/session-recording-associations.ts +30 -1
- package/corpus/templates/analytics/server/lib/session-replay-triage.ts +99 -0
- package/corpus/templates/analytics/server/lib/session-replay.ts +85 -40
- package/corpus/templates/analytics/server/lib/sessions-triage-lab.ts +8 -2
- package/corpus/templates/analytics/server/plugins/db.ts +46 -0
- package/corpus/templates/analytics/shared/output-use.ts +205 -0
- package/corpus/templates/analytics/shared/session-events.ts +6 -0
- package/corpus/templates/assets/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/brain/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/calendar/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/calendar/CHANGELOG.md +6 -0
- package/corpus/templates/calendar/actions/create-event.ts +2 -4
- package/corpus/templates/calendar/actions/update-event.ts +35 -6
- package/corpus/templates/calendar/changelog/2026-10-21-solo-events-avoid-notification-approval.md +6 -0
- package/corpus/templates/chat/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/clips/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/community/qr/package.json +1 -1
- package/corpus/templates/content/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/content/.agents/skills/content-product-development/references/verification.md +36 -0
- package/corpus/templates/content/.agents/skills/document-editing/SKILL.md +10 -0
- package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +17 -3
- package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +4 -2
- package/corpus/templates/content/CHANGELOG.md +54 -0
- package/corpus/templates/content/acceptance/_writers.ts +604 -0
- package/corpus/templates/content/acceptance/generate-action-registry.ts +10 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/create-document.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/duplicate-page.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/edit-document-find-and-replace-without-a-revision.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/edit-document-find-and-replace.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/edit-document-initializecontent.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/import-content.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-import-content-source-existing-page.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-import-content-source-new-page.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-sync-local-folder-source-changed-file.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/local-files-sync-local-folder-source-new-file.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/restore-document-version.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/set-document-property-primary-blocks-field.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/set-image-alt-text.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/undo-content-import.json +75 -0
- package/corpus/templates/content/acceptance/golden/gate-off-stored-bytes/update-document-browser-full-rewrite.json +75 -0
- package/corpus/templates/content/acceptance/known-loss.ts +69 -0
- package/corpus/templates/content/acceptance/round-trip-corpus.ts +1397 -0
- package/corpus/templates/content/actions/_blocks-field-identity.ts +35 -1
- package/corpus/templates/content/actions/_browser-document-save-attempt.ts +23 -1
- package/corpus/templates/content/actions/_builder-cms-blob-custody.ts +467 -0
- package/corpus/templates/content/actions/_builder-cms-execution-lease.ts +17 -0
- package/corpus/templates/content/actions/_builder-cms-intent-lookup.ts +5 -0
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +881 -21
- package/corpus/templates/content/actions/_builder-cms-write-adapter.ts +28 -2
- package/corpus/templates/content/actions/_builder-cms-write-client.ts +109 -11
- package/corpus/templates/content/actions/_builder-docs-client.ts +1 -0
- package/corpus/templates/content/actions/_builder-private-blob.test-fixture.ts +90 -0
- package/corpus/templates/content/actions/_builder-source-execution-guard.ts +48 -0
- package/corpus/templates/content/actions/_content-database-lifecycle.ts +11 -11
- package/corpus/templates/content/actions/_content-database-personal-view.ts +2 -0
- package/corpus/templates/content/actions/_content-favorites.ts +37 -0
- package/corpus/templates/content/actions/_content-save-outcomes.ts +5 -0
- package/corpus/templates/content/actions/_database-membership-lock.ts +39 -8
- package/corpus/templates/content/actions/_database-navigation.ts +19 -21
- package/corpus/templates/content/actions/_database-row-batch.ts +41 -18
- package/corpus/templates/content/actions/_database-row-mutation.ts +17 -28
- package/corpus/templates/content/actions/_database-source-utils.ts +308 -9
- package/corpus/templates/content/actions/_database-utils.ts +96 -7
- package/corpus/templates/content/actions/_database-view-setup.ts +37 -2
- package/corpus/templates/content/actions/_delete-content-space.ts +8 -1
- package/corpus/templates/content/actions/_document-edit-mutation.ts +33 -32
- package/corpus/templates/content/actions/_document-flush.ts +593 -171
- package/corpus/templates/content/actions/_document-save-locks.ts +54 -0
- package/corpus/templates/content/actions/_document-save-row.ts +133 -0
- package/corpus/templates/content/actions/_github-source-freshness.ts +30 -4
- package/corpus/templates/content/actions/_github-source.ts +18 -8
- package/corpus/templates/content/actions/_move-page-to-space.ts +189 -25
- package/corpus/templates/content/actions/_nfm-syntax.ts +2 -0
- package/corpus/templates/content/actions/_row-lock-order.ts +115 -0
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +23 -6
- package/corpus/templates/content/actions/cancel-prepared-builder-source-update.ts +110 -26
- package/corpus/templates/content/actions/change-content-database-source-role.ts +51 -7
- package/corpus/templates/content/actions/create-content-database.ts +11 -0
- package/corpus/templates/content/actions/create-document.ts +13 -1
- package/corpus/templates/content/actions/delete-content-database.ts +17 -14
- package/corpus/templates/content/actions/delete-document-property.ts +5 -0
- package/corpus/templates/content/actions/delete-document.ts +311 -100
- package/corpus/templates/content/actions/disconnect-content-database-source.ts +68 -2
- package/corpus/templates/content/actions/disconnect-local-folder-source.ts +33 -2
- package/corpus/templates/content/actions/edit-document.ts +18 -5
- package/corpus/templates/content/actions/execute-builder-source-execution.ts +900 -140
- package/corpus/templates/content/actions/export-document.ts +3 -0
- package/corpus/templates/content/actions/get-blocks-field-word-count.ts +22 -5
- package/corpus/templates/content/actions/get-document.ts +2 -0
- package/corpus/templates/content/actions/import-content-source.ts +170 -54
- package/corpus/templates/content/actions/move-document.ts +191 -73
- package/corpus/templates/content/actions/permanently-delete-document.ts +6 -0
- package/corpus/templates/content/actions/prepare-builder-source-execution.ts +155 -13
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +299 -73
- package/corpus/templates/content/actions/pull-document.ts +8 -2
- package/corpus/templates/content/actions/remove-database-items.ts +23 -4
- package/corpus/templates/content/actions/restore-content-database.ts +76 -55
- package/corpus/templates/content/actions/restore-document-version.ts +19 -35
- package/corpus/templates/content/actions/restore-document.ts +65 -53
- package/corpus/templates/content/actions/rollback-created-slash-document.ts +11 -16
- package/corpus/templates/content/actions/set-document-property.ts +15 -1
- package/corpus/templates/content/actions/set-live-body-switch.ts +45 -0
- package/corpus/templates/content/actions/share-local-file-document.ts +18 -14
- package/corpus/templates/content/actions/suggest-document-edit.ts +2 -3
- package/corpus/templates/content/actions/sync-local-folder-source.ts +35 -1
- package/corpus/templates/content/actions/undo-content-import.ts +16 -12
- package/corpus/templates/content/actions/update-content-database-view.ts +2 -0
- package/corpus/templates/content/actions/update-document.ts +158 -34
- package/corpus/templates/content/actions/validate-builder-source-execution.ts +135 -26
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +1 -6
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +49 -3
- package/corpus/templates/content/app/components/editor/ContentImportDialog.tsx +2 -0
- package/corpus/templates/content/app/components/editor/DocumentBlockFields.tsx +53 -11
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +608 -353
- package/corpus/templates/content/app/components/editor/StaticDocumentBody.tsx +765 -0
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +233 -80
- package/corpus/templates/content/app/components/editor/blockFieldSaveController.ts +32 -3
- package/corpus/templates/content/app/components/editor/blockFieldSaveRegistry.ts +88 -23
- package/corpus/templates/content/app/components/editor/comment-anchors.ts +19 -0
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +228 -71
- package/corpus/templates/content/app/components/editor/database/GitHubSourceStatusLine.tsx +27 -2
- package/corpus/templates/content/app/components/editor/database/ListItemLayout.tsx +32 -8
- package/corpus/templates/content/app/components/editor/database/ListItemRow.tsx +27 -2
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +1 -0
- package/corpus/templates/content/app/components/editor/document-flush-participant.ts +253 -0
- package/corpus/templates/content/app/components/editor/editor-transaction-meta.ts +28 -0
- package/corpus/templates/content/app/components/editor/extensions/AudioBlock.tsx +2 -1
- package/corpus/templates/content/app/components/editor/extensions/ImageBlock.tsx +27 -6
- package/corpus/templates/content/app/components/editor/extensions/LocalMdxComponentNode.tsx +0 -1
- package/corpus/templates/content/app/components/editor/extensions/NotionExtensions.tsx +4 -4
- package/corpus/templates/content/app/components/editor/extensions/SuggestionHighlight.ts +24 -2
- package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +25 -6
- package/corpus/templates/content/app/components/editor/pending-document-persistence.ts +59 -1
- package/corpus/templates/content/app/components/editor/stored-body-images.ts +27 -0
- package/corpus/templates/content/app/components/editor/suggestions/presentation-rebase.ts +17 -0
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +11 -4
- package/corpus/templates/content/app/components/trash/TrashBrowser.tsx +4 -1
- package/corpus/templates/content/app/global.css +21 -0
- package/corpus/templates/content/app/hooks/use-content-database.ts +40 -2
- package/corpus/templates/content/app/hooks/use-content-trash.ts +8 -0
- package/corpus/templates/content/app/hooks/use-documents.ts +14 -0
- package/corpus/templates/content/app/i18n-data.ts +1 -0
- package/corpus/templates/content/app/import-messages.ts +25 -0
- package/corpus/templates/content/app/trash-messages.ts +16 -0
- 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
- package/corpus/templates/content/changelog/2026-10-16-a-page-restored-from-trash-returns-to-its-place-in-its-colle.md +6 -0
- package/corpus/templates/content/changelog/2026-10-16-agent-written-markdown-keeps-nested-lists-indented-with-spac.md +6 -0
- package/corpus/templates/content/changelog/2026-10-16-opening-a-page-you-can-edit-no-longer-rebuilds-its-editor-on.md +6 -0
- package/corpus/templates/content/changelog/2026-10-16-pages-moved-or-imported-at-the-same-time-can-no-longer-end-u.md +6 -0
- package/corpus/templates/content/changelog/2026-10-16-re-importing-a-markdown-export-of-a-page-no-longer-reports-t.md +6 -0
- package/corpus/templates/content/changelog/2026-10-16-saving-a-page-or-restoring-one-of-its-versions-no-longer-fai.md +6 -0
- package/corpus/templates/content/changelog/2026-10-17-agents-reading-a-page-you-have-open-no-longer-wait-or-fail-w.md +6 -0
- package/corpus/templates/content/changelog/2026-10-17-builder-content-avoids-retrying-a-write-when-builder-accepte.md +6 -0
- package/corpus/templates/content/changelog/2026-10-18-link-a-new-collection-to-a-github-folder-from-its-sources.md +1 -1
- package/corpus/templates/content/changelog/2026-10-19-fresh-document-reads-require-confirmation-from-every-open-ed.md +6 -0
- package/corpus/templates/content/changelog/2026-10-20-builder-content-sync-keeps-read-and-write-status-accurate-wh.md +6 -0
- package/corpus/templates/content/changelog/2026-10-20-html-table-cells-preserve-a-trailing-backslash-when-opening-.md +6 -0
- package/corpus/templates/content/changelog/2026-10-20-preserve-empty-paragraph-colors-and-refuse-unsupported-inlin.md +6 -0
- package/corpus/templates/content/changelog/2026-10-20-the-advanced-filter-and-each-filter-group-inside-it-have-the.md +6 -0
- package/corpus/templates/content/changelog/2026-10-21-blocks-fields-keep-unconfirmed-saves-visible-and-agent-reads.md +6 -0
- package/corpus/templates/content/changelog/2026-10-21-list-rows-can-show-each-pages-first-lines.md +6 -0
- package/corpus/templates/content/changelog/2026-10-21-preserve-compact-table-row-groups-and-report-invalid-block-colors.md +6 -0
- package/corpus/templates/content/changelog/2026-10-21-suggested-edits-show-an-agent-s-whole-reason-open-a-group-to.md +6 -0
- package/corpus/templates/content/changelog/2026-10-21-suggestions-keep-refusing-unmatched-emphasis-in-stored-markd.md +6 -0
- package/corpus/templates/content/changelog/2026-10-22-a-collection-linked-to-a-big-github-folder-fills-faster-and-p.md +6 -0
- package/corpus/templates/content/changelog/2026-10-22-accept-remaining-and-reject-remaining-show-the-result-for-ev.md +6 -0
- package/corpus/templates/content/changelog/2026-10-22-accepting-a-group-of-suggested-edits-saves-faster-and-adds-o.md +6 -0
- package/corpus/templates/content/changelog/2026-10-22-agents-read-saved-page-text-after-failed-icon-change.md +6 -0
- 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
- package/corpus/templates/content/changelog/2026-10-22-text-an-agent-writes-inside-a-callout-column-or-synced-block.md +6 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.adapters.md +29 -0
- package/corpus/templates/content/e2e/auth-files.ts +28 -0
- package/corpus/templates/content/e2e/convergence-summary.ts +84 -29
- package/corpus/templates/content/e2e/gate-arm.ts +15 -0
- package/corpus/templates/content/e2e/global-setup.ts +43 -75
- package/corpus/templates/content/e2e/global-teardown.ts +34 -0
- package/corpus/templates/content/e2e/helpers.ts +598 -92
- package/corpus/templates/content/e2e/live-body-gate.ts +188 -0
- package/corpus/templates/content/e2e/playwright.config.ts +12 -3
- package/corpus/templates/content/e2e/server-identity.ts +47 -0
- package/corpus/templates/content/e2e/stored-form/collab-blocks.ts +123 -0
- package/corpus/templates/content/package.json +1 -1
- package/corpus/templates/content/parity/matrix.md +42 -42
- package/corpus/templates/content/parity/matrix.ts +3 -1
- package/corpus/templates/content/scripts/_stored-form-census-kinds.ts +30 -2
- package/corpus/templates/content/scripts/historical-icon-apply.ts +9 -1
- package/corpus/templates/content/scripts/trace-startup.mjs +460 -133
- package/corpus/templates/content/server/db/exec.ts +58 -0
- package/corpus/templates/content/server/db/schema.ts +21 -0
- package/corpus/templates/content/server/lib/content-trash-purge.ts +222 -144
- package/corpus/templates/content/server/lib/document-metadata-updated-at.ts +43 -1
- package/corpus/templates/content/server/lib/document-revision.ts +23 -0
- package/corpus/templates/content/server/lib/live-body-writer.ts +311 -0
- package/corpus/templates/content/server/lib/notion-sync.ts +63 -29
- package/corpus/templates/content/server/lib/notion.ts +5 -5
- package/corpus/templates/content/server/lib/suggested-edits.ts +357 -230
- package/corpus/templates/content/server/live-copy/binding.ts +31 -0
- package/corpus/templates/content/server/live-copy/bounded-task.d.ts +6 -0
- package/corpus/templates/content/server/live-copy/exec-db.ts +1 -0
- package/corpus/templates/content/server/live-copy/holds.ts +59 -0
- package/corpus/templates/content/server/live-copy/persist.ts +656 -0
- package/corpus/templates/content/server/live-copy/switch.ts +136 -0
- package/corpus/templates/content/server/live-copy/task-names.ts +4 -0
- package/corpus/templates/content/server/live-copy/tasks.ts +183 -0
- package/corpus/templates/content/server/live-copy/write-cause.ts +85 -0
- package/corpus/templates/content/server/live-copy/write.ts +85 -0
- package/corpus/templates/content/server/plugins/builder-private-payload-cleanup.ts +22 -0
- package/corpus/templates/content/server/plugins/collab.ts +3 -0
- package/corpus/templates/content/server/plugins/db.ts +33 -0
- package/corpus/templates/content/server/routes/api/documents/[id]/move.patch.ts +50 -168
- package/corpus/templates/content/shared/api.ts +32 -1
- package/corpus/templates/content/shared/blocks-fields-manifest.ts +106 -0
- package/corpus/templates/content/shared/database-item-layout.ts +54 -22
- package/corpus/templates/content/shared/database-query.ts +192 -30
- package/corpus/templates/content/shared/document-export.ts +12 -14
- package/corpus/templates/content/shared/document-flush-protocol.ts +88 -0
- package/corpus/templates/content/shared/document-intent-merge.ts +16 -9
- package/corpus/templates/content/shared/editor-save-state.ts +97 -0
- package/corpus/templates/content/shared/feature-flags.ts +10 -0
- package/corpus/templates/content/shared/import/markdown.ts +91 -7
- package/corpus/templates/content/shared/import/types.ts +2 -0
- package/corpus/templates/content/shared/inline-math.ts +6 -4
- package/corpus/templates/content/shared/nfm-fidelity.ts +247 -0
- package/corpus/templates/content/shared/nfm.ts +1933 -340
- package/corpus/templates/content/shared/og-description.ts +258 -36
- package/corpus/templates/content/shared/suggestion-diff.ts +13 -0
- package/corpus/templates/content/shared/suggestion-formatting.ts +143 -20
- package/corpus/templates/content/shared/suggestion-text.ts +39 -0
- package/corpus/templates/content/vitest.config.ts +10 -0
- package/corpus/templates/crm/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/design/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/design/.agents/skills/design-templates/SKILL.md +5 -1
- package/corpus/templates/design/.agents/skills/native-effects/SKILL.md +9 -2
- package/corpus/templates/design/.generated/bridge/shader-fill-preview.generated.ts +3 -249
- package/corpus/templates/design/.generated/bridge/shader-runtime.generated.ts +30 -92
- package/corpus/templates/design/AGENTS.md +1 -3
- package/corpus/templates/design/CHANGELOG.md +34 -0
- package/corpus/templates/design/CODE_NATIVE_DESIGN_STUDIO_IMPLEMENTATION_PLAN.md +1 -6
- package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +5 -7
- package/corpus/templates/design/actions/_native-local-export-server.ts +44 -31
- package/corpus/templates/design/actions/_native-render-contexts.ts +76 -21
- package/corpus/templates/design/actions/claim-native-local-export.ts +5 -0
- package/corpus/templates/design/actions/finish-native-local-export.ts +13 -2
- package/corpus/templates/design/actions/get-getting-started.ts +53 -0
- package/corpus/templates/design/actions/get-native-shader-approvals.ts +35 -0
- package/corpus/templates/design/actions/get-shader.ts +134 -219
- package/corpus/templates/design/actions/list-design-extensions.ts +3 -58
- package/corpus/templates/design/actions/request-native-local-export.ts +32 -6
- package/corpus/templates/design/actions/run-design-extension-action.ts +0 -29
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +141 -108
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +0 -218
- package/corpus/templates/design/app/components/design/DesignThumbnail.tsx +59 -3
- package/corpus/templates/design/app/components/design/EditPanel.tsx +35 -47
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +242 -62
- package/corpus/templates/design/app/components/design/NativePreviewErrorBoundary.tsx +53 -0
- package/corpus/templates/design/app/components/design/bridge/codegen.ts +18 -3
- package/corpus/templates/design/app/components/design/bridge/native-composition-clock.ts +5 -4
- package/corpus/templates/design/app/components/design/bridge/native-dom.ts +37 -0
- package/corpus/templates/design/app/components/design/bridge/native-intrinsic-image.ts +2 -1
- package/corpus/templates/design/app/components/design/bridge/native-mesh-grid.ts +90 -0
- package/corpus/templates/design/app/components/design/bridge/native-opaque-public-asset.ts +363 -0
- package/corpus/templates/design/app/components/design/bridge/native-opaque-worker-lease.ts +179 -0
- package/corpus/templates/design/app/components/design/bridge/native-preview-geometry.ts +132 -7
- package/corpus/templates/design/app/components/design/bridge/native-preview-policy.ts +4 -0
- package/corpus/templates/design/app/components/design/bridge/native-preview-viewport-transport.ts +378 -0
- package/corpus/templates/design/app/components/design/bridge/native-scene-body-transform.ts +62 -0
- package/corpus/templates/design/app/components/design/bridge/native-scene-presentation-element.ts +10 -0
- package/corpus/templates/design/app/components/design/bridge/native-shader-runtime.bridge.ts +778 -246
- package/corpus/templates/design/app/components/design/bridge/native-source-provider.ts +512 -320
- package/corpus/templates/design/app/components/design/bridge/native-stateful-resource.ts +2 -2
- package/corpus/templates/design/app/components/design/bridge/native-stateless-compute.ts +5 -2
- package/corpus/templates/design/app/components/design/bridge/native-svg-source.ts +11 -1
- package/corpus/templates/design/app/components/design/bridge/native-worker-broker.ts +6 -0
- package/corpus/templates/design/app/components/design/bridge/native-worker-entry.ts +761 -303
- package/corpus/templates/design/app/components/design/bridge/native-worker-fill.ts +16 -6
- package/corpus/templates/design/app/components/design/bridge/native-worker-gpu.ts +854 -91
- package/corpus/templates/design/app/components/design/bridge/native-worker-host.ts +15 -1
- package/corpus/templates/design/app/components/design/bridge/native-worker-input-assets.ts +200 -0
- package/corpus/templates/design/app/components/design/bridge/native-worker-protocol.ts +40 -1
- package/corpus/templates/design/app/components/design/bridge/native-worker-scene-host.ts +540 -161
- package/corpus/templates/design/app/components/design/bridge/native-worker-source-snapshot.ts +21 -0
- package/corpus/templates/design/app/components/design/bridge/shader-fill-preview.bridge.ts +5 -371
- package/corpus/templates/design/app/components/design/bridge/shader-runtime.bridge.ts +45 -150
- package/corpus/templates/design/app/components/design/design-canvas/interact-document.ts +5 -9
- package/corpus/templates/design/app/components/design/design-canvas/native-preview-surface.ts +150 -0
- package/corpus/templates/design/app/components/design/design-canvas/native-public-asset-preview.ts +409 -0
- package/corpus/templates/design/app/components/design/design-canvas/native-public-worker-preview.ts +1086 -0
- package/corpus/templates/design/app/components/design/design-canvas/private-replay-screenshot-preview.ts +2 -2
- package/corpus/templates/design/app/components/design/design-canvas/text-content-change-result.ts +46 -12
- package/corpus/templates/design/app/components/design/edit-panel/effects-properties.tsx +15 -26
- package/corpus/templates/design/app/components/design/edit-panel/fill-properties.tsx +74 -67
- package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +7 -19
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +39 -30
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +4 -0
- package/corpus/templates/design/app/components/design/inspector/NativeShaderColorControls.tsx +3 -7
- package/corpus/templates/design/app/components/design/inspector/NativeShaderPaintControls.tsx +12 -5
- package/corpus/templates/design/app/components/design/inspector/NativeShaderPanel.tsx +705 -190
- package/corpus/templates/design/app/components/design/inspector/fill-field-reading.ts +1 -2
- package/corpus/templates/design/app/components/design/inspector/index.ts +0 -6
- package/corpus/templates/design/app/components/design/inspector/native-catalog-display.ts +26 -5
- package/corpus/templates/design/app/components/design/inspector/native-shader-catalog-fixture.ts +42 -0
- package/corpus/templates/design/app/components/design/inspector/native-shader-catalog-preview.ts +51 -33
- package/corpus/templates/design/app/components/design/inspector/native-shader-paint.ts +1 -0
- package/corpus/templates/design/app/components/design/inspector/native-shader-property-draft.ts +89 -23
- package/corpus/templates/design/app/components/design/inspector/saved-glsl-shader.tsx +243 -0
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +54 -5
- package/corpus/templates/design/app/components/design/shader-source-coordination.ts +66 -0
- package/corpus/templates/design/app/components/design/use-native-shader-approvals.ts +36 -8
- package/corpus/templates/design/app/components/home/DesignHomeLibrary.tsx +15 -8
- package/corpus/templates/design/app/components/layout/GettingStarted.tsx +50 -0
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +3 -0
- package/corpus/templates/design/app/components/templates/DesignTemplateGrid.tsx +163 -0
- package/corpus/templates/design/app/components/templates/DesignTemplateLibrary.tsx +65 -78
- package/corpus/templates/design/app/components/templates/TemplatePreview.tsx +66 -5
- package/corpus/templates/design/app/global.css +6 -0
- package/corpus/templates/design/app/i18n/en-US.ts +95 -2
- package/corpus/templates/design/app/lib/canvas-load-outcome.ts +147 -0
- package/corpus/templates/design/app/lib/canvas-outcome-tracking.ts +531 -0
- package/corpus/templates/design/app/lib/canvas-style-kind.ts +50 -0
- package/corpus/templates/design/app/pages/Index.tsx +10 -3
- package/corpus/templates/design/app/pages/Present.tsx +36 -1
- package/corpus/templates/design/app/pages/design-editor/commands/apply-file-content-update.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/apply-local-content-update.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/commit-visual-styles.ts +88 -32
- package/corpus/templates/design/app/pages/design-editor/commands/cross-screen-element-drop.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/layer-move-to-screen.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/paste-selection.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/paste-svg-layer.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/prepare-content-history-replay.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/redo.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/render-png-blob.ts +84 -41
- package/corpus/templates/design/app/pages/design-editor/commands/save-file-content.ts +38 -3
- package/corpus/templates/design/app/pages/design-editor/commands/shader-source-edit.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/commands/undo.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/design-editor-view.tsx +0 -2
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-content-and-components.ts +4 -33
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-core.ts +9 -0
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-export-and-handoff.ts +2 -2
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-files-and-saving.ts +2 -0
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-history.ts +0 -11
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-layer-models.ts +2 -55
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-screen-rendering.tsx +0 -3
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-selection-and-styles.ts +0 -24
- package/corpus/templates/design/app/pages/design-editor/text-edit-utils.ts +0 -16
- package/corpus/templates/design/app/pages/design-editor/use-native-local-export-requests.ts +70 -11
- package/corpus/templates/design/app/pages/design-editor/view/single-screen-canvas.tsx +0 -2
- package/corpus/templates/design/changelog/2026-10-20-folded-mesh-adds-an-animated-sculpted-fill-with-editable-col.md +6 -0
- package/corpus/templates/design/changelog/2026-10-20-read-only-design-views-render-native-shader-previews-in-nest.md +6 -0
- package/corpus/templates/design/changelog/2026-10-20-selected-screens-with-shader-effects-can-be-exported-togethe.md +6 -0
- package/corpus/templates/design/changelog/2026-10-20-shader-previews-reuse-validated-scene-data-while-panning-inc.md +6 -0
- package/corpus/templates/design/changelog/2026-10-20-shader-previews-stay-aligned-while-you-zoom.md +6 -0
- package/corpus/templates/design/changelog/2026-10-20-signed-out-sessions-no-longer-watch-for-private-png-export-r.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-a-getting-started-checklist-at-the-bottom-of-the-sidebar-tra.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-effect-thumbnails-show-richer-previews.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-native-effects-render-across-previews.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-native-shader-previews-use-less-gpu-memory-when-many-mesh-ef.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-opening-design-no-longer-shows-png-export-errors-when-no-exp.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-pulsing-border-controls-grouped.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-pulsing-border-follows-element-outlines.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-remove-obsolete-shader-fills.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-shader-previews-recover-from-temporary-gpu-and-image-failure.md +6 -0
- package/corpus/templates/design/changelog/2026-10-21-templates-now-open-a-read-only-preview-from-the-card-and-the.md +6 -0
- package/corpus/templates/design/changelog/2026-10-22-collapsed-shader-layers-no-longer-interrupt-other-shaders-on.md +6 -0
- package/corpus/templates/design/changelog/2026-10-22-shader-fills-and-effects-render-correctly-on-canvas-elements.md +6 -0
- package/corpus/templates/design/changelog/2026-10-22-shader-fills-keep-rendering-when-other-screen-content-cannot.md +6 -0
- package/corpus/templates/design/package.json +0 -1
- package/corpus/templates/design/playwright.config.ts +1 -1
- package/corpus/templates/design/scripts/design-export-validation/export-baseline.json +24 -0
- package/corpus/templates/design/scripts/runtime-budget-zoom.ts +9 -21
- package/corpus/templates/design/scripts/runtime-budget.ts +10 -24
- package/corpus/templates/design/server/lib/getting-started.ts +267 -0
- package/corpus/templates/design/server/plugins/agent-chat.ts +0 -2
- package/corpus/templates/design/server/plugins/getting-started.ts +5 -0
- package/corpus/templates/design/shared/design-template-presets/analytics-dashboard.ts +127 -0
- package/corpus/templates/design/shared/design-template-presets/design-studio.ts +98 -0
- package/corpus/templates/design/shared/design-template-presets/messaging-app.ts +101 -0
- package/corpus/templates/design/shared/design-template-presets/project-tasks.ts +120 -0
- package/corpus/templates/design/shared/design-template-presets.ts +8 -0
- package/corpus/templates/design/shared/effect-graph.ts +46 -1
- package/corpus/templates/design/shared/generation-output-receipt.ts +0 -1
- package/corpus/templates/design/shared/native-effect-animation-capability.ts +6 -0
- package/corpus/templates/design/shared/native-effect-folded-mesh-v1.ts +268 -0
- package/corpus/templates/design/shared/native-effect-folded-mesh-v2.ts +310 -0
- package/corpus/templates/design/shared/native-effect-folded-mesh.ts +489 -0
- package/corpus/templates/design/shared/native-effect-gallery-additions.ts +2 -2
- package/corpus/templates/design/shared/native-effect-paint.ts +8 -0
- package/corpus/templates/design/shared/native-effect-parameter-constraints.ts +8 -1
- package/corpus/templates/design/shared/native-effect-presets.ts +18 -1
- package/corpus/templates/design/shared/native-effect-property-presentation.ts +81 -0
- package/corpus/templates/design/shared/native-effect-pulsing-border-v3.ts +281 -0
- package/corpus/templates/design/shared/native-effect-pulsing-border-v4.ts +284 -0
- package/corpus/templates/design/shared/native-effect-pulsing-border.ts +300 -0
- package/corpus/templates/design/shared/native-effect-trust.ts +6 -0
- package/corpus/templates/design/shared/native-effect-wgsl.ts +12 -0
- package/corpus/templates/design/shared/native-effects.ts +528 -15
- package/corpus/templates/design/shared/native-input-resources.ts +36 -0
- package/corpus/templates/design/shared/native-local-export.ts +14 -0
- package/corpus/templates/design/shared/native-parameter-animation.ts +1 -0
- package/corpus/templates/design/shared/native-pointer-input.ts +9 -11
- package/corpus/templates/design/shared/shader-fills.ts +0 -513
- package/corpus/templates/design/vitest.setup.ts +7 -1
- package/corpus/templates/dispatch/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +20 -18
- package/corpus/templates/factory/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +36 -80
- package/corpus/templates/factory/.agents/skills/review-latest-feedback/references/channel-inventory.md +54 -16
- package/corpus/templates/factory/.agents/skills/review-latest-feedback/references/slack-reaction-replies.md +50 -73
- package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +20 -18
- package/corpus/templates/forms/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/mail/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/plan/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/slides/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/slides/CHANGELOG.md +6 -0
- package/corpus/templates/slides/actions/delete-deck.ts +7 -0
- package/corpus/templates/slides/changelog/2026-10-21-connected-deck-deletion-requires-approval.md +6 -0
- package/corpus/templates/slides/scripts/edit-fidelity/client-action.ts +61 -0
- package/corpus/templates/slides/scripts/edit-fidelity/run.ts +10 -0
- package/corpus/templates/slides-2/.agents/skills/actions/SKILL.md +199 -0
- package/corpus/templates/slides-2/.agents/skills/actions/references/action-fields.md +145 -0
- package/corpus/templates/slides-2/.agents/skills/actions/references/examples.md +96 -0
- package/corpus/templates/slides-2/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/slides-2/.agents/skills/adding-a-feature/SKILL.md +235 -0
- package/corpus/templates/slides-2/.agents/skills/agent-native-docs/SKILL.md +161 -0
- package/corpus/templates/slides-2/.agents/skills/agent-native-toolkit/SKILL.md +314 -0
- package/corpus/templates/slides-2/.agents/skills/analytics-data-for-decks/SKILL.md +44 -0
- package/corpus/templates/slides-2/.agents/skills/apply-slide-comments/SKILL.md +63 -0
- package/corpus/templates/slides-2/.agents/skills/client-side-routing/SKILL.md +87 -0
- package/corpus/templates/slides-2/.agents/skills/context-awareness/SKILL.md +282 -0
- package/corpus/templates/slides-2/.agents/skills/create-deck/SKILL.md +263 -0
- package/corpus/templates/slides-2/.agents/skills/create-deck/references/reference-inputs.md +72 -0
- package/corpus/templates/slides-2/.agents/skills/create-deck/references/slide-templates.md +93 -0
- package/corpus/templates/slides-2/.agents/skills/create-deck/references/source-material.md +16 -0
- package/corpus/templates/slides-2/.agents/skills/creative-context/SKILL.md +134 -0
- package/corpus/templates/slides-2/.agents/skills/customizing-agent-native/SKILL.md +219 -0
- package/corpus/templates/slides-2/.agents/skills/deck-management/SKILL.md +182 -0
- package/corpus/templates/slides-2/.agents/skills/delegate-to-agent/SKILL.md +62 -0
- package/corpus/templates/slides-2/.agents/skills/design-systems/SKILL.md +233 -0
- package/corpus/templates/slides-2/.agents/skills/external-agents/SKILL.md +549 -0
- package/corpus/templates/slides-2/.agents/skills/external-agents/references/mcp-apps-embedding.md +169 -0
- package/corpus/templates/slides-2/.agents/skills/frontend-design/SKILL.md +102 -0
- package/corpus/templates/slides-2/.agents/skills/frontend-design/references/visual-direction.md +102 -0
- package/corpus/templates/slides-2/.agents/skills/image-generation-via-a2a/SKILL.md +134 -0
- package/corpus/templates/slides-2/.agents/skills/performance/SKILL.md +79 -0
- package/corpus/templates/slides-2/.agents/skills/portability/SKILL.md +108 -0
- package/corpus/templates/slides-2/.agents/skills/real-time-sync/SKILL.md +146 -0
- package/corpus/templates/slides-2/.agents/skills/reliable-mutations/SKILL.md +72 -0
- package/corpus/templates/slides-2/.agents/skills/secrets/SKILL.md +82 -0
- package/corpus/templates/slides-2/.agents/skills/security/SKILL.md +80 -0
- package/corpus/templates/slides-2/.agents/skills/self-modifying-code/SKILL.md +123 -0
- package/corpus/templates/slides-2/.agents/skills/shadcn-ui/SKILL.md +71 -0
- package/corpus/templates/slides-2/.agents/skills/sharing/SKILL.md +286 -0
- package/corpus/templates/slides-2/.agents/skills/slide-design/SKILL.md +144 -0
- package/corpus/templates/slides-2/.agents/skills/slide-editing/SKILL.md +284 -0
- package/corpus/templates/slides-2/.agents/skills/slide-editing/references/animations.md +33 -0
- package/corpus/templates/slides-2/.agents/skills/slide-editing/references/freeform-objects.md +22 -0
- package/corpus/templates/slides-2/.agents/skills/slide-editing/references/restyling.md +69 -0
- package/corpus/templates/slides-2/.agents/skills/slide-editing/references/transitions.md +26 -0
- package/corpus/templates/slides-2/.agents/skills/slide-editing/references/video.md +45 -0
- package/corpus/templates/slides-2/.agents/skills/slide-images/SKILL.md +136 -0
- package/corpus/templates/slides-2/.agents/skills/storing-data/SKILL.md +234 -0
- package/corpus/templates/slides-2/.agents/skills/turn-into-skill/SKILL.md +112 -0
- package/corpus/templates/slides-2/.agents/skills/turn-into-skill/agents/openai.yaml +4 -0
- package/corpus/templates/slides-2/.agents/skills/workspace-conventions/SKILL.md +103 -0
- package/corpus/templates/slides-2/.builder/rules/deploy-app.mdc +22 -0
- package/corpus/templates/slides-2/.builder/rules/organize-ui.mdc +9 -0
- package/corpus/templates/slides-2/.dockerignore +61 -0
- package/corpus/templates/slides-2/.env.example +23 -0
- package/corpus/templates/slides-2/.ignore +3 -0
- package/corpus/templates/slides-2/.mcp.json +8 -0
- package/corpus/templates/slides-2/.oxfmtrc.json +8 -0
- package/corpus/templates/slides-2/AGENTS.md +66 -0
- package/corpus/templates/slides-2/CHANGELOG.md +76 -0
- package/corpus/templates/slides-2/DEVELOPING.md +157 -0
- package/corpus/templates/slides-2/README.md +58 -0
- package/corpus/templates/slides-2/THIRD_PARTY_NOTICES.md +33 -0
- package/corpus/templates/slides-2/_gitignore +38 -0
- package/corpus/templates/slides-2/actions/_agent-presence.ts +29 -0
- package/corpus/templates/slides-2/actions/_app-url.ts +37 -0
- package/corpus/templates/slides-2/actions/_deck-app-scope.ts +30 -0
- package/corpus/templates/slides-2/actions/_deck-tracking.ts +260 -0
- package/corpus/templates/slides-2/actions/_deck-write.ts +206 -0
- package/corpus/templates/slides-2/actions/_imported-slide-source.ts +162 -0
- package/corpus/templates/slides-2/actions/_inline-image-storage.ts +1013 -0
- package/corpus/templates/slides-2/actions/_linked-design-system.ts +83 -0
- package/corpus/templates/slides-2/actions/_presenter-notes.ts +83 -0
- package/corpus/templates/slides-2/actions/_render-artifacts.ts +111 -0
- package/corpus/templates/slides-2/actions/_slide-source.ts +344 -0
- package/corpus/templates/slides-2/actions/_tab-state.ts +51 -0
- package/corpus/templates/slides-2/actions/_test-brandfetch.ts +31 -0
- package/corpus/templates/slides-2/actions/_uploaded-files.ts +114 -0
- package/corpus/templates/slides-2/actions/add-deck.ts +123 -0
- package/corpus/templates/slides-2/actions/add-slide-comment.ts +267 -0
- package/corpus/templates/slides-2/actions/add-slide.ts +888 -0
- package/corpus/templates/slides-2/actions/analyze-brand-assets.ts +66 -0
- package/corpus/templates/slides-2/actions/apply-design-system.ts +111 -0
- package/corpus/templates/slides-2/actions/approve-deck-access-request.ts +287 -0
- package/corpus/templates/slides-2/actions/audit-contrast.ts +143 -0
- package/corpus/templates/slides-2/actions/check-image-gen.ts +17 -0
- package/corpus/templates/slides-2/actions/clone-context-slide.ts +340 -0
- package/corpus/templates/slides-2/actions/clone-creative-context-deck.ts +143 -0
- package/corpus/templates/slides-2/actions/control-deck-history.ts +186 -0
- package/corpus/templates/slides-2/actions/control-presenter.ts +117 -0
- package/corpus/templates/slides-2/actions/control-slide-editor.ts +267 -0
- package/corpus/templates/slides-2/actions/create-deck-from-template.ts +274 -0
- package/corpus/templates/slides-2/actions/create-deck.ts +1243 -0
- package/corpus/templates/slides-2/actions/create-design-system.ts +131 -0
- package/corpus/templates/slides-2/actions/create-share-link.ts +127 -0
- package/corpus/templates/slides-2/actions/db-health.ts +22 -0
- package/corpus/templates/slides-2/actions/delete-asset.ts +154 -0
- package/corpus/templates/slides-2/actions/delete-deck.ts +427 -0
- package/corpus/templates/slides-2/actions/delete-design-system.ts +167 -0
- package/corpus/templates/slides-2/actions/delete-slide-comment.ts +143 -0
- package/corpus/templates/slides-2/actions/delete-staged-dataset.ts +30 -0
- package/corpus/templates/slides-2/actions/duplicate-deck.ts +299 -0
- package/corpus/templates/slides-2/actions/export-google-slides.ts +41 -0
- package/corpus/templates/slides-2/actions/export-html.ts +770 -0
- package/corpus/templates/slides-2/actions/export-pptx.ts +2203 -0
- package/corpus/templates/slides-2/actions/extract-pdf.ts +49 -0
- package/corpus/templates/slides-2/actions/generate-image-api.ts +671 -0
- package/corpus/templates/slides-2/actions/generate-image.ts +492 -0
- package/corpus/templates/slides-2/actions/get-agent-access-deck.ts +52 -0
- package/corpus/templates/slides-2/actions/get-deck-access-status.ts +130 -0
- package/corpus/templates/slides-2/actions/get-deck-design-tokens.ts +62 -0
- package/corpus/templates/slides-2/actions/get-deck-reference-context.ts +232 -0
- package/corpus/templates/slides-2/actions/get-deck-template.ts +38 -0
- package/corpus/templates/slides-2/actions/get-deck-version.ts +85 -0
- package/corpus/templates/slides-2/actions/get-deck.ts +562 -0
- package/corpus/templates/slides-2/actions/get-design-system-decode-job-status.ts +57 -0
- package/corpus/templates/slides-2/actions/get-design-system-tier-limit.ts +12 -0
- package/corpus/templates/slides-2/actions/get-design-system.ts +453 -0
- package/corpus/templates/slides-2/actions/get-google-docs-status.ts +106 -0
- package/corpus/templates/slides-2/actions/get-google-picker-token.ts +84 -0
- package/corpus/templates/slides-2/actions/get-home-suggestions.ts +52 -0
- package/corpus/templates/slides-2/actions/get-layout-overflows.ts +192 -0
- package/corpus/templates/slides-2/actions/get-slide-render.ts +125 -0
- package/corpus/templates/slides-2/actions/get-slide-source.ts +115 -0
- package/corpus/templates/slides-2/actions/get-slide-theme-preview.ts +64 -0
- package/corpus/templates/slides-2/actions/get-slide-theme.ts +44 -0
- package/corpus/templates/slides-2/actions/get-slides-2-upload-storage-status.ts +17 -0
- package/corpus/templates/slides-2/actions/get-slides-notification-prefs.ts +37 -0
- package/corpus/templates/slides-2/actions/get-workspace-defaults.ts +51 -0
- package/corpus/templates/slides-2/actions/image-gen-status.ts +35 -0
- package/corpus/templates/slides-2/actions/import-code.ts +26 -0
- package/corpus/templates/slides-2/actions/import-design-project.ts +49 -0
- package/corpus/templates/slides-2/actions/import-document.ts +125 -0
- package/corpus/templates/slides-2/actions/import-docx.ts +57 -0
- package/corpus/templates/slides-2/actions/import-file.ts +1273 -0
- package/corpus/templates/slides-2/actions/import-from-url.ts +25 -0
- package/corpus/templates/slides-2/actions/import-google-doc.ts +208 -0
- package/corpus/templates/slides-2/actions/import-google-font.ts +110 -0
- package/corpus/templates/slides-2/actions/import-google-slides-reference.ts +667 -0
- package/corpus/templates/slides-2/actions/import-pptx.ts +564 -0
- package/corpus/templates/slides-2/actions/import-svgl-logo.ts +115 -0
- package/corpus/templates/slides-2/actions/index-design-system-with-builder.ts +181 -0
- package/corpus/templates/slides-2/actions/index-uploaded-design-system-files.ts +77 -0
- package/corpus/templates/slides-2/actions/list-assets.ts +286 -0
- package/corpus/templates/slides-2/actions/list-deck-templates.ts +83 -0
- package/corpus/templates/slides-2/actions/list-deck-versions.ts +185 -0
- package/corpus/templates/slides-2/actions/list-decks.ts +591 -0
- package/corpus/templates/slides-2/actions/list-design-systems.ts +180 -0
- package/corpus/templates/slides-2/actions/list-slide-comments.ts +128 -0
- package/corpus/templates/slides-2/actions/list-slide-themes.ts +17 -0
- package/corpus/templates/slides-2/actions/list-staged-datasets.ts +14 -0
- package/corpus/templates/slides-2/actions/logo-config.ts +13 -0
- package/corpus/templates/slides-2/actions/navigate.ts +158 -0
- package/corpus/templates/slides-2/actions/patch-deck.ts +2378 -0
- package/corpus/templates/slides-2/actions/provider-api-catalog.ts +25 -0
- package/corpus/templates/slides-2/actions/provider-api-docs.ts +83 -0
- package/corpus/templates/slides-2/actions/provider-api-request.ts +222 -0
- package/corpus/templates/slides-2/actions/query-staged-dataset.ts +83 -0
- package/corpus/templates/slides-2/actions/read-composer-source.ts +108 -0
- package/corpus/templates/slides-2/actions/request-deck-access.ts +803 -0
- package/corpus/templates/slides-2/actions/restore-deck-version.ts +203 -0
- package/corpus/templates/slides-2/actions/run.ts +2 -0
- package/corpus/templates/slides-2/actions/save-deck.ts +313 -0
- package/corpus/templates/slides-2/actions/search-google-fonts.ts +61 -0
- package/corpus/templates/slides-2/actions/search-images.ts +30 -0
- package/corpus/templates/slides-2/actions/search-logos.ts +23 -0
- package/corpus/templates/slides-2/actions/search-svgl-logos.ts +42 -0
- package/corpus/templates/slides-2/actions/set-default-design-system.ts +88 -0
- package/corpus/templates/slides-2/actions/set-workspace-defaults.ts +61 -0
- package/corpus/templates/slides-2/actions/start-design-system-upload.ts +80 -0
- package/corpus/templates/slides-2/actions/sync-design-system-with-builder.ts +84 -0
- package/corpus/templates/slides-2/actions/toggle-slide-comment-reaction.ts +150 -0
- package/corpus/templates/slides-2/actions/transform-slide-objects.ts +1528 -0
- package/corpus/templates/slides-2/actions/update-asset.ts +499 -0
- package/corpus/templates/slides-2/actions/update-deck-aspect-ratio.ts +95 -0
- package/corpus/templates/slides-2/actions/update-deck-design-tokens.ts +175 -0
- package/corpus/templates/slides-2/actions/update-design-system.ts +95 -0
- package/corpus/templates/slides-2/actions/update-slide-comment.ts +213 -0
- package/corpus/templates/slides-2/actions/update-slide-source.ts +353 -0
- package/corpus/templates/slides-2/actions/update-slide.ts +850 -0
- package/corpus/templates/slides-2/actions/update-slides-notification-prefs.ts +55 -0
- package/corpus/templates/slides-2/actions/view-screen.ts +1098 -0
- package/corpus/templates/slides-2/agent-native.app-skill.json +165 -0
- package/corpus/templates/slides-2/agent-native.config.ts +20 -0
- package/corpus/templates/slides-2/agent-native.json +18 -0
- package/corpus/templates/slides-2/app/components/ThemeToggle.tsx +47 -0
- package/corpus/templates/slides-2/app/components/comments/SlideCommentPins.tsx +781 -0
- package/corpus/templates/slides-2/app/components/comments/SlideCommentsPanel.tsx +1075 -0
- package/corpus/templates/slides-2/app/components/deck/DeckCard.tsx +304 -0
- package/corpus/templates/slides-2/app/components/deck/DeckFilterMenu.tsx +83 -0
- package/corpus/templates/slides-2/app/components/deck/ExcalidrawSlide.tsx +183 -0
- package/corpus/templates/slides-2/app/components/deck/MermaidRenderer.tsx +126 -0
- package/corpus/templates/slides-2/app/components/deck/SlideRenderer.tsx +1553 -0
- package/corpus/templates/slides-2/app/components/design-system/DesignSystemCard.tsx +235 -0
- package/corpus/templates/slides-2/app/components/design-system/DesignSystemSetup.tsx +2021 -0
- package/corpus/templates/slides-2/app/components/design-system/builder-design-system-upload.ts +200 -0
- package/corpus/templates/slides-2/app/components/design-system/builder-index-response.ts +104 -0
- package/corpus/templates/slides-2/app/components/editor/AddSlidePopover.tsx +461 -0
- package/corpus/templates/slides-2/app/components/editor/AiEditingMarker.tsx +24 -0
- package/corpus/templates/slides-2/app/components/editor/AlignmentGuides.tsx +82 -0
- package/corpus/templates/slides-2/app/components/editor/AnimationsPanel.tsx +698 -0
- package/corpus/templates/slides-2/app/components/editor/AppMenu.tsx +356 -0
- package/corpus/templates/slides-2/app/components/editor/AssetLibraryPanel.tsx +508 -0
- package/corpus/templates/slides-2/app/components/editor/BlockBubbleMenu.tsx +548 -0
- package/corpus/templates/slides-2/app/components/editor/DeckAccessDeniedPage.tsx +173 -0
- package/corpus/templates/slides-2/app/components/editor/DeckEditorSkeleton.tsx +35 -0
- package/corpus/templates/slides-2/app/components/editor/DeferredPopoverFallback.tsx +148 -0
- package/corpus/templates/slides-2/app/components/editor/EditorActionCluster.tsx +217 -0
- package/corpus/templates/slides-2/app/components/editor/EditorSidebar.tsx +1047 -0
- package/corpus/templates/slides-2/app/components/editor/EditorToolbar.tsx +1285 -0
- package/corpus/templates/slides-2/app/components/editor/ExportMenu.tsx +579 -0
- package/corpus/templates/slides-2/app/components/editor/GeneratingOverlay.tsx +21 -0
- package/corpus/templates/slides-2/app/components/editor/GeneratingSlidePreview.tsx +73 -0
- package/corpus/templates/slides-2/app/components/editor/GoogleDocImportHint.tsx +378 -0
- package/corpus/templates/slides-2/app/components/editor/GoogleDriveConnectionCta.tsx +154 -0
- package/corpus/templates/slides-2/app/components/editor/GoogleSlidesReferenceImport.tsx +299 -0
- package/corpus/templates/slides-2/app/components/editor/HistoryPanel.tsx +354 -0
- package/corpus/templates/slides-2/app/components/editor/HomeQuickStartDialog.tsx +202 -0
- package/corpus/templates/slides-2/app/components/editor/ImageCropOverlay.tsx +820 -0
- package/corpus/templates/slides-2/app/components/editor/ImageDropPromptPopover.tsx +280 -0
- package/corpus/templates/slides-2/app/components/editor/ImageGenPanel.tsx +244 -0
- package/corpus/templates/slides-2/app/components/editor/ImageOverlay.tsx +280 -0
- package/corpus/templates/slides-2/app/components/editor/ImageSearchPanel.tsx +183 -0
- package/corpus/templates/slides-2/app/components/editor/ImportDeckButton.tsx +247 -0
- package/corpus/templates/slides-2/app/components/editor/LogoSearchPanel.tsx +366 -0
- package/corpus/templates/slides-2/app/components/editor/MermaidToExcalidrawPanel.tsx +99 -0
- package/corpus/templates/slides-2/app/components/editor/MissingDeckAccessPane.tsx +219 -0
- package/corpus/templates/slides-2/app/components/editor/NewDeckReferenceStep.tsx +812 -0
- package/corpus/templates/slides-2/app/components/editor/PromptDialog.tsx +963 -0
- package/corpus/templates/slides-2/app/components/editor/QuestionFlow.tsx +119 -0
- package/corpus/templates/slides-2/app/components/editor/RequestDeckAccessDialog.tsx +101 -0
- package/corpus/templates/slides-2/app/components/editor/ShareDialog.tsx +126 -0
- package/corpus/templates/slides-2/app/components/editor/SlideContextToolbar.tsx +1471 -0
- package/corpus/templates/slides-2/app/components/editor/SlideEditor.tsx +11183 -0
- package/corpus/templates/slides-2/app/components/editor/SlideOverflowWarning.tsx +82 -0
- package/corpus/templates/slides-2/app/components/editor/SlideScrollStack.tsx +307 -0
- package/corpus/templates/slides-2/app/components/editor/SlideSlashCommandMenu.tsx +692 -0
- package/corpus/templates/slides-2/app/components/editor/SlideThumbnailContextMenu.tsx +52 -0
- package/corpus/templates/slides-2/app/components/editor/SlideTransitionControl.tsx +184 -0
- package/corpus/templates/slides-2/app/components/editor/SlidesComposerContext.tsx +789 -0
- package/corpus/templates/slides-2/app/components/editor/SlidesComposerContextProvider.tsx +74 -0
- package/corpus/templates/slides-2/app/components/editor/SlidesLayersPanel.tsx +377 -0
- package/corpus/templates/slides-2/app/components/editor/SpeakerNotesPanel.tsx +119 -0
- package/corpus/templates/slides-2/app/components/editor/TweaksPanel.tsx +77 -0
- package/corpus/templates/slides-2/app/components/editor/UploadStorageGate.tsx +37 -0
- package/corpus/templates/slides-2/app/components/editor/bullet-editing.ts +880 -0
- package/corpus/templates/slides-2/app/components/editor/canvas-interactions/index.ts +12 -0
- package/corpus/templates/slides-2/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +119 -0
- package/corpus/templates/slides-2/app/components/editor/commit-active-edit.ts +14 -0
- package/corpus/templates/slides-2/app/components/editor/editor-command-model.ts +35 -0
- package/corpus/templates/slides-2/app/components/editor/fit-text-object.ts +31 -0
- package/corpus/templates/slides-2/app/components/editor/in-place-text-session.browser-cases.json +983 -0
- package/corpus/templates/slides-2/app/components/editor/in-place-text-session.browser-host.ts +747 -0
- package/corpus/templates/slides-2/app/components/editor/in-place-text-session.ts +6891 -0
- package/corpus/templates/slides-2/app/components/editor/inline-edit-session.ts +26 -0
- package/corpus/templates/slides-2/app/components/editor/list-editing.ts +501 -0
- package/corpus/templates/slides-2/app/components/editor/rich-text-selection.ts +975 -0
- package/corpus/templates/slides-2/app/components/editor/rte-test-utils.ts +265 -0
- package/corpus/templates/slides-2/app/components/editor/selection-overlay-measurement.ts +191 -0
- package/corpus/templates/slides-2/app/components/editor/slide-escape-arbiter.ts +34 -0
- package/corpus/templates/slides-2/app/components/editor/slide-object-interactions.ts +6362 -0
- package/corpus/templates/slides-2/app/components/editor/slide-object-transform.browser-host.ts +19 -0
- package/corpus/templates/slides-2/app/components/editor/slide-pointer-target.ts +432 -0
- package/corpus/templates/slides-2/app/components/editor/slide-presence.ts +13 -0
- package/corpus/templates/slides-2/app/components/editor/slide-style.ts +243 -0
- package/corpus/templates/slides-2/app/components/editor/slide-text-targets.ts +540 -0
- package/corpus/templates/slides-2/app/components/editor/style-clipboard.ts +102 -0
- package/corpus/templates/slides-2/app/components/editor/use-prompt-import.ts +159 -0
- package/corpus/templates/slides-2/app/components/home/SlidesHomeLibrary.tsx +79 -0
- package/corpus/templates/slides-2/app/components/layout/AgentWorkIndicator.tsx +193 -0
- package/corpus/templates/slides-2/app/components/layout/Header.tsx +110 -0
- package/corpus/templates/slides-2/app/components/layout/Layout.tsx +492 -0
- package/corpus/templates/slides-2/app/components/layout/Sidebar.tsx +109 -0
- package/corpus/templates/slides-2/app/components/layout/layout-route-policy.ts +28 -0
- package/corpus/templates/slides-2/app/components/presentation/PresentationView.tsx +1116 -0
- package/corpus/templates/slides-2/app/components/presentation/PresenterView.tsx +526 -0
- package/corpus/templates/slides-2/app/components/presentation/SlideTransitionStage.tsx +297 -0
- package/corpus/templates/slides-2/app/components/presentation/present-channel.ts +31 -0
- package/corpus/templates/slides-2/app/components/presentation/slide-build-steps.ts +231 -0
- package/corpus/templates/slides-2/app/components/presentation/slide-navigation.ts +273 -0
- package/corpus/templates/slides-2/app/components/presentation/slide-transition-motion.ts +258 -0
- package/corpus/templates/slides-2/app/components/presentation/voice-navigation.ts +61 -0
- package/corpus/templates/slides-2/app/components/settings/notification-settings.tsx +93 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2AssetBrowser.tsx +726 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2CommandMenu.tsx +453 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2Comments.tsx +571 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2DesignTokens.tsx +345 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2Editor.tsx +4804 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2ExportMenu.tsx +671 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2FontBrowser.tsx +342 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2ImageCropControls.tsx +487 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2Inspector.tsx +950 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/Slides2SvglLogoSearchDialog.tsx +332 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/cross-slide-edit-history.ts +151 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/design-token-presets.ts +140 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/editor-action-errors.ts +47 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/editor-export-errors.ts +60 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/geometry.ts +275 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/image-crop-style.ts +82 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/inline-text-editor.tsx +631 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/keyboard-shortcuts.ts +104 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/object-insertion.ts +13 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/preview-patches.ts +54 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/sandbox-render-errors.ts +23 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/source-structure.ts +634 -0
- package/corpus/templates/slides-2/app/components/slides-2-editor/types.ts +85 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2BlackoutOverlay.tsx +13 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2ControlBar.tsx +285 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2HelpDialog.tsx +72 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2JumpInput.tsx +38 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2LaserPointer.tsx +67 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2Overview.tsx +161 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2Player.tsx +839 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/Slides2ProgressBar.tsx +23 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/keyboard.ts +36 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/presenter-channel.ts +131 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/use-presenter-action-bridge.ts +296 -0
- package/corpus/templates/slides-2/app/components/slides-2-presenter/useSlides2TouchSwipe.ts +80 -0
- package/corpus/templates/slides-2/app/components/slides-2-runtime/SandboxedSlide.tsx +724 -0
- package/corpus/templates/slides-2/app/components/slides-2-runtime/SlideContentRenderer.tsx +137 -0
- package/corpus/templates/slides-2/app/components/slides-2-runtime/Slides2Canvas.tsx +99 -0
- package/corpus/templates/slides-2/app/components/slides-2-runtime/constants.ts +4 -0
- package/corpus/templates/slides-2/app/components/slides-2-runtime/protocol.ts +1400 -0
- package/corpus/templates/slides-2/app/components/slides-2-runtime/transition-frame.ts +439 -0
- package/corpus/templates/slides-2/app/components/templates/DeckTemplateLibrary.tsx +314 -0
- package/corpus/templates/slides-2/app/components/templates/DeckTemplatePreview.tsx +60 -0
- package/corpus/templates/slides-2/app/components/templates/DeckTemplateStage.tsx +45 -0
- package/corpus/templates/slides-2/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/button-group.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/button.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/card.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/command.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/context-menu.tsx +32 -0
- package/corpus/templates/slides-2/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/filter-trigger.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/input.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/label.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/progress.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/scroll-area.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/select.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/slider.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/tabs.tsx +59 -0
- package/corpus/templates/slides-2/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/toggle-group.tsx +1 -0
- package/corpus/templates/slides-2/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/slides-2/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/slides-2/app/components/visual-editor/CanvasCommentPins.tsx +46 -0
- package/corpus/templates/slides-2/app/components/visual-editor/DrawOverlay.tsx +27 -0
- package/corpus/templates/slides-2/app/components/visual-editor/MultiSelectChip.tsx +97 -0
- package/corpus/templates/slides-2/app/components/visual-editor/SaveStatusIndicator.tsx +273 -0
- package/corpus/templates/slides-2/app/components/visual-editor/index.ts +4 -0
- package/corpus/templates/slides-2/app/context/DeckContext.tsx +7486 -0
- package/corpus/templates/slides-2/app/design-system.ts +3 -0
- package/corpus/templates/slides-2/app/entry.client.tsx +10 -0
- package/corpus/templates/slides-2/app/entry.server.tsx +10 -0
- package/corpus/templates/slides-2/app/global.css +1626 -0
- package/corpus/templates/slides-2/app/hooks/use-agent-generating.ts +517 -0
- package/corpus/templates/slides-2/app/hooks/use-compact-editor-layout.ts +26 -0
- package/corpus/templates/slides-2/app/hooks/use-contrast-audit-bridge.ts +49 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-access-reload.ts +70 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-access.ts +50 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-design-system.ts +146 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-history-action-bridge.ts +266 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-presence.ts +89 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-role.ts +46 -0
- package/corpus/templates/slides-2/app/hooks/use-deck-versions.ts +43 -0
- package/corpus/templates/slides-2/app/hooks/use-design-system-workflows.ts +11 -0
- package/corpus/templates/slides-2/app/hooks/use-design-systems.ts +31 -0
- package/corpus/templates/slides-2/app/hooks/use-generating-slide-preview.ts +115 -0
- package/corpus/templates/slides-2/app/hooks/use-navigation-state.ts +229 -0
- package/corpus/templates/slides-2/app/hooks/use-new-deck-generation-signal.ts +46 -0
- package/corpus/templates/slides-2/app/hooks/use-new-deck-generation.ts +710 -0
- package/corpus/templates/slides-2/app/hooks/use-sidebar-collapsed.ts +95 -0
- package/corpus/templates/slides-2/app/hooks/use-slide-comments.ts +202 -0
- package/corpus/templates/slides-2/app/hooks/use-slide-file-storage-status.ts +55 -0
- package/corpus/templates/slides-2/app/hooks/use-undo-selection.ts +66 -0
- package/corpus/templates/slides-2/app/hooks/use-workspace-defaults.ts +31 -0
- package/corpus/templates/slides-2/app/i18n/en-US.ts +1507 -0
- package/corpus/templates/slides-2/app/i18n/index.ts +19 -0
- package/corpus/templates/slides-2/app/lib/agent-visible-message.ts +21 -0
- package/corpus/templates/slides-2/app/lib/aspect-ratios.ts +7 -0
- package/corpus/templates/slides-2/app/lib/asset-error-copy.ts +59 -0
- package/corpus/templates/slides-2/app/lib/canvas-zoom.ts +47 -0
- package/corpus/templates/slides-2/app/lib/composer-context.ts +152 -0
- package/corpus/templates/slides-2/app/lib/composer-draft.ts +34 -0
- package/corpus/templates/slides-2/app/lib/contrast-audit.ts +390 -0
- package/corpus/templates/slides-2/app/lib/contrast-resolve.ts +240 -0
- package/corpus/templates/slides-2/app/lib/create-deck-generation.ts +938 -0
- package/corpus/templates/slides-2/app/lib/deck-access-lost.ts +4 -0
- package/corpus/templates/slides-2/app/lib/deck-backup.ts +186 -0
- package/corpus/templates/slides-2/app/lib/deck-editor-loading.ts +91 -0
- package/corpus/templates/slides-2/app/lib/deck-export-file-client.ts +77 -0
- package/corpus/templates/slides-2/app/lib/deck-filter.ts +52 -0
- package/corpus/templates/slides-2/app/lib/deck-list-loading.ts +16 -0
- package/corpus/templates/slides-2/app/lib/deck-preview-frame.ts +15 -0
- package/corpus/templates/slides-2/app/lib/deck-share-links.ts +9 -0
- package/corpus/templates/slides-2/app/lib/deck-sorting.ts +19 -0
- package/corpus/templates/slides-2/app/lib/deferred-editor-surfaces.ts +24 -0
- package/corpus/templates/slides-2/app/lib/design-system-selection.ts +11 -0
- package/corpus/templates/slides-2/app/lib/design-systems.ts +231 -0
- package/corpus/templates/slides-2/app/lib/dynamic-import.ts +50 -0
- package/corpus/templates/slides-2/app/lib/editor-agent-handoff.ts +92 -0
- package/corpus/templates/slides-2/app/lib/editor-shortcuts.ts +153 -0
- package/corpus/templates/slides-2/app/lib/export-google-slides-client.ts +168 -0
- package/corpus/templates/slides-2/app/lib/export-pdf-client.ts +684 -0
- package/corpus/templates/slides-2/app/lib/export-pptx-client.ts +2420 -0
- package/corpus/templates/slides-2/app/lib/generation-lifecycle.ts +24 -0
- package/corpus/templates/slides-2/app/lib/generation-state.ts +247 -0
- package/corpus/templates/slides-2/app/lib/google-docs-client.ts +110 -0
- package/corpus/templates/slides-2/app/lib/google-slides-export-availability-client.ts +53 -0
- package/corpus/templates/slides-2/app/lib/google-slides-reference-source.ts +18 -0
- package/corpus/templates/slides-2/app/lib/image-download.ts +85 -0
- package/corpus/templates/slides-2/app/lib/image-drop-to-agent.ts +210 -0
- package/corpus/templates/slides-2/app/lib/import-uploaded-deck.ts +132 -0
- package/corpus/templates/slides-2/app/lib/inline-edit-remote.ts +55 -0
- package/corpus/templates/slides-2/app/lib/localize-slides-changelog.ts +47 -0
- package/corpus/templates/slides-2/app/lib/mermaid-blocks.ts +18 -0
- package/corpus/templates/slides-2/app/lib/new-deck-reference-selection.ts +174 -0
- package/corpus/templates/slides-2/app/lib/normalize-slide-padding.ts +74 -0
- package/corpus/templates/slides-2/app/lib/pending-deck-changes.ts +33 -0
- package/corpus/templates/slides-2/app/lib/portaled-layer.ts +7 -0
- package/corpus/templates/slides-2/app/lib/pptx-google-slides.ts +204 -0
- package/corpus/templates/slides-2/app/lib/prompt-attachment-adapter.ts +37 -0
- package/corpus/templates/slides-2/app/lib/prompt-file-uploads.ts +557 -0
- package/corpus/templates/slides-2/app/lib/recent-references.ts +106 -0
- package/corpus/templates/slides-2/app/lib/reference-document-hydration.ts +406 -0
- package/corpus/templates/slides-2/app/lib/register-chat-renderers.tsx +645 -0
- package/corpus/templates/slides-2/app/lib/reveal-after-delete.ts +55 -0
- package/corpus/templates/slides-2/app/lib/sanitize-slide-html.ts +752 -0
- package/corpus/templates/slides-2/app/lib/slide-agent-context.ts +148 -0
- package/corpus/templates/slides-2/app/lib/slide-animation-elements.ts +900 -0
- package/corpus/templates/slides-2/app/lib/slide-clipboard.ts +534 -0
- package/corpus/templates/slides-2/app/lib/slide-comment-anchor.ts +286 -0
- package/corpus/templates/slides-2/app/lib/slide-content-merge.ts +295 -0
- package/corpus/templates/slides-2/app/lib/slide-image-replacement.ts +1919 -0
- package/corpus/templates/slides-2/app/lib/slide-live-remote.ts +215 -0
- package/corpus/templates/slides-2/app/lib/slide-scroll.ts +56 -0
- package/corpus/templates/slides-2/app/lib/slide-source-map.ts +1099 -0
- package/corpus/templates/slides-2/app/lib/slide-video.ts +390 -0
- package/corpus/templates/slides-2/app/lib/slides-relay-tracking.ts +114 -0
- package/corpus/templates/slides-2/app/lib/streaming-slide-html.ts +77 -0
- package/corpus/templates/slides-2/app/lib/tab-id.ts +3 -0
- package/corpus/templates/slides-2/app/lib/template-navigation.ts +15 -0
- package/corpus/templates/slides-2/app/lib/text-tool-shortcut.ts +75 -0
- package/corpus/templates/slides-2/app/lib/undo-reveal.ts +332 -0
- package/corpus/templates/slides-2/app/lib/upload-response.ts +107 -0
- package/corpus/templates/slides-2/app/lib/utils.ts +38 -0
- package/corpus/templates/slides-2/app/lib/validate-native-slide-html.ts +177 -0
- package/corpus/templates/slides-2/app/lib/video-upload.ts +354 -0
- package/corpus/templates/slides-2/app/pages/DeckEditor.tsx +6158 -0
- package/corpus/templates/slides-2/app/pages/DesignSystems.tsx +363 -0
- package/corpus/templates/slides-2/app/pages/Index.tsx +3254 -0
- package/corpus/templates/slides-2/app/pages/NotFound.tsx +33 -0
- package/corpus/templates/slides-2/app/pages/Presentation.tsx +120 -0
- package/corpus/templates/slides-2/app/pages/SharedPresentation.tsx +174 -0
- package/corpus/templates/slides-2/app/pages/SlideThemeDetail.tsx +227 -0
- package/corpus/templates/slides-2/app/pages/SlideThemes.tsx +155 -0
- package/corpus/templates/slides-2/app/pages/Slides2EditorPage.tsx +1618 -0
- package/corpus/templates/slides-2/app/pages/Slides2PresenterConsolePage.tsx +937 -0
- package/corpus/templates/slides-2/app/pages/Slides2PresenterPage.tsx +979 -0
- package/corpus/templates/slides-2/app/pages/Templates.tsx +32 -0
- package/corpus/templates/slides-2/app/root.tsx +391 -0
- package/corpus/templates/slides-2/app/routes/$.tsx +10 -0
- package/corpus/templates/slides-2/app/routes/_index.tsx +1 -0
- package/corpus/templates/slides-2/app/routes/access-request.approve.tsx +276 -0
- package/corpus/templates/slides-2/app/routes/agent.tsx +19 -0
- package/corpus/templates/slides-2/app/routes/chat.$threadId.tsx +1 -0
- package/corpus/templates/slides-2/app/routes/chat.tsx +190 -0
- package/corpus/templates/slides-2/app/routes/deck.$id.tsx +10 -0
- package/corpus/templates/slides-2/app/routes/deck.$id_.present.tsx +10 -0
- package/corpus/templates/slides-2/app/routes/design-systems.tsx +10 -0
- package/corpus/templates/slides-2/app/routes/extensions.$id.$slug.tsx +2 -0
- package/corpus/templates/slides-2/app/routes/extensions.$id.tsx +5 -0
- package/corpus/templates/slides-2/app/routes/extensions._index.tsx +5 -0
- package/corpus/templates/slides-2/app/routes/extensions.tsx +5 -0
- package/corpus/templates/slides-2/app/routes/home-layout.tsx +31 -0
- package/corpus/templates/slides-2/app/routes/home.tsx +22 -0
- package/corpus/templates/slides-2/app/routes/p.$id.tsx +195 -0
- package/corpus/templates/slides-2/app/routes/settings.$.tsx +1 -0
- package/corpus/templates/slides-2/app/routes/settings.tsx +131 -0
- package/corpus/templates/slides-2/app/routes/share.$token.tsx +137 -0
- package/corpus/templates/slides-2/app/routes/slide.tsx +209 -0
- package/corpus/templates/slides-2/app/routes/team.tsx +11 -0
- package/corpus/templates/slides-2/app/routes/templates.tsx +1 -0
- package/corpus/templates/slides-2/app/routes/themes.$id.tsx +1 -0
- package/corpus/templates/slides-2/app/routes/themes.tsx +1 -0
- package/corpus/templates/slides-2/app/routes.ts +24 -0
- package/corpus/templates/slides-2/app/vite-env.d.ts +24 -0
- package/corpus/templates/slides-2/changelog/2026-10-17-find-and-switch-decks-from-the-presenter-console.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-17-meet-slides-2-create-and-refine-editable-slide-decks-with-an.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-17-pptx-image-export.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-17-visual-editor.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-18-apply-an-accessible-design-system-to-an-existing-deck-before.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-18-choose-a-template-or-start-a-new-presentation-from-the-slide.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-18-generate-decks-from-a-prompt-then-edit-slide-elements-direct.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-18-generate-presentation-decks-from-a-prompt-and-edit-every-sli.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-18-new-presentation-drafts-save-before-generation-starts-so-you.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-18-the-assistant-can-undo-redo-and-save-pending-edits-in-the-vi.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-agents-can-insert-duplicate-and-delete-canvas-objects-in-sou.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-browse-slide-themes.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-clicking-a-slide-preview-in-overview-selects-that-slide.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-create-decks-from-a-prompt-and-edit-slides-directly-on-the-c.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-creating-and-editing-decks-now-starts-with-the-tools-most-re.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-deleting-decks-revokes-public-links.md +7 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-escape-cancels-an-in-progress-slide-drag-without-losing-earl.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-import-failures-now-show-clear-localized-descriptions-instea.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-presenter-controls-stay-responsive-when-moving-over-the-slid.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-presenter-notes-stay-private-from-viewers-and-commenters.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-preview-generated-slides-in-chat.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-remote-image-previews-accept-supported-raster-formats.md +6 -0
- 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
- package/corpus/templates/slides-2/changelog/2026-10-19-slide-generation-explains-when-react-effect-hooks-cannot-run.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-the-editor-highlights-hovered-objects-and-keeps-image-replac.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-19-the-slide-editor-uses-the-shared-agent-native-controls.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-20-deck-editing-controls-match-the-workspace.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-20-google-slides-imports-now-report-missing-image-data-instead-.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-20-imports-and-previews-handle-large-content-safely.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-20-public-deck-pages-can-export-source-backed-slides-to-pdf.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-20-saved-slide-images-stay-available.md +6 -0
- package/corpus/templates/slides-2/changelog/2026-10-20-scope-global-media-picks-to-assets-the-current-deck-can-reso.md +6 -0
- package/corpus/templates/slides-2/components.json +20 -0
- package/corpus/templates/slides-2/drizzle.config.ts +3 -0
- package/corpus/templates/slides-2/learnings.defaults.md +5 -0
- package/corpus/templates/slides-2/netlify.toml +24 -0
- package/corpus/templates/slides-2/package.json +147 -0
- package/corpus/templates/slides-2/public/agent-native-icon-dark.svg +10 -0
- package/corpus/templates/slides-2/public/agent-native-icon-light.svg +10 -0
- package/corpus/templates/slides-2/public/agent-native-logo-dark.svg +21 -0
- package/corpus/templates/slides-2/public/agent-native-logo-light.svg +21 -0
- package/corpus/templates/slides-2/public/assets/builder-logo-white.svg +15 -0
- package/corpus/templates/slides-2/public/assets/generated/preview.html +61 -0
- package/corpus/templates/slides-2/public/assets/intuit-logo-white.svg +6 -0
- package/corpus/templates/slides-2/public/assets/walmart-logo-white.svg +6 -0
- package/corpus/templates/slides-2/public/chatgpt-plugin-icon.svg +7 -0
- package/corpus/templates/slides-2/public/favicon.svg +1 -0
- package/corpus/templates/slides-2/public/icon-180.svg +1 -0
- package/corpus/templates/slides-2/public/icon-192.svg +1 -0
- package/corpus/templates/slides-2/public/icon-512.svg +1 -0
- package/corpus/templates/slides-2/public/manifest.json +20 -0
- package/corpus/templates/slides-2/public/placeholder.svg +1 -0
- package/corpus/templates/slides-2/public/robots.txt +14 -0
- package/corpus/templates/slides-2/public/visual-edit-structure-proof.html +99 -0
- package/corpus/templates/slides-2/react-router.config.ts +7 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/README.md +499 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/authoring-fuzz.ts +9517 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/baseline.json +16427 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/dev-server-url.ts +10 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/lib/in-page.ts +1975 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/lib/metrics.ts +1401 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/retry-infra.ts +7 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/run-options.ts +21 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/run-outcomes.ts +127 -0
- package/corpus/templates/slides-2/scripts/edit-fidelity/run.ts +8451 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/README.md +116 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/compare-layout-lib.ts +241 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/compare-layout.ts +30 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/diff.ts +222 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/export.ts +765 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/fixtures/agent-dark-deck.json +48 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/generate-calibration.ts +765 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/google-export.ts +137 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/google-layout.ts +82 -0
- package/corpus/templates/slides-2/scripts/export-fidelity/resolve-pkg.ts +29 -0
- package/corpus/templates/slides-2/scripts/migrate-production.ts +22 -0
- package/corpus/templates/slides-2/server/db/index.ts +73 -0
- package/corpus/templates/slides-2/server/db/schema.ts +189 -0
- package/corpus/templates/slides-2/server/handlers/assets-url.ts +13 -0
- package/corpus/templates/slides-2/server/handlers/assets.ts +3217 -0
- package/corpus/templates/slides-2/server/handlers/decks.ts +185 -0
- package/corpus/templates/slides-2/server/handlers/demo.ts +9 -0
- package/corpus/templates/slides-2/server/handlers/design-systems.ts +219 -0
- package/corpus/templates/slides-2/server/handlers/google-docs-auth.ts +165 -0
- package/corpus/templates/slides-2/server/handlers/image-gen.ts +153 -0
- package/corpus/templates/slides-2/server/handlers/image-providers/gemini.ts +209 -0
- package/corpus/templates/slides-2/server/handlers/image-providers/index.ts +61 -0
- package/corpus/templates/slides-2/server/handlers/image-providers/openai.ts +288 -0
- package/corpus/templates/slides-2/server/handlers/image-providers/types.ts +35 -0
- package/corpus/templates/slides-2/server/handlers/import/docx-parser.ts +31 -0
- package/corpus/templates/slides-2/server/handlers/import/html-converter.ts +1534 -0
- package/corpus/templates/slides-2/server/handlers/import/pdf-fidelity-parser.ts +1039 -0
- package/corpus/templates/slides-2/server/handlers/import/pdf-sidecar-reader.ts +81 -0
- package/corpus/templates/slides-2/server/handlers/import/pdf-style-digest.ts +187 -0
- package/corpus/templates/slides-2/server/handlers/import/pptx-assets.ts +155 -0
- package/corpus/templates/slides-2/server/handlers/import/pptx-parser.ts +57 -0
- package/corpus/templates/slides-2/server/handlers/request-auth-context.ts +108 -0
- package/corpus/templates/slides-2/server/handlers/share.ts +52 -0
- package/corpus/templates/slides-2/server/handlers/uploads-chunked.ts +1066 -0
- package/corpus/templates/slides-2/server/handlers/uploads.ts +457 -0
- package/corpus/templates/slides-2/server/lib/access-request-email.ts +66 -0
- package/corpus/templates/slides-2/server/lib/assets-image-delegation.ts +331 -0
- package/corpus/templates/slides-2/server/lib/bounded-multipart.ts +49 -0
- package/corpus/templates/slides-2/server/lib/builder-design-system-proxy.ts +122 -0
- package/corpus/templates/slides-2/server/lib/chat-attachments.ts +425 -0
- package/corpus/templates/slides-2/server/lib/chatgpt-directory-tools.ts +246 -0
- package/corpus/templates/slides-2/server/lib/chunked-upload-session.ts +195 -0
- package/corpus/templates/slides-2/server/lib/comment-notifications.ts +184 -0
- package/corpus/templates/slides-2/server/lib/deck-access-requests.ts +102 -0
- package/corpus/templates/slides-2/server/lib/deck-asset-scope.ts +150 -0
- package/corpus/templates/slides-2/server/lib/deck-export-tracking.ts +119 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-case-study.ts +154 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-company.ts +160 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-pitch.ts +151 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-quarterly.ts +264 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-shared.ts +35 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-update.ts +188 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/a-workshop.ts +196 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-keynote.ts +131 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-lesson.ts +209 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-manifesto.ts +149 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-portfolio.ts +144 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-research.ts +221 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-roadmap.ts +264 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/b-shared.ts +44 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/group-a.ts +16 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/group-b.ts +16 -0
- package/corpus/templates/slides-2/server/lib/deck-templates/legacy.ts +567 -0
- package/corpus/templates/slides-2/server/lib/deck-templates.ts +60 -0
- package/corpus/templates/slides-2/server/lib/deck-versions.ts +233 -0
- package/corpus/templates/slides-2/server/lib/design-system-workflows.ts +22 -0
- package/corpus/templates/slides-2/server/lib/emails.ts +84 -0
- package/corpus/templates/slides-2/server/lib/env-config.ts +15 -0
- package/corpus/templates/slides-2/server/lib/fetch-remote-image.ts +245 -0
- package/corpus/templates/slides-2/server/lib/generation-completion.ts +278 -0
- package/corpus/templates/slides-2/server/lib/google-docs-access.ts +51 -0
- package/corpus/templates/slides-2/server/lib/google-docs-error.ts +54 -0
- package/corpus/templates/slides-2/server/lib/google-docs-oauth.ts +422 -0
- package/corpus/templates/slides-2/server/lib/google-fonts.ts +509 -0
- package/corpus/templates/slides-2/server/lib/google-oauth-preflight.ts +119 -0
- package/corpus/templates/slides-2/server/lib/google-slides-export-availability.ts +55 -0
- package/corpus/templates/slides-2/server/lib/image-proxy-response.ts +16 -0
- package/corpus/templates/slides-2/server/lib/image-proxy-url.ts +155 -0
- package/corpus/templates/slides-2/server/lib/import-asset-storage.ts +214 -0
- package/corpus/templates/slides-2/server/lib/imported-asset-batch.ts +218 -0
- package/corpus/templates/slides-2/server/lib/legacy-slide-source.ts +692 -0
- package/corpus/templates/slides-2/server/lib/media-search-providers.ts +216 -0
- package/corpus/templates/slides-2/server/lib/native-creative-context.ts +295 -0
- package/corpus/templates/slides-2/server/lib/pdf-parse-setup.ts +115 -0
- package/corpus/templates/slides-2/server/lib/provider-api.ts +57 -0
- package/corpus/templates/slides-2/server/lib/request-wait-until.ts +30 -0
- package/corpus/templates/slides-2/server/lib/shared-deck.ts +29 -0
- package/corpus/templates/slides-2/server/lib/slide-asset-references.ts +309 -0
- package/corpus/templates/slides-2/server/lib/slide-content-patch.ts +1004 -0
- package/corpus/templates/slides-2/server/lib/slide-hygiene.ts +731 -0
- package/corpus/templates/slides-2/server/lib/slide-image-insertion.ts +136 -0
- package/corpus/templates/slides-2/server/lib/slide-reveal-issues.ts +41 -0
- package/corpus/templates/slides-2/server/lib/slide-source-editing/babel-walk.ts +117 -0
- package/corpus/templates/slides-2/server/lib/slide-source-editing/batch-edit.ts +152 -0
- package/corpus/templates/slides-2/server/lib/slide-source-editing/edit-ops.ts +1478 -0
- package/corpus/templates/slides-2/server/lib/slide-source-editing/image-target.ts +128 -0
- package/corpus/templates/slides-2/server/lib/slide-source-editing/text-diff.ts +23 -0
- package/corpus/templates/slides-2/server/lib/slide-source-limits.ts +9 -0
- package/corpus/templates/slides-2/server/lib/slide-source.ts +1786 -0
- package/corpus/templates/slides-2/server/lib/slide-theme-demo-sources.ts +2106 -0
- package/corpus/templates/slides-2/server/lib/slide-themes.ts +2174 -0
- package/corpus/templates/slides-2/server/lib/slide-worker-runtime.ts +1995 -0
- package/corpus/templates/slides-2/server/lib/slides-tracking.ts +73 -0
- package/corpus/templates/slides-2/server/lib/source-import.ts +213 -0
- package/corpus/templates/slides-2/server/lib/svgl.ts +364 -0
- package/corpus/templates/slides-2/server/lib/tenant-files.ts +179 -0
- package/corpus/templates/slides-2/server/lib/upload-storage-status.ts +9 -0
- package/corpus/templates/slides-2/server/lib/uploaded-asset-cleanup-outbox.ts +521 -0
- package/corpus/templates/slides-2/server/lib/uploaded-asset-object-lifecycle.ts +404 -0
- package/corpus/templates/slides-2/server/lib/uploaded-fonts.ts +696 -0
- package/corpus/templates/slides-2/server/lib/uploaded-reference-storage.ts +77 -0
- package/corpus/templates/slides-2/server/lib/validate-slide-animations.ts +341 -0
- package/corpus/templates/slides-2/server/middleware/auth.ts +6 -0
- package/corpus/templates/slides-2/server/plugins/_dev-upload-stub.ts +6 -0
- package/corpus/templates/slides-2/server/plugins/agent-chat.ts +402 -0
- package/corpus/templates/slides-2/server/plugins/auth.ts +31 -0
- package/corpus/templates/slides-2/server/plugins/collab.ts +30 -0
- package/corpus/templates/slides-2/server/plugins/config.ts +6 -0
- package/corpus/templates/slides-2/server/plugins/core-routes.ts +30 -0
- package/corpus/templates/slides-2/server/plugins/creative-context.ts +187 -0
- package/corpus/templates/slides-2/server/plugins/db.ts +462 -0
- package/corpus/templates/slides-2/server/plugins/feature-flags.ts +5 -0
- package/corpus/templates/slides-2/server/plugins/labs.ts +8 -0
- package/corpus/templates/slides-2/server/plugins/orphaned-asset-cleanup.ts +17 -0
- package/corpus/templates/slides-2/server/plugins/otel.ts +6 -0
- package/corpus/templates/slides-2/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/slides-2/server/register-secrets.ts +209 -0
- package/corpus/templates/slides-2/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/slides-2/server/routes/[...page].head.ts +1 -0
- package/corpus/templates/slides-2/server/routes/[base]/_agent-native/google-docs/auth-url.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/[base]/_agent-native/google-docs/callback.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/_agent-native/google-docs/auth-url.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/_agent-native/google-docs/callback.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/assets/upload-video.post.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/assets/upload.post.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/assets/video-uploads.delete.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/deck-agent-context.json.get.ts +105 -0
- package/corpus/templates/slides-2/server/routes/api/decks/events.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/demo.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/exports/[filename].get.ts +221 -0
- package/corpus/templates/slides-2/server/routes/api/exports/google-slides.post.ts +240 -0
- package/corpus/templates/slides-2/server/routes/api/exports/html.post.ts +67 -0
- package/corpus/templates/slides-2/server/routes/api/exports/pptx.post.ts +100 -0
- package/corpus/templates/slides-2/server/routes/api/gen-preview/[...].get.ts +24 -0
- package/corpus/templates/slides-2/server/routes/api/generated/[...].get.ts +24 -0
- package/corpus/templates/slides-2/server/routes/api/image-proxy.get.ts +518 -0
- package/corpus/templates/slides-2/server/routes/api/import-assets/[token].get.ts +70 -0
- package/corpus/templates/slides-2/server/routes/api/preview-images.get.ts +20 -0
- package/corpus/templates/slides-2/server/routes/api/share/[token].get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/uploads-chunked/[sessionId]/chunk.post.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/uploads-chunked/[sessionId]/status.get.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/uploads-chunked/[sessionId].delete.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/uploads-chunked/start.post.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/uploads.delete.ts +1 -0
- package/corpus/templates/slides-2/server/routes/api/uploads.post.ts +1 -0
- package/corpus/templates/slides-2/server/workspace-defaults.ts +196 -0
- package/corpus/templates/slides-2/shared/action-ui.ts +147 -0
- package/corpus/templates/slides-2/shared/agent-readable.ts +2 -0
- package/corpus/templates/slides-2/shared/api.ts +406 -0
- package/corpus/templates/slides-2/shared/app-state-tabs.ts +30 -0
- package/corpus/templates/slides-2/shared/app-storage.ts +9 -0
- package/corpus/templates/slides-2/shared/aspect-ratios.ts +49 -0
- package/corpus/templates/slides-2/shared/blank-slide.ts +179 -0
- package/corpus/templates/slides-2/shared/client-compatibility.ts +2 -0
- package/corpus/templates/slides-2/shared/contrast-audit.ts +255 -0
- package/corpus/templates/slides-2/shared/deck-access.ts +26 -0
- package/corpus/templates/slides-2/shared/deck-app-scope.ts +14 -0
- package/corpus/templates/slides-2/shared/deck-content.ts +37 -0
- package/corpus/templates/slides-2/shared/deck-history-control.ts +79 -0
- package/corpus/templates/slides-2/shared/deck-scope.ts +5 -0
- package/corpus/templates/slides-2/shared/deck-title.ts +199 -0
- package/corpus/templates/slides-2/shared/deck-write.ts +61 -0
- package/corpus/templates/slides-2/shared/design-flags.ts +7 -0
- package/corpus/templates/slides-2/shared/design-system-validation.ts +88 -0
- package/corpus/templates/slides-2/shared/editor-control.ts +120 -0
- package/corpus/templates/slides-2/shared/generation-timing.ts +19 -0
- package/corpus/templates/slides-2/shared/google-docs.ts +69 -0
- package/corpus/templates/slides-2/shared/labs.ts +10 -0
- package/corpus/templates/slides-2/shared/overview-navigation.ts +34 -0
- package/corpus/templates/slides-2/shared/ownership.ts +6 -0
- package/corpus/templates/slides-2/shared/pdf-sidecar.ts +130 -0
- package/corpus/templates/slides-2/shared/presenter-control.ts +111 -0
- package/corpus/templates/slides-2/shared/representative-slide.ts +89 -0
- package/corpus/templates/slides-2/shared/slide-background.ts +30 -0
- package/corpus/templates/slides-2/shared/slide-comment-anchor.ts +117 -0
- package/corpus/templates/slides-2/shared/slide-comment-reactions.ts +47 -0
- package/corpus/templates/slides-2/shared/slide-design-tokens.ts +92 -0
- package/corpus/templates/slides-2/shared/slide-fit.ts +78 -0
- package/corpus/templates/slides-2/shared/slide-ids.ts +133 -0
- package/corpus/templates/slides-2/shared/slide-number.ts +124 -0
- package/corpus/templates/slides-2/shared/slide-object-structure.ts +790 -0
- package/corpus/templates/slides-2/shared/slide-text-range-selection.ts +50 -0
- package/corpus/templates/slides-2/shared/slide-transitions.ts +70 -0
- package/corpus/templates/slides-2/shared/slides-2-transition.ts +194 -0
- package/corpus/templates/slides-2/shared/slides-user-prefs.ts +22 -0
- package/corpus/templates/slides-2/shared/source-import-errors.ts +12 -0
- package/corpus/templates/slides-2/shared/source-runtime-export.ts +76 -0
- package/corpus/templates/slides-2/shared/upload-types.ts +41 -0
- package/corpus/templates/slides-2/ssr-entry.ts +11 -0
- package/corpus/templates/slides-2/tsconfig.json +27 -0
- package/corpus/templates/slides-2/vite.config.ts +77 -0
- package/corpus/templates/slides-2/vitest.config.ts +28 -0
- package/corpus/templates/tasks/.agents/skills/actions/references/action-fields.md +1 -1
- package/package.json +1 -1
- package/corpus/templates/design/.agents/skills/shader-fills/SKILL.md +0 -182
- package/corpus/templates/design/actions/apply-shader-fill.ts +0 -450
- package/corpus/templates/design/actions/apply-shader.ts +0 -257
- package/corpus/templates/design/actions/preview-shader-fill.ts +0 -157
- package/corpus/templates/design/app/components/design/inspector/GlslShaderPanel.tsx +0 -1144
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +0 -450
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.stories.tsx +0 -71
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +0 -555
- package/corpus/templates/design/app/components/design/inspector/ShaderEffectRow.tsx +0 -105
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +0 -433
- package/corpus/templates/design/app/components/design/inspector/color-picker-shader-pane.tsx +0 -648
- package/corpus/templates/design/shared/shader-fill.ts +0 -174
- package/corpus/templates/design/shared/shader-presets.ts +0 -1523
|
@@ -0,0 +1,1528 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { defineAction } from "@agent-native/core";
|
|
4
|
+
import type { ActionRunContext } from "@agent-native/core/action";
|
|
5
|
+
import * as t from "@babel/types";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
findJsxAncestors,
|
|
10
|
+
parseSource,
|
|
11
|
+
walkJsx,
|
|
12
|
+
} from "../server/lib/slide-source-editing/babel-walk.js";
|
|
13
|
+
import {
|
|
14
|
+
planEdit,
|
|
15
|
+
type Splice,
|
|
16
|
+
} from "../server/lib/slide-source-editing/edit-ops.js";
|
|
17
|
+
import { appStateKey } from "../shared/app-state-tabs.js";
|
|
18
|
+
import {
|
|
19
|
+
deleteSourceElement,
|
|
20
|
+
duplicateSourceElement,
|
|
21
|
+
insertSourceObject,
|
|
22
|
+
type SourceSelection,
|
|
23
|
+
} from "../shared/slide-object-structure.js";
|
|
24
|
+
import { slideSourceFailure } from "./_slide-source.js";
|
|
25
|
+
import {
|
|
26
|
+
getCurrentRequestBrowserTabId,
|
|
27
|
+
readAppStateForCurrentTab,
|
|
28
|
+
} from "./_tab-state.js";
|
|
29
|
+
import getSlideSource from "./get-slide-source.js";
|
|
30
|
+
import updateSlideSource from "./update-slide-source.js";
|
|
31
|
+
|
|
32
|
+
const CANVAS_WIDTH = 1920;
|
|
33
|
+
const CANVAS_HEIGHT = 1080;
|
|
34
|
+
const MIN_OBJECT_SIZE = 24;
|
|
35
|
+
const MAX_TARGETS = 64;
|
|
36
|
+
const MAX_RENDERED_SLIDE_INSTANCES_PER_SOURCE_LOCATOR = 8_000;
|
|
37
|
+
|
|
38
|
+
const sourceLocatorSchema = z.object({
|
|
39
|
+
line: z
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.min(1)
|
|
43
|
+
.describe("1-based JSX source line from view-screen"),
|
|
44
|
+
column: z
|
|
45
|
+
.number()
|
|
46
|
+
.int()
|
|
47
|
+
.min(0)
|
|
48
|
+
.describe("0-based JSX source column from view-screen"),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const selectedTargetsSchema = z
|
|
52
|
+
.array(sourceLocatorSchema)
|
|
53
|
+
.min(1)
|
|
54
|
+
.max(MAX_TARGETS)
|
|
55
|
+
.describe(
|
|
56
|
+
"Source locators for selected canvas objects that share one JSX parent",
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const boundsSchema = z.object({
|
|
60
|
+
x: z.number().min(-10000).max(10000).describe("Canvas left in 1920x1080 px"),
|
|
61
|
+
y: z.number().min(-10000).max(10000).describe("Canvas top in 1920x1080 px"),
|
|
62
|
+
width: z
|
|
63
|
+
.number()
|
|
64
|
+
.min(MIN_OBJECT_SIZE)
|
|
65
|
+
.max(10000)
|
|
66
|
+
.describe("Target width in px"),
|
|
67
|
+
height: z
|
|
68
|
+
.number()
|
|
69
|
+
.min(MIN_OBJECT_SIZE)
|
|
70
|
+
.max(10000)
|
|
71
|
+
.describe("Target height in px"),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const insertionGeometrySchema = z.object({
|
|
75
|
+
left: z
|
|
76
|
+
.number()
|
|
77
|
+
.finite()
|
|
78
|
+
.min(-10000)
|
|
79
|
+
.max(10000)
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("Canvas left in pixels"),
|
|
82
|
+
top: z
|
|
83
|
+
.number()
|
|
84
|
+
.finite()
|
|
85
|
+
.min(-10000)
|
|
86
|
+
.max(10000)
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("Canvas top in pixels"),
|
|
89
|
+
width: z
|
|
90
|
+
.number()
|
|
91
|
+
.finite()
|
|
92
|
+
.min(-10000)
|
|
93
|
+
.max(10000)
|
|
94
|
+
.optional()
|
|
95
|
+
.describe("Canvas width in pixels; negative values normalize leftward"),
|
|
96
|
+
height: z
|
|
97
|
+
.number()
|
|
98
|
+
.finite()
|
|
99
|
+
.min(-10000)
|
|
100
|
+
.max(10000)
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("Canvas height in pixels; negative values normalize upward"),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const slideObjectTransformOperationSchema = z.discriminatedUnion("op", [
|
|
106
|
+
z.object({
|
|
107
|
+
op: z.literal("move"),
|
|
108
|
+
targets: selectedTargetsSchema,
|
|
109
|
+
dx: z
|
|
110
|
+
.number()
|
|
111
|
+
.min(-10000)
|
|
112
|
+
.max(10000)
|
|
113
|
+
.describe("Horizontal movement in canvas px"),
|
|
114
|
+
dy: z
|
|
115
|
+
.number()
|
|
116
|
+
.min(-10000)
|
|
117
|
+
.max(10000)
|
|
118
|
+
.describe("Vertical movement in canvas px"),
|
|
119
|
+
}),
|
|
120
|
+
z.object({
|
|
121
|
+
op: z.literal("resize"),
|
|
122
|
+
targets: selectedTargetsSchema,
|
|
123
|
+
bounds: boundsSchema.describe(
|
|
124
|
+
"Desired selection bounds on the 1920x1080 canvas",
|
|
125
|
+
),
|
|
126
|
+
preserveAspectRatio: z
|
|
127
|
+
.boolean()
|
|
128
|
+
.default(false)
|
|
129
|
+
.describe(
|
|
130
|
+
"Fit the resized selection inside bounds while preserving its proportions",
|
|
131
|
+
),
|
|
132
|
+
}),
|
|
133
|
+
z.object({
|
|
134
|
+
op: z.literal("rotate"),
|
|
135
|
+
targets: selectedTargetsSchema,
|
|
136
|
+
deltaDegrees: z
|
|
137
|
+
.number()
|
|
138
|
+
.min(-3600)
|
|
139
|
+
.max(3600)
|
|
140
|
+
.describe("Rotation delta in degrees around the selection center"),
|
|
141
|
+
}),
|
|
142
|
+
z.object({
|
|
143
|
+
op: z.literal("align"),
|
|
144
|
+
targets: selectedTargetsSchema,
|
|
145
|
+
alignment: z
|
|
146
|
+
.enum(["left", "center", "right", "top", "middle", "bottom"])
|
|
147
|
+
.describe("Edge or center to align"),
|
|
148
|
+
reference: z
|
|
149
|
+
.enum(["selection", "slide"])
|
|
150
|
+
.default("selection")
|
|
151
|
+
.describe("Align within the selection bounds or the full slide canvas"),
|
|
152
|
+
}),
|
|
153
|
+
z.object({
|
|
154
|
+
op: z.literal("distribute"),
|
|
155
|
+
targets: selectedTargetsSchema,
|
|
156
|
+
axis: z
|
|
157
|
+
.enum(["horizontal", "vertical"])
|
|
158
|
+
.describe("Spread three or more objects with equal gaps on this axis"),
|
|
159
|
+
}),
|
|
160
|
+
z.object({
|
|
161
|
+
op: z.literal("group"),
|
|
162
|
+
targets: selectedTargetsSchema
|
|
163
|
+
.min(2)
|
|
164
|
+
.describe("Two or more selected sibling objects to group"),
|
|
165
|
+
}),
|
|
166
|
+
z.object({
|
|
167
|
+
op: z.literal("ungroup"),
|
|
168
|
+
target: sourceLocatorSchema.describe(
|
|
169
|
+
"Source locator for the selected group",
|
|
170
|
+
),
|
|
171
|
+
}),
|
|
172
|
+
z.object({
|
|
173
|
+
op: z.literal("z-order"),
|
|
174
|
+
targets: selectedTargetsSchema,
|
|
175
|
+
target: z
|
|
176
|
+
.enum(["forward", "backward", "front", "back"])
|
|
177
|
+
.describe(
|
|
178
|
+
"Move the selected objects within their same-parent absolute layers",
|
|
179
|
+
),
|
|
180
|
+
}),
|
|
181
|
+
z
|
|
182
|
+
.object({
|
|
183
|
+
op: z.literal("insert"),
|
|
184
|
+
kind: z
|
|
185
|
+
.enum(["text", "rectangle", "ellipse", "line"])
|
|
186
|
+
.describe("Object to insert into the slide canvas"),
|
|
187
|
+
geometry: insertionGeometrySchema
|
|
188
|
+
.optional()
|
|
189
|
+
.describe(
|
|
190
|
+
"Optional canvas bounds in 1920x1080 px; omitted values use the editor's default for this object kind",
|
|
191
|
+
),
|
|
192
|
+
text: z
|
|
193
|
+
.string()
|
|
194
|
+
.max(10_000)
|
|
195
|
+
.optional()
|
|
196
|
+
.describe("Text content for a text object; defaults to Text"),
|
|
197
|
+
})
|
|
198
|
+
.superRefine(({ kind, text }, context) => {
|
|
199
|
+
if (kind !== "text" && text !== undefined) {
|
|
200
|
+
context.addIssue({
|
|
201
|
+
code: z.ZodIssueCode.custom,
|
|
202
|
+
path: ["text"],
|
|
203
|
+
message: "Only text objects accept text content",
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
z.object({
|
|
208
|
+
op: z.literal("duplicate"),
|
|
209
|
+
target: sourceLocatorSchema.describe(
|
|
210
|
+
"Exact source locator for one selected JSX object from current view-screen",
|
|
211
|
+
),
|
|
212
|
+
}),
|
|
213
|
+
z.object({
|
|
214
|
+
op: z.literal("delete"),
|
|
215
|
+
target: sourceLocatorSchema.describe(
|
|
216
|
+
"Exact source locator for one selected JSX object from current view-screen",
|
|
217
|
+
),
|
|
218
|
+
}),
|
|
219
|
+
]);
|
|
220
|
+
|
|
221
|
+
export type SlideObjectTransformOperation = z.infer<
|
|
222
|
+
typeof slideObjectTransformOperationSchema
|
|
223
|
+
>;
|
|
224
|
+
|
|
225
|
+
type SourceLocator = z.infer<typeof sourceLocatorSchema>;
|
|
226
|
+
type Geometry = {
|
|
227
|
+
x: number;
|
|
228
|
+
y: number;
|
|
229
|
+
width: number;
|
|
230
|
+
height: number;
|
|
231
|
+
rotation: number;
|
|
232
|
+
rotationKey: "rotate" | "transform";
|
|
233
|
+
};
|
|
234
|
+
type StaticStyleEntry = { value: unknown; isStatic: boolean };
|
|
235
|
+
type SourceStyle = Map<string, StaticStyleEntry>;
|
|
236
|
+
|
|
237
|
+
export type SlideObjectTransformPlan =
|
|
238
|
+
| {
|
|
239
|
+
mode: "edits";
|
|
240
|
+
edits: Array<{
|
|
241
|
+
line: number;
|
|
242
|
+
column: number;
|
|
243
|
+
ops: Array<{
|
|
244
|
+
kind: "set-style";
|
|
245
|
+
key: string;
|
|
246
|
+
value: string;
|
|
247
|
+
}>;
|
|
248
|
+
}>;
|
|
249
|
+
targetCount: number;
|
|
250
|
+
}
|
|
251
|
+
| {
|
|
252
|
+
mode: "source";
|
|
253
|
+
sourceTsx: string;
|
|
254
|
+
targetCount: number;
|
|
255
|
+
createdObjectId?: string;
|
|
256
|
+
createdLocator?: SourceSelection;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
function transformFailure(
|
|
260
|
+
message: string,
|
|
261
|
+
details?: Record<string, unknown>,
|
|
262
|
+
): never {
|
|
263
|
+
throw slideSourceFailure(
|
|
264
|
+
message,
|
|
265
|
+
422,
|
|
266
|
+
"slide_transform_unsupported",
|
|
267
|
+
details,
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function sourceConflict(
|
|
272
|
+
message: string,
|
|
273
|
+
details?: Record<string, unknown>,
|
|
274
|
+
): never {
|
|
275
|
+
throw slideSourceFailure(message, 409, "slide_source_conflict", details);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async function requireCurrentVisualSelection(
|
|
279
|
+
deckId: string,
|
|
280
|
+
slideId: string,
|
|
281
|
+
expectedRevision: number,
|
|
282
|
+
expectedSourceHash: string,
|
|
283
|
+
target: SourceLocator,
|
|
284
|
+
): Promise<void> {
|
|
285
|
+
if (!getCurrentRequestBrowserTabId()) {
|
|
286
|
+
throw slideSourceFailure(
|
|
287
|
+
"Duplicate and delete require a current visual selection in the request tab. Reselect the object in the editor and retry.",
|
|
288
|
+
409,
|
|
289
|
+
"slide_transform_selection_required",
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const selection = await readAppStateForCurrentTab(
|
|
294
|
+
appStateKey("slides-selection"),
|
|
295
|
+
{ fallbackToGlobal: false },
|
|
296
|
+
);
|
|
297
|
+
const items = Array.isArray(selection?.items)
|
|
298
|
+
? selection.items.filter(
|
|
299
|
+
(item): item is Record<string, unknown> =>
|
|
300
|
+
typeof item === "object" && item !== null && !Array.isArray(item),
|
|
301
|
+
)
|
|
302
|
+
: [];
|
|
303
|
+
const selectedTargets = items.filter(
|
|
304
|
+
(item) =>
|
|
305
|
+
item.sourceLine === target.line && item.sourceColumn === target.column,
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
if (
|
|
309
|
+
selection?.deckId !== deckId ||
|
|
310
|
+
selection.slideId !== slideId ||
|
|
311
|
+
selection.sourceRevision !== expectedRevision ||
|
|
312
|
+
selection.sourceHash !== expectedSourceHash ||
|
|
313
|
+
items.length !== 1 ||
|
|
314
|
+
selectedTargets.length !== 1
|
|
315
|
+
) {
|
|
316
|
+
throw slideSourceFailure(
|
|
317
|
+
"Duplicate and delete require a currently selected source object on the same deck, slide, revision, and source hash. Reselect the object and retry.",
|
|
318
|
+
409,
|
|
319
|
+
"slide_transform_selection_required",
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const selected = selectedTargets[0]!;
|
|
324
|
+
const instanceIndex = selected.instanceIndex;
|
|
325
|
+
const instanceCount = selected.instanceCount;
|
|
326
|
+
if (
|
|
327
|
+
typeof instanceIndex !== "number" ||
|
|
328
|
+
!Number.isSafeInteger(instanceIndex) ||
|
|
329
|
+
typeof instanceCount !== "number" ||
|
|
330
|
+
!Number.isSafeInteger(instanceCount) ||
|
|
331
|
+
instanceIndex < 0 ||
|
|
332
|
+
instanceCount < 1 ||
|
|
333
|
+
instanceCount > MAX_RENDERED_SLIDE_INSTANCES_PER_SOURCE_LOCATOR ||
|
|
334
|
+
instanceIndex >= instanceCount
|
|
335
|
+
) {
|
|
336
|
+
throw slideSourceFailure(
|
|
337
|
+
"Duplicate and delete require fresh rendered-instance metadata from the editor. Reselect the object and call view-screen again.",
|
|
338
|
+
409,
|
|
339
|
+
"slide_transform_selection_required",
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
if (instanceCount !== 1 || instanceIndex !== 0) {
|
|
343
|
+
throw slideSourceFailure(
|
|
344
|
+
`The selected JSX source callsite renders ${instanceCount} visible instances. Duplicate and delete cannot target one rendered copy safely; select an object whose source callsite renders once.`,
|
|
345
|
+
409,
|
|
346
|
+
"slide_transform_selection_required",
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function readStaticExpression(
|
|
352
|
+
node: t.Node | null | undefined,
|
|
353
|
+
): StaticStyleEntry {
|
|
354
|
+
if (!node) return { value: undefined, isStatic: false };
|
|
355
|
+
if (t.isNullLiteral(node)) return { value: null, isStatic: true };
|
|
356
|
+
if (
|
|
357
|
+
t.isStringLiteral(node) ||
|
|
358
|
+
t.isNumericLiteral(node) ||
|
|
359
|
+
t.isBooleanLiteral(node)
|
|
360
|
+
) {
|
|
361
|
+
return { value: node.value, isStatic: true };
|
|
362
|
+
}
|
|
363
|
+
if (
|
|
364
|
+
t.isUnaryExpression(node) &&
|
|
365
|
+
node.operator === "-" &&
|
|
366
|
+
t.isNumericLiteral(node.argument)
|
|
367
|
+
) {
|
|
368
|
+
return { value: -node.argument.value, isStatic: true };
|
|
369
|
+
}
|
|
370
|
+
if (t.isTemplateLiteral(node) && node.expressions.length === 0) {
|
|
371
|
+
return {
|
|
372
|
+
value: node.quasis.map((quasi) => quasi.value.cooked ?? "").join(""),
|
|
373
|
+
isStatic: true,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
return { value: undefined, isStatic: false };
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function jsxAttribute(
|
|
380
|
+
element: t.JSXElement,
|
|
381
|
+
name: string,
|
|
382
|
+
): t.JSXAttribute | null {
|
|
383
|
+
for (const attr of element.openingElement.attributes) {
|
|
384
|
+
if (
|
|
385
|
+
t.isJSXAttribute(attr) &&
|
|
386
|
+
t.isJSXIdentifier(attr.name) &&
|
|
387
|
+
attr.name.name === name
|
|
388
|
+
) {
|
|
389
|
+
return attr;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function readAttributeString(
|
|
396
|
+
element: t.JSXElement,
|
|
397
|
+
name: string,
|
|
398
|
+
): string | null {
|
|
399
|
+
const value = jsxAttribute(element, name)?.value;
|
|
400
|
+
if (t.isStringLiteral(value)) return value.value;
|
|
401
|
+
if (
|
|
402
|
+
t.isJSXExpressionContainer(value) &&
|
|
403
|
+
t.isStringLiteral(value.expression)
|
|
404
|
+
) {
|
|
405
|
+
return value.expression.value;
|
|
406
|
+
}
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function requireStableObjectId(element: t.JSXElement): void {
|
|
411
|
+
const objectId = readAttributeString(element, "data-slide-object-id");
|
|
412
|
+
if (!objectId?.trim()) {
|
|
413
|
+
transformFailure(
|
|
414
|
+
"Grouping and z-order require every canvas object to have a static data-slide-object-id.",
|
|
415
|
+
{ line: element.loc?.start.line, column: element.loc?.start.column },
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function readSourceStyle(element: t.JSXElement): SourceStyle {
|
|
421
|
+
const attr = jsxAttribute(element, "style");
|
|
422
|
+
const value = attr?.value;
|
|
423
|
+
if (!value || !t.isJSXExpressionContainer(value)) {
|
|
424
|
+
transformFailure(
|
|
425
|
+
"The selected JSX element needs a static inline style object for canvas transforms.",
|
|
426
|
+
{ line: element.loc?.start.line, column: element.loc?.start.column },
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
if (!t.isObjectExpression(value.expression)) {
|
|
430
|
+
transformFailure(
|
|
431
|
+
"The selected JSX style is computed at runtime and its geometry cannot be verified.",
|
|
432
|
+
{ line: element.loc?.start.line, column: element.loc?.start.column },
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const style: SourceStyle = new Map();
|
|
437
|
+
for (const property of value.expression.properties) {
|
|
438
|
+
if (!t.isObjectProperty(property) || property.computed) {
|
|
439
|
+
transformFailure(
|
|
440
|
+
"The selected JSX style contains a spread or computed property, so its geometry cannot be verified.",
|
|
441
|
+
{ line: element.loc?.start.line, column: element.loc?.start.column },
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
let key: string | null = null;
|
|
445
|
+
if (t.isIdentifier(property.key)) key = property.key.name;
|
|
446
|
+
else if (t.isStringLiteral(property.key)) key = property.key.value;
|
|
447
|
+
if (!key)
|
|
448
|
+
transformFailure(
|
|
449
|
+
"The selected JSX style has an unsupported property name.",
|
|
450
|
+
{ line: element.loc?.start.line, column: element.loc?.start.column },
|
|
451
|
+
);
|
|
452
|
+
style.set(key, readStaticExpression(property.value));
|
|
453
|
+
}
|
|
454
|
+
return style;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function staticStyleValue(style: SourceStyle, key: string): unknown {
|
|
458
|
+
const entry = style.get(key);
|
|
459
|
+
if (!entry || !entry.isStatic) {
|
|
460
|
+
transformFailure(
|
|
461
|
+
"The selected JSX element has dynamic or missing " + key + " geometry.",
|
|
462
|
+
{ key },
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
return entry.value;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function cssPixel(value: unknown, key: string): number {
|
|
469
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
470
|
+
if (typeof value === "string") {
|
|
471
|
+
const match = /^(-?(?:\d+\.?\d*|\.\d+))(?:px)?$/.exec(value.trim());
|
|
472
|
+
if (match && (value.trim().endsWith("px") || Number(match[1]) === 0)) {
|
|
473
|
+
const number = Number(match[1]);
|
|
474
|
+
if (Number.isFinite(number)) return number;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return transformFailure(
|
|
478
|
+
"The selected JSX element needs numeric pixel " + key + " geometry.",
|
|
479
|
+
{ key, value },
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function parseAngle(value: unknown, key: string): number {
|
|
484
|
+
if (typeof value === "number" && value === 0) return 0;
|
|
485
|
+
if (typeof value !== "string") {
|
|
486
|
+
return transformFailure("The selected JSX rotation is not static.", {
|
|
487
|
+
key,
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
const trimmed = value.trim();
|
|
491
|
+
if (!trimmed || trimmed === "none" || trimmed === "0") return 0;
|
|
492
|
+
const match = /^(-?(?:\d+\.?\d*|\.\d+))(deg|grad|rad|turn)$/.exec(trimmed);
|
|
493
|
+
if (!match) {
|
|
494
|
+
return transformFailure(
|
|
495
|
+
"Canvas transforms support only a single static rotation angle.",
|
|
496
|
+
{ key, value },
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
const amount = Number(match[1]);
|
|
500
|
+
if (match[2] === "deg") return amount;
|
|
501
|
+
if (match[2] === "grad") return amount * 0.9;
|
|
502
|
+
if (match[2] === "rad") return (amount * 180) / Math.PI;
|
|
503
|
+
return amount * 360;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function wrapDegrees(value: number): number {
|
|
507
|
+
const wrapped = ((value % 360) + 360) % 360;
|
|
508
|
+
return Math.abs(wrapped) < 0.000001 || Math.abs(wrapped - 360) < 0.000001
|
|
509
|
+
? 0
|
|
510
|
+
: round(wrapped);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function round(value: number): number {
|
|
514
|
+
return Math.round(value * 1000) / 1000;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function readRotation(style: SourceStyle): {
|
|
518
|
+
rotation: number;
|
|
519
|
+
rotationKey: "rotate" | "transform";
|
|
520
|
+
} {
|
|
521
|
+
const individualRotation = style.get("rotate");
|
|
522
|
+
const transform = style.get("transform");
|
|
523
|
+
if (individualRotation && !individualRotation.isStatic) {
|
|
524
|
+
transformFailure("The selected JSX element has a dynamic rotate style.");
|
|
525
|
+
}
|
|
526
|
+
if (transform && !transform.isStatic) {
|
|
527
|
+
transformFailure("The selected JSX element has a dynamic transform style.");
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const transformValue = transform?.value;
|
|
531
|
+
const individualValue = individualRotation?.value;
|
|
532
|
+
if (
|
|
533
|
+
typeof transformValue === "string" &&
|
|
534
|
+
transformValue.trim() !== "" &&
|
|
535
|
+
transformValue.trim() !== "none"
|
|
536
|
+
) {
|
|
537
|
+
const match =
|
|
538
|
+
/^rotate\(\s*(-?(?:\d+\.?\d*|\.\d+))(deg|grad|rad|turn)\s*\)$/.exec(
|
|
539
|
+
transformValue.trim(),
|
|
540
|
+
);
|
|
541
|
+
if (
|
|
542
|
+
!match ||
|
|
543
|
+
(individualRotation && parseAngle(individualValue, "rotate") !== 0)
|
|
544
|
+
) {
|
|
545
|
+
transformFailure(
|
|
546
|
+
"Canvas transforms support a single rotation without translate, scale, or skew.",
|
|
547
|
+
{ transform: transformValue },
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
return {
|
|
551
|
+
rotation: parseAngle(match[1] + match[2], "transform"),
|
|
552
|
+
rotationKey: "transform",
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
if (transform && typeof transformValue !== "string") {
|
|
556
|
+
transformFailure("The selected JSX transform is not a supported rotation.");
|
|
557
|
+
}
|
|
558
|
+
if (
|
|
559
|
+
transformValue !== undefined &&
|
|
560
|
+
transformValue !== null &&
|
|
561
|
+
transformValue !== "none" &&
|
|
562
|
+
transformValue !== ""
|
|
563
|
+
) {
|
|
564
|
+
transformFailure(
|
|
565
|
+
"Canvas transforms support a single rotation without translate, scale, or skew.",
|
|
566
|
+
{ transform: transformValue },
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
return {
|
|
570
|
+
rotation: parseAngle(individualValue ?? 0, "rotate"),
|
|
571
|
+
rotationKey: "rotate",
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function readGeometry(element: t.JSXElement): Geometry {
|
|
576
|
+
const style = readSourceStyle(element);
|
|
577
|
+
const positionEntry = style.get("position");
|
|
578
|
+
if (!positionEntry) {
|
|
579
|
+
transformFailure(
|
|
580
|
+
"The selected JSX element is in flow layout; only absolute canvas objects can be transformed.",
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
if (!positionEntry.isStatic) {
|
|
584
|
+
transformFailure("The selected JSX element has dynamic position geometry.");
|
|
585
|
+
}
|
|
586
|
+
const position = positionEntry.value;
|
|
587
|
+
if (position !== "absolute") {
|
|
588
|
+
transformFailure(
|
|
589
|
+
"The selected JSX element is in flow layout; only absolute canvas objects can be transformed.",
|
|
590
|
+
{ position },
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
const x = cssPixel(staticStyleValue(style, "left"), "left");
|
|
594
|
+
const y = cssPixel(staticStyleValue(style, "top"), "top");
|
|
595
|
+
const width = cssPixel(staticStyleValue(style, "width"), "width");
|
|
596
|
+
const height = cssPixel(staticStyleValue(style, "height"), "height");
|
|
597
|
+
if (width < MIN_OBJECT_SIZE || height < MIN_OBJECT_SIZE) {
|
|
598
|
+
transformFailure(
|
|
599
|
+
"Canvas objects must remain at least " +
|
|
600
|
+
MIN_OBJECT_SIZE +
|
|
601
|
+
" px wide and high.",
|
|
602
|
+
{ width, height },
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
const origin = style.get("transformOrigin");
|
|
606
|
+
if (origin && !origin.isStatic) {
|
|
607
|
+
transformFailure(
|
|
608
|
+
"The selected JSX element has a dynamic transform origin.",
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
if (
|
|
612
|
+
origin?.value !== undefined &&
|
|
613
|
+
!["center", "50%", "50% 50%", "center center"].includes(
|
|
614
|
+
String(origin.value).trim(),
|
|
615
|
+
)
|
|
616
|
+
) {
|
|
617
|
+
transformFailure(
|
|
618
|
+
"Canvas transforms require the default center transform origin.",
|
|
619
|
+
{ transformOrigin: origin.value },
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
const translate = style.get("translate");
|
|
623
|
+
if (translate && !translate.isStatic) {
|
|
624
|
+
transformFailure("The selected JSX element has a dynamic translate style.");
|
|
625
|
+
}
|
|
626
|
+
if (
|
|
627
|
+
translate?.value !== undefined &&
|
|
628
|
+
!["none", "0", "0px", "0px 0px"].includes(String(translate.value).trim())
|
|
629
|
+
) {
|
|
630
|
+
transformFailure(
|
|
631
|
+
"Canvas transforms do not support a non-zero CSS translate value.",
|
|
632
|
+
{ translate: translate.value },
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
const scale = style.get("scale");
|
|
636
|
+
if (scale && !scale.isStatic) {
|
|
637
|
+
transformFailure("The selected JSX element has a dynamic scale style.");
|
|
638
|
+
}
|
|
639
|
+
if (
|
|
640
|
+
scale?.value !== undefined &&
|
|
641
|
+
!["none", "1", "1 1", "1 1 1"].includes(String(scale.value).trim())
|
|
642
|
+
) {
|
|
643
|
+
transformFailure(
|
|
644
|
+
"Canvas transforms do not support a non-identity CSS scale value.",
|
|
645
|
+
{ scale: scale.value },
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
const rotation = readRotation(style);
|
|
649
|
+
return { x, y, width, height, ...rotation };
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function parseSlideSource(source: string): t.File {
|
|
653
|
+
const ast = parseSource(source);
|
|
654
|
+
if (!ast) {
|
|
655
|
+
return transformFailure(
|
|
656
|
+
"Slide source could not be parsed for a canvas transform.",
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
return ast;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function findSourceElement(ast: t.File, locator: SourceLocator): t.JSXElement {
|
|
663
|
+
const matches: t.JSXElement[] = [];
|
|
664
|
+
walkJsx(ast, (node) => {
|
|
665
|
+
if (
|
|
666
|
+
t.isJSXElement(node) &&
|
|
667
|
+
node.loc?.start.line === locator.line &&
|
|
668
|
+
node.loc.start.column === locator.column
|
|
669
|
+
) {
|
|
670
|
+
matches.push(node);
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
if (matches.length !== 1) {
|
|
674
|
+
transformFailure(
|
|
675
|
+
"Source locator " +
|
|
676
|
+
locator.line +
|
|
677
|
+
":" +
|
|
678
|
+
locator.column +
|
|
679
|
+
" matched " +
|
|
680
|
+
matches.length +
|
|
681
|
+
" JSX elements. Refresh view-screen and get-slide-source before transforming.",
|
|
682
|
+
locator,
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
return matches[0]!;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function findParentJsx(
|
|
689
|
+
ast: t.File,
|
|
690
|
+
locator: SourceLocator,
|
|
691
|
+
element: t.JSXElement,
|
|
692
|
+
): t.JSXElement | t.JSXFragment {
|
|
693
|
+
const ancestors = findJsxAncestors(ast, locator.line, locator.column);
|
|
694
|
+
if (ancestors[0] !== element || ancestors.length < 2) {
|
|
695
|
+
return transformFailure(
|
|
696
|
+
"The selected JSX object has no JSX sibling parent.",
|
|
697
|
+
locator,
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
return ancestors[1]!;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function directJsxChildren(
|
|
704
|
+
parent: t.JSXElement | t.JSXFragment,
|
|
705
|
+
): t.JSXElement[] {
|
|
706
|
+
return parent.children.filter(t.isJSXElement);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function requireSameParent(
|
|
710
|
+
ast: t.File,
|
|
711
|
+
targets: SourceLocator[],
|
|
712
|
+
): { elements: t.JSXElement[]; parent: t.JSXElement | t.JSXFragment } {
|
|
713
|
+
const elements = targets.map((locator) => findSourceElement(ast, locator));
|
|
714
|
+
if (new Set(elements).size !== elements.length) {
|
|
715
|
+
transformFailure("Each canvas object locator must be unique.");
|
|
716
|
+
}
|
|
717
|
+
const parent = findParentJsx(ast, targets[0]!, elements[0]!);
|
|
718
|
+
for (let index = 1; index < elements.length; index += 1) {
|
|
719
|
+
if (findParentJsx(ast, targets[index]!, elements[index]!) !== parent) {
|
|
720
|
+
transformFailure(
|
|
721
|
+
"The selected objects must be direct siblings in the same JSX parent.",
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return { elements, parent };
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function visualBounds(geometry: Geometry) {
|
|
729
|
+
const radians = (geometry.rotation * Math.PI) / 180;
|
|
730
|
+
const width =
|
|
731
|
+
Math.abs(Math.cos(radians)) * geometry.width +
|
|
732
|
+
Math.abs(Math.sin(radians)) * geometry.height;
|
|
733
|
+
const height =
|
|
734
|
+
Math.abs(Math.sin(radians)) * geometry.width +
|
|
735
|
+
Math.abs(Math.cos(radians)) * geometry.height;
|
|
736
|
+
const centerX = geometry.x + geometry.width / 2;
|
|
737
|
+
const centerY = geometry.y + geometry.height / 2;
|
|
738
|
+
return {
|
|
739
|
+
x: centerX - width / 2,
|
|
740
|
+
y: centerY - height / 2,
|
|
741
|
+
width,
|
|
742
|
+
height,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
function unionBounds(geometries: Geometry[]) {
|
|
747
|
+
if (geometries.length === 0) {
|
|
748
|
+
return transformFailure("Select at least one canvas object.");
|
|
749
|
+
}
|
|
750
|
+
const bounds = geometries.map(visualBounds);
|
|
751
|
+
const left = Math.min(...bounds.map((entry) => entry.x));
|
|
752
|
+
const top = Math.min(...bounds.map((entry) => entry.y));
|
|
753
|
+
const right = Math.max(...bounds.map((entry) => entry.x + entry.width));
|
|
754
|
+
const bottom = Math.max(...bounds.map((entry) => entry.y + entry.height));
|
|
755
|
+
return { x: left, y: top, width: right - left, height: bottom - top };
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function formatPx(value: number): string {
|
|
759
|
+
return round(value) + "px";
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function formatRotation(value: number): string {
|
|
763
|
+
return wrapDegrees(value) + "deg";
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function readStaticZIndex(style: SourceStyle): number | null {
|
|
767
|
+
const entry = style.get("zIndex");
|
|
768
|
+
if (!entry) return null;
|
|
769
|
+
if (!entry.isStatic) {
|
|
770
|
+
transformFailure("A same-parent layer has a dynamic z-index.");
|
|
771
|
+
}
|
|
772
|
+
if (entry.value === null || entry.value === "auto") return null;
|
|
773
|
+
const value = Number(entry.value);
|
|
774
|
+
if (!Number.isFinite(value) || !Number.isInteger(value)) {
|
|
775
|
+
transformFailure("Same-parent layer z-index values must be integers.");
|
|
776
|
+
}
|
|
777
|
+
return value;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
type StyleUpdates = Record<string, string>;
|
|
781
|
+
|
|
782
|
+
function makeEdits(
|
|
783
|
+
targets: SourceLocator[],
|
|
784
|
+
updates: StyleUpdates[],
|
|
785
|
+
): Array<{
|
|
786
|
+
line: number;
|
|
787
|
+
column: number;
|
|
788
|
+
ops: Array<{ kind: "set-style"; key: string; value: string }>;
|
|
789
|
+
}> {
|
|
790
|
+
return targets.flatMap((target, index) => {
|
|
791
|
+
const values = updates[index] ?? {};
|
|
792
|
+
const ops = Object.entries(values).map(([key, value]) => ({
|
|
793
|
+
kind: "set-style" as const,
|
|
794
|
+
key,
|
|
795
|
+
value,
|
|
796
|
+
}));
|
|
797
|
+
return ops.length
|
|
798
|
+
? [{ line: target.line, column: target.column, ops }]
|
|
799
|
+
: [];
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function styleSplices(
|
|
804
|
+
source: string,
|
|
805
|
+
targets: SourceLocator[],
|
|
806
|
+
updates: StyleUpdates[],
|
|
807
|
+
): Splice[] {
|
|
808
|
+
const splices: Splice[] = [];
|
|
809
|
+
const edits = makeEdits(targets, updates);
|
|
810
|
+
for (const edit of edits) {
|
|
811
|
+
const result = planEdit(source, edit.line, edit.column, edit.ops, true);
|
|
812
|
+
if (!result.ok) {
|
|
813
|
+
transformFailure(
|
|
814
|
+
"The selected JSX style cannot be edited safely: " + result.error + ".",
|
|
815
|
+
{ line: edit.line, column: edit.column },
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
splices.push(...result.splices);
|
|
819
|
+
}
|
|
820
|
+
return splices;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function applySplicesToRange(
|
|
824
|
+
source: string,
|
|
825
|
+
rangeStart: number,
|
|
826
|
+
rangeEnd: number,
|
|
827
|
+
splices: Splice[],
|
|
828
|
+
): string {
|
|
829
|
+
const local = splices.map((splice) => ({
|
|
830
|
+
from: splice.from - rangeStart,
|
|
831
|
+
to: splice.to - rangeStart,
|
|
832
|
+
text: splice.text,
|
|
833
|
+
}));
|
|
834
|
+
if (
|
|
835
|
+
local.some(
|
|
836
|
+
(splice) =>
|
|
837
|
+
splice.from < 0 ||
|
|
838
|
+
splice.to > rangeEnd - rangeStart ||
|
|
839
|
+
splice.from > splice.to,
|
|
840
|
+
)
|
|
841
|
+
) {
|
|
842
|
+
transformFailure(
|
|
843
|
+
"A source style edit crossed the structural transform range.",
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
local.sort((left, right) => right.from - left.from);
|
|
847
|
+
for (let index = 1; index < local.length; index += 1) {
|
|
848
|
+
const previous = local[index - 1]!;
|
|
849
|
+
const current = local[index]!;
|
|
850
|
+
if (current.to > previous.from) {
|
|
851
|
+
transformFailure("Canvas object source edits overlap.");
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
let result = source.slice(rangeStart, rangeEnd);
|
|
855
|
+
for (const splice of local) {
|
|
856
|
+
result =
|
|
857
|
+
result.slice(0, splice.from) + splice.text + result.slice(splice.to);
|
|
858
|
+
}
|
|
859
|
+
return result;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
function requireContiguousSiblingRange(
|
|
863
|
+
parent: t.JSXElement | t.JSXFragment,
|
|
864
|
+
elements: t.JSXElement[],
|
|
865
|
+
): { start: number; end: number } {
|
|
866
|
+
const children = parent.children;
|
|
867
|
+
const indexes = elements.map((element) => children.indexOf(element));
|
|
868
|
+
if (indexes.some((index) => index < 0)) {
|
|
869
|
+
transformFailure("Canvas group members must be direct JSX siblings.");
|
|
870
|
+
}
|
|
871
|
+
const startIndex = Math.min(...indexes);
|
|
872
|
+
const endIndex = Math.max(...indexes);
|
|
873
|
+
const selected = new Set(elements);
|
|
874
|
+
for (const child of children.slice(startIndex, endIndex + 1)) {
|
|
875
|
+
if (t.isJSXElement(child) && !selected.has(child)) {
|
|
876
|
+
transformFailure(
|
|
877
|
+
"Grouping cannot move an unselected JSX sibling between selected objects.",
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
if (t.isJSXText(child) && child.value.trim() === "") continue;
|
|
881
|
+
if (t.isJSXElement(child) && selected.has(child)) continue;
|
|
882
|
+
transformFailure(
|
|
883
|
+
"Grouping requires selected objects to be adjacent, apart from whitespace.",
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
const ordered = [...elements].sort(
|
|
887
|
+
(left, right) => left.start! - right.start!,
|
|
888
|
+
);
|
|
889
|
+
const first = ordered[0]!;
|
|
890
|
+
const last = ordered[ordered.length - 1]!;
|
|
891
|
+
if (typeof first.start !== "number" || typeof last.end !== "number") {
|
|
892
|
+
transformFailure("Selected JSX objects are missing source ranges.");
|
|
893
|
+
}
|
|
894
|
+
return { start: first.start, end: last.end };
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
function sourceSplice(
|
|
898
|
+
source: string,
|
|
899
|
+
start: number,
|
|
900
|
+
end: number,
|
|
901
|
+
replacement: string,
|
|
902
|
+
) {
|
|
903
|
+
return source.slice(0, start) + replacement + source.slice(end);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function groupSource(
|
|
907
|
+
source: string,
|
|
908
|
+
ast: t.File,
|
|
909
|
+
targets: SourceLocator[],
|
|
910
|
+
): SlideObjectTransformPlan {
|
|
911
|
+
if (targets.length < 2) {
|
|
912
|
+
transformFailure("Grouping requires at least two selected canvas objects.");
|
|
913
|
+
}
|
|
914
|
+
const { elements, parent } = requireSameParent(ast, targets);
|
|
915
|
+
elements.forEach(requireStableObjectId);
|
|
916
|
+
const range = requireContiguousSiblingRange(parent, elements);
|
|
917
|
+
const geometries = elements.map(readGeometry);
|
|
918
|
+
const bounds = unionBounds(geometries);
|
|
919
|
+
const updates = geometries.map((geometry) => ({
|
|
920
|
+
left: formatPx(geometry.x - bounds.x),
|
|
921
|
+
top: formatPx(geometry.y - bounds.y),
|
|
922
|
+
}));
|
|
923
|
+
const splices = styleSplices(source, targets, updates);
|
|
924
|
+
const inner = applySplicesToRange(source, range.start, range.end, splices);
|
|
925
|
+
const groupId = randomUUID();
|
|
926
|
+
const explicitZIndexes = elements
|
|
927
|
+
.map((element) => readStaticZIndex(readSourceStyle(element)))
|
|
928
|
+
.filter((value): value is number => value !== null);
|
|
929
|
+
const zIndex =
|
|
930
|
+
explicitZIndexes.length > 0
|
|
931
|
+
? ", zIndex: " + Math.max(...explicitZIndexes)
|
|
932
|
+
: "";
|
|
933
|
+
const replacement =
|
|
934
|
+
'<div className="fmd-slide-group" data-slide-group="true" data-slide-object-id="' +
|
|
935
|
+
groupId +
|
|
936
|
+
'" style={{ position: "absolute", left: "' +
|
|
937
|
+
formatPx(bounds.x) +
|
|
938
|
+
'", top: "' +
|
|
939
|
+
formatPx(bounds.y) +
|
|
940
|
+
'", width: "' +
|
|
941
|
+
formatPx(bounds.width) +
|
|
942
|
+
'", height: "' +
|
|
943
|
+
formatPx(bounds.height) +
|
|
944
|
+
'", boxSizing: "border-box"' +
|
|
945
|
+
zIndex +
|
|
946
|
+
" }}>" +
|
|
947
|
+
inner +
|
|
948
|
+
"</div>";
|
|
949
|
+
return {
|
|
950
|
+
mode: "source",
|
|
951
|
+
sourceTsx: sourceSplice(source, range.start, range.end, replacement),
|
|
952
|
+
targetCount: targets.length,
|
|
953
|
+
createdObjectId: groupId,
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function ungroupSource(
|
|
958
|
+
source: string,
|
|
959
|
+
ast: t.File,
|
|
960
|
+
target: SourceLocator,
|
|
961
|
+
): SlideObjectTransformPlan {
|
|
962
|
+
const group = findSourceElement(ast, target);
|
|
963
|
+
const isGroup =
|
|
964
|
+
readAttributeString(group, "data-slide-group") === "true" &&
|
|
965
|
+
(readAttributeString(group, "className") ?? "")
|
|
966
|
+
.split(/\s+/)
|
|
967
|
+
.includes("fmd-slide-group");
|
|
968
|
+
if (!isGroup || !group.closingElement) {
|
|
969
|
+
transformFailure(
|
|
970
|
+
"The selected source element is not a complete slide object group.",
|
|
971
|
+
target,
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
const sourceChildren = directJsxChildren(group);
|
|
975
|
+
if (sourceChildren.length < 2) {
|
|
976
|
+
transformFailure(
|
|
977
|
+
"A slide object group must contain at least two direct objects.",
|
|
978
|
+
target,
|
|
979
|
+
);
|
|
980
|
+
}
|
|
981
|
+
sourceChildren.forEach(requireStableObjectId);
|
|
982
|
+
for (const child of group.children) {
|
|
983
|
+
if (t.isJSXElement(child)) continue;
|
|
984
|
+
if (t.isJSXText(child) && child.value.trim() === "") continue;
|
|
985
|
+
transformFailure(
|
|
986
|
+
"Ungroup supports direct JSX object children only.",
|
|
987
|
+
target,
|
|
988
|
+
);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
const groupGeometry = readGeometry(group);
|
|
992
|
+
const groupZIndex = readStaticZIndex(readSourceStyle(group));
|
|
993
|
+
const children = sourceChildren
|
|
994
|
+
.map((element, sourceOrder) => ({
|
|
995
|
+
element,
|
|
996
|
+
sourceOrder,
|
|
997
|
+
zIndex: readStaticZIndex(readSourceStyle(element)) ?? 0,
|
|
998
|
+
}))
|
|
999
|
+
.sort(
|
|
1000
|
+
(left, right) =>
|
|
1001
|
+
left.zIndex - right.zIndex || left.sourceOrder - right.sourceOrder,
|
|
1002
|
+
);
|
|
1003
|
+
const center = {
|
|
1004
|
+
x: groupGeometry.x + groupGeometry.width / 2,
|
|
1005
|
+
y: groupGeometry.y + groupGeometry.height / 2,
|
|
1006
|
+
};
|
|
1007
|
+
const groupAngle = (groupGeometry.rotation * Math.PI) / 180;
|
|
1008
|
+
const childrenUpdates: StyleUpdates[] = children.map(({ element }) => {
|
|
1009
|
+
const geometry = readGeometry(element);
|
|
1010
|
+
const childCenter = {
|
|
1011
|
+
x: groupGeometry.x + geometry.x + geometry.width / 2,
|
|
1012
|
+
y: groupGeometry.y + geometry.y + geometry.height / 2,
|
|
1013
|
+
};
|
|
1014
|
+
const dx = childCenter.x - center.x;
|
|
1015
|
+
const dy = childCenter.y - center.y;
|
|
1016
|
+
const worldCenter = {
|
|
1017
|
+
x: center.x + Math.cos(groupAngle) * dx - Math.sin(groupAngle) * dy,
|
|
1018
|
+
y: center.y + Math.sin(groupAngle) * dx + Math.cos(groupAngle) * dy,
|
|
1019
|
+
};
|
|
1020
|
+
const rotation = wrapDegrees(geometry.rotation + groupGeometry.rotation);
|
|
1021
|
+
return {
|
|
1022
|
+
left: formatPx(worldCenter.x - geometry.width / 2),
|
|
1023
|
+
top: formatPx(worldCenter.y - geometry.height / 2),
|
|
1024
|
+
zIndex: groupZIndex === null ? "auto" : String(groupZIndex),
|
|
1025
|
+
...(geometry.rotation !== 0 || groupGeometry.rotation !== 0
|
|
1026
|
+
? {
|
|
1027
|
+
[geometry.rotationKey]:
|
|
1028
|
+
geometry.rotationKey === "transform"
|
|
1029
|
+
? "rotate(" + formatRotation(rotation) + ")"
|
|
1030
|
+
: formatRotation(rotation),
|
|
1031
|
+
}
|
|
1032
|
+
: {}),
|
|
1033
|
+
};
|
|
1034
|
+
});
|
|
1035
|
+
const childTargets = children.map(({ element }) => ({
|
|
1036
|
+
line: element.loc!.start.line,
|
|
1037
|
+
column: element.loc!.start.column,
|
|
1038
|
+
}));
|
|
1039
|
+
const childSplices = styleSplices(source, childTargets, childrenUpdates);
|
|
1040
|
+
const innerStart = group.openingElement.end;
|
|
1041
|
+
const innerEnd = group.closingElement.start;
|
|
1042
|
+
if (typeof innerStart !== "number" || typeof innerEnd !== "number") {
|
|
1043
|
+
transformFailure(
|
|
1044
|
+
"The selected slide object group is missing a source range.",
|
|
1045
|
+
target,
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
const sourceOrder = [...sourceChildren].sort(
|
|
1049
|
+
(left, right) => left.start! - right.start!,
|
|
1050
|
+
);
|
|
1051
|
+
const firstSourceChild = sourceOrder[0]!;
|
|
1052
|
+
const lastSourceChild = sourceOrder[sourceOrder.length - 1]!;
|
|
1053
|
+
if (
|
|
1054
|
+
typeof firstSourceChild.start !== "number" ||
|
|
1055
|
+
typeof lastSourceChild.end !== "number" ||
|
|
1056
|
+
children.some(
|
|
1057
|
+
({ element }) =>
|
|
1058
|
+
typeof element.start !== "number" || typeof element.end !== "number",
|
|
1059
|
+
)
|
|
1060
|
+
) {
|
|
1061
|
+
transformFailure(
|
|
1062
|
+
"A grouped slide object is missing a source range.",
|
|
1063
|
+
target,
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
const leadingWhitespace = source.slice(innerStart, firstSourceChild.start);
|
|
1067
|
+
const trailingWhitespace = source.slice(lastSourceChild.end, innerEnd);
|
|
1068
|
+
const whitespaceBefore = new Map<t.JSXElement, string>();
|
|
1069
|
+
for (let index = 1; index < sourceOrder.length; index += 1) {
|
|
1070
|
+
const previous = sourceOrder[index - 1]!;
|
|
1071
|
+
const current = sourceOrder[index]!;
|
|
1072
|
+
whitespaceBefore.set(current, source.slice(previous.end!, current.start!));
|
|
1073
|
+
}
|
|
1074
|
+
const updatedChildren = children.map(({ element }, index) => {
|
|
1075
|
+
const start = element.start!;
|
|
1076
|
+
const end = element.end!;
|
|
1077
|
+
const edits = childSplices.filter(
|
|
1078
|
+
(splice) => splice.from >= start && splice.to <= end,
|
|
1079
|
+
);
|
|
1080
|
+
const fragment = applySplicesToRange(source, start, end, edits);
|
|
1081
|
+
const whitespace =
|
|
1082
|
+
index === 0
|
|
1083
|
+
? leadingWhitespace
|
|
1084
|
+
: (whitespaceBefore.get(element) ?? leadingWhitespace);
|
|
1085
|
+
return whitespace + fragment;
|
|
1086
|
+
});
|
|
1087
|
+
const inner = updatedChildren.join("") + trailingWhitespace;
|
|
1088
|
+
return {
|
|
1089
|
+
mode: "source",
|
|
1090
|
+
sourceTsx: sourceSplice(source, group.start!, group.end!, inner),
|
|
1091
|
+
targetCount: sourceChildren.length,
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
function arrangeZOrder(
|
|
1096
|
+
ast: t.File,
|
|
1097
|
+
targets: SourceLocator[],
|
|
1098
|
+
target: "forward" | "backward" | "front" | "back",
|
|
1099
|
+
): SlideObjectTransformPlan {
|
|
1100
|
+
const { elements, parent } = requireSameParent(ast, targets);
|
|
1101
|
+
const children = directJsxChildren(parent);
|
|
1102
|
+
const layers: Array<{
|
|
1103
|
+
element: t.JSXElement;
|
|
1104
|
+
zIndex: number;
|
|
1105
|
+
order: number;
|
|
1106
|
+
locator: SourceLocator;
|
|
1107
|
+
}> = [];
|
|
1108
|
+
for (const [order, element] of children.entries()) {
|
|
1109
|
+
if (!readAttributeString(element, "data-slide-object-id")) continue;
|
|
1110
|
+
const style = readSourceStyle(element);
|
|
1111
|
+
const position = style.get("position");
|
|
1112
|
+
if (!position) continue;
|
|
1113
|
+
if (!position.isStatic) {
|
|
1114
|
+
transformFailure("A same-parent layer has dynamic position styles.");
|
|
1115
|
+
}
|
|
1116
|
+
if (position.value !== "absolute") continue;
|
|
1117
|
+
const zIndex = readStaticZIndex(style) ?? 0;
|
|
1118
|
+
layers.push({
|
|
1119
|
+
element,
|
|
1120
|
+
zIndex,
|
|
1121
|
+
order,
|
|
1122
|
+
locator: {
|
|
1123
|
+
line: element.loc!.start.line,
|
|
1124
|
+
column: element.loc!.start.column,
|
|
1125
|
+
},
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
const selected = new Set(elements);
|
|
1129
|
+
elements.forEach(requireStableObjectId);
|
|
1130
|
+
if (
|
|
1131
|
+
elements.some(
|
|
1132
|
+
(element) => !layers.some((layer) => layer.element === element),
|
|
1133
|
+
)
|
|
1134
|
+
) {
|
|
1135
|
+
transformFailure(
|
|
1136
|
+
"Z-order applies only to absolute-positioned canvas objects.",
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
if (layers.some((layer) => !layer.element.loc)) {
|
|
1140
|
+
transformFailure("A same-parent layer is missing its JSX source location.");
|
|
1141
|
+
}
|
|
1142
|
+
const ordered = [...layers].sort(
|
|
1143
|
+
(left, right) => left.zIndex - right.zIndex || left.order - right.order,
|
|
1144
|
+
);
|
|
1145
|
+
const reordered = [...ordered];
|
|
1146
|
+
if (target === "front" || target === "back") {
|
|
1147
|
+
const selectedLayers = reordered.filter((layer) =>
|
|
1148
|
+
selected.has(layer.element),
|
|
1149
|
+
);
|
|
1150
|
+
const unselectedLayers = reordered.filter(
|
|
1151
|
+
(layer) => !selected.has(layer.element),
|
|
1152
|
+
);
|
|
1153
|
+
reordered.splice(
|
|
1154
|
+
0,
|
|
1155
|
+
reordered.length,
|
|
1156
|
+
...(target === "front"
|
|
1157
|
+
? [...unselectedLayers, ...selectedLayers]
|
|
1158
|
+
: [...selectedLayers, ...unselectedLayers]),
|
|
1159
|
+
);
|
|
1160
|
+
} else {
|
|
1161
|
+
const step = target === "forward" ? 1 : -1;
|
|
1162
|
+
const selectedIndexes = reordered
|
|
1163
|
+
.map((layer, index) => (selected.has(layer.element) ? index : -1))
|
|
1164
|
+
.filter((index) => index >= 0);
|
|
1165
|
+
const indexes = step > 0 ? selectedIndexes.reverse() : selectedIndexes;
|
|
1166
|
+
for (const index of indexes) {
|
|
1167
|
+
const currentIndex = reordered.findIndex(
|
|
1168
|
+
(entry) => entry === ordered[index],
|
|
1169
|
+
);
|
|
1170
|
+
const nextIndex = currentIndex + step;
|
|
1171
|
+
if (
|
|
1172
|
+
nextIndex < 0 ||
|
|
1173
|
+
nextIndex >= reordered.length ||
|
|
1174
|
+
selected.has(reordered[nextIndex]!.element)
|
|
1175
|
+
) {
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
const [moved] = reordered.splice(currentIndex, 1);
|
|
1179
|
+
if (moved) reordered.splice(nextIndex, 0, moved);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
const updates = reordered.map((layer, index) => ({
|
|
1183
|
+
zIndex: String(index),
|
|
1184
|
+
}));
|
|
1185
|
+
const changed = reordered.some((layer, index) => layer.zIndex !== index);
|
|
1186
|
+
return {
|
|
1187
|
+
mode: "edits",
|
|
1188
|
+
edits: changed
|
|
1189
|
+
? makeEdits(
|
|
1190
|
+
reordered.map((layer) => layer.locator),
|
|
1191
|
+
updates,
|
|
1192
|
+
)
|
|
1193
|
+
: [],
|
|
1194
|
+
targetCount: elements.length,
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
export function planSlideObjectTransform(
|
|
1199
|
+
source: string,
|
|
1200
|
+
operation: SlideObjectTransformOperation,
|
|
1201
|
+
): SlideObjectTransformPlan {
|
|
1202
|
+
if (operation.op === "insert") {
|
|
1203
|
+
const result = insertSourceObject(source, {
|
|
1204
|
+
kind: operation.kind,
|
|
1205
|
+
...(operation.geometry ? { geometry: operation.geometry } : {}),
|
|
1206
|
+
...(operation.text !== undefined ? { text: operation.text } : {}),
|
|
1207
|
+
});
|
|
1208
|
+
if (!result) {
|
|
1209
|
+
transformFailure(
|
|
1210
|
+
"An object could not be inserted into the default slide canvas. Refresh get-slide-source and try a supported slide component.",
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
return {
|
|
1214
|
+
mode: "source",
|
|
1215
|
+
sourceTsx: result.sourceTsx,
|
|
1216
|
+
targetCount: 1,
|
|
1217
|
+
createdObjectId: result.createdObjectId,
|
|
1218
|
+
createdLocator: result.selection,
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
if (operation.op === "duplicate") {
|
|
1222
|
+
const result = duplicateSourceElement(source, operation.target);
|
|
1223
|
+
if (!result) {
|
|
1224
|
+
transformFailure(
|
|
1225
|
+
"The selected JSX object cannot be duplicated safely. Use a current view-screen locator for a root or direct JSX child; objects with custom IDs, spreads, or unsupported nested structure are not duplicated.",
|
|
1226
|
+
operation.target,
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
return {
|
|
1230
|
+
mode: "source",
|
|
1231
|
+
sourceTsx: result.sourceTsx,
|
|
1232
|
+
targetCount: 1,
|
|
1233
|
+
...(result.createdObjectId
|
|
1234
|
+
? { createdObjectId: result.createdObjectId }
|
|
1235
|
+
: {}),
|
|
1236
|
+
...(result.selection ? { createdLocator: result.selection } : {}),
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
if (operation.op === "delete") {
|
|
1240
|
+
const result = deleteSourceElement(source, operation.target);
|
|
1241
|
+
if (!result) {
|
|
1242
|
+
transformFailure(
|
|
1243
|
+
"The selected JSX object cannot be deleted safely. Use a current view-screen locator for a root or direct JSX child.",
|
|
1244
|
+
operation.target,
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
mode: "source",
|
|
1249
|
+
sourceTsx: result.sourceTsx,
|
|
1250
|
+
targetCount: 1,
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
const ast = parseSlideSource(source);
|
|
1255
|
+
if (operation.op === "group") {
|
|
1256
|
+
return groupSource(source, ast, operation.targets);
|
|
1257
|
+
}
|
|
1258
|
+
if (operation.op === "ungroup") {
|
|
1259
|
+
return ungroupSource(source, ast, operation.target);
|
|
1260
|
+
}
|
|
1261
|
+
if (operation.op === "z-order") {
|
|
1262
|
+
return arrangeZOrder(ast, operation.targets, operation.target);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
const targets = operation.targets;
|
|
1266
|
+
const { elements } = requireSameParent(ast, targets);
|
|
1267
|
+
const geometries = elements.map(readGeometry);
|
|
1268
|
+
let updates: StyleUpdates[];
|
|
1269
|
+
switch (operation.op) {
|
|
1270
|
+
case "move":
|
|
1271
|
+
updates = geometries.map((geometry) => ({
|
|
1272
|
+
left: formatPx(geometry.x + operation.dx),
|
|
1273
|
+
top: formatPx(geometry.y + operation.dy),
|
|
1274
|
+
}));
|
|
1275
|
+
break;
|
|
1276
|
+
case "resize": {
|
|
1277
|
+
const current = unionBounds(geometries);
|
|
1278
|
+
let scaleX = operation.bounds.width / current.width;
|
|
1279
|
+
let scaleY = operation.bounds.height / current.height;
|
|
1280
|
+
let targetX = operation.bounds.x;
|
|
1281
|
+
let targetY = operation.bounds.y;
|
|
1282
|
+
if (operation.preserveAspectRatio) {
|
|
1283
|
+
const scale = Math.min(scaleX, scaleY);
|
|
1284
|
+
targetX += (operation.bounds.width - current.width * scale) / 2;
|
|
1285
|
+
targetY += (operation.bounds.height - current.height * scale) / 2;
|
|
1286
|
+
scaleX = scale;
|
|
1287
|
+
scaleY = scale;
|
|
1288
|
+
}
|
|
1289
|
+
if (
|
|
1290
|
+
geometries.some(
|
|
1291
|
+
(geometry) =>
|
|
1292
|
+
geometry.rotation !== 0 && Math.abs(scaleX - scaleY) > 0.000001,
|
|
1293
|
+
)
|
|
1294
|
+
) {
|
|
1295
|
+
transformFailure(
|
|
1296
|
+
"Rotated objects can only be resized with a uniform scale.",
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1299
|
+
updates = geometries.map((geometry) => {
|
|
1300
|
+
const width = geometry.width * scaleX;
|
|
1301
|
+
const height = geometry.height * scaleY;
|
|
1302
|
+
if (width < MIN_OBJECT_SIZE || height < MIN_OBJECT_SIZE) {
|
|
1303
|
+
transformFailure(
|
|
1304
|
+
"Resize would make an object smaller than " +
|
|
1305
|
+
MIN_OBJECT_SIZE +
|
|
1306
|
+
" px.",
|
|
1307
|
+
);
|
|
1308
|
+
}
|
|
1309
|
+
const centerX =
|
|
1310
|
+
targetX + (geometry.x + geometry.width / 2 - current.x) * scaleX;
|
|
1311
|
+
const centerY =
|
|
1312
|
+
targetY + (geometry.y + geometry.height / 2 - current.y) * scaleY;
|
|
1313
|
+
return {
|
|
1314
|
+
left: formatPx(centerX - width / 2),
|
|
1315
|
+
top: formatPx(centerY - height / 2),
|
|
1316
|
+
width: formatPx(width),
|
|
1317
|
+
height: formatPx(height),
|
|
1318
|
+
};
|
|
1319
|
+
});
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
case "rotate": {
|
|
1323
|
+
const bounds = unionBounds(geometries);
|
|
1324
|
+
const center = {
|
|
1325
|
+
x: bounds.x + bounds.width / 2,
|
|
1326
|
+
y: bounds.y + bounds.height / 2,
|
|
1327
|
+
};
|
|
1328
|
+
const radians = (operation.deltaDegrees * Math.PI) / 180;
|
|
1329
|
+
updates = geometries.map((geometry) => {
|
|
1330
|
+
const objectCenter = {
|
|
1331
|
+
x: geometry.x + geometry.width / 2,
|
|
1332
|
+
y: geometry.y + geometry.height / 2,
|
|
1333
|
+
};
|
|
1334
|
+
const dx = objectCenter.x - center.x;
|
|
1335
|
+
const dy = objectCenter.y - center.y;
|
|
1336
|
+
const nextCenter = {
|
|
1337
|
+
x: center.x + Math.cos(radians) * dx - Math.sin(radians) * dy,
|
|
1338
|
+
y: center.y + Math.sin(radians) * dx + Math.cos(radians) * dy,
|
|
1339
|
+
};
|
|
1340
|
+
const rotation = wrapDegrees(
|
|
1341
|
+
geometry.rotation + operation.deltaDegrees,
|
|
1342
|
+
);
|
|
1343
|
+
return {
|
|
1344
|
+
left: formatPx(nextCenter.x - geometry.width / 2),
|
|
1345
|
+
top: formatPx(nextCenter.y - geometry.height / 2),
|
|
1346
|
+
[geometry.rotationKey]:
|
|
1347
|
+
geometry.rotationKey === "transform"
|
|
1348
|
+
? "rotate(" + formatRotation(rotation) + ")"
|
|
1349
|
+
: formatRotation(rotation),
|
|
1350
|
+
};
|
|
1351
|
+
});
|
|
1352
|
+
break;
|
|
1353
|
+
}
|
|
1354
|
+
case "align": {
|
|
1355
|
+
const bounds =
|
|
1356
|
+
operation.reference === "slide"
|
|
1357
|
+
? { x: 0, y: 0, width: CANVAS_WIDTH, height: CANVAS_HEIGHT }
|
|
1358
|
+
: unionBounds(geometries);
|
|
1359
|
+
updates = geometries.map((geometry) => {
|
|
1360
|
+
const visual = visualBounds(geometry);
|
|
1361
|
+
let dx = 0;
|
|
1362
|
+
let dy = 0;
|
|
1363
|
+
if (operation.alignment === "left") dx = bounds.x - visual.x;
|
|
1364
|
+
if (operation.alignment === "center") {
|
|
1365
|
+
dx = bounds.x + (bounds.width - visual.width) / 2 - visual.x;
|
|
1366
|
+
}
|
|
1367
|
+
if (operation.alignment === "right") {
|
|
1368
|
+
dx = bounds.x + bounds.width - visual.width - visual.x;
|
|
1369
|
+
}
|
|
1370
|
+
if (operation.alignment === "top") dy = bounds.y - visual.y;
|
|
1371
|
+
if (operation.alignment === "middle") {
|
|
1372
|
+
dy = bounds.y + (bounds.height - visual.height) / 2 - visual.y;
|
|
1373
|
+
}
|
|
1374
|
+
if (operation.alignment === "bottom") {
|
|
1375
|
+
dy = bounds.y + bounds.height - visual.height - visual.y;
|
|
1376
|
+
}
|
|
1377
|
+
return {
|
|
1378
|
+
...(dx !== 0 ? { left: formatPx(geometry.x + dx) } : {}),
|
|
1379
|
+
...(dy !== 0 ? { top: formatPx(geometry.y + dy) } : {}),
|
|
1380
|
+
};
|
|
1381
|
+
});
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
case "distribute": {
|
|
1385
|
+
if (geometries.length < 3) {
|
|
1386
|
+
transformFailure(
|
|
1387
|
+
"Distribution requires at least three selected objects.",
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
const horizontal = operation.axis === "horizontal";
|
|
1391
|
+
const axis = horizontal ? "x" : "y";
|
|
1392
|
+
const size = horizontal ? "width" : "height";
|
|
1393
|
+
const visual = geometries.map(visualBounds);
|
|
1394
|
+
const ordered = geometries
|
|
1395
|
+
.map((geometry, index) => ({ geometry, visual: visual[index]!, index }))
|
|
1396
|
+
.sort(
|
|
1397
|
+
(left, right) =>
|
|
1398
|
+
left.visual[axis] - right.visual[axis] || left.index - right.index,
|
|
1399
|
+
);
|
|
1400
|
+
const start = Math.min(...visual.map((box) => box[axis]));
|
|
1401
|
+
const end = Math.max(...visual.map((box) => box[axis] + box[size]));
|
|
1402
|
+
const occupied = visual.reduce((sum, box) => sum + box[size], 0);
|
|
1403
|
+
const gap = (end - start - occupied) / (geometries.length - 1);
|
|
1404
|
+
let cursor = start;
|
|
1405
|
+
updates = geometries.map(() => ({}));
|
|
1406
|
+
for (const entry of ordered) {
|
|
1407
|
+
const visualOffset = entry.visual[axis] - entry.geometry[axis];
|
|
1408
|
+
updates[entry.index] = horizontal
|
|
1409
|
+
? { left: formatPx(cursor - visualOffset) }
|
|
1410
|
+
: { top: formatPx(cursor - visualOffset) };
|
|
1411
|
+
cursor += entry.visual[size] + gap;
|
|
1412
|
+
}
|
|
1413
|
+
break;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
return {
|
|
1417
|
+
mode: "edits",
|
|
1418
|
+
edits: makeEdits(targets, updates),
|
|
1419
|
+
targetCount: targets.length,
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
export default defineAction({
|
|
1424
|
+
title: "Transform slide objects",
|
|
1425
|
+
description:
|
|
1426
|
+
"Insert text or basic shapes, duplicate or delete one selected JSX object, or move, resize, rotate, align, distribute, group, ungroup, or reorder objects on a React source-backed slide. Insertion returns the new object ID and source locator; duplication returns the new locator and a remapped ID for editor-created objects. Duplicate/delete require the locator to match the current request-tab visual selection and its deck, slide, revision, source hash, and rendered-instance metadata; shared source callsites are rejected. Structural changes are source-validated and saved as one revision-checked replacement; geometric transforms keep their static absolute-pixel and same-parent requirements.",
|
|
1427
|
+
schema: z.object({
|
|
1428
|
+
deckId: z.string().min(1).describe("Deck containing the slide"),
|
|
1429
|
+
slideId: z.string().min(1).describe("Stable slide ID to transform"),
|
|
1430
|
+
expectedRevision: z
|
|
1431
|
+
.number()
|
|
1432
|
+
.int()
|
|
1433
|
+
.positive()
|
|
1434
|
+
.describe("Current slide revision returned by get-slide-source"),
|
|
1435
|
+
expectedSourceHash: z
|
|
1436
|
+
.string()
|
|
1437
|
+
.regex(/^[a-f0-9]{64}$/)
|
|
1438
|
+
.describe("Current SHA-256 sourceHash returned by get-slide-source"),
|
|
1439
|
+
operation: slideObjectTransformOperationSchema.describe(
|
|
1440
|
+
"One atomic source-backed canvas object operation; duplicate/delete locators come from current view-screen selection",
|
|
1441
|
+
),
|
|
1442
|
+
}),
|
|
1443
|
+
retrySafe: (input) => typeof input.expectedSourceHash === "string",
|
|
1444
|
+
http: { method: "POST" },
|
|
1445
|
+
mcpAnnotations: {
|
|
1446
|
+
readOnlyHint: false,
|
|
1447
|
+
destructiveHint: true,
|
|
1448
|
+
openWorldHint: false,
|
|
1449
|
+
},
|
|
1450
|
+
run: async (
|
|
1451
|
+
{ deckId, slideId, expectedRevision, expectedSourceHash, operation },
|
|
1452
|
+
ctx?: ActionRunContext,
|
|
1453
|
+
) => {
|
|
1454
|
+
if (operation.op === "duplicate" || operation.op === "delete") {
|
|
1455
|
+
await requireCurrentVisualSelection(
|
|
1456
|
+
deckId,
|
|
1457
|
+
slideId,
|
|
1458
|
+
expectedRevision,
|
|
1459
|
+
expectedSourceHash,
|
|
1460
|
+
operation.target,
|
|
1461
|
+
);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
let sourceRead: {
|
|
1465
|
+
slide: { sourceTsx: string; revision: number; sourceHash: string };
|
|
1466
|
+
};
|
|
1467
|
+
try {
|
|
1468
|
+
sourceRead = (await getSlideSource.run(
|
|
1469
|
+
{
|
|
1470
|
+
deckId,
|
|
1471
|
+
slideId,
|
|
1472
|
+
},
|
|
1473
|
+
ctx,
|
|
1474
|
+
)) as typeof sourceRead;
|
|
1475
|
+
} catch (error) {
|
|
1476
|
+
if (
|
|
1477
|
+
(error as { errorCode?: unknown })?.errorCode === "slide_source_missing"
|
|
1478
|
+
) {
|
|
1479
|
+
throw slideSourceFailure(
|
|
1480
|
+
"Canvas transforms in this action require a React source-backed slide. Legacy HTML slide transforms are not supported here.",
|
|
1481
|
+
409,
|
|
1482
|
+
"slide_transform_legacy_unsupported",
|
|
1483
|
+
);
|
|
1484
|
+
}
|
|
1485
|
+
throw error;
|
|
1486
|
+
}
|
|
1487
|
+
if (
|
|
1488
|
+
sourceRead.slide.revision !== expectedRevision ||
|
|
1489
|
+
sourceRead.slide.sourceHash !== expectedSourceHash
|
|
1490
|
+
) {
|
|
1491
|
+
sourceConflict(
|
|
1492
|
+
"Slide source changed after it was read. Call get-slide-source and rebase the transform.",
|
|
1493
|
+
{
|
|
1494
|
+
revision: sourceRead.slide.revision,
|
|
1495
|
+
sourceHash: sourceRead.slide.sourceHash,
|
|
1496
|
+
},
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
const plan = planSlideObjectTransform(
|
|
1501
|
+
sourceRead.slide.sourceTsx,
|
|
1502
|
+
operation,
|
|
1503
|
+
);
|
|
1504
|
+
const update = await updateSlideSource.run(
|
|
1505
|
+
{
|
|
1506
|
+
deckId,
|
|
1507
|
+
slideId,
|
|
1508
|
+
expectedRevision,
|
|
1509
|
+
expectedSourceHash,
|
|
1510
|
+
...(plan.mode === "source"
|
|
1511
|
+
? { sourceTsx: plan.sourceTsx }
|
|
1512
|
+
: { edits: plan.edits }),
|
|
1513
|
+
},
|
|
1514
|
+
ctx,
|
|
1515
|
+
);
|
|
1516
|
+
return {
|
|
1517
|
+
...(update as Record<string, unknown>),
|
|
1518
|
+
operation: operation.op,
|
|
1519
|
+
targetCount: plan.targetCount,
|
|
1520
|
+
...(plan.mode === "source" && plan.createdObjectId
|
|
1521
|
+
? { createdObjectId: plan.createdObjectId }
|
|
1522
|
+
: {}),
|
|
1523
|
+
...(plan.mode === "source" && plan.createdLocator
|
|
1524
|
+
? { createdLocator: plan.createdLocator }
|
|
1525
|
+
: {}),
|
|
1526
|
+
};
|
|
1527
|
+
},
|
|
1528
|
+
});
|