nudge-ui 0.2.5 → 0.2.6
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/dist/cli/agentCommand.d.ts +0 -1
- package/dist/cli/agentCommand.js +0 -1
- package/dist/client.mjs +238 -122
- package/dist/compiler/ast.d.ts +0 -6
- package/dist/compiler/ast.js +0 -5
- package/dist/compiler/componentContractTypes.d.ts +11 -5
- package/dist/compiler/componentContracts.js +3 -9
- package/dist/compiler/componentInstrumentation.d.ts +2 -13
- package/dist/compiler/componentInstrumentation.js +3 -12
- package/dist/compiler/componentPolicyResolution.d.ts +3 -22
- package/dist/compiler/componentPolicyResolution.js +6 -38
- package/dist/compiler/identityAttributes.d.ts +2 -0
- package/dist/compiler/identityAttributes.js +2 -0
- package/dist/compiler/index.d.ts +0 -1
- package/dist/compiler/index.js +0 -1
- package/dist/compiler/packageComponentContracts.d.ts +10 -19
- package/dist/compiler/packageComponentContracts.js +60 -43
- package/dist/compiler/reactComponentProtocols.d.ts +0 -7
- package/dist/compiler/reactComponentProtocols.js +0 -7
- package/dist/compiler/reactIdentity.d.ts +2 -2
- package/dist/compiler/reactIdentity.js +41 -43
- package/dist/compiler/sourcePaths.d.ts +4 -8
- package/dist/compiler/sourcePaths.js +6 -8
- package/dist/css/dialects/index.d.ts +2 -21
- package/dist/css/dialects/index.js +2 -9
- package/dist/css/dialects/tailwind.d.ts +2 -16
- package/dist/css/dialects/tailwind.js +2 -25
- package/dist/css/dialects/vanillaExtract.d.ts +1 -9
- package/dist/css/dialects/vanillaExtract.js +0 -1
- package/dist/css/index.d.ts +0 -8
- package/dist/css/index.js +0 -8
- package/dist/css/model/index.d.ts +6 -38
- package/dist/css/model/index.js +0 -9
- package/dist/css/token-inventory/index.d.ts +0 -23
- package/dist/css/token-inventory/index.js +0 -23
- package/dist/css/token-inventory/inventory.js +4 -16
- package/dist/css/token-inventory/parseStylesheet.d.ts +1 -9
- package/dist/css/token-inventory/parseStylesheet.js +5 -42
- package/dist/css/token-inventory/policy.d.ts +2 -39
- package/dist/css/token-inventory/policy.js +2 -39
- package/dist/css/token-inventory/types.d.ts +2 -15
- package/dist/css/value-semantics/borderSemantics.d.ts +1 -8
- package/dist/css/value-semantics/borderSemantics.js +5 -23
- package/dist/css/value-semantics/boxSemantics.d.ts +2 -25
- package/dist/css/value-semantics/boxSemantics.js +1 -7
- package/dist/css/value-semantics/colorSemantics.d.ts +6 -60
- package/dist/css/value-semantics/colorSemantics.js +9 -40
- package/dist/css/value-semantics/cssSyntax.d.ts +10 -10
- package/dist/css/value-semantics/cssSyntax.js +39 -11
- package/dist/css/value-semantics/fontSemantics.d.ts +3 -19
- package/dist/css/value-semantics/fontSemantics.js +7 -25
- package/dist/css/value-semantics/index.d.ts +1 -12
- package/dist/css/value-semantics/index.js +1 -12
- package/dist/css/value-semantics/propertyPolicy.d.ts +6 -53
- package/dist/css/value-semantics/propertyPolicy.js +47 -59
- package/dist/css/value-semantics/stringMaps.d.ts +0 -1
- package/dist/css/value-semantics/structuredValues.d.ts +3 -37
- package/dist/css/value-semantics/structuredValues.js +6 -17
- package/dist/css/value-semantics/tokenInterpretation.d.ts +8 -50
- package/dist/css/value-semantics/tokenInterpretation.js +7 -21
- package/dist/hosts/astro/astroRuntimeConfig.d.ts +0 -1
- package/dist/hosts/astro/astroRuntimeConfig.js +0 -1
- package/dist/hosts/astro/clientAsset.d.ts +1 -5
- package/dist/hosts/astro/clientAsset.js +1 -5
- package/dist/hosts/astro/clientTransport.d.ts +0 -1
- package/dist/hosts/astro/clientTransport.js +4 -9
- package/dist/hosts/astro/integration.d.ts +2 -28
- package/dist/hosts/astro/integration.js +7 -36
- package/dist/hosts/astro/markdownIdentity.d.ts +0 -3
- package/dist/hosts/astro/markdownIdentity.js +0 -3
- package/dist/hosts/astro/middleware.d.ts +1 -12
- package/dist/hosts/astro/middleware.js +1 -12
- package/dist/hosts/astro/projectContext.d.ts +1 -9
- package/dist/hosts/astro/projectContext.js +2 -11
- package/dist/hosts/astro/responseInstrumentation.d.ts +4 -33
- package/dist/hosts/astro/responseInstrumentation.js +5 -34
- package/dist/hosts/environment.d.ts +0 -8
- package/dist/hosts/environment.js +0 -1
- package/dist/hosts/next/index.js +1 -3
- package/dist/hosts/next/loader.d.ts +5 -44
- package/dist/hosts/next/loader.js +22 -103
- package/dist/hosts/next/loaders/identity-loader.cjs +111 -65
- package/dist/hosts/next/loaders/loader-plugin.cjs +111 -65
- package/dist/hosts/next/manifest.d.ts +2 -16
- package/dist/hosts/next/manifest.js +18 -20
- package/dist/hosts/next/mount.d.ts +1 -11
- package/dist/hosts/next/mount.js +1 -11
- package/dist/hosts/next/repositoryScope.d.ts +2 -17
- package/dist/hosts/next/repositoryScope.js +2 -17
- package/dist/hosts/next/sidecar.d.ts +0 -13
- package/dist/hosts/next/sidecar.js +25 -110
- package/dist/hosts/next/wrapper.d.ts +0 -31
- package/dist/hosts/next/wrapper.js +13 -64
- package/dist/hosts/projectBridge.d.ts +0 -2
- package/dist/hosts/projectBridge.js +0 -2
- package/dist/hosts/reactRendererCapture.d.ts +2 -0
- package/dist/hosts/reactRendererCapture.js +12 -0
- package/dist/hosts/static/cli.d.ts +0 -4
- package/dist/hosts/static/cli.js +0 -3
- package/dist/hosts/static/html/bootstrap.d.ts +1 -18
- package/dist/hosts/static/html/bootstrap.js +2 -14
- package/dist/hosts/static/manifest.d.ts +2 -15
- package/dist/hosts/static/manifest.js +5 -18
- package/dist/hosts/static/server.d.ts +4 -38
- package/dist/hosts/static/server.js +17 -67
- package/dist/hosts/vite/index.d.ts +0 -10
- package/dist/hosts/vite/index.js +0 -10
- package/dist/hosts/vite/react.d.ts +4 -17
- package/dist/hosts/vite/react.js +18 -35
- package/dist/hosts/vite/tokens/activeStylesheets.d.ts +1 -10
- package/dist/hosts/vite/tokens/activeStylesheets.js +3 -8
- package/dist/hosts/vite/tokens/fileMap.d.ts +0 -1
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.d.ts +2 -15
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.js +3 -10
- package/dist/hosts/vite/vite.d.ts +5 -26
- package/dist/hosts/vite/vite.js +44 -80
- package/dist/html/dom.d.ts +0 -1
- package/dist/html/dom.js +0 -1
- package/dist/html/identity.d.ts +1 -15
- package/dist/html/identity.js +1 -8
- package/dist/html/insertions.d.ts +2 -8
- package/dist/html/insertions.js +1 -1
- package/dist/inspector/agent/McpConnectionDialog.d.ts +1 -6
- package/dist/inspector/agent/McpConnectionDialog.js +1 -6
- package/dist/inspector/agent/activity.d.ts +1 -1
- package/dist/inspector/agent/activity.js +1 -1
- package/dist/inspector/agent/client.d.ts +2 -26
- package/dist/inspector/agent/client.js +17 -64
- package/dist/inspector/agent/connectionStatus.d.ts +0 -1
- package/dist/inspector/agent/connectionStatus.js +0 -1
- package/dist/inspector/agent/httpTransport.d.ts +0 -8
- package/dist/inspector/agent/httpTransport.js +21 -39
- package/dist/inspector/agent/protocol.d.ts +1 -10
- package/dist/inspector/agent/protocol.js +1 -9
- package/dist/inspector/agent/verification.d.ts +2 -19
- package/dist/inspector/agent/verification.js +7 -43
- package/dist/inspector/boot.d.ts +3 -1
- package/dist/inspector/boot.js +12 -20
- package/dist/inspector/canvas/AgentActivityOverlay.d.ts +1 -1
- package/dist/inspector/canvas/AgentActivityOverlay.js +1 -1
- package/dist/inspector/canvas/CanvasCard.js +7 -14
- package/dist/inspector/canvas/CanvasElementOverlay.js +117 -50
- package/dist/inspector/canvas/CanvasWorkspace.js +15 -29
- package/dist/inspector/canvas/PageCard.d.ts +0 -1
- package/dist/inspector/canvas/PageCard.js +0 -1
- package/dist/inspector/canvas/SketchToolOptions.d.ts +0 -1
- package/dist/inspector/canvas/SketchToolOptions.js +0 -6
- package/dist/inspector/canvas/ToolOptionsDrawer.d.ts +1 -6
- package/dist/inspector/canvas/ToolOptionsDrawer.js +2 -8
- package/dist/inspector/canvas/activeCanvasDocument.d.ts +0 -2
- package/dist/inspector/canvas/activeCanvasDocument.js +0 -2
- package/dist/inspector/canvas/agentPresentation.d.ts +2 -13
- package/dist/inspector/canvas/agentPresentation.js +3 -14
- package/dist/inspector/canvas/canvasFrame.d.ts +2 -6
- package/dist/inspector/canvas/canvasFrame.js +1 -2
- package/dist/inspector/canvas/canvasResize.d.ts +1 -6
- package/dist/inspector/canvas/canvasResize.js +1 -6
- package/dist/inspector/canvas/canvasStore.d.ts +4 -12
- package/dist/inspector/canvas/canvasStore.js +12 -26
- package/dist/inspector/canvas/frameConnection.d.ts +1 -7
- package/dist/inspector/canvas/frameContent.d.ts +0 -1
- package/dist/inspector/canvas/frameLifecycle.d.ts +12 -0
- package/dist/inspector/canvas/frameLifecycle.js +11 -0
- package/dist/inspector/canvas/frameProtocol.d.ts +5 -40
- package/dist/inspector/canvas/frameProtocol.js +1 -24
- package/dist/inspector/canvas/frameScrollbarStyles.d.ts +0 -1
- package/dist/inspector/canvas/frameScrollbarStyles.js +0 -1
- package/dist/inspector/canvas/layout.d.ts +10 -22
- package/dist/inspector/canvas/layout.js +0 -3
- package/dist/inspector/canvas/normalizeUrl.js +1 -8
- package/dist/inspector/canvas/pageSurface.d.ts +1 -6
- package/dist/inspector/canvas/pageSurface.js +1 -6
- package/dist/inspector/canvas/projection.d.ts +4 -25
- package/dist/inspector/canvas/projection.js +22 -72
- package/dist/inspector/canvas/rendererBootstrap.d.ts +8 -1
- package/dist/inspector/canvas/rendererBootstrap.js +6 -14
- package/dist/inspector/canvas/rendererCidIndex.d.ts +0 -5
- package/dist/inspector/canvas/rendererCidIndex.js +0 -5
- package/dist/inspector/canvas/rendererElementSelector.js +29 -27
- package/dist/inspector/canvas/rendererMessageRouter.d.ts +0 -1
- package/dist/inspector/canvas/rendererMessageRouter.js +0 -1
- package/dist/inspector/canvas/rendererSelectionProxy.d.ts +1 -5
- package/dist/inspector/canvas/rendererSelectionProxy.js +2 -7
- package/dist/inspector/canvas/rendererStylesheet.d.ts +0 -1
- package/dist/inspector/canvas/rendererStylesheet.js +9 -2
- package/dist/inspector/canvas/resizeHandleScale.d.ts +1 -10
- package/dist/inspector/canvas/resizeHandleScale.js +1 -10
- package/dist/inspector/canvas/sessionStore.d.ts +1 -7
- package/dist/inspector/canvas/sessionStore.js +21 -34
- package/dist/inspector/canvas/staleChangeDetector.js +1 -4
- package/dist/inspector/canvas/toolbarScale.d.ts +1 -4
- package/dist/inspector/canvas/toolbarScale.js +1 -4
- package/dist/inspector/canvas/useCanvasLayoutAnimation.d.ts +0 -1
- package/dist/inspector/canvas/useCanvasLayoutAnimation.js +0 -1
- package/dist/inspector/canvas/viewStore.js +1 -1
- package/dist/inspector/canvas/wheelPan.d.ts +1 -1
- package/dist/inspector/canvas/wheelPan.js +1 -1
- package/dist/inspector/canvas/workspaceLease.d.ts +1 -5
- package/dist/inspector/canvas/workspaceLease.js +1 -7
- package/dist/inspector/changes/codecs.js +2 -1
- package/dist/inspector/changes/draftPreview.d.ts +1 -6
- package/dist/inspector/changes/draftPreview.js +15 -30
- package/dist/inspector/changes/editModel.d.ts +3 -13
- package/dist/inspector/changes/editModel.js +1 -2
- package/dist/inspector/changes/managedStyleProjection.js +4 -14
- package/dist/inspector/changes/model.d.ts +0 -5
- package/dist/inspector/changes/model.js +1 -8
- package/dist/inspector/changes/previewDiagnostics.d.ts +2 -12
- package/dist/inspector/changes/previewDiagnostics.js +4 -20
- package/dist/inspector/changes/previewVerification.d.ts +25 -0
- package/dist/inspector/changes/previewVerification.js +34 -0
- package/dist/inspector/changes/structuralTypes.d.ts +2 -4
- package/dist/inspector/changes/types.d.ts +3 -10
- package/dist/inspector/clientManifest.d.ts +17 -6
- package/dist/inspector/clientManifest.js +16 -3
- package/dist/inspector/comments/CommentsOverlay.js +48 -7
- package/dist/inspector/comments/element.d.ts +1 -2
- package/dist/inspector/comments/element.js +1 -2
- package/dist/inspector/comments/store.d.ts +1 -1
- package/dist/inspector/comments/store.js +1 -1
- package/dist/inspector/comments/verification.d.ts +8 -2
- package/dist/inspector/comments/verification.js +18 -10
- package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +8 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.js +10 -7
- package/dist/inspector/componentSemantics/adapterRegistry.d.ts +2 -9
- package/dist/inspector/componentSemantics/adapterRegistry.js +2 -9
- package/dist/inspector/componentSemantics/changeModel.js +2 -4
- package/dist/inspector/componentSemantics/react/callsites.d.ts +28 -0
- package/dist/inspector/componentSemantics/react/callsites.js +261 -0
- package/dist/inspector/componentSemantics/react/devtoolsHook.d.ts +23 -0
- package/dist/inspector/componentSemantics/react/devtoolsHook.js +71 -0
- package/dist/inspector/componentSemantics/react/fibers.d.ts +17 -0
- package/dist/inspector/componentSemantics/react/fibers.js +30 -0
- package/dist/inspector/componentSemantics/{reactRuntime.d.ts → react/runtime.d.ts} +3 -2
- package/dist/inspector/componentSemantics/{reactRuntime.js → react/runtime.js} +70 -53
- package/dist/inspector/componentSemantics/runtimeBridge.d.ts +2 -18
- package/dist/inspector/componentSemantics/runtimeBridge.js +5 -19
- package/dist/inspector/componentSemantics/textBinding.d.ts +1 -9
- package/dist/inspector/componentSemantics/textBinding.js +16 -42
- package/dist/inspector/componentSemantics/types.d.ts +8 -27
- package/dist/inspector/componentSemantics/types.js +0 -1
- package/dist/inspector/conformance/borderCases.d.ts +0 -5
- package/dist/inspector/conformance/borderCases.js +0 -5
- package/dist/inspector/conformance/colorCases.d.ts +0 -6
- package/dist/inspector/conformance/colorCases.js +0 -6
- package/dist/inspector/conformance/fixture.d.ts +1 -5
- package/dist/inspector/conformance/fixture.js +1 -5
- package/dist/inspector/conformance/spacingCases.d.ts +0 -4
- package/dist/inspector/conformance/spacingCases.js +0 -4
- package/dist/inspector/conformance/typographyCases.d.ts +0 -5
- package/dist/inspector/conformance/typographyCases.js +0 -5
- package/dist/inspector/drafts/draftStore.d.ts +7 -21
- package/dist/inspector/drafts/draftStore.js +15 -5
- package/dist/inspector/drafts/model.d.ts +7 -15
- package/dist/inspector/drafts/model.js +0 -2
- package/dist/inspector/drafts/store.d.ts +1 -8
- package/dist/inspector/drafts/store.js +3 -10
- package/dist/inspector/editScope.d.ts +0 -1
- package/dist/inspector/editScope.js +0 -1
- package/dist/inspector/inline-text/inlineTextDiagnostics.d.ts +0 -2
- package/dist/inspector/inline-text/inlineTextDiagnostics.js +0 -2
- package/dist/inspector/inline-text/inlineTextEditor.d.ts +2 -8
- package/dist/inspector/inline-text/inlineTextEditor.js +26 -79
- package/dist/inspector/inline-text/inlineTextLifecycle.js +1 -6
- package/dist/inspector/inline-text/textEditChange.d.ts +0 -1
- package/dist/inspector/inspection/bridge.d.ts +2 -6
- package/dist/inspector/inspection/bridge.js +4 -12
- package/dist/inspector/inspection/browserCssInspection.d.ts +4 -11
- package/dist/inspector/inspection/browserCssInspection.js +4 -8
- package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +0 -7
- package/dist/inspector/inspection/browserCssInspectionRegistry.js +1 -16
- package/dist/inspector/inspection/selectionProperty.d.ts +1 -6
- package/dist/inspector/inspection/selectionProperty.js +1 -5
- package/dist/inspector/inspection/useBrowserCssInspection.d.ts +1 -5
- package/dist/inspector/inspection/useBrowserCssInspection.js +5 -21
- package/dist/inspector/iterations/capture.d.ts +0 -1
- package/dist/inspector/iterations/capture.js +4 -9
- package/dist/inspector/iterations/client.d.ts +0 -1
- package/dist/inspector/iterations/client.js +0 -1
- package/dist/inspector/iterations/coordinator.d.ts +0 -1
- package/dist/inspector/iterations/coordinator.js +0 -1
- package/dist/inspector/iterations/prompt.d.ts +0 -1
- package/dist/inspector/iterations/prompt.js +0 -1
- package/dist/inspector/overlay/DomNavigator.d.ts +3 -1
- package/dist/inspector/overlay/DomNavigator.js +39 -15
- package/dist/inspector/overlay/DropGuideOverlay.d.ts +0 -1
- package/dist/inspector/overlay/DropGuideOverlay.js +0 -1
- package/dist/inspector/overlay/MeasurementGuideOverlay.d.ts +1 -8
- package/dist/inspector/overlay/MeasurementGuideOverlay.js +1 -5
- package/dist/inspector/overlay/clickPolicy.d.ts +3 -14
- package/dist/inspector/overlay/clickPolicy.js +3 -14
- package/dist/inspector/overlay/dropGuide.d.ts +0 -3
- package/dist/inspector/overlay/dropGuide.js +0 -3
- package/dist/inspector/overlay/frameThrottle.d.ts +0 -1
- package/dist/inspector/overlay/frameThrottle.js +0 -1
- package/dist/inspector/overlay/interactionStyles.d.ts +1 -1
- package/dist/inspector/overlay/interactionStyles.js +2 -8
- package/dist/inspector/overlay/measurementGeometry.js +4 -12
- package/dist/inspector/overlay/selectedGeometry.d.ts +1 -6
- package/dist/inspector/overlay/selectedGeometry.js +1 -8
- package/dist/inspector/overlay/spacingGestures.d.ts +14 -21
- package/dist/inspector/overlay/spacingGestures.js +151 -31
- package/dist/inspector/overlay/structuralGestures.d.ts +2 -9
- package/dist/inspector/overlay/structuralGestures.js +1 -4
- package/dist/inspector/pageInspector.d.ts +4 -13
- package/dist/inspector/pageInspector.js +25 -32
- package/dist/inspector/projection/cssEscapes.d.ts +0 -1
- package/dist/inspector/projection/cssEscapes.js +2 -4
- package/dist/inspector/projection/draftProjection.d.ts +2 -14
- package/dist/inspector/projection/draftProjection.js +1 -8
- package/dist/inspector/projection/managedStylesheet.d.ts +1 -7
- package/dist/inspector/projection/managedStylesheet.js +4 -22
- package/dist/inspector/projection/renderedInstance.d.ts +5 -28
- package/dist/inspector/projection/renderedInstance.js +6 -32
- package/dist/inspector/projection/structuralProjection.d.ts +7 -39
- package/dist/inspector/projection/structuralProjection.js +17 -52
- package/dist/inspector/projection/textProjection.d.ts +2 -14
- package/dist/inspector/projection/textProjection.js +17 -70
- package/dist/inspector/prompt/PromptSettingsDialog.d.ts +0 -1
- package/dist/inspector/prompt/PromptSettingsDialog.js +0 -1
- package/dist/inspector/prompt/clipboardHandoff.d.ts +1 -9
- package/dist/inspector/prompt/clipboardHandoff.js +1 -9
- package/dist/inspector/prompt/generatePrompt.d.ts +1 -1
- package/dist/inspector/prompt/generatePrompt.js +10 -25
- package/dist/inspector/prompt/promptSettings.d.ts +0 -3
- package/dist/inspector/prompt/promptSettings.js +0 -3
- package/dist/inspector/runtime/devFlag.d.ts +2 -25
- package/dist/inspector/runtime/devFlag.js +4 -31
- package/dist/inspector/runtime/documentStylesheetOrder.d.ts +0 -2
- package/dist/inspector/runtime/editorShell.d.ts +0 -1
- package/dist/inspector/runtime/editorShell.js +0 -1
- package/dist/inspector/runtime/inspectorStorage.d.ts +1 -7
- package/dist/inspector/runtime/inspectorStorage.js +1 -6
- package/dist/inspector/runtime/ownedStylesheets.d.ts +2 -8
- package/dist/inspector/runtime/ownedStylesheets.js +2 -8
- package/dist/inspector/runtime/runtimeConfig.d.ts +12 -86
- package/dist/inspector/runtime/runtimeConfig.js +9 -50
- package/dist/inspector/runtime/runtimeIdentityClaims.d.ts +3 -13
- package/dist/inspector/runtime/runtimeIdentityClaims.js +9 -19
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +4 -36
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +7 -40
- package/dist/inspector/runtime/useRuntimeConfig.d.ts +1 -8
- package/dist/inspector/runtime/useRuntimeConfig.js +1 -8
- package/dist/inspector/selection/editScope.d.ts +1 -7
- package/dist/inspector/selection/editScope.js +2 -12
- package/dist/inspector/selection/editTarget.d.ts +1 -5
- package/dist/inspector/selection/hierarchy.d.ts +11 -11
- package/dist/inspector/selection/hierarchy.js +42 -24
- package/dist/inspector/selection/selectionStore.d.ts +0 -3
- package/dist/inspector/selection/selectionStore.js +5 -16
- package/dist/inspector/selection/sourceSite.d.ts +1 -5
- package/dist/inspector/selection/sourceSite.js +2 -8
- package/dist/inspector/selection/styleSelection.d.ts +1 -5
- package/dist/inspector/selection/styleSelection.js +1 -5
- package/dist/inspector/session/lifecycle.d.ts +1 -9
- package/dist/inspector/session/lifecycle.js +0 -1
- package/dist/inspector/session/sessionContext.d.ts +0 -4
- package/dist/inspector/session/sessionContext.js +0 -4
- package/dist/inspector/session/sessionFactory.d.ts +0 -9
- package/dist/inspector/session/sessionFactory.js +0 -6
- package/dist/inspector/settings/SettingsDialog.d.ts +0 -1
- package/dist/inspector/settings/SettingsDialog.js +5 -3
- package/dist/inspector/shell/AgentStatusButton.d.ts +3 -2
- package/dist/inspector/shell/AgentStatusButton.js +5 -5
- package/dist/inspector/shell/ChangesLog.js +3 -4
- package/dist/inspector/shell/CopyPromptButton.d.ts +2 -1
- package/dist/inspector/shell/CopyPromptButton.js +12 -11
- package/dist/inspector/shell/InspectorEditors.d.ts +16 -0
- package/dist/inspector/shell/InspectorEditors.js +14 -0
- package/dist/inspector/shell/InspectorPanel.d.ts +12 -0
- package/dist/inspector/shell/InspectorPanel.js +8 -0
- package/dist/inspector/shell/InspectorSelection.d.ts +24 -0
- package/dist/inspector/shell/InspectorSelection.js +20 -0
- package/dist/inspector/shell/InspectorShell.js +26 -48
- package/dist/inspector/shell/NudgeLogoIcon.d.ts +5 -0
- package/dist/inspector/shell/NudgeLogoIcon.js +5 -0
- package/dist/inspector/shell/PeekOriginalButton.d.ts +0 -5
- package/dist/inspector/shell/PeekOriginalButton.js +0 -5
- package/dist/inspector/shell/PeekOriginalIcon.d.ts +0 -5
- package/dist/inspector/shell/PeekOriginalIcon.js +0 -5
- package/dist/inspector/shell/PromptActionButton.d.ts +21 -0
- package/dist/inspector/shell/PromptActionButton.js +14 -0
- package/dist/inspector/shell/elementName.d.ts +5 -0
- package/dist/inspector/shell/elementName.js +29 -0
- package/dist/inspector/shell/interactionStatePreview.d.ts +1 -4
- package/dist/inspector/shell/interactionStatePreview.js +3 -8
- package/dist/inspector/shell/originalPreview.d.ts +1 -6
- package/dist/inspector/shell/originalPreview.js +1 -6
- package/dist/inspector/shell/stateValue.d.ts +1 -2
- package/dist/inspector/shell/stateValue.js +2 -5
- package/dist/inspector/shell/styleState.d.ts +1 -2
- package/dist/inspector/shell/styleState.js +1 -2
- package/dist/inspector/sketch/SketchEditor.js +0 -1
- package/dist/inspector/sketch/SketchFrameOverlay.js +8 -12
- package/dist/inspector/sketch/SketchOverlay.js +5 -6
- package/dist/inspector/sketch/SketchPromptPanel.d.ts +0 -1
- package/dist/inspector/sketch/SketchPromptPanel.js +0 -1
- package/dist/inspector/sketch/SketchWorkspace.js +2 -4
- package/dist/inspector/sketch/capture.d.ts +12 -3
- package/dist/inspector/sketch/capture.js +12 -11
- package/dist/inspector/sketch/copySketch.d.ts +1 -7
- package/dist/inspector/sketch/copySketch.js +2 -11
- package/dist/inspector/sketch/drawingTools.d.ts +1 -3
- package/dist/inspector/sketch/drawingTools.js +1 -2
- package/dist/inspector/sketch/frameHeading.d.ts +1 -7
- package/dist/inspector/sketch/frameHeading.js +1 -8
- package/dist/inspector/sketch/freehand.d.ts +0 -1
- package/dist/inspector/sketch/freehand.js +0 -1
- package/dist/inspector/sketch/geometry.d.ts +1 -6
- package/dist/inspector/sketch/geometry.js +1 -6
- package/dist/inspector/sketch/handoff.js +0 -1
- package/dist/inspector/sketch/history.d.ts +1 -5
- package/dist/inspector/sketch/history.js +1 -4
- package/dist/inspector/sketch/interaction.d.ts +2 -2
- package/dist/inspector/sketch/interaction.js +2 -2
- package/dist/inspector/sketch/model.d.ts +2 -9
- package/dist/inspector/sketch/model.js +2 -19
- package/dist/inspector/sketch/persistence.d.ts +0 -1
- package/dist/inspector/sketch/persistence.js +2 -2
- package/dist/inspector/sketch/raster.d.ts +1 -4
- package/dist/inspector/sketch/raster.js +2 -8
- package/dist/inspector/sketch/store.js +2 -3
- package/dist/inspector/sketch/videoFrames.js +2 -3
- package/dist/inspector/spacing/projection.d.ts +0 -8
- package/dist/inspector/spacing/projection.js +38 -20
- package/dist/inspector/styleEditors/BackgroundEditor.js +1 -1
- package/dist/inspector/styleEditors/BorderEditor.js +1 -6
- package/dist/inspector/styleEditors/ChildPlacement.d.ts +12 -0
- package/dist/inspector/styleEditors/ChildPlacement.js +9 -0
- package/dist/inspector/styleEditors/FlexControls.d.ts +35 -0
- package/dist/inspector/styleEditors/FlexControls.js +158 -0
- package/dist/inspector/styleEditors/GapField.d.ts +5 -2
- package/dist/inspector/styleEditors/GapField.js +3 -4
- package/dist/inspector/styleEditors/GridChildSection.d.ts +0 -5
- package/dist/inspector/styleEditors/GridChildSection.js +0 -5
- package/dist/inspector/styleEditors/GridPicker.d.ts +1 -1
- package/dist/inspector/styleEditors/GridPicker.js +2 -4
- package/dist/inspector/styleEditors/GridSection.d.ts +10 -8
- package/dist/inspector/styleEditors/GridSection.js +22 -9
- package/dist/inspector/styleEditors/GridValueField.d.ts +1 -5
- package/dist/inspector/styleEditors/GridValueField.js +2 -8
- package/dist/inspector/styleEditors/ImageBackgroundEditor.d.ts +0 -1
- package/dist/inspector/styleEditors/ImageBackgroundEditor.js +0 -1
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +0 -1
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +0 -1
- package/dist/inspector/styleEditors/LayoutComboField.js +0 -5
- package/dist/inspector/styleEditors/LayoutModeRow.d.ts +14 -0
- package/dist/inspector/styleEditors/LayoutModeRow.js +60 -0
- package/dist/inspector/styleEditors/LayoutSection.d.ts +2 -2
- package/dist/inspector/styleEditors/LayoutSection.js +30 -356
- package/dist/inspector/styleEditors/OpacityEditor.js +7 -5
- package/dist/inspector/styleEditors/PositionControls.d.ts +18 -0
- package/dist/inspector/styleEditors/PositionControls.js +16 -0
- package/dist/inspector/styleEditors/SizeSection.d.ts +18 -0
- package/dist/inspector/styleEditors/SizeSection.js +71 -0
- package/dist/inspector/styleEditors/{SpacingBox.d.ts → SpacingField.d.ts} +3 -10
- package/dist/inspector/styleEditors/{SpacingBox.js → SpacingField.js} +15 -29
- package/dist/inspector/styleEditors/Typography.js +2 -4
- package/dist/inspector/styleEditors/borderModel.d.ts +1 -7
- package/dist/inspector/styleEditors/borderModel.js +2 -11
- package/dist/inspector/styleEditors/completeCssValue.d.ts +1 -5
- package/dist/inspector/styleEditors/completeCssValue.js +3 -13
- package/dist/inspector/styleEditors/fieldValue.d.ts +20 -0
- package/dist/inspector/styleEditors/fieldValue.js +26 -0
- package/dist/inspector/styleEditors/gradientValue.d.ts +1 -1
- package/dist/inspector/styleEditors/gradientValue.js +3 -2
- package/dist/inspector/styleEditors/gridChildModel.d.ts +7 -47
- package/dist/inspector/styleEditors/gridChildModel.js +6 -37
- package/dist/inspector/styleEditors/hiddenSizeOverrides.d.ts +5 -0
- package/dist/inspector/styleEditors/hiddenSizeOverrides.js +42 -0
- package/dist/inspector/styleEditors/inlineAuthored.d.ts +1 -8
- package/dist/inspector/styleEditors/inlineAuthored.js +3 -17
- package/dist/inspector/styleEditors/layoutMode.d.ts +15 -0
- package/dist/inspector/styleEditors/layoutMode.js +33 -0
- package/dist/inspector/styleEditors/layoutPreviewState.d.ts +0 -1
- package/dist/inspector/styleEditors/layoutPreviewState.js +0 -1
- package/dist/inspector/styleEditors/layoutValue.d.ts +2 -8
- package/dist/inspector/styleEditors/layoutValue.js +4 -12
- package/dist/inspector/styleEditors/nudgeValue.d.ts +1 -13
- package/dist/inspector/styleEditors/nudgeValue.js +1 -13
- package/dist/inspector/styleEditors/rowLookup.d.ts +1 -5
- package/dist/inspector/styleEditors/rowLookup.js +1 -5
- package/dist/inspector/styleEditors/stringRecord.d.ts +1 -2
- package/dist/inspector/styleEditors/stylePresence.d.ts +0 -2
- package/dist/inspector/styleEditors/stylePresence.js +1 -4
- package/dist/inspector/styleEditors/textRelevance.d.ts +1 -1
- package/dist/inspector/styleEditors/textRelevance.js +1 -1
- package/dist/inspector/styleEditors/useFieldVisibility.js +1 -2
- package/dist/inspector/styleEditors/useLayoutContext.d.ts +13 -0
- package/dist/inspector/styleEditors/useLayoutContext.js +53 -0
- package/dist/inspector/styleEditors/valuePolicy.d.ts +1 -5
- package/dist/inspector/styleEditors/valuePolicy.js +0 -1
- package/dist/inspector/testing.d.ts +1 -4
- package/dist/inspector/testing.js +1 -4
- package/dist/inspector/tokens/TokenChip.d.ts +1 -4
- package/dist/inspector/tokens/TokenChip.js +1 -4
- package/dist/inspector/tokens/TokenField.d.ts +4 -3
- package/dist/inspector/tokens/TokenField.js +19 -29
- package/dist/inspector/tokens/catalog.d.ts +2 -10
- package/dist/inspector/tokens/catalog.js +5 -12
- package/dist/inspector/tokens/dragPointerLock.d.ts +0 -1
- package/dist/inspector/tokens/dragPointerLock.js +2 -3
- package/dist/inspector/tokens/editActions.d.ts +1 -1
- package/dist/inspector/tokens/editActions.js +2 -4
- package/dist/inspector/tokens/resolution/cascade.d.ts +1 -5
- package/dist/inspector/tokens/resolution/cascade.js +1 -5
- package/dist/inspector/tokens/resolution/containerQueryEvaluator.d.ts +1 -5
- package/dist/inspector/tokens/resolution/containerQueryEvaluator.js +1 -5
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +4 -19
- package/dist/inspector/tokens/resolution/cssomCollector.js +151 -122
- package/dist/inspector/tokens/resolution/nestedSelectors.d.ts +1 -5
- package/dist/inspector/tokens/resolution/nestedSelectors.js +1 -5
- package/dist/inspector/tokens/resolution/ruleMatching.d.ts +4 -14
- package/dist/inspector/tokens/resolution/ruleMatching.js +121 -67
- package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +3 -14
- package/dist/inspector/tokens/resolution/selectorSemantics.js +12 -27
- package/dist/inspector/tokens/resolution.d.ts +5 -24
- package/dist/inspector/tokens/resolution.js +16 -71
- package/dist/inspector/tokens/tokenAvailability.d.ts +2 -14
- package/dist/inspector/tokens/tokenAvailability.js +6 -38
- package/dist/inspector/tokens/valueSemanticsAdapter.d.ts +0 -1
- package/dist/inspector/tokens/valueSemanticsAdapter.js +18 -2
- package/dist/inspector/ui/AtRuleContext.d.ts +5 -5
- package/dist/inspector/ui/AtRuleContext.js +8 -6
- package/dist/inspector/ui/ControlSurface.d.ts +0 -4
- package/dist/inspector/ui/Disclosure.d.ts +0 -5
- package/dist/inspector/ui/Disclosure.js +0 -4
- package/dist/inspector/ui/InlineStyleWarning.d.ts +0 -1
- package/dist/inspector/ui/InspectorPopover.d.ts +1 -5
- package/dist/inspector/ui/InspectorPopover.js +1 -5
- package/dist/inspector/ui/SegmentedControl.d.ts +4 -4
- package/dist/inspector/ui/SegmentedControl.js +6 -4
- package/dist/inspector/ui/SideValuesField.d.ts +1 -6
- package/dist/inspector/ui/SideValuesField.js +2 -8
- package/dist/inspector/ui/Toast.d.ts +0 -4
- package/dist/inspector/ui/Toast.js +0 -4
- package/dist/inspector/ui/atRuleSegments.d.ts +13 -0
- package/dist/inspector/ui/atRuleSegments.js +34 -0
- package/dist/inspector/ui/classNames.d.ts +0 -1
- package/dist/inspector/ui/classNames.js +0 -1
- package/dist/inspector/ui/customCursors.d.ts +7 -1
- package/dist/inspector/ui/customCursors.js +2 -6
- package/dist/inspector/ui/styles.js +18 -20
- package/dist/inspector/workspace/controller.js +20 -1
- package/dist/inspector/workspace/handoff.d.ts +1 -5
- package/dist/inspector/workspace/handoff.js +1 -5
- package/dist/inspector/workspace/timeline.d.ts +5 -2
- package/dist/inspector/workspace/timeline.js +0 -1
- package/dist/internal/agent-protocol.d.ts +20 -42
- package/dist/internal/agent-protocol.js +18 -35
- package/dist/nudge-ui.mjs +75 -28
- package/dist/project/artifacts.js +24 -21
- package/dist/project/files.d.ts +0 -1
- package/dist/project/files.js +2 -9
- package/dist/project/identity.d.ts +1 -5
- package/dist/project/identity.js +1 -5
- package/dist/project/mcpPackage.d.ts +1 -6
- package/dist/project/mcpPackage.js +2 -7
- package/dist/project/pathPolicy.d.ts +1 -6
- package/dist/project/pathPolicy.js +1 -6
- package/dist/project/tokens.d.ts +2 -12
- package/dist/project/tokens.js +4 -15
- package/dist/transport/editor.d.ts +1 -12
- package/dist/transport/editor.js +2 -13
- package/dist/transport/index.d.ts +0 -5
- package/dist/transport/index.js +0 -5
- package/dist/transport/routes.d.ts +0 -5
- package/dist/transport/routes.js +0 -5
- package/package.json +5 -4
- package/dist/inspector/styleEditors/InsetSection.d.ts +0 -15
- package/dist/inspector/styleEditors/InsetSection.js +0 -15
- package/dist/inspector/styleEditors/PositionInsets.d.ts +0 -15
- package/dist/inspector/styleEditors/PositionInsets.js +0 -12
- package/dist/inspector/tokens/TokenDropdown.d.ts +0 -13
- package/dist/inspector/tokens/TokenDropdown.js +0 -59
|
@@ -6,7 +6,7 @@ import { useBoardCamera, useCanvasPresentation, useCanvasPresentationTransitioni
|
|
|
6
6
|
import { handleElementClick } from "./rendererSelectionProxy.js";
|
|
7
7
|
import { getSelectedElements, useHierarchy, useSelectedElement, useSelectedElements } from "../selection/selectionStore.js";
|
|
8
8
|
import { readBorderWidths, toRect, } from "../overlay/overlayGeometry.js";
|
|
9
|
-
const overlayStyles = ".canvas-element-overlay {\n position: fixed;\n pointer-events: none;\n z-index: 1;\n background: transparent;\n outline: 1px solid var(--accent);\n outline-offset: -1px;\n}\n\n.canvas-spacing-guide {\n position: fixed;\n z-index: 1;\n border-radius: 999px;\n background: var(--accent);\n outline: none;\n box-shadow: none;\n pointer-events: none;\n}\n\n.canvas-spacing-fill {\n position: fixed;\n z-index: 1;\n pointer-events: none;\n background: rgb(59 130 246 / 14%);\n}\n\n.canvas-spacing-fill[data-kind=\"gap\"] {\n background: rgb(236 72 153 / 14%);\n}\n\n.canvas-spacing-guide[data-kind=\"gap\"] {\n background: #ec4899;\n}\n\n.canvas-spacing-value-badge {\n position: fixed;\n z-index: 2;\n transform: translate(-50%, calc(-100% - var(--space-8)));\n padding: var(--space-4) var(--space-8);\n border-radius: var(--radius-8);\n background: var(--surface-raised-2x);\n box-shadow: var(--shadow-popup);\n color: var(--text-primary);\n font-family: var(--font-family);\n font-size: var(--font-size-base);\n font-weight: 400;\n line-height: 1.4;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n pointer-events: none;\n}\n\n.canvas-selected-outline {\n position: fixed;\n pointer-events: none;\n z-index: 1;\n outline: 1px solid var(--accent);\n outline-offset: -1px;\n}\n\n.canvas-dom-drop-line {\n z-index: 2147483647;\n border-radius: 999px;\n background: #3b82f6;\n box-shadow: 0 0 0 1px rgb(255 255 255 / 95%), 0 1px 5px rgb(37 99 235 / 72%);\n}\n\n.canvas-dom-drop-line::before,\n.canvas-dom-drop-line::after {\n position: absolute;\n top: 50%;\n width: 8px;\n height: 8px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n background: #2563eb;\n content: \"\";\n transform: translateY(-50%);\n}\n\n.canvas-dom-drop-line::before { left: -3px; }\n.canvas-dom-drop-line::after { right: -3px; }\n\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::before,\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::after {\n left: 50%;\n right: auto;\n transform: translateX(-50%);\n}\n\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::before { top: -3px; }\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::after { top: auto; bottom: -3px; }\n\n.canvas-dom-drop-target {\n z-index: 2147483646;\n box-sizing: border-box;\n border: 1px solid rgb(59 130 246 / 72%);\n border-radius: 4px;\n background: rgb(59 130 246 / 5%);\n}\n";
|
|
9
|
+
const overlayStyles = ".canvas-element-overlay {\n position: fixed;\n pointer-events: none;\n z-index: 1;\n background: transparent;\n outline: 1px solid var(--accent);\n outline-offset: -1px;\n}\n\n.canvas-element-overlay[data-linked=\"true\"] {\n outline-color: var(--linked);\n}\n\n.canvas-spacing-guide {\n position: fixed;\n z-index: 1;\n border-radius: 999px;\n background: var(--accent);\n outline: none;\n box-shadow: none;\n pointer-events: none;\n}\n\n.canvas-spacing-fill {\n position: fixed;\n z-index: 1;\n pointer-events: none;\n background: rgb(59 130 246 / 14%);\n}\n\n.canvas-spacing-fill[data-kind=\"gap\"] {\n background: rgb(236 72 153 / 14%);\n}\n\n.canvas-spacing-guide[data-kind=\"gap\"] {\n background: #ec4899;\n}\n\n.canvas-spacing-fill[data-kind=\"margin\"] {\n background: rgb(239 68 68 / 14%);\n}\n\n.canvas-spacing-guide[data-kind=\"margin\"] {\n background: #ef4444;\n}\n\n.canvas-spacing-value-badge {\n position: fixed;\n z-index: 2;\n transform: translate(-50%, calc(-100% - var(--space-8)));\n padding: var(--space-4) var(--space-8);\n border-radius: var(--radius-8);\n background: var(--surface-raised-2x);\n box-shadow: var(--shadow-popup);\n color: var(--text-primary);\n font-family: var(--font-family);\n font-size: var(--font-size-base);\n font-weight: 400;\n line-height: 1.4;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n pointer-events: none;\n}\n\n.canvas-selected-outline {\n position: fixed;\n pointer-events: none;\n z-index: 1;\n outline: 1px solid var(--accent);\n outline-offset: -1px;\n}\n\n.canvas-selected-outline[data-linked=\"true\"] {\n outline-color: var(--linked);\n}\n\n.canvas-linked-outline {\n position: fixed;\n pointer-events: none;\n z-index: 1;\n outline: 1px solid var(--linked);\n outline-offset: -1px;\n opacity: 0.6;\n}\n\n.canvas-dom-drop-line {\n z-index: 2147483647;\n border-radius: 999px;\n background: #3b82f6;\n box-shadow: 0 0 0 1px rgb(255 255 255 / 95%), 0 1px 5px rgb(37 99 235 / 72%);\n}\n\n.canvas-dom-drop-line::before,\n.canvas-dom-drop-line::after {\n position: absolute;\n top: 50%;\n width: 8px;\n height: 8px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n background: #2563eb;\n content: \"\";\n transform: translateY(-50%);\n}\n\n.canvas-dom-drop-line::before { left: -3px; }\n.canvas-dom-drop-line::after { right: -3px; }\n\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::before,\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::after {\n left: 50%;\n right: auto;\n transform: translateX(-50%);\n}\n\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::before { top: -3px; }\n.canvas-dom-drop-line[data-orientation=\"vertical\"]::after { top: auto; bottom: -3px; }\n\n.canvas-dom-drop-target {\n z-index: 2147483646;\n box-sizing: border-box;\n border: 1px solid rgb(59 130 246 / 72%);\n border-radius: 4px;\n background: rgb(59 130 246 / 5%);\n}\n";
|
|
10
10
|
import { deleteElement, getDropLocationAtPoint, moveElement, nudgeElement } from "../overlay/structuralGestures.js";
|
|
11
11
|
import { changeKey } from "../changes/model.js";
|
|
12
12
|
import { getActiveDraftChanges, redo, subscribeActiveDraftChanges, undo } from "../drafts/store.js";
|
|
@@ -21,6 +21,8 @@ import { findCanvasFrameByDocument, getRegisteredFrames } from "./projection.js"
|
|
|
21
21
|
import { connectFrame, measureFrameViewport, toViewportPoint, toViewportRect } from "./frameConnection.js";
|
|
22
22
|
import { RENDERER_ELEMENT_ID_ATTR } from "./rendererCidIndex.js";
|
|
23
23
|
import { observeSelectedGeometry } from "../overlay/selectedGeometry.js";
|
|
24
|
+
import { getEditScope, sourceSiteSelector } from "../selection/editScope.js";
|
|
25
|
+
import { useComponentProps } from "../componentSemantics/ComponentPropsSection.js";
|
|
24
26
|
import { handleInlineTextEditIntent, useInlineTextSession } from "../inline-text/inlineTextEditor.js";
|
|
25
27
|
import { setInspectorOpen, toggleInspector } from "../shell/openStore.js";
|
|
26
28
|
import { EMPTY_TEXT_PROJECTION_ATTR } from "../projection/textProjection.js";
|
|
@@ -31,6 +33,15 @@ import { beginLayoutPreview, endLayoutPreview } from "../styleEditors/layoutPrev
|
|
|
31
33
|
import { useNudgeUiRuntimeConfig } from "../runtime/useRuntimeConfig.js";
|
|
32
34
|
import { DomNavigator } from "../overlay/DomNavigator.js";
|
|
33
35
|
import { InspectorStyle } from "../ui/InspectorStyle.js";
|
|
36
|
+
/** An element that is already the only selection keeps its record; re-resolving can differ only in derived metadata. */
|
|
37
|
+
function selectGestureElement(element) {
|
|
38
|
+
const current = getSelectedElements();
|
|
39
|
+
if (current.length === 1 && current[0].domElement === element)
|
|
40
|
+
return;
|
|
41
|
+
const selected = resolveSelectionFromElement(element);
|
|
42
|
+
if (selected)
|
|
43
|
+
setSelectedElement(selected);
|
|
44
|
+
}
|
|
34
45
|
function spacingBadgeForDrag(drag, point) {
|
|
35
46
|
return {
|
|
36
47
|
iframe: drag.iframe,
|
|
@@ -101,14 +112,7 @@ function restoreSpacingPreview(drag) {
|
|
|
101
112
|
}
|
|
102
113
|
endLayoutPreview(drag.element, drag.affordance.property);
|
|
103
114
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Commits a managed rule for the drag's final value. Returns the created change
|
|
106
|
-
* records (empty for a no-op drag). The preview inline is intentionally left
|
|
107
|
-
* applied at the committed value once a record exists; the caller must register
|
|
108
|
-
* a PendingSpacingCommit and release it after the renderer acknowledges the
|
|
109
|
-
* projected sheet. Restoring the authored declaration first would flash the old
|
|
110
|
-
* value for the postMessage round trip the sheet takes.
|
|
111
|
-
*/
|
|
115
|
+
/** On a real change the preview inline stays applied; the caller must register a PendingSpacingCommit. */
|
|
112
116
|
function commitSpacingDrag(drag) {
|
|
113
117
|
if (drag.currentValue === drag.startValue) {
|
|
114
118
|
restoreSpacingPreview(drag);
|
|
@@ -120,9 +124,7 @@ function commitSpacingDrag(drag) {
|
|
|
120
124
|
oldRawValue: spacingValueCss(drag.startValue),
|
|
121
125
|
}]);
|
|
122
126
|
}
|
|
123
|
-
/** Removes
|
|
124
|
-
* reproduces the committed value; keeps it otherwise and retries on the next
|
|
125
|
-
* projection acknowledgement from that frame. */
|
|
127
|
+
/** Removes the preview inline once the projected sheet alone reproduces the value; retries on the next acknowledgement. */
|
|
126
128
|
function tryReleasePendingSpacingCommit(commit) {
|
|
127
129
|
const { element, property, committedValue } = commit;
|
|
128
130
|
if (!element.isConnected)
|
|
@@ -148,9 +150,7 @@ function releasePendingSpacingCommits(pending, iframe) {
|
|
|
148
150
|
}
|
|
149
151
|
pending.length = write;
|
|
150
152
|
}
|
|
151
|
-
/** Restores
|
|
152
|
-
* or cleared before its sheet landed. Runs synchronously with the workspace
|
|
153
|
-
* change, so the inline never outlives the intent behind it. */
|
|
153
|
+
/** Restores a held preview inline whose committed rule was undone, reverted, or cleared. */
|
|
154
154
|
function reconcilePendingSpacingCommits(pending) {
|
|
155
155
|
if (pending.length === 0)
|
|
156
156
|
return;
|
|
@@ -173,9 +173,7 @@ function reconcilePendingSpacingCommits(pending) {
|
|
|
173
173
|
}
|
|
174
174
|
pending.length = write;
|
|
175
175
|
}
|
|
176
|
-
/**
|
|
177
|
-
* same element and property into the newest one so the held value and the
|
|
178
|
-
* authored baseline both stay coherent across rapid successive drags. */
|
|
176
|
+
/** Folds an older unapplied commit for the same element and property into the newest one. */
|
|
179
177
|
function pushPendingSpacingCommit(pending, next) {
|
|
180
178
|
const existing = pending.findIndex((commit) => commit.iframe === next.iframe
|
|
181
179
|
&& commit.element === next.element
|
|
@@ -190,6 +188,43 @@ function pushPendingSpacingCommit(pending, next) {
|
|
|
190
188
|
originalInlinePriority: pending[existing].originalInlinePriority,
|
|
191
189
|
};
|
|
192
190
|
}
|
|
191
|
+
const LINKED_PEER_LIMIT = 200;
|
|
192
|
+
/** Frames the follow loop keeps measuring after outlines stop moving, covering the commit that applies a pan. */
|
|
193
|
+
const OUTLINE_IDLE_FRAMES = 8;
|
|
194
|
+
/** Writes the outline boxes straight to the DOM, so a stale React render cannot win; returns whether any moved. */
|
|
195
|
+
function syncOutlinePositions(frame, outlines) {
|
|
196
|
+
const viewport = measureFrameViewport(frame);
|
|
197
|
+
let moved = false;
|
|
198
|
+
for (const [element, node] of outlines) {
|
|
199
|
+
const rect = toViewportRect(viewport, toRect(element.getBoundingClientRect()));
|
|
200
|
+
const box = `${rect.left}|${rect.top}|${rect.width}|${rect.height}`;
|
|
201
|
+
if (node.dataset.box !== box)
|
|
202
|
+
moved = true;
|
|
203
|
+
node.dataset.box = box;
|
|
204
|
+
node.style.left = `${rect.left}px`;
|
|
205
|
+
node.style.top = `${rect.top}px`;
|
|
206
|
+
node.style.width = `${rect.width}px`;
|
|
207
|
+
node.style.height = `${rect.height}px`;
|
|
208
|
+
}
|
|
209
|
+
return moved;
|
|
210
|
+
}
|
|
211
|
+
function isLinkedElement(element) {
|
|
212
|
+
return element !== null && getEditScope(element) === "source-site" && findLinkedPeers(element).length > 0;
|
|
213
|
+
}
|
|
214
|
+
/** Other elements rendered from the selected element's source site. */
|
|
215
|
+
function findLinkedPeers(element) {
|
|
216
|
+
const selector = sourceSiteSelector(element.getAttribute("data-cid") ?? "", element.getAttribute("data-src") ?? "");
|
|
217
|
+
if (!selector)
|
|
218
|
+
return [];
|
|
219
|
+
try {
|
|
220
|
+
return [...element.ownerDocument.querySelectorAll(selector)]
|
|
221
|
+
.filter((candidate) => candidate !== element)
|
|
222
|
+
.slice(0, LINKED_PEER_LIMIT);
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
193
228
|
export function CanvasElementOverlay() {
|
|
194
229
|
const [hover, setHover] = useState(null);
|
|
195
230
|
const [measureState, setMeasureState] = useState(null);
|
|
@@ -243,9 +278,15 @@ export function CanvasElementOverlay() {
|
|
|
243
278
|
: [];
|
|
244
279
|
})
|
|
245
280
|
: [];
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
281
|
+
const componentProps = useComponentProps(selectedElements.length === 1 ? selected : null);
|
|
282
|
+
const linkedPeers = selectedInCanvas && selectedElements.length === 1 && selected && getEditScope(selected.domElement) === "source-site"
|
|
283
|
+
? findLinkedPeers(selected.domElement)
|
|
284
|
+
: [];
|
|
285
|
+
const projectedLinkedPeers = selectedFrameViewport
|
|
286
|
+
? linkedPeers.map((peer) => ({ peer, rect: toViewportRect(selectedFrameViewport, toRect(peer.getBoundingClientRect())) }))
|
|
287
|
+
: [];
|
|
288
|
+
const selectionIsLinked = componentProps !== null || linkedPeers.length > 0;
|
|
289
|
+
// Camera transforms commit before iframe viewport geometry is readable; re-render once so overlays use the new frame rect.
|
|
249
290
|
useLayoutEffect(() => {
|
|
250
291
|
const geometryChanged = previousProjectionGeometryKey.current !== projectionGeometryKey;
|
|
251
292
|
previousProjectionGeometryKey.current = projectionGeometryKey;
|
|
@@ -255,12 +296,48 @@ export function CanvasElementOverlay() {
|
|
|
255
296
|
const selectedBorders = selectedInCanvas && selected
|
|
256
297
|
? readBorderWidths(selected.domElement)
|
|
257
298
|
: null;
|
|
299
|
+
const outlineNodes = useRef(new Map());
|
|
300
|
+
const outlineRef = (element) => (node) => {
|
|
301
|
+
if (node)
|
|
302
|
+
outlineNodes.current.set(element, node);
|
|
303
|
+
else
|
|
304
|
+
outlineNodes.current.delete(element);
|
|
305
|
+
};
|
|
306
|
+
// React renders a frame or more after a pan or scroll, so outlines follow the live geometry on their own frame loop.
|
|
307
|
+
useEffect(() => {
|
|
308
|
+
if (!selectedFrame)
|
|
309
|
+
return;
|
|
310
|
+
const frameDocument = selectedFrame.contentDocument;
|
|
311
|
+
let raf = null;
|
|
312
|
+
let idleFrames = 0;
|
|
313
|
+
const tick = () => {
|
|
314
|
+
raf = null;
|
|
315
|
+
idleFrames = syncOutlinePositions(selectedFrame, outlineNodes.current) ? 0 : idleFrames + 1;
|
|
316
|
+
if (idleFrames < OUTLINE_IDLE_FRAMES)
|
|
317
|
+
raf = window.requestAnimationFrame(tick);
|
|
318
|
+
};
|
|
319
|
+
const follow = () => {
|
|
320
|
+
idleFrames = 0;
|
|
321
|
+
if (raf === null)
|
|
322
|
+
raf = window.requestAnimationFrame(tick);
|
|
323
|
+
};
|
|
324
|
+
const options = { capture: true, passive: true };
|
|
325
|
+
window.addEventListener("wheel", follow, options);
|
|
326
|
+
frameDocument?.addEventListener("scroll", follow, options);
|
|
327
|
+
return () => {
|
|
328
|
+
window.removeEventListener("wheel", follow, options);
|
|
329
|
+
frameDocument?.removeEventListener("scroll", follow, options);
|
|
330
|
+
if (raf !== null)
|
|
331
|
+
window.cancelAnimationFrame(raf);
|
|
332
|
+
};
|
|
333
|
+
}, [selectedFrame]);
|
|
258
334
|
useEffect(() => {
|
|
259
335
|
if (!selectedInCanvas || !selected)
|
|
260
336
|
return;
|
|
261
|
-
const stops = selectedElements.map((candidate) =>
|
|
337
|
+
const stops = [...selectedElements.map((candidate) => candidate.domElement), ...linkedPeers]
|
|
338
|
+
.map((element) => observeSelectedGeometry(element, refreshSelectedGeometry));
|
|
262
339
|
return () => stops.forEach((stop) => stop());
|
|
263
|
-
}, [selected, selectedElements, selectedInCanvas]);
|
|
340
|
+
}, [selected, selectedElements, selectedInCanvas, linkedPeers.length]);
|
|
264
341
|
useEffect(() => {
|
|
265
342
|
const broadcastMeasureModifier = (altKey) => {
|
|
266
343
|
measureAltKeyRef.current = altKey;
|
|
@@ -287,9 +364,7 @@ export function CanvasElementOverlay() {
|
|
|
287
364
|
window.removeEventListener("blur", onBlur);
|
|
288
365
|
};
|
|
289
366
|
}, []);
|
|
290
|
-
//
|
|
291
|
-
// (never per hover), so the measurement self-rulers exclusion can compare
|
|
292
|
-
// identities without a per-hover scan of the frame document.
|
|
367
|
+
// Computed once per selection change, never per hover, so the measurement exclusion needs no per-hover scan.
|
|
293
368
|
const selectedIdentity = useMemo(() => {
|
|
294
369
|
const el = selected?.domElement;
|
|
295
370
|
if (!el)
|
|
@@ -297,9 +372,7 @@ export function CanvasElementOverlay() {
|
|
|
297
372
|
const elementId = el.getAttribute(RENDERER_ELEMENT_ID_ATTR);
|
|
298
373
|
return elementId ? { elementId } : null;
|
|
299
374
|
}, [selected?.domElement]);
|
|
300
|
-
//
|
|
301
|
-
// it: undo/redo/revert/clear remove the record synchronously, so restore the
|
|
302
|
-
// authored declaration before the renderer's next replace-styles lands.
|
|
375
|
+
// Undo/redo/revert/clear remove the record synchronously; restore the authored declaration before the next replace-styles lands.
|
|
303
376
|
useEffect(() => {
|
|
304
377
|
return subscribeActiveDraftChanges(() => {
|
|
305
378
|
reconcilePendingSpacingCommits(pendingSpacingCommitsRef.current);
|
|
@@ -380,17 +453,22 @@ export function CanvasElementOverlay() {
|
|
|
380
453
|
&& spacingDescriptorMatches(handleAffordance, msg.spacing)
|
|
381
454
|
? { point: hoverPoint, value: handleAffordance.value }
|
|
382
455
|
: null;
|
|
383
|
-
|
|
456
|
+
// Hover messages arrive every frame; the peer query runs once per element entered, not per message.
|
|
457
|
+
const hoverRect = msg.rect;
|
|
458
|
+
setHover((current) => ({
|
|
384
459
|
iframe: frame.iframe,
|
|
385
460
|
identity: { elementId: msg.elementId },
|
|
386
|
-
rect:
|
|
461
|
+
rect: hoverRect,
|
|
387
462
|
borders: msg.borders ?? { top: 0, right: 0, bottom: 0, left: 0 },
|
|
388
463
|
cardId: frame.cardId,
|
|
389
464
|
spacing: spacingGuides.length > 0 ? spacingDescriptor : null,
|
|
390
465
|
spacingGuides,
|
|
391
466
|
spacingAreas,
|
|
392
467
|
spacingHandleBadge,
|
|
393
|
-
|
|
468
|
+
linked: current?.iframe === frame.iframe && current.identity.elementId === msg.elementId
|
|
469
|
+
? current.linked
|
|
470
|
+
: isLinkedElement(hoverElement ?? frame.element(msg)),
|
|
471
|
+
}));
|
|
394
472
|
}
|
|
395
473
|
else if (data.type === "element-measure-state") {
|
|
396
474
|
const msg = data;
|
|
@@ -466,18 +544,14 @@ export function CanvasElementOverlay() {
|
|
|
466
544
|
originalInlineValue: element.style.getPropertyValue(spacing.property),
|
|
467
545
|
originalInlinePriority: element.style.getPropertyPriority(spacing.property),
|
|
468
546
|
};
|
|
469
|
-
|
|
470
|
-
if (selectedElement)
|
|
471
|
-
setSelectedElement(selectedElement);
|
|
547
|
+
selectGestureElement(element);
|
|
472
548
|
applySpacingPreview(spacingDragRef.current, msg.point, msg.shiftKey === true);
|
|
473
549
|
setSpacingDragBadge(spacingBadgeForDrag(spacingDragRef.current, msg.point));
|
|
474
550
|
refreshSpacingPreviewOverlay(spacingDragRef.current);
|
|
475
551
|
return;
|
|
476
552
|
}
|
|
477
553
|
dragRef.current = { iframe: frame.iframe, element };
|
|
478
|
-
|
|
479
|
-
if (selectedElement)
|
|
480
|
-
setSelectedElement(selectedElement);
|
|
554
|
+
selectGestureElement(element);
|
|
481
555
|
updateDropGuide(msg.point);
|
|
482
556
|
}
|
|
483
557
|
else if (data.type === "element-drag-move") {
|
|
@@ -518,9 +592,7 @@ export function CanvasElementOverlay() {
|
|
|
518
592
|
}
|
|
519
593
|
clearDropGuide("canvas");
|
|
520
594
|
if (!msg.cancelled) {
|
|
521
|
-
|
|
522
|
-
if (selectedElement)
|
|
523
|
-
setSelectedElement(selectedElement);
|
|
595
|
+
selectGestureElement(spacing.element);
|
|
524
596
|
}
|
|
525
597
|
return;
|
|
526
598
|
}
|
|
@@ -530,9 +602,7 @@ export function CanvasElementOverlay() {
|
|
|
530
602
|
const drop = getDropLocationAtPoint(frameDocument, current.element, msg.point.x, msg.point.y);
|
|
531
603
|
if (drop)
|
|
532
604
|
moveElement(current.element, drop);
|
|
533
|
-
|
|
534
|
-
if (selectedElement)
|
|
535
|
-
setSelectedElement(selectedElement);
|
|
605
|
+
selectGestureElement(current.element);
|
|
536
606
|
}
|
|
537
607
|
dragRef.current = null;
|
|
538
608
|
clearDropGuide("canvas");
|
|
@@ -551,9 +621,7 @@ export function CanvasElementOverlay() {
|
|
|
551
621
|
const element = frame.element(data);
|
|
552
622
|
const record = element ? nudgeElement(element, data.key) : null;
|
|
553
623
|
if (element && record) {
|
|
554
|
-
|
|
555
|
-
if (selectedElement)
|
|
556
|
-
setSelectedElement(selectedElement);
|
|
624
|
+
selectGestureElement(element);
|
|
557
625
|
}
|
|
558
626
|
}
|
|
559
627
|
else if (data.type === "history-request") {
|
|
@@ -616,8 +684,7 @@ export function CanvasElementOverlay() {
|
|
|
616
684
|
const isSelfHover = Boolean(hoverInSelectedFrame
|
|
617
685
|
&& selectedIdentity
|
|
618
686
|
&& hoverInSelectedFrame.identity.elementId === selectedIdentity.elementId);
|
|
619
|
-
// Selected elements already have a live
|
|
620
|
-
// is based on a cached renderer message and can lag during spacing previews.
|
|
687
|
+
// Selected elements already have a live outline; the hover outline is cached and can lag during spacing previews.
|
|
621
688
|
const showHoverOutline = Boolean(projectedHoverRect && !isSelfHover);
|
|
622
689
|
const showMeasurement = Boolean(showGuideOverlay
|
|
623
690
|
&& selectedLocalRect
|
|
@@ -636,7 +703,7 @@ export function CanvasElementOverlay() {
|
|
|
636
703
|
: [];
|
|
637
704
|
if (presentationTransitioning || layoutTransitioning || temporaryAppInteraction)
|
|
638
705
|
return _jsx(InspectorStyle, { testId: "canvas-element-overlay-styles", css: overlayStyles });
|
|
639
|
-
return (_jsxs(_Fragment, { children: [_jsx(InspectorStyle, { testId: "canvas-element-overlay-styles", css: overlayStyles }), showGuideOverlay && selectedRect && selectedFrameViewport ? (_jsx(MeasurementGuideOverlay, { testId: "canvas-measurement-overlay", selectedRect: selectedRect, guideViewport: selectedFrameViewport, segments: measurementSegments })) : null, projectedHoverRect ? (_jsxs(_Fragment, { children: [hoverSpacing ? projectedSpacingAreas.map((area, index) => (_jsx("div", { className: "canvas-spacing-fill", "data-test": "canvas-spacing-fill", "data-kind": hoverSpacing.kind, "data-property": hoverSpacing.property, "data-side": hoverSpacing.side ?? undefined, "data-area-index": index, style: overlayStyle(area), "aria-hidden": "true" }, `${hoverSpacing.property}-area-${index}`))) : null, showHoverOutline ? (_jsx("div", { className: "canvas-element-overlay", "data-test": "canvas-hover-outline", style: overlayStyle(projectedHoverRect), "aria-hidden": "true" })) : null, hoverSpacing ? projectedSpacingGuides.map((guide, index) => (_jsx("div", { className: "canvas-spacing-guide", "data-test": "canvas-spacing-guide", "data-kind": hoverSpacing.kind, "data-property": hoverSpacing.property, "data-side": hoverSpacing.side ?? undefined, "data-guide-index": index, style: spacingGuideStyle(guide), "aria-hidden": "true" }, `${hoverSpacing.property}-${index}`))) : null] })) : null, projectedSelectedGeometry.map(({ element, rect }, index) => (_jsx("div", { className: "canvas-selected-outline", "data-test": "canvas-selected-outline", "data-selected-cid": element.cid, "data-selected-index": index, "data-selected-src": element.src, style: overlayStyle(rect), "aria-hidden": "true" }, `${element.cid}-${index}`))), projectedSpacingBadge && spacingBadge ? (_jsx("div", { className: "canvas-spacing-value-badge", "data-test": "canvas-spacing-value-badge", style: { left: projectedSpacingBadge.x, top: projectedSpacingBadge.y }, "aria-hidden": "true", children: spacingValueCss(spacingBadge.value) })) : null, domNavigationEnabled && !inlineTextSession && selectedElements.length === 1 && selected && selectedRect && selectedFrameViewport ? (_jsx(DomNavigator, { selected: selected, hierarchy: hierarchy, anchor: selectedRect, project: (element) => element.ownerDocument === selected.domElement.ownerDocument
|
|
706
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorStyle, { testId: "canvas-element-overlay-styles", css: overlayStyles }), showGuideOverlay && selectedRect && selectedFrameViewport ? (_jsx(MeasurementGuideOverlay, { testId: "canvas-measurement-overlay", selectedRect: selectedRect, guideViewport: selectedFrameViewport, segments: measurementSegments })) : null, projectedHoverRect ? (_jsxs(_Fragment, { children: [hoverSpacing ? projectedSpacingAreas.map((area, index) => (_jsx("div", { className: "canvas-spacing-fill", "data-test": "canvas-spacing-fill", "data-kind": hoverSpacing.kind, "data-property": hoverSpacing.property, "data-side": hoverSpacing.side ?? undefined, "data-area-index": index, style: overlayStyle(area), "aria-hidden": "true" }, `${hoverSpacing.property}-area-${index}`))) : null, showHoverOutline ? (_jsx("div", { className: "canvas-element-overlay", "data-linked": hover?.linked ? "true" : undefined, "data-test": "canvas-hover-outline", style: overlayStyle(projectedHoverRect), "aria-hidden": "true" })) : null, hoverSpacing ? projectedSpacingGuides.map((guide, index) => (_jsx("div", { className: "canvas-spacing-guide", "data-test": "canvas-spacing-guide", "data-kind": hoverSpacing.kind, "data-property": hoverSpacing.property, "data-side": hoverSpacing.side ?? undefined, "data-guide-index": index, style: spacingGuideStyle(guide), "aria-hidden": "true" }, `${hoverSpacing.property}-${index}`))) : null] })) : null, projectedLinkedPeers.map(({ peer, rect }, index) => (_jsx("div", { ref: outlineRef(peer), className: "canvas-linked-outline", "data-test": "canvas-linked-outline", style: overlayStyle(rect), "aria-hidden": "true" }, `${peer.getAttribute("data-cid")}-${index}`))), projectedSelectedGeometry.map(({ element, rect }, index) => (_jsx("div", { ref: outlineRef(element.domElement), className: "canvas-selected-outline", "data-linked": selectionIsLinked ? "true" : undefined, "data-test": "canvas-selected-outline", "data-selected-cid": element.cid, "data-selected-index": index, "data-selected-src": element.src, style: overlayStyle(rect), "aria-hidden": "true" }, `${element.cid}-${index}`))), projectedSpacingBadge && spacingBadge ? (_jsx("div", { className: "canvas-spacing-value-badge", "data-test": "canvas-spacing-value-badge", style: { left: projectedSpacingBadge.x, top: projectedSpacingBadge.y }, "aria-hidden": "true", children: spacingValueCss(spacingBadge.value) })) : null, domNavigationEnabled && !inlineTextSession && !measureStateForSelectedFrame?.altKey && selectedElements.length === 1 && selected && selectedRect && selectedFrameViewport ? (_jsx(DomNavigator, { selected: selected, hierarchy: hierarchy, anchor: selectedRect, linked: selectionIsLinked, project: (element) => element.ownerDocument === selected.domElement.ownerDocument
|
|
640
707
|
? toViewportRect(selectedFrameViewport, toRect(element.getBoundingClientRect()))
|
|
641
708
|
: null })) : null, _jsx(DropGuideOverlay, { guide: projectedDropGuide, lineClassName: "canvas-dom-drop-line", lineTestId: "canvas-dom-drop-line", targetClassName: "canvas-dom-drop-target", targetTestId: "canvas-dom-drop-target" })] }));
|
|
642
709
|
}
|
|
@@ -18,10 +18,8 @@ import { subscribeOriginalPreview, isOriginalPreviewActive } from "../shell/orig
|
|
|
18
18
|
import { recordCanvasStructuralProjectionReports } from "../projection/structuralProjection.js";
|
|
19
19
|
import { recordCanvasRenderedInstanceProjectionReports } from "../projection/renderedInstance.js";
|
|
20
20
|
import { recordCanvasTextProjectionReports } from "../projection/textProjection.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { beginPreviewAttempt, publishPreviewDiagnostic } from "../changes/previewDiagnostics.js";
|
|
24
|
-
import { verifyManagedStyleProjection } from "../changes/managedStyleProjection.js";
|
|
21
|
+
import { beginPreviewAttempt } from "../changes/previewDiagnostics.js";
|
|
22
|
+
import { verifyPreviewChanges } from "../changes/previewVerification.js";
|
|
25
23
|
import { getCanvasPreviewDocument, getRegisteredFrames, isCanvasCanonicalProjectionRevisionCurrent, projectToAllReadyCards, recordCanvasProjectionApplied, getFrameRegistryVersion, subscribeFrameRegistry, } from "./projection.js";
|
|
26
24
|
import { connectFrame, toViewportPoint } from "./frameConnection.js";
|
|
27
25
|
import { normalizeUrl, normalizedUrlKey } from "./normalizeUrl.js";
|
|
@@ -32,7 +30,7 @@ import { wheelPanDelta } from "./wheelPan.js";
|
|
|
32
30
|
import { zoomCameraAtPointer } from "./canvasGestures.js";
|
|
33
31
|
const canvasWorkspaceStyles = ".canvas-workspace {\n position: fixed;\n inset: 0;\n display: flex;\n flex-direction: column;\n background: var(--surface-panel);\n pointer-events: auto;\n}\n\n.canvas-workspace__board {\n flex: 1;\n overflow: hidden;\n position: relative;\n background: var(--surface-panel);\n}\n\n.canvas-workspace__focus-action {\n position: absolute;\n top: max(12px, env(safe-area-inset-top));\n left: max(12px, env(safe-area-inset-left));\n z-index: calc(var(--z-index) - 1);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--space-4);\n border-radius: var(--radius-12);\n background: var(--surface-raised-2x);\n box-shadow: var(--shadow-popup);\n pointer-events: auto;\n}\n\n.canvas-workspace__board.is-grabbable {\n cursor: grab;\n}\n\n.canvas-workspace__board.is-grabbing {\n cursor: grabbing;\n}\n\n/* Canvas gestures take precedence over every card interaction while Space is\n held. This also closes the short postMessage gap before an iframe receives\n its mirrored modifier state. */\n.canvas-workspace__board.is-grabbable .canvas-card,\n.canvas-workspace__board.is-grabbing .canvas-card {\n pointer-events: none;\n}\n\n.canvas-workspace__board-content {\n position: absolute;\n width: 100%;\n height: 100%;\n /*\n * Leave `will-change` unset so the browser can re-rasterize this subtree at\n * the current camera scale. A permanent `will-change: transform` promotes\n * it to a fixed bitmap, which makes iframe content look soft when zoomed.\n */\n}\n\n.canvas-workspace__board.is-grabbing .canvas-workspace__board-content {\n /* Panning benefits from a cached composited layer; zoom restores the crisp\n * default path as soon as the gesture ends. */\n will-change: transform;\n}\n\n.canvas-workspace[data-presentation=\"focus\"] .canvas-workspace__board-content {\n inset: 0;\n transform: none !important;\n}\n\n.canvas-workspace.is-presentation-transitioning .canvas-card:not(.is-presentation-card) {\n visibility: hidden !important;\n pointer-events: none !important;\n}\n\n.canvas-workspace__target-error {\n position: absolute;\n inset: 0;\n display: grid;\n place-items: center;\n color: #6b7280;\n font: 500 14px/1.4 system-ui, sans-serif;\n}\n\n/* Moving iframes must not acquire hover state beneath a stationary pointer. */\n.canvas-workspace.is-presentation-transitioning .canvas-card__iframe,\n.canvas-workspace__board.is-layout-transitioning .canvas-card__iframe {\n pointer-events: none;\n}\n\n/* The page surface edits the live page under the workspace, so only the\n toolbar takes pointer input. */\n.canvas-workspace[data-surface=\"page\"],\n.canvas-workspace[data-surface=\"page\"] .canvas-workspace__board {\n background: transparent;\n pointer-events: none;\n}\n\n.canvas-workspace[data-surface=\"page\"] .canvas-toolbar {\n pointer-events: auto;\n}\n";
|
|
34
32
|
const canvasCardStyles = ".canvas-card {\n position: relative;\n}\n\n/* Extend the card's hover region to the toolbar above the iframe. */\n.canvas-card::before {\n content: \"\";\n position: absolute;\n right: 0;\n bottom: 100%;\n left: 0;\n height: calc((var(--control-height-large) + var(--space-16)) * var(--canvas-toolbar-scale, 1));\n pointer-events: auto;\n}\n\n.canvas-card__frame {\n position: relative;\n width: 100%;\n height: 100%;\n background: var(--surface-panel);\n border-radius: 0;\n overflow: hidden;\n}\n\n.canvas-card.is-selected .canvas-card__frame {\n outline: 2px solid var(--frame-accent, var(--accent));\n outline-offset: -2px;\n}\n\n.canvas-card.is-focus-presentation .canvas-card__frame {\n outline: none;\n}\n\n.canvas-card.is-focused.is-selected:not(.is-linked) .canvas-card__frame {\n animation: canvas-card-focus 900ms ease-out;\n}\n\n@keyframes canvas-card-focus {\n 0%, 35% { outline: 3px solid var(--frame-accent, var(--accent)); outline-offset: -3px; }\n 100% { outline: 0 solid transparent; outline-offset: -2px; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .canvas-card.is-focused .canvas-card__frame {\n animation: none;\n }\n}\n\n.canvas-card__header {\n display: flex;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n bottom: calc(100% + var(--space-8));\n justify-content: flex-end;\n z-index: 3;\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n}\n\n.canvas-card__drag-surface {\n position: relative;\n display: flex;\n align-items: center;\n gap: var(--space-8);\n flex: 0 1 auto;\n margin-right: auto;\n min-width: 0;\n min-height: var(--control-height-large);\n padding: 0;\n cursor: grab;\n user-select: none;\n touch-action: none;\n}\n\n.canvas-card.is-dragging .canvas-card__drag-surface {\n cursor: grabbing;\n}\n\n.canvas-card__identity {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n min-width: 0;\n}\n\n.canvas-card__dimensions {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n position: relative;\n flex: 0 1 auto;\n min-width: 0;\n max-width: 260px;\n color: var(--text-secondary);\n font-size: var(--font-size-base);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n\n.canvas-card__title {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.canvas-card__live-badge,\n.canvas-card__iteration-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 20px;\n height: 20px;\n background: var(--accent-surface);\n color: var(--accent);\n border-radius: var(--radius-4);\n pointer-events: auto;\n}\n\n.canvas-card__floating-toolbar {\n position: absolute;\n left: 50%;\n flex-shrink: 0;\n width: max-content;\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transform: translate(-50%, calc(-24px + var(--space-4)));\n transition: opacity 140ms ease-out, transform 140ms ease-out, visibility 140ms;\n}\n\n.canvas-card:hover .canvas-card__floating-toolbar,\n.canvas-card:focus-within .canvas-card__floating-toolbar,\n.canvas-card__floating-toolbar[data-busy=\"true\"] {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n transform: translate(-50%, -24px);\n}\n\n.canvas-card__actions.canvas-toolbar {\n position: static;\n width: max-content;\n transform: none;\n white-space: nowrap;\n}\n\n.canvas-card__actions .canvas-toolbar__divider {\n margin-inline: 0;\n}\n\n@media (hover: none) {\n .canvas-card.is-selected .canvas-card__floating-toolbar {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n transform: translate(-50%, -24px);\n }\n}\n\n.canvas-card.is-dragging .canvas-card__floating-toolbar,\n.canvas-workspace__board.is-grabbable .canvas-card__floating-toolbar,\n.canvas-workspace__board.is-grabbing .canvas-card__floating-toolbar,\n.canvas-workspace.is-presentation-transitioning .canvas-card__floating-toolbar,\n.canvas-workspace__board.is-layout-transitioning .canvas-card__floating-toolbar {\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: none;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .canvas-card__floating-toolbar { transition: none; }\n}\n\n.canvas-card__iteration-error {\n position: absolute;\n right: 0;\n bottom: calc(100% + var(--space-8));\n color: var(--text-danger, #b42318);\n font-size: 12px;\n white-space: nowrap;\n}\n\n.canvas-card__iframe {\n width: 100%;\n height: 100%;\n border: none;\n display: block;\n}\n\n.canvas-card__sketch-overlay {\n position: absolute;\n inset: 0;\n z-index: 2;\n display: block;\n pointer-events: none;\n}\n\n.canvas-card__loading {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--text-muted, #777777);\n font-size: 12px;\n font-weight: 500;\n}\n\n.canvas-card__error {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n height: 100%;\n padding: 20px;\n text-align: center;\n}\n\n.canvas-card__error p {\n margin: 0;\n color: var(--text-muted, #777777);\n font-size: 12px;\n font-weight: 500;\n}\n\n.canvas-card__error-actions {\n display: flex;\n gap: 8px;\n}\n\n.canvas-card__resize-handle {\n position: absolute;\n z-index: 3;\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n padding: 4px;\n color: var(--text-muted, #777777);\n opacity: 0;\n transition: opacity 150ms ease;\n touch-action: none;\n user-select: none;\n}\n\n.canvas-card__resize-handle--top,\n.canvas-card__resize-handle--bottom {\n right: 16px;\n left: 16px;\n height: 16px;\n cursor: ns-resize;\n}\n\n.canvas-card__resize-handle--top {\n top: 0;\n}\n\n.canvas-card__resize-handle--bottom {\n bottom: 0;\n}\n\n.canvas-card__resize-handle--left,\n.canvas-card__resize-handle--right {\n top: 16px;\n bottom: 16px;\n width: 16px;\n cursor: ew-resize;\n}\n\n.canvas-card__resize-handle--left {\n left: 0;\n}\n\n.canvas-card__resize-handle--right {\n right: 0;\n}\n\n.canvas-card__resize-handle--top-left,\n.canvas-card__resize-handle--top-right,\n.canvas-card__resize-handle--bottom-right,\n.canvas-card__resize-handle--bottom-left {\n z-index: 4;\n width: 24px;\n height: 24px;\n cursor: nwse-resize;\n}\n\n.canvas-card__resize-handle--top-left {\n top: 0;\n left: 0;\n}\n\n.canvas-card__resize-handle--top-right {\n top: 0;\n right: 0;\n cursor: nesw-resize;\n}\n\n.canvas-card__resize-handle--bottom-right {\n right: 0;\n bottom: 0;\n}\n\n.canvas-card__resize-handle--bottom-left {\n bottom: 0;\n left: 0;\n cursor: nesw-resize;\n}\n\n.canvas-card:hover .canvas-card__resize-handle,\n.canvas-card:focus-within .canvas-card__resize-handle {\n opacity: 1;\n}\n\n.canvas-card__resize-handle:hover {\n color: var(--accent);\n}\n\n.canvas-card__resize-handle:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n opacity: 1;\n}\n\n.canvas-card.is-linked {\n --frame-accent: #a855f7;\n}\n\n.canvas-card.is-linked:not(.is-focus-presentation) .canvas-card__frame {\n outline: 2px solid var(--frame-accent);\n outline-offset: -2px;\n}\n\n.canvas-card__iteration-badge {\n color: var(--text-secondary);\n background: var(--surface-raised-2x);\n}\n";
|
|
35
|
-
const foundationStyles = ":host {\n all: initial;\n --surface-panel: #
|
|
33
|
+
const foundationStyles = ":host {\n all: initial;\n --surface-panel: #fff;\n --surface-control: var(--surface-well);\n --surface-control-hover: var(--surface-well-2x);\n --surface-raised: #FAFAFA;\n --surface-raised-2x: #fff ;\n --surface-raised-hover: #F5F5F4;\n --surface-well: hsla(0, 0%, 0%, 0.05);\n --surface-well-2x: hsla(0, 0%, 0%, 0.10);\n /* Inverse surfaces mirror the landing palette for dark, high-emphasis controls. */\n --surface-inverse: #1f201e;\n --surface-inverse-hover: #343532;\n\n --border-subtle: hsla(0, 0%, 0%, 0.1);\n --border-medium: hsla(0, 0%, 0%, 0.2);\n --border-strong: #d8d8d8;\n\n --text-primary: #242424;\n --text-secondary: #6f6f6f;\n --text-muted: #777777;\n --text-muted-subtle: #a1a1a1;\n --text-inverse: #fff;\n\n --accent: #0096ff;\n --linked: #8b5cf6;\n --accent-surface: rgba(0, 176, 255, 0.15);\n --warning: #d97706;\n --warning-text: #9a5b00;\n --warning-surface: #fff6e5;\n --danger: #df4b4b;\n --danger-text: #bd3636;\n --danger-surface: rgba(223, 75, 75, 0.2);\n --success: #2e7d52;\n\n --space-0: 0;\n --space-4: 4px;\n --space-8: 8px;\n --space-12: 12px;\n --space-16: 16px;\n --space-20: 20px;\n --space-24: 24px;\n --space-32: 32px;\n --space-40: 40px;\n --space-48: 48px;\n\n /* Radius */\n --radius-0: 0;\n --radius-4: 4px;\n --radius-6: 6px;\n --radius-8: 8px;\n --radius-12: 12px;\n --radius-16: 16px;\n --radius-20: 20px;\n --radius-24: 24px;\n --radius-pill: 999px;\n\n --radius-control: var(--radius-8);\n --shadow-outline: 0 0 0 1px rgba(0, 0, 0, 0.05);\n --shadow-popup: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.10);\n --shadow-control-outline: 0 0 0 0.5px rgba(0, 0, 0, 0.25);\n --shadow-control: inset 0 -2px 0 rgba(0, 0, 0, 0.03), var(--shadow-control-outline);\n --z-index: 2147483647;\n\n --font-family: \"Inter Variable\", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n --font-size-base: 12px;\n --font-size-small: 10px;\n --font-weight-base: 400;\n --font-weight-label: 600;\n\n /* Control semantic sizes */\n --control-height-small: 24px;\n --control-height-large: 32px;\n --control-height-xlarge: 40px;\n --label-column: 104px;\n\n --icon-size-small: 16px;\n --icon-size-large: 20px;\n --icon-stroke-width: 1.5px;\n\n position: fixed;\n inset: 0;\n z-index: var(--z-index);\n pointer-events: none;\n font-family: var(--font-family);\n background: transparent;\n box-sizing: border-box;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nbutton,\ninput,\nselect {\n font-family: inherit;\n}\n";
|
|
36
34
|
import { useInspectorOpen } from "../shell/openStore.js";
|
|
37
35
|
import { isEditableEvent } from "../shell/shortcuts.js";
|
|
38
36
|
import { acknowledgeAgentRendererReady } from "./agentPresentation.js";
|
|
@@ -129,8 +127,7 @@ export function CanvasWorkspace({ primaryUrl }) {
|
|
|
129
127
|
: null;
|
|
130
128
|
if (!board || !card || !cardElement || typeof cardElement.animate !== "function" || camera.zoom <= 0)
|
|
131
129
|
return;
|
|
132
|
-
// The previous layout is
|
|
133
|
-
// board, and canvas places the card through the camera.
|
|
130
|
+
// The previous layout is gone, so derive it: focus fills the board, canvas places the card through the camera.
|
|
134
131
|
const boardRect = snapshotRect(board.getBoundingClientRect());
|
|
135
132
|
const canvasRect = {
|
|
136
133
|
left: boardRect.left + camera.x + card.x * camera.zoom,
|
|
@@ -497,8 +494,7 @@ export function CanvasWorkspace({ primaryUrl }) {
|
|
|
497
494
|
};
|
|
498
495
|
if (isProjectionAppliedMessage(msg, identity)) {
|
|
499
496
|
recordCanvasProjectionApplied(frame.cardId, msg.revision);
|
|
500
|
-
//
|
|
501
|
-
// the page without inspector changes; skip conflict verification.
|
|
497
|
+
// Peek shows the page without inspector changes; skip conflict verification.
|
|
502
498
|
if (isOriginalPreviewActive())
|
|
503
499
|
return;
|
|
504
500
|
const frameDocument = frame.document();
|
|
@@ -507,23 +503,14 @@ export function CanvasWorkspace({ primaryUrl }) {
|
|
|
507
503
|
if (frameDocument && plan && draft && isCanvasCanonicalProjectionRevisionCurrent(frameDocument, msg.revision)) {
|
|
508
504
|
const attempt = beginPreviewAttempt(getCanvasPreviewDocument(frame.cardId), plan.draftRevision);
|
|
509
505
|
if (attempt) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
if (!isCanvasCanonicalProjectionRevisionCurrent(frameDocument, msg.revision))
|
|
519
|
-
return;
|
|
520
|
-
const settled = verifyManagedStyleProjection(change, null, frameDocument);
|
|
521
|
-
if (settled)
|
|
522
|
-
publishPreviewDiagnostic(attempt, changeKey(change), settled);
|
|
523
|
-
}, 300);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
506
|
+
verifyPreviewChanges({
|
|
507
|
+
changes: draft.contents.changes,
|
|
508
|
+
document: frameDocument,
|
|
509
|
+
attempt,
|
|
510
|
+
targetFor: () => null,
|
|
511
|
+
isCurrent: () => isCanvasCanonicalProjectionRevisionCurrent(frameDocument, msg.revision),
|
|
512
|
+
retryAnimation: (run) => window.setTimeout(run, 300),
|
|
513
|
+
});
|
|
527
514
|
}
|
|
528
515
|
}
|
|
529
516
|
return;
|
|
@@ -549,8 +536,7 @@ export function CanvasWorkspace({ primaryUrl }) {
|
|
|
549
536
|
if (msg.type === "frame-ready") {
|
|
550
537
|
acknowledgeAgentRendererReady(frame.cardId);
|
|
551
538
|
syncActiveFrameUrl(msg.url);
|
|
552
|
-
// A card can
|
|
553
|
-
// Seed it with the current modifier state before its first pointer event.
|
|
539
|
+
// A card can load after Space was pressed, so seed the current modifier state.
|
|
554
540
|
frame.post({ type: "pan-modifier", spaceHeld: spaceHeldRef.current });
|
|
555
541
|
sendInspectorInteractionState(frame, inspectorOpen, rendererInteractionsEnabled, spaceHeldRef.current ? "drag" : rendererCursor);
|
|
556
542
|
sendBoardGestureState(frame, presentation === "canvas");
|
|
@@ -753,7 +739,7 @@ export function CanvasWorkspace({ primaryUrl }) {
|
|
|
753
739
|
window.addEventListener("wheel", handleGlobalWheel, { capture: true, passive: false });
|
|
754
740
|
return () => window.removeEventListener("wheel", handleGlobalWheel, { capture: true });
|
|
755
741
|
}, [mode, presentation, sketchActive, interactionTool, panCanvasByWheel, zoomAtPointer]);
|
|
756
|
-
// Every page card would share the one page renderer, so restored
|
|
742
|
+
// Every page card would share the one page renderer, so extra restored cards stay unmounted.
|
|
757
743
|
const renderCard = (card) => pageSurface ? (card.id === presentationCardId ? _jsx(PageCard, { card: card, documentOwner: inspectorSession }, card.id) : null) : (_jsx(CanvasCard, { card: card, presentation: presentation, presentationCard: card.id === presentationCardId, linkedToActive: linkedFrameIds.includes(card.id), onShowFocus: showFocus, onDuplicate: duplicateDesign, onCreateIteration: canvasIterationsEnabled ? createIteration : undefined, documentOwner: inspectorSession }, card.id));
|
|
758
744
|
if (mode !== "canvas")
|
|
759
745
|
return null;
|
|
@@ -11,7 +11,6 @@ import { disposeRuntimeIdentityClaims } from "../runtime/runtimeIdentityClaims.j
|
|
|
11
11
|
import { disposeInlineTextEdit } from "../inline-text/inlineTextEditor.js";
|
|
12
12
|
import { startClipboardHandoffController } from "../prompt/clipboardHandoff.js";
|
|
13
13
|
import { SketchFrameOverlay } from "../sketch/SketchFrameOverlay.js";
|
|
14
|
-
/** The page-surface Canvas card: the inspected page is the renderer. */
|
|
15
14
|
export function PageCard({ card, documentOwner }) {
|
|
16
15
|
const cardRef = useRef(card);
|
|
17
16
|
cardRef.current = card;
|
|
@@ -13,7 +13,6 @@ function EraserIllustration() {
|
|
|
13
13
|
const id = useId();
|
|
14
14
|
return (_jsxs("svg", { className: "sketch-options__illustration sketch-options__illustration--eraser", viewBox: "0 0 22 47", width: 22, height: 47, fill: "none", "aria-hidden": "true", children: [_jsx("path", { d: "M0.302734 4.7855V32.0302C0.302734 33.7251 1.40783 35.2219 3.0276 35.721L16.5844 39.898C19.0565 40.6597 21.5639 38.8232 21.5836 36.2366L21.8269 4.22443C21.8393 2.59599 20.8289 1.13477 19.3009 0.571436L19.1428 0.513114C18.2253 0.174845 17.2467 0.0339522 16.271 0.0996387L3.90538 0.932154C1.8777 1.06867 0.302734 2.75323 0.302734 4.7855Z", fill: "#DFDBD8" }), _jsx("mask", { id: `${id}-shade-mask`, style: { maskType: "alpha" }, maskUnits: "userSpaceOnUse", x: 0, y: 0, width: 22, height: 27, children: _jsx("path", { d: "M0.302734 4.7855V18.1255C0.302734 19.8204 1.40783 21.3173 3.0276 21.8164L16.6054 25.9999C19.0712 26.7596 21.5743 24.9341 21.6044 22.3541L21.8158 4.23606C21.8348 2.60193 20.8233 1.1327 19.2899 0.567375L19.1428 0.513114C18.2253 0.174845 17.2467 0.0339521 16.271 0.0996387L3.90538 0.932154C1.8777 1.06867 0.302734 2.75323 0.302734 4.7855Z", fill: "#131211" }) }), _jsxs("g", { mask: `url(#${id}-shade-mask)`, children: [_jsxs("g", { opacity: 0.7, filter: `url(#${id}-blur)`, children: [_jsx("path", { d: "M4.40022 2.17282C2.33677 1.90432 3.237 0.727298 3.94504 0.335731L14.1105 -2.01367C14.6668 -2.01367 16.4471 -1.71161 19.1174 -0.503342C21.7878 0.704922 22.253 1.11886 22.1519 1.1748L16.6898 1.51043C13.4531 1.73418 6.46367 2.44133 4.40022 2.17282Z", fill: "white" }), _jsx("path", { d: "M5.5 10.4287V21.2917C9.01287 22.5379 17.0143 25.0204 20.8216 22.1607C22.8245 20.6563 21.6392 14.6978 21.8484 12.754C22.4553 7.11543 21.6967 2.68513 18.2071 2.68513C17.4484 2.74107 15 3.04186 10.5 3.47638C6.03379 3.90764 5.39885 7.96741 5.5 10.4287Z", fill: "white" }), _jsx("path", { d: "M4.40022 5.87361V21.7262C3.42918 23.6057 1.51777 20.7842 0.759154 19.5536C0.809729 17.4839 0.758789 6.10855 0.758789 5.03454C0.758789 3.69202 1.51741 1.84606 2.88293 2.3495C3.97534 2.75226 4.34963 4.86672 4.40022 5.87361Z", fill: "white" })] }), _jsx("path", { d: "M16.2881 0.348633C17.2286 0.285354 18.1722 0.421976 19.0566 0.748047L19.2148 0.805664C20.6438 1.33259 21.5887 2.69971 21.5771 4.22266L21.334 36.2344C21.3156 38.6536 18.9702 40.3714 16.6582 39.6592L3.10156 35.4824C1.58668 35.0157 0.552786 33.6154 0.552734 32.0303V4.78516L0.556641 4.6084C0.644771 2.78788 2.08482 1.30547 3.92188 1.18164L16.2881 0.348633Z", stroke: "black", strokeOpacity: 0.1, strokeWidth: 0.5 })] }), _jsx("path", { d: "M4.55172 21.3245L0.303448 18.9751H0V44.6507L4.09655 47.0001L22 44.1473V19.3107L4.55172 21.3245Z", fill: `url(#${id}-sleeve)` }), _jsx("path", { d: "M0.253906 19.1685L4.45801 21.4937L4.5127 21.5229L4.57422 21.5161L21.8066 19.5269V43.9819L4.13281 46.7983L0.193359 44.5386V19.1685H0.253906Z", stroke: "black", strokeOpacity: 0.3, strokeWidth: 0.386207 }), _jsxs("defs", { children: [_jsxs("filter", { id: `${id}-blur`, x: -0.786039, y: -3.5585, width: 24.4949, height: 28.5867, filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [_jsx("feFlood", { floodOpacity: 0, result: "BackgroundImageFix" }), _jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), _jsx("feGaussianBlur", { stdDeviation: 0.772414, result: "effect1_foregroundBlur" })] }), _jsxs("linearGradient", { id: `${id}-sleeve`, x1: "1.01446e-07", y1: "26.0713", x2: "8.5", y2: "26.0713", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#5D5D5D" }), _jsx("stop", { offset: "0.48629", stopColor: "#5D5D5D" }), _jsx("stop", { offset: "0.568482", stopColor: "#2B2B2B" })] })] })] }));
|
|
15
15
|
}
|
|
16
|
-
/** Rectangle tool icon: outlined in the selected pen color with a 10% tint, matching what it draws. */
|
|
17
16
|
function RectangleIcon({ color }) {
|
|
18
17
|
return (_jsx("svg", { viewBox: "0 0 24 24", width: 24, height: 24, fill: "none", "aria-hidden": "true", children: _jsx("rect", { x: 1, y: 1, width: 22, height: 22, rx: 4, fill: color.value, fillOpacity: SKETCH_RECTANGLE_FILL_OPACITY, stroke: color.value, strokeWidth: 2 }) }));
|
|
19
18
|
}
|
|
@@ -21,14 +20,10 @@ function IllustratedToolButton({ tool, activeTool, label, hidden, children, }) {
|
|
|
21
20
|
const active = tool === activeTool;
|
|
22
21
|
return (_jsx(Tooltip, { content: label, stableTrigger: true, children: _jsx("button", { type: "button", className: "sketch-options__illustrated", "aria-label": label, "aria-pressed": active, "data-active": active ? "true" : "false", "data-test": `sketch-tool-${tool}`, tabIndex: hidden ? -1 : undefined, onClick: () => setSketchDrawingTool(tool), children: children }) }));
|
|
23
22
|
}
|
|
24
|
-
/** Distance from the picker's center to each swatch center, and the swatch diameter, in px. */
|
|
25
23
|
const PALETTE_RADIUS = 26;
|
|
26
24
|
const PALETTE_SWATCH_SIZE = 32;
|
|
27
|
-
/** Paint order of the overlapping swatches, bottom to top; the selected swatch always wins. */
|
|
28
|
-
/** Delay between neighboring swatches as they fan out or collapse, in ms. */
|
|
29
25
|
const PALETTE_STAGGER_MS = 18;
|
|
30
26
|
const PALETTE_STACK_ORDER = ["yellow", "orange", "red", "black", "green", "blue"];
|
|
31
|
-
/** Offset of swatch `index` of `count` from the picker's center; the first sits at the top right. */
|
|
32
27
|
function paletteSwatchOffset(index, count) {
|
|
33
28
|
const radians = ((-90 + (index + 0.5) * (360 / count)) * Math.PI) / 180;
|
|
34
29
|
return {
|
|
@@ -79,7 +74,6 @@ function ColorPicker({ color, hidden }) {
|
|
|
79
74
|
closePalette();
|
|
80
75
|
} }, option.id))) })) : null] }));
|
|
81
76
|
}
|
|
82
|
-
/** Pen, eraser, color and rectangle controls that slide out beside the sketch tool. */
|
|
83
77
|
export function SketchToolOptions({ open }) {
|
|
84
78
|
const drawing = useSketchDrawingTools();
|
|
85
79
|
return (_jsx(ToolOptionsDrawer, { name: "sketch", open: open, label: "Sketch tools", children: ({ hidden, settled }) => (_jsxs(_Fragment, { children: [_jsx(IllustratedToolButton, { tool: "pen", activeTool: drawing.tool, label: "Pen", hidden: hidden, children: _jsx(PenIllustration, { color: drawing.color }) }), _jsx(IllustratedToolButton, { tool: "eraser", activeTool: drawing.tool, label: "Eraser", hidden: hidden, children: _jsx(EraserIllustration, {}) }), _jsx(Tooltip, { content: "Rectangle", stableTrigger: true, children: _jsx(IconButton, { variant: "quiet", size: "large", className: "canvas-toolbar__tool sketch-options__rectangle", label: "Rectangle", "aria-pressed": drawing.tool === "rectangle", "data-active": drawing.tool === "rectangle" ? "true" : "false", "data-test": "sketch-tool-rectangle", tabIndex: hidden ? -1 : undefined, onClick: () => setSketchDrawingTool("rectangle"), children: _jsx(RectangleIcon, { color: drawing.color }) }) }), _jsx(ColorPicker, { color: drawing.color, hidden: hidden || !settled })] })) }));
|
|
@@ -4,18 +4,13 @@ export interface ToolOptionsDrawerProps {
|
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly open: boolean;
|
|
6
6
|
readonly label: string;
|
|
7
|
-
/**
|
|
8
|
-
* Renders the drawer content. `hidden` removes controls from the tab order;
|
|
9
|
-
* `settled` is true once the slide finishes and content may overflow the bar.
|
|
10
|
-
*/
|
|
7
|
+
/** `hidden` removes controls from the tab order; `settled` is true once the slide finishes. */
|
|
11
8
|
readonly children: (state: {
|
|
12
9
|
readonly hidden: boolean;
|
|
13
10
|
readonly settled: boolean;
|
|
14
11
|
}) => ReactNode;
|
|
15
12
|
}
|
|
16
|
-
/** Slides tool-specific options out of the canvas toolbar beside their tool. */
|
|
17
13
|
export declare function ToolOptionsDrawer({ name, open, label, children }: ToolOptionsDrawerProps): ReactElement;
|
|
18
|
-
/** Closes a toolbar popover on an outside pointer press or Escape. */
|
|
19
14
|
export declare function useDismissablePopover(open: boolean, rootRef: {
|
|
20
15
|
readonly current: HTMLElement | null;
|
|
21
16
|
}, close: () => void): void;
|
|
@@ -2,12 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
/** Matches the `width` transition in CanvasToolbar.css. */
|
|
4
4
|
const SLIDE_DURATION_MS = 220;
|
|
5
|
-
// The toolbar
|
|
6
|
-
// Remember each drawer's last state and width so the new instance can animate
|
|
7
|
-
// from them; it can mount before its content has been laid out.
|
|
5
|
+
// The toolbar remounts when sketching moves it into a root-level portal; remember each drawer's last state and width.
|
|
8
6
|
const lastOpen = new Map();
|
|
9
7
|
const lastWidth = new Map();
|
|
10
|
-
/** Slides tool-specific options out of the canvas toolbar beside their tool. */
|
|
11
8
|
export function ToolOptionsDrawer({ name, open, label, children }) {
|
|
12
9
|
const [expanded, setExpanded] = useState(() => lastOpen.get(name) ?? false);
|
|
13
10
|
const [settled, setSettled] = useState(() => (lastOpen.get(name) ?? false) && open);
|
|
@@ -35,9 +32,7 @@ export function ToolOptionsDrawer({ name, open, label, children }) {
|
|
|
35
32
|
setSettled(false);
|
|
36
33
|
let timer;
|
|
37
34
|
const frame = requestAnimationFrame(() => {
|
|
38
|
-
//
|
|
39
|
-
// effect before a freshly mounted toolbar is ever styled. Flush its
|
|
40
|
-
// previous state first so the width change transitions instead of jumping.
|
|
35
|
+
// React can run this effect before a remounted toolbar is styled; flush layout so the width change transitions instead of jumping.
|
|
41
36
|
void drawerRef.current?.offsetWidth;
|
|
42
37
|
setExpanded(open);
|
|
43
38
|
if (open)
|
|
@@ -50,7 +45,6 @@ export function ToolOptionsDrawer({ name, open, label, children }) {
|
|
|
50
45
|
}, [name, open]);
|
|
51
46
|
return (_jsx("div", { ref: drawerRef, className: "tool-options", role: "group", "aria-label": label, "aria-hidden": !open, "data-expanded": expanded ? "true" : "false", "data-settled": settled ? "true" : "false", "data-test": `${name}-tool-options`, style: { width: expanded ? contentWidth : 0 }, children: _jsx("div", { className: "tool-options__inner", ref: innerRef, children: children({ hidden: !open, settled }) }) }));
|
|
52
47
|
}
|
|
53
|
-
/** Closes a toolbar popover on an outside pointer press or Escape. */
|
|
54
48
|
export function useDismissablePopover(open, rootRef, close) {
|
|
55
49
|
const closeRef = useRef(close);
|
|
56
50
|
closeRef.current = close;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { CanvasFrame } from "./canvasFrame.js";
|
|
2
|
-
/** Resolves only the selected or focused frame. */
|
|
3
2
|
export declare function resolveActiveCanvasFrame(frames: ReadonlyMap<string, CanvasFrame>, selectedCardId: string | null, focusedCardId: string | null): CanvasFrame | null;
|
|
4
3
|
export declare function getActiveCanvasDocument(): Document | null;
|
|
5
|
-
/** Returns the iframe that owns the active renderer document. */
|
|
6
4
|
export declare function getActiveCanvasFrame(): CanvasFrame | null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getFocusedCardId, getSelectedCardId } from "./canvasStore.js";
|
|
2
2
|
import { getRegisteredFrames } from "./projection.js";
|
|
3
|
-
/** Resolves only the selected or focused frame. */
|
|
4
3
|
export function resolveActiveCanvasFrame(frames, selectedCardId, focusedCardId) {
|
|
5
4
|
const activeCardId = selectedCardId ?? focusedCardId;
|
|
6
5
|
return activeCardId ? frames.get(activeCardId) ?? null : null;
|
|
@@ -17,7 +16,6 @@ export function getActiveCanvasDocument() {
|
|
|
17
16
|
return null;
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
/** Returns the iframe that owns the active renderer document. */
|
|
21
19
|
export function getActiveCanvasFrame() {
|
|
22
20
|
return resolveActiveCanvasFrame(getRegisteredFrames(), getSelectedCardId(), getFocusedCardId());
|
|
23
21
|
}
|