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,389 @@
|
|
|
1
|
+
import { isRenderedInstanceOverride, isStyleRuleContextValue, isTextContentChangeValue, } from "./editModel.js";
|
|
2
|
+
import { isComponentChange, isTokenChange, } from "./types.js";
|
|
3
|
+
export function isSerializableChange(value) {
|
|
4
|
+
if (!isRecord(value))
|
|
5
|
+
return false;
|
|
6
|
+
if (value.kind === "token")
|
|
7
|
+
return isSerializableTokenChangeValue(value);
|
|
8
|
+
if (value.kind === "component-prop")
|
|
9
|
+
return isSerializableComponentChangeValue(value);
|
|
10
|
+
if (value.kind === "text-content")
|
|
11
|
+
return isTextContentChangeValue(value);
|
|
12
|
+
return isSerializableElementChangeValue(value);
|
|
13
|
+
}
|
|
14
|
+
export function isSerializableElementChangeValue(value) {
|
|
15
|
+
if (!isRecord(value)
|
|
16
|
+
|| !hasOnlyKeys(value, [
|
|
17
|
+
"kind", "cid", "file", "line", "column", "selector", "property",
|
|
18
|
+
"sourceProperty", "sourceAuthoredValue", "oldToken", "newToken", "rawValue",
|
|
19
|
+
"oldRawValue", "source", "runtimeEvidence", "scope", "instanceOverride", "state",
|
|
20
|
+
])
|
|
21
|
+
|| (value.kind !== undefined && value.kind !== "element")
|
|
22
|
+
|| typeof value.cid !== "string"
|
|
23
|
+
|| typeof value.file !== "string"
|
|
24
|
+
|| !isFiniteNumber(value.line)
|
|
25
|
+
|| (value.column !== undefined && !isNonNegativeSafeInteger(value.column))
|
|
26
|
+
|| typeof value.selector !== "string"
|
|
27
|
+
|| typeof value.property !== "string"
|
|
28
|
+
|| !isSourceValue(value.source)
|
|
29
|
+
|| !isTokenRefValue(value.oldToken)
|
|
30
|
+
|| !isTokenRefValue(value.newToken)
|
|
31
|
+
|| (value.sourceProperty !== undefined && typeof value.sourceProperty !== "string")
|
|
32
|
+
|| (value.sourceAuthoredValue !== undefined && typeof value.sourceAuthoredValue !== "string")
|
|
33
|
+
|| (value.rawValue !== undefined && typeof value.rawValue !== "string")
|
|
34
|
+
|| (value.oldRawValue !== undefined && typeof value.oldRawValue !== "string")
|
|
35
|
+
|| (value.runtimeEvidence !== undefined && !isRuntimeElementEvidenceValue(value.runtimeEvidence))
|
|
36
|
+
|| !isEditScopeValue(value.scope)
|
|
37
|
+
|| (value.instanceOverride !== undefined && value.scope !== "rendered-instance")
|
|
38
|
+
|| (value.scope === "rendered-instance" && !isRenderedInstanceOverride(value.instanceOverride))
|
|
39
|
+
|| (value.state !== undefined && !isElementStateValue(value.state))) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
export function isSerializableTokenChangeValue(value) {
|
|
45
|
+
return isRecord(value)
|
|
46
|
+
&& hasOnlyKeys(value, [
|
|
47
|
+
"kind", "tokenName", "file", "line", "selector", "property", "rawValue",
|
|
48
|
+
"oldRawValue", "important", "context", "contextLabel", "source",
|
|
49
|
+
])
|
|
50
|
+
&& value.kind === "token"
|
|
51
|
+
&& typeof value.tokenName === "string"
|
|
52
|
+
&& typeof value.file === "string"
|
|
53
|
+
&& isFiniteNumber(value.line)
|
|
54
|
+
&& typeof value.selector === "string"
|
|
55
|
+
&& typeof value.property === "string"
|
|
56
|
+
&& typeof value.rawValue === "string"
|
|
57
|
+
&& typeof value.oldRawValue === "string"
|
|
58
|
+
&& (value.important === undefined || typeof value.important === "boolean")
|
|
59
|
+
&& isStyleRuleContextValue(value.context)
|
|
60
|
+
&& typeof value.contextLabel === "string"
|
|
61
|
+
&& isSourceValue(value.source);
|
|
62
|
+
}
|
|
63
|
+
export function isSerializableComponentChangeValue(value) {
|
|
64
|
+
if (!isRecord(value)
|
|
65
|
+
|| !hasOnlyKeys(value, ["kind", "target", "property", "before", "after", "authoredAs", "scope", "evidence"])
|
|
66
|
+
|| value.kind !== "component-prop"
|
|
67
|
+
|| !isComponentTargetValue(value.target)
|
|
68
|
+
|| typeof value.property !== "string"
|
|
69
|
+
|| !isComponentBaselineValue(value.before)
|
|
70
|
+
|| !isComponentPropValue(value.after)
|
|
71
|
+
|| !isAuthoredPropKindValue(value.authoredAs)
|
|
72
|
+
|| !isEditScopeValue(value.scope)
|
|
73
|
+
|| (value.evidence !== undefined && !isComponentInvocationEvidenceValue(value.evidence))) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const evidence = value.evidence;
|
|
77
|
+
return !isUnsafeRepeatedSourceOverride(value.authoredAs, value.scope, evidence);
|
|
78
|
+
}
|
|
79
|
+
export function serializeChange(change) {
|
|
80
|
+
if (isTokenChange(change)) {
|
|
81
|
+
const serialized = serializeTokenChange(change);
|
|
82
|
+
return isSerializableTokenChangeValue(serialized) ? serialized : null;
|
|
83
|
+
}
|
|
84
|
+
if (isComponentChange(change)) {
|
|
85
|
+
if (isRepeatedUnsafeSourceOverride(change))
|
|
86
|
+
return null;
|
|
87
|
+
const serialized = serializeComponentChange(change);
|
|
88
|
+
return isSerializableComponentChangeValue(serialized) ? serialized : null;
|
|
89
|
+
}
|
|
90
|
+
if (change.kind === "text-content") {
|
|
91
|
+
const serialized = serializeTextContentChange(change);
|
|
92
|
+
return isTextContentChangeValue(serialized) ? serialized : null;
|
|
93
|
+
}
|
|
94
|
+
const serialized = serializeElementChange(change);
|
|
95
|
+
return serialized && isSerializableElementChangeValue(serialized) ? serialized : null;
|
|
96
|
+
}
|
|
97
|
+
export function serializeElementChange(change) {
|
|
98
|
+
if (change.instanceOverride !== undefined && change.scope !== "rendered-instance")
|
|
99
|
+
return null;
|
|
100
|
+
if (change.scope === "rendered-instance" && !isRenderedInstanceOverride(change.instanceOverride))
|
|
101
|
+
return null;
|
|
102
|
+
return {
|
|
103
|
+
kind: change.kind,
|
|
104
|
+
cid: change.cid,
|
|
105
|
+
file: change.file,
|
|
106
|
+
line: change.line,
|
|
107
|
+
column: change.column,
|
|
108
|
+
selector: change.selector,
|
|
109
|
+
property: change.property,
|
|
110
|
+
sourceProperty: change.sourceProperty,
|
|
111
|
+
sourceAuthoredValue: change.sourceAuthoredValue,
|
|
112
|
+
oldToken: serializeTokenRef(change.oldToken),
|
|
113
|
+
newToken: serializeTokenRef(change.newToken),
|
|
114
|
+
rawValue: change.rawValue,
|
|
115
|
+
oldRawValue: change.oldRawValue,
|
|
116
|
+
source: change.source,
|
|
117
|
+
runtimeEvidence: change.runtimeEvidence ? { ...change.runtimeEvidence } : undefined,
|
|
118
|
+
scope: change.scope === "rendered-instance" ? "rendered-instance" : "source-site",
|
|
119
|
+
instanceOverride: change.scope === "rendered-instance" ? change.instanceOverride : undefined,
|
|
120
|
+
state: change.state,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export function serializeTokenChange(change) {
|
|
124
|
+
const wrappers = change.context?.wrappers;
|
|
125
|
+
return {
|
|
126
|
+
kind: "token",
|
|
127
|
+
tokenName: change.tokenName,
|
|
128
|
+
file: change.file,
|
|
129
|
+
line: change.line,
|
|
130
|
+
selector: change.selector,
|
|
131
|
+
property: change.property,
|
|
132
|
+
rawValue: change.rawValue,
|
|
133
|
+
oldRawValue: change.oldRawValue,
|
|
134
|
+
important: change.important,
|
|
135
|
+
context: wrappers ? { wrappers: wrappers.map((wrapper) => ({ ...wrapper })) } : {},
|
|
136
|
+
contextLabel: change.contextLabel ?? "",
|
|
137
|
+
source: change.source,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export function serializeComponentChange(change) {
|
|
141
|
+
return {
|
|
142
|
+
kind: "component-prop",
|
|
143
|
+
target: { ...change.target },
|
|
144
|
+
property: change.property,
|
|
145
|
+
before: change.before.kind === "default"
|
|
146
|
+
? { kind: "default" }
|
|
147
|
+
: { kind: "value", value: change.before.value },
|
|
148
|
+
after: change.after,
|
|
149
|
+
authoredAs: change.authoredAs,
|
|
150
|
+
scope: change.scope,
|
|
151
|
+
evidence: change.evidence ? { ...change.evidence } : undefined,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export function serializeTextContentChange(change) {
|
|
155
|
+
return {
|
|
156
|
+
kind: "text-content",
|
|
157
|
+
id: change.id,
|
|
158
|
+
target: {
|
|
159
|
+
sourceSite: { ...change.target.sourceSite },
|
|
160
|
+
occurrence: change.target.occurrence,
|
|
161
|
+
props: change.target.props,
|
|
162
|
+
ariaLabel: change.target.ariaLabel,
|
|
163
|
+
beforeText: change.target.beforeText,
|
|
164
|
+
...(change.target.textNodePath?.length
|
|
165
|
+
? { textNodePath: [...change.target.textNodePath] }
|
|
166
|
+
: {}),
|
|
167
|
+
},
|
|
168
|
+
source: { ...change.source },
|
|
169
|
+
selector: change.selector,
|
|
170
|
+
before: change.before,
|
|
171
|
+
after: change.after,
|
|
172
|
+
authoredAs: change.authoredAs,
|
|
173
|
+
scope: change.scope,
|
|
174
|
+
evidence: change.evidence ? { ...change.evidence } : undefined,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export function deserializeChange(serialized) {
|
|
178
|
+
if (serialized.kind === "token")
|
|
179
|
+
return deserializeTokenChange(serialized);
|
|
180
|
+
if (serialized.kind === "component-prop")
|
|
181
|
+
return deserializeComponentChange(serialized);
|
|
182
|
+
if (serialized.kind === "text-content")
|
|
183
|
+
return deserializeTextContentChange(serialized);
|
|
184
|
+
return deserializeElementChange(serialized);
|
|
185
|
+
}
|
|
186
|
+
export function deserializeElementChange(serialized) {
|
|
187
|
+
return {
|
|
188
|
+
kind: serialized.kind,
|
|
189
|
+
cid: serialized.cid,
|
|
190
|
+
file: serialized.file,
|
|
191
|
+
line: serialized.line,
|
|
192
|
+
column: serialized.column,
|
|
193
|
+
selector: serialized.selector,
|
|
194
|
+
property: serialized.property,
|
|
195
|
+
sourceProperty: serialized.sourceProperty,
|
|
196
|
+
sourceAuthoredValue: serialized.sourceAuthoredValue,
|
|
197
|
+
oldToken: deserializeTokenRef(serialized.oldToken),
|
|
198
|
+
newToken: deserializeTokenRef(serialized.newToken),
|
|
199
|
+
rawValue: serialized.rawValue,
|
|
200
|
+
oldRawValue: serialized.oldRawValue,
|
|
201
|
+
source: serialized.source,
|
|
202
|
+
runtimeEvidence: serialized.runtimeEvidence ? { ...serialized.runtimeEvidence } : undefined,
|
|
203
|
+
scope: serialized.scope ?? "source-site",
|
|
204
|
+
instanceOverride: serialized.scope === "rendered-instance" ? serialized.instanceOverride : undefined,
|
|
205
|
+
state: serialized.state,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
export function deserializeTokenChange(serialized) {
|
|
209
|
+
return {
|
|
210
|
+
kind: "token",
|
|
211
|
+
tokenName: serialized.tokenName,
|
|
212
|
+
file: serialized.file,
|
|
213
|
+
line: serialized.line,
|
|
214
|
+
selector: serialized.selector,
|
|
215
|
+
property: serialized.property,
|
|
216
|
+
rawValue: serialized.rawValue,
|
|
217
|
+
oldRawValue: serialized.oldRawValue,
|
|
218
|
+
important: serialized.important ?? false,
|
|
219
|
+
context: serialized.context ?? {},
|
|
220
|
+
contextLabel: serialized.contextLabel ?? "",
|
|
221
|
+
source: serialized.source,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
export function deserializeComponentChange(serialized) {
|
|
225
|
+
return {
|
|
226
|
+
kind: "component-prop",
|
|
227
|
+
target: { ...serialized.target },
|
|
228
|
+
property: serialized.property,
|
|
229
|
+
before: serialized.before.kind === "default"
|
|
230
|
+
? { kind: "default" }
|
|
231
|
+
: { kind: "value", value: serialized.before.value },
|
|
232
|
+
after: serialized.after,
|
|
233
|
+
authoredAs: serialized.authoredAs,
|
|
234
|
+
scope: serialized.scope,
|
|
235
|
+
evidence: serialized.evidence ? { ...serialized.evidence } : undefined,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
export function deserializeTextContentChange(serialized) {
|
|
239
|
+
return {
|
|
240
|
+
kind: "text-content",
|
|
241
|
+
id: serialized.id,
|
|
242
|
+
target: {
|
|
243
|
+
sourceSite: { ...serialized.target.sourceSite },
|
|
244
|
+
occurrence: serialized.target.occurrence,
|
|
245
|
+
props: serialized.target.props,
|
|
246
|
+
ariaLabel: serialized.target.ariaLabel,
|
|
247
|
+
beforeText: serialized.target.beforeText,
|
|
248
|
+
...(serialized.target.textNodePath?.length
|
|
249
|
+
? { textNodePath: [...serialized.target.textNodePath] }
|
|
250
|
+
: {}),
|
|
251
|
+
},
|
|
252
|
+
source: { ...serialized.source },
|
|
253
|
+
selector: serialized.selector,
|
|
254
|
+
before: serialized.before,
|
|
255
|
+
after: serialized.after,
|
|
256
|
+
authoredAs: serialized.authoredAs,
|
|
257
|
+
scope: serialized.scope,
|
|
258
|
+
evidence: serialized.evidence ? { ...serialized.evidence } : undefined,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function serializeTokenRef(token) {
|
|
262
|
+
if (!token)
|
|
263
|
+
return null;
|
|
264
|
+
return {
|
|
265
|
+
name: token.name,
|
|
266
|
+
value: token.value ?? "",
|
|
267
|
+
source: token.source ?? "",
|
|
268
|
+
cssValue: token.cssValue,
|
|
269
|
+
cssName: token.cssName,
|
|
270
|
+
adapter: token.adapter,
|
|
271
|
+
origin: token.origin,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function deserializeTokenRef(serialized) {
|
|
275
|
+
if (!serialized)
|
|
276
|
+
return null;
|
|
277
|
+
return {
|
|
278
|
+
name: serialized.name,
|
|
279
|
+
value: serialized.value,
|
|
280
|
+
source: serialized.source,
|
|
281
|
+
cssValue: serialized.cssValue,
|
|
282
|
+
cssName: serialized.cssName,
|
|
283
|
+
adapter: serialized.adapter,
|
|
284
|
+
origin: serialized.origin,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function isUnsafeRepeatedSourceOverride(authoredAs, scope, evidence) {
|
|
288
|
+
return isComponentInvocationEvidenceValue(evidence)
|
|
289
|
+
&& evidence.mountedCount > 1
|
|
290
|
+
&& (authoredAs === "expression" || authoredAs === "spread")
|
|
291
|
+
&& scope !== "rendered-instance";
|
|
292
|
+
}
|
|
293
|
+
function isRepeatedUnsafeSourceOverride(change) {
|
|
294
|
+
return isUnsafeRepeatedSourceOverride(change.authoredAs, change.scope, change.evidence);
|
|
295
|
+
}
|
|
296
|
+
function isComponentTargetValue(value) {
|
|
297
|
+
return isRecord(value)
|
|
298
|
+
&& hasOnlyKeys(value, ["framework", "componentId", "callsiteId", "componentName", "file", "line", "column"])
|
|
299
|
+
&& value.framework === "react"
|
|
300
|
+
&& typeof value.componentId === "string"
|
|
301
|
+
&& typeof value.callsiteId === "string"
|
|
302
|
+
&& typeof value.componentName === "string"
|
|
303
|
+
&& typeof value.file === "string"
|
|
304
|
+
&& isFiniteNumber(value.line)
|
|
305
|
+
&& isFiniteNumber(value.column);
|
|
306
|
+
}
|
|
307
|
+
function isComponentBaselineValue(value) {
|
|
308
|
+
if (!isRecord(value))
|
|
309
|
+
return false;
|
|
310
|
+
if (value.kind === "default")
|
|
311
|
+
return hasOnlyKeys(value, ["kind"]);
|
|
312
|
+
return hasOnlyKeys(value, ["kind", "value"])
|
|
313
|
+
&& value.kind === "value"
|
|
314
|
+
&& isComponentPropValue(value.value);
|
|
315
|
+
}
|
|
316
|
+
function isComponentInvocationEvidenceValue(value) {
|
|
317
|
+
return isRecord(value)
|
|
318
|
+
&& hasOnlyKeys(value, ["occurrence", "props", "ariaLabel", "beforeText", "mountedCount"])
|
|
319
|
+
&& isNonNegativeSafeInteger(value.occurrence)
|
|
320
|
+
&& (typeof value.props === "string" || value.props === null)
|
|
321
|
+
&& (typeof value.ariaLabel === "string" || value.ariaLabel === null)
|
|
322
|
+
&& typeof value.beforeText === "string"
|
|
323
|
+
&& isNonNegativeSafeInteger(value.mountedCount);
|
|
324
|
+
}
|
|
325
|
+
function isRuntimeElementEvidenceValue(value) {
|
|
326
|
+
return isRecord(value)
|
|
327
|
+
&& hasOnlyKeys(value, ["reason", "tagName", "text", "props", "ariaLabel"])
|
|
328
|
+
&& (value.reason === undefined || value.reason === "runtime-created" || value.reason === "unannotated")
|
|
329
|
+
&& typeof value.tagName === "string"
|
|
330
|
+
&& (typeof value.text === "string" || value.text === null)
|
|
331
|
+
&& (typeof value.props === "string" || value.props === null)
|
|
332
|
+
&& (typeof value.ariaLabel === "string" || value.ariaLabel === null);
|
|
333
|
+
}
|
|
334
|
+
function isTokenRefValue(value) {
|
|
335
|
+
if (value === null)
|
|
336
|
+
return true;
|
|
337
|
+
return isRecord(value)
|
|
338
|
+
&& hasOnlyKeys(value, ["name", "value", "source", "cssValue", "cssName", "adapter", "origin"])
|
|
339
|
+
&& typeof value.name === "string"
|
|
340
|
+
&& typeof value.value === "string"
|
|
341
|
+
&& typeof value.source === "string"
|
|
342
|
+
&& (value.cssValue === undefined || typeof value.cssValue === "string")
|
|
343
|
+
&& (value.cssName === undefined || typeof value.cssName === "string")
|
|
344
|
+
&& (value.adapter === undefined || typeof value.adapter === "string")
|
|
345
|
+
&& (value.origin === undefined
|
|
346
|
+
|| value.origin === "project"
|
|
347
|
+
|| value.origin === "package"
|
|
348
|
+
|| value.origin === "framework"
|
|
349
|
+
|| value.origin === "generated"
|
|
350
|
+
|| value.origin === "runtime");
|
|
351
|
+
}
|
|
352
|
+
function isSourceValue(value) {
|
|
353
|
+
return isRecord(value)
|
|
354
|
+
&& hasOnlyKeys(value, ["file", "line", "component"])
|
|
355
|
+
&& typeof value.file === "string"
|
|
356
|
+
&& isFiniteNumber(value.line)
|
|
357
|
+
&& typeof value.component === "string";
|
|
358
|
+
}
|
|
359
|
+
function isEditScopeValue(value) {
|
|
360
|
+
return value === undefined || value === "source-site" || value === "rendered-instance";
|
|
361
|
+
}
|
|
362
|
+
function isComponentPropValue(value) {
|
|
363
|
+
return typeof value === "string"
|
|
364
|
+
|| (typeof value === "number" && Number.isFinite(value))
|
|
365
|
+
|| typeof value === "boolean";
|
|
366
|
+
}
|
|
367
|
+
function isAuthoredPropKindValue(value) {
|
|
368
|
+
return value === "literal" || value === "expression" || value === "spread" || value === "default";
|
|
369
|
+
}
|
|
370
|
+
function isElementStateValue(value) {
|
|
371
|
+
return value === "base"
|
|
372
|
+
|| value === "hover"
|
|
373
|
+
|| value === "active"
|
|
374
|
+
|| value === "focus"
|
|
375
|
+
|| value === "focus-visible"
|
|
376
|
+
|| value === "disabled";
|
|
377
|
+
}
|
|
378
|
+
function isRecord(value) {
|
|
379
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
380
|
+
}
|
|
381
|
+
function hasOnlyKeys(value, allowed) {
|
|
382
|
+
return Object.keys(value).every((key) => allowed.includes(key));
|
|
383
|
+
}
|
|
384
|
+
function isFiniteNumber(value) {
|
|
385
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
386
|
+
}
|
|
387
|
+
function isNonNegativeSafeInteger(value) {
|
|
388
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
389
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { TokenContextWrapper } from "../../css/model/index.js";
|
|
2
|
+
export type EditScope = "source-site" | "rendered-instance";
|
|
3
|
+
/** A JSX instrumentation site. This is stable across documents. */
|
|
4
|
+
export interface SourceSiteRef {
|
|
5
|
+
cid: string;
|
|
6
|
+
src: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Serializable identity for one rendered output. It deliberately contains no
|
|
10
|
+
* DOM reference or generated node id: each document resolves it independently.
|
|
11
|
+
*/
|
|
12
|
+
export interface RenderedInstanceRef {
|
|
13
|
+
sourceSite: SourceSiteRef;
|
|
14
|
+
locator: {
|
|
15
|
+
kind: "evidence";
|
|
16
|
+
occurrence: number;
|
|
17
|
+
props: string | null;
|
|
18
|
+
text: string | null;
|
|
19
|
+
/** An accessible name can distinguish icon-only repeated controls. */
|
|
20
|
+
ariaLabel?: string | null;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface RenderedInstanceOverride {
|
|
24
|
+
id: string;
|
|
25
|
+
target: RenderedInstanceRef;
|
|
26
|
+
}
|
|
27
|
+
/** The browser-independent CSS context retained on a token change. */
|
|
28
|
+
export interface StyleRuleContext {
|
|
29
|
+
wrappers?: TokenContextWrapper[];
|
|
30
|
+
}
|
|
31
|
+
export declare function isRenderedInstanceRef(value: unknown): value is RenderedInstanceRef;
|
|
32
|
+
export declare function isRenderedInstanceOverride(value: unknown): value is RenderedInstanceOverride;
|
|
33
|
+
/** Validates the serializable context carried by a token change. */
|
|
34
|
+
export declare function isStyleRuleContextValue(value: unknown): value is StyleRuleContext;
|
|
35
|
+
/** A source site shared by text and rendered-instance evidence. */
|
|
36
|
+
export type TextProjectionSourceSite = SourceSiteRef;
|
|
37
|
+
export interface TextProjectionTarget {
|
|
38
|
+
sourceSite: TextProjectionSourceSite;
|
|
39
|
+
occurrence: number;
|
|
40
|
+
props: string | null;
|
|
41
|
+
ariaLabel: string | null;
|
|
42
|
+
beforeText: string;
|
|
43
|
+
/** Document-local evidence for a text node inside safe mixed markup. */
|
|
44
|
+
textNodePath?: readonly number[];
|
|
45
|
+
}
|
|
46
|
+
export type TextProjectionScope = EditScope;
|
|
47
|
+
/** Bounded semantic evidence retained alongside an instance text projection. */
|
|
48
|
+
export interface TextBindingEvidence {
|
|
49
|
+
callsiteId: string;
|
|
50
|
+
componentName: string;
|
|
51
|
+
property: string;
|
|
52
|
+
mountedCount: number;
|
|
53
|
+
}
|
|
54
|
+
export interface TextContentChangeRecord {
|
|
55
|
+
kind: "text-content";
|
|
56
|
+
property?: undefined;
|
|
57
|
+
id: string;
|
|
58
|
+
target: TextProjectionTarget;
|
|
59
|
+
source: {
|
|
60
|
+
file: string;
|
|
61
|
+
line: number;
|
|
62
|
+
column: number;
|
|
63
|
+
component: string;
|
|
64
|
+
};
|
|
65
|
+
selector: string;
|
|
66
|
+
before: string;
|
|
67
|
+
after: string;
|
|
68
|
+
authoredAs: "literal" | "expression" | "unknown";
|
|
69
|
+
scope?: TextProjectionScope;
|
|
70
|
+
evidence?: TextBindingEvidence;
|
|
71
|
+
}
|
|
72
|
+
export declare function isTextProjectionTargetValue(value: unknown): value is TextProjectionTarget;
|
|
73
|
+
export declare function isTextContentChangeValue(value: unknown): value is TextContentChangeRecord;
|
|
74
|
+
export declare function isTextContentChangeListValue(value: unknown): value is TextContentChangeRecord[];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export function isRenderedInstanceRef(value) {
|
|
2
|
+
if (!isRecord(value) || !hasOnlyKeys(value, ["sourceSite", "locator"]))
|
|
3
|
+
return false;
|
|
4
|
+
const source = value.sourceSite;
|
|
5
|
+
const locator = value.locator;
|
|
6
|
+
if (!isRecord(source)
|
|
7
|
+
|| !hasOnlyKeys(source, ["cid", "src"])
|
|
8
|
+
|| typeof source.cid !== "string"
|
|
9
|
+
|| typeof source.src !== "string"
|
|
10
|
+
|| !isRecord(locator)
|
|
11
|
+
|| !hasOnlyKeys(locator, ["kind", "occurrence", "props", "text", "ariaLabel"]))
|
|
12
|
+
return false;
|
|
13
|
+
return locator.kind === "evidence"
|
|
14
|
+
&& Number.isSafeInteger(locator.occurrence) && locator.occurrence >= 0
|
|
15
|
+
&& (typeof locator.props === "string" || locator.props === null)
|
|
16
|
+
&& (typeof locator.text === "string" || locator.text === null)
|
|
17
|
+
&& (locator.ariaLabel === undefined || typeof locator.ariaLabel === "string" || locator.ariaLabel === null);
|
|
18
|
+
}
|
|
19
|
+
export function isRenderedInstanceOverride(value) {
|
|
20
|
+
return isRecord(value)
|
|
21
|
+
&& hasOnlyKeys(value, ["id", "target"])
|
|
22
|
+
&& typeof value.id === "string"
|
|
23
|
+
&& isRenderedInstanceRef(value.target);
|
|
24
|
+
}
|
|
25
|
+
/** Validates the serializable context carried by a token change. */
|
|
26
|
+
export function isStyleRuleContextValue(value) {
|
|
27
|
+
if (!isRecord(value) || !hasOnlyKeys(value, ["wrappers"]))
|
|
28
|
+
return false;
|
|
29
|
+
const wrappers = value.wrappers;
|
|
30
|
+
return wrappers === undefined || (Array.isArray(wrappers) && wrappers.every((wrapper) => {
|
|
31
|
+
if (!isRecord(wrapper) || !hasOnlyKeys(wrapper, ["kind", "params"]))
|
|
32
|
+
return false;
|
|
33
|
+
return (wrapper.kind === "media"
|
|
34
|
+
|| wrapper.kind === "supports"
|
|
35
|
+
|| wrapper.kind === "scope"
|
|
36
|
+
|| wrapper.kind === "layer")
|
|
37
|
+
&& typeof wrapper.params === "string";
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
export function isTextProjectionTargetValue(value) {
|
|
41
|
+
if (!isRecord(value)
|
|
42
|
+
|| !hasOnlyKeys(value, ["sourceSite", "occurrence", "props", "ariaLabel", "beforeText", "textNodePath"])) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const occurrence = value.occurrence;
|
|
46
|
+
const props = value.props;
|
|
47
|
+
const ariaLabel = value.ariaLabel;
|
|
48
|
+
const beforeText = value.beforeText;
|
|
49
|
+
const textNodePath = value.textNodePath;
|
|
50
|
+
if (!isNonNegativeSafeInteger(occurrence)
|
|
51
|
+
|| (typeof props !== "string" && props !== null)
|
|
52
|
+
|| (typeof ariaLabel !== "string" && ariaLabel !== null)
|
|
53
|
+
|| typeof beforeText !== "string"
|
|
54
|
+
|| (textNodePath !== undefined
|
|
55
|
+
&& (!Array.isArray(textNodePath)
|
|
56
|
+
|| textNodePath.length === 0
|
|
57
|
+
|| !textNodePath.every(isNonNegativeSafeInteger)))) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const source = value.sourceSite;
|
|
61
|
+
return isRecord(source)
|
|
62
|
+
&& hasOnlyKeys(source, ["cid", "src"])
|
|
63
|
+
&& typeof source.cid === "string"
|
|
64
|
+
&& source.cid.length > 0
|
|
65
|
+
&& typeof source.src === "string"
|
|
66
|
+
&& source.src.length > 0;
|
|
67
|
+
}
|
|
68
|
+
export function isTextContentChangeValue(value) {
|
|
69
|
+
if (!isRecord(value)
|
|
70
|
+
|| !hasOnlyKeys(value, ["kind", "id", "target", "source", "selector", "before", "after", "authoredAs", "scope", "evidence"])) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (value.kind !== "text-content"
|
|
74
|
+
|| typeof value.id !== "string" || value.id.length === 0
|
|
75
|
+
|| typeof value.selector !== "string" || value.selector.length === 0
|
|
76
|
+
|| typeof value.before !== "string"
|
|
77
|
+
|| typeof value.after !== "string"
|
|
78
|
+
|| (value.authoredAs !== "literal" && value.authoredAs !== "expression" && value.authoredAs !== "unknown")) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const source = value.source;
|
|
82
|
+
if (!isRecord(source)
|
|
83
|
+
|| !hasOnlyKeys(source, ["file", "line", "column", "component"])
|
|
84
|
+
|| typeof source.file !== "string" || source.file.length === 0
|
|
85
|
+
|| !isNonNegativeSafeInteger(source.line)
|
|
86
|
+
|| !isNonNegativeSafeInteger(source.column)
|
|
87
|
+
|| typeof source.component !== "string" || source.component.length === 0) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (value.scope !== undefined
|
|
91
|
+
&& value.scope !== "source-site"
|
|
92
|
+
&& value.scope !== "rendered-instance")
|
|
93
|
+
return false;
|
|
94
|
+
if (value.evidence !== undefined) {
|
|
95
|
+
const evidence = value.evidence;
|
|
96
|
+
if (!isRecord(evidence)
|
|
97
|
+
|| !hasOnlyKeys(evidence, ["callsiteId", "componentName", "property", "mountedCount"])
|
|
98
|
+
|| typeof evidence.callsiteId !== "string" || evidence.callsiteId.length === 0
|
|
99
|
+
|| typeof evidence.componentName !== "string" || evidence.componentName.length === 0
|
|
100
|
+
|| typeof evidence.property !== "string" || evidence.property.length === 0
|
|
101
|
+
|| !isNonNegativeSafeInteger(evidence.mountedCount))
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return isTextProjectionTargetValue(value.target)
|
|
105
|
+
&& value.target.beforeText === value.before;
|
|
106
|
+
}
|
|
107
|
+
export function isTextContentChangeListValue(value) {
|
|
108
|
+
if (!Array.isArray(value) || !value.every(isTextContentChangeValue))
|
|
109
|
+
return false;
|
|
110
|
+
return new Set(value.map((change) => change.id)).size === value.length;
|
|
111
|
+
}
|
|
112
|
+
function isRecord(value) {
|
|
113
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
114
|
+
}
|
|
115
|
+
function hasOnlyKeys(value, allowed) {
|
|
116
|
+
return Object.keys(value).every((key) => allowed.includes(key));
|
|
117
|
+
}
|
|
118
|
+
function isNonNegativeSafeInteger(value) {
|
|
119
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
120
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PreviewResult, StyleRule } from "../projection/managedStylesheet.js";
|
|
2
|
+
import { type ChangeRecord, type PreviewableChangeRecord } from "./types.js";
|
|
3
|
+
/** The source selector stays canonical; the projection marker is document-local. */
|
|
4
|
+
export declare function selectorForManagedChange(change: PreviewableChangeRecord): string | null;
|
|
5
|
+
export declare function buildManagedStyleRules(changes: ChangeRecord[]): StyleRule[];
|
|
6
|
+
export declare function verifyManagedStyleProjection(change: PreviewableChangeRecord, selectedElement?: HTMLElement | null): PreviewResult | null;
|