@agent-native/core 0.129.1 → 0.130.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 +2 -2
- package/corpus/core/CHANGELOG.md +78 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +114 -0
- package/corpus/core/docs/content/creating-templates.mdx +28 -2
- package/corpus/core/docs/content/syncing-template-changes.mdx +7 -0
- package/corpus/core/docs/content/template-clips-developers.mdx +12 -5
- package/corpus/core/docs/content/template-dispatch-developers.mdx +1 -1
- package/corpus/core/docs/content/template-dispatch.mdx +1 -1
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/action-ui.ts +1 -0
- package/corpus/core/src/action.ts +5 -1
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/corpus/core/src/agent/harness/runner.ts +5 -0
- package/corpus/core/src/agent/production-agent.ts +33 -0
- package/corpus/core/src/agent/run-loop-with-resume.ts +5 -0
- package/corpus/core/src/agent/run-manager.ts +126 -1
- package/corpus/core/src/agent/thread-data-builder.ts +47 -2
- package/corpus/core/src/agent/types.ts +2 -0
- package/corpus/core/src/chat-threads/store.ts +4 -5
- package/corpus/core/src/cli/create.ts +1139 -65
- package/corpus/core/src/cli/design-connect.ts +3 -7
- package/corpus/core/src/cli/index.ts +5 -3
- package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/corpus/core/src/client/AssistantChat.tsx +27 -16
- package/corpus/core/src/client/agent-chat-adapter.ts +24 -0
- package/corpus/core/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/corpus/core/src/client/chat/index.ts +1 -0
- package/corpus/core/src/client/chat/message-components.tsx +104 -1
- package/corpus/core/src/client/chat/run-recovery.tsx +15 -3
- package/corpus/core/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/corpus/core/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/corpus/core/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/corpus/core/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/corpus/core/src/client/embed-auth.ts +2 -0
- package/corpus/core/src/client/org/InvitationBanner.tsx +14 -1
- package/corpus/core/src/client/org/OrgSwitcher.tsx +23 -0
- package/corpus/core/src/client/org/TeamPage.tsx +130 -0
- package/corpus/core/src/client/org/WorkspaceNotice.tsx +85 -0
- package/corpus/core/src/client/org/hooks.ts +14 -0
- package/corpus/core/src/client/org/index.ts +2 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +134 -51
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/corpus/core/src/client/resources/use-resources.ts +6 -0
- package/corpus/core/src/client/use-action.ts +3 -1
- package/corpus/core/src/client/widgets/index.ts +1 -0
- package/corpus/core/src/coding-tools/run-code.ts +2 -1
- package/corpus/core/src/db/client.ts +28 -4
- package/corpus/core/src/deploy/build.ts +31 -3
- package/corpus/core/src/eject/remote-mcp-presets.ts +1 -1
- package/corpus/core/src/index.browser.ts +1 -0
- package/corpus/core/src/index.ts +1 -0
- package/corpus/core/src/integrations/google-docs-poller.ts +3 -0
- package/corpus/core/src/integrations/webhook-handler.ts +28 -11
- package/corpus/core/src/jobs/scheduler.ts +4 -0
- package/corpus/core/src/localization/default-messages.ts +3 -2
- package/corpus/core/src/mcp/build-server.ts +20 -2
- package/corpus/core/src/observability/traces.ts +48 -12
- package/corpus/core/src/org/handlers.ts +52 -1
- package/corpus/core/src/org/migrations.ts +4 -0
- package/corpus/core/src/org/plugin.ts +14 -0
- package/corpus/core/src/org/schema.ts +1 -0
- package/corpus/core/src/org/types.ts +8 -0
- package/corpus/core/src/org/workspace-url.ts +74 -0
- package/corpus/core/src/resources/handlers.ts +35 -5
- package/corpus/core/src/scripts/runner.ts +183 -5
- package/corpus/core/src/server/action-routes.ts +32 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +29 -0
- package/corpus/core/src/server/agent-teams.ts +10 -1
- package/corpus/core/src/server/auth.ts +33 -7
- package/corpus/core/src/server/embed-route.ts +9 -0
- package/corpus/core/src/server/embed-session.ts +62 -3
- package/corpus/core/src/server/open-route.ts +20 -6
- package/corpus/core/src/server/prompts/framework-core-compact.ts +1 -1
- package/corpus/core/src/server/prompts/framework-core.ts +1 -0
- package/corpus/core/src/server/request-context.ts +36 -1
- package/corpus/core/src/shared/embed-auth.ts +1 -0
- package/corpus/core/src/shared/html-document.ts +115 -0
- package/corpus/core/src/shared/index.ts +1 -0
- package/corpus/core/src/sharing/access.ts +8 -1
- package/corpus/core/src/sharing/registry.ts +11 -2
- package/corpus/core/src/workspace-files/actions.ts +100 -0
- package/corpus/core/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +4 -0
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +9 -1
- package/corpus/templates/analytics/AGENTS.md +17 -24
- package/corpus/templates/analytics/actions/data-source-status.ts +11 -1
- package/corpus/templates/analytics/app/i18n-data.ts +34 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +86 -0
- package/corpus/templates/analytics/app/lib/native-mcp-exclusions.ts +9 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +184 -20
- package/corpus/templates/analytics/changelog/2026-07-28-native-analytics-data-sources-no-longer-show-duplicate-mc.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-exports-now-appear-in-chat-with-a-direct-download-instead-of.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-queued-chat-prompts-no-longer-resend-after-analytics-navigat.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-scheduled-dashboard-emails-load-every-panel-reliably-without.md +6 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +6 -3
- package/corpus/templates/analytics/server/lib/credential-keys.ts +1 -1
- package/corpus/templates/analytics/server/lib/hubspot.ts +1 -1
- package/corpus/templates/analytics/server/lib/provider-credentials.ts +55 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +123 -27
- package/corpus/templates/analytics/server/routes/[...page].get.ts +2 -7
- package/corpus/templates/analytics/vite.config.ts +7 -0
- package/corpus/templates/brain/actions/list-connection-providers.ts +100 -2
- package/corpus/templates/brain/app/lib/brain.ts +10 -0
- package/corpus/templates/brain/app/routes/sources.tsx +15 -4
- package/corpus/templates/brain/changelog/2026-07-29-brain-automatically-retries-failed-source-syncs-and-guides-y.md +6 -0
- package/corpus/templates/brain/jobs/process-ingest-queue.ts +13 -0
- package/corpus/templates/brain/server/jobs/sync-sources.ts +27 -22
- package/corpus/templates/brain/server/plugins/agent-chat.ts +2 -1
- package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +7 -1
- package/corpus/templates/clips/AGENTS.md +1 -1
- package/corpus/templates/clips/actions/create-recording-agent-link.ts +11 -1
- package/corpus/templates/clips/actions/update-comment.ts +68 -0
- package/corpus/templates/clips/app/components/editor/editor-layout.tsx +0 -1
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +221 -65
- package/corpus/templates/clips/app/components/player/video-player.tsx +101 -27
- package/corpus/templates/clips/app/i18n/en-US.ts +2 -1
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +48 -27
- package/corpus/templates/clips/app/routes/bug-report.tsx +43 -4
- package/corpus/templates/clips/app/routes/record.tsx +2 -0
- package/corpus/templates/clips/changelog/2026-07-29-clip-playback-now-recovers-instead-of-getting-stuck-when-a-b.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-comments-can-now-be-edited-after-posting.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-download-actions-now-use-a-shorter-clearer-label.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-embedded-bug-reports-now-return-a-temporary-agent-readable.md +6 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +21 -1
- package/corpus/templates/clips/shared/bug-report.ts +99 -0
- package/corpus/templates/content/actions/_content-database-personal-view.ts +7 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +5 -2
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +20 -8
- package/corpus/templates/content/changelog/2026-07-29-missing-databases-no-longer-trigger-repeated-personal-view-e.md +6 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +83 -47
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +474 -55
- package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +3 -0
- package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +18 -1
- package/corpus/templates/design/.generated/bridge/source-location.generated.ts +348 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +2 -7
- package/corpus/templates/design/actions/apply-visual-edit.ts +7 -1
- package/corpus/templates/design/actions/connect-localhost.ts +5 -9
- package/corpus/templates/design/actions/create-component.ts +16 -13
- package/corpus/templates/design/actions/grant-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/list-design-source-capabilities.ts +4 -7
- package/corpus/templates/design/actions/list-local-files.ts +26 -50
- package/corpus/templates/design/actions/list-localhost-connections.ts +2 -7
- package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +2 -2
- package/corpus/templates/design/actions/open-visual-edit.ts +234 -135
- package/corpus/templates/design/actions/read-local-file.ts +26 -50
- package/corpus/templates/design/actions/request-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/write-local-file.ts +31 -73
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +307 -133
- package/corpus/templates/design/app/components/design/EditPanel.tsx +94 -22
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +137 -60
- package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +75 -14
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +755 -97
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +8 -0
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +24 -1
- package/corpus/templates/design/app/components/design/bridge/source-location.bridge.ts +530 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +278 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +32 -12
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-setup.ts +14 -3
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +87 -24
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +36 -0
- package/corpus/templates/design/app/components/design/code-workbench/store.tsx +2 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +48 -8
- package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +3 -13
- package/corpus/templates/design/app/components/design/design-canvas/embedded-frame.ts +4 -2
- package/corpus/templates/design/app/components/design/design-canvas/hit-test.ts +3 -13
- package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +3 -1
- package/corpus/templates/design/app/components/design/edit-panel/inspect-code-source.ts +93 -0
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -2
- package/corpus/templates/design/app/components/design/multi-screen/cross-screen-drop.ts +35 -0
- package/corpus/templates/design/app/components/design/multi-screen/iframe-targeting.ts +24 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +9 -0
- package/corpus/templates/design/app/components/design/types.ts +29 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +7 -4
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +153 -46
- package/corpus/templates/design/app/i18n-responsive-interact.ts +12 -12
- package/corpus/templates/design/app/lib/design-editor-route.ts +23 -0
- package/corpus/templates/design/app/pages/VisualEdit.tsx +19 -6
- package/corpus/templates/design/app/pages/design-editor/action-error.ts +19 -0
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +29 -0
- package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +6 -0
- package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +277 -15
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +75 -9
- package/corpus/templates/design/app/pages/design-editor/layer-state-scope.ts +28 -0
- package/corpus/templates/design/app/pages/design-editor/live-screen-layer-drop.ts +41 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +496 -41
- package/corpus/templates/design/app/pages/design-editor/pending-live-edit-unload-guard.ts +27 -0
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +10 -0
- package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +168 -9
- package/corpus/templates/design/app/pages/design-editor/responsive-interact.ts +41 -3
- package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +5 -0
- package/corpus/templates/design/app/pages/design-editor/selection-state.ts +42 -13
- package/corpus/templates/design/app/pages/design-editor/source-location.ts +180 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +17 -0
- package/corpus/templates/design/app/public-routes.ts +1 -0
- package/corpus/templates/design/app/routes/visual-edit.$id.tsx +15 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-is-easier-to-find-and-named-screens-open-dir.md +1 -1
- package/corpus/templates/design/changelog/2026-07-28-deleting-a-selected-element-now-removes-it-from-the-live-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-deleting-an-element-on-a-connected-localhost-screen-now-queu.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-shows-a-responsive-device-preview-with-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layer-hide-and-lock-now-apply-to-the-live-preview-instead-of.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layers-panel-selections-on-a-connected-localhost-screen-can-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-locked-layers-now-show-a-subtle-dashed-outline-in-the-live-p.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-apply-design-updates-button-now-counts-pending-live-text.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-design-canvas-no-longer-stalls-on-a-render-loop-while-a-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edit-on-a-local-dev-server-no-longer-requires-signing.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edits-on-a-react-19-app-no-longer-report-a-source-lin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-an-edit-that-cannot-be-written-to-source-now-names-the-reaso.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-applying-a-primitive-dropped-onto-a-connected-localhost-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-changing-a-style-in-the-inspector-now-updates-a-connected-lo.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-choosing-edit-or-annotate-from-a-focused-screen-now-returns-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-concurrent-source-edits-now-return-a-clear-conflict-response.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-creating-a-component-from-an-element-that-repeats-in-the-sou.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-deleting-an-element-you-just-dropped-onto-a-live-screen-no-l.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-a-layer-across-screens-no-longer-dies-when-the-poin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-an-element-from-a-stored-screen-into-a-live-localho.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-drawing-a-box-on-the-canvas-and-dragging-it-into-a-connected.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-fixed-a-loading-screen-flicker-when-reopening-designs-with-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-interact-mode-has-edit-and-annotate-buttons-again-so-you-can.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-layer-groups-can-be-dropped-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-localhost-source-errors-now-say-what-actually-went-wrong-whi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-opening-or-refreshing-a-live-localhost-screen-in-single-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-redo-after-undoing-a-drop-onto-a-live-screen-puts-the-elemen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-can-be-drawn-directly-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-drawn-on-the-canvas-board-now-appear-immediately-inst.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-style-edits-on-a-running-localhost-screen-now-preview-live-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-the-apply-design-updates-control-now-appears-as-a-clean-conn.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-visual-edits-on-a-mapped-component-instance-now-tell-the-age.md +6 -0
- package/corpus/templates/design/server/lib/design-data-access.ts +21 -7
- package/corpus/templates/design/server/lib/localhost-connection.ts +240 -0
- package/corpus/templates/design/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/design/server/source-workspace.ts +2 -0
- package/corpus/templates/design/shared/code-layer.ts +43 -0
- package/corpus/templates/design/shared/html-content.ts +26 -0
- package/corpus/templates/design/shared/html-integrity.ts +21 -1
- package/corpus/templates/design/shared/local-jsx-visual-edit.ts +15 -0
- package/corpus/templates/design/shared/source-mode.ts +76 -0
- package/corpus/templates/dispatch/changelog/2026-07-29-workspace-members-without-admin-access-now-see-a-clear-permi.md +6 -0
- package/corpus/templates/dispatch/server/lib/usage-metrics.ts +2 -1
- package/corpus/templates/plan/app/lib/plan-annotation-runtime.ts +3 -4
- package/corpus/templates/plan/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/slides/actions/patch-deck.ts +29 -17
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +3 -2
- package/dist/action-ui.d.ts +1 -0
- package/dist/action-ui.d.ts.map +1 -1
- package/dist/action-ui.js +1 -0
- package/dist/action-ui.js.map +1 -1
- package/dist/action.d.ts +5 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +13 -5
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/harness/runner.d.ts.map +1 -1
- package/dist/agent/harness/runner.js +5 -0
- package/dist/agent/harness/runner.js.map +1 -1
- package/dist/agent/production-agent.d.ts +16 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +18 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +6 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts +14 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +91 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +3 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +35 -3
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +4 -6
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/create.d.ts +66 -6
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +765 -66
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +2 -7
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/index.js +5 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.js +83 -47
- package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +16 -9
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +21 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.d.ts +2 -0
- package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.js +8 -2
- package/dist/client/blocks/library/wireframe-kit.js.map +1 -1
- package/dist/client/chat/index.d.ts +1 -1
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +1 -1
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +17 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +24 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts +6 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +13 -3
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.d.ts.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.js +2 -3
- package/dist/client/chat/widgets/DataTableWidget.js.map +1 -1
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts +5 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts.map +1 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js +34 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js.map +1 -0
- package/dist/client/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js +13 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
- package/dist/client/chat/widgets/workspace-file-result.d.ts +12 -0
- package/dist/client/chat/widgets/workspace-file-result.d.ts.map +1 -0
- package/dist/client/chat/widgets/workspace-file-result.js +34 -0
- package/dist/client/chat/widgets/workspace-file-result.js.map +1 -0
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +2 -1
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts +5 -2
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.js +9 -2
- package/dist/client/org/InvitationBanner.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +3 -2
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +27 -3
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/org/WorkspaceNotice.d.ts +18 -0
- package/dist/client/org/WorkspaceNotice.d.ts.map +1 -0
- package/dist/client/org/WorkspaceNotice.js +56 -0
- package/dist/client/org/WorkspaceNotice.js.map +1 -0
- package/dist/client/org/hooks.d.ts +1 -0
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +12 -0
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/index.d.ts +2 -1
- package/dist/client/org/index.d.ts.map +1 -1
- package/dist/client/org/index.js +2 -1
- package/dist/client/org/index.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +8 -12
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +3 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +49 -20
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +3 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +1 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js +3 -0
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/use-action.d.ts +3 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +3 -1
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/widgets/index.d.ts +1 -1
- package/dist/client/widgets/index.d.ts.map +1 -1
- package/dist/client/widgets/index.js +1 -1
- package/dist/client/widgets/index.js.map +1 -1
- package/dist/coding-tools/run-code.js +2 -1
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db/client.d.ts +1 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +24 -3
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +25 -3
- package/dist/deploy/build.js.map +1 -1
- package/dist/eject/remote-mcp-presets.js +1 -1
- package/dist/eject/remote-mcp-presets.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +4 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +23 -11
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.js +4 -0
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +3 -2
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +3 -2
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +10 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +27 -7
- package/dist/observability/traces.js.map +1 -1
- package/dist/org/handlers.d.ts +15 -0
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +45 -1
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +4 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/org/plugin.d.ts +1 -0
- package/dist/org/plugin.d.ts.map +1 -1
- package/dist/org/plugin.js +10 -1
- package/dist/org/plugin.js.map +1 -1
- package/dist/org/schema.d.ts +19 -0
- package/dist/org/schema.d.ts.map +1 -1
- package/dist/org/schema.js +1 -0
- package/dist/org/schema.js.map +1 -1
- package/dist/org/types.d.ts +8 -0
- package/dist/org/types.d.ts.map +1 -1
- package/dist/org/types.js.map +1 -1
- package/dist/org/workspace-url.d.ts +32 -0
- package/dist/org/workspace-url.d.ts.map +1 -0
- package/dist/org/workspace-url.js +63 -0
- package/dist/org/workspace-url.js.map +1 -0
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/resources/handlers.d.ts +2 -3
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +25 -5
- package/dist/resources/handlers.js.map +1 -1
- package/dist/scripts/runner.d.ts +17 -0
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +130 -5
- package/dist/scripts/runner.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +24 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +26 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +10 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth.d.ts +22 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +33 -7
- package/dist/server/auth.js.map +1 -1
- package/dist/server/embed-route.d.ts.map +1 -1
- package/dist/server/embed-route.js +6 -1
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts +7 -0
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +46 -4
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +17 -7
- package/dist/server/open-route.js.map +1 -1
- package/dist/server/prompts/framework-core-compact.js +1 -1
- package/dist/server/prompts/framework-core-compact.js.map +1 -1
- package/dist/server/prompts/framework-core.d.ts.map +1 -1
- package/dist/server/prompts/framework-core.js +1 -0
- package/dist/server/prompts/framework-core.js.map +1 -1
- package/dist/server/request-context.d.ts +26 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +18 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/shared/embed-auth.d.ts +1 -0
- package/dist/shared/embed-auth.d.ts.map +1 -1
- package/dist/shared/embed-auth.js +1 -0
- package/dist/shared/embed-auth.js.map +1 -1
- package/dist/shared/html-document.d.ts +12 -0
- package/dist/shared/html-document.d.ts.map +1 -0
- package/dist/shared/html-document.js +92 -0
- package/dist/shared/html-document.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/sharing/access.d.ts +1 -0
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +8 -2
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/registry.d.ts +3 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/workspace-files/actions.d.ts +28 -0
- package/dist/workspace-files/actions.d.ts.map +1 -0
- package/dist/workspace-files/actions.js +75 -0
- package/dist/workspace-files/actions.js.map +1 -0
- package/dist/workspace-files/tool.d.ts.map +1 -1
- package/dist/workspace-files/tool.js +4 -0
- package/dist/workspace-files/tool.js.map +1 -1
- package/docs/content/cloneable-saas.mdx +114 -0
- package/docs/content/creating-templates.mdx +28 -2
- package/docs/content/syncing-template-changes.mdx +7 -0
- package/docs/content/template-clips-developers.mdx +12 -5
- package/docs/content/template-dispatch-developers.mdx +1 -1
- package/docs/content/template-dispatch.mdx +1 -1
- package/package.json +2 -2
- package/src/action-ui.ts +1 -0
- package/src/action.ts +5 -1
- package/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/src/agent/harness/runner.ts +5 -0
- package/src/agent/production-agent.ts +33 -0
- package/src/agent/run-loop-with-resume.ts +5 -0
- package/src/agent/run-manager.ts +126 -1
- package/src/agent/thread-data-builder.ts +47 -2
- package/src/agent/types.ts +2 -0
- package/src/chat-threads/store.ts +4 -5
- package/src/cli/create.ts +1139 -65
- package/src/cli/design-connect.ts +3 -7
- package/src/cli/index.ts +5 -3
- package/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/src/client/AssistantChat.tsx +27 -16
- package/src/client/agent-chat-adapter.ts +24 -0
- package/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/src/client/chat/index.ts +1 -0
- package/src/client/chat/message-components.tsx +104 -1
- package/src/client/chat/run-recovery.tsx +15 -3
- package/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/src/client/embed-auth.ts +2 -0
- package/src/client/org/InvitationBanner.tsx +14 -1
- package/src/client/org/OrgSwitcher.tsx +23 -0
- package/src/client/org/TeamPage.tsx +130 -0
- package/src/client/org/WorkspaceNotice.tsx +85 -0
- package/src/client/org/hooks.ts +14 -0
- package/src/client/org/index.ts +2 -0
- package/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/src/client/resources/ResourcesPanel.tsx +134 -51
- package/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/src/client/resources/use-resources.ts +6 -0
- package/src/client/use-action.ts +3 -1
- package/src/client/widgets/index.ts +1 -0
- package/src/coding-tools/run-code.ts +2 -1
- package/src/db/client.ts +28 -4
- package/src/deploy/build.ts +31 -3
- package/src/eject/remote-mcp-presets.ts +1 -1
- package/src/index.browser.ts +1 -0
- package/src/index.ts +1 -0
- package/src/integrations/google-docs-poller.ts +3 -0
- package/src/integrations/webhook-handler.ts +28 -11
- package/src/jobs/scheduler.ts +4 -0
- package/src/localization/default-messages.ts +3 -2
- package/src/mcp/build-server.ts +20 -2
- package/src/observability/traces.ts +48 -12
- package/src/org/handlers.ts +52 -1
- package/src/org/migrations.ts +4 -0
- package/src/org/plugin.ts +14 -0
- package/src/org/schema.ts +1 -0
- package/src/org/types.ts +8 -0
- package/src/org/workspace-url.ts +74 -0
- package/src/resources/handlers.ts +35 -5
- package/src/scripts/runner.ts +183 -5
- package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +2 -1
- package/src/server/action-routes.ts +32 -2
- package/src/server/agent-chat-plugin.ts +29 -0
- package/src/server/agent-teams.ts +10 -1
- package/src/server/auth.ts +33 -7
- package/src/server/embed-route.ts +9 -0
- package/src/server/embed-session.ts +62 -3
- package/src/server/open-route.ts +20 -6
- package/src/server/prompts/framework-core-compact.ts +1 -1
- package/src/server/prompts/framework-core.ts +1 -0
- package/src/server/request-context.ts +36 -1
- package/src/shared/embed-auth.ts +1 -0
- package/src/shared/html-document.ts +115 -0
- package/src/shared/index.ts +1 -0
- package/src/sharing/access.ts +8 -1
- package/src/sharing/registry.ts +11 -2
- package/src/workspace-files/actions.ts +100 -0
- package/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-can-preview-designs-in-responsive-device-sizes.md +0 -6
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-opens-a-full-screen-responsive-preview-wit.md +0 -6
|
@@ -168,6 +168,11 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
168
168
|
'[data-agent-native-empty-text-editing="true"] [data-agent-native-edit-overlay="selection"]{display:none!important}' +
|
|
169
169
|
"[data-agent-native-text-editing]{outline:none!important;outline-offset:0!important}" +
|
|
170
170
|
"[data-agent-native-edge-handle],[data-agent-native-edit-handle],[data-agent-native-rotate-handle]{transition:width 150ms ease-out,height 150ms ease-out,border-width 150ms ease-out,top 150ms ease-out,bottom 150ms ease-out,left 150ms ease-out,right 150ms ease-out}" +
|
|
171
|
+
// Locked layers get a neutral dashed hairline instead of an accent one:
|
|
172
|
+
// accent means "selected" everywhere else in the canvas chrome, and a
|
|
173
|
+
// locked layer is usually neither selected nor selectable. The width
|
|
174
|
+
// rides the chrome line scale so it stays one screen pixel at any zoom.
|
|
175
|
+
'[data-agent-native-runtime-locked="true"]{outline:calc(1px * var(--agent-native-editor-chrome-line-scale, 1)) dashed rgba(148,163,184,0.9)!important;outline-offset:0!important;cursor:not-allowed!important}' +
|
|
171
176
|
"[data-agent-native-spacing-line]{position:absolute;display:none;pointer-events:none;border-radius:999px}" +
|
|
172
177
|
"[data-agent-native-spacing-region]{position:absolute;display:none;box-sizing:border-box;pointer-events:auto;background-size:6px 6px}" +
|
|
173
178
|
'[data-agent-native-spacing-region][data-orientation="vertical"]{cursor:ew-resize}' +
|
|
@@ -426,13 +431,168 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
426
431
|
}
|
|
427
432
|
|
|
428
433
|
/**
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
434
|
+
* Resolve a DOM element to the authored source site exposed by its framework
|
|
435
|
+
* dev runtime, read-only, so the editor and coding agent anchor to evidence
|
|
436
|
+
* instead of a selector guess. Explicit data-source-* / data-loc attributes
|
|
437
|
+
* still win at the call sites below.
|
|
438
|
+
*
|
|
439
|
+
* React tiers:
|
|
440
|
+
* • React <=18 — the structured `_debugSource` fiber field (authored file,
|
|
441
|
+
* line and column, emitted by the dev JSX transform).
|
|
442
|
+
* • React 19 — `_debugSource` is gone; parse the `_debugStack` owner stack
|
|
443
|
+
* captured at element creation.
|
|
444
|
+
* Vue's dev compiler exposes `vnode.props.__v_inspector`; Svelte's dev
|
|
445
|
+
* compiler exposes `element.__svelte_meta.loc`. Both are authored compiler
|
|
446
|
+
* coordinates. When a runtime omits its dev metadata, report WHY
|
|
447
|
+
* (`unavailableReason`) instead of guessing.
|
|
448
|
+
*
|
|
449
|
+
* `sourceFile`/`line`/`column` are the element's OWN authoring site (a button
|
|
450
|
+
* inside Card.jsx always resolves to Card.jsx). `owner*` is where the nearest
|
|
451
|
+
* enclosing component was instantiated — `<Card …>` in the parent — which is
|
|
452
|
+
* what separates a directly-authored instance from `.map()`-produced ones.
|
|
453
|
+
* All `.map()` siblings share one owner site, so `ownerKey` (their React key)
|
|
454
|
+
* is the only source-derived signal that tells them apart.
|
|
455
|
+
*
|
|
456
|
+
* TRAP: a `_debugStack` frame points into the file the dev server SERVES, so
|
|
457
|
+
* under a transforming dev server (Vite's React plugin, Next.js) its line is
|
|
458
|
+
* the transformed line, not the authored one — `_debugSource` and
|
|
459
|
+
* data-source-* attributes are authored coordinates. React 19 has ONLY the
|
|
460
|
+
* stack tier, so this is the common case, not the corner: on the React 19.2 +
|
|
461
|
+
* Vite 8 target an `<h1>` authored at line 13 reports as line 26. That is why
|
|
462
|
+
* every result carries `method`, and why nothing downstream may present a
|
|
463
|
+
* `debug-stack` position as the authored JSX line.
|
|
464
|
+
*
|
|
465
|
+
* Keep in sync with ../../../pages/design-editor/source-location.ts (the
|
|
466
|
+
* unit-tested parser) and source-location.bridge.ts; bridge files may not
|
|
467
|
+
* import, so the parsing is duplicated by hand.
|
|
435
468
|
*/
|
|
469
|
+
var PROVENANCE_NOISE_SEGMENTS: Record<string, true> = {
|
|
470
|
+
node_modules: true,
|
|
471
|
+
dist: true,
|
|
472
|
+
build: true,
|
|
473
|
+
".next": true,
|
|
474
|
+
public: true,
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
function isProvenanceNoisePath(path: string): boolean {
|
|
478
|
+
var segments = path.split("/");
|
|
479
|
+
for (var i = 0; i < segments.length; i += 1) {
|
|
480
|
+
if (PROVENANCE_NOISE_SEGMENTS[segments[i]!]) return true;
|
|
481
|
+
if (segments[i] === "_next" && segments[i + 1] === "static") return true;
|
|
482
|
+
}
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// webpack-internal:/// (webpack/Next.js/CRA), Vite's /@fs/ absolute serving,
|
|
487
|
+
// plain http(s) dev-server paths and file: URLs all reduce to one path here.
|
|
488
|
+
function resolveProvenanceFrameUrl(rawUrl: string): string | null {
|
|
489
|
+
if (rawUrl.indexOf("webpack-internal:///") === 0) {
|
|
490
|
+
var webpackPath = rawUrl
|
|
491
|
+
.slice("webpack-internal:///".length)
|
|
492
|
+
.replace(/^\.\//, "");
|
|
493
|
+
return webpackPath || null;
|
|
494
|
+
}
|
|
495
|
+
try {
|
|
496
|
+
var url = new URL(rawUrl);
|
|
497
|
+
var path = decodeURIComponent(url.pathname);
|
|
498
|
+
if (path.indexOf("/@fs/") === 0) {
|
|
499
|
+
path = path.slice("/@fs".length);
|
|
500
|
+
} else if (url.protocol !== "file:") {
|
|
501
|
+
path = path.replace(/^\/+/, "");
|
|
502
|
+
}
|
|
503
|
+
return path || null;
|
|
504
|
+
} catch (_error) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
var PROVENANCE_STACK_FRAME_RE =
|
|
510
|
+
/^\s*at\s+(?:([^\s(]+)\s+\()?([^()\s][^()]*?):(\d+):(\d+)\)?\s*$/;
|
|
511
|
+
|
|
512
|
+
function parseProvenanceStackFrame(lineText: string): {
|
|
513
|
+
sourceFile: string;
|
|
514
|
+
line: number;
|
|
515
|
+
column: number;
|
|
516
|
+
functionName?: string;
|
|
517
|
+
} | null {
|
|
518
|
+
var match = PROVENANCE_STACK_FRAME_RE.exec(lineText);
|
|
519
|
+
if (!match) return null;
|
|
520
|
+
var sourceFile = resolveProvenanceFrameUrl(match[2]!);
|
|
521
|
+
if (!sourceFile || isProvenanceNoisePath(sourceFile)) return null;
|
|
522
|
+
var line = parseInt(match[3]!, 10);
|
|
523
|
+
var column = parseInt(match[4]!, 10);
|
|
524
|
+
if (!isFinite(line) || !isFinite(column)) return null;
|
|
525
|
+
return {
|
|
526
|
+
sourceFile: sourceFile,
|
|
527
|
+
line: line,
|
|
528
|
+
column: column,
|
|
529
|
+
functionName: match[1] || undefined,
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function fiberDebugLocation(fiber: any): {
|
|
534
|
+
sourceFile: string;
|
|
535
|
+
line: number;
|
|
536
|
+
column?: number;
|
|
537
|
+
functionName?: string;
|
|
538
|
+
structured: boolean;
|
|
539
|
+
} | null {
|
|
540
|
+
var source =
|
|
541
|
+
fiber._debugSource ||
|
|
542
|
+
(fiber._debugInfo && fiber._debugInfo.source) ||
|
|
543
|
+
(fiber.stateNode && fiber.stateNode._debugSource) ||
|
|
544
|
+
(fiber.elementType && fiber.elementType._debugSource);
|
|
545
|
+
if (source && source.fileName) {
|
|
546
|
+
return {
|
|
547
|
+
sourceFile: source.fileName,
|
|
548
|
+
line: source.lineNumber,
|
|
549
|
+
column: source.columnNumber,
|
|
550
|
+
structured: true,
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
var stack =
|
|
554
|
+
(fiber._debugStack && fiber._debugStack.stack) ||
|
|
555
|
+
(fiber._debugInfo && fiber._debugInfo.stack) ||
|
|
556
|
+
(fiber.stateNode &&
|
|
557
|
+
fiber.stateNode._debugStack &&
|
|
558
|
+
fiber.stateNode._debugStack.stack);
|
|
559
|
+
if (!stack) return null;
|
|
560
|
+
var lines = String(stack).split("\n");
|
|
561
|
+
for (var index = 0; index < lines.length; index += 1) {
|
|
562
|
+
var parsed = parseProvenanceStackFrame(lines[index]!);
|
|
563
|
+
if (parsed) {
|
|
564
|
+
return {
|
|
565
|
+
sourceFile: parsed.sourceFile,
|
|
566
|
+
line: parsed.line,
|
|
567
|
+
column: parsed.column,
|
|
568
|
+
functionName: parsed.functionName,
|
|
569
|
+
structured: false,
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
type FrameworkDebugProvenance = {
|
|
577
|
+
framework?: "react" | "vue" | "svelte";
|
|
578
|
+
sourceFile?: string;
|
|
579
|
+
line?: number;
|
|
580
|
+
column?: number;
|
|
581
|
+
component?: string;
|
|
582
|
+
ownerSourceFile?: string;
|
|
583
|
+
ownerLine?: number;
|
|
584
|
+
ownerColumn?: number;
|
|
585
|
+
ownerComponentName?: string;
|
|
586
|
+
ownerKey?: string;
|
|
587
|
+
// Which tier produced line/column. "debug-stack" is a TRANSFORMED position.
|
|
588
|
+
method?: "debug-source" | "debug-stack" | "vue-inspector" | "svelte-meta";
|
|
589
|
+
// Which tier produced ownerLine/ownerColumn. Tracked separately because an
|
|
590
|
+
// element can carry an authored data-source-* position while its owner site
|
|
591
|
+
// is only reachable through the (transformed) owner stack.
|
|
592
|
+
ownerMethod?: "debug-source" | "debug-stack";
|
|
593
|
+
unavailableReason?: "not-framework" | "no-debug-info";
|
|
594
|
+
};
|
|
595
|
+
|
|
436
596
|
// Fiber debug stacks are immutable for the lifetime of a mounted host node.
|
|
437
597
|
// Keep the relatively expensive Object.keys + owner walk off the snapshot
|
|
438
598
|
// hot path after the first successful read. A WeakMap also means React can
|
|
@@ -440,58 +600,190 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
440
600
|
// before a slow/Suspense hydration attaches Fiber to an existing DOM node.
|
|
441
601
|
var reactDebugProvenanceCache =
|
|
442
602
|
typeof WeakMap !== "undefined"
|
|
443
|
-
? new WeakMap<Element,
|
|
603
|
+
? new WeakMap<Element, FrameworkDebugProvenance>()
|
|
444
604
|
: null;
|
|
445
605
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
606
|
+
var REACT_FIBER_KEY_PREFIXES = [
|
|
607
|
+
"__reactFiber$",
|
|
608
|
+
"__reactInternalInstance$",
|
|
609
|
+
"__reactInternalFiberCurrent$",
|
|
610
|
+
"__reactInternalFiber$",
|
|
611
|
+
];
|
|
612
|
+
|
|
613
|
+
function reactFiberOf(el: Element): any {
|
|
614
|
+
var keys = Object.keys(el);
|
|
615
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
616
|
+
for (var j = 0; j < REACT_FIBER_KEY_PREFIXES.length; j += 1) {
|
|
617
|
+
if (keys[i]!.indexOf(REACT_FIBER_KEY_PREFIXES[j]!) === 0) {
|
|
618
|
+
return (el as unknown as Record<string, any>)[keys[i]!];
|
|
619
|
+
}
|
|
452
620
|
}
|
|
453
|
-
|
|
621
|
+
}
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function reactDebugProvenance(el: Element): FrameworkDebugProvenance {
|
|
454
626
|
var cached = reactDebugProvenanceCache?.get(el);
|
|
455
627
|
if (cached !== undefined) return cached;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
628
|
+
// Deliberately no climb to an ancestor's fiber: this runs over every node
|
|
629
|
+
// in the runtime snapshot, and borrowing a parent's location would stamp a
|
|
630
|
+
// non-React node with a source line that is not its own.
|
|
631
|
+
var leafFiber = reactFiberOf(el);
|
|
632
|
+
if (!leafFiber) return { unavailableReason: "not-framework" };
|
|
633
|
+
|
|
634
|
+
var elementLocation: ReturnType<typeof fiberDebugLocation> = null;
|
|
635
|
+
var componentFiber: any = null;
|
|
636
|
+
var fiber = leafFiber;
|
|
461
637
|
for (var depth = 0; fiber && depth < 12; depth += 1) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
638
|
+
if (!elementLocation) elementLocation = fiberDebugLocation(fiber);
|
|
639
|
+
if (
|
|
640
|
+
!componentFiber &&
|
|
641
|
+
fiber !== leafFiber &&
|
|
642
|
+
typeof fiber.type === "function"
|
|
643
|
+
) {
|
|
644
|
+
componentFiber = fiber;
|
|
645
|
+
}
|
|
646
|
+
if (elementLocation && componentFiber) break;
|
|
647
|
+
fiber = fiber.return;
|
|
648
|
+
}
|
|
649
|
+
if (!elementLocation) {
|
|
650
|
+
return { framework: "react", unavailableReason: "no-debug-info" };
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
var componentName =
|
|
654
|
+
(componentFiber &&
|
|
655
|
+
componentFiber.type &&
|
|
656
|
+
(componentFiber.type.displayName || componentFiber.type.name)) ||
|
|
657
|
+
elementLocation.functionName ||
|
|
658
|
+
undefined;
|
|
659
|
+
var provenance: FrameworkDebugProvenance = {
|
|
660
|
+
framework: "react",
|
|
661
|
+
sourceFile: elementLocation.sourceFile,
|
|
662
|
+
line: elementLocation.line,
|
|
663
|
+
column: elementLocation.column,
|
|
664
|
+
component: componentName,
|
|
665
|
+
method: elementLocation.structured ? "debug-source" : "debug-stack",
|
|
666
|
+
};
|
|
667
|
+
if (componentFiber) {
|
|
668
|
+
var ownerLocation = fiberDebugLocation(componentFiber);
|
|
669
|
+
if (ownerLocation) {
|
|
670
|
+
provenance.ownerSourceFile = ownerLocation.sourceFile;
|
|
671
|
+
provenance.ownerLine = ownerLocation.line;
|
|
672
|
+
provenance.ownerColumn = ownerLocation.column;
|
|
673
|
+
provenance.ownerComponentName = componentName;
|
|
674
|
+
provenance.ownerMethod = ownerLocation.structured
|
|
675
|
+
? "debug-source"
|
|
676
|
+
: "debug-stack";
|
|
677
|
+
}
|
|
678
|
+
if (typeof componentFiber.key === "string" && componentFiber.key) {
|
|
679
|
+
provenance.ownerKey = componentFiber.key;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
reactDebugProvenanceCache?.set(el, provenance);
|
|
683
|
+
return provenance;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function parseFrameworkDataLoc(
|
|
687
|
+
value: string,
|
|
688
|
+
): { sourceFile: string; line: number; column?: number } | null {
|
|
689
|
+
var lastColon = value.lastIndexOf(":");
|
|
690
|
+
if (lastColon < 0) return null;
|
|
691
|
+
var lastPart = value.slice(lastColon + 1);
|
|
692
|
+
if (!/^\d+$/.test(lastPart)) return null;
|
|
693
|
+
var beforeLast = value.slice(0, lastColon);
|
|
694
|
+
var previousColon = beforeLast.lastIndexOf(":");
|
|
695
|
+
var previousPart =
|
|
696
|
+
previousColon >= 0 ? beforeLast.slice(previousColon + 1) : "";
|
|
697
|
+
var hasColumn = /^\d+$/.test(previousPart);
|
|
698
|
+
var sourceFile = (
|
|
699
|
+
hasColumn ? beforeLast.slice(0, previousColon) : beforeLast
|
|
700
|
+
).trim();
|
|
701
|
+
var line = parseInt(hasColumn ? previousPart : lastPart, 10);
|
|
702
|
+
var column = hasColumn ? parseInt(lastPart, 10) : undefined;
|
|
703
|
+
if (!sourceFile || !isFinite(line)) return null;
|
|
704
|
+
if (column !== undefined && !isFinite(column)) return null;
|
|
705
|
+
return { sourceFile: sourceFile, line: line, column: column };
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function vueDebugProvenance(el: Element): FrameworkDebugProvenance | null {
|
|
709
|
+
var node: any = el;
|
|
710
|
+
var sawVue = false;
|
|
711
|
+
for (var depth = 0; node && depth < 8; depth += 1) {
|
|
712
|
+
var vnode = node.__vnode;
|
|
713
|
+
var component = node.__vueParentComponent;
|
|
714
|
+
if (vnode || component) sawVue = true;
|
|
715
|
+
var inspector =
|
|
716
|
+
vnode && vnode.props && typeof vnode.props.__v_inspector === "string"
|
|
717
|
+
? vnode.props.__v_inspector
|
|
718
|
+
: null;
|
|
719
|
+
if (inspector) {
|
|
720
|
+
var parsed = parseFrameworkDataLoc(inspector);
|
|
721
|
+
if (parsed) {
|
|
722
|
+
var componentType =
|
|
723
|
+
(component && component.type) || (vnode && vnode.type);
|
|
724
|
+
return {
|
|
725
|
+
framework: "vue",
|
|
726
|
+
sourceFile: parsed.sourceFile,
|
|
727
|
+
line: parsed.line,
|
|
728
|
+
column: parsed.column,
|
|
729
|
+
component:
|
|
730
|
+
componentType &&
|
|
731
|
+
(componentType.name ||
|
|
732
|
+
componentType.__name ||
|
|
733
|
+
componentType.displayName),
|
|
734
|
+
method: "vue-inspector",
|
|
485
735
|
};
|
|
486
|
-
reactDebugProvenanceCache?.set(el, provenance);
|
|
487
|
-
return provenance;
|
|
488
|
-
} catch (_error) {
|
|
489
|
-
// Ignore malformed/non-URL debug frames and keep walking owners.
|
|
490
736
|
}
|
|
491
737
|
}
|
|
492
|
-
|
|
738
|
+
node = node.parentElement;
|
|
739
|
+
}
|
|
740
|
+
return sawVue
|
|
741
|
+
? { framework: "vue", unavailableReason: "no-debug-info" }
|
|
742
|
+
: null;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
function svelteDebugProvenance(el: Element): FrameworkDebugProvenance | null {
|
|
746
|
+
var node: any = el;
|
|
747
|
+
var sawSvelte = false;
|
|
748
|
+
for (var depth = 0; node && depth < 8; depth += 1) {
|
|
749
|
+
var meta = node.__svelte_meta;
|
|
750
|
+
if (meta) sawSvelte = true;
|
|
751
|
+
var loc = meta && meta.loc;
|
|
752
|
+
var sourceFile = loc && (loc.file || loc.filename);
|
|
753
|
+
var line = loc && Number(loc.line);
|
|
754
|
+
var column = loc && Number(loc.column);
|
|
755
|
+
if (sourceFile && isFinite(line)) {
|
|
756
|
+
return {
|
|
757
|
+
framework: "svelte",
|
|
758
|
+
sourceFile: String(sourceFile),
|
|
759
|
+
line: line,
|
|
760
|
+
column: isFinite(column) ? column : undefined,
|
|
761
|
+
component:
|
|
762
|
+
typeof meta.component === "string"
|
|
763
|
+
? meta.component
|
|
764
|
+
: typeof meta.name === "string"
|
|
765
|
+
? meta.name
|
|
766
|
+
: undefined,
|
|
767
|
+
method: "svelte-meta",
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
node = node.parentElement;
|
|
771
|
+
}
|
|
772
|
+
return sawSvelte
|
|
773
|
+
? { framework: "svelte", unavailableReason: "no-debug-info" }
|
|
774
|
+
: null;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function frameworkDebugProvenance(el: Element): FrameworkDebugProvenance {
|
|
778
|
+
var react = reactDebugProvenance(el);
|
|
779
|
+
if (react.sourceFile || react.unavailableReason === "no-debug-info") {
|
|
780
|
+
return react;
|
|
493
781
|
}
|
|
494
|
-
|
|
782
|
+
var vue = vueDebugProvenance(el);
|
|
783
|
+
if (vue) return vue;
|
|
784
|
+
var svelte = svelteDebugProvenance(el);
|
|
785
|
+
if (svelte) return svelte;
|
|
786
|
+
return { unavailableReason: "not-framework" };
|
|
495
787
|
}
|
|
496
788
|
|
|
497
789
|
var runtimeLayerSnapshotTimer: number | null = null;
|
|
@@ -533,8 +825,8 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
533
825
|
function ensureRuntimeLayerNodeId(el: Element): string {
|
|
534
826
|
var existing = el.getAttribute("data-agent-native-node-id")?.trim();
|
|
535
827
|
if (existing) return existing;
|
|
536
|
-
var provenance =
|
|
537
|
-
var provenanceKey = provenance
|
|
828
|
+
var provenance = frameworkDebugProvenance(el);
|
|
829
|
+
var provenanceKey = provenance.sourceFile
|
|
538
830
|
? [
|
|
539
831
|
provenance.sourceFile,
|
|
540
832
|
provenance.line,
|
|
@@ -692,10 +984,18 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
692
984
|
ensureRuntimeLayerNodeId(sourceNode),
|
|
693
985
|
);
|
|
694
986
|
inlineSnapshotComputedStyle(sourceNode, cloneNode);
|
|
695
|
-
var provenance =
|
|
696
|
-
if (provenance) {
|
|
987
|
+
var provenance = frameworkDebugProvenance(sourceNode);
|
|
988
|
+
if (provenance.sourceFile) {
|
|
989
|
+
if (provenance.framework) {
|
|
990
|
+
cloneNode.setAttribute("data-source-framework", provenance.framework);
|
|
991
|
+
}
|
|
697
992
|
cloneNode.setAttribute("data-source-file", provenance.sourceFile);
|
|
698
993
|
cloneNode.setAttribute("data-source-line", String(provenance.line));
|
|
994
|
+
// Without this the projection would read a stack-derived (transformed)
|
|
995
|
+
// line back out through data-source-*, i.e. as an authored one.
|
|
996
|
+
if (provenance.method) {
|
|
997
|
+
cloneNode.setAttribute("data-source-method", provenance.method);
|
|
998
|
+
}
|
|
699
999
|
if (provenance.column) {
|
|
700
1000
|
cloneNode.setAttribute(
|
|
701
1001
|
"data-source-column",
|
|
@@ -705,6 +1005,48 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
705
1005
|
if (provenance.component) {
|
|
706
1006
|
cloneNode.setAttribute("data-component-name", provenance.component);
|
|
707
1007
|
}
|
|
1008
|
+
if (provenance.ownerSourceFile) {
|
|
1009
|
+
cloneNode.setAttribute(
|
|
1010
|
+
"data-source-owner-file",
|
|
1011
|
+
provenance.ownerSourceFile,
|
|
1012
|
+
);
|
|
1013
|
+
cloneNode.setAttribute(
|
|
1014
|
+
"data-source-owner-line",
|
|
1015
|
+
String(provenance.ownerLine),
|
|
1016
|
+
);
|
|
1017
|
+
if (provenance.ownerColumn) {
|
|
1018
|
+
cloneNode.setAttribute(
|
|
1019
|
+
"data-source-owner-column",
|
|
1020
|
+
String(provenance.ownerColumn),
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
if (provenance.ownerComponentName) {
|
|
1024
|
+
cloneNode.setAttribute(
|
|
1025
|
+
"data-source-owner-component",
|
|
1026
|
+
provenance.ownerComponentName,
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
// Same trap as data-source-method: without the owner's own tier the
|
|
1030
|
+
// projection would read a stack-derived owner line as an authored one.
|
|
1031
|
+
if (provenance.ownerMethod) {
|
|
1032
|
+
cloneNode.setAttribute(
|
|
1033
|
+
"data-source-owner-method",
|
|
1034
|
+
provenance.ownerMethod,
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
// The only source-derived signal that separates `.map()` siblings,
|
|
1039
|
+
// which all share one owner call site.
|
|
1040
|
+
if (provenance.ownerKey) {
|
|
1041
|
+
cloneNode.setAttribute("data-source-owner-key", provenance.ownerKey);
|
|
1042
|
+
}
|
|
1043
|
+
} else if (provenance.unavailableReason) {
|
|
1044
|
+
// Absent must stay distinguishable from not-loaded-yet downstream, so
|
|
1045
|
+
// record why this node has no location instead of dropping the fact.
|
|
1046
|
+
cloneNode.setAttribute(
|
|
1047
|
+
"data-source-unavailable",
|
|
1048
|
+
provenance.unavailableReason,
|
|
1049
|
+
);
|
|
708
1050
|
}
|
|
709
1051
|
nodeCount += 1;
|
|
710
1052
|
}
|
|
@@ -1502,19 +1844,13 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
1502
1844
|
});
|
|
1503
1845
|
}
|
|
1504
1846
|
// --- provenance: read explicit source-location attributes when present,
|
|
1505
|
-
// then fall back to
|
|
1506
|
-
var provenance:
|
|
1507
|
-
| {
|
|
1508
|
-
sourceFile?: string;
|
|
1509
|
-
line?: number;
|
|
1510
|
-
column?: number;
|
|
1511
|
-
component?: string;
|
|
1512
|
-
}
|
|
1513
|
-
| undefined = undefined;
|
|
1847
|
+
// then fall back to framework dev-runtime metadata. ---
|
|
1848
|
+
var provenance: FrameworkDebugProvenance | undefined = undefined;
|
|
1514
1849
|
var dataSourceFile = el.getAttribute("data-source-file");
|
|
1515
1850
|
var dataSourceLine = el.getAttribute("data-source-line");
|
|
1516
1851
|
var dataSourceColumn = el.getAttribute("data-source-column");
|
|
1517
1852
|
var dataComponentName = el.getAttribute("data-component-name");
|
|
1853
|
+
var dataSourceFramework = el.getAttribute("data-source-framework");
|
|
1518
1854
|
var dataLoc = el.getAttribute("data-loc");
|
|
1519
1855
|
// data-loc may encode "file:line:col" (Babel source plugin convention).
|
|
1520
1856
|
// Only parse it when data-source-file is absent, to avoid double-reads.
|
|
@@ -1537,23 +1873,28 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
1537
1873
|
if (hasColumn) dataSourceColumn = lastPart;
|
|
1538
1874
|
}
|
|
1539
1875
|
}
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1876
|
+
// Always consult runtime metadata, even when a source plugin already
|
|
1877
|
+
// stamped data-source-*. For React those attributes describe the element's
|
|
1878
|
+
// OWN site and never the owner call site, which is the only thing that
|
|
1879
|
+
// separates `.map()` siblings. The attribute tier still wins below.
|
|
1880
|
+
var hadDataSourceFile = !!dataSourceFile;
|
|
1881
|
+
var frameworkProvenance: FrameworkDebugProvenance =
|
|
1882
|
+
frameworkDebugProvenance(el);
|
|
1883
|
+
if (!hadDataSourceFile && frameworkProvenance.sourceFile) {
|
|
1884
|
+
dataSourceFile = frameworkProvenance.sourceFile;
|
|
1885
|
+
dataSourceLine = String(frameworkProvenance.line);
|
|
1886
|
+
dataSourceColumn = frameworkProvenance.column
|
|
1887
|
+
? String(frameworkProvenance.column)
|
|
1888
|
+
: null;
|
|
1889
|
+
dataComponentName =
|
|
1890
|
+
dataComponentName || frameworkProvenance.component || null;
|
|
1551
1891
|
}
|
|
1552
1892
|
if (
|
|
1553
1893
|
dataSourceFile ||
|
|
1554
1894
|
dataSourceLine ||
|
|
1555
1895
|
dataSourceColumn ||
|
|
1556
|
-
dataComponentName
|
|
1896
|
+
dataComponentName ||
|
|
1897
|
+
frameworkProvenance.unavailableReason
|
|
1557
1898
|
) {
|
|
1558
1899
|
provenance = {};
|
|
1559
1900
|
if (dataSourceFile) provenance.sourceFile = dataSourceFile;
|
|
@@ -1566,6 +1907,49 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
1566
1907
|
if (!isNaN(col)) provenance.column = col;
|
|
1567
1908
|
}
|
|
1568
1909
|
if (dataComponentName) provenance.component = dataComponentName;
|
|
1910
|
+
// Which tier the line/column above actually came from. An attribute-borne
|
|
1911
|
+
// location is authored by that transform's convention unless it says
|
|
1912
|
+
// otherwise; a fiber one is only authored on the `_debugSource` tier.
|
|
1913
|
+
if (dataSourceFile) {
|
|
1914
|
+
var declaredMethod = el.getAttribute("data-source-method");
|
|
1915
|
+
provenance.method =
|
|
1916
|
+
declaredMethod === "debug-source" ||
|
|
1917
|
+
declaredMethod === "debug-stack" ||
|
|
1918
|
+
declaredMethod === "vue-inspector" ||
|
|
1919
|
+
declaredMethod === "svelte-meta"
|
|
1920
|
+
? declaredMethod
|
|
1921
|
+
: hadDataSourceFile
|
|
1922
|
+
? "data-attribute"
|
|
1923
|
+
: frameworkProvenance.method || "data-attribute";
|
|
1924
|
+
}
|
|
1925
|
+
provenance.framework =
|
|
1926
|
+
dataSourceFramework === "react" ||
|
|
1927
|
+
dataSourceFramework === "vue" ||
|
|
1928
|
+
dataSourceFramework === "svelte" ||
|
|
1929
|
+
dataSourceFramework === "html"
|
|
1930
|
+
? dataSourceFramework
|
|
1931
|
+
: hadDataSourceFile
|
|
1932
|
+
? frameworkProvenance.framework || "html"
|
|
1933
|
+
: frameworkProvenance.framework;
|
|
1934
|
+
if (frameworkProvenance.ownerSourceFile) {
|
|
1935
|
+
provenance.ownerSourceFile = frameworkProvenance.ownerSourceFile;
|
|
1936
|
+
provenance.ownerLine = frameworkProvenance.ownerLine;
|
|
1937
|
+
provenance.ownerColumn = frameworkProvenance.ownerColumn;
|
|
1938
|
+
provenance.ownerComponentName = frameworkProvenance.ownerComponentName;
|
|
1939
|
+
// The owner's own tier: on a source-plugin element `method` is the
|
|
1940
|
+
// attribute's authored position while this one is the owner stack's
|
|
1941
|
+
// transformed line, so they must not share a single field.
|
|
1942
|
+
provenance.ownerMethod = frameworkProvenance.ownerMethod;
|
|
1943
|
+
}
|
|
1944
|
+
if (frameworkProvenance.ownerKey) {
|
|
1945
|
+
provenance.ownerKey = frameworkProvenance.ownerKey;
|
|
1946
|
+
}
|
|
1947
|
+
// Why there is no location, so the editor can say "this app exposes no
|
|
1948
|
+
// debug info" instead of "still loading". Never alongside a resolved
|
|
1949
|
+
// location — a plugin-stamped element on a non-React page has one.
|
|
1950
|
+
if (!dataSourceFile && frameworkProvenance.unavailableReason) {
|
|
1951
|
+
provenance.unavailableReason = frameworkProvenance.unavailableReason;
|
|
1952
|
+
}
|
|
1569
1953
|
}
|
|
1570
1954
|
return {
|
|
1571
1955
|
tagName: el.tagName.toLowerCase(),
|
|
@@ -2430,20 +2814,36 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
2430
2814
|
{
|
|
2431
2815
|
requestId: string;
|
|
2432
2816
|
el: Element;
|
|
2433
|
-
target: { anchor: Element; placement: string; axis?: string };
|
|
2434
|
-
origin:
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2817
|
+
target: { anchor: Element; placement: string; axis?: string } | null;
|
|
2818
|
+
origin:
|
|
2819
|
+
| {
|
|
2820
|
+
prevParent: Element;
|
|
2821
|
+
prevNextSibling: Node | null;
|
|
2822
|
+
// Inline position/left/top/right/bottom VALUES captured right before
|
|
2823
|
+
// the optimistic reorder's stripAbsolutePositioningForFlowInsert ran
|
|
2824
|
+
// (absent/undefined when that strip did not apply — e.g. an
|
|
2825
|
+
// absolute-container drop, or a flow-reorder of an already-flow
|
|
2826
|
+
// element with nothing to strip). Restored by the visual-structure-ack
|
|
2827
|
+
// failure branch alongside the parent/sibling revert so a rejected
|
|
2828
|
+
// move-node round-trip cannot leave the element stripped of its
|
|
2829
|
+
// absolute positioning while stuck in the wrong parent.
|
|
2830
|
+
prevInlinePositionStyles?: Record<string, string> | null;
|
|
2831
|
+
}
|
|
2832
|
+
// A host-driven insert has no previous position to restore: the
|
|
2833
|
+
// element did not exist before this request, so a rejected/undone
|
|
2834
|
+
// round-trip must REMOVE it. Restoring a prevParent it never had is
|
|
2835
|
+
// what would leave an orphan node behind after Cmd+Z.
|
|
2836
|
+
| { inserted: true }
|
|
2837
|
+
// A host-driven delete. The DETACHED element is kept alive here so an
|
|
2838
|
+
// undone deletion re-attaches the real node — with its live React
|
|
2839
|
+
// state, listeners and children — instead of re-parsing a sanitized
|
|
2840
|
+
// snapshot of what it used to look like.
|
|
2841
|
+
| {
|
|
2842
|
+
removed: true;
|
|
2843
|
+
prevParent: Element;
|
|
2844
|
+
prevNextSibling: Node | null;
|
|
2845
|
+
}
|
|
2846
|
+
| null;
|
|
2447
2847
|
}
|
|
2448
2848
|
> = {};
|
|
2449
2849
|
var pendingShieldDrag: {
|
|
@@ -2677,7 +3077,12 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
2677
3077
|
);
|
|
2678
3078
|
}
|
|
2679
3079
|
|
|
2680
|
-
|
|
3080
|
+
// Both layer states are painted here, from the one `layer-states` message,
|
|
3081
|
+
// so every call site that re-runs after a runtime document swap restores
|
|
3082
|
+
// hide AND lock together. Locked paints an attribute only; the hairline
|
|
3083
|
+
// treatment lives in the editor chrome stylesheet so it is stripped from
|
|
3084
|
+
// runtimeHeadHtmlWithoutEditorChrome and never reaches source or export.
|
|
3085
|
+
function applyLayerStateSelectors(): void {
|
|
2681
3086
|
document
|
|
2682
3087
|
.querySelectorAll("[data-agent-native-runtime-hidden]")
|
|
2683
3088
|
.forEach(function (el: HTMLElement) {
|
|
@@ -2704,6 +3109,18 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
2704
3109
|
});
|
|
2705
3110
|
} catch (_err) {}
|
|
2706
3111
|
});
|
|
3112
|
+
document
|
|
3113
|
+
.querySelectorAll("[data-agent-native-runtime-locked]")
|
|
3114
|
+
.forEach(function (el) {
|
|
3115
|
+
el.removeAttribute("data-agent-native-runtime-locked");
|
|
3116
|
+
});
|
|
3117
|
+
lockedSelectors.forEach(function (selector) {
|
|
3118
|
+
try {
|
|
3119
|
+
document.querySelectorAll(selector).forEach(function (el) {
|
|
3120
|
+
el.setAttribute("data-agent-native-runtime-locked", "true");
|
|
3121
|
+
});
|
|
3122
|
+
} catch (_err) {}
|
|
3123
|
+
});
|
|
2707
3124
|
}
|
|
2708
3125
|
|
|
2709
3126
|
function replaceRuntimeDocument(
|
|
@@ -2737,7 +3154,7 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
2737
3154
|
? selectorCandidates
|
|
2738
3155
|
: [],
|
|
2739
3156
|
};
|
|
2740
|
-
|
|
3157
|
+
applyLayerStateSelectors();
|
|
2741
3158
|
refreshOverlays();
|
|
2742
3159
|
return;
|
|
2743
3160
|
}
|
|
@@ -2845,7 +3262,7 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
2845
3262
|
currentMatch.remove();
|
|
2846
3263
|
}
|
|
2847
3264
|
}
|
|
2848
|
-
|
|
3265
|
+
applyLayerStateSelectors();
|
|
2849
3266
|
selectedEl = null;
|
|
2850
3267
|
if (nextMatch) {
|
|
2851
3268
|
try {
|
|
@@ -2883,7 +3300,7 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
2883
3300
|
persistentNodes.forEach(function (node) {
|
|
2884
3301
|
document.body.appendChild(node);
|
|
2885
3302
|
});
|
|
2886
|
-
|
|
3303
|
+
applyLayerStateSelectors();
|
|
2887
3304
|
|
|
2888
3305
|
selectedEl = null;
|
|
2889
3306
|
clearHoverGate();
|
|
@@ -5283,6 +5700,18 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
5283
5700
|
if (match && !isLayerInteractionBlocked(match)) return match;
|
|
5284
5701
|
} catch (_err) {}
|
|
5285
5702
|
}
|
|
5703
|
+
// Last resort: React re-creating a node drops its imperatively stamped
|
|
5704
|
+
// "runtime-" id, and on a client-rendered screen that id is the host's ONLY
|
|
5705
|
+
// identity for the element — so the miss dropped the whole edit while we
|
|
5706
|
+
// still held the selection. ensureRuntimeLayerNodeId is deterministic over
|
|
5707
|
+
// screen + provenance + structural path, so re-stamping restores the SAME id
|
|
5708
|
+
// for the intended element and a different one for anything else.
|
|
5709
|
+
if (selectedEl && document.documentElement.contains(selectedEl)) {
|
|
5710
|
+
try {
|
|
5711
|
+
ensureRuntimeLayerNodeId(selectedEl);
|
|
5712
|
+
if (matchesExactSelectorList(selectedEl, candidates)) return selectedEl;
|
|
5713
|
+
} catch (_err) {}
|
|
5714
|
+
}
|
|
5286
5715
|
return null;
|
|
5287
5716
|
}
|
|
5288
5717
|
|
|
@@ -5464,8 +5893,30 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
5464
5893
|
// is only safe when it identifies exactly one live element. Prefer the
|
|
5465
5894
|
// runtime projection's stable source id and fall back to the selector only
|
|
5466
5895
|
// when that id has no match at all.
|
|
5467
|
-
function findUniqueRuntimeStructureTarget(selector, sourceId) {
|
|
5896
|
+
function findUniqueRuntimeStructureTarget(selector, sourceId, pendingId?) {
|
|
5468
5897
|
var matches = new Set<Element>();
|
|
5898
|
+
// Pending ids are deliberately NOT part of the stable-id list below: they
|
|
5899
|
+
// are minted per hit-test and only ever stamped on the live DOM, so they
|
|
5900
|
+
// must not participate in stored-id resolution. They are still the only
|
|
5901
|
+
// handle a cross-screen drop has on an id-less live anchor.
|
|
5902
|
+
if (typeof pendingId === "string" && pendingId) {
|
|
5903
|
+
try {
|
|
5904
|
+
var pendingMatches = document.querySelectorAll(
|
|
5905
|
+
'[data-an-pending-node-id="' + escapeAttribute(pendingId) + '"]',
|
|
5906
|
+
);
|
|
5907
|
+
if (pendingMatches.length === 1) {
|
|
5908
|
+
var pendingMatch = pendingMatches[0];
|
|
5909
|
+
if (
|
|
5910
|
+
pendingMatch !== document.body &&
|
|
5911
|
+
pendingMatch !== document.documentElement &&
|
|
5912
|
+
!isOverlayElement(pendingMatch) &&
|
|
5913
|
+
!isLayerInteractionBlocked(pendingMatch)
|
|
5914
|
+
) {
|
|
5915
|
+
return pendingMatch;
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5918
|
+
} catch (_err) {}
|
|
5919
|
+
}
|
|
5469
5920
|
if (typeof sourceId === "string" && sourceId) {
|
|
5470
5921
|
var attributes = [
|
|
5471
5922
|
"data-agent-native-node-id",
|
|
@@ -5513,7 +5964,7 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
5513
5964
|
}
|
|
5514
5965
|
}
|
|
5515
5966
|
|
|
5516
|
-
function removeRuntimeTarget(selector, selectorCandidates) {
|
|
5967
|
+
function removeRuntimeTarget(selector, selectorCandidates, requestId?) {
|
|
5517
5968
|
var target = findRuntimeTarget(selector, selectorCandidates);
|
|
5518
5969
|
if (
|
|
5519
5970
|
!target ||
|
|
@@ -5521,6 +5972,23 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
5521
5972
|
target === document.documentElement
|
|
5522
5973
|
)
|
|
5523
5974
|
return false;
|
|
5975
|
+
// A requestId means the host queued this deletion as a pending live edit
|
|
5976
|
+
// and may undo it. Register it in the same pending-move table the drag
|
|
5977
|
+
// path uses so the existing visual-structure-ack channel can put the node
|
|
5978
|
+
// back; without it the ack arrives for an unknown id and Cmd+Z silently
|
|
5979
|
+
// does nothing.
|
|
5980
|
+
if (typeof requestId === "string" && requestId && target.parentElement) {
|
|
5981
|
+
pendingStructureMoves[requestId] = {
|
|
5982
|
+
requestId: requestId,
|
|
5983
|
+
el: target,
|
|
5984
|
+
target: null,
|
|
5985
|
+
origin: {
|
|
5986
|
+
removed: true,
|
|
5987
|
+
prevParent: target.parentElement,
|
|
5988
|
+
prevNextSibling: target.nextSibling,
|
|
5989
|
+
},
|
|
5990
|
+
};
|
|
5991
|
+
}
|
|
5524
5992
|
if (target.parentElement) target.parentElement.removeChild(target);
|
|
5525
5993
|
// T23: the removed subtree may contain the active text-edit element —
|
|
5526
5994
|
// its blur/keydown listeners are gone with it, so exit the session
|
|
@@ -8165,7 +8633,7 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
8165
8633
|
correctAbsoluteMemberClientPosition(el, desiredDropPoint);
|
|
8166
8634
|
}
|
|
8167
8635
|
|
|
8168
|
-
function postVisualStructureChange(el, target, origin) {
|
|
8636
|
+
function postVisualStructureChange(el, target, origin, insertedHtml?) {
|
|
8169
8637
|
if (!el || !target || !target.anchor) return;
|
|
8170
8638
|
dndLog("post:structure-change", {
|
|
8171
8639
|
el: getSelector(el),
|
|
@@ -8192,6 +8660,11 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
8192
8660
|
placement: target.placement,
|
|
8193
8661
|
dropMode: target.dropMode || "flow-insert",
|
|
8194
8662
|
forceFlowPositionOverride: Boolean(target.forceFlowPositionOverride),
|
|
8663
|
+
// Present only when this node did not exist in the running app before
|
|
8664
|
+
// the change. The host must NOT tell the coding agent to relocate an
|
|
8665
|
+
// element the source file has never contained.
|
|
8666
|
+
insertedHtml:
|
|
8667
|
+
typeof insertedHtml === "string" ? insertedHtml : undefined,
|
|
8195
8668
|
sourceRect: rectInfoForElement(el),
|
|
8196
8669
|
anchorRect: rectInfoForElement(target.anchor),
|
|
8197
8670
|
payload: getElementInfo(el),
|
|
@@ -11886,7 +12359,7 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
11886
12359
|
clearHoverGate();
|
|
11887
12360
|
highlightOverlay.style.display = "none";
|
|
11888
12361
|
}
|
|
11889
|
-
|
|
12362
|
+
applyLayerStateSelectors();
|
|
11890
12363
|
return;
|
|
11891
12364
|
}
|
|
11892
12365
|
if (e.data.type === "runtime-structure-move") {
|
|
@@ -11949,6 +12422,147 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
11949
12422
|
postVisualStructureChange(runtimeSubject, runtimeTarget, runtimeOrigin);
|
|
11950
12423
|
return;
|
|
11951
12424
|
}
|
|
12425
|
+
if (e.data.type === "runtime-structure-insert") {
|
|
12426
|
+
var insertRequestId = e.data.requestId;
|
|
12427
|
+
// An insert that silently returns loses the whole gesture with nothing
|
|
12428
|
+
// on screen and nothing in the pending list — strictly worse than a
|
|
12429
|
+
// no-op move, which at least leaves the element where it was. Always
|
|
12430
|
+
// answer the host so it can surface the failure.
|
|
12431
|
+
var rejectInsert = function (reason: string): void {
|
|
12432
|
+
(window.parent as Window).postMessage(
|
|
12433
|
+
{
|
|
12434
|
+
type: "runtime-structure-insert-rejected",
|
|
12435
|
+
screenId: designCanvasScreenId,
|
|
12436
|
+
requestId: insertRequestId,
|
|
12437
|
+
reason: reason,
|
|
12438
|
+
},
|
|
12439
|
+
"*",
|
|
12440
|
+
);
|
|
12441
|
+
};
|
|
12442
|
+
if (readOnly) {
|
|
12443
|
+
rejectInsert("read-only");
|
|
12444
|
+
return;
|
|
12445
|
+
}
|
|
12446
|
+
var insertPlacement = String(e.data.placement || "");
|
|
12447
|
+
if (
|
|
12448
|
+
insertPlacement !== "before" &&
|
|
12449
|
+
insertPlacement !== "after" &&
|
|
12450
|
+
insertPlacement !== "inside"
|
|
12451
|
+
) {
|
|
12452
|
+
rejectInsert("placement");
|
|
12453
|
+
return;
|
|
12454
|
+
}
|
|
12455
|
+
var insertAnchor = findUniqueRuntimeStructureTarget(
|
|
12456
|
+
String(e.data.anchorSelector || ""),
|
|
12457
|
+
typeof e.data.anchorSourceId === "string" ? e.data.anchorSourceId : "",
|
|
12458
|
+
typeof e.data.anchorPendingNodeId === "string"
|
|
12459
|
+
? e.data.anchorPendingNodeId
|
|
12460
|
+
: "",
|
|
12461
|
+
);
|
|
12462
|
+
if (!insertAnchor) {
|
|
12463
|
+
rejectInsert("anchor-unresolved");
|
|
12464
|
+
return;
|
|
12465
|
+
}
|
|
12466
|
+
if (
|
|
12467
|
+
(insertPlacement === "inside" &&
|
|
12468
|
+
!isContainerDropTarget(insertAnchor)) ||
|
|
12469
|
+
(insertPlacement !== "inside" && !insertAnchor.parentElement)
|
|
12470
|
+
) {
|
|
12471
|
+
rejectInsert("placement-unavailable");
|
|
12472
|
+
return;
|
|
12473
|
+
}
|
|
12474
|
+
var parsedInsertEl = parseNodeHtmlPreviewElement(
|
|
12475
|
+
typeof e.data.html === "string" ? e.data.html : "",
|
|
12476
|
+
);
|
|
12477
|
+
if (
|
|
12478
|
+
!parsedInsertEl ||
|
|
12479
|
+
parsedInsertEl === document.body ||
|
|
12480
|
+
parsedInsertEl.tagName === "BODY"
|
|
12481
|
+
) {
|
|
12482
|
+
rejectInsert("html");
|
|
12483
|
+
return;
|
|
12484
|
+
}
|
|
12485
|
+
var insertNodeId = parsedInsertEl.getAttribute(
|
|
12486
|
+
"data-agent-native-node-id",
|
|
12487
|
+
);
|
|
12488
|
+
// Repeat drops of the same board primitive must not mint a second live
|
|
12489
|
+
// element carrying the same node id: findUniqueRuntimeStructureTarget
|
|
12490
|
+
// returns null on a duplicate id, which silently breaks every later
|
|
12491
|
+
// move, ack, and undo for BOTH copies. Re-drag the existing node instead.
|
|
12492
|
+
var existingInsertEl: Element | null = null;
|
|
12493
|
+
if (insertNodeId) {
|
|
12494
|
+
try {
|
|
12495
|
+
existingInsertEl = document.querySelector(
|
|
12496
|
+
'[data-agent-native-node-id="' +
|
|
12497
|
+
escapeAttribute(insertNodeId) +
|
|
12498
|
+
'"]',
|
|
12499
|
+
);
|
|
12500
|
+
} catch (_err) {}
|
|
12501
|
+
}
|
|
12502
|
+
if (existingInsertEl === insertAnchor) {
|
|
12503
|
+
rejectInsert("anchor-is-subject");
|
|
12504
|
+
return;
|
|
12505
|
+
}
|
|
12506
|
+
var insertTarget = {
|
|
12507
|
+
anchor: insertAnchor,
|
|
12508
|
+
placement: insertPlacement,
|
|
12509
|
+
axis: parentFlowAxis(
|
|
12510
|
+
insertPlacement === "inside"
|
|
12511
|
+
? insertAnchor
|
|
12512
|
+
: insertAnchor.parentElement!,
|
|
12513
|
+
),
|
|
12514
|
+
dropMode:
|
|
12515
|
+
insertPlacement === "inside" &&
|
|
12516
|
+
isAbsolutePrimitiveContainer(insertAnchor)
|
|
12517
|
+
? "absolute-container"
|
|
12518
|
+
: "flow-insert",
|
|
12519
|
+
};
|
|
12520
|
+
if (existingInsertEl) {
|
|
12521
|
+
if (existingInsertEl.contains(insertAnchor)) {
|
|
12522
|
+
rejectInsert("anchor-inside-subject");
|
|
12523
|
+
return;
|
|
12524
|
+
}
|
|
12525
|
+
var reinsertOrigin = {
|
|
12526
|
+
prevParent: existingInsertEl.parentElement!,
|
|
12527
|
+
prevNextSibling: existingInsertEl.nextSibling,
|
|
12528
|
+
prevInlinePositionStyles:
|
|
12529
|
+
snapshotInlinePositionStyles(existingInsertEl),
|
|
12530
|
+
};
|
|
12531
|
+
applyRuntimeReorder(existingInsertEl, insertTarget);
|
|
12532
|
+
selectedEl = existingInsertEl;
|
|
12533
|
+
positionOverlay(selectionOverlay, selectedEl);
|
|
12534
|
+
refreshOverlays();
|
|
12535
|
+
postVisualStructureChange(
|
|
12536
|
+
existingInsertEl,
|
|
12537
|
+
insertTarget,
|
|
12538
|
+
reinsertOrigin,
|
|
12539
|
+
);
|
|
12540
|
+
return;
|
|
12541
|
+
}
|
|
12542
|
+
// The host bakes flow/absolute positioning into the markup before it
|
|
12543
|
+
// gets here (it owns the drop point and the anchor rect), so the node
|
|
12544
|
+
// goes in verbatim — no reorder rebasing on a never-laid-out element.
|
|
12545
|
+
if (insertPlacement === "inside") {
|
|
12546
|
+
insertAnchor.appendChild(parsedInsertEl);
|
|
12547
|
+
} else {
|
|
12548
|
+
insertAnchor.parentElement!.insertBefore(
|
|
12549
|
+
parsedInsertEl,
|
|
12550
|
+
insertPlacement === "before"
|
|
12551
|
+
? insertAnchor
|
|
12552
|
+
: insertAnchor.nextSibling,
|
|
12553
|
+
);
|
|
12554
|
+
}
|
|
12555
|
+
selectedEl = parsedInsertEl;
|
|
12556
|
+
positionOverlay(selectionOverlay, selectedEl);
|
|
12557
|
+
refreshOverlays();
|
|
12558
|
+
postVisualStructureChange(
|
|
12559
|
+
parsedInsertEl,
|
|
12560
|
+
insertTarget,
|
|
12561
|
+
{ inserted: true },
|
|
12562
|
+
parsedInsertEl.outerHTML,
|
|
12563
|
+
);
|
|
12564
|
+
return;
|
|
12565
|
+
}
|
|
11952
12566
|
if (e.data.type === "visual-structure-ack") {
|
|
11953
12567
|
dndLog("ack", {
|
|
11954
12568
|
requestId: e.data.requestId,
|
|
@@ -11957,8 +12571,40 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
11957
12571
|
var move = pendingStructureMoves[e.data.requestId];
|
|
11958
12572
|
if (!move) return;
|
|
11959
12573
|
delete pendingStructureMoves[e.data.requestId];
|
|
12574
|
+
var moveWasInsert = Boolean(move.origin && "inserted" in move.origin);
|
|
12575
|
+
var moveWasRemoval = Boolean(move.origin && "removed" in move.origin);
|
|
12576
|
+
if (moveWasRemoval) {
|
|
12577
|
+
// applied === true means the source now deletes it too, so the node
|
|
12578
|
+
// stays gone and this entry is simply released. applied === false is
|
|
12579
|
+
// the undo: re-attach the very element that was removed.
|
|
12580
|
+
if (!e.data.applied && move.origin && "removed" in move.origin) {
|
|
12581
|
+
var removedParent = move.origin.prevParent;
|
|
12582
|
+
var removedNextSibling = move.origin.prevNextSibling;
|
|
12583
|
+
if (
|
|
12584
|
+
removedParent &&
|
|
12585
|
+
removedParent.isConnected &&
|
|
12586
|
+
!move.el.isConnected
|
|
12587
|
+
) {
|
|
12588
|
+
removedParent.insertBefore(
|
|
12589
|
+
move.el,
|
|
12590
|
+
removedNextSibling &&
|
|
12591
|
+
removedNextSibling.parentNode === removedParent
|
|
12592
|
+
? removedNextSibling
|
|
12593
|
+
: null,
|
|
12594
|
+
);
|
|
12595
|
+
selectedEl = move.el;
|
|
12596
|
+
positionOverlay(selectionOverlay, selectedEl);
|
|
12597
|
+
postElementSelect(selectedEl);
|
|
12598
|
+
}
|
|
12599
|
+
}
|
|
12600
|
+
refreshOverlays();
|
|
12601
|
+
return;
|
|
12602
|
+
}
|
|
11960
12603
|
if (e.data.applied) {
|
|
11961
|
-
|
|
12604
|
+
// An inserted node is already exactly where the host asked for it and
|
|
12605
|
+
// has no pre-insert geometry to rebase; replaying the reorder would
|
|
12606
|
+
// re-run the absolute/flow correction against its own current rect.
|
|
12607
|
+
if (!moveWasInsert && move.el && move.el.isConnected && move.target) {
|
|
11962
12608
|
applyRuntimeReorder(move.el, move.target);
|
|
11963
12609
|
selectedEl = move.el;
|
|
11964
12610
|
positionOverlay(selectionOverlay, selectedEl);
|
|
@@ -11974,10 +12620,18 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
11974
12620
|
// stripped of its absolute positioning — worse than doing nothing,
|
|
11975
12621
|
// since it now renders at the flow position of a detached style
|
|
11976
12622
|
// instead of either its original spot or the intended drop slot.
|
|
12623
|
+
if (moveWasInsert) {
|
|
12624
|
+
if (move.el && move.el.isConnected) move.el.remove();
|
|
12625
|
+
if (selectedEl === move.el) selectedEl = null;
|
|
12626
|
+
if (hoveredEl === move.el) hoveredEl = null;
|
|
12627
|
+
refreshOverlays();
|
|
12628
|
+
return;
|
|
12629
|
+
}
|
|
11977
12630
|
if (
|
|
11978
12631
|
move.el &&
|
|
11979
12632
|
move.el.isConnected &&
|
|
11980
12633
|
move.origin &&
|
|
12634
|
+
"prevParent" in move.origin &&
|
|
11981
12635
|
move.origin.prevParent &&
|
|
11982
12636
|
move.origin.prevParent.isConnected
|
|
11983
12637
|
) {
|
|
@@ -12018,7 +12672,11 @@ declare var __SELECTED_LAYER_DRAG_PRIORITY__: boolean;
|
|
|
12018
12672
|
return;
|
|
12019
12673
|
}
|
|
12020
12674
|
if (e.data.type === "delete-element") {
|
|
12021
|
-
removeRuntimeTarget(
|
|
12675
|
+
removeRuntimeTarget(
|
|
12676
|
+
e.data.selector,
|
|
12677
|
+
e.data.selectorCandidates,
|
|
12678
|
+
e.data.requestId,
|
|
12679
|
+
);
|
|
12022
12680
|
return;
|
|
12023
12681
|
}
|
|
12024
12682
|
if (e.data.type === "set-text-content") {
|