@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,1786 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
import { and, eq, inArray, isNull, or } from "drizzle-orm";
|
|
5
|
+
import { createElement, Fragment, type ReactNode } from "react";
|
|
6
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
7
|
+
|
|
8
|
+
import { getDb, schema } from "../db/index.js";
|
|
9
|
+
import { parseSource, walkAll } from "./slide-source-editing/babel-walk.js";
|
|
10
|
+
import {
|
|
11
|
+
isSlideSourceWithinByteLimit,
|
|
12
|
+
SLIDE_SOURCE_BYTE_LIMIT_MESSAGE,
|
|
13
|
+
} from "./slide-source-limits.js";
|
|
14
|
+
|
|
15
|
+
const MAX_RENDERED_LENGTH = 1024 * 1024;
|
|
16
|
+
const MAX_AST_NODES = 8_000;
|
|
17
|
+
const MAX_EVALUATED_VALUES = 32_000;
|
|
18
|
+
// Bound module expansion separately from persisted deck rendering.
|
|
19
|
+
const MAX_SOURCE_PAGES = 40;
|
|
20
|
+
const MAX_RENDER_DEPTH = 48;
|
|
21
|
+
const MAX_ASSET_COUNT = 64;
|
|
22
|
+
const ASSET_ID = /^[A-Za-z0-9_-]{1,200}$/;
|
|
23
|
+
|
|
24
|
+
const HTML_TAGS = new Set([
|
|
25
|
+
"a",
|
|
26
|
+
"article",
|
|
27
|
+
"aside",
|
|
28
|
+
"b",
|
|
29
|
+
"blockquote",
|
|
30
|
+
"br",
|
|
31
|
+
"caption",
|
|
32
|
+
"cite",
|
|
33
|
+
"code",
|
|
34
|
+
"dd",
|
|
35
|
+
"del",
|
|
36
|
+
"details",
|
|
37
|
+
"div",
|
|
38
|
+
"dl",
|
|
39
|
+
"dt",
|
|
40
|
+
"em",
|
|
41
|
+
"figcaption",
|
|
42
|
+
"figure",
|
|
43
|
+
"footer",
|
|
44
|
+
"h1",
|
|
45
|
+
"h2",
|
|
46
|
+
"h3",
|
|
47
|
+
"h4",
|
|
48
|
+
"h5",
|
|
49
|
+
"h6",
|
|
50
|
+
"header",
|
|
51
|
+
"hr",
|
|
52
|
+
"i",
|
|
53
|
+
"img",
|
|
54
|
+
"ins",
|
|
55
|
+
"kbd",
|
|
56
|
+
"li",
|
|
57
|
+
"main",
|
|
58
|
+
"mark",
|
|
59
|
+
"nav",
|
|
60
|
+
"ol",
|
|
61
|
+
"p",
|
|
62
|
+
"pre",
|
|
63
|
+
"q",
|
|
64
|
+
"s",
|
|
65
|
+
"section",
|
|
66
|
+
"small",
|
|
67
|
+
"span",
|
|
68
|
+
"strong",
|
|
69
|
+
"sub",
|
|
70
|
+
"sup",
|
|
71
|
+
"table",
|
|
72
|
+
"tbody",
|
|
73
|
+
"td",
|
|
74
|
+
"tfoot",
|
|
75
|
+
"th",
|
|
76
|
+
"thead",
|
|
77
|
+
"tr",
|
|
78
|
+
"u",
|
|
79
|
+
"ul",
|
|
80
|
+
"video",
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
const SVG_TAGS = new Set([
|
|
84
|
+
"svg",
|
|
85
|
+
"g",
|
|
86
|
+
"path",
|
|
87
|
+
"circle",
|
|
88
|
+
"ellipse",
|
|
89
|
+
"line",
|
|
90
|
+
"polygon",
|
|
91
|
+
"polyline",
|
|
92
|
+
"rect",
|
|
93
|
+
"text",
|
|
94
|
+
"tspan",
|
|
95
|
+
"defs",
|
|
96
|
+
"linearGradient",
|
|
97
|
+
"radialGradient",
|
|
98
|
+
"stop",
|
|
99
|
+
"clipPath",
|
|
100
|
+
"mask",
|
|
101
|
+
"pattern",
|
|
102
|
+
"marker",
|
|
103
|
+
"symbol",
|
|
104
|
+
"use",
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
const SAFE_ATTRS = new Set([
|
|
108
|
+
"alt",
|
|
109
|
+
"align",
|
|
110
|
+
"aria-label",
|
|
111
|
+
"aria-hidden",
|
|
112
|
+
"aria-roledescription",
|
|
113
|
+
"autoPlay",
|
|
114
|
+
"colSpan",
|
|
115
|
+
"controls",
|
|
116
|
+
"cx",
|
|
117
|
+
"cy",
|
|
118
|
+
"d",
|
|
119
|
+
"decoding",
|
|
120
|
+
"dir",
|
|
121
|
+
"draggable",
|
|
122
|
+
"fill",
|
|
123
|
+
"fillOpacity",
|
|
124
|
+
"fillRule",
|
|
125
|
+
"focusable",
|
|
126
|
+
"fontFamily",
|
|
127
|
+
"fontSize",
|
|
128
|
+
"fontWeight",
|
|
129
|
+
"height",
|
|
130
|
+
"hidden",
|
|
131
|
+
"href",
|
|
132
|
+
"htmlFor",
|
|
133
|
+
"id",
|
|
134
|
+
"lang",
|
|
135
|
+
"loading",
|
|
136
|
+
"loop",
|
|
137
|
+
"markerEnd",
|
|
138
|
+
"markerStart",
|
|
139
|
+
"muted",
|
|
140
|
+
"markerMid",
|
|
141
|
+
"offset",
|
|
142
|
+
"opacity",
|
|
143
|
+
"points",
|
|
144
|
+
"preserveAspectRatio",
|
|
145
|
+
"playsInline",
|
|
146
|
+
"poster",
|
|
147
|
+
"preload",
|
|
148
|
+
"r",
|
|
149
|
+
"rel",
|
|
150
|
+
"role",
|
|
151
|
+
"rowSpan",
|
|
152
|
+
"scope",
|
|
153
|
+
"shapeRendering",
|
|
154
|
+
"stroke",
|
|
155
|
+
"strokeDasharray",
|
|
156
|
+
"strokeDashoffset",
|
|
157
|
+
"strokeLinecap",
|
|
158
|
+
"strokeLinejoin",
|
|
159
|
+
"strokeOpacity",
|
|
160
|
+
"strokeWidth",
|
|
161
|
+
"stopColor",
|
|
162
|
+
"stopOpacity",
|
|
163
|
+
"tabIndex",
|
|
164
|
+
"target",
|
|
165
|
+
"textAnchor",
|
|
166
|
+
"title",
|
|
167
|
+
"transform",
|
|
168
|
+
"vectorEffect",
|
|
169
|
+
"viewBox",
|
|
170
|
+
"width",
|
|
171
|
+
"x",
|
|
172
|
+
"x1",
|
|
173
|
+
"x2",
|
|
174
|
+
"y",
|
|
175
|
+
"y1",
|
|
176
|
+
"y2",
|
|
177
|
+
"xmlns",
|
|
178
|
+
]);
|
|
179
|
+
|
|
180
|
+
const ATTR_ALIASES: Record<string, string> = {
|
|
181
|
+
class: "className",
|
|
182
|
+
for: "htmlFor",
|
|
183
|
+
"stroke-width": "strokeWidth",
|
|
184
|
+
"stroke-linecap": "strokeLinecap",
|
|
185
|
+
"stroke-linejoin": "strokeLinejoin",
|
|
186
|
+
"stroke-dasharray": "strokeDasharray",
|
|
187
|
+
"stroke-dashoffset": "strokeDashoffset",
|
|
188
|
+
"fill-rule": "fillRule",
|
|
189
|
+
"fill-opacity": "fillOpacity",
|
|
190
|
+
"stroke-opacity": "strokeOpacity",
|
|
191
|
+
"text-anchor": "textAnchor",
|
|
192
|
+
"shape-rendering": "shapeRendering",
|
|
193
|
+
"vector-effect": "vectorEffect",
|
|
194
|
+
"preserve-aspect-ratio": "preserveAspectRatio",
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const SAFE_STYLE_FUNCTIONS = new Set([
|
|
198
|
+
"calc",
|
|
199
|
+
"clamp",
|
|
200
|
+
"color",
|
|
201
|
+
"color-mix",
|
|
202
|
+
"conic-gradient",
|
|
203
|
+
"hsl",
|
|
204
|
+
"hsla",
|
|
205
|
+
"hwb",
|
|
206
|
+
"lab",
|
|
207
|
+
"lch",
|
|
208
|
+
"linear-gradient",
|
|
209
|
+
"max",
|
|
210
|
+
"matrix",
|
|
211
|
+
"matrix3d",
|
|
212
|
+
"min",
|
|
213
|
+
"oklab",
|
|
214
|
+
"oklch",
|
|
215
|
+
"circle",
|
|
216
|
+
"ellipse",
|
|
217
|
+
"inset",
|
|
218
|
+
"polygon",
|
|
219
|
+
"radial-gradient",
|
|
220
|
+
"repeating-conic-gradient",
|
|
221
|
+
"repeating-linear-gradient",
|
|
222
|
+
"repeating-radial-gradient",
|
|
223
|
+
"rgb",
|
|
224
|
+
"rgba",
|
|
225
|
+
"rotate",
|
|
226
|
+
"rotatex",
|
|
227
|
+
"rotatey",
|
|
228
|
+
"rotatez",
|
|
229
|
+
"scale",
|
|
230
|
+
"scalex",
|
|
231
|
+
"scaley",
|
|
232
|
+
"scalez",
|
|
233
|
+
"skew",
|
|
234
|
+
"skewx",
|
|
235
|
+
"skewy",
|
|
236
|
+
"translate",
|
|
237
|
+
"translatex",
|
|
238
|
+
"translatey",
|
|
239
|
+
"translatez",
|
|
240
|
+
"var",
|
|
241
|
+
]);
|
|
242
|
+
const GRID_TRACK_STYLE_KEYS = new Set([
|
|
243
|
+
"gridAutoColumns",
|
|
244
|
+
"gridAutoRows",
|
|
245
|
+
"gridTemplateColumns",
|
|
246
|
+
"gridTemplateRows",
|
|
247
|
+
]);
|
|
248
|
+
const CSS_GRID_TRACK_SIZE =
|
|
249
|
+
/^(?:0|(?:\d+(?:\.\d+)?|\.\d+)(?:px|fr|%|rem|em)|auto|min-content|max-content)$/i;
|
|
250
|
+
const MAX_GRID_TRACK_LIST_LENGTH = 512;
|
|
251
|
+
const MAX_GRID_TRACKS = 24;
|
|
252
|
+
const MAX_GRID_REPEAT_COUNT = 12;
|
|
253
|
+
const MAX_FILTER_BLUR_PX = 64;
|
|
254
|
+
const MAX_STATIC_MASK_LENGTH = 128;
|
|
255
|
+
const SAFE_VAR_REFERENCE = /var\(\s*--(?:deck|ds)-[A-Za-z0-9_-]+\s*\)/gi;
|
|
256
|
+
const CSS_FUNCTION = /([a-z][a-z0-9-]*)\s*\(/gi;
|
|
257
|
+
const QUOTED_STYLE_KEYS = new Set(["font", "fontFamily"]);
|
|
258
|
+
const SVG_LOCAL_REFERENCE_STYLE_KEYS = new Set([
|
|
259
|
+
"clipPath",
|
|
260
|
+
"fill",
|
|
261
|
+
"markerEnd",
|
|
262
|
+
"markerMid",
|
|
263
|
+
"markerStart",
|
|
264
|
+
"mask",
|
|
265
|
+
"stroke",
|
|
266
|
+
]);
|
|
267
|
+
const SVG_LOCAL_REFERENCE_ATTRS = new Set([
|
|
268
|
+
"fill",
|
|
269
|
+
"markerEnd",
|
|
270
|
+
"markerMid",
|
|
271
|
+
"markerStart",
|
|
272
|
+
"stroke",
|
|
273
|
+
]);
|
|
274
|
+
const RESOURCE_STYLE_KEYS = new Set([
|
|
275
|
+
"borderImage",
|
|
276
|
+
"borderImageSource",
|
|
277
|
+
"content",
|
|
278
|
+
"cursor",
|
|
279
|
+
"filter",
|
|
280
|
+
"listStyle",
|
|
281
|
+
"listStyleImage",
|
|
282
|
+
"mask",
|
|
283
|
+
"maskBorder",
|
|
284
|
+
"maskBorderSource",
|
|
285
|
+
"maskImage",
|
|
286
|
+
"offsetPath",
|
|
287
|
+
"shapeOutside",
|
|
288
|
+
"backdropFilter",
|
|
289
|
+
]);
|
|
290
|
+
const VARIABLE_IMAGE_STYLE_KEYS = new Set([
|
|
291
|
+
"background",
|
|
292
|
+
"backgroundImage",
|
|
293
|
+
"clipPath",
|
|
294
|
+
"fill",
|
|
295
|
+
"markerEnd",
|
|
296
|
+
"markerMid",
|
|
297
|
+
"markerStart",
|
|
298
|
+
"stroke",
|
|
299
|
+
]);
|
|
300
|
+
const SAFE_STYLE_KEY = /^(?:[a-z][A-Za-z0-9]*|--[A-Za-z0-9_-]+)$/;
|
|
301
|
+
const SAFE_THEME_VARIABLE = /^var\(\s*--(?:deck|ds)-[A-Za-z0-9_-]+\s*\)$/i;
|
|
302
|
+
const SAFE_THEME_COLOR_VARIABLES = new Set([
|
|
303
|
+
"--cs-clay",
|
|
304
|
+
"--cs-forest",
|
|
305
|
+
"--cs-peach",
|
|
306
|
+
"--deck-accent",
|
|
307
|
+
"--deck-bg",
|
|
308
|
+
"--deck-ink",
|
|
309
|
+
"--deck-muted",
|
|
310
|
+
"--deck-surface",
|
|
311
|
+
"--deck-text",
|
|
312
|
+
"--ds-accent",
|
|
313
|
+
"--ds-bg",
|
|
314
|
+
"--ds-surface",
|
|
315
|
+
"--ds-text",
|
|
316
|
+
"--ds-text-muted",
|
|
317
|
+
"--qt-amber",
|
|
318
|
+
"--qt-grid",
|
|
319
|
+
"--qt-loss",
|
|
320
|
+
"--up-line",
|
|
321
|
+
"--up-ok",
|
|
322
|
+
"--up-risk",
|
|
323
|
+
"--up-warn",
|
|
324
|
+
"--ws-dot",
|
|
325
|
+
"--ws-mint",
|
|
326
|
+
"--ws-peach",
|
|
327
|
+
"--ws-pink",
|
|
328
|
+
"--ws-sky",
|
|
329
|
+
]);
|
|
330
|
+
const SAFE_THEME_FONT_VARIABLES = new Set([
|
|
331
|
+
"--deck-body-font",
|
|
332
|
+
"--deck-display-font",
|
|
333
|
+
"--deck-heading-font",
|
|
334
|
+
]);
|
|
335
|
+
|
|
336
|
+
export class SlideSourceError extends Error {
|
|
337
|
+
readonly statusCode = 422;
|
|
338
|
+
readonly errorCode = "invalid_slide_source";
|
|
339
|
+
|
|
340
|
+
constructor(message: string) {
|
|
341
|
+
super(message);
|
|
342
|
+
this.name = "SlideSourceError";
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function hashSlideSource(sourceTsx: string): string {
|
|
347
|
+
return createHash("sha256").update(sourceTsx, "utf8").digest("hex");
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface StaticSlidePageSource {
|
|
351
|
+
sourceTsx: string;
|
|
352
|
+
notes?: string;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export function findStaticLocalPageArray(
|
|
356
|
+
ast: t.File,
|
|
357
|
+
expression: t.Node,
|
|
358
|
+
): t.ArrayExpression | null {
|
|
359
|
+
const candidate = unwrapTypeScriptExpression(expression);
|
|
360
|
+
if (!t.isIdentifier(candidate)) return null;
|
|
361
|
+
|
|
362
|
+
for (const statement of ast.program.body) {
|
|
363
|
+
const declaration = t.isExportNamedDeclaration(statement)
|
|
364
|
+
? statement.declaration
|
|
365
|
+
: statement;
|
|
366
|
+
if (!t.isVariableDeclaration(declaration) || declaration.kind !== "const")
|
|
367
|
+
continue;
|
|
368
|
+
|
|
369
|
+
const binding = declaration.declarations.find(
|
|
370
|
+
(item) => t.isIdentifier(item.id) && item.id.name === candidate.name,
|
|
371
|
+
);
|
|
372
|
+
if (!binding?.init) continue;
|
|
373
|
+
const initializer = unwrapTypeScriptExpression(binding.init);
|
|
374
|
+
return t.isArrayExpression(initializer) ? initializer : null;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export function splitSlideSourcePages(
|
|
381
|
+
sourceTsx: string,
|
|
382
|
+
): StaticSlidePageSource[] {
|
|
383
|
+
const ast = parse(sourceTsx);
|
|
384
|
+
const defaultExport = ast.program.body.find(t.isExportDefaultDeclaration);
|
|
385
|
+
if (!defaultExport || !t.isExportDefaultDeclaration(defaultExport)) {
|
|
386
|
+
throw new SlideSourceError(
|
|
387
|
+
"Slide source must have a default component export.",
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
let declaration = unwrapTypeScriptExpression(defaultExport.declaration);
|
|
392
|
+
const localPageArray = findStaticLocalPageArray(ast, declaration);
|
|
393
|
+
if (localPageArray) declaration = localPageArray;
|
|
394
|
+
let pageExpressions: t.Node[];
|
|
395
|
+
if (!t.isArrayExpression(declaration)) {
|
|
396
|
+
if (
|
|
397
|
+
t.isIdentifier(declaration) ||
|
|
398
|
+
t.isArrowFunctionExpression(declaration) ||
|
|
399
|
+
t.isFunctionExpression(declaration) ||
|
|
400
|
+
t.isFunctionDeclaration(declaration)
|
|
401
|
+
) {
|
|
402
|
+
pageExpressions = [declaration];
|
|
403
|
+
} else {
|
|
404
|
+
throw new SlideSourceError(
|
|
405
|
+
"Default export must be a static component or a static local Page array.",
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
if (
|
|
410
|
+
declaration.elements.length === 0 ||
|
|
411
|
+
declaration.elements.length > MAX_SOURCE_PAGES
|
|
412
|
+
) {
|
|
413
|
+
throw new SlideSourceError(
|
|
414
|
+
`A source module must contain between 1 and ${MAX_SOURCE_PAGES} static pages.`,
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
pageExpressions = declaration.elements.map((page) => {
|
|
418
|
+
if (!page || t.isSpreadElement(page) || t.isJSXNamespacedName(page)) {
|
|
419
|
+
throw new SlideSourceError(
|
|
420
|
+
"Page arrays must contain explicit local components.",
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
let component = page;
|
|
424
|
+
while (
|
|
425
|
+
t.isTSAsExpression(component) ||
|
|
426
|
+
t.isTSTypeAssertion(component) ||
|
|
427
|
+
t.isTSNonNullExpression(component) ||
|
|
428
|
+
t.isTSSatisfiesExpression(component)
|
|
429
|
+
) {
|
|
430
|
+
component = component.expression;
|
|
431
|
+
}
|
|
432
|
+
if (
|
|
433
|
+
!t.isIdentifier(component) &&
|
|
434
|
+
!t.isArrowFunctionExpression(component) &&
|
|
435
|
+
!t.isFunctionExpression(component)
|
|
436
|
+
) {
|
|
437
|
+
throw new SlideSourceError(
|
|
438
|
+
"Page arrays may contain only local component functions or names.",
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
return component;
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const moduleNotes = readModuleNotes(ast, pageExpressions.length);
|
|
446
|
+
const componentTransitions = readComponentTransitions(ast, pageExpressions);
|
|
447
|
+
return pageExpressions.map((component, index) => {
|
|
448
|
+
const declarationStart = defaultExport.declaration.start;
|
|
449
|
+
const declarationEnd = defaultExport.declaration.end;
|
|
450
|
+
if (
|
|
451
|
+
declarationStart == null ||
|
|
452
|
+
declarationEnd == null ||
|
|
453
|
+
component.start == null ||
|
|
454
|
+
component.end == null
|
|
455
|
+
) {
|
|
456
|
+
throw new SlideSourceError(
|
|
457
|
+
"Slide source page locations are unavailable.",
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
const edits: Array<{ start: number; end: number; replacement: string }> =
|
|
461
|
+
[];
|
|
462
|
+
if (t.isArrayExpression(declaration)) {
|
|
463
|
+
edits.push({
|
|
464
|
+
start: declarationStart,
|
|
465
|
+
end: declarationEnd,
|
|
466
|
+
replacement: sourceTsx.slice(component.start, component.end),
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
for (const assignment of componentTransitions.assignments) {
|
|
470
|
+
if (assignment.start == null || assignment.end == null) {
|
|
471
|
+
throw new SlideSourceError(
|
|
472
|
+
"A page transition assignment has no source location.",
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
edits.push({
|
|
476
|
+
start: assignment.start,
|
|
477
|
+
end: assignment.end,
|
|
478
|
+
replacement: sourceTsx
|
|
479
|
+
.slice(assignment.start, assignment.end)
|
|
480
|
+
.replace(/[^\n]/g, " "),
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
const pageTransition = componentTransitions.byPage.get(
|
|
484
|
+
getComponentName(component) ?? "",
|
|
485
|
+
);
|
|
486
|
+
if (pageTransition) {
|
|
487
|
+
if (pageTransition.start == null || pageTransition.end == null) {
|
|
488
|
+
throw new SlideSourceError("A page transition has no source location.");
|
|
489
|
+
}
|
|
490
|
+
const transitionExport = componentTransitions.exportedTransition;
|
|
491
|
+
if (
|
|
492
|
+
transitionExport &&
|
|
493
|
+
transitionExport.start != null &&
|
|
494
|
+
transitionExport.end != null
|
|
495
|
+
) {
|
|
496
|
+
edits.push({
|
|
497
|
+
start: transitionExport.start,
|
|
498
|
+
end: transitionExport.end,
|
|
499
|
+
replacement: sourceTsx.slice(
|
|
500
|
+
pageTransition.start,
|
|
501
|
+
pageTransition.end,
|
|
502
|
+
),
|
|
503
|
+
});
|
|
504
|
+
} else {
|
|
505
|
+
edits.push({
|
|
506
|
+
start: sourceTsx.length,
|
|
507
|
+
end: sourceTsx.length,
|
|
508
|
+
replacement: `\nexport const transition = ${sourceTsx.slice(pageTransition.start, pageTransition.end)};\n`,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (moduleNotes.exportNode) {
|
|
513
|
+
const notesDeclaration = moduleNotes.exportNode.declaration;
|
|
514
|
+
if (
|
|
515
|
+
!notesDeclaration ||
|
|
516
|
+
moduleNotes.exportNode.start == null ||
|
|
517
|
+
notesDeclaration.start == null
|
|
518
|
+
) {
|
|
519
|
+
throw new SlideSourceError(
|
|
520
|
+
"Speaker notes export has no source location.",
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
edits.push({
|
|
524
|
+
start: moduleNotes.exportNode.start,
|
|
525
|
+
end: notesDeclaration.start,
|
|
526
|
+
replacement: "",
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
let pageSource = sourceTsx;
|
|
530
|
+
for (const edit of edits.sort((a, b) => b.start - a.start)) {
|
|
531
|
+
pageSource =
|
|
532
|
+
pageSource.slice(0, edit.start) +
|
|
533
|
+
edit.replacement +
|
|
534
|
+
pageSource.slice(edit.end);
|
|
535
|
+
}
|
|
536
|
+
return {
|
|
537
|
+
sourceTsx: pageSource,
|
|
538
|
+
...(moduleNotes.values ? { notes: moduleNotes.values[index] ?? "" } : {}),
|
|
539
|
+
};
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function unwrapTypeScriptExpression(expression: t.Node): t.Node {
|
|
544
|
+
let current = expression;
|
|
545
|
+
while (
|
|
546
|
+
t.isTSAsExpression(current) ||
|
|
547
|
+
t.isTSTypeAssertion(current) ||
|
|
548
|
+
t.isTSNonNullExpression(current) ||
|
|
549
|
+
t.isTSSatisfiesExpression(current)
|
|
550
|
+
) {
|
|
551
|
+
current = current.expression;
|
|
552
|
+
}
|
|
553
|
+
return current;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function readComponentTransitions(
|
|
557
|
+
ast: t.File,
|
|
558
|
+
pages: t.Node[],
|
|
559
|
+
): {
|
|
560
|
+
assignments: t.ExpressionStatement[];
|
|
561
|
+
byPage: Map<string, t.Expression>;
|
|
562
|
+
exportedTransition?: t.Expression;
|
|
563
|
+
} {
|
|
564
|
+
const pageNames = new Set(
|
|
565
|
+
pages.map(getComponentName).filter((name): name is string => name !== null),
|
|
566
|
+
);
|
|
567
|
+
const assignments: t.ExpressionStatement[] = [];
|
|
568
|
+
const byPage = new Map<string, t.Expression>();
|
|
569
|
+
for (const statement of ast.program.body) {
|
|
570
|
+
if (
|
|
571
|
+
!t.isExpressionStatement(statement) ||
|
|
572
|
+
!t.isAssignmentExpression(statement.expression)
|
|
573
|
+
)
|
|
574
|
+
continue;
|
|
575
|
+
const assignment = statement.expression;
|
|
576
|
+
const left = assignment.left;
|
|
577
|
+
if (
|
|
578
|
+
assignment.operator !== "=" ||
|
|
579
|
+
!t.isMemberExpression(left) ||
|
|
580
|
+
left.computed ||
|
|
581
|
+
!t.isIdentifier(left.object) ||
|
|
582
|
+
!t.isIdentifier(left.property) ||
|
|
583
|
+
left.property.name !== "transition" ||
|
|
584
|
+
!pageNames.has(left.object.name)
|
|
585
|
+
) {
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
assignments.push(statement);
|
|
589
|
+
byPage.set(left.object.name, assignment.right as t.Expression);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
let exportedTransition: t.Expression | undefined;
|
|
593
|
+
for (const statement of ast.program.body) {
|
|
594
|
+
if (
|
|
595
|
+
!t.isExportNamedDeclaration(statement) ||
|
|
596
|
+
!t.isVariableDeclaration(statement.declaration)
|
|
597
|
+
)
|
|
598
|
+
continue;
|
|
599
|
+
for (const declaration of statement.declaration.declarations) {
|
|
600
|
+
if (
|
|
601
|
+
t.isIdentifier(declaration.id) &&
|
|
602
|
+
declaration.id.name === "transition" &&
|
|
603
|
+
declaration.init
|
|
604
|
+
) {
|
|
605
|
+
exportedTransition = declaration.init as t.Expression;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return { assignments, byPage, exportedTransition };
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function getComponentName(node: t.Node): string | null {
|
|
613
|
+
if (t.isIdentifier(node)) return node.name;
|
|
614
|
+
if (
|
|
615
|
+
(t.isFunctionExpression(node) || t.isFunctionDeclaration(node)) &&
|
|
616
|
+
node.id
|
|
617
|
+
) {
|
|
618
|
+
return node.id.name;
|
|
619
|
+
}
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function readModuleNotes(
|
|
624
|
+
ast: t.File,
|
|
625
|
+
pageCount: number,
|
|
626
|
+
): { exportNode?: t.ExportNamedDeclaration; values?: string[] } {
|
|
627
|
+
const notesExports = ast.program.body.filter(
|
|
628
|
+
(statement): statement is t.ExportNamedDeclaration => {
|
|
629
|
+
if (
|
|
630
|
+
!t.isExportNamedDeclaration(statement) ||
|
|
631
|
+
!t.isVariableDeclaration(statement.declaration)
|
|
632
|
+
) {
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
return statement.declaration.declarations.some(
|
|
636
|
+
(declaration) =>
|
|
637
|
+
t.isIdentifier(declaration.id) && declaration.id.name === "notes",
|
|
638
|
+
);
|
|
639
|
+
},
|
|
640
|
+
);
|
|
641
|
+
if (notesExports.length === 0) return {};
|
|
642
|
+
if (notesExports.length !== 1)
|
|
643
|
+
throw new SlideSourceError(
|
|
644
|
+
"Slide source may contain only one notes export.",
|
|
645
|
+
);
|
|
646
|
+
|
|
647
|
+
const exportNode = notesExports[0]!;
|
|
648
|
+
const declaration = exportNode.declaration;
|
|
649
|
+
if (
|
|
650
|
+
!t.isVariableDeclaration(declaration) ||
|
|
651
|
+
declaration.kind !== "const" ||
|
|
652
|
+
declaration.declarations.length !== 1
|
|
653
|
+
) {
|
|
654
|
+
throw new SlideSourceError(
|
|
655
|
+
"Speaker notes must be one static const array export.",
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
const notesDeclaration = declaration.declarations[0]!;
|
|
659
|
+
if (
|
|
660
|
+
!t.isIdentifier(notesDeclaration.id) ||
|
|
661
|
+
notesDeclaration.id.name !== "notes" ||
|
|
662
|
+
!t.isArrayExpression(notesDeclaration.init)
|
|
663
|
+
) {
|
|
664
|
+
throw new SlideSourceError("Speaker notes must be a static string array.");
|
|
665
|
+
}
|
|
666
|
+
if (notesDeclaration.init.elements.length > pageCount) {
|
|
667
|
+
throw new SlideSourceError(
|
|
668
|
+
"Speaker notes cannot contain more entries than the slide page array.",
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
const values = notesDeclaration.init.elements.map((entry) => {
|
|
672
|
+
if (!entry) return "";
|
|
673
|
+
if (t.isIdentifier(entry, { name: "undefined" }) || t.isNullLiteral(entry))
|
|
674
|
+
return "";
|
|
675
|
+
if (t.isStringLiteral(entry)) return entry.value;
|
|
676
|
+
if (t.isTemplateLiteral(entry) && entry.expressions.length === 0) {
|
|
677
|
+
const value = entry.quasis[0]?.value.cooked;
|
|
678
|
+
if (value !== null && value !== undefined) return value;
|
|
679
|
+
}
|
|
680
|
+
throw new SlideSourceError(
|
|
681
|
+
"Speaker notes entries must be static strings or empty values.",
|
|
682
|
+
);
|
|
683
|
+
});
|
|
684
|
+
return { exportNode, values };
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export function collectSlideAssetIds(sourceTsx: string): string[] {
|
|
688
|
+
const ast = parse(sourceTsx);
|
|
689
|
+
const ids = new Set<string>();
|
|
690
|
+
|
|
691
|
+
walkAll(ast, (node) => {
|
|
692
|
+
if (!t.isJSXElement(node)) return;
|
|
693
|
+
for (const attribute of node.openingElement.attributes) {
|
|
694
|
+
if (!t.isJSXAttribute(attribute) || !t.isJSXIdentifier(attribute.name))
|
|
695
|
+
continue;
|
|
696
|
+
if (
|
|
697
|
+
attribute.name.name !== "src" &&
|
|
698
|
+
!(
|
|
699
|
+
attribute.name.name === "poster" &&
|
|
700
|
+
jsxTagName(node.openingElement.name) === "video"
|
|
701
|
+
)
|
|
702
|
+
) {
|
|
703
|
+
continue;
|
|
704
|
+
}
|
|
705
|
+
const value = jsxAttributeLiteral(attribute);
|
|
706
|
+
if (typeof value !== "string") {
|
|
707
|
+
throw new SlideSourceError(
|
|
708
|
+
`${attribute.name.name} must use an asset:// reference.`,
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
if (!value.startsWith("asset://")) {
|
|
712
|
+
throw new SlideSourceError(
|
|
713
|
+
`${attribute.name.name} must use an asset:// reference.`,
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
const id = value.slice("asset://".length);
|
|
717
|
+
if (!ASSET_ID.test(id))
|
|
718
|
+
throw new SlideSourceError("Invalid asset handle.");
|
|
719
|
+
ids.add(id);
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
if (ids.size > MAX_ASSET_COUNT) {
|
|
724
|
+
throw new SlideSourceError(
|
|
725
|
+
`A slide can reference at most ${MAX_ASSET_COUNT} uploaded assets.`,
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
return [...ids];
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export async function resolveSlideAssets(
|
|
732
|
+
sourceTsx: string,
|
|
733
|
+
scope: { ownerEmail: string; orgId?: string | null },
|
|
734
|
+
): Promise<Map<string, string>> {
|
|
735
|
+
const ids = collectSlideAssetIds(sourceTsx);
|
|
736
|
+
if (ids.length === 0) return new Map();
|
|
737
|
+
|
|
738
|
+
const ownerScope = and(
|
|
739
|
+
eq(schema.uploadedAssets.ownerEmail, scope.ownerEmail),
|
|
740
|
+
scope.orgId
|
|
741
|
+
? eq(schema.uploadedAssets.orgId, scope.orgId)
|
|
742
|
+
: isNull(schema.uploadedAssets.orgId),
|
|
743
|
+
);
|
|
744
|
+
const assetScope = scope.orgId
|
|
745
|
+
? or(ownerScope, eq(schema.uploadedAssets.orgId, scope.orgId))
|
|
746
|
+
: ownerScope;
|
|
747
|
+
|
|
748
|
+
const rows = await getDb()
|
|
749
|
+
.select({ id: schema.uploadedAssets.id, url: schema.uploadedAssets.url })
|
|
750
|
+
.from(schema.uploadedAssets)
|
|
751
|
+
.where(and(inArray(schema.uploadedAssets.id, ids), assetScope));
|
|
752
|
+
const resolved = new Map<string, string>();
|
|
753
|
+
for (const row of rows) {
|
|
754
|
+
resolved.set(row.id, assertStoredAssetUrl(row.url));
|
|
755
|
+
}
|
|
756
|
+
const missing = ids.filter((id) => !resolved.has(id));
|
|
757
|
+
if (missing.length) {
|
|
758
|
+
throw Object.assign(
|
|
759
|
+
new Error("One or more slide assets are unavailable to this deck."),
|
|
760
|
+
{ statusCode: 404, errorCode: "slide_asset_unavailable" },
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
return resolved;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export function slideAssetOrigins(assetUrls: Iterable<string>): string[] {
|
|
767
|
+
const origins = new Set<string>();
|
|
768
|
+
for (const url of assetUrls) {
|
|
769
|
+
const parsed = new URL(url);
|
|
770
|
+
origins.add(parsed.origin);
|
|
771
|
+
}
|
|
772
|
+
return [...origins].sort();
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export function renderSlideSource(
|
|
776
|
+
sourceTsx: string,
|
|
777
|
+
assetUrls: ReadonlyMap<string, string>,
|
|
778
|
+
): string {
|
|
779
|
+
const ast = parse(sourceTsx);
|
|
780
|
+
const renderer = new StaticSlideRenderer(ast, assetUrls);
|
|
781
|
+
const markup = renderToStaticMarkup(renderer.render());
|
|
782
|
+
if (markup.length > MAX_RENDERED_LENGTH) {
|
|
783
|
+
throw new SlideSourceError("Rendered slide is too large.");
|
|
784
|
+
}
|
|
785
|
+
if (
|
|
786
|
+
/<\/?(?:script|style|iframe|frame|object|embed|link|meta|base|form|input|audio)\b/i.test(
|
|
787
|
+
markup,
|
|
788
|
+
)
|
|
789
|
+
) {
|
|
790
|
+
throw new SlideSourceError("Rendered slide contains a disallowed element.");
|
|
791
|
+
}
|
|
792
|
+
return markup;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function assertStoredAssetUrl(value: string): string {
|
|
796
|
+
let parsed: URL;
|
|
797
|
+
try {
|
|
798
|
+
parsed = new URL(value);
|
|
799
|
+
} catch {
|
|
800
|
+
throw Object.assign(new Error("Uploaded asset URL is invalid."), {
|
|
801
|
+
statusCode: 422,
|
|
802
|
+
errorCode: "invalid_stored_slide_asset",
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
if (
|
|
806
|
+
parsed.protocol !== "https:" &&
|
|
807
|
+
!(parsed.protocol === "http:" && isLocalHost(parsed.hostname))
|
|
808
|
+
) {
|
|
809
|
+
throw Object.assign(
|
|
810
|
+
new Error("Uploaded asset URL must use HTTPS or the local app origin."),
|
|
811
|
+
{
|
|
812
|
+
statusCode: 422,
|
|
813
|
+
errorCode: "invalid_stored_slide_asset",
|
|
814
|
+
},
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
return parsed.href;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function isLocalHost(hostname: string): boolean {
|
|
821
|
+
return (
|
|
822
|
+
hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]"
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function parse(sourceTsx: string): t.File {
|
|
827
|
+
if (!sourceTsx.trim() || !isSlideSourceWithinByteLimit(sourceTsx)) {
|
|
828
|
+
throw new SlideSourceError(SLIDE_SOURCE_BYTE_LIMIT_MESSAGE);
|
|
829
|
+
}
|
|
830
|
+
const ast = parseSource(sourceTsx);
|
|
831
|
+
if (!ast) throw new SlideSourceError("Slide source has a syntax error.");
|
|
832
|
+
let count = 0;
|
|
833
|
+
walkAll(ast, () => {
|
|
834
|
+
count += 1;
|
|
835
|
+
if (count > MAX_AST_NODES)
|
|
836
|
+
throw new SlideSourceError("Slide source is too complex.");
|
|
837
|
+
});
|
|
838
|
+
return ast;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function jsxAttributeLiteral(attribute: t.JSXAttribute): unknown {
|
|
842
|
+
if (!attribute.value) return true;
|
|
843
|
+
if (t.isStringLiteral(attribute.value)) return attribute.value.value;
|
|
844
|
+
if (
|
|
845
|
+
t.isJSXExpressionContainer(attribute.value) &&
|
|
846
|
+
t.isStringLiteral(attribute.value.expression)
|
|
847
|
+
) {
|
|
848
|
+
return attribute.value.expression.value;
|
|
849
|
+
}
|
|
850
|
+
return undefined;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
class StaticFunction {
|
|
854
|
+
constructor(
|
|
855
|
+
readonly node:
|
|
856
|
+
| t.ArrowFunctionExpression
|
|
857
|
+
| t.FunctionExpression
|
|
858
|
+
| t.FunctionDeclaration,
|
|
859
|
+
readonly closure: Map<string, unknown>,
|
|
860
|
+
) {}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
class StaticSlideRenderer {
|
|
864
|
+
private readonly components = new Map<string, StaticFunction>();
|
|
865
|
+
private readonly variables = new Map<string, unknown>();
|
|
866
|
+
private renderedNodeCount = 0;
|
|
867
|
+
private evaluatedValueCount = 0;
|
|
868
|
+
|
|
869
|
+
constructor(
|
|
870
|
+
private readonly ast: t.File,
|
|
871
|
+
private readonly assetUrls: ReadonlyMap<string, string>,
|
|
872
|
+
) {
|
|
873
|
+
this.prepareProgram();
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
render(): ReactNode {
|
|
877
|
+
const declaration = this.defaultExport();
|
|
878
|
+
const component = this.toStaticFunction(declaration, this.variables);
|
|
879
|
+
if (!component)
|
|
880
|
+
throw new SlideSourceError(
|
|
881
|
+
"Default export must be a local slide component.",
|
|
882
|
+
);
|
|
883
|
+
const output = this.invoke(component, [{}], 0);
|
|
884
|
+
return this.asChild(output);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
private prepareProgram(): void {
|
|
888
|
+
let defaultCount = 0;
|
|
889
|
+
for (const statement of this.ast.program.body) {
|
|
890
|
+
if (t.isExportDefaultDeclaration(statement)) {
|
|
891
|
+
defaultCount += 1;
|
|
892
|
+
continue;
|
|
893
|
+
}
|
|
894
|
+
if (
|
|
895
|
+
t.isTSInterfaceDeclaration(statement) ||
|
|
896
|
+
t.isTSTypeAliasDeclaration(statement)
|
|
897
|
+
)
|
|
898
|
+
continue;
|
|
899
|
+
if (t.isFunctionDeclaration(statement)) {
|
|
900
|
+
if (!statement.id)
|
|
901
|
+
throw new SlideSourceError(
|
|
902
|
+
"Anonymous helper declarations are not supported.",
|
|
903
|
+
);
|
|
904
|
+
this.components.set(
|
|
905
|
+
statement.id.name,
|
|
906
|
+
new StaticFunction(statement, this.variables),
|
|
907
|
+
);
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
if (t.isVariableDeclaration(statement) && statement.kind === "const") {
|
|
911
|
+
for (const declaration of statement.declarations) {
|
|
912
|
+
if (!t.isIdentifier(declaration.id) || !declaration.init) {
|
|
913
|
+
throw new SlideSourceError(
|
|
914
|
+
"Top-level declarations must be initialized const values.",
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
const fn = this.toStaticFunction(declaration.init, this.variables);
|
|
918
|
+
if (fn) this.components.set(declaration.id.name, fn);
|
|
919
|
+
else
|
|
920
|
+
this.variables.set(
|
|
921
|
+
declaration.id.name,
|
|
922
|
+
this.evaluate(declaration.init, this.variables, 0),
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
927
|
+
if (t.isEmptyStatement(statement)) continue;
|
|
928
|
+
throw new SlideSourceError(
|
|
929
|
+
"Slide source cannot import modules or execute top-level code.",
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
if (defaultCount !== 1)
|
|
933
|
+
throw new SlideSourceError(
|
|
934
|
+
"Slide source must have exactly one default export.",
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
private defaultExport(): t.Node {
|
|
939
|
+
const statement = this.ast.program.body.find(t.isExportDefaultDeclaration);
|
|
940
|
+
if (!statement || !t.isExportDefaultDeclaration(statement)) {
|
|
941
|
+
throw new SlideSourceError(
|
|
942
|
+
"Slide source must have a default component export.",
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
return statement.declaration;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
private toStaticFunction(
|
|
949
|
+
node: t.Node,
|
|
950
|
+
closure: Map<string, unknown>,
|
|
951
|
+
): StaticFunction | null {
|
|
952
|
+
if (
|
|
953
|
+
t.isArrowFunctionExpression(node) ||
|
|
954
|
+
t.isFunctionExpression(node) ||
|
|
955
|
+
t.isFunctionDeclaration(node)
|
|
956
|
+
) {
|
|
957
|
+
if (node.async || node.generator)
|
|
958
|
+
throw new SlideSourceError(
|
|
959
|
+
"Async and generator components are not supported.",
|
|
960
|
+
);
|
|
961
|
+
return new StaticFunction(node, new Map(closure));
|
|
962
|
+
}
|
|
963
|
+
if (t.isIdentifier(node)) {
|
|
964
|
+
const value = closure.get(node.name) ?? this.components.get(node.name);
|
|
965
|
+
return isStaticFunction(value) ? value : null;
|
|
966
|
+
}
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
private evaluate(
|
|
971
|
+
node: t.Node,
|
|
972
|
+
scope: Map<string, unknown>,
|
|
973
|
+
depth: number,
|
|
974
|
+
): unknown {
|
|
975
|
+
if (depth > MAX_RENDER_DEPTH)
|
|
976
|
+
throw new SlideSourceError("Slide source nesting is too deep.");
|
|
977
|
+
this.reserveEvaluatedValues(1);
|
|
978
|
+
if (
|
|
979
|
+
t.isStringLiteral(node) ||
|
|
980
|
+
t.isNumericLiteral(node) ||
|
|
981
|
+
t.isBooleanLiteral(node)
|
|
982
|
+
)
|
|
983
|
+
return node.value;
|
|
984
|
+
if (t.isNullLiteral(node)) return null;
|
|
985
|
+
if (t.isJSXElement(node)) return this.renderElement(node, scope, depth + 1);
|
|
986
|
+
if (t.isJSXFragment(node)) {
|
|
987
|
+
return createElement(
|
|
988
|
+
Fragment,
|
|
989
|
+
null,
|
|
990
|
+
...this.renderChildren(node.children, scope, depth + 1),
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
if (t.isIdentifier(node)) {
|
|
994
|
+
if (node.name === "undefined") return undefined;
|
|
995
|
+
if (scope.has(node.name)) return scope.get(node.name);
|
|
996
|
+
if (this.components.has(node.name)) return this.components.get(node.name);
|
|
997
|
+
throw new SlideSourceError(`Unknown identifier "${node.name}".`);
|
|
998
|
+
}
|
|
999
|
+
if (t.isArrayExpression(node)) {
|
|
1000
|
+
this.reserveEvaluatedValues(node.elements.length);
|
|
1001
|
+
return node.elements.map((entry) => {
|
|
1002
|
+
if (!entry) return null;
|
|
1003
|
+
if (t.isSpreadElement(entry))
|
|
1004
|
+
throw new SlideSourceError("Spread expressions are not supported.");
|
|
1005
|
+
return this.evaluate(entry, scope, depth + 1);
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
if (t.isObjectExpression(node)) {
|
|
1009
|
+
const result: Record<string, unknown> = Object.create(null);
|
|
1010
|
+
for (const property of node.properties) {
|
|
1011
|
+
if (
|
|
1012
|
+
!t.isObjectProperty(property) ||
|
|
1013
|
+
property.computed ||
|
|
1014
|
+
property.shorthand
|
|
1015
|
+
) {
|
|
1016
|
+
throw new SlideSourceError(
|
|
1017
|
+
"Object values must use explicit static properties.",
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
const key = t.isIdentifier(property.key)
|
|
1021
|
+
? property.key.name
|
|
1022
|
+
: t.isStringLiteral(property.key)
|
|
1023
|
+
? property.key.value
|
|
1024
|
+
: null;
|
|
1025
|
+
if (!key || isBlockedProperty(key))
|
|
1026
|
+
throw new SlideSourceError("Object key is not allowed.");
|
|
1027
|
+
result[key] = this.evaluate(property.value, scope, depth + 1);
|
|
1028
|
+
}
|
|
1029
|
+
return result;
|
|
1030
|
+
}
|
|
1031
|
+
if (t.isTemplateLiteral(node)) {
|
|
1032
|
+
return node.quasis
|
|
1033
|
+
.map((part, index) => {
|
|
1034
|
+
const value = part.value.cooked;
|
|
1035
|
+
if (value === null)
|
|
1036
|
+
throw new SlideSourceError("Invalid template string escape.");
|
|
1037
|
+
return (
|
|
1038
|
+
value +
|
|
1039
|
+
(index < node.expressions.length
|
|
1040
|
+
? String(
|
|
1041
|
+
this.evaluate(node.expressions[index], scope, depth + 1) ??
|
|
1042
|
+
"",
|
|
1043
|
+
)
|
|
1044
|
+
: "")
|
|
1045
|
+
);
|
|
1046
|
+
})
|
|
1047
|
+
.join("");
|
|
1048
|
+
}
|
|
1049
|
+
if (t.isBinaryExpression(node)) {
|
|
1050
|
+
const left = this.evaluate(node.left, scope, depth + 1);
|
|
1051
|
+
const right = this.evaluate(node.right, scope, depth + 1);
|
|
1052
|
+
if (node.operator === "+") {
|
|
1053
|
+
if (typeof left === "string" || typeof right === "string") {
|
|
1054
|
+
return String(left ?? "") + String(right ?? "");
|
|
1055
|
+
}
|
|
1056
|
+
if (typeof left === "number" && typeof right === "number")
|
|
1057
|
+
return left + right;
|
|
1058
|
+
}
|
|
1059
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
1060
|
+
if (node.operator === "-") return left - right;
|
|
1061
|
+
if (node.operator === "*") return left * right;
|
|
1062
|
+
if (node.operator === "/") return right === 0 ? null : left / right;
|
|
1063
|
+
if (node.operator === "%") return right === 0 ? null : left % right;
|
|
1064
|
+
}
|
|
1065
|
+
throw new SlideSourceError(
|
|
1066
|
+
"Only static addition and numeric arithmetic are supported.",
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
if (t.isConditionalExpression(node)) {
|
|
1070
|
+
const test = this.evaluate(node.test, scope, depth + 1);
|
|
1071
|
+
return this.evaluate(
|
|
1072
|
+
test ? node.consequent : node.alternate,
|
|
1073
|
+
scope,
|
|
1074
|
+
depth + 1,
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
if (t.isLogicalExpression(node)) {
|
|
1078
|
+
const left = this.evaluate(node.left, scope, depth + 1);
|
|
1079
|
+
if (node.operator === "&&")
|
|
1080
|
+
return left ? this.evaluate(node.right, scope, depth + 1) : left;
|
|
1081
|
+
if (node.operator === "||")
|
|
1082
|
+
return left ? left : this.evaluate(node.right, scope, depth + 1);
|
|
1083
|
+
if (node.operator === "??")
|
|
1084
|
+
return left == null
|
|
1085
|
+
? this.evaluate(node.right, scope, depth + 1)
|
|
1086
|
+
: left;
|
|
1087
|
+
}
|
|
1088
|
+
if (t.isMemberExpression(node)) {
|
|
1089
|
+
const object = this.evaluate(node.object, scope, depth + 1);
|
|
1090
|
+
const property = node.computed
|
|
1091
|
+
? this.evaluate(node.property, scope, depth + 1)
|
|
1092
|
+
: t.isIdentifier(node.property)
|
|
1093
|
+
? node.property.name
|
|
1094
|
+
: null;
|
|
1095
|
+
if (typeof property !== "string" && typeof property !== "number") {
|
|
1096
|
+
throw new SlideSourceError("Dynamic property access is not supported.");
|
|
1097
|
+
}
|
|
1098
|
+
if (isBlockedProperty(String(property)))
|
|
1099
|
+
throw new SlideSourceError("Prototype access is not allowed.");
|
|
1100
|
+
if (
|
|
1101
|
+
(Array.isArray(object) || isPlainObject(object)) &&
|
|
1102
|
+
Object.hasOwn(object, property)
|
|
1103
|
+
) {
|
|
1104
|
+
return (object as Record<string | number, unknown>)[property];
|
|
1105
|
+
}
|
|
1106
|
+
if (typeof object === "string" && property === "length")
|
|
1107
|
+
return object.length;
|
|
1108
|
+
throw new SlideSourceError(
|
|
1109
|
+
"Slide source reads only own properties of static values.",
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
if (t.isCallExpression(node))
|
|
1113
|
+
return this.evaluateCall(node, scope, depth + 1);
|
|
1114
|
+
if (t.isArrowFunctionExpression(node) || t.isFunctionExpression(node)) {
|
|
1115
|
+
const fn = this.toStaticFunction(node, scope);
|
|
1116
|
+
if (fn) return fn;
|
|
1117
|
+
}
|
|
1118
|
+
if (
|
|
1119
|
+
t.isTSAsExpression(node) ||
|
|
1120
|
+
t.isTSTypeAssertion(node) ||
|
|
1121
|
+
t.isTSNonNullExpression(node) ||
|
|
1122
|
+
t.isTSSatisfiesExpression(node)
|
|
1123
|
+
) {
|
|
1124
|
+
return this.evaluate(node.expression, scope, depth + 1);
|
|
1125
|
+
}
|
|
1126
|
+
if (t.isUnaryExpression(node)) {
|
|
1127
|
+
const value = this.evaluate(node.argument, scope, depth + 1);
|
|
1128
|
+
if (
|
|
1129
|
+
node.operator === "!" &&
|
|
1130
|
+
(value === null || typeof value !== "object")
|
|
1131
|
+
)
|
|
1132
|
+
return !value;
|
|
1133
|
+
if (typeof value === "number" && node.operator === "-") return -value;
|
|
1134
|
+
}
|
|
1135
|
+
throw new SlideSourceError(`Unsupported expression: ${node.type}.`);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
private evaluateCall(
|
|
1139
|
+
node: t.CallExpression,
|
|
1140
|
+
scope: Map<string, unknown>,
|
|
1141
|
+
depth: number,
|
|
1142
|
+
): unknown {
|
|
1143
|
+
const args = node.arguments.map((argument) => {
|
|
1144
|
+
if (t.isSpreadElement(argument) || t.isJSXNamespacedName(argument)) {
|
|
1145
|
+
throw new SlideSourceError("Spread arguments are not supported.");
|
|
1146
|
+
}
|
|
1147
|
+
return this.evaluate(argument, scope, depth + 1);
|
|
1148
|
+
});
|
|
1149
|
+
if (t.isIdentifier(node.callee)) {
|
|
1150
|
+
const fn =
|
|
1151
|
+
scope.get(node.callee.name) ?? this.components.get(node.callee.name);
|
|
1152
|
+
if (isStaticFunction(fn)) return this.invoke(fn, args, depth + 1);
|
|
1153
|
+
}
|
|
1154
|
+
if (
|
|
1155
|
+
t.isMemberExpression(node.callee) &&
|
|
1156
|
+
!node.callee.computed &&
|
|
1157
|
+
t.isIdentifier(node.callee.property)
|
|
1158
|
+
) {
|
|
1159
|
+
const object = this.evaluate(node.callee.object, scope, depth + 1);
|
|
1160
|
+
const method = node.callee.property.name;
|
|
1161
|
+
if (
|
|
1162
|
+
Array.isArray(object) &&
|
|
1163
|
+
method === "map" &&
|
|
1164
|
+
isStaticFunction(args[0])
|
|
1165
|
+
) {
|
|
1166
|
+
this.reserveEvaluatedValues(object.length);
|
|
1167
|
+
return object.map((value, index) =>
|
|
1168
|
+
this.invoke(args[0] as StaticFunction, [value, index], depth + 1),
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
if (Array.isArray(object) && method === "join")
|
|
1172
|
+
return object.join(String(args[0] ?? ","));
|
|
1173
|
+
if (typeof object === "string") {
|
|
1174
|
+
if (method === "toUpperCase") return object.toUpperCase();
|
|
1175
|
+
if (method === "toLowerCase") return object.toLowerCase();
|
|
1176
|
+
if (method === "trim") return object.trim();
|
|
1177
|
+
if (method === "slice")
|
|
1178
|
+
return object.slice(
|
|
1179
|
+
Number(args[0] ?? 0),
|
|
1180
|
+
args[1] === undefined ? undefined : Number(args[1]),
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
throw new SlideSourceError(
|
|
1185
|
+
"Only local pure helpers and static array/string methods may be called.",
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
private invoke(fn: StaticFunction, args: unknown[], depth: number): unknown {
|
|
1190
|
+
if (depth > MAX_RENDER_DEPTH)
|
|
1191
|
+
throw new SlideSourceError("Slide component nesting is too deep.");
|
|
1192
|
+
this.reserveEvaluatedValues(1);
|
|
1193
|
+
const scope = new Map(fn.closure);
|
|
1194
|
+
fn.node.params.forEach((parameter, index) =>
|
|
1195
|
+
bindParameter(parameter, args[index], scope),
|
|
1196
|
+
);
|
|
1197
|
+
if (
|
|
1198
|
+
t.isArrowFunctionExpression(fn.node) &&
|
|
1199
|
+
!t.isBlockStatement(fn.node.body)
|
|
1200
|
+
) {
|
|
1201
|
+
return this.evaluate(fn.node.body, scope, depth + 1);
|
|
1202
|
+
}
|
|
1203
|
+
const body = fn.node.body;
|
|
1204
|
+
if (!t.isBlockStatement(body))
|
|
1205
|
+
throw new SlideSourceError("Invalid component body.");
|
|
1206
|
+
for (const statement of body.body) {
|
|
1207
|
+
if (t.isVariableDeclaration(statement) && statement.kind === "const") {
|
|
1208
|
+
for (const declaration of statement.declarations) {
|
|
1209
|
+
if (!t.isIdentifier(declaration.id) || !declaration.init) {
|
|
1210
|
+
throw new SlideSourceError(
|
|
1211
|
+
"Component locals must be initialized const values.",
|
|
1212
|
+
);
|
|
1213
|
+
}
|
|
1214
|
+
scope.set(
|
|
1215
|
+
declaration.id.name,
|
|
1216
|
+
this.evaluate(declaration.init, scope, depth + 1),
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if (t.isReturnStatement(statement)) {
|
|
1222
|
+
return statement.argument
|
|
1223
|
+
? this.evaluate(statement.argument, scope, depth + 1)
|
|
1224
|
+
: null;
|
|
1225
|
+
}
|
|
1226
|
+
if (t.isEmptyStatement(statement)) continue;
|
|
1227
|
+
throw new SlideSourceError(
|
|
1228
|
+
"Components may contain only const declarations and a return.",
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
throw new SlideSourceError("Every slide component must return markup.");
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
private renderElement(
|
|
1235
|
+
node: t.JSXElement,
|
|
1236
|
+
scope: Map<string, unknown>,
|
|
1237
|
+
depth: number,
|
|
1238
|
+
): ReactNode {
|
|
1239
|
+
if (depth > MAX_RENDER_DEPTH || ++this.renderedNodeCount > MAX_AST_NODES) {
|
|
1240
|
+
throw new SlideSourceError("Slide output is too complex.");
|
|
1241
|
+
}
|
|
1242
|
+
const name = jsxTagName(node.openingElement.name);
|
|
1243
|
+
if (!name)
|
|
1244
|
+
throw new SlideSourceError(
|
|
1245
|
+
"Namespaced and member JSX tags are not supported.",
|
|
1246
|
+
);
|
|
1247
|
+
const sourceLoc = node.loc?.start;
|
|
1248
|
+
const props: Record<string, unknown> = {};
|
|
1249
|
+
if (sourceLoc)
|
|
1250
|
+
props["data-slide-loc"] = `${sourceLoc.line}:${sourceLoc.column}`;
|
|
1251
|
+
|
|
1252
|
+
for (const attribute of node.openingElement.attributes) {
|
|
1253
|
+
if (t.isJSXSpreadAttribute(attribute))
|
|
1254
|
+
throw new SlideSourceError("Spread attributes are not supported.");
|
|
1255
|
+
if (!t.isJSXIdentifier(attribute.name))
|
|
1256
|
+
throw new SlideSourceError(
|
|
1257
|
+
"Namespaced JSX attributes are not supported.",
|
|
1258
|
+
);
|
|
1259
|
+
const rawName = attribute.name.name;
|
|
1260
|
+
if (
|
|
1261
|
+
/^on/i.test(rawName) ||
|
|
1262
|
+
rawName === "dangerouslySetInnerHTML" ||
|
|
1263
|
+
rawName === "data-slide-loc"
|
|
1264
|
+
) {
|
|
1265
|
+
throw new SlideSourceError(`Attribute "${rawName}" is not allowed.`);
|
|
1266
|
+
}
|
|
1267
|
+
const propName = ATTR_ALIASES[rawName] ?? rawName;
|
|
1268
|
+
if (
|
|
1269
|
+
propName !== "style" &&
|
|
1270
|
+
propName !== "src" &&
|
|
1271
|
+
!isSafeAttribute(propName)
|
|
1272
|
+
) {
|
|
1273
|
+
throw new SlideSourceError(`Attribute "${rawName}" is not allowed.`);
|
|
1274
|
+
}
|
|
1275
|
+
if (propName === "src" && name !== "img" && name !== "video") {
|
|
1276
|
+
throw new SlideSourceError(
|
|
1277
|
+
"Only <img> and <video> elements may load uploaded assets.",
|
|
1278
|
+
);
|
|
1279
|
+
}
|
|
1280
|
+
if (propName === "poster" && name !== "video") {
|
|
1281
|
+
throw new SlideSourceError("Only <video> elements may use a poster.");
|
|
1282
|
+
}
|
|
1283
|
+
let value: unknown;
|
|
1284
|
+
if (!attribute.value) value = true;
|
|
1285
|
+
else if (t.isStringLiteral(attribute.value))
|
|
1286
|
+
value = attribute.value.value;
|
|
1287
|
+
else if (t.isJSXExpressionContainer(attribute.value)) {
|
|
1288
|
+
value = this.evaluate(attribute.value.expression, scope, depth + 1);
|
|
1289
|
+
} else {
|
|
1290
|
+
throw new SlideSourceError(
|
|
1291
|
+
`Attribute "${rawName}" has an unsupported value.`,
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1294
|
+
if (propName === "src" || propName === "poster")
|
|
1295
|
+
value = this.resolveAsset(value);
|
|
1296
|
+
if (propName === "href") {
|
|
1297
|
+
value = safeHref(value);
|
|
1298
|
+
if (
|
|
1299
|
+
name !== "a" &&
|
|
1300
|
+
!(name === "use" && String(value).startsWith("#"))
|
|
1301
|
+
) {
|
|
1302
|
+
throw new SlideSourceError(
|
|
1303
|
+
"Links are allowed only on anchors and local SVG references.",
|
|
1304
|
+
);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
if (SVG_LOCAL_REFERENCE_ATTRS.has(propName)) value = safeSvgPaint(value);
|
|
1308
|
+
if (propName === "style") value = safeStyle(value);
|
|
1309
|
+
if (value !== null && value !== undefined) {
|
|
1310
|
+
if (!isPrimitive(value) && propName !== "style") {
|
|
1311
|
+
throw new SlideSourceError(
|
|
1312
|
+
`Attribute "${rawName}" must have a static primitive value.`,
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
props[propName] = value;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
const children = this.renderChildren(node.children, scope, depth + 1);
|
|
1320
|
+
if (isComponentName(name)) {
|
|
1321
|
+
const component = this.components.get(name);
|
|
1322
|
+
if (!component)
|
|
1323
|
+
throw new SlideSourceError(`Unknown local component "${name}".`);
|
|
1324
|
+
if (children.length === 1) props.children = children[0];
|
|
1325
|
+
if (children.length > 1) props.children = children;
|
|
1326
|
+
return this.asChild(this.invoke(component, [props], depth + 1));
|
|
1327
|
+
}
|
|
1328
|
+
if (!HTML_TAGS.has(name) && !SVG_TAGS.has(name)) {
|
|
1329
|
+
throw new SlideSourceError(`Element <${name}> is not allowed.`);
|
|
1330
|
+
}
|
|
1331
|
+
if (name === "img" && children.length > 0)
|
|
1332
|
+
throw new SlideSourceError("Images cannot have child elements.");
|
|
1333
|
+
if (name === "video" && children.length > 0)
|
|
1334
|
+
throw new SlideSourceError("Videos cannot have child elements.");
|
|
1335
|
+
if (name === "use" && typeof props.href === "string") {
|
|
1336
|
+
if (!props.href.startsWith("#"))
|
|
1337
|
+
throw new SlideSourceError("SVG external references are not allowed.");
|
|
1338
|
+
}
|
|
1339
|
+
if ((name === "img" || name === "video") && typeof props.src !== "string") {
|
|
1340
|
+
throw new SlideSourceError("Media must use a resolved asset handle.");
|
|
1341
|
+
}
|
|
1342
|
+
if (children.length === 0) return createElement(name, props);
|
|
1343
|
+
return createElement(name, props, ...children);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
private renderChildren(
|
|
1347
|
+
children: Array<
|
|
1348
|
+
| t.JSXText
|
|
1349
|
+
| t.JSXExpressionContainer
|
|
1350
|
+
| t.JSXSpreadChild
|
|
1351
|
+
| t.JSXElement
|
|
1352
|
+
| t.JSXFragment
|
|
1353
|
+
>,
|
|
1354
|
+
scope: Map<string, unknown>,
|
|
1355
|
+
depth: number,
|
|
1356
|
+
): ReactNode[] {
|
|
1357
|
+
const result: ReactNode[] = [];
|
|
1358
|
+
for (const child of children) {
|
|
1359
|
+
if (t.isJSXText(child)) {
|
|
1360
|
+
const value = normalizeJsxText(child.value);
|
|
1361
|
+
if (value) result.push(value);
|
|
1362
|
+
continue;
|
|
1363
|
+
}
|
|
1364
|
+
if (t.isJSXSpreadChild(child))
|
|
1365
|
+
throw new SlideSourceError("Spread children are not supported.");
|
|
1366
|
+
if (t.isJSXExpressionContainer(child)) {
|
|
1367
|
+
if (t.isJSXEmptyExpression(child.expression)) continue;
|
|
1368
|
+
const value = this.evaluate(child.expression, scope, depth + 1);
|
|
1369
|
+
result.push(this.asChild(value));
|
|
1370
|
+
continue;
|
|
1371
|
+
}
|
|
1372
|
+
if (t.isJSXElement(child) || t.isJSXFragment(child)) {
|
|
1373
|
+
const value = this.evaluate(child, scope, depth + 1);
|
|
1374
|
+
result.push(this.asChild(value));
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
return result;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
private resolveAsset(value: unknown): string {
|
|
1381
|
+
if (typeof value !== "string" || !value.startsWith("asset://")) {
|
|
1382
|
+
throw new SlideSourceError("Media sources must use asset:// handles.");
|
|
1383
|
+
}
|
|
1384
|
+
const id = value.slice("asset://".length);
|
|
1385
|
+
const url = this.assetUrls.get(id);
|
|
1386
|
+
if (!url)
|
|
1387
|
+
throw new SlideSourceError(
|
|
1388
|
+
"Media references an unresolved asset handle.",
|
|
1389
|
+
);
|
|
1390
|
+
return url;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
private asChild(value: unknown): ReactNode {
|
|
1394
|
+
if (value === null || value === undefined || typeof value === "boolean")
|
|
1395
|
+
return null;
|
|
1396
|
+
if (typeof value === "string" || typeof value === "number") return value;
|
|
1397
|
+
if (Array.isArray(value)) {
|
|
1398
|
+
this.reserveEvaluatedValues(value.length);
|
|
1399
|
+
return value.map((child) => this.asChild(child));
|
|
1400
|
+
}
|
|
1401
|
+
if (isReactNode(value)) return value;
|
|
1402
|
+
throw new SlideSourceError(
|
|
1403
|
+
"Markup children must be text, numbers, arrays, or JSX elements.",
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
private reserveEvaluatedValues(count: number): void {
|
|
1408
|
+
if (count < 0 || this.evaluatedValueCount + count > MAX_EVALUATED_VALUES) {
|
|
1409
|
+
throw new SlideSourceError(
|
|
1410
|
+
"Slide output expands beyond the static evaluation limit.",
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
this.evaluatedValueCount += count;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
function bindParameter(
|
|
1418
|
+
parameter: t.Node,
|
|
1419
|
+
value: unknown,
|
|
1420
|
+
scope: Map<string, unknown>,
|
|
1421
|
+
): void {
|
|
1422
|
+
if (t.isIdentifier(parameter)) {
|
|
1423
|
+
scope.set(parameter.name, value);
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
if (t.isObjectPattern(parameter) && isPlainObject(value)) {
|
|
1427
|
+
for (const property of parameter.properties) {
|
|
1428
|
+
if (
|
|
1429
|
+
!t.isObjectProperty(property) ||
|
|
1430
|
+
property.computed ||
|
|
1431
|
+
property.shorthand
|
|
1432
|
+
) {
|
|
1433
|
+
throw new SlideSourceError(
|
|
1434
|
+
"Component props must use simple property destructuring.",
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1437
|
+
const key = t.isIdentifier(property.key)
|
|
1438
|
+
? property.key.name
|
|
1439
|
+
: t.isStringLiteral(property.key)
|
|
1440
|
+
? property.key.value
|
|
1441
|
+
: null;
|
|
1442
|
+
if (!key || isBlockedProperty(key))
|
|
1443
|
+
throw new SlideSourceError("Invalid component prop.");
|
|
1444
|
+
const target = property.value;
|
|
1445
|
+
if (!t.isIdentifier(target))
|
|
1446
|
+
throw new SlideSourceError(
|
|
1447
|
+
"Nested prop destructuring is not supported.",
|
|
1448
|
+
);
|
|
1449
|
+
scope.set(target.name, value[key]);
|
|
1450
|
+
}
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
if (t.isRestElement(parameter) || t.isAssignmentPattern(parameter)) {
|
|
1454
|
+
throw new SlideSourceError(
|
|
1455
|
+
"Rest and default component parameters are not supported.",
|
|
1456
|
+
);
|
|
1457
|
+
}
|
|
1458
|
+
throw new SlideSourceError(
|
|
1459
|
+
"Component parameters must be props or simple prop destructuring.",
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
function safeStyle(value: unknown): Record<string, string | number> {
|
|
1464
|
+
if (!isPlainObject(value))
|
|
1465
|
+
throw new SlideSourceError("Style must be a static object literal.");
|
|
1466
|
+
const result: Record<string, string | number> = {};
|
|
1467
|
+
for (const [key, rawValue] of Object.entries(value)) {
|
|
1468
|
+
if (!SAFE_STYLE_KEY.test(key) || isBlockedProperty(key))
|
|
1469
|
+
throw new SlideSourceError(`CSS property "${key}" is not allowed.`);
|
|
1470
|
+
const safeStaticMask =
|
|
1471
|
+
key === "mask" &&
|
|
1472
|
+
typeof rawValue === "string" &&
|
|
1473
|
+
isSafeStaticRadialGradientMask(rawValue);
|
|
1474
|
+
if (RESOURCE_STYLE_KEYS.has(key) && key !== "filter" && !safeStaticMask)
|
|
1475
|
+
throw new SlideSourceError(
|
|
1476
|
+
`CSS property "${key}" can initiate network requests and is not allowed.`,
|
|
1477
|
+
);
|
|
1478
|
+
if (
|
|
1479
|
+
key === "filter" &&
|
|
1480
|
+
rawValue !== null &&
|
|
1481
|
+
rawValue !== undefined &&
|
|
1482
|
+
typeof rawValue !== "string"
|
|
1483
|
+
) {
|
|
1484
|
+
throw new SlideSourceError(
|
|
1485
|
+
"CSS filter values must use a bounded blur() function.",
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
if (typeof rawValue === "number") {
|
|
1489
|
+
if (!Number.isFinite(rawValue))
|
|
1490
|
+
throw new SlideSourceError("CSS values must be finite.");
|
|
1491
|
+
result[key] = rawValue;
|
|
1492
|
+
} else if (typeof rawValue === "string") {
|
|
1493
|
+
result[key] = key.startsWith("--")
|
|
1494
|
+
? safeCustomPropertyValue(key, rawValue)
|
|
1495
|
+
: safeStyleValue(rawValue, key);
|
|
1496
|
+
} else if (rawValue !== null && rawValue !== undefined) {
|
|
1497
|
+
throw new SlideSourceError(`CSS value for "${key}" is not allowed.`);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return result;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
function safeStyleValue(value: string, key: string): string {
|
|
1504
|
+
if (
|
|
1505
|
+
/[\u0000-\u001f\u007f\\;{}<>@]/.test(value) ||
|
|
1506
|
+
value.includes("/*") ||
|
|
1507
|
+
value.includes("*/") ||
|
|
1508
|
+
(!QUOTED_STYLE_KEYS.has(key) && /['"]/.test(value))
|
|
1509
|
+
) {
|
|
1510
|
+
throw new SlideSourceError(`CSS value for "${key}" is not allowed.`);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
if (SVG_LOCAL_REFERENCE_STYLE_KEYS.has(key) && isLocalSvgReference(value)) {
|
|
1514
|
+
return value;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
if (VARIABLE_IMAGE_STYLE_KEYS.has(key)) {
|
|
1518
|
+
const references = [...value.matchAll(/var\(\s*(--[A-Za-z0-9_-]+)\s*\)/gi)];
|
|
1519
|
+
const withoutVariables = value.replace(SAFE_VAR_REFERENCE, "");
|
|
1520
|
+
if (/\bvar\s*\(/i.test(withoutVariables)) {
|
|
1521
|
+
throw new SlideSourceError(
|
|
1522
|
+
`CSS value for "${key}" has an unsupported variable reference.`,
|
|
1523
|
+
);
|
|
1524
|
+
}
|
|
1525
|
+
if (
|
|
1526
|
+
references.some(
|
|
1527
|
+
(match) => !SAFE_THEME_COLOR_VARIABLES.has(match[1]!.toLowerCase()),
|
|
1528
|
+
)
|
|
1529
|
+
) {
|
|
1530
|
+
throw new SlideSourceError(
|
|
1531
|
+
`CSS value for "${key}" cannot use CSS variables.`,
|
|
1532
|
+
);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
const withoutVariables = value.replace(SAFE_VAR_REFERENCE, "");
|
|
1537
|
+
if (/\bvar\s*\(/i.test(withoutVariables)) {
|
|
1538
|
+
throw new SlideSourceError(
|
|
1539
|
+
`CSS value for "${key}" has an unsupported variable reference.`,
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
let parenDepth = 0;
|
|
1544
|
+
for (const character of value) {
|
|
1545
|
+
if (character === "(") {
|
|
1546
|
+
parenDepth += 1;
|
|
1547
|
+
} else if (character === ")") {
|
|
1548
|
+
parenDepth -= 1;
|
|
1549
|
+
if (parenDepth < 0) {
|
|
1550
|
+
throw new SlideSourceError(
|
|
1551
|
+
`CSS value for "${key}" has unbalanced parentheses.`,
|
|
1552
|
+
);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
if (parenDepth !== 0) {
|
|
1557
|
+
throw new SlideSourceError(
|
|
1558
|
+
`CSS value for "${key}" has unbalanced parentheses.`,
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
if (GRID_TRACK_STYLE_KEYS.has(key) && isSafeGridTrackList(value)) {
|
|
1563
|
+
return value;
|
|
1564
|
+
}
|
|
1565
|
+
if (key === "filter" && isSafeBlurFilter(value)) {
|
|
1566
|
+
return value;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
for (const match of value.matchAll(CSS_FUNCTION)) {
|
|
1570
|
+
if (!SAFE_STYLE_FUNCTIONS.has(match[1]!.toLowerCase())) {
|
|
1571
|
+
throw new SlideSourceError(`CSS function "${match[1]}" is not allowed.`);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
if (key === "filter") {
|
|
1575
|
+
throw new SlideSourceError(
|
|
1576
|
+
"CSS filter values must use a bounded blur() function.",
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1579
|
+
return value;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
function isSafeGridTrackList(value: string): boolean {
|
|
1583
|
+
if (value.length > MAX_GRID_TRACK_LIST_LENGTH) return false;
|
|
1584
|
+
const tracks = splitTopLevelWhitespace(value);
|
|
1585
|
+
if (tracks.length === 0 || tracks.length > MAX_GRID_TRACKS) return false;
|
|
1586
|
+
|
|
1587
|
+
let totalTracks = 0;
|
|
1588
|
+
for (const track of tracks) {
|
|
1589
|
+
if (CSS_GRID_TRACK_SIZE.test(track)) {
|
|
1590
|
+
totalTracks += 1;
|
|
1591
|
+
} else {
|
|
1592
|
+
const repeat = /^repeat\(\s*(\d{1,2})\s*,\s*(.+?)\s*\)$/i.exec(track);
|
|
1593
|
+
const minmax = /^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i.exec(track);
|
|
1594
|
+
if (repeat) {
|
|
1595
|
+
const count = Number(repeat[1]);
|
|
1596
|
+
if (
|
|
1597
|
+
count < 1 ||
|
|
1598
|
+
count > MAX_GRID_REPEAT_COUNT ||
|
|
1599
|
+
!CSS_GRID_TRACK_SIZE.test(repeat[2]!)
|
|
1600
|
+
) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
totalTracks += count;
|
|
1604
|
+
} else if (
|
|
1605
|
+
minmax &&
|
|
1606
|
+
CSS_GRID_TRACK_SIZE.test(minmax[1]!) &&
|
|
1607
|
+
CSS_GRID_TRACK_SIZE.test(minmax[2]!)
|
|
1608
|
+
) {
|
|
1609
|
+
totalTracks += 1;
|
|
1610
|
+
} else {
|
|
1611
|
+
return false;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (totalTracks > MAX_GRID_TRACKS) return false;
|
|
1615
|
+
}
|
|
1616
|
+
return true;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
function splitTopLevelWhitespace(value: string): string[] {
|
|
1620
|
+
const parts: string[] = [];
|
|
1621
|
+
let depth = 0;
|
|
1622
|
+
let start = 0;
|
|
1623
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
1624
|
+
const character = value[index]!;
|
|
1625
|
+
if (character === "(") depth += 1;
|
|
1626
|
+
else if (character === ")") depth -= 1;
|
|
1627
|
+
else if (/\s/.test(character) && depth === 0) {
|
|
1628
|
+
const part = value.slice(start, index).trim();
|
|
1629
|
+
if (part) parts.push(part);
|
|
1630
|
+
start = index + 1;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
const finalPart = value.slice(start).trim();
|
|
1634
|
+
if (finalPart) parts.push(finalPart);
|
|
1635
|
+
return parts;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
function isSafeBlurFilter(value: string): boolean {
|
|
1639
|
+
const match = /^blur\(\s*(\d+(?:\.\d+)?|\.\d+)px\s*\)$/i.exec(value);
|
|
1640
|
+
return Boolean(match && Number(match[1]) <= MAX_FILTER_BLUR_PX);
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
function isSafeStaticRadialGradientMask(value: string): boolean {
|
|
1644
|
+
if (value.length > MAX_STATIC_MASK_LENGTH) return false;
|
|
1645
|
+
const match =
|
|
1646
|
+
/^radial-gradient\(\s*circle\s*,\s*transparent\s+(\d+(?:\.\d+)?%)\s*,\s*#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})\s+(\d+(?:\.\d+)?%)\s*\)$/i.exec(
|
|
1647
|
+
value,
|
|
1648
|
+
);
|
|
1649
|
+
return Boolean(
|
|
1650
|
+
match &&
|
|
1651
|
+
Number(match[1]!.slice(0, -1)) <= 100 &&
|
|
1652
|
+
Number(match[2]!.slice(0, -1)) <= 100,
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
function safeCustomPropertyValue(key: string, value: string): string {
|
|
1657
|
+
if (SAFE_THEME_FONT_VARIABLES.has(key.toLowerCase())) {
|
|
1658
|
+
return safeStyleValue(value, "fontFamily");
|
|
1659
|
+
}
|
|
1660
|
+
if (key.toLowerCase() === "--deck-radius") {
|
|
1661
|
+
if (!/^(?:0|(?:\d+(?:\.\d+)?)(?:px|rem|em))$/i.test(value.trim())) {
|
|
1662
|
+
throw new SlideSourceError(
|
|
1663
|
+
`CSS value for "${key}" must be a static radius.`,
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1666
|
+
return value;
|
|
1667
|
+
}
|
|
1668
|
+
if (!SAFE_THEME_COLOR_VARIABLES.has(key.toLowerCase())) {
|
|
1669
|
+
return safeStyleValue(value, key);
|
|
1670
|
+
}
|
|
1671
|
+
const trimmed = value.trim();
|
|
1672
|
+
const variable = trimmed.match(SAFE_THEME_VARIABLE);
|
|
1673
|
+
if (variable) {
|
|
1674
|
+
const referencedName = variable[0].slice(4, -1).trim().toLowerCase();
|
|
1675
|
+
if (SAFE_THEME_COLOR_VARIABLES.has(referencedName)) return value;
|
|
1676
|
+
throw new SlideSourceError(
|
|
1677
|
+
`CSS value for "${key}" references an unsupported theme color.`,
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
if (
|
|
1681
|
+
!/^#[0-9a-f]{3,8}$/i.test(trimmed) &&
|
|
1682
|
+
!/^(?:transparent|currentcolor|black|white|red|blue|green|gray|grey|orange|purple)$/i.test(
|
|
1683
|
+
trimmed,
|
|
1684
|
+
) &&
|
|
1685
|
+
!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color-mix)\(/i.test(trimmed)
|
|
1686
|
+
) {
|
|
1687
|
+
throw new SlideSourceError(
|
|
1688
|
+
`CSS value for "${key}" must be a static theme color.`,
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1691
|
+
return safeStyleValue(trimmed, "color");
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
function safeSvgPaint(value: unknown): unknown {
|
|
1695
|
+
if (typeof value !== "string") {
|
|
1696
|
+
throw new SlideSourceError("SVG paint values must be static strings.");
|
|
1697
|
+
}
|
|
1698
|
+
if (isLocalSvgReference(value)) return value;
|
|
1699
|
+
if (/\bvar\s*\(/i.test(value)) {
|
|
1700
|
+
throw new SlideSourceError("SVG paint values cannot use CSS variables.");
|
|
1701
|
+
}
|
|
1702
|
+
return safeStyleValue(value, "color");
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
function isLocalSvgReference(value: string): boolean {
|
|
1706
|
+
return /^url\(\s*#[A-Za-z][A-Za-z0-9_.:-]*\s*\)$/i.test(value);
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
function safeHref(value: unknown): string {
|
|
1710
|
+
if (typeof value !== "string")
|
|
1711
|
+
throw new SlideSourceError("Link targets must be static strings.");
|
|
1712
|
+
const href = value.trim();
|
|
1713
|
+
if (href.startsWith("#") || /^(?:https?:|mailto:|tel:)/i.test(href))
|
|
1714
|
+
return href;
|
|
1715
|
+
throw new SlideSourceError(
|
|
1716
|
+
"Links may use https, http, mailto, tel, or a local fragment.",
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
function isSafeAttribute(name: string): boolean {
|
|
1721
|
+
if (SAFE_ATTRS.has(name)) return true;
|
|
1722
|
+
return (
|
|
1723
|
+
/^(?:aria-[a-z0-9-]+|data-[a-z0-9-]+)$/.test(name) &&
|
|
1724
|
+
name !== "data-slide-loc"
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
function isComponentName(name: string): boolean {
|
|
1729
|
+
return /^[A-Z]/.test(name);
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
function jsxTagName(node: t.JSXOpeningElement["name"]): string | null {
|
|
1733
|
+
return t.isJSXIdentifier(node) ? node.name : null;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
function normalizeJsxText(value: string): string {
|
|
1737
|
+
const lines = value.split(/\r\n|\n|\r/);
|
|
1738
|
+
const last = lines.length - 1;
|
|
1739
|
+
return lines
|
|
1740
|
+
.map((line, index) => {
|
|
1741
|
+
let normalized = line.replace(/\t/g, " ");
|
|
1742
|
+
if (index !== 0) normalized = normalized.replace(/^ +/, "");
|
|
1743
|
+
if (index !== last) normalized = normalized.replace(/ +$/, "");
|
|
1744
|
+
if (!normalized.trim()) return "";
|
|
1745
|
+
if (index !== last) normalized += " ";
|
|
1746
|
+
return normalized;
|
|
1747
|
+
})
|
|
1748
|
+
.join("");
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
1752
|
+
return (
|
|
1753
|
+
value !== null &&
|
|
1754
|
+
typeof value === "object" &&
|
|
1755
|
+
(Object.getPrototypeOf(value) === null ||
|
|
1756
|
+
Object.getPrototypeOf(value) === Object.prototype)
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
function isPrimitive(value: unknown): value is string | number | boolean {
|
|
1761
|
+
return (
|
|
1762
|
+
typeof value === "string" ||
|
|
1763
|
+
typeof value === "number" ||
|
|
1764
|
+
typeof value === "boolean"
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
function isStaticFunction(value: unknown): value is StaticFunction {
|
|
1769
|
+
return value instanceof StaticFunction;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
function isBlockedProperty(value: string): boolean {
|
|
1773
|
+
return (
|
|
1774
|
+
value === "__proto__" || value === "prototype" || value === "constructor"
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
function isReactNode(value: unknown): value is ReactNode {
|
|
1779
|
+
return (
|
|
1780
|
+
value === null ||
|
|
1781
|
+
typeof value === "string" ||
|
|
1782
|
+
typeof value === "number" ||
|
|
1783
|
+
Array.isArray(value) ||
|
|
1784
|
+
(typeof value === "object" && value !== null && "$$typeof" in value)
|
|
1785
|
+
);
|
|
1786
|
+
}
|