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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured and box value interpretation (plan slice 3.5).
|
|
3
|
+
*
|
|
4
|
+
* One browser-safe Module turns an authored CSSOM value for a box/border/
|
|
5
|
+
* radius/font property into a structured projection tree: the physical sides,
|
|
6
|
+
* border longhands, radius corners, or font longhands it expands to, each with
|
|
7
|
+
* source-property provenance and its own token interpretation.
|
|
8
|
+
*
|
|
9
|
+
* One interpretation tree: each distinct authored component is token-interpreted
|
|
10
|
+
* once and every projected field that carries that component reuses the same
|
|
11
|
+
* interpretation (tokenName, tokens, opacity, modifiers, cycle). A border color
|
|
12
|
+
* token, a multi-value spacing token, or a radius token is therefore resolved
|
|
13
|
+
* once per declaration, not once per projected longhand.
|
|
14
|
+
*
|
|
15
|
+
* Conservative fallbacks: ambiguous borders, slash-separated radius forms,
|
|
16
|
+
* complex fonts, and everything outside the supported families stay a single
|
|
17
|
+
* raw/composite row with the resolution's existing capability classification.
|
|
18
|
+
*
|
|
19
|
+
* Browser-safe contract: this module imports only the shared model and the
|
|
20
|
+
* other value-semantics Modules. Directionality is an explicit input fact; it
|
|
21
|
+
* never walks the DOM or CSSOM.
|
|
22
|
+
*/
|
|
23
|
+
import type { BorderStructure, ColorOpacity, EditCapability, OpacityValue, TokenReference, ValueModifier } from "../model/index.js";
|
|
24
|
+
import { type TokenInterpretationContext, type TokenValueInterpretation } from "./tokenInterpretation.js";
|
|
25
|
+
import { type Directionality } from "./boxSemantics.js";
|
|
26
|
+
export type { Directionality } from "./boxSemantics.js";
|
|
27
|
+
/** One projected longhand row from the structured interpretation. */
|
|
28
|
+
export interface StructuredField {
|
|
29
|
+
property: string;
|
|
30
|
+
/** The authored value projected to this field (per-side/corner/longhand). */
|
|
31
|
+
declaredValue: string;
|
|
32
|
+
/** The shorthand the field came from (e.g. `"border"`, `"padding-inline"`). */
|
|
33
|
+
sourceProperty: string;
|
|
34
|
+
tokenName: string | null;
|
|
35
|
+
resolvedValue: string;
|
|
36
|
+
tokens: TokenReference[];
|
|
37
|
+
opacity?: ColorOpacity;
|
|
38
|
+
propertyOpacity?: OpacityValue;
|
|
39
|
+
color?: TokenValueInterpretation["color"];
|
|
40
|
+
modifiers: ValueModifier[];
|
|
41
|
+
capability: EditCapability;
|
|
42
|
+
structure?: BorderStructure;
|
|
43
|
+
diagnostic?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Explicit, DOM-free facts the structured interpretation needs. */
|
|
46
|
+
export interface StructuredValuesContext {
|
|
47
|
+
/** Token table plus the integration's token-interpretation policies. */
|
|
48
|
+
tokenContext: TokenInterpretationContext;
|
|
49
|
+
/**
|
|
50
|
+
* Writing-mode/direction facts for logical→physical mapping. Absent →
|
|
51
|
+
* `ltr` / `horizontal-tb`.
|
|
52
|
+
*/
|
|
53
|
+
directionality?: Directionality;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Interprets one authored value for a property into a structured projection
|
|
57
|
+
* tree. Returns the projected fields, or a single conservative raw/composite
|
|
58
|
+
* field when the value cannot be decomposed faithfully. The declared order of
|
|
59
|
+
* the families mirrors CSS projection precedence: logical sides, border, font,
|
|
60
|
+
* border-radius corners, gap, physical spacing, then the raw fallback.
|
|
61
|
+
*/
|
|
62
|
+
export declare function interpretValue(property: string, authored: string, ctx: StructuredValuesContext): StructuredField[];
|
|
63
|
+
/** @internal Use the package-level `interpretValue` Interface in production. */
|
|
64
|
+
export declare const interpretStructuredValue: typeof interpretValue;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { splitTopLevelWhitespace, topLevelSlashIndex } from "./cssSyntax.js";
|
|
2
|
+
import { parseBorderComponents } from "./borderSemantics.js";
|
|
3
|
+
import { parseFontShorthand } from "./fontSemantics.js";
|
|
4
|
+
import { normalizeOpacityPercent } from "./colorSemantics.js";
|
|
5
|
+
import { classifyEditCapability } from "./propertyPolicy.js";
|
|
6
|
+
import { interpretTokenValue } from "./tokenInterpretation.js";
|
|
7
|
+
import { BORDER_RADIUS_CORNERS, GAP_AXES, SPACING_SIDES, expandFourValueShorthand, expandTwoValueShorthand, logicalPhysicalSides, } from "./boxSemantics.js";
|
|
8
|
+
function propertyOpacityFor(authored, interpretation, capability) {
|
|
9
|
+
const value = normalizeOpacityPercent(interpretation.resolvedValue);
|
|
10
|
+
if (value === null)
|
|
11
|
+
return undefined;
|
|
12
|
+
const token = interpretation.tokenName
|
|
13
|
+
? interpretation.tokens.find((reference) => reference.name === interpretation.tokenName)
|
|
14
|
+
: undefined;
|
|
15
|
+
return {
|
|
16
|
+
value,
|
|
17
|
+
authoredValue: authored.trim(),
|
|
18
|
+
tokenName: interpretation.tokenName,
|
|
19
|
+
...(token ? { token } : {}),
|
|
20
|
+
editable: capability !== "raw" && !/\b(?:calc|min|max|clamp|env|anchor-size)\s*\(/i.test(authored),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function cycleDiagnostic(cycle) {
|
|
24
|
+
return `custom-property alias cycle includes ${cycle}`;
|
|
25
|
+
}
|
|
26
|
+
function projectField(projection) {
|
|
27
|
+
const { interpretation } = projection;
|
|
28
|
+
return {
|
|
29
|
+
property: projection.property,
|
|
30
|
+
declaredValue: projection.declaredValue,
|
|
31
|
+
sourceProperty: projection.sourceProperty,
|
|
32
|
+
tokenName: interpretation.tokenName,
|
|
33
|
+
resolvedValue: projection.resolvedValue ?? interpretation.resolvedValue,
|
|
34
|
+
tokens: interpretation.tokens,
|
|
35
|
+
opacity: interpretation.opacity,
|
|
36
|
+
...(projection.property.toLowerCase() === "opacity"
|
|
37
|
+
? { propertyOpacity: propertyOpacityFor(projection.declaredValue, interpretation, projection.capability) }
|
|
38
|
+
: {}),
|
|
39
|
+
color: interpretation.color,
|
|
40
|
+
modifiers: interpretation.modifiers,
|
|
41
|
+
capability: projection.capability,
|
|
42
|
+
diagnostic: projection.diagnostic
|
|
43
|
+
?? (interpretation.cycle ? cycleDiagnostic(interpretation.cycle) : undefined),
|
|
44
|
+
structure: projection.structure,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function rawField(property, authored, ctx) {
|
|
48
|
+
const trimmed = authored.trim();
|
|
49
|
+
const interpretation = interpretTokenValue(trimmed, ctx.tokenContext);
|
|
50
|
+
const capability = property.toLowerCase() === "border" ? "raw" : classifyEditCapability(property, authored);
|
|
51
|
+
return projectField({
|
|
52
|
+
property,
|
|
53
|
+
declaredValue: trimmed,
|
|
54
|
+
sourceProperty: property,
|
|
55
|
+
interpretation,
|
|
56
|
+
capability,
|
|
57
|
+
diagnostic: capability === "composite" ? `unsupported composite value for ${property}` : undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function unsupportedField(property, authored, ctx) {
|
|
61
|
+
const field = rawField(property, authored, ctx);
|
|
62
|
+
return {
|
|
63
|
+
...field,
|
|
64
|
+
capability: "raw",
|
|
65
|
+
diagnostic: field.diagnostic?.startsWith("custom-property alias cycle")
|
|
66
|
+
? field.diagnostic
|
|
67
|
+
: `unsupported structured value for ${property}`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function fieldFor(property, declaredValue, sourceProperty, ctx) {
|
|
71
|
+
return projectField({
|
|
72
|
+
property,
|
|
73
|
+
declaredValue,
|
|
74
|
+
sourceProperty,
|
|
75
|
+
interpretation: interpretTokenValue(declaredValue, ctx.tokenContext),
|
|
76
|
+
capability: classifyEditCapability(property, declaredValue),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Expands authored raw values into per-position entries, deriving each
|
|
81
|
+
* component's token interpretation once. A bare `var()` whose resolved value
|
|
82
|
+
* is multiple lengths expands into multiple positions, preserving the token
|
|
83
|
+
* on every one.
|
|
84
|
+
*/
|
|
85
|
+
function expandPositionValues(rawValues, ctx) {
|
|
86
|
+
return rawValues.flatMap((rawValue) => {
|
|
87
|
+
const res = interpretTokenValue(rawValue, ctx.tokenContext);
|
|
88
|
+
const tokenValues = res.tokenName ? splitTopLevelWhitespace(res.resolvedValue) : [];
|
|
89
|
+
if (res.tokenName && /^var\(\s*--[\w-]+(?:\s*,[\s\S]*)?\s*\)$/.test(rawValue) && tokenValues.length > 1) {
|
|
90
|
+
return tokenValues.map((resolvedValue) => ({
|
|
91
|
+
declaredValue: rawValue,
|
|
92
|
+
resolvedValue,
|
|
93
|
+
interpretation: res,
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
return [{ declaredValue: rawValue, resolvedValue: res.resolvedValue, interpretation: res }];
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function expandLogicalSides(sides, property, authored, ctx) {
|
|
100
|
+
const rawValues = splitTopLevelWhitespace(authored);
|
|
101
|
+
const positions = expandPositionValues(rawValues, ctx);
|
|
102
|
+
const values = sides.length === 1
|
|
103
|
+
? positions.length === 1 ? [positions[0]] : null
|
|
104
|
+
: expandTwoValueShorthand(positions);
|
|
105
|
+
if (!values)
|
|
106
|
+
return null;
|
|
107
|
+
return sides.map((side, index) => projectPositionField(side, property, values[index]));
|
|
108
|
+
}
|
|
109
|
+
function expandBorder(lower, property, authored, ctx) {
|
|
110
|
+
const components = parseBorderComponents(authored.trim(), ctx.tokenContext);
|
|
111
|
+
if (!components)
|
|
112
|
+
return null;
|
|
113
|
+
// SAFETY: lower is one of the known border structure source properties from the parser typed union.
|
|
114
|
+
const sourceProperty = lower;
|
|
115
|
+
const sidePrefix = sourceProperty === "border" ? "" : `${sourceProperty}-`;
|
|
116
|
+
// Interpret each distinct component once; every projected longhand reuses
|
|
117
|
+
// that component result rather than resolving the same token repeatedly.
|
|
118
|
+
const { widthResult, styleResult, colorResult } = components;
|
|
119
|
+
const scopedStructure = {
|
|
120
|
+
kind: "border",
|
|
121
|
+
sourceProperty,
|
|
122
|
+
width: components.width,
|
|
123
|
+
style: components.style,
|
|
124
|
+
color: components.color,
|
|
125
|
+
colorTokenName: colorResult.tokenName,
|
|
126
|
+
};
|
|
127
|
+
const authoredValue = authored.trim();
|
|
128
|
+
const entries = sidePrefix
|
|
129
|
+
? [[`${sidePrefix}width`, components.width], [`${sidePrefix}style`, components.style], [`${sidePrefix}color`, components.color]]
|
|
130
|
+
: [
|
|
131
|
+
["border-width", components.width], ["border-style", components.style], ["border-color", components.color],
|
|
132
|
+
["border-top-width", components.width], ["border-right-width", components.width], ["border-bottom-width", components.width], ["border-left-width", components.width],
|
|
133
|
+
["border-top-style", components.style], ["border-right-style", components.style], ["border-bottom-style", components.style], ["border-left-style", components.style],
|
|
134
|
+
["border-top-color", components.color], ["border-right-color", components.color], ["border-bottom-color", components.color], ["border-left-color", components.color],
|
|
135
|
+
];
|
|
136
|
+
return entries.map(([longhand, component]) => {
|
|
137
|
+
const result = longhand.endsWith("color")
|
|
138
|
+
? colorResult
|
|
139
|
+
: longhand.endsWith("style") ? styleResult : widthResult;
|
|
140
|
+
return projectField({
|
|
141
|
+
property: longhand,
|
|
142
|
+
declaredValue: authoredValue,
|
|
143
|
+
sourceProperty: property,
|
|
144
|
+
interpretation: result,
|
|
145
|
+
resolvedValue: result.resolvedValue || component,
|
|
146
|
+
capability: "structured",
|
|
147
|
+
structure: scopedStructure,
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function expandFont(property, authored, ctx) {
|
|
152
|
+
const parts = parseFontShorthand(authored);
|
|
153
|
+
if (!parts)
|
|
154
|
+
return null;
|
|
155
|
+
return Object.entries(parts).map(([longhand, declaredValue]) => fieldFor(longhand, declaredValue, property, ctx));
|
|
156
|
+
}
|
|
157
|
+
function expandCorners(property, corners, authored, ctx) {
|
|
158
|
+
const rawValues = splitTopLevelWhitespace(authored);
|
|
159
|
+
// Slash-separated radius forms stay conservative: a single raw row.
|
|
160
|
+
if (topLevelSlashIndex(authored) >= 0 || rawValues.length === 0 || rawValues.length > 4) {
|
|
161
|
+
return [unsupportedField(property, authored, ctx)];
|
|
162
|
+
}
|
|
163
|
+
const positions = expandPositionValues(rawValues, ctx);
|
|
164
|
+
const resolvedSlash = positions.some(({ interpretation }) => topLevelSlashIndex(interpretation.resolvedValue) >= 0
|
|
165
|
+
|| interpretation.modifiers.some((modifier) => modifier.kind === "fallback" && topLevelSlashIndex(modifier.value) >= 0));
|
|
166
|
+
if (resolvedSlash)
|
|
167
|
+
return [unsupportedField(property, authored, ctx)];
|
|
168
|
+
const cornerValues = expandFourValueShorthand(positions);
|
|
169
|
+
if (!cornerValues)
|
|
170
|
+
return [unsupportedField(property, authored, ctx)];
|
|
171
|
+
return corners.map((longhand, index) => projectPositionField(longhand, property, cornerValues[index]));
|
|
172
|
+
}
|
|
173
|
+
function projectPositionField(longhand, sourceProperty, value) {
|
|
174
|
+
return projectField({
|
|
175
|
+
property: longhand,
|
|
176
|
+
declaredValue: value.declaredValue,
|
|
177
|
+
sourceProperty,
|
|
178
|
+
interpretation: value.interpretation,
|
|
179
|
+
resolvedValue: value.resolvedValue,
|
|
180
|
+
capability: classifyEditCapability(longhand, value.declaredValue),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function expandSides(property, sides, authored, ctx) {
|
|
184
|
+
const rawValues = splitTopLevelWhitespace(authored);
|
|
185
|
+
if (rawValues.length === 0 || rawValues.length > 4)
|
|
186
|
+
return null;
|
|
187
|
+
const sideValues = expandFourValueShorthand(expandPositionValues(rawValues, ctx));
|
|
188
|
+
if (!sideValues)
|
|
189
|
+
return null;
|
|
190
|
+
return sides.map((longhand, index) => projectPositionField(longhand, property, sideValues[index]));
|
|
191
|
+
}
|
|
192
|
+
function expandGap(property, axes, authored, ctx) {
|
|
193
|
+
const rawValues = splitTopLevelWhitespace(authored);
|
|
194
|
+
const positions = expandPositionValues(rawValues, ctx);
|
|
195
|
+
const axisValues = expandTwoValueShorthand(positions);
|
|
196
|
+
if (!axisValues)
|
|
197
|
+
return null;
|
|
198
|
+
return axes.map((longhand, index) => projectPositionField(longhand, property, axisValues[index]));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Interprets one authored value for a property into a structured projection
|
|
202
|
+
* tree. Returns the projected fields, or a single conservative raw/composite
|
|
203
|
+
* field when the value cannot be decomposed faithfully. The declared order of
|
|
204
|
+
* the families mirrors CSS projection precedence: logical sides, border, font,
|
|
205
|
+
* border-radius corners, gap, physical spacing, then the raw fallback.
|
|
206
|
+
*/
|
|
207
|
+
export function interpretValue(property, authored, ctx) {
|
|
208
|
+
const lower = property.toLowerCase();
|
|
209
|
+
if (lower === "opacity")
|
|
210
|
+
return [rawField(property, authored, ctx)];
|
|
211
|
+
const logicalSides = logicalPhysicalSides(lower, ctx.directionality);
|
|
212
|
+
if (logicalSides) {
|
|
213
|
+
const fields = expandLogicalSides(logicalSides, property, authored, ctx);
|
|
214
|
+
if (fields)
|
|
215
|
+
return fields;
|
|
216
|
+
return [unsupportedField(property, authored, ctx)];
|
|
217
|
+
}
|
|
218
|
+
if (lower === "border" || /^border-(?:top|right|bottom|left)$/.test(lower)) {
|
|
219
|
+
const fields = expandBorder(lower, property, authored, ctx);
|
|
220
|
+
if (fields)
|
|
221
|
+
return fields;
|
|
222
|
+
return [unsupportedField(property, authored, ctx)];
|
|
223
|
+
}
|
|
224
|
+
if (lower === "font") {
|
|
225
|
+
const fields = expandFont(property, authored, ctx);
|
|
226
|
+
if (fields)
|
|
227
|
+
return fields;
|
|
228
|
+
return [unsupportedField(property, authored, ctx)];
|
|
229
|
+
}
|
|
230
|
+
const corners = BORDER_RADIUS_CORNERS[lower];
|
|
231
|
+
if (corners)
|
|
232
|
+
return expandCorners(property, corners, authored, ctx);
|
|
233
|
+
const gapAxes = GAP_AXES[lower];
|
|
234
|
+
if (gapAxes) {
|
|
235
|
+
const fields = expandGap(property, gapAxes, authored, ctx);
|
|
236
|
+
if (fields)
|
|
237
|
+
return fields;
|
|
238
|
+
return [unsupportedField(property, authored, ctx)];
|
|
239
|
+
}
|
|
240
|
+
const sides = SPACING_SIDES[lower];
|
|
241
|
+
if (sides) {
|
|
242
|
+
const fields = expandSides(property, sides, authored, ctx);
|
|
243
|
+
if (fields)
|
|
244
|
+
return fields;
|
|
245
|
+
return [unsupportedField(property, authored, ctx)];
|
|
246
|
+
}
|
|
247
|
+
return [rawField(property, authored, ctx)];
|
|
248
|
+
}
|
|
249
|
+
/** @internal Use the package-level `interpretValue` Interface in production. */
|
|
250
|
+
export const interpretStructuredValue = interpretValue;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token-reference, alias, and modifier interpretation (plan slice 3.2).
|
|
3
|
+
*
|
|
4
|
+
* This is the deep value-semantics Module for token attribution: it turns one
|
|
5
|
+
* CSSOM-authored value into the structured token facts an inspector needs —
|
|
6
|
+
* the primary field token, every referenced token with its origin, the leaf
|
|
7
|
+
* token behind chained aliases, explicit modifiers (fallbacks and alpha), and
|
|
8
|
+
* a `cycle` diagnostic when alias traversal loops.
|
|
9
|
+
*
|
|
10
|
+
* Interface invariants:
|
|
11
|
+
* - the Module never touches the DOM or CSSOM; the token table, local
|
|
12
|
+
* aliases, color/opacity reading, direct-literal attribution, and alias
|
|
13
|
+
* attribution are all explicit inputs (`TokenInterpretationContext`);
|
|
14
|
+
* - the primary token, all referenced tokens, and implementation aliases stay
|
|
15
|
+
* distinct;
|
|
16
|
+
* - alias cycles terminate and surface a `cycle` diagnostic;
|
|
17
|
+
* - arbitrary input does not throw through `interpretTokenValue`;
|
|
18
|
+
* - framework-specific policy — Tailwind `--tw-*` aliases, adapter-derived
|
|
19
|
+
* token origins, direct Tailwind v3 color attribution — is injected by the
|
|
20
|
+
* integration, never encoded here.
|
|
21
|
+
*/
|
|
22
|
+
import type { ColorOpacity, ColorValueFacts, TokenEntry, TokenOrigin, TokenReference, TokenTable, ValueModifier } from "../model/index.js";
|
|
23
|
+
export { extractVarCalls } from "./cssSyntax.js";
|
|
24
|
+
/** The structured token interpretation of one authored CSSOM value. */
|
|
25
|
+
export interface TokenValueInterpretation {
|
|
26
|
+
/** The primary field token, or null when no non-alpha token is primary. */
|
|
27
|
+
tokenName: string | null;
|
|
28
|
+
/** The authored value with the primary reference substituted by its leaf. */
|
|
29
|
+
resolvedValue: string;
|
|
30
|
+
/** Every referenced token (primary, fallback, opacity), deduped, with origin. */
|
|
31
|
+
tokens: TokenReference[];
|
|
32
|
+
/** Normalized opacity when the value carries an alpha component. */
|
|
33
|
+
opacity?: ColorOpacity;
|
|
34
|
+
/** Color-shape facts projected to UI without reparsing authored expressions there. */
|
|
35
|
+
color: ColorValueFacts;
|
|
36
|
+
/** Explicit fallback and alpha modifiers derived from the authored value. */
|
|
37
|
+
modifiers: ValueModifier[];
|
|
38
|
+
/** The token reached after traversing chained aliases from `tokenName`. */
|
|
39
|
+
leafTokenName: string | null;
|
|
40
|
+
/** The alias reference that repeated during traversal, when a cycle exists. */
|
|
41
|
+
cycle?: string;
|
|
42
|
+
}
|
|
43
|
+
/** The interpretation of a token's own value after alias traversal. */
|
|
44
|
+
export interface AliasInnerResult {
|
|
45
|
+
tokenName: string | null;
|
|
46
|
+
resolvedValue: string;
|
|
47
|
+
leafTokenName: string | null;
|
|
48
|
+
cycle?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* How a local alias reference is attributed after its value is resolved.
|
|
52
|
+
* The neutral default authors the alias name itself; the Tailwind `--tw-*`
|
|
53
|
+
* policy (attributing to the catalog token an implementation alias points at)
|
|
54
|
+
* is supplied by the integration.
|
|
55
|
+
*/
|
|
56
|
+
export interface AliasAttribution {
|
|
57
|
+
known: boolean;
|
|
58
|
+
tokenName: string | null;
|
|
59
|
+
resolvedValue: string;
|
|
60
|
+
leafTokenName: string | null;
|
|
61
|
+
cycle?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Facts the token interpretation needs that are not part of the authored text. */
|
|
64
|
+
export interface TokenInterpretationContext {
|
|
65
|
+
/** Resolved token table (custom-property name → entry). */
|
|
66
|
+
table: TokenTable;
|
|
67
|
+
/** Local aliases collected from the selected element's cascade. */
|
|
68
|
+
localAliases?: ReadonlyMap<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* Direct literal attribution: a token entry matched to the authored value
|
|
71
|
+
* before var() interpretation (integration policy, e.g. Tailwind v3 config
|
|
72
|
+
* tokens). Absent when no direct attribution applies.
|
|
73
|
+
*/
|
|
74
|
+
resolveDirectToken?: (value: string) => TokenEntry | undefined;
|
|
75
|
+
/** Token-origin derivation. Default: `entry.origin ?? "project"` (undefined → "runtime"). */
|
|
76
|
+
resolveOrigin?: (entry: TokenEntry | undefined) => TokenOrigin;
|
|
77
|
+
/** Local-alias attribution policy. Default attributes the alias reference itself. */
|
|
78
|
+
resolveAlias?: (ref: string, inner: AliasInnerResult) => AliasAttribution;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Neutral token-origin derivation. Adapter-name heuristics ("tailwind-v3"
|
|
82
|
+
* → "framework", "vanilla-extract" → "project") remain integration policy.
|
|
83
|
+
*/
|
|
84
|
+
export declare function defaultTokenOrigin(entry: TokenEntry | undefined): TokenOrigin;
|
|
85
|
+
/**
|
|
86
|
+
* Interprets the token references, aliases, and modifiers of one authored
|
|
87
|
+
* CSSOM value against explicit token knowledge. Returns the primary token,
|
|
88
|
+
* every referenced token, the leaf token, modifiers, and a cycle diagnostic.
|
|
89
|
+
*/
|
|
90
|
+
export declare function interpretTokenValue(value: string, ctx: TokenInterpretationContext): TokenValueInterpretation;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { interpretColorValue, } from "./colorSemantics.js";
|
|
2
|
+
export { extractVarCalls } from "./cssSyntax.js";
|
|
3
|
+
import { extractVarCalls } from "./cssSyntax.js";
|
|
4
|
+
const EMPTY_LOCAL_ALIASES = new Map();
|
|
5
|
+
/**
|
|
6
|
+
* Neutral token-origin derivation. Adapter-name heuristics ("tailwind-v3"
|
|
7
|
+
* → "framework", "vanilla-extract" → "project") remain integration policy.
|
|
8
|
+
*/
|
|
9
|
+
export function defaultTokenOrigin(entry) {
|
|
10
|
+
if (!entry)
|
|
11
|
+
return "runtime";
|
|
12
|
+
return entry.origin ?? "project";
|
|
13
|
+
}
|
|
14
|
+
function defaultAliasAttribution(ref, inner) {
|
|
15
|
+
return {
|
|
16
|
+
known: true,
|
|
17
|
+
tokenName: ref,
|
|
18
|
+
resolvedValue: inner.resolvedValue,
|
|
19
|
+
leafTokenName: inner.leafTokenName ?? ref,
|
|
20
|
+
cycle: inner.cycle,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function resolveRef(ref, table, visited, localAliases, ctx) {
|
|
24
|
+
if (visited.has(ref)) {
|
|
25
|
+
const entry = table[ref];
|
|
26
|
+
return {
|
|
27
|
+
known: entry !== undefined,
|
|
28
|
+
tokenName: entry ? entry.name : null,
|
|
29
|
+
resolvedValue: entry ? entry.value : `var(${ref})`,
|
|
30
|
+
leafTokenName: entry ? entry.name : null,
|
|
31
|
+
cycle: ref,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const entry = table[ref];
|
|
35
|
+
if (entry) {
|
|
36
|
+
const nextVisited = new Set(visited);
|
|
37
|
+
nextVisited.add(ref);
|
|
38
|
+
const inner = resolveTokenValueInner(entry.value, table, nextVisited, localAliases, ctx);
|
|
39
|
+
return { known: true, tokenName: entry.name, resolvedValue: inner.resolvedValue, leafTokenName: inner.leafTokenName ?? entry.name, cycle: inner.cycle };
|
|
40
|
+
}
|
|
41
|
+
const localValue = localAliases.get(ref);
|
|
42
|
+
if (localValue === undefined) {
|
|
43
|
+
return { known: false, tokenName: null, resolvedValue: `var(${ref})`, leafTokenName: null };
|
|
44
|
+
}
|
|
45
|
+
const nextVisited = new Set(visited);
|
|
46
|
+
nextVisited.add(ref);
|
|
47
|
+
const inner = resolveTokenValueInner(localValue, table, nextVisited, localAliases, ctx);
|
|
48
|
+
return (ctx.resolveAlias ?? defaultAliasAttribution)(ref, inner);
|
|
49
|
+
}
|
|
50
|
+
function resolveTokenValueInner(value, table, visited, localAliases, ctx) {
|
|
51
|
+
const trimmed = value.trim();
|
|
52
|
+
const refs = extractVarCalls(trimmed).map((call) => call.name);
|
|
53
|
+
if (refs.length === 0)
|
|
54
|
+
return { tokenName: null, resolvedValue: trimmed, leafTokenName: null };
|
|
55
|
+
for (const ref of refs) {
|
|
56
|
+
const res = resolveRef(ref, table, visited, localAliases, ctx);
|
|
57
|
+
if (res.known)
|
|
58
|
+
return { tokenName: res.tokenName, resolvedValue: res.resolvedValue, leafTokenName: res.leafTokenName, cycle: res.cycle };
|
|
59
|
+
}
|
|
60
|
+
return { tokenName: null, resolvedValue: trimmed, leafTokenName: null };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Interprets the token references, aliases, and modifiers of one authored
|
|
64
|
+
* CSSOM value against explicit token knowledge. Returns the primary token,
|
|
65
|
+
* every referenced token, the leaf token, modifiers, and a cycle diagnostic.
|
|
66
|
+
*/
|
|
67
|
+
export function interpretTokenValue(value, ctx) {
|
|
68
|
+
const authored = value.trim();
|
|
69
|
+
const table = ctx.table;
|
|
70
|
+
const localAliases = ctx.localAliases ?? EMPTY_LOCAL_ALIASES;
|
|
71
|
+
const resolveOrigin = ctx.resolveOrigin ?? defaultTokenOrigin;
|
|
72
|
+
const calls = extractVarCalls(authored);
|
|
73
|
+
const references = [];
|
|
74
|
+
let firstKnown = null;
|
|
75
|
+
const directToken = ctx.resolveDirectToken?.(authored);
|
|
76
|
+
if (directToken) {
|
|
77
|
+
firstKnown = { tokenName: directToken.name, leafTokenName: directToken.name, resolvedValue: directToken.value };
|
|
78
|
+
references.push({ name: directToken.name, origin: resolveOrigin(directToken) });
|
|
79
|
+
}
|
|
80
|
+
for (const call of calls) {
|
|
81
|
+
const result = resolveRef(call.name, table, new Set(), localAliases, ctx);
|
|
82
|
+
if (result.known) {
|
|
83
|
+
if (!references.some((token) => token.name === result.tokenName)) {
|
|
84
|
+
references.push({
|
|
85
|
+
name: result.tokenName ?? call.name,
|
|
86
|
+
origin: resolveOrigin(table[call.name] ?? table[result.tokenName ?? ""]),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!firstKnown) {
|
|
90
|
+
firstKnown = {
|
|
91
|
+
tokenName: result.tokenName ?? call.name,
|
|
92
|
+
leafTokenName: result.leafTokenName,
|
|
93
|
+
resolvedValue: result.resolvedValue,
|
|
94
|
+
cycle: result.cycle,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (call.fallback) {
|
|
99
|
+
const fallback = call.fallback.trim();
|
|
100
|
+
if (fallback) {
|
|
101
|
+
const fallbackResult = interpretTokenValue(fallback, ctx);
|
|
102
|
+
references.push(...fallbackResult.tokens.filter((token) => !references.some((seen) => seen.name === token.name)));
|
|
103
|
+
if (!firstKnown && fallbackResult.tokenName) {
|
|
104
|
+
firstKnown = {
|
|
105
|
+
tokenName: fallbackResult.tokenName,
|
|
106
|
+
leafTokenName: fallbackResult.leafTokenName,
|
|
107
|
+
resolvedValue: fallbackResult.resolvedValue,
|
|
108
|
+
cycle: fallbackResult.cycle,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const colorContext = {
|
|
115
|
+
tokenTable: table,
|
|
116
|
+
localAliases,
|
|
117
|
+
resolveTokenReference: (value) => resolveComponentReference(value, ctx),
|
|
118
|
+
};
|
|
119
|
+
const authoredColor = interpretColorValue(authored, colorContext);
|
|
120
|
+
const opacity = authoredColor.opacity;
|
|
121
|
+
const modifiers = calls.flatMap((call) => call.fallback ? [{ kind: "fallback", value: call.fallback }] : []);
|
|
122
|
+
if (opacity)
|
|
123
|
+
modifiers.push({ kind: "alpha", value: opacity.value });
|
|
124
|
+
const inner = resolveTokenValueInner(authored, table, new Set(), localAliases, ctx);
|
|
125
|
+
// An alpha variable is still a token reference, but it is not the color
|
|
126
|
+
// token represented by the field. For example, in
|
|
127
|
+
// `rgb(37 99 235 / var(--opacity-muted))`, the color is literal and only
|
|
128
|
+
// the opacity is token-backed. Keep that distinction in `tokenName` so the
|
|
129
|
+
// UI can render a base color chip only when one actually exists.
|
|
130
|
+
const alphaTokenName = opacity?.tokenName;
|
|
131
|
+
const baseKnown = firstKnown && firstKnown.tokenName !== alphaTokenName ? firstKnown : null;
|
|
132
|
+
const baseInner = inner.tokenName && inner.tokenName !== alphaTokenName ? inner : null;
|
|
133
|
+
const primary = baseKnown ?? baseInner;
|
|
134
|
+
const resolvedColor = primary?.resolvedValue
|
|
135
|
+
? interpretColorValue(primary.resolvedValue, colorContext)
|
|
136
|
+
: null;
|
|
137
|
+
return {
|
|
138
|
+
tokenName: primary?.tokenName ?? (alphaTokenName ? null : firstKnown?.tokenName ?? inner.tokenName),
|
|
139
|
+
resolvedValue: primary?.resolvedValue ?? (alphaTokenName ? authored : inner.resolvedValue),
|
|
140
|
+
tokens: references,
|
|
141
|
+
opacity,
|
|
142
|
+
color: {
|
|
143
|
+
hasEmbeddedAlpha: authoredColor.facts.hasEmbeddedAlpha || Boolean(resolvedColor?.facts.hasEmbeddedAlpha),
|
|
144
|
+
isExpression: authoredColor.facts.isExpression,
|
|
145
|
+
opacityEditable: authoredColor.facts.opacityEditable && !resolvedColor?.facts.hasEmbeddedAlpha,
|
|
146
|
+
},
|
|
147
|
+
modifiers,
|
|
148
|
+
leafTokenName: primary?.leafTokenName ?? primary?.tokenName ?? null,
|
|
149
|
+
cycle: primary?.cycle,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Resolves a `var()` component of a color expression (for example an opacity
|
|
154
|
+
* token) through the same interpretation context as the authored value. This
|
|
155
|
+
* is what the color Module's `interpretColorOpacity` uses to attribute
|
|
156
|
+
* token-backed alpha components, keeping alias and framework attribution in
|
|
157
|
+
* the token interpretation.
|
|
158
|
+
*/
|
|
159
|
+
function resolveComponentReference(value, ctx) {
|
|
160
|
+
const calls = extractVarCalls(value);
|
|
161
|
+
if (calls.length === 0)
|
|
162
|
+
return null;
|
|
163
|
+
const table = ctx.table;
|
|
164
|
+
const localAliases = ctx.localAliases ?? EMPTY_LOCAL_ALIASES;
|
|
165
|
+
const resolveOrigin = ctx.resolveOrigin ?? defaultTokenOrigin;
|
|
166
|
+
const references = [];
|
|
167
|
+
let firstKnown = null;
|
|
168
|
+
for (const call of calls) {
|
|
169
|
+
const result = resolveRef(call.name, table, new Set(), localAliases, ctx);
|
|
170
|
+
if (result.known) {
|
|
171
|
+
if (!references.some((token) => token.name === result.tokenName)) {
|
|
172
|
+
references.push({
|
|
173
|
+
name: result.tokenName ?? call.name,
|
|
174
|
+
origin: resolveOrigin(table[call.name] ?? table[result.tokenName ?? ""]),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (!firstKnown) {
|
|
178
|
+
firstKnown = { tokenName: result.tokenName ?? call.name, resolvedValue: result.resolvedValue };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (call.fallback) {
|
|
182
|
+
const fallback = call.fallback.trim();
|
|
183
|
+
if (fallback) {
|
|
184
|
+
const fallbackResult = interpretTokenValue(fallback, ctx);
|
|
185
|
+
references.push(...fallbackResult.tokens.filter((token) => !references.some((seen) => seen.name === token.name)));
|
|
186
|
+
if (!firstKnown && fallbackResult.tokenName) {
|
|
187
|
+
firstKnown = { tokenName: fallbackResult.tokenName, resolvedValue: fallbackResult.resolvedValue };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return firstKnown ? { tokenName: firstKnown.tokenName, resolvedValue: firstKnown.resolvedValue, tokens: references } : null;
|
|
193
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Canonical ambient transport contract published by the Vite Adapter. */
|
|
2
|
+
declare module "virtual:design-tokens" {
|
|
3
|
+
export type {
|
|
4
|
+
TokenCatalogDiagnostic,
|
|
5
|
+
TokenContext,
|
|
6
|
+
TokenContextWrapper,
|
|
7
|
+
TokenContextWrapperKind,
|
|
8
|
+
TokenDeclaration,
|
|
9
|
+
TokenDefinition,
|
|
10
|
+
TokenEntry,
|
|
11
|
+
} from "./model/index.js";
|
|
12
|
+
export const tokens: TokenEntry[];
|
|
13
|
+
export const tokenCatalog: TokenDefinition[];
|
|
14
|
+
export const tokenDiagnostics: TokenCatalogDiagnostic[];
|
|
15
|
+
export const tokenGeneration: string;
|
|
16
|
+
export const nudgeUiProjectId: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NudgeUiRuntimeConfig } from "../../inspector/clientManifest.js";
|
|
2
|
+
interface AstroRuntimeKnowledge {
|
|
3
|
+
readonly projectId: string;
|
|
4
|
+
readonly tokenCatalog: NudgeUiRuntimeConfig["tokenCatalog"];
|
|
5
|
+
readonly tokens: NudgeUiRuntimeConfig["tokens"];
|
|
6
|
+
readonly tokenDiagnostics: NudgeUiRuntimeConfig["tokenDiagnostics"];
|
|
7
|
+
readonly tokenGeneration: string;
|
|
8
|
+
readonly componentContracts: NudgeUiRuntimeConfig["componentContracts"];
|
|
9
|
+
}
|
|
10
|
+
/** Builds the runtime knowledge shared by both Astro client transports. */
|
|
11
|
+
export declare function createAstroRuntimeConfig(knowledge: AstroRuntimeKnowledge): NudgeUiRuntimeConfig;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { detectStylingSystem, } from "../../inspector/clientManifest.js";
|
|
2
|
+
const ASTRO_SCOPING_SELECTOR_PATTERN = "\\[data-astro-cid-[^\\]]*\\]|\\.astro-[a-zA-Z0-9_-]+";
|
|
3
|
+
const ASTRO_SOURCE_COORDINATES = {
|
|
4
|
+
exactCidPrefixes: ["astro:"],
|
|
5
|
+
exactFileExtensions: [".astro", ".html", ".htm"],
|
|
6
|
+
};
|
|
7
|
+
/** Builds the runtime knowledge shared by both Astro client transports. */
|
|
8
|
+
export function createAstroRuntimeConfig(knowledge) {
|
|
9
|
+
return {
|
|
10
|
+
projectId: knowledge.projectId,
|
|
11
|
+
host: "astro",
|
|
12
|
+
framework: "Astro",
|
|
13
|
+
stylingSystem: detectStylingSystem(knowledge.tokens),
|
|
14
|
+
capabilities: {
|
|
15
|
+
canvas: false,
|
|
16
|
+
componentSemantics: true,
|
|
17
|
+
sourceCoordinates: ASTRO_SOURCE_COORDINATES,
|
|
18
|
+
scopingSelectorPattern: ASTRO_SCOPING_SELECTOR_PATTERN,
|
|
19
|
+
},
|
|
20
|
+
tokenCatalog: knowledge.tokenCatalog,
|
|
21
|
+
tokens: knowledge.tokens,
|
|
22
|
+
tokenDiagnostics: knowledge.tokenDiagnostics,
|
|
23
|
+
tokenGeneration: knowledge.tokenGeneration,
|
|
24
|
+
componentContracts: knowledge.componentContracts,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
interface ClientAssetDependencies {
|
|
3
|
+
readonly resolveClientPath?: () => string;
|
|
4
|
+
readonly readClientFile?: (path: string) => Promise<Buffer>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Creates the Astro handler for the shared, immutable inspector client.
|
|
8
|
+
* Resolution and reads remain lazy so disabled and production integrations do
|
|
9
|
+
* not depend on a development asset being present.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAstroClientAssetHandler(dependencies?: ClientAssetDependencies): (request: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
12
|
+
export {};
|