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,103 @@
|
|
|
1
|
+
import { getActiveStyleState } from "../shell/styleState.js";
|
|
2
|
+
import { getStateStyleValue } from "../shell/stateValue.js";
|
|
3
|
+
import { getElementComputedStyle } from "../runtime/domRealm.js";
|
|
4
|
+
import { getBrowserCssInspection } from "../inspection/browserCssInspectionRegistry.js";
|
|
5
|
+
const DEFAULT_LAYOUT_VALUES = {
|
|
6
|
+
width: "auto",
|
|
7
|
+
height: "auto",
|
|
8
|
+
"min-width": "0",
|
|
9
|
+
"min-height": "0",
|
|
10
|
+
"max-width": "none",
|
|
11
|
+
"max-height": "none",
|
|
12
|
+
"aspect-ratio": "auto",
|
|
13
|
+
top: "auto",
|
|
14
|
+
right: "auto",
|
|
15
|
+
bottom: "auto",
|
|
16
|
+
left: "auto",
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns the authored CSS value when one is available, without replacing
|
|
20
|
+
* keywords such as `auto` with the browser's used pixel value.
|
|
21
|
+
*/
|
|
22
|
+
export function meaningfulLayoutValue(el, property) {
|
|
23
|
+
const authored = readAuthoredStyleValue(el, property);
|
|
24
|
+
if (authored)
|
|
25
|
+
return authored;
|
|
26
|
+
const computed = getStateStyleValue(el, property);
|
|
27
|
+
// Aspect-ratio's computed serialization remains a meaningful authored-like
|
|
28
|
+
// value, unlike used dimensions such as a block's computed pixel width.
|
|
29
|
+
if (property === "aspect-ratio" && computed && computed !== "auto")
|
|
30
|
+
return computed;
|
|
31
|
+
return DEFAULT_LAYOUT_VALUES[property] ?? computed;
|
|
32
|
+
}
|
|
33
|
+
export function readAuthoredStyleValue(el, property) {
|
|
34
|
+
try {
|
|
35
|
+
const state = getActiveStyleState();
|
|
36
|
+
const row = getBrowserCssInspection(el.ownerDocument ?? document)
|
|
37
|
+
.inspect(el, { state }).properties
|
|
38
|
+
.find((candidate) => candidate.property === property);
|
|
39
|
+
const authored = row?.authored ?? row?.declaredValue;
|
|
40
|
+
if (authored?.trim())
|
|
41
|
+
return authored.trim();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// CSSOM can reject cross-origin stylesheets. Fall through to explicit
|
|
45
|
+
// inline CSS and the computed-value fallback used by the field layer.
|
|
46
|
+
}
|
|
47
|
+
const inline = el.style.getPropertyValue(property).trim();
|
|
48
|
+
return inline || null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Shorthands that also author the keyed longhand when present in a `style`
|
|
52
|
+
* attribute. Managed-stylesheet previews lose the cascade to any of these,
|
|
53
|
+
* so fields must treat the longhand as inline-blocked either way.
|
|
54
|
+
*/
|
|
55
|
+
const INLINE_SHORTHAND_SOURCES = {
|
|
56
|
+
"row-gap": ["gap"],
|
|
57
|
+
"column-gap": ["gap"],
|
|
58
|
+
"margin-top": ["margin"],
|
|
59
|
+
"margin-right": ["margin"],
|
|
60
|
+
"margin-bottom": ["margin"],
|
|
61
|
+
"margin-left": ["margin"],
|
|
62
|
+
"padding-top": ["padding"],
|
|
63
|
+
"padding-right": ["padding"],
|
|
64
|
+
"padding-bottom": ["padding"],
|
|
65
|
+
"padding-left": ["padding"],
|
|
66
|
+
top: ["inset"],
|
|
67
|
+
right: ["inset"],
|
|
68
|
+
bottom: ["inset"],
|
|
69
|
+
left: ["inset"],
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Returns the inline-authored source when `el` carries the property — or a
|
|
73
|
+
* shorthand that sets it — in its `style` attribute. Managed previews can
|
|
74
|
+
* never beat inline styles in the cascade, so a non-null result means the
|
|
75
|
+
* field must present as blocked instead of accepting edits that silently
|
|
76
|
+
* revert (see `verifyPreview`'s "inline-style" conflict).
|
|
77
|
+
*/
|
|
78
|
+
export function inlineAuthoredValue(el, property) {
|
|
79
|
+
const direct = el.style.getPropertyValue(property).trim();
|
|
80
|
+
if (direct)
|
|
81
|
+
return `${property}: ${direct}`;
|
|
82
|
+
for (const shorthand of INLINE_SHORTHAND_SOURCES[property] ?? []) {
|
|
83
|
+
const value = el.style.getPropertyValue(shorthand).trim();
|
|
84
|
+
if (value)
|
|
85
|
+
return `${shorthand}: ${value}`;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Reads both representations needed by a layout editor. Authored CSS is the
|
|
91
|
+
* editable source of truth; computed CSS is only the browser preview/fallback.
|
|
92
|
+
*/
|
|
93
|
+
export function getLayoutValue(el, property) {
|
|
94
|
+
const authored = readAuthoredStyleValue(el, property);
|
|
95
|
+
let computed = "";
|
|
96
|
+
try {
|
|
97
|
+
computed = getElementComputedStyle(el).getPropertyValue(property).trim();
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
computed = getStateStyleValue(el, property);
|
|
101
|
+
}
|
|
102
|
+
return { property, authored, computed };
|
|
103
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type NudgeDirection = -1 | 1;
|
|
2
|
+
/**
|
|
3
|
+
* Returns a nudged CSS numeric literal, or null when the value is not a
|
|
4
|
+
* standalone number that the inspector can safely edit.
|
|
5
|
+
*/
|
|
6
|
+
export declare function nudgeCssValue(property: string, rawValue: string, direction: NudgeDirection, large?: boolean): string | null;
|
|
7
|
+
/** Returns a clamped opacity percentage nudged by 1%, or 10% with Shift. */
|
|
8
|
+
export declare function nudgeOpacityValue(rawValue: string, direction: NudgeDirection, large?: boolean): string | null;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { completeCssValue, CSS_NUMBER_SOURCE } from "./completeCssValue.js";
|
|
2
|
+
import { valuePolicyFor } from "./valuePolicy.js";
|
|
3
|
+
const CSS_NUMBER = new RegExp(`^(?:${CSS_NUMBER_SOURCE})$`, "i");
|
|
4
|
+
const CSS_NUMERIC_LITERAL = new RegExp(`^(${CSS_NUMBER_SOURCE})(px|rem|em|%)?$`, "i");
|
|
5
|
+
/**
|
|
6
|
+
* Returns a nudged CSS numeric literal, or null when the value is not a
|
|
7
|
+
* standalone number that the inspector can safely edit.
|
|
8
|
+
*/
|
|
9
|
+
export function nudgeCssValue(property, rawValue, direction, large = false) {
|
|
10
|
+
const normalised = normaliseForNudge(property, rawValue);
|
|
11
|
+
const parsed = parseNumericLiteral(normalised);
|
|
12
|
+
if (!parsed)
|
|
13
|
+
return null;
|
|
14
|
+
const step = nudgeStep(property, parsed.unit, large);
|
|
15
|
+
if (step === null)
|
|
16
|
+
return null;
|
|
17
|
+
let next = parsed.number + direction * step;
|
|
18
|
+
if (isFontWeight(property))
|
|
19
|
+
next = Math.min(1000, Math.max(1, next));
|
|
20
|
+
if (isLineHeight(property))
|
|
21
|
+
next = Math.max(0, next);
|
|
22
|
+
return `${formatNumber(next)}${parsed.unit}`;
|
|
23
|
+
}
|
|
24
|
+
/** Returns a clamped opacity percentage nudged by 1%, or 10% with Shift. */
|
|
25
|
+
export function nudgeOpacityValue(rawValue, direction, large = false) {
|
|
26
|
+
const parsed = parseNumericLiteral(rawValue);
|
|
27
|
+
if (!parsed || parsed.unit !== "%")
|
|
28
|
+
return null;
|
|
29
|
+
const step = large ? 10 : 1;
|
|
30
|
+
const next = Math.min(100, Math.max(0, parsed.number + direction * step));
|
|
31
|
+
return `${formatNumber(next)}%`;
|
|
32
|
+
}
|
|
33
|
+
function normaliseForNudge(property, rawValue) {
|
|
34
|
+
const value = rawValue.trim();
|
|
35
|
+
if (!CSS_NUMBER.test(value))
|
|
36
|
+
return value;
|
|
37
|
+
const normalised = completeCssValue(value, valuePolicyFor(isLineHeight(property) ? "line-height" : property));
|
|
38
|
+
return isLineHeight(property) && normalised === "0" ? "0%" : normalised;
|
|
39
|
+
}
|
|
40
|
+
function parseNumericLiteral(value) {
|
|
41
|
+
const match = CSS_NUMERIC_LITERAL.exec(value.trim());
|
|
42
|
+
if (!match)
|
|
43
|
+
return null;
|
|
44
|
+
const number = Number(match[1]);
|
|
45
|
+
if (!Number.isFinite(number))
|
|
46
|
+
return null;
|
|
47
|
+
// SAFETY: the regex guarantees match[2] is one of the known CSS unit strings.
|
|
48
|
+
const unit = (match[2] ?? "").toLowerCase();
|
|
49
|
+
return { number, unit };
|
|
50
|
+
}
|
|
51
|
+
function nudgeStep(property, unit, large) {
|
|
52
|
+
if (isFontWeight(property))
|
|
53
|
+
return large ? 800 : 100;
|
|
54
|
+
if (isLineHeight(property) && unit === "%")
|
|
55
|
+
return large ? 80 : 10;
|
|
56
|
+
if (unit === "px" || unit === "%" || unit === "")
|
|
57
|
+
return large ? 8 : 1;
|
|
58
|
+
if (unit === "rem" || unit === "em")
|
|
59
|
+
return large ? 1 : 0.125;
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function isLineHeight(property) {
|
|
63
|
+
return property === "line-height" || property.includes("line-height");
|
|
64
|
+
}
|
|
65
|
+
function isFontWeight(property) {
|
|
66
|
+
return property === "font-weight" || property.includes("font-weight");
|
|
67
|
+
}
|
|
68
|
+
function formatNumber(value) {
|
|
69
|
+
const rounded = Number(value.toFixed(12));
|
|
70
|
+
return Object.is(rounded, -0) ? "0" : String(rounded);
|
|
71
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ResolvedProperty } from "../../css/model/index.js";
|
|
2
|
+
/** Finds the resolved row for one CSS property, or null when it is absent. */
|
|
3
|
+
export declare function findTokenRow(rows: readonly ResolvedProperty[], property: string): ResolvedProperty | null;
|
|
4
|
+
/**
|
|
5
|
+
* Source provenance for an edit, taken from the row that produced it. Omitted
|
|
6
|
+
* when the row carries no authored origin, so the caller sends no metadata.
|
|
7
|
+
*/
|
|
8
|
+
export declare function metadataFor(row: ResolvedProperty | null | undefined): {
|
|
9
|
+
sourceProperty: string;
|
|
10
|
+
sourceAuthoredValue: string;
|
|
11
|
+
} | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Finds the resolved row for one CSS property, or null when it is absent. */
|
|
2
|
+
export function findTokenRow(rows, property) {
|
|
3
|
+
return rows.find((row) => row.property === property) ?? null;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Source provenance for an edit, taken from the row that produced it. Omitted
|
|
7
|
+
* when the row carries no authored origin, so the caller sends no metadata.
|
|
8
|
+
*/
|
|
9
|
+
export function metadataFor(row) {
|
|
10
|
+
return row?.sourceProperty
|
|
11
|
+
? { sourceProperty: row.sourceProperty, sourceAuthoredValue: row.authored ?? row.declaredValue }
|
|
12
|
+
: undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes the small amount of CSS value semantics the inspector can safely
|
|
3
|
+
* assist with. Values outside these policies remain raw CSS.
|
|
4
|
+
*/
|
|
5
|
+
export type CssUnit = "px" | "rem" | "em" | "%" | "";
|
|
6
|
+
export type ValuePolicy = {
|
|
7
|
+
kind: "raw" | "number";
|
|
8
|
+
defaultUnit: null;
|
|
9
|
+
allowedUnits: readonly [];
|
|
10
|
+
} | {
|
|
11
|
+
kind: "unit";
|
|
12
|
+
defaultUnit: CssUnit;
|
|
13
|
+
allowedUnits: readonly CssUnit[];
|
|
14
|
+
} | {
|
|
15
|
+
kind: "line-height";
|
|
16
|
+
defaultUnit: "%";
|
|
17
|
+
allowedUnits: readonly ["%", "px", ""];
|
|
18
|
+
};
|
|
19
|
+
/** Returns the default and supported units for an editable CSS property. */
|
|
20
|
+
export declare function valuePolicyFor(property: string): ValuePolicy;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const RAW_VALUE = { kind: "raw", defaultUnit: null, allowedUnits: [] };
|
|
2
|
+
const NUMBER_VALUE = { kind: "number", defaultUnit: null, allowedUnits: [] };
|
|
3
|
+
const PIXEL_LENGTH = {
|
|
4
|
+
kind: "unit",
|
|
5
|
+
defaultUnit: "px",
|
|
6
|
+
allowedUnits: ["px", "rem", "em", "%"],
|
|
7
|
+
};
|
|
8
|
+
const BORDER_WIDTH = {
|
|
9
|
+
kind: "unit",
|
|
10
|
+
defaultUnit: "px",
|
|
11
|
+
allowedUnits: ["px", "rem", "em"],
|
|
12
|
+
};
|
|
13
|
+
const FONT_SIZE = {
|
|
14
|
+
kind: "unit",
|
|
15
|
+
defaultUnit: "px",
|
|
16
|
+
allowedUnits: ["px", "rem", "em", "%"],
|
|
17
|
+
};
|
|
18
|
+
const LINE_HEIGHT = {
|
|
19
|
+
kind: "line-height",
|
|
20
|
+
defaultUnit: "%",
|
|
21
|
+
allowedUnits: ["%", "px", ""],
|
|
22
|
+
};
|
|
23
|
+
const LETTER_SPACING = {
|
|
24
|
+
kind: "unit",
|
|
25
|
+
defaultUnit: "em",
|
|
26
|
+
allowedUnits: ["em"],
|
|
27
|
+
};
|
|
28
|
+
const FLEX_BASIS = {
|
|
29
|
+
kind: "unit",
|
|
30
|
+
defaultUnit: "px",
|
|
31
|
+
allowedUnits: ["px", "%"],
|
|
32
|
+
};
|
|
33
|
+
const NUMBER_PROPERTIES = new Set(["flex-grow", "flex-shrink", "order", "font-weight"]);
|
|
34
|
+
const PIXEL_LENGTH_PROPERTIES = new Set([
|
|
35
|
+
"margin",
|
|
36
|
+
"margin-top",
|
|
37
|
+
"margin-right",
|
|
38
|
+
"margin-bottom",
|
|
39
|
+
"margin-left",
|
|
40
|
+
"padding",
|
|
41
|
+
"padding-top",
|
|
42
|
+
"padding-right",
|
|
43
|
+
"padding-bottom",
|
|
44
|
+
"padding-left",
|
|
45
|
+
"row-gap",
|
|
46
|
+
"column-gap",
|
|
47
|
+
"gap",
|
|
48
|
+
"top",
|
|
49
|
+
"right",
|
|
50
|
+
"bottom",
|
|
51
|
+
"left",
|
|
52
|
+
"inset",
|
|
53
|
+
"inset-block",
|
|
54
|
+
"inset-inline",
|
|
55
|
+
"width",
|
|
56
|
+
"height",
|
|
57
|
+
"min-width",
|
|
58
|
+
"min-height",
|
|
59
|
+
"max-width",
|
|
60
|
+
"max-height",
|
|
61
|
+
"border-radius",
|
|
62
|
+
]);
|
|
63
|
+
/** Returns the default and supported units for an editable CSS property. */
|
|
64
|
+
export function valuePolicyFor(property) {
|
|
65
|
+
if (NUMBER_PROPERTIES.has(property))
|
|
66
|
+
return NUMBER_VALUE;
|
|
67
|
+
if (property === "font-size")
|
|
68
|
+
return FONT_SIZE;
|
|
69
|
+
if (property === "line-height")
|
|
70
|
+
return LINE_HEIGHT;
|
|
71
|
+
if (property === "letter-spacing")
|
|
72
|
+
return LETTER_SPACING;
|
|
73
|
+
if (property === "flex-basis")
|
|
74
|
+
return FLEX_BASIS;
|
|
75
|
+
if (/^border(?:-(?:top|right|bottom|left))?-width$/.test(property))
|
|
76
|
+
return BORDER_WIDTH;
|
|
77
|
+
if (/^(?:inset|margin|padding)-(?:horizontal|vertical)$/.test(property))
|
|
78
|
+
return PIXEL_LENGTH;
|
|
79
|
+
if (PIXEL_LENGTH_PROPERTIES.has(property))
|
|
80
|
+
return PIXEL_LENGTH;
|
|
81
|
+
return RAW_VALUE;
|
|
82
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test and conformance helpers for validating the inspector through a
|
|
3
|
+
* consumer-facing entry point. Keep these exports out of the runtime entry.
|
|
4
|
+
*/
|
|
5
|
+
export { assertConformanceFixture, runConformanceFixture } from "./conformance/fixture.js";
|
|
6
|
+
export type { ConformanceFixture, ConformanceResult, ConformancePropertyExpectation, ConformanceProjectionExpectation, ConformanceProjectionFieldExpectation, } from "./conformance/fixture.js";
|
|
7
|
+
export { BORDER_CASES } from "./conformance/borderCases.js";
|
|
8
|
+
export { COLOR_CASES } from "./conformance/colorCases.js";
|
|
9
|
+
export { SPACING_CASES } from "./conformance/spacingCases.js";
|
|
10
|
+
export { TYPOGRAPHY_CASES } from "./conformance/typographyCases.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test and conformance helpers for validating the inspector through a
|
|
3
|
+
* consumer-facing entry point. Keep these exports out of the runtime entry.
|
|
4
|
+
*/
|
|
5
|
+
export { assertConformanceFixture, runConformanceFixture } from "./conformance/fixture.js";
|
|
6
|
+
export { BORDER_CASES } from "./conformance/borderCases.js";
|
|
7
|
+
export { COLOR_CASES } from "./conformance/colorCases.js";
|
|
8
|
+
export { SPACING_CASES } from "./conformance/spacingCases.js";
|
|
9
|
+
export { TYPOGRAPHY_CASES } from "./conformance/typographyCases.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactElement } from "react";
|
|
2
|
+
export type TokenChipSize = "default" | "small";
|
|
3
|
+
export interface TokenChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
size?: TokenChipSize;
|
|
5
|
+
"data-test"?: string;
|
|
6
|
+
"data-group"?: string;
|
|
7
|
+
}
|
|
8
|
+
interface TokenChipSlotProps extends HTMLAttributes<HTMLSpanElement> {
|
|
9
|
+
"data-test"?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function TokenChipRoot({ size, className, children, ...props }: TokenChipProps): ReactElement;
|
|
12
|
+
declare function TokenChipPicker({ className, children, ...props }: TokenChipSlotProps): ReactElement;
|
|
13
|
+
declare function TokenChipLabel({ className, children, ...props }: TokenChipSlotProps): ReactElement;
|
|
14
|
+
declare function TokenChipAction({ className, children, ...props }: TokenChipSlotProps): ReactElement;
|
|
15
|
+
/**
|
|
16
|
+
* Layout for a token's selected value. Callers compose the picker and actions
|
|
17
|
+
* so their interaction semantics remain independent of the chip's visuals.
|
|
18
|
+
*/
|
|
19
|
+
export declare const TokenChip: typeof TokenChipRoot & {
|
|
20
|
+
Picker: typeof TokenChipPicker;
|
|
21
|
+
Label: typeof TokenChipLabel;
|
|
22
|
+
Action: typeof TokenChipAction;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TokenLabel } from "./TokenLabel.js";
|
|
3
|
+
function TokenChipRoot({ size = "default", className, children, ...props }) {
|
|
4
|
+
return (_jsx("span", { ...props, className: `token-chip token-chip--${size}${className ? ` ${className}` : ""}`, children: children }));
|
|
5
|
+
}
|
|
6
|
+
function TokenChipPicker({ className, children, ...props }) {
|
|
7
|
+
return (_jsx("span", { ...props, className: `token-chip__picker${className ? ` ${className}` : ""}`, children: children }));
|
|
8
|
+
}
|
|
9
|
+
function TokenChipLabel({ className, children, ...props }) {
|
|
10
|
+
return (_jsx(TokenLabel, { ...props, className: `token-chip__label${className ? ` ${className}` : ""}`, children: children }));
|
|
11
|
+
}
|
|
12
|
+
function TokenChipAction({ className, children, ...props }) {
|
|
13
|
+
return (_jsx("span", { ...props, className: `token-chip__action${className ? ` ${className}` : ""}`, children: children }));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Layout for a token's selected value. Callers compose the picker and actions
|
|
17
|
+
* so their interaction semantics remain independent of the chip's visuals.
|
|
18
|
+
*/
|
|
19
|
+
export const TokenChip = Object.assign(TokenChipRoot, {
|
|
20
|
+
Picker: TokenChipPicker,
|
|
21
|
+
Label: TokenChipLabel,
|
|
22
|
+
Action: TokenChipAction,
|
|
23
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { TokenEntry } from "../../css/model/index.js";
|
|
3
|
+
import type { ResolvedProperty } from "../../css/model/index.js";
|
|
4
|
+
import type { CssValueGrammar, TokenSemanticSlot } from "../../css/value-semantics/index.js";
|
|
5
|
+
export interface TokenDropdownProps {
|
|
6
|
+
row: ResolvedProperty;
|
|
7
|
+
domElement: HTMLElement;
|
|
8
|
+
entries: TokenEntry[];
|
|
9
|
+
slot?: TokenSemanticSlot;
|
|
10
|
+
grammar?: CssValueGrammar;
|
|
11
|
+
onAfterEdit?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function TokenDropdown(props: TokenDropdownProps): ReactElement;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { swapToken, promoteToToken } from "./editActions.js";
|
|
4
|
+
import { Select } from "../ui/Select.js";
|
|
5
|
+
import { selectTokens, TOKEN_GROUP_LABELS, TOKEN_GROUP_ORDER, } from "../../css/value-semantics/index.js";
|
|
6
|
+
function groupTokens(entries) {
|
|
7
|
+
const map = new Map();
|
|
8
|
+
for (const entry of entries) {
|
|
9
|
+
const group = entry.group;
|
|
10
|
+
let list = map.get(group);
|
|
11
|
+
if (!list) {
|
|
12
|
+
list = [];
|
|
13
|
+
map.set(group, list);
|
|
14
|
+
}
|
|
15
|
+
list.push(entry);
|
|
16
|
+
}
|
|
17
|
+
return map;
|
|
18
|
+
}
|
|
19
|
+
export function TokenDropdown(props) {
|
|
20
|
+
const { row, domElement, entries, slot, grammar, onAfterEdit } = props;
|
|
21
|
+
const candidates = useMemo(() => selectTokens({
|
|
22
|
+
element: domElement,
|
|
23
|
+
property: row.property,
|
|
24
|
+
slot,
|
|
25
|
+
entries,
|
|
26
|
+
currentToken: row.tokenName,
|
|
27
|
+
grammar,
|
|
28
|
+
}).candidates, [domElement, entries, grammar, row.property, row.tokenName, slot]);
|
|
29
|
+
const grouped = useMemo(() => groupTokens(candidates), [candidates]);
|
|
30
|
+
function handleSelect(value) {
|
|
31
|
+
const chosen = candidates.find(({ entry }) => entry.name === value)?.entry;
|
|
32
|
+
if (!chosen)
|
|
33
|
+
return;
|
|
34
|
+
const oldToken = row.tokenName
|
|
35
|
+
? entries.find((entry) => entry.name === row.tokenName || entry.cssName === row.tokenName) ?? null
|
|
36
|
+
: null;
|
|
37
|
+
swapToken(domElement, row.property, chosen, oldToken);
|
|
38
|
+
onAfterEdit?.();
|
|
39
|
+
}
|
|
40
|
+
function handlePromote(value) {
|
|
41
|
+
const chosen = entries.find((entry) => entry.name === value);
|
|
42
|
+
if (!chosen)
|
|
43
|
+
return;
|
|
44
|
+
promoteToToken(domElement, row.property, chosen);
|
|
45
|
+
onAfterEdit?.();
|
|
46
|
+
}
|
|
47
|
+
const hasToken = row.tokenName !== null;
|
|
48
|
+
const selectValue = row.tokenName ?? "";
|
|
49
|
+
const selectGroups = TOKEN_GROUP_ORDER.flatMap((group) => {
|
|
50
|
+
const list = grouped.get(group);
|
|
51
|
+
if (!list || list.length === 0)
|
|
52
|
+
return [];
|
|
53
|
+
return [{
|
|
54
|
+
label: TOKEN_GROUP_LABELS[group],
|
|
55
|
+
options: list.map(({ entry }) => ({ value: entry.name, label: entry.name })),
|
|
56
|
+
}];
|
|
57
|
+
});
|
|
58
|
+
return (_jsx("span", { className: "token-dropdown", "data-test": "token-dropdown", children: hasToken ? (_jsx(Select, { "data-test": "token-select", value: selectValue, groups: selectGroups, searchable: true, searchPlaceholder: "Search", searchAriaLabel: "Search tokens", onValueChange: handleSelect })) : (_jsx("span", { className: "token-promote", "data-test": "token-promote", children: _jsx(Select, { "data-test": "token-promote-select", value: "", placeholder: "Replace with token\u2026", groups: selectGroups, searchable: true, searchPlaceholder: "Search", searchAriaLabel: "Search tokens", onValueChange: handlePromote }) })) }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { TokenEntry } from "../../css/model/index.js";
|
|
3
|
+
import type { AtRuleContext, ColorOpacity, ColorValueFacts, ResolvedProperty } from "../../css/model/index.js";
|
|
4
|
+
import type { TokenSemanticSlot } from "../../css/value-semantics/index.js";
|
|
5
|
+
import type { StyleEditMetadata } from "./editActions.js";
|
|
6
|
+
import { type EditTarget } from "../selection/editTarget.js";
|
|
7
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
8
|
+
export interface TokenValueFieldProps {
|
|
9
|
+
property: string;
|
|
10
|
+
domElement?: HTMLElement;
|
|
11
|
+
semanticSlot?: TokenSemanticSlot;
|
|
12
|
+
committedValue: string;
|
|
13
|
+
resolvedValue?: string;
|
|
14
|
+
activeTokenName?: string | null;
|
|
15
|
+
entries: TokenEntry[];
|
|
16
|
+
suggestions?: ReadonlyArray<string>;
|
|
17
|
+
inputDataTest?: string;
|
|
18
|
+
allowedTokenNames?: ReadonlySet<string>;
|
|
19
|
+
isColor?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
mixed?: boolean;
|
|
22
|
+
formatRawValue?: (value: string) => string;
|
|
23
|
+
onCommitRaw(value: string): void;
|
|
24
|
+
onSelectToken(token: TokenEntry): boolean | void;
|
|
25
|
+
onUnlink(value: string): void;
|
|
26
|
+
/** Referenced tokens used for raw color-field behavior; not rendered inline. */
|
|
27
|
+
attributionTokens?: string[];
|
|
28
|
+
leading?: ReactNode;
|
|
29
|
+
trailing?: ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
opacity?: ColorOpacity;
|
|
33
|
+
color?: ColorValueFacts;
|
|
34
|
+
onCommitOpacity?(value: string): boolean | void;
|
|
35
|
+
atRules?: readonly AtRuleContext[];
|
|
36
|
+
chipVariant?: "default" | "small";
|
|
37
|
+
}
|
|
38
|
+
export interface TokenFieldProps {
|
|
39
|
+
property: string;
|
|
40
|
+
semanticSlot?: TokenSemanticSlot;
|
|
41
|
+
tokenRow?: ResolvedProperty | null;
|
|
42
|
+
selection?: StyleSelection | null;
|
|
43
|
+
initialValue?: string;
|
|
44
|
+
/** Optional normalized value shown when an authored row is not token-backed. */
|
|
45
|
+
displayValue?: string;
|
|
46
|
+
domElement: HTMLElement;
|
|
47
|
+
/** Optional group target. `domElement` remains the primary inspection node. */
|
|
48
|
+
editTarget?: EditTarget;
|
|
49
|
+
entries: TokenEntry[];
|
|
50
|
+
suggestions?: ReadonlyArray<string>;
|
|
51
|
+
inputDataTest?: string;
|
|
52
|
+
onAfterEdit?: () => void;
|
|
53
|
+
editMetadata?: StyleEditMetadata;
|
|
54
|
+
leading?: ReactNode;
|
|
55
|
+
trailing?: ReactNode;
|
|
56
|
+
className?: string;
|
|
57
|
+
label?: string;
|
|
58
|
+
chipVariant?: "default" | "small";
|
|
59
|
+
formatRawValue?: (value: string) => string;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
/** Shows a mixed value without accidentally committing the placeholder. */
|
|
62
|
+
mixed?: boolean;
|
|
63
|
+
/** Referenced tokens used for raw color-field behavior; not rendered inline. */
|
|
64
|
+
attributionTokens?: string[];
|
|
65
|
+
}
|
|
66
|
+
export declare function colorValueToHex(value: string): string | null;
|
|
67
|
+
export declare function TokenValueField(props: TokenValueFieldProps): ReactElement;
|
|
68
|
+
export declare function TokenField(props: TokenFieldProps): ReactElement;
|