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,34 @@
|
|
|
1
|
+
import { getActiveStyleState } from "./styleState.js";
|
|
2
|
+
import { getBrowserCssInspection } from "../inspection/browserCssInspectionRegistry.js";
|
|
3
|
+
import { getElementComputedStyle } from "../runtime/domRealm.js";
|
|
4
|
+
/** Read an inspector value from the selected authored state, falling back to
|
|
5
|
+
* the browser only when CSSOM has no declaration to attribute. */
|
|
6
|
+
export function getStateStyleValue(el, property, fallback = "") {
|
|
7
|
+
try {
|
|
8
|
+
const state = getActiveStyleState();
|
|
9
|
+
// Keep the browser's exact computed value for ordinary Base inspection.
|
|
10
|
+
// Authored resolution is needed when the live element is transiently
|
|
11
|
+
// interacted with, or when the user explicitly selected another state.
|
|
12
|
+
const hasLiveInteraction = [":hover", ":active", ":focus", ":focus-visible"].some((selector) => {
|
|
13
|
+
try {
|
|
14
|
+
return el.matches(selector);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
if (state === "base" && !hasLiveInteraction) {
|
|
21
|
+
return getElementComputedStyle(el).getPropertyValue(property).trim() || fallback;
|
|
22
|
+
}
|
|
23
|
+
const rows = getBrowserCssInspection(el.ownerDocument ?? document)
|
|
24
|
+
.inspect(el, { state }).properties;
|
|
25
|
+
const row = rows.find((candidate) => candidate.property === property)
|
|
26
|
+
?? (property === "background-color" ? rows.find((candidate) => candidate.property === "background") : undefined);
|
|
27
|
+
if (row?.resolvedValue)
|
|
28
|
+
return row.resolvedValue;
|
|
29
|
+
return getElementComputedStyle(el).getPropertyValue(property).trim() || fallback;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return fallback;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const INTERACTION_STATES: readonly ["hover", "active", "focus", "focus-visible", "disabled"];
|
|
2
|
+
export type InteractionState = "base" | (typeof INTERACTION_STATES)[number];
|
|
3
|
+
/** The selected authored interaction state. Kept outside React so edit actions
|
|
4
|
+
* and history have the same context as the panel that initiated an edit. */
|
|
5
|
+
export declare function getActiveStyleState(): InteractionState;
|
|
6
|
+
export declare function setActiveStyleState(state: InteractionState): void;
|
|
7
|
+
export declare function selectorForInteractionState(selector: string, state: InteractionState): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const INTERACTION_STATES = ["hover", "active", "focus", "focus-visible", "disabled"];
|
|
2
|
+
let activeState = "base";
|
|
3
|
+
/** The selected authored interaction state. Kept outside React so edit actions
|
|
4
|
+
* and history have the same context as the panel that initiated an edit. */
|
|
5
|
+
export function getActiveStyleState() {
|
|
6
|
+
return activeState;
|
|
7
|
+
}
|
|
8
|
+
export function setActiveStyleState(state) {
|
|
9
|
+
activeState = state;
|
|
10
|
+
}
|
|
11
|
+
export function selectorForInteractionState(selector, state) {
|
|
12
|
+
return state === "base" ? selector : `${selector}:${state}`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ResolvedProperty } from "../../css/model/index.js";
|
|
2
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
3
|
+
declare const SIDES: readonly ["top", "right", "bottom", "left"];
|
|
4
|
+
/** Derived from SIDES so the union and the iteration set cannot drift apart. */
|
|
5
|
+
export type ProjectionSide = (typeof SIDES)[number];
|
|
6
|
+
export type ProjectionGroup = "padding" | "margin" | "inset";
|
|
7
|
+
export type ProjectionAxis = "horizontal" | "vertical";
|
|
8
|
+
export type ProjectionState = "shared" | "mixed";
|
|
9
|
+
export interface InspectorFieldProjection {
|
|
10
|
+
property: string;
|
|
11
|
+
authoredValue: string;
|
|
12
|
+
value: string;
|
|
13
|
+
tokenName: string | null;
|
|
14
|
+
sourceProperty?: string;
|
|
15
|
+
row: ResolvedProperty | null;
|
|
16
|
+
}
|
|
17
|
+
export interface InspectorAxisProjection {
|
|
18
|
+
axis: ProjectionAxis;
|
|
19
|
+
sides: readonly [ProjectionSide, ProjectionSide];
|
|
20
|
+
state: ProjectionState;
|
|
21
|
+
fields: readonly [InspectorFieldProjection, InspectorFieldProjection];
|
|
22
|
+
}
|
|
23
|
+
export interface InspectorSpacingProjection {
|
|
24
|
+
property: ProjectionGroup;
|
|
25
|
+
linked: boolean;
|
|
26
|
+
fields: Record<ProjectionSide, InspectorFieldProjection>;
|
|
27
|
+
axes: Record<ProjectionAxis, InspectorAxisProjection>;
|
|
28
|
+
}
|
|
29
|
+
export interface InspectorProjection {
|
|
30
|
+
spacing: Record<ProjectionGroup, InspectorSpacingProjection>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Projects resolved physical side facts into the compact spacing UI shape.
|
|
34
|
+
* Authored value, token identity, computed value, and source property all
|
|
35
|
+
* participate in shared/mixed detection so visually equal values cannot
|
|
36
|
+
* accidentally discard authored CSS intent. Source properties remain on each
|
|
37
|
+
* field as provenance but do not by themselves force expansion.
|
|
38
|
+
*/
|
|
39
|
+
export declare function projectInspectorValues(el: HTMLElement, rows: ResolvedProperty[]): InspectorProjection;
|
|
40
|
+
/** Projects computed group values into the existing spacing editor model. */
|
|
41
|
+
export declare function projectInspectorValuesForSelection(selection: StyleSelection): InspectorProjection;
|
|
42
|
+
export declare function projectionSides(axis: ProjectionAxis): readonly [ProjectionSide, ProjectionSide];
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { getStateStyleValue } from "../shell/stateValue.js";
|
|
2
|
+
const SIDES = ["top", "right", "bottom", "left"];
|
|
3
|
+
const AXIS_SIDES = {
|
|
4
|
+
// Preserve CSS physical-side order within each axis. This makes a mixed
|
|
5
|
+
// horizontal value read as right, left and a mixed vertical value as top,
|
|
6
|
+
// bottom when the compact editor renders both values.
|
|
7
|
+
horizontal: ["right", "left"],
|
|
8
|
+
vertical: ["top", "bottom"],
|
|
9
|
+
};
|
|
10
|
+
function fieldProjection(el, rows, property) {
|
|
11
|
+
const row = rows.find((candidate) => candidate.property === property) ?? null;
|
|
12
|
+
// The selected element is the rendering authority. Resolved rows can be
|
|
13
|
+
// one render behind while the debounced inspector refreshes, so use the
|
|
14
|
+
// live computed side value for grouping when available and retain the row
|
|
15
|
+
// for authored/token/source provenance.
|
|
16
|
+
const liveValue = getStateStyleValue(el, property);
|
|
17
|
+
const rowValue = row?.computed || row?.resolvedValue;
|
|
18
|
+
const rowIsCurrent = !liveValue || !row || Boolean(row.sourceProperty) || !rowValue || rowValue === liveValue;
|
|
19
|
+
const effectiveRow = rowIsCurrent ? row : null;
|
|
20
|
+
const value = liveValue || row?.resolvedValue || "";
|
|
21
|
+
return {
|
|
22
|
+
property,
|
|
23
|
+
authoredValue: effectiveRow?.authored ?? effectiveRow?.declaredValue ?? value,
|
|
24
|
+
value,
|
|
25
|
+
tokenName: effectiveRow?.tokenName ?? null,
|
|
26
|
+
sourceProperty: effectiveRow?.sourceProperty,
|
|
27
|
+
row: effectiveRow,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function fieldSignature(field) {
|
|
31
|
+
// Source property is provenance, not visible value identity. Two physical
|
|
32
|
+
// longhands with the same authored/token value may still use the compact
|
|
33
|
+
// axis control; the individual source properties remain attached to their
|
|
34
|
+
// fields for prompt generation and edit metadata.
|
|
35
|
+
return [field.authoredValue, field.tokenName ?? "", field.value].join("|");
|
|
36
|
+
}
|
|
37
|
+
function axisProjection(axis, fields) {
|
|
38
|
+
const sides = AXIS_SIDES[axis];
|
|
39
|
+
const pair = [fields[sides[0]], fields[sides[1]]];
|
|
40
|
+
return {
|
|
41
|
+
axis,
|
|
42
|
+
sides,
|
|
43
|
+
state: fieldSignature(pair[0]) === fieldSignature(pair[1]) ? "shared" : "mixed",
|
|
44
|
+
fields: pair,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function spacingProjection(el, rows, property) {
|
|
48
|
+
// SAFETY: SIDES contains exactly the ProjectionSide keys, so the resulting record is complete.
|
|
49
|
+
const fields = Object.fromEntries(SIDES.map((side) => {
|
|
50
|
+
const field = fieldProjection(el, rows, property === "inset" ? side : `${property}-${side}`);
|
|
51
|
+
return [side, field];
|
|
52
|
+
}));
|
|
53
|
+
const signatures = SIDES.map((side) => fieldSignature(fields[side]));
|
|
54
|
+
return {
|
|
55
|
+
property,
|
|
56
|
+
linked: new Set(signatures).size === 1,
|
|
57
|
+
fields,
|
|
58
|
+
axes: {
|
|
59
|
+
horizontal: axisProjection("horizontal", fields),
|
|
60
|
+
vertical: axisProjection("vertical", fields),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Projects resolved physical side facts into the compact spacing UI shape.
|
|
66
|
+
* Authored value, token identity, computed value, and source property all
|
|
67
|
+
* participate in shared/mixed detection so visually equal values cannot
|
|
68
|
+
* accidentally discard authored CSS intent. Source properties remain on each
|
|
69
|
+
* field as provenance but do not by themselves force expansion.
|
|
70
|
+
*/
|
|
71
|
+
export function projectInspectorValues(el, rows) {
|
|
72
|
+
return {
|
|
73
|
+
spacing: {
|
|
74
|
+
padding: spacingProjection(el, rows, "padding"),
|
|
75
|
+
margin: spacingProjection(el, rows, "margin"),
|
|
76
|
+
inset: spacingProjection(el, rows, "inset"),
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function selectionField(selection, property) {
|
|
81
|
+
const selectedProperty = selection.getProperty(property);
|
|
82
|
+
const mixed = selectedProperty?.value.kind === "mixed";
|
|
83
|
+
const value = selectedProperty?.value.kind === "common" ? selectedProperty.value.value : "";
|
|
84
|
+
const row = selectedProperty?.primaryRow ?? null;
|
|
85
|
+
return {
|
|
86
|
+
property,
|
|
87
|
+
authoredValue: mixed ? "Mixed" : value,
|
|
88
|
+
value: mixed ? "Mixed" : value,
|
|
89
|
+
tokenName: selectedProperty?.token.kind === "common" ? selectedProperty.token.name : null,
|
|
90
|
+
sourceProperty: row?.sourceProperty,
|
|
91
|
+
row,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function selectionAxis(axis, fields) {
|
|
95
|
+
const sides = AXIS_SIDES[axis];
|
|
96
|
+
const pair = [fields[sides[0]], fields[sides[1]]];
|
|
97
|
+
return {
|
|
98
|
+
axis,
|
|
99
|
+
sides,
|
|
100
|
+
state: pair[0].value === pair[1].value ? "shared" : "mixed",
|
|
101
|
+
fields: pair,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function selectionSpacing(selection, property) {
|
|
105
|
+
// SAFETY: SIDES supplies exactly the ProjectionSide keys, so fromEntries yields that exact record shape.
|
|
106
|
+
const fields = Object.fromEntries(SIDES.map((side) => {
|
|
107
|
+
const field = selectionField(selection, property === "inset" ? side : `${property}-${side}`);
|
|
108
|
+
return [side, field];
|
|
109
|
+
}));
|
|
110
|
+
const signatures = SIDES.map((side) => fieldSignature(fields[side]));
|
|
111
|
+
return {
|
|
112
|
+
property,
|
|
113
|
+
linked: new Set(signatures).size === 1,
|
|
114
|
+
fields,
|
|
115
|
+
axes: {
|
|
116
|
+
horizontal: selectionAxis("horizontal", fields),
|
|
117
|
+
vertical: selectionAxis("vertical", fields),
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** Projects computed group values into the existing spacing editor model. */
|
|
122
|
+
export function projectInspectorValuesForSelection(selection) {
|
|
123
|
+
if (selection.elements.length === 1) {
|
|
124
|
+
return projectInspectorValues(selection.primary.domElement, [...selection.primaryRows]);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
spacing: {
|
|
128
|
+
padding: selectionSpacing(selection, "padding"),
|
|
129
|
+
margin: selectionSpacing(selection, "margin"),
|
|
130
|
+
inset: selectionSpacing(selection, "inset"),
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export function projectionSides(axis) {
|
|
135
|
+
return AXIS_SIDES[axis];
|
|
136
|
+
}
|
|
@@ -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 { SelectedElement } from "../selection/selectionStore.js";
|
|
5
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
6
|
+
export interface AppearanceSectionProps {
|
|
7
|
+
element: SelectedElement;
|
|
8
|
+
selection?: StyleSelection | null;
|
|
9
|
+
entries?: TokenEntry[];
|
|
10
|
+
tokenRows?: ResolvedProperty[];
|
|
11
|
+
onAfterEdit?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function AppearanceSection(props: AppearanceSectionProps): ReactElement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BorderRadiusEditor } from "./BorderRadiusEditor.js";
|
|
3
|
+
import { OpacityEditor } from "./OpacityEditor.js";
|
|
4
|
+
export function AppearanceSection(props) {
|
|
5
|
+
return (_jsxs("section", { className: "editor appearance", "data-test": "appearance-section", children: [_jsx("div", { className: "editor__title", children: "Appearance" }), _jsxs("div", { className: "appearance__fields", children: [_jsx(OpacityEditor, { ...props }), _jsx(BorderRadiusEditor, { ...props, embedded: true })] })] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { EditTarget } from "../selection/editTarget.js";
|
|
5
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
6
|
+
export declare const ASPECT_RATIO_PRESETS: string[];
|
|
7
|
+
export interface AspectRatioFieldProps {
|
|
8
|
+
domElement: HTMLElement;
|
|
9
|
+
editTarget?: EditTarget;
|
|
10
|
+
selection?: StyleSelection | null;
|
|
11
|
+
entries?: TokenEntry[];
|
|
12
|
+
tokenRow?: ResolvedProperty | null;
|
|
13
|
+
revision?: number;
|
|
14
|
+
onAfterEdit?: () => void;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function AspectRatioField({ domElement: el, editTarget, selection, entries, tokenRow, onAfterEdit, className, }: AspectRatioFieldProps): ReactElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FieldRow } from "../ui/FieldRow.js";
|
|
3
|
+
import { ControlSurface } from "../ui/ControlSurface.js";
|
|
4
|
+
import { TokenField } from "../tokens/TokenField.js";
|
|
5
|
+
import { meaningfulLayoutValue } from "./layoutValue.js";
|
|
6
|
+
import { getNudgeUiTokenEntries } from "../runtime/runtimeConfig.js";
|
|
7
|
+
export const ASPECT_RATIO_PRESETS = ["auto", "1 / 1", "4 / 3", "3 / 2", "16 / 9", "21 / 9"];
|
|
8
|
+
export function AspectRatioField({ domElement: el, editTarget, selection, entries = getNudgeUiTokenEntries(), tokenRow, onAfterEdit, className, }) {
|
|
9
|
+
return (_jsx(FieldRow, { label: "aspect-ratio", "data-test": "layout-size-aspect-ratio", className: className, children: _jsx(ControlSurface, { children: _jsx(TokenField, { property: "aspect-ratio", selection: selection, tokenRow: tokenRow, initialValue: meaningfulLayoutValue(el, "aspect-ratio"), domElement: el, editTarget: editTarget, entries: entries, suggestions: ASPECT_RATIO_PRESETS, inputDataTest: "layout-aspect-ratio-input", onAfterEdit: onAfterEdit }) }) }));
|
|
10
|
+
}
|
|
@@ -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 { SelectedElement } from "../selection/selectionStore.js";
|
|
5
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
6
|
+
export interface BorderEditorProps {
|
|
7
|
+
element: SelectedElement;
|
|
8
|
+
selection?: StyleSelection | null;
|
|
9
|
+
entries?: TokenEntry[];
|
|
10
|
+
tokenRows?: ResolvedProperty[];
|
|
11
|
+
onAfterEdit?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function BorderEditor(props: BorderEditorProps): ReactElement;
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { IconBorderBottom, IconBorderLeft, IconBorderRight, IconBorderSides, IconBorderStyle2, IconBorderTop, IconCheck, IconMinus, IconPlus, } from "@tabler/icons-react";
|
|
4
|
+
import { findTokenRow } from "./rowLookup.js";
|
|
5
|
+
import { TokenField } from "../tokens/TokenField.js";
|
|
6
|
+
import { setStyle, setStyles } from "../tokens/editActions.js";
|
|
7
|
+
import { FieldRow } from "../ui/FieldRow.js";
|
|
8
|
+
import { SIDE_NAMES } from "../ui/SideValuesField.js";
|
|
9
|
+
import { IconButton } from "../ui/IconButton.js";
|
|
10
|
+
import { ToggleButton } from "../ui/ToggleButton.js";
|
|
11
|
+
import { formatInspectorLabel } from "../ui/labels.js";
|
|
12
|
+
import { getStateStyleValue } from "../shell/stateValue.js";
|
|
13
|
+
import { PopoverListbox } from "../ui/PopoverListbox.js";
|
|
14
|
+
import { ControlSurface } from "../ui/ControlSurface.js";
|
|
15
|
+
import { getNudgeUiTokenEntries } from "../runtime/runtimeConfig.js";
|
|
16
|
+
const BORDER_STYLES = ["none", "hidden", "solid", "dashed", "dotted", "double", "groove", "ridge", "inset", "outset"];
|
|
17
|
+
const INVISIBLE_BORDER_STYLES = new Set(["none", "hidden"]);
|
|
18
|
+
const ZERO_WIDTH = /^(?:0|0px|0rem|0em|0%)$/i;
|
|
19
|
+
const BORDER_SIDES = SIDE_NAMES.map((side) => `border-${side}`);
|
|
20
|
+
function borderStyleValue(el, rows, property) {
|
|
21
|
+
const row = findTokenRow(rows, property);
|
|
22
|
+
const structured = row?.structure?.style?.trim();
|
|
23
|
+
if (structured)
|
|
24
|
+
return structured.toLowerCase();
|
|
25
|
+
const authored = (row?.authored ?? row?.declaredValue ?? "").trim().toLowerCase();
|
|
26
|
+
if (authored && BORDER_STYLES.includes(authored))
|
|
27
|
+
return authored;
|
|
28
|
+
return (getStateStyleValue(el, property, "none") || "none").toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
function borderWidthValue(el, rows, property) {
|
|
31
|
+
const row = findTokenRow(rows, property);
|
|
32
|
+
if (row?.structure?.width)
|
|
33
|
+
return row.structure.width.trim();
|
|
34
|
+
return (row?.authored
|
|
35
|
+
|| row?.declaredValue
|
|
36
|
+
|| row?.resolvedValue
|
|
37
|
+
|| getStateStyleValue(el, property, "0px")
|
|
38
|
+
|| "0px").trim();
|
|
39
|
+
}
|
|
40
|
+
function borderColorValue(el, rows, property) {
|
|
41
|
+
const row = findTokenRow(rows, property);
|
|
42
|
+
if (row?.structure?.color)
|
|
43
|
+
return row.structure.color.trim();
|
|
44
|
+
return (row?.authored
|
|
45
|
+
|| row?.declaredValue
|
|
46
|
+
|| row?.resolvedValue
|
|
47
|
+
|| getStateStyleValue(el, property, "currentcolor")
|
|
48
|
+
|| "currentcolor").trim();
|
|
49
|
+
}
|
|
50
|
+
/** Effective per-side value used to decide linked vs individual UI. */
|
|
51
|
+
function sideComponentSignature(el, rows, property) {
|
|
52
|
+
const row = findTokenRow(rows, property);
|
|
53
|
+
if (property.endsWith("-width")) {
|
|
54
|
+
return `w:${borderWidthValue(el, rows, property).toLowerCase()}|t:${row?.tokenName ?? ""}`;
|
|
55
|
+
}
|
|
56
|
+
if (property.endsWith("-style")) {
|
|
57
|
+
return `s:${borderStyleValue(el, rows, property)}`;
|
|
58
|
+
}
|
|
59
|
+
if (property.endsWith("-color")) {
|
|
60
|
+
return `c:${borderColorValue(el, rows, property).toLowerCase()}|t:${row?.tokenName ?? ""}`;
|
|
61
|
+
}
|
|
62
|
+
return `${row?.authored ?? ""}|${row?.resolvedValue ?? getStateStyleValue(el, property)}`;
|
|
63
|
+
}
|
|
64
|
+
function sideValueForLink(el, rows, property, fallback = "") {
|
|
65
|
+
if (property.endsWith("-width"))
|
|
66
|
+
return borderWidthValue(el, rows, property) || fallback;
|
|
67
|
+
if (property.endsWith("-style"))
|
|
68
|
+
return borderStyleValue(el, rows, property) || fallback;
|
|
69
|
+
if (property.endsWith("-color"))
|
|
70
|
+
return borderColorValue(el, rows, property) || fallback;
|
|
71
|
+
return fallback;
|
|
72
|
+
}
|
|
73
|
+
function borderLinkDeclaration(el, rows, shorthand, sideProperties) {
|
|
74
|
+
const sharedValue = sideValueForLink(el, rows, sideProperties[0], shorthand === "border-style" ? "solid" : "");
|
|
75
|
+
return sharedValue ? { property: shorthand, value: sharedValue } : null;
|
|
76
|
+
}
|
|
77
|
+
function linkedTokenRow(rows, shorthand, sideProperties) {
|
|
78
|
+
const direct = findTokenRow(rows, shorthand);
|
|
79
|
+
if (direct)
|
|
80
|
+
return direct;
|
|
81
|
+
const first = findTokenRow(rows, sideProperties[0]);
|
|
82
|
+
return first ? { ...first, property: shorthand } : null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Sides are linked when every face shares the same effective component value.
|
|
86
|
+
* Uses structured width/style/color parts (not the full authored shorthand string)
|
|
87
|
+
* so four different `border-*` shorthands correctly expand the UI.
|
|
88
|
+
*/
|
|
89
|
+
function valuesAreLinked(el, rows, shorthand, sideProperties) {
|
|
90
|
+
const hasDirectRow = Boolean(findTokenRow(rows, shorthand));
|
|
91
|
+
const hasSideRows = sideProperties.some((property) => Boolean(findTokenRow(rows, property)));
|
|
92
|
+
// A lone shorthand with no per-side overrides is inherently linked.
|
|
93
|
+
if (hasDirectRow && !hasSideRows)
|
|
94
|
+
return true;
|
|
95
|
+
const signatures = sideProperties.map((property) => sideComponentSignature(el, rows, property));
|
|
96
|
+
return new Set(signatures).size === 1;
|
|
97
|
+
}
|
|
98
|
+
function isBorderFaceProperty(property) {
|
|
99
|
+
const p = property.toLowerCase();
|
|
100
|
+
return p === "border"
|
|
101
|
+
|| p === "border-width"
|
|
102
|
+
|| p === "border-style"
|
|
103
|
+
|| p === "border-color"
|
|
104
|
+
|| /^border-(top|right|bottom|left)(?:-(?:width|style|color))?$/.test(p);
|
|
105
|
+
}
|
|
106
|
+
function isZeroWidthValue(value) {
|
|
107
|
+
const trimmed = value.trim().toLowerCase();
|
|
108
|
+
if (ZERO_WIDTH.test(trimmed))
|
|
109
|
+
return true;
|
|
110
|
+
// Structured/preflight authored forms like `0 solid` / `0px solid currentcolor`.
|
|
111
|
+
const first = trimmed.split(/\s+/)[0] ?? "";
|
|
112
|
+
return ZERO_WIDTH.test(first);
|
|
113
|
+
}
|
|
114
|
+
/** True when a face paints: drawn style and non-zero width. */
|
|
115
|
+
function sidePaints(el, rows, side) {
|
|
116
|
+
const style = borderStyleValue(el, rows, `border-${side}-style`);
|
|
117
|
+
if (INVISIBLE_BORDER_STYLES.has(style))
|
|
118
|
+
return false;
|
|
119
|
+
return !isZeroWidthValue(borderWidthValue(el, rows, `border-${side}-width`));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Show border controls for intentional / painted borders only.
|
|
123
|
+
*
|
|
124
|
+
* Tailwind preflight authors `border: 0 solid` on `*`. That is cascade
|
|
125
|
+
* evidence but not a visible border — hide controls and show + instead.
|
|
126
|
+
*
|
|
127
|
+
* Counts as presence:
|
|
128
|
+
* - any painted face (drawn style + non-zero width)
|
|
129
|
+
* - explicit `none` / `hidden`
|
|
130
|
+
* - authored non-zero width
|
|
131
|
+
*/
|
|
132
|
+
function hasBorderPresence(el, rows) {
|
|
133
|
+
if (SIDE_NAMES.some((side) => sidePaints(el, rows, side)))
|
|
134
|
+
return true;
|
|
135
|
+
for (const row of rows) {
|
|
136
|
+
if (!isBorderFaceProperty(row.property) && !row.structure)
|
|
137
|
+
continue;
|
|
138
|
+
const property = row.property.toLowerCase();
|
|
139
|
+
const authored = (row.authored ?? row.declaredValue ?? "").trim().toLowerCase();
|
|
140
|
+
const structuredStyle = row.structure?.style?.trim().toLowerCase() ?? "";
|
|
141
|
+
const structuredWidth = row.structure?.width?.trim() ?? "";
|
|
142
|
+
if (INVISIBLE_BORDER_STYLES.has(structuredStyle) || INVISIBLE_BORDER_STYLES.has(authored)) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
if (structuredWidth && !isZeroWidthValue(structuredWidth))
|
|
146
|
+
return true;
|
|
147
|
+
if ((property === "border-width" || property.endsWith("-width")) && authored && !isZeroWidthValue(authored)) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Computed non-zero width without cascade rows (inline / inaccessible sheets).
|
|
152
|
+
if (!isZeroWidthValue(borderWidthValue(el, rows, "border-width")))
|
|
153
|
+
return true;
|
|
154
|
+
if (SIDE_NAMES.some((side) => !isZeroWidthValue(borderWidthValue(el, rows, `border-${side}-width`)))) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Linked presentation from cascade data + optional user toggle.
|
|
161
|
+
* Divergent faces always open; equal faces start linked but can expand.
|
|
162
|
+
* Linking divergent faces is optimistic until cascade rows catch up.
|
|
163
|
+
*/
|
|
164
|
+
function useBorderLinkedState(dataLinked, resetKey) {
|
|
165
|
+
const [userUnlinked, setUserUnlinked] = useState(false);
|
|
166
|
+
const [userLinked, setUserLinked] = useState(false);
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
setUserUnlinked(false);
|
|
169
|
+
setUserLinked(false);
|
|
170
|
+
}, [resetKey]);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (dataLinked)
|
|
173
|
+
setUserLinked(false);
|
|
174
|
+
else
|
|
175
|
+
setUserUnlinked(false);
|
|
176
|
+
}, [dataLinked]);
|
|
177
|
+
const isLinked = dataLinked ? !userUnlinked : userLinked;
|
|
178
|
+
function setLinked(next) {
|
|
179
|
+
if (next) {
|
|
180
|
+
setUserUnlinked(false);
|
|
181
|
+
setUserLinked(true);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
setUserLinked(false);
|
|
185
|
+
setUserUnlinked(true);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return [isLinked, setLinked];
|
|
189
|
+
}
|
|
190
|
+
export function BorderEditor(props) {
|
|
191
|
+
const { element, selection, entries, tokenRows = [], onAfterEdit } = props;
|
|
192
|
+
const el = element.domElement;
|
|
193
|
+
const editTarget = selection?.target ?? el;
|
|
194
|
+
const isGroup = Boolean(selection && selection.elements.length > 1);
|
|
195
|
+
const allEntries = entries ?? getNudgeUiTokenEntries();
|
|
196
|
+
const borderWidthProperties = BORDER_SIDES.map((side) => `${side}-width`);
|
|
197
|
+
const borderStyleProperties = BORDER_SIDES.map((side) => `${side}-style`);
|
|
198
|
+
const borderColorProperties = BORDER_SIDES.map((side) => `${side}-color`);
|
|
199
|
+
const borderWidthDataLinked = valuesAreLinked(el, tokenRows, "border-width", borderWidthProperties);
|
|
200
|
+
const borderStyleDataLinked = valuesAreLinked(el, tokenRows, "border-style", borderStyleProperties);
|
|
201
|
+
const borderColorDataLinked = valuesAreLinked(el, tokenRows, "border-color", borderColorProperties);
|
|
202
|
+
const allDataLinked = !isGroup && borderWidthDataLinked && borderStyleDataLinked && borderColorDataLinked;
|
|
203
|
+
const [borderLinked, setBorderLinked] = useBorderLinkedState(allDataLinked, el);
|
|
204
|
+
const borderRow = findTokenRow(tokenRows, "border");
|
|
205
|
+
const hasStructuredBorderRows = tokenRows.some((row) => Boolean(row.structure));
|
|
206
|
+
const rawBorderFallback = !isGroup && Boolean(borderRow && !borderRow.structure && !hasStructuredBorderRows);
|
|
207
|
+
const linkedBorderStyle = borderStyleValue(el, tokenRows, "border-style");
|
|
208
|
+
const showWidthAndColor = !(borderLinked && INVISIBLE_BORDER_STYLES.has(linkedBorderStyle));
|
|
209
|
+
const hasBorder = isGroup
|
|
210
|
+
? selection?.domElements.some((candidate) => hasBorderPresence(candidate, [])) ?? false
|
|
211
|
+
: hasBorderPresence(el, tokenRows);
|
|
212
|
+
const [borderSessionOpen, setBorderSessionOpen] = useState(false);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
setBorderSessionOpen(false);
|
|
215
|
+
}, [el]);
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
if (hasBorder || rawBorderFallback)
|
|
218
|
+
setBorderSessionOpen(true);
|
|
219
|
+
}, [hasBorder, rawBorderFallback]);
|
|
220
|
+
const showBorderControls = hasBorder || borderSessionOpen || rawBorderFallback;
|
|
221
|
+
function handleAddBorder() {
|
|
222
|
+
setStyle(editTarget, "border", "1px solid");
|
|
223
|
+
setBorderSessionOpen(true);
|
|
224
|
+
onAfterEdit?.();
|
|
225
|
+
}
|
|
226
|
+
function handleRemoveBorder() {
|
|
227
|
+
setStyle(editTarget, "border", "0 solid");
|
|
228
|
+
setBorderSessionOpen(false);
|
|
229
|
+
onAfterEdit?.();
|
|
230
|
+
}
|
|
231
|
+
function handleExpand() {
|
|
232
|
+
setBorderLinked(false);
|
|
233
|
+
}
|
|
234
|
+
function handleCollapse() {
|
|
235
|
+
setBorderLinked(true);
|
|
236
|
+
const declarations = [
|
|
237
|
+
borderLinkDeclaration(el, tokenRows, "border-style", borderStyleProperties),
|
|
238
|
+
borderLinkDeclaration(el, tokenRows, "border-width", borderWidthProperties),
|
|
239
|
+
borderLinkDeclaration(el, tokenRows, "border-color", borderColorProperties),
|
|
240
|
+
].filter((declaration) => declaration !== null);
|
|
241
|
+
if (declarations.length > 0) {
|
|
242
|
+
setStyles(editTarget, declarations);
|
|
243
|
+
onAfterEdit?.();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const sideRows = SIDE_NAMES.map((side, index) => ({
|
|
247
|
+
side,
|
|
248
|
+
color: (_jsx(ControlSurface, { children: _jsx(TokenField, { property: borderColorProperties[index], selection: selection, tokenRow: findTokenRow(tokenRows, borderColorProperties[index]), domElement: el, editTarget: editTarget, entries: allEntries, onAfterEdit: onAfterEdit }) })),
|
|
249
|
+
width: (_jsx(ControlSurface, { children: _jsx(TokenField, { property: borderWidthProperties[index], selection: selection, tokenRow: findTokenRow(tokenRows, borderWidthProperties[index]), domElement: el, editTarget: editTarget, entries: allEntries, onAfterEdit: onAfterEdit, chipVariant: "small" }) })),
|
|
250
|
+
style: (_jsx(BorderStyleSettingsMenu, { property: borderStyleProperties[index], tokenRow: findTokenRow(tokenRows, borderStyleProperties[index]), domElement: el, editTarget: editTarget, selection: selection, dataTest: `border-style-${side}`, onAfterEdit: onAfterEdit })),
|
|
251
|
+
}));
|
|
252
|
+
return (_jsxs("div", { className: `editor`, "data-test": "border-editor", children: [_jsxs("div", { className: "editor__title-row", children: [_jsx("div", { className: "editor__title", children: "Border" }), showBorderControls ? (_jsx(IconButton, { variant: "quiet", label: "Remove Border", "data-test": "remove-border", className: "border__remove", onClick: handleRemoveBorder, children: _jsx(IconMinus, { size: 16, "aria-hidden": "true" }) })) : (_jsx(IconButton, { variant: "quiet", label: "Add Border", "data-test": "add-border", className: "border__add", onClick: handleAddBorder, children: _jsx(IconPlus, { size: 16, "aria-hidden": "true" }) }))] }), showBorderControls && (_jsx("div", { className: "border", "data-expanded": borderLinked ? "false" : "true", children: rawBorderFallback ? (_jsx(FieldRow, { label: "Border", children: _jsx(ControlSurface, { children: _jsx(TokenField, { property: "border", selection: selection, tokenRow: borderRow, domElement: el, editTarget: editTarget, entries: allEntries, onAfterEdit: onAfterEdit }) }) })) : borderLinked ? (_jsxs("div", { className: "border__linked-row", children: [showWidthAndColor ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "border__linked-control border__linked-control--color", children: _jsx(ControlSurface, { children: _jsx(TokenField, { property: "border-color", selection: selection, tokenRow: linkedTokenRow(tokenRows, "border-color", borderColorProperties), domElement: el, editTarget: editTarget, entries: allEntries, onAfterEdit: onAfterEdit }) }) }), _jsx("div", { className: "border__linked-control border__linked-control--width", children: _jsx(ControlSurface, { children: _jsx(TokenField, { property: "border-width", selection: selection, tokenRow: linkedTokenRow(tokenRows, "border-width", borderWidthProperties), domElement: el, editTarget: editTarget, entries: allEntries, onAfterEdit: onAfterEdit, chipVariant: "small" }) }) })] })) : null, _jsx(BorderStyleSettingsMenu, { property: "border-style", tokenRow: linkedTokenRow(tokenRows, "border-style", borderStyleProperties), domElement: el, editTarget: editTarget, selection: selection, onAfterEdit: onAfterEdit }), _jsx(ToggleButton, { variant: "quiet", size: "default", "data-test": "border-expand", label: "Edit Individual Border Sides", title: "Edit Individual Border Sides", pressed: !borderLinked, onPressedChange: (pressed) => {
|
|
253
|
+
if (pressed)
|
|
254
|
+
handleExpand();
|
|
255
|
+
}, children: _jsx(IconBorderSides, { size: 16, "aria-hidden": "true" }) })] })) : (_jsxs("div", { className: "border__expanded", children: [_jsxs("div", { className: "border__expanded-header", children: [_jsx("span", { className: "side-values__label", children: formatInspectorLabel("Individual Sides") }), _jsx(ToggleButton, { variant: "quiet", size: "default", "data-test": "border-collapse", label: "Link All Border Sides", title: "Link All Border Sides", pressed: !borderLinked, onPressedChange: (pressed) => {
|
|
256
|
+
if (!pressed)
|
|
257
|
+
handleCollapse();
|
|
258
|
+
}, children: _jsx(IconBorderSides, { size: 16, "aria-hidden": "true" }) })] }), showWidthAndColor ? (_jsx("div", { className: "border__side-rows", "data-test": "border-side-rows", children: sideRows.map(({ side, color, width, style }) => (_jsxs("div", { className: "border__side-row", "data-side": side, "aria-label": `Border ${formatInspectorLabel(side)}`, children: [_jsx(BorderSideIndicator, { side: side }), _jsx("div", { className: "border__side-control border__side-control--color", children: color }), _jsx("div", { className: "border__side-control border__side-control--width", children: width }), style] }, side))) })) : null] })) }))] }));
|
|
259
|
+
}
|
|
260
|
+
const BORDER_SIDE_ICONS = {
|
|
261
|
+
top: IconBorderTop,
|
|
262
|
+
right: IconBorderRight,
|
|
263
|
+
bottom: IconBorderBottom,
|
|
264
|
+
left: IconBorderLeft,
|
|
265
|
+
};
|
|
266
|
+
function BorderSideIndicator({ side }) {
|
|
267
|
+
const Icon = BORDER_SIDE_ICONS[side];
|
|
268
|
+
return _jsx(Icon, { className: "side-values__icon side-values__side-icon", size: 16, "aria-hidden": "true" });
|
|
269
|
+
}
|
|
270
|
+
function BorderStyleSettingsMenu({ property, tokenRow, domElement: el, editTarget, selection, dataTest = "border-style-settings", onAfterEdit }) {
|
|
271
|
+
const structured = tokenRow?.structure?.style?.trim().toLowerCase() ?? "";
|
|
272
|
+
const selectedValue = selection?.getProperty(property)?.value;
|
|
273
|
+
const mixed = selectedValue?.kind === "mixed";
|
|
274
|
+
const commonValue = selectedValue?.kind === "common" ? selectedValue.value : "";
|
|
275
|
+
const initial = mixed ? "Mixed" : commonValue || structured || getStateStyleValue(el, property, "none") || "none";
|
|
276
|
+
const [value, setValue] = useState(initial);
|
|
277
|
+
const [open, setOpen] = useState(false);
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
setValue(mixed ? "Mixed" : commonValue || structured || getStateStyleValue(el, property, "none") || "none");
|
|
280
|
+
}, [commonValue, el, mixed, property, structured]);
|
|
281
|
+
function handleChange(next) {
|
|
282
|
+
if (!BORDER_STYLES.includes(next))
|
|
283
|
+
return;
|
|
284
|
+
setValue(next);
|
|
285
|
+
setStyle(editTarget ?? el, property, next);
|
|
286
|
+
setOpen(false);
|
|
287
|
+
onAfterEdit?.();
|
|
288
|
+
}
|
|
289
|
+
return (_jsx(PopoverListbox, { query: "", value: null, open: open, triggerElement: (_jsx(IconButton, { variant: "quiet", size: "default", label: `Border style: ${formatInspectorLabel(value)}`, "data-test": dataTest, "data-current-style": value, children: _jsx(IconBorderStyle2, { size: 16, "aria-hidden": "true" }) })), triggerDataTest: dataTest, triggerAriaLabel: "Border style settings", items: BORDER_STYLES.map((style) => ({
|
|
290
|
+
value: style,
|
|
291
|
+
label: formatInspectorLabel(style),
|
|
292
|
+
leading: style === value ? _jsx(IconCheck, { size: 14, stroke: 2, "aria-hidden": "true" }) : undefined,
|
|
293
|
+
"data-test": `border-style-setting-${style}`,
|
|
294
|
+
})), onQueryChange: () => undefined, onOpenChange: setOpen, onSelect: handleChange }));
|
|
295
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { SelectedElement } from "../selection/selectionStore.js";
|
|
5
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
6
|
+
export interface BorderRadiusEditorProps {
|
|
7
|
+
element: SelectedElement;
|
|
8
|
+
selection?: StyleSelection | null;
|
|
9
|
+
entries?: TokenEntry[];
|
|
10
|
+
tokenRows?: ResolvedProperty[];
|
|
11
|
+
onAfterEdit?: () => void;
|
|
12
|
+
embedded?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function BorderRadiusEditor(props: BorderRadiusEditorProps): ReactElement;
|