@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,1534 @@
|
|
|
1
|
+
import { ASPECT_RATIOS } from "@shared/aspect-ratios";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ParsedElement,
|
|
5
|
+
ParsedParagraph,
|
|
6
|
+
ParsedSlide,
|
|
7
|
+
ParsedTextRun,
|
|
8
|
+
} from "./pptx-parser.js";
|
|
9
|
+
|
|
10
|
+
function esc(text: string): string {
|
|
11
|
+
return text
|
|
12
|
+
.replace(/&/g, "&")
|
|
13
|
+
.replace(/</g, "<")
|
|
14
|
+
.replace(/>/g, ">")
|
|
15
|
+
.replace(/"/g, """);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function buildFullBleedImageSlideHtml(
|
|
19
|
+
imageUrl: string,
|
|
20
|
+
headingText?: string,
|
|
21
|
+
subtitleText?: string,
|
|
22
|
+
): string {
|
|
23
|
+
let overlay = "";
|
|
24
|
+
if (headingText && subtitleText) {
|
|
25
|
+
overlay = `\n <div style="position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, rgba(12,10,8,0.95) 0%, rgba(12,10,8,0.88) 55%, rgba(12,10,8,0.4) 82%, rgba(12,10,8,0) 100%); padding: 56px 56px 60px; text-align: center; font-family: 'Poppins', sans-serif;"> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
26
|
+
<div style="width: 72px; height: 3px; background: #d8b26a; margin: 0 auto 20px;"></div> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
27
|
+
<h2 style="font-size: 30px; font-weight: 800; color: #d8b26a; line-height: 1.25; margin: 0 0 14px;">${esc(headingText)}</h2> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
28
|
+
<p style="font-size: 19px; font-weight: 500; color: #fff; line-height: 1.5; margin: 0;">${esc(subtitleText)}</p> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
29
|
+
</div>`;
|
|
30
|
+
} else if (headingText) {
|
|
31
|
+
overlay = `\n <div style="position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.15) 45%, rgba(0,0,0,0) 65%);"></div> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
32
|
+
<div style="position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 70px; font-family: 'Poppins', sans-serif;">
|
|
33
|
+
<h2 style="font-size: 40px; font-weight: 900; color: #fff; line-height: 1.15; letter-spacing: -1px; margin: 0;">${esc(headingText)}</h2> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
34
|
+
</div>`;
|
|
35
|
+
}
|
|
36
|
+
return `<div class="fmd-slide" style="position: relative; width: 100%; height: 100%; overflow: hidden;">
|
|
37
|
+
<img src="${esc(imageUrl)}" alt="" style="position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;" />${overlay}
|
|
38
|
+
</div>`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function buildFullPageImageSlideHtml(
|
|
42
|
+
imageUrl: string,
|
|
43
|
+
sourceWidth?: number,
|
|
44
|
+
sourceHeight?: number,
|
|
45
|
+
): string {
|
|
46
|
+
const sourceDimensions =
|
|
47
|
+
Number.isFinite(sourceWidth) &&
|
|
48
|
+
Number.isFinite(sourceHeight) &&
|
|
49
|
+
sourceWidth! > 0 &&
|
|
50
|
+
sourceHeight! > 0
|
|
51
|
+
? ` data-source-width="${sourceWidth}" data-source-height="${sourceHeight}"`
|
|
52
|
+
: "";
|
|
53
|
+
return `<div class="fmd-slide fmd-imported-pdf" data-imported-pdf="true"${sourceDimensions} style="position: relative; width: 100%; height: 100%; overflow: hidden; background: hsl(var(--background));">
|
|
54
|
+
<img src="${esc(imageUrl)}" alt="" style="position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;" />
|
|
55
|
+
</div>`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function formatRun(run: ParsedTextRun): string {
|
|
59
|
+
let text = esc(run.content);
|
|
60
|
+
if (run.color)
|
|
61
|
+
text = `<span style="color: ${esc(run.color)};">${text}</span>`;
|
|
62
|
+
if (run.bold) text = `<strong>${text}</strong>`;
|
|
63
|
+
if (run.italic) text = `<em>${text}</em>`;
|
|
64
|
+
return text;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const DEFAULT_IMPORT_FONT = "'Poppins', sans-serif";
|
|
68
|
+
|
|
69
|
+
const FONT_WEIGHT_SUFFIX =
|
|
70
|
+
/[ _-](?:ultra|extra|semi|demi)?[ _-]?(?:black|heavy|bold|medium|regular|normal|roman|book|light|thin|italic|oblique)$/i;
|
|
71
|
+
|
|
72
|
+
function cssFontFamily(themeFont: string | undefined): string {
|
|
73
|
+
if (!themeFont) return DEFAULT_IMPORT_FONT;
|
|
74
|
+
const safeName = themeFont.replace(/["']/g, "").trim();
|
|
75
|
+
if (!safeName) return DEFAULT_IMPORT_FONT;
|
|
76
|
+
let base = safeName;
|
|
77
|
+
while (FONT_WEIGHT_SUFFIX.test(base)) {
|
|
78
|
+
const stripped = base.replace(FONT_WEIGHT_SUFFIX, "").trim();
|
|
79
|
+
if (!stripped) break;
|
|
80
|
+
base = stripped;
|
|
81
|
+
}
|
|
82
|
+
return base === safeName
|
|
83
|
+
? `'${safeName}', sans-serif`
|
|
84
|
+
: `'${safeName}', '${base}', sans-serif`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function groupIntoParagraphs(texts: ParsedTextRun[]): ParsedTextRun[][] {
|
|
88
|
+
const paragraphs: ParsedTextRun[][] = [];
|
|
89
|
+
let current: ParsedTextRun[] = [];
|
|
90
|
+
|
|
91
|
+
for (const run of texts) {
|
|
92
|
+
const parts = run.content.split(/\r?\n/);
|
|
93
|
+
for (let i = 0; i < parts.length; i++) {
|
|
94
|
+
if (i > 0 && current.length > 0) {
|
|
95
|
+
paragraphs.push(current);
|
|
96
|
+
current = [];
|
|
97
|
+
}
|
|
98
|
+
const text = parts[i].trim();
|
|
99
|
+
if (text) {
|
|
100
|
+
current.push({ ...run, content: text });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (current.length > 0) {
|
|
105
|
+
paragraphs.push(current);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return paragraphs;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function convertToSlideHtml(
|
|
112
|
+
slide: ParsedSlide,
|
|
113
|
+
imageUrls?: string | Record<string, string>,
|
|
114
|
+
themeFont?: string,
|
|
115
|
+
): string {
|
|
116
|
+
if (slide.elements) {
|
|
117
|
+
return buildFidelitySlide(slide, imageUrls, themeFont);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const paragraphs = groupIntoParagraphs(slide.texts);
|
|
121
|
+
const fontFamily = cssFontFamily(themeFont);
|
|
122
|
+
|
|
123
|
+
if (slide.images.length > 0) {
|
|
124
|
+
return buildImageSlide(
|
|
125
|
+
paragraphs,
|
|
126
|
+
slide,
|
|
127
|
+
typeof imageUrls === "string" ? imageUrls : undefined,
|
|
128
|
+
fontFamily,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (slide.layoutHint === "title" || paragraphs.length <= 2) {
|
|
133
|
+
return buildTitleSlide(paragraphs, slide, fontFamily);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return buildContentSlide(paragraphs, slide, fontFamily);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const DEFAULT_SLIDE_WIDTH_EMU = 9144000;
|
|
140
|
+
const DEFAULT_SLIDE_HEIGHT_EMU = 5143500;
|
|
141
|
+
const DEFAULT_PPTX_BACKGROUND = "#ffffff"; // guard:allow-raw-color - PPTX's own white default when no background is declared
|
|
142
|
+
// OOXML's own default run color when nothing in the run, the placeholder
|
|
143
|
+
// chain, or `<p:txStyles>` declares one. It has to be the value the file
|
|
144
|
+
// format states, not a readable-looking approximation: an invented near-black
|
|
145
|
+
// renders beside the deck's real black inside a single text box, which is
|
|
146
|
+
// visible as two different blacks in one paragraph.
|
|
147
|
+
const DEFAULT_PPTX_FOREGROUND = "#000000"; // guard:allow-raw-color - OOXML's declared default text color
|
|
148
|
+
/**
|
|
149
|
+
* OOXML's own default run size, used only when the run, its placeholder
|
|
150
|
+
* chain, and the deck's `<p:defaultTextStyle>` all fail to state one.
|
|
151
|
+
* KNOWN GAP: the parser does not read `<p:defaultTextStyle>` or the master's
|
|
152
|
+
* `<p:otherStyle>`, and real decks routinely declare 14pt there — an unsized
|
|
153
|
+
* run in one of those decks renders 28% oversized and overflows its authored
|
|
154
|
+
* box. Fixing that needs the parser to surface the deck's declared default,
|
|
155
|
+
* not a different constant here.
|
|
156
|
+
*/
|
|
157
|
+
const DEFAULT_PPTX_FONT_SIZE_PT = 18;
|
|
158
|
+
|
|
159
|
+
function referenceBoxForSlide(
|
|
160
|
+
widthEmu: number,
|
|
161
|
+
heightEmu: number,
|
|
162
|
+
): { width: number; height: number } {
|
|
163
|
+
const target = widthEmu / heightEmu;
|
|
164
|
+
let best: { width: number; height: number } = ASPECT_RATIOS["16:9"];
|
|
165
|
+
let bestDiff = Infinity;
|
|
166
|
+
for (const preset of Object.values(ASPECT_RATIOS)) {
|
|
167
|
+
const diff = Math.abs(preset.width / preset.height - target);
|
|
168
|
+
if (diff < bestDiff) {
|
|
169
|
+
bestDiff = diff;
|
|
170
|
+
best = preset;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return { width: best.width, height: best.height };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function buildFidelitySlide(
|
|
177
|
+
slide: ParsedSlide,
|
|
178
|
+
imageUrls: string | Record<string, string> | undefined,
|
|
179
|
+
themeFont: string | undefined,
|
|
180
|
+
): string {
|
|
181
|
+
const widthEmu = slide.widthEmu || DEFAULT_SLIDE_WIDTH_EMU;
|
|
182
|
+
const heightEmu = slide.heightEmu || DEFAULT_SLIDE_HEIGHT_EMU;
|
|
183
|
+
const refBox = referenceBoxForSlide(widthEmu, heightEmu);
|
|
184
|
+
const background = slide.backgroundColor ?? DEFAULT_PPTX_BACKGROUND;
|
|
185
|
+
const gridStyle = slide.backgroundGrid
|
|
186
|
+
? `background-image:linear-gradient(to right, ${esc(slide.backgroundGrid.color)} 0 ${Math.max(0.5, toSlidePxX(slide.backgroundGrid.lineWidthEmu, widthEmu, refBox.width))}px, transparent ${Math.max(0.5, toSlidePxX(slide.backgroundGrid.lineWidthEmu, widthEmu, refBox.width))}px),linear-gradient(to bottom, ${esc(slide.backgroundGrid.color)} 0 ${Math.max(0.5, toSlidePxY(slide.backgroundGrid.lineWidthEmu, heightEmu, refBox.height))}px, transparent ${Math.max(0.5, toSlidePxY(slide.backgroundGrid.lineWidthEmu, heightEmu, refBox.height))}px);background-size:${toSlidePxX(slide.backgroundGrid.stepXEmu, widthEmu, refBox.width)}px ${toSlidePxY(slide.backgroundGrid.stepYEmu, heightEmu, refBox.height)}px;background-position:${toSlidePxX(slide.backgroundGrid.offsetXEmu, widthEmu, refBox.width)}px ${toSlidePxY(slide.backgroundGrid.offsetYEmu, heightEmu, refBox.height)}px;background-repeat:repeat;`
|
|
187
|
+
: "";
|
|
188
|
+
const elements = slide.elements ?? [];
|
|
189
|
+
const html = elements
|
|
190
|
+
.map((element, index) =>
|
|
191
|
+
buildFidelityElement(
|
|
192
|
+
element,
|
|
193
|
+
index,
|
|
194
|
+
widthEmu,
|
|
195
|
+
heightEmu,
|
|
196
|
+
refBox,
|
|
197
|
+
imageUrls,
|
|
198
|
+
themeFont,
|
|
199
|
+
),
|
|
200
|
+
)
|
|
201
|
+
.join("\n");
|
|
202
|
+
|
|
203
|
+
return `<div class="fmd-slide fmd-imported-pptx" data-imported-pptx="true" data-slide-width-emu="${widthEmu}" data-slide-height-emu="${heightEmu}" style="position: relative; width: 100%; height: 100%; overflow: hidden; background: ${esc(background)};${gridStyle} font-family: ${cssFontFamily(themeFont)};">${html}
|
|
204
|
+
</div>`;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function buildFidelityElement(
|
|
208
|
+
element: ParsedElement,
|
|
209
|
+
index: number,
|
|
210
|
+
widthEmu: number,
|
|
211
|
+
heightEmu: number,
|
|
212
|
+
refBox: { width: number; height: number },
|
|
213
|
+
imageUrls: string | Record<string, string> | undefined,
|
|
214
|
+
themeFont: string | undefined,
|
|
215
|
+
): string {
|
|
216
|
+
const widthPx = toSlidePxX(element.width, widthEmu, refBox.width);
|
|
217
|
+
const heightPx = toSlidePxY(element.height, heightEmu, refBox.height);
|
|
218
|
+
const position = `position: absolute; left: ${toSlidePxX(element.x, widthEmu, refBox.width)}px; top: ${toSlidePxY(element.y, heightEmu, refBox.height)}px; width: ${widthPx}px; height: ${heightPx}px; z-index: ${index}; box-sizing: border-box;`;
|
|
219
|
+
const rotation = element.rotation
|
|
220
|
+
? ` transform: rotate(${element.rotation}deg); transform-origin: center center;`
|
|
221
|
+
: "";
|
|
222
|
+
const objectId = ` data-slide-object-id="${esc(element.id)}"`;
|
|
223
|
+
|
|
224
|
+
if (element.kind === "image") {
|
|
225
|
+
const url = imageUrlForElement(element, imageUrls);
|
|
226
|
+
const imageStyle = imageRenderStyle(element);
|
|
227
|
+
const imagePath = customGeometryPath(element, widthPx, heightPx);
|
|
228
|
+
const clip = imagePath
|
|
229
|
+
? `clip-path: path('${imagePath}');`
|
|
230
|
+
: geometryCss(element, widthPx, heightPx);
|
|
231
|
+
return `<div class="fmd-pptx-image" data-pptx-element-kind="image" data-pptx-image-name="${esc(element.image?.name ?? "image")}"${objectId} style="${position}${rotation} overflow: hidden;${clip}">${url ? `<img src="${esc(url)}" alt="" style="${imageStyle}" />` : `<div class="fmd-img-placeholder" style="width:100%;height:100%;">Imported image: ${esc(element.image?.name ?? "image")}</div>`}</div>`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (element.kind === "table") {
|
|
235
|
+
return buildFidelityTable(
|
|
236
|
+
element,
|
|
237
|
+
widthEmu,
|
|
238
|
+
refBox.width,
|
|
239
|
+
themeFont,
|
|
240
|
+
position,
|
|
241
|
+
rotation,
|
|
242
|
+
objectId,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const customPath =
|
|
247
|
+
element.kind === "shape"
|
|
248
|
+
? customGeometryPath(element, widthPx, heightPx)
|
|
249
|
+
: undefined;
|
|
250
|
+
const outlinePath =
|
|
251
|
+
element.kind === "shape"
|
|
252
|
+
? (customPath ?? clippedPresetPath(element, widthPx, heightPx))
|
|
253
|
+
: undefined;
|
|
254
|
+
const decoration = shapeDecoration(
|
|
255
|
+
element,
|
|
256
|
+
widthEmu,
|
|
257
|
+
refBox.width,
|
|
258
|
+
widthPx,
|
|
259
|
+
heightPx,
|
|
260
|
+
customPath,
|
|
261
|
+
outlinePath,
|
|
262
|
+
);
|
|
263
|
+
if (element.kind === "shape") {
|
|
264
|
+
const stroke = outlinePath
|
|
265
|
+
? customGeometryStroke(
|
|
266
|
+
element,
|
|
267
|
+
outlinePath,
|
|
268
|
+
widthEmu,
|
|
269
|
+
refBox.width,
|
|
270
|
+
widthPx,
|
|
271
|
+
heightPx,
|
|
272
|
+
)
|
|
273
|
+
: "";
|
|
274
|
+
const caps = lineEndCaps(
|
|
275
|
+
element,
|
|
276
|
+
widthEmu,
|
|
277
|
+
refBox.width,
|
|
278
|
+
widthPx,
|
|
279
|
+
heightPx,
|
|
280
|
+
);
|
|
281
|
+
return `<div class="fmd-pptx-shape" data-pptx-element-kind="shape"${objectId} style="${position}${rotation}${decoration}">${stroke}${caps}</div>`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const textStyle = textBoxStyle(
|
|
285
|
+
element,
|
|
286
|
+
widthEmu,
|
|
287
|
+
heightEmu,
|
|
288
|
+
refBox,
|
|
289
|
+
themeFont,
|
|
290
|
+
);
|
|
291
|
+
const defaultFontWeight = element.placeholderType === "title" ? 700 : 400;
|
|
292
|
+
const boxFontSizePt = firstDeclaredFontSizePt(element.paragraphs);
|
|
293
|
+
const paragraphs = (element.paragraphs ?? [])
|
|
294
|
+
.map((paragraph, paragraphIndex) =>
|
|
295
|
+
buildFidelityParagraph(
|
|
296
|
+
paragraph,
|
|
297
|
+
paragraphIndex,
|
|
298
|
+
widthEmu,
|
|
299
|
+
refBox.width,
|
|
300
|
+
themeFont,
|
|
301
|
+
defaultFontWeight,
|
|
302
|
+
boxFontSizePt,
|
|
303
|
+
),
|
|
304
|
+
)
|
|
305
|
+
.join("\n");
|
|
306
|
+
return `<div class="fmd-pptx-text" data-pptx-element-kind="text"${objectId} style="${position}${rotation}${decoration}${textStyle}">${paragraphs}</div>`;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function toSlidePxX(
|
|
310
|
+
valueEmu: number,
|
|
311
|
+
slideWidthEmu: number,
|
|
312
|
+
refWidthPx: number,
|
|
313
|
+
): number {
|
|
314
|
+
return Math.round((valueEmu / slideWidthEmu) * refWidthPx * 1000) / 1000;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function toSlidePxY(
|
|
318
|
+
valueEmu: number,
|
|
319
|
+
slideHeightEmu: number,
|
|
320
|
+
refHeightPx: number,
|
|
321
|
+
): number {
|
|
322
|
+
return Math.round((valueEmu / slideHeightEmu) * refHeightPx * 1000) / 1000;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const EMU_PER_POINT = 12700;
|
|
326
|
+
|
|
327
|
+
function ptToSlidePx(
|
|
328
|
+
valuePt: number,
|
|
329
|
+
widthEmu: number,
|
|
330
|
+
refWidthPx: number,
|
|
331
|
+
): number {
|
|
332
|
+
return toSlidePxX(valuePt * EMU_PER_POINT, widthEmu, refWidthPx);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function imageUrlForElement(
|
|
336
|
+
element: ParsedElement,
|
|
337
|
+
imageUrls: string | Record<string, string> | undefined,
|
|
338
|
+
): string | undefined {
|
|
339
|
+
if (typeof imageUrls === "string") return imageUrls;
|
|
340
|
+
return imageUrls?.[element.id];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function imageRenderStyle(element: ParsedElement): string {
|
|
344
|
+
const crop = element.image?.crop;
|
|
345
|
+
if (!crop) return "display:block;width:100%;height:100%;object-fit:fill;";
|
|
346
|
+
const visibleWidth = Math.max(0.001, 1 - crop.left - crop.right);
|
|
347
|
+
const visibleHeight = Math.max(0.001, 1 - crop.top - crop.bottom);
|
|
348
|
+
return `display:block;position:absolute;left:${(-crop.left / visibleWidth) * 100}%;top:${(-crop.top / visibleHeight) * 100}%;width:${(1 / visibleWidth) * 100}%;height:${(1 / visibleHeight) * 100}%;object-fit:fill;`;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
type ParsedTableCell = NonNullable<
|
|
352
|
+
ParsedElement["table"]
|
|
353
|
+
>["rows"][number][number];
|
|
354
|
+
|
|
355
|
+
const DEFAULT_TABLE_CELL_MARGIN_X_EMU = 91440;
|
|
356
|
+
const DEFAULT_TABLE_CELL_MARGIN_Y_EMU = 45720;
|
|
357
|
+
|
|
358
|
+
function buildFidelityTable(
|
|
359
|
+
element: ParsedElement,
|
|
360
|
+
widthEmu: number,
|
|
361
|
+
refWidthPx: number,
|
|
362
|
+
themeFont: string | undefined,
|
|
363
|
+
position: string,
|
|
364
|
+
rotation: string,
|
|
365
|
+
objectId: string,
|
|
366
|
+
): string {
|
|
367
|
+
const rows = element.table?.rows ?? [];
|
|
368
|
+
const rowsHtml = rows
|
|
369
|
+
.map(
|
|
370
|
+
(row, rowIndex) =>
|
|
371
|
+
`<tr${rowHeightStyle(element, rowIndex)}>${row
|
|
372
|
+
.map((cell) =>
|
|
373
|
+
buildFidelityTableCell(cell, widthEmu, refWidthPx, themeFont),
|
|
374
|
+
)
|
|
375
|
+
.join("")}</tr>`,
|
|
376
|
+
)
|
|
377
|
+
.join("");
|
|
378
|
+
const columnWidths = element.table?.columnWidthsEmu ?? [];
|
|
379
|
+
const totalColumnWidth = columnWidths.reduce(
|
|
380
|
+
(total, width) => total + width,
|
|
381
|
+
0,
|
|
382
|
+
);
|
|
383
|
+
const colgroup =
|
|
384
|
+
totalColumnWidth > 0
|
|
385
|
+
? `<colgroup>${columnWidths
|
|
386
|
+
.map(
|
|
387
|
+
(width) =>
|
|
388
|
+
`<col style="width:${(width / totalColumnWidth) * 100}%" />`,
|
|
389
|
+
)
|
|
390
|
+
.join("")}</colgroup>`
|
|
391
|
+
: "";
|
|
392
|
+
return `<div class="fmd-pptx-table" data-pptx-element-kind="table"${objectId} style="${position}${rotation} overflow: hidden;"><table style="width:100%;height:100%;border-collapse:collapse;table-layout:fixed;font-family:${cssFontFamily(themeFont)};">${colgroup}${rowsHtml}</table></div>`;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function rowHeightStyle(element: ParsedElement, rowIndex: number): string {
|
|
396
|
+
const rowHeight = element.table?.rowHeightsEmu?.[rowIndex];
|
|
397
|
+
if (!rowHeight || element.height <= 0) return "";
|
|
398
|
+
return ` style="height:${(rowHeight / element.height) * 100}%"`;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function buildFidelityTableCell(
|
|
402
|
+
cell: ParsedTableCell,
|
|
403
|
+
widthEmu: number,
|
|
404
|
+
refWidthPx: number,
|
|
405
|
+
themeFont: string | undefined,
|
|
406
|
+
): string {
|
|
407
|
+
const fill = cell.fill ? `background:${esc(cell.fill)};` : "";
|
|
408
|
+
const paragraphsHtml = cell.paragraphs
|
|
409
|
+
.map((paragraph, paragraphIndex) =>
|
|
410
|
+
buildFidelityParagraph(
|
|
411
|
+
paragraph,
|
|
412
|
+
paragraphIndex,
|
|
413
|
+
widthEmu,
|
|
414
|
+
refWidthPx,
|
|
415
|
+
themeFont,
|
|
416
|
+
400,
|
|
417
|
+
),
|
|
418
|
+
)
|
|
419
|
+
.join("");
|
|
420
|
+
const paddingY = toSlidePxX(
|
|
421
|
+
DEFAULT_TABLE_CELL_MARGIN_Y_EMU,
|
|
422
|
+
widthEmu,
|
|
423
|
+
refWidthPx,
|
|
424
|
+
);
|
|
425
|
+
const paddingX = toSlidePxX(
|
|
426
|
+
DEFAULT_TABLE_CELL_MARGIN_X_EMU,
|
|
427
|
+
widthEmu,
|
|
428
|
+
refWidthPx,
|
|
429
|
+
);
|
|
430
|
+
const borders = TABLE_CELL_SIDES.map((side) =>
|
|
431
|
+
tableCellBorderCss(side, cell.borders?.[side], widthEmu, refWidthPx),
|
|
432
|
+
).join("");
|
|
433
|
+
return `<td colspan="${cell.colSpan ?? 1}" rowspan="${cell.rowSpan ?? 1}" style="padding:${paddingY}px ${paddingX}px;vertical-align:top;${fill}${borders}">${paragraphsHtml}</td>`;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const TABLE_CELL_SIDES = ["top", "right", "bottom", "left"] as const;
|
|
437
|
+
|
|
438
|
+
function tableCellBorderCss(
|
|
439
|
+
side: (typeof TABLE_CELL_SIDES)[number],
|
|
440
|
+
border: NonNullable<ParsedTableCell["borders"]>["top"],
|
|
441
|
+
widthEmu: number,
|
|
442
|
+
refWidthPx: number,
|
|
443
|
+
): string {
|
|
444
|
+
if (!border) return "";
|
|
445
|
+
const width = Math.max(
|
|
446
|
+
1,
|
|
447
|
+
toSlidePxX(border.widthEmu ?? 9525, widthEmu, refWidthPx),
|
|
448
|
+
);
|
|
449
|
+
return `border-${side}:${round3(width)}px ${border.dash ?? "solid"} ${esc(border.color)};`;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const UNRENDERABLE_GEOMETRIES = new Set([
|
|
453
|
+
"arc",
|
|
454
|
+
"bentUpArrow",
|
|
455
|
+
"bracePair",
|
|
456
|
+
"bracketPair",
|
|
457
|
+
"chord",
|
|
458
|
+
"circularArrow",
|
|
459
|
+
"corner",
|
|
460
|
+
"curvedDownArrow",
|
|
461
|
+
"curvedLeftArrow",
|
|
462
|
+
"curvedRightArrow",
|
|
463
|
+
"curvedUpArrow",
|
|
464
|
+
"donut",
|
|
465
|
+
"frame",
|
|
466
|
+
"leftBrace",
|
|
467
|
+
"leftBracket",
|
|
468
|
+
"leftCircularArrow",
|
|
469
|
+
"noSmoking",
|
|
470
|
+
"rightBrace",
|
|
471
|
+
"rightBracket",
|
|
472
|
+
]);
|
|
473
|
+
|
|
474
|
+
const DEFAULT_CORNER_ADJUSTMENT = 0.16667;
|
|
475
|
+
|
|
476
|
+
const diamondPoints = (w: number, h: number): [number, number][] => [
|
|
477
|
+
[w / 2, 0],
|
|
478
|
+
[w, h / 2],
|
|
479
|
+
[w / 2, h],
|
|
480
|
+
[0, h / 2],
|
|
481
|
+
];
|
|
482
|
+
|
|
483
|
+
const CLIP_PATH_GEOMETRIES: Record<
|
|
484
|
+
string,
|
|
485
|
+
(
|
|
486
|
+
w: number,
|
|
487
|
+
h: number,
|
|
488
|
+
ss: number,
|
|
489
|
+
adj?: Record<string, number>,
|
|
490
|
+
) => [number, number][]
|
|
491
|
+
> = {
|
|
492
|
+
halfFrame: (w, h, ss, adj) => {
|
|
493
|
+
const x1 = (ss * pin(0, adj?.adj2 ?? 33333, (100000 * w) / ss)) / 100000;
|
|
494
|
+
const y1 =
|
|
495
|
+
(ss * pin(0, adj?.adj1 ?? 33333, (100000 * (h - (h * x1) / w)) / ss)) /
|
|
496
|
+
100000;
|
|
497
|
+
return [
|
|
498
|
+
[0, 0],
|
|
499
|
+
[w, 0],
|
|
500
|
+
[w - (y1 * w) / h, y1],
|
|
501
|
+
[x1, y1],
|
|
502
|
+
[x1, h - (x1 * h) / w],
|
|
503
|
+
[0, h],
|
|
504
|
+
];
|
|
505
|
+
},
|
|
506
|
+
triangle: (w, h) => [
|
|
507
|
+
[w / 2, 0],
|
|
508
|
+
[w, h],
|
|
509
|
+
[0, h],
|
|
510
|
+
],
|
|
511
|
+
rtTriangle: (w, h) => [
|
|
512
|
+
[0, 0],
|
|
513
|
+
[w, h],
|
|
514
|
+
[0, h],
|
|
515
|
+
],
|
|
516
|
+
diamond: diamondPoints,
|
|
517
|
+
flowChartDecision: diamondPoints,
|
|
518
|
+
homePlate: (w, h, ss) => {
|
|
519
|
+
const x = ss * 0.16667;
|
|
520
|
+
return [
|
|
521
|
+
[0, 0],
|
|
522
|
+
[w - x, 0],
|
|
523
|
+
[w, h / 2],
|
|
524
|
+
[w - x, h],
|
|
525
|
+
[0, h],
|
|
526
|
+
];
|
|
527
|
+
},
|
|
528
|
+
chevron: (w, h, ss) => {
|
|
529
|
+
const x = ss * 0.5;
|
|
530
|
+
return [
|
|
531
|
+
[0, 0],
|
|
532
|
+
[w - x, 0],
|
|
533
|
+
[w, h / 2],
|
|
534
|
+
[w - x, h],
|
|
535
|
+
[0, h],
|
|
536
|
+
[x, h / 2],
|
|
537
|
+
];
|
|
538
|
+
},
|
|
539
|
+
hexagon: (w, h, ss) => {
|
|
540
|
+
const x = ss * 0.25;
|
|
541
|
+
return [
|
|
542
|
+
[x, 0],
|
|
543
|
+
[w - x, 0],
|
|
544
|
+
[w, h / 2],
|
|
545
|
+
[w - x, h],
|
|
546
|
+
[x, h],
|
|
547
|
+
[0, h / 2],
|
|
548
|
+
];
|
|
549
|
+
},
|
|
550
|
+
trapezoid: (w, h, ss) => {
|
|
551
|
+
const x = ss * 0.25;
|
|
552
|
+
return [
|
|
553
|
+
[x, 0],
|
|
554
|
+
[w - x, 0],
|
|
555
|
+
[w, h],
|
|
556
|
+
[0, h],
|
|
557
|
+
];
|
|
558
|
+
},
|
|
559
|
+
parallelogram: (w, h, ss) => {
|
|
560
|
+
const x = ss * 0.25;
|
|
561
|
+
return [
|
|
562
|
+
[x, 0],
|
|
563
|
+
[w, 0],
|
|
564
|
+
[w - x, h],
|
|
565
|
+
[0, h],
|
|
566
|
+
];
|
|
567
|
+
},
|
|
568
|
+
octagon: (w, h, ss) => {
|
|
569
|
+
const c = ss * 0.29289;
|
|
570
|
+
return [
|
|
571
|
+
[c, 0],
|
|
572
|
+
[w - c, 0],
|
|
573
|
+
[w, c],
|
|
574
|
+
[w, h - c],
|
|
575
|
+
[w - c, h],
|
|
576
|
+
[c, h],
|
|
577
|
+
[0, h - c],
|
|
578
|
+
[0, c],
|
|
579
|
+
];
|
|
580
|
+
},
|
|
581
|
+
pentagon: (w, h) => [
|
|
582
|
+
[w / 2, 0],
|
|
583
|
+
[w, h * 0.38],
|
|
584
|
+
[w * 0.82, h],
|
|
585
|
+
[w * 0.18, h],
|
|
586
|
+
[0, h * 0.38],
|
|
587
|
+
],
|
|
588
|
+
plus: (w, h, ss) => {
|
|
589
|
+
const a = ss * 0.25;
|
|
590
|
+
return [
|
|
591
|
+
[a, 0],
|
|
592
|
+
[w - a, 0],
|
|
593
|
+
[w - a, a],
|
|
594
|
+
[w, a],
|
|
595
|
+
[w, h - a],
|
|
596
|
+
[w - a, h - a],
|
|
597
|
+
[w - a, h],
|
|
598
|
+
[a, h],
|
|
599
|
+
[a, h - a],
|
|
600
|
+
[0, h - a],
|
|
601
|
+
[0, a],
|
|
602
|
+
[a, a],
|
|
603
|
+
];
|
|
604
|
+
},
|
|
605
|
+
downArrow: (w, h, ss) => arrowPoints(w, h, ss, "down"),
|
|
606
|
+
upArrow: (w, h, ss) => arrowPoints(w, h, ss, "up"),
|
|
607
|
+
rightArrow: (w, h, ss) => arrowPoints(w, h, ss, "right"),
|
|
608
|
+
leftArrow: (w, h, ss) => arrowPoints(w, h, ss, "left"),
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
function arrowPoints(
|
|
612
|
+
w: number,
|
|
613
|
+
h: number,
|
|
614
|
+
ss: number,
|
|
615
|
+
direction: "up" | "down" | "left" | "right",
|
|
616
|
+
): [number, number][] {
|
|
617
|
+
const shaft = ss * 0.25;
|
|
618
|
+
const head = ss * 0.5;
|
|
619
|
+
if (direction === "down" || direction === "up") {
|
|
620
|
+
const cx = w / 2;
|
|
621
|
+
const base: [number, number][] = [
|
|
622
|
+
[cx - shaft, 0],
|
|
623
|
+
[cx + shaft, 0],
|
|
624
|
+
[cx + shaft, h - head],
|
|
625
|
+
[w, h - head],
|
|
626
|
+
[cx, h],
|
|
627
|
+
[0, h - head],
|
|
628
|
+
[cx - shaft, h - head],
|
|
629
|
+
];
|
|
630
|
+
return direction === "down"
|
|
631
|
+
? base
|
|
632
|
+
: base.map(([x, y]) => [x, h - y] as [number, number]);
|
|
633
|
+
}
|
|
634
|
+
const cy = h / 2;
|
|
635
|
+
const base: [number, number][] = [
|
|
636
|
+
[0, cy - shaft],
|
|
637
|
+
[w - head, cy - shaft],
|
|
638
|
+
[w - head, 0],
|
|
639
|
+
[w, cy],
|
|
640
|
+
[w - head, h],
|
|
641
|
+
[w - head, cy + shaft],
|
|
642
|
+
[0, cy + shaft],
|
|
643
|
+
];
|
|
644
|
+
return direction === "right"
|
|
645
|
+
? base
|
|
646
|
+
: base.map(([x, y]) => [w - x, y] as [number, number]);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function toPercent(value: number, total: number): number {
|
|
650
|
+
return Math.round((value / Math.max(total, 0.001)) * 10000) / 100;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
function blockArcPath(
|
|
654
|
+
adjustments: Record<string, number> | undefined,
|
|
655
|
+
widthPx: number,
|
|
656
|
+
heightPx: number,
|
|
657
|
+
): string | undefined {
|
|
658
|
+
const startAngle = (adjustments?.adj1 ?? 10800000) / 60000;
|
|
659
|
+
const endAngle = (adjustments?.adj2 ?? 0) / 60000;
|
|
660
|
+
const thickness = Math.min(Math.max(adjustments?.adj3 ?? 25000, 0), 50000);
|
|
661
|
+
let swing = endAngle - startAngle;
|
|
662
|
+
while (swing <= 0) swing += 360;
|
|
663
|
+
swing = Math.min(swing, 359.9);
|
|
664
|
+
const outerX = widthPx / 2;
|
|
665
|
+
const outerY = heightPx / 2;
|
|
666
|
+
const inset = (Math.min(widthPx, heightPx) * thickness) / 100000;
|
|
667
|
+
const innerX = outerX - inset;
|
|
668
|
+
const innerY = outerY - inset;
|
|
669
|
+
if (!(innerX > 0) || !(innerY > 0)) return undefined;
|
|
670
|
+
// ponytail: parametric angles, exact for a circular block arc — which is
|
|
671
|
+
// every one in the decks this was measured against. A markedly elliptical
|
|
672
|
+
// one starts and ends a few degrees around from where PowerPoint puts it;
|
|
673
|
+
// OOXML's `cat2`/`sat2` true-angle correction is the upgrade.
|
|
674
|
+
const at = (radiusX: number, radiusY: number, degrees: number) => {
|
|
675
|
+
const angle = (degrees * Math.PI) / 180;
|
|
676
|
+
return `${round1(outerX + radiusX * Math.cos(angle))} ${round1(outerY + radiusY * Math.sin(angle))}`;
|
|
677
|
+
};
|
|
678
|
+
const large = swing > 180 ? 1 : 0;
|
|
679
|
+
return [
|
|
680
|
+
`M${at(outerX, outerY, startAngle)}`,
|
|
681
|
+
`A${round1(outerX)} ${round1(outerY)} 0 ${large} 1 ${at(outerX, outerY, startAngle + swing)}`,
|
|
682
|
+
`L${at(innerX, innerY, startAngle + swing)}`,
|
|
683
|
+
`A${round1(innerX)} ${round1(innerY)} 0 ${large} 0 ${at(innerX, innerY, startAngle)}`,
|
|
684
|
+
"Z",
|
|
685
|
+
].join(" ");
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function pin(min: number, value: number, max: number): number {
|
|
689
|
+
return Math.min(Math.max(value, min), max);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function ellipseAngle(
|
|
693
|
+
angle60k: number,
|
|
694
|
+
radiusX: number,
|
|
695
|
+
radiusY: number,
|
|
696
|
+
): number {
|
|
697
|
+
const radians = (angle60k / 60000) * (Math.PI / 180);
|
|
698
|
+
return Math.atan2(radiusX * Math.sin(radians), radiusY * Math.cos(radians));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function presetPen(
|
|
702
|
+
widthPx: number,
|
|
703
|
+
heightPx: number,
|
|
704
|
+
flipH?: boolean,
|
|
705
|
+
flipV?: boolean,
|
|
706
|
+
) {
|
|
707
|
+
const parts: string[] = [];
|
|
708
|
+
const toX = (x: number) => round1(flipH ? widthPx - x : x);
|
|
709
|
+
const toY = (y: number) => round1(flipV ? heightPx - y : y);
|
|
710
|
+
const mirrored = Boolean(flipH) !== Boolean(flipV);
|
|
711
|
+
let currentX = 0;
|
|
712
|
+
let currentY = 0;
|
|
713
|
+
const emit = (command: string, points: [number, number][]) => {
|
|
714
|
+
const last = points[points.length - 1]!;
|
|
715
|
+
currentX = last[0];
|
|
716
|
+
currentY = last[1];
|
|
717
|
+
parts.push(
|
|
718
|
+
`${command}${points.map(([x, y]) => `${toX(x)} ${toY(y)}`).join(" ")}`,
|
|
719
|
+
);
|
|
720
|
+
};
|
|
721
|
+
return {
|
|
722
|
+
move: (x: number, y: number) => emit("M", [[x, y]]),
|
|
723
|
+
line: (x: number, y: number) => emit("L", [[x, y]]),
|
|
724
|
+
cubic: (points: [number, number][]) => emit("C", points),
|
|
725
|
+
arc: (
|
|
726
|
+
radiusX: number,
|
|
727
|
+
radiusY: number,
|
|
728
|
+
start60k: number,
|
|
729
|
+
swing60k: number,
|
|
730
|
+
) => {
|
|
731
|
+
const start = ellipseAngle(start60k, radiusX, radiusY);
|
|
732
|
+
const end = ellipseAngle(start60k + swing60k, radiusX, radiusY);
|
|
733
|
+
const centerX = currentX - radiusX * Math.cos(start);
|
|
734
|
+
const centerY = currentY - radiusY * Math.sin(start);
|
|
735
|
+
currentX = centerX + radiusX * Math.cos(end);
|
|
736
|
+
currentY = centerY + radiusY * Math.sin(end);
|
|
737
|
+
const large = Math.abs(swing60k) > 180 * 60000 ? 1 : 0;
|
|
738
|
+
const sweep = swing60k >= 0 !== mirrored ? 1 : 0;
|
|
739
|
+
parts.push(
|
|
740
|
+
`A${round1(radiusX)} ${round1(radiusY)} 0 ${large} ${sweep} ${toX(currentX)} ${toY(currentY)}`,
|
|
741
|
+
);
|
|
742
|
+
},
|
|
743
|
+
close: () => parts.push("Z"),
|
|
744
|
+
path: () => parts.join(" "),
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
const PRESET_PATH_GEOMETRIES: Record<
|
|
749
|
+
string,
|
|
750
|
+
(
|
|
751
|
+
pen: ReturnType<typeof presetPen>,
|
|
752
|
+
w: number,
|
|
753
|
+
h: number,
|
|
754
|
+
adj: Record<string, number> | undefined,
|
|
755
|
+
) => void
|
|
756
|
+
> = {
|
|
757
|
+
heart: (pen, w, h) => {
|
|
758
|
+
const hc = w / 2;
|
|
759
|
+
const quarter = h / 4;
|
|
760
|
+
const dx1 = (w * 49) / 48;
|
|
761
|
+
const dx2 = (w * 10) / 48;
|
|
762
|
+
const y1 = -h / 3;
|
|
763
|
+
pen.move(hc, quarter);
|
|
764
|
+
pen.cubic([
|
|
765
|
+
[hc + dx2, y1],
|
|
766
|
+
[hc + dx1, quarter],
|
|
767
|
+
[hc, h],
|
|
768
|
+
]);
|
|
769
|
+
pen.cubic([
|
|
770
|
+
[hc - dx1, quarter],
|
|
771
|
+
[hc - dx2, y1],
|
|
772
|
+
[hc, quarter],
|
|
773
|
+
]);
|
|
774
|
+
pen.close();
|
|
775
|
+
},
|
|
776
|
+
pie: (pen, w, h, adj) => {
|
|
777
|
+
const radiusX = w / 2;
|
|
778
|
+
const radiusY = h / 2;
|
|
779
|
+
const startAngle = pin(0, adj?.adj1 ?? 0, 21599999);
|
|
780
|
+
const endAngle = pin(0, adj?.adj2 ?? 16200000, 21599999);
|
|
781
|
+
const span = endAngle - startAngle;
|
|
782
|
+
const swing = Math.min(span > 0 ? span : span + 21600000, 21594000);
|
|
783
|
+
const start = ellipseAngle(startAngle, radiusX, radiusY);
|
|
784
|
+
pen.move(
|
|
785
|
+
radiusX + radiusX * Math.cos(start),
|
|
786
|
+
radiusY + radiusY * Math.sin(start),
|
|
787
|
+
);
|
|
788
|
+
pen.arc(radiusX, radiusY, startAngle, swing);
|
|
789
|
+
pen.line(radiusX, radiusY);
|
|
790
|
+
pen.close();
|
|
791
|
+
},
|
|
792
|
+
uturnArrow: (pen, w, h, adj) => {
|
|
793
|
+
const ss = Math.min(w, h);
|
|
794
|
+
const a2 = pin(0, adj?.adj2 ?? 25000, 25000);
|
|
795
|
+
const a1 = pin(0, adj?.adj1 ?? 25000, a2 * 2);
|
|
796
|
+
const a3 = pin(0, adj?.adj3 ?? 25000, ((100000 - (a1 * ss) / h) * h) / ss);
|
|
797
|
+
const a5 = pin(((a3 + a1) * ss) / h, adj?.adj5 ?? 75000, 100000);
|
|
798
|
+
const th = (ss * a1) / 100000;
|
|
799
|
+
const aw2 = (ss * a2) / 100000;
|
|
800
|
+
const dh2 = aw2 - th / 2;
|
|
801
|
+
const y5 = (h * a5) / 100000;
|
|
802
|
+
const y4 = y5 - (ss * a3) / 100000;
|
|
803
|
+
const x9 = w - dh2;
|
|
804
|
+
const a4 = pin(0, adj?.adj4 ?? 43750, (Math.min(x9 / 2, y4) * 100000) / ss);
|
|
805
|
+
const bd = (ss * a4) / 100000;
|
|
806
|
+
const bd2 = Math.max(bd - th, 0);
|
|
807
|
+
const x3 = th + bd2;
|
|
808
|
+
const x8 = w - aw2;
|
|
809
|
+
const x6 = x8 - aw2;
|
|
810
|
+
const x7 = x6 + dh2;
|
|
811
|
+
pen.move(0, h);
|
|
812
|
+
pen.line(0, bd);
|
|
813
|
+
pen.arc(bd, bd, 10800000, 5400000);
|
|
814
|
+
pen.line(x9 - bd, 0);
|
|
815
|
+
pen.arc(bd, bd, 16200000, 5400000);
|
|
816
|
+
pen.line(x9, y4);
|
|
817
|
+
pen.line(w, y4);
|
|
818
|
+
pen.line(x8, y5);
|
|
819
|
+
pen.line(x6, y4);
|
|
820
|
+
pen.line(x7, y4);
|
|
821
|
+
pen.line(x7, x3);
|
|
822
|
+
pen.arc(bd2, bd2, 0, -5400000);
|
|
823
|
+
pen.line(x3, th);
|
|
824
|
+
pen.arc(bd2, bd2, 16200000, -5400000);
|
|
825
|
+
pen.line(th, h);
|
|
826
|
+
pen.close();
|
|
827
|
+
},
|
|
828
|
+
bentArrow: (pen, w, h, adj) => {
|
|
829
|
+
const ss = Math.min(w, h);
|
|
830
|
+
const a2 = pin(0, adj?.adj2 ?? 25000, 50000);
|
|
831
|
+
const a1 = pin(0, adj?.adj1 ?? 25000, a2 * 2);
|
|
832
|
+
const a3 = pin(0, adj?.adj3 ?? 25000, 50000);
|
|
833
|
+
const th = (ss * a1) / 100000;
|
|
834
|
+
const aw2 = (ss * a2) / 100000;
|
|
835
|
+
const dh2 = aw2 - th / 2;
|
|
836
|
+
const ah = (ss * a3) / 100000;
|
|
837
|
+
const a4 = pin(
|
|
838
|
+
0,
|
|
839
|
+
adj?.adj4 ?? 43750,
|
|
840
|
+
(100000 * Math.min(w - ah, h - dh2)) / ss,
|
|
841
|
+
);
|
|
842
|
+
const bd = (ss * a4) / 100000;
|
|
843
|
+
const bd2 = Math.max(bd - th, 0);
|
|
844
|
+
const x4 = w - ah;
|
|
845
|
+
const y3 = dh2 + th;
|
|
846
|
+
pen.move(0, h);
|
|
847
|
+
pen.line(0, dh2 + bd);
|
|
848
|
+
pen.arc(bd, bd, 10800000, 5400000);
|
|
849
|
+
pen.line(x4, dh2);
|
|
850
|
+
pen.line(x4, 0);
|
|
851
|
+
pen.line(w, aw2);
|
|
852
|
+
pen.line(x4, y3 + dh2);
|
|
853
|
+
pen.line(x4, y3);
|
|
854
|
+
pen.line(th + bd2, y3);
|
|
855
|
+
pen.arc(bd2, bd2, 16200000, -5400000);
|
|
856
|
+
pen.line(th, h);
|
|
857
|
+
pen.close();
|
|
858
|
+
},
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
function presetGeometryPath(
|
|
862
|
+
element: ParsedElement,
|
|
863
|
+
widthPx: number,
|
|
864
|
+
heightPx: number,
|
|
865
|
+
): string | undefined {
|
|
866
|
+
const build = element.shapeType
|
|
867
|
+
? PRESET_PATH_GEOMETRIES[element.shapeType]
|
|
868
|
+
: undefined;
|
|
869
|
+
if (!build) return undefined;
|
|
870
|
+
if (!(widthPx > 0) || !(heightPx > 0)) return undefined;
|
|
871
|
+
const pen = presetPen(widthPx, heightPx, element.flipH, element.flipV);
|
|
872
|
+
build(pen, widthPx, heightPx, element.shapeAdjustments);
|
|
873
|
+
return pen.path();
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
function geometryCss(
|
|
877
|
+
element: ParsedElement,
|
|
878
|
+
widthPx: number,
|
|
879
|
+
heightPx: number,
|
|
880
|
+
): string {
|
|
881
|
+
const shapeType = element.shapeType;
|
|
882
|
+
const adjustments = element.shapeAdjustments;
|
|
883
|
+
if (!shapeType) return "";
|
|
884
|
+
const shortest = Math.min(widthPx, heightPx);
|
|
885
|
+
const corner = round3(shortest * DEFAULT_CORNER_ADJUSTMENT);
|
|
886
|
+
switch (shapeType) {
|
|
887
|
+
case "ellipse":
|
|
888
|
+
case "smileyFace":
|
|
889
|
+
return "border-radius: 50%;";
|
|
890
|
+
case "roundRect":
|
|
891
|
+
return `border-radius: ${corner}px;`;
|
|
892
|
+
case "round1Rect":
|
|
893
|
+
return `border-radius: 0 ${corner}px 0 0;`;
|
|
894
|
+
case "round2SameRect":
|
|
895
|
+
return `border-radius: ${corner}px ${corner}px 0 0;`;
|
|
896
|
+
case "round2DiagRect":
|
|
897
|
+
return `border-radius: ${corner}px 0 ${corner}px 0;`;
|
|
898
|
+
case "flowChartTerminator":
|
|
899
|
+
return `border-radius: ${round3(shortest / 2)}px;`;
|
|
900
|
+
case "blockArc": {
|
|
901
|
+
const path = blockArcPath(adjustments, widthPx, heightPx);
|
|
902
|
+
return path ? `clip-path: path('${path}');` : "";
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
const presetPath = presetGeometryPath(element, widthPx, heightPx);
|
|
906
|
+
if (presetPath) return `clip-path: path('${presetPath}');`;
|
|
907
|
+
const points = CLIP_PATH_GEOMETRIES[shapeType]?.(
|
|
908
|
+
widthPx,
|
|
909
|
+
heightPx,
|
|
910
|
+
shortest,
|
|
911
|
+
adjustments,
|
|
912
|
+
);
|
|
913
|
+
if (!points) return "";
|
|
914
|
+
const polygon = points
|
|
915
|
+
.map(([x, y]) => `${toPercent(x, widthPx)}% ${toPercent(y, heightPx)}%`)
|
|
916
|
+
.join(", ");
|
|
917
|
+
return `clip-path: polygon(${polygon});`;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
function clippedPresetPath(
|
|
921
|
+
element: ParsedElement,
|
|
922
|
+
widthPx: number,
|
|
923
|
+
heightPx: number,
|
|
924
|
+
): string | undefined {
|
|
925
|
+
const shapeType = element.shapeType;
|
|
926
|
+
const adjustments = element.shapeAdjustments;
|
|
927
|
+
if (!shapeType) return undefined;
|
|
928
|
+
if (shapeType === "blockArc") {
|
|
929
|
+
return blockArcPath(adjustments, widthPx, heightPx);
|
|
930
|
+
}
|
|
931
|
+
const presetPath = presetGeometryPath(element, widthPx, heightPx);
|
|
932
|
+
if (presetPath) return presetPath;
|
|
933
|
+
const points = CLIP_PATH_GEOMETRIES[shapeType]?.(
|
|
934
|
+
widthPx,
|
|
935
|
+
heightPx,
|
|
936
|
+
Math.min(widthPx, heightPx),
|
|
937
|
+
adjustments,
|
|
938
|
+
);
|
|
939
|
+
if (!points) return undefined;
|
|
940
|
+
return `${points
|
|
941
|
+
.map(
|
|
942
|
+
([x, y], index) => `${index === 0 ? "M" : "L"}${round1(x)} ${round1(y)}`,
|
|
943
|
+
)
|
|
944
|
+
.join(" ")} Z`;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
function round3(value: number): number {
|
|
948
|
+
return Math.round(value * 1000) / 1000;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
function round1(value: number): number {
|
|
952
|
+
return Math.round(value * 10) / 10;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
function createPathWriter() {
|
|
956
|
+
let out = "";
|
|
957
|
+
let lastCommand = "";
|
|
958
|
+
let afterLetter = false;
|
|
959
|
+
let previousNumberHadPoint = false;
|
|
960
|
+
let x = 0;
|
|
961
|
+
let y = 0;
|
|
962
|
+
let subpathX = 0;
|
|
963
|
+
let subpathY = 0;
|
|
964
|
+
|
|
965
|
+
const number = (value: number): number => {
|
|
966
|
+
const rounded = round1(value);
|
|
967
|
+
let text = String(rounded);
|
|
968
|
+
if (text.startsWith("0.")) text = text.slice(1);
|
|
969
|
+
else if (text.startsWith("-0.")) text = `-${text.slice(2)}`;
|
|
970
|
+
const joins =
|
|
971
|
+
afterLetter ||
|
|
972
|
+
text.startsWith("-") ||
|
|
973
|
+
(text.startsWith(".") && previousNumberHadPoint);
|
|
974
|
+
out += joins ? text : ` ${text}`;
|
|
975
|
+
afterLetter = false;
|
|
976
|
+
previousNumberHadPoint = text.includes(".");
|
|
977
|
+
return rounded;
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
const command = (letter: string) => {
|
|
981
|
+
if (lastCommand === letter) return;
|
|
982
|
+
out += letter;
|
|
983
|
+
afterLetter = true;
|
|
984
|
+
lastCommand = letter === "m" ? "l" : letter;
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
return {
|
|
988
|
+
write(letter: string, points: { x: number; y: number }[]) {
|
|
989
|
+
command(letter);
|
|
990
|
+
const fromX = x;
|
|
991
|
+
const fromY = y;
|
|
992
|
+
for (const point of points) {
|
|
993
|
+
x = fromX + number(point.x - fromX);
|
|
994
|
+
y = fromY + number(point.y - fromY);
|
|
995
|
+
}
|
|
996
|
+
if (letter === "m") {
|
|
997
|
+
subpathX = x;
|
|
998
|
+
subpathY = y;
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
arc(
|
|
1002
|
+
radiusX: number,
|
|
1003
|
+
radiusY: number,
|
|
1004
|
+
largeArc: number,
|
|
1005
|
+
sweep: number,
|
|
1006
|
+
toX: number,
|
|
1007
|
+
toY: number,
|
|
1008
|
+
) {
|
|
1009
|
+
command("a");
|
|
1010
|
+
number(radiusX);
|
|
1011
|
+
number(radiusY);
|
|
1012
|
+
number(0);
|
|
1013
|
+
number(largeArc);
|
|
1014
|
+
number(sweep);
|
|
1015
|
+
const fromX = x;
|
|
1016
|
+
const fromY = y;
|
|
1017
|
+
x = fromX + number(toX - fromX);
|
|
1018
|
+
y = fromY + number(toY - fromY);
|
|
1019
|
+
},
|
|
1020
|
+
close() {
|
|
1021
|
+
out += "z";
|
|
1022
|
+
afterLetter = true;
|
|
1023
|
+
lastCommand = "";
|
|
1024
|
+
x = subpathX;
|
|
1025
|
+
y = subpathY;
|
|
1026
|
+
},
|
|
1027
|
+
result: () => out,
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
function customGeometryPath(
|
|
1032
|
+
element: ParsedElement,
|
|
1033
|
+
widthPx: number,
|
|
1034
|
+
heightPx: number,
|
|
1035
|
+
): string | undefined {
|
|
1036
|
+
const geometry = element.geometry;
|
|
1037
|
+
if (!geometry || geometry.kind !== "custom") return undefined;
|
|
1038
|
+
if (!(widthPx > 0) || !(heightPx > 0)) return undefined;
|
|
1039
|
+
const writer = createPathWriter();
|
|
1040
|
+
let wrote = false;
|
|
1041
|
+
for (const path of geometry.paths) {
|
|
1042
|
+
const scaleX = widthPx / path.w;
|
|
1043
|
+
const scaleY = heightPx / path.h;
|
|
1044
|
+
const toX = (x: number) =>
|
|
1045
|
+
element.flipH ? widthPx - x * scaleX : x * scaleX;
|
|
1046
|
+
const toY = (y: number) =>
|
|
1047
|
+
element.flipV ? heightPx - y * scaleY : y * scaleY;
|
|
1048
|
+
let currentX = 0;
|
|
1049
|
+
let currentY = 0;
|
|
1050
|
+
for (const command of path.commands) {
|
|
1051
|
+
wrote = true;
|
|
1052
|
+
if (command.kind === "close") {
|
|
1053
|
+
writer.close();
|
|
1054
|
+
continue;
|
|
1055
|
+
}
|
|
1056
|
+
if (command.kind === "arcTo") {
|
|
1057
|
+
const start = (command.stAng / 60000) * (Math.PI / 180);
|
|
1058
|
+
const swing = (command.swAng / 60000) * (Math.PI / 180);
|
|
1059
|
+
const centerX = currentX - command.wR * Math.cos(start);
|
|
1060
|
+
const centerY = currentY - command.hR * Math.sin(start);
|
|
1061
|
+
currentX = centerX + command.wR * Math.cos(start + swing);
|
|
1062
|
+
currentY = centerY + command.hR * Math.sin(start + swing);
|
|
1063
|
+
const largeArc = Math.abs(command.swAng) > 180 * 60000 ? 1 : 0;
|
|
1064
|
+
const sweep =
|
|
1065
|
+
command.swAng >= 0 !==
|
|
1066
|
+
(Boolean(element.flipH) !== Boolean(element.flipV))
|
|
1067
|
+
? 1
|
|
1068
|
+
: 0;
|
|
1069
|
+
writer.arc(
|
|
1070
|
+
command.wR * scaleX,
|
|
1071
|
+
command.hR * scaleY,
|
|
1072
|
+
largeArc,
|
|
1073
|
+
sweep,
|
|
1074
|
+
toX(currentX),
|
|
1075
|
+
toY(currentY),
|
|
1076
|
+
);
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
const last = command.points[command.points.length - 1]!;
|
|
1080
|
+
currentX = last.x;
|
|
1081
|
+
currentY = last.y;
|
|
1082
|
+
writer.write(
|
|
1083
|
+
{ moveTo: "m", lnTo: "l", quadBezTo: "q", cubicBezTo: "c" }[
|
|
1084
|
+
command.kind
|
|
1085
|
+
],
|
|
1086
|
+
command.points.map((point) => ({ x: toX(point.x), y: toY(point.y) })),
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return wrote ? writer.result() : undefined;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
function customGeometryStroke(
|
|
1094
|
+
element: ParsedElement,
|
|
1095
|
+
pathData: string,
|
|
1096
|
+
widthEmu: number,
|
|
1097
|
+
refWidthPx: number,
|
|
1098
|
+
widthPx: number,
|
|
1099
|
+
heightPx: number,
|
|
1100
|
+
): string {
|
|
1101
|
+
if (!element.lineColor) return "";
|
|
1102
|
+
const stroke = Math.max(
|
|
1103
|
+
1,
|
|
1104
|
+
toSlidePxX(element.lineWidth ?? 12700, widthEmu, refWidthPx),
|
|
1105
|
+
);
|
|
1106
|
+
return `<svg viewBox="0 0 ${round3(widthPx)} ${round3(heightPx)}" preserveAspectRatio="none" style="position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;"><path d="${esc(pathData)}" fill="none" stroke="${esc(element.lineColor)}" stroke-width="${stroke}" /></svg>`;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
function strokeDecoration(
|
|
1110
|
+
element: ParsedElement,
|
|
1111
|
+
widthEmu: number,
|
|
1112
|
+
refWidthPx: number,
|
|
1113
|
+
widthPx: number,
|
|
1114
|
+
heightPx: number,
|
|
1115
|
+
): string {
|
|
1116
|
+
if (!element.lineColor) return "";
|
|
1117
|
+
const stroke = strokeWidthPx(element, widthEmu, refWidthPx);
|
|
1118
|
+
const color = esc(element.lineColor);
|
|
1119
|
+
const axis = lineAxis(widthPx, heightPx, stroke);
|
|
1120
|
+
if (axis === "x") return `border-top: ${stroke}px solid ${color};`;
|
|
1121
|
+
if (axis === "y") return `border-left: ${stroke}px solid ${color};`;
|
|
1122
|
+
return `border: ${stroke}px solid ${color};`;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
function strokeWidthPx(
|
|
1126
|
+
element: ParsedElement,
|
|
1127
|
+
widthEmu: number,
|
|
1128
|
+
refWidthPx: number,
|
|
1129
|
+
): number {
|
|
1130
|
+
return Math.max(
|
|
1131
|
+
1,
|
|
1132
|
+
toSlidePxX(element.lineWidth ?? 12700, widthEmu, refWidthPx),
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
function lineAxis(
|
|
1137
|
+
widthPx: number,
|
|
1138
|
+
heightPx: number,
|
|
1139
|
+
stroke: number,
|
|
1140
|
+
): "x" | "y" | undefined {
|
|
1141
|
+
if (heightPx < stroke * 2 && widthPx > heightPx) return "x";
|
|
1142
|
+
if (widthPx < stroke * 2 && heightPx > widthPx) return "y";
|
|
1143
|
+
return undefined;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
const LINE_END_SCALE: Record<string, number> = { sm: 2, med: 3, lg: 5 };
|
|
1147
|
+
|
|
1148
|
+
function lineEndCaps(
|
|
1149
|
+
element: ParsedElement,
|
|
1150
|
+
widthEmu: number,
|
|
1151
|
+
refWidthPx: number,
|
|
1152
|
+
widthPx: number,
|
|
1153
|
+
heightPx: number,
|
|
1154
|
+
): string {
|
|
1155
|
+
const head = ovalCapRadius(element.lineHeadEnd);
|
|
1156
|
+
const tail = ovalCapRadius(element.lineTailEnd);
|
|
1157
|
+
if (!element.lineColor || (!head && !tail)) return "";
|
|
1158
|
+
const stroke = strokeWidthPx(element, widthEmu, refWidthPx);
|
|
1159
|
+
const axis = lineAxis(widthPx, heightPx, stroke);
|
|
1160
|
+
if (!axis) return "";
|
|
1161
|
+
const along = axis === "x" ? widthPx : heightPx;
|
|
1162
|
+
const flipped = axis === "x" ? element.flipH : element.flipV;
|
|
1163
|
+
const point = (distance: number, radius: number) => ({
|
|
1164
|
+
radius: radius * stroke,
|
|
1165
|
+
x: axis === "x" ? distance : stroke / 2,
|
|
1166
|
+
y: axis === "x" ? stroke / 2 : distance,
|
|
1167
|
+
});
|
|
1168
|
+
const caps = [
|
|
1169
|
+
head ? point(flipped ? along : 0, head) : undefined,
|
|
1170
|
+
tail ? point(flipped ? 0 : along, tail) : undefined,
|
|
1171
|
+
].filter((cap) => cap !== undefined);
|
|
1172
|
+
const pad = Math.max(...caps.map((cap) => cap.radius));
|
|
1173
|
+
const boxWidth = round3(widthPx + pad * 2);
|
|
1174
|
+
const boxHeight = round3(heightPx + pad * 2);
|
|
1175
|
+
const circles = caps
|
|
1176
|
+
.map(
|
|
1177
|
+
(cap) =>
|
|
1178
|
+
`<circle cx="${round3(cap.x + pad)}" cy="${round3(cap.y + pad)}" r="${round3(cap.radius)}" fill="${esc(element.lineColor ?? "")}" />`,
|
|
1179
|
+
)
|
|
1180
|
+
.join("");
|
|
1181
|
+
return `<svg viewBox="0 0 ${boxWidth} ${boxHeight}" style="position:absolute;left:${round3(-pad)}px;top:${round3(-pad)}px;width:${boxWidth}px;height:${boxHeight}px;overflow:visible;pointer-events:none;">${circles}</svg>`;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
function ovalCapRadius(end: ParsedElement["lineHeadEnd"]): number | undefined {
|
|
1185
|
+
if (end?.type !== "oval") return undefined;
|
|
1186
|
+
return (LINE_END_SCALE[end.w ?? "med"] ?? LINE_END_SCALE.med) / 2;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
function shapeDecoration(
|
|
1190
|
+
element: ParsedElement,
|
|
1191
|
+
widthEmu: number,
|
|
1192
|
+
refWidthPx: number,
|
|
1193
|
+
widthPx: number,
|
|
1194
|
+
heightPx: number,
|
|
1195
|
+
customPath: string | undefined,
|
|
1196
|
+
outlinePath: string | undefined,
|
|
1197
|
+
): string {
|
|
1198
|
+
if (
|
|
1199
|
+
!customPath &&
|
|
1200
|
+
element.shapeType &&
|
|
1201
|
+
UNRENDERABLE_GEOMETRIES.has(element.shapeType)
|
|
1202
|
+
) {
|
|
1203
|
+
return "";
|
|
1204
|
+
}
|
|
1205
|
+
const fill = element.fill ? `background: ${esc(element.fill)};` : "";
|
|
1206
|
+
if (customPath) {
|
|
1207
|
+
return fill ? `${fill}clip-path: path('${customPath}');` : "";
|
|
1208
|
+
}
|
|
1209
|
+
const line = outlinePath
|
|
1210
|
+
? ""
|
|
1211
|
+
: strokeDecoration(element, widthEmu, refWidthPx, widthPx, heightPx);
|
|
1212
|
+
return `${fill}${line}${geometryCss(element, widthPx, heightPx)}`;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
function textBoxStyle(
|
|
1216
|
+
element: ParsedElement,
|
|
1217
|
+
widthEmu: number,
|
|
1218
|
+
heightEmu: number,
|
|
1219
|
+
refBox: { width: number; height: number },
|
|
1220
|
+
themeFont: string | undefined,
|
|
1221
|
+
): string {
|
|
1222
|
+
const padding = element.padding;
|
|
1223
|
+
const left = padding ? toSlidePxX(padding.left, widthEmu, refBox.width) : 0;
|
|
1224
|
+
const right = padding ? toSlidePxX(padding.right, widthEmu, refBox.width) : 0;
|
|
1225
|
+
const top = padding ? toSlidePxY(padding.top, heightEmu, refBox.height) : 0;
|
|
1226
|
+
const bottom = padding
|
|
1227
|
+
? toSlidePxY(padding.bottom, heightEmu, refBox.height)
|
|
1228
|
+
: 0;
|
|
1229
|
+
const align = element.paragraphs?.[0]?.alignment ?? "left";
|
|
1230
|
+
const vertical =
|
|
1231
|
+
element.verticalAlign === "middle"
|
|
1232
|
+
? "justify-content:center;"
|
|
1233
|
+
: element.verticalAlign === "bottom"
|
|
1234
|
+
? "justify-content:flex-end;"
|
|
1235
|
+
: "justify-content:flex-start;";
|
|
1236
|
+
return `display:flex;flex-direction:column;${vertical}padding:${top}px ${right}px ${bottom}px ${left}px;font-family:${cssFontFamily(themeFont)};text-align:${align};overflow:visible;`;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
const DEFAULT_LINE_SPACING = 1.2;
|
|
1240
|
+
|
|
1241
|
+
function firstDeclaredFontSizePt(
|
|
1242
|
+
paragraphs: ParsedParagraph[] | undefined,
|
|
1243
|
+
): number | undefined {
|
|
1244
|
+
for (const paragraph of paragraphs ?? []) {
|
|
1245
|
+
for (const run of paragraph.runs) {
|
|
1246
|
+
if (run.fontSize !== undefined) return run.fontSize;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
return undefined;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
function buildFidelityParagraph(
|
|
1253
|
+
paragraph: ParsedParagraph,
|
|
1254
|
+
paragraphIndex: number,
|
|
1255
|
+
widthEmu: number,
|
|
1256
|
+
refWidthPx: number,
|
|
1257
|
+
themeFont: string | undefined,
|
|
1258
|
+
defaultFontWeight: number,
|
|
1259
|
+
boxFontSizePt?: number,
|
|
1260
|
+
): string {
|
|
1261
|
+
const firstRun = paragraph.runs[0];
|
|
1262
|
+
const paragraphFontSizePt =
|
|
1263
|
+
firstRun?.fontSize ??
|
|
1264
|
+
(paragraph.runs.length === 0 ? boxFontSizePt : undefined) ??
|
|
1265
|
+
DEFAULT_PPTX_FONT_SIZE_PT;
|
|
1266
|
+
const fontSize = ptToSlidePx(paragraphFontSizePt, widthEmu, refWidthPx);
|
|
1267
|
+
const lineHeight = paragraph.lineSpacing ?? DEFAULT_LINE_SPACING;
|
|
1268
|
+
const bulletFontSize = ptToSlidePx(
|
|
1269
|
+
paragraph.bulletSize ?? paragraphFontSizePt,
|
|
1270
|
+
widthEmu,
|
|
1271
|
+
refWidthPx,
|
|
1272
|
+
);
|
|
1273
|
+
const bullet = paragraph.bulletChar
|
|
1274
|
+
? `<span aria-hidden="true" style="display:inline-block;min-width:${fontSize * 0.75}px;white-space:nowrap;margin-right:${fontSize * 0.65}px;color:${esc(paragraph.bulletColor ?? firstRun?.color ?? DEFAULT_PPTX_FOREGROUND)};font-family:${cssFontFamily(paragraph.bulletFontFamily ?? themeFont)};font-size:${bulletFontSize}px;">${esc(paragraph.bulletChar)}</span>`
|
|
1275
|
+
: "";
|
|
1276
|
+
const marginLeft = paragraph.marginLeftEmu
|
|
1277
|
+
? toSlidePxX(paragraph.marginLeftEmu, widthEmu, refWidthPx)
|
|
1278
|
+
: 0;
|
|
1279
|
+
const indent = paragraph.indentEmu
|
|
1280
|
+
? toSlidePxX(paragraph.indentEmu, widthEmu, refWidthPx)
|
|
1281
|
+
: 0;
|
|
1282
|
+
const spacingBefore = paragraph.spaceBeforePt ?? 0;
|
|
1283
|
+
const spacingAfter = paragraph.spaceAfterPt ?? 0;
|
|
1284
|
+
const bulletMargin = paragraph.bulletChar ? `margin-left:${indent}px;` : "";
|
|
1285
|
+
const marginBefore = ptToSlidePx(spacingBefore, widthEmu, refWidthPx);
|
|
1286
|
+
const marginAfter = ptToSlidePx(spacingAfter, widthEmu, refWidthPx);
|
|
1287
|
+
const text = paragraph.runs
|
|
1288
|
+
.map((run) =>
|
|
1289
|
+
formatFidelityRun(
|
|
1290
|
+
run,
|
|
1291
|
+
widthEmu,
|
|
1292
|
+
refWidthPx,
|
|
1293
|
+
themeFont,
|
|
1294
|
+
defaultFontWeight,
|
|
1295
|
+
),
|
|
1296
|
+
)
|
|
1297
|
+
.join("");
|
|
1298
|
+
const direction = paragraph.rtl ? ` dir="rtl"` : "";
|
|
1299
|
+
const directionCss = paragraph.rtl ? "direction:rtl;" : "";
|
|
1300
|
+
return `<p data-pptx-paragraph="${paragraphIndex}"${direction} style="${directionCss}display:block;flex:0 0 auto;text-align:${paragraph.alignment ?? (paragraph.rtl ? "right" : "left")};white-space:pre-wrap;margin:${marginBefore}px 0 ${marginAfter}px;line-height:${lineHeight};font-size:${fontSize}px;min-height:${fontSize * lineHeight}px;padding-left:${marginLeft}px;text-indent:${paragraph.bulletChar ? 0 : indent}px;">${bullet.replace("display:inline-block;", `display:inline-block;${bulletMargin}`)}${text}</p>`;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
function formatFidelityRun(
|
|
1304
|
+
run: ParsedTextRun,
|
|
1305
|
+
widthEmu: number,
|
|
1306
|
+
refWidthPx: number,
|
|
1307
|
+
themeFont: string | undefined,
|
|
1308
|
+
defaultFontWeight = 400,
|
|
1309
|
+
): string {
|
|
1310
|
+
const styles = [
|
|
1311
|
+
`font-size:${ptToSlidePx(run.fontSize ?? DEFAULT_PPTX_FONT_SIZE_PT, widthEmu, refWidthPx)}px`,
|
|
1312
|
+
`font-family:${cssFontFamily(run.fontFamily ?? themeFont)}`,
|
|
1313
|
+
`color:${esc(run.color ?? DEFAULT_PPTX_FOREGROUND)}`,
|
|
1314
|
+
`font-weight:${run.bold ? 700 : fontWeightForFamily(run.fontFamily, defaultFontWeight)}`,
|
|
1315
|
+
`font-style:${run.italic ? "italic" : "normal"}`,
|
|
1316
|
+
`text-decoration:${run.underline ? "underline" : "none"}`,
|
|
1317
|
+
].join(";");
|
|
1318
|
+
const href = run.href && isSafeLinkHref(run.href) ? run.href : undefined;
|
|
1319
|
+
if (href) {
|
|
1320
|
+
return `<a href="${esc(href)}" target="_blank" rel="noopener noreferrer" style="${styles};">${esc(run.content)}</a>`;
|
|
1321
|
+
}
|
|
1322
|
+
return `<span style="${styles};">${esc(run.content)}</span>`;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
function isSafeLinkHref(href: string): boolean {
|
|
1326
|
+
return /^(https?:|mailto:)/i.test(href);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
function fontWeightForFamily(
|
|
1330
|
+
fontFamily: string | undefined,
|
|
1331
|
+
fallback: number,
|
|
1332
|
+
): number {
|
|
1333
|
+
const normalized = fontFamily?.toLowerCase() ?? "";
|
|
1334
|
+
if (!normalized) return fallback;
|
|
1335
|
+
if (/(?:semi|demi)bold|semibold/.test(normalized)) return 600;
|
|
1336
|
+
if (/black|heavy/.test(normalized)) return 900;
|
|
1337
|
+
if (/extra[- ]?bold|ultra[- ]?bold/.test(normalized)) return 800;
|
|
1338
|
+
if (/bold/.test(normalized)) return 700;
|
|
1339
|
+
if (/medium/.test(normalized)) return 500;
|
|
1340
|
+
if (/light|thin/.test(normalized)) return 300;
|
|
1341
|
+
return 400;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
function buildTitleSlide(
|
|
1345
|
+
paragraphs: ParsedTextRun[][],
|
|
1346
|
+
slide: ParsedSlide,
|
|
1347
|
+
fontFamily: string,
|
|
1348
|
+
): string {
|
|
1349
|
+
const titlePara = paragraphs[0] ?? [];
|
|
1350
|
+
const subtitlePara = paragraphs[1] ?? [];
|
|
1351
|
+
|
|
1352
|
+
const titleText = titlePara.map(formatRun).join(" ") || "Untitled Slide";
|
|
1353
|
+
const subtitleText = subtitlePara.map(formatRun).join(" ");
|
|
1354
|
+
|
|
1355
|
+
return `<div class="fmd-slide" style="padding: 80px 110px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; font-family: ${fontFamily};">
|
|
1356
|
+
<h1 style="font-size: 64px; font-weight: 900; color: #fff; line-height: 1.1; letter-spacing: -2px; margin: 0 0 24px 0;">${titleText}</h1>${subtitleText ? `\n <p style="font-size: 22px; color: rgba(255,255,255,0.55); margin: 0;">${subtitleText}</p>` : ""} <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1357
|
+
</div>`;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
function buildContentSlide(
|
|
1361
|
+
paragraphs: ParsedTextRun[][],
|
|
1362
|
+
slide: ParsedSlide,
|
|
1363
|
+
fontFamily: string,
|
|
1364
|
+
): string {
|
|
1365
|
+
const headingPara = paragraphs[0] ?? [];
|
|
1366
|
+
const bulletParas = paragraphs.slice(1);
|
|
1367
|
+
|
|
1368
|
+
const headingText = headingPara.map(formatRun).join(" ") || "Slide";
|
|
1369
|
+
|
|
1370
|
+
let bulletsHtml = "";
|
|
1371
|
+
if (bulletParas.length > 0) {
|
|
1372
|
+
const bulletItems = bulletParas
|
|
1373
|
+
.map((para) => {
|
|
1374
|
+
const text = para.map(formatRun).join(" ");
|
|
1375
|
+
return ` <div style="display: flex; align-items: flex-start; gap: 16px;">
|
|
1376
|
+
<span style="font-size: 8px; color: #fff; margin-top: 8px; flex-shrink: 0;">●</span> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1377
|
+
<span style="font-size: 22px; color: rgba(255,255,255,0.85); line-height: 1.5;">${text}</span> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1378
|
+
</div>`;
|
|
1379
|
+
})
|
|
1380
|
+
.join("\n");
|
|
1381
|
+
|
|
1382
|
+
bulletsHtml = `\n <div class="fmd-animation-container" style="display: flex; flex-direction: column; gap: 20px;">
|
|
1383
|
+
${bulletItems}
|
|
1384
|
+
</div>`;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
return `<div class="fmd-slide" style="padding: 80px 110px; display: flex; flex-direction: column; justify-content: flex-start; font-family: ${fontFamily};">
|
|
1388
|
+
<div style="font-size: 14px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: #00E5FF; margin-bottom: 16px;">IMPORTED</div> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1389
|
+
<h2 style="font-size: 40px; font-weight: 900; color: #fff; line-height: 1.15; letter-spacing: -1px; margin: 0 0 48px 0;">${headingText}</h2>${bulletsHtml} <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1390
|
+
</div>`;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
function imageOrPlaceholder(
|
|
1394
|
+
imageUrl: string | undefined,
|
|
1395
|
+
imageName: string,
|
|
1396
|
+
style: string,
|
|
1397
|
+
objectFit: "cover" | "contain" = "contain",
|
|
1398
|
+
): string {
|
|
1399
|
+
if (imageUrl) {
|
|
1400
|
+
return `<img src="${esc(imageUrl)}" alt="" style="${style} object-fit: ${objectFit};" />`;
|
|
1401
|
+
}
|
|
1402
|
+
return `<div class="fmd-img-placeholder" style="${style}">Imported image: ${esc(imageName)}</div>`;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function buildImageSlide(
|
|
1406
|
+
paragraphs: ParsedTextRun[][],
|
|
1407
|
+
slide: ParsedSlide,
|
|
1408
|
+
imageUrl: string | undefined,
|
|
1409
|
+
fontFamily: string,
|
|
1410
|
+
): string {
|
|
1411
|
+
if (imageUrl && slide.images[0]?.fullBleed) {
|
|
1412
|
+
return buildOverlayImageSlide(paragraphs, imageUrl, fontFamily);
|
|
1413
|
+
}
|
|
1414
|
+
return buildStackedImageSlide(paragraphs, slide, imageUrl, fontFamily);
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
function buildOverlayImageSlide(
|
|
1418
|
+
paragraphs: ParsedTextRun[][],
|
|
1419
|
+
imageUrl: string,
|
|
1420
|
+
fontFamily: string,
|
|
1421
|
+
): string {
|
|
1422
|
+
const headingPara = paragraphs[0] ?? [];
|
|
1423
|
+
const headingHtml = headingPara.map(formatRun).join(" ") || "Slide";
|
|
1424
|
+
|
|
1425
|
+
const captionParas = paragraphs.slice(1);
|
|
1426
|
+
const captionHtml = captionParas.length
|
|
1427
|
+
? `<div class="fmd-animation-container" style="display: flex; flex-direction: column; gap: 8px;">${captionParas
|
|
1428
|
+
.map(
|
|
1429
|
+
(para) =>
|
|
1430
|
+
`<p style="font-size: 18px; color: rgba(255,255,255,0.75); /* guard:allow-raw-color - standalone imported slide HTML uses fixed contrast colors */ line-height: 1.5; margin: 0;">${para.map(formatRun).join(" ")}</p>`,
|
|
1431
|
+
)
|
|
1432
|
+
.join("\n")}</div>`
|
|
1433
|
+
: "";
|
|
1434
|
+
|
|
1435
|
+
return `<div class="fmd-slide" style="position: relative; width: 100%; height: 100%; overflow: hidden;">
|
|
1436
|
+
<img src="${esc(imageUrl)}" alt="" style="position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;" />
|
|
1437
|
+
<div style="position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 55%, rgba(0,0,0,0) 80%);"></div> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1438
|
+
<div style="position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 70px; font-family: ${fontFamily};">
|
|
1439
|
+
<h2 style="font-size: 40px; font-weight: 900; color: #fff; /* guard:allow-raw-color - standalone imported slide HTML uses fixed contrast colors */ line-height: 1.15; letter-spacing: -1px; margin: 0 0 ${captionHtml ? "12px" : "0"} 0;">${headingHtml}</h2>${captionHtml ? `\n ${captionHtml}` : ""}
|
|
1440
|
+
</div>
|
|
1441
|
+
</div>`;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function buildStackedImageSlide(
|
|
1445
|
+
paragraphs: ParsedTextRun[][],
|
|
1446
|
+
slide: ParsedSlide,
|
|
1447
|
+
imageUrl: string | undefined,
|
|
1448
|
+
fontFamily: string,
|
|
1449
|
+
): string {
|
|
1450
|
+
const headingPara = paragraphs[0] ?? [];
|
|
1451
|
+
const headingText = headingPara.map(formatRun).join(" ") || "Slide";
|
|
1452
|
+
|
|
1453
|
+
const captionParas = paragraphs.slice(1);
|
|
1454
|
+
const captionText = captionParas.length
|
|
1455
|
+
? `<div class="fmd-animation-container" style="display: flex; flex-direction: column; gap: 8px;">${captionParas
|
|
1456
|
+
.map(
|
|
1457
|
+
(para) =>
|
|
1458
|
+
`<p style="font-size: 16px; color: rgba(255,255,255,0.7); /* guard:allow-raw-color - standalone imported slide HTML uses fixed contrast colors */ line-height: 1.5; margin: 0;">${para.map(formatRun).join(" ")}</p>`,
|
|
1459
|
+
)
|
|
1460
|
+
.join("\n")}</div>`
|
|
1461
|
+
: "";
|
|
1462
|
+
|
|
1463
|
+
const imageName = slide.images[0]?.name ?? "image";
|
|
1464
|
+
const aspectRatio = slide.images[0]?.aspectRatio ?? 16 / 9;
|
|
1465
|
+
const imageHtml = imageOrPlaceholder(
|
|
1466
|
+
imageUrl,
|
|
1467
|
+
imageName,
|
|
1468
|
+
`display: block; max-width: 100%; max-height: 320px; aspect-ratio: ${aspectRatio}; border-radius: 12px; margin: 0 auto 24px;`,
|
|
1469
|
+
);
|
|
1470
|
+
|
|
1471
|
+
return `<div class="fmd-slide" style="padding: 64px 90px; display: flex; flex-direction: column; justify-content: flex-start; font-family: ${fontFamily};">
|
|
1472
|
+
${imageHtml}
|
|
1473
|
+
<h2 style="font-size: 32px; font-weight: 900; color: #fff; /* guard:allow-raw-color - standalone imported slide HTML uses fixed contrast colors */ line-height: 1.2; letter-spacing: -0.5px; margin: 0 0 12px 0;">${headingText}</h2>${captionText ? `\n ${captionText}` : ""}
|
|
1474
|
+
</div>`;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
function stripTags(html: string): string {
|
|
1478
|
+
return html.replace(/<[^>]+>/g, "");
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
export function convertSectionsToSlides(
|
|
1482
|
+
sections: { heading: string; content: string }[],
|
|
1483
|
+
): string[] {
|
|
1484
|
+
const slides: string[] = [];
|
|
1485
|
+
|
|
1486
|
+
for (const section of sections) {
|
|
1487
|
+
const heading = section.heading || "Section";
|
|
1488
|
+
const plainContent = stripTags(section.content).trim();
|
|
1489
|
+
|
|
1490
|
+
if (!plainContent && !section.heading) continue;
|
|
1491
|
+
|
|
1492
|
+
const lines = plainContent
|
|
1493
|
+
.split(/\n+/)
|
|
1494
|
+
.map((l) => l.trim())
|
|
1495
|
+
.filter(Boolean);
|
|
1496
|
+
|
|
1497
|
+
if (lines.length === 0) {
|
|
1498
|
+
slides.push(
|
|
1499
|
+
`<div class="fmd-slide" style="padding: 80px 110px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; font-family: 'Poppins', sans-serif;">
|
|
1500
|
+
<div style="font-size: 16px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: #00E5FF; margin-bottom: 20px;">${String(slides.length + 1).padStart(2, "0")}</div> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1501
|
+
<h2 style="font-size: 72px; font-weight: 900; color: #fff; line-height: 1.05; letter-spacing: -2px; margin: 0;">${esc(heading)}</h2> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1502
|
+
</div>`,
|
|
1503
|
+
);
|
|
1504
|
+
continue;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
const LINES_PER_SLIDE = 5;
|
|
1508
|
+
for (let i = 0; i < lines.length; i += LINES_PER_SLIDE) {
|
|
1509
|
+
const chunk = lines.slice(i, i + LINES_PER_SLIDE);
|
|
1510
|
+
const bulletItems = chunk
|
|
1511
|
+
.map(
|
|
1512
|
+
(
|
|
1513
|
+
line,
|
|
1514
|
+
) => ` <div style="display: flex; align-items: flex-start; gap: 16px;">
|
|
1515
|
+
<span style="font-size: 8px; color: #fff; margin-top: 8px; flex-shrink: 0;">●</span> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1516
|
+
<span style="font-size: 22px; color: rgba(255,255,255,0.85); line-height: 1.5;">${esc(line)}</span> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1517
|
+
</div>`,
|
|
1518
|
+
)
|
|
1519
|
+
.join("\n");
|
|
1520
|
+
|
|
1521
|
+
slides.push(
|
|
1522
|
+
`<div class="fmd-slide" style="padding: 80px 110px; display: flex; flex-direction: column; justify-content: flex-start; font-family: 'Poppins', sans-serif;">
|
|
1523
|
+
<div style="font-size: 14px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: #00E5FF; margin-bottom: 16px;">IMPORTED</div> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1524
|
+
<h2 style="font-size: 40px; font-weight: 900; color: #fff; line-height: 1.15; letter-spacing: -1px; margin: 0 0 48px 0;">${esc(heading)}</h2> <!-- // guard:allow-raw-color — imported slide HTML preserves authored presentation colors. -->
|
|
1525
|
+
<div style="display: flex; flex-direction: column; gap: 20px;">
|
|
1526
|
+
${bulletItems}
|
|
1527
|
+
</div>
|
|
1528
|
+
</div>`,
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
return slides;
|
|
1534
|
+
}
|