@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,1975 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
/**
|
|
3
|
+
* Code that runs inside the Slides editor page. `installInPageHelpers` is
|
|
4
|
+
* serialized by Playwright's addInitScript, so everything it uses must live
|
|
5
|
+
* inside its body — it cannot close over module scope.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Editor chrome that legitimately differs between view and edit. */
|
|
9
|
+
export const CHROME_SELECTOR = [
|
|
10
|
+
"[data-slide-selection-chrome]",
|
|
11
|
+
"[data-slide-selection-outline]",
|
|
12
|
+
"[data-slide-resize-handle]",
|
|
13
|
+
"[data-slide-resize-handle-bar]",
|
|
14
|
+
"[data-slide-move-handle]",
|
|
15
|
+
"[data-slide-rotate-handle]",
|
|
16
|
+
"[data-slide-layer-hover-outline]",
|
|
17
|
+
"[data-slide-container-outline]",
|
|
18
|
+
"[data-slide-group-move-handle]",
|
|
19
|
+
"[data-selection-overlay-left]",
|
|
20
|
+
"[data-block-bubble-menu]",
|
|
21
|
+
].join(",");
|
|
22
|
+
|
|
23
|
+
export const MASK_CSS = `${CHROME_SELECTOR}{visibility:hidden!important}
|
|
24
|
+
*,*::before,*::after{caret-color:transparent!important;transition:none!important;animation:none!important}
|
|
25
|
+
::selection{background:transparent!important}`;
|
|
26
|
+
|
|
27
|
+
export const EDITOR_SELECTOR = ".slide-rich-editor-host .ProseMirror";
|
|
28
|
+
|
|
29
|
+
export interface Rect {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TextTarget {
|
|
37
|
+
index: number;
|
|
38
|
+
builderId: string | null;
|
|
39
|
+
slideObjectId: string | null;
|
|
40
|
+
pptxParagraph: string | null;
|
|
41
|
+
tag: string;
|
|
42
|
+
className: string;
|
|
43
|
+
text: string;
|
|
44
|
+
/** Which same-tag, same-text element this is, in document order. */
|
|
45
|
+
occurrence: number;
|
|
46
|
+
/** Viewport point on the first non-space glyph. */
|
|
47
|
+
point: { x: number; y: number };
|
|
48
|
+
/** Relative to the slide canvas. */
|
|
49
|
+
rect: Rect;
|
|
50
|
+
/** Viewport point is covered by something other than the target. */
|
|
51
|
+
covered: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface SnapRecord {
|
|
55
|
+
key: string;
|
|
56
|
+
stableKey?: string;
|
|
57
|
+
pptxRecordKey?: string;
|
|
58
|
+
slideObjectId?: string | null;
|
|
59
|
+
pptxParagraph?: string | null;
|
|
60
|
+
kind: "text" | "box";
|
|
61
|
+
inside: boolean;
|
|
62
|
+
/** Its appearance is preserved even when it shares the edited visual row. */
|
|
63
|
+
protectedStyle?: boolean;
|
|
64
|
+
/** Its marker box relative to the edited row, for measuring aligned reflow. */
|
|
65
|
+
protectedRect?: Rect;
|
|
66
|
+
/** Its presence is preserved when the authoring operation should keep the row. */
|
|
67
|
+
protectedStructure?: boolean;
|
|
68
|
+
/** A leading span that supplies the marker for a styled bullet row. */
|
|
69
|
+
styledBulletMarker?: boolean;
|
|
70
|
+
styledBulletMarkerText?: string;
|
|
71
|
+
downstreamFlow?: boolean;
|
|
72
|
+
flexCrossAlignment?: {
|
|
73
|
+
context: string;
|
|
74
|
+
axis: "x" | "y";
|
|
75
|
+
containerPosition: number;
|
|
76
|
+
containerSize: number;
|
|
77
|
+
itemSize: number;
|
|
78
|
+
editedItemSize: number;
|
|
79
|
+
};
|
|
80
|
+
layoutPath?: string[];
|
|
81
|
+
tag?: string;
|
|
82
|
+
className?: string;
|
|
83
|
+
inlineStyle?: string;
|
|
84
|
+
props: Record<string, string>;
|
|
85
|
+
rect: Rect;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface Inventory {
|
|
89
|
+
elements: number;
|
|
90
|
+
visible: number;
|
|
91
|
+
hidden: number;
|
|
92
|
+
svg: number;
|
|
93
|
+
img: number;
|
|
94
|
+
style: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface Snapshot {
|
|
98
|
+
records: SnapRecord[];
|
|
99
|
+
inventory: Inventory;
|
|
100
|
+
text: string;
|
|
101
|
+
editedRect: Rect | null;
|
|
102
|
+
/** Border box of the edited element, without overflowing descendants. */
|
|
103
|
+
editedBoxRect: Rect | null;
|
|
104
|
+
editedObjectId?: string | null;
|
|
105
|
+
editedParagraphId?: string | null;
|
|
106
|
+
editedObjectRect?: Rect | null;
|
|
107
|
+
editedTargetRect?: Rect | null;
|
|
108
|
+
editedFlowAnchorRect?: Rect | null;
|
|
109
|
+
editedAuthoringFragmentRects?: Rect[];
|
|
110
|
+
editedObjectPosition?: string | null;
|
|
111
|
+
/** The edited target moves siblings through normal document flow. */
|
|
112
|
+
editedInFlow?: boolean;
|
|
113
|
+
/** Rendered lines of the element the edit is matched to, in full. */
|
|
114
|
+
editedText: string | null;
|
|
115
|
+
editedLayoutPath?: string[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type OutsideSnapshot = Pick<
|
|
119
|
+
Snapshot,
|
|
120
|
+
| "records"
|
|
121
|
+
| "editedRect"
|
|
122
|
+
| "editedInFlow"
|
|
123
|
+
| "editedObjectId"
|
|
124
|
+
| "editedParagraphId"
|
|
125
|
+
| "editedObjectRect"
|
|
126
|
+
| "editedTargetRect"
|
|
127
|
+
| "editedFlowAnchorRect"
|
|
128
|
+
| "editedAuthoringFragmentRects"
|
|
129
|
+
| "editedObjectPosition"
|
|
130
|
+
>;
|
|
131
|
+
|
|
132
|
+
export interface EditorState {
|
|
133
|
+
editing: boolean;
|
|
134
|
+
focusInEditor: boolean;
|
|
135
|
+
blocks: number;
|
|
136
|
+
editorRect: Rect | null;
|
|
137
|
+
sourceRect: Rect | null;
|
|
138
|
+
/** Top of the edited element's content, which moves with anchored text. */
|
|
139
|
+
contentTop: number | null;
|
|
140
|
+
/** The caret's box, or null unless the selection is a caret in the edited element. */
|
|
141
|
+
caretRect: Rect | null;
|
|
142
|
+
/**
|
|
143
|
+
* Position among the edited element's descendants of the block box holding
|
|
144
|
+
* the caret, -1 for the element itself; null with no caret in it.
|
|
145
|
+
*/
|
|
146
|
+
caretBlock: number | null;
|
|
147
|
+
caretConvertibleTag: string | null;
|
|
148
|
+
sourceTag: string | null;
|
|
149
|
+
sourceText: string | null;
|
|
150
|
+
sourceOccurrence: number;
|
|
151
|
+
editorHtml: string;
|
|
152
|
+
/** The editor's rendered lines, which the element shows once saved. */
|
|
153
|
+
editorText: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface CanonicalPair {
|
|
157
|
+
stored: string[];
|
|
158
|
+
saved: string[];
|
|
159
|
+
found: boolean;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface InPageHelpers {
|
|
163
|
+
listTargets(canvasSel: string): TextTarget[];
|
|
164
|
+
targetSourceHtml(canvasSel: string, targetIndex: number): string;
|
|
165
|
+
snapshot(
|
|
166
|
+
canvasSel: string,
|
|
167
|
+
edited: { targetIndex?: number; text?: string; marker?: string },
|
|
168
|
+
): Snapshot;
|
|
169
|
+
outsideSnapshot(canvasSel: string): OutsideSnapshot;
|
|
170
|
+
editorState(canvasSel: string): EditorState;
|
|
171
|
+
/** Why the selection entering edit left is not at the gesture's point, or null. */
|
|
172
|
+
entryCaretProblem(
|
|
173
|
+
point: { x: number; y: number },
|
|
174
|
+
gesture: string,
|
|
175
|
+
): Promise<string | null>;
|
|
176
|
+
backgroundPoint(canvasSel: string): { x: number; y: number } | null;
|
|
177
|
+
customStyleProperties(element: Element): string[];
|
|
178
|
+
canonical(html: string): string[];
|
|
179
|
+
canonicalOutside(
|
|
180
|
+
stored: string,
|
|
181
|
+
saved: string,
|
|
182
|
+
target: { tag: string; text: string; occurrence: number },
|
|
183
|
+
): CanonicalPair;
|
|
184
|
+
/** Call stacks of content writes sent since the last call, oldest first. */
|
|
185
|
+
takeWriteStacks(): string[];
|
|
186
|
+
/** Keepalive content writes sent since the last call, in this tab. */
|
|
187
|
+
takeKeepaliveWrites(): KeepaliveWrite[];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface KeepaliveWrite {
|
|
191
|
+
action: string;
|
|
192
|
+
/** The JSON body; null when it was not a string and could not be read. */
|
|
193
|
+
body: string | null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare global {
|
|
197
|
+
interface Window {
|
|
198
|
+
__editFidelity: InPageHelpers;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function installInPageHelpers(chromeSelector: string) {
|
|
203
|
+
const snapEpoch = crypto.randomUUID();
|
|
204
|
+
const snapIds = new WeakMap<Element, number>();
|
|
205
|
+
let nextSnapId = 0;
|
|
206
|
+
const snapId = (element: Element) => {
|
|
207
|
+
let id = snapIds.get(element);
|
|
208
|
+
if (id === undefined) {
|
|
209
|
+
id = ++nextSnapId;
|
|
210
|
+
snapIds.set(element, id);
|
|
211
|
+
}
|
|
212
|
+
return id;
|
|
213
|
+
};
|
|
214
|
+
const TEXT_PROPS = [
|
|
215
|
+
"font-family",
|
|
216
|
+
"font-size",
|
|
217
|
+
"font-weight",
|
|
218
|
+
"font-style",
|
|
219
|
+
"line-height",
|
|
220
|
+
"letter-spacing",
|
|
221
|
+
"word-spacing",
|
|
222
|
+
"text-transform",
|
|
223
|
+
"color",
|
|
224
|
+
"-webkit-text-fill-color",
|
|
225
|
+
"text-shadow",
|
|
226
|
+
"text-decoration-line",
|
|
227
|
+
"font-feature-settings",
|
|
228
|
+
"font-variation-settings",
|
|
229
|
+
"text-align",
|
|
230
|
+
"white-space",
|
|
231
|
+
"opacity",
|
|
232
|
+
"visibility",
|
|
233
|
+
];
|
|
234
|
+
const customStylePropertiesByDocument = new WeakMap<
|
|
235
|
+
Document,
|
|
236
|
+
{
|
|
237
|
+
version: number;
|
|
238
|
+
propertiesVersion: number;
|
|
239
|
+
properties: string[] | null;
|
|
240
|
+
observer: MutationObserver;
|
|
241
|
+
}
|
|
242
|
+
>();
|
|
243
|
+
const SIDES = ["top", "right", "bottom", "left"];
|
|
244
|
+
const BOX_PROPS = [
|
|
245
|
+
"display",
|
|
246
|
+
"opacity",
|
|
247
|
+
"visibility",
|
|
248
|
+
"position",
|
|
249
|
+
...SIDES,
|
|
250
|
+
"transform",
|
|
251
|
+
"transform-origin",
|
|
252
|
+
"translate",
|
|
253
|
+
"rotate",
|
|
254
|
+
"scale",
|
|
255
|
+
...SIDES.map((s) => `margin-${s}`),
|
|
256
|
+
...SIDES.map((s) => `padding-${s}`),
|
|
257
|
+
...SIDES.flatMap((s) => [
|
|
258
|
+
`border-${s}-width`,
|
|
259
|
+
`border-${s}-style`,
|
|
260
|
+
`border-${s}-color`,
|
|
261
|
+
]),
|
|
262
|
+
"border-top-left-radius",
|
|
263
|
+
"border-top-right-radius",
|
|
264
|
+
"border-bottom-right-radius",
|
|
265
|
+
"border-bottom-left-radius",
|
|
266
|
+
"background-color",
|
|
267
|
+
"background-image",
|
|
268
|
+
"box-shadow",
|
|
269
|
+
];
|
|
270
|
+
const OUTSIDE_EXTRA_STYLE_PROPS = [
|
|
271
|
+
"filter",
|
|
272
|
+
"backdrop-filter",
|
|
273
|
+
"clip-path",
|
|
274
|
+
"mask-image",
|
|
275
|
+
"mix-blend-mode",
|
|
276
|
+
"isolation",
|
|
277
|
+
"z-index",
|
|
278
|
+
"overflow-x",
|
|
279
|
+
"overflow-y",
|
|
280
|
+
"contain",
|
|
281
|
+
"content-visibility",
|
|
282
|
+
"object-fit",
|
|
283
|
+
"object-position",
|
|
284
|
+
"align-content",
|
|
285
|
+
"align-items",
|
|
286
|
+
"align-self",
|
|
287
|
+
"justify-content",
|
|
288
|
+
"justify-items",
|
|
289
|
+
"justify-self",
|
|
290
|
+
"flex-basis",
|
|
291
|
+
"flex-direction",
|
|
292
|
+
"flex-grow",
|
|
293
|
+
"flex-shrink",
|
|
294
|
+
"flex-wrap",
|
|
295
|
+
"gap",
|
|
296
|
+
"row-gap",
|
|
297
|
+
"column-gap",
|
|
298
|
+
"grid-area",
|
|
299
|
+
"grid-auto-flow",
|
|
300
|
+
"grid-column-end",
|
|
301
|
+
"grid-column-start",
|
|
302
|
+
"grid-row-end",
|
|
303
|
+
"grid-row-start",
|
|
304
|
+
"grid-template-areas",
|
|
305
|
+
"grid-template-columns",
|
|
306
|
+
"grid-template-rows",
|
|
307
|
+
];
|
|
308
|
+
const PAINTED_TAGS = new Set([
|
|
309
|
+
"SVG",
|
|
310
|
+
"IMG",
|
|
311
|
+
"HR",
|
|
312
|
+
"CANVAS",
|
|
313
|
+
"VIDEO",
|
|
314
|
+
"PICTURE",
|
|
315
|
+
"IFRAME",
|
|
316
|
+
]);
|
|
317
|
+
const INLINE_TAGS = new Set([
|
|
318
|
+
"a",
|
|
319
|
+
"abbr",
|
|
320
|
+
"b",
|
|
321
|
+
"br",
|
|
322
|
+
"code",
|
|
323
|
+
"em",
|
|
324
|
+
"font",
|
|
325
|
+
"i",
|
|
326
|
+
"img",
|
|
327
|
+
"mark",
|
|
328
|
+
"s",
|
|
329
|
+
"small",
|
|
330
|
+
"span",
|
|
331
|
+
"strong",
|
|
332
|
+
"sub",
|
|
333
|
+
"sup",
|
|
334
|
+
"u",
|
|
335
|
+
]);
|
|
336
|
+
const TRANSIENT_ATTRS = new Set([
|
|
337
|
+
"data-src-i",
|
|
338
|
+
"data-builder-id",
|
|
339
|
+
"data-slide-text-block",
|
|
340
|
+
"data-editing-block",
|
|
341
|
+
"data-slide-content-scope",
|
|
342
|
+
"contenteditable",
|
|
343
|
+
"spellcheck",
|
|
344
|
+
"aria-expanded",
|
|
345
|
+
"aria-controls",
|
|
346
|
+
"aria-activedescendant",
|
|
347
|
+
"aria-haspopup",
|
|
348
|
+
]);
|
|
349
|
+
|
|
350
|
+
const norm = (s: string | null | undefined) =>
|
|
351
|
+
(s ?? "").replace(/[\s\u200b\ufeff]+/g, " ").trim();
|
|
352
|
+
const strip = (s: string | null | undefined) =>
|
|
353
|
+
(s ?? "").replace(/[\s\u200b\ufeff]+/g, "");
|
|
354
|
+
/**
|
|
355
|
+
* The element's text, one line per <br> or block, placeholders and blank
|
|
356
|
+
* lines dropped: textContent gives a <br> nothing, so it cannot tell a kept
|
|
357
|
+
* break from a lost one, and innerText applies text-transform.
|
|
358
|
+
*/
|
|
359
|
+
const lines = (el: Element) => {
|
|
360
|
+
let out = "";
|
|
361
|
+
const walk = (n: Node) => {
|
|
362
|
+
// Source indentation is not a line break.
|
|
363
|
+
if (n.nodeType === Node.TEXT_NODE)
|
|
364
|
+
out += (n as Text).data.replace(/\s+/g, " ");
|
|
365
|
+
else if (n.nodeName === "BR") out += "\n";
|
|
366
|
+
else if (n instanceof Element && !/^(STYLE|SCRIPT)$/.test(n.tagName)) {
|
|
367
|
+
const block =
|
|
368
|
+
n !== el && !getComputedStyle(n).display.startsWith("inline");
|
|
369
|
+
if (block) out += "\n";
|
|
370
|
+
n.childNodes.forEach(walk);
|
|
371
|
+
if (block) out += "\n";
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
walk(el);
|
|
375
|
+
return out
|
|
376
|
+
.replace(/[\u200b\ufeff]/g, "")
|
|
377
|
+
.split("\n")
|
|
378
|
+
.map(norm)
|
|
379
|
+
.filter(Boolean)
|
|
380
|
+
.join("\n");
|
|
381
|
+
};
|
|
382
|
+
const rectOf = (r: DOMRect, origin: DOMRect): Rect => ({
|
|
383
|
+
x: Math.round(r.left - origin.left),
|
|
384
|
+
y: Math.round(r.top - origin.top),
|
|
385
|
+
width: Math.round(r.width),
|
|
386
|
+
height: Math.round(r.height),
|
|
387
|
+
});
|
|
388
|
+
const isChrome = (el: Element) => !!el.closest(chromeSelector);
|
|
389
|
+
const directText = (el: Element) =>
|
|
390
|
+
Array.from(el.childNodes)
|
|
391
|
+
.filter((n) => n.nodeType === Node.TEXT_NODE)
|
|
392
|
+
.map((n) => n.nodeValue ?? "")
|
|
393
|
+
.join("");
|
|
394
|
+
const alpha = (color: string) => {
|
|
395
|
+
if (!color || color === "transparent") return 0;
|
|
396
|
+
const m = color.match(/rgba?\(([^)]+)\)/);
|
|
397
|
+
if (!m) return 1;
|
|
398
|
+
const parts = m[1].split(/[\s,/]+/).filter(Boolean);
|
|
399
|
+
return parts.length > 3 ? Number(parts[3]) : 1;
|
|
400
|
+
};
|
|
401
|
+
const paints = (el: Element, cs: CSSStyleDeclaration) =>
|
|
402
|
+
PAINTED_TAGS.has(el.tagName.toUpperCase()) ||
|
|
403
|
+
alpha(cs.backgroundColor) > 0 ||
|
|
404
|
+
cs.backgroundImage !== "none" ||
|
|
405
|
+
cs.boxShadow !== "none" ||
|
|
406
|
+
SIDES.some(
|
|
407
|
+
(s) =>
|
|
408
|
+
parseFloat(cs.getPropertyValue(`border-${s}-width`)) > 0 &&
|
|
409
|
+
cs.getPropertyValue(`border-${s}-style`) !== "none" &&
|
|
410
|
+
alpha(cs.getPropertyValue(`border-${s}-color`)) > 0,
|
|
411
|
+
);
|
|
412
|
+
const pick = (cs: CSSStyleDeclaration, props: string[]) => {
|
|
413
|
+
const out: Record<string, string> = {};
|
|
414
|
+
for (const p of props) out[p] = cs.getPropertyValue(p).trim();
|
|
415
|
+
return out;
|
|
416
|
+
};
|
|
417
|
+
const computedStyleProps = (
|
|
418
|
+
cs: CSSStyleDeclaration,
|
|
419
|
+
customProperties: string[],
|
|
420
|
+
) => {
|
|
421
|
+
const out = pick(cs, OUTSIDE_EXTRA_STYLE_PROPS);
|
|
422
|
+
for (const property of customProperties) {
|
|
423
|
+
out[property] = cs.getPropertyValue(property).trim();
|
|
424
|
+
}
|
|
425
|
+
return out;
|
|
426
|
+
};
|
|
427
|
+
const customPropertiesFor = (root: Element) => {
|
|
428
|
+
const document = root.ownerDocument;
|
|
429
|
+
let cache = customStylePropertiesByDocument.get(document);
|
|
430
|
+
if (!cache) {
|
|
431
|
+
cache = {
|
|
432
|
+
version: 0,
|
|
433
|
+
propertiesVersion: -1,
|
|
434
|
+
properties: null,
|
|
435
|
+
observer: new MutationObserver((records) => {
|
|
436
|
+
const isStyleSheet = (node: Node) => {
|
|
437
|
+
const element = node instanceof Element ? node : node.parentElement;
|
|
438
|
+
return !!element?.closest('style,link[rel~="stylesheet"]');
|
|
439
|
+
};
|
|
440
|
+
if (
|
|
441
|
+
records.some(
|
|
442
|
+
(record) =>
|
|
443
|
+
isStyleSheet(record.target) ||
|
|
444
|
+
Array.from(record.addedNodes).some(
|
|
445
|
+
(node) =>
|
|
446
|
+
node instanceof Element &&
|
|
447
|
+
(node.matches('style,link[rel~="stylesheet"]') ||
|
|
448
|
+
node.querySelector('style,link[rel~="stylesheet"]')),
|
|
449
|
+
) ||
|
|
450
|
+
Array.from(record.removedNodes).some(
|
|
451
|
+
(node) =>
|
|
452
|
+
node instanceof Element &&
|
|
453
|
+
(node.matches('style,link[rel~="stylesheet"]') ||
|
|
454
|
+
node.querySelector('style,link[rel~="stylesheet"]')),
|
|
455
|
+
),
|
|
456
|
+
)
|
|
457
|
+
) {
|
|
458
|
+
cache!.version += 1;
|
|
459
|
+
}
|
|
460
|
+
}),
|
|
461
|
+
};
|
|
462
|
+
cache.observer.observe(document.documentElement, {
|
|
463
|
+
attributes: true,
|
|
464
|
+
attributeFilter: ["disabled", "href", "media", "rel", "type"],
|
|
465
|
+
characterData: true,
|
|
466
|
+
childList: true,
|
|
467
|
+
subtree: true,
|
|
468
|
+
});
|
|
469
|
+
customStylePropertiesByDocument.set(document, cache);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const collectRuleProperties = () => {
|
|
473
|
+
const names = new Set<string>();
|
|
474
|
+
const visit = (rules: CSSRuleList) => {
|
|
475
|
+
for (const rule of Array.from(rules)) {
|
|
476
|
+
const style = (rule as CSSStyleRule).style;
|
|
477
|
+
if (style) {
|
|
478
|
+
for (let index = 0; index < style.length; index += 1) {
|
|
479
|
+
const property = style[index];
|
|
480
|
+
if (property?.startsWith("--")) names.add(property);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (
|
|
484
|
+
"name" in rule &&
|
|
485
|
+
typeof rule.name === "string" &&
|
|
486
|
+
rule.name.startsWith("--") &&
|
|
487
|
+
"syntax" in rule
|
|
488
|
+
) {
|
|
489
|
+
names.add(rule.name);
|
|
490
|
+
}
|
|
491
|
+
if ("cssRules" in rule) visit((rule as CSSGroupingRule).cssRules);
|
|
492
|
+
if ("styleSheet" in rule) {
|
|
493
|
+
const imported = (rule as CSSImportRule).styleSheet;
|
|
494
|
+
if (imported) visit(imported.cssRules);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
try {
|
|
500
|
+
for (const stylesheet of Array.from(document.styleSheets)) {
|
|
501
|
+
// Slides only uses this remote sheet for @font-face declarations.
|
|
502
|
+
if (
|
|
503
|
+
stylesheet.href &&
|
|
504
|
+
new URL(stylesheet.href).hostname === "fonts.googleapis.com"
|
|
505
|
+
) {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
visit(stylesheet.cssRules);
|
|
509
|
+
}
|
|
510
|
+
} catch (error) {
|
|
511
|
+
if (error instanceof DOMException && error.name === "SecurityError") {
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
throw error;
|
|
515
|
+
}
|
|
516
|
+
return [...names].sort();
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
if (cache.propertiesVersion !== cache.version) {
|
|
520
|
+
cache.properties = collectRuleProperties();
|
|
521
|
+
cache.propertiesVersion = cache.version;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const names = new Set(cache.properties ?? []);
|
|
525
|
+
if (cache.properties === null) {
|
|
526
|
+
for (const element of [root, ...root.querySelectorAll("*")]) {
|
|
527
|
+
const style = getComputedStyle(element);
|
|
528
|
+
for (let index = 0; index < style.length; index += 1) {
|
|
529
|
+
const property = style[index];
|
|
530
|
+
if (property?.startsWith("--")) names.add(property);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const addInlineProperties = (element: Element) => {
|
|
536
|
+
const style = (element as HTMLElement | SVGElement).style;
|
|
537
|
+
if (!style) return;
|
|
538
|
+
for (let index = 0; index < style.length; index += 1) {
|
|
539
|
+
const property = style[index];
|
|
540
|
+
if (property?.startsWith("--")) names.add(property);
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
for (
|
|
544
|
+
let ancestor: Element | null = root;
|
|
545
|
+
ancestor;
|
|
546
|
+
ancestor = ancestor.parentElement
|
|
547
|
+
) {
|
|
548
|
+
addInlineProperties(ancestor);
|
|
549
|
+
}
|
|
550
|
+
for (const element of root.querySelectorAll<HTMLElement | SVGElement>(
|
|
551
|
+
"[style]",
|
|
552
|
+
)) {
|
|
553
|
+
addInlineProperties(element);
|
|
554
|
+
}
|
|
555
|
+
return [...names].sort();
|
|
556
|
+
};
|
|
557
|
+
// getComputedStyle resolves an `auto` margin to its used length, which
|
|
558
|
+
// moves whenever a flex sibling grows; the computed value stays `auto`.
|
|
559
|
+
const boxProps = (el: Element, cs: CSSStyleDeclaration) => {
|
|
560
|
+
const out = pick(cs, BOX_PROPS);
|
|
561
|
+
if (el.hasAttribute("data-fmd-autofit-content")) {
|
|
562
|
+
out["--fmd-fit-scale"] = cs.getPropertyValue("--fmd-fit-scale").trim();
|
|
563
|
+
out["--fmd-fit-x"] = cs.getPropertyValue("--fmd-fit-x").trim();
|
|
564
|
+
out["--fmd-fit-y"] = cs.getPropertyValue("--fmd-fit-y").trim();
|
|
565
|
+
out["data-fmd-autofit-active"] = String(
|
|
566
|
+
el.hasAttribute("data-fmd-autofit-active"),
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
const map =
|
|
570
|
+
typeof el.computedStyleMap === "function" ? el.computedStyleMap() : null;
|
|
571
|
+
const inline = (el as HTMLElement).style;
|
|
572
|
+
for (const s of SIDES) {
|
|
573
|
+
if (
|
|
574
|
+
String(map?.get(`margin-${s}`)) === "auto" ||
|
|
575
|
+
(!map && inline?.getPropertyValue(`margin-${s}`) === "auto")
|
|
576
|
+
)
|
|
577
|
+
out[`margin-${s}`] = "auto";
|
|
578
|
+
}
|
|
579
|
+
return out;
|
|
580
|
+
};
|
|
581
|
+
const visible = (el: Element) => {
|
|
582
|
+
const r = el.getBoundingClientRect();
|
|
583
|
+
return (
|
|
584
|
+
r.width > 0 &&
|
|
585
|
+
r.height > 0 &&
|
|
586
|
+
el.checkVisibility({ opacityProperty: true, visibilityProperty: true })
|
|
587
|
+
);
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
function textTargets(root: Element): HTMLElement[] {
|
|
591
|
+
return Array.from(
|
|
592
|
+
root.querySelectorAll<HTMLElement>('[data-slide-text-block="true"]'),
|
|
593
|
+
).filter((el) => {
|
|
594
|
+
if (el.tagName === "STYLE" || el.tagName === "SCRIPT") return false;
|
|
595
|
+
if (isChrome(el)) return false;
|
|
596
|
+
const r = el.getBoundingClientRect();
|
|
597
|
+
return r.width > 0 && r.height > 0 && norm(el.textContent) !== "";
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function firstGlyphRect(el: Element): DOMRect {
|
|
602
|
+
const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
|
|
603
|
+
for (let n = walker.nextNode(); n; n = walker.nextNode()) {
|
|
604
|
+
const value = n.nodeValue ?? "";
|
|
605
|
+
const offset = value.search(/\S/);
|
|
606
|
+
if (offset < 0) continue;
|
|
607
|
+
const range = document.createRange();
|
|
608
|
+
range.setStart(n, offset);
|
|
609
|
+
range.setEnd(n, offset + 1);
|
|
610
|
+
const r = range.getBoundingClientRect();
|
|
611
|
+
if (r.width > 0 && r.height > 0) return r;
|
|
612
|
+
}
|
|
613
|
+
return el.getBoundingClientRect();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function occurrenceOf(el: Element, root: ParentNode): number {
|
|
617
|
+
const tag = el.tagName;
|
|
618
|
+
const text = strip(el.textContent);
|
|
619
|
+
let n = 0;
|
|
620
|
+
for (const other of Array.from(root.querySelectorAll(tag))) {
|
|
621
|
+
if (other === el) return n;
|
|
622
|
+
if (strip(other.textContent) === text) n++;
|
|
623
|
+
}
|
|
624
|
+
return n;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
/** Deepest match also covers a source split across sibling text targets. */
|
|
628
|
+
function findByText(root: Element, text: string): Element | null {
|
|
629
|
+
const want = strip(text);
|
|
630
|
+
if (!want) return null;
|
|
631
|
+
const prefix = want.slice(0, 40);
|
|
632
|
+
let best: Element | null = null;
|
|
633
|
+
let bestScore = Infinity;
|
|
634
|
+
let bestDepth = -1;
|
|
635
|
+
let bestCount = 0;
|
|
636
|
+
const candidates = new Set<Element>();
|
|
637
|
+
for (const target of textTargets(root)) {
|
|
638
|
+
for (
|
|
639
|
+
let el: Element | null = target;
|
|
640
|
+
el && el !== root;
|
|
641
|
+
el = el.parentElement
|
|
642
|
+
) {
|
|
643
|
+
candidates.add(el);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
for (const el of candidates) {
|
|
647
|
+
if (!visible(el)) continue;
|
|
648
|
+
const have = strip(el.textContent);
|
|
649
|
+
if (!have.includes(prefix)) continue;
|
|
650
|
+
const score = Math.abs(have.length - want.length);
|
|
651
|
+
let depth = 0;
|
|
652
|
+
for (
|
|
653
|
+
let parent = el.parentElement;
|
|
654
|
+
parent && parent !== root;
|
|
655
|
+
parent = parent.parentElement
|
|
656
|
+
) {
|
|
657
|
+
depth++;
|
|
658
|
+
}
|
|
659
|
+
if (score < bestScore || (score === bestScore && depth > bestDepth)) {
|
|
660
|
+
best = el;
|
|
661
|
+
bestScore = score;
|
|
662
|
+
bestDepth = depth;
|
|
663
|
+
bestCount = 1;
|
|
664
|
+
} else if (score === bestScore && depth === bestDepth) {
|
|
665
|
+
bestCount += 1;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return bestCount === 1 ? best : null;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* The element's box grown to its content: text that overflows a fixed-size
|
|
673
|
+
* box (a freeform object) paints outside the box but is still the edit.
|
|
674
|
+
*/
|
|
675
|
+
function paintedRect(el: Element): DOMRect {
|
|
676
|
+
const box = el.getBoundingClientRect();
|
|
677
|
+
const range = document.createRange();
|
|
678
|
+
range.selectNodeContents(el);
|
|
679
|
+
const content = range.getBoundingClientRect();
|
|
680
|
+
if (!content.width && !content.height) return box;
|
|
681
|
+
const left = Math.min(box.left, content.left);
|
|
682
|
+
const top = Math.min(box.top, content.top);
|
|
683
|
+
return new DOMRect(
|
|
684
|
+
left,
|
|
685
|
+
top,
|
|
686
|
+
Math.max(box.right, content.right) - left,
|
|
687
|
+
Math.max(box.bottom, content.bottom) - top,
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function listTargets(canvasSel: string): TextTarget[] {
|
|
692
|
+
const root = document.querySelector(canvasSel);
|
|
693
|
+
if (!root) throw new Error(`canvas not found: ${canvasSel}`);
|
|
694
|
+
const origin = root.getBoundingClientRect();
|
|
695
|
+
const slideRoot = root.querySelector(".slide-content") ?? root;
|
|
696
|
+
return textTargets(root).map((el, index) => {
|
|
697
|
+
const glyph = firstGlyphRect(el);
|
|
698
|
+
const point = {
|
|
699
|
+
x: glyph.left + glyph.width / 2,
|
|
700
|
+
y: glyph.top + glyph.height / 2,
|
|
701
|
+
};
|
|
702
|
+
const hit = document.elementFromPoint(point.x, point.y);
|
|
703
|
+
return {
|
|
704
|
+
index,
|
|
705
|
+
builderId: el.getAttribute("data-builder-id"),
|
|
706
|
+
slideObjectId:
|
|
707
|
+
el
|
|
708
|
+
.closest<HTMLElement>("[data-slide-object-id]")
|
|
709
|
+
?.getAttribute("data-slide-object-id") ?? null,
|
|
710
|
+
pptxParagraph:
|
|
711
|
+
el
|
|
712
|
+
.closest<HTMLElement>("[data-pptx-paragraph]")
|
|
713
|
+
?.getAttribute("data-pptx-paragraph") ?? null,
|
|
714
|
+
tag: el.tagName,
|
|
715
|
+
className: el.getAttribute("class") ?? "",
|
|
716
|
+
text: norm(el.textContent),
|
|
717
|
+
occurrence: occurrenceOf(el, slideRoot),
|
|
718
|
+
point,
|
|
719
|
+
rect: rectOf(el.getBoundingClientRect(), origin),
|
|
720
|
+
covered: !hit || !(el === hit || el.contains(hit)),
|
|
721
|
+
};
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
function targetSourceHtml(canvasSel: string, targetIndex: number) {
|
|
726
|
+
const root = document.querySelector(canvasSel);
|
|
727
|
+
if (!root) throw new Error(`canvas not found: ${canvasSel}`);
|
|
728
|
+
const target = textTargets(root)[targetIndex];
|
|
729
|
+
if (!target) throw new Error(`text target not found: ${targetIndex}`);
|
|
730
|
+
return target.innerHTML;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/** The focused editor root, in place or floating; a fix may move it. */
|
|
734
|
+
function activeEditor(): HTMLElement | null {
|
|
735
|
+
const a = document.activeElement as HTMLElement | null;
|
|
736
|
+
if (a && a.isContentEditable) {
|
|
737
|
+
let top: HTMLElement = a;
|
|
738
|
+
while (top.parentElement?.isContentEditable) top = top.parentElement;
|
|
739
|
+
return top;
|
|
740
|
+
}
|
|
741
|
+
return document.querySelector<HTMLElement>(
|
|
742
|
+
".slide-rich-editor-host .ProseMirror",
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/** Editor surface living outside the slide canvas (the floating host). */
|
|
747
|
+
function floatingHost(root: Element, editor: HTMLElement | null) {
|
|
748
|
+
if (!editor || root.contains(editor)) return null;
|
|
749
|
+
return editor.closest(".slide-rich-editor-host") ?? editor;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function editedSource(root: Element, editor: HTMLElement | null) {
|
|
753
|
+
return (
|
|
754
|
+
root.querySelector<HTMLElement>('[data-editing-block="true"]') ??
|
|
755
|
+
(editor && root.contains(editor)
|
|
756
|
+
? (editor.closest<HTMLElement>("[data-slide-text-block]") ?? editor)
|
|
757
|
+
: null)
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function caretRect(origin: DOMRect, source: HTMLElement | null): Rect | null {
|
|
762
|
+
const selection = getSelection();
|
|
763
|
+
if (!source || !selection?.rangeCount) return null;
|
|
764
|
+
const caret = selection.getRangeAt(0);
|
|
765
|
+
if (!caret.collapsed || !source.contains(caret.endContainer)) return null;
|
|
766
|
+
let box: DOMRect | undefined = caret.getClientRects()[0];
|
|
767
|
+
// A caret in an empty or collapsed-whitespace text node, or on an empty
|
|
768
|
+
// line, draws no box of its own; the next <br> or rendered character
|
|
769
|
+
// after it in document order sits on the caret's line.
|
|
770
|
+
if (!box?.height) {
|
|
771
|
+
box = undefined;
|
|
772
|
+
const walker = document.createTreeWalker(
|
|
773
|
+
source,
|
|
774
|
+
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT,
|
|
775
|
+
);
|
|
776
|
+
const char = document.createRange();
|
|
777
|
+
for (let n = walker.nextNode(); n && !box; n = walker.nextNode()) {
|
|
778
|
+
if (n.nodeName === "BR") {
|
|
779
|
+
const at = Array.from(n.parentNode!.childNodes).indexOf(
|
|
780
|
+
n as ChildNode,
|
|
781
|
+
);
|
|
782
|
+
const r = (n as Element).getBoundingClientRect();
|
|
783
|
+
if (caret.comparePoint(n.parentNode!, at) >= 0 && r.height) box = r;
|
|
784
|
+
} else if (n.nodeType === Node.TEXT_NODE) {
|
|
785
|
+
const from =
|
|
786
|
+
caret.comparePoint(n, 0) >= 0
|
|
787
|
+
? 0
|
|
788
|
+
: n === caret.startContainer
|
|
789
|
+
? caret.startOffset
|
|
790
|
+
: null;
|
|
791
|
+
if (from === null) continue;
|
|
792
|
+
for (let i = from; i < (n as Text).length && !box; i++) {
|
|
793
|
+
char.setStart(n, i);
|
|
794
|
+
char.setEnd(n, i + 1);
|
|
795
|
+
const r = char.getClientRects()[0];
|
|
796
|
+
if (r?.height) box = r;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return box?.height ? rectOf(box, origin) : null;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function caretBlock(source: HTMLElement | null): number | null {
|
|
805
|
+
const selection = getSelection();
|
|
806
|
+
const at = selection?.rangeCount
|
|
807
|
+
? selection.getRangeAt(0).endContainer
|
|
808
|
+
: null;
|
|
809
|
+
if (!source || !at || !source.contains(at)) return null;
|
|
810
|
+
let el = at instanceof Element ? at : at.parentElement;
|
|
811
|
+
// A flex item computes to display: block, yet the items along a flex row
|
|
812
|
+
// share its line, so a flex item never counts as a block of its own.
|
|
813
|
+
while (
|
|
814
|
+
el &&
|
|
815
|
+
el !== source &&
|
|
816
|
+
(/^inline|^contents/.test(getComputedStyle(el).display) ||
|
|
817
|
+
/flex$/.test(getComputedStyle(el.parentElement!).display))
|
|
818
|
+
)
|
|
819
|
+
el = el.parentElement;
|
|
820
|
+
return !el || el === source
|
|
821
|
+
? -1
|
|
822
|
+
: Array.from(source.querySelectorAll("*")).indexOf(el);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
function caretConvertibleTag(editor: HTMLElement | null): string | null {
|
|
826
|
+
const focus = getSelection()?.focusNode;
|
|
827
|
+
if (!editor || !focus || !editor.contains(focus)) return null;
|
|
828
|
+
let el = focus instanceof Element ? focus : focus.parentElement;
|
|
829
|
+
while (el) {
|
|
830
|
+
const tag = el.tagName.toLowerCase();
|
|
831
|
+
if (/^h[1-6]$/.test(tag) || tag === "li") return tag;
|
|
832
|
+
if (el === editor) break;
|
|
833
|
+
el = el.parentElement;
|
|
834
|
+
}
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Top of the element's rendered text and line breaks. A range over the
|
|
840
|
+
* whole element would also take in the border box of every child, so a
|
|
841
|
+
* taller icon or shape beside the text would pin it.
|
|
842
|
+
*/
|
|
843
|
+
function contentTop(source: HTMLElement, origin: DOMRect): number {
|
|
844
|
+
let top = Infinity;
|
|
845
|
+
const walker = document.createTreeWalker(
|
|
846
|
+
source,
|
|
847
|
+
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT,
|
|
848
|
+
);
|
|
849
|
+
const range = document.createRange();
|
|
850
|
+
for (let n = walker.nextNode(); n; n = walker.nextNode()) {
|
|
851
|
+
let rects: ArrayLike<DOMRect> = [];
|
|
852
|
+
if (n.nodeName === "BR") rects = (n as Element).getClientRects();
|
|
853
|
+
else if (n.nodeType === Node.TEXT_NODE) {
|
|
854
|
+
range.selectNodeContents(n);
|
|
855
|
+
rects = range.getClientRects();
|
|
856
|
+
}
|
|
857
|
+
for (const r of Array.from(rects))
|
|
858
|
+
if (r.height) top = Math.min(top, r.top);
|
|
859
|
+
}
|
|
860
|
+
if (top === Infinity) top = source.getBoundingClientRect().top;
|
|
861
|
+
return Math.round(top - origin.top);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function editorState(canvasSel: string): EditorState {
|
|
865
|
+
const root = document.querySelector(canvasSel);
|
|
866
|
+
if (!root) throw new Error(`canvas not found: ${canvasSel}`);
|
|
867
|
+
const origin = root.getBoundingClientRect();
|
|
868
|
+
const pm = activeEditor();
|
|
869
|
+
const source = editedSource(root, pm);
|
|
870
|
+
const slideRoot = root.querySelector(".slide-content") ?? root;
|
|
871
|
+
return {
|
|
872
|
+
editing: !!pm,
|
|
873
|
+
focusInEditor: !!pm && pm.contains(document.activeElement),
|
|
874
|
+
blocks: pm ? pm.children.length : 0,
|
|
875
|
+
editorRect: pm ? rectOf(pm.getBoundingClientRect(), origin) : null,
|
|
876
|
+
sourceRect: source
|
|
877
|
+
? rectOf(source.getBoundingClientRect(), origin)
|
|
878
|
+
: null,
|
|
879
|
+
contentTop: source ? contentTop(source, origin) : null,
|
|
880
|
+
caretRect: caretRect(origin, source),
|
|
881
|
+
caretBlock: caretBlock(source),
|
|
882
|
+
caretConvertibleTag: caretConvertibleTag(pm),
|
|
883
|
+
sourceTag: source?.tagName ?? null,
|
|
884
|
+
sourceText: source ? norm(source.textContent) : null,
|
|
885
|
+
sourceOccurrence: source ? occurrenceOf(source, slideRoot) : 0,
|
|
886
|
+
editorHtml: pm?.innerHTML.slice(0, 4000) ?? "",
|
|
887
|
+
editorText: pm ? lines(pm) : "",
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Compares in rendered characters from the editor's start, so equivalent
|
|
893
|
+
* DOM positions agree. That count makes a row's end equal the next row's
|
|
894
|
+
* start, so the selection must also lie in the point's row. A click on a
|
|
895
|
+
* glyph's middle may put the caret on either side of it, so the point spans
|
|
896
|
+
* one grapheme each way, but never a space, which would reach the next
|
|
897
|
+
* word; a double-click spans the word and a space after it; a point on a
|
|
898
|
+
* short leading element of a row (a bullet marker) spans that element up
|
|
899
|
+
* to the row's text. Every offset indexes one collapsed text of the whole
|
|
900
|
+
* editor, since collapsing a row alone can merge a space with its
|
|
901
|
+
* neighbor's differently.
|
|
902
|
+
*/
|
|
903
|
+
async function entryCaretProblem(
|
|
904
|
+
point: { x: number; y: number },
|
|
905
|
+
gesture: string,
|
|
906
|
+
): Promise<string | null> {
|
|
907
|
+
await new Promise((r) =>
|
|
908
|
+
requestAnimationFrame(() => requestAnimationFrame(r)),
|
|
909
|
+
);
|
|
910
|
+
const editor = activeEditor();
|
|
911
|
+
const selection = getSelection();
|
|
912
|
+
if (!editor || !selection?.rangeCount) return "no selection";
|
|
913
|
+
const sel = selection.getRangeAt(0);
|
|
914
|
+
if (
|
|
915
|
+
!editor.contains(sel.startContainer) ||
|
|
916
|
+
!editor.contains(sel.endContainer)
|
|
917
|
+
)
|
|
918
|
+
return "the selection is outside the editor";
|
|
919
|
+
const renderedText = (text: string | null | undefined) =>
|
|
920
|
+
(text ?? "").replace(/[\s\u200b\ufeff]+/g, " ");
|
|
921
|
+
const offsetOf = (node: Node, offset: number) => {
|
|
922
|
+
const r = document.createRange();
|
|
923
|
+
r.setStart(editor, 0);
|
|
924
|
+
r.setEnd(node, offset);
|
|
925
|
+
return renderedText(r.toString()).length;
|
|
926
|
+
};
|
|
927
|
+
const start = offsetOf(sel.startContainer, sel.startOffset);
|
|
928
|
+
const end = offsetOf(sel.endContainer, sel.endOffset);
|
|
929
|
+
// caretRangeFromPoint rounds the point to whole pixels, which can move it
|
|
930
|
+
// across a narrow glyph; the click itself used the fractional point.
|
|
931
|
+
const pos = document.caretPositionFromPoint?.(point.x, point.y);
|
|
932
|
+
const range = pos ? null : document.caretRangeFromPoint(point.x, point.y);
|
|
933
|
+
const node = pos?.offsetNode ?? range?.startContainer;
|
|
934
|
+
const offset = pos?.offset ?? range?.startOffset ?? 0;
|
|
935
|
+
if (!node || !editor.contains(node))
|
|
936
|
+
return "the click point is outside the editor";
|
|
937
|
+
const pointHitsPunctuation = () => {
|
|
938
|
+
if (!(node instanceof Text)) return false;
|
|
939
|
+
let at = 0;
|
|
940
|
+
for (const character of node.data) {
|
|
941
|
+
const from = at;
|
|
942
|
+
at += character.length;
|
|
943
|
+
if (
|
|
944
|
+
(from !== offset && at !== offset) ||
|
|
945
|
+
!/[\p{P}\p{S}]/u.test(character)
|
|
946
|
+
) {
|
|
947
|
+
continue;
|
|
948
|
+
}
|
|
949
|
+
const glyph = document.createRange();
|
|
950
|
+
glyph.setStart(node, from);
|
|
951
|
+
glyph.setEnd(node, at);
|
|
952
|
+
if (
|
|
953
|
+
Array.from(glyph.getClientRects()).some(
|
|
954
|
+
(r) =>
|
|
955
|
+
point.x >= r.left &&
|
|
956
|
+
point.x <= r.right &&
|
|
957
|
+
point.y >= r.top &&
|
|
958
|
+
point.y <= r.bottom,
|
|
959
|
+
)
|
|
960
|
+
) {
|
|
961
|
+
return true;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
return false;
|
|
965
|
+
};
|
|
966
|
+
let row: Element = editor;
|
|
967
|
+
let marker: Element | null = null;
|
|
968
|
+
for (
|
|
969
|
+
let el = node instanceof Element ? node : node.parentElement;
|
|
970
|
+
el && el !== editor && editor.contains(el);
|
|
971
|
+
el = el.parentElement
|
|
972
|
+
) {
|
|
973
|
+
const parent = el.parentElement;
|
|
974
|
+
const own = renderedText(el.textContent).length;
|
|
975
|
+
if (
|
|
976
|
+
parent &&
|
|
977
|
+
parent.firstElementChild === el &&
|
|
978
|
+
own >= 1 &&
|
|
979
|
+
own <= 3 &&
|
|
980
|
+
// A number label like "01" is text a double-click selects; only a
|
|
981
|
+
// glyph like "●" is a marker, as the editor itself treats it.
|
|
982
|
+
!/[\p{L}\p{N}]/u.test(el.textContent ?? "") &&
|
|
983
|
+
renderedText(parent.textContent).length > own &&
|
|
984
|
+
offsetOf(parent, 0) === offsetOf(el, 0)
|
|
985
|
+
) {
|
|
986
|
+
row = parent;
|
|
987
|
+
marker = el;
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
if (!getComputedStyle(el).display.startsWith("inline")) {
|
|
991
|
+
row = el;
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
// A bullet marker is not text, so even a double-click on one only
|
|
996
|
+
// places the caret at the row's text.
|
|
997
|
+
if ((marker || gesture !== "dblclick") && !sel.collapsed)
|
|
998
|
+
return `a ${gesture} selected characters ${start}-${end} instead of placing a caret`;
|
|
999
|
+
const rowStart = offsetOf(row, 0);
|
|
1000
|
+
const editorTextRange = document.createRange();
|
|
1001
|
+
editorTextRange.selectNodeContents(editor);
|
|
1002
|
+
const editorText = renderedText(editorTextRange.toString());
|
|
1003
|
+
let from: number;
|
|
1004
|
+
let to: number;
|
|
1005
|
+
if (marker) {
|
|
1006
|
+
from = offsetOf(marker, 0);
|
|
1007
|
+
to = offsetOf(marker, marker.childNodes.length);
|
|
1008
|
+
if (editorText[to] === " ") to++;
|
|
1009
|
+
} else {
|
|
1010
|
+
const rowText = editorText.slice(
|
|
1011
|
+
rowStart,
|
|
1012
|
+
offsetOf(row, row.childNodes.length),
|
|
1013
|
+
);
|
|
1014
|
+
const pointOffset = offsetOf(node, offset) - rowStart;
|
|
1015
|
+
const segments = Array.from(
|
|
1016
|
+
new Intl.Segmenter(undefined, {
|
|
1017
|
+
granularity: gesture === "dblclick" ? "word" : "grapheme",
|
|
1018
|
+
}).segment(rowText),
|
|
1019
|
+
);
|
|
1020
|
+
let localFrom = pointOffset;
|
|
1021
|
+
let localTo = pointOffset;
|
|
1022
|
+
let wordEnd: number | undefined;
|
|
1023
|
+
if (gesture === "dblclick") {
|
|
1024
|
+
const wordIndex = segments.findIndex(
|
|
1025
|
+
({ index, segment, isWordLike }) =>
|
|
1026
|
+
isWordLike &&
|
|
1027
|
+
((index <= pointOffset && pointOffset < index + segment.length) ||
|
|
1028
|
+
(!sel.collapsed &&
|
|
1029
|
+
start - rowStart < index + segment.length &&
|
|
1030
|
+
end - rowStart > index)),
|
|
1031
|
+
);
|
|
1032
|
+
if (wordIndex >= 0) {
|
|
1033
|
+
const word = segments[wordIndex]!;
|
|
1034
|
+
localFrom = word.index;
|
|
1035
|
+
wordEnd = word.index + word.segment.length;
|
|
1036
|
+
localTo = wordEnd;
|
|
1037
|
+
const next = segments[wordIndex + 1]?.segment;
|
|
1038
|
+
if (next && !next.trim()) localTo += next.length;
|
|
1039
|
+
const collapsedOnPunctuation =
|
|
1040
|
+
sel.collapsed &&
|
|
1041
|
+
Math.abs(start - rowStart - word.index) <= 1 &&
|
|
1042
|
+
pointHitsPunctuation();
|
|
1043
|
+
if (
|
|
1044
|
+
!collapsedOnPunctuation &&
|
|
1045
|
+
(start - rowStart > localFrom || end - rowStart < wordEnd)
|
|
1046
|
+
)
|
|
1047
|
+
return `double-click did not select the complete word (selection ${start - rowStart}-${end - rowStart}, click ${pointOffset}, word ${localFrom}-${wordEnd})`;
|
|
1048
|
+
if (collapsedOnPunctuation) {
|
|
1049
|
+
localFrom = start - rowStart;
|
|
1050
|
+
localTo = end - rowStart;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
if (wordEnd === undefined) {
|
|
1055
|
+
segments.forEach(({ index, segment }, i) => {
|
|
1056
|
+
if (gesture !== "dblclick" && !segment.trim()) return;
|
|
1057
|
+
if (index < pointOffset && index + segment.length >= pointOffset)
|
|
1058
|
+
localFrom = index;
|
|
1059
|
+
if (index <= pointOffset && index + segment.length > pointOffset) {
|
|
1060
|
+
localTo = index + segment.length;
|
|
1061
|
+
const next = segments[i + 1]?.segment;
|
|
1062
|
+
if (gesture === "dblclick" && next && !next.trim())
|
|
1063
|
+
localTo += next.length;
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
from = rowStart + localFrom;
|
|
1068
|
+
to = rowStart + localTo;
|
|
1069
|
+
}
|
|
1070
|
+
const rowRange = document.createRange();
|
|
1071
|
+
rowRange.selectNode(row);
|
|
1072
|
+
const inRow =
|
|
1073
|
+
rowRange.comparePoint(sel.startContainer, sel.startOffset) === 0 &&
|
|
1074
|
+
rowRange.comparePoint(sel.endContainer, sel.endOffset) === 0;
|
|
1075
|
+
if (inRow && start >= from && end <= to) return null;
|
|
1076
|
+
return `selection at character ${start}${end !== start ? `-${end}` : ""} of ${editorText.length}${inRow ? "" : " in another row"}, click at ${from}${to !== from ? `-${to}` : ""}`;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
function captureSnapshot(
|
|
1080
|
+
canvasSel: string,
|
|
1081
|
+
edited: {
|
|
1082
|
+
targetIndex?: number;
|
|
1083
|
+
text?: string;
|
|
1084
|
+
marker?: string;
|
|
1085
|
+
targetBuilderId?: string;
|
|
1086
|
+
targetSlideObjectId?: string;
|
|
1087
|
+
targetPptxParagraph?: string;
|
|
1088
|
+
targetTextIncludes?: string;
|
|
1089
|
+
authoringFragmentTexts?: string[];
|
|
1090
|
+
preserveStyledBulletMarker?: boolean;
|
|
1091
|
+
},
|
|
1092
|
+
outsideOnly = false,
|
|
1093
|
+
): Snapshot | OutsideSnapshot {
|
|
1094
|
+
const root = document.querySelector(canvasSel);
|
|
1095
|
+
if (!root) throw new Error(`canvas not found: ${canvasSel}`);
|
|
1096
|
+
const customProperties = outsideOnly ? customPropertiesFor(root) : [];
|
|
1097
|
+
const origin = root.getBoundingClientRect();
|
|
1098
|
+
const editor = activeEditor();
|
|
1099
|
+
const host = floatingHost(root, editor);
|
|
1100
|
+
const editingBlock = editedSource(root, editor);
|
|
1101
|
+
let editedEl: Element | null = null;
|
|
1102
|
+
if (edited.marker) {
|
|
1103
|
+
const marker = strip(edited.marker);
|
|
1104
|
+
const matches = textTargets(root).filter((el) =>
|
|
1105
|
+
strip(el.textContent).includes(marker),
|
|
1106
|
+
);
|
|
1107
|
+
editedEl = matches.length === 1 ? matches[0]! : null;
|
|
1108
|
+
} else if (edited.targetIndex !== undefined) {
|
|
1109
|
+
editedEl = textTargets(root)[edited.targetIndex] ?? null;
|
|
1110
|
+
} else if (edited.text) {
|
|
1111
|
+
editedEl = findByText(root, edited.text);
|
|
1112
|
+
}
|
|
1113
|
+
let stableEditedTarget: Element | null = null;
|
|
1114
|
+
if (
|
|
1115
|
+
edited.targetSlideObjectId !== undefined &&
|
|
1116
|
+
edited.targetPptxParagraph !== undefined
|
|
1117
|
+
) {
|
|
1118
|
+
const matches = Array.from(
|
|
1119
|
+
root.querySelectorAll<HTMLElement>("[data-pptx-paragraph]"),
|
|
1120
|
+
).filter(
|
|
1121
|
+
(el) =>
|
|
1122
|
+
el.getAttribute("data-pptx-paragraph") ===
|
|
1123
|
+
edited.targetPptxParagraph &&
|
|
1124
|
+
el
|
|
1125
|
+
.closest("[data-slide-object-id]")
|
|
1126
|
+
?.getAttribute("data-slide-object-id") ===
|
|
1127
|
+
edited.targetSlideObjectId,
|
|
1128
|
+
);
|
|
1129
|
+
const paragraphTextMatches = edited.targetTextIncludes
|
|
1130
|
+
? matches.filter((el) =>
|
|
1131
|
+
norm(el.textContent).includes(norm(edited.targetTextIncludes)),
|
|
1132
|
+
)
|
|
1133
|
+
: matches;
|
|
1134
|
+
const targetObject = Array.from(
|
|
1135
|
+
root.querySelectorAll<HTMLElement>("[data-slide-object-id]"),
|
|
1136
|
+
).find(
|
|
1137
|
+
(el) =>
|
|
1138
|
+
el.getAttribute("data-slide-object-id") ===
|
|
1139
|
+
edited.targetSlideObjectId,
|
|
1140
|
+
);
|
|
1141
|
+
const fallbackTextMatches =
|
|
1142
|
+
edited.targetTextIncludes && targetObject
|
|
1143
|
+
? Array.from(
|
|
1144
|
+
targetObject.querySelectorAll<HTMLElement>(
|
|
1145
|
+
"p,li,blockquote,h1,h2,h3,h4,h5,h6,div",
|
|
1146
|
+
),
|
|
1147
|
+
).filter((el) =>
|
|
1148
|
+
norm(el.textContent).includes(norm(edited.targetTextIncludes)),
|
|
1149
|
+
)
|
|
1150
|
+
: [];
|
|
1151
|
+
const fallbackTargets = fallbackTextMatches.filter(
|
|
1152
|
+
(el) =>
|
|
1153
|
+
!fallbackTextMatches.some(
|
|
1154
|
+
(other) => other !== el && el.contains(other),
|
|
1155
|
+
),
|
|
1156
|
+
);
|
|
1157
|
+
const textMatches =
|
|
1158
|
+
paragraphTextMatches.length > 0
|
|
1159
|
+
? paragraphTextMatches
|
|
1160
|
+
: fallbackTargets;
|
|
1161
|
+
const builderMatches = edited.targetBuilderId
|
|
1162
|
+
? textMatches.filter(
|
|
1163
|
+
(el) =>
|
|
1164
|
+
el
|
|
1165
|
+
.closest<HTMLElement>("[data-builder-id]")
|
|
1166
|
+
?.getAttribute("data-builder-id") === edited.targetBuilderId,
|
|
1167
|
+
)
|
|
1168
|
+
: [];
|
|
1169
|
+
const resolvedTargets =
|
|
1170
|
+
builderMatches.length === 1 ? builderMatches : textMatches;
|
|
1171
|
+
if (resolvedTargets.length !== 1) {
|
|
1172
|
+
const candidates = textMatches.map((el) => {
|
|
1173
|
+
const object = el.closest<HTMLElement>("[data-slide-object-id]");
|
|
1174
|
+
const builder = el.closest<HTMLElement>("[data-builder-id]");
|
|
1175
|
+
const rect = el.getBoundingClientRect();
|
|
1176
|
+
const style = getComputedStyle(el);
|
|
1177
|
+
return {
|
|
1178
|
+
objectId: object?.getAttribute("data-slide-object-id") ?? null,
|
|
1179
|
+
builderId: builder?.getAttribute("data-builder-id") ?? null,
|
|
1180
|
+
editing: el.getAttribute("data-editing-block"),
|
|
1181
|
+
rect: [rect.x, rect.y, rect.width, rect.height],
|
|
1182
|
+
display: style.display,
|
|
1183
|
+
visibility: style.visibility,
|
|
1184
|
+
opacity: style.opacity,
|
|
1185
|
+
};
|
|
1186
|
+
});
|
|
1187
|
+
throw new Error(
|
|
1188
|
+
`expected one imported paragraph ${edited.targetPptxParagraph} in slide object ${edited.targetSlideObjectId}${edited.targetTextIncludes ? ` containing ${JSON.stringify(edited.targetTextIncludes)} for builder ${edited.targetBuilderId ?? "any"}` : ""}, found ${resolvedTargets.length}: ${JSON.stringify(candidates)}`,
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
stableEditedTarget = resolvedTargets[0]!;
|
|
1192
|
+
} else if (edited.targetBuilderId) {
|
|
1193
|
+
stableEditedTarget =
|
|
1194
|
+
Array.from(
|
|
1195
|
+
root.querySelectorAll<HTMLElement>("[data-builder-id]"),
|
|
1196
|
+
).find(
|
|
1197
|
+
(el) => el.getAttribute("data-builder-id") === edited.targetBuilderId,
|
|
1198
|
+
) ?? null;
|
|
1199
|
+
}
|
|
1200
|
+
const editedOwner =
|
|
1201
|
+
stableEditedTarget ??
|
|
1202
|
+
(editedEl
|
|
1203
|
+
? (editedEl.closest("[data-slide-object-id]") ??
|
|
1204
|
+
editedEl.closest('[data-slide-text-block="true"]') ??
|
|
1205
|
+
editedEl.closest("ul, ol") ??
|
|
1206
|
+
editedEl)
|
|
1207
|
+
: null);
|
|
1208
|
+
const targetBlock = editingBlock ?? editedOwner;
|
|
1209
|
+
const editedBox = editingBlock ?? targetBlock;
|
|
1210
|
+
const editedObject =
|
|
1211
|
+
stableEditedTarget?.closest<HTMLElement>("[data-slide-object-id]") ??
|
|
1212
|
+
editedBox?.closest<HTMLElement>("[data-slide-object-id]") ??
|
|
1213
|
+
null;
|
|
1214
|
+
const logicalObjectId =
|
|
1215
|
+
edited.targetSlideObjectId ??
|
|
1216
|
+
editedObject?.getAttribute("data-slide-object-id") ??
|
|
1217
|
+
null;
|
|
1218
|
+
const targetObjectIds = new Set(
|
|
1219
|
+
[logicalObjectId].filter((id): id is string => !!id),
|
|
1220
|
+
);
|
|
1221
|
+
const targetParagraph =
|
|
1222
|
+
edited.targetSlideObjectId !== undefined &&
|
|
1223
|
+
edited.targetPptxParagraph !== undefined
|
|
1224
|
+
? Array.from(
|
|
1225
|
+
root.querySelectorAll<HTMLElement>("[data-pptx-paragraph]"),
|
|
1226
|
+
).find(
|
|
1227
|
+
(el) =>
|
|
1228
|
+
el.getAttribute("data-pptx-paragraph") ===
|
|
1229
|
+
edited.targetPptxParagraph &&
|
|
1230
|
+
el
|
|
1231
|
+
.closest("[data-slide-object-id]")
|
|
1232
|
+
?.getAttribute("data-slide-object-id") ===
|
|
1233
|
+
edited.targetSlideObjectId,
|
|
1234
|
+
)
|
|
1235
|
+
: null;
|
|
1236
|
+
const fragmentTexts = [
|
|
1237
|
+
...(edited.authoringFragmentTexts ?? []),
|
|
1238
|
+
...(edited.targetTextIncludes ? [edited.targetTextIncludes] : []),
|
|
1239
|
+
];
|
|
1240
|
+
const authoringFragmentBlocks = new Set<HTMLElement>();
|
|
1241
|
+
if (fragmentTexts.length > 0 && editedObject) {
|
|
1242
|
+
for (const text of new Set(fragmentTexts)) {
|
|
1243
|
+
const candidates = Array.from(
|
|
1244
|
+
editedObject.querySelectorAll<HTMLElement>(
|
|
1245
|
+
"p,li,blockquote,h1,h2,h3,h4,h5,h6,div",
|
|
1246
|
+
),
|
|
1247
|
+
).filter((el) => norm(el.textContent).includes(norm(text)));
|
|
1248
|
+
const blocks = candidates.filter(
|
|
1249
|
+
(el) =>
|
|
1250
|
+
!candidates.some((other) => other !== el && el.contains(other)),
|
|
1251
|
+
);
|
|
1252
|
+
if (blocks.length !== 1) {
|
|
1253
|
+
throw new Error(
|
|
1254
|
+
`expected one authoring fragment block in slide object ${logicalObjectId} for marker ${JSON.stringify(text)}, found ${blocks.length}`,
|
|
1255
|
+
);
|
|
1256
|
+
}
|
|
1257
|
+
const block = blocks[0]!;
|
|
1258
|
+
authoringFragmentBlocks.add(block);
|
|
1259
|
+
if (block.parentElement?.matches("ul,ol")) {
|
|
1260
|
+
authoringFragmentBlocks.add(block.parentElement);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
const isStyledBulletRow = (el: Element) => {
|
|
1265
|
+
if (!/^(DIV|LI|P)$/.test(el.tagName)) return false;
|
|
1266
|
+
const marker = el.firstElementChild;
|
|
1267
|
+
if (!marker || marker.tagName !== "SPAN") return false;
|
|
1268
|
+
const text = norm(marker.textContent);
|
|
1269
|
+
if (/^[-*•●◦▪‣·⁃–—]+$/u.test(text)) return true;
|
|
1270
|
+
const style = getComputedStyle(marker);
|
|
1271
|
+
const width = Number.parseFloat(style.width);
|
|
1272
|
+
const height = Number.parseFloat(style.height);
|
|
1273
|
+
const background = style.backgroundColor;
|
|
1274
|
+
const alpha = background.match(/[,/]\s*([\d.]+)%?\s*\)$/)?.[1];
|
|
1275
|
+
const hasVisibleBackground =
|
|
1276
|
+
background !== "transparent" &&
|
|
1277
|
+
(alpha === undefined || Number(alpha) !== 0);
|
|
1278
|
+
return (
|
|
1279
|
+
!text &&
|
|
1280
|
+
width > 0 &&
|
|
1281
|
+
width <= 48 &&
|
|
1282
|
+
height > 0 &&
|
|
1283
|
+
height <= 48 &&
|
|
1284
|
+
(Number.parseFloat(style.borderTopWidth) > 0 ||
|
|
1285
|
+
Number.parseFloat(style.borderLeftWidth) > 0 ||
|
|
1286
|
+
hasVisibleBackground ||
|
|
1287
|
+
Number.parseFloat(style.borderRadius) > 0)
|
|
1288
|
+
);
|
|
1289
|
+
};
|
|
1290
|
+
let visualEditBlock = targetBlock;
|
|
1291
|
+
let protectedMarker: Element | null = null;
|
|
1292
|
+
for (
|
|
1293
|
+
let ancestor = targetBlock;
|
|
1294
|
+
ancestor && ancestor !== root;
|
|
1295
|
+
ancestor = ancestor.parentElement
|
|
1296
|
+
) {
|
|
1297
|
+
if (isStyledBulletRow(ancestor)) {
|
|
1298
|
+
visualEditBlock = ancestor;
|
|
1299
|
+
if (edited.preserveStyledBulletMarker) {
|
|
1300
|
+
protectedMarker = ancestor.firstElementChild;
|
|
1301
|
+
}
|
|
1302
|
+
break;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
const isInNormalFlow = (el: Element | null) => {
|
|
1306
|
+
if (!el) return false;
|
|
1307
|
+
for (
|
|
1308
|
+
let ancestor: Element | null = el;
|
|
1309
|
+
ancestor && ancestor !== root;
|
|
1310
|
+
ancestor = ancestor.parentElement
|
|
1311
|
+
) {
|
|
1312
|
+
const style = getComputedStyle(ancestor);
|
|
1313
|
+
if (
|
|
1314
|
+
style.position === "absolute" ||
|
|
1315
|
+
style.position === "fixed" ||
|
|
1316
|
+
style.position === "sticky" ||
|
|
1317
|
+
style.cssFloat !== "none" ||
|
|
1318
|
+
style.transform !== "none" ||
|
|
1319
|
+
(style.position === "relative" &&
|
|
1320
|
+
[style.top, style.right, style.bottom, style.left].some(
|
|
1321
|
+
(offset) => offset !== "auto" && Number.parseFloat(offset) !== 0,
|
|
1322
|
+
))
|
|
1323
|
+
) {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
return true;
|
|
1328
|
+
};
|
|
1329
|
+
const followsEditedFlow = (el: Element) => {
|
|
1330
|
+
if (
|
|
1331
|
+
!editedBox ||
|
|
1332
|
+
editedBox === el ||
|
|
1333
|
+
editedBox.contains(el) ||
|
|
1334
|
+
el.contains(editedBox)
|
|
1335
|
+
) {
|
|
1336
|
+
return false;
|
|
1337
|
+
}
|
|
1338
|
+
let editedBranch: Element = editedBox;
|
|
1339
|
+
while (
|
|
1340
|
+
editedBranch.parentElement &&
|
|
1341
|
+
!editedBranch.parentElement.contains(el)
|
|
1342
|
+
) {
|
|
1343
|
+
editedBranch = editedBranch.parentElement;
|
|
1344
|
+
}
|
|
1345
|
+
let followingBranch: Element = el;
|
|
1346
|
+
while (
|
|
1347
|
+
followingBranch.parentElement &&
|
|
1348
|
+
!followingBranch.parentElement.contains(editedBranch)
|
|
1349
|
+
) {
|
|
1350
|
+
followingBranch = followingBranch.parentElement;
|
|
1351
|
+
}
|
|
1352
|
+
const parent = editedBranch.parentElement;
|
|
1353
|
+
if (!parent || followingBranch.parentElement !== parent) return false;
|
|
1354
|
+
const parentStyle = getComputedStyle(parent);
|
|
1355
|
+
const flexDirection = parentStyle.flexDirection;
|
|
1356
|
+
const isRow = flexDirection.startsWith("row");
|
|
1357
|
+
const isColumn = flexDirection.startsWith("column");
|
|
1358
|
+
const itemStyle = getComputedStyle(followingBranch);
|
|
1359
|
+
const align =
|
|
1360
|
+
itemStyle.alignSelf === "auto"
|
|
1361
|
+
? parentStyle.alignItems
|
|
1362
|
+
: itemStyle.alignSelf;
|
|
1363
|
+
if (
|
|
1364
|
+
parentStyle.display.includes("flex") &&
|
|
1365
|
+
parentStyle.flexWrap === "nowrap" &&
|
|
1366
|
+
(isRow || isColumn) &&
|
|
1367
|
+
align === "center"
|
|
1368
|
+
) {
|
|
1369
|
+
const axis: "x" | "y" = isRow ? "y" : "x";
|
|
1370
|
+
const parentRect = parent.getBoundingClientRect();
|
|
1371
|
+
const itemRect = followingBranch.getBoundingClientRect();
|
|
1372
|
+
const editedRect = editedBranch.getBoundingClientRect();
|
|
1373
|
+
const editedItemStyle = getComputedStyle(editedBranch);
|
|
1374
|
+
const isFlexItem = (style: CSSStyleDeclaration) =>
|
|
1375
|
+
style.position !== "absolute" &&
|
|
1376
|
+
style.position !== "fixed" &&
|
|
1377
|
+
style.position !== "sticky" &&
|
|
1378
|
+
style.cssFloat === "none";
|
|
1379
|
+
if (!isFlexItem(editedItemStyle) || !isFlexItem(itemStyle)) {
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
const size = axis === "x" ? "width" : "height";
|
|
1383
|
+
const path: number[] = [];
|
|
1384
|
+
for (
|
|
1385
|
+
let node: Element | null = parent;
|
|
1386
|
+
node && node !== root && node.parentElement;
|
|
1387
|
+
node = node.parentElement
|
|
1388
|
+
) {
|
|
1389
|
+
path.unshift(
|
|
1390
|
+
Array.prototype.indexOf.call(node.parentElement!.children, node),
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1393
|
+
return {
|
|
1394
|
+
flexCrossAlignment: {
|
|
1395
|
+
context: path.join(".") || "root",
|
|
1396
|
+
axis,
|
|
1397
|
+
containerPosition: parentRect[axis] - origin[axis],
|
|
1398
|
+
containerSize: parentRect[size],
|
|
1399
|
+
itemSize: itemRect[size],
|
|
1400
|
+
editedItemSize: editedRect[size],
|
|
1401
|
+
},
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
if (!isInNormalFlow(editedBox) || !isInNormalFlow(el)) return false;
|
|
1405
|
+
const editedOrder = Number.parseInt(
|
|
1406
|
+
getComputedStyle(editedBranch).order,
|
|
1407
|
+
10,
|
|
1408
|
+
);
|
|
1409
|
+
const followingOrder = Number.parseInt(
|
|
1410
|
+
getComputedStyle(followingBranch).order,
|
|
1411
|
+
10,
|
|
1412
|
+
);
|
|
1413
|
+
if (
|
|
1414
|
+
parentStyle.display.includes("flex") &&
|
|
1415
|
+
Number.isFinite(editedOrder) &&
|
|
1416
|
+
Number.isFinite(followingOrder) &&
|
|
1417
|
+
followingOrder < editedOrder
|
|
1418
|
+
) {
|
|
1419
|
+
return false;
|
|
1420
|
+
}
|
|
1421
|
+
if (
|
|
1422
|
+
editedBranch.compareDocumentPosition(followingBranch) &
|
|
1423
|
+
Node.DOCUMENT_POSITION_FOLLOWING
|
|
1424
|
+
) {
|
|
1425
|
+
return {};
|
|
1426
|
+
}
|
|
1427
|
+
return false;
|
|
1428
|
+
};
|
|
1429
|
+
const insideEdited = (el: Element) =>
|
|
1430
|
+
(!!host && host.contains(el)) ||
|
|
1431
|
+
(!!visualEditBlock &&
|
|
1432
|
+
(visualEditBlock === el || visualEditBlock.contains(el))) ||
|
|
1433
|
+
Array.from(authoringFragmentBlocks).some(
|
|
1434
|
+
(block) => block === el || block.contains(el),
|
|
1435
|
+
);
|
|
1436
|
+
|
|
1437
|
+
const records: SnapRecord[] = [];
|
|
1438
|
+
const seen = new Map<string, number>();
|
|
1439
|
+
const layoutPathOf = (el: Element) => {
|
|
1440
|
+
const path: string[] = [];
|
|
1441
|
+
const editedObject = editedBox?.closest("[data-slide-object-id]");
|
|
1442
|
+
for (
|
|
1443
|
+
let node: Element | null = el;
|
|
1444
|
+
node && node !== root;
|
|
1445
|
+
node = node.parentElement
|
|
1446
|
+
) {
|
|
1447
|
+
const style = getComputedStyle(node);
|
|
1448
|
+
const rect = node.getBoundingClientRect();
|
|
1449
|
+
const object = node.closest("[data-slide-object-id]");
|
|
1450
|
+
const paragraph = node.closest("[data-pptx-paragraph]");
|
|
1451
|
+
path.push(
|
|
1452
|
+
`${node.tagName.toLowerCase()}[sameObject=${Boolean(object && object === editedObject)};object=${object?.getAttribute("data-slide-object-id") ?? ""};paragraph=${paragraph?.getAttribute("data-pptx-paragraph") ?? ""};block=${node.hasAttribute("data-slide-text-block")};editing=${node.hasAttribute("data-editing-block")};${style.display};${style.position};${style.top},${style.right},${style.bottom},${style.left};${style.transform};${style.alignSelf};${style.alignItems};${style.alignContent};${style.flexDirection};${style.justifyContent};${style.gridTemplateRows};${style.gridTemplateColumns};${style.gridRowStart},${style.gridRowEnd};${rect.x},${rect.y},${rect.width},${rect.height}]`,
|
|
1453
|
+
);
|
|
1454
|
+
}
|
|
1455
|
+
return path;
|
|
1456
|
+
};
|
|
1457
|
+
const push = (
|
|
1458
|
+
base: string,
|
|
1459
|
+
kind: SnapRecord["kind"],
|
|
1460
|
+
inside: boolean,
|
|
1461
|
+
props: Record<string, string>,
|
|
1462
|
+
rect: Rect,
|
|
1463
|
+
flow: ReturnType<typeof followsEditedFlow> = false,
|
|
1464
|
+
textElement?: Pick<SnapRecord, "tag" | "inlineStyle">,
|
|
1465
|
+
layoutPath?: string[],
|
|
1466
|
+
element?: Element,
|
|
1467
|
+
) => {
|
|
1468
|
+
const n = seen.get(base) ?? 0;
|
|
1469
|
+
seen.set(base, n + 1);
|
|
1470
|
+
const recordKind = base.endsWith("::before")
|
|
1471
|
+
? "before"
|
|
1472
|
+
: base.endsWith("::after")
|
|
1473
|
+
? "after"
|
|
1474
|
+
: kind;
|
|
1475
|
+
const recordObject = element?.closest("[data-slide-object-id]");
|
|
1476
|
+
const recordParagraph = element?.closest("[data-pptx-paragraph]");
|
|
1477
|
+
const objectId =
|
|
1478
|
+
recordObject?.getAttribute("data-slide-object-id") ?? null;
|
|
1479
|
+
const paragraphId =
|
|
1480
|
+
recordParagraph?.getAttribute("data-pptx-paragraph") ?? null;
|
|
1481
|
+
const path: string[] = [];
|
|
1482
|
+
for (
|
|
1483
|
+
let node: Element | null | undefined = element;
|
|
1484
|
+
node && recordParagraph && node !== recordParagraph;
|
|
1485
|
+
node = node.parentElement
|
|
1486
|
+
) {
|
|
1487
|
+
const parent = node.parentElement;
|
|
1488
|
+
path.unshift(
|
|
1489
|
+
`${node.tagName.toLowerCase()}:${parent ? Array.from(parent.children).indexOf(node) : 0}`,
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
const logicalRecordObjectId =
|
|
1493
|
+
objectId && targetObjectIds.has(objectId) ? logicalObjectId : objectId;
|
|
1494
|
+
const protectedElement = Boolean(
|
|
1495
|
+
element &&
|
|
1496
|
+
protectedMarker &&
|
|
1497
|
+
(protectedMarker === element || protectedMarker.contains(element)),
|
|
1498
|
+
);
|
|
1499
|
+
const markerParent = element?.parentElement;
|
|
1500
|
+
const styledBulletMarker = Boolean(
|
|
1501
|
+
element &&
|
|
1502
|
+
markerParent &&
|
|
1503
|
+
markerParent.firstElementChild === element &&
|
|
1504
|
+
isStyledBulletRow(markerParent),
|
|
1505
|
+
);
|
|
1506
|
+
const visualBlockRect =
|
|
1507
|
+
protectedElement && visualEditBlock
|
|
1508
|
+
? rectOf(visualEditBlock.getBoundingClientRect(), origin)
|
|
1509
|
+
: null;
|
|
1510
|
+
records.push({
|
|
1511
|
+
key: `${base}#${n}`,
|
|
1512
|
+
...(element
|
|
1513
|
+
? {
|
|
1514
|
+
stableKey: `${snapEpoch}:${snapId(element)}:${recordKind}`,
|
|
1515
|
+
slideObjectId: logicalRecordObjectId,
|
|
1516
|
+
pptxParagraph: paragraphId,
|
|
1517
|
+
...(logicalRecordObjectId && paragraphId
|
|
1518
|
+
? {
|
|
1519
|
+
pptxRecordKey: `${logicalRecordObjectId}:${paragraphId}:${path.join("/")}:${recordKind}`,
|
|
1520
|
+
}
|
|
1521
|
+
: {}),
|
|
1522
|
+
}
|
|
1523
|
+
: {}),
|
|
1524
|
+
kind,
|
|
1525
|
+
inside,
|
|
1526
|
+
...(protectedElement
|
|
1527
|
+
? {
|
|
1528
|
+
protectedStyle: true,
|
|
1529
|
+
protectedStructure: true,
|
|
1530
|
+
...(visualBlockRect
|
|
1531
|
+
? {
|
|
1532
|
+
protectedRect: {
|
|
1533
|
+
x: rect.x - visualBlockRect.x,
|
|
1534
|
+
y: rect.y - visualBlockRect.y,
|
|
1535
|
+
width: rect.width,
|
|
1536
|
+
height: rect.height,
|
|
1537
|
+
},
|
|
1538
|
+
}
|
|
1539
|
+
: {}),
|
|
1540
|
+
}
|
|
1541
|
+
: {}),
|
|
1542
|
+
...(styledBulletMarker
|
|
1543
|
+
? {
|
|
1544
|
+
styledBulletMarker: true,
|
|
1545
|
+
styledBulletMarkerText: norm(element?.textContent),
|
|
1546
|
+
}
|
|
1547
|
+
: {}),
|
|
1548
|
+
downstreamFlow: !!flow,
|
|
1549
|
+
...(flow && flow.flexCrossAlignment
|
|
1550
|
+
? { flexCrossAlignment: flow.flexCrossAlignment }
|
|
1551
|
+
: {}),
|
|
1552
|
+
...(layoutPath ? { layoutPath } : {}),
|
|
1553
|
+
...(element
|
|
1554
|
+
? {
|
|
1555
|
+
className: element.getAttribute("class") ?? "",
|
|
1556
|
+
inlineStyle: element.getAttribute("style") ?? "",
|
|
1557
|
+
}
|
|
1558
|
+
: {}),
|
|
1559
|
+
props,
|
|
1560
|
+
rect,
|
|
1561
|
+
...textElement,
|
|
1562
|
+
});
|
|
1563
|
+
};
|
|
1564
|
+
const boxKey = (el: Element) => {
|
|
1565
|
+
const cls = (el.getAttribute("class") ?? "")
|
|
1566
|
+
.split(/\s+/)
|
|
1567
|
+
.filter(Boolean)
|
|
1568
|
+
.sort()
|
|
1569
|
+
.join(".");
|
|
1570
|
+
return `box:${el.tagName.toLowerCase()}${cls ? `.${cls}` : ""}`;
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
const visit = (el: Element) => {
|
|
1574
|
+
if (outsideOnly && insideEdited(el)) return;
|
|
1575
|
+
if (el.tagName === "STYLE" || el.tagName === "SCRIPT") return;
|
|
1576
|
+
if (isChrome(el)) return;
|
|
1577
|
+
// The hidden source of a floating editor is represented by the
|
|
1578
|
+
// editor's own copy; counting both would double every edited run.
|
|
1579
|
+
if (host && editingBlock && el === editingBlock) return;
|
|
1580
|
+
const cs = getComputedStyle(el);
|
|
1581
|
+
const inside = insideEdited(el);
|
|
1582
|
+
const flow = followsEditedFlow(el);
|
|
1583
|
+
const text = norm(directText(el));
|
|
1584
|
+
if (text) {
|
|
1585
|
+
const range = document.createRange();
|
|
1586
|
+
range.selectNodeContents(el);
|
|
1587
|
+
const textRect = rectOf(range.getBoundingClientRect(), origin);
|
|
1588
|
+
push(
|
|
1589
|
+
`text:${text.slice(0, 80)}`,
|
|
1590
|
+
"text",
|
|
1591
|
+
inside,
|
|
1592
|
+
{
|
|
1593
|
+
...pick(cs, TEXT_PROPS),
|
|
1594
|
+
...(outsideOnly ? computedStyleProps(cs, customProperties) : {}),
|
|
1595
|
+
visible: String(visible(el)),
|
|
1596
|
+
},
|
|
1597
|
+
textRect,
|
|
1598
|
+
flow,
|
|
1599
|
+
{
|
|
1600
|
+
tag: el.tagName.toLowerCase(),
|
|
1601
|
+
inlineStyle: el.getAttribute("style") ?? "",
|
|
1602
|
+
},
|
|
1603
|
+
layoutPathOf(el),
|
|
1604
|
+
el,
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
if (
|
|
1608
|
+
paints(el, cs) ||
|
|
1609
|
+
cs.transform !== "none" ||
|
|
1610
|
+
el.hasAttribute("data-fmd-autofit-content")
|
|
1611
|
+
) {
|
|
1612
|
+
push(
|
|
1613
|
+
boxKey(el),
|
|
1614
|
+
"box",
|
|
1615
|
+
inside,
|
|
1616
|
+
{
|
|
1617
|
+
...boxProps(el, cs),
|
|
1618
|
+
...(outsideOnly ? computedStyleProps(cs, customProperties) : {}),
|
|
1619
|
+
},
|
|
1620
|
+
rectOf(el.getBoundingClientRect(), origin),
|
|
1621
|
+
flow,
|
|
1622
|
+
undefined,
|
|
1623
|
+
layoutPathOf(el),
|
|
1624
|
+
el,
|
|
1625
|
+
);
|
|
1626
|
+
}
|
|
1627
|
+
for (const pseudo of ["::before", "::after"]) {
|
|
1628
|
+
const ps = getComputedStyle(el, pseudo);
|
|
1629
|
+
if (ps.content === "none" || ps.content === "normal") continue;
|
|
1630
|
+
if (!paints(el, ps) && norm(ps.content.replace(/^"|"$/g, "")) === "")
|
|
1631
|
+
continue;
|
|
1632
|
+
push(
|
|
1633
|
+
`${boxKey(el)}${pseudo}`,
|
|
1634
|
+
"box",
|
|
1635
|
+
inside,
|
|
1636
|
+
{
|
|
1637
|
+
...pick(ps, BOX_PROPS),
|
|
1638
|
+
...(outsideOnly ? computedStyleProps(ps, customProperties) : {}),
|
|
1639
|
+
content: ps.content,
|
|
1640
|
+
},
|
|
1641
|
+
{ x: 0, y: 0, width: 0, height: 0 },
|
|
1642
|
+
false,
|
|
1643
|
+
undefined,
|
|
1644
|
+
layoutPathOf(el),
|
|
1645
|
+
el,
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1648
|
+
if (el.tagName.toUpperCase() === "SVG") return;
|
|
1649
|
+
for (const child of Array.from(el.children)) visit(child);
|
|
1650
|
+
};
|
|
1651
|
+
visit(root);
|
|
1652
|
+
if (host) visit(host);
|
|
1653
|
+
|
|
1654
|
+
const editedRect = editedBox
|
|
1655
|
+
? rectOf(paintedRect(editedBox), origin)
|
|
1656
|
+
: null;
|
|
1657
|
+
const editedBoxRect = editedBox
|
|
1658
|
+
? rectOf(editedBox.getBoundingClientRect(), origin)
|
|
1659
|
+
: null;
|
|
1660
|
+
const editedParagraph = stableEditedTarget?.closest<HTMLElement>(
|
|
1661
|
+
"[data-pptx-paragraph]",
|
|
1662
|
+
);
|
|
1663
|
+
const editedTargetRect = stableEditedTarget
|
|
1664
|
+
? rectOf(stableEditedTarget.getBoundingClientRect(), origin)
|
|
1665
|
+
: null;
|
|
1666
|
+
const editedFlowAnchor =
|
|
1667
|
+
targetParagraph ?? editedParagraph ?? stableEditedTarget;
|
|
1668
|
+
const editedFlowAnchorRect = editedFlowAnchor
|
|
1669
|
+
? rectOf(editedFlowAnchor.getBoundingClientRect(), origin)
|
|
1670
|
+
: null;
|
|
1671
|
+
const editedAuthoringFragmentRects = Array.from(authoringFragmentBlocks)
|
|
1672
|
+
.filter((block) => !block.matches("ul,ol"))
|
|
1673
|
+
.map((block) => rectOf(block.getBoundingClientRect(), origin));
|
|
1674
|
+
const editedInFlow = isInNormalFlow(editedBox);
|
|
1675
|
+
if (outsideOnly) {
|
|
1676
|
+
return {
|
|
1677
|
+
records,
|
|
1678
|
+
editedRect,
|
|
1679
|
+
editedInFlow,
|
|
1680
|
+
editedObjectId: logicalObjectId,
|
|
1681
|
+
editedParagraphId:
|
|
1682
|
+
edited.targetPptxParagraph ??
|
|
1683
|
+
editedParagraph?.getAttribute("data-pptx-paragraph") ??
|
|
1684
|
+
null,
|
|
1685
|
+
editedObjectRect: editedObject
|
|
1686
|
+
? rectOf(editedObject.getBoundingClientRect(), origin)
|
|
1687
|
+
: null,
|
|
1688
|
+
editedTargetRect,
|
|
1689
|
+
editedFlowAnchorRect,
|
|
1690
|
+
editedAuthoringFragmentRects,
|
|
1691
|
+
editedObjectPosition: editedObject
|
|
1692
|
+
? getComputedStyle(editedObject).position
|
|
1693
|
+
: null,
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
const all = Array.from(root.querySelectorAll("*")).filter(
|
|
1698
|
+
(el) => el.tagName !== "STYLE" && !isChrome(el),
|
|
1699
|
+
);
|
|
1700
|
+
const meaningful = all.filter(
|
|
1701
|
+
(el) =>
|
|
1702
|
+
norm(directText(el)) !== "" ||
|
|
1703
|
+
paints(el, getComputedStyle(el)) ||
|
|
1704
|
+
PAINTED_TAGS.has(el.tagName.toUpperCase()),
|
|
1705
|
+
);
|
|
1706
|
+
const inventory: Inventory = {
|
|
1707
|
+
elements: all.length,
|
|
1708
|
+
visible: meaningful.filter(visible).length,
|
|
1709
|
+
hidden: meaningful.filter((el) => !visible(el)).length,
|
|
1710
|
+
svg: root.querySelectorAll("svg").length,
|
|
1711
|
+
img: root.querySelectorAll("img").length,
|
|
1712
|
+
style: root.querySelectorAll("style").length,
|
|
1713
|
+
};
|
|
1714
|
+
return {
|
|
1715
|
+
records,
|
|
1716
|
+
inventory,
|
|
1717
|
+
text: norm((root as HTMLElement).innerText),
|
|
1718
|
+
editedRect,
|
|
1719
|
+
editedBoxRect,
|
|
1720
|
+
editedObjectId: logicalObjectId,
|
|
1721
|
+
editedParagraphId:
|
|
1722
|
+
edited.targetPptxParagraph ??
|
|
1723
|
+
editedParagraph?.getAttribute("data-pptx-paragraph") ??
|
|
1724
|
+
null,
|
|
1725
|
+
editedObjectRect: editedObject
|
|
1726
|
+
? rectOf(editedObject.getBoundingClientRect(), origin)
|
|
1727
|
+
: null,
|
|
1728
|
+
editedTargetRect,
|
|
1729
|
+
editedFlowAnchorRect,
|
|
1730
|
+
editedAuthoringFragmentRects,
|
|
1731
|
+
editedObjectPosition: editedObject
|
|
1732
|
+
? getComputedStyle(editedObject).position
|
|
1733
|
+
: null,
|
|
1734
|
+
editedInFlow,
|
|
1735
|
+
editedText: editedEl ? lines(editedEl) : null,
|
|
1736
|
+
editedLayoutPath: editedBox ? layoutPathOf(editedBox) : undefined,
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
function snapshot(
|
|
1741
|
+
canvasSel: string,
|
|
1742
|
+
edited: {
|
|
1743
|
+
targetIndex?: number;
|
|
1744
|
+
text?: string;
|
|
1745
|
+
marker?: string;
|
|
1746
|
+
targetBuilderId?: string;
|
|
1747
|
+
targetSlideObjectId?: string;
|
|
1748
|
+
targetPptxParagraph?: string;
|
|
1749
|
+
targetTextIncludes?: string;
|
|
1750
|
+
authoringFragmentTexts?: string[];
|
|
1751
|
+
preserveStyledBulletMarker?: boolean;
|
|
1752
|
+
},
|
|
1753
|
+
): Snapshot {
|
|
1754
|
+
return captureSnapshot(canvasSel, edited) as Snapshot;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
function outsideSnapshot(canvasSel: string): OutsideSnapshot {
|
|
1758
|
+
return captureSnapshot(canvasSel, {}, true) as OutsideSnapshot;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
function backgroundPoint(canvasSel: string) {
|
|
1762
|
+
const canvas = document.querySelector(canvasSel);
|
|
1763
|
+
const track = document.querySelector(
|
|
1764
|
+
'[data-main-slide-canvas="true"]',
|
|
1765
|
+
)?.parentElement;
|
|
1766
|
+
if (!canvas || !track) return null;
|
|
1767
|
+
const c = canvas.getBoundingClientRect();
|
|
1768
|
+
const t = track.getBoundingClientRect();
|
|
1769
|
+
const candidates = [
|
|
1770
|
+
{ x: c.left - 12, y: c.top + c.height / 2 },
|
|
1771
|
+
{ x: c.right + 12, y: c.top + c.height / 2 },
|
|
1772
|
+
{ x: c.left + c.width / 2, y: c.bottom + 12 },
|
|
1773
|
+
{ x: c.left + c.width / 2, y: c.top - 12 },
|
|
1774
|
+
];
|
|
1775
|
+
for (const p of candidates) {
|
|
1776
|
+
if (p.x <= t.left || p.x >= t.right || p.y <= t.top || p.y >= t.bottom)
|
|
1777
|
+
continue;
|
|
1778
|
+
const hit = document.elementFromPoint(p.x, p.y);
|
|
1779
|
+
if (hit && track.contains(hit) && !canvas.contains(hit)) return p;
|
|
1780
|
+
}
|
|
1781
|
+
return null;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
function canonicalNode(node: Node, depth: number, out: string[]) {
|
|
1785
|
+
const pad = " ".repeat(depth);
|
|
1786
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
1787
|
+
const raw = node.nodeValue ?? "";
|
|
1788
|
+
const text = raw.replace(/[\s\u200b\ufeff]+/g, " ");
|
|
1789
|
+
if (text.trim() === "") {
|
|
1790
|
+
const inline = (n: Node | null) =>
|
|
1791
|
+
!!n &&
|
|
1792
|
+
(n.nodeType === Node.TEXT_NODE ||
|
|
1793
|
+
(n.nodeType === Node.ELEMENT_NODE &&
|
|
1794
|
+
INLINE_TAGS.has((n as Element).tagName.toLowerCase())));
|
|
1795
|
+
if (!(inline(node.previousSibling) && inline(node.nextSibling))) return;
|
|
1796
|
+
}
|
|
1797
|
+
out.push(`${pad}"${text}"`);
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return;
|
|
1801
|
+
const el = node as Element;
|
|
1802
|
+
if (el.hasAttribute("data-fmd-autofit-content")) {
|
|
1803
|
+
for (const child of Array.from(el.childNodes)) {
|
|
1804
|
+
canonicalNode(child, depth, out);
|
|
1805
|
+
}
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
const tag = el.tagName.toLowerCase();
|
|
1809
|
+
const attrs = Array.from(el.attributes)
|
|
1810
|
+
.filter((attribute) => !TRANSIENT_ATTRS.has(attribute.name))
|
|
1811
|
+
.map((a) => {
|
|
1812
|
+
if (a.name === "style") {
|
|
1813
|
+
const scratch = document.createElement("div").style;
|
|
1814
|
+
scratch.cssText = a.value;
|
|
1815
|
+
const decls: string[] = [];
|
|
1816
|
+
for (let i = 0; i < scratch.length; i++) {
|
|
1817
|
+
const name = scratch[i];
|
|
1818
|
+
const prio = scratch.getPropertyPriority(name);
|
|
1819
|
+
decls.push(
|
|
1820
|
+
`${name}:${scratch.getPropertyValue(name).trim()}${prio ? ` !${prio}` : ""}`,
|
|
1821
|
+
);
|
|
1822
|
+
}
|
|
1823
|
+
return `style="${decls.sort().join("; ")}"`;
|
|
1824
|
+
}
|
|
1825
|
+
if (a.name === "class") {
|
|
1826
|
+
return `class="${a.value.split(/\s+/).filter(Boolean).sort().join(" ")}"`;
|
|
1827
|
+
}
|
|
1828
|
+
return `${a.name}="${a.value}"`;
|
|
1829
|
+
})
|
|
1830
|
+
.sort();
|
|
1831
|
+
out.push(`${pad}<${tag}${attrs.length ? ` ${attrs.join(" ")}` : ""}>`);
|
|
1832
|
+
if (tag === "style") {
|
|
1833
|
+
out.push(`${pad} ${norm(el.textContent)}`);
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1836
|
+
const kids =
|
|
1837
|
+
tag === "template"
|
|
1838
|
+
? Array.from((el as HTMLTemplateElement).content.childNodes)
|
|
1839
|
+
: Array.from(el.childNodes);
|
|
1840
|
+
for (const child of kids) canonicalNode(child, depth + 1, out);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
function parse(html: string): DocumentFragment {
|
|
1844
|
+
const tpl = document.createElement("template");
|
|
1845
|
+
tpl.innerHTML = html;
|
|
1846
|
+
return tpl.content;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
function canonicalFragment(frag: ParentNode): string[] {
|
|
1850
|
+
const out: string[] = [];
|
|
1851
|
+
for (const child of Array.from(frag.childNodes))
|
|
1852
|
+
canonicalNode(child, 0, out);
|
|
1853
|
+
return out;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
function canonical(html: string): string[] {
|
|
1857
|
+
return canonicalFragment(parse(html));
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
function pathOf(el: Element, root: ParentNode): number[] {
|
|
1861
|
+
const path: number[] = [];
|
|
1862
|
+
let cur: Element | null = el;
|
|
1863
|
+
while (cur && cur.parentNode && cur !== root) {
|
|
1864
|
+
path.unshift(Array.from(cur.parentNode.children).indexOf(cur));
|
|
1865
|
+
if (cur.parentNode === root) break;
|
|
1866
|
+
cur = cur.parentElement;
|
|
1867
|
+
}
|
|
1868
|
+
return path;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
function atPath(root: ParentNode, path: number[]): Element | null {
|
|
1872
|
+
let cur: ParentNode | null = root;
|
|
1873
|
+
for (const i of path) {
|
|
1874
|
+
cur = (cur?.children[i] as Element | undefined) ?? null;
|
|
1875
|
+
if (!cur) return null;
|
|
1876
|
+
}
|
|
1877
|
+
return cur as Element | null;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
function canonicalOutside(
|
|
1881
|
+
stored: string,
|
|
1882
|
+
saved: string,
|
|
1883
|
+
target: { tag: string; text: string; occurrence: number },
|
|
1884
|
+
): CanonicalPair {
|
|
1885
|
+
const a = parse(stored);
|
|
1886
|
+
const b = parse(saved);
|
|
1887
|
+
const want = strip(target.text);
|
|
1888
|
+
const matches = Array.from(a.querySelectorAll(target.tag)).filter(
|
|
1889
|
+
(el) => strip(el.textContent) === want,
|
|
1890
|
+
);
|
|
1891
|
+
const el = matches[target.occurrence] ?? matches[0];
|
|
1892
|
+
if (!el)
|
|
1893
|
+
return {
|
|
1894
|
+
stored: canonical(stored),
|
|
1895
|
+
saved: canonical(saved),
|
|
1896
|
+
found: false,
|
|
1897
|
+
};
|
|
1898
|
+
const path = pathOf(el, a);
|
|
1899
|
+
const other = atPath(b, path);
|
|
1900
|
+
// Enter in a list item adds sibling items right after the edited one;
|
|
1901
|
+
// they belong to the edit, not to "everything else".
|
|
1902
|
+
const extra =
|
|
1903
|
+
other && other.parentNode && el.parentNode
|
|
1904
|
+
? Math.max(
|
|
1905
|
+
0,
|
|
1906
|
+
other.parentNode.children.length - el.parentNode.children.length,
|
|
1907
|
+
)
|
|
1908
|
+
: 0;
|
|
1909
|
+
const placeholder = () => document.createElement("edited-element");
|
|
1910
|
+
el.replaceWith(placeholder());
|
|
1911
|
+
if (other) {
|
|
1912
|
+
for (let i = 0; i < extra; i++) other.nextElementSibling?.remove();
|
|
1913
|
+
other.replaceWith(placeholder());
|
|
1914
|
+
}
|
|
1915
|
+
return {
|
|
1916
|
+
stored: canonicalFragment(a),
|
|
1917
|
+
saved: canonicalFragment(b),
|
|
1918
|
+
found: !!other,
|
|
1919
|
+
};
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
const writeStacks: string[] = [];
|
|
1923
|
+
const KEEPALIVE_WRITES = "edit-fidelity:keepalive-writes";
|
|
1924
|
+
const nativeFetch = window.fetch;
|
|
1925
|
+
window.fetch = function (input: RequestInfo | URL, init?: RequestInit) {
|
|
1926
|
+
const url =
|
|
1927
|
+
input instanceof Request ? input.url : new URL(input, location.href).href;
|
|
1928
|
+
const method = (
|
|
1929
|
+
init?.method ?? (input instanceof Request ? input.method : "GET")
|
|
1930
|
+
).toUpperCase();
|
|
1931
|
+
const action =
|
|
1932
|
+
method === "POST" || method === "PUT"
|
|
1933
|
+
? /\/_agent-native\/actions\/(patch-deck|save-deck|update-slide)\b/.exec(
|
|
1934
|
+
url,
|
|
1935
|
+
)?.[1]
|
|
1936
|
+
: undefined;
|
|
1937
|
+
if (action) {
|
|
1938
|
+
writeStacks.push(new Error().stack ?? "");
|
|
1939
|
+
// Slides sends these on pagehide, and Playwright's request events never
|
|
1940
|
+
// report them; the bodies survive the reload in sessionStorage.
|
|
1941
|
+
if (init?.keepalive || (input instanceof Request && input.keepalive)) {
|
|
1942
|
+
const sent: KeepaliveWrite[] = JSON.parse(
|
|
1943
|
+
sessionStorage.getItem(KEEPALIVE_WRITES) ?? "[]",
|
|
1944
|
+
);
|
|
1945
|
+
sent.push({
|
|
1946
|
+
action,
|
|
1947
|
+
body: typeof init?.body === "string" ? init.body : null,
|
|
1948
|
+
});
|
|
1949
|
+
sessionStorage.setItem(KEEPALIVE_WRITES, JSON.stringify(sent));
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
return nativeFetch.call(this, input, init);
|
|
1953
|
+
};
|
|
1954
|
+
const takeWriteStacks = () => writeStacks.splice(0);
|
|
1955
|
+
const takeKeepaliveWrites = (): KeepaliveWrite[] => {
|
|
1956
|
+
const sent = JSON.parse(sessionStorage.getItem(KEEPALIVE_WRITES) ?? "[]");
|
|
1957
|
+
sessionStorage.removeItem(KEEPALIVE_WRITES);
|
|
1958
|
+
return sent;
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1961
|
+
window.__editFidelity = {
|
|
1962
|
+
listTargets,
|
|
1963
|
+
targetSourceHtml,
|
|
1964
|
+
takeWriteStacks,
|
|
1965
|
+
takeKeepaliveWrites,
|
|
1966
|
+
snapshot,
|
|
1967
|
+
outsideSnapshot,
|
|
1968
|
+
editorState,
|
|
1969
|
+
entryCaretProblem,
|
|
1970
|
+
backgroundPoint,
|
|
1971
|
+
customStyleProperties: customPropertiesFor,
|
|
1972
|
+
canonical,
|
|
1973
|
+
canonicalOutside,
|
|
1974
|
+
};
|
|
1975
|
+
}
|