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,342 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { IconAdjustmentsHorizontal, IconArrowsMaximize, IconArrowsMinimize, IconCheck, IconLetterH, IconLetterW, IconSettings, IconSpacingHorizontal, IconSpacingVertical, IconTextWrap } from "@tabler/icons-react";
|
|
4
|
+
import { TokenField } from "../tokens/TokenField.js";
|
|
5
|
+
import { LayoutDropdown } from "./LayoutDropdown.js";
|
|
6
|
+
import { LayoutComboField } from "./LayoutComboField.js";
|
|
7
|
+
import { GapField } from "./GapField.js";
|
|
8
|
+
import { AspectRatioField } from "./AspectRatioField.js";
|
|
9
|
+
import { PositionInsets } from "./PositionInsets.js";
|
|
10
|
+
import { GridSection } from "./GridSection.js";
|
|
11
|
+
import { meaningfulLayoutValue } from "./layoutValue.js";
|
|
12
|
+
import { setStyle, setStyles } from "../tokens/editActions.js";
|
|
13
|
+
import { IconButton } from "../ui/IconButton.js";
|
|
14
|
+
import { InspectorPopover } from "../ui/InspectorPopover.js";
|
|
15
|
+
import { PopoverListbox } from "../ui/PopoverListbox.js";
|
|
16
|
+
import { SegmentedControl } from "../ui/SegmentedControl.js";
|
|
17
|
+
import { getStateStyleValue } from "../shell/stateValue.js";
|
|
18
|
+
import { formatInspectorLabel } from "../ui/labels.js";
|
|
19
|
+
import { getElementComputedStyle } from "../runtime/domRealm.js";
|
|
20
|
+
import { FieldRow } from "../ui/FieldRow.js";
|
|
21
|
+
import { ControlSurface } from "../ui/ControlSurface.js";
|
|
22
|
+
import { getNudgeUiTokenEntries } from "../runtime/runtimeConfig.js";
|
|
23
|
+
const DISPLAY_OPTIONS = ["block", "inline", "inline-block", "flex", "inline-flex", "grid", "inline-grid", "none", "contents"];
|
|
24
|
+
const POSITION_OPTIONS = ["static", "relative", "absolute", "fixed", "sticky"];
|
|
25
|
+
const FLEX_DIRECTION_OPTIONS = ["row", "row-reverse", "column", "column-reverse"];
|
|
26
|
+
const ALIGN_CONTENT_OPTIONS = ["normal", "stretch", "flex-start", "flex-end", "center", "space-between", "space-around"];
|
|
27
|
+
const ALIGN_SELF_OPTIONS = ["auto", "stretch", "flex-start", "flex-end", "center", "baseline"];
|
|
28
|
+
const FLEX_GROW_PRESETS = ["0", "1", "2", "3"];
|
|
29
|
+
const FLEX_SHRINK_PRESETS = ["0", "1"];
|
|
30
|
+
const FLEX_BASIS_PRESETS = ["auto", "0", "0%", "100%", "50%", "fit-content"];
|
|
31
|
+
const ORDER_PRESETS = ["-1", "0", "1", "2", "3"];
|
|
32
|
+
const FLEX_ALIGNMENT_OPTIONS = ["flex-start", "center", "flex-end"];
|
|
33
|
+
const FLEX_DISTRIBUTION_OPTIONS = ["space-between", "space-around", "space-evenly"];
|
|
34
|
+
const SIZE_PRESETS = ["auto", "0", "100%", "fit-content"];
|
|
35
|
+
const MIN_SIZE_PRESETS = ["0", "min-content", "fit-content"];
|
|
36
|
+
const MAX_WIDTH_PRESETS = ["none", "100%", "100vw", "fit-content"];
|
|
37
|
+
const MAX_HEIGHT_PRESETS = ["none", "100%", "100vh", "fit-content"];
|
|
38
|
+
export function LayoutSection(props) {
|
|
39
|
+
const { element, selection, entries, tokenRows = [], onAfterEdit } = props;
|
|
40
|
+
const el = element.domElement;
|
|
41
|
+
const editTarget = selection?.target ?? el;
|
|
42
|
+
const allEntries = entries ?? getNudgeUiTokenEntries();
|
|
43
|
+
const [primaryIsFlexContainer, setPrimaryIsFlexContainer] = useState(false);
|
|
44
|
+
const [primaryIsFlexChild, setPrimaryIsFlexChild] = useState(false);
|
|
45
|
+
const [primaryIsGridContainer, setPrimaryIsGridContainer] = useState(false);
|
|
46
|
+
const [primaryIsGridChild, setPrimaryIsGridChild] = useState(false);
|
|
47
|
+
const [primaryPosition, setPrimaryPosition] = useState(() => getStateStyleValue(el, "position", "static"));
|
|
48
|
+
const [layoutRevision, setLayoutRevision] = useState(0);
|
|
49
|
+
const [flexDirection] = useComputedLayoutValue(el, "flex-direction", "row", layoutRevision);
|
|
50
|
+
const [flexWrap] = useComputedLayoutValue(el, "flex-wrap", "nowrap", layoutRevision);
|
|
51
|
+
const selectedDirection = selection?.getProperty("flex-direction")?.value;
|
|
52
|
+
const selectedWrap = selection?.getProperty("flex-wrap")?.value;
|
|
53
|
+
const mixedFlexDirection = selectedDirection?.kind === "mixed";
|
|
54
|
+
const mixedFlexWrap = selectedWrap?.kind === "mixed";
|
|
55
|
+
const sharedFlexDirection = selectedDirection?.kind === "common"
|
|
56
|
+
? selectedDirection.value
|
|
57
|
+
: flexDirection;
|
|
58
|
+
const sharedFlexWrap = selectedWrap?.kind === "common"
|
|
59
|
+
? selectedWrap.value
|
|
60
|
+
: flexWrap;
|
|
61
|
+
const isFlexWrapped = mixedFlexDirection || mixedFlexWrap || sharedFlexWrap !== "nowrap";
|
|
62
|
+
const relevantGap = !mixedFlexDirection && sharedFlexDirection.startsWith("column") ? "row-gap" : "column-gap";
|
|
63
|
+
const lineGap = relevantGap === "row-gap" ? "column-gap" : "row-gap";
|
|
64
|
+
function notifyAfterEdit() {
|
|
65
|
+
setLayoutRevision((revision) => revision + 1);
|
|
66
|
+
onAfterEdit?.();
|
|
67
|
+
}
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
try {
|
|
70
|
+
const cs = getElementComputedStyle(el);
|
|
71
|
+
const display = cs.display;
|
|
72
|
+
setPrimaryIsFlexContainer(display === "flex" || display === "inline-flex");
|
|
73
|
+
setPrimaryIsGridContainer(display === "grid" || display === "inline-grid");
|
|
74
|
+
setPrimaryPosition(cs.position);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// noop
|
|
78
|
+
}
|
|
79
|
+
}, [el, layoutRevision]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
try {
|
|
82
|
+
const parentEl = el.parentElement;
|
|
83
|
+
if (!parentEl) {
|
|
84
|
+
setPrimaryIsFlexChild(false);
|
|
85
|
+
setPrimaryIsGridChild(false);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const pDisplay = getElementComputedStyle(parentEl).display;
|
|
89
|
+
setPrimaryIsFlexChild(pDisplay === "flex" || pDisplay === "inline-flex");
|
|
90
|
+
setPrimaryIsGridChild(pDisplay === "grid" || pDisplay === "inline-grid");
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
setPrimaryIsFlexChild(false);
|
|
94
|
+
setPrimaryIsGridChild(false);
|
|
95
|
+
}
|
|
96
|
+
}, [el, layoutRevision]);
|
|
97
|
+
const isFlexContainer = selection ? selection.supportsRole("flex-container") : primaryIsFlexContainer;
|
|
98
|
+
const isFlexChild = selection ? selection.supportsRole("flex-child") : primaryIsFlexChild;
|
|
99
|
+
const isGridContainer = selection ? selection.supportsRole("grid-container") : primaryIsGridContainer;
|
|
100
|
+
const isGridChild = selection ? selection.supportsRole("grid-child") : primaryIsGridChild;
|
|
101
|
+
const selectedPosition = selection?.getProperty("position")?.value;
|
|
102
|
+
const position = selectedPosition?.kind === "common" ? selectedPosition.value : primaryPosition;
|
|
103
|
+
const showPositionInsets = selection
|
|
104
|
+
? selection.supportsRole("inset-position")
|
|
105
|
+
: position === "absolute" || position === "fixed";
|
|
106
|
+
return (_jsxs("div", { className: "editor", "data-test": "layout-section", children: [_jsx("div", { className: "editor__title", children: "Layout" }), _jsxs("div", { className: "layout", children: [_jsxs("div", { className: "layout__basic", children: [_jsx(SizeSection, { domElement: el, editTarget: editTarget, selection: selection, entries: allEntries, tokenRows: tokenRows, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsxs("div", { className: "layout__tool-row", children: [_jsx(LayoutDropdown, { property: "display", options: DISPLAY_OPTIONS, domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsx(LayoutDropdown, { property: "position", options: POSITION_OPTIONS, domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit })] })] }), isFlexContainer ? (_jsxs("div", { className: "layout__group", "data-test": "layout-flex-container", children: [_jsx("div", { className: "editor__title", children: "Flex" }), _jsx("div", { className: "layout__flex-toolbar", children: _jsxs("div", { className: "layout__direction-tools", children: [_jsx(FlexDirectionControl, { domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsx(FlexWrapToggle, { domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsx(FlexSettingsMenu, { domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit })] }) }), _jsxs("div", { className: "layout__flex-lower", children: [mixedFlexDirection ? (_jsx("div", { className: "layout__alignment-grid", "data-test": "layout-flex-axis-mixed", children: "Choose a shared flex direction to edit physical alignment." })) : (_jsx(FlexAlignmentGrid, { domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit })), _jsx("div", { className: "layout__gap-column", "data-test": "layout-gap", children: _jsxs("div", { className: "layout__gap-fields", children: [_jsxs("div", { className: "layout__spacing-primary", children: [_jsx(FlexGapField, { property: relevantGap, domElement: el, editTarget: editTarget, selection: selection, entries: allEntries, tokenRows: tokenRows, onAfterEdit: notifyAfterEdit }), _jsx(FlexDistributionControl, { domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit })] }), isFlexWrapped ? (_jsx(FlexGapField, { property: lineGap, domElement: el, editTarget: editTarget, selection: selection, entries: allEntries, tokenRows: tokenRows, onAfterEdit: notifyAfterEdit })) : null] }) })] })] })) : null, isFlexChild ? (_jsxs("div", { className: "layout__group", "data-test": "layout-flex-child", children: [_jsx("div", { className: "editor__title", children: "Flex Child" }), _jsxs("div", { className: "layout__flex-child-fields", children: [_jsx(FlexChildValueField, { label: "Grow", property: "flex-grow", presets: FLEX_GROW_PRESETS, domElement: el, editTarget: editTarget, selection: selection, inputOnly: true, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsx(FlexChildValueField, { label: "Shrink", property: "flex-shrink", presets: FLEX_SHRINK_PRESETS, domElement: el, editTarget: editTarget, selection: selection, inputOnly: true, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsx(FlexChildValueField, { label: "Basis", property: "flex-basis", presets: FLEX_BASIS_PRESETS, domElement: el, editTarget: editTarget, selection: selection, inputOnly: true, revision: layoutRevision, onAfterEdit: notifyAfterEdit }), _jsx(FlexChildSettingsMenu, { domElement: el, editTarget: editTarget, selection: selection, revision: layoutRevision, onAfterEdit: notifyAfterEdit })] })] })) : null, isGridContainer || isGridChild ? (_jsx(GridSection, { domElement: el, showContainer: isGridContainer, showChild: isGridChild, editTarget: editTarget, selection: selection, entries: allEntries, tokenRows: tokenRows, revision: layoutRevision, onAfterEdit: notifyAfterEdit })) : null, showPositionInsets ? (_jsx(PositionInsets, { domElement: el, editTarget: editTarget, selection: selection, entries: allEntries, tokenRows: tokenRows, revision: layoutRevision, onAfterEdit: notifyAfterEdit })) : null] })] }));
|
|
107
|
+
}
|
|
108
|
+
function SizeSection({ domElement: el, editTarget, selection, entries, tokenRows, revision, onAfterEdit }) {
|
|
109
|
+
const [expanded, setExpanded] = useState(false);
|
|
110
|
+
const fields = [
|
|
111
|
+
{ property: "width", presets: SIZE_PRESETS },
|
|
112
|
+
{ property: "height", presets: SIZE_PRESETS },
|
|
113
|
+
{ property: "min-width", presets: MIN_SIZE_PRESETS },
|
|
114
|
+
{ property: "min-height", presets: MIN_SIZE_PRESETS },
|
|
115
|
+
{ property: "max-width", presets: MAX_WIDTH_PRESETS },
|
|
116
|
+
{ property: "max-height", presets: MAX_HEIGHT_PRESETS },
|
|
117
|
+
];
|
|
118
|
+
function renderTokenField(property, presets) {
|
|
119
|
+
return (_jsx(ControlSurface, { className: property === "width" || property === "height" ? "layout__size-field--icon" : undefined, children: _jsx(TokenField, { property: property, selection: selection, tokenRow: tokenRows.find((row) => row.property === property) ?? null, initialValue: meaningfulLayoutValue(el, property), domElement: el, editTarget: editTarget, entries: entries, suggestions: presets, leading: property === "width"
|
|
120
|
+
? _jsx(IconLetterW, { size: "var(--icon-size-small)", stroke: 1.8, "aria-hidden": "true" })
|
|
121
|
+
: property === "height"
|
|
122
|
+
? _jsx(IconLetterH, { size: "var(--icon-size-small)", stroke: 1.8, "aria-hidden": "true" })
|
|
123
|
+
: undefined, onAfterEdit: onAfterEdit }) }));
|
|
124
|
+
}
|
|
125
|
+
return (_jsx("div", { className: "layout__size", "data-test": "layout-size", "data-expanded": expanded ? "true" : "false", children: _jsxs("div", { className: "layout__size-grid", children: [_jsx(FieldRow, { label: "Width", hideLabel: true, "data-test": "layout-size-width", className: "layout__size-cell layout__size-cell--width", children: renderTokenField("width", SIZE_PRESETS) }), _jsx(FieldRow, { label: "Height", hideLabel: true, "data-test": "layout-size-height", className: "layout__size-cell layout__size-cell--height", children: renderTokenField("height", SIZE_PRESETS) }), _jsx(IconButton, { className: "layout__size-cell layout__size-cell--toggle", variant: "quiet", size: "default", "data-test": expanded ? "layout-size-collapse" : "layout-size-expand", "aria-label": expanded ? "Collapse Size Fields" : "Expand Size Fields", label: expanded ? "Collapse Size Fields" : "Expand Size Fields", title: expanded ? "Collapse Size Fields" : "Expand Size Fields", onClick: () => setExpanded(!expanded), children: expanded ? (_jsx(IconArrowsMinimize, { size: 16, stroke: 1.8, "aria-hidden": "true" })) : (_jsx(IconArrowsMaximize, { size: 16, stroke: 1.8, "aria-hidden": "true" })) }), expanded && fields.slice(2).map(({ property, presets }) => (_jsx(FieldRow, { label: property, "data-test": `layout-size-${property}`, className: `layout__size-cell layout__size-cell--${property}`, children: renderTokenField(property, presets) }, property))), expanded && (_jsx(AspectRatioField, { className: "layout__size-cell layout__size-cell--aspect-ratio", domElement: el, editTarget: editTarget, selection: selection, entries: entries, tokenRow: tokenRows.find((row) => row.property === "aspect-ratio") ?? null, revision: revision, onAfterEdit: onAfterEdit }))] }) }));
|
|
126
|
+
}
|
|
127
|
+
function FlexChildValueField({ label, property, presets, inputOnly = false, domElement, editTarget, selection, revision = 0, onAfterEdit }) {
|
|
128
|
+
return (_jsx(FieldRow, { label: label, className: "layout__flex-child-field", children: _jsx(LayoutComboField, { property: property, presets: presets, domElement: domElement, editTarget: editTarget, selection: selection, inputOnly: inputOnly, revision: revision, onAfterEdit: onAfterEdit }) }));
|
|
129
|
+
}
|
|
130
|
+
function FlexChildSettingsMenu({ domElement, editTarget, selection, revision = 0, onAfterEdit }) {
|
|
131
|
+
const [open, setOpen] = useState(false);
|
|
132
|
+
return (_jsx(InspectorPopover, { "data-test": "layout-flex-child-settings", side: "left", align: "start", triggerElement: (_jsx(IconButton, { variant: "quiet", size: "default", label: "Flex child settings", title: "Flex child settings", "data-test": "layout-flex-child-settings", children: _jsx(IconSettings, { size: 16, stroke: 1.8, "aria-hidden": "true" }) })), open: open, onOpenChange: setOpen, children: _jsxs("div", { className: "layout__flex-child-settings", "data-test": "layout-flex-child-settings-content", children: [_jsx("div", { className: "layout__flex-child-settings-title", children: "Flex Child Settings" }), _jsx(LayoutDropdown, { property: "align-self", options: ALIGN_SELF_OPTIONS, domElement: domElement, editTarget: editTarget, selection: selection, stacked: true, revision: revision, onAfterEdit: onAfterEdit }), _jsx(FlexChildValueField, { label: "Order", property: "order", presets: ORDER_PRESETS, domElement: domElement, editTarget: editTarget, selection: selection, revision: revision, onAfterEdit: onAfterEdit })] }) }));
|
|
133
|
+
}
|
|
134
|
+
function FlexGapField({ property, domElement, editTarget, selection, entries, tokenRows, onAfterEdit }) {
|
|
135
|
+
const field = (_jsx(GapField, { property: property, domElement: domElement, editTarget: editTarget, selection: selection, entries: entries, tokenRows: tokenRows, onAfterEdit: onAfterEdit }));
|
|
136
|
+
return (_jsxs(ControlSurface, { className: "layout__spacing-field", children: [property === "column-gap" ? (_jsx(IconSpacingHorizontal, { className: "layout__spacing-icon", size: "var(--icon-size-small)", stroke: 1.8, "aria-hidden": "true", "data-test": `layout-spacing-icon-${property}` })) : (_jsx(IconSpacingVertical, { className: "layout__spacing-icon", size: "var(--icon-size-small)", stroke: 1.8, "aria-hidden": "true", "data-test": `layout-spacing-icon-${property}` })), field] }));
|
|
137
|
+
}
|
|
138
|
+
function FlexDirectionControl({ domElement, editTarget, selection, revision = 0, onAfterEdit }) {
|
|
139
|
+
const [direction, setDirection] = useComputedLayoutValue(domElement, "flex-direction", "row", revision);
|
|
140
|
+
const selectedDirection = selection?.getProperty("flex-direction")?.value;
|
|
141
|
+
const mixed = selectedDirection?.kind === "mixed";
|
|
142
|
+
const sharedDirection = selectedDirection?.kind === "common" ? selectedDirection.value : direction;
|
|
143
|
+
const orientation = sharedDirection.startsWith("column") ? "column" : "row";
|
|
144
|
+
const reverse = sharedDirection.endsWith("-reverse");
|
|
145
|
+
function selectDirection(next) {
|
|
146
|
+
if (!FLEX_DIRECTION_OPTIONS.includes(next))
|
|
147
|
+
return;
|
|
148
|
+
setDirection(next);
|
|
149
|
+
setStyle(editTarget ?? domElement, "flex-direction", next);
|
|
150
|
+
onAfterEdit?.();
|
|
151
|
+
}
|
|
152
|
+
return (_jsx(SegmentedControl, { value: mixed ? null : orientation, "aria-label": "Flex direction", options: [
|
|
153
|
+
{
|
|
154
|
+
value: "row",
|
|
155
|
+
label: "Set Flex Direction To Row",
|
|
156
|
+
testId: "layout-direction-row",
|
|
157
|
+
icon: (_jsx("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", children: _jsx("path", { d: "M2 8h11M9 4l4 4-4 4", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "var(--icon-stroke-width)" }) })),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
value: "column",
|
|
161
|
+
label: "Set Flex Direction To Column",
|
|
162
|
+
testId: "layout-direction-column",
|
|
163
|
+
icon: (_jsx("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", children: _jsx("path", { d: "M8 2v11M4 9l4 4 4-4", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "var(--icon-stroke-width)" }) })),
|
|
164
|
+
},
|
|
165
|
+
], onChange: (next) => selectDirection(`${next}${!mixed && reverse ? "-reverse" : ""}`) }));
|
|
166
|
+
}
|
|
167
|
+
function FlexWrapToggle({ domElement, editTarget, selection, revision = 0, onAfterEdit }) {
|
|
168
|
+
const [wrap] = useComputedLayoutValue(domElement, "flex-wrap", "nowrap", revision);
|
|
169
|
+
const selectedWrap = selection?.getProperty("flex-wrap")?.value;
|
|
170
|
+
const mixed = selectedWrap?.kind === "mixed";
|
|
171
|
+
const sharedWrap = selectedWrap?.kind === "common" ? selectedWrap.value : wrap;
|
|
172
|
+
const isWrapped = !mixed && sharedWrap !== "nowrap";
|
|
173
|
+
function toggleWrap() {
|
|
174
|
+
setStyle(editTarget ?? domElement, "flex-wrap", isWrapped ? "nowrap" : "wrap");
|
|
175
|
+
onAfterEdit?.();
|
|
176
|
+
}
|
|
177
|
+
return (_jsx(IconButton, { variant: "secondary", size: "default", "data-active": isWrapped, "data-test": "layout-flex-wrap-toggle", label: mixed ? "Set Flex Wrap" : isWrapped ? "Disable Flex Wrap" : "Enable Flex Wrap", "aria-pressed": mixed ? "mixed" : isWrapped, onClick: toggleWrap, children: _jsx(IconTextWrap, { size: 16, stroke: 1.8, "aria-hidden": "true" }) }));
|
|
178
|
+
}
|
|
179
|
+
function FlexSettingsMenu({ domElement, editTarget, selection, revision = 0, onAfterEdit }) {
|
|
180
|
+
const [direction] = useComputedLayoutValue(domElement, "flex-direction", "row", revision);
|
|
181
|
+
const [wrap] = useComputedLayoutValue(domElement, "flex-wrap", "nowrap", revision);
|
|
182
|
+
const [alignContent] = useComputedLayoutValue(domElement, "align-content", "normal", revision);
|
|
183
|
+
const [alignItems] = useComputedLayoutValue(domElement, "align-items", "stretch", revision);
|
|
184
|
+
const [open, setOpen] = useState(false);
|
|
185
|
+
const selectedDirection = selection?.getProperty("flex-direction")?.value;
|
|
186
|
+
const selectedWrap = selection?.getProperty("flex-wrap")?.value;
|
|
187
|
+
const mixedDirection = selectedDirection?.kind === "mixed";
|
|
188
|
+
const mixedWrap = selectedWrap?.kind === "mixed";
|
|
189
|
+
const sharedDirection = selectedDirection?.kind === "common"
|
|
190
|
+
? selectedDirection.value
|
|
191
|
+
: direction;
|
|
192
|
+
const sharedWrap = selectedWrap?.kind === "common" ? selectedWrap.value : wrap;
|
|
193
|
+
const orientation = sharedDirection.startsWith("column") ? "column" : "row";
|
|
194
|
+
const crossAxis = mixedDirection ? "cross axis" : orientation === "column" ? "width" : "height";
|
|
195
|
+
const isStretching = normalizeFlexAlign(alignItems) === "stretch";
|
|
196
|
+
const reverseDirection = sharedDirection.endsWith("-reverse")
|
|
197
|
+
? orientation
|
|
198
|
+
: `${orientation}-reverse`;
|
|
199
|
+
const items = [
|
|
200
|
+
...(mixedDirection ? [] : [{
|
|
201
|
+
value: `flex-direction:${reverseDirection}`,
|
|
202
|
+
label: formatInspectorLabel(reverseDirection),
|
|
203
|
+
trailing: "Flex Direction",
|
|
204
|
+
current: sharedDirection === reverseDirection,
|
|
205
|
+
"data-test": "layout-flex-setting-direction-reverse",
|
|
206
|
+
}]),
|
|
207
|
+
...(mixedWrap ? [] : [{
|
|
208
|
+
value: "flex-wrap:wrap-reverse",
|
|
209
|
+
label: formatInspectorLabel("wrap-reverse"),
|
|
210
|
+
trailing: "Flex Wrap",
|
|
211
|
+
current: sharedWrap === "wrap-reverse",
|
|
212
|
+
"data-test": "layout-flex-setting-wrap-reverse",
|
|
213
|
+
}]),
|
|
214
|
+
...ALIGN_CONTENT_OPTIONS.map((value) => ({
|
|
215
|
+
value: `align-content:${value}`,
|
|
216
|
+
label: formatInspectorLabel(value),
|
|
217
|
+
trailing: "Align Content",
|
|
218
|
+
current: alignContent === value,
|
|
219
|
+
"data-test": `layout-flex-setting-align-content-${value}`,
|
|
220
|
+
})),
|
|
221
|
+
{
|
|
222
|
+
value: "align-items:baseline",
|
|
223
|
+
label: "Text baseline",
|
|
224
|
+
trailing: "Cross-axis fit",
|
|
225
|
+
current: alignItems === "baseline",
|
|
226
|
+
"data-test": "layout-flex-setting-align-items-baseline",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
value: "align-items:stretch",
|
|
230
|
+
label: `Children fill ${crossAxis}`,
|
|
231
|
+
trailing: "Cross-axis fit",
|
|
232
|
+
current: isStretching,
|
|
233
|
+
"data-test": "layout-flex-setting-align-items-stretch",
|
|
234
|
+
},
|
|
235
|
+
];
|
|
236
|
+
function selectSetting(setting) {
|
|
237
|
+
const separator = setting.indexOf(":");
|
|
238
|
+
if (separator < 0)
|
|
239
|
+
return;
|
|
240
|
+
const property = setting.slice(0, separator);
|
|
241
|
+
const value = setting.slice(separator + 1);
|
|
242
|
+
setStyle(editTarget ?? domElement, property, value);
|
|
243
|
+
setOpen(false);
|
|
244
|
+
onAfterEdit?.();
|
|
245
|
+
}
|
|
246
|
+
return (_jsx(PopoverListbox, { query: "", value: null, open: open, triggerElement: (_jsx(IconButton, { variant: "quiet", size: "default", label: "Flex settings", "data-test": "layout-flex-settings", children: _jsx(IconSettings, { size: 16, stroke: 1.8, "aria-hidden": "true" }) })), triggerDataTest: "layout-flex-settings", triggerAriaLabel: "Flex settings", items: items.map((item) => ({
|
|
247
|
+
value: item.value,
|
|
248
|
+
label: item.label,
|
|
249
|
+
trailing: item.trailing,
|
|
250
|
+
leading: item.current ? _jsx(IconCheck, { size: 14, stroke: 2, "aria-hidden": "true" }) : undefined,
|
|
251
|
+
"data-test": item["data-test"],
|
|
252
|
+
})), onQueryChange: () => undefined, onOpenChange: setOpen, onSelect: selectSetting }));
|
|
253
|
+
}
|
|
254
|
+
function FlexDistributionControl({ domElement, editTarget, revision = 0, onAfterEdit }) {
|
|
255
|
+
const [computedJustify] = useComputedLayoutValue(domElement, "justify-content", "flex-start", revision);
|
|
256
|
+
const justify = normalizeFlexJustify(computedJustify);
|
|
257
|
+
const lastPlacement = useRef("flex-start");
|
|
258
|
+
const distributed = FLEX_DISTRIBUTION_OPTIONS.includes(justify);
|
|
259
|
+
const [open, setOpen] = useState(false);
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (FLEX_ALIGNMENT_OPTIONS.includes(justify))
|
|
262
|
+
lastPlacement.current = justify;
|
|
263
|
+
}, [justify]);
|
|
264
|
+
function selectDistribution(next) {
|
|
265
|
+
const value = next === "packed" ? lastPlacement.current : next;
|
|
266
|
+
setStyle(editTarget ?? domElement, "justify-content", value);
|
|
267
|
+
onAfterEdit?.();
|
|
268
|
+
}
|
|
269
|
+
return (_jsx(PopoverListbox, { className: "layout__distribution-control", query: "", value: distributed ? justify : "packed", open: open, triggerElement: (_jsx(IconButton, { variant: "quiet", size: "default", label: "Item distribution", title: "Item distribution", "data-active": distributed, "data-test": "layout-flex-distribution", children: _jsx(IconAdjustmentsHorizontal, { size: 16, stroke: 1.8, "aria-hidden": "true" }) })), triggerDataTest: "layout-flex-distribution", triggerAriaLabel: "Item distribution", items: [
|
|
270
|
+
{ value: "packed", label: "Keep grouped" },
|
|
271
|
+
{ value: "space-between", label: "Spread between" },
|
|
272
|
+
{ value: "space-around", label: "Spread around" },
|
|
273
|
+
{ value: "space-evenly", label: "Spread evenly" },
|
|
274
|
+
].map((item) => ({
|
|
275
|
+
...item,
|
|
276
|
+
leading: (distributed ? justify : "packed") === item.value
|
|
277
|
+
? _jsx(IconCheck, { size: 14, stroke: 2, "aria-hidden": "true" })
|
|
278
|
+
: undefined,
|
|
279
|
+
"data-test": `layout-flex-distribution-${item.value}`,
|
|
280
|
+
})), onQueryChange: () => undefined, onOpenChange: setOpen, onSelect: (next) => {
|
|
281
|
+
selectDistribution(next);
|
|
282
|
+
setOpen(false);
|
|
283
|
+
} }));
|
|
284
|
+
}
|
|
285
|
+
function FlexAlignmentGrid({ domElement, editTarget, revision = 0, onAfterEdit }) {
|
|
286
|
+
const [direction] = useComputedLayoutValue(domElement, "flex-direction", "row", revision);
|
|
287
|
+
const [computedJustify, setJustify] = useComputedLayoutValue(domElement, "justify-content", "flex-start", revision);
|
|
288
|
+
const [computedAlign, setAlign] = useComputedLayoutValue(domElement, "align-items", "stretch", revision);
|
|
289
|
+
const justify = normalizeFlexJustify(computedJustify);
|
|
290
|
+
const align = normalizeFlexAlign(computedAlign);
|
|
291
|
+
const isColumn = direction.startsWith("column");
|
|
292
|
+
const isReverse = direction.endsWith("-reverse");
|
|
293
|
+
const distributed = FLEX_DISTRIBUTION_OPTIONS.includes(justify);
|
|
294
|
+
// The grid represents physical positions in the parent. For row flex
|
|
295
|
+
// containers, justify-content runs horizontally; for column flex
|
|
296
|
+
// containers, it runs vertically, so the two grid axes need to transpose.
|
|
297
|
+
const rowValues = isColumn
|
|
298
|
+
? isReverse ? [...FLEX_ALIGNMENT_OPTIONS].reverse() : FLEX_ALIGNMENT_OPTIONS
|
|
299
|
+
: FLEX_ALIGNMENT_OPTIONS;
|
|
300
|
+
const columnValues = !isColumn && isReverse
|
|
301
|
+
? [...FLEX_ALIGNMENT_OPTIONS].reverse()
|
|
302
|
+
: FLEX_ALIGNMENT_OPTIONS;
|
|
303
|
+
function selectAlignment(nextJustify, nextAlign) {
|
|
304
|
+
// Keep an explicit distribution choice when the grid is used to change
|
|
305
|
+
// the cross-axis alignment. The distribution control owns values such as
|
|
306
|
+
// `space-between`; a grid click should not silently replace them with the
|
|
307
|
+
// packed default.
|
|
308
|
+
const resolvedJustify = distributed ? justify : nextJustify;
|
|
309
|
+
setJustify(resolvedJustify);
|
|
310
|
+
setAlign(nextAlign);
|
|
311
|
+
setStyles(editTarget ?? domElement, [
|
|
312
|
+
{ property: "justify-content", value: resolvedJustify },
|
|
313
|
+
{ property: "align-items", value: nextAlign },
|
|
314
|
+
]);
|
|
315
|
+
onAfterEdit?.();
|
|
316
|
+
}
|
|
317
|
+
return (_jsxs("div", { className: "layout__alignment-grid", role: "group", "aria-label": "Place flex items", "data-direction": isColumn ? "column" : "row", "data-justify": justify, "data-align": align, "data-distributed": distributed, children: [distributed ? (_jsxs("span", { className: "layout__distribution-preview", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] })) : null, rowValues.flatMap((rowValue) => columnValues.map((columnValue) => {
|
|
318
|
+
const justifyValue = isColumn ? rowValue : columnValue;
|
|
319
|
+
const alignValue = isColumn ? columnValue : rowValue;
|
|
320
|
+
const active = justify === justifyValue && align === alignValue;
|
|
321
|
+
return (_jsx(IconButton, { size: "default", variant: "quiet", className: "layout__alignment-button", "data-active": active, "data-test": `layout-align-${alignValue}-${justifyValue}`, label: formatInspectorLabel(`Align ${alignValue.replace("flex-", "")} And Distribute ${justifyValue.replace("flex-", "")}`), "aria-pressed": active, onClick: () => selectAlignment(justifyValue, alignValue), children: _jsx("span", {}) }, `${alignValue}-${justifyValue}`));
|
|
322
|
+
}))] }));
|
|
323
|
+
}
|
|
324
|
+
function normalizeFlexJustify(value) {
|
|
325
|
+
// `normal` is the computed initial value, but behaves as `flex-start` for
|
|
326
|
+
// flex containers. Show the physical placement the user will actually see.
|
|
327
|
+
return value === "normal" ? "flex-start" : value;
|
|
328
|
+
}
|
|
329
|
+
function normalizeFlexAlign(value) {
|
|
330
|
+
// The initial `normal` value resolves to stretch for flex items.
|
|
331
|
+
return value === "normal" ? "stretch" : value;
|
|
332
|
+
}
|
|
333
|
+
function useComputedLayoutValue(domElement, property, fallback, revision) {
|
|
334
|
+
const [value, setValue] = useState(() => readLayoutValue(domElement, property, fallback));
|
|
335
|
+
useEffect(() => {
|
|
336
|
+
setValue(readLayoutValue(domElement, property, fallback));
|
|
337
|
+
}, [domElement, property, fallback, revision]);
|
|
338
|
+
return [value, setValue];
|
|
339
|
+
}
|
|
340
|
+
function readLayoutValue(domElement, property, fallback) {
|
|
341
|
+
return getStateStyleValue(domElement, property, fallback);
|
|
342
|
+
}
|
|
@@ -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 OpacityEditorProps {
|
|
7
|
+
element: SelectedElement;
|
|
8
|
+
selection?: StyleSelection | null;
|
|
9
|
+
entries?: TokenEntry[];
|
|
10
|
+
tokenRows?: ResolvedProperty[];
|
|
11
|
+
onAfterEdit?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function OpacityEditor({ element, selection, entries, tokenRows, onAfterEdit }: OpacityEditorProps): ReactElement;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconBackground } from "@tabler/icons-react";
|
|
3
|
+
import { normalizeOpacityPercent } from "../../css/value-semantics/index.js";
|
|
4
|
+
import { metadataFor } from "./rowLookup.js";
|
|
5
|
+
import { getStateStyleValue } from "../shell/stateValue.js";
|
|
6
|
+
import { ControlSurface } from "../ui/ControlSurface.js";
|
|
7
|
+
import { TokenField } from "../tokens/TokenField.js";
|
|
8
|
+
import { getNudgeUiTokenEntries } from "../runtime/runtimeConfig.js";
|
|
9
|
+
function effectiveOpacity(element, row) {
|
|
10
|
+
return row?.propertyOpacity?.value
|
|
11
|
+
?? normalizeOpacityPercent(row?.resolvedValue ?? "")
|
|
12
|
+
?? normalizeOpacityPercent(getStateStyleValue(element, "opacity", "1"))
|
|
13
|
+
?? "100%";
|
|
14
|
+
}
|
|
15
|
+
export function OpacityEditor({ element, selection, entries, tokenRows = [], onAfterEdit }) {
|
|
16
|
+
const el = element.domElement;
|
|
17
|
+
const editTarget = selection?.target ?? el;
|
|
18
|
+
const allEntries = entries ?? getNudgeUiTokenEntries();
|
|
19
|
+
const row = tokenRows.find((candidate) => candidate.property === "opacity") ?? null;
|
|
20
|
+
const selectedProperty = selection && selection.elements.length > 1
|
|
21
|
+
? selection.getProperty("opacity")
|
|
22
|
+
: null;
|
|
23
|
+
const mixed = selectedProperty?.value.kind === "mixed";
|
|
24
|
+
const value = mixed
|
|
25
|
+
? "Mixed"
|
|
26
|
+
: selectedProperty?.value.kind === "common" ? selectedProperty.value.value : effectiveOpacity(el, row);
|
|
27
|
+
const editable = row?.propertyOpacity?.editable ?? true;
|
|
28
|
+
const activeToken = mixed
|
|
29
|
+
? null
|
|
30
|
+
: selectedProperty
|
|
31
|
+
? selectedProperty.token.kind === "common" ? selectedProperty.token.name : null
|
|
32
|
+
: row?.propertyOpacity?.tokenName ?? row?.tokenName;
|
|
33
|
+
return (_jsxs("div", { className: "appearance__field opacity-editor", "data-test": "opacity-editor", children: [_jsx("div", { className: "appearance__field-label", children: "Opacity" }), _jsx(ControlSurface, { "data-test": "opacity-control", children: _jsx(TokenField, { property: "opacity", semanticSlot: "opacity", tokenRow: row, selection: selection, initialValue: value, displayValue: value, domElement: el, editTarget: editTarget, entries: allEntries, inputDataTest: "opacity-input", editMetadata: metadataFor(row), disabled: !editable, mixed: mixed, formatRawValue: (raw) => normalizeOpacityPercent(raw) ?? "", leading: _jsx(IconBackground, { size: 16, stroke: 1.8, "aria-hidden": "true" }), trailing: activeToken ? _jsx("span", { className: "opacity-editor__effective", "data-test": "opacity-effective", children: value }) : undefined, label: "Opacity", onAfterEdit: onAfterEdit, chipVariant: "small" }) })] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 interface PositionInsetsProps {
|
|
7
|
+
domElement: HTMLElement;
|
|
8
|
+
editTarget?: EditTarget;
|
|
9
|
+
selection?: StyleSelection | null;
|
|
10
|
+
entries?: TokenEntry[];
|
|
11
|
+
tokenRows?: ResolvedProperty[];
|
|
12
|
+
revision?: number;
|
|
13
|
+
onAfterEdit?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function PositionInsets({ domElement: el, editTarget, selection, entries, tokenRows, onAfterEdit, }: PositionInsetsProps): ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getNudgeUiTokenEntries } from "../runtime/runtimeConfig.js";
|
|
3
|
+
import { projectInspectorValues, projectInspectorValuesForSelection } from "../spacing/projection.js";
|
|
4
|
+
import { SpacingField } from "./SpacingBox.js";
|
|
5
|
+
const OFFSET_PRESETS = ["auto", "0", "50%", "100%"];
|
|
6
|
+
export function PositionInsets({ domElement: el, editTarget, selection, entries, tokenRows = [], onAfterEdit, }) {
|
|
7
|
+
const allEntries = entries ?? getNudgeUiTokenEntries();
|
|
8
|
+
const projection = selection
|
|
9
|
+
? projectInspectorValuesForSelection(selection)
|
|
10
|
+
: projectInspectorValues(el, tokenRows);
|
|
11
|
+
return (_jsxs("div", { className: "layout__group", "data-test": "layout-position", children: [_jsx("div", { className: "editor__title", children: "Position" }), _jsx(SpacingField, { property: "inset", projection: projection.spacing.inset, domElement: el, editTarget: editTarget, selection: selection, entries: allEntries, tokenRows: tokenRows, onAfterEdit: onAfterEdit, showLabel: false, showEmptyState: false, suggestions: OFFSET_PRESETS })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ResolvedProperty } from "../../css/model/index.js";
|
|
3
|
+
import type { TokenEntry } from "../../css/model/index.js";
|
|
4
|
+
import type { SelectedElement } from "../selection/selectionStore.js";
|
|
5
|
+
import { type InspectorSpacingProjection } from "../spacing/projection.js";
|
|
6
|
+
import type { EditTarget } from "../selection/editTarget.js";
|
|
7
|
+
import type { StyleSelection } from "../selection/styleSelection.js";
|
|
8
|
+
export interface SpacingBoxProps {
|
|
9
|
+
element: SelectedElement;
|
|
10
|
+
selection?: StyleSelection | null;
|
|
11
|
+
entries?: TokenEntry[];
|
|
12
|
+
tokenRows?: ResolvedProperty[];
|
|
13
|
+
onAfterEdit?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function SpacingBox(props: SpacingBoxProps): ReactElement;
|
|
16
|
+
export interface SpacingFieldProps {
|
|
17
|
+
property: "padding" | "margin" | "inset";
|
|
18
|
+
projection: InspectorSpacingProjection;
|
|
19
|
+
domElement: HTMLElement;
|
|
20
|
+
editTarget?: EditTarget;
|
|
21
|
+
selection?: StyleSelection | null;
|
|
22
|
+
entries: TokenEntry[];
|
|
23
|
+
tokenRows: ResolvedProperty[];
|
|
24
|
+
onAfterEdit?: () => void;
|
|
25
|
+
showLabel?: boolean;
|
|
26
|
+
showEmptyState?: boolean;
|
|
27
|
+
suggestions?: ReadonlyArray<string>;
|
|
28
|
+
}
|
|
29
|
+
export declare function SpacingField({ property, projection: spacingProjection, domElement: el, editTarget, selection, entries, tokenRows, onAfterEdit, showLabel, showEmptyState, suggestions, }: SpacingFieldProps): ReactElement;
|