@agent-native/core-corpus 0.213.1 → 0.216.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/actions/references/action-fields.md +1 -1
- package/corpus/templates/analytics/CHANGELOG.md +1 -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/lib/session-replay.ts +40 -9
- 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/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 +26 -1
- package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +4 -2
- package/corpus/templates/content/CHANGELOG.md +51 -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/_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/_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 +18 -1
- package/corpus/templates/content/actions/_database-utils.ts +3 -0
- package/corpus/templates/content/actions/_database-view-setup.ts +321 -11
- 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.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/_property-utils.ts +3 -0
- package/corpus/templates/content/actions/_row-lock-order.ts +115 -0
- 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 +270 -97
- package/corpus/templates/content/actions/edit-document.ts +18 -5
- 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/import-content-source.ts +170 -54
- package/corpus/templates/content/actions/move-document.ts +191 -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/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 +20 -2
- package/corpus/templates/content/actions/update-document.ts +19 -14
- package/corpus/templates/content/actions/view-screen.ts +12 -0
- 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 +296 -87
- package/corpus/templates/content/app/components/editor/database/ListItemLayout.tsx +410 -0
- package/corpus/templates/content/app/components/editor/database/ListItemRow.tsx +426 -0
- package/corpus/templates/content/app/components/editor/database/ListView.tsx +136 -18
- package/corpus/templates/content/app/components/editor/database/navigation-state.ts +3 -0
- package/corpus/templates/content/app/components/editor/database/settings.tsx +3 -3
- package/corpus/templates/content/app/components/editor/database/view-config.ts +4 -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 +34 -0
- package/corpus/templates/content/app/hooks/use-content-trash.ts +8 -0
- package/corpus/templates/content/app/i18n-data.ts +32 -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-19-fresh-document-reads-require-confirmation-from-every-open-ed.md +6 -0
- package/corpus/templates/content/changelog/2026-10-19-list-rows-can-be-customized.md +6 -0
- package/corpus/templates/content/changelog/2026-10-19-list-views-fit-phone-screens.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-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-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/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/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 +1 -0
- package/corpus/templates/content/server/lib/content-trash-purge.ts +208 -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 +199 -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/plugins/db.ts +5 -0
- package/corpus/templates/content/server/routes/api/documents/[id]/move.patch.ts +50 -168
- package/corpus/templates/content/shared/api.ts +20 -0
- package/corpus/templates/content/shared/blocks-fields-manifest.ts +106 -0
- package/corpus/templates/content/shared/database-item-layout.ts +591 -0
- 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/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/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/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 +5 -88
- package/corpus/templates/design/AGENTS.md +1 -3
- package/corpus/templates/design/CHANGELOG.md +32 -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-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 +131 -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 +646 -167
- package/corpus/templates/design/app/components/design/bridge/native-source-provider.ts +246 -192
- 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 +425 -126
- 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 +4 -146
- 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/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/templates/TemplatePreview.tsx +60 -3
- package/corpus/templates/design/app/i18n/en-US.ts +78 -2
- 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 +2 -3
- 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/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-export-and-handoff.ts +2 -2
- 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-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-22-shader-fills-and-effects-render-correctly-on-canvas-elements.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/runtime-budget-zoom.ts +9 -21
- package/corpus/templates/design/scripts/runtime-budget.ts +10 -24
- package/corpus/templates/design/server/plugins/agent-chat.ts +0 -2
- 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/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-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,1099 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parse,
|
|
3
|
+
parseFragment,
|
|
4
|
+
serializeOuter,
|
|
5
|
+
type DefaultTreeAdapterTypes as P5,
|
|
6
|
+
} from "parse5";
|
|
7
|
+
|
|
8
|
+
import { mermaidBlockPattern } from "./mermaid-blocks";
|
|
9
|
+
import { ALLOWED_TAGS, DROP_WITH_CHILDREN } from "./sanitize-slide-html";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Save boundary for slide HTML.
|
|
13
|
+
*
|
|
14
|
+
* The editor canvas shows `render(stored)`: logo filters, `sanitizeSlideHtml`
|
|
15
|
+
* (scoped `<style>`, dropped svg, rewritten style attributes) and
|
|
16
|
+
* `prepareImportedFonts`, then autofit wrappers and editor ids. Serializing that
|
|
17
|
+
* DOM back into storage is what flattened whole slides. Instead every rendered
|
|
18
|
+
* element carries a stamp naming the stored element it came from, and a save
|
|
19
|
+
* diffs the live DOM against a fresh render and splices only the difference
|
|
20
|
+
* into the stored string. Bytes outside the changed elements are copied.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export const SOURCE_STAMP_ATTR = "data-src-i";
|
|
24
|
+
|
|
25
|
+
export interface SlideSourceRange {
|
|
26
|
+
tag: string;
|
|
27
|
+
openStart: number;
|
|
28
|
+
/** After the start tag's `>`. */
|
|
29
|
+
openEnd: number;
|
|
30
|
+
/** `null` when the end tag is implied or the element is void. */
|
|
31
|
+
closeStart: number | null;
|
|
32
|
+
closeEnd: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface StampedSlideSource {
|
|
36
|
+
html: string;
|
|
37
|
+
ranges: SlideSourceRange[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** What a canvas root was rendered from; registered by the renderer. */
|
|
41
|
+
export interface RenderedSlideSource {
|
|
42
|
+
stored: string;
|
|
43
|
+
ranges: SlideSourceRange[];
|
|
44
|
+
/** The exact HTML the renderer mounted (stamped, sanitized). */
|
|
45
|
+
base: string;
|
|
46
|
+
nonce: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export class SlideSourceMapError extends Error {
|
|
50
|
+
constructor(message: string) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "SlideSourceMapError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Live editor attributes are not user-authored source changes. */
|
|
57
|
+
const TRANSIENT_ATTRS = new Set([
|
|
58
|
+
SOURCE_STAMP_ATTR,
|
|
59
|
+
"data-builder-id",
|
|
60
|
+
"data-slide-text-block",
|
|
61
|
+
"data-video-autoplay",
|
|
62
|
+
"contenteditable",
|
|
63
|
+
"data-editing-block",
|
|
64
|
+
"spellcheck",
|
|
65
|
+
"role",
|
|
66
|
+
"aria-expanded",
|
|
67
|
+
"aria-autocomplete",
|
|
68
|
+
"aria-controls",
|
|
69
|
+
"aria-activedescendant",
|
|
70
|
+
"aria-haspopup",
|
|
71
|
+
]);
|
|
72
|
+
const SOURCE_ACCESSIBILITY_ATTRS = new Set([
|
|
73
|
+
"role",
|
|
74
|
+
"aria-expanded",
|
|
75
|
+
"aria-autocomplete",
|
|
76
|
+
"aria-controls",
|
|
77
|
+
"aria-activedescendant",
|
|
78
|
+
"aria-haspopup",
|
|
79
|
+
]);
|
|
80
|
+
/** Renderer wrappers whose children belong to the wrapper's parent. */
|
|
81
|
+
const TRANSPARENT = "[data-fmd-autofit-content]";
|
|
82
|
+
const MERMAID_INDEX_ATTR = "data-mermaid-index";
|
|
83
|
+
/** The document parse puts these around the fragment; they are not content. */
|
|
84
|
+
const DOCUMENT_TAGS = new Set(["html", "head", "body"]);
|
|
85
|
+
const VOID_TAGS = new Set([
|
|
86
|
+
"area",
|
|
87
|
+
"base",
|
|
88
|
+
"br",
|
|
89
|
+
"col",
|
|
90
|
+
"embed",
|
|
91
|
+
"hr",
|
|
92
|
+
"img",
|
|
93
|
+
"input",
|
|
94
|
+
"link",
|
|
95
|
+
"meta",
|
|
96
|
+
"param",
|
|
97
|
+
"source",
|
|
98
|
+
"track",
|
|
99
|
+
"wbr",
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
// ------------------------------------------------------------- locating ---
|
|
103
|
+
|
|
104
|
+
interface SourceElement {
|
|
105
|
+
node: P5.Element;
|
|
106
|
+
range: SlideSourceRange;
|
|
107
|
+
/** Offset to insert a stamp at, or the existing stamp attribute to replace. */
|
|
108
|
+
stamp: { at: number } | { start: number; end: number } | null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface LocatedSource {
|
|
112
|
+
elements: SourceElement[];
|
|
113
|
+
ordinalOf: Map<P5.Element, number>;
|
|
114
|
+
head: P5.ChildNode[];
|
|
115
|
+
body: P5.ChildNode[];
|
|
116
|
+
/** By placeholder index: the stored block and its element ordinal. */
|
|
117
|
+
mermaid: Array<{ source: string; ordinal: number | null }>;
|
|
118
|
+
/**
|
|
119
|
+
* Ordinals of formatting elements the parser also rebuilt elsewhere (an
|
|
120
|
+
* unclosed `<b>` reopened in each later paragraph). Every copy carries the
|
|
121
|
+
* one stamp, and only the first is the stored element.
|
|
122
|
+
*/
|
|
123
|
+
reconstructed: Set<number>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Parse as the sanitizer's DOMParser does: scripting off, so `<noscript>`
|
|
127
|
+
// content is markup, not text.
|
|
128
|
+
const PARSE_OPTIONS = { scriptingEnabled: false } as const;
|
|
129
|
+
|
|
130
|
+
const isElement = (node: P5.Node): node is P5.Element =>
|
|
131
|
+
"tagName" in node && typeof node.tagName === "string";
|
|
132
|
+
const isComment = (node: P5.Node): node is P5.CommentNode =>
|
|
133
|
+
node.nodeName === "#comment";
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Parses the stored string the way the sanitizer does (a full document parse),
|
|
137
|
+
* so the stamps land on the elements the browser builds. Ordinals are preorder
|
|
138
|
+
* over elements that have a start tag in the source; parser-implied elements
|
|
139
|
+
* (tbody, adoption-agency clones) get none.
|
|
140
|
+
*/
|
|
141
|
+
function locateSource(stored: string): LocatedSource {
|
|
142
|
+
const doc = parse(stored, { ...PARSE_OPTIONS, sourceCodeLocationInfo: true });
|
|
143
|
+
const mermaid: LocatedSource["mermaid"] = [];
|
|
144
|
+
const mermaidAt = new Map<number, number>();
|
|
145
|
+
for (const match of stored.matchAll(mermaidBlockPattern())) {
|
|
146
|
+
mermaidAt.set(match.index, mermaid.length);
|
|
147
|
+
mermaid.push({ source: match[0], ordinal: null });
|
|
148
|
+
}
|
|
149
|
+
const elements: SourceElement[] = [];
|
|
150
|
+
const ordinalOf = new Map<P5.Element, number>();
|
|
151
|
+
const ordinalAt = new Map<number, number>();
|
|
152
|
+
const reconstructed = new Set<number>();
|
|
153
|
+
const head: P5.ChildNode[] = [];
|
|
154
|
+
const body: P5.ChildNode[] = [];
|
|
155
|
+
|
|
156
|
+
const visit = (parent: P5.ParentNode) => {
|
|
157
|
+
for (const child of parent.childNodes) {
|
|
158
|
+
if (!isElement(child)) continue;
|
|
159
|
+
const loc = child.sourceCodeLocation;
|
|
160
|
+
const start = loc?.startTag;
|
|
161
|
+
if (!loc || !start || DOCUMENT_TAGS.has(child.tagName)) {
|
|
162
|
+
visit(child);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const original = ordinalAt.get(start.startOffset);
|
|
166
|
+
if (original !== undefined) {
|
|
167
|
+
// A rebuilt copy reports the original's start tag.
|
|
168
|
+
reconstructed.add(original);
|
|
169
|
+
visit(child);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const ordinal = elements.length;
|
|
173
|
+
ordinalOf.set(child, ordinal);
|
|
174
|
+
ordinalAt.set(start.startOffset, ordinal);
|
|
175
|
+
elements.push({
|
|
176
|
+
node: child,
|
|
177
|
+
range: {
|
|
178
|
+
tag: child.tagName,
|
|
179
|
+
openStart: start.startOffset,
|
|
180
|
+
openEnd: start.endOffset,
|
|
181
|
+
closeStart: loc.endTag?.startOffset ?? null,
|
|
182
|
+
closeEnd: loc.endOffset,
|
|
183
|
+
},
|
|
184
|
+
stamp: stampPosition(stored, loc),
|
|
185
|
+
});
|
|
186
|
+
const block = mermaidAt.get(start.startOffset);
|
|
187
|
+
if (block !== undefined) {
|
|
188
|
+
// The block's content is diagram source handed to mermaid verbatim;
|
|
189
|
+
// a stamp inside it would change the diagram.
|
|
190
|
+
mermaid[block].ordinal = ordinal;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (child.tagName !== "template") visit(child);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
visit(doc);
|
|
197
|
+
|
|
198
|
+
// Comments before the first tag or after `</body>` hang off the document
|
|
199
|
+
// and `<html>`; they sit before or after the body's children.
|
|
200
|
+
let afterBody = false;
|
|
201
|
+
const levels = (nodes: P5.ChildNode[]) => {
|
|
202
|
+
for (const node of nodes) {
|
|
203
|
+
if (isComment(node)) (afterBody ? body : head).push(node);
|
|
204
|
+
else if (!isElement(node)) continue;
|
|
205
|
+
else if (node.tagName === "html") levels(node.childNodes);
|
|
206
|
+
else if (node.tagName === "head") head.push(...node.childNodes);
|
|
207
|
+
else if (node.tagName === "body") {
|
|
208
|
+
body.push(...node.childNodes);
|
|
209
|
+
afterBody = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
levels(doc.childNodes);
|
|
214
|
+
return { elements, ordinalOf, head, body, mermaid, reconstructed };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
type ElementLocation = NonNullable<P5.Element["sourceCodeLocation"]>;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Where a new attribute goes in a start tag: before the self-closing `/`,
|
|
221
|
+
* unless that `/` ends an unquoted value (`src=a/`), where inserting before it
|
|
222
|
+
* would change the value. `null` for a tag with no `>`.
|
|
223
|
+
*/
|
|
224
|
+
function attributeInsertionPoint(
|
|
225
|
+
stored: string,
|
|
226
|
+
loc: ElementLocation,
|
|
227
|
+
): number | null {
|
|
228
|
+
const gt = loc.startTag!.endOffset - 1;
|
|
229
|
+
if (stored[gt] !== ">") return null;
|
|
230
|
+
const lastAttrEnd = Math.max(
|
|
231
|
+
-1,
|
|
232
|
+
...Object.values(loc.attrs ?? {}).map((attr) => attr.endOffset),
|
|
233
|
+
);
|
|
234
|
+
return stored[gt - 1] === "/" && lastAttrEnd !== gt ? gt - 1 : gt;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function stampPosition(
|
|
238
|
+
stored: string,
|
|
239
|
+
loc: ElementLocation,
|
|
240
|
+
): SourceElement["stamp"] {
|
|
241
|
+
const existing = loc.attrs?.[SOURCE_STAMP_ATTR];
|
|
242
|
+
if (existing) return { start: existing.startOffset, end: existing.endOffset };
|
|
243
|
+
const at = attributeInsertionPoint(stored, loc);
|
|
244
|
+
return at === null ? null : { at };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Inserts `data-src-i="<nonce>:<ordinal>"` into every located start tag. The
|
|
249
|
+
* stamp goes at the end of the tag so the mermaid and logo regexes, which read
|
|
250
|
+
* a tag's leading attributes, still match.
|
|
251
|
+
*/
|
|
252
|
+
export function stampSlideSource(
|
|
253
|
+
stored: string,
|
|
254
|
+
nonce: string,
|
|
255
|
+
): StampedSlideSource {
|
|
256
|
+
const located = locateSource(stored);
|
|
257
|
+
const edits: Array<{ start: number; end: number; text: string }> = [];
|
|
258
|
+
located.elements.forEach(({ stamp }, ordinal) => {
|
|
259
|
+
if (!stamp) return;
|
|
260
|
+
const attr = `${SOURCE_STAMP_ATTR}="${nonce}:${ordinal}"`;
|
|
261
|
+
if ("at" in stamp) {
|
|
262
|
+
edits.push({ start: stamp.at, end: stamp.at, text: ` ${attr}` });
|
|
263
|
+
} else {
|
|
264
|
+
edits.push({ start: stamp.start, end: stamp.end, text: attr });
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
edits.sort((a, b) => a.start - b.start);
|
|
268
|
+
let html = "";
|
|
269
|
+
let copied = 0;
|
|
270
|
+
for (const edit of edits) {
|
|
271
|
+
html += stored.slice(copied, edit.start) + edit.text;
|
|
272
|
+
copied = edit.end;
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
html: html + stored.slice(copied),
|
|
276
|
+
ranges: located.elements.map((element) => element.range),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// ---------------------------------------------------------------- merge ---
|
|
281
|
+
|
|
282
|
+
type Kid = Element | string;
|
|
283
|
+
|
|
284
|
+
const escapeText = (text: string) =>
|
|
285
|
+
text
|
|
286
|
+
.replace(/&/g, "&")
|
|
287
|
+
.replace(/</g, "<")
|
|
288
|
+
.replace(/>/g, ">")
|
|
289
|
+
.replace(/ /g, " ");
|
|
290
|
+
const escapeAttr = (value: string) =>
|
|
291
|
+
value.replace(/&/g, "&").replace(/"/g, """).replace(/ /g, " ");
|
|
292
|
+
|
|
293
|
+
function attrMap(el: Element): Map<string, string> {
|
|
294
|
+
const map = new Map<string, string>();
|
|
295
|
+
const isVideo = el.tagName.toLowerCase() === "video";
|
|
296
|
+
for (const attr of Array.from(el.attributes)) {
|
|
297
|
+
if (TRANSIENT_ATTRS.has(attr.name)) {
|
|
298
|
+
if (
|
|
299
|
+
isVideo &&
|
|
300
|
+
attr.name === "data-video-autoplay" &&
|
|
301
|
+
attr.value === "true"
|
|
302
|
+
) {
|
|
303
|
+
map.set("autoplay", "");
|
|
304
|
+
}
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
map.set(attr.name, attr.value);
|
|
308
|
+
}
|
|
309
|
+
return map;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function styleOf(el: Element): CSSStyleDeclaration | null {
|
|
313
|
+
return (el as HTMLElement).style ?? null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** Per-longhand base→live change; `null` means the property was removed. */
|
|
317
|
+
function styleDelta(base: Element, live: Element): Map<string, string | null> {
|
|
318
|
+
const delta = new Map<string, string | null>();
|
|
319
|
+
const bs = styleOf(base);
|
|
320
|
+
const ls = styleOf(live);
|
|
321
|
+
if (!bs || !ls) return delta;
|
|
322
|
+
const props = new Set<string>();
|
|
323
|
+
for (let i = 0; i < bs.length; i++) props.add(bs[i]);
|
|
324
|
+
for (let i = 0; i < ls.length; i++) props.add(ls[i]);
|
|
325
|
+
// A shorthand holding `var()` reads back only as itself, with every
|
|
326
|
+
// longhand empty, so it is compared by its declared name.
|
|
327
|
+
for (const el of [base, live]) {
|
|
328
|
+
for (const { name } of splitDeclarations(el.getAttribute("style") ?? "")) {
|
|
329
|
+
if (
|
|
330
|
+
`${bs.getPropertyValue(name)}${ls.getPropertyValue(name)}`.includes(
|
|
331
|
+
"var(",
|
|
332
|
+
)
|
|
333
|
+
)
|
|
334
|
+
props.add(name);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
for (const prop of props) {
|
|
338
|
+
const before = bs.getPropertyValue(prop) + bs.getPropertyPriority(prop);
|
|
339
|
+
const after = ls.getPropertyValue(prop) + ls.getPropertyPriority(prop);
|
|
340
|
+
if (before === after) continue;
|
|
341
|
+
const value = ls.getPropertyValue(prop);
|
|
342
|
+
delta.set(
|
|
343
|
+
prop,
|
|
344
|
+
value
|
|
345
|
+
? `${value}${ls.getPropertyPriority(prop) ? " !important" : ""}`
|
|
346
|
+
: null,
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
return delta;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function sameAttrs(a: Element, b: Element): boolean {
|
|
353
|
+
const x = attrMap(a);
|
|
354
|
+
const y = attrMap(b);
|
|
355
|
+
if (x.size !== y.size) return false;
|
|
356
|
+
for (const [name, value] of x) {
|
|
357
|
+
const other = y.get(name);
|
|
358
|
+
if (other === undefined) return false;
|
|
359
|
+
if (other === value) continue;
|
|
360
|
+
// Touching `el.style` reserializes the attribute without changing it.
|
|
361
|
+
if (name === "style" && styleDelta(b, a).size === 0) continue;
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** Declarations of a style attribute, split outside quotes and parentheses. */
|
|
368
|
+
function splitDeclarations(
|
|
369
|
+
style: string,
|
|
370
|
+
): Array<{ name: string; raw: string }> {
|
|
371
|
+
const out: Array<{ name: string; raw: string }> = [];
|
|
372
|
+
let depth = 0;
|
|
373
|
+
let quote = "";
|
|
374
|
+
let start = 0;
|
|
375
|
+
const push = (end: number) => {
|
|
376
|
+
const raw = style.slice(start, end);
|
|
377
|
+
const colon = raw.indexOf(":");
|
|
378
|
+
const name = colon > 0 ? raw.slice(0, colon).trim() : "";
|
|
379
|
+
if (raw.trim())
|
|
380
|
+
out.push({
|
|
381
|
+
name: name.startsWith("--") ? name : name.toLowerCase(),
|
|
382
|
+
raw,
|
|
383
|
+
});
|
|
384
|
+
start = end + 1;
|
|
385
|
+
};
|
|
386
|
+
for (let i = 0; i < style.length; i++) {
|
|
387
|
+
const c = style[i];
|
|
388
|
+
if (quote) {
|
|
389
|
+
if (c === quote) quote = "";
|
|
390
|
+
} else if (c === '"' || c === "'") quote = c;
|
|
391
|
+
else if (c === "(") depth++;
|
|
392
|
+
else if (c === ")") depth--;
|
|
393
|
+
else if (c === ";" && depth === 0) push(i);
|
|
394
|
+
}
|
|
395
|
+
push(style.length);
|
|
396
|
+
return out;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* The stored style text with the user's per-property change applied. Untouched
|
|
401
|
+
* declarations keep their stored bytes, so renderer rewrites (sanitized
|
|
402
|
+
* formatting, font renames, the logo filter) never reach storage.
|
|
403
|
+
*/
|
|
404
|
+
function mergeStyle(
|
|
405
|
+
stored: string | undefined,
|
|
406
|
+
base: Element,
|
|
407
|
+
live: Element,
|
|
408
|
+
scratch: CSSStyleDeclaration,
|
|
409
|
+
): string | null {
|
|
410
|
+
const delta = styleDelta(base, live);
|
|
411
|
+
if (delta.size === 0) return stored ?? null;
|
|
412
|
+
const kept: string[] = [];
|
|
413
|
+
for (const decl of splitDeclarations(stored ?? "")) {
|
|
414
|
+
if (delta.has(decl.name)) continue;
|
|
415
|
+
scratch.cssText = decl.raw;
|
|
416
|
+
const covered = [...delta].filter(
|
|
417
|
+
([prop]) => scratch.getPropertyValue(prop) !== "",
|
|
418
|
+
);
|
|
419
|
+
const mustDrop = covered.some(
|
|
420
|
+
([prop, value]) =>
|
|
421
|
+
value === null ||
|
|
422
|
+
(scratch.getPropertyPriority(prop) === "important" &&
|
|
423
|
+
!value.endsWith("!important")),
|
|
424
|
+
);
|
|
425
|
+
if (!mustDrop) {
|
|
426
|
+
kept.push(decl.raw.trim());
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
// A shorthand that also set a removed longhand: keep what it set for the
|
|
430
|
+
// properties the user did not touch.
|
|
431
|
+
const liveStyle = styleOf(live);
|
|
432
|
+
for (let i = 0; i < scratch.length; i++) {
|
|
433
|
+
const longhand = scratch[i];
|
|
434
|
+
if (delta.has(longhand) || !liveStyle) continue;
|
|
435
|
+
const value = liveStyle.getPropertyValue(longhand);
|
|
436
|
+
if (!value) continue;
|
|
437
|
+
const important = liveStyle.getPropertyPriority(longhand);
|
|
438
|
+
kept.push(`${longhand}: ${value}${important ? " !important" : ""}`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
for (const [prop, value] of delta) {
|
|
442
|
+
if (value !== null) kept.push(`${prop}: ${value}`);
|
|
443
|
+
}
|
|
444
|
+
return kept.length ? kept.join("; ") : null;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function textOf(node: P5.Node): string {
|
|
448
|
+
if (node.nodeName === "#text") return (node as P5.TextNode).value;
|
|
449
|
+
if (!("childNodes" in node)) return "";
|
|
450
|
+
return (node as P5.ParentNode).childNodes.map(textOf).join("");
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Elements under `node` that its own source slice (from `from`) produces: a
|
|
455
|
+
* formatting element rebuilt from a start tag before the slice is not one.
|
|
456
|
+
*/
|
|
457
|
+
function elementCount(node: P5.ParentNode, from: number): number {
|
|
458
|
+
let n = 0;
|
|
459
|
+
for (const child of node.childNodes) {
|
|
460
|
+
if (!isElement(child)) continue;
|
|
461
|
+
const start = child.sourceCodeLocation?.startTag?.startOffset;
|
|
462
|
+
n +=
|
|
463
|
+
(start !== undefined && start < from ? 0 : 1) + elementCount(child, from);
|
|
464
|
+
}
|
|
465
|
+
return n;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface MergeRenderedEditsInput {
|
|
469
|
+
stored: string;
|
|
470
|
+
ranges: SlideSourceRange[];
|
|
471
|
+
base: string;
|
|
472
|
+
/** A root the caller owns (a clone of the canvas): the merge mutates it. */
|
|
473
|
+
live: Element;
|
|
474
|
+
nonce: string;
|
|
475
|
+
/** Applied to both the base and the live root before they are compared. */
|
|
476
|
+
prepare?: (root: ParentNode) => void;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The stored string with the live DOM's changes, relative to `base`, spliced
|
|
481
|
+
* in. No change returns `stored` itself.
|
|
482
|
+
*
|
|
483
|
+
* - Unchanged elements are copied as their exact stored source slice.
|
|
484
|
+
* - A changed element keeps its stored start tag; changed attributes are
|
|
485
|
+
* spliced into it, and a style change is applied per declaration.
|
|
486
|
+
* - Its children are walked over the stored bytes when only children changed
|
|
487
|
+
* or were deleted; otherwise they are rebuilt, and stored-only nodes
|
|
488
|
+
* (`<style>`, svg, comments) are put back after their previous sibling.
|
|
489
|
+
* - A stamped element whose source slice does not parse back to itself
|
|
490
|
+
* (misnested markup) is written canonically, for that subtree only.
|
|
491
|
+
* - Unstamped or foreign-stamped elements are new content, written from the
|
|
492
|
+
* live DOM.
|
|
493
|
+
*/
|
|
494
|
+
export function mergeRenderedEdits(input: MergeRenderedEditsInput): {
|
|
495
|
+
html: string;
|
|
496
|
+
changed: boolean;
|
|
497
|
+
} {
|
|
498
|
+
const html = sourceMerge(input).mergeRoot();
|
|
499
|
+
return { html, changed: html !== input.stored };
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Replays an edit of `stored` (`edited`, its merged result) onto `next`, a
|
|
504
|
+
* newer version of the slide someone else wrote. The edit moves as the
|
|
505
|
+
* smallest stored element around it that `next` still holds exactly once.
|
|
506
|
+
* Null when `next` changed that element too: both cannot be kept.
|
|
507
|
+
*/
|
|
508
|
+
export function rebaseSlideEdit(
|
|
509
|
+
stored: string,
|
|
510
|
+
ranges: readonly SlideSourceRange[],
|
|
511
|
+
edited: string,
|
|
512
|
+
next: string,
|
|
513
|
+
): string | null {
|
|
514
|
+
if (edited === stored) return next;
|
|
515
|
+
if (next === stored) return edited;
|
|
516
|
+
const shorter = Math.min(stored.length, edited.length);
|
|
517
|
+
let start = 0;
|
|
518
|
+
while (start < shorter && stored[start] === edited[start]) start += 1;
|
|
519
|
+
let tail = 0;
|
|
520
|
+
while (
|
|
521
|
+
tail < shorter - start &&
|
|
522
|
+
stored[stored.length - 1 - tail] === edited[edited.length - 1 - tail]
|
|
523
|
+
) {
|
|
524
|
+
tail += 1;
|
|
525
|
+
}
|
|
526
|
+
const end = stored.length - tail;
|
|
527
|
+
const growth = edited.length - stored.length;
|
|
528
|
+
const enclosing = ranges
|
|
529
|
+
.filter((range) => range.openStart <= start && range.closeEnd >= end)
|
|
530
|
+
.sort((a, b) => a.closeEnd - a.openStart - (b.closeEnd - b.openStart));
|
|
531
|
+
for (const range of enclosing) {
|
|
532
|
+
const before = stored.slice(range.openStart, range.closeEnd);
|
|
533
|
+
const at = next.indexOf(before);
|
|
534
|
+
if (at < 0) return null;
|
|
535
|
+
if (next.indexOf(before, at + 1) >= 0) continue;
|
|
536
|
+
return (
|
|
537
|
+
next.slice(0, at) +
|
|
538
|
+
edited.slice(range.openStart, range.closeEnd + growth) +
|
|
539
|
+
next.slice(at + before.length)
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* The stored-form HTML of one live element (or a detached copy of one): its
|
|
547
|
+
* stored source with its own changes applied, free of stamps and of anything
|
|
548
|
+
* the renderer added. Clipboard copies use this, so a pasted logo does not
|
|
549
|
+
* carry the rendered logo filter back into storage.
|
|
550
|
+
*/
|
|
551
|
+
export function storedFormOf(
|
|
552
|
+
source: RenderedSlideSource,
|
|
553
|
+
element: Element,
|
|
554
|
+
): string {
|
|
555
|
+
return sourceMerge({ ...source, live: element }).emit(element);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function sourceMerge(input: MergeRenderedEditsInput) {
|
|
559
|
+
const { stored, nonce, live } = input;
|
|
560
|
+
const located = locateSource(stored);
|
|
561
|
+
if (located.elements.length !== input.ranges.length) {
|
|
562
|
+
throw new SlideSourceMapError(
|
|
563
|
+
`source map is stale: ${input.ranges.length} ranges for ${located.elements.length} stored elements`,
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
const ranges = located.elements.map((element) => element.range);
|
|
567
|
+
// Parsed in a template's inert document so base images never load.
|
|
568
|
+
const template = live.ownerDocument.createElement("template");
|
|
569
|
+
template.innerHTML = input.base;
|
|
570
|
+
const baseRoot = template.content;
|
|
571
|
+
const inert = baseRoot.ownerDocument;
|
|
572
|
+
input.prepare?.(baseRoot);
|
|
573
|
+
input.prepare?.(live);
|
|
574
|
+
|
|
575
|
+
const stampOf = (el: Element): number | null => {
|
|
576
|
+
const value = el.getAttribute(SOURCE_STAMP_ATTR);
|
|
577
|
+
if (!value) return null;
|
|
578
|
+
const colon = value.lastIndexOf(":");
|
|
579
|
+
if (value.slice(0, colon) !== nonce) return null;
|
|
580
|
+
const ordinal = Number(value.slice(colon + 1));
|
|
581
|
+
return Number.isInteger(ordinal) && ordinal >= 0 && ordinal < ranges.length
|
|
582
|
+
? ordinal
|
|
583
|
+
: null;
|
|
584
|
+
};
|
|
585
|
+
// The renderer swaps each mermaid block for a placeholder the diagram
|
|
586
|
+
// component replaces; both stand for the stored block's element.
|
|
587
|
+
for (const root of [baseRoot, live]) {
|
|
588
|
+
for (const el of Array.from(
|
|
589
|
+
root.querySelectorAll(`[${MERMAID_INDEX_ATTR}]`),
|
|
590
|
+
)) {
|
|
591
|
+
const block =
|
|
592
|
+
located.mermaid[Number(el.getAttribute(MERMAID_INDEX_ATTR))];
|
|
593
|
+
if (block?.ordinal != null) {
|
|
594
|
+
el.setAttribute(SOURCE_STAMP_ATTR, `${nonce}:${block.ordinal}`);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
// A clone of a stored element (Enter copying a row) carries its stamps; the
|
|
599
|
+
// first live copy in document order is the stored element, the rest are new.
|
|
600
|
+
const firstCopy = new Map<number, Element>();
|
|
601
|
+
for (const el of [
|
|
602
|
+
live,
|
|
603
|
+
...Array.from(live.querySelectorAll(`[${SOURCE_STAMP_ATTR}]`)),
|
|
604
|
+
]) {
|
|
605
|
+
const ordinal = stampOf(el);
|
|
606
|
+
if (ordinal !== null && !firstCopy.has(ordinal)) firstCopy.set(ordinal, el);
|
|
607
|
+
}
|
|
608
|
+
const baseBy = new Map<number, Element>();
|
|
609
|
+
for (const el of Array.from(
|
|
610
|
+
baseRoot.querySelectorAll(`[${SOURCE_STAMP_ATTR}]`),
|
|
611
|
+
)) {
|
|
612
|
+
const ordinal = stampOf(el);
|
|
613
|
+
if (ordinal !== null && !baseBy.has(ordinal)) baseBy.set(ordinal, el);
|
|
614
|
+
}
|
|
615
|
+
// The parser's later copies of a reconstructed element: the stored markup
|
|
616
|
+
// reopens them, so only their children are content.
|
|
617
|
+
const rebuilt = new Set<Element>();
|
|
618
|
+
for (const root of [baseRoot, live]) {
|
|
619
|
+
const first = new Set<number>();
|
|
620
|
+
for (const el of Array.from(
|
|
621
|
+
root.querySelectorAll(`[${SOURCE_STAMP_ATTR}]`),
|
|
622
|
+
)) {
|
|
623
|
+
const ordinal = stampOf(el);
|
|
624
|
+
if (ordinal === null || !located.reconstructed.has(ordinal)) continue;
|
|
625
|
+
if (first.has(ordinal)) rebuilt.add(el);
|
|
626
|
+
else first.add(ordinal);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const scratch = inert.createElement("div").style;
|
|
630
|
+
// The parser adds <tbody>/<colgroup> to a stored <table> that omits them;
|
|
631
|
+
// they have no source, so writing them would change the stored bytes.
|
|
632
|
+
const isImplied = (el: Element) =>
|
|
633
|
+
(el.tagName === "TBODY" || el.tagName === "COLGROUP") &&
|
|
634
|
+
stampOf(el) === null &&
|
|
635
|
+
el.parentElement?.tagName === "TABLE" &&
|
|
636
|
+
stampOf(el.parentElement) !== null;
|
|
637
|
+
|
|
638
|
+
const kids = (node: ParentNode): Kid[] => {
|
|
639
|
+
const out: Kid[] = [];
|
|
640
|
+
const push = (child: Node) => {
|
|
641
|
+
if (child.nodeType === 1) {
|
|
642
|
+
const el = child as Element;
|
|
643
|
+
if (el.matches(TRANSPARENT) || rebuilt.has(el) || isImplied(el)) {
|
|
644
|
+
el.childNodes.forEach(push);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
// The rendered <style> is the scoped copy; the stored one is
|
|
648
|
+
// written from its source bytes.
|
|
649
|
+
if (
|
|
650
|
+
el.tagName === "STYLE" &&
|
|
651
|
+
stampOf(el) === null &&
|
|
652
|
+
!el.hasAttribute("data-fmd-crop-keyframes")
|
|
653
|
+
) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
out.push(el);
|
|
657
|
+
} else if (child.nodeType === 3) {
|
|
658
|
+
const text = (child as Text).data;
|
|
659
|
+
if (!text) return;
|
|
660
|
+
const last = out[out.length - 1];
|
|
661
|
+
if (typeof last === "string") out[out.length - 1] = last + text;
|
|
662
|
+
else out.push(text);
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
node.childNodes.forEach(push);
|
|
666
|
+
return out;
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
const isOpaque = (el: Element) => el.hasAttribute(MERMAID_INDEX_ATTR);
|
|
670
|
+
const sameMemo = new Map<Element, { other: Element; same: boolean }>();
|
|
671
|
+
const sameKids = (a: ParentNode, b: ParentNode): boolean => {
|
|
672
|
+
const x = kids(a);
|
|
673
|
+
const y = kids(b);
|
|
674
|
+
return x.length === y.length && x.every((kid, i) => sameKid(kid, y[i]));
|
|
675
|
+
};
|
|
676
|
+
/** `a` is live, `b` is base. */
|
|
677
|
+
const sameKid = (a: Kid, b: Kid): boolean => {
|
|
678
|
+
if (typeof a === "string" || typeof b === "string") return a === b;
|
|
679
|
+
const memo = sameMemo.get(a);
|
|
680
|
+
if (memo?.other === b) return memo.same;
|
|
681
|
+
const same =
|
|
682
|
+
a.tagName === b.tagName &&
|
|
683
|
+
stampOf(a) === stampOf(b) &&
|
|
684
|
+
(isOpaque(a) && isOpaque(b)
|
|
685
|
+
? a.getAttribute(MERMAID_INDEX_ATTR) ===
|
|
686
|
+
b.getAttribute(MERMAID_INDEX_ATTR)
|
|
687
|
+
: sameAttrs(a, b) && sameKids(a, b));
|
|
688
|
+
sameMemo.set(a, { other: b, same });
|
|
689
|
+
return same;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
const trustMemo = new Map<number, boolean>();
|
|
693
|
+
/** The source slice parses back to exactly this element. */
|
|
694
|
+
const isTrusted = (ordinal: number): boolean => {
|
|
695
|
+
const cached = trustMemo.get(ordinal);
|
|
696
|
+
if (cached !== undefined) return cached;
|
|
697
|
+
const { node, range } = located.elements[ordinal];
|
|
698
|
+
const nodes = parseFragment(
|
|
699
|
+
stored.slice(range.openStart, range.closeEnd),
|
|
700
|
+
PARSE_OPTIONS,
|
|
701
|
+
).childNodes;
|
|
702
|
+
const only = nodes[0];
|
|
703
|
+
const trusted =
|
|
704
|
+
nodes.length === 1 &&
|
|
705
|
+
isElement(only) &&
|
|
706
|
+
only.tagName === node.tagName &&
|
|
707
|
+
textOf(only) === textOf(node) &&
|
|
708
|
+
elementCount(only, 0) === elementCount(node, range.openStart);
|
|
709
|
+
trustMemo.set(ordinal, trusted);
|
|
710
|
+
return trusted;
|
|
711
|
+
};
|
|
712
|
+
const sourceOf = (ordinal: number): string => {
|
|
713
|
+
const { node, range } = located.elements[ordinal];
|
|
714
|
+
return isTrusted(ordinal)
|
|
715
|
+
? stored.slice(range.openStart, range.closeEnd)
|
|
716
|
+
: serializeOuter(node);
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* A stored parent's children as the renderer sees them: unwrapped tags
|
|
721
|
+
* contribute their children, parser-implied elements are transparent.
|
|
722
|
+
*/
|
|
723
|
+
const renderLevel = (nodes: P5.ChildNode[], inHead: boolean) => {
|
|
724
|
+
const out: P5.ChildNode[] = [];
|
|
725
|
+
const walk = (list: P5.ChildNode[]) => {
|
|
726
|
+
for (const node of list) {
|
|
727
|
+
if (isComment(node)) out.push(node);
|
|
728
|
+
if (!isElement(node)) continue;
|
|
729
|
+
const ordinal = located.ordinalOf.get(node);
|
|
730
|
+
const tag = node.tagName;
|
|
731
|
+
const unwrapped =
|
|
732
|
+
ordinal === undefined ||
|
|
733
|
+
(!inHead &&
|
|
734
|
+
!ALLOWED_TAGS.has(tag) &&
|
|
735
|
+
!DROP_WITH_CHILDREN.has(tag) &&
|
|
736
|
+
tag !== "template");
|
|
737
|
+
if (unwrapped) walk(node.childNodes);
|
|
738
|
+
else out.push(node);
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
walk(nodes);
|
|
742
|
+
return out;
|
|
743
|
+
};
|
|
744
|
+
const ROOT = null;
|
|
745
|
+
const storedChildren = (parent: P5.Element | typeof ROOT) =>
|
|
746
|
+
parent === ROOT
|
|
747
|
+
? [
|
|
748
|
+
...renderLevel(located.head, true),
|
|
749
|
+
...renderLevel(located.body, false),
|
|
750
|
+
]
|
|
751
|
+
: renderLevel(
|
|
752
|
+
parent.tagName === "template"
|
|
753
|
+
? (parent as P5.Template).content.childNodes
|
|
754
|
+
: parent.childNodes,
|
|
755
|
+
false,
|
|
756
|
+
);
|
|
757
|
+
|
|
758
|
+
const openTag = (tag: string, attrs: Iterable<[string, string]>) => {
|
|
759
|
+
let out = `<${tag}`;
|
|
760
|
+
for (const [name, value] of attrs) out += ` ${name}="${escapeAttr(value)}"`;
|
|
761
|
+
return `${out}>`;
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
/** Stored start tag with the base→live attribute change spliced in. */
|
|
765
|
+
const mergedOpenTag = (
|
|
766
|
+
ordinal: number,
|
|
767
|
+
base: Element,
|
|
768
|
+
live: Element,
|
|
769
|
+
tag: string,
|
|
770
|
+
splice: boolean,
|
|
771
|
+
): string => {
|
|
772
|
+
const { node, range } = located.elements[ordinal];
|
|
773
|
+
const storedAttrs = new Map(node.attrs.map((a) => [a.name, a.value]));
|
|
774
|
+
const baseAttrs = attrMap(base);
|
|
775
|
+
const liveAttrs = attrMap(live);
|
|
776
|
+
const changes = new Map<string, string | null>();
|
|
777
|
+
for (const name of new Set([...baseAttrs.keys(), ...liveAttrs.keys()])) {
|
|
778
|
+
const before = baseAttrs.get(name);
|
|
779
|
+
const after = liveAttrs.get(name);
|
|
780
|
+
if (before === after) continue;
|
|
781
|
+
if (name === "style") {
|
|
782
|
+
const merged = mergeStyle(
|
|
783
|
+
storedAttrs.get("style"),
|
|
784
|
+
base,
|
|
785
|
+
live,
|
|
786
|
+
scratch,
|
|
787
|
+
);
|
|
788
|
+
if (merged !== (storedAttrs.get("style") ?? null))
|
|
789
|
+
changes.set(name, merged);
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
changes.set(name, after ?? null);
|
|
793
|
+
}
|
|
794
|
+
if (!splice) {
|
|
795
|
+
for (const [name, value] of changes) {
|
|
796
|
+
if (value === null) storedAttrs.delete(name);
|
|
797
|
+
else storedAttrs.set(name, value);
|
|
798
|
+
}
|
|
799
|
+
for (const name of TRANSIENT_ATTRS) {
|
|
800
|
+
if (!SOURCE_ACCESSIBILITY_ATTRS.has(name)) storedAttrs.delete(name);
|
|
801
|
+
}
|
|
802
|
+
return openTag(tag, storedAttrs);
|
|
803
|
+
}
|
|
804
|
+
const loc = node.sourceCodeLocation!;
|
|
805
|
+
const locations = loc.attrs ?? {};
|
|
806
|
+
const edits: Array<{ start: number; end: number; text: string }> = [];
|
|
807
|
+
const tail = attributeInsertionPoint(stored, loc) ?? range.openEnd - 1;
|
|
808
|
+
for (const [name, value] of changes) {
|
|
809
|
+
const at = locations[name];
|
|
810
|
+
const text = value === null ? "" : `${name}="${escapeAttr(value)}"`;
|
|
811
|
+
if (at) {
|
|
812
|
+
let start = at.startOffset;
|
|
813
|
+
if (value === null) {
|
|
814
|
+
while (start > range.openStart && /\s/.test(stored[start - 1]))
|
|
815
|
+
start--;
|
|
816
|
+
}
|
|
817
|
+
edits.push({ start, end: at.endOffset, text });
|
|
818
|
+
} else if (value !== null) {
|
|
819
|
+
edits.push({ start: tail, end: tail, text: ` ${text}` });
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
edits.sort((a, b) => b.start - a.start);
|
|
823
|
+
let tagSource = stored.slice(range.openStart, range.openEnd);
|
|
824
|
+
for (const edit of edits) {
|
|
825
|
+
tagSource =
|
|
826
|
+
tagSource.slice(0, edit.start - range.openStart) +
|
|
827
|
+
edit.text +
|
|
828
|
+
tagSource.slice(edit.end - range.openStart);
|
|
829
|
+
}
|
|
830
|
+
return tagSource;
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
const storedOnlyAfter = (parent: P5.Element | typeof ROOT, ok: Kid[]) => {
|
|
834
|
+
const lead: string[] = [];
|
|
835
|
+
const after = new Map<number, string[]>();
|
|
836
|
+
let anchor = -1;
|
|
837
|
+
for (const node of storedChildren(parent)) {
|
|
838
|
+
let html: string;
|
|
839
|
+
if (isComment(node)) {
|
|
840
|
+
const loc = node.sourceCodeLocation;
|
|
841
|
+
html = loc
|
|
842
|
+
? stored.slice(loc.startOffset, loc.endOffset)
|
|
843
|
+
: `<!--${node.data}-->`;
|
|
844
|
+
} else {
|
|
845
|
+
const ordinal = located.ordinalOf.get(node as P5.Element)!;
|
|
846
|
+
if (baseBy.has(ordinal)) {
|
|
847
|
+
const at = ok.findIndex(
|
|
848
|
+
(kid) => typeof kid !== "string" && stampOf(kid) === ordinal,
|
|
849
|
+
);
|
|
850
|
+
if (at >= 0) anchor = at;
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
html = sourceOf(ordinal);
|
|
854
|
+
}
|
|
855
|
+
if (anchor < 0) lead.push(html);
|
|
856
|
+
else after.set(anchor, [...(after.get(anchor) ?? []), html]);
|
|
857
|
+
}
|
|
858
|
+
return { lead, after };
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
const emitKids = (
|
|
862
|
+
ok: Kid[],
|
|
863
|
+
parent: P5.Element | typeof ROOT | undefined,
|
|
864
|
+
) => {
|
|
865
|
+
const anchors =
|
|
866
|
+
parent === undefined
|
|
867
|
+
? { lead: [] as string[], after: new Map<number, string[]>() }
|
|
868
|
+
: storedOnlyAfter(parent, ok);
|
|
869
|
+
let out = anchors.lead.join("");
|
|
870
|
+
ok.forEach((kid, i) => {
|
|
871
|
+
out += emit(kid) + (anchors.after.get(i) ?? []).join("");
|
|
872
|
+
});
|
|
873
|
+
return out;
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Children written over the stored bytes: valid when the live children are
|
|
878
|
+
* the base children minus deleted ones with the text between them intact,
|
|
879
|
+
* and every stored child the renderer shows is one of those base children,
|
|
880
|
+
* in source order.
|
|
881
|
+
*/
|
|
882
|
+
const bySource = (
|
|
883
|
+
ok: Kid[],
|
|
884
|
+
bk: Kid[],
|
|
885
|
+
parent: P5.Element | typeof ROOT,
|
|
886
|
+
from: number,
|
|
887
|
+
to: number,
|
|
888
|
+
): string | null => {
|
|
889
|
+
const baseEls = bk.filter((kid): kid is Element => typeof kid !== "string");
|
|
890
|
+
const shown = storedChildren(parent)
|
|
891
|
+
.filter(isElement)
|
|
892
|
+
.map((node) => located.ordinalOf.get(node)!)
|
|
893
|
+
.filter((ordinal) => baseBy.has(ordinal));
|
|
894
|
+
if (
|
|
895
|
+
shown.length !== baseEls.length ||
|
|
896
|
+
shown.some((ordinal, i) => ordinal !== stampOf(baseEls[i]))
|
|
897
|
+
) {
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
// Match each live element to the next base element with its stamp; the
|
|
901
|
+
// base elements skipped over were deleted.
|
|
902
|
+
const kept = new Map<Element, Element>();
|
|
903
|
+
const liveText = [""];
|
|
904
|
+
const baseText = [""];
|
|
905
|
+
let b = 0;
|
|
906
|
+
for (const kid of ok) {
|
|
907
|
+
if (typeof kid === "string") {
|
|
908
|
+
liveText[liveText.length - 1] += kid;
|
|
909
|
+
continue;
|
|
910
|
+
}
|
|
911
|
+
const ordinal = stampOf(kid);
|
|
912
|
+
for (; b < bk.length; b++) {
|
|
913
|
+
const candidate = bk[b];
|
|
914
|
+
if (typeof candidate === "string") {
|
|
915
|
+
baseText[baseText.length - 1] += candidate;
|
|
916
|
+
} else if (stampOf(candidate) === ordinal) {
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
if (b === bk.length || ordinal === null) return null;
|
|
921
|
+
kept.set(bk[b] as Element, kid);
|
|
922
|
+
b++;
|
|
923
|
+
liveText.push("");
|
|
924
|
+
baseText.push("");
|
|
925
|
+
}
|
|
926
|
+
for (; b < bk.length; b++) {
|
|
927
|
+
const rest = bk[b];
|
|
928
|
+
if (typeof rest === "string") baseText[baseText.length - 1] += rest;
|
|
929
|
+
}
|
|
930
|
+
if (liveText.some((text, i) => text !== baseText[i])) return null;
|
|
931
|
+
|
|
932
|
+
let out = "";
|
|
933
|
+
let cursor = from;
|
|
934
|
+
for (const el of baseEls) {
|
|
935
|
+
const ordinal = stampOf(el)!;
|
|
936
|
+
const range = ranges[ordinal];
|
|
937
|
+
if (
|
|
938
|
+
!isTrusted(ordinal) ||
|
|
939
|
+
range.openStart < cursor ||
|
|
940
|
+
range.closeEnd > to
|
|
941
|
+
)
|
|
942
|
+
return null;
|
|
943
|
+
out += stored.slice(cursor, range.openStart);
|
|
944
|
+
const keptKid = kept.get(el);
|
|
945
|
+
if (keptKid) out += emit(keptKid);
|
|
946
|
+
cursor = range.closeEnd;
|
|
947
|
+
}
|
|
948
|
+
return out + stored.slice(cursor, to);
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
const emit = (kid: Kid): string => {
|
|
952
|
+
if (typeof kid === "string") return escapeText(kid);
|
|
953
|
+
const tag = kid.tagName.toLowerCase();
|
|
954
|
+
const ordinal = stampOf(kid);
|
|
955
|
+
const base = ordinal === null ? undefined : baseBy.get(ordinal);
|
|
956
|
+
if (ordinal === null || !base) {
|
|
957
|
+
if (isOpaque(kid)) {
|
|
958
|
+
const block =
|
|
959
|
+
located.mermaid[Number(kid.getAttribute(MERMAID_INDEX_ATTR))];
|
|
960
|
+
if (block) return block.source;
|
|
961
|
+
}
|
|
962
|
+
return (
|
|
963
|
+
openTag(tag, attrMap(kid)) +
|
|
964
|
+
(VOID_TAGS.has(tag) ? "" : `${emitKids(kids(kid), undefined)}</${tag}>`)
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
const first = firstCopy.get(ordinal) === kid;
|
|
968
|
+
// A second live copy of one stored element (a split that cloned it) gets
|
|
969
|
+
// its own tag; copying the stored slice again would duplicate what the
|
|
970
|
+
// slice holds beyond the live children, such as svg and comments.
|
|
971
|
+
if (isOpaque(kid) || (first && sameKid(kid, base)))
|
|
972
|
+
return sourceOf(ordinal);
|
|
973
|
+
const range = ranges[ordinal];
|
|
974
|
+
const trusted = isTrusted(ordinal);
|
|
975
|
+
const sameTag = kid.tagName === base.tagName;
|
|
976
|
+
const open =
|
|
977
|
+
first && trusted && sameTag && sameAttrs(kid, base)
|
|
978
|
+
? stored.slice(range.openStart, range.openEnd)
|
|
979
|
+
: mergedOpenTag(ordinal, base, kid, tag, first && trusted && sameTag);
|
|
980
|
+
if (VOID_TAGS.has(tag)) return open;
|
|
981
|
+
// An implied end stays implied: closing an unclosed `<b>` explicitly
|
|
982
|
+
// would stop the parser reopening it in the paragraphs after it.
|
|
983
|
+
const close =
|
|
984
|
+
trusted && sameTag
|
|
985
|
+
? range.closeStart === null
|
|
986
|
+
? ""
|
|
987
|
+
: stored.slice(range.closeStart, range.closeEnd)
|
|
988
|
+
: `</${tag}>`;
|
|
989
|
+
const node = located.elements[ordinal].node;
|
|
990
|
+
const ok = kids(kid);
|
|
991
|
+
if (first && trusted && sameTag) {
|
|
992
|
+
const inner = bySource(
|
|
993
|
+
ok,
|
|
994
|
+
kids(base),
|
|
995
|
+
node,
|
|
996
|
+
range.openEnd,
|
|
997
|
+
range.closeStart ?? range.closeEnd,
|
|
998
|
+
);
|
|
999
|
+
if (inner !== null) return open + inner + close;
|
|
1000
|
+
}
|
|
1001
|
+
return open + emitKids(ok, first ? node : undefined) + close;
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
const mergeRoot = (): string =>
|
|
1005
|
+
sameKids(live, baseRoot)
|
|
1006
|
+
? stored
|
|
1007
|
+
: (bySource(kids(live), kids(baseRoot), ROOT, 0, stored.length) ??
|
|
1008
|
+
emitKids(kids(live), ROOT));
|
|
1009
|
+
return { mergeRoot, emit };
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// --------------------------------------------------------------- guard ---
|
|
1013
|
+
|
|
1014
|
+
/** The scoped stylesheet's selectors, which the renderer writes into `<style>`. */
|
|
1015
|
+
export const SCOPED_STYLE_SELECTOR_MARKER = "scoped-style-selector";
|
|
1016
|
+
const SCOPED_SELECTOR = /\[data-slide-content-scope\s*=/g;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Markers only the renderer or the editor puts into slide HTML: the scoped
|
|
1020
|
+
* stylesheet's selectors, source stamps and editor attributes. A write that
|
|
1021
|
+
* adds one stored rendered markup; the growth check lets content that already
|
|
1022
|
+
* carries them (older flattened decks) keep saving. Author-writable styling,
|
|
1023
|
+
* such as a logo filter or a hidden element, is not a marker: a copy of stored
|
|
1024
|
+
* content legitimately carries it. Markers are read from parsed attributes and
|
|
1025
|
+
* `<style>` text, so text that names one is not a marker and a quoted `>` in
|
|
1026
|
+
* an earlier attribute cannot hide one.
|
|
1027
|
+
*/
|
|
1028
|
+
const MARKER_ATTRS = [
|
|
1029
|
+
"data-slide-content-scope",
|
|
1030
|
+
SOURCE_STAMP_ATTR,
|
|
1031
|
+
"data-builder-id",
|
|
1032
|
+
"data-editing-block",
|
|
1033
|
+
"data-slide-text-block",
|
|
1034
|
+
"contenteditable",
|
|
1035
|
+
"data-fmd-autofit-content",
|
|
1036
|
+
];
|
|
1037
|
+
const MARKER_CLASSES: Array<[string, RegExp]> = [
|
|
1038
|
+
["ProseMirror", /(?:^|\s)ProseMirror(?:\s|$)/],
|
|
1039
|
+
["slide-rich-editor", /(?:^|\s)slide-rich-editor/],
|
|
1040
|
+
];
|
|
1041
|
+
const MARKER_ORDER = [
|
|
1042
|
+
SCOPED_STYLE_SELECTOR_MARKER,
|
|
1043
|
+
...MARKER_ATTRS,
|
|
1044
|
+
...MARKER_CLASSES.map(([name]) => name),
|
|
1045
|
+
];
|
|
1046
|
+
|
|
1047
|
+
function countRenderArtifacts(html: string): Map<string, number> {
|
|
1048
|
+
const counts = new Map<string, number>();
|
|
1049
|
+
const add = (name: string, n = 1) =>
|
|
1050
|
+
n > 0 && counts.set(name, (counts.get(name) ?? 0) + n);
|
|
1051
|
+
const walk = (parent: P5.ParentNode) => {
|
|
1052
|
+
for (const node of parent.childNodes) {
|
|
1053
|
+
if (!isElement(node)) continue;
|
|
1054
|
+
for (const { name, value } of node.attrs) {
|
|
1055
|
+
// Older editors stored contenteditable="false" on text elements, so
|
|
1056
|
+
// only an editable value marks the live editing surface.
|
|
1057
|
+
if (name === "contenteditable" && value.toLowerCase() === "false")
|
|
1058
|
+
continue;
|
|
1059
|
+
if (MARKER_ATTRS.includes(name)) add(name);
|
|
1060
|
+
if (name !== "class") continue;
|
|
1061
|
+
for (const [marker, pattern] of MARKER_CLASSES) {
|
|
1062
|
+
if (pattern.test(value)) add(marker);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (node.tagName === "style") {
|
|
1066
|
+
add(
|
|
1067
|
+
SCOPED_STYLE_SELECTOR_MARKER,
|
|
1068
|
+
textOf(node).match(SCOPED_SELECTOR)?.length ?? 0,
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
walk(node.tagName === "template" ? (node as P5.Template).content : node);
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
walk(parseFragment(html, PARSE_OPTIONS));
|
|
1075
|
+
return counts;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* Names of the render/editor markers `next` has more of than `prev`. The
|
|
1080
|
+
* client checks its own saves and the actions check agent and old-client
|
|
1081
|
+
* writes with the same list.
|
|
1082
|
+
*/
|
|
1083
|
+
export function renderArtifactGrowth(prev: string, next: string): string[] {
|
|
1084
|
+
const before = countRenderArtifacts(prev);
|
|
1085
|
+
const after = countRenderArtifacts(next);
|
|
1086
|
+
return MARKER_ORDER.filter(
|
|
1087
|
+
(name) => (after.get(name) ?? 0) > (before.get(name) ?? 0),
|
|
1088
|
+
);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/** Removes source stamps from HTML that leaves the canvas. */
|
|
1092
|
+
export function stripSourceStamps(root: Element | DocumentFragment): void {
|
|
1093
|
+
if (root instanceof Element) root.removeAttribute(SOURCE_STAMP_ATTR);
|
|
1094
|
+
for (const el of Array.from(
|
|
1095
|
+
root.querySelectorAll(`[${SOURCE_STAMP_ATTR}]`),
|
|
1096
|
+
)) {
|
|
1097
|
+
el.removeAttribute(SOURCE_STAMP_ATTR);
|
|
1098
|
+
}
|
|
1099
|
+
}
|