nudge-ui 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/bin/nudge-ui.mjs +7 -0
- package/dist/LICENSE +21 -0
- package/dist/client.mjs +261 -0
- package/dist/compiler/ast.d.ts +18 -0
- package/dist/compiler/ast.js +75 -0
- package/dist/compiler/componentContractTypes.d.ts +19 -0
- package/dist/compiler/componentContractTypes.js +1 -0
- package/dist/compiler/componentContracts.d.ts +2 -0
- package/dist/compiler/componentContracts.js +260 -0
- package/dist/compiler/componentInstrumentation.d.ts +32 -0
- package/dist/compiler/componentInstrumentation.js +140 -0
- package/dist/compiler/componentPolicyResolution.d.ts +71 -0
- package/dist/compiler/componentPolicyResolution.js +388 -0
- package/dist/compiler/index.d.ts +9 -0
- package/dist/compiler/index.js +9 -0
- package/dist/compiler/packageComponentContracts.d.ts +32 -0
- package/dist/compiler/packageComponentContracts.js +308 -0
- package/dist/compiler/reactComponentProtocols.d.ts +145 -0
- package/dist/compiler/reactComponentProtocols.js +47 -0
- package/dist/compiler/reactIdentity.d.ts +15 -0
- package/dist/compiler/reactIdentity.js +339 -0
- package/dist/compiler/sourcePaths.d.ts +12 -0
- package/dist/compiler/sourcePaths.js +27 -0
- package/dist/css/dialects/index.d.ts +62 -0
- package/dist/css/dialects/index.js +103 -0
- package/dist/css/dialects/tailwind.d.ts +46 -0
- package/dist/css/dialects/tailwind.js +119 -0
- package/dist/css/dialects/vanillaExtract.d.ts +20 -0
- package/dist/css/dialects/vanillaExtract.js +32 -0
- package/dist/css/index.d.ts +10 -0
- package/dist/css/index.js +10 -0
- package/dist/css/model/index.d.ts +190 -0
- package/dist/css/model/index.js +10 -0
- package/dist/css/token-inventory/index.d.ts +26 -0
- package/dist/css/token-inventory/index.js +24 -0
- package/dist/css/token-inventory/inventory.d.ts +8 -0
- package/dist/css/token-inventory/inventory.js +421 -0
- package/dist/css/token-inventory/parseStylesheet.d.ts +16 -0
- package/dist/css/token-inventory/parseStylesheet.js +155 -0
- package/dist/css/token-inventory/policy.d.ts +47 -0
- package/dist/css/token-inventory/policy.js +50 -0
- package/dist/css/token-inventory/types.d.ts +97 -0
- package/dist/css/token-inventory/types.js +1 -0
- package/dist/css/value-semantics/borderSemantics.d.ts +28 -0
- package/dist/css/value-semantics/borderSemantics.js +91 -0
- package/dist/css/value-semantics/boxSemantics.d.ts +37 -0
- package/dist/css/value-semantics/boxSemantics.js +71 -0
- package/dist/css/value-semantics/colorSemantics.d.ts +99 -0
- package/dist/css/value-semantics/colorSemantics.js +526 -0
- package/dist/css/value-semantics/cssSyntax.d.ts +19 -0
- package/dist/css/value-semantics/cssSyntax.js +111 -0
- package/dist/css/value-semantics/fontSemantics.d.ts +35 -0
- package/dist/css/value-semantics/fontSemantics.js +131 -0
- package/dist/css/value-semantics/index.d.ts +20 -0
- package/dist/css/value-semantics/index.js +15 -0
- package/dist/css/value-semantics/propertyPolicy.d.ts +118 -0
- package/dist/css/value-semantics/propertyPolicy.js +356 -0
- package/dist/css/value-semantics/stringMaps.d.ts +2 -0
- package/dist/css/value-semantics/stringMaps.js +1 -0
- package/dist/css/value-semantics/structuredValues.d.ts +64 -0
- package/dist/css/value-semantics/structuredValues.js +250 -0
- package/dist/css/value-semantics/tokenInterpretation.d.ts +90 -0
- package/dist/css/value-semantics/tokenInterpretation.js +193 -0
- package/dist/css/virtual-design-tokens.d.ts +17 -0
- package/dist/hosts/astro/astroRuntimeConfig.d.ts +12 -0
- package/dist/hosts/astro/astroRuntimeConfig.js +26 -0
- package/dist/hosts/astro/clientAsset.d.ts +12 -0
- package/dist/hosts/astro/clientAsset.js +51 -0
- package/dist/hosts/astro/clientTransport.d.ts +3 -0
- package/dist/hosts/astro/clientTransport.js +57 -0
- package/dist/hosts/astro/index.d.ts +3 -0
- package/dist/hosts/astro/index.js +2 -0
- package/dist/hosts/astro/integration.d.ts +35 -0
- package/dist/hosts/astro/integration.js +96 -0
- package/dist/hosts/astro/middleware.d.ts +13 -0
- package/dist/hosts/astro/middleware.js +22 -0
- package/dist/hosts/astro/projectContext.d.ts +11 -0
- package/dist/hosts/astro/projectContext.js +34 -0
- package/dist/hosts/astro/responseInstrumentation.d.ts +41 -0
- package/dist/hosts/astro/responseInstrumentation.js +80 -0
- package/dist/hosts/next/index.d.ts +4 -0
- package/dist/hosts/next/index.js +7 -0
- package/dist/hosts/next/loader.d.ts +66 -0
- package/dist/hosts/next/loader.js +346 -0
- package/dist/hosts/next/loaders/identity-loader.cjs +228257 -0
- package/dist/hosts/next/loaders/loader-plugin.cjs +228257 -0
- package/dist/hosts/next/manifest.d.ts +38 -0
- package/dist/hosts/next/manifest.js +30 -0
- package/dist/hosts/next/mount.d.ts +12 -0
- package/dist/hosts/next/mount.js +23 -0
- package/dist/hosts/next/repositoryScope.d.ts +20 -0
- package/dist/hosts/next/repositoryScope.js +33 -0
- package/dist/hosts/next/sidecar.d.ts +27 -0
- package/dist/hosts/next/sidecar.js +526 -0
- package/dist/hosts/next/wrapper.d.ts +67 -0
- package/dist/hosts/next/wrapper.js +310 -0
- package/dist/hosts/static/cli.d.ts +12 -0
- package/dist/hosts/static/cli.js +77 -0
- package/dist/hosts/static/html/bootstrap.d.ts +27 -0
- package/dist/hosts/static/html/bootstrap.js +93 -0
- package/dist/hosts/static/index.d.ts +4 -0
- package/dist/hosts/static/index.js +4 -0
- package/dist/hosts/static/manifest.d.ts +18 -0
- package/dist/hosts/static/manifest.js +51 -0
- package/dist/hosts/static/server.d.ts +72 -0
- package/dist/hosts/static/server.js +554 -0
- package/dist/hosts/vite/index.d.ts +20 -0
- package/dist/hosts/vite/index.js +48 -0
- package/dist/hosts/vite/react.d.ts +67 -0
- package/dist/hosts/vite/react.js +231 -0
- package/dist/hosts/vite/tokens/activeStylesheets.d.ts +28 -0
- package/dist/hosts/vite/tokens/activeStylesheets.js +70 -0
- package/dist/hosts/vite/tokens/fileMap.d.ts +2 -0
- package/dist/hosts/vite/tokens/fileMap.js +1 -0
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.d.ts +46 -0
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.js +104 -0
- package/dist/hosts/vite/virtual/design-tokens.d.ts +9 -0
- package/dist/hosts/vite/virtual/design-tokens.js +7 -0
- package/dist/hosts/vite/virtual-design-tokens.d.ts +1 -0
- package/dist/hosts/vite/vite.d.ts +62 -0
- package/dist/hosts/vite/vite.js +854 -0
- package/dist/html/dom.d.ts +13 -0
- package/dist/html/dom.js +46 -0
- package/dist/html/identity.d.ts +40 -0
- package/dist/html/identity.js +196 -0
- package/dist/html/insertions.d.ts +26 -0
- package/dist/html/insertions.js +59 -0
- package/dist/inspector/agent/McpConnectionDialog.d.ts +26 -0
- package/dist/inspector/agent/McpConnectionDialog.js +135 -0
- package/dist/inspector/agent/client.d.ts +98 -0
- package/dist/inspector/agent/client.js +728 -0
- package/dist/inspector/agent/connectionStatus.d.ts +13 -0
- package/dist/inspector/agent/connectionStatus.js +35 -0
- package/dist/inspector/agent/httpTransport.d.ts +21 -0
- package/dist/inspector/agent/httpTransport.js +347 -0
- package/dist/inspector/agent/protocol.d.ts +95 -0
- package/dist/inspector/agent/protocol.js +9 -0
- package/dist/inspector/agent/verification.d.ts +39 -0
- package/dist/inspector/agent/verification.js +207 -0
- package/dist/inspector/canvas/CanvasCard.d.ts +10 -0
- package/dist/inspector/canvas/CanvasCard.js +275 -0
- package/dist/inspector/canvas/CanvasElementOverlay.d.ts +2 -0
- package/dist/inspector/canvas/CanvasElementOverlay.js +301 -0
- package/dist/inspector/canvas/CanvasWorkspace.d.ts +2 -0
- package/dist/inspector/canvas/CanvasWorkspace.js +301 -0
- package/dist/inspector/canvas/LockedWorkspaceNotice.d.ts +6 -0
- package/dist/inspector/canvas/LockedWorkspaceNotice.js +17 -0
- package/dist/inspector/canvas/StaleChangeIndicator.d.ts +7 -0
- package/dist/inspector/canvas/StaleChangeIndicator.js +43 -0
- package/dist/inspector/canvas/agentPresentation.d.ts +87 -0
- package/dist/inspector/canvas/agentPresentation.js +421 -0
- package/dist/inspector/canvas/canvasGestures.d.ts +12 -0
- package/dist/inspector/canvas/canvasGestures.js +21 -0
- package/dist/inspector/canvas/canvasStore.d.ts +108 -0
- package/dist/inspector/canvas/canvasStore.js +448 -0
- package/dist/inspector/canvas/frameProtocol.d.ts +231 -0
- package/dist/inspector/canvas/frameProtocol.js +165 -0
- package/dist/inspector/canvas/linkEligibility.d.ts +8 -0
- package/dist/inspector/canvas/linkEligibility.js +68 -0
- package/dist/inspector/canvas/measurementProjection.d.ts +8 -0
- package/dist/inspector/canvas/measurementProjection.js +16 -0
- package/dist/inspector/canvas/normalizeUrl.d.ts +7 -0
- package/dist/inspector/canvas/normalizeUrl.js +27 -0
- package/dist/inspector/canvas/projection.d.ts +41 -0
- package/dist/inspector/canvas/projection.js +232 -0
- package/dist/inspector/canvas/rendererBootstrap.d.ts +4 -0
- package/dist/inspector/canvas/rendererBootstrap.js +410 -0
- package/dist/inspector/canvas/rendererCidIndex.d.ts +11 -0
- package/dist/inspector/canvas/rendererCidIndex.js +21 -0
- package/dist/inspector/canvas/rendererElementSelector.d.ts +2 -0
- package/dist/inspector/canvas/rendererElementSelector.js +378 -0
- package/dist/inspector/canvas/rendererSelectionProxy.d.ts +2 -0
- package/dist/inspector/canvas/rendererSelectionProxy.js +61 -0
- package/dist/inspector/canvas/rendererStylesheet.d.ts +16 -0
- package/dist/inspector/canvas/rendererStylesheet.js +221 -0
- package/dist/inspector/canvas/resizeHandleScale.d.ts +13 -0
- package/dist/inspector/canvas/resizeHandleScale.js +20 -0
- package/dist/inspector/canvas/roleDetection.d.ts +5 -0
- package/dist/inspector/canvas/roleDetection.js +21 -0
- package/dist/inspector/canvas/sessionStore.d.ts +71 -0
- package/dist/inspector/canvas/sessionStore.js +453 -0
- package/dist/inspector/canvas/staleChangeDetector.d.ts +11 -0
- package/dist/inspector/canvas/staleChangeDetector.js +217 -0
- package/dist/inspector/canvas/toolbarScale.d.ts +7 -0
- package/dist/inspector/canvas/toolbarScale.js +11 -0
- package/dist/inspector/canvas/workspaceLease.d.ts +26 -0
- package/dist/inspector/canvas/workspaceLease.js +214 -0
- package/dist/inspector/changes/changesLog.d.ts +46 -0
- package/dist/inspector/changes/changesLog.js +209 -0
- package/dist/inspector/changes/codecs.d.ts +98 -0
- package/dist/inspector/changes/codecs.js +389 -0
- package/dist/inspector/changes/editModel.d.ts +74 -0
- package/dist/inspector/changes/editModel.js +120 -0
- package/dist/inspector/changes/managedStyleProjection.d.ts +6 -0
- package/dist/inspector/changes/managedStyleProjection.js +109 -0
- package/dist/inspector/changes/model.d.ts +13 -0
- package/dist/inspector/changes/model.js +163 -0
- package/dist/inspector/changes/presentation.d.ts +14 -0
- package/dist/inspector/changes/presentation.js +81 -0
- package/dist/inspector/changes/previewDiagnostics.d.ts +39 -0
- package/dist/inspector/changes/previewDiagnostics.js +172 -0
- package/dist/inspector/changes/structuralTypes.d.ts +35 -0
- package/dist/inspector/changes/structuralTypes.js +1 -0
- package/dist/inspector/changes/types.d.ts +76 -0
- package/dist/inspector/changes/types.js +16 -0
- package/dist/inspector/changes/workspaceChanges.d.ts +43 -0
- package/dist/inspector/changes/workspaceChanges.js +239 -0
- package/dist/inspector/clientManifest.d.ts +24 -0
- package/dist/inspector/clientManifest.js +69 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +5 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.js +44 -0
- package/dist/inspector/componentSemantics/adapterRegistry.d.ts +11 -0
- package/dist/inspector/componentSemantics/adapterRegistry.js +75 -0
- package/dist/inspector/componentSemantics/boundaries.d.ts +2 -0
- package/dist/inspector/componentSemantics/boundaries.js +10 -0
- package/dist/inspector/componentSemantics/changeAction.d.ts +3 -0
- package/dist/inspector/componentSemantics/changeAction.js +6 -0
- package/dist/inspector/componentSemantics/changeModel.d.ts +8 -0
- package/dist/inspector/componentSemantics/changeModel.js +60 -0
- package/dist/inspector/componentSemantics/index.d.ts +4 -0
- package/dist/inspector/componentSemantics/index.js +2 -0
- package/dist/inspector/componentSemantics/reactRuntime.d.ts +10 -0
- package/dist/inspector/componentSemantics/reactRuntime.js +186 -0
- package/dist/inspector/componentSemantics/runtimeBridge.d.ts +25 -0
- package/dist/inspector/componentSemantics/runtimeBridge.js +161 -0
- package/dist/inspector/componentSemantics/runtimeTypes.d.ts +2 -0
- package/dist/inspector/componentSemantics/runtimeTypes.js +1 -0
- package/dist/inspector/componentSemantics/textBinding.d.ts +69 -0
- package/dist/inspector/componentSemantics/textBinding.js +514 -0
- package/dist/inspector/componentSemantics/types.d.ts +96 -0
- package/dist/inspector/componentSemantics/types.js +5 -0
- package/dist/inspector/conformance/borderCases.d.ts +7 -0
- package/dist/inspector/conformance/borderCases.js +428 -0
- package/dist/inspector/conformance/colorCases.d.ts +8 -0
- package/dist/inspector/conformance/colorCases.js +470 -0
- package/dist/inspector/conformance/fixture.d.ts +68 -0
- package/dist/inspector/conformance/fixture.js +153 -0
- package/dist/inspector/conformance/projection.d.ts +2 -0
- package/dist/inspector/conformance/projection.js +3 -0
- package/dist/inspector/conformance/spacingCases.d.ts +6 -0
- package/dist/inspector/conformance/spacingCases.js +417 -0
- package/dist/inspector/conformance/typographyCases.d.ts +7 -0
- package/dist/inspector/conformance/typographyCases.js +174 -0
- package/dist/inspector/editScope.d.ts +4 -0
- package/dist/inspector/editScope.js +5 -0
- package/dist/inspector/index.d.ts +20 -0
- package/dist/inspector/index.js +236 -0
- package/dist/inspector/inline-text/inlineTextEditor.d.ts +74 -0
- package/dist/inspector/inline-text/inlineTextEditor.js +1207 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.d.ts +2 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.js +17 -0
- package/dist/inspector/inline-text/textChangeBoundary.d.ts +6 -0
- package/dist/inspector/inline-text/textChangeBoundary.js +1 -0
- package/dist/inspector/inspection/bridge.d.ts +72 -0
- package/dist/inspector/inspection/bridge.js +134 -0
- package/dist/inspector/inspection/browserCssInspection.d.ts +74 -0
- package/dist/inspector/inspection/browserCssInspection.js +317 -0
- package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +12 -0
- package/dist/inspector/inspection/browserCssInspectionRegistry.js +66 -0
- package/dist/inspector/inspection/selectionProperty.d.ts +32 -0
- package/dist/inspector/inspection/selectionProperty.js +33 -0
- package/dist/inspector/inspection/useBrowserCssInspection.d.ts +20 -0
- package/dist/inspector/inspection/useBrowserCssInspection.js +159 -0
- package/dist/inspector/overlay/DropGuideOverlay.d.ts +17 -0
- package/dist/inspector/overlay/DropGuideOverlay.js +17 -0
- package/dist/inspector/overlay/InspectorOverlay.d.ts +5 -0
- package/dist/inspector/overlay/InspectorOverlay.js +328 -0
- package/dist/inspector/overlay/MeasurementGuideOverlay.d.ts +19 -0
- package/dist/inspector/overlay/MeasurementGuideOverlay.js +40 -0
- package/dist/inspector/overlay/clickPolicy.d.ts +7 -0
- package/dist/inspector/overlay/clickPolicy.js +13 -0
- package/dist/inspector/overlay/dropGuide.d.ts +22 -0
- package/dist/inspector/overlay/dropGuide.js +48 -0
- package/dist/inspector/overlay/elementSelector.d.ts +1 -0
- package/dist/inspector/overlay/elementSelector.js +100 -0
- package/dist/inspector/overlay/frameThrottle.d.ts +10 -0
- package/dist/inspector/overlay/frameThrottle.js +38 -0
- package/dist/inspector/overlay/interactionStyles.d.ts +3 -0
- package/dist/inspector/overlay/interactionStyles.js +70 -0
- package/dist/inspector/overlay/measurementGeometry.d.ts +25 -0
- package/dist/inspector/overlay/measurementGeometry.js +104 -0
- package/dist/inspector/overlay/overlayGeometry.d.ts +40 -0
- package/dist/inspector/overlay/overlayGeometry.js +59 -0
- package/dist/inspector/overlay/selectedGeometry.d.ts +7 -0
- package/dist/inspector/overlay/selectedGeometry.js +51 -0
- package/dist/inspector/overlay/structuralGestures.d.ts +28 -0
- package/dist/inspector/overlay/structuralGestures.js +180 -0
- package/dist/inspector/projection/cssEscapes.d.ts +3 -0
- package/dist/inspector/projection/cssEscapes.js +20 -0
- package/dist/inspector/projection/managedStylesheet.d.ts +33 -0
- package/dist/inspector/projection/managedStylesheet.js +240 -0
- package/dist/inspector/projection/renderedInstance.d.ts +56 -0
- package/dist/inspector/projection/renderedInstance.js +306 -0
- package/dist/inspector/projection/structuralProjection.d.ts +93 -0
- package/dist/inspector/projection/structuralProjection.js +560 -0
- package/dist/inspector/projection/structuralProjectionBoundary.d.ts +5 -0
- package/dist/inspector/projection/structuralProjectionBoundary.js +65 -0
- package/dist/inspector/projection/textProjection.d.ts +53 -0
- package/dist/inspector/projection/textProjection.js +705 -0
- package/dist/inspector/projection/workspaceProjection.d.ts +43 -0
- package/dist/inspector/projection/workspaceProjection.js +58 -0
- package/dist/inspector/prompt/PromptSettingsDialog.d.ts +15 -0
- package/dist/inspector/prompt/PromptSettingsDialog.js +17 -0
- package/dist/inspector/prompt/clipboardHandoff.d.ts +34 -0
- package/dist/inspector/prompt/clipboardHandoff.js +212 -0
- package/dist/inspector/prompt/copyToClipboard.d.ts +1 -0
- package/dist/inspector/prompt/copyToClipboard.js +34 -0
- package/dist/inspector/prompt/detectFramework.d.ts +6 -0
- package/dist/inspector/prompt/detectFramework.js +4 -0
- package/dist/inspector/prompt/generatePrompt.d.ts +7 -0
- package/dist/inspector/prompt/generatePrompt.js +391 -0
- package/dist/inspector/prompt/promptSettings.d.ts +8 -0
- package/dist/inspector/prompt/promptSettings.js +28 -0
- package/dist/inspector/runtime/devFlag.d.ts +28 -0
- package/dist/inspector/runtime/devFlag.js +50 -0
- package/dist/inspector/runtime/documentStylesheetOrder.d.ts +19 -0
- package/dist/inspector/runtime/documentStylesheetOrder.js +89 -0
- package/dist/inspector/runtime/domRealm.d.ts +4 -0
- package/dist/inspector/runtime/domRealm.js +11 -0
- package/dist/inspector/runtime/runtimeConfig.d.ts +119 -0
- package/dist/inspector/runtime/runtimeConfig.js +276 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +32 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +149 -0
- package/dist/inspector/runtime/useRuntimeConfig.d.ts +10 -0
- package/dist/inspector/runtime/useRuntimeConfig.js +13 -0
- package/dist/inspector/selection/editScope.d.ts +32 -0
- package/dist/inspector/selection/editScope.js +140 -0
- package/dist/inspector/selection/editTarget.d.ts +8 -0
- package/dist/inspector/selection/editTarget.js +11 -0
- package/dist/inspector/selection/hierarchy.d.ts +7 -0
- package/dist/inspector/selection/hierarchy.js +42 -0
- package/dist/inspector/selection/resolveSelection.d.ts +10 -0
- package/dist/inspector/selection/resolveSelection.js +60 -0
- package/dist/inspector/selection/selectionStore.d.ts +41 -0
- package/dist/inspector/selection/selectionStore.js +262 -0
- package/dist/inspector/selection/selectionTarget.d.ts +5 -0
- package/dist/inspector/selection/selectionTarget.js +50 -0
- package/dist/inspector/selection/sourceSite.d.ts +2 -0
- package/dist/inspector/selection/sourceSite.js +12 -0
- package/dist/inspector/selection/styleSelection.d.ts +22 -0
- package/dist/inspector/selection/styleSelection.js +104 -0
- package/dist/inspector/session/index.d.ts +3 -0
- package/dist/inspector/session/index.js +2 -0
- package/dist/inspector/session/lifecycle.d.ts +22 -0
- package/dist/inspector/session/lifecycle.js +63 -0
- package/dist/inspector/session/sessionContext.d.ts +21 -0
- package/dist/inspector/session/sessionContext.js +28 -0
- package/dist/inspector/session/sessionFactory.d.ts +29 -0
- package/dist/inspector/session/sessionFactory.js +73 -0
- package/dist/inspector/settings/SettingsDialog.d.ts +12 -0
- package/dist/inspector/settings/SettingsDialog.js +46 -0
- package/dist/inspector/shell/AppShell.d.ts +2 -0
- package/dist/inspector/shell/AppShell.js +9 -0
- package/dist/inspector/shell/ChangesLog.d.ts +6 -0
- package/dist/inspector/shell/ChangesLog.js +92 -0
- package/dist/inspector/shell/CopyPromptButton.d.ts +9 -0
- package/dist/inspector/shell/CopyPromptButton.js +159 -0
- package/dist/inspector/shell/DomNavigation.d.ts +8 -0
- package/dist/inspector/shell/DomNavigation.js +30 -0
- package/dist/inspector/shell/EmptyState.d.ts +2 -0
- package/dist/inspector/shell/EmptyState.js +15 -0
- package/dist/inspector/shell/InspectorShell.d.ts +11 -0
- package/dist/inspector/shell/InspectorShell.js +268 -0
- package/dist/inspector/shell/openStore.d.ts +6 -0
- package/dist/inspector/shell/openStore.js +29 -0
- package/dist/inspector/shell/panelLayout.d.ts +2 -0
- package/dist/inspector/shell/panelLayout.js +29 -0
- package/dist/inspector/shell/shortcuts.d.ts +3 -0
- package/dist/inspector/shell/shortcuts.js +25 -0
- package/dist/inspector/shell/stateValue.d.ts +3 -0
- package/dist/inspector/shell/stateValue.js +34 -0
- package/dist/inspector/shell/styleState.d.ts +7 -0
- package/dist/inspector/shell/styleState.js +13 -0
- package/dist/inspector/spacing/projection.d.ts +43 -0
- package/dist/inspector/spacing/projection.js +136 -0
- package/dist/inspector/styleEditors/AppearanceSection.d.ts +13 -0
- package/dist/inspector/styleEditors/AppearanceSection.js +6 -0
- package/dist/inspector/styleEditors/AspectRatioField.d.ts +17 -0
- package/dist/inspector/styleEditors/AspectRatioField.js +10 -0
- package/dist/inspector/styleEditors/BorderEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/BorderEditor.js +295 -0
- package/dist/inspector/styleEditors/BorderRadiusEditor.d.ts +14 -0
- package/dist/inspector/styleEditors/BorderRadiusEditor.js +108 -0
- package/dist/inspector/styleEditors/BoxShadowEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/BoxShadowEditor.js +13 -0
- package/dist/inspector/styleEditors/ColorPicker.d.ts +15 -0
- package/dist/inspector/styleEditors/ColorPicker.js +73 -0
- package/dist/inspector/styleEditors/GapField.d.ts +17 -0
- package/dist/inspector/styleEditors/GapField.js +12 -0
- package/dist/inspector/styleEditors/GridChildSection.d.ts +14 -0
- package/dist/inspector/styleEditors/GridChildSection.js +91 -0
- package/dist/inspector/styleEditors/GridPicker.d.ts +13 -0
- package/dist/inspector/styleEditors/GridPicker.js +179 -0
- package/dist/inspector/styleEditors/GridSection.d.ts +17 -0
- package/dist/inspector/styleEditors/GridSection.js +27 -0
- package/dist/inspector/styleEditors/GridValueField.d.ts +17 -0
- package/dist/inspector/styleEditors/GridValueField.js +70 -0
- package/dist/inspector/styleEditors/InsetSection.d.ts +15 -0
- package/dist/inspector/styleEditors/InsetSection.js +15 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +6 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +6 -0
- package/dist/inspector/styleEditors/LayoutComboField.d.ts +18 -0
- package/dist/inspector/styleEditors/LayoutComboField.js +138 -0
- package/dist/inspector/styleEditors/LayoutDropdown.d.ts +14 -0
- package/dist/inspector/styleEditors/LayoutDropdown.js +34 -0
- package/dist/inspector/styleEditors/LayoutSection.d.ts +13 -0
- package/dist/inspector/styleEditors/LayoutSection.js +342 -0
- package/dist/inspector/styleEditors/OpacityEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/OpacityEditor.js +34 -0
- package/dist/inspector/styleEditors/PositionInsets.d.ts +15 -0
- package/dist/inspector/styleEditors/PositionInsets.js +12 -0
- package/dist/inspector/styleEditors/SpacingBox.d.ts +29 -0
- package/dist/inspector/styleEditors/SpacingBox.js +189 -0
- package/dist/inspector/styleEditors/Typography.d.ts +13 -0
- package/dist/inspector/styleEditors/Typography.js +137 -0
- package/dist/inspector/styleEditors/completeCssValue.d.ts +8 -0
- package/dist/inspector/styleEditors/completeCssValue.js +34 -0
- package/dist/inspector/styleEditors/gridChildModel.d.ts +74 -0
- package/dist/inspector/styleEditors/gridChildModel.js +138 -0
- package/dist/inspector/styleEditors/layoutValue.d.ts +24 -0
- package/dist/inspector/styleEditors/layoutValue.js +103 -0
- package/dist/inspector/styleEditors/nudgeValue.d.ts +8 -0
- package/dist/inspector/styleEditors/nudgeValue.js +71 -0
- package/dist/inspector/styleEditors/rowLookup.d.ts +11 -0
- package/dist/inspector/styleEditors/rowLookup.js +13 -0
- package/dist/inspector/styleEditors/stringRecord.d.ts +4 -0
- package/dist/inspector/styleEditors/stringRecord.js +1 -0
- package/dist/inspector/styleEditors/valuePolicy.d.ts +20 -0
- package/dist/inspector/styleEditors/valuePolicy.js +82 -0
- package/dist/inspector/testing.d.ts +10 -0
- package/dist/inspector/testing.js +9 -0
- package/dist/inspector/tokens/TokenChip.d.ts +24 -0
- package/dist/inspector/tokens/TokenChip.js +23 -0
- package/dist/inspector/tokens/TokenDropdown.d.ts +13 -0
- package/dist/inspector/tokens/TokenDropdown.js +59 -0
- package/dist/inspector/tokens/TokenField.d.ts +68 -0
- package/dist/inspector/tokens/TokenField.js +485 -0
- package/dist/inspector/tokens/TokenLabel.d.ts +7 -0
- package/dist/inspector/tokens/TokenLabel.js +23 -0
- package/dist/inspector/tokens/TokensPanel.d.ts +5 -0
- package/dist/inspector/tokens/TokensPanel.js +47 -0
- package/dist/inspector/tokens/catalog.d.ts +51 -0
- package/dist/inspector/tokens/catalog.js +184 -0
- package/dist/inspector/tokens/editActions.d.ts +35 -0
- package/dist/inspector/tokens/editActions.js +164 -0
- package/dist/inspector/tokens/resolution/cascade.d.ts +14 -0
- package/dist/inspector/tokens/resolution/cascade.js +31 -0
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +43 -0
- package/dist/inspector/tokens/resolution/cssomCollector.js +528 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +12 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.js +106 -0
- package/dist/inspector/tokens/resolution.d.ts +56 -0
- package/dist/inspector/tokens/resolution.js +1401 -0
- package/dist/inspector/tokens/tokenEdits.d.ts +3 -0
- package/dist/inspector/tokens/tokenEdits.js +22 -0
- package/dist/inspector/tokens/valueSemanticsAdapter.d.ts +6 -0
- package/dist/inspector/tokens/valueSemanticsAdapter.js +68 -0
- package/dist/inspector/ui/AtRuleContext.d.ts +18 -0
- package/dist/inspector/ui/AtRuleContext.js +54 -0
- package/dist/inspector/ui/Button.d.ts +9 -0
- package/dist/inspector/ui/Button.js +4 -0
- package/dist/inspector/ui/ColorSwatch.d.ts +7 -0
- package/dist/inspector/ui/ColorSwatch.js +6 -0
- package/dist/inspector/ui/ControlSurface.d.ts +14 -0
- package/dist/inspector/ui/ControlSurface.js +10 -0
- package/dist/inspector/ui/FieldRow.d.ts +14 -0
- package/dist/inspector/ui/FieldRow.js +15 -0
- package/dist/inspector/ui/IconButton.d.ts +14 -0
- package/dist/inspector/ui/IconButton.js +5 -0
- package/dist/inspector/ui/InspectorPopover.d.ts +17 -0
- package/dist/inspector/ui/InspectorPopover.js +13 -0
- package/dist/inspector/ui/PopoverListbox.d.ts +37 -0
- package/dist/inspector/ui/PopoverListbox.js +21 -0
- package/dist/inspector/ui/SegmentedControl.d.ts +24 -0
- package/dist/inspector/ui/SegmentedControl.js +16 -0
- package/dist/inspector/ui/Select.d.ts +25 -0
- package/dist/inspector/ui/Select.js +56 -0
- package/dist/inspector/ui/SideValuesField.d.ts +44 -0
- package/dist/inspector/ui/SideValuesField.js +76 -0
- package/dist/inspector/ui/StatusCallout.d.ts +9 -0
- package/dist/inspector/ui/StatusCallout.js +4 -0
- package/dist/inspector/ui/TextInput.d.ts +12 -0
- package/dist/inspector/ui/TextInput.js +5 -0
- package/dist/inspector/ui/ToggleButton.d.ts +11 -0
- package/dist/inspector/ui/ToggleButton.js +6 -0
- package/dist/inspector/ui/assets/grid.svg +14 -0
- package/dist/inspector/ui/css.d.ts +9 -0
- package/dist/inspector/ui/labels.d.ts +1 -0
- package/dist/inspector/ui/labels.js +7 -0
- package/dist/inspector/ui/styles.d.ts +1 -0
- package/dist/inspector/ui/styles.js +68 -0
- package/dist/inspector/virtual-modules.d.ts +7 -0
- package/dist/inspector/vite-env.d.ts +10 -0
- package/dist/internal/agent-protocol.d.ts +232 -0
- package/dist/internal/agent-protocol.js +237 -0
- package/dist/nudge-ui.mjs +15722 -0
- package/dist/project/files.d.ts +19 -0
- package/dist/project/files.js +226 -0
- package/dist/project/identity.d.ts +6 -0
- package/dist/project/identity.js +19 -0
- package/dist/project/pathPolicy.d.ts +8 -0
- package/dist/project/pathPolicy.js +12 -0
- package/dist/project/tokens.d.ts +36 -0
- package/dist/project/tokens.js +223 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/routes.d.ts +13 -0
- package/dist/transport/routes.js +16 -0
- package/package.json +137 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { verifyPreview } from "../projection/managedStylesheet.js";
|
|
2
|
+
import { getSelectedElement } from "../selection/selectionStore.js";
|
|
3
|
+
import { instanceSelector } from "../projection/renderedInstance.js";
|
|
4
|
+
import { selectorForInteractionState } from "../shell/styleState.js";
|
|
5
|
+
import { isComponentChange, isTextContentChange, isTokenChange, } from "./types.js";
|
|
6
|
+
import { tokenReference } from "./model.js";
|
|
7
|
+
function requestedStyleValue(change) {
|
|
8
|
+
if (isTokenChange(change))
|
|
9
|
+
return change.rawValue;
|
|
10
|
+
if (change.newToken)
|
|
11
|
+
return tokenReference(change.newToken);
|
|
12
|
+
return change.rawValue ?? "";
|
|
13
|
+
}
|
|
14
|
+
function projectedStyleValue(change) {
|
|
15
|
+
const value = requestedStyleValue(change);
|
|
16
|
+
return isTokenChange(change) && change.important && !/!\s*important\s*$/i.test(value)
|
|
17
|
+
? `${value} !important`
|
|
18
|
+
: value;
|
|
19
|
+
}
|
|
20
|
+
function ruleKey(change) {
|
|
21
|
+
const context = isTokenChange(change) ? JSON.stringify(change.context) : "";
|
|
22
|
+
return `${selectorForManagedChange(change) ?? change.selector}\u0000${change.property}\u0000${context}`;
|
|
23
|
+
}
|
|
24
|
+
/** The source selector stays canonical; the projection marker is document-local. */
|
|
25
|
+
export function selectorForManagedChange(change) {
|
|
26
|
+
if (!isTokenChange(change) && change.scope === "rendered-instance") {
|
|
27
|
+
if (!change.instanceOverride)
|
|
28
|
+
return null;
|
|
29
|
+
const selector = instanceSelector(change.instanceOverride);
|
|
30
|
+
return selector ? selectorForInteractionState(selector, change.state ?? "base") : null;
|
|
31
|
+
}
|
|
32
|
+
return change.selector;
|
|
33
|
+
}
|
|
34
|
+
export function buildManagedStyleRules(changes) {
|
|
35
|
+
const sourceRules = new Map();
|
|
36
|
+
const instanceRules = new Map();
|
|
37
|
+
for (const change of changes) {
|
|
38
|
+
if (isComponentChange(change) || isTextContentChange(change))
|
|
39
|
+
continue;
|
|
40
|
+
const value = projectedStyleValue(change);
|
|
41
|
+
if (!value)
|
|
42
|
+
continue;
|
|
43
|
+
const selector = selectorForManagedChange(change);
|
|
44
|
+
if (!selector)
|
|
45
|
+
continue;
|
|
46
|
+
const key = ruleKey(change);
|
|
47
|
+
const map = !isTokenChange(change) && change.scope === "rendered-instance"
|
|
48
|
+
? instanceRules
|
|
49
|
+
: sourceRules;
|
|
50
|
+
const existing = map.get(key);
|
|
51
|
+
if (existing) {
|
|
52
|
+
existing.declarations[change.property] = value;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
map.set(key, {
|
|
56
|
+
selector,
|
|
57
|
+
declarations: { [change.property]: value },
|
|
58
|
+
context: isTokenChange(change) ? change.context : undefined,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Source-site rules remain the default; exact rendered-instance rules are
|
|
63
|
+
// emitted afterwards so their additional marker specificity wins.
|
|
64
|
+
return [...sourceRules.values(), ...instanceRules.values()];
|
|
65
|
+
}
|
|
66
|
+
export function verifyManagedStyleProjection(change, selectedElement) {
|
|
67
|
+
// Deferred verification must use the selection that existed when the
|
|
68
|
+
// projection was committed. Reading the live selection here can make a
|
|
69
|
+
// host-document change verify against a later canvas selection (or vice
|
|
70
|
+
// versa) and manufacture a conflict for the wrong document.
|
|
71
|
+
const selected = selectedElement === undefined
|
|
72
|
+
? getSelectedElement()?.domElement ?? null
|
|
73
|
+
: selectedElement;
|
|
74
|
+
const requestedValue = requestedStyleValue(change);
|
|
75
|
+
// A Canvas-only selection belongs to an iframe. The controller stylesheet
|
|
76
|
+
// cannot verify it synchronously; leave its result unknown until the frame
|
|
77
|
+
// has received the canonical projection rather than claiming it is stale.
|
|
78
|
+
if (selected && selected.ownerDocument !== document) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
let targets = [];
|
|
82
|
+
try {
|
|
83
|
+
const selector = selectorForManagedChange(change);
|
|
84
|
+
targets = selector ? Array.from(document.querySelectorAll(selector)) : [];
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
targets = [];
|
|
88
|
+
}
|
|
89
|
+
// Probe targets lazily in DOM order and stop at the first conflicting
|
|
90
|
+
// preview: the reported result is exactly "first conflict ?? first target",
|
|
91
|
+
// so probing the remaining instances cannot change the outcome. A
|
|
92
|
+
// source-site selector matched by many rendered instances (one callsite,
|
|
93
|
+
// hundreds of nodes) otherwise pays a probe + important-rule scan per match.
|
|
94
|
+
let firstApplied = null;
|
|
95
|
+
let previewResult = null;
|
|
96
|
+
for (const target of targets) {
|
|
97
|
+
const result = verifyPreview(target, change.property, requestedValue);
|
|
98
|
+
if (result.status === "conflict") {
|
|
99
|
+
previewResult = result;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
if (!firstApplied)
|
|
103
|
+
firstApplied = result;
|
|
104
|
+
}
|
|
105
|
+
if (previewResult === null) {
|
|
106
|
+
previewResult = firstApplied ?? verifyPreview(null, change.property, requestedValue);
|
|
107
|
+
}
|
|
108
|
+
return previewResult;
|
|
109
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TokenEntry } from "../../css/model/index.js";
|
|
2
|
+
import { type ChangeRecord } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The CSS value a token swap writes into the managed stylesheet and the
|
|
5
|
+
* prompt must describe: an adapter-provided literal when present, otherwise a
|
|
6
|
+
* var() reference on the authored cssName (falling back to the entry name).
|
|
7
|
+
*/
|
|
8
|
+
export declare function tokenReference(token: TokenEntry): string;
|
|
9
|
+
export declare function changeKey(change: ChangeRecord): string;
|
|
10
|
+
export declare function mergeChange(current: ChangeRecord[], incoming: ChangeRecord): ChangeRecord[];
|
|
11
|
+
export declare function canonicalizeChanges(incoming: ChangeRecord[]): ChangeRecord[];
|
|
12
|
+
export declare function sameEffectiveChanges(left: ChangeRecord[], right: ChangeRecord[]): boolean;
|
|
13
|
+
export declare function selectorForChange(change: ChangeRecord): string | undefined;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { isComponentChange, isElementChange, isTextContentChange, isTokenChange, } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The CSS value a token swap writes into the managed stylesheet and the
|
|
4
|
+
* prompt must describe: an adapter-provided literal when present, otherwise a
|
|
5
|
+
* var() reference on the authored cssName (falling back to the entry name).
|
|
6
|
+
*/
|
|
7
|
+
export function tokenReference(token) {
|
|
8
|
+
return token.cssValue ?? `var(${token.cssName ?? token.name})`;
|
|
9
|
+
}
|
|
10
|
+
export function changeKey(change) {
|
|
11
|
+
if (isTokenChange(change)) {
|
|
12
|
+
return [
|
|
13
|
+
"token",
|
|
14
|
+
change.tokenName,
|
|
15
|
+
change.file,
|
|
16
|
+
change.line,
|
|
17
|
+
change.selector,
|
|
18
|
+
JSON.stringify(change.context),
|
|
19
|
+
].join("\u0000");
|
|
20
|
+
}
|
|
21
|
+
if (isComponentChange(change)) {
|
|
22
|
+
return [
|
|
23
|
+
"component-prop",
|
|
24
|
+
change.target.framework,
|
|
25
|
+
change.target.callsiteId,
|
|
26
|
+
change.property,
|
|
27
|
+
].join("\u0000");
|
|
28
|
+
}
|
|
29
|
+
if (isTextContentChange(change)) {
|
|
30
|
+
// The marker id is document-local projection identity. `beforeText` is
|
|
31
|
+
// part of the durable evidence: two outputs at one source site may have
|
|
32
|
+
// different initial copy and must remain distinct canonical intents.
|
|
33
|
+
return [
|
|
34
|
+
"text-content",
|
|
35
|
+
change.target.sourceSite.cid,
|
|
36
|
+
change.target.sourceSite.src,
|
|
37
|
+
change.target.props ?? "",
|
|
38
|
+
change.target.ariaLabel ?? "",
|
|
39
|
+
change.target.beforeText,
|
|
40
|
+
change.target.textNodePath?.join(",") ?? "",
|
|
41
|
+
].join("\u0000");
|
|
42
|
+
}
|
|
43
|
+
return [
|
|
44
|
+
change.cid,
|
|
45
|
+
change.file,
|
|
46
|
+
change.line,
|
|
47
|
+
change.scope === "rendered-instance"
|
|
48
|
+
? change.instanceOverride?.id ?? "missing-instance-override"
|
|
49
|
+
: change.selector,
|
|
50
|
+
change.scope ?? "source-site",
|
|
51
|
+
change.state ?? "base",
|
|
52
|
+
change.property,
|
|
53
|
+
].join("\u0000");
|
|
54
|
+
}
|
|
55
|
+
function effectiveValue(change) {
|
|
56
|
+
if (isTokenChange(change))
|
|
57
|
+
return change.rawValue;
|
|
58
|
+
if (isComponentChange(change))
|
|
59
|
+
return JSON.stringify(change.after);
|
|
60
|
+
if (isTextContentChange(change))
|
|
61
|
+
return change.after;
|
|
62
|
+
if (change.newToken)
|
|
63
|
+
return tokenReference(change.newToken);
|
|
64
|
+
return change.rawValue ?? "";
|
|
65
|
+
}
|
|
66
|
+
function isAtBaseline(change) {
|
|
67
|
+
if (isTokenChange(change))
|
|
68
|
+
return change.rawValue === change.oldRawValue;
|
|
69
|
+
if (isComponentChange(change)) {
|
|
70
|
+
return change.before.kind === "value"
|
|
71
|
+
&& Object.is(change.after, change.before.value);
|
|
72
|
+
}
|
|
73
|
+
if (isTextContentChange(change))
|
|
74
|
+
return change.after === change.before;
|
|
75
|
+
const baseline = change.oldToken
|
|
76
|
+
? tokenReference(change.oldToken)
|
|
77
|
+
: change.oldRawValue ?? "";
|
|
78
|
+
return effectiveValue(change) === baseline;
|
|
79
|
+
}
|
|
80
|
+
function mergeWithExisting(incoming, existing) {
|
|
81
|
+
if (existing && isTokenChange(incoming) && isTokenChange(existing)) {
|
|
82
|
+
return { ...incoming, oldRawValue: existing.oldRawValue };
|
|
83
|
+
}
|
|
84
|
+
if (existing && isComponentChange(incoming) && isComponentChange(existing)) {
|
|
85
|
+
return {
|
|
86
|
+
...incoming,
|
|
87
|
+
before: existing.before,
|
|
88
|
+
scope: incoming.scope ?? existing.scope,
|
|
89
|
+
evidence: incoming.evidence ?? existing.evidence,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (existing && isTextContentChange(incoming) && isTextContentChange(existing)) {
|
|
93
|
+
return {
|
|
94
|
+
...incoming,
|
|
95
|
+
id: existing.id,
|
|
96
|
+
target: existing.target,
|
|
97
|
+
source: existing.source,
|
|
98
|
+
selector: existing.selector,
|
|
99
|
+
before: existing.before,
|
|
100
|
+
authoredAs: existing.authoredAs,
|
|
101
|
+
scope: incoming.scope ?? existing.scope,
|
|
102
|
+
evidence: incoming.evidence ?? existing.evidence,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (existing && isElementChange(incoming) && isElementChange(existing)) {
|
|
106
|
+
return {
|
|
107
|
+
...incoming,
|
|
108
|
+
oldToken: existing.oldToken,
|
|
109
|
+
oldRawValue: existing.oldRawValue,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return incoming;
|
|
113
|
+
}
|
|
114
|
+
function textStableIdentity(change) {
|
|
115
|
+
if (!isTextContentChange(change))
|
|
116
|
+
return null;
|
|
117
|
+
return [
|
|
118
|
+
change.target.sourceSite.cid,
|
|
119
|
+
change.target.sourceSite.src,
|
|
120
|
+
change.target.props ?? "",
|
|
121
|
+
change.target.ariaLabel ?? "",
|
|
122
|
+
change.target.textNodePath?.join(",") ?? "",
|
|
123
|
+
].join("\u0000");
|
|
124
|
+
}
|
|
125
|
+
function compatibleTextExisting(current, incoming) {
|
|
126
|
+
if (!isTextContentChange(incoming))
|
|
127
|
+
return undefined;
|
|
128
|
+
const exact = current.filter((candidate) => changeKey(candidate) === changeKey(incoming));
|
|
129
|
+
if (exact.length === 1)
|
|
130
|
+
return exact[0];
|
|
131
|
+
if (exact.length > 1)
|
|
132
|
+
return undefined;
|
|
133
|
+
const identity = textStableIdentity(incoming);
|
|
134
|
+
const compatible = current.filter((candidate) => isTextContentChange(candidate)
|
|
135
|
+
&& textStableIdentity(candidate) === identity
|
|
136
|
+
&& incoming.before === candidate.after);
|
|
137
|
+
return compatible.length === 1 ? compatible[0] : undefined;
|
|
138
|
+
}
|
|
139
|
+
export function mergeChange(current, incoming) {
|
|
140
|
+
const key = changeKey(incoming);
|
|
141
|
+
const existing = isTextContentChange(incoming)
|
|
142
|
+
? compatibleTextExisting(current, incoming)
|
|
143
|
+
: current.find((candidate) => changeKey(candidate) === key);
|
|
144
|
+
const canonical = mergeWithExisting(incoming, existing);
|
|
145
|
+
const next = existing
|
|
146
|
+
? current.filter((candidate) => candidate !== existing)
|
|
147
|
+
: isTextContentChange(incoming)
|
|
148
|
+
? current
|
|
149
|
+
: current.filter((candidate) => changeKey(candidate) !== key);
|
|
150
|
+
return isAtBaseline(canonical) ? next : [...next, canonical];
|
|
151
|
+
}
|
|
152
|
+
export function canonicalizeChanges(incoming) {
|
|
153
|
+
return incoming.reduce((current, change) => mergeChange(current, change), []);
|
|
154
|
+
}
|
|
155
|
+
export function sameEffectiveChanges(left, right) {
|
|
156
|
+
if (left.length !== right.length)
|
|
157
|
+
return false;
|
|
158
|
+
const values = new Map(left.map((change) => [changeKey(change), effectiveValue(change)]));
|
|
159
|
+
return right.every((change) => values.get(changeKey(change)) === effectiveValue(change));
|
|
160
|
+
}
|
|
161
|
+
export function selectorForChange(change) {
|
|
162
|
+
return isComponentChange(change) || isTextContentChange(change) ? undefined : change.selector;
|
|
163
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ChangeRecord } from "./types.js";
|
|
2
|
+
import type { EditScope } from "../editScope.js";
|
|
3
|
+
export interface ChangePresentation {
|
|
4
|
+
groupKey: string;
|
|
5
|
+
groupLabel: string;
|
|
6
|
+
file: string;
|
|
7
|
+
property: string;
|
|
8
|
+
propertyLabel: string;
|
|
9
|
+
before: string;
|
|
10
|
+
after: string;
|
|
11
|
+
scope?: EditScope;
|
|
12
|
+
evidence?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function presentChange(change: ChangeRecord): ChangePresentation;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { formatComponentPropBaseline, formatComponentPropValue, } from "../componentSemantics/changeModel.js";
|
|
2
|
+
import { isComponentChange, isTokenChange, isTextContentChange, } from "./types.js";
|
|
3
|
+
import { formatInspectorLabel } from "../ui/labels.js";
|
|
4
|
+
export function presentChange(change) {
|
|
5
|
+
if (isTokenChange(change)) {
|
|
6
|
+
return {
|
|
7
|
+
groupKey: [
|
|
8
|
+
"token",
|
|
9
|
+
change.tokenName,
|
|
10
|
+
change.file,
|
|
11
|
+
change.line,
|
|
12
|
+
change.contextLabel,
|
|
13
|
+
].join("\u0000"),
|
|
14
|
+
groupLabel: `Global token · ${change.tokenName}`,
|
|
15
|
+
file: change.file,
|
|
16
|
+
property: change.property,
|
|
17
|
+
propertyLabel: change.contextLabel,
|
|
18
|
+
before: change.oldRawValue,
|
|
19
|
+
after: change.rawValue,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (isComponentChange(change)) {
|
|
23
|
+
return {
|
|
24
|
+
groupKey: [
|
|
25
|
+
"component-prop",
|
|
26
|
+
change.target.framework,
|
|
27
|
+
change.target.callsiteId,
|
|
28
|
+
].join("\u0000"),
|
|
29
|
+
groupLabel: `${change.target.componentName} · Component`,
|
|
30
|
+
file: change.target.file,
|
|
31
|
+
property: change.property,
|
|
32
|
+
propertyLabel: formatInspectorLabel(change.property),
|
|
33
|
+
before: formatComponentPropBaseline(change.before),
|
|
34
|
+
after: formatComponentPropValue(change.after),
|
|
35
|
+
scope: change.scope ?? "source-site",
|
|
36
|
+
evidence: change.evidence
|
|
37
|
+
? `occurrence ${change.evidence.occurrence + 1} · ${change.evidence.mountedCount} mounted outputs`
|
|
38
|
+
: undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (isTextContentChange(change)) {
|
|
42
|
+
return {
|
|
43
|
+
groupKey: [
|
|
44
|
+
"text-content",
|
|
45
|
+
change.target.sourceSite.cid,
|
|
46
|
+
change.target.sourceSite.src,
|
|
47
|
+
change.target.occurrence,
|
|
48
|
+
change.target.props ?? "",
|
|
49
|
+
change.target.ariaLabel ?? "",
|
|
50
|
+
].join("\u0000"),
|
|
51
|
+
groupLabel: `${change.source.component || change.target.sourceSite.cid} · Rendered text`,
|
|
52
|
+
file: change.source.file,
|
|
53
|
+
property: "text-content",
|
|
54
|
+
propertyLabel: "Rendered text",
|
|
55
|
+
before: change.before,
|
|
56
|
+
after: change.after,
|
|
57
|
+
scope: change.scope ?? "rendered-instance",
|
|
58
|
+
evidence: change.evidence
|
|
59
|
+
? `${change.evidence.componentName}.${change.evidence.property} · ${change.evidence.mountedCount} mounted outputs`
|
|
60
|
+
: undefined,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
groupKey: [
|
|
65
|
+
change.cid,
|
|
66
|
+
change.file,
|
|
67
|
+
change.line,
|
|
68
|
+
change.selector,
|
|
69
|
+
change.scope ?? "source-site",
|
|
70
|
+
].join("\u0000"),
|
|
71
|
+
groupLabel: change.cid,
|
|
72
|
+
file: change.file,
|
|
73
|
+
property: change.property,
|
|
74
|
+
propertyLabel: formatInspectorLabel(change.property),
|
|
75
|
+
before: change.oldToken?.name
|
|
76
|
+
?? (change.rawValue !== undefined && change.newToken
|
|
77
|
+
? change.rawValue
|
|
78
|
+
: "(original)"),
|
|
79
|
+
after: change.newToken?.name ?? change.rawValue ?? "",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PreviewResult } from "../projection/managedStylesheet.js";
|
|
2
|
+
/** A logical document is stable while its live document may be replaced. */
|
|
3
|
+
export interface PreviewDocument {
|
|
4
|
+
readonly logicalDocument: string;
|
|
5
|
+
readonly sessionId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PreviewAttempt extends PreviewDocument {
|
|
8
|
+
readonly workspaceRevision: number;
|
|
9
|
+
readonly attempt: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PreviewDiagnostic extends PreviewAttempt {
|
|
12
|
+
readonly changeKey: string;
|
|
13
|
+
readonly result: PreviewResult;
|
|
14
|
+
}
|
|
15
|
+
/** Returns the stable host-document identity for this inspector lifetime. */
|
|
16
|
+
export declare function getHostPreviewDocument(): PreviewDocument;
|
|
17
|
+
/** Starts or replaces the live session for one logical document. */
|
|
18
|
+
export declare function startPreviewDocumentSession(document: PreviewDocument): void;
|
|
19
|
+
/** Invalidates a live document session and rejects all of its late results. */
|
|
20
|
+
export declare function invalidatePreviewDocumentSession(logicalDocument: string, sessionId?: string): void;
|
|
21
|
+
/** Opens a verification attempt for the currently active document session. */
|
|
22
|
+
export declare function beginPreviewAttempt(document: PreviewDocument, revision?: number): PreviewAttempt | null;
|
|
23
|
+
/** Publishes only a result from the active revision, session, and attempt. */
|
|
24
|
+
export declare function publishPreviewDiagnostic(attempt: PreviewAttempt, changeKey: string, result: PreviewResult): boolean;
|
|
25
|
+
/** Removes diagnostics for the supplied canonical keys across live documents. */
|
|
26
|
+
export declare function clearPreviewDiagnostics(changeKeys?: Iterable<string>): void;
|
|
27
|
+
/** Notifies consumers when verification state changes without a result. */
|
|
28
|
+
export declare function notifyPreviewDiagnostics(): void;
|
|
29
|
+
export declare function getPreviewDiagnostic(changeKey: string, logicalDocument?: string): PreviewDiagnostic | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Host-first read across live documents. The per-document store is observable
|
|
32
|
+
* here so a Canvas-only conflict is not write-only; host remains the default
|
|
33
|
+
* for single-document consumers.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAnyPreviewDiagnostic(changeKey: string): PreviewDiagnostic | undefined;
|
|
36
|
+
export declare function subscribePreviewDiagnostics(listener: () => void): () => void;
|
|
37
|
+
export declare function getPreviewDiagnosticRevision(): number;
|
|
38
|
+
/** Test and teardown reset; it does not alter canonical workspace state. */
|
|
39
|
+
export declare function resetPreviewDiagnostics(): void;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { getWorkspaceChanges, subscribeWorkspaceChanges } from "./workspaceChanges.js";
|
|
2
|
+
const HOST_DOCUMENT = {
|
|
3
|
+
logicalDocument: "host",
|
|
4
|
+
sessionId: "host-document",
|
|
5
|
+
};
|
|
6
|
+
let workspaceRevision = getWorkspaceChanges().revision;
|
|
7
|
+
let activeSessions = new Map([[HOST_DOCUMENT.logicalDocument, HOST_DOCUMENT.sessionId]]);
|
|
8
|
+
let attemptsBySession = new Map();
|
|
9
|
+
let diagnostics = new Map();
|
|
10
|
+
let diagnosticRevision = 0;
|
|
11
|
+
const listeners = new Set();
|
|
12
|
+
function storageKey(document, changeKey) {
|
|
13
|
+
return `${document.logicalDocument}\u0000${document.sessionId}\u0000${changeKey}`;
|
|
14
|
+
}
|
|
15
|
+
function sessionKey(document) {
|
|
16
|
+
return `${document.logicalDocument}\u0000${document.sessionId}`;
|
|
17
|
+
}
|
|
18
|
+
function sameResult(left, right) {
|
|
19
|
+
return left.status === right.status
|
|
20
|
+
&& left.reason === right.reason
|
|
21
|
+
&& left.requestedValue === right.requestedValue
|
|
22
|
+
&& left.computedValue === right.computedValue;
|
|
23
|
+
}
|
|
24
|
+
function notify() {
|
|
25
|
+
diagnosticRevision += 1;
|
|
26
|
+
for (const listener of listeners)
|
|
27
|
+
listener();
|
|
28
|
+
}
|
|
29
|
+
function syncWorkspaceRevision() {
|
|
30
|
+
const nextRevision = getWorkspaceChanges().revision;
|
|
31
|
+
if (nextRevision === workspaceRevision)
|
|
32
|
+
return;
|
|
33
|
+
// Track the revision so late publishes are rejected per key. Do not clear
|
|
34
|
+
// here: a new commit must preserve earlier diagnostics until they are
|
|
35
|
+
// re-verified, otherwise every edit deletes every other change's status.
|
|
36
|
+
workspaceRevision = nextRevision;
|
|
37
|
+
}
|
|
38
|
+
subscribeWorkspaceChanges(syncWorkspaceRevision);
|
|
39
|
+
/** Returns the stable host-document identity for this inspector lifetime. */
|
|
40
|
+
export function getHostPreviewDocument() {
|
|
41
|
+
return HOST_DOCUMENT;
|
|
42
|
+
}
|
|
43
|
+
/** Starts or replaces the live session for one logical document. */
|
|
44
|
+
export function startPreviewDocumentSession(document) {
|
|
45
|
+
syncWorkspaceRevision();
|
|
46
|
+
const previousSession = activeSessions.get(document.logicalDocument);
|
|
47
|
+
if (previousSession === document.sessionId)
|
|
48
|
+
return;
|
|
49
|
+
activeSessions.set(document.logicalDocument, document.sessionId);
|
|
50
|
+
attemptsBySession.set(sessionKey(document), 0);
|
|
51
|
+
let changed = false;
|
|
52
|
+
for (const [key, diagnostic] of diagnostics) {
|
|
53
|
+
if (diagnostic.logicalDocument === document.logicalDocument) {
|
|
54
|
+
diagnostics.delete(key);
|
|
55
|
+
changed = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (changed || previousSession !== undefined)
|
|
59
|
+
notify();
|
|
60
|
+
}
|
|
61
|
+
/** Invalidates a live document session and rejects all of its late results. */
|
|
62
|
+
export function invalidatePreviewDocumentSession(logicalDocument, sessionId) {
|
|
63
|
+
const activeSession = activeSessions.get(logicalDocument);
|
|
64
|
+
if (activeSession === undefined || (sessionId !== undefined && activeSession !== sessionId))
|
|
65
|
+
return;
|
|
66
|
+
activeSessions.delete(logicalDocument);
|
|
67
|
+
attemptsBySession.delete(sessionKey({ logicalDocument, sessionId: activeSession }));
|
|
68
|
+
let changed = false;
|
|
69
|
+
for (const [key, diagnostic] of diagnostics) {
|
|
70
|
+
if (diagnostic.logicalDocument === logicalDocument && diagnostic.sessionId === activeSession) {
|
|
71
|
+
diagnostics.delete(key);
|
|
72
|
+
changed = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (changed || activeSession !== undefined)
|
|
76
|
+
notify();
|
|
77
|
+
}
|
|
78
|
+
/** Opens a verification attempt for the currently active document session. */
|
|
79
|
+
export function beginPreviewAttempt(document, revision = getWorkspaceChanges().revision) {
|
|
80
|
+
syncWorkspaceRevision();
|
|
81
|
+
if (revision !== workspaceRevision || activeSessions.get(document.logicalDocument) !== document.sessionId) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const attempt = (attemptsBySession.get(sessionKey(document)) ?? 0) + 1;
|
|
85
|
+
attemptsBySession.set(sessionKey(document), attempt);
|
|
86
|
+
// Do not delete existing diagnostics here. The attempt stamp already
|
|
87
|
+
// rejects late publishes per key; wiping would drop every other change's
|
|
88
|
+
// status before it is re-verified (and drop all host status when Canvas
|
|
89
|
+
// verification returns null).
|
|
90
|
+
return { ...document, workspaceRevision: revision, attempt };
|
|
91
|
+
}
|
|
92
|
+
/** Publishes only a result from the active revision, session, and attempt. */
|
|
93
|
+
export function publishPreviewDiagnostic(attempt, changeKey, result) {
|
|
94
|
+
syncWorkspaceRevision();
|
|
95
|
+
if (attempt.workspaceRevision !== workspaceRevision
|
|
96
|
+
|| activeSessions.get(attempt.logicalDocument) !== attempt.sessionId
|
|
97
|
+
|| attemptsBySession.get(sessionKey(attempt)) !== attempt.attempt) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const key = storageKey(attempt, changeKey);
|
|
101
|
+
const previous = diagnostics.get(key);
|
|
102
|
+
if (previous
|
|
103
|
+
&& previous.changeKey === changeKey
|
|
104
|
+
&& previous.workspaceRevision === attempt.workspaceRevision
|
|
105
|
+
&& previous.attempt === attempt.attempt
|
|
106
|
+
&& sameResult(previous.result, result)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
diagnostics.set(key, { ...attempt, changeKey, result });
|
|
110
|
+
notify();
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
/** Removes diagnostics for the supplied canonical keys across live documents. */
|
|
114
|
+
export function clearPreviewDiagnostics(changeKeys) {
|
|
115
|
+
const keys = changeKeys ? new Set(changeKeys) : null;
|
|
116
|
+
let changed = false;
|
|
117
|
+
for (const [key, diagnostic] of diagnostics) {
|
|
118
|
+
if (!keys || keys.has(diagnostic.changeKey)) {
|
|
119
|
+
diagnostics.delete(key);
|
|
120
|
+
changed = true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (changed)
|
|
124
|
+
notify();
|
|
125
|
+
}
|
|
126
|
+
/** Notifies consumers when verification state changes without a result. */
|
|
127
|
+
export function notifyPreviewDiagnostics() {
|
|
128
|
+
notify();
|
|
129
|
+
}
|
|
130
|
+
export function getPreviewDiagnostic(changeKey, logicalDocument = HOST_DOCUMENT.logicalDocument) {
|
|
131
|
+
// Pure getter: never sync or notify. It runs on the React render path via
|
|
132
|
+
// StaleChangeIndicator, so side effects here would clear state mid-render.
|
|
133
|
+
// Diagnostics survive workspace revisions until overwritten or explicitly
|
|
134
|
+
// cleared; publish-time stamps reject stale results per key.
|
|
135
|
+
const sessionId = activeSessions.get(logicalDocument);
|
|
136
|
+
if (!sessionId)
|
|
137
|
+
return undefined;
|
|
138
|
+
return diagnostics.get(storageKey({ logicalDocument, sessionId }, changeKey));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Host-first read across live documents. The per-document store is observable
|
|
142
|
+
* here so a Canvas-only conflict is not write-only; host remains the default
|
|
143
|
+
* for single-document consumers.
|
|
144
|
+
*/
|
|
145
|
+
export function getAnyPreviewDiagnostic(changeKey) {
|
|
146
|
+
const host = getPreviewDiagnostic(changeKey, HOST_DOCUMENT.logicalDocument);
|
|
147
|
+
if (host)
|
|
148
|
+
return host;
|
|
149
|
+
for (const logicalDocument of activeSessions.keys()) {
|
|
150
|
+
if (logicalDocument === HOST_DOCUMENT.logicalDocument)
|
|
151
|
+
continue;
|
|
152
|
+
const diagnostic = getPreviewDiagnostic(changeKey, logicalDocument);
|
|
153
|
+
if (diagnostic)
|
|
154
|
+
return diagnostic;
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
export function subscribePreviewDiagnostics(listener) {
|
|
159
|
+
listeners.add(listener);
|
|
160
|
+
return () => listeners.delete(listener);
|
|
161
|
+
}
|
|
162
|
+
export function getPreviewDiagnosticRevision() {
|
|
163
|
+
return diagnosticRevision;
|
|
164
|
+
}
|
|
165
|
+
/** Test and teardown reset; it does not alter canonical workspace state. */
|
|
166
|
+
export function resetPreviewDiagnostics() {
|
|
167
|
+
workspaceRevision = getWorkspaceChanges().revision;
|
|
168
|
+
activeSessions = new Map([[HOST_DOCUMENT.logicalDocument, HOST_DOCUMENT.sessionId]]);
|
|
169
|
+
attemptsBySession = new Map();
|
|
170
|
+
diagnostics = new Map();
|
|
171
|
+
notify();
|
|
172
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RenderedInstanceRef } from "./editModel.js";
|
|
2
|
+
/** Controller-owned intent to remove one rendered instance. */
|
|
3
|
+
export interface StructuralDelete {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: "delete";
|
|
6
|
+
target: RenderedInstanceRef;
|
|
7
|
+
}
|
|
8
|
+
/** Controller-owned intent to move one rendered instance. */
|
|
9
|
+
export interface StructuralMove {
|
|
10
|
+
id: string;
|
|
11
|
+
kind: "move";
|
|
12
|
+
target: RenderedInstanceRef;
|
|
13
|
+
source: {
|
|
14
|
+
parent: RenderedInstanceRef;
|
|
15
|
+
};
|
|
16
|
+
destination: {
|
|
17
|
+
parent: RenderedInstanceRef;
|
|
18
|
+
before: RenderedInstanceRef | null;
|
|
19
|
+
};
|
|
20
|
+
presentation: {
|
|
21
|
+
sourceParentTag: string;
|
|
22
|
+
destinationParentTag: string;
|
|
23
|
+
fromIndex: number;
|
|
24
|
+
toIndex: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export type StructuralChange = StructuralDelete | StructuralMove;
|
|
28
|
+
export type StructuralProjectionStatus = "applied" | "missing" | "ambiguous" | "overridden";
|
|
29
|
+
export type StructuralProjectionReason = "target" | "source-parent" | "destination-parent" | "anchor" | "illegal-destination" | "react-override";
|
|
30
|
+
export interface StructuralProjectionReport {
|
|
31
|
+
changeId: string;
|
|
32
|
+
status: StructuralProjectionStatus;
|
|
33
|
+
/** Bounded diagnostic data; it never changes canonical structural intent. */
|
|
34
|
+
reason?: StructuralProjectionReason;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|