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,93 @@
|
|
|
1
|
+
import type { StructuralChange, StructuralDelete, StructuralMove, StructuralProjectionReason, StructuralProjectionReport } from "../changes/structuralTypes.js";
|
|
2
|
+
export { isStructuralChange, isStructuralDelete, isStructuralMove, isStructuralProjectionReport, } from "./structuralProjectionBoundary.js";
|
|
3
|
+
/**
|
|
4
|
+
* Controller-owned structural intent. It contains no DOM node, placeholder,
|
|
5
|
+
* position, or renderer-local identity. Each document resolves a snapshot for
|
|
6
|
+
* itself and keeps any physical preview artefacts private to that document.
|
|
7
|
+
*/
|
|
8
|
+
export type { StructuralChange, StructuralDelete, StructuralMove, StructuralProjectionReason, StructuralProjectionReport, StructuralProjectionStatus, } from "../changes/structuralTypes.js";
|
|
9
|
+
/** Conservative HTML containment policy shared by gesture and projection code. */
|
|
10
|
+
export declare function canContainElement(parent: HTMLElement, child: HTMLElement): boolean;
|
|
11
|
+
export type StructuralMoveLegality = {
|
|
12
|
+
valid: true;
|
|
13
|
+
sourceParent: HTMLElement;
|
|
14
|
+
destinationParent: HTMLElement;
|
|
15
|
+
before: HTMLElement | null;
|
|
16
|
+
} | {
|
|
17
|
+
valid: false;
|
|
18
|
+
reason: StructuralProjectionReason;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Applies the one conservative move policy used by guide calculation, commit,
|
|
22
|
+
* and resolved document projection. The returned elements are document-local
|
|
23
|
+
* and must never be stored in canonical structural intent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getStructuralMoveLegality(element: HTMLElement, destination: {
|
|
26
|
+
parent: HTMLElement;
|
|
27
|
+
before: Node | null;
|
|
28
|
+
}): StructuralMoveLegality;
|
|
29
|
+
export interface StructuralChangeDiagnostic extends StructuralProjectionReport {
|
|
30
|
+
document: "Inspect" | `Canvas ${string}`;
|
|
31
|
+
}
|
|
32
|
+
/** Captures a delete intent once, in the controller, at the user gesture. */
|
|
33
|
+
export declare function createStructuralDelete(element: HTMLElement, id?: string): StructuralDelete | null;
|
|
34
|
+
/**
|
|
35
|
+
* Capture a move only when every address can be represented by durable
|
|
36
|
+
* rendered-instance references. Local DOM positions are deliberately never a
|
|
37
|
+
* fallback: a missed preview is safer than moving the wrong item.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createStructuralMove(element: HTMLElement, destination: {
|
|
40
|
+
parent: HTMLElement;
|
|
41
|
+
before: Node | null;
|
|
42
|
+
}, id?: string): StructuralMove | null;
|
|
43
|
+
export declare function getStructuralChanges(): readonly StructuralChange[];
|
|
44
|
+
export declare function getStructuralDeletes(): readonly StructuralDelete[];
|
|
45
|
+
/** Revert removes one canonical intent and leaves every other intent intact. */
|
|
46
|
+
export declare function revertStructuralChange(changeId: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Removes source-verified structural intents without leaving an undo path that
|
|
49
|
+
* can recreate their browser-only previews.
|
|
50
|
+
*
|
|
51
|
+
* Agent completion can verify a subset of one dispatched snapshot. The
|
|
52
|
+
* remaining records and their useful history stay intact while every verified
|
|
53
|
+
* ID is pruned from canonical state, undo/redo snapshots, and Canvas reports.
|
|
54
|
+
*/
|
|
55
|
+
export declare function reconcileVerifiedStructuralChanges(verifiedIds: ReadonlySet<string>): number;
|
|
56
|
+
/** State changes drive controller-to-renderer projection. Diagnostics do not. */
|
|
57
|
+
export declare function subscribeStructuralChanges(listener: () => void): () => void;
|
|
58
|
+
/** Compatibility name retained while the controller moved to a full union. */
|
|
59
|
+
export declare const subscribeStructuralDeletes: typeof subscribeStructuralChanges;
|
|
60
|
+
/** Diagnostics change after host/frame resolution or a one-shot conflict check. */
|
|
61
|
+
export declare function subscribeStructuralDiagnostics(listener: () => void): () => void;
|
|
62
|
+
/** Monotonic snapshot for React consumers of document-local diagnostics. */
|
|
63
|
+
export declare function getStructuralDiagnosticRevision(): number;
|
|
64
|
+
/**
|
|
65
|
+
* Apply one full controller snapshot to one document. Physical nodes and
|
|
66
|
+
* placeholders stay in the document state only; history stays serializable in
|
|
67
|
+
* the controller. A same snapshot never reapplies an overridden preview.
|
|
68
|
+
*/
|
|
69
|
+
export declare function applyStructuralProjection(doc: Document, snapshot: readonly StructuralChange[]): StructuralProjectionReport[];
|
|
70
|
+
/** Compatibility entry point for the delete-only 0050 callers. */
|
|
71
|
+
export declare function applyStructuralDeleteProjection(doc: Document, snapshot: readonly StructuralDelete[]): StructuralProjectionReport[];
|
|
72
|
+
export declare function getStructuralProjectionReports(doc: Document): readonly StructuralProjectionReport[];
|
|
73
|
+
/**
|
|
74
|
+
* Frames may report only their document-local outcome. The controller owns
|
|
75
|
+
* these reports and filters them against its current canonical change set.
|
|
76
|
+
*/
|
|
77
|
+
export declare function recordCanvasStructuralProjectionReports(cardId: string, revision: number, reports: readonly StructuralProjectionReport[]): void;
|
|
78
|
+
export declare function clearCanvasStructuralProjectionReports(cardId: string): void;
|
|
79
|
+
/** Removes document-local reports for canonical intents that no longer exist. */
|
|
80
|
+
export declare function pruneStructuralProjectionReports(changeIds: ReadonlySet<string>): void;
|
|
81
|
+
/** Clears reports before restoring or clearing an atomic workspace snapshot. */
|
|
82
|
+
export declare function clearStructuralProjectionReports(): void;
|
|
83
|
+
export declare function getStructuralChangeDiagnostics(changeId: string): StructuralChangeDiagnostic[];
|
|
84
|
+
/** Controller teardown/test hook. It is not a user-visible history operation. */
|
|
85
|
+
export declare function resetStructuralDeleteProjection(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Releases one document's structural projection without touching canonical
|
|
88
|
+
* workspace intent. Applied deletes/moves owned by this document are restored
|
|
89
|
+
* and the document observer is disconnected; the controller snapshot stays
|
|
90
|
+
* intact so a later remount can re-project from canonical state. Register as
|
|
91
|
+
* a document-session cleanup alongside disposeBrowserCssInspection.
|
|
92
|
+
*/
|
|
93
|
+
export declare function releaseDocumentProjection(doc: Document): void;
|
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { captureRenderedInstance, matchesRenderedInstanceEvidence, resolveRenderedInstance, } from "./renderedInstance.js";
|
|
2
|
+
import { isStructuralProjectionReport } from "./structuralProjectionBoundary.js";
|
|
3
|
+
import { resetWorkspaceChanges, workspaceChangeStore, } from "../changes/workspaceChanges.js";
|
|
4
|
+
export { isStructuralChange, isStructuralDelete, isStructuralMove, isStructuralProjectionReport, } from "./structuralProjectionBoundary.js";
|
|
5
|
+
const VOID_PARENT_TAGS = new Set([
|
|
6
|
+
"area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr",
|
|
7
|
+
]);
|
|
8
|
+
const PHRASING_PARENT_TAGS = new Set([
|
|
9
|
+
"a", "abbr", "b", "button", "cite", "code", "em", "label", "mark", "p", "small", "span", "strong", "time",
|
|
10
|
+
]);
|
|
11
|
+
const PHRASING_CHILD_TAGS = new Set([
|
|
12
|
+
"a", "abbr", "b", "br", "button", "cite", "code", "em", "img", "input", "label", "mark", "small", "span", "strong", "time",
|
|
13
|
+
]);
|
|
14
|
+
const STRUCTURALLY_CONSTRAINED_PARENT_TAGS = new Set([
|
|
15
|
+
"colgroup", "optgroup", "option", "select", "table", "tbody", "td", "tfoot", "th", "thead", "tr",
|
|
16
|
+
]);
|
|
17
|
+
function isPhrasingElement(element) {
|
|
18
|
+
return PHRASING_CHILD_TAGS.has(element.tagName.toLowerCase());
|
|
19
|
+
}
|
|
20
|
+
function isUnsupportedWrappedFlexRow(element) {
|
|
21
|
+
const style = element.ownerDocument.defaultView?.getComputedStyle(element);
|
|
22
|
+
return (style?.display === "flex" || style?.display === "inline-flex")
|
|
23
|
+
&& (style.flexDirection || "row").startsWith("row")
|
|
24
|
+
&& Boolean(style.flexWrap && style.flexWrap !== "nowrap");
|
|
25
|
+
}
|
|
26
|
+
/** Conservative HTML containment policy shared by gesture and projection code. */
|
|
27
|
+
export function canContainElement(parent, child) {
|
|
28
|
+
const parentTag = parent.tagName.toLowerCase();
|
|
29
|
+
if (VOID_PARENT_TAGS.has(parentTag)
|
|
30
|
+
|| STRUCTURALLY_CONSTRAINED_PARENT_TAGS.has(parentTag)
|
|
31
|
+
|| parent === child
|
|
32
|
+
|| child.contains(parent))
|
|
33
|
+
return false;
|
|
34
|
+
return !PHRASING_PARENT_TAGS.has(parentTag) || isPhrasingElement(child);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Applies the one conservative move policy used by guide calculation, commit,
|
|
38
|
+
* and resolved document projection. The returned elements are document-local
|
|
39
|
+
* and must never be stored in canonical structural intent.
|
|
40
|
+
*/
|
|
41
|
+
export function getStructuralMoveLegality(element, destination) {
|
|
42
|
+
if (!element.isConnected)
|
|
43
|
+
return { valid: false, reason: "target" };
|
|
44
|
+
const sourceParent = element.parentElement;
|
|
45
|
+
if (!sourceParent || !sourceParent.isConnected)
|
|
46
|
+
return { valid: false, reason: "source-parent" };
|
|
47
|
+
if (destination.parent.ownerDocument !== element.ownerDocument || !destination.parent.isConnected) {
|
|
48
|
+
return { valid: false, reason: "destination-parent" };
|
|
49
|
+
}
|
|
50
|
+
let before = null;
|
|
51
|
+
if (destination.before !== null) {
|
|
52
|
+
if (destination.before.nodeType !== 1
|
|
53
|
+
|| destination.before.ownerDocument !== element.ownerDocument
|
|
54
|
+
|| !destination.before.isConnected) {
|
|
55
|
+
return { valid: false, reason: "anchor" };
|
|
56
|
+
}
|
|
57
|
+
// SAFETY: nodeType === 1 was checked above, so this is an HTMLElement in the destination document.
|
|
58
|
+
before = destination.before;
|
|
59
|
+
if (before.parentElement !== destination.parent)
|
|
60
|
+
return { valid: false, reason: "anchor" };
|
|
61
|
+
}
|
|
62
|
+
if (destination.parent === element || element.contains(destination.parent)) {
|
|
63
|
+
return { valid: false, reason: "illegal-destination" };
|
|
64
|
+
}
|
|
65
|
+
const display = destination.parent.ownerDocument.defaultView?.getComputedStyle(destination.parent).display;
|
|
66
|
+
if (display === "inline" || display === "contents"
|
|
67
|
+
|| isUnsupportedWrappedFlexRow(destination.parent)
|
|
68
|
+
|| !canContainElement(destination.parent, element)) {
|
|
69
|
+
return { valid: false, reason: "illegal-destination" };
|
|
70
|
+
}
|
|
71
|
+
if (before === element)
|
|
72
|
+
return { valid: false, reason: "anchor" };
|
|
73
|
+
if (sourceParent === destination.parent
|
|
74
|
+
&& (before === element.nextElementSibling || (before === null && element.nextElementSibling === null))) {
|
|
75
|
+
return { valid: false, reason: "illegal-destination" };
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
valid: true,
|
|
79
|
+
sourceParent,
|
|
80
|
+
destinationParent: destination.parent,
|
|
81
|
+
before,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
let nextStructuralId = 1;
|
|
85
|
+
const documentStates = new Map();
|
|
86
|
+
let reportsByDocument = new WeakMap();
|
|
87
|
+
const reportsByCanvasCard = new Map();
|
|
88
|
+
const diagnosticListeners = new Set();
|
|
89
|
+
let diagnosticRevision = 0;
|
|
90
|
+
function notifyDiagnostics() {
|
|
91
|
+
diagnosticRevision += 1;
|
|
92
|
+
for (const listener of diagnosticListeners)
|
|
93
|
+
listener();
|
|
94
|
+
}
|
|
95
|
+
function structuralId() {
|
|
96
|
+
return `structural-${crypto.randomUUID?.() ?? nextStructuralId++}`;
|
|
97
|
+
}
|
|
98
|
+
function cloneSnapshot(snapshot) {
|
|
99
|
+
// Structural changes are small JSON-safe records. Cloning their top-level
|
|
100
|
+
// array is enough: no operation mutates a change or its nested references.
|
|
101
|
+
return [...snapshot];
|
|
102
|
+
}
|
|
103
|
+
function projectStructuralChanges(snapshot) {
|
|
104
|
+
reprojectKnownDocuments(snapshot.structuralChanges);
|
|
105
|
+
}
|
|
106
|
+
/** Captures a delete intent once, in the controller, at the user gesture. */
|
|
107
|
+
export function createStructuralDelete(element, id = structuralId()) {
|
|
108
|
+
const target = captureRenderedInstance(element);
|
|
109
|
+
if (!target)
|
|
110
|
+
return null;
|
|
111
|
+
const change = { id, kind: "delete", target };
|
|
112
|
+
if (!workspaceChangeStore.commitStructuralChange(change))
|
|
113
|
+
return null;
|
|
114
|
+
projectStructuralChanges(workspaceChangeStore.getSnapshot());
|
|
115
|
+
return change;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Capture a move only when every address can be represented by durable
|
|
119
|
+
* rendered-instance references. Local DOM positions are deliberately never a
|
|
120
|
+
* fallback: a missed preview is safer than moving the wrong item.
|
|
121
|
+
*/
|
|
122
|
+
export function createStructuralMove(element, destination, id = structuralId()) {
|
|
123
|
+
const legality = getStructuralMoveLegality(element, destination);
|
|
124
|
+
if (!legality.valid)
|
|
125
|
+
return null;
|
|
126
|
+
const { sourceParent: sourceParentElement, destinationParent, before: beforeElement } = legality;
|
|
127
|
+
const target = captureRenderedInstance(element);
|
|
128
|
+
const sourceParent = captureRenderedInstance(sourceParentElement);
|
|
129
|
+
const parent = captureRenderedInstance(destinationParent);
|
|
130
|
+
const before = beforeElement ? captureRenderedInstance(beforeElement) : null;
|
|
131
|
+
if (!target || !sourceParent || !parent || (beforeElement && !before))
|
|
132
|
+
return null;
|
|
133
|
+
const sourceChildren = Array.from(sourceParentElement.children);
|
|
134
|
+
const destinationChildren = Array.from(destinationParent.children);
|
|
135
|
+
const fromIndex = sourceChildren.indexOf(element);
|
|
136
|
+
const beforeIndex = beforeElement ? destinationChildren.indexOf(beforeElement) : destinationChildren.length;
|
|
137
|
+
if (fromIndex < 0 || beforeIndex < 0)
|
|
138
|
+
return null;
|
|
139
|
+
const sameParent = sourceParentElement === destinationParent;
|
|
140
|
+
const change = {
|
|
141
|
+
id,
|
|
142
|
+
kind: "move",
|
|
143
|
+
target,
|
|
144
|
+
source: { parent: sourceParent },
|
|
145
|
+
destination: { parent, before },
|
|
146
|
+
presentation: {
|
|
147
|
+
sourceParentTag: sourceParentElement.tagName.toLowerCase(),
|
|
148
|
+
destinationParentTag: destinationParent.tagName.toLowerCase(),
|
|
149
|
+
fromIndex,
|
|
150
|
+
toIndex: beforeElement
|
|
151
|
+
? beforeIndex - (sameParent && fromIndex < beforeIndex ? 1 : 0)
|
|
152
|
+
: destinationChildren.length - (sameParent ? 1 : 0),
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
if (!workspaceChangeStore.commitStructuralChange(change))
|
|
156
|
+
return null;
|
|
157
|
+
projectStructuralChanges(workspaceChangeStore.getSnapshot());
|
|
158
|
+
return change;
|
|
159
|
+
}
|
|
160
|
+
export function getStructuralChanges() {
|
|
161
|
+
return workspaceChangeStore.getSnapshot().structuralChanges;
|
|
162
|
+
}
|
|
163
|
+
export function getStructuralDeletes() {
|
|
164
|
+
return getStructuralChanges().filter((change) => change.kind === "delete");
|
|
165
|
+
}
|
|
166
|
+
/** Revert removes one canonical intent and leaves every other intent intact. */
|
|
167
|
+
export function revertStructuralChange(changeId) {
|
|
168
|
+
const changed = workspaceChangeStore.revertStructuralChangeRecord(changeId);
|
|
169
|
+
if (changed)
|
|
170
|
+
projectStructuralChanges(workspaceChangeStore.getSnapshot());
|
|
171
|
+
return changed;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Removes source-verified structural intents without leaving an undo path that
|
|
175
|
+
* can recreate their browser-only previews.
|
|
176
|
+
*
|
|
177
|
+
* Agent completion can verify a subset of one dispatched snapshot. The
|
|
178
|
+
* remaining records and their useful history stay intact while every verified
|
|
179
|
+
* ID is pruned from canonical state, undo/redo snapshots, and Canvas reports.
|
|
180
|
+
*/
|
|
181
|
+
export function reconcileVerifiedStructuralChanges(verifiedIds) {
|
|
182
|
+
if (verifiedIds.size === 0)
|
|
183
|
+
return 0;
|
|
184
|
+
const removed = workspaceChangeStore.reconcileWorkspaceChanges(new Set(), verifiedIds);
|
|
185
|
+
if (removed === 0)
|
|
186
|
+
return 0;
|
|
187
|
+
projectStructuralChanges(workspaceChangeStore.getSnapshot());
|
|
188
|
+
for (const [cardId, canvasReports] of reportsByCanvasCard) {
|
|
189
|
+
reportsByCanvasCard.set(cardId, {
|
|
190
|
+
...canvasReports,
|
|
191
|
+
reports: canvasReports.reports.filter((report) => !verifiedIds.has(report.changeId)),
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
notifyDiagnostics();
|
|
195
|
+
return removed;
|
|
196
|
+
}
|
|
197
|
+
/** State changes drive controller-to-renderer projection. Diagnostics do not. */
|
|
198
|
+
export function subscribeStructuralChanges(listener) {
|
|
199
|
+
return workspaceChangeStore.subscribe(listener);
|
|
200
|
+
}
|
|
201
|
+
/** Compatibility name retained while the controller moved to a full union. */
|
|
202
|
+
export const subscribeStructuralDeletes = subscribeStructuralChanges;
|
|
203
|
+
/** Diagnostics change after host/frame resolution or a one-shot conflict check. */
|
|
204
|
+
export function subscribeStructuralDiagnostics(listener) {
|
|
205
|
+
diagnosticListeners.add(listener);
|
|
206
|
+
return () => diagnosticListeners.delete(listener);
|
|
207
|
+
}
|
|
208
|
+
/** Monotonic snapshot for React consumers of document-local diagnostics. */
|
|
209
|
+
export function getStructuralDiagnosticRevision() {
|
|
210
|
+
return diagnosticRevision;
|
|
211
|
+
}
|
|
212
|
+
function getDocumentState(doc) {
|
|
213
|
+
let state = documentStates.get(doc);
|
|
214
|
+
if (state)
|
|
215
|
+
return state;
|
|
216
|
+
state = {
|
|
217
|
+
applied: new Map(),
|
|
218
|
+
appliedOrder: [],
|
|
219
|
+
snapshot: [],
|
|
220
|
+
snapshotKey: null,
|
|
221
|
+
observer: null,
|
|
222
|
+
validationQueued: false,
|
|
223
|
+
};
|
|
224
|
+
documentStates.set(doc, state);
|
|
225
|
+
installDocumentObserver(doc, state);
|
|
226
|
+
return state;
|
|
227
|
+
}
|
|
228
|
+
function installDocumentObserver(doc, state) {
|
|
229
|
+
const viewWithObserver = doc.defaultView;
|
|
230
|
+
const Observer = viewWithObserver?.MutationObserver
|
|
231
|
+
?? (typeof MutationObserver !== "undefined" ? MutationObserver : undefined);
|
|
232
|
+
if (!Observer || !doc.documentElement)
|
|
233
|
+
return;
|
|
234
|
+
state.observer = new Observer(() => scheduleValidation(doc, state));
|
|
235
|
+
state.observer.observe(doc.documentElement, {
|
|
236
|
+
childList: true,
|
|
237
|
+
subtree: true,
|
|
238
|
+
characterData: true,
|
|
239
|
+
attributes: true,
|
|
240
|
+
attributeFilter: ["data-cid", "data-src", "data-cprops", "aria-label"],
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function hasUnresolvedAppliedChange(state) {
|
|
244
|
+
for (const local of state.applied.values()) {
|
|
245
|
+
if (local.kind === "unresolved")
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
function scheduleValidation(doc, state) {
|
|
251
|
+
if (state.validationQueued || state.applied.size === 0)
|
|
252
|
+
return;
|
|
253
|
+
state.validationQueued = true;
|
|
254
|
+
queueMicrotask(() => {
|
|
255
|
+
state.validationQueued = false;
|
|
256
|
+
// A renderer can receive its projection before its application tree has
|
|
257
|
+
// mounted. Retry unresolved records after that tree changes so a valid
|
|
258
|
+
// late mount converges without requiring another controller message.
|
|
259
|
+
if (hasUnresolvedAppliedChange(state)) {
|
|
260
|
+
rebuildForSnapshot(doc, state, state.snapshot, false);
|
|
261
|
+
// The replay is synchronous, so external renderer mutations cannot
|
|
262
|
+
// interleave with it. Discard only the records produced by the replay;
|
|
263
|
+
// future renderer mutations remain observed and can trigger another try.
|
|
264
|
+
state.observer?.takeRecords();
|
|
265
|
+
storeReports(doc, reportsForSnapshot(state, state.snapshot));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
validateAppliedPreview(doc, state);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function sameReports(a, b) {
|
|
272
|
+
return a.length === b.length && a.every((report, index) => report.changeId === b[index]?.changeId
|
|
273
|
+
&& report.status === b[index]?.status
|
|
274
|
+
&& report.reason === b[index]?.reason);
|
|
275
|
+
}
|
|
276
|
+
function storeReports(doc, reports) {
|
|
277
|
+
const before = reportsByDocument.get(doc) ?? [];
|
|
278
|
+
reportsByDocument.set(doc, reports);
|
|
279
|
+
if (!sameReports(before, reports))
|
|
280
|
+
notifyDiagnostics();
|
|
281
|
+
}
|
|
282
|
+
function reportsForSnapshot(state, snapshot) {
|
|
283
|
+
return snapshot.map((change) => {
|
|
284
|
+
const local = state.applied.get(change.id);
|
|
285
|
+
const status = local?.status ?? "missing";
|
|
286
|
+
return {
|
|
287
|
+
changeId: change.id,
|
|
288
|
+
status,
|
|
289
|
+
...(local && "reason" in local && local.reason ? { reason: local.reason } : {}),
|
|
290
|
+
};
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function restoreApplied(local) {
|
|
294
|
+
if (local.kind === "unresolved")
|
|
295
|
+
return;
|
|
296
|
+
if (local.kind === "delete") {
|
|
297
|
+
// If React already replaced our placeholder, never reinsert the stale
|
|
298
|
+
// detached node. The observer will (or already did) report overridden.
|
|
299
|
+
if (local.placeholder.isConnected)
|
|
300
|
+
local.placeholder.replaceWith(local.element);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (!local.element.isConnected || !local.fromParent.isConnected)
|
|
304
|
+
return;
|
|
305
|
+
const anchor = local.fromBefore?.parentNode === local.fromParent ? local.fromBefore : null;
|
|
306
|
+
local.fromParent.insertBefore(local.element, anchor);
|
|
307
|
+
}
|
|
308
|
+
function rebuildForSnapshot(doc, state, snapshot, schedulePostReplayValidation = true) {
|
|
309
|
+
// React may have changed a projected node before its mutation callback ran.
|
|
310
|
+
// Validate synchronously so a rebuild never restores a framework-owned node.
|
|
311
|
+
validateAppliedPreview(doc, state);
|
|
312
|
+
const activeIds = new Set(snapshot.map((change) => change.id));
|
|
313
|
+
const retainedOverrides = new Map();
|
|
314
|
+
for (const [id, local] of state.applied) {
|
|
315
|
+
if (local.status === "overridden" && activeIds.has(id))
|
|
316
|
+
retainedOverrides.set(id, local);
|
|
317
|
+
}
|
|
318
|
+
// Undo in reverse application order, reconstructing this document's source
|
|
319
|
+
// baseline before replaying the desired canonical sequence. This is what
|
|
320
|
+
// makes reverting an earlier move correct when later moves remain.
|
|
321
|
+
for (const id of [...state.appliedOrder].reverse()) {
|
|
322
|
+
const local = state.applied.get(id);
|
|
323
|
+
if (local && local.status !== "overridden")
|
|
324
|
+
restoreApplied(local);
|
|
325
|
+
}
|
|
326
|
+
state.applied = retainedOverrides;
|
|
327
|
+
state.appliedOrder = [];
|
|
328
|
+
state.snapshot = cloneSnapshot(snapshot);
|
|
329
|
+
state.snapshotKey = JSON.stringify(snapshot);
|
|
330
|
+
for (const change of snapshot) {
|
|
331
|
+
const retained = state.applied.get(change.id);
|
|
332
|
+
if (retained?.status === "overridden")
|
|
333
|
+
continue;
|
|
334
|
+
applyChangeToDocument(doc, state, change);
|
|
335
|
+
}
|
|
336
|
+
// Moves need to verify the final placement, after all later canonical
|
|
337
|
+
// operations have replayed, rather than the transient first insertion.
|
|
338
|
+
for (const local of state.applied.values()) {
|
|
339
|
+
if (local.kind === "move" && local.status === "applied") {
|
|
340
|
+
local.expectedParent = local.element.parentElement ?? local.expectedParent;
|
|
341
|
+
// SAFETY: a move nextElementSibling is an HTMLElement when the move is still applied.
|
|
342
|
+
local.expectedBefore = local.element.nextElementSibling;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (schedulePostReplayValidation)
|
|
346
|
+
scheduleValidation(doc, state);
|
|
347
|
+
}
|
|
348
|
+
function storeUnresolved(state, changeId, status, reason) {
|
|
349
|
+
state.applied.set(changeId, { kind: "unresolved", status, reason });
|
|
350
|
+
}
|
|
351
|
+
function applyChangeToDocument(doc, state, change) {
|
|
352
|
+
const target = resolveRenderedInstance(doc, change.target);
|
|
353
|
+
if (target.status !== "resolved") {
|
|
354
|
+
storeUnresolved(state, change.id, target.status, "target");
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (change.kind === "delete") {
|
|
358
|
+
const placeholder = doc.createComment("nudge-ui-deleted");
|
|
359
|
+
target.element.replaceWith(placeholder);
|
|
360
|
+
state.applied.set(change.id, { kind: "delete", status: "applied", element: target.element, placeholder });
|
|
361
|
+
state.appliedOrder.push(change.id);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const sourceParent = resolveRenderedInstance(doc, change.source.parent);
|
|
365
|
+
if (sourceParent.status !== "resolved") {
|
|
366
|
+
storeUnresolved(state, change.id, sourceParent.status, "source-parent");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const parent = resolveRenderedInstance(doc, change.destination.parent);
|
|
370
|
+
if (parent.status !== "resolved") {
|
|
371
|
+
storeUnresolved(state, change.id, parent.status, "destination-parent");
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const before = change.destination.before ? resolveRenderedInstance(doc, change.destination.before) : null;
|
|
375
|
+
if (before && before.status !== "resolved") {
|
|
376
|
+
storeUnresolved(state, change.id, before.status, "anchor");
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (target.element.parentElement !== sourceParent.element) {
|
|
380
|
+
storeUnresolved(state, change.id, "missing", "source-parent");
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const legality = getStructuralMoveLegality(target.element, {
|
|
384
|
+
parent: parent.element,
|
|
385
|
+
before: before?.element ?? null,
|
|
386
|
+
});
|
|
387
|
+
if (!legality.valid) {
|
|
388
|
+
storeUnresolved(state, change.id, "missing", legality.reason);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const fromParent = legality.sourceParent;
|
|
392
|
+
const fromBefore = target.element.nextSibling;
|
|
393
|
+
legality.destinationParent.insertBefore(target.element, legality.before);
|
|
394
|
+
state.applied.set(change.id, {
|
|
395
|
+
kind: "move",
|
|
396
|
+
status: "applied",
|
|
397
|
+
element: target.element,
|
|
398
|
+
target: change.target,
|
|
399
|
+
fromParent,
|
|
400
|
+
fromBefore,
|
|
401
|
+
expectedParent: legality.destinationParent,
|
|
402
|
+
// SAFETY: target.element was inserted into an HTMLElement, so its nextElementSibling is an HTMLElement when present.
|
|
403
|
+
expectedBefore: target.element.nextElementSibling,
|
|
404
|
+
});
|
|
405
|
+
state.appliedOrder.push(change.id);
|
|
406
|
+
}
|
|
407
|
+
function validationStatus(local) {
|
|
408
|
+
if (local.kind === "unresolved")
|
|
409
|
+
return local.status;
|
|
410
|
+
if (local.status === "overridden")
|
|
411
|
+
return "overridden";
|
|
412
|
+
if (local.kind === "delete")
|
|
413
|
+
return local.placeholder.isConnected ? "applied" : "overridden";
|
|
414
|
+
return local.element.isConnected
|
|
415
|
+
&& local.element.parentElement === local.expectedParent
|
|
416
|
+
&& local.element.nextElementSibling === local.expectedBefore
|
|
417
|
+
&& matchesRenderedInstanceEvidence(local.element, local.target)
|
|
418
|
+
? "applied"
|
|
419
|
+
: "overridden";
|
|
420
|
+
}
|
|
421
|
+
/** Rebuild already-mounted document adapters from canonical data only. */
|
|
422
|
+
function reprojectKnownDocuments(changes = getStructuralChanges()) {
|
|
423
|
+
for (const [doc, state] of documentStates) {
|
|
424
|
+
rebuildForSnapshot(doc, state, changes);
|
|
425
|
+
storeReports(doc, reportsForSnapshot(state, state.snapshot));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
function validateAppliedPreview(doc, state) {
|
|
429
|
+
let changed = false;
|
|
430
|
+
for (const local of state.applied.values()) {
|
|
431
|
+
const status = validationStatus(local);
|
|
432
|
+
if (status !== local.status) {
|
|
433
|
+
local.status = status;
|
|
434
|
+
if (status === "overridden")
|
|
435
|
+
local.reason = "react-override";
|
|
436
|
+
changed = true;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (!changed)
|
|
440
|
+
return;
|
|
441
|
+
storeReports(doc, reportsForSnapshot(state, state.snapshot));
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Apply one full controller snapshot to one document. Physical nodes and
|
|
445
|
+
* placeholders stay in the document state only; history stays serializable in
|
|
446
|
+
* the controller. A same snapshot never reapplies an overridden preview.
|
|
447
|
+
*/
|
|
448
|
+
export function applyStructuralProjection(doc, snapshot) {
|
|
449
|
+
const state = getDocumentState(doc);
|
|
450
|
+
const key = JSON.stringify(snapshot);
|
|
451
|
+
if (state.snapshotKey !== key)
|
|
452
|
+
rebuildForSnapshot(doc, state, snapshot);
|
|
453
|
+
const reports = reportsForSnapshot(state, snapshot);
|
|
454
|
+
storeReports(doc, reports);
|
|
455
|
+
return reports;
|
|
456
|
+
}
|
|
457
|
+
/** Compatibility entry point for the delete-only 0050 callers. */
|
|
458
|
+
export function applyStructuralDeleteProjection(doc, snapshot) {
|
|
459
|
+
return applyStructuralProjection(doc, snapshot);
|
|
460
|
+
}
|
|
461
|
+
export function getStructuralProjectionReports(doc) {
|
|
462
|
+
return reportsByDocument.get(doc) ?? [];
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Frames may report only their document-local outcome. The controller owns
|
|
466
|
+
* these reports and filters them against its current canonical change set.
|
|
467
|
+
*/
|
|
468
|
+
export function recordCanvasStructuralProjectionReports(cardId, revision, reports) {
|
|
469
|
+
if (!Number.isSafeInteger(revision) || revision < 0 || !reports.every(isStructuralProjectionReport))
|
|
470
|
+
return;
|
|
471
|
+
const expected = new Set(getStructuralChanges().map((change) => change.id));
|
|
472
|
+
if (reports.length !== expected.size || new Set(reports.map((report) => report.changeId)).size !== reports.length
|
|
473
|
+
|| reports.some((report) => !expected.has(report.changeId)))
|
|
474
|
+
return;
|
|
475
|
+
const existing = reportsByCanvasCard.get(cardId);
|
|
476
|
+
if (existing && revision < existing.revision)
|
|
477
|
+
return;
|
|
478
|
+
const next = reports.map((report) => ({ ...report }));
|
|
479
|
+
if (existing && existing.revision === revision && sameReports(existing.reports, next))
|
|
480
|
+
return;
|
|
481
|
+
reportsByCanvasCard.set(cardId, { revision, reports: next });
|
|
482
|
+
notifyDiagnostics();
|
|
483
|
+
}
|
|
484
|
+
export function clearCanvasStructuralProjectionReports(cardId) {
|
|
485
|
+
if (!reportsByCanvasCard.delete(cardId))
|
|
486
|
+
return;
|
|
487
|
+
notifyDiagnostics();
|
|
488
|
+
}
|
|
489
|
+
/** Removes document-local reports for canonical intents that no longer exist. */
|
|
490
|
+
export function pruneStructuralProjectionReports(changeIds) {
|
|
491
|
+
if (changeIds.size === 0)
|
|
492
|
+
return;
|
|
493
|
+
for (const [cardId, canvasReports] of reportsByCanvasCard) {
|
|
494
|
+
reportsByCanvasCard.set(cardId, {
|
|
495
|
+
...canvasReports,
|
|
496
|
+
reports: canvasReports.reports.filter((report) => !changeIds.has(report.changeId)),
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
notifyDiagnostics();
|
|
500
|
+
}
|
|
501
|
+
/** Clears reports before restoring or clearing an atomic workspace snapshot. */
|
|
502
|
+
export function clearStructuralProjectionReports() {
|
|
503
|
+
reportsByCanvasCard.clear();
|
|
504
|
+
reportsByDocument = new WeakMap();
|
|
505
|
+
notifyDiagnostics();
|
|
506
|
+
}
|
|
507
|
+
export function getStructuralChangeDiagnostics(changeId) {
|
|
508
|
+
const diagnostics = [];
|
|
509
|
+
const host = reportsByDocument.get(document)?.find((report) => report.changeId === changeId);
|
|
510
|
+
if (host)
|
|
511
|
+
diagnostics.push({ ...host, document: "Inspect" });
|
|
512
|
+
for (const [cardId, entry] of reportsByCanvasCard) {
|
|
513
|
+
const report = entry.reports.find((candidate) => candidate.changeId === changeId);
|
|
514
|
+
if (report)
|
|
515
|
+
diagnostics.push({ ...report, document: `Canvas ${cardId}` });
|
|
516
|
+
}
|
|
517
|
+
return diagnostics;
|
|
518
|
+
}
|
|
519
|
+
/** Controller teardown/test hook. It is not a user-visible history operation. */
|
|
520
|
+
export function resetStructuralDeleteProjection() {
|
|
521
|
+
for (const state of documentStates.values()) {
|
|
522
|
+
for (const id of [...state.appliedOrder].reverse()) {
|
|
523
|
+
const local = state.applied.get(id);
|
|
524
|
+
if (local && local.status !== "overridden")
|
|
525
|
+
restoreApplied(local);
|
|
526
|
+
}
|
|
527
|
+
state.observer?.disconnect();
|
|
528
|
+
}
|
|
529
|
+
documentStates.clear();
|
|
530
|
+
reportsByDocument = new WeakMap();
|
|
531
|
+
reportsByCanvasCard.clear();
|
|
532
|
+
nextStructuralId = 1;
|
|
533
|
+
diagnosticRevision = 0;
|
|
534
|
+
resetWorkspaceChanges();
|
|
535
|
+
notifyDiagnostics();
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Releases one document's structural projection without touching canonical
|
|
539
|
+
* workspace intent. Applied deletes/moves owned by this document are restored
|
|
540
|
+
* and the document observer is disconnected; the controller snapshot stays
|
|
541
|
+
* intact so a later remount can re-project from canonical state. Register as
|
|
542
|
+
* a document-session cleanup alongside disposeBrowserCssInspection.
|
|
543
|
+
*/
|
|
544
|
+
export function releaseDocumentProjection(doc) {
|
|
545
|
+
const state = documentStates.get(doc);
|
|
546
|
+
if (!state) {
|
|
547
|
+
if (reportsByDocument.delete(doc))
|
|
548
|
+
notifyDiagnostics();
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
for (const id of [...state.appliedOrder].reverse()) {
|
|
552
|
+
const local = state.applied.get(id);
|
|
553
|
+
if (local && local.status !== "overridden")
|
|
554
|
+
restoreApplied(local);
|
|
555
|
+
}
|
|
556
|
+
state.observer?.disconnect();
|
|
557
|
+
documentStates.delete(doc);
|
|
558
|
+
reportsByDocument.delete(doc);
|
|
559
|
+
notifyDiagnostics();
|
|
560
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StructuralChange, StructuralDelete, StructuralMove, StructuralProjectionReport } from "../changes/structuralTypes.js";
|
|
2
|
+
export declare function isStructuralProjectionReport(value: unknown): value is StructuralProjectionReport;
|
|
3
|
+
export declare function isStructuralDelete(value: unknown): value is StructuralDelete;
|
|
4
|
+
export declare function isStructuralMove(value: unknown): value is StructuralMove;
|
|
5
|
+
export declare function isStructuralChange(value: unknown): value is StructuralChange;
|