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
|
@@ -16,7 +16,6 @@ function hasOnlyKeys(value, allowed) {
|
|
|
16
16
|
export const TEXT_PROJECTION_ATTR = "data-projection-text";
|
|
17
17
|
/** Inspector-owned hit target for a projected text node whose value is empty. */
|
|
18
18
|
export const EMPTY_TEXT_PROJECTION_ATTR = "data-empty-text";
|
|
19
|
-
/** Inspector-owned exact-node evidence paired with EMPTY_TEXT_PROJECTION_ATTR. */
|
|
20
19
|
export const EMPTY_TEXT_PROJECTION_PATH_ATTR = "data-empty-text-path";
|
|
21
20
|
const UNSAFE_TEXT_TAGS = new Set(["SCRIPT", "STYLE", "TEXTAREA", "OPTION"]);
|
|
22
21
|
const UNSAFE_MIXED_DESCENDANT_TAGS = new Set([
|
|
@@ -50,19 +49,14 @@ function isEmptyTextAffordance(node) {
|
|
|
50
49
|
function hasInlineTextEditor(element) {
|
|
51
50
|
return element.querySelector('[data-inline-editor="true"]') !== null;
|
|
52
51
|
}
|
|
53
|
-
/**
|
|
54
|
-
* What the application last rendered into each projected Text node. A source
|
|
55
|
-
* update can render the projected value itself, so restoring `before` would
|
|
56
|
-
* overwrite real application output that the framework will not repaint.
|
|
57
|
-
*/
|
|
52
|
+
/** A restore must not overwrite real application output that the framework will not repaint. */
|
|
58
53
|
let applicationText = new WeakMap();
|
|
59
54
|
function isInlineEditorNode(node) {
|
|
60
55
|
return node.nodeType === 1 && (node.matches('[data-inline-editor="true"]')
|
|
61
56
|
|| hasInlineTextEditor(node));
|
|
62
57
|
}
|
|
63
58
|
function recordApplicationWrites(records) {
|
|
64
|
-
// The inline editor
|
|
65
|
-
// the draft, in one task. That write belongs to the editor.
|
|
59
|
+
// The inline editor writes the draft while swapping its wrapper back in the same task; that write belongs to the editor.
|
|
66
60
|
if (records.some((record) => record.type === "childList"
|
|
67
61
|
&& [...record.addedNodes, ...record.removedNodes].some(isInlineEditorNode)))
|
|
68
62
|
return;
|
|
@@ -167,8 +161,7 @@ function nodeAtPath(root, path) {
|
|
|
167
161
|
}
|
|
168
162
|
return current;
|
|
169
163
|
}
|
|
170
|
-
/**
|
|
171
|
-
* child path only when one bounded before/after text node remains unique. */
|
|
164
|
+
/** Tolerates a changed child path only when one before/after text node remains unique. */
|
|
172
165
|
export function resolveTextProjectionTextNode(element, target, expectedText = target.beforeText) {
|
|
173
166
|
if (target.textNodePath) {
|
|
174
167
|
const atPath = nodeAtPath(element, target.textNodePath);
|
|
@@ -191,22 +184,17 @@ export function resolveTextProjectionTextNode(element, target, expectedText = ta
|
|
|
191
184
|
}
|
|
192
185
|
return matches.length === 1 ? matches[0] : null;
|
|
193
186
|
}
|
|
194
|
-
/** Whether an element's text is code, form state, or other non-prose content. */
|
|
195
187
|
export function isUnsafeTextHost(element) {
|
|
196
188
|
return UNSAFE_TEXT_TAGS.has(element.tagName);
|
|
197
189
|
}
|
|
198
|
-
/** Whether an application-owned editing region contains the element. */
|
|
199
190
|
export function isInApplicationEditingHost(element) {
|
|
200
191
|
const editingHost = element.closest("[contenteditable]");
|
|
201
192
|
return Boolean(editingHost
|
|
202
193
|
&& editingHost.getAttribute("data-inline-editor") !== "true"
|
|
203
194
|
&& editingHost.getAttribute("contenteditable") !== "false");
|
|
204
195
|
}
|
|
205
|
-
/** Whether replacing one text node inside the element keeps its authored markup. */
|
|
206
196
|
export function hasSafeMixedDescendants(element) {
|
|
207
|
-
// <br> only controls line layout
|
|
208
|
-
// node, so keeping the break while changing that node is safe; formatting
|
|
209
|
-
// descendants below still reject a flattening text projection.
|
|
197
|
+
// <br> only controls line layout, so it stays allowed; the projection targets one exact text node.
|
|
210
198
|
for (const descendant of Array.from(element.querySelectorAll("*"))) {
|
|
211
199
|
if (UNSAFE_MIXED_DESCENDANT_TAGS.has(descendant.tagName))
|
|
212
200
|
return false;
|
|
@@ -228,9 +216,7 @@ function textHostIsSafe(element, allowEmpty = false, target) {
|
|
|
228
216
|
&& (allowEmpty || textNode.nodeValue?.length)
|
|
229
217
|
&& hasSafeMixedDescendants(element));
|
|
230
218
|
}
|
|
231
|
-
//
|
|
232
|
-
// the retained empty Text node. Ignore it when proving that a direct leaf
|
|
233
|
-
// remains safe; otherwise the affordance would invalidate its own target.
|
|
219
|
+
// Ignore inspector-owned affordances here; otherwise the affordance would invalidate its own target.
|
|
234
220
|
const applicationChildren = Array.from(element.children)
|
|
235
221
|
.filter((child) => !isEmptyTextAffordance(child)
|
|
236
222
|
&& child.getAttribute("data-inline-editor") !== "true");
|
|
@@ -240,17 +226,10 @@ function textHostIsSafe(element, allowEmpty = false, target) {
|
|
|
240
226
|
if (textNodes.length === 1) {
|
|
241
227
|
return allowEmpty || Boolean(textNodes[0]?.nodeValue?.length);
|
|
242
228
|
}
|
|
243
|
-
// The
|
|
244
|
-
// that inspector-owned wrapper as transparent while validating the
|
|
245
|
-
// canonical projection; otherwise its insertion would self-report as an
|
|
246
|
-
// application reconciliation and remove the re-entry slot mid-session.
|
|
229
|
+
// The inline editor's wrapper is inspector-owned; treating it as an application child would drop the re-entry slot.
|
|
247
230
|
const editingHosts = Array.from(element.children)
|
|
248
231
|
.filter((child) => child.getAttribute("data-inline-editor") === "true");
|
|
249
|
-
// The browser may split
|
|
250
|
-
// native editor receives its first input. The wrapper is still inspector
|
|
251
|
-
// owned; its plain-text input guards are responsible for rejecting rich or
|
|
252
|
-
// paragraph edits, so validation must not cancel the session on that
|
|
253
|
-
// transient child shape.
|
|
232
|
+
// The browser may split the empty Text node on first input; that transient shape must not cancel the session.
|
|
254
233
|
return editingHosts.length === 1;
|
|
255
234
|
}
|
|
256
235
|
function sourceCandidates(doc, sourceSite) {
|
|
@@ -274,7 +253,6 @@ function evidenceMatches(element, target, expectedText) {
|
|
|
274
253
|
&& target.textNodePath === undefined
|
|
275
254
|
&& (element.textContent ?? "") === ""));
|
|
276
255
|
}
|
|
277
|
-
/** Capture stable source/evidence identity without retaining a DOM reference. */
|
|
278
256
|
export function captureTextProjectionTarget(element, beforeText = element.textContent ?? "", selectedTextNode) {
|
|
279
257
|
if (!element.isConnected)
|
|
280
258
|
return null;
|
|
@@ -306,11 +284,7 @@ export function captureTextProjectionTarget(element, beforeText = element.textCo
|
|
|
306
284
|
...pathTarget,
|
|
307
285
|
};
|
|
308
286
|
}
|
|
309
|
-
/**
|
|
310
|
-
* Resolve against source identity and bounded evidence. Occurrence is kept as
|
|
311
|
-
* presentation metadata only and is never used to choose among identical
|
|
312
|
-
* repeated outputs.
|
|
313
|
-
*/
|
|
287
|
+
/** Occurrence is presentation metadata only; identical repeated outputs resolve as ambiguous. */
|
|
314
288
|
export function resolveTextProjectionTarget(doc, target, afterText) {
|
|
315
289
|
const candidates = sourceCandidates(doc, target.sourceSite);
|
|
316
290
|
const evidence = candidates.filter((element) => evidenceMatches(element, target, target.beforeText)
|
|
@@ -355,9 +329,7 @@ function emptyTextAffordanceFor(doc, state, change, element) {
|
|
|
355
329
|
return null;
|
|
356
330
|
const parentElement = parent;
|
|
357
331
|
const path = markerKey(change.target);
|
|
358
|
-
//
|
|
359
|
-
// existing slot remains beside that wrapper; search the whole projected
|
|
360
|
-
// root before creating another slot inside the editing host.
|
|
332
|
+
// Search the whole root before creating another slot; during re-entry the editor wrapper sits between the slot and the Text node.
|
|
361
333
|
const existing = Array.from(element.querySelectorAll(`[${EMPTY_TEXT_PROJECTION_ATTR}]`))
|
|
362
334
|
.find((child) => child.getAttribute(EMPTY_TEXT_PROJECTION_ATTR) === change.id
|
|
363
335
|
&& child.getAttribute(EMPTY_TEXT_PROJECTION_PATH_ATTR) === path);
|
|
@@ -373,18 +345,13 @@ function emptyTextAffordanceFor(doc, state, change, element) {
|
|
|
373
345
|
affordance.setAttribute("role", "presentation");
|
|
374
346
|
affordance.setAttribute("contenteditable", "false");
|
|
375
347
|
affordance.tabIndex = -1;
|
|
376
|
-
//
|
|
377
|
-
// interaction stylesheet supplies its visible, borderless hit geometry.
|
|
348
|
+
// Never a source identity; the interaction stylesheet supplies its hit geometry.
|
|
378
349
|
affordance.hidden = !isInteractionStylesInstalled(doc);
|
|
379
350
|
parentElement.insertBefore(affordance, textNode.nextSibling);
|
|
380
351
|
state.emptyAffordances.set(change.id, affordance);
|
|
381
352
|
return affordance;
|
|
382
353
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Keep inspector-owned empty-text hit slots aligned with the canonical text
|
|
385
|
-
* projection. Slots are colocated with the exact retained Text node, so they
|
|
386
|
-
* do not replace application structure or alter the durable text path.
|
|
387
|
-
*/
|
|
354
|
+
/** Slots are colocated with the retained Text node so they never alter the durable text path. */
|
|
388
355
|
function syncEmptyTextAffordances(doc, state, changes) {
|
|
389
356
|
const emptyChanges = new Map(changes.filter((change) => change.after.length === 0).map((change) => [change.id, change]));
|
|
390
357
|
const seen = new Set();
|
|
@@ -422,7 +389,6 @@ function syncEmptyTextAffordances(doc, state, changes) {
|
|
|
422
389
|
emptyTextAffordanceFor(doc, state, change, applied.element);
|
|
423
390
|
}
|
|
424
391
|
}
|
|
425
|
-
/** Returns the canonical record represented by an inspector empty-text slot. */
|
|
426
392
|
export function getTextContentChangeById(changeId) {
|
|
427
393
|
return canonicalChanges.get(changeId) ?? null;
|
|
428
394
|
}
|
|
@@ -458,9 +424,7 @@ function restoreAppliedProjection(state, applied) {
|
|
|
458
424
|
return;
|
|
459
425
|
if (!hasProjectionMarker(element, applied.change.target, applied.change.id))
|
|
460
426
|
return;
|
|
461
|
-
//
|
|
462
|
-
// clear. The marker, identity evidence, and projected value must all still
|
|
463
|
-
// belong to us; text alone is not proof after a source-site identity change.
|
|
427
|
+
// Only restore when the marker and identity evidence still match; text alone is not proof.
|
|
464
428
|
if (!textProjectionIdentityMatches(element, applied.change))
|
|
465
429
|
return;
|
|
466
430
|
const textNode = resolveTextProjectionTextNode(element, applied.change.target, applied.change.after);
|
|
@@ -491,11 +455,7 @@ function validationStatus(applied) {
|
|
|
491
455
|
const directEmpty = applied.change.target.textNodePath === undefined
|
|
492
456
|
&& applied.change.after.length === 0
|
|
493
457
|
&& (element.textContent ?? "") === "";
|
|
494
|
-
// While an empty projection is
|
|
495
|
-
// draft value that intentionally differs from the canonical empty value.
|
|
496
|
-
// Keep the projection applied until the editor restores its Text node and
|
|
497
|
-
// appends the next canonical snapshot; otherwise removing the slot changes
|
|
498
|
-
// the wrapper's ownership and cancels the draft mid-keystroke.
|
|
458
|
+
// While an empty projection is reopened the editor's draft intentionally differs; dropping it mid-keystroke would cancel the draft.
|
|
499
459
|
const inlineDraft = hasInlineTextEditor(element);
|
|
500
460
|
const identityValid = textProjectionIdentityMatches(element, applied.change);
|
|
501
461
|
const safe = textHostIsSafe(element, applied.change.after.length === 0, applied.change.target);
|
|
@@ -504,12 +464,7 @@ function validationStatus(applied) {
|
|
|
504
464
|
}
|
|
505
465
|
return "applied";
|
|
506
466
|
}
|
|
507
|
-
/**
|
|
508
|
-
* A controller can hydrate before a lazy route has mounted its tracked roots.
|
|
509
|
-
* Keep a missing/ambiguous record pending and retry only when the document
|
|
510
|
-
* mutates; an overridden projection remains authoritative and is never
|
|
511
|
-
* re-applied.
|
|
512
|
-
*/
|
|
467
|
+
/** Missing/ambiguous records stay pending until the document mutates; an overridden projection is never re-applied. */
|
|
513
468
|
function resolvePendingProjection(doc, state, applied) {
|
|
514
469
|
if (applied.status !== "missing" && applied.status !== "ambiguous") {
|
|
515
470
|
return validationStatus(applied);
|
|
@@ -593,7 +548,6 @@ function getDocumentState(doc) {
|
|
|
593
548
|
documentStates.set(doc, state);
|
|
594
549
|
return state;
|
|
595
550
|
}
|
|
596
|
-
/** Apply one controller-owned text snapshot to a document adapter. */
|
|
597
551
|
export function applyTextContentProjection(doc, changes) {
|
|
598
552
|
if (!isNudgeUiDev())
|
|
599
553
|
return [];
|
|
@@ -601,9 +555,7 @@ export function applyTextContentProjection(doc, changes) {
|
|
|
601
555
|
setCanonicalTextContentChanges(changes);
|
|
602
556
|
const key = JSON.stringify(changes);
|
|
603
557
|
if (state.snapshotKey === key) {
|
|
604
|
-
//
|
|
605
|
-
// reporting so a pending MutationObserver callback cannot leave a stale
|
|
606
|
-
// "applied" result visible to the Changes Log.
|
|
558
|
+
// Validate before reporting so a pending observer callback cannot leave a stale result in the Changes Log.
|
|
607
559
|
validateAppliedProjection(doc, state);
|
|
608
560
|
const reports = reportsForSnapshot(state, changes);
|
|
609
561
|
storeReports(doc, reports);
|
|
@@ -612,10 +564,7 @@ export function applyTextContentProjection(doc, changes) {
|
|
|
612
564
|
const previous = state.applied;
|
|
613
565
|
const next = new Map();
|
|
614
566
|
const incomingIds = new Set(changes.map((change) => change.id));
|
|
615
|
-
//
|
|
616
|
-
// marker/value still owned by that record; every surviving record keeps its
|
|
617
|
-
// current application status and must not be replayed merely because an
|
|
618
|
-
// unrelated change altered the shared snapshot.
|
|
567
|
+
// Removed records are an explicit revert; surviving records keep their status and must not be replayed because an unrelated change altered the snapshot.
|
|
619
568
|
for (const [id, applied] of previous) {
|
|
620
569
|
if (incomingIds.has(id))
|
|
621
570
|
continue;
|
|
@@ -663,9 +612,7 @@ export function applyTextContentProjection(doc, changes) {
|
|
|
663
612
|
}
|
|
664
613
|
state.applied = next;
|
|
665
614
|
syncEmptyTextAffordances(doc, state, changes);
|
|
666
|
-
//
|
|
667
|
-
// also cleans a marker left by a previous runtime instance without touching
|
|
668
|
-
// a surviving overridden projection in `next`.
|
|
615
|
+
// Also cleans markers left by a previous runtime instance without touching a surviving overridden projection.
|
|
669
616
|
for (const marker of Array.from(doc.querySelectorAll(`[${TEXT_PROJECTION_ATTR}]`))) {
|
|
670
617
|
const markers = readProjectionMarkers(marker);
|
|
671
618
|
for (const [key, id] of markers) {
|
|
@@ -10,6 +10,5 @@ export interface PromptSettingsFieldsProps {
|
|
|
10
10
|
onChange: (value: string) => void;
|
|
11
11
|
instructionsRef?: RefObject<HTMLTextAreaElement | null>;
|
|
12
12
|
}
|
|
13
|
-
/** Edits the instructions appended to every generated prompt. */
|
|
14
13
|
export declare function PromptSettingsFields({ value, onChange, instructionsRef, }: PromptSettingsFieldsProps): ReactElement;
|
|
15
14
|
export declare function PromptSettingsDialog({ open, value, onChange, onOpenChange, }: PromptSettingsDialogProps): ReactElement;
|
|
@@ -3,7 +3,6 @@ import { useRef } from "react";
|
|
|
3
3
|
import { Dialog } from "@base-ui/react/dialog";
|
|
4
4
|
import { IconX } from "@tabler/icons-react";
|
|
5
5
|
import { portalContainer } from "../ui/portalContainer.js";
|
|
6
|
-
/** Edits the instructions appended to every generated prompt. */
|
|
7
6
|
export function PromptSettingsFields({ value, onChange, instructionsRef, }) {
|
|
8
7
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "prompt-settings__field", children: _jsx("textarea", { ref: instructionsRef, id: "nudge-ui-custom-instructions", className: "prompt-settings__textarea", "data-test": "prompt-custom-instructions", "aria-label": "Custom instructions", rows: 6, value: value, onChange: (event) => onChange(event.currentTarget.value) }) }), _jsx("div", { className: "prompt-settings__actions", children: _jsx(Dialog.Close, { className: "button button--primary", "data-test": "prompt-settings-done", type: "button", children: "Done" }) })] }));
|
|
9
8
|
}
|
|
@@ -27,14 +27,6 @@ export declare function getClipboardHandoffRecords(draftId: string): {
|
|
|
27
27
|
structuralChanges: StructuralChange[];
|
|
28
28
|
};
|
|
29
29
|
export declare function reconcileClipboardHandoff(doc?: Document): Promise<number>;
|
|
30
|
-
/**
|
|
31
|
-
* Verifies copied edits after the document changes. Each check briefly removes
|
|
32
|
-
* the copied preview, so a check that reconciles nothing doubles the minimum
|
|
33
|
-
* interval before the next one: a page that mutates continuously (clocks,
|
|
34
|
-
* carousels) would otherwise flash the preview every few hundred milliseconds.
|
|
35
|
-
* Later changes never postpone a pending check, so a busy page is still
|
|
36
|
-
* checked once per interval. Returning to the page or copying a new prompt
|
|
37
|
-
* resets the interval.
|
|
38
|
-
*/
|
|
30
|
+
/** A check briefly removes the copied preview, so reconciling nothing doubles the interval to avoid flashing on continuously mutating pages. */
|
|
39
31
|
export declare function startClipboardHandoffController(doc?: Document): () => void;
|
|
40
32
|
export {};
|
|
@@ -126,15 +126,7 @@ export async function reconcileClipboardHandoff(doc = document) {
|
|
|
126
126
|
}
|
|
127
127
|
const CHECK_DELAY_MS = 450;
|
|
128
128
|
const MAX_CHECK_DELAY_MS = 8_000;
|
|
129
|
-
/**
|
|
130
|
-
* Verifies copied edits after the document changes. Each check briefly removes
|
|
131
|
-
* the copied preview, so a check that reconciles nothing doubles the minimum
|
|
132
|
-
* interval before the next one: a page that mutates continuously (clocks,
|
|
133
|
-
* carousels) would otherwise flash the preview every few hundred milliseconds.
|
|
134
|
-
* Later changes never postpone a pending check, so a busy page is still
|
|
135
|
-
* checked once per interval. Returning to the page or copying a new prompt
|
|
136
|
-
* resets the interval.
|
|
137
|
-
*/
|
|
129
|
+
/** A check briefly removes the copied preview, so reconciling nothing doubles the interval to avoid flashing on continuously mutating pages. */
|
|
138
130
|
export function startClipboardHandoffController(doc = document) {
|
|
139
131
|
const view = doc.defaultView;
|
|
140
132
|
let timer = null;
|
|
@@ -6,6 +6,6 @@ export interface FrameworkHints {
|
|
|
6
6
|
framework?: string;
|
|
7
7
|
stylingSystem?: string;
|
|
8
8
|
}
|
|
9
|
-
/** Counts the
|
|
9
|
+
/** Counts the exported intents, not the raw gesture history. */
|
|
10
10
|
export declare function countPromptChanges(changes: readonly ChangeRecord[], structuralChanges?: readonly StructuralChange[], sketchCount?: number): number;
|
|
11
11
|
export declare function generatePrompt(changes: ChangeRecord[], frameworkHints?: FrameworkHints, structuralChanges?: readonly StructuralChange[], customInstructions?: string, sketches?: readonly AgentSketchMetadata[], comments?: readonly ElementComment[]): string;
|
|
@@ -11,11 +11,11 @@ const EMPTY_SENTINEL = "<!-- No changes to export -->\n\nThe changes log is empt
|
|
|
11
11
|
/** Labels describe the observed tag, without guessing its role in the page. */
|
|
12
12
|
function elementLabel(tag) {
|
|
13
13
|
const normalized = normalizeRuntimeTag(tag);
|
|
14
|
-
const labels =
|
|
15
|
-
p
|
|
16
|
-
textarea
|
|
17
|
-
|
|
18
|
-
const label = /^h[1-6]$/.test(normalized) ? "Heading" : labels
|
|
14
|
+
const labels = new Map([
|
|
15
|
+
["p", "Paragraph"], ["button", "Button"], ["a", "Link"], ["img", "Image"], ["input", "Input"],
|
|
16
|
+
["textarea", "Text area"], ["select", "Select"], ["form", "Form"], ["nav", "Navigation"], ["section", "Section"],
|
|
17
|
+
]);
|
|
18
|
+
const label = /^h[1-6]$/.test(normalized) ? "Heading" : labels.get(normalized) ?? "Element";
|
|
19
19
|
return normalized ? `${label} (${promptText(`<${normalized}>`)})` : label;
|
|
20
20
|
}
|
|
21
21
|
/** Runtime IDs identify one DOM element; authored sites can render several items. */
|
|
@@ -86,9 +86,7 @@ function elementChangeLine(rec) {
|
|
|
86
86
|
}
|
|
87
87
|
if (rec.newToken) {
|
|
88
88
|
const before = rec.oldRawValue !== undefined ? `\`${rec.oldRawValue}\` → ` : "";
|
|
89
|
-
//
|
|
90
|
-
// (adapter literal or var(cssName)); a bare var(name) would be invalid
|
|
91
|
-
// CSS for adapter tokens whose names are not custom-property names.
|
|
89
|
+
// Adapter token names are not always custom-property names, so emit the literal the stylesheet wrote.
|
|
92
90
|
return `- **Change:** ${property}: ${before}\`${tokenReference(rec.newToken)}\``;
|
|
93
91
|
}
|
|
94
92
|
if (rec.rawValue !== undefined) {
|
|
@@ -221,12 +219,7 @@ function selectedItemLine(group, sourceLocation) {
|
|
|
221
219
|
function setHeading(label, tag) {
|
|
222
220
|
return tag ? `${label} (${promptText(`<${normalizeRuntimeTag(tag)}>`)})` : label;
|
|
223
221
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Coordinate precision follows each element's identity origin, not the
|
|
226
|
-
* document's framework hint (ADR-0011 Stage 5). The active host Adapter
|
|
227
|
-
* declares which origins carry exact authored coordinates through the
|
|
228
|
-
* runtime configuration; hosts that declare nothing are exact everywhere.
|
|
229
|
-
*/
|
|
222
|
+
/** Precision follows each element's identity origin, not the framework hint; hosts that declare nothing are exact everywhere. */
|
|
230
223
|
function hasExactAuthoredCoordinates(policy, cid, file) {
|
|
231
224
|
if (policy === null)
|
|
232
225
|
return true;
|
|
@@ -235,11 +228,6 @@ function hasExactAuthoredCoordinates(policy, cid, file) {
|
|
|
235
228
|
}
|
|
236
229
|
return policy.exactFileExtensions.some((extension) => file.endsWith(extension));
|
|
237
230
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Formats one source location for a prompt. Exact origins keep the
|
|
240
|
-
* authored column; line-only origins — and sites whose column is unknown —
|
|
241
|
-
* degrade to `file:line` rather than fabricating precision.
|
|
242
|
-
*/
|
|
243
231
|
function formatSourceLocation(policy, source) {
|
|
244
232
|
if (hasExactAuthoredCoordinates(policy, source.cid, source.file) && source.column > 0) {
|
|
245
233
|
return `${source.file}:${source.line}:${source.column}`;
|
|
@@ -259,8 +247,7 @@ function renderedInstanceDescription(ref) {
|
|
|
259
247
|
return `the element named ${promptText(ariaLabel)}${source}`;
|
|
260
248
|
if (props)
|
|
261
249
|
return `the element with props ${promptText(props)}${source}`;
|
|
262
|
-
//
|
|
263
|
-
// repeated outputs from the same source site.
|
|
250
|
+
// Without semantic evidence, the ordinal is the only way to distinguish repeated outputs from one source site.
|
|
264
251
|
return `rendered instance ${ref.locator.occurrence + 1} of ${sourceSiteLabel(ref)}`;
|
|
265
252
|
}
|
|
266
253
|
function structuralChangeLine(change) {
|
|
@@ -324,9 +311,7 @@ function canonicalizeStructuralChanges(changes) {
|
|
|
324
311
|
&& first.presentation.fromIndex === latest.presentation.toIndex;
|
|
325
312
|
if (returnedToStart)
|
|
326
313
|
continue;
|
|
327
|
-
//
|
|
328
|
-
// context when the gesture crossed intermediate containers so the prompt
|
|
329
|
-
// describes the authored move rather than the drag history.
|
|
314
|
+
// Keep the first source context so the prompt describes the authored move, not the drag history.
|
|
330
315
|
if (first && first !== latest && latest.kind === "move") {
|
|
331
316
|
canonical.push({
|
|
332
317
|
...latest,
|
|
@@ -344,7 +329,7 @@ function canonicalizeStructuralChanges(changes) {
|
|
|
344
329
|
}
|
|
345
330
|
return canonical;
|
|
346
331
|
}
|
|
347
|
-
/** Counts the
|
|
332
|
+
/** Counts the exported intents, not the raw gesture history. */
|
|
348
333
|
export function countPromptChanges(changes, structuralChanges = [], sketchCount = 0) {
|
|
349
334
|
return canonicalizeChanges([...changes]).length + canonicalizeStructuralChanges(structuralChanges).length + sketchCount;
|
|
350
335
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/** The default guidance included in every generated prompt. */
|
|
2
1
|
export declare const DEFAULT_CUSTOM_INSTRUCTIONS = "Preserve existing tokens, logical properties, and CSS intent while applying these rendered changes.";
|
|
3
2
|
declare function storageKey(projectId: string): string;
|
|
4
|
-
/** Reads the project-scoped custom prompt instructions from browser storage. */
|
|
5
3
|
export declare function loadCustomInstructions(projectId: string): string;
|
|
6
|
-
/** Persists custom prompt instructions without making storage availability a prerequisite for editing. */
|
|
7
4
|
export declare function saveCustomInstructions(projectId: string, instructions: string): void;
|
|
8
5
|
export { storageKey as promptSettingsStorageKey };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { inspectorStorage } from "../runtime/inspectorStorage.js";
|
|
2
2
|
import { isDemoRuntime } from "../runtime/runtimeConfig.js";
|
|
3
|
-
/** The default guidance included in every generated prompt. */
|
|
4
3
|
export const DEFAULT_CUSTOM_INSTRUCTIONS = "Preserve existing tokens, logical properties, and CSS intent while applying these rendered changes.";
|
|
5
4
|
function storageKey(projectId) {
|
|
6
5
|
return `nudge-ui:${projectId}:prompt-settings`;
|
|
7
6
|
}
|
|
8
|
-
/** Reads the project-scoped custom prompt instructions from browser storage. */
|
|
9
7
|
export function loadCustomInstructions(projectId) {
|
|
10
8
|
if (isDemoRuntime())
|
|
11
9
|
return DEFAULT_CUSTOM_INSTRUCTIONS;
|
|
@@ -16,7 +14,6 @@ export function loadCustomInstructions(projectId) {
|
|
|
16
14
|
return DEFAULT_CUSTOM_INSTRUCTIONS;
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
|
-
/** Persists custom prompt instructions without making storage availability a prerequisite for editing. */
|
|
20
17
|
export function saveCustomInstructions(projectId, instructions) {
|
|
21
18
|
if (isDemoRuntime())
|
|
22
19
|
return; // demo runtimes never persist
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decides the shared dev gate from one bundler observation and one host
|
|
3
|
-
* observation. Pure so every precedence rule is unit-testable without a
|
|
4
|
-
* particular bundler present.
|
|
5
|
-
*
|
|
6
|
-
* Precedence: an explicit host flag wins (a compiler without a define must
|
|
7
|
-
* still be authoritative); otherwise the bundler define decides; with neither,
|
|
8
|
-
* development is assumed absent — the gate fails closed rather than guessing.
|
|
9
|
-
*/
|
|
1
|
+
/** An explicit host flag wins; otherwise the bundler define; neither means not-development. */
|
|
10
2
|
export declare function resolveNudgeUiDev(bundlerDefinedDev: boolean | undefined, hostFlag: boolean | undefined): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Records whether the host Adapter is running a development server (ADR-0002).
|
|
13
|
-
*
|
|
14
|
-
* Vite and the standalone esbuild pipeline statically replace
|
|
15
|
-
* `import.meta.env.DEV`, so their bundles need no runtime flag. Hosts whose
|
|
16
|
-
* compiler cannot supply that define — Next.js/SWC has no equivalent of Vite's
|
|
17
|
-
* `define` for `import.meta.env` — must call this before bootstrapping the
|
|
18
|
-
* inspector. Passing `undefined` clears the override and restores the static
|
|
19
|
-
* define as the sole authority.
|
|
20
|
-
*
|
|
21
|
-
* The flag is process-global state by design: every inspector Module shares
|
|
22
|
-
* one dev gate, and a host configures it once per document, not per Module.
|
|
23
|
-
*/
|
|
3
|
+
/** For hosts whose compiler cannot supply the bundler define (Next.js/SWC); call before bootstrapping, `undefined` clears it. */
|
|
24
4
|
export declare function setNudgeUiHostDevFlag(value: boolean | undefined): void;
|
|
25
|
-
/**
|
|
26
|
-
* Dev-phase gate shared by every inspector Module (ADR-0002).
|
|
27
|
-
*/
|
|
28
5
|
export declare function isNudgeUiDev(): boolean;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decides the shared dev gate from one bundler observation and one host
|
|
3
|
-
* observation. Pure so every precedence rule is unit-testable without a
|
|
4
|
-
* particular bundler present.
|
|
5
|
-
*
|
|
6
|
-
* Precedence: an explicit host flag wins (a compiler without a define must
|
|
7
|
-
* still be authoritative); otherwise the bundler define decides; with neither,
|
|
8
|
-
* development is assumed absent — the gate fails closed rather than guessing.
|
|
9
|
-
*/
|
|
1
|
+
/** An explicit host flag wins; otherwise the bundler define; neither means not-development. */
|
|
10
2
|
export function resolveNudgeUiDev(bundlerDefinedDev, hostFlag) {
|
|
11
3
|
if (hostFlag !== undefined)
|
|
12
4
|
return hostFlag;
|
|
@@ -15,33 +7,14 @@ export function resolveNudgeUiDev(bundlerDefinedDev, hostFlag) {
|
|
|
15
7
|
return false;
|
|
16
8
|
}
|
|
17
9
|
let hostDevFlag;
|
|
18
|
-
/**
|
|
19
|
-
* Records whether the host Adapter is running a development server (ADR-0002).
|
|
20
|
-
*
|
|
21
|
-
* Vite and the standalone esbuild pipeline statically replace
|
|
22
|
-
* `import.meta.env.DEV`, so their bundles need no runtime flag. Hosts whose
|
|
23
|
-
* compiler cannot supply that define — Next.js/SWC has no equivalent of Vite's
|
|
24
|
-
* `define` for `import.meta.env` — must call this before bootstrapping the
|
|
25
|
-
* inspector. Passing `undefined` clears the override and restores the static
|
|
26
|
-
* define as the sole authority.
|
|
27
|
-
*
|
|
28
|
-
* The flag is process-global state by design: every inspector Module shares
|
|
29
|
-
* one dev gate, and a host configures it once per document, not per Module.
|
|
30
|
-
*/
|
|
10
|
+
/** For hosts whose compiler cannot supply the bundler define (Next.js/SWC); call before bootstrapping, `undefined` clears it. */
|
|
31
11
|
export function setNudgeUiHostDevFlag(value) {
|
|
32
12
|
hostDevFlag = value;
|
|
33
13
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Dev-phase gate shared by every inspector Module (ADR-0002).
|
|
36
|
-
*/
|
|
37
14
|
export function isNudgeUiDev() {
|
|
38
15
|
try {
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
// compiler defines nothing — Next.js/SWC — `import.meta.env` is undefined
|
|
42
|
-
// and the bare property read throws a TypeError. A build-mode name (such
|
|
43
|
-
// as the landing demo's `nudge-demo`) must never widen this gate; the
|
|
44
|
-
// demo runtime opens it for its own document instead (ADR-0014).
|
|
16
|
+
// Statically replaced under Vite; where nothing defines it (Next.js/SWC)
|
|
17
|
+
// this read throws and the catch fails closed.
|
|
45
18
|
return resolveNudgeUiDev(import.meta.env.DEV === true, hostDevFlag);
|
|
46
19
|
}
|
|
47
20
|
catch {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TokenCatalogDiagnostic, TokenDefinition } from "../../css/model/index.js";
|
|
2
2
|
import type { NudgeUiRuntimeConfig } from "./runtimeConfig.js";
|
|
3
|
-
/** Evidence collected from the browser's current stylesheet order. */
|
|
4
3
|
export interface DocumentStylesheetOrderEvidence {
|
|
5
4
|
readonly projectPaths: readonly string[];
|
|
6
5
|
/** False when a sheet is cross-origin, inline, unloaded, or duplicated. */
|
|
@@ -8,7 +7,6 @@ export interface DocumentStylesheetOrderEvidence {
|
|
|
8
7
|
}
|
|
9
8
|
/** Reads same-origin stylesheet order without making directory order authoritative. */
|
|
10
9
|
export declare function collectDocumentStylesheetOrder(document: Document): DocumentStylesheetOrderEvidence;
|
|
11
|
-
/** Token catalog plus diagnostics produced by document-order reconciliation. */
|
|
12
10
|
export interface DocumentTokenCatalogReconciliation {
|
|
13
11
|
readonly catalog: readonly TokenDefinition[];
|
|
14
12
|
readonly diagnostics: readonly TokenCatalogDiagnostic[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** The synchronous subset of `Storage` that inspector persistence uses. */
|
|
2
1
|
export interface InspectorStorage {
|
|
3
2
|
getItem(key: string): string | null;
|
|
4
3
|
setItem(key: string, value: string): void;
|
|
@@ -6,12 +5,7 @@ export interface InspectorStorage {
|
|
|
6
5
|
/** Reloads an asynchronous backend under the lease, before controller hydration. */
|
|
7
6
|
refresh?(): Promise<void>;
|
|
8
7
|
}
|
|
9
|
-
/** Replaces `localStorage` for inspector-owned state, for example with extension storage. */
|
|
10
8
|
export declare function configureInspectorStorage(storage: InspectorStorage | null): void;
|
|
11
|
-
/** The configured storage, else `localStorage`; null where neither exists. */
|
|
12
9
|
export declare function inspectorStorage(): InspectorStorage | null;
|
|
13
|
-
/**
|
|
14
|
-
* Serves reads from a snapshot loaded before boot and forwards each write.
|
|
15
|
-
* Asynchronous backends stay behind the synchronous interface callers expect.
|
|
16
|
-
*/
|
|
10
|
+
/** Keeps an asynchronous backend behind the synchronous interface callers expect. */
|
|
17
11
|
export declare function createMirroredStorage(initial: Readonly<Record<string, string>>, persist: (key: string, value: string | null) => void, read?: () => Promise<Readonly<Record<string, string>>>): InspectorStorage;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
let configured = null;
|
|
2
|
-
/** Replaces `localStorage` for inspector-owned state, for example with extension storage. */
|
|
3
2
|
export function configureInspectorStorage(storage) {
|
|
4
3
|
configured = storage;
|
|
5
4
|
}
|
|
6
|
-
/** The configured storage, else `localStorage`; null where neither exists. */
|
|
7
5
|
export function inspectorStorage() {
|
|
8
6
|
if (configured)
|
|
9
7
|
return configured;
|
|
10
8
|
return typeof localStorage === "undefined" ? null : localStorage;
|
|
11
9
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Serves reads from a snapshot loaded before boot and forwards each write.
|
|
14
|
-
* Asynchronous backends stay behind the synchronous interface callers expect.
|
|
15
|
-
*/
|
|
10
|
+
/** Keeps an asynchronous backend behind the synchronous interface callers expect. */
|
|
16
11
|
export function createMirroredStorage(initial, persist, read) {
|
|
17
12
|
const values = new Map(Object.entries(initial));
|
|
18
13
|
let refreshId = 0;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
type StyleRoot = Document | ShadowRoot;
|
|
2
2
|
/** Transient visual state projection, excluded from authored CSS inspection. */
|
|
3
3
|
export declare const STATE_PREVIEW_SHEET_ID = "nudge-ui-state-preview";
|
|
4
|
-
/**
|
|
5
|
-
* Uses constructable stylesheets everywhere without probing the page policy.
|
|
6
|
-
* A blocked probe logs a violation and can send one to the site's CSP report endpoint.
|
|
7
|
-
*/
|
|
4
|
+
/** Skips the style-element probe because a blocked probe can log a violation to the site's CSP report endpoint. */
|
|
8
5
|
export declare function preferAdoptedStylesheets(): void;
|
|
9
|
-
/**
|
|
10
|
-
* A strict `style-src` policy blocks `<style>` elements, leaving them without
|
|
11
|
-
* a sheet, but not constructable stylesheets. Checked once per document.
|
|
12
|
-
*/
|
|
6
|
+
/** A strict `style-src` blocks `<style>` elements but not constructable stylesheets; checked once per document. */
|
|
13
7
|
export declare function allowsStyleElements(doc: Document): boolean;
|
|
14
8
|
/** Creates or replaces the adopted sheet stored under `key`, after the root's own stylesheets. */
|
|
15
9
|
export declare function adoptStylesheet(root: StyleRoot, key: string, cssText: string): CSSStyleSheet | null;
|
|
@@ -3,17 +3,11 @@ export const STATE_PREVIEW_SHEET_ID = "nudge-ui-state-preview";
|
|
|
3
3
|
const styleElementSupport = new WeakMap();
|
|
4
4
|
const adoptedSheets = new WeakMap();
|
|
5
5
|
let adoptedOnly = false;
|
|
6
|
-
/**
|
|
7
|
-
* Uses constructable stylesheets everywhere without probing the page policy.
|
|
8
|
-
* A blocked probe logs a violation and can send one to the site's CSP report endpoint.
|
|
9
|
-
*/
|
|
6
|
+
/** Skips the style-element probe because a blocked probe can log a violation to the site's CSP report endpoint. */
|
|
10
7
|
export function preferAdoptedStylesheets() {
|
|
11
8
|
adoptedOnly = true;
|
|
12
9
|
}
|
|
13
|
-
/**
|
|
14
|
-
* A strict `style-src` policy blocks `<style>` elements, leaving them without
|
|
15
|
-
* a sheet, but not constructable stylesheets. Checked once per document.
|
|
16
|
-
*/
|
|
10
|
+
/** A strict `style-src` blocks `<style>` elements but not constructable stylesheets; checked once per document. */
|
|
17
11
|
export function allowsStyleElements(doc) {
|
|
18
12
|
if (adoptedOnly)
|
|
19
13
|
return false;
|