nudge-ui 0.2.4 → 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 +4 -29
- package/dist/client.mjs +987 -221
- 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 +14 -71
- package/dist/hosts/projectBridge.d.ts +0 -2
- package/dist/hosts/projectBridge.js +3 -19
- 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 +8 -9
- package/dist/inspector/agent/activity.d.ts +2 -2
- package/dist/inspector/agent/activity.js +4 -3
- package/dist/inspector/agent/client.d.ts +3 -27
- package/dist/inspector/agent/client.js +43 -91
- package/dist/inspector/agent/connectionStatus.d.ts +3 -2
- package/dist/inspector/agent/connectionStatus.js +25 -1
- package/dist/inspector/agent/httpTransport.d.ts +0 -8
- package/dist/inspector/agent/httpTransport.js +42 -176
- package/dist/inspector/agent/protocol.d.ts +1 -10
- package/dist/inspector/agent/protocol.js +1 -9
- package/dist/inspector/agent/verification.d.ts +3 -20
- package/dist/inspector/agent/verification.js +10 -43
- package/dist/inspector/boot.d.ts +5 -0
- package/dist/inspector/boot.js +289 -0
- package/dist/inspector/canvas/AgentActivityOverlay.d.ts +3 -2
- package/dist/inspector/canvas/AgentActivityOverlay.js +7 -4
- package/dist/inspector/canvas/CanvasCard.js +26 -24
- package/dist/inspector/canvas/CanvasElementOverlay.js +196 -174
- package/dist/inspector/canvas/CanvasToolbar.js +2 -1
- package/dist/inspector/canvas/CanvasWorkspace.js +87 -124
- package/dist/inspector/canvas/LockedWorkspaceNotice.d.ts +3 -2
- package/dist/inspector/canvas/LockedWorkspaceNotice.js +10 -6
- package/dist/inspector/canvas/PageCard.d.ts +9 -0
- package/dist/inspector/canvas/PageCard.js +50 -0
- package/dist/inspector/canvas/SketchToolOptions.d.ts +4 -0
- package/dist/inspector/canvas/SketchToolOptions.js +80 -0
- package/dist/inspector/canvas/StaleChangeIndicator.d.ts +1 -1
- package/dist/inspector/canvas/StaleChangeIndicator.js +1 -1
- package/dist/inspector/canvas/ToolOptionsDrawer.d.ts +16 -0
- package/dist/inspector/canvas/ToolOptionsDrawer.js +71 -0
- package/dist/inspector/canvas/activeCanvasDocument.d.ts +3 -4
- 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/assets/eraser.svg +28 -0
- package/dist/inspector/canvas/assets/pen.svg +25 -0
- package/dist/inspector/canvas/canvasFrame.d.ts +12 -0
- package/dist/inspector/canvas/canvasFrame.js +9 -0
- package/dist/inspector/canvas/canvasGestures.d.ts +0 -1
- package/dist/inspector/canvas/canvasGestures.js +0 -6
- package/dist/inspector/canvas/canvasResize.d.ts +1 -6
- package/dist/inspector/canvas/canvasResize.js +1 -6
- package/dist/inspector/canvas/canvasStore.d.ts +5 -7
- package/dist/inspector/canvas/canvasStore.js +42 -21
- package/dist/inspector/canvas/frameConnection.d.ts +42 -0
- package/dist/inspector/canvas/frameConnection.js +73 -0
- 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 +20 -38
- package/dist/inspector/canvas/frameProtocol.js +37 -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 +6 -0
- package/dist/inspector/canvas/pageSurface.js +29 -0
- package/dist/inspector/canvas/projection.d.ts +14 -25
- package/dist/inspector/canvas/projection.js +64 -87
- package/dist/inspector/canvas/rendererBootstrap.d.ts +8 -1
- package/dist/inspector/canvas/rendererBootstrap.js +10 -15
- package/dist/inspector/canvas/rendererCidIndex.d.ts +0 -5
- package/dist/inspector/canvas/rendererCidIndex.js +0 -5
- package/dist/inspector/canvas/rendererElementSelector.js +38 -28
- package/dist/inspector/canvas/rendererMessageRouter.d.ts +4 -6
- package/dist/inspector/canvas/rendererMessageRouter.js +12 -17
- package/dist/inspector/canvas/rendererSelectionProxy.d.ts +3 -1
- package/dist/inspector/canvas/rendererSelectionProxy.js +7 -40
- package/dist/inspector/canvas/rendererStylesheet.d.ts +0 -1
- package/dist/inspector/canvas/rendererStylesheet.js +23 -1
- package/dist/inspector/canvas/resizeHandleScale.d.ts +1 -10
- package/dist/inspector/canvas/resizeHandleScale.js +1 -10
- package/dist/inspector/canvas/sessionStore.d.ts +3 -9
- package/dist/inspector/canvas/sessionStore.js +33 -43
- package/dist/inspector/canvas/staleChangeDetector.d.ts +1 -1
- package/dist/inspector/canvas/staleChangeDetector.js +11 -26
- 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.d.ts +1 -0
- package/dist/inspector/changes/codecs.js +21 -5
- package/dist/inspector/changes/draftPreview.d.ts +7 -0
- package/dist/inspector/changes/draftPreview.js +118 -0
- package/dist/inspector/changes/editModel.d.ts +11 -13
- package/dist/inspector/changes/editModel.js +9 -4
- package/dist/inspector/changes/managedStyleProjection.js +6 -15
- 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 +5 -21
- 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 +11 -8
- package/dist/inspector/clientManifest.d.ts +17 -6
- package/dist/inspector/clientManifest.js +16 -3
- package/dist/inspector/comments/CommentsOverlay.js +66 -23
- 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 +4 -3
- package/dist/inspector/comments/verification.d.ts +8 -2
- package/dist/inspector/comments/verification.js +19 -11
- package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +8 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.js +12 -8
- package/dist/inspector/componentSemantics/adapterRegistry.d.ts +2 -9
- package/dist/inspector/componentSemantics/adapterRegistry.js +2 -9
- package/dist/inspector/componentSemantics/changeAction.js +1 -1
- 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 +2 -11
- package/dist/inspector/componentSemantics/textBinding.js +20 -87
- 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 +95 -0
- package/dist/inspector/drafts/draftStore.js +461 -0
- package/dist/inspector/drafts/model.d.ts +14 -14
- package/dist/inspector/drafts/model.js +4 -2
- package/dist/inspector/drafts/store.d.ts +47 -16
- package/dist/inspector/drafts/store.js +137 -170
- package/dist/inspector/editScope.d.ts +0 -1
- package/dist/inspector/editScope.js +0 -1
- package/dist/inspector/index.d.ts +2 -4
- package/dist/inspector/index.js +2 -264
- 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 +3 -9
- package/dist/inspector/inline-text/inlineTextEditor.js +27 -81
- package/dist/inspector/inline-text/inlineTextLifecycle.js +1 -6
- package/dist/inspector/inline-text/textEditChange.d.ts +1 -2
- package/dist/inspector/inspection/bridge.d.ts +3 -7
- package/dist/inspector/inspection/bridge.js +6 -13
- package/dist/inspector/inspection/browserCssInspection.d.ts +12 -11
- package/dist/inspector/inspection/browserCssInspection.js +32 -14
- package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +0 -7
- package/dist/inspector/inspection/browserCssInspectionRegistry.js +1 -16
- package/dist/inspector/inspection/inspectionSnapshot.d.ts +6 -0
- package/dist/inspector/inspection/inspectionSnapshot.js +10 -0
- package/dist/inspector/inspection/performanceDiagnostics.d.ts +18 -0
- package/dist/inspector/inspection/performanceDiagnostics.js +31 -0
- 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 +22 -59
- package/dist/inspector/iterations/capture.d.ts +2 -2
- package/dist/inspector/iterations/capture.js +4 -9
- package/dist/inspector/iterations/client.d.ts +2 -2
- package/dist/inspector/iterations/client.js +0 -1
- package/dist/inspector/iterations/coordinator.d.ts +4 -4
- package/dist/inspector/iterations/coordinator.js +5 -4
- package/dist/inspector/iterations/prompt.d.ts +0 -1
- package/dist/inspector/iterations/prompt.js +9 -9
- 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 +19 -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 +33 -0
- package/dist/inspector/pageInspector.js +335 -0
- package/dist/inspector/projection/cssEscapes.d.ts +0 -1
- package/dist/inspector/projection/cssEscapes.js +2 -4
- package/dist/inspector/projection/draftProjection.d.ts +6 -10
- package/dist/inspector/projection/draftProjection.js +8 -7
- package/dist/inspector/projection/managedStylesheet.d.ts +1 -7
- package/dist/inspector/projection/managedStylesheet.js +28 -26
- package/dist/inspector/projection/renderedInstance.d.ts +5 -28
- package/dist/inspector/projection/renderedInstance.js +13 -33
- package/dist/inspector/projection/structuralProjection.d.ts +7 -48
- package/dist/inspector/projection/structuralProjection.js +31 -96
- package/dist/inspector/projection/textProjection.d.ts +7 -13
- package/dist/inspector/projection/textProjection.js +35 -80
- 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 -0
- package/dist/inspector/prompt/clipboardHandoff.js +34 -16
- package/dist/inspector/prompt/generatePrompt.d.ts +2 -2
- package/dist/inspector/prompt/generatePrompt.js +247 -166
- package/dist/inspector/prompt/promptDocument.d.ts +3 -0
- package/dist/inspector/prompt/promptDocument.js +8 -0
- package/dist/inspector/prompt/promptSettings.d.ts +0 -3
- package/dist/inspector/prompt/promptSettings.js +7 -8
- 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 +11 -0
- package/dist/inspector/runtime/inspectorStorage.js +37 -0
- package/dist/inspector/runtime/ownedStylesheets.d.ts +14 -0
- package/dist/inspector/runtime/ownedStylesheets.js +66 -0
- package/dist/inspector/runtime/runtimeConfig.d.ts +14 -84
- package/dist/inspector/runtime/runtimeConfig.js +18 -50
- package/dist/inspector/runtime/runtimeIdentityClaims.d.ts +19 -0
- package/dist/inspector/runtime/runtimeIdentityClaims.js +178 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +6 -23
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +103 -52
- package/dist/inspector/runtime/useRuntimeConfig.d.ts +1 -8
- package/dist/inspector/runtime/useRuntimeConfig.js +1 -8
- package/dist/inspector/selection/editScope.d.ts +2 -7
- package/dist/inspector/selection/editScope.js +15 -14
- 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 +7 -7
- package/dist/inspector/shell/AppShell.js +6 -2
- package/dist/inspector/shell/ChangesLog.js +29 -12
- package/dist/inspector/shell/CopyPromptButton.d.ts +2 -1
- package/dist/inspector/shell/CopyPromptButton.js +62 -55
- package/dist/inspector/shell/EmptyState.js +3 -3
- 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.d.ts +0 -3
- package/dist/inspector/shell/InspectorShell.js +44 -58
- 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 +3 -8
- 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 +6 -0
- package/dist/inspector/shell/interactionStatePreview.js +107 -0
- package/dist/inspector/shell/originalPreview.d.ts +1 -5
- package/dist/inspector/shell/originalPreview.js +5 -37
- package/dist/inspector/shell/stateValue.d.ts +1 -2
- package/dist/inspector/shell/stateValue.js +4 -8
- package/dist/inspector/shell/styleState.d.ts +1 -2
- package/dist/inspector/shell/styleState.js +1 -2
- package/dist/inspector/sketch/SketchEditor.js +5 -5
- package/dist/inspector/sketch/SketchFrameOverlay.d.ts +2 -1
- package/dist/inspector/sketch/SketchFrameOverlay.js +13 -16
- package/dist/inspector/sketch/SketchOverlay.d.ts +3 -5
- package/dist/inspector/sketch/SketchOverlay.js +138 -263
- package/dist/inspector/sketch/SketchPromptPanel.d.ts +1 -2
- package/dist/inspector/sketch/SketchPromptPanel.js +8 -2
- package/dist/inspector/sketch/SketchThumbnail.d.ts +5 -0
- package/dist/inspector/sketch/SketchThumbnail.js +18 -0
- package/dist/inspector/sketch/SketchWorkspace.d.ts +1 -2
- package/dist/inspector/sketch/SketchWorkspace.js +70 -37
- package/dist/inspector/sketch/capture.d.ts +12 -3
- package/dist/inspector/sketch/capture.js +31 -14
- package/dist/inspector/sketch/copySketch.d.ts +4 -0
- package/dist/inspector/sketch/copySketch.js +43 -0
- package/dist/inspector/sketch/drawingTools.d.ts +15 -0
- package/dist/inspector/sketch/drawingTools.js +46 -0
- package/dist/inspector/sketch/frameHeading.d.ts +3 -0
- package/dist/inspector/sketch/frameHeading.js +23 -0
- package/dist/inspector/sketch/freehand.d.ts +0 -1
- package/dist/inspector/sketch/freehand.js +3 -4
- package/dist/inspector/sketch/geometry.d.ts +2 -1
- package/dist/inspector/sketch/geometry.js +15 -1
- package/dist/inspector/sketch/handoff.js +0 -1
- package/dist/inspector/sketch/history.d.ts +26 -0
- package/dist/inspector/sketch/history.js +55 -0
- package/dist/inspector/sketch/interaction.d.ts +3 -5
- package/dist/inspector/sketch/interaction.js +8 -11
- package/dist/inspector/sketch/model.d.ts +33 -6
- package/dist/inspector/sketch/model.js +101 -63
- package/dist/inspector/sketch/persistence.d.ts +14 -1
- package/dist/inspector/sketch/persistence.js +64 -8
- package/dist/inspector/sketch/raster.d.ts +3 -2
- package/dist/inspector/sketch/raster.js +40 -20
- package/dist/inspector/sketch/store.d.ts +1 -1
- package/dist/inspector/sketch/store.js +3 -4
- package/dist/inspector/sketch/videoFrames.d.ts +6 -0
- package/dist/inspector/sketch/videoFrames.js +80 -0
- package/dist/inspector/spacing/projection.d.ts +0 -8
- package/dist/inspector/spacing/projection.js +38 -20
- package/dist/inspector/styleEditors/BackgroundEditor.js +3 -2
- package/dist/inspector/styleEditors/BorderEditor.js +30 -135
- package/dist/inspector/styleEditors/BorderRadiusEditor.js +8 -3
- 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 +1 -2
- 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 +36 -0
- package/dist/inspector/styleEditors/borderModel.js +105 -0
- 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 +6 -15
- 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 +53 -32
- package/dist/inspector/tokens/TokensPanel.js +2 -1
- 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 +4 -4
- package/dist/inspector/tokens/editActions.js +11 -7
- 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 +11 -0
- package/dist/inspector/tokens/resolution/containerQueryEvaluator.js +82 -0
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +4 -19
- package/dist/inspector/tokens/resolution/cssomCollector.js +186 -122
- package/dist/inspector/tokens/resolution/nestedSelectors.d.ts +2 -0
- package/dist/inspector/tokens/resolution/nestedSelectors.js +63 -0
- package/dist/inspector/tokens/resolution/ruleMatching.d.ts +4 -14
- package/dist/inspector/tokens/resolution/ruleMatching.js +136 -63
- 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 +11 -27
- package/dist/inspector/tokens/resolution.js +105 -181
- package/dist/inspector/tokens/tokenAvailability.d.ts +2 -14
- package/dist/inspector/tokens/tokenAvailability.js +6 -38
- package/dist/inspector/tokens/tokenEdits.d.ts +1 -1
- package/dist/inspector/tokens/tokenEdits.js +1 -1
- 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/InlineStyleWarning.js +2 -2
- package/dist/inspector/ui/InspectorPopover.d.ts +1 -5
- package/dist/inspector/ui/InspectorPopover.js +1 -5
- package/dist/inspector/ui/InspectorStyle.d.ts +8 -0
- package/dist/inspector/ui/InspectorStyle.js +26 -0
- package/dist/inspector/ui/PopoverListbox.d.ts +2 -1
- package/dist/inspector/ui/PopoverListbox.js +3 -3
- 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 +10 -0
- package/dist/inspector/ui/Toast.js +26 -0
- package/dist/inspector/ui/assets/canvasIllustration.d.ts +2 -0
- package/dist/inspector/ui/assets/canvasIllustration.js +21 -0
- package/dist/inspector/ui/assets/gridIllustration.d.ts +2 -0
- package/dist/inspector/ui/assets/{grid.svg → gridIllustration.js} +3 -2
- 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 +11 -0
- package/dist/inspector/ui/customCursors.js +29 -7
- package/dist/inspector/ui/styles.js +25 -25
- package/dist/inspector/workspace/commands.js +1 -2
- package/dist/inspector/workspace/controller.js +20 -2
- package/dist/inspector/workspace/handoff.d.ts +1 -5
- package/dist/inspector/workspace/handoff.js +4 -7
- package/dist/inspector/workspace/sentItems.d.ts +3 -6
- package/dist/inspector/workspace/sentItems.js +6 -24
- package/dist/inspector/workspace/timeline.d.ts +28 -11
- package/dist/inspector/workspace/timeline.js +117 -96
- package/dist/internal/agent-protocol.d.ts +53 -38
- package/dist/internal/agent-protocol.js +151 -42
- package/dist/nudge-ui.mjs +155 -92
- 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 +3 -0
- package/dist/project/mcpPackage.js +55 -0
- 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 +16 -5
- package/dist/inspector/canvas/measurementProjection.d.ts +0 -8
- package/dist/inspector/canvas/measurementProjection.js +0 -16
- package/dist/inspector/changes/changesLog.d.ts +0 -49
- package/dist/inspector/changes/changesLog.js +0 -255
- package/dist/inspector/changes/draftChanges.d.ts +0 -58
- package/dist/inspector/changes/draftChanges.js +0 -304
- package/dist/inspector/conformance/projection.d.ts +0 -2
- package/dist/inspector/conformance/projection.js +0 -3
- package/dist/inspector/inline-text/textChangeBoundary.d.ts +0 -6
- package/dist/inspector/inline-text/textChangeBoundary.js +0 -1
- package/dist/inspector/overlay/InspectorOverlay.d.ts +0 -5
- package/dist/inspector/overlay/InspectorOverlay.js +0 -332
- package/dist/inspector/overlay/elementSelector.d.ts +0 -1
- package/dist/inspector/overlay/elementSelector.js +0 -111
- package/dist/inspector/sketch/SketchChanges.d.ts +0 -2
- package/dist/inspector/sketch/SketchChanges.js +0 -72
- package/dist/inspector/sketch/SketchEntryButton.d.ts +0 -4
- package/dist/inspector/sketch/SketchEntryButton.js +0 -11
- package/dist/inspector/sketch/SketchLayersPanel.d.ts +0 -2
- package/dist/inspector/sketch/SketchLayersPanel.js +0 -71
- 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
|
@@ -4,7 +4,6 @@ export function stripCssQuery(id) {
|
|
|
4
4
|
export function isCssStylesheet(id) {
|
|
5
5
|
return /\.css(?:$|[?#])/i.test(id);
|
|
6
6
|
}
|
|
7
|
-
/** Extract quoted and url(...) @import targets while ignoring CSS comments. */
|
|
8
7
|
export function cssImportSpecifiers(css) {
|
|
9
8
|
const withoutComments = css.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
10
9
|
const imports = [];
|
|
@@ -17,10 +16,7 @@ export function cssImportSpecifiers(css) {
|
|
|
17
16
|
}
|
|
18
17
|
return imports;
|
|
19
18
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Resolve every CSS file reached from the supplied host stylesheets. Missing
|
|
22
|
-
* and unreadable imports are reported but never make the catalog unavailable.
|
|
23
|
-
*/
|
|
19
|
+
/** Missing and unreadable imports are reported, never fatal to the catalog. */
|
|
24
20
|
export async function discoverCssImportGraph(entryFiles, dependencies) {
|
|
25
21
|
const files = new Map();
|
|
26
22
|
const order = [];
|
|
@@ -54,9 +50,8 @@ export async function discoverCssImportGraph(entryFiles, dependencies) {
|
|
|
54
50
|
unresolved.push({ importer: fileId, specifier });
|
|
55
51
|
continue;
|
|
56
52
|
}
|
|
57
|
-
// A processor-owned import such as Tailwind's package entry may resolve
|
|
58
|
-
//
|
|
59
|
-
// ordinary-CSS graph, but it is not an unresolved stylesheet failure.
|
|
53
|
+
// A processor-owned import such as Tailwind's package entry may resolve to JavaScript
|
|
54
|
+
// and emit CSS during transform; it is outside this graph, not an unresolved failure.
|
|
60
55
|
if (!isCssStylesheet(resolved))
|
|
61
56
|
continue;
|
|
62
57
|
await visit(resolved);
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import type { ArtifactStage, StylesheetArtifact } from "../../../css/token-inventory/index.js";
|
|
2
2
|
import type { CssImportGraph } from "./activeStylesheets.js";
|
|
3
|
-
/**
|
|
4
|
-
* Source directories that a Vite host explicitly owns.
|
|
5
|
-
*
|
|
6
|
-
* Vite's resolved root is always included by the adapter. `sourceRoots` lets a
|
|
7
|
-
* monorepo host add authored workspace packages without treating every file
|
|
8
|
-
* reachable through Vite's module graph as application code. Generated roots
|
|
9
|
-
* are excluded even when a caller accidentally includes them in a source
|
|
10
|
-
* root.
|
|
11
|
-
*/
|
|
3
|
+
/** Vite's resolved root is always included; generated roots are excluded even when nested in a source root. */
|
|
12
4
|
export interface ViteSourceScopeOptions {
|
|
13
5
|
readonly sourceRoots?: readonly string[];
|
|
14
6
|
readonly generatedRoots?: readonly string[];
|
|
@@ -30,7 +22,6 @@ export interface ViteStylesheetArtifactInput {
|
|
|
30
22
|
/** Explicit graph-level v4 detection avoids mistaking Tailwind v3 --tw helpers for v4. */
|
|
31
23
|
readonly tailwindV4?: boolean;
|
|
32
24
|
}
|
|
33
|
-
/** Map Vite-specific identity and evidence into the neutral artifact contract. */
|
|
34
25
|
export declare function createViteStylesheetArtifact(input: ViteStylesheetArtifactInput): StylesheetArtifact;
|
|
35
26
|
export interface OrderedViteStylesheet {
|
|
36
27
|
readonly id: string;
|
|
@@ -38,9 +29,5 @@ export interface OrderedViteStylesheet {
|
|
|
38
29
|
readonly order?: number;
|
|
39
30
|
readonly discoveryOrder?: number;
|
|
40
31
|
}
|
|
41
|
-
/**
|
|
42
|
-
* A single active root proves nested CSS import order. Multiple independent
|
|
43
|
-
* roots have no proven cross-root cascade order, so their traversal rank stays
|
|
44
|
-
* discovery evidence.
|
|
45
|
-
*/
|
|
32
|
+
/** A single active root proves nested CSS import order; multiple roots have no cross-root cascade order, so their rank stays discovery evidence. */
|
|
46
33
|
export declare function orderViteStylesheetGraph(graph: CssImportGraph, activeRootCount: number): OrderedViteStylesheet[];
|
|
@@ -32,10 +32,8 @@ export function isHostApplicationSource(id, projectRoot, options = {}) {
|
|
|
32
32
|
const sourceRoot = roots.find((candidate) => isInsideRoot(absoluteFile, candidate));
|
|
33
33
|
if (!sourceRoot)
|
|
34
34
|
return false;
|
|
35
|
-
// A
|
|
36
|
-
//
|
|
37
|
-
// root does not: there, a directory named `build` may be ordinary authored
|
|
38
|
-
// source, and the resolved output directory is already excluded above.
|
|
35
|
+
// A declared source root keeps a name-based guard against nested generated directories;
|
|
36
|
+
// the primary root does not, since a directory named `build` may be authored source there.
|
|
39
37
|
if (sourceRoot !== primaryRoot) {
|
|
40
38
|
const pathSegments = relative(sourceRoot, absoluteFile).split(sep).filter(Boolean);
|
|
41
39
|
if (pathSegments.some((segment) => GENERATED_DIRECTORY_NAMES.has(segment))) {
|
|
@@ -60,7 +58,6 @@ export function catalogSourcePath(id, projectRoot, options = {}) {
|
|
|
60
58
|
return relative(projectRoot, fileId).replace(/\\/g, "/");
|
|
61
59
|
return fileId.replace(/^\//, "");
|
|
62
60
|
}
|
|
63
|
-
/** Map Vite-specific identity and evidence into the neutral artifact contract. */
|
|
64
61
|
export function createViteStylesheetArtifact(input) {
|
|
65
62
|
const fileId = stripCssQuery(input.id);
|
|
66
63
|
// The artifact input already carries the scope fields, so it is the scope.
|
|
@@ -89,11 +86,7 @@ function isInsideRoot(file, root) {
|
|
|
89
86
|
&& !relativeFile.startsWith(`..${sep}`)
|
|
90
87
|
&& !isAbsolute(relativeFile);
|
|
91
88
|
}
|
|
92
|
-
/**
|
|
93
|
-
* A single active root proves nested CSS import order. Multiple independent
|
|
94
|
-
* roots have no proven cross-root cascade order, so their traversal rank stays
|
|
95
|
-
* discovery evidence.
|
|
96
|
-
*/
|
|
89
|
+
/** A single active root proves nested CSS import order; multiple roots have no cross-root cascade order, so their rank stays discovery evidence. */
|
|
97
90
|
export function orderViteStylesheetGraph(graph, activeRootCount) {
|
|
98
91
|
const authoritative = activeRootCount === 1;
|
|
99
92
|
return graph.order.map((id, index) => ({
|
|
@@ -2,19 +2,12 @@ import type { Plugin } from "vite";
|
|
|
2
2
|
import type { TailwindV3Config, ThemeContract } from "../../css/dialects/index.js";
|
|
3
3
|
import { type NudgeUiRuntimeConfig } from "../../inspector/clientManifest.js";
|
|
4
4
|
import type { FrameworkHost, FrameworkSupport, ReactOptions } from "./react.js";
|
|
5
|
-
/**
|
|
6
|
-
* How to find the project's vanilla-extract theme contract. Loading a module
|
|
7
|
-
* is a host capability, so the specifier lives here; what the contract means
|
|
8
|
-
* is interpreted in `nudge-ui/css/dialects`.
|
|
9
|
-
*/
|
|
10
5
|
export interface VanillaExtractOptions {
|
|
11
6
|
themeContract?: ThemeContract;
|
|
12
7
|
/** A Vite-resolvable module exporting a published compiled contract. */
|
|
13
8
|
themeContractModule?: string;
|
|
14
|
-
/** Defaults to `vars`. */
|
|
15
9
|
themeContractExport?: string;
|
|
16
10
|
themeContractPrefix?: string;
|
|
17
|
-
/** Known compiled values by custom-property name. */
|
|
18
11
|
cssValues?: Readonly<Record<string, string>>;
|
|
19
12
|
source?: string;
|
|
20
13
|
}
|
|
@@ -29,7 +22,7 @@ export interface NudgeUiOptions extends ReactOptions {
|
|
|
29
22
|
demoPages?: readonly string[];
|
|
30
23
|
/** Labels for the seeded demo cards in display order, including the primary card. */
|
|
31
24
|
demoCardLabels?: readonly string[];
|
|
32
|
-
/** Product features exposed by the inspector runtime
|
|
25
|
+
/** Product features exposed by the inspector runtime; omitted flags remain enabled. */
|
|
33
26
|
features?: NudgeUiRuntimeConfig["features"];
|
|
34
27
|
/** Explicit project ID for browser-storage keys (defaults to root directory basename). */
|
|
35
28
|
projectId?: string;
|
|
@@ -39,32 +32,18 @@ export interface NudgeUiOptions extends ReactOptions {
|
|
|
39
32
|
source?: string;
|
|
40
33
|
};
|
|
41
34
|
vanillaExtract?: VanillaExtractOptions;
|
|
42
|
-
/**
|
|
43
|
-
* Authored workspace directories outside Vite's resolved root. Dependencies
|
|
44
|
-
* and generated output stay excluded even when a broad directory is given.
|
|
45
|
-
*/
|
|
35
|
+
/** Authored workspace directories outside Vite's resolved root; dependencies and generated output stay excluded. */
|
|
46
36
|
sourceRoots?: readonly string[];
|
|
47
37
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Extracts the stylesheet string Vite embeds in dev CSS-module JS wrappers
|
|
50
|
-
* (`const __vite__css = "…"`). Returns null for anything that is not such a
|
|
51
|
-
* wrapper, so callers can feed the original code unchanged.
|
|
52
|
-
*/
|
|
53
38
|
export declare function extractViteModuleCss(code: string): string | null;
|
|
54
39
|
export interface TransformIndexHtmlOptions {
|
|
55
|
-
/** Inject the debug mount div instead of the standard one. */
|
|
56
40
|
debug?: boolean;
|
|
57
41
|
/** Keep the injection in a `build` command (explicit demo builds only). */
|
|
58
42
|
demoBuild?: boolean;
|
|
59
43
|
/** Keep the route-sensitive landing demo on its build-time virtual module. */
|
|
60
44
|
demo?: boolean;
|
|
45
|
+
/** Inline classic script that must run before any application module. */
|
|
46
|
+
headScript?: string;
|
|
61
47
|
}
|
|
62
|
-
export declare function transformIndexHtmlHtml(html: string, command: "serve" | "build", { debug, demoBuild, demo }?: TransformIndexHtmlOptions): string | null;
|
|
63
|
-
/**
|
|
64
|
-
* Owns the build tool and nothing else: module graph, CSS observation, token
|
|
65
|
-
* inventory, transport middleware, bootstrap injection, HMR. Framework
|
|
66
|
-
* semantics arrive through `createFramework`; passing `null` is a supported
|
|
67
|
-
* composition, and `vite.noFramework.test.ts` exercises it to prove nothing
|
|
68
|
-
* here has grown a React assumption.
|
|
69
|
-
*/
|
|
48
|
+
export declare function transformIndexHtmlHtml(html: string, command: "serve" | "build", { debug, demoBuild, demo, headScript }?: TransformIndexHtmlOptions): string | null;
|
|
70
49
|
export declare function createVitePlugins(options?: NudgeUiOptions, createFramework?: ((options: NudgeUiOptions, host: FrameworkHost) => FrameworkSupport) | null): Plugin[];
|
package/dist/hosts/vite/vite.js
CHANGED
|
@@ -7,7 +7,7 @@ import { NUDGE_UI_CLIENT_PATH, NUDGE_UI_EDITOR_PATH, NUDGE_UI_MANIFEST_PATH, cre
|
|
|
7
7
|
import { discoverCssImportGraph, stripCssQuery } from "./tokens/activeStylesheets.js";
|
|
8
8
|
import { catalogSourcePath, createViteStylesheetArtifact, isHostApplicationSource, isPackageStylesheet, orderViteStylesheetGraph, } from "./tokens/viteStylesheetArtifacts.js";
|
|
9
9
|
import { interpretDialects } from "../../css/dialects/index.js";
|
|
10
|
-
import { detectStylingSystem, } from "../../inspector/clientManifest.js";
|
|
10
|
+
import { createNudgeUiClientManifest, detectStylingSystem, } from "../../inspector/clientManifest.js";
|
|
11
11
|
import { loopbackOrigin, startOptionalProjectBridge, } from "../projectBridge.js";
|
|
12
12
|
import { automationManifestFields, isNudgeUiEnabled } from "../environment.js";
|
|
13
13
|
function isRecord(value) {
|
|
@@ -26,11 +26,6 @@ const MOUNT_DIV = `<div id="nudge-ui-root"></div>`;
|
|
|
26
26
|
const DEBUG_MOUNT_DIV = `<div id="nudge-ui-root" data-nudge-ui-debug="true"></div>`;
|
|
27
27
|
const INSPECTOR_SCRIPT = `<script type="module" src="${CLIENT_PATH}" data-nudge-ui-client data-nudge-ui-manifest="${MANIFEST_PATH}"></script>`;
|
|
28
28
|
const LEGACY_INSPECTOR_SCRIPT = `<script type="module" src="/@id/__x00__virtual:nudge-ui-inspector"></script>`;
|
|
29
|
-
/**
|
|
30
|
-
* Extracts the stylesheet string Vite embeds in dev CSS-module JS wrappers
|
|
31
|
-
* (`const __vite__css = "…"`). Returns null for anything that is not such a
|
|
32
|
-
* wrapper, so callers can feed the original code unchanged.
|
|
33
|
-
*/
|
|
34
29
|
export function extractViteModuleCss(code) {
|
|
35
30
|
const match = /(?:^|;)\s*(?:const|let|var)\s+__vite__css\s*=\s*("(?:[^"\\]|\\.)*")/m.exec(code);
|
|
36
31
|
if (!match)
|
|
@@ -79,17 +74,26 @@ function scanCssFiles(rootDir, files = [], dir = rootDir, ignoredDirectory) {
|
|
|
79
74
|
}
|
|
80
75
|
return files;
|
|
81
76
|
}
|
|
82
|
-
export function transformIndexHtmlHtml(html, command, { debug = false, demoBuild = false, demo = false } = {}) {
|
|
77
|
+
export function transformIndexHtmlHtml(html, command, { debug = false, demoBuild = false, demo = false, headScript } = {}) {
|
|
83
78
|
if (command === "build" && !demoBuild)
|
|
84
79
|
return null;
|
|
85
80
|
if (html.includes("data-nudge-ui-client"))
|
|
86
81
|
return null;
|
|
87
82
|
const script = demo || demoBuild ? LEGACY_INSPECTOR_SCRIPT : INSPECTOR_SCRIPT;
|
|
88
83
|
const inject = `\n${debug ? DEBUG_MOUNT_DIV : MOUNT_DIV}\n${script}\n`;
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
const withHead = headScript ? prependToHead(html, `<script data-nudge-ui-head>${headScript}</script>`) : html;
|
|
85
|
+
if (withHead.includes("</body>")) {
|
|
86
|
+
return withHead.replace("</body>", `${inject}</body>`);
|
|
91
87
|
}
|
|
92
|
-
return
|
|
88
|
+
return withHead + inject;
|
|
89
|
+
}
|
|
90
|
+
/** Classic inline scripts run in document order, ahead of every module script. */
|
|
91
|
+
function prependToHead(html, tag) {
|
|
92
|
+
const head = /<head(?:\s[^>]*)?>/i.exec(html);
|
|
93
|
+
if (!head)
|
|
94
|
+
return `${tag}\n${html}`;
|
|
95
|
+
const at = head.index + head[0].length;
|
|
96
|
+
return `${html.slice(0, at)}\n${tag}${html.slice(at)}`;
|
|
93
97
|
}
|
|
94
98
|
function invalidateHmrModules(server, modules, timestamp) {
|
|
95
99
|
const invalidated = new Set();
|
|
@@ -97,13 +101,6 @@ function invalidateHmrModules(server, modules, timestamp) {
|
|
|
97
101
|
server.moduleGraph.invalidateModule(module, invalidated, timestamp, true);
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Owns the build tool and nothing else: module graph, CSS observation, token
|
|
102
|
-
* inventory, transport middleware, bootstrap injection, HMR. Framework
|
|
103
|
-
* semantics arrive through `createFramework`; passing `null` is a supported
|
|
104
|
-
* composition, and `vite.noFramework.test.ts` exercises it to prove nothing
|
|
105
|
-
* here has grown a React assumption.
|
|
106
|
-
*/
|
|
107
104
|
export function createVitePlugins(options = {}, createFramework = null) {
|
|
108
105
|
const enabled = isNudgeUiEnabled(options.enabled);
|
|
109
106
|
let root;
|
|
@@ -116,7 +113,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
116
113
|
let postTransformPromise = null;
|
|
117
114
|
const inventory = createTokenInventory();
|
|
118
115
|
const activeHostCssFiles = new Set();
|
|
119
|
-
//
|
|
116
|
+
// Ordered per artifact, not per observation: a transform hook has no import-graph ordering.
|
|
120
117
|
const stylesheetOrdering = new Map();
|
|
121
118
|
// Detected from the authored graph: v3 also emits --tw-* helpers, so transformed output is not a safe signal.
|
|
122
119
|
const tailwindV4SourceFiles = new Set();
|
|
@@ -129,7 +126,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
129
126
|
let contractDiagnostics = [];
|
|
130
127
|
let activeGraphDiagnostics = [];
|
|
131
128
|
const sourceScanDiagnostics = new Map();
|
|
132
|
-
/** Generation of the last snapshot actually serialized into the virtual module. */
|
|
133
129
|
let lastPublishedGeneration = null;
|
|
134
130
|
/** Resolved at hook time: Vite's root and output directory are unknown when `nudgeUi()` is called. */
|
|
135
131
|
function sourceScope() {
|
|
@@ -147,7 +143,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
147
143
|
function catalogPath(id) {
|
|
148
144
|
return catalogSourcePath(id, root, sourceScope());
|
|
149
145
|
}
|
|
150
|
-
// Everything below reaches the framework through optional chaining, so `null` is a working configuration.
|
|
151
146
|
const frameworkModuleId = (id) => framework !== null && (id === framework.virtualModuleId || id === resolvedFrameworkModule());
|
|
152
147
|
const resolvedFrameworkModule = () => framework === null ? null : `\0${framework.virtualModuleId}`;
|
|
153
148
|
const framework = createFramework?.(options, {
|
|
@@ -169,20 +164,14 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
169
164
|
const relativeFile = relative(root, absoluteFile);
|
|
170
165
|
return relativeFile === "build" || relativeFile.startsWith(`build${sep}`);
|
|
171
166
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Authored and transformed observations of the same id are fed as two
|
|
174
|
-
* artifacts. The inventory keeps both: the transformed one is the
|
|
175
|
-
* browser-relevant fact set, while names authored in the same artifact keep
|
|
176
|
-
* project provenance.
|
|
177
|
-
*/
|
|
167
|
+
/** Authored and transformed observations of one id stay separate artifacts; the transformed one is the browser-relevant fact set. */
|
|
178
168
|
function feedCssArtifact(id, rawCode, stage, ordering = {}) {
|
|
179
169
|
if (!CSS_EXT.test(id))
|
|
180
170
|
return;
|
|
181
171
|
let code = rawCode;
|
|
182
172
|
const fileId = id.split(/[?#]/, 1)[0] ?? id;
|
|
183
|
-
// Astro compiles component <style> blocks into JS wrappers with no authored .css
|
|
184
|
-
//
|
|
185
|
-
// component-scoped custom properties (ADR-0011).
|
|
173
|
+
// Astro compiles component <style> blocks into JS wrappers with no authored .css artifact,
|
|
174
|
+
// so unwrap the embedded stylesheet or the catalog never sees scoped custom properties (ADR-0011).
|
|
186
175
|
if (!CSS_EXT.test(fileId)) {
|
|
187
176
|
const unwrapped = extractViteModuleCss(code);
|
|
188
177
|
if (unwrapped !== null)
|
|
@@ -210,7 +199,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
210
199
|
inventory.apply(artifact);
|
|
211
200
|
sourceScanDiagnostics.delete(artifact.id);
|
|
212
201
|
}
|
|
213
|
-
/** Drop every observation and temporary provenance fact for one stylesheet. */
|
|
214
202
|
function feedCssRemoval(id) {
|
|
215
203
|
const fileId = id.split(/[?#]/, 1)[0] ?? id;
|
|
216
204
|
tailwindV4SourceFiles.delete(fileId);
|
|
@@ -224,7 +212,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
224
212
|
sourceScanDiagnostics.delete(artifact.id);
|
|
225
213
|
inventory.apply(artifact);
|
|
226
214
|
}
|
|
227
|
-
/** The inventory keeps the last valid authored observation and records a recoverable diagnostic. */
|
|
228
215
|
function feedCssTransformFailure(id) {
|
|
229
216
|
if (!CSS_EXT.test(id))
|
|
230
217
|
return;
|
|
@@ -251,7 +238,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
251
238
|
resolvedId = (await devServer.pluginContainer.resolveId(moduleSpecifier))?.id ?? null;
|
|
252
239
|
}
|
|
253
240
|
catch {
|
|
254
|
-
// The diagnostic below explains
|
|
241
|
+
// The diagnostic below explains the failure without making the CSS catalog unavailable.
|
|
255
242
|
}
|
|
256
243
|
if (!resolvedId) {
|
|
257
244
|
contractDiagnostics = [{
|
|
@@ -304,12 +291,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
304
291
|
return;
|
|
305
292
|
await refreshPublishedThemeContract();
|
|
306
293
|
}
|
|
307
|
-
/**
|
|
308
|
-
* Hands everything this host observed about CSS dialects to the interpreter
|
|
309
|
-
* and applies what comes back, so the snapshot carries final labels. Every
|
|
310
|
-
* contribution is id-keyed and replaceable, so repeating this with unchanged
|
|
311
|
-
* facts is a no-op and load() shares one path with the HMR exactly-once guard.
|
|
312
|
-
*/
|
|
294
|
+
/** Id-keyed, replaceable contributions: repeating this with unchanged facts is a no-op. */
|
|
313
295
|
function syncInventoryContributions() {
|
|
314
296
|
const { contributions } = interpretDialects({
|
|
315
297
|
...(options.tailwindV3 === undefined ? {} : { tailwindV3: options.tailwindV3 }),
|
|
@@ -342,11 +324,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
342
324
|
for (const contribution of contributions)
|
|
343
325
|
inventory.applyContribution(contribution);
|
|
344
326
|
}
|
|
345
|
-
/**
|
|
346
|
-
* Publishes exactly once per observable snapshot change. Every HMR feed for
|
|
347
|
-
* an event settles first, so identical facts do not bump the generation, and
|
|
348
|
-
* contributions sync first so the guard compares what load() would serialize.
|
|
349
|
-
*/
|
|
327
|
+
/** Publishes exactly once per observable snapshot change: callers settle every feed first, and this compares what `load()` would serialize. */
|
|
350
328
|
function invalidateTokensIfChanged(server) {
|
|
351
329
|
const generation = currentTokenGeneration();
|
|
352
330
|
if (generation === lastPublishedGeneration)
|
|
@@ -460,8 +438,8 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
460
438
|
return Promise.resolve();
|
|
461
439
|
if (postTransformPromise)
|
|
462
440
|
return postTransformPromise;
|
|
463
|
-
// The module graph decides reachability:
|
|
464
|
-
//
|
|
441
|
+
// The module graph decides reachability: only the reachable entries are transformed,
|
|
442
|
+
// without activating dead CSS files.
|
|
465
443
|
postTransformPromise = (async () => {
|
|
466
444
|
await refreshActiveStylesheetTokens();
|
|
467
445
|
const cssPaths = activeHostCssFiles.size > 0
|
|
@@ -483,17 +461,14 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
483
461
|
await projectBridgeStart;
|
|
484
462
|
await ensurePostTransformCss();
|
|
485
463
|
await ensurePublishedThemeContract();
|
|
486
|
-
return {
|
|
487
|
-
version: 1,
|
|
488
|
-
revision: 0,
|
|
464
|
+
return createNudgeUiClientManifest({
|
|
489
465
|
runtime: buildRuntimeSnapshot(),
|
|
490
466
|
...(projectBridge ? { agentBridge: projectBridge.browser } : {}),
|
|
491
467
|
...automationManifestFields(),
|
|
492
|
-
};
|
|
468
|
+
});
|
|
493
469
|
}
|
|
494
470
|
function startProjectBridge(server) {
|
|
495
|
-
// The
|
|
496
|
-
// sessions, an agent bridge, or filesystem persistence.
|
|
471
|
+
// The demo runs without project-owned sessions, an agent bridge, or filesystem persistence.
|
|
497
472
|
if (options.demo === true || !root || projectBridgeStart)
|
|
498
473
|
return;
|
|
499
474
|
const address = server.httpServer?.address();
|
|
@@ -528,8 +503,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
528
503
|
}));
|
|
529
504
|
return {
|
|
530
505
|
projectId: options.projectId ?? (root ? basename(root) : "vite"),
|
|
531
|
-
// Without a framework there are no component boundaries to describe, so the
|
|
532
|
-
// project is HTML and CSS as far as the inspector is concerned.
|
|
506
|
+
// Without a framework there are no component boundaries to describe, so the project is HTML and CSS.
|
|
533
507
|
host: framework?.hostLabel ?? "static-html",
|
|
534
508
|
framework: framework?.framework ?? "HTML",
|
|
535
509
|
stylingSystem: detectStylingSystem(snapshot.tokens),
|
|
@@ -654,8 +628,8 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
654
628
|
server.watcher?.on("unlink", (file) => handleStylesheetWatchEvent(server, file, "unlink"));
|
|
655
629
|
},
|
|
656
630
|
buildStart() {
|
|
657
|
-
// The browser imports virtual:design-tokens before styles.css is necessarily
|
|
658
|
-
//
|
|
631
|
+
// The browser imports virtual:design-tokens before styles.css is necessarily transformed,
|
|
632
|
+
// so transform-only collection would yield an empty first load.
|
|
659
633
|
if (!enabled || (command !== "serve" && !demoBuild) || !root)
|
|
660
634
|
return;
|
|
661
635
|
for (const cssPath of scanCssFiles(root, [], root, buildOutputDirectory)) {
|
|
@@ -693,14 +667,12 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
693
667
|
}
|
|
694
668
|
await ensurePostTransformCss();
|
|
695
669
|
await ensurePublishedThemeContract();
|
|
696
|
-
//
|
|
697
|
-
// snapshot verbatim, so there is no post-snapshot enrichment or TOCTOU.
|
|
670
|
+
// One immutable snapshot is serialized verbatim; there is no post-snapshot enrichment.
|
|
698
671
|
const runtime = buildRuntimeSnapshot();
|
|
699
672
|
lastPublishedGeneration = runtime.tokenGeneration;
|
|
700
673
|
return `export const tokenCatalog = ${JSON.stringify(runtime.tokenCatalog)};\nexport const tokens = ${JSON.stringify(runtime.tokens)};\nexport const tokenDiagnostics = ${JSON.stringify(runtime.tokenDiagnostics)};\nexport const tokenGeneration = ${JSON.stringify(runtime.tokenGeneration)};\nexport const nudgeUiProjectId = ${JSON.stringify(runtime.projectId)};\nexport default tokens;\n`;
|
|
701
674
|
}
|
|
702
675
|
if (id === RESOLVED_INSPECTOR_ID) {
|
|
703
|
-
// ADR-0002: normal production builds receive no inspector bootstrap.
|
|
704
676
|
if (command === "build" && !demoBuild) {
|
|
705
677
|
return `export {};\n`;
|
|
706
678
|
}
|
|
@@ -708,8 +680,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
708
680
|
const demoControllerExpression = demoBuild
|
|
709
681
|
? "true"
|
|
710
682
|
: '(import.meta.env.DEV && window.location.pathname === "/")';
|
|
711
|
-
// Taken from the composed framework, so the demo bootstrap cannot drift
|
|
712
|
-
// from the manifest the transport serves.
|
|
683
|
+
// Taken from the composed framework, so the demo bootstrap cannot drift from the served manifest.
|
|
713
684
|
const identity = buildRuntimeSnapshot();
|
|
714
685
|
return [
|
|
715
686
|
'import { bootstrapNudgeUi, configureNudgeUiRuntime, createNudgeUiEditorUrl, detectFramework, hasNudgeUiDirectTabIntent, isCanvasRenderer, isNudgeUiDirectUrl, readNudgeUiEditorTarget, rememberNudgeUiDirectTabIntent } from "nudge-ui/internal/inspector";',
|
|
@@ -758,15 +729,13 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
758
729
|
return null;
|
|
759
730
|
}
|
|
760
731
|
if (framework && id === resolvedFrameworkModule()) {
|
|
761
|
-
// ADR-0002: production builds receive an empty catalog.
|
|
762
732
|
const productionBuild = command === "build" && !demoBuild;
|
|
763
733
|
return framework.serializeVirtualModule(productionBuild ? [] : framework.contracts());
|
|
764
734
|
}
|
|
765
735
|
return null;
|
|
766
736
|
},
|
|
767
|
-
// React's Vite plugin is also `enforce: "pre"` with no explicit hook order, so
|
|
768
|
-
//
|
|
769
|
-
// refresh helpers and shifts the AST locations data-src depends on.
|
|
737
|
+
// React's Vite plugin is also `enforce: "pre"` with no explicit hook order, so hook-level
|
|
738
|
+
// `order: "pre"` is what parses authored TSX before Babel shifts the AST locations data-src depends on.
|
|
770
739
|
transform: {
|
|
771
740
|
order: "pre",
|
|
772
741
|
async handler(code, id) {
|
|
@@ -783,7 +752,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
783
752
|
feedCssArtifact(id, code, "authored");
|
|
784
753
|
return null; // let Vite's CSS pipeline handle the actual stylesheet
|
|
785
754
|
}
|
|
786
|
-
// Everything past CSS belongs to the framework; with none, source modules are untouched.
|
|
787
755
|
if (!framework)
|
|
788
756
|
return null;
|
|
789
757
|
return framework.transform({
|
|
@@ -796,14 +764,17 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
796
764
|
},
|
|
797
765
|
},
|
|
798
766
|
transformIndexHtml(html) {
|
|
799
|
-
// The
|
|
800
|
-
//
|
|
767
|
+
// The static demo build imports the virtual module from the app entry, because Vite
|
|
768
|
+
// cannot preserve the dev HTML virtual-module URL.
|
|
801
769
|
if (!enabled || demoBuild)
|
|
802
770
|
return;
|
|
771
|
+
// Demo builds return above: they ship production React, which has no prop-editing toolkit.
|
|
772
|
+
const headScript = framework?.documentHeadScript;
|
|
803
773
|
const out = transformIndexHtmlHtml(html, command, {
|
|
804
774
|
debug: options.debug === true,
|
|
805
775
|
demoBuild,
|
|
806
776
|
demo: options.demo === true,
|
|
777
|
+
...(headScript ? { headScript } : {}),
|
|
807
778
|
});
|
|
808
779
|
return out === null ? undefined : out;
|
|
809
780
|
},
|
|
@@ -815,7 +786,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
815
786
|
invalidateHmrModules(ctx.server, ctx.modules, ctx.timestamp);
|
|
816
787
|
publishedThemeContractLoaded = false;
|
|
817
788
|
await ensurePublishedThemeContract();
|
|
818
|
-
// Same exactly-once path as the CSS branch.
|
|
819
789
|
const { changed, generation, virtual } = invalidateTokensIfChanged(ctx.server);
|
|
820
790
|
if (changed && virtual)
|
|
821
791
|
return [...ctx.modules, virtual];
|
|
@@ -833,8 +803,7 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
833
803
|
catch {
|
|
834
804
|
framework.forget(ctx.file);
|
|
835
805
|
}
|
|
836
|
-
// Vite must update importer edges first: a component can add or remove a
|
|
837
|
-
// stylesheet import while every CSS file remains on disk.
|
|
806
|
+
// Vite must update importer edges first: a component can add or remove a stylesheet import.
|
|
838
807
|
invalidateHmrModules(ctx.server, ctx.modules, ctx.timestamp);
|
|
839
808
|
try {
|
|
840
809
|
await ctx.server.transformRequest(ctx.file);
|
|
@@ -886,20 +855,17 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
886
855
|
}
|
|
887
856
|
}
|
|
888
857
|
await refreshActiveStylesheetTokens();
|
|
889
|
-
// ctx.read() returns authored source, so re-run it through Vite to pick up
|
|
890
|
-
// Tailwind's generated stylesheet before invalidating below.
|
|
858
|
+
// ctx.read() returns authored source, so re-run it through Vite to pick up Tailwind's generated stylesheet.
|
|
891
859
|
postTransformPromise = null;
|
|
892
860
|
try {
|
|
893
861
|
await ctx.server.transformRequest(ctx.file);
|
|
894
862
|
}
|
|
895
863
|
catch {
|
|
896
|
-
// Marks the transform failed so authored rows survive with a recoverable
|
|
897
|
-
// diagnostic. A deleted file has no authored read and is a removal instead.
|
|
864
|
+
// Marks the transform failed so authored rows survive with a recoverable diagnostic.
|
|
898
865
|
if (hasAuthoredObservation)
|
|
899
866
|
feedCssTransformFailure(ctx.file);
|
|
900
867
|
}
|
|
901
|
-
// Every feed for this event has settled, so invalidate only on a real
|
|
902
|
-
// generation change. Vite's own CSS update below still runs either way.
|
|
868
|
+
// Every feed for this event has settled, so invalidate only on a real generation change.
|
|
903
869
|
const { changed, generation, virtual } = invalidateTokensIfChanged(ctx.server);
|
|
904
870
|
if (generation !== previousGeneration && !virtual) {
|
|
905
871
|
ctx.server.ws.send({ type: "full-reload", path: "*" });
|
|
@@ -911,7 +877,6 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
911
877
|
if (m)
|
|
912
878
|
modules.push(m);
|
|
913
879
|
}
|
|
914
|
-
// Deduplicate while preserving order.
|
|
915
880
|
const seen = new Set();
|
|
916
881
|
return modules.filter((m) => {
|
|
917
882
|
if (seen.has(m.id ?? ""))
|
|
@@ -921,9 +886,8 @@ export function createVitePlugins(options = {}, createFramework = null) {
|
|
|
921
886
|
});
|
|
922
887
|
},
|
|
923
888
|
};
|
|
924
|
-
// Tailwind's generator is a pre-transform hook, so this companion stays in Vite's
|
|
925
|
-
//
|
|
926
|
-
// CSS-post JavaScript wrapper. The main plugin stays pre-ordered for TSX locations.
|
|
889
|
+
// Tailwind's generator is a pre-transform hook, so this companion stays in Vite's normal
|
|
890
|
+
// group: after every pre plugin regardless of user order, and before Vite's CSS-post wrapper.
|
|
927
891
|
const transformedCssObserver = {
|
|
928
892
|
name: "nudge-ui:transformed-css",
|
|
929
893
|
apply: "serve",
|
package/dist/html/dom.d.ts
CHANGED
|
@@ -8,6 +8,5 @@ export type StartTagLocation = NonNullable<ElementLocation["startTag"]>;
|
|
|
8
8
|
export declare function isElement(node: DefaultTreeAdapterTypes.ChildNode): node is HtmlElement;
|
|
9
9
|
export declare function hasAttribute(element: HtmlElement, name: string, value?: string): boolean;
|
|
10
10
|
export declare function getAttributeValue(element: HtmlElement, name: string): string | undefined;
|
|
11
|
-
/** Every `<body>` in the document, skipping inert `<template>` content. */
|
|
12
11
|
export declare function findBodyElements(document: DefaultTreeAdapterTypes.Document): HtmlElement[];
|
|
13
12
|
export declare function escapeAttributeValue(value: string): string;
|
package/dist/html/dom.js
CHANGED
|
@@ -19,7 +19,6 @@ export function hasAttribute(element, name, value) {
|
|
|
19
19
|
export function getAttributeValue(element, name) {
|
|
20
20
|
return element.attrs.find((candidate) => candidate.name === name)?.value;
|
|
21
21
|
}
|
|
22
|
-
/** Every `<body>` in the document, skipping inert `<template>` content. */
|
|
23
22
|
export function findBodyElements(document) {
|
|
24
23
|
const bodies = [];
|
|
25
24
|
const visit = (parent) => {
|
package/dist/html/identity.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds source identity to HTML without reserializing it. The two hosts differ
|
|
3
|
-
* only in where identity comes from: the static-HTML host owns the file and
|
|
4
|
-
* uses parser offsets, Astro does not own the response and reads its
|
|
5
|
-
* compiler's annotations. Both share the traversal below.
|
|
6
|
-
*
|
|
7
|
-
* Attributes are inserted only where missing, at the end of the opening tag,
|
|
8
|
-
* so everything outside those insertions stays byte-for-byte unchanged.
|
|
9
|
-
*/
|
|
10
1
|
export interface HtmlIdentityDiagnostic {
|
|
11
2
|
readonly code: HtmlIdentityDiagnosticCode;
|
|
12
3
|
readonly severity: "warning";
|
|
@@ -26,15 +17,10 @@ export interface HtmlIdentityResult {
|
|
|
26
17
|
readonly diagnostics: readonly HtmlIdentityDiagnostic[];
|
|
27
18
|
readonly insertedAttributeCount: number;
|
|
28
19
|
}
|
|
29
|
-
/** Instruments an HTML file the host owns on disk, using parser offsets for position. */
|
|
30
20
|
export declare function instrumentSourceHtml(source: string, file: string): HtmlIdentityResult;
|
|
31
21
|
export interface RenderedHtmlIdentityOptions {
|
|
32
22
|
/** Relativizes absolute annotation paths. Omit to forward them unchanged. */
|
|
33
23
|
readonly projectRoot?: string;
|
|
34
24
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Instruments a rendered Astro dev response from Astro's own compiler
|
|
37
|
-
* annotations. Elements without them degrade to an `astro:<Tag>` label and no
|
|
38
|
-
* position, because a guessed `data-src` would be worse than none.
|
|
39
|
-
*/
|
|
25
|
+
/** Elements without Astro compiler annotations degrade to an `astro:<Tag>` label and no position. */
|
|
40
26
|
export declare function instrumentRenderedHtml(html: string, options?: RenderedHtmlIdentityOptions): HtmlIdentityResult;
|
package/dist/html/identity.js
CHANGED
|
@@ -84,7 +84,6 @@ function runIdentityPass(source, pass) {
|
|
|
84
84
|
insertedAttributeCount: insertions.reduce((count, i) => count + i.attributeCount, 0),
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
/** Instruments an HTML file the host owns on disk, using parser offsets for position. */
|
|
88
87
|
export function instrumentSourceHtml(source, file) {
|
|
89
88
|
return runIdentityPass(source, {
|
|
90
89
|
file,
|
|
@@ -104,11 +103,7 @@ export function instrumentSourceHtml(source, file) {
|
|
|
104
103
|
const ASTRO_ISLAND_TAG_NAME = "astro-island";
|
|
105
104
|
const ASTRO_SOURCE_FILE_ATTRIBUTE = "data-astro-source-file";
|
|
106
105
|
const ASTRO_SOURCE_LOC_ATTRIBUTE = "data-astro-source-loc";
|
|
107
|
-
/**
|
|
108
|
-
* Instruments a rendered Astro dev response from Astro's own compiler
|
|
109
|
-
* annotations. Elements without them degrade to an `astro:<Tag>` label and no
|
|
110
|
-
* position, because a guessed `data-src` would be worse than none.
|
|
111
|
-
*/
|
|
106
|
+
/** Elements without Astro compiler annotations degrade to an `astro:<Tag>` label and no position. */
|
|
112
107
|
export function instrumentRenderedHtml(html, options = {}) {
|
|
113
108
|
let sawSourceAnnotation = false;
|
|
114
109
|
const result = runIdentityPass(html, {
|
|
@@ -167,7 +162,6 @@ function readAstroSourceIdentity(element, projectRoot, report, position) {
|
|
|
167
162
|
const file = projectRelativePath(trimmedFile, projectRoot);
|
|
168
163
|
return loc.column === undefined ? `${file}:${loc.line}` : `${file}:${loc.line}:${loc.column}`;
|
|
169
164
|
}
|
|
170
|
-
/** Parses "line:column". A bare integer is accepted as a line with no column. */
|
|
171
165
|
function parseAstroSourceLoc(value) {
|
|
172
166
|
const match = /^\s*(\d+)(?:\s*:\s*(\d+))?\s*$/.exec(value);
|
|
173
167
|
const lineText = match?.[1];
|
|
@@ -180,7 +174,6 @@ function parseAstroSourceLoc(value) {
|
|
|
180
174
|
const column = Number(columnText);
|
|
181
175
|
return line >= 1 && column >= 1 ? { line, column } : null;
|
|
182
176
|
}
|
|
183
|
-
/** Separators are normalized to forward slashes so values stay portable. */
|
|
184
177
|
function projectRelativePath(filePath, projectRoot) {
|
|
185
178
|
const normalized = filePath.replaceAll("\\", "/");
|
|
186
179
|
if (projectRoot === undefined || !path.isAbsolute(normalized))
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { StartTagLocation } from "./dom.js";
|
|
2
|
-
/** Attribute text to splice into the original source at one byte offset. */
|
|
3
2
|
export interface Insertion {
|
|
4
3
|
readonly offset: number;
|
|
5
4
|
readonly text: string;
|
|
@@ -7,14 +6,9 @@ export interface Insertion {
|
|
|
7
6
|
}
|
|
8
7
|
/** Offset just inside the opening tag's `>`, or null if it is not a tag boundary. */
|
|
9
8
|
export declare function insertionOffsetFor(source: string, startTag: StartTagLocation): number | null;
|
|
10
|
-
/**
|
|
9
|
+
/** Leaves every other byte untouched. */
|
|
11
10
|
export declare function applyInsertions(source: string, insertions: readonly Insertion[]): string;
|
|
12
|
-
/**
|
|
13
|
-
* One-based positions computed from the original source, not from parse5,
|
|
14
|
-
* which normalizes `\r\n` and lone `\r` to `\n` and would drift from the bytes
|
|
15
|
-
* these operations preserve. Columns count UTF-16 code units, so a tab is one
|
|
16
|
-
* column, matching grep-style tooling rather than editor tab stops.
|
|
17
|
-
*/
|
|
11
|
+
/** One-based; computed from the original source because parse5 normalizes line endings. Columns count UTF-16 code units. */
|
|
18
12
|
export interface SourcePositionIndex {
|
|
19
13
|
readonly lineStarts: readonly number[];
|
|
20
14
|
}
|
package/dist/html/insertions.js
CHANGED
|
@@ -10,7 +10,7 @@ export function insertionOffsetFor(source, startTag) {
|
|
|
10
10
|
// Insert before a self-closing slash: `<input data-cid="..." />`.
|
|
11
11
|
return source[endOffset - 2] === "/" ? endOffset - 2 : endOffset - 1;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/** Leaves every other byte untouched. */
|
|
14
14
|
export function applyInsertions(source, insertions) {
|
|
15
15
|
const byOffset = new Map();
|
|
16
16
|
for (const insertion of insertions) {
|