nudge-ui 0.2.5 → 0.2.6
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/dist/cli/agentCommand.d.ts +0 -1
- package/dist/cli/agentCommand.js +0 -1
- package/dist/client.mjs +238 -122
- package/dist/compiler/ast.d.ts +0 -6
- package/dist/compiler/ast.js +0 -5
- package/dist/compiler/componentContractTypes.d.ts +11 -5
- package/dist/compiler/componentContracts.js +3 -9
- package/dist/compiler/componentInstrumentation.d.ts +2 -13
- package/dist/compiler/componentInstrumentation.js +3 -12
- package/dist/compiler/componentPolicyResolution.d.ts +3 -22
- package/dist/compiler/componentPolicyResolution.js +6 -38
- package/dist/compiler/identityAttributes.d.ts +2 -0
- package/dist/compiler/identityAttributes.js +2 -0
- package/dist/compiler/index.d.ts +0 -1
- package/dist/compiler/index.js +0 -1
- package/dist/compiler/packageComponentContracts.d.ts +10 -19
- package/dist/compiler/packageComponentContracts.js +60 -43
- package/dist/compiler/reactComponentProtocols.d.ts +0 -7
- package/dist/compiler/reactComponentProtocols.js +0 -7
- package/dist/compiler/reactIdentity.d.ts +2 -2
- package/dist/compiler/reactIdentity.js +41 -43
- package/dist/compiler/sourcePaths.d.ts +4 -8
- package/dist/compiler/sourcePaths.js +6 -8
- package/dist/css/dialects/index.d.ts +2 -21
- package/dist/css/dialects/index.js +2 -9
- package/dist/css/dialects/tailwind.d.ts +2 -16
- package/dist/css/dialects/tailwind.js +2 -25
- package/dist/css/dialects/vanillaExtract.d.ts +1 -9
- package/dist/css/dialects/vanillaExtract.js +0 -1
- package/dist/css/index.d.ts +0 -8
- package/dist/css/index.js +0 -8
- package/dist/css/model/index.d.ts +6 -38
- package/dist/css/model/index.js +0 -9
- package/dist/css/token-inventory/index.d.ts +0 -23
- package/dist/css/token-inventory/index.js +0 -23
- package/dist/css/token-inventory/inventory.js +4 -16
- package/dist/css/token-inventory/parseStylesheet.d.ts +1 -9
- package/dist/css/token-inventory/parseStylesheet.js +5 -42
- package/dist/css/token-inventory/policy.d.ts +2 -39
- package/dist/css/token-inventory/policy.js +2 -39
- package/dist/css/token-inventory/types.d.ts +2 -15
- package/dist/css/value-semantics/borderSemantics.d.ts +1 -8
- package/dist/css/value-semantics/borderSemantics.js +5 -23
- package/dist/css/value-semantics/boxSemantics.d.ts +2 -25
- package/dist/css/value-semantics/boxSemantics.js +1 -7
- package/dist/css/value-semantics/colorSemantics.d.ts +6 -60
- package/dist/css/value-semantics/colorSemantics.js +9 -40
- package/dist/css/value-semantics/cssSyntax.d.ts +10 -10
- package/dist/css/value-semantics/cssSyntax.js +39 -11
- package/dist/css/value-semantics/fontSemantics.d.ts +3 -19
- package/dist/css/value-semantics/fontSemantics.js +7 -25
- package/dist/css/value-semantics/index.d.ts +1 -12
- package/dist/css/value-semantics/index.js +1 -12
- package/dist/css/value-semantics/propertyPolicy.d.ts +6 -53
- package/dist/css/value-semantics/propertyPolicy.js +47 -59
- package/dist/css/value-semantics/stringMaps.d.ts +0 -1
- package/dist/css/value-semantics/structuredValues.d.ts +3 -37
- package/dist/css/value-semantics/structuredValues.js +6 -17
- package/dist/css/value-semantics/tokenInterpretation.d.ts +8 -50
- package/dist/css/value-semantics/tokenInterpretation.js +7 -21
- package/dist/hosts/astro/astroRuntimeConfig.d.ts +0 -1
- package/dist/hosts/astro/astroRuntimeConfig.js +0 -1
- package/dist/hosts/astro/clientAsset.d.ts +1 -5
- package/dist/hosts/astro/clientAsset.js +1 -5
- package/dist/hosts/astro/clientTransport.d.ts +0 -1
- package/dist/hosts/astro/clientTransport.js +4 -9
- package/dist/hosts/astro/integration.d.ts +2 -28
- package/dist/hosts/astro/integration.js +7 -36
- package/dist/hosts/astro/markdownIdentity.d.ts +0 -3
- package/dist/hosts/astro/markdownIdentity.js +0 -3
- package/dist/hosts/astro/middleware.d.ts +1 -12
- package/dist/hosts/astro/middleware.js +1 -12
- package/dist/hosts/astro/projectContext.d.ts +1 -9
- package/dist/hosts/astro/projectContext.js +2 -11
- package/dist/hosts/astro/responseInstrumentation.d.ts +4 -33
- package/dist/hosts/astro/responseInstrumentation.js +5 -34
- package/dist/hosts/environment.d.ts +0 -8
- package/dist/hosts/environment.js +0 -1
- package/dist/hosts/next/index.js +1 -3
- package/dist/hosts/next/loader.d.ts +5 -44
- package/dist/hosts/next/loader.js +22 -103
- package/dist/hosts/next/loaders/identity-loader.cjs +111 -65
- package/dist/hosts/next/loaders/loader-plugin.cjs +111 -65
- package/dist/hosts/next/manifest.d.ts +2 -16
- package/dist/hosts/next/manifest.js +18 -20
- package/dist/hosts/next/mount.d.ts +1 -11
- package/dist/hosts/next/mount.js +1 -11
- package/dist/hosts/next/repositoryScope.d.ts +2 -17
- package/dist/hosts/next/repositoryScope.js +2 -17
- package/dist/hosts/next/sidecar.d.ts +0 -13
- package/dist/hosts/next/sidecar.js +25 -110
- package/dist/hosts/next/wrapper.d.ts +0 -31
- package/dist/hosts/next/wrapper.js +13 -64
- package/dist/hosts/projectBridge.d.ts +0 -2
- package/dist/hosts/projectBridge.js +0 -2
- package/dist/hosts/reactRendererCapture.d.ts +2 -0
- package/dist/hosts/reactRendererCapture.js +12 -0
- package/dist/hosts/static/cli.d.ts +0 -4
- package/dist/hosts/static/cli.js +0 -3
- package/dist/hosts/static/html/bootstrap.d.ts +1 -18
- package/dist/hosts/static/html/bootstrap.js +2 -14
- package/dist/hosts/static/manifest.d.ts +2 -15
- package/dist/hosts/static/manifest.js +5 -18
- package/dist/hosts/static/server.d.ts +4 -38
- package/dist/hosts/static/server.js +17 -67
- package/dist/hosts/vite/index.d.ts +0 -10
- package/dist/hosts/vite/index.js +0 -10
- package/dist/hosts/vite/react.d.ts +4 -17
- package/dist/hosts/vite/react.js +18 -35
- package/dist/hosts/vite/tokens/activeStylesheets.d.ts +1 -10
- package/dist/hosts/vite/tokens/activeStylesheets.js +3 -8
- package/dist/hosts/vite/tokens/fileMap.d.ts +0 -1
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.d.ts +2 -15
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.js +3 -10
- package/dist/hosts/vite/vite.d.ts +5 -26
- package/dist/hosts/vite/vite.js +44 -80
- package/dist/html/dom.d.ts +0 -1
- package/dist/html/dom.js +0 -1
- package/dist/html/identity.d.ts +1 -15
- package/dist/html/identity.js +1 -8
- package/dist/html/insertions.d.ts +2 -8
- package/dist/html/insertions.js +1 -1
- package/dist/inspector/agent/McpConnectionDialog.d.ts +1 -6
- package/dist/inspector/agent/McpConnectionDialog.js +1 -6
- package/dist/inspector/agent/activity.d.ts +1 -1
- package/dist/inspector/agent/activity.js +1 -1
- package/dist/inspector/agent/client.d.ts +2 -26
- package/dist/inspector/agent/client.js +17 -64
- package/dist/inspector/agent/connectionStatus.d.ts +0 -1
- package/dist/inspector/agent/connectionStatus.js +0 -1
- package/dist/inspector/agent/httpTransport.d.ts +0 -8
- package/dist/inspector/agent/httpTransport.js +21 -39
- package/dist/inspector/agent/protocol.d.ts +1 -10
- package/dist/inspector/agent/protocol.js +1 -9
- package/dist/inspector/agent/verification.d.ts +2 -19
- package/dist/inspector/agent/verification.js +7 -43
- package/dist/inspector/boot.d.ts +3 -1
- package/dist/inspector/boot.js +12 -20
- package/dist/inspector/canvas/AgentActivityOverlay.d.ts +1 -1
- package/dist/inspector/canvas/AgentActivityOverlay.js +1 -1
- package/dist/inspector/canvas/CanvasCard.js +7 -14
- package/dist/inspector/canvas/CanvasElementOverlay.js +117 -50
- package/dist/inspector/canvas/CanvasWorkspace.js +15 -29
- package/dist/inspector/canvas/PageCard.d.ts +0 -1
- package/dist/inspector/canvas/PageCard.js +0 -1
- package/dist/inspector/canvas/SketchToolOptions.d.ts +0 -1
- package/dist/inspector/canvas/SketchToolOptions.js +0 -6
- package/dist/inspector/canvas/ToolOptionsDrawer.d.ts +1 -6
- package/dist/inspector/canvas/ToolOptionsDrawer.js +2 -8
- package/dist/inspector/canvas/activeCanvasDocument.d.ts +0 -2
- package/dist/inspector/canvas/activeCanvasDocument.js +0 -2
- package/dist/inspector/canvas/agentPresentation.d.ts +2 -13
- package/dist/inspector/canvas/agentPresentation.js +3 -14
- package/dist/inspector/canvas/canvasFrame.d.ts +2 -6
- package/dist/inspector/canvas/canvasFrame.js +1 -2
- package/dist/inspector/canvas/canvasResize.d.ts +1 -6
- package/dist/inspector/canvas/canvasResize.js +1 -6
- package/dist/inspector/canvas/canvasStore.d.ts +4 -12
- package/dist/inspector/canvas/canvasStore.js +12 -26
- package/dist/inspector/canvas/frameConnection.d.ts +1 -7
- package/dist/inspector/canvas/frameContent.d.ts +0 -1
- package/dist/inspector/canvas/frameLifecycle.d.ts +12 -0
- package/dist/inspector/canvas/frameLifecycle.js +11 -0
- package/dist/inspector/canvas/frameProtocol.d.ts +5 -40
- package/dist/inspector/canvas/frameProtocol.js +1 -24
- package/dist/inspector/canvas/frameScrollbarStyles.d.ts +0 -1
- package/dist/inspector/canvas/frameScrollbarStyles.js +0 -1
- package/dist/inspector/canvas/layout.d.ts +10 -22
- package/dist/inspector/canvas/layout.js +0 -3
- package/dist/inspector/canvas/normalizeUrl.js +1 -8
- package/dist/inspector/canvas/pageSurface.d.ts +1 -6
- package/dist/inspector/canvas/pageSurface.js +1 -6
- package/dist/inspector/canvas/projection.d.ts +4 -25
- package/dist/inspector/canvas/projection.js +22 -72
- package/dist/inspector/canvas/rendererBootstrap.d.ts +8 -1
- package/dist/inspector/canvas/rendererBootstrap.js +6 -14
- package/dist/inspector/canvas/rendererCidIndex.d.ts +0 -5
- package/dist/inspector/canvas/rendererCidIndex.js +0 -5
- package/dist/inspector/canvas/rendererElementSelector.js +29 -27
- package/dist/inspector/canvas/rendererMessageRouter.d.ts +0 -1
- package/dist/inspector/canvas/rendererMessageRouter.js +0 -1
- package/dist/inspector/canvas/rendererSelectionProxy.d.ts +1 -5
- package/dist/inspector/canvas/rendererSelectionProxy.js +2 -7
- package/dist/inspector/canvas/rendererStylesheet.d.ts +0 -1
- package/dist/inspector/canvas/rendererStylesheet.js +9 -2
- package/dist/inspector/canvas/resizeHandleScale.d.ts +1 -10
- package/dist/inspector/canvas/resizeHandleScale.js +1 -10
- package/dist/inspector/canvas/sessionStore.d.ts +1 -7
- package/dist/inspector/canvas/sessionStore.js +21 -34
- package/dist/inspector/canvas/staleChangeDetector.js +1 -4
- package/dist/inspector/canvas/toolbarScale.d.ts +1 -4
- package/dist/inspector/canvas/toolbarScale.js +1 -4
- package/dist/inspector/canvas/useCanvasLayoutAnimation.d.ts +0 -1
- package/dist/inspector/canvas/useCanvasLayoutAnimation.js +0 -1
- package/dist/inspector/canvas/viewStore.js +1 -1
- package/dist/inspector/canvas/wheelPan.d.ts +1 -1
- package/dist/inspector/canvas/wheelPan.js +1 -1
- package/dist/inspector/canvas/workspaceLease.d.ts +1 -5
- package/dist/inspector/canvas/workspaceLease.js +1 -7
- package/dist/inspector/changes/codecs.js +2 -1
- package/dist/inspector/changes/draftPreview.d.ts +1 -6
- package/dist/inspector/changes/draftPreview.js +15 -30
- package/dist/inspector/changes/editModel.d.ts +3 -13
- package/dist/inspector/changes/editModel.js +1 -2
- package/dist/inspector/changes/managedStyleProjection.js +4 -14
- package/dist/inspector/changes/model.d.ts +0 -5
- package/dist/inspector/changes/model.js +1 -8
- package/dist/inspector/changes/previewDiagnostics.d.ts +2 -12
- package/dist/inspector/changes/previewDiagnostics.js +4 -20
- package/dist/inspector/changes/previewVerification.d.ts +25 -0
- package/dist/inspector/changes/previewVerification.js +34 -0
- package/dist/inspector/changes/structuralTypes.d.ts +2 -4
- package/dist/inspector/changes/types.d.ts +3 -10
- package/dist/inspector/clientManifest.d.ts +17 -6
- package/dist/inspector/clientManifest.js +16 -3
- package/dist/inspector/comments/CommentsOverlay.js +48 -7
- package/dist/inspector/comments/element.d.ts +1 -2
- package/dist/inspector/comments/element.js +1 -2
- package/dist/inspector/comments/store.d.ts +1 -1
- package/dist/inspector/comments/store.js +1 -1
- package/dist/inspector/comments/verification.d.ts +8 -2
- package/dist/inspector/comments/verification.js +18 -10
- package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +8 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.js +10 -7
- package/dist/inspector/componentSemantics/adapterRegistry.d.ts +2 -9
- package/dist/inspector/componentSemantics/adapterRegistry.js +2 -9
- package/dist/inspector/componentSemantics/changeModel.js +2 -4
- package/dist/inspector/componentSemantics/react/callsites.d.ts +28 -0
- package/dist/inspector/componentSemantics/react/callsites.js +261 -0
- package/dist/inspector/componentSemantics/react/devtoolsHook.d.ts +23 -0
- package/dist/inspector/componentSemantics/react/devtoolsHook.js +71 -0
- package/dist/inspector/componentSemantics/react/fibers.d.ts +17 -0
- package/dist/inspector/componentSemantics/react/fibers.js +30 -0
- package/dist/inspector/componentSemantics/{reactRuntime.d.ts → react/runtime.d.ts} +3 -2
- package/dist/inspector/componentSemantics/{reactRuntime.js → react/runtime.js} +70 -53
- package/dist/inspector/componentSemantics/runtimeBridge.d.ts +2 -18
- package/dist/inspector/componentSemantics/runtimeBridge.js +5 -19
- package/dist/inspector/componentSemantics/textBinding.d.ts +1 -9
- package/dist/inspector/componentSemantics/textBinding.js +16 -42
- package/dist/inspector/componentSemantics/types.d.ts +8 -27
- package/dist/inspector/componentSemantics/types.js +0 -1
- package/dist/inspector/conformance/borderCases.d.ts +0 -5
- package/dist/inspector/conformance/borderCases.js +0 -5
- package/dist/inspector/conformance/colorCases.d.ts +0 -6
- package/dist/inspector/conformance/colorCases.js +0 -6
- package/dist/inspector/conformance/fixture.d.ts +1 -5
- package/dist/inspector/conformance/fixture.js +1 -5
- package/dist/inspector/conformance/spacingCases.d.ts +0 -4
- package/dist/inspector/conformance/spacingCases.js +0 -4
- package/dist/inspector/conformance/typographyCases.d.ts +0 -5
- package/dist/inspector/conformance/typographyCases.js +0 -5
- package/dist/inspector/drafts/draftStore.d.ts +7 -21
- package/dist/inspector/drafts/draftStore.js +15 -5
- package/dist/inspector/drafts/model.d.ts +7 -15
- package/dist/inspector/drafts/model.js +0 -2
- package/dist/inspector/drafts/store.d.ts +1 -8
- package/dist/inspector/drafts/store.js +3 -10
- package/dist/inspector/editScope.d.ts +0 -1
- package/dist/inspector/editScope.js +0 -1
- package/dist/inspector/inline-text/inlineTextDiagnostics.d.ts +0 -2
- package/dist/inspector/inline-text/inlineTextDiagnostics.js +0 -2
- package/dist/inspector/inline-text/inlineTextEditor.d.ts +2 -8
- package/dist/inspector/inline-text/inlineTextEditor.js +26 -79
- package/dist/inspector/inline-text/inlineTextLifecycle.js +1 -6
- package/dist/inspector/inline-text/textEditChange.d.ts +0 -1
- package/dist/inspector/inspection/bridge.d.ts +2 -6
- package/dist/inspector/inspection/bridge.js +4 -12
- package/dist/inspector/inspection/browserCssInspection.d.ts +4 -11
- package/dist/inspector/inspection/browserCssInspection.js +4 -8
- package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +0 -7
- package/dist/inspector/inspection/browserCssInspectionRegistry.js +1 -16
- package/dist/inspector/inspection/selectionProperty.d.ts +1 -6
- package/dist/inspector/inspection/selectionProperty.js +1 -5
- package/dist/inspector/inspection/useBrowserCssInspection.d.ts +1 -5
- package/dist/inspector/inspection/useBrowserCssInspection.js +5 -21
- package/dist/inspector/iterations/capture.d.ts +0 -1
- package/dist/inspector/iterations/capture.js +4 -9
- package/dist/inspector/iterations/client.d.ts +0 -1
- package/dist/inspector/iterations/client.js +0 -1
- package/dist/inspector/iterations/coordinator.d.ts +0 -1
- package/dist/inspector/iterations/coordinator.js +0 -1
- package/dist/inspector/iterations/prompt.d.ts +0 -1
- package/dist/inspector/iterations/prompt.js +0 -1
- package/dist/inspector/overlay/DomNavigator.d.ts +3 -1
- package/dist/inspector/overlay/DomNavigator.js +39 -15
- package/dist/inspector/overlay/DropGuideOverlay.d.ts +0 -1
- package/dist/inspector/overlay/DropGuideOverlay.js +0 -1
- package/dist/inspector/overlay/MeasurementGuideOverlay.d.ts +1 -8
- package/dist/inspector/overlay/MeasurementGuideOverlay.js +1 -5
- package/dist/inspector/overlay/clickPolicy.d.ts +3 -14
- package/dist/inspector/overlay/clickPolicy.js +3 -14
- package/dist/inspector/overlay/dropGuide.d.ts +0 -3
- package/dist/inspector/overlay/dropGuide.js +0 -3
- package/dist/inspector/overlay/frameThrottle.d.ts +0 -1
- package/dist/inspector/overlay/frameThrottle.js +0 -1
- package/dist/inspector/overlay/interactionStyles.d.ts +1 -1
- package/dist/inspector/overlay/interactionStyles.js +2 -8
- package/dist/inspector/overlay/measurementGeometry.js +4 -12
- package/dist/inspector/overlay/selectedGeometry.d.ts +1 -6
- package/dist/inspector/overlay/selectedGeometry.js +1 -8
- package/dist/inspector/overlay/spacingGestures.d.ts +14 -21
- package/dist/inspector/overlay/spacingGestures.js +151 -31
- package/dist/inspector/overlay/structuralGestures.d.ts +2 -9
- package/dist/inspector/overlay/structuralGestures.js +1 -4
- package/dist/inspector/pageInspector.d.ts +4 -13
- package/dist/inspector/pageInspector.js +25 -32
- package/dist/inspector/projection/cssEscapes.d.ts +0 -1
- package/dist/inspector/projection/cssEscapes.js +2 -4
- package/dist/inspector/projection/draftProjection.d.ts +2 -14
- package/dist/inspector/projection/draftProjection.js +1 -8
- package/dist/inspector/projection/managedStylesheet.d.ts +1 -7
- package/dist/inspector/projection/managedStylesheet.js +4 -22
- package/dist/inspector/projection/renderedInstance.d.ts +5 -28
- package/dist/inspector/projection/renderedInstance.js +6 -32
- package/dist/inspector/projection/structuralProjection.d.ts +7 -39
- package/dist/inspector/projection/structuralProjection.js +17 -52
- package/dist/inspector/projection/textProjection.d.ts +2 -14
- package/dist/inspector/projection/textProjection.js +17 -70
- package/dist/inspector/prompt/PromptSettingsDialog.d.ts +0 -1
- package/dist/inspector/prompt/PromptSettingsDialog.js +0 -1
- package/dist/inspector/prompt/clipboardHandoff.d.ts +1 -9
- package/dist/inspector/prompt/clipboardHandoff.js +1 -9
- package/dist/inspector/prompt/generatePrompt.d.ts +1 -1
- package/dist/inspector/prompt/generatePrompt.js +10 -25
- package/dist/inspector/prompt/promptSettings.d.ts +0 -3
- package/dist/inspector/prompt/promptSettings.js +0 -3
- package/dist/inspector/runtime/devFlag.d.ts +2 -25
- package/dist/inspector/runtime/devFlag.js +4 -31
- package/dist/inspector/runtime/documentStylesheetOrder.d.ts +0 -2
- package/dist/inspector/runtime/editorShell.d.ts +0 -1
- package/dist/inspector/runtime/editorShell.js +0 -1
- package/dist/inspector/runtime/inspectorStorage.d.ts +1 -7
- package/dist/inspector/runtime/inspectorStorage.js +1 -6
- package/dist/inspector/runtime/ownedStylesheets.d.ts +2 -8
- package/dist/inspector/runtime/ownedStylesheets.js +2 -8
- package/dist/inspector/runtime/runtimeConfig.d.ts +12 -86
- package/dist/inspector/runtime/runtimeConfig.js +9 -50
- package/dist/inspector/runtime/runtimeIdentityClaims.d.ts +3 -13
- package/dist/inspector/runtime/runtimeIdentityClaims.js +9 -19
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +4 -36
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +7 -40
- package/dist/inspector/runtime/useRuntimeConfig.d.ts +1 -8
- package/dist/inspector/runtime/useRuntimeConfig.js +1 -8
- package/dist/inspector/selection/editScope.d.ts +1 -7
- package/dist/inspector/selection/editScope.js +2 -12
- package/dist/inspector/selection/editTarget.d.ts +1 -5
- package/dist/inspector/selection/hierarchy.d.ts +11 -11
- package/dist/inspector/selection/hierarchy.js +42 -24
- package/dist/inspector/selection/selectionStore.d.ts +0 -3
- package/dist/inspector/selection/selectionStore.js +5 -16
- package/dist/inspector/selection/sourceSite.d.ts +1 -5
- package/dist/inspector/selection/sourceSite.js +2 -8
- package/dist/inspector/selection/styleSelection.d.ts +1 -5
- package/dist/inspector/selection/styleSelection.js +1 -5
- package/dist/inspector/session/lifecycle.d.ts +1 -9
- package/dist/inspector/session/lifecycle.js +0 -1
- package/dist/inspector/session/sessionContext.d.ts +0 -4
- package/dist/inspector/session/sessionContext.js +0 -4
- package/dist/inspector/session/sessionFactory.d.ts +0 -9
- package/dist/inspector/session/sessionFactory.js +0 -6
- package/dist/inspector/settings/SettingsDialog.d.ts +0 -1
- package/dist/inspector/settings/SettingsDialog.js +5 -3
- package/dist/inspector/shell/AgentStatusButton.d.ts +3 -2
- package/dist/inspector/shell/AgentStatusButton.js +5 -5
- package/dist/inspector/shell/ChangesLog.js +3 -4
- package/dist/inspector/shell/CopyPromptButton.d.ts +2 -1
- package/dist/inspector/shell/CopyPromptButton.js +12 -11
- package/dist/inspector/shell/InspectorEditors.d.ts +16 -0
- package/dist/inspector/shell/InspectorEditors.js +14 -0
- package/dist/inspector/shell/InspectorPanel.d.ts +12 -0
- package/dist/inspector/shell/InspectorPanel.js +8 -0
- package/dist/inspector/shell/InspectorSelection.d.ts +24 -0
- package/dist/inspector/shell/InspectorSelection.js +20 -0
- package/dist/inspector/shell/InspectorShell.js +26 -48
- package/dist/inspector/shell/NudgeLogoIcon.d.ts +5 -0
- package/dist/inspector/shell/NudgeLogoIcon.js +5 -0
- package/dist/inspector/shell/PeekOriginalButton.d.ts +0 -5
- package/dist/inspector/shell/PeekOriginalButton.js +0 -5
- package/dist/inspector/shell/PeekOriginalIcon.d.ts +0 -5
- package/dist/inspector/shell/PeekOriginalIcon.js +0 -5
- package/dist/inspector/shell/PromptActionButton.d.ts +21 -0
- package/dist/inspector/shell/PromptActionButton.js +14 -0
- package/dist/inspector/shell/elementName.d.ts +5 -0
- package/dist/inspector/shell/elementName.js +29 -0
- package/dist/inspector/shell/interactionStatePreview.d.ts +1 -4
- package/dist/inspector/shell/interactionStatePreview.js +3 -8
- package/dist/inspector/shell/originalPreview.d.ts +1 -6
- package/dist/inspector/shell/originalPreview.js +1 -6
- package/dist/inspector/shell/stateValue.d.ts +1 -2
- package/dist/inspector/shell/stateValue.js +2 -5
- package/dist/inspector/shell/styleState.d.ts +1 -2
- package/dist/inspector/shell/styleState.js +1 -2
- package/dist/inspector/sketch/SketchEditor.js +0 -1
- package/dist/inspector/sketch/SketchFrameOverlay.js +8 -12
- package/dist/inspector/sketch/SketchOverlay.js +5 -6
- package/dist/inspector/sketch/SketchPromptPanel.d.ts +0 -1
- package/dist/inspector/sketch/SketchPromptPanel.js +0 -1
- package/dist/inspector/sketch/SketchWorkspace.js +2 -4
- package/dist/inspector/sketch/capture.d.ts +12 -3
- package/dist/inspector/sketch/capture.js +12 -11
- package/dist/inspector/sketch/copySketch.d.ts +1 -7
- package/dist/inspector/sketch/copySketch.js +2 -11
- package/dist/inspector/sketch/drawingTools.d.ts +1 -3
- package/dist/inspector/sketch/drawingTools.js +1 -2
- package/dist/inspector/sketch/frameHeading.d.ts +1 -7
- package/dist/inspector/sketch/frameHeading.js +1 -8
- package/dist/inspector/sketch/freehand.d.ts +0 -1
- package/dist/inspector/sketch/freehand.js +0 -1
- package/dist/inspector/sketch/geometry.d.ts +1 -6
- package/dist/inspector/sketch/geometry.js +1 -6
- package/dist/inspector/sketch/handoff.js +0 -1
- package/dist/inspector/sketch/history.d.ts +1 -5
- package/dist/inspector/sketch/history.js +1 -4
- package/dist/inspector/sketch/interaction.d.ts +2 -2
- package/dist/inspector/sketch/interaction.js +2 -2
- package/dist/inspector/sketch/model.d.ts +2 -9
- package/dist/inspector/sketch/model.js +2 -19
- package/dist/inspector/sketch/persistence.d.ts +0 -1
- package/dist/inspector/sketch/persistence.js +2 -2
- package/dist/inspector/sketch/raster.d.ts +1 -4
- package/dist/inspector/sketch/raster.js +2 -8
- package/dist/inspector/sketch/store.js +2 -3
- package/dist/inspector/sketch/videoFrames.js +2 -3
- package/dist/inspector/spacing/projection.d.ts +0 -8
- package/dist/inspector/spacing/projection.js +38 -20
- package/dist/inspector/styleEditors/BackgroundEditor.js +1 -1
- package/dist/inspector/styleEditors/BorderEditor.js +1 -6
- package/dist/inspector/styleEditors/ChildPlacement.d.ts +12 -0
- package/dist/inspector/styleEditors/ChildPlacement.js +9 -0
- package/dist/inspector/styleEditors/FlexControls.d.ts +35 -0
- package/dist/inspector/styleEditors/FlexControls.js +158 -0
- package/dist/inspector/styleEditors/GapField.d.ts +5 -2
- package/dist/inspector/styleEditors/GapField.js +3 -4
- package/dist/inspector/styleEditors/GridChildSection.d.ts +0 -5
- package/dist/inspector/styleEditors/GridChildSection.js +0 -5
- package/dist/inspector/styleEditors/GridPicker.d.ts +1 -1
- package/dist/inspector/styleEditors/GridPicker.js +2 -4
- package/dist/inspector/styleEditors/GridSection.d.ts +10 -8
- package/dist/inspector/styleEditors/GridSection.js +22 -9
- package/dist/inspector/styleEditors/GridValueField.d.ts +1 -5
- package/dist/inspector/styleEditors/GridValueField.js +2 -8
- package/dist/inspector/styleEditors/ImageBackgroundEditor.d.ts +0 -1
- package/dist/inspector/styleEditors/ImageBackgroundEditor.js +0 -1
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +0 -1
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +0 -1
- package/dist/inspector/styleEditors/LayoutComboField.js +0 -5
- package/dist/inspector/styleEditors/LayoutModeRow.d.ts +14 -0
- package/dist/inspector/styleEditors/LayoutModeRow.js +60 -0
- package/dist/inspector/styleEditors/LayoutSection.d.ts +2 -2
- package/dist/inspector/styleEditors/LayoutSection.js +30 -356
- package/dist/inspector/styleEditors/OpacityEditor.js +7 -5
- package/dist/inspector/styleEditors/PositionControls.d.ts +18 -0
- package/dist/inspector/styleEditors/PositionControls.js +16 -0
- package/dist/inspector/styleEditors/SizeSection.d.ts +18 -0
- package/dist/inspector/styleEditors/SizeSection.js +71 -0
- package/dist/inspector/styleEditors/{SpacingBox.d.ts → SpacingField.d.ts} +3 -10
- package/dist/inspector/styleEditors/{SpacingBox.js → SpacingField.js} +15 -29
- package/dist/inspector/styleEditors/Typography.js +2 -4
- package/dist/inspector/styleEditors/borderModel.d.ts +1 -7
- package/dist/inspector/styleEditors/borderModel.js +2 -11
- package/dist/inspector/styleEditors/completeCssValue.d.ts +1 -5
- package/dist/inspector/styleEditors/completeCssValue.js +3 -13
- package/dist/inspector/styleEditors/fieldValue.d.ts +20 -0
- package/dist/inspector/styleEditors/fieldValue.js +26 -0
- package/dist/inspector/styleEditors/gradientValue.d.ts +1 -1
- package/dist/inspector/styleEditors/gradientValue.js +3 -2
- package/dist/inspector/styleEditors/gridChildModel.d.ts +7 -47
- package/dist/inspector/styleEditors/gridChildModel.js +6 -37
- package/dist/inspector/styleEditors/hiddenSizeOverrides.d.ts +5 -0
- package/dist/inspector/styleEditors/hiddenSizeOverrides.js +42 -0
- package/dist/inspector/styleEditors/inlineAuthored.d.ts +1 -8
- package/dist/inspector/styleEditors/inlineAuthored.js +3 -17
- package/dist/inspector/styleEditors/layoutMode.d.ts +15 -0
- package/dist/inspector/styleEditors/layoutMode.js +33 -0
- package/dist/inspector/styleEditors/layoutPreviewState.d.ts +0 -1
- package/dist/inspector/styleEditors/layoutPreviewState.js +0 -1
- package/dist/inspector/styleEditors/layoutValue.d.ts +2 -8
- package/dist/inspector/styleEditors/layoutValue.js +4 -12
- package/dist/inspector/styleEditors/nudgeValue.d.ts +1 -13
- package/dist/inspector/styleEditors/nudgeValue.js +1 -13
- package/dist/inspector/styleEditors/rowLookup.d.ts +1 -5
- package/dist/inspector/styleEditors/rowLookup.js +1 -5
- package/dist/inspector/styleEditors/stringRecord.d.ts +1 -2
- package/dist/inspector/styleEditors/stylePresence.d.ts +0 -2
- package/dist/inspector/styleEditors/stylePresence.js +1 -4
- package/dist/inspector/styleEditors/textRelevance.d.ts +1 -1
- package/dist/inspector/styleEditors/textRelevance.js +1 -1
- package/dist/inspector/styleEditors/useFieldVisibility.js +1 -2
- package/dist/inspector/styleEditors/useLayoutContext.d.ts +13 -0
- package/dist/inspector/styleEditors/useLayoutContext.js +53 -0
- package/dist/inspector/styleEditors/valuePolicy.d.ts +1 -5
- package/dist/inspector/styleEditors/valuePolicy.js +0 -1
- package/dist/inspector/testing.d.ts +1 -4
- package/dist/inspector/testing.js +1 -4
- package/dist/inspector/tokens/TokenChip.d.ts +1 -4
- package/dist/inspector/tokens/TokenChip.js +1 -4
- package/dist/inspector/tokens/TokenField.d.ts +4 -3
- package/dist/inspector/tokens/TokenField.js +19 -29
- package/dist/inspector/tokens/catalog.d.ts +2 -10
- package/dist/inspector/tokens/catalog.js +5 -12
- package/dist/inspector/tokens/dragPointerLock.d.ts +0 -1
- package/dist/inspector/tokens/dragPointerLock.js +2 -3
- package/dist/inspector/tokens/editActions.d.ts +1 -1
- package/dist/inspector/tokens/editActions.js +2 -4
- package/dist/inspector/tokens/resolution/cascade.d.ts +1 -5
- package/dist/inspector/tokens/resolution/cascade.js +1 -5
- package/dist/inspector/tokens/resolution/containerQueryEvaluator.d.ts +1 -5
- package/dist/inspector/tokens/resolution/containerQueryEvaluator.js +1 -5
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +4 -19
- package/dist/inspector/tokens/resolution/cssomCollector.js +151 -122
- package/dist/inspector/tokens/resolution/nestedSelectors.d.ts +1 -5
- package/dist/inspector/tokens/resolution/nestedSelectors.js +1 -5
- package/dist/inspector/tokens/resolution/ruleMatching.d.ts +4 -14
- package/dist/inspector/tokens/resolution/ruleMatching.js +121 -67
- package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +3 -14
- package/dist/inspector/tokens/resolution/selectorSemantics.js +12 -27
- package/dist/inspector/tokens/resolution.d.ts +5 -24
- package/dist/inspector/tokens/resolution.js +16 -71
- package/dist/inspector/tokens/tokenAvailability.d.ts +2 -14
- package/dist/inspector/tokens/tokenAvailability.js +6 -38
- package/dist/inspector/tokens/valueSemanticsAdapter.d.ts +0 -1
- package/dist/inspector/tokens/valueSemanticsAdapter.js +18 -2
- package/dist/inspector/ui/AtRuleContext.d.ts +5 -5
- package/dist/inspector/ui/AtRuleContext.js +8 -6
- package/dist/inspector/ui/ControlSurface.d.ts +0 -4
- package/dist/inspector/ui/Disclosure.d.ts +0 -5
- package/dist/inspector/ui/Disclosure.js +0 -4
- package/dist/inspector/ui/InlineStyleWarning.d.ts +0 -1
- package/dist/inspector/ui/InspectorPopover.d.ts +1 -5
- package/dist/inspector/ui/InspectorPopover.js +1 -5
- package/dist/inspector/ui/SegmentedControl.d.ts +4 -4
- package/dist/inspector/ui/SegmentedControl.js +6 -4
- package/dist/inspector/ui/SideValuesField.d.ts +1 -6
- package/dist/inspector/ui/SideValuesField.js +2 -8
- package/dist/inspector/ui/Toast.d.ts +0 -4
- package/dist/inspector/ui/Toast.js +0 -4
- package/dist/inspector/ui/atRuleSegments.d.ts +13 -0
- package/dist/inspector/ui/atRuleSegments.js +34 -0
- package/dist/inspector/ui/classNames.d.ts +0 -1
- package/dist/inspector/ui/classNames.js +0 -1
- package/dist/inspector/ui/customCursors.d.ts +7 -1
- package/dist/inspector/ui/customCursors.js +2 -6
- package/dist/inspector/ui/styles.js +18 -20
- package/dist/inspector/workspace/controller.js +20 -1
- package/dist/inspector/workspace/handoff.d.ts +1 -5
- package/dist/inspector/workspace/handoff.js +1 -5
- package/dist/inspector/workspace/timeline.d.ts +5 -2
- package/dist/inspector/workspace/timeline.js +0 -1
- package/dist/internal/agent-protocol.d.ts +20 -42
- package/dist/internal/agent-protocol.js +18 -35
- package/dist/nudge-ui.mjs +75 -28
- package/dist/project/artifacts.js +24 -21
- package/dist/project/files.d.ts +0 -1
- package/dist/project/files.js +2 -9
- package/dist/project/identity.d.ts +1 -5
- package/dist/project/identity.js +1 -5
- package/dist/project/mcpPackage.d.ts +1 -6
- package/dist/project/mcpPackage.js +2 -7
- package/dist/project/pathPolicy.d.ts +1 -6
- package/dist/project/pathPolicy.js +1 -6
- package/dist/project/tokens.d.ts +2 -12
- package/dist/project/tokens.js +4 -15
- package/dist/transport/editor.d.ts +1 -12
- package/dist/transport/editor.js +2 -13
- package/dist/transport/index.d.ts +0 -5
- package/dist/transport/index.js +0 -5
- package/dist/transport/routes.d.ts +0 -5
- package/dist/transport/routes.js +0 -5
- package/package.json +5 -4
- package/dist/inspector/styleEditors/InsetSection.d.ts +0 -15
- package/dist/inspector/styleEditors/InsetSection.js +0 -15
- package/dist/inspector/styleEditors/PositionInsets.d.ts +0 -15
- package/dist/inspector/styleEditors/PositionInsets.js +0 -12
- package/dist/inspector/tokens/TokenDropdown.d.ts +0 -13
- package/dist/inspector/tokens/TokenDropdown.js +0 -59
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CanvasCamera } from "./viewStore.js";
|
|
1
2
|
export interface LayoutCard {
|
|
2
3
|
readonly id: string;
|
|
3
4
|
readonly x: number;
|
|
@@ -11,42 +12,29 @@ export interface Bounds {
|
|
|
11
12
|
readonly maxX: number;
|
|
12
13
|
readonly maxY: number;
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
+
/** Where a new card or iteration is placed on the board. */
|
|
16
|
+
export interface CardPosition {
|
|
17
|
+
readonly x: number;
|
|
18
|
+
readonly y: number;
|
|
19
|
+
}
|
|
15
20
|
export interface LayoutShift {
|
|
16
21
|
readonly id: string;
|
|
17
22
|
readonly from: Pick<LayoutCard, "x" | "y">;
|
|
18
23
|
readonly to: Pick<LayoutCard, "x" | "y">;
|
|
19
24
|
}
|
|
20
25
|
export declare function boundsOf(cards: readonly LayoutCard[]): Bounds;
|
|
21
|
-
|
|
22
|
-
export declare function nextCardPosition(cards: readonly LayoutCard[], gap: number): {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
};
|
|
26
|
+
export declare function nextCardPosition(cards: readonly LayoutCard[], gap: number): CardPosition;
|
|
26
27
|
export declare function pushOverlappingCards<T extends LayoutCard>(cards: readonly T[], protectedIds: ReadonlySet<string>, gap: number): T[];
|
|
27
|
-
export declare function iterationPosition(cards: readonly LayoutCard[], source: LayoutCard, gap: number):
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
};
|
|
31
|
-
/** Zooms and centers content inside the padded viewport; null for empty content. */
|
|
28
|
+
export declare function iterationPosition(cards: readonly LayoutCard[], source: LayoutCard, gap: number): CardPosition;
|
|
32
29
|
export declare function fitCamera(bounds: Bounds, viewport: {
|
|
33
30
|
width: number;
|
|
34
31
|
height: number;
|
|
35
|
-
}, padding: number):
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
zoom: number;
|
|
39
|
-
} | null;
|
|
32
|
+
}, padding: number): CanvasCamera | null;
|
|
40
33
|
export declare function centerCamera(bounds: Bounds, zoom: number, viewport: {
|
|
41
34
|
width: number;
|
|
42
35
|
height: number;
|
|
43
|
-
}):
|
|
44
|
-
x: number;
|
|
45
|
-
y: number;
|
|
46
|
-
zoom: number;
|
|
47
|
-
};
|
|
36
|
+
}): CanvasCamera;
|
|
48
37
|
export declare function layoutShifts(before: readonly LayoutCard[], after: readonly LayoutCard[]): LayoutShift[];
|
|
49
38
|
/** Replays recorded shifts as deltas, so frames moved since the creation keep their later moves. */
|
|
50
39
|
export declare function applyLayoutShifts<T extends LayoutCard>(cards: readonly T[], shifts: readonly LayoutShift[], forward: boolean): T[];
|
|
51
|
-
/** Reinserts recorded frames after their nearest recorded predecessor that still exists. */
|
|
52
40
|
export declare function reinsertInRecordedOrder<T extends LayoutCard>(cards: readonly T[], recorded: readonly T[], ids: ReadonlySet<string>): T[];
|
|
@@ -12,7 +12,6 @@ export function boundsOf(cards) {
|
|
|
12
12
|
}
|
|
13
13
|
return { minX, minY, maxX, maxY };
|
|
14
14
|
}
|
|
15
|
-
/** Places a new frame to the right of every frame, on the first frame's row. */
|
|
16
15
|
export function nextCardPosition(cards, gap) {
|
|
17
16
|
if (cards.length === 0)
|
|
18
17
|
return { x: 0, y: 0 };
|
|
@@ -55,7 +54,6 @@ export function iterationPosition(cards, source, gap) {
|
|
|
55
54
|
}
|
|
56
55
|
return { x, y };
|
|
57
56
|
}
|
|
58
|
-
/** Zooms and centers content inside the padded viewport; null for empty content. */
|
|
59
57
|
export function fitCamera(bounds, viewport, padding) {
|
|
60
58
|
const width = bounds.maxX - bounds.minX;
|
|
61
59
|
const height = bounds.maxY - bounds.minY;
|
|
@@ -92,7 +90,6 @@ export function applyLayoutShifts(cards, shifts, forward) {
|
|
|
92
90
|
return { ...card, x: card.x + to.x - from.x, y: card.y + to.y - from.y };
|
|
93
91
|
});
|
|
94
92
|
}
|
|
95
|
-
/** Reinserts recorded frames after their nearest recorded predecessor that still exists. */
|
|
96
93
|
export function reinsertInRecordedOrder(cards, recorded, ids) {
|
|
97
94
|
let next = [...cards];
|
|
98
95
|
for (const [index, added] of recorded.entries()) {
|
|
@@ -14,14 +14,7 @@ export function normalizeUrl(url) {
|
|
|
14
14
|
export function normalizedUrlKey(normalized) {
|
|
15
15
|
return `${normalized.origin}${canonicalRoutePath(normalized.pathname)}${normalized.search}`;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Directory-index pages resolve to the directory URL: `/` and `/index.html`
|
|
19
|
-
* are one route served from one file on every supported dev server, so card
|
|
20
|
-
* deduplication must treat them as the same key or link discovery spawns a
|
|
21
|
-
* duplicate card for the page already on the board.
|
|
22
|
-
*/
|
|
17
|
+
/** Dev servers serve `/` and `/index.html` from one file, so dedup must treat them as the same key. */
|
|
23
18
|
function canonicalRoutePath(pathname) {
|
|
24
|
-
// "/docs/index.html" becomes the directory form "/docs/"; a bare
|
|
25
|
-
// "/index.html" becomes "/".
|
|
26
19
|
return pathname.replace(/\/index\.html?$/i, "/");
|
|
27
20
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { CanvasFrame } from "./canvasFrame.js";
|
|
2
|
-
/**
|
|
3
|
-
* Runs the renderer and controller in the inspected window. The single Canvas
|
|
4
|
-
* card is the page itself, so no iframe or framing permission is needed.
|
|
5
|
-
*/
|
|
2
|
+
/** Runs renderer and controller in the inspected window so no iframe or framing permission is needed. */
|
|
6
3
|
export declare function enablePageSurface(): void;
|
|
7
4
|
export declare function isPageSurface(): boolean;
|
|
8
|
-
/** The page-surface card's frame: the inspected window, filling the viewport. */
|
|
9
5
|
export declare function getPageFrame(win?: Window): CanvasFrame;
|
|
10
|
-
/** True for events that start inside the inspector's own shadow root. */
|
|
11
6
|
export declare function isInspectorUiEvent(event: Event): boolean;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { NUDGE_UI_MOUNT_ID } from "../../transport/routes.js";
|
|
2
2
|
let pageSurface = false;
|
|
3
|
-
/**
|
|
4
|
-
* Runs the renderer and controller in the inspected window. The single Canvas
|
|
5
|
-
* card is the page itself, so no iframe or framing permission is needed.
|
|
6
|
-
*/
|
|
3
|
+
/** Runs renderer and controller in the inspected window so no iframe or framing permission is needed. */
|
|
7
4
|
export function enablePageSurface() {
|
|
8
5
|
pageSurface = true;
|
|
9
6
|
}
|
|
@@ -11,7 +8,6 @@ export function isPageSurface() {
|
|
|
11
8
|
return pageSurface;
|
|
12
9
|
}
|
|
13
10
|
const pageFrames = new WeakMap();
|
|
14
|
-
/** The page-surface card's frame: the inspected window, filling the viewport. */
|
|
15
11
|
export function getPageFrame(win = window) {
|
|
16
12
|
const existing = pageFrames.get(win);
|
|
17
13
|
if (existing)
|
|
@@ -28,7 +24,6 @@ export function getPageFrame(win = window) {
|
|
|
28
24
|
pageFrames.set(win, frame);
|
|
29
25
|
return frame;
|
|
30
26
|
}
|
|
31
|
-
/** True for events that start inside the inspector's own shadow root. */
|
|
32
27
|
export function isInspectorUiEvent(event) {
|
|
33
28
|
return pageSurface && event.composedPath().some((node) => node instanceof Element && node.id === NUDGE_UI_MOUNT_ID);
|
|
34
29
|
}
|
|
@@ -13,38 +13,19 @@ export interface CanvasProjectionStatus {
|
|
|
13
13
|
sentRevision: number;
|
|
14
14
|
appliedRevision: number;
|
|
15
15
|
}
|
|
16
|
-
/** Returns the current value-based identity for one Canvas card document. */
|
|
17
16
|
export declare function getCanvasPreviewDocument(cardId: string): PreviewDocument;
|
|
18
17
|
/** Invalidates a card's current document before its iframe is replaced. */
|
|
19
18
|
export declare function invalidateCanvasPreviewDocument(cardId: string): void;
|
|
20
|
-
export declare function computeProjection(): {
|
|
21
|
-
css: string;
|
|
22
|
-
revision: number;
|
|
23
|
-
sourceRevision: number;
|
|
24
|
-
managedStyles: CompiledManagedStyles;
|
|
25
|
-
instanceOverrides: readonly import("../changes/editModel.js").RenderedInstanceOverride[];
|
|
26
|
-
structuralChanges: readonly import("../changes/structuralTypes.js").StructuralChange[];
|
|
27
|
-
textContentChanges: readonly import("../changes/editModel.js").TextContentChangeRecord[];
|
|
28
|
-
componentOverrides: readonly import("../componentSemantics/types.js").ComponentOverride[];
|
|
29
|
-
runtimeIdentities?: readonly import("../runtime/runtimeIdentityClaims.js").RuntimeIdentityClaim[];
|
|
30
|
-
};
|
|
31
19
|
export declare function computeProjectionForCard(cardId: string): FrameProjection;
|
|
32
20
|
export declare function getCanonicalFrameProjection(cardId: string, expectedRevision: number): FrameProjection | null;
|
|
33
|
-
/**
|
|
34
|
-
* Re-sends the canonical projection after a temporary verification projection
|
|
35
|
-
* and settles once the renderer acknowledges it, so callers can treat the
|
|
36
|
-
* acknowledgement's stylesheet invalidation as part of their own work.
|
|
37
|
-
*/
|
|
21
|
+
/** Re-sends the canonical projection and settles on acknowledgement, so callers can rely on its stylesheet invalidation. */
|
|
38
22
|
export declare function restoreCanonicalFrameProjection(doc: Document): Promise<void>;
|
|
39
23
|
export declare function getCanvasCardIdForDocument(doc: Document): string | null;
|
|
40
24
|
export declare function resetProjectionRevision(): void;
|
|
41
|
-
/** Sends the canonical projection and returns its revision, or null when the frame has no window. */
|
|
42
25
|
export declare function sendProjectionToCard(card: Pick<CanvasCard, "id">, iframe: CanvasFrame): number | null;
|
|
43
|
-
/** Temporarily projects a snapshot through the renderer that owns the document. */
|
|
44
26
|
export declare function projectDraftToDocument(doc: Document, snapshot: DraftContents): Promise<number | null>;
|
|
45
|
-
/**
|
|
27
|
+
/** Whether an acknowledged temporary projection is still authoritative. */
|
|
46
28
|
export declare function isCanvasProjectionRevisionCurrent(doc: Document, expectedRevision: number): boolean;
|
|
47
|
-
/** Returns whether the live frame acknowledged its latest canonical workspace projection. */
|
|
48
29
|
export declare function isCanvasCanonicalProjectionRevisionCurrent(doc: Document, expectedRevision: number): boolean;
|
|
49
30
|
export declare function registerCardFrameSource(cardId: string, iframe: CanvasFrame): void;
|
|
50
31
|
export declare function registerCardFrame(cardId: string, iframe: CanvasFrame): void;
|
|
@@ -54,15 +35,13 @@ export declare function findCanvasFrameBySource(source: MessageEventSource | nul
|
|
|
54
35
|
cardId: string;
|
|
55
36
|
iframe: CanvasFrame;
|
|
56
37
|
} | null;
|
|
57
|
-
/** The registered frame rendering `doc
|
|
38
|
+
/** The registered frame rendering `doc`; on the page surface this is the controller document. */
|
|
58
39
|
export declare function findCanvasFrameByDocument(doc: Document | null | undefined): CanvasFrame | null;
|
|
59
40
|
export declare function subscribeFrameRegistry(listener: () => void): () => void;
|
|
60
|
-
/** Records the highest complete projection revision accepted by one frame. */
|
|
61
41
|
export declare function recordCanvasProjectionApplied(cardId: string, appliedRevision: number): void;
|
|
62
|
-
/** Returns projection progress for the document containing a selected element. */
|
|
63
42
|
export declare function getCanvasProjectionStatus(doc: Document): CanvasProjectionStatus | null;
|
|
64
43
|
export declare function subscribeCanvasProjectionAcknowledgements(listener: () => void): () => void;
|
|
65
44
|
export declare function getCanvasProjectionAcknowledgementVersion(): number;
|
|
66
|
-
/**
|
|
45
|
+
/** Bumped whenever a frame registers or unregisters, for `useSyncExternalStore`. */
|
|
67
46
|
export declare function getFrameRegistryVersion(): number;
|
|
68
47
|
export declare function projectToAllReadyCards(): void;
|
|
@@ -2,16 +2,14 @@ import { draftIdForCard, getDraftChanges, getActiveDraftChanges } from "../draft
|
|
|
2
2
|
import { getCanvasCards } from "./canvasStore.js";
|
|
3
3
|
import { getCanvasMode } from "./viewStore.js";
|
|
4
4
|
import { connectFrame } from "./frameConnection.js";
|
|
5
|
-
import { clearCanvasRenderedInstanceProjectionReports
|
|
6
|
-
import { clearCanvasTextProjectionReports
|
|
5
|
+
import { clearCanvasRenderedInstanceProjectionReports } from "../projection/renderedInstance.js";
|
|
6
|
+
import { clearCanvasTextProjectionReports } from "../projection/textProjection.js";
|
|
7
7
|
import { clearCanvasStructuralProjectionReports } from "../projection/structuralProjection.js";
|
|
8
8
|
import { invalidatePreviewDocumentSession, startPreviewDocumentSession, } from "../changes/previewDiagnostics.js";
|
|
9
9
|
import { compileDraftProjection, } from "../projection/draftProjection.js";
|
|
10
10
|
import { isOriginalPreviewActive } from "../shell/originalPreview.js";
|
|
11
11
|
import { disposeBrowserCssInspection, notifyBrowserStylesheetChange } from "../inspection/browserCssInspectionRegistry.js";
|
|
12
12
|
let revision = 0;
|
|
13
|
-
let lastRulesKey = null;
|
|
14
|
-
let lastPeekActive = false;
|
|
15
13
|
const draftPlans = new Map();
|
|
16
14
|
const frameProjectionStates = new Map();
|
|
17
15
|
const previewDocuments = new Map();
|
|
@@ -27,10 +25,8 @@ function createPreviewDocumentIdentity(cardId) {
|
|
|
27
25
|
previewDocuments.set(cardId, previewDocument);
|
|
28
26
|
return previewDocument;
|
|
29
27
|
}
|
|
30
|
-
/** Returns the current value-based identity for one Canvas card document. */
|
|
31
28
|
export function getCanvasPreviewDocument(cardId) {
|
|
32
|
-
// Pure getter:
|
|
33
|
-
// idempotent here; registerCardFrame owns session activation.
|
|
29
|
+
// Pure getter: registerCardFrame owns session activation; creating the identity here is idempotent.
|
|
34
30
|
return previewDocuments.get(cardId) ?? createPreviewDocumentIdentity(cardId);
|
|
35
31
|
}
|
|
36
32
|
/** Invalidates a card's current document before its iframe is replaced. */
|
|
@@ -44,47 +40,6 @@ export function invalidateCanvasPreviewDocument(cardId) {
|
|
|
44
40
|
invalidatePreviewDocumentSession(previewDocument.logicalDocument, previewDocument.sessionId);
|
|
45
41
|
previewDocuments.delete(cardId);
|
|
46
42
|
}
|
|
47
|
-
function projectionKey(plan) {
|
|
48
|
-
// Revision ordering protects every controller-owned projection dimension.
|
|
49
|
-
// In particular, a delete-only snapshot has empty CSS but must still advance
|
|
50
|
-
// past the snapshot already accepted by ready Canvas renderers.
|
|
51
|
-
return `${plan.managedStyles.css}\u0000${JSON.stringify(plan.instanceOverrides)}\u0000${JSON.stringify(plan.structuralChanges)}\u0000${JSON.stringify(plan.textContentChanges)}\u0000${JSON.stringify(plan.componentOverrides)}`;
|
|
52
|
-
}
|
|
53
|
-
export function computeProjection() {
|
|
54
|
-
const plan = compileDraftProjection(getActiveDraftChanges());
|
|
55
|
-
if (isOriginalPreviewActive()) {
|
|
56
|
-
// Hold-to-view-original: frames show the page without inspector changes
|
|
57
|
-
// while canonical intent (and its projection key) stays untouched.
|
|
58
|
-
if (!lastPeekActive) {
|
|
59
|
-
lastPeekActive = true;
|
|
60
|
-
revision += 1;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
...plan,
|
|
64
|
-
managedStyles: { rules: [], css: "" },
|
|
65
|
-
css: "",
|
|
66
|
-
instanceOverrides: [],
|
|
67
|
-
structuralChanges: [],
|
|
68
|
-
textContentChanges: [],
|
|
69
|
-
componentOverrides: [],
|
|
70
|
-
revision,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (lastPeekActive) {
|
|
74
|
-
// Force the canonical projection to resend after a peek even though its
|
|
75
|
-
// key is unchanged since the peek began.
|
|
76
|
-
lastPeekActive = false;
|
|
77
|
-
lastRulesKey = null;
|
|
78
|
-
}
|
|
79
|
-
setCanonicalRenderedInstanceOverrides(plan.instanceOverrides);
|
|
80
|
-
setCanonicalTextContentChanges(plan.textContentChanges);
|
|
81
|
-
const key = projectionKey(plan);
|
|
82
|
-
if (key !== lastRulesKey) {
|
|
83
|
-
lastRulesKey = key;
|
|
84
|
-
revision += 1;
|
|
85
|
-
}
|
|
86
|
-
return { ...plan, css: plan.managedStyles.css, revision };
|
|
87
|
-
}
|
|
88
43
|
export function computeProjectionForCard(cardId) {
|
|
89
44
|
const draftId = draftIdForCard(cardId);
|
|
90
45
|
const workspace = draftId ? getDraftChanges(draftId) : getActiveDraftChanges();
|
|
@@ -109,11 +64,7 @@ export function getCanonicalFrameProjection(cardId, expectedRevision) {
|
|
|
109
64
|
return null;
|
|
110
65
|
return plan;
|
|
111
66
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Re-sends the canonical projection after a temporary verification projection
|
|
114
|
-
* and settles once the renderer acknowledges it, so callers can treat the
|
|
115
|
-
* acknowledgement's stylesheet invalidation as part of their own work.
|
|
116
|
-
*/
|
|
67
|
+
/** Re-sends the canonical projection and settles on acknowledgement, so callers can rely on its stylesheet invalidation. */
|
|
117
68
|
export async function restoreCanonicalFrameProjection(doc) {
|
|
118
69
|
const id = getCanvasCardIdForDocument(doc);
|
|
119
70
|
const card = getCanvasCards().find((card) => card.id === id);
|
|
@@ -132,8 +83,6 @@ export function getCanvasCardIdForDocument(doc) {
|
|
|
132
83
|
}
|
|
133
84
|
export function resetProjectionRevision() {
|
|
134
85
|
revision = 0;
|
|
135
|
-
lastRulesKey = null;
|
|
136
|
-
lastPeekActive = false;
|
|
137
86
|
draftPlans.clear();
|
|
138
87
|
for (const state of frameProjectionStates.values()) {
|
|
139
88
|
state.sentRevision = -1;
|
|
@@ -144,7 +93,6 @@ export function resetProjectionRevision() {
|
|
|
144
93
|
projectionAcknowledgementVersion += 1;
|
|
145
94
|
notifyProjectionAcknowledgementListeners();
|
|
146
95
|
}
|
|
147
|
-
/** Sends the canonical projection and returns its revision, or null when the frame has no window. */
|
|
148
96
|
export function sendProjectionToCard(card, iframe) {
|
|
149
97
|
const win = iframe.contentWindow;
|
|
150
98
|
if (!win)
|
|
@@ -164,7 +112,7 @@ export function sendProjectionToCard(card, iframe) {
|
|
|
164
112
|
function sendProjectionMessage(cardId, iframe, rev, css, instanceOverrides, structuralChanges, textContentChanges, componentOverrides, runtimeIdentities, canonical = false) {
|
|
165
113
|
if (!iframe.contentWindow)
|
|
166
114
|
return;
|
|
167
|
-
markProjectionSent(cardId, iframe, rev, canonical);
|
|
115
|
+
markProjectionSent(cardId, iframe, rev, css, canonical);
|
|
168
116
|
connectFrame(cardId, iframe).post({
|
|
169
117
|
type: "replace-styles",
|
|
170
118
|
css,
|
|
@@ -176,7 +124,6 @@ function sendProjectionMessage(cardId, iframe, rev, css, instanceOverrides, stru
|
|
|
176
124
|
...(runtimeIdentities ? { runtimeIdentities: [...runtimeIdentities] } : {}),
|
|
177
125
|
});
|
|
178
126
|
}
|
|
179
|
-
/** Temporarily projects a snapshot through the renderer that owns the document. */
|
|
180
127
|
export async function projectDraftToDocument(doc, snapshot) {
|
|
181
128
|
const entry = [...frameProjectionStates.entries()].find(([, state]) => state.document === doc);
|
|
182
129
|
if (!entry)
|
|
@@ -187,10 +134,7 @@ export async function projectDraftToDocument(doc, snapshot) {
|
|
|
187
134
|
sendProjectionMessage(cardId, state.iframe, revision, plan.managedStyles.css, plan.instanceOverrides, plan.structuralChanges, plan.textContentChanges, plan.componentOverrides, plan.runtimeIdentities);
|
|
188
135
|
return waitForProjectionApplied(cardId, doc, revision);
|
|
189
136
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Resolves with `requestedRevision` once the frame acknowledges it, or null
|
|
192
|
-
* when a newer projection supersedes it, the frame is replaced, or 2s pass.
|
|
193
|
-
*/
|
|
137
|
+
/** Resolves with `requestedRevision` on acknowledgement; null when superseded, replaced, or after 2s. */
|
|
194
138
|
function waitForProjectionApplied(cardId, doc, requestedRevision) {
|
|
195
139
|
const initial = frameProjectionStates.get(cardId);
|
|
196
140
|
if (initial?.appliedRevision === requestedRevision && initial.sentRevision === requestedRevision) {
|
|
@@ -220,7 +164,7 @@ function waitForProjectionApplied(cardId, doc, requestedRevision) {
|
|
|
220
164
|
timer = setTimeout(() => finish(null), 2_000);
|
|
221
165
|
});
|
|
222
166
|
}
|
|
223
|
-
/**
|
|
167
|
+
/** Whether an acknowledged temporary projection is still authoritative. */
|
|
224
168
|
export function isCanvasProjectionRevisionCurrent(doc, expectedRevision) {
|
|
225
169
|
for (const state of frameProjectionStates.values()) {
|
|
226
170
|
if (state.document !== doc)
|
|
@@ -236,7 +180,6 @@ export function isCanvasProjectionRevisionCurrent(doc, expectedRevision) {
|
|
|
236
180
|
}
|
|
237
181
|
return false;
|
|
238
182
|
}
|
|
239
|
-
/** Returns whether the live frame acknowledged its latest canonical workspace projection. */
|
|
240
183
|
export function isCanvasCanonicalProjectionRevisionCurrent(doc, expectedRevision) {
|
|
241
184
|
for (const state of frameProjectionStates.values()) {
|
|
242
185
|
if (state.document !== doc)
|
|
@@ -279,6 +222,8 @@ export function registerCardFrame(cardId, iframe) {
|
|
|
279
222
|
appliedRevision: -1,
|
|
280
223
|
canonicalSentRevision: -1,
|
|
281
224
|
canonicalProjection: null,
|
|
225
|
+
sentCss: new Map(),
|
|
226
|
+
appliedCss: null,
|
|
282
227
|
});
|
|
283
228
|
}
|
|
284
229
|
else {
|
|
@@ -310,7 +255,7 @@ export function findCanvasFrameBySource(source) {
|
|
|
310
255
|
}
|
|
311
256
|
return null;
|
|
312
257
|
}
|
|
313
|
-
/** The registered frame rendering `doc
|
|
258
|
+
/** The registered frame rendering `doc`; on the page surface this is the controller document. */
|
|
314
259
|
export function findCanvasFrameByDocument(doc) {
|
|
315
260
|
if (!doc)
|
|
316
261
|
return null;
|
|
@@ -335,29 +280,34 @@ function getFrameDocument(iframe) {
|
|
|
335
280
|
return null;
|
|
336
281
|
}
|
|
337
282
|
}
|
|
338
|
-
function markProjectionSent(cardId, iframe, sentRevision, canonical = false) {
|
|
283
|
+
function markProjectionSent(cardId, iframe, sentRevision, css, canonical = false) {
|
|
339
284
|
const state = frameProjectionStates.get(cardId);
|
|
340
285
|
if (!state || state.iframe !== iframe)
|
|
341
286
|
return;
|
|
342
287
|
state.sentRevision = Math.max(state.sentRevision, sentRevision);
|
|
288
|
+
state.sentCss.set(sentRevision, css);
|
|
343
289
|
if (canonical)
|
|
344
290
|
state.canonicalSentRevision = sentRevision;
|
|
345
291
|
}
|
|
346
|
-
/** Records the highest complete projection revision accepted by one frame. */
|
|
347
292
|
export function recordCanvasProjectionApplied(cardId, appliedRevision) {
|
|
348
293
|
const state = frameProjectionStates.get(cardId);
|
|
349
294
|
if (!state || appliedRevision > state.sentRevision || appliedRevision <= state.appliedRevision)
|
|
350
295
|
return;
|
|
351
296
|
state.appliedRevision = appliedRevision;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
297
|
+
const css = state.sentCss.get(appliedRevision);
|
|
298
|
+
for (const sent of state.sentCss.keys()) {
|
|
299
|
+
if (sent <= appliedRevision)
|
|
300
|
+
state.sentCss.delete(sent);
|
|
301
|
+
}
|
|
302
|
+
// Renderer stylesheet writes don't invalidate the controller's CSSOM cache, so only a CSS change needs a refresh.
|
|
303
|
+
const cssChanged = css === undefined || css !== state.appliedCss;
|
|
304
|
+
state.appliedCss = css ?? null;
|
|
305
|
+
if (cssChanged && state.document && state.iframe.contentDocument === state.document) {
|
|
355
306
|
notifyBrowserStylesheetChange(state.document);
|
|
356
307
|
}
|
|
357
308
|
projectionAcknowledgementVersion += 1;
|
|
358
309
|
notifyProjectionAcknowledgementListeners();
|
|
359
310
|
}
|
|
360
|
-
/** Returns projection progress for the document containing a selected element. */
|
|
361
311
|
export function getCanvasProjectionStatus(doc) {
|
|
362
312
|
for (const state of frameProjectionStates.values()) {
|
|
363
313
|
if (state.document !== doc)
|
|
@@ -387,7 +337,7 @@ function notifyProjectionAcknowledgementListeners() {
|
|
|
387
337
|
}
|
|
388
338
|
}
|
|
389
339
|
let frameRegistryVersion = 0;
|
|
390
|
-
/**
|
|
340
|
+
/** Bumped whenever a frame registers or unregisters, for `useSyncExternalStore`. */
|
|
391
341
|
export function getFrameRegistryVersion() {
|
|
392
342
|
return frameRegistryVersion;
|
|
393
343
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { startRendererProjectionDiagnostics } from "./rendererStylesheet.js";
|
|
2
|
+
import { installRendererElementSelector } from "./rendererElementSelector.js";
|
|
1
3
|
export interface RendererBootstrapHandle {
|
|
2
4
|
teardown(): void;
|
|
3
5
|
}
|
|
4
|
-
|
|
6
|
+
/** Replaces the renderer resources a caller cannot exercise directly, such as jsdom-based browser tests. */
|
|
7
|
+
export interface RendererBootstrapResources {
|
|
8
|
+
readonly installElementSelector?: typeof installRendererElementSelector;
|
|
9
|
+
readonly startProjectionDiagnostics?: typeof startRendererProjectionDiagnostics;
|
|
10
|
+
}
|
|
11
|
+
export declare function bootstrapRenderer(resources?: RendererBootstrapResources): RendererBootstrapHandle | undefined;
|
|
@@ -106,8 +106,7 @@ function scheduleRendererTimer(owner, callback, delay) {
|
|
|
106
106
|
function teardownRenderer(owner) {
|
|
107
107
|
if (!owner.active)
|
|
108
108
|
return;
|
|
109
|
-
// Invalidate callbacks before releasing
|
|
110
|
-
// frame can still run after its source has been cancelled.
|
|
109
|
+
// Invalidate callbacks before releasing resources: queued microtasks or frames can still run.
|
|
111
110
|
owner.active = false;
|
|
112
111
|
if (activeRendererBootstrap?.owner === owner) {
|
|
113
112
|
activeRendererBootstrap = null;
|
|
@@ -129,7 +128,7 @@ function teardownRenderer(owner) {
|
|
|
129
128
|
restoreHistoryPatch();
|
|
130
129
|
clearRendererIdentity();
|
|
131
130
|
}
|
|
132
|
-
export function bootstrapRenderer() {
|
|
131
|
+
export function bootstrapRenderer(resources = {}) {
|
|
133
132
|
if (!getNudgeUiRuntimeConfig().capabilities.canvas)
|
|
134
133
|
return;
|
|
135
134
|
if (!isNudgeUiDev())
|
|
@@ -153,10 +152,10 @@ export function bootstrapRenderer() {
|
|
|
153
152
|
observeFrameMetadata(owner);
|
|
154
153
|
owner.resourceDisposers.push(() => disposeRuntimeIdentityClaims(document));
|
|
155
154
|
owner.resourceDisposers.push(subscribeNudgeUiRuntime(() => sendFrameRuntime(owner)));
|
|
156
|
-
const disposeDiagnostics = startRendererProjectionDiagnostics();
|
|
155
|
+
const disposeDiagnostics = (resources.startProjectionDiagnostics ?? startRendererProjectionDiagnostics)();
|
|
157
156
|
if (disposeDiagnostics)
|
|
158
157
|
owner.resourceDisposers.push(disposeDiagnostics);
|
|
159
|
-
const disposeSelector = installRendererElementSelector();
|
|
158
|
+
const disposeSelector = (resources.installElementSelector ?? installRendererElementSelector)();
|
|
160
159
|
if (disposeSelector)
|
|
161
160
|
owner.resourceDisposers.push(disposeSelector);
|
|
162
161
|
installRendererPanProxy(owner);
|
|
@@ -226,13 +225,7 @@ export function bootstrapRenderer() {
|
|
|
226
225
|
};
|
|
227
226
|
window.addEventListener("message", onMessage);
|
|
228
227
|
owner.listenerRemovers.push(() => window.removeEventListener("message", onMessage));
|
|
229
|
-
//
|
|
230
|
-
// iframe load AND on every hello it receives, but its answering listener
|
|
231
|
-
// attaches when the card component commits — normally long before any
|
|
232
|
-
// renderer finishes booting. The retries cover the residual window where
|
|
233
|
-
// a renderer's listeners go live before the controller's do (fast boot,
|
|
234
|
-
// slow controller compile). Every path is idempotent: setRendererIdentity
|
|
235
|
-
// overwrites, re-registration replaces, projection re-sends are safe.
|
|
228
|
+
// The controller's listener may attach after the renderer boots; retry briefly, and every path is idempotent.
|
|
236
229
|
let helloAttempts = 0;
|
|
237
230
|
const solicitHandshake = () => {
|
|
238
231
|
if (!ownsRendererBootstrap(owner) || getRendererIdentity() || helloAttempts >= 5)
|
|
@@ -357,8 +350,7 @@ function installRendererPanProxy(owner) {
|
|
|
357
350
|
panMoveUpdate.cancel();
|
|
358
351
|
return;
|
|
359
352
|
}
|
|
360
|
-
// Pointer-up can arrive before the next
|
|
361
|
-
// latest point before pan-end so the final drag position is not lost.
|
|
353
|
+
// Pointer-up can arrive before the next frame; flush the latest point so the final position is not lost.
|
|
362
354
|
panMoveUpdate.flush();
|
|
363
355
|
panning = false;
|
|
364
356
|
const identity = getRendererIdentity();
|
|
@@ -3,9 +3,4 @@ export declare const RENDERER_ELEMENT_ID_ATTR = "data-renderer-id";
|
|
|
3
3
|
export interface CidIndex {
|
|
4
4
|
elementId(el: HTMLElement): string;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Retains the historical factory name while replacing positional indexes with
|
|
8
|
-
* node identities. IDs are attached to the actual DOM node, so reorders and
|
|
9
|
-
* sibling insertions cannot redirect a delayed controller message.
|
|
10
|
-
*/
|
|
11
6
|
export declare function createCidIndex(_doc: Document): CidIndex;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/** Renderer-owned identity that survives DOM reorders for the lifetime of a node. */
|
|
2
2
|
export const RENDERER_ELEMENT_ID_ATTR = "data-renderer-id";
|
|
3
|
-
/**
|
|
4
|
-
* Retains the historical factory name while replacing positional indexes with
|
|
5
|
-
* node identities. IDs are attached to the actual DOM node, so reorders and
|
|
6
|
-
* sibling insertions cannot redirect a delayed controller message.
|
|
7
|
-
*/
|
|
8
3
|
export function createCidIndex(_doc) {
|
|
9
4
|
let nextId = 1;
|
|
10
5
|
const ids = new WeakMap();
|
|
@@ -9,7 +9,7 @@ import { resolveSelectionTarget, selectionTargetMode } from "../selection/select
|
|
|
9
9
|
import { escapeCssString } from "../projection/cssEscapes.js";
|
|
10
10
|
import { APPLICATION_GESTURE_EVENTS, blockApplicationClick, blockApplicationGesture, isInlineEditorTarget, isUserClick, } from "../overlay/clickPolicy.js";
|
|
11
11
|
import { EMPTY_TEXT_PROJECTION_ATTR } from "../projection/textProjection.js";
|
|
12
|
-
import {
|
|
12
|
+
import { getElementSpacingAtPoint, getElementSpacingHandleAtPoint, toSpacingDescriptor, } from "../overlay/spacingGestures.js";
|
|
13
13
|
import { COMMENT_CURSOR, INTERACTION_CURSOR_PROPERTY, rendererCursorValue } from "../ui/customCursors.js";
|
|
14
14
|
import { isInspectorUiEvent, isPageSurface } from "./pageSurface.js";
|
|
15
15
|
const REACT_FIBER_KEY = /^__reactFiber\$/;
|
|
@@ -171,24 +171,22 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
171
171
|
appliedRootCursor = cursor;
|
|
172
172
|
}
|
|
173
173
|
function reportHover(pending) {
|
|
174
|
-
const {
|
|
174
|
+
const { clear } = pending;
|
|
175
175
|
const identity = getRendererIdentity();
|
|
176
176
|
if (!identity)
|
|
177
177
|
return;
|
|
178
|
+
// Only the handle hit starts a drag and changes the cursor; the area-wide match is purely visual.
|
|
179
|
+
const elementSpacing = !commentMode && !clear && pending.point
|
|
180
|
+
? getElementSpacingAtPoint(document, pending.element, pending.point.x, pending.point.y)
|
|
181
|
+
: null;
|
|
182
|
+
// A margin belongs to a child of the hovered element; hovering it reports that child.
|
|
183
|
+
const element = elementSpacing?.handle?.element ?? elementSpacing?.area?.element ?? pending.element;
|
|
184
|
+
const spacing = elementSpacing?.handle?.element === element ? elementSpacing.handle : null;
|
|
185
|
+
const hoverSpacing = elementSpacing?.area?.element === element ? elementSpacing.area : null;
|
|
178
186
|
const cid = element.getAttribute("data-cid");
|
|
179
187
|
const selector = buildSelector(element);
|
|
180
188
|
const src = element.getAttribute("data-src") ?? "";
|
|
181
189
|
const rect = clear ? null : element.getBoundingClientRect();
|
|
182
|
-
// The handle hit is the only target that starts a drag, so it is the only
|
|
183
|
-
// one that changes the cursor. The area-wide match is purely visual.
|
|
184
|
-
const rawSpacing = !commentMode && !clear && pending.point
|
|
185
|
-
? getSpacingAffordanceAtPoint(document, pending.point.x, pending.point.y)
|
|
186
|
-
: null;
|
|
187
|
-
const spacing = rawSpacing && rawSpacing.element === element ? rawSpacing : null;
|
|
188
|
-
const rawHoverSpacing = !commentMode && !clear && pending.point
|
|
189
|
-
? getSpacingHoverAtPoint(document, pending.point.x, pending.point.y)
|
|
190
|
-
: null;
|
|
191
|
-
const hoverSpacing = rawHoverSpacing && rawHoverSpacing.element === element ? rawHoverSpacing : null;
|
|
192
190
|
if (spacing) {
|
|
193
191
|
setSpacingCursor(spacing.element, spacing.cursor);
|
|
194
192
|
}
|
|
@@ -282,7 +280,8 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
282
280
|
if (interactionsSuspended)
|
|
283
281
|
return;
|
|
284
282
|
updateMeasureState(event.altKey, true);
|
|
285
|
-
|
|
283
|
+
// Like mousemove, a pressed pointer reports drag moves, not hovers.
|
|
284
|
+
if (suppressHoverDuringSpacingDrag || pendingDrag)
|
|
286
285
|
return;
|
|
287
286
|
const target = event.target;
|
|
288
287
|
if (!(target instanceof Element))
|
|
@@ -298,6 +297,8 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
298
297
|
trackListener(window, "scroll", suppressHoverDuringScroll, true);
|
|
299
298
|
let pendingDrag = null;
|
|
300
299
|
let dragging = false;
|
|
300
|
+
// The browser clicks the common ancestor after a drag; that click must not reselect the ancestor.
|
|
301
|
+
let suppressClickAfterDrag = false;
|
|
301
302
|
let lastDragPoint = null;
|
|
302
303
|
let lastSelected = null;
|
|
303
304
|
trackListener(window, "nudge-ui:open", () => {
|
|
@@ -410,19 +411,15 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
410
411
|
const element = resolveSelectionTarget(event.target, selectionTargetMode(event));
|
|
411
412
|
if (!element)
|
|
412
413
|
return;
|
|
413
|
-
const spacingAffordance =
|
|
414
|
-
const spacing = spacingAffordance
|
|
415
|
-
? toSpacingDescriptor(spacingAffordance)
|
|
416
|
-
: null;
|
|
414
|
+
const spacingAffordance = getElementSpacingHandleAtPoint(document, element, event.clientX, event.clientY);
|
|
415
|
+
const spacing = spacingAffordance ? toSpacingDescriptor(spacingAffordance) : null;
|
|
417
416
|
if (spacing) {
|
|
418
417
|
suppressHoverDuringSpacingDrag = true;
|
|
419
418
|
hoverUpdate.cancel();
|
|
420
419
|
lastHoverPoint = null;
|
|
421
420
|
}
|
|
422
421
|
const identity = getRendererIdentity();
|
|
423
|
-
// A spacing drag owns the
|
|
424
|
-
// attempt for the same down event; padding and gaps are intentionally not
|
|
425
|
-
// editable text targets.
|
|
422
|
+
// A spacing drag owns the gesture; padding and gaps are not editable text targets.
|
|
426
423
|
if (identity && !spacing) {
|
|
427
424
|
const emptyProjectionId = event.target instanceof Element
|
|
428
425
|
? event.target.closest(`[${EMPTY_TEXT_PROJECTION_ATTR}]`)?.getAttribute(EMPTY_TEXT_PROJECTION_ATTR) ?? undefined
|
|
@@ -441,9 +438,10 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
441
438
|
};
|
|
442
439
|
sendToParent(message);
|
|
443
440
|
}
|
|
444
|
-
|
|
441
|
+
const owner = spacingAffordance?.element ?? element;
|
|
442
|
+
lastSelected = owner;
|
|
445
443
|
pendingDrag = {
|
|
446
|
-
element,
|
|
444
|
+
element: owner,
|
|
447
445
|
point: { x: event.clientX, y: event.clientY },
|
|
448
446
|
spacing,
|
|
449
447
|
};
|
|
@@ -501,6 +499,8 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
501
499
|
function finishDrag(event) {
|
|
502
500
|
dragMoveUpdate.cancel();
|
|
503
501
|
if (dragging) {
|
|
502
|
+
suppressClickAfterDrag = true;
|
|
503
|
+
window.setTimeout(() => { suppressClickAfterDrag = false; }, 0);
|
|
504
504
|
event.preventDefault();
|
|
505
505
|
const point = { x: event.clientX, y: event.clientY };
|
|
506
506
|
lastDragPoint = point;
|
|
@@ -545,9 +545,7 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
545
545
|
sendToParent(message);
|
|
546
546
|
return phase === "keydown";
|
|
547
547
|
}
|
|
548
|
-
//
|
|
549
|
-
// the iframe document. A page-level window handler can otherwise stop the
|
|
550
|
-
// event before it reaches the document listener.
|
|
548
|
+
// Must run before application capture handlers on the iframe document, which can stop the event.
|
|
551
549
|
trackListener(window, "keydown", (event) => {
|
|
552
550
|
if (isEditableEvent(event))
|
|
553
551
|
return;
|
|
@@ -692,11 +690,15 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
|
|
|
692
690
|
trackListener(document, "click", (event) => {
|
|
693
691
|
if (interactionsSuspended || !acceptsClick(event))
|
|
694
692
|
return;
|
|
693
|
+
if (suppressClickAfterDrag) {
|
|
694
|
+
suppressClickAfterDrag = false;
|
|
695
|
+
blockApplicationClick(event);
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
695
698
|
const target = event.target;
|
|
696
699
|
if (!(target instanceof Element))
|
|
697
700
|
return;
|
|
698
|
-
// Design-tool clicks are editing gestures and must not reach the
|
|
699
|
-
// rendered application; the Select tool is how the app receives them.
|
|
701
|
+
// Design-tool clicks are editing gestures and must not reach the rendered application.
|
|
700
702
|
const el = resolveSelectionTarget(target, selectionTargetMode(event));
|
|
701
703
|
if (!el) {
|
|
702
704
|
blockApplicationClick(event);
|