@weasel-js/core 1.10.1 → 1.11.1
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/CHANGELOG.md +1014 -0
- package/README.md +16 -15
- package/dist/WeaselProvider.js +25 -9
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +217 -140
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +92 -50
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +147 -84
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js +140 -65
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotateCursor.js +10 -4
- package/dist/affordances/rotateCursor.js.map +1 -1
- package/dist/affordances/rotationHandle.js +83 -60
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +20 -14
- package/dist/animation/behaviors/coast.js.map +1 -1
- package/dist/animation/behaviors/coastByWrite.js +98 -70
- package/dist/animation/behaviors/coastByWrite.js.map +1 -1
- package/dist/animation/behaviors/coastOnTargets.js +115 -67
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -1
- package/dist/animation/behaviors/momentum.js +88 -53
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +14 -7
- package/dist/animation/clipTargets.js.map +1 -1
- package/dist/animation/departures.js +116 -0
- package/dist/animation/departures.js.map +1 -0
- package/dist/animation/index.js +18 -15
- package/dist/animation/poseHelpers.js +147 -107
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +158 -85
- package/dist/animation/poseTarget.js.map +1 -1
- package/dist/animation/poseTransition.js +64 -0
- package/dist/animation/poseTransition.js.map +1 -0
- package/dist/animation/reflow.js +208 -120
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +76 -45
- package/dist/animation/rewind.js.map +1 -1
- package/dist/animation/rig/bindRig.js +135 -82
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +120 -75
- package/dist/animation/rig/rigNode.js.map +1 -1
- package/dist/animation/rig/rigSeat.js +61 -41
- package/dist/animation/rig/rigSeat.js.map +1 -1
- package/dist/animation/rig/skinBinding.js +57 -45
- package/dist/animation/rig/skinBinding.js.map +1 -1
- package/dist/animation/rig/useRig.js +44 -30
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +51 -35
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +55 -32
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js +13 -8
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +44 -22
- package/dist/animation/writtenPoseTarget.js.map +1 -1
- package/dist/{autoPoseDescriptor-DHg5KqaJ.d.ts → autoPoseDescriptor-CZ1eXbzY.d.ts} +1 -1
- package/dist/barrel/canvas.js +45 -32
- package/dist/barrel/chrome.js +19 -16
- package/dist/barrel/icons.js +6 -0
- package/dist/barrel/input.js +19 -18
- package/dist/barrel/interactions.js +41 -39
- package/dist/barrel/paint.js +12 -11
- package/dist/barrel/paths.js +39 -13
- package/dist/barrel/renderer.js +25 -14
- package/dist/barrel/routing.js +64 -58
- package/dist/barrel/scene.js +51 -37
- package/dist/barrel/text.js +10 -9
- package/dist/barrel/viewport.js +48 -45
- package/dist/canvas/Canvas.js +191 -306
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +273 -199
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +103 -64
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +68 -41
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/LeanSceneCanvas.js +23 -0
- package/dist/canvas/LeanSceneCanvas.js.map +1 -0
- package/dist/canvas/ModalityHud.js +58 -43
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +137 -60
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js +77 -59
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +9 -6
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/CanvasKitProviders.js +25 -0
- package/dist/canvas/SceneCanvas/CanvasKitProviders.js.map +1 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -6
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +47 -32
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +72 -37
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/SceneCanvasInput.js +124 -0
- package/dist/canvas/SceneCanvas/SceneCanvasInput.js.map +1 -0
- package/dist/canvas/SceneCanvas/brushOverlay.js +36 -0
- package/dist/canvas/SceneCanvas/brushOverlay.js.map +1 -0
- package/dist/canvas/SceneCanvas/builtinToolSets.js +30 -0
- package/dist/canvas/SceneCanvas/builtinToolSets.js.map +1 -0
- package/dist/canvas/SceneCanvas/canvasPassThrough.js +73 -0
- package/dist/canvas/SceneCanvas/canvasPassThrough.js.map +1 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js +54 -32
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +26 -30
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +323 -159
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +39 -13
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +83 -47
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +123 -106
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js +80 -62
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -1
- package/dist/canvas/SceneCanvas/mergeLayers.js +43 -0
- package/dist/canvas/SceneCanvas/mergeLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/namedPresets.js +56 -0
- package/dist/canvas/SceneCanvas/namedPresets.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +66 -31
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseRegistrars.js +18 -8
- package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -1
- package/dist/canvas/SceneCanvas/presets/arrange.js +27 -0
- package/dist/canvas/SceneCanvas/presets/arrange.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/chrome.js +14 -0
- package/dist/canvas/SceneCanvas/presets/chrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/edit.js +59 -0
- package/dist/canvas/SceneCanvas/presets/edit.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/ingest.js +13 -0
- package/dist/canvas/SceneCanvas/presets/ingest.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/paths.js +67 -0
- package/dist/canvas/SceneCanvas/presets/paths.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/select.js +19 -0
- package/dist/canvas/SceneCanvas/presets/select.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/toolDriven.js +20 -0
- package/dist/canvas/SceneCanvas/presets/toolDriven.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/transform.js +41 -0
- package/dist/canvas/SceneCanvas/presets/transform.js.map +1 -0
- package/dist/canvas/SceneCanvas/presets/view.js +14 -0
- package/dist/canvas/SceneCanvas/presets/view.js.map +1 -0
- package/dist/canvas/SceneCanvas/props.js +9 -35
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +43 -35
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -1
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +22 -15
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/toolRegistry.js +34 -15
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -1
- package/dist/canvas/SceneCanvas/useActionTunings.js +14 -11
- package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +59 -36
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBakedScene.js +17 -0
- package/dist/canvas/SceneCanvas/useBakedScene.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +47 -23
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +22 -14
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +53 -38
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasDevtoolsRoot.js +93 -0
- package/dist/canvas/SceneCanvas/useCanvasDevtoolsRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +24 -14
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +35 -12
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasTools.js +112 -53
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useChromeAffordances.js +31 -0
- package/dist/canvas/SceneCanvas/useChromeAffordances.js.map +1 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js +107 -56
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -1
- package/dist/canvas/SceneCanvas/useDepartureGhostLayer.js +64 -0
- package/dist/canvas/SceneCanvas/useDepartureGhostLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +104 -71
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +21 -14
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -1
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +21 -19
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -1
- package/dist/canvas/SceneCanvas/useNodeKinds.js +28 -19
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +91 -59
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +62 -35
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +121 -50
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasPathEdit.js +30 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasPathEdit.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js +38 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +99 -44
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js +165 -0
- package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useScenePicking.js +68 -0
- package/dist/canvas/SceneCanvas/useScenePicking.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +28 -17
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +160 -80
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +38 -26
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneStandardActions.js +107 -0
- package/dist/canvas/SceneCanvas/useSceneStandardActions.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +40 -27
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSurfaceRouting.js +29 -0
- package/dist/canvas/SceneCanvas/useSurfaceRouting.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSurfaceViewInputs.js +44 -0
- package/dist/canvas/SceneCanvas/useSurfaceViewInputs.js.map +1 -0
- package/dist/canvas/SceneCanvas/useToolKeybindings.js +28 -0
- package/dist/canvas/SceneCanvas/useToolKeybindings.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +52 -28
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +10 -4
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +276 -312
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +68 -42
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/SurfaceCanvas.js +38 -33
- package/dist/canvas/SurfaceCanvas.js.map +1 -1
- package/dist/canvas/accentColor.js +8 -5
- package/dist/canvas/accentColor.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +33 -18
- package/dist/canvas/adapterDerivedPath.js.map +1 -1
- package/dist/canvas/adapterPickSource.js +49 -23
- package/dist/canvas/adapterPickSource.js.map +1 -1
- package/dist/canvas/affordanceAt.js +106 -50
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +111 -80
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +101 -59
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +161 -72
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js +18 -10
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/contextAttributes.js +14 -0
- package/dist/canvas/contextAttributes.js.map +1 -0
- package/dist/canvas/copiesAbove.js +24 -14
- package/dist/canvas/copiesAbove.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +55 -31
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +30 -12
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/booleans.js +104 -0
- package/dist/canvas/deps/booleans.js.map +1 -0
- package/dist/canvas/deps/changes.js +17 -9
- package/dist/canvas/deps/changes.js.map +1 -1
- package/dist/canvas/deps/debug.js +12 -5
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/dispatchSources.js +27 -0
- package/dist/canvas/deps/dispatchSources.js.map +1 -0
- package/dist/canvas/deps/dispatcher.js +18 -7
- package/dist/canvas/deps/dispatcher.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +150 -64
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js +13 -7
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +78 -53
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/ingestion.js +18 -13
- package/dist/canvas/deps/ingestion.js.map +1 -1
- package/dist/canvas/deps/insert.js +178 -116
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/kitSettings.js +16 -0
- package/dist/canvas/deps/kitSettings.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +25 -13
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/layout.js +32 -20
- package/dist/canvas/deps/layout.js.map +1 -1
- package/dist/canvas/deps/nodeAtPoint.js +28 -14
- package/dist/canvas/deps/nodeAtPoint.js.map +1 -1
- package/dist/canvas/deps/pathEditCommits.js +193 -0
- package/dist/canvas/deps/pathEditCommits.js.map +1 -0
- package/dist/canvas/deps/pathLeaf.js +66 -0
- package/dist/canvas/deps/pathLeaf.js.map +1 -0
- package/dist/canvas/deps/pathLeafDeps.js +13 -0
- package/dist/canvas/deps/pathLeafDeps.js.map +1 -0
- package/dist/canvas/deps/poseDescriptor.js +10 -8
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/previewPaths.js +44 -0
- package/dist/canvas/deps/previewPaths.js.map +1 -0
- package/dist/canvas/deps/resizePolicy.js +32 -25
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +73 -87
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/snap.js +61 -7
- package/dist/canvas/deps/snap.js.map +1 -1
- package/dist/canvas/deps/surface.js +30 -0
- package/dist/canvas/deps/surface.js.map +1 -0
- package/dist/canvas/deps/textEdit.js +21 -13
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/transformFollowers.js +20 -0
- package/dist/canvas/deps/transformFollowers.js.map +1 -0
- package/dist/canvas/deps/view.js +46 -34
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +173 -70
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/doubleClickTarget.js +20 -0
- package/dist/canvas/doubleClickTarget.js.map +1 -0
- package/dist/canvas/drawEnvelope.js +26 -17
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/drawnBounds.js +142 -0
- package/dist/canvas/drawnBounds.js.map +1 -0
- package/dist/canvas/getNodeAtPoint.js +11 -8
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hostAnchor.js +35 -18
- package/dist/canvas/hostAnchor.js.map +1 -1
- package/dist/canvas/hud.module.js +25 -14
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js +82 -61
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/kitRequirements.js +154 -115
- package/dist/canvas/kitRequirements.js.map +1 -1
- package/dist/canvas/layerHover.js +28 -0
- package/dist/canvas/layerHover.js.map +1 -0
- package/dist/canvas/layerOrder.js +107 -57
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +16 -9
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/mountedCanvases.js +23 -13
- package/dist/canvas/mountedCanvases.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +73 -25
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +69 -53
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/measurePainter.js +58 -0
- package/dist/canvas/nodeShapes/measurePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/memo.js +16 -5
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +125 -46
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +42 -27
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +20 -13
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +26 -22
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +67 -46
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/strokedBounds.js +177 -0
- package/dist/canvas/nodeShapes/strokedBounds.js.map +1 -0
- package/dist/canvas/nodeShapes/textPainter.js +170 -37
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overChildren.js +29 -18
- package/dist/canvas/overChildren.js.map +1 -1
- package/dist/canvas/overlayRoleStrokes.js +32 -3
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +24 -12
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/canvas/paintedCursorLayer.js +59 -35
- package/dist/canvas/paintedCursorLayer.js.map +1 -1
- package/dist/canvas/pathOverlay.js +83 -0
- package/dist/canvas/pathOverlay.js.map +1 -0
- package/dist/canvas/pickReach.js +34 -17
- package/dist/canvas/pickReach.js.map +1 -1
- package/dist/canvas/pickWalk.js +151 -102
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +39 -22
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +51 -27
- package/dist/canvas/poseCascade.js.map +1 -1
- package/dist/canvas/poseRotation.js +24 -14
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +23 -15
- package/dist/canvas/rasterReadback.js.map +1 -1
- package/dist/canvas/rasterToPng.js +21 -15
- package/dist/canvas/rasterToPng.js.map +1 -1
- package/dist/canvas/renderDebugSnapshot.js +37 -19
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +33 -18
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +203 -87
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +96 -75
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +141 -92
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +56 -27
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +24 -14
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +85 -49
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +58 -49
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surfaceContribution.js +22 -10
- package/dist/canvas/surfaceContribution.js.map +1 -1
- package/dist/canvas/useCanvasElements.js +31 -0
- package/dist/canvas/useCanvasElements.js.map +1 -0
- package/dist/canvas/useCanvasHandle.js +69 -0
- package/dist/canvas/useCanvasHandle.js.map +1 -0
- package/dist/canvas/useCanvasPaint.js +92 -0
- package/dist/canvas/useCanvasPaint.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +45 -23
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +41 -23
- package/dist/canvas/useCanvasSurface.js.map +1 -1
- package/dist/canvas/useCanvasView.js +80 -48
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useClientToWorld.js +27 -0
- package/dist/canvas/useClientToWorld.js.map +1 -0
- package/dist/canvas/useExtraLayers.js +45 -0
- package/dist/canvas/useExtraLayers.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +109 -49
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHitObserver.js +22 -15
- package/dist/canvas/useHitObserver.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +83 -53
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useInFlightBounds.js +52 -0
- package/dist/canvas/useInFlightBounds.js.map +1 -0
- package/dist/canvas/useLateContentRedraw.js +21 -14
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useLayerStack.js +72 -0
- package/dist/canvas/useLayerStack.js.map +1 -0
- package/dist/canvas/usePaintedCursor.js +28 -0
- package/dist/canvas/usePaintedCursor.js.map +1 -0
- package/dist/canvas/useRedrawOn.js +24 -14
- package/dist/canvas/useRedrawOn.js.map +1 -1
- package/dist/canvas/useSceneAdapter.js +21 -16
- package/dist/canvas/useSceneAdapter.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +15 -7
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +46 -27
- package/dist/canvas/useSurfaceInput.js.map +1 -1
- package/dist/canvas/useSurfaceSize.js +43 -0
- package/dist/canvas/useSurfaceSize.js.map +1 -0
- package/dist/canvas/useToolCursor.js +30 -21
- package/dist/canvas/useToolCursor.js.map +1 -1
- package/dist/canvas/useViewHelpers.js +110 -61
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/useViewLayerGate.js +29 -0
- package/dist/canvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/useViewNesting.js +104 -0
- package/dist/canvas/useViewNesting.js.map +1 -0
- package/dist/canvas/useViewRegistrySurface.js +44 -0
- package/dist/canvas/useViewRegistrySurface.js.map +1 -0
- package/dist/canvas/viewInputs.js +14 -11
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +140 -42
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +71 -33
- package/dist/canvas/watchElementMove.js.map +1 -1
- package/dist/canvas/wrapNodeOutput.js +20 -13
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +9 -4
- package/dist/clipboard.js +4 -3
- package/dist/{clone-C0eADtS0.d.ts → clone-C3e0OTuF.d.ts} +27 -73
- package/dist/clone.d.ts +7 -5
- package/dist/core/adapters/testing/rootsTree.js +17 -0
- package/dist/core/adapters/testing/rootsTree.js.map +1 -0
- package/dist/core/applyOps.js +23 -7
- package/dist/core/applyOps.js.map +1 -1
- package/dist/core/device/index.js +6 -5
- package/dist/core/device/targets.js +29 -8
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +86 -52
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/device/useTargetBasePx.js +23 -0
- package/dist/core/device/useTargetBasePx.js.map +1 -0
- package/dist/core/device/watchDevicePixelRatio.js +27 -10
- package/dist/core/device/watchDevicePixelRatio.js.map +1 -1
- package/dist/core/geometry/autoPoseDescriptor.js +38 -24
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -1
- package/dist/core/geometry/inkExtents.js +60 -0
- package/dist/core/geometry/inkExtents.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +101 -76
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -1
- package/dist/core/geometry/poseDescriptor.js +199 -136
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +127 -79
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +84 -60
- package/dist/core/geometry/targetFrame.js.map +1 -1
- package/dist/core/geometry/unionBounds.js +103 -48
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +3 -2
- package/dist/core/layers/backgroundFill.js +23 -15
- package/dist/core/layers/backgroundFill.js.map +1 -1
- package/dist/core/layers/children.js +16 -13
- package/dist/core/layers/children.js.map +1 -1
- package/dist/core/layers/gateLayer.js +24 -9
- package/dist/core/layers/gateLayer.js.map +1 -1
- package/dist/core/layers/layerGroup.js +42 -29
- package/dist/core/layers/layerGroup.js.map +1 -1
- package/dist/core/layers/redrawSource.js +15 -0
- package/dist/core/layers/redrawSource.js.map +1 -0
- package/dist/core/layers/render.js +183 -93
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/layers/retain.js +38 -0
- package/dist/core/layers/retain.js.map +1 -0
- package/dist/core/ops/arrange.js +30 -19
- package/dist/core/ops/arrange.js.map +1 -1
- package/dist/core/ops/create.js +32 -23
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/createHistory.js +23 -14
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js +80 -53
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/nodeFlags.js +44 -0
- package/dist/core/ops/nodeFlags.js.map +1 -0
- package/dist/core/ops/registry.js +26 -11
- package/dist/core/ops/registry.js.map +1 -1
- package/dist/core/ops/reorder/algorithms.js +62 -38
- package/dist/core/ops/reorder/algorithms.js.map +1 -1
- package/dist/core/ops/reorder/index.js +124 -84
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +32 -23
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
- package/dist/core/ops/reparent.js +63 -37
- package/dist/core/ops/reparent.js.map +1 -1
- package/dist/core/ops/select.js +23 -20
- package/dist/core/ops/select.js.map +1 -1
- package/dist/core/ops/setData.js +23 -21
- package/dist/core/ops/setData.js.map +1 -1
- package/dist/core/ops/setDependsOn.js +37 -0
- package/dist/core/ops/setDependsOn.js.map +1 -0
- package/dist/core/ops/setLayer.js +26 -21
- package/dist/core/ops/setLayer.js.map +1 -1
- package/dist/core/ops/setLayout.js +27 -18
- package/dist/core/ops/setLayout.js.map +1 -1
- package/dist/core/ops/setPath.js +60 -41
- package/dist/core/ops/setPath.js.map +1 -1
- package/dist/core/ops/setText.js +26 -21
- package/dist/core/ops/setText.js.map +1 -1
- package/dist/core/ops/slot.js +36 -22
- package/dist/core/ops/slot.js.map +1 -1
- package/dist/core/ops/transform.js +35 -28
- package/dist/core/ops/transform.js.map +1 -1
- package/dist/core/ops/writtenBy.js +53 -0
- package/dist/core/ops/writtenBy.js.map +1 -0
- package/dist/core/pages/fitViewToPage.js +24 -11
- package/dist/core/pages/fitViewToPage.js.map +1 -1
- package/dist/core/pages/pageEdits.js +164 -0
- package/dist/core/pages/pageEdits.js.map +1 -0
- package/dist/core/pages/pages.js +102 -42
- package/dist/core/pages/pages.js.map +1 -1
- package/dist/core/pages/pagesLayer.js +19 -13
- package/dist/core/pages/pagesLayer.js.map +1 -1
- package/dist/core/paint/meshKind.js +16 -11
- package/dist/core/paint/meshKind.js.map +1 -1
- package/dist/core/paint/meshKindLazy.js +1 -1
- package/dist/core/paint/meshKindLazy.js.map +1 -1
- package/dist/core/paint/paintKindEntry.js +13 -4
- package/dist/core/paint/paintKindEntry.js.map +1 -1
- package/dist/core/paint/paintKinds.js +149 -88
- package/dist/core/paint/paintKinds.js.map +1 -1
- package/dist/core/paint/registerMesh.js +6 -4
- package/dist/core/paint/registerMesh.js.map +1 -1
- package/dist/core/scene/NodeProperties.js +15 -10
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js +22 -13
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/annotation.js +28 -0
- package/dist/core/scene/annotation.js.map +1 -0
- package/dist/core/scene/appliedLog.js +31 -23
- package/dist/core/scene/appliedLog.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +120 -75
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/arrivals.js +17 -6
- package/dist/core/scene/arrivals.js.map +1 -1
- package/dist/core/scene/boundOps.js +42 -23
- package/dist/core/scene/boundOps.js.map +1 -1
- package/dist/core/scene/carryDescendants.js +51 -0
- package/dist/core/scene/carryDescendants.js.map +1 -0
- package/dist/core/scene/composeFrame.js +51 -21
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/core/scene/composePose.js +114 -62
- package/dist/core/scene/composePose.js.map +1 -1
- package/dist/core/scene/depFrame.js +94 -0
- package/dist/core/scene/depFrame.js.map +1 -0
- package/dist/core/scene/depMemo.js +44 -19
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/dependents.js +73 -45
- package/dist/core/scene/dependents.js.map +1 -1
- package/dist/core/scene/derivedParts.js +58 -0
- package/dist/core/scene/derivedParts.js.map +1 -0
- package/dist/core/scene/derivedPath.js +52 -22
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/docValues.js +57 -0
- package/dist/core/scene/docValues.js.map +1 -0
- package/dist/core/scene/editMode.js +11 -11
- package/dist/core/scene/editMode.js.map +1 -1
- package/dist/core/scene/editPass.js +111 -0
- package/dist/core/scene/editPass.js.map +1 -0
- package/dist/core/scene/effectivePose.js +173 -51
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -75
- package/dist/core/scene/fieldEdits.js.map +1 -1
- package/dist/core/scene/historyFacade.js +127 -87
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +7 -3
- package/dist/core/scene/historyForm.js.map +1 -1
- package/dist/core/scene/kitOps.js +203 -131
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js +49 -22
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +123 -92
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +143 -72
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/core/scene/lockGuard.js +32 -24
- package/dist/core/scene/lockGuard.js.map +1 -1
- package/dist/core/scene/minSize.js +17 -0
- package/dist/core/scene/minSize.js.map +1 -0
- package/dist/core/scene/nestedHit.js +45 -31
- package/dist/core/scene/nestedHit.js.map +1 -1
- package/dist/core/scene/nodeFlags.js +43 -0
- package/dist/core/scene/nodeFlags.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +58 -41
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeGates.js +58 -0
- package/dist/core/scene/nodeGates.js.map +1 -0
- package/dist/core/scene/nodeMemo.js +92 -40
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +179 -99
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/notifier.js +30 -19
- package/dist/core/scene/notifier.js.map +1 -1
- package/dist/core/scene/opTable.js +42 -36
- package/dist/core/scene/opTable.js.map +1 -1
- package/dist/core/scene/outerOps.js +49 -43
- package/dist/core/scene/outerOps.js.map +1 -1
- package/dist/core/scene/pathEffects/blend.js +80 -0
- package/dist/core/scene/pathEffects/blend.js.map +1 -0
- package/dist/core/scene/pathEffects/derive.js +112 -0
- package/dist/core/scene/pathEffects/derive.js.map +1 -0
- package/dist/core/scene/pathEffects/effects.js +40 -0
- package/dist/core/scene/pathEffects/effects.js.map +1 -0
- package/dist/core/scene/poseFeed.js +95 -60
- package/dist/core/scene/poseFeed.js.map +1 -1
- package/dist/core/scene/poseHold.js +33 -24
- package/dist/core/scene/poseHold.js.map +1 -1
- package/dist/core/scene/poseOverrides.js +86 -49
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseRemovals.js +58 -0
- package/dist/core/scene/poseRemovals.js.map +1 -0
- package/dist/core/scene/poseSnapshot.js +62 -41
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/poseWrites.js +151 -0
- package/dist/core/scene/poseWrites.js.map +1 -0
- package/dist/core/scene/reconcileSpecs.js +63 -34
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +99 -57
- package/dist/core/scene/recorder.js.map +1 -1
- package/dist/core/scene/renderOrder.js +105 -59
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/scene.js +139 -80
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneChanges.js +13 -0
- package/dist/core/scene/sceneChanges.js.map +1 -0
- package/dist/core/scene/sceneEdits.js +69 -49
- package/dist/core/scene/sceneEdits.js.map +1 -1
- package/dist/core/scene/sceneMutators.js +45 -36
- package/dist/core/scene/sceneMutators.js.map +1 -1
- package/dist/core/scene/scenePoseAdapter.js +13 -9
- package/dist/core/scene/scenePoseAdapter.js.map +1 -1
- package/dist/core/scene/sceneRecording.js +106 -73
- package/dist/core/scene/sceneRecording.js.map +1 -1
- package/dist/core/scene/sceneSelection.js +26 -16
- package/dist/core/scene/sceneSelection.js.map +1 -1
- package/dist/core/scene/sceneState.js +61 -37
- package/dist/core/scene/sceneState.js.map +1 -1
- package/dist/core/scene/serialization.js +89 -50
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +35 -26
- package/dist/core/scene/staleReplay.js.map +1 -1
- package/dist/core/scene/statedFields.js +10 -5
- package/dist/core/scene/statedFields.js.map +1 -1
- package/dist/core/scene/treeEdits.js +129 -98
- package/dist/core/scene/treeEdits.js.map +1 -1
- package/dist/core/scene/treeOrder.js +13 -8
- package/dist/core/scene/treeOrder.js.map +1 -1
- package/dist/core/scene/treeReads.js +25 -16
- package/dist/core/scene/treeReads.js.map +1 -1
- package/dist/core/scene/types.js +4 -3
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/scene/unionOfChildren.js +20 -10
- package/dist/core/scene/unionOfChildren.js.map +1 -1
- package/dist/core/scene/unitScopes.js +33 -8
- package/dist/core/scene/unitScopes.js.map +1 -1
- package/dist/core/scene/useScene.js +32 -24
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/chromeState.js +41 -17
- package/dist/core/selection/chromeState.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +39 -24
- package/dist/core/selection/readOnlySelection.js.map +1 -1
- package/dist/core/selection/selectionTarget.js +14 -3
- package/dist/core/selection/selectionTarget.js.map +1 -1
- package/dist/core/selection/usePublishSceneSelection.js +20 -19
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -1
- package/dist/core/selection/useSelection.js +90 -57
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js +57 -28
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stableStringify.js +5 -4
- package/dist/core/stableStringify.js.map +1 -1
- package/dist/core/stylus/stylus.js +49 -25
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js +61 -34
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +21 -11
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clampView.js +31 -15
- package/dist/core/viewport/clampView.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js +15 -4
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/createVelocityTracker.js +23 -19
- package/dist/core/viewport/createVelocityTracker.js.map +1 -1
- package/dist/core/viewport/fitToBounds.js +28 -11
- package/dist/core/viewport/fitToBounds.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js +45 -19
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/interpolateView.js +40 -20
- package/dist/core/viewport/interpolateView.js.map +1 -1
- package/dist/core/viewport/parallax.js +89 -56
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/sceneNodeClientRect.js +21 -12
- package/dist/core/viewport/sceneNodeClientRect.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +40 -17
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useAutoCenter.js +36 -22
- package/dist/core/viewport/useAutoCenter.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js +43 -22
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +120 -48
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +93 -58
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -1
- package/dist/core/viewport/useVelocityTracker.js +9 -6
- package/dist/core/viewport/useVelocityTracker.js.map +1 -1
- package/dist/core/viewport/useViewAnimation.js +143 -84
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +48 -24
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/viewTransform.js +8 -6
- package/dist/core/viewport/viewTransform.js.map +1 -1
- package/dist/core/viewport/viewportWorldRect.js +15 -7
- package/dist/core/viewport/viewportWorldRect.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js +31 -20
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/core/viewport/zoomAt.js +47 -19
- package/dist/core/viewport/zoomAt.js.map +1 -1
- package/dist/core/viewport/zoomBounds.js +33 -17
- package/dist/core/viewport/zoomBounds.js.map +1 -1
- package/dist/cornerHandles-BHuoMs1o.d.ts +169 -0
- package/dist/debug/createDebugOverlayLayer.js +251 -258
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js +69 -47
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/defaultTheme.js +20 -6
- package/dist/debug/defaultTheme.js.map +1 -1
- package/dist/debug/features.js +17 -0
- package/dist/debug/features.js.map +1 -0
- package/dist/debug/flag.js +3 -2
- package/dist/debug/frameStats.js +11 -9
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/overlayPanels.js +117 -0
- package/dist/debug/overlayPanels.js.map +1 -0
- package/dist/debug/parseDebugFlags.js +26 -27
- package/dist/debug/parseDebugFlags.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -33
- package/dist/debug/useDebugSink.js.map +1 -1
- package/dist/depSchema-BpZNOv7q.d.ts +2803 -0
- package/dist/devtools/handlers.js +112 -0
- package/dist/devtools/handlers.js.map +1 -0
- package/dist/devtools/history.js +71 -0
- package/dist/devtools/history.js.map +1 -0
- package/dist/devtools/hook.js +74 -0
- package/dist/devtools/hook.js.map +1 -0
- package/dist/devtools/label.js +25 -0
- package/dist/devtools/label.js.map +1 -0
- package/dist/devtools/notices.js +58 -0
- package/dist/devtools/notices.js.map +1 -0
- package/dist/devtools/protocol.js +7 -0
- package/dist/devtools/protocol.js.map +1 -0
- package/dist/devtools/registry.js +90 -0
- package/dist/devtools/registry.js.map +1 -0
- package/dist/devtools/root.js +80 -0
- package/dist/devtools/root.js.map +1 -0
- package/dist/devtools/serialize.js +86 -0
- package/dist/devtools/serialize.js.map +1 -0
- package/dist/devtools/session.js +111 -0
- package/dist/devtools/session.js.map +1 -0
- package/dist/devtools/transport.js +67 -0
- package/dist/devtools/transport.js.map +1 -0
- package/dist/devtools/useDevtoolsRoot.js +81 -0
- package/dist/devtools/useDevtoolsRoot.js.map +1 -0
- package/dist/devtools-protocol.d.ts +435 -0
- package/dist/devtools-protocol.js +7 -0
- package/dist/devtools.d.ts +8 -0
- package/dist/devtools.js +12 -0
- package/dist/devtools.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js +12 -10
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js +103 -25
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js +18 -10
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/index.js +8 -7
- package/dist/features/chrome-caps/resolve.js +28 -16
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +52 -44
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -1
- package/dist/features/chrome-caps/useHoverTracking.js +58 -26
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +105 -36
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +49 -29
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js +27 -9
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +20 -11
- package/dist/features/ingestion/placement.js.map +1 -1
- package/dist/features/ingestion/registerKitHandlers.js +35 -18
- package/dist/features/ingestion/registerKitHandlers.js.map +1 -1
- package/dist/features/ingestion/svgHandler.js +60 -34
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +37 -16
- package/dist/features/ingestion/textHandler.js.map +1 -1
- package/dist/features/ingestion/useCanvasIngestion.js +57 -39
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -1
- package/dist/features/ingestion/weaselJsonHandler.js +38 -28
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js +110 -81
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/measure/actionIds.js +22 -0
- package/dist/features/measure/actionIds.js.map +1 -0
- package/dist/features/measure/measureCommands.js +180 -0
- package/dist/features/measure/measureCommands.js.map +1 -0
- package/dist/features/measure/measureContribution.js +57 -0
- package/dist/features/measure/measureContribution.js.map +1 -0
- package/dist/features/measure/measureEdits.js +82 -0
- package/dist/features/measure/measureEdits.js.map +1 -0
- package/dist/features/measure/measureGestures.js +185 -0
- package/dist/features/measure/measureGestures.js.map +1 -0
- package/dist/features/measure/measureHit.js +80 -0
- package/dist/features/measure/measureHit.js.map +1 -0
- package/dist/features/measure/measureLayer.js +86 -0
- package/dist/features/measure/measureLayer.js.map +1 -0
- package/dist/features/measure/measurement.js +79 -0
- package/dist/features/measure/measurement.js.map +1 -0
- package/dist/features/measure/measurements.js +41 -0
- package/dist/features/measure/measurements.js.map +1 -0
- package/dist/features/modes/modeLayers.js +81 -55
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/modes/modeTriggers.js +66 -0
- package/dist/features/modes/modeTriggers.js.map +1 -0
- package/dist/features/pathEffects/index.js +35 -0
- package/dist/features/pathEffects/index.js.map +1 -0
- package/dist/features/pathEffects/readSource.js +46 -0
- package/dist/features/pathEffects/readSource.js.map +1 -0
- package/dist/features/paths/anchorData.js +65 -0
- package/dist/features/paths/anchorData.js.map +1 -0
- package/dist/features/paths/anchorMarkers.js +137 -0
- package/dist/features/paths/anchorMarkers.js.map +1 -0
- package/dist/features/paths/editablePath.js +149 -46
- package/dist/features/paths/editablePath.js.map +1 -1
- package/dist/features/paths/index.js +12 -9
- package/dist/features/paths/originProjection.js +16 -9
- package/dist/features/paths/originProjection.js.map +1 -1
- package/dist/features/paths/pathEditExtension.js +26 -0
- package/dist/features/paths/pathEditExtension.js.map +1 -0
- package/dist/features/paths/pathEditState.js +107 -26
- package/dist/features/paths/pathEditState.js.map +1 -1
- package/dist/features/paths/pathEditingOverlayLayer.js +58 -110
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +79 -29
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/pathRepresentation.js +27 -0
- package/dist/features/paths/pathRepresentation.js.map +1 -0
- package/dist/features/paths/pathSnap/glyphs.js +39 -0
- package/dist/features/paths/pathSnap/glyphs.js.map +1 -0
- package/dist/features/paths/pathSnap/pathSnapSource.js +82 -0
- package/dist/features/paths/pathSnap/pathSnapSource.js.map +1 -0
- package/dist/features/paths/pathSnap/sceneIndex.js +85 -0
- package/dist/features/paths/pathSnap/sceneIndex.js.map +1 -0
- package/dist/features/paths/pathSnap/snapGeometry.js +47 -0
- package/dist/features/paths/pathSnap/snapGeometry.js.map +1 -0
- package/dist/features/paths/penPreviewLayer.js +135 -102
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/shapeGenerator.js +112 -60
- package/dist/features/paths/shapeGenerator.js.map +1 -1
- package/dist/features/paths/strokeOutline.js +15 -0
- package/dist/features/paths/strokeOutline.js.map +1 -0
- package/dist/features/paths/useAnchorFields.js +35 -0
- package/dist/features/paths/useAnchorFields.js.map +1 -0
- package/dist/features/paths/usePathEdit.js +58 -28
- package/dist/features/paths/usePathEdit.js.map +1 -1
- package/dist/features/poseRun/usePoseRun.js +110 -43
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/handleCommands.js +116 -0
- package/dist/features/selection/handleCommands.js.map +1 -0
- package/dist/features/selection/overlay.js +288 -328
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/selection/selectionPose.js +112 -0
- package/dist/features/selection/selectionPose.js.map +1 -0
- package/dist/features/snap/angle2d.js +158 -0
- package/dist/features/snap/angle2d.js.map +1 -0
- package/dist/features/snap/debugCandidates.js +27 -0
- package/dist/features/snap/debugCandidates.js.map +1 -0
- package/dist/features/snap/gather.js +79 -0
- package/dist/features/snap/gather.js.map +1 -0
- package/dist/features/snap/inputSubspace.js +46 -0
- package/dist/features/snap/inputSubspace.js.map +1 -0
- package/dist/features/snap/lazySession.js +17 -0
- package/dist/features/snap/lazySession.js.map +1 -0
- package/dist/features/snap/marks.js +29 -0
- package/dist/features/snap/marks.js.map +1 -0
- package/dist/features/snap/outcomeStore.js +25 -0
- package/dist/features/snap/outcomeStore.js.map +1 -0
- package/dist/features/snap/pointSnap.js +48 -0
- package/dist/features/snap/pointSnap.js.map +1 -0
- package/dist/features/snap/probes2d.js +99 -0
- package/dist/features/snap/probes2d.js.map +1 -0
- package/dist/features/snap/readoutDraw.js +93 -0
- package/dist/features/snap/readoutDraw.js.map +1 -0
- package/dist/features/snap/readoutLayer.js +49 -0
- package/dist/features/snap/readoutLayer.js.map +1 -0
- package/dist/features/snap/registry.js +27 -0
- package/dist/features/snap/registry.js.map +1 -0
- package/dist/features/snap/resizeBox.js +137 -0
- package/dist/features/snap/resizeBox.js.map +1 -0
- package/dist/features/snap/roles.js +32 -0
- package/dist/features/snap/roles.js.map +1 -0
- package/dist/features/snap/rotationSource.js +47 -0
- package/dist/features/snap/rotationSource.js.map +1 -0
- package/dist/features/snap/sceneReads.js +45 -0
- package/dist/features/snap/sceneReads.js.map +1 -0
- package/dist/features/snap/sceneSession2d.js +81 -0
- package/dist/features/snap/sceneSession2d.js.map +1 -0
- package/dist/features/snap/screen.js +23 -0
- package/dist/features/snap/screen.js.map +1 -0
- package/dist/features/snap/session2d.js +143 -0
- package/dist/features/snap/session2d.js.map +1 -0
- package/dist/features/snap/spanSnap.js +80 -0
- package/dist/features/snap/spanSnap.js.map +1 -0
- package/dist/features/snap/stepAngles.js +15 -0
- package/dist/features/snap/stepAngles.js.map +1 -0
- package/dist/features/text/editingDrawOne.js +32 -0
- package/dist/features/text/editingDrawOne.js.map +1 -0
- package/dist/features/text/index.js +7 -6
- package/dist/features/text/textHitAt.js +51 -0
- package/dist/features/text/textHitAt.js.map +1 -0
- package/dist/features/text/textLayer.js +21 -27
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +190 -128
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewResolver.js +48 -39
- package/dist/features/viewports/viewResolver.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +60 -29
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/iconRegistry/IconRegistryProvider.js +73 -0
- package/dist/iconRegistry/IconRegistryProvider.js.map +1 -0
- package/dist/iconRegistry/useIconGlyph.js +14 -0
- package/dist/iconRegistry/useIconGlyph.js.map +1 -0
- package/dist/iconRegistry/useIconVariant.js +29 -0
- package/dist/iconRegistry/useIconVariant.js.map +1 -0
- package/dist/icons.d.ts +6 -0
- package/dist/icons.js +3 -0
- package/dist/icons.table.js +13 -0
- package/dist/icons.table.js.map +1 -0
- package/dist/icons.table.json +546 -0
- package/dist/icons2.table.js +9 -0
- package/dist/icons2.table.js.map +1 -0
- package/dist/index.d.ts +4856 -5666
- package/dist/index.js +346 -285
- package/dist/input/keyState.js +118 -54
- package/dist/input/keyState.js.map +1 -1
- package/dist/input/useKeyModifiers.js +13 -7
- package/dist/input/useKeyModifiers.js.map +1 -1
- package/dist/input/useKeyState.js +23 -16
- package/dist/input/useKeyState.js.map +1 -1
- package/dist/interactions/actions/align/action.js +78 -45
- package/dist/interactions/actions/align/action.js.map +1 -1
- package/dist/interactions/actions/align/align.js +86 -48
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +73 -33
- package/dist/interactions/actions/booleans/action.js.map +1 -1
- package/dist/interactions/actions/booleans/booleans.js +77 -70
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/commit.js +49 -0
- package/dist/interactions/actions/booleans/commit.js.map +1 -0
- package/dist/interactions/actions/booleans/custom.js +48 -0
- package/dist/interactions/actions/booleans/custom.js.map +1 -0
- package/dist/interactions/actions/booleans/operands.js +43 -32
- package/dist/interactions/actions/booleans/operands.js.map +1 -1
- package/dist/interactions/actions/booleans/pieces.js +29 -23
- package/dist/interactions/actions/booleans/pieces.js.map +1 -1
- package/dist/interactions/actions/booleans/placement.js +30 -17
- package/dist/interactions/actions/booleans/placement.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleans.js +30 -17
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js +8 -5
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/clipboard/action.js +81 -40
- package/dist/interactions/actions/clipboard/action.js.map +1 -1
- package/dist/interactions/actions/clipboard/clipboardOps.js +100 -72
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/materializePaste.js +38 -19
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js +66 -28
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +102 -70
- package/dist/interactions/actions/clone/action.js.map +1 -1
- package/dist/interactions/actions/clone/behaviors.js +55 -38
- package/dist/interactions/actions/clone/behaviors.js.map +1 -1
- package/dist/interactions/actions/defaultCommitAdapter.js +32 -10
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +252 -111
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorFields.js +54 -0
- package/dist/interactions/actions/defaults/anchorFields.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorHandles.js +31 -27
- package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorJoin.js +55 -37
- package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js +56 -40
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/bendSegment.js +67 -31
- package/dist/interactions/actions/defaults/bendSegment.js.map +1 -1
- package/dist/interactions/actions/defaults/cancelGesture.js +12 -5
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js +22 -7
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/contextMenu.js +149 -0
- package/dist/interactions/actions/defaults/contextMenu.js.map +1 -0
- package/dist/interactions/actions/defaults/copySubtree.js +43 -29
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js +79 -54
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js +92 -55
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +60 -32
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js +22 -18
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js +20 -8
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/escape.js +16 -7
- package/dist/interactions/actions/defaults/escape.js.map +1 -1
- package/dist/interactions/actions/defaults/exitPathEdit.js +6 -6
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +122 -73
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +58 -39
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +43 -22
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +57 -55
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/nudgeSteps.js +17 -12
- package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -1
- package/dist/interactions/actions/defaults/pathEditMarks.js +60 -0
- package/dist/interactions/actions/defaults/pathEditMarks.js.map +1 -0
- package/dist/interactions/actions/defaults/pathEditTools.js +57 -0
- package/dist/interactions/actions/defaults/pathEditTools.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js +55 -39
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/reorder.js +71 -40
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js +13 -6
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/segmentUnder.js +24 -16
- package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -1
- package/dist/interactions/actions/defaults/selectAll.js +21 -7
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +37 -21
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +19 -10
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js +46 -25
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +19 -11
- package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/slice.js +42 -17
- package/dist/interactions/actions/defaults/slice.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +63 -42
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js +34 -16
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js +29 -10
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/undoRedo.js +26 -20
- package/dist/interactions/actions/defaults/undoRedo.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +91 -58
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js +42 -23
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js +107 -59
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/distribute/action.js +64 -39
- package/dist/interactions/actions/distribute/action.js.map +1 -1
- package/dist/interactions/actions/distribute/distribute.js +53 -34
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/distribute/plan.js +40 -22
- package/dist/interactions/actions/distribute/plan.js.map +1 -1
- package/dist/interactions/actions/drawnBoxes.js +32 -0
- package/dist/interactions/actions/drawnBoxes.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/action.js +245 -72
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/extensionDrags.js +50 -0
- package/dist/interactions/actions/edit-anchors/extensionDrags.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +74 -47
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/handleDrag.js +101 -0
- package/dist/interactions/actions/edit-anchors/handleDrag.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/handles.js +41 -27
- package/dist/interactions/actions/edit-anchors/handles.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/params.js +12 -0
- package/dist/interactions/actions/edit-anchors/params.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/preview.js +93 -18
- package/dist/interactions/actions/edit-anchors/preview.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/symmetry.js +12 -7
- package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +121 -61
- package/dist/interactions/actions/flip/action.js.map +1 -1
- package/dist/interactions/actions/flip/helpers.js +69 -36
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/geometryProjection.js +17 -12
- package/dist/interactions/actions/geometryProjection.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +20 -11
- package/dist/interactions/actions/gestureFrames.js.map +1 -1
- package/dist/interactions/actions/gestureLifecycle.js +96 -48
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/hitSelection.js +6 -4
- package/dist/interactions/actions/hitSelection.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +70 -42
- package/dist/interactions/actions/insert/action.js.map +1 -1
- package/dist/interactions/actions/insert/commit.js +44 -22
- package/dist/interactions/actions/insert/commit.js.map +1 -1
- package/dist/interactions/actions/insert/extras.js +60 -38
- package/dist/interactions/actions/insert/extras.js.map +1 -1
- package/dist/interactions/actions/insert/frame.js +58 -39
- package/dist/interactions/actions/insert/frame.js.map +1 -1
- package/dist/interactions/actions/insert/geometry.js +29 -25
- package/dist/interactions/actions/insert/geometry.js.map +1 -1
- package/dist/interactions/actions/insert/parent.js +11 -0
- package/dist/interactions/actions/insert/parent.js.map +1 -0
- package/dist/interactions/actions/insert/placeAction.js +113 -0
- package/dist/interactions/actions/insert/placeAction.js.map +1 -0
- package/dist/interactions/actions/insert/repositionAction.js +26 -11
- package/dist/interactions/actions/insert/repositionAction.js.map +1 -1
- package/dist/interactions/actions/insert/rotateAction.js +19 -8
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -1
- package/dist/interactions/actions/insert/session.js +61 -41
- package/dist/interactions/actions/insert/session.js.map +1 -1
- package/dist/interactions/actions/insert/shape.js +83 -25
- package/dist/interactions/actions/insert/shape.js.map +1 -1
- package/dist/interactions/actions/lasso-select/action.js +160 -100
- package/dist/interactions/actions/lasso-select/action.js.map +1 -1
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +44 -25
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
- package/dist/interactions/actions/move/action.js +91 -52
- package/dist/interactions/actions/move/action.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +55 -36
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +20 -10
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +40 -24
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +102 -64
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +103 -78
- package/dist/interactions/actions/move/capture.js.map +1 -1
- package/dist/interactions/actions/move/commit/index.js +41 -34
- package/dist/interactions/actions/move/commit/index.js.map +1 -1
- package/dist/interactions/actions/move/commit/layoutDrop.js +43 -32
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -1
- package/dist/interactions/actions/move/commit/layoutRelease.js +97 -77
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -1
- package/dist/interactions/actions/move/commit/rebase.js +16 -13
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -1
- package/dist/interactions/actions/move/commit/reparent.js +89 -57
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -1
- package/dist/interactions/actions/move/delta.js +58 -36
- package/dist/interactions/actions/move/delta.js.map +1 -1
- package/dist/interactions/actions/move/frame.js +66 -35
- package/dist/interactions/actions/move/frame.js.map +1 -1
- package/dist/interactions/actions/move/gestureAdapter.js +30 -20
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +43 -25
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -1
- package/dist/interactions/actions/move/layout/container.js +93 -72
- package/dist/interactions/actions/move/layout/container.js.map +1 -1
- package/dist/interactions/actions/move/layout/dragged.js +61 -39
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -1
- package/dist/interactions/actions/move/layout/dropPass.js +153 -94
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -1
- package/dist/interactions/actions/move/layout/exits.js +58 -30
- package/dist/interactions/actions/move/layout/exits.js.map +1 -1
- package/dist/interactions/actions/move/layout/glide.js +55 -34
- package/dist/interactions/actions/move/layout/glide.js.map +1 -1
- package/dist/interactions/actions/move/session.js +96 -56
- package/dist/interactions/actions/move/session.js.map +1 -1
- package/dist/interactions/actions/move/translate.js +37 -51
- package/dist/interactions/actions/move/translate.js.map +1 -1
- package/dist/interactions/actions/moveNodes.js +87 -0
- package/dist/interactions/actions/moveNodes.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +28 -20
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +43 -31
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -1
- package/dist/interactions/actions/outlines/outlineStroke.js +68 -45
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -1
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +24 -19
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -1
- package/dist/interactions/actions/outlines/replaceWithPaths.js +57 -42
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -1
- package/dist/interactions/actions/outlines/strokeRegion.js +37 -22
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -1
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +8 -5
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -1
- package/dist/interactions/actions/pathCommands/cutJoin.js +119 -72
- package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -1
- package/dist/interactions/actions/pathCommands/livePathEdit.js +74 -40
- package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -1
- package/dist/interactions/actions/pathCommands/pathNodes.js +91 -82
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -1
- package/dist/interactions/actions/pathCommands/simplifyOffset.js +52 -28
- package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -1
- package/dist/interactions/actions/pathGestureTags.js +29 -0
- package/dist/interactions/actions/pathGestureTags.js.map +1 -0
- package/dist/interactions/actions/planeInput.js +198 -123
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -7
- package/dist/interactions/actions/pointerState.js.map +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js +24 -14
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +45 -28
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +103 -63
- package/dist/interactions/actions/resize/action.js.map +1 -1
- package/dist/interactions/actions/resize/aspect.js +44 -0
- package/dist/interactions/actions/resize/aspect.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js +38 -13
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +15 -11
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -1
- package/dist/interactions/actions/resize/capture.js +105 -62
- package/dist/interactions/actions/resize/capture.js.map +1 -1
- package/dist/interactions/actions/resize/commit.js +76 -56
- package/dist/interactions/actions/resize/commit.js.map +1 -1
- package/dist/interactions/actions/resize/cornerHandles.js +154 -17
- package/dist/interactions/actions/resize/cornerHandles.js.map +1 -1
- package/dist/interactions/actions/resize/frame.js +133 -66
- package/dist/interactions/actions/resize/frame.js.map +1 -1
- package/dist/interactions/actions/resize/minimum.js +35 -0
- package/dist/interactions/actions/resize/minimum.js.map +1 -0
- package/dist/interactions/actions/resize/replay.js +40 -30
- package/dist/interactions/actions/resize/replay.js.map +1 -1
- package/dist/interactions/actions/resize/ruleBounds.js +8 -5
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -1
- package/dist/interactions/actions/resize/session.js +97 -50
- package/dist/interactions/actions/resize/session.js.map +1 -1
- package/dist/interactions/actions/resolveOverlays.js +48 -33
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js +63 -46
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +71 -42
- package/dist/interactions/actions/rotate/action.js.map +1 -1
- package/dist/interactions/actions/rotate/commit.js +40 -31
- package/dist/interactions/actions/rotate/commit.js.map +1 -1
- package/dist/interactions/actions/rotate/frame.js +75 -47
- package/dist/interactions/actions/rotate/frame.js.map +1 -1
- package/dist/interactions/actions/rotate/geometry.js +36 -24
- package/dist/interactions/actions/rotate/geometry.js.map +1 -1
- package/dist/interactions/actions/rotate/handle.js +28 -15
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/replay.js +22 -18
- package/dist/interactions/actions/rotate/replay.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +117 -76
- package/dist/interactions/actions/rotate/session.js.map +1 -1
- package/dist/interactions/actions/selectionSubtree.js +135 -53
- package/dist/interactions/actions/selectionSubtree.js.map +1 -1
- package/dist/interactions/actions/spatialReference.js +33 -26
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/testUtils.js +53 -0
- package/dist/interactions/actions/testUtils.js.map +1 -0
- package/dist/interactions/actions/transform-again/action.js +49 -35
- package/dist/interactions/actions/transform-again/action.js.map +1 -1
- package/dist/interactions/actions/transform-again/memory.js +32 -21
- package/dist/interactions/actions/transform-again/memory.js.map +1 -1
- package/dist/interactions/actions/transformFinish.js +106 -0
- package/dist/interactions/actions/transformFinish.js.map +1 -0
- package/dist/interactions/actions/useActionSet.js +83 -0
- package/dist/interactions/actions/useActionSet.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +23 -165
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragGesture.js +109 -68
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragPointOf.js +17 -10
- package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -1
- package/dist/interactions/gestures/dragRadial/dragRadial.js +129 -93
- package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -1
- package/dist/interactions/gestures/dragRect/dragRect.js +155 -111
- package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -1
- package/dist/interactions/gestures/handleDrag/handleDrag.js +52 -30
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +168 -97
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +32 -25
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +26 -17
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +39 -21
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/kitSettingsSchema.js +76 -0
- package/dist/kitSettingsSchema.js.map +1 -0
- package/dist/{math-CYUjoyyU.d.ts → math-CrJULaZI.d.ts} +5 -6
- package/dist/math.d.ts +4 -5
- package/dist/math.js +7 -6
- package/dist/mesh.js +3 -2
- package/dist/move.d.ts +9 -7
- package/dist/move.js +4 -3
- package/dist/{originProjection-CoNVpITV.d.ts → options-DBxEryYq.d.ts} +4 -27
- package/dist/originProjection-gY0jb4Wb.d.ts +24 -0
- package/dist/patterns-builtin.js +3 -2
- package/dist/{poseDescriptor-Bqk-11Rl.d.ts → poseDescriptor-DN2yfnq_.d.ts} +7 -7
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +3 -2
- package/dist/resize.d.ts +11 -28
- package/dist/resize.js +6 -7
- package/dist/routing.d.ts +1 -1
- package/dist/routing.js +3 -2
- package/dist/style.css +88 -1
- package/dist/test-hook/createTestHook.js +23 -20
- package/dist/test-hook/createTestHook.js.map +1 -1
- package/dist/test-hook/install.js +32 -13
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +23 -16
- package/dist/test-hook/useTestHook.js.map +1 -1
- package/dist/test-seams.d.ts +168 -1
- package/dist/test-seams.js +8 -3
- package/dist/tools/builtin/ellipse/useEllipseTool.js +22 -17
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js +44 -28
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/dragPanContribution.js +12 -7
- package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js +21 -13
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js +28 -19
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js +48 -36
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +24 -17
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/measure/useMeasureTool.js +84 -0
- package/dist/tools/builtin/measure/useMeasureTool.js.map +1 -0
- package/dist/tools/builtin/pen/penHandle.js +58 -0
- package/dist/tools/builtin/pen/penHandle.js.map +1 -0
- package/dist/tools/builtin/pen/usePenTool.js +461 -303
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js +20 -15
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js +51 -31
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +45 -28
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +24 -16
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +47 -30
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +94 -56
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +155 -108
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/insertToolOptions.js +5 -4
- package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js +15 -8
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +148 -101
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +48 -31
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/sticky/stickyNode.js +49 -0
- package/dist/tools/builtin/sticky/stickyNode.js.map +1 -0
- package/dist/tools/builtin/sticky/useStickyTool.js +86 -0
- package/dist/tools/builtin/sticky/useStickyTool.js.map +1 -0
- package/dist/tools/builtin/text/useTextTool.js +59 -34
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/index.js +26 -0
- package/dist/tools/overlayBinding.js +7 -5
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +62 -46
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-DBbbCy0i.d.ts → types-7puAuVD2.d.ts} +5 -264
- package/dist/types-BN9hbdMI.d.ts +184 -0
- package/dist/types-CniVctmk.d.ts +949 -0
- package/dist/types-oFeQ5VjV.d.ts +264 -0
- package/dist/util/color.js +39 -18
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js +93 -38
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +11 -3
- package/dist/version.js.map +1 -1
- package/package.json +46 -24
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +0 -126
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +0 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +0 -55
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +0 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +0 -16
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +0 -1
- package/dist/canvas/SceneCanvas/isDev.js +0 -12
- package/dist/canvas/SceneCanvas/isDev.js.map +0 -1
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +0 -20
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +0 -1
- package/dist/cornerHandles-BSKbyuvQ.d.ts +0 -104
- package/dist/icons/ArrowIcon.js +0 -23
- package/dist/icons/ArrowIcon.js.map +0 -1
- package/dist/icons/EllipseIcon.js +0 -21
- package/dist/icons/EllipseIcon.js.map +0 -1
- package/dist/icons/EyedropperIcon.js +0 -49
- package/dist/icons/EyedropperIcon.js.map +0 -1
- package/dist/icons/HandIcon.js +0 -59
- package/dist/icons/HandIcon.js.map +0 -1
- package/dist/icons/ImageIcon.js +0 -34
- package/dist/icons/ImageIcon.js.map +0 -1
- package/dist/icons/LassoIcon.js +0 -22
- package/dist/icons/LassoIcon.js.map +0 -1
- package/dist/icons/LineIcon.js +0 -22
- package/dist/icons/LineIcon.js.map +0 -1
- package/dist/icons/PenIcon.js +0 -36
- package/dist/icons/PenIcon.js.map +0 -1
- package/dist/icons/PencilIcon.js +0 -25
- package/dist/icons/PencilIcon.js.map +0 -1
- package/dist/icons/PolygonIcon.js +0 -19
- package/dist/icons/PolygonIcon.js.map +0 -1
- package/dist/icons/RectIcon.js +0 -37
- package/dist/icons/RectIcon.js.map +0 -1
- package/dist/icons/SelectIcon.js +0 -20
- package/dist/icons/SelectIcon.js.map +0 -1
- package/dist/icons/SliceIcon.js +0 -24
- package/dist/icons/SliceIcon.js.map +0 -1
- package/dist/icons/StarIcon.js +0 -19
- package/dist/icons/StarIcon.js.map +0 -1
- package/dist/icons/TextIcon.js +0 -19
- package/dist/icons/TextIcon.js.map +0 -1
- package/dist/icons/UnknownIcon.js +0 -33
- package/dist/icons/UnknownIcon.js.map +0 -1
- package/dist/icons/_base.js +0 -12
- package/dist/icons/_base.js.map +0 -1
- package/dist/interactions/actions/actionShortcuts.js +0 -32
- package/dist/interactions/actions/actionShortcuts.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +0 -40
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js +0 -10
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/alignIcons.js +0 -173
- package/dist/interactions/actions/defaults/icons/alignIcons.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/anchorIcons.js +0 -75
- package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +0 -194
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/distributeIcons.js +0 -63
- package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/editIcons.js +0 -307
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +0 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +0 -91
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +0 -1
- package/dist/interactions/actions/resize/behaviors/index.js +0 -8
- package/dist/interactions/actions/resize/behaviors/index.js.map +0 -1
- package/dist/interactions/actions/resize/behaviors/lockAspect.js +0 -24
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +0 -1
- package/dist/interactions/actions/resize/pointSnap.js +0 -111
- package/dist/interactions/actions/resize/pointSnap.js.map +0 -1
- package/dist/interactions/actions/rotate/behaviors/index.js +0 -7
- package/dist/interactions/actions/rotate/behaviors/index.js.map +0 -1
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +0 -12
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +0 -1
- package/dist/interactions/gestures/shared/snap.js +0 -24
- package/dist/interactions/gestures/shared/snap.js.map +0 -1
- package/dist/test-seams-D0pyV3pR.d.ts +0 -149
- package/dist/tools/builtin/bone/boneActions.js +0 -130
- package/dist/tools/builtin/bone/boneActions.js.map +0 -1
- package/dist/tools/builtin/bone/boneOverlay.js +0 -58
- package/dist/tools/builtin/bone/boneOverlay.js.map +0 -1
- package/dist/tools/builtin/bone/placedRig.js +0 -24
- package/dist/tools/builtin/bone/placedRig.js.map +0 -1
- package/dist/tools/builtin/bone/rigEditState.js +0 -21
- package/dist/tools/builtin/bone/rigEditState.js.map +0 -1
- package/dist/tools/builtin/bone/useBoneTool.js +0 -98
- package/dist/tools/builtin/bone/useBoneTool.js.map +0 -1
- package/dist/tools/builtin/weight/useWeightTool.js +0 -77
- package/dist/tools/builtin/weight/useWeightTool.js.map +0 -1
- package/dist/tools/builtin/weight/weightActions.js +0 -112
- package/dist/tools/builtin/weight/weightActions.js.map +0 -1
- package/dist/tools/builtin/weight/weightOverlay.js +0 -61
- package/dist/tools/builtin/weight/weightOverlay.js.map +0 -1
- package/dist/util/constrainTo45.js +0 -17
- package/dist/util/constrainTo45.js.map +0 -1
|
@@ -0,0 +1,2803 @@
|
|
|
1
|
+
import { TileKind, Paint, GradStop, TilePaint, Fill, Stroke, CommandFill, CommandStroke, CommandPaint } from '@weasel-js/paint';
|
|
2
|
+
import { Reflection } from '@weasel-js/registry';
|
|
3
|
+
import { ComponentType } from 'react';
|
|
4
|
+
import { IconRef } from '@weasel-js/icons';
|
|
5
|
+
import { PaintDrawKind, DrawCommand, Effect, CompositeOp, BlendFactors } from '@weasel-js/renderer';
|
|
6
|
+
import * as _weasel_js_routing_react from '@weasel-js/routing/react';
|
|
7
|
+
import * as _weasel_js_geom from '@weasel-js/geom';
|
|
8
|
+
import { FramedBox, View, Path, Affine, Rect, Scale2, PolygonPath, PathFillRule, AnchorSet, PointOrigin } from '@weasel-js/geom';
|
|
9
|
+
import { Op, History } from '@weasel-js/history';
|
|
10
|
+
import { NodeId, ModifierState, OverlayRole, ResizeAnchor, ActionDeps, OngoingHandle, OngoingOverlay, SelectionApi, IngestItem, Point2, DragSample, DebugSink, LongPressState } from '@weasel-js/routing';
|
|
11
|
+
import { TextNodeSource, TextOutlinesError, TextStyle, StyledRun, TextVerticalAlign } from '@weasel-js/text';
|
|
12
|
+
import { CursorSpec } from '@weasel-js/cursor';
|
|
13
|
+
import { ClaimableGesture } from '@weasel-js/gestures';
|
|
14
|
+
import { SnapTier, ProbeRole } from '@weasel-js/geom/nd';
|
|
15
|
+
import { S as Scene, R as RectPose } from './types-CniVctmk.js';
|
|
16
|
+
import { a as PlaneMap, L as LayoutStrategy, b as LayoutDropTargetMode, R as ReflowTransition } from './types-7puAuVD2.js';
|
|
17
|
+
import { O as OriginProjection } from './originProjection-gY0jb4Wb.js';
|
|
18
|
+
import { EasingSpec, InterpolatorFactory, Target, Animator, TargetAxes } from '@weasel-js/animator';
|
|
19
|
+
import { I as InsertAdapter, P as PasteOmission, R as RegionPickView } from './types-oFeQ5VjV.js';
|
|
20
|
+
import { B as BoundsConstraint } from './clone-C3e0OTuF.js';
|
|
21
|
+
import { P as PoseDescriptor } from './poseDescriptor-DN2yfnq_.js';
|
|
22
|
+
|
|
23
|
+
/** Pixel dimensions of the canvas viewport. */
|
|
24
|
+
interface ViewportDims {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}
|
|
28
|
+
/** Options for {@link fitViewToBounds}. */
|
|
29
|
+
interface FitViewToBoundsOptions {
|
|
30
|
+
/** Inset (in CSS px) around the bounds. Default 16. */
|
|
31
|
+
padding?: number;
|
|
32
|
+
/** Defaults to the kit-wide max zoom (`DEFAULT_MAX_ZOOM`). */
|
|
33
|
+
maxScale?: number;
|
|
34
|
+
/** Defaults to the kit-wide min zoom (`DEFAULT_MIN_ZOOM`). */
|
|
35
|
+
minScale?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Fit mode:
|
|
38
|
+
* - `'contain'` (default): uniform scale = `min(availW/w, availH/h)`. Bounds fit entirely; one axis has letterboxing.
|
|
39
|
+
* - `'fill'`: uniform scale = `max(...)`. Bounds overflow viewport on one axis.
|
|
40
|
+
* - `'stretch'`: per-axis scale. Bounds match viewport exactly; scale is non-uniform.
|
|
41
|
+
*/
|
|
42
|
+
mode?: 'contain' | 'fill' | 'stretch';
|
|
43
|
+
/**
|
|
44
|
+
* Where bounds that overflow the viewport on an axis sit, which happens when
|
|
45
|
+
* `minScale` stops the fit or `mode` is `'fill'`. `'center'` (default) shows
|
|
46
|
+
* their middle; `'start'` shows their left or top edge, inset by `padding`.
|
|
47
|
+
* An axis that fits is centered either way.
|
|
48
|
+
*/
|
|
49
|
+
anchor?: 'center' | 'start';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Compute the target {@link View} that fits `bounds` (world space) inside
|
|
53
|
+
* `viewportDims` (CSS px). The bounds are centered in the viewport with
|
|
54
|
+
* uniform padding on all sides; the resulting scale is clamped to the
|
|
55
|
+
* configured min/max.
|
|
56
|
+
*
|
|
57
|
+
* Empty / zero-sized bounds or viewports cannot be fit — in that case this
|
|
58
|
+
* returns `currentView` unchanged and logs a `console.warn`.
|
|
59
|
+
*/
|
|
60
|
+
declare function fitViewToBounds(bounds: FramedBox, viewportDims: ViewportDims, currentView: View, opts?: FitViewToBoundsOptions): View;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* `Paint`'s discriminant, open on the string the way `ChromeId` is: the
|
|
64
|
+
* kinds the kit ships, plus whatever a consumer registers.
|
|
65
|
+
*/
|
|
66
|
+
type PaintKind = 'solid' | 'linear-gradient' | 'radial-gradient' | 'conic-gradient' | TileKind | 'texture' | (string & {});
|
|
67
|
+
/**
|
|
68
|
+
* A set of kinds an editor offers as one choice. Kinds sharing a family show
|
|
69
|
+
* as a single segment in a kind bar, named by the family, and the member is
|
|
70
|
+
* picked inside that segment's body. The built-in tiles and `texture` are the
|
|
71
|
+
* `patternFamily`.
|
|
72
|
+
*/
|
|
73
|
+
interface PaintKindFamily {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
/** Glyph for the family's segment. */
|
|
77
|
+
icon?: IconRef;
|
|
78
|
+
}
|
|
79
|
+
/** What a registered kind's editor renders. `PaintInput` in `@weasel-js/ui`
|
|
80
|
+
* is the control that mounts it. */
|
|
81
|
+
interface PaintKindEditorProps {
|
|
82
|
+
value: Paint;
|
|
83
|
+
onInput?(next: Paint): void;
|
|
84
|
+
onChange(next: Paint): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* One paint kind: the renderer's draw slots, plus what an editor and a
|
|
88
|
+
* serializer read.
|
|
89
|
+
*
|
|
90
|
+
* `seed`, `label` and `colorOf` are the editor's slots and every kind has
|
|
91
|
+
* them. The rest are optional because a kind may not need them.
|
|
92
|
+
*/
|
|
93
|
+
interface PaintKindEntry extends PaintDrawKind {
|
|
94
|
+
label: string;
|
|
95
|
+
/** Glyph naming this kind in an editor's kind bar. A kind without one is
|
|
96
|
+
* named by its `label`. */
|
|
97
|
+
icon?: IconRef;
|
|
98
|
+
/** The family this kind is offered under; see {@link PaintKindFamily}. A
|
|
99
|
+
* kind without one is its own segment. */
|
|
100
|
+
family?: PaintKindFamily;
|
|
101
|
+
/** A paint of this kind seeded from a color — what an editor writes when a
|
|
102
|
+
* consumer switches a solid to this kind. */
|
|
103
|
+
seed(fromColor: string): Paint;
|
|
104
|
+
/** The single color this paint shows, or `undefined` when it has none. */
|
|
105
|
+
colorOf(paint: Paint): string | undefined;
|
|
106
|
+
/** Editor slot. */
|
|
107
|
+
Editor?: ComponentType<PaintKindEditorProps>;
|
|
108
|
+
/**
|
|
109
|
+
* The stop list this paint reads as. With `fromStops`, it is what makes a
|
|
110
|
+
* kind a gradient: `listGradientKinds` returns the kinds carrying both, and
|
|
111
|
+
* `switchGradientKind` converts between any two of them through the list.
|
|
112
|
+
*/
|
|
113
|
+
stopsOf?(paint: Paint): GradStop[];
|
|
114
|
+
/** A paint of this kind built from a stop list, in `bounds` units. The
|
|
115
|
+
* converse of `stopsOf`; supply both or neither. */
|
|
116
|
+
fromStops?(stops: GradStop[]): Paint;
|
|
117
|
+
/**
|
|
118
|
+
* The `<defs>` entry backing a `url(#id)` reference.
|
|
119
|
+
*
|
|
120
|
+
* SVG has paint servers for two gradients and a pattern and nothing else, so
|
|
121
|
+
* a kind beyond those has no element to target: write a foreign-namespaced
|
|
122
|
+
* one under the `wzl:` prefix `@weasel-js/svg` declares on the root whenever
|
|
123
|
+
* a document holds such a paint. That package emits the fallback color
|
|
124
|
+
* beside the reference on its own, from `colorOf`.
|
|
125
|
+
*/
|
|
126
|
+
toSvg?(id: string, fill: Paint): string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A consumer's own paint, typed as a `Paint`.
|
|
130
|
+
*
|
|
131
|
+
* `Paint` stays a closed union: opening its discriminant would widen every
|
|
132
|
+
* built-in member and break the narrowing the kit's own branches depend on.
|
|
133
|
+
* A registered kind declares its own interface instead and passes it through
|
|
134
|
+
* here — the kit reads only `kind` and hands the whole object back to that
|
|
135
|
+
* kind's slots.
|
|
136
|
+
*/
|
|
137
|
+
declare function asPaint<T extends {
|
|
138
|
+
kind: string;
|
|
139
|
+
}>(paint: T): Paint;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The paint-kind registry — what makes `Paint` open. The built-in kinds
|
|
143
|
+
* are registered here at module load so an editor's kind bar can enumerate
|
|
144
|
+
* every kind through one list.
|
|
145
|
+
*
|
|
146
|
+
* Every entry is also handed to the renderer's own registry, which reads only
|
|
147
|
+
* its draw slots. A built-in kind has none: its render slot is a branch in the
|
|
148
|
+
* GL renderer and its serialize slot lives in `@weasel-js/svg`.
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
/** The family the built-in tiles and `texture` are offered under. A consumer's
|
|
152
|
+
* own pattern kind joins it by naming this as its `family`. */
|
|
153
|
+
declare const patternFamily: PaintKindFamily;
|
|
154
|
+
/** A tile paint seeded from a color. `units: 'bounds'` anchors the tile to the
|
|
155
|
+
* node's box, so the texture travels with the shape. */
|
|
156
|
+
declare function seedTile(kind: TileKind, color: string): TilePaint;
|
|
157
|
+
/** Resolves with the entry for a kind that is loaded on first use. */
|
|
158
|
+
type PaintKindLoader = () => Promise<PaintKindEntry>;
|
|
159
|
+
/** Every registered paint kind, with the overrides each displaced. */
|
|
160
|
+
declare const paintKindRegistry: Reflection<PaintKindEntry>;
|
|
161
|
+
/** Register a paint kind. Returns a disposer that removes it. Re-registering an
|
|
162
|
+
* existing id is an override; disposing it uncovers whatever it displaced. */
|
|
163
|
+
declare function registerPaintKind(entry: PaintKindEntry): () => void;
|
|
164
|
+
/**
|
|
165
|
+
* Declare a paint kind that is loaded the first time something looks it up,
|
|
166
|
+
* so its code stays out of the bundle until a paint of it appears — typically
|
|
167
|
+
* `() => import('./myKind').then((m) => m.myKindEntry)`.
|
|
168
|
+
*
|
|
169
|
+
* Until it lands the kind is unregistered: the renderer draws nothing for its
|
|
170
|
+
* paints, and every other reader treats it as unknown. Registering it fires
|
|
171
|
+
* `paintKindRegistry`'s subscribers. Call `warmPaintKinds` to load ahead of
|
|
172
|
+
* the first frame instead.
|
|
173
|
+
*
|
|
174
|
+
* A kind that is already registered never calls its loader. Returns a
|
|
175
|
+
* disposer that removes the loader.
|
|
176
|
+
*/
|
|
177
|
+
declare function registerPaintKindLoader(id: string, load: PaintKindLoader): () => void;
|
|
178
|
+
/** The entry for `kind`, or `undefined`. A lookup that misses on a kind with
|
|
179
|
+
* a loader starts that load; see {@link registerPaintKindLoader}. */
|
|
180
|
+
declare function getPaintKind(kind: string | undefined): PaintKindEntry | undefined;
|
|
181
|
+
/** Every registered kind, built-ins first, in registration order. The same
|
|
182
|
+
* array until the registry changes. */
|
|
183
|
+
declare function listPaintKinds(): readonly PaintKindEntry[];
|
|
184
|
+
/** Every registered gradient kind — the ones that read as and build from a
|
|
185
|
+
* stop list — in registration order. The same array until the registry
|
|
186
|
+
* changes. */
|
|
187
|
+
declare function listGradientKinds(): readonly PaintKindEntry[];
|
|
188
|
+
/**
|
|
189
|
+
* `paint` retargeted to gradient kind `kind`, or `undefined` when either side
|
|
190
|
+
* is not a gradient kind.
|
|
191
|
+
*
|
|
192
|
+
* Between two of the stop gradients this is `withGradientKind`, which carries
|
|
193
|
+
* the geometry. Any other pair goes through the stop list — `stopsOf` on the
|
|
194
|
+
* way out, `fromStops` on the way in — keeping `interpolate` and `opacity`.
|
|
195
|
+
* Lossy wherever the kinds hold different information.
|
|
196
|
+
*/
|
|
197
|
+
declare function switchGradientKind(paint: Paint, kind: PaintKind): Paint | undefined;
|
|
198
|
+
/** The registry entry for a paint, or `undefined` when its kind is unknown. */
|
|
199
|
+
declare function paintKindOf(fill: Paint): PaintKindEntry | undefined;
|
|
200
|
+
/** @internal Test helper — do not call from product code. */
|
|
201
|
+
declare function _resetPaintKindsForTests(): void;
|
|
202
|
+
|
|
203
|
+
/** The paint a path node wears, resolved: what an action that turns ink into
|
|
204
|
+
* geometry reads from a node and tells a consumer to put on a result. */
|
|
205
|
+
interface PathPaint {
|
|
206
|
+
/** `null` is no fill. */
|
|
207
|
+
fill: Fill | null;
|
|
208
|
+
/** Absent for no stroke. */
|
|
209
|
+
stroke?: Stroke;
|
|
210
|
+
}
|
|
211
|
+
/** {@link PathPaint} of a node that keeps its paint in `data.fill` and
|
|
212
|
+
* `data.stroke`, as the built-in path painter draws it: a stroke with no
|
|
213
|
+
* `paint` is none, and an undeclared fill is the default shape fill unless
|
|
214
|
+
* the node is stroked. */
|
|
215
|
+
declare function pathPaintOf(data: {
|
|
216
|
+
fill?: Fill | null;
|
|
217
|
+
stroke?: Stroke | null;
|
|
218
|
+
}): PathPaint;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Create Outlines: replace each selected text node with path nodes carrying
|
|
222
|
+
* its glyph outlines, giving up editability for geometry — the destructive
|
|
223
|
+
* conversion every vector editor has. One path per paint the text wears; one
|
|
224
|
+
* undoable batch; the replacement takes the text node's slot, so stacking
|
|
225
|
+
* order is unchanged.
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/** What a path minted by an outline action must carry — see
|
|
229
|
+
* {@link CreateOutlinesAdapter.createPathNode}. */
|
|
230
|
+
interface OutlinePathSpec extends PathPaint {
|
|
231
|
+
/** The parent the path goes under: the source's own, or the container
|
|
232
|
+
* minted to hold a source's several paths. */
|
|
233
|
+
parent: string | null;
|
|
234
|
+
}
|
|
235
|
+
/** What `applyCreateOutlines` and `applyOutlineStroke` read and write through. */
|
|
236
|
+
interface CreateOutlinesAdapter {
|
|
237
|
+
getSelection(): readonly NodeId[] | readonly string[];
|
|
238
|
+
/** The text node behind `id`, or `undefined` for anything else. */
|
|
239
|
+
getTextSource(id: NodeId): TextNodeSource | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* Optional: the world-space path of the path node behind `id`, and the
|
|
242
|
+
* paint it wears. Outline Stroke reads both, and passes over a node that
|
|
243
|
+
* lacks either.
|
|
244
|
+
*/
|
|
245
|
+
getWorldPath?(id: NodeId): Path | undefined;
|
|
246
|
+
getPaint?(id: NodeId): PathPaint | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Optional: the frame the node behind `id` draws its stroke in, as the
|
|
249
|
+
* matrix taking that frame to world (`poseFrameOf`); null or absent for a
|
|
250
|
+
* node drawn straight. Outline Stroke skews and stretches a world-width
|
|
251
|
+
* stroke with it. Without it every stroke is outlined in world.
|
|
252
|
+
*/
|
|
253
|
+
getStrokeFrame?(id: NodeId): Affine | null | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* Mint one path node of node `sourceId`'s outlines. `path` is in world
|
|
256
|
+
* space. The node must wear `spec`'s fill and stroke — a text whose runs
|
|
257
|
+
* differ in paint gets one path per paint, and a filled node whose stroke
|
|
258
|
+
* is outlined gets one for the fill and one for the stroke — and sit under
|
|
259
|
+
* `spec.parent`. The kit places it; only the consumer knows its data shape,
|
|
260
|
+
* so anything else of the source's `data` worth keeping is the adapter's to
|
|
261
|
+
* copy: onto this path when it stands alone in the source's slot, onto the
|
|
262
|
+
* container when `createContainerNode` minted one.
|
|
263
|
+
*/
|
|
264
|
+
createPathNode(path: Path, sourceId: NodeId, spec: OutlinePathSpec): {
|
|
265
|
+
id: string;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Mint the container that holds one source's several paths, under `parent`.
|
|
269
|
+
* `bounds` is the world envelope of the paths. The kit puts the container in
|
|
270
|
+
* the source's slot and the paths inside it, back to front. Without this,
|
|
271
|
+
* the paths are laid flat in that slot instead.
|
|
272
|
+
*/
|
|
273
|
+
createContainerNode?(sourceId: NodeId, spec: {
|
|
274
|
+
parent: string | null;
|
|
275
|
+
bounds: Rect;
|
|
276
|
+
}): {
|
|
277
|
+
id: string;
|
|
278
|
+
};
|
|
279
|
+
/** Full node for `id`, so undo restores the text node whole. */
|
|
280
|
+
getNode(id: string): {
|
|
281
|
+
id: string;
|
|
282
|
+
} | undefined | null;
|
|
283
|
+
/** The tree: each path is inserted at its source node's index among its
|
|
284
|
+
* parent's children. */
|
|
285
|
+
getParent(id: string): string | null;
|
|
286
|
+
getChildren(parentId: string | null): string[];
|
|
287
|
+
applyOps?(ops: Op[], label?: string): void;
|
|
288
|
+
setSelection?(ids: NodeId[]): void;
|
|
289
|
+
insertNode?(node: {
|
|
290
|
+
id: string;
|
|
291
|
+
}, index?: number): void;
|
|
292
|
+
removeNode?(id: string): void;
|
|
293
|
+
}
|
|
294
|
+
/** Outcome of {@link applyCreateOutlines}. */
|
|
295
|
+
type CreateOutlinesResult =
|
|
296
|
+
/** `resultIds` are what replaced the text nodes at their level — a path,
|
|
297
|
+
* a container, or a run of flat paths each — which is also what is now
|
|
298
|
+
* selected in the text nodes' place. */
|
|
299
|
+
{
|
|
300
|
+
kind: 'applied';
|
|
301
|
+
resultIds: string[];
|
|
302
|
+
}
|
|
303
|
+
/** Nothing selected is text with ink. */
|
|
304
|
+
| {
|
|
305
|
+
kind: 'noop';
|
|
306
|
+
reason: 'no-text';
|
|
307
|
+
}
|
|
308
|
+
/** Some selected text has no outline geometry; nothing was changed. */
|
|
309
|
+
| {
|
|
310
|
+
kind: 'failed';
|
|
311
|
+
reason: 'text-outlines';
|
|
312
|
+
error: TextOutlinesError;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Convert every text node in the selection to outlines, as one batch labeled
|
|
316
|
+
* "Create Outlines". Other selected nodes are left alone and stay selected.
|
|
317
|
+
* All or nothing: if any text node's face cannot supply outlines the scene is
|
|
318
|
+
* untouched and the error comes back in the result.
|
|
319
|
+
*/
|
|
320
|
+
declare function applyCreateOutlines(adapter: CreateOutlinesAdapter): CreateOutlinesResult;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* What each selected node gives a Boolean operation: its path, its glyph
|
|
324
|
+
* outlines, or the region its ink covers once a stroke is counted.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* What a stroked operand gives a Boolean operation.
|
|
329
|
+
*
|
|
330
|
+
* - `'ignore'`: its path, as though it had no stroke.
|
|
331
|
+
* - `'unfilled'`: the region its stroke covers when it has no fill, as a line
|
|
332
|
+
* or an open pencil stroke has none; its path when it is filled.
|
|
333
|
+
* - `'include'`: what it paints — its fill and its stroke together, or the
|
|
334
|
+
* stroke alone when it has no fill.
|
|
335
|
+
*
|
|
336
|
+
* Any mode but `'ignore'` needs {@link BooleansAdapter.getPaint}.
|
|
337
|
+
*/
|
|
338
|
+
type BooleanStrokes = 'ignore' | 'unfilled' | 'include';
|
|
339
|
+
/** Options for `applyBooleanOp`. */
|
|
340
|
+
interface BooleanOpOptions {
|
|
341
|
+
/** Default `'ignore'`. */
|
|
342
|
+
strokes?: BooleanStrokes;
|
|
343
|
+
/** The view scale a `{ px }` stroke width resolves against: one number, or
|
|
344
|
+
* the view's own scale per axis. Default 1. */
|
|
345
|
+
scale?: number | Scale2;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Pure action core for path boolean operations. Resolves the current
|
|
350
|
+
* selection into z-ordered paths, runs the chosen op, and dispatches a
|
|
351
|
+
* single batch of `Op`s (delete sources + insert results + set selection).
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
/** Boolean op identifiers: the five Pathfinder primaries, and Crop, Trim, and Merge. */
|
|
355
|
+
type BooleanOp = 'union' | 'intersect' | 'subtract' | 'exclude' | 'divide' | 'crop' | 'trim' | 'merge';
|
|
356
|
+
/** Adapter the hook and the pure core both consume. */
|
|
357
|
+
interface BooleansAdapter {
|
|
358
|
+
getSelection(): readonly NodeId[] | readonly string[];
|
|
359
|
+
getWorldPath(id: NodeId): Path | undefined;
|
|
360
|
+
/**
|
|
361
|
+
* Optional: the text node behind `id`, for an id `getWorldPath` has no path
|
|
362
|
+
* for. Its glyph outlines (`textToPath`) become the operand, so text can be
|
|
363
|
+
* cut, united or intersected like any shape.
|
|
364
|
+
*/
|
|
365
|
+
getTextSource?(id: NodeId): TextNodeSource | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* Optional: the paint the path node behind `id` wears. An operation told to
|
|
368
|
+
* count strokes (`BooleanOpOptions.strokes`) reads it to learn whether the
|
|
369
|
+
* node is stroked and whether it is filled; without it every operand is its
|
|
370
|
+
* path alone.
|
|
371
|
+
*/
|
|
372
|
+
getPaint?(id: NodeId): PathPaint | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Optional: the frame the node behind `id` draws its stroke in, as the
|
|
375
|
+
* matrix taking that frame to world (`poseFrameOf`); null or absent for a
|
|
376
|
+
* node drawn straight. A counted world-width stroke is skewed and stretched
|
|
377
|
+
* with it. Without it every stroke is outlined in world.
|
|
378
|
+
*/
|
|
379
|
+
getStrokeFrame?(id: NodeId): Affine | null | undefined;
|
|
380
|
+
compareZ(a: NodeId, b: NodeId): number;
|
|
381
|
+
/**
|
|
382
|
+
* Mint a new node from a boolean-op result `Path`. `producedBy` names the
|
|
383
|
+
* op that synthesized it — adapters that store provenance (e.g. for a
|
|
384
|
+
* layer-panel icon) record it; others ignore the arg. `sourceId` is the
|
|
385
|
+
* source the result stands in for: the topmost, except that each piece of
|
|
386
|
+
* a Divide, Crop, Trim, or Merge names the topmost source it was cut from. Give the
|
|
387
|
+
* node that source's parent, or the kit's reorder cannot find it there.
|
|
388
|
+
* `paint` is passed when that source's stroke went into the geometry, and
|
|
389
|
+
* the node must wear it as given: wearing the source's stroke again would
|
|
390
|
+
* draw it twice. Without `paint`, give it that source's paint. The kit never
|
|
391
|
+
* reads a node's `data`: anything else the result should keep of its source,
|
|
392
|
+
* a name say, is the adapter's to copy from `sourceId`.
|
|
393
|
+
*/
|
|
394
|
+
createPathNode(path: Path, producedBy: BooleanOp, sourceId: NodeId, paint?: PathPaint): {
|
|
395
|
+
id: string;
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* The full object for an id. The delete ops capture it, so their `invert`
|
|
399
|
+
* (an insert) restores the complete object on undo.
|
|
400
|
+
*/
|
|
401
|
+
getNode(id: NodeId): {
|
|
402
|
+
id: string;
|
|
403
|
+
} | undefined | null;
|
|
404
|
+
/**
|
|
405
|
+
* The tree. The kit reads each source's slot among its siblings through
|
|
406
|
+
* `getParent` and `getChildren`, and moves each result into the slot of
|
|
407
|
+
* the topmost source in its own source's parent through `setChildOrder`.
|
|
408
|
+
* `defaultCommitAdapter` supplies all three, and `getNode`.
|
|
409
|
+
*/
|
|
410
|
+
getParent(id: string): string | null;
|
|
411
|
+
getChildren(parentId: string | null): string[];
|
|
412
|
+
setChildOrder(parentId: string | null, ids: string[]): void;
|
|
413
|
+
applyOps?(ops: Op[], label?: string): void;
|
|
414
|
+
setSelection?(ids: NodeId[]): void;
|
|
415
|
+
insertNode?(node: {
|
|
416
|
+
id: string;
|
|
417
|
+
}): void;
|
|
418
|
+
removeNode?(id: string): void;
|
|
419
|
+
}
|
|
420
|
+
/** Outcome reported back to callers (lets the hook surface no-op signals). */
|
|
421
|
+
type BooleanOpResult = {
|
|
422
|
+
kind: 'applied';
|
|
423
|
+
resultIds: string[];
|
|
424
|
+
} | {
|
|
425
|
+
kind: 'noop';
|
|
426
|
+
reason: 'no-paths' | 'too-few-for-subtract' | 'empty-result';
|
|
427
|
+
}
|
|
428
|
+
/** A text operand had no outline geometry. Nothing was changed: an op that
|
|
429
|
+
* quietly dropped the operand would commit a different shape than asked. */
|
|
430
|
+
| {
|
|
431
|
+
kind: 'failed';
|
|
432
|
+
reason: 'text-outlines';
|
|
433
|
+
error: TextOutlinesError;
|
|
434
|
+
};
|
|
435
|
+
/** One path a Boolean operation would make. */
|
|
436
|
+
interface BooleanPreviewPiece {
|
|
437
|
+
path: Path;
|
|
438
|
+
/** The source the piece stands in for; see `BooleansAdapter.createPathNode`. */
|
|
439
|
+
sourceId: NodeId;
|
|
440
|
+
/** Set when that source's stroke went into `path`: the paint the piece wears. */
|
|
441
|
+
paint?: PathPaint;
|
|
442
|
+
}
|
|
443
|
+
/** What {@link previewBooleanOp} answers: the pieces, or why there are none. */
|
|
444
|
+
type BooleanOpPreview = {
|
|
445
|
+
kind: 'pieces';
|
|
446
|
+
pieces: BooleanPreviewPiece[];
|
|
447
|
+
} | Exclude<BooleanOpResult, {
|
|
448
|
+
kind: 'applied';
|
|
449
|
+
}>;
|
|
450
|
+
/**
|
|
451
|
+
* What {@link applyBooleanOp} would make of the selection, without minting a
|
|
452
|
+
* node or committing anything: for drawing an operation before it is applied.
|
|
453
|
+
*/
|
|
454
|
+
declare function previewBooleanOp(adapter: BooleansAdapter, op: BooleanOp, opts?: BooleanOpOptions): BooleanOpPreview;
|
|
455
|
+
/**
|
|
456
|
+
* Run one Boolean operation over the selected paths and commit the result as a
|
|
457
|
+
* single undoable batch.
|
|
458
|
+
*
|
|
459
|
+
* Operands are ordered back-to-front, which is what makes `subtract` mean
|
|
460
|
+
* "everything in front removed from the backmost shape". Returns without
|
|
461
|
+
* mutating anything when the selection holds no paths, or too few for the
|
|
462
|
+
* requested operation. `opts.strokes` says what a stroked operand gives.
|
|
463
|
+
*/
|
|
464
|
+
declare function applyBooleanOp(adapter: BooleansAdapter, op: BooleanOp, opts?: BooleanOpOptions): BooleanOpResult;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Read-only state that affordances consult on every render and hit-test
|
|
468
|
+
* call. Built via `buildChromeState` and held across renders, so affordances
|
|
469
|
+
* must not cache anything they read from it.
|
|
470
|
+
*/
|
|
471
|
+
interface ChromeState {
|
|
472
|
+
/** Currently selected ids. Live; reflects useSelection's React state,
|
|
473
|
+
* less any on a layer this view does not paint. */
|
|
474
|
+
readonly selection: readonly NodeId[];
|
|
475
|
+
/** True when the canvas is in multi-mode AND >= 2 ids are selected, and
|
|
476
|
+
* still >= 2 once `selection` drops the ones this view does not paint. */
|
|
477
|
+
readonly multiActive: boolean;
|
|
478
|
+
/** Bounds for any selection member id. Honors active-tool overlay state
|
|
479
|
+
* (move/resize/rotate ghosts → ghost bounds; otherwise → committed
|
|
480
|
+
* pose bounds). Returns null for unknown ids or ids whose bounds aren't
|
|
481
|
+
* computable. */
|
|
482
|
+
boundsOf(id: string): FramedBox | null;
|
|
483
|
+
/** Multi-union AABB when `multiActive`. Recomputed from `boundsOf` over
|
|
484
|
+
* every selected id on each read, expanding rotated members to the extent
|
|
485
|
+
* of their ink; null otherwise. */
|
|
486
|
+
readonly unionBounds: FramedBox | null;
|
|
487
|
+
/** Active modifier state at the moment of the call. */
|
|
488
|
+
readonly modifiers: ModifierState;
|
|
489
|
+
/** True iff the node's pose-descriptor declares it can carry a rotation.
|
|
490
|
+
* Affordances consult this to decide whether to expose rotate cursors /
|
|
491
|
+
* drag-bands. Defaults to `true` when the descriptor doesn't declare
|
|
492
|
+
* (back-compat) or when the id is unknown — the rotation gesture will
|
|
493
|
+
* no-op visually for poses without AABB fields, but the affordance
|
|
494
|
+
* doesn't lie about the cursor. Optional on the interface so unit-test
|
|
495
|
+
* call sites that construct `ChromeState` by hand keep compiling;
|
|
496
|
+
* affordances should treat an absent predicate as "true". */
|
|
497
|
+
canRotate?(id: string): boolean;
|
|
498
|
+
/** Whether a scene layer reaches the screen in the view this state was
|
|
499
|
+
* built for — its `layerVisibility` / `layerOrder`, as `ViewApi` answers
|
|
500
|
+
* it. Absent: the view paints every layer the scene shows. An affordance
|
|
501
|
+
* that reads it puts no chrome on a node whose layer it says `false` to. */
|
|
502
|
+
layerIsPainted?(layerId: string): boolean;
|
|
503
|
+
}
|
|
504
|
+
/** Whether chrome goes on something painted on `layer`, as `gate` — a
|
|
505
|
+
* `ChromeState`, a `ViewApi` — says. No layer, or no gate: it does. */
|
|
506
|
+
declare function paintsLayer(gate: {
|
|
507
|
+
layerIsPainted?(layerId: string): boolean;
|
|
508
|
+
} | null | undefined, layer: string | undefined): boolean;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* A single interactive piece of chrome. Affordances declare interactive regions in a target's
|
|
512
|
+
* *local* frame; `composeAffordanceLayer` composes the target's bounds transform (rotation
|
|
513
|
+
* around the AABB center, when present) for both paint and hit-test, so the affordance never
|
|
514
|
+
* touches rotation, view.scale, or world↔screen math.
|
|
515
|
+
*/
|
|
516
|
+
interface Affordance {
|
|
517
|
+
/** Stable id for debug overlays + visibility maps. */
|
|
518
|
+
id: string;
|
|
519
|
+
/** This affordance's interactive regions. Each lives in some target id's local frame (or
|
|
520
|
+
* the world frame when `targetId` is `null`). `[]` means no chrome for this state. */
|
|
521
|
+
regions(state: ChromeState): readonly AffordanceRegion[];
|
|
522
|
+
/** Optional non-interactive decoration (e.g., a leader line from a bounds edge to a
|
|
523
|
+
* handle). Receives raw state + view because it may live outside any single target's
|
|
524
|
+
* local frame. */
|
|
525
|
+
decorate?(state: ChromeState, view: View): DrawCommand[];
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* One interactive region produced by an affordance. The framework owns
|
|
529
|
+
* the local↔world transform for `targetId` (when non-null), so `shape`,
|
|
530
|
+
* `paint.sizePx`, and `hitRadiusPx` are always specified in coordinates
|
|
531
|
+
* the affordance can reason about directly.
|
|
532
|
+
*/
|
|
533
|
+
interface AffordanceRegion<TScratch = unknown> {
|
|
534
|
+
/** Stable id, e.g. `corner-min-min`. Used for debug overlays + a11y. */
|
|
535
|
+
id: string;
|
|
536
|
+
/** A chrome-caps id gating this region on top of its affordance's. */
|
|
537
|
+
chromeId?: string;
|
|
538
|
+
/** Target id whose `state.boundsOf(targetId)` defines this region's
|
|
539
|
+
* local frame: the bounds' `rotation` and `transform`, as `poseFrameOf`
|
|
540
|
+
* composes them about the box center. Pass
|
|
541
|
+
* `null` for affordances anchored to the viewport / world frame
|
|
542
|
+
* (identity transform). */
|
|
543
|
+
targetId: string | null;
|
|
544
|
+
/** Region geometry, expressed in the target's local frame.
|
|
545
|
+
*
|
|
546
|
+
* - `point` — square hit of half-extent `hitRadiusPx` screen pixels,
|
|
547
|
+
* axis-aligned on screen unless `turned`. `standoff` pushes the anchor `px`
|
|
548
|
+
* screen pixels off the edge whose outward normal (target-local) is
|
|
549
|
+
* `normal`, measured along that normal as it lands on screen — for
|
|
550
|
+
* chrome that floats a fixed distance off an edge at any zoom.
|
|
551
|
+
* - `rect` — axis-aligned rect (target rotation applies).
|
|
552
|
+
* - `annulus` — outer ellipse minus inner rect cutout, for zones that sit *around* the
|
|
553
|
+
* AABB (e.g. a rotate-on-hover band).
|
|
554
|
+
* - `outline` — within `hitRadiusPx` screen pixels of `path`'s outline, either side of it,
|
|
555
|
+
* for chrome that is a path's own edge (path edit's segments). Hit-only. */
|
|
556
|
+
shape: {
|
|
557
|
+
kind: 'point';
|
|
558
|
+
x: number;
|
|
559
|
+
y: number;
|
|
560
|
+
hitRadiusPx: number;
|
|
561
|
+
standoff?: {
|
|
562
|
+
px: number;
|
|
563
|
+
normal: {
|
|
564
|
+
x: number;
|
|
565
|
+
y: number;
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
/** Turn the square to the target, at the angle the target's x axis
|
|
569
|
+
* lands on screen (`screenAngleOf`) — for handles painted turned. */
|
|
570
|
+
turned?: boolean;
|
|
571
|
+
/** The body this point is a corner of: its target-local size, and
|
|
572
|
+
* which way leads out of it on each axis. While the body spans under
|
|
573
|
+
* four `hitRadiusPx` on an axis on screen, only the outward half of
|
|
574
|
+
* the square on that axis takes a press, so a small body can still be
|
|
575
|
+
* grabbed. The cut runs along the square's own axes: pair it with
|
|
576
|
+
* `turned` on a target that can rotate. */
|
|
577
|
+
cornerOf?: {
|
|
578
|
+
width: number;
|
|
579
|
+
height: number;
|
|
580
|
+
outward: {
|
|
581
|
+
x: -1 | 1;
|
|
582
|
+
y: -1 | 1;
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
/** The body this point is an edge midpoint of: its target-local
|
|
586
|
+
* size. While either side spans under `EDGE_HANDLE_MIN_RADII`
|
|
587
|
+
* `hitRadiusPx` on screen, the point is neither hit nor painted, so it
|
|
588
|
+
* cannot crowd the corners or cover the middle of a small body. */
|
|
589
|
+
edgeOf?: {
|
|
590
|
+
width: number;
|
|
591
|
+
height: number;
|
|
592
|
+
};
|
|
593
|
+
} | {
|
|
594
|
+
kind: 'rect';
|
|
595
|
+
x: number;
|
|
596
|
+
y: number;
|
|
597
|
+
width: number;
|
|
598
|
+
height: number;
|
|
599
|
+
} | {
|
|
600
|
+
kind: 'annulus';
|
|
601
|
+
/** Outer-ellipse center (target-local). */
|
|
602
|
+
cx: number;
|
|
603
|
+
cy: number;
|
|
604
|
+
/** Outer-ellipse semi-axes (target-local). */
|
|
605
|
+
rx: number;
|
|
606
|
+
ry: number;
|
|
607
|
+
/** Inner rect (target-local) — the cutout. Typically the
|
|
608
|
+
* selection's AABB. */
|
|
609
|
+
innerX: number;
|
|
610
|
+
innerY: number;
|
|
611
|
+
innerWidth: number;
|
|
612
|
+
innerHeight: number;
|
|
613
|
+
/** Minimum band thickness outside the inner rect, in **screen**
|
|
614
|
+
* pixels. The framework widens `rx`/`ry` to at least
|
|
615
|
+
* `innerHalfExtent + pxExtent(minBandPx, view.scale)` on each axis
|
|
616
|
+
* for both paint and hit-test.
|
|
617
|
+
*
|
|
618
|
+
* In screen pixels because the clamp has to know the view and the affordance
|
|
619
|
+
* doesn't: `ChromeState` carries no scale. */
|
|
620
|
+
minBandPx?: number;
|
|
621
|
+
} | {
|
|
622
|
+
kind: 'outline';
|
|
623
|
+
path: PolygonPath;
|
|
624
|
+
hitRadiusPx: number;
|
|
625
|
+
};
|
|
626
|
+
/** Optional paint. World position is derived from `shape` + target
|
|
627
|
+
* transform; visual size stays in screen pixels (so handles don't
|
|
628
|
+
* warp under zoom or non-uniform scale). Omit for hit-only regions.
|
|
629
|
+
*
|
|
630
|
+
* - `square` — small fixed-size square (only valid over `point` shapes).
|
|
631
|
+
* - `annulus` — fill + stroke the annulus ring (only valid over `annulus` shapes).
|
|
632
|
+
* - `custom` — emit arbitrary draw commands; receives a {@link CustomPaintContext}. */
|
|
633
|
+
paint?: {
|
|
634
|
+
kind: 'square';
|
|
635
|
+
sizePx: number;
|
|
636
|
+
fill?: CommandFill;
|
|
637
|
+
stroke?: CommandStroke;
|
|
638
|
+
} | {
|
|
639
|
+
kind: 'annulus';
|
|
640
|
+
fill?: CommandFill;
|
|
641
|
+
stroke?: CommandStroke;
|
|
642
|
+
insetPx?: number;
|
|
643
|
+
} | {
|
|
644
|
+
kind: 'custom';
|
|
645
|
+
draw: (ctx: CustomPaintContext) => DrawCommand[];
|
|
646
|
+
};
|
|
647
|
+
/** Discriminator a press on this region reports as `AffordanceHit.kind` —
|
|
648
|
+
* the string routing specs match on (`'handle:top-left'`,
|
|
649
|
+
* `'rotate-handle'`, `'anchor:3'`). Omit for regions that only exist
|
|
650
|
+
* inside a consumer-registered layer, where the layer id is the
|
|
651
|
+
* discriminator; `buildAffordanceAt` falls back to
|
|
652
|
+
* `<affordanceId>:<regionId>`. */
|
|
653
|
+
hitKind?: string;
|
|
654
|
+
/** Cursor to show while hovering this region: one spec, or one worked out
|
|
655
|
+
* from where the pointer is (`at`, in world coords). */
|
|
656
|
+
cursor?: CursorSpec | ((at: {
|
|
657
|
+
x: number;
|
|
658
|
+
y: number;
|
|
659
|
+
}, view: View) => CursorSpec);
|
|
660
|
+
/** `'exclusive'` bars every binding whose target doesn't consult the
|
|
661
|
+
* affordance. Read only when the affordance is composed into a
|
|
662
|
+
* consumer-registered layer; kit chrome routes through
|
|
663
|
+
* `buildAffordanceAt`, which reports `'shared'`. */
|
|
664
|
+
strength?: 'exclusive' | 'shared';
|
|
665
|
+
/** Which gestures an exclusive claim bars. Omitted bars all of them. */
|
|
666
|
+
claimedKinds?: readonly ClaimableGesture[];
|
|
667
|
+
/** Drag binding produced when this region is hit. Called lazily, so state snapshots
|
|
668
|
+
* (e.g., capturing per-leaf poses at click time) belong inside `bind()`, not inside
|
|
669
|
+
* `regions()`. */
|
|
670
|
+
bind(): AffordanceBinding<TScratch>;
|
|
671
|
+
}
|
|
672
|
+
/** Context passed to a region's `paint.kind === 'custom'` draw callback. */
|
|
673
|
+
interface CustomPaintContext {
|
|
674
|
+
/** World-space mapping of `shape`. For `point`, only `x`/`y` are set.
|
|
675
|
+
* For `rect`, all four fields are set. */
|
|
676
|
+
world: {
|
|
677
|
+
x: number;
|
|
678
|
+
y: number;
|
|
679
|
+
width?: number;
|
|
680
|
+
height?: number;
|
|
681
|
+
};
|
|
682
|
+
/** The original local shape (same object identity as `region.shape`). */
|
|
683
|
+
local: AffordanceRegion['shape'];
|
|
684
|
+
view: View;
|
|
685
|
+
state: ChromeState;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Result of an affordance hit. `initialScratch` is what the region already knows (which
|
|
689
|
+
* corner, which target id) so the action that picks up the drag doesn't re-derive it. It
|
|
690
|
+
* reaches the matching action through `InvocationCtx.drag.affordance`.
|
|
691
|
+
*/
|
|
692
|
+
interface AffordanceBinding<TScratch = unknown> {
|
|
693
|
+
initialScratch?: TScratch;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* The fields `buildAffordanceAt` lifts out of a region's `initialScratch` when it turns a
|
|
697
|
+
* region hit into an `AffordanceHit`. Scratch is otherwise opaque; these names mean the same
|
|
698
|
+
* thing to every affordance. An affordance that doesn't set them produces a hit without
|
|
699
|
+
* those fields.
|
|
700
|
+
*/
|
|
701
|
+
interface CommonAffordanceScratch {
|
|
702
|
+
/** The node (or `MULTI_RESIZE_TARGET_ID`) this chrome acts on. Becomes
|
|
703
|
+
* `AffordanceHit.targetIds`. */
|
|
704
|
+
targetId?: string;
|
|
705
|
+
/** For resize chrome: which corner stays pinned. Mirrors the kit's
|
|
706
|
+
* `ResizeAnchor`, spelled inline so `affordances/` doesn't take a type
|
|
707
|
+
* dependency on the gesture layer for one field. */
|
|
708
|
+
anchor?: {
|
|
709
|
+
x: 'min' | 'max' | 'free';
|
|
710
|
+
y: 'min' | 'max' | 'free';
|
|
711
|
+
};
|
|
712
|
+
/** World-space invariant point of the transform — the fixed corner for a
|
|
713
|
+
* resize, the pivot for a rotation. */
|
|
714
|
+
fixedPoint?: {
|
|
715
|
+
x: number;
|
|
716
|
+
y: number;
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* What a **registered layer's** `hitTest` returns. The added fields are how a consumer's own
|
|
721
|
+
* chrome says the things kit chrome says through `AffordanceRegion` — which cursor to show,
|
|
722
|
+
* and whether it owns the point outright.
|
|
723
|
+
*/
|
|
724
|
+
interface LayerHit<TScratch = unknown> extends AffordanceBinding<TScratch> {
|
|
725
|
+
/** Cursor while the pointer is over this hit. Reaches the hover-cursor
|
|
726
|
+
* pump as `AffordanceHit.cursor`, the same path kit chrome uses. */
|
|
727
|
+
cursor?: CursorSpec;
|
|
728
|
+
/** `'exclusive'` bars every binding whose target doesn't consult the affordance. Omitted
|
|
729
|
+
* means `'shared'`. Becomes `AffordanceHit.strength`. */
|
|
730
|
+
strength?: 'exclusive' | 'shared';
|
|
731
|
+
/** Which gestures an exclusive claim bars. Omitted bars all of them. */
|
|
732
|
+
claimedKinds?: readonly ClaimableGesture[];
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Several consecutive layers composited as one.
|
|
737
|
+
*
|
|
738
|
+
* A layer's own `effects` run over that layer alone, which is the wrong
|
|
739
|
+
* picture whenever a pass reads neighboring pixels: `blur(A over B)` is not
|
|
740
|
+
* `blur(A) over blur(B)`. A group draws its members into one buffer, runs one
|
|
741
|
+
* chain over it, and composites the result back once.
|
|
742
|
+
*
|
|
743
|
+
* Membership is by `RenderLayer.id` — the same names `layerOrder` and
|
|
744
|
+
* `layerVisibility` use, not the `layers` map's slot keys.
|
|
745
|
+
*
|
|
746
|
+
* Only *consecutive* members share a buffer. A group whose members are
|
|
747
|
+
* separated in the render order is drawn as one bracket per run, with a
|
|
748
|
+
* warning.
|
|
749
|
+
*
|
|
750
|
+
* This is a render-stack bracket, not a scene `ContainerNode`.
|
|
751
|
+
*/
|
|
752
|
+
interface LayerGroup {
|
|
753
|
+
/** Names the group in warnings; not a layer id and never drawn. */
|
|
754
|
+
id: string;
|
|
755
|
+
/**
|
|
756
|
+
* Member layer ids. Order here is ignored — the render order decides.
|
|
757
|
+
*
|
|
758
|
+
* A name claims that layer and every layer under it in the `:` namespace, so
|
|
759
|
+
* `'scene'` covers the `scene:<layerId>` layers a scene with declared layers
|
|
760
|
+
* draws as. The separator is required: `'scene'` does not reach `scenery`.
|
|
761
|
+
* A name matching no layer being drawn is warned about.
|
|
762
|
+
*/
|
|
763
|
+
layers: readonly string[];
|
|
764
|
+
/** Passes over the group's combined pixels, in order. A thunk is re-read on
|
|
765
|
+
* every frame, so an animating radius costs no React render. */
|
|
766
|
+
effects?: readonly Effect[] | ((view: View, dims: Dims) => readonly Effect[]);
|
|
767
|
+
/** Opacity applied to the group's composited result, not to each member. */
|
|
768
|
+
alpha?: number;
|
|
769
|
+
/** 4×5 color matrix (row-major, 20 numbers) applied to the composited
|
|
770
|
+
* result. See `GroupDrawCommand.colorMatrix`. */
|
|
771
|
+
colorMatrix?: number[];
|
|
772
|
+
/** How the composited result joins the layers under it. Default
|
|
773
|
+
* `source-over`. See `GroupDrawCommand.composite`. */
|
|
774
|
+
composite?: CompositeOp | BlendFactors;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* When `drawLayers` asks the renderer to keep a layer's pixels between frames
|
|
779
|
+
* (`GroupDrawCommand.retain`) rather than submit its commands again.
|
|
780
|
+
*
|
|
781
|
+
* A layer is retained once its `deps` have held for a frame, the view has held
|
|
782
|
+
* since the frame before (for a world-space layer, whose pixels move with
|
|
783
|
+
* it), and it holds at least `minCommands` drawing commands. A layer changing
|
|
784
|
+
* every frame is never retained: drawing it into its surface and compositing
|
|
785
|
+
* that costs more than drawing it.
|
|
786
|
+
*/
|
|
787
|
+
interface LayerRetainPolicy {
|
|
788
|
+
minCommands: number;
|
|
789
|
+
}
|
|
790
|
+
/** Measured on 1280x800 at dpr 2: an unchanged layer composites cheaper than
|
|
791
|
+
* it submits from about 130 to 250 commands, depending on the layer count. */
|
|
792
|
+
declare const DEFAULT_LAYER_RETAIN: LayerRetainPolicy;
|
|
793
|
+
|
|
794
|
+
/** Something outside React whose changes a paint reads — a mode registry, a
|
|
795
|
+
* scoping lookup. A notification repaints the canvas; the listener takes no
|
|
796
|
+
* arguments and the returned function unsubscribes. */
|
|
797
|
+
interface RedrawSource {
|
|
798
|
+
subscribe(listener: () => void): () => void;
|
|
799
|
+
}
|
|
800
|
+
/** The `subscribe` for a layer that draws `sources`: it notifies whenever any
|
|
801
|
+
* of them does. A thunk is read when the subscription is made. */
|
|
802
|
+
declare function subscribeToSources(sources: readonly {
|
|
803
|
+
subscribe?: RedrawSource['subscribe'];
|
|
804
|
+
}[] | (() => readonly {
|
|
805
|
+
subscribe?: RedrawSource['subscribe'];
|
|
806
|
+
}[])): RedrawSource['subscribe'];
|
|
807
|
+
|
|
808
|
+
/** Canvas size in CSS pixels, so layers don't have to know about DPR. */
|
|
809
|
+
interface Dims {
|
|
810
|
+
width: number;
|
|
811
|
+
height: number;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* What a layer's `draw` threw, and which layer threw it. A throw that escaped
|
|
815
|
+
* the frame loop would take the whole frame with it, every other layer
|
|
816
|
+
* included.
|
|
817
|
+
*/
|
|
818
|
+
interface LayerDrawFailure {
|
|
819
|
+
layerId: string;
|
|
820
|
+
error: unknown;
|
|
821
|
+
}
|
|
822
|
+
/** One layer's memoized output, keyed by layer id. Owned by the canvas that
|
|
823
|
+
* calls `drawLayers`, not by `drawLayers` itself — the function is pure. */
|
|
824
|
+
type LayerCommandCache = Map<string, {
|
|
825
|
+
deps: readonly unknown[];
|
|
826
|
+
cmds: DrawCommand[];
|
|
827
|
+
/** Whether the last frame served `cmds` from here rather than drawing. */
|
|
828
|
+
reused?: boolean;
|
|
829
|
+
/** The view the last frame drew under. */
|
|
830
|
+
view?: View;
|
|
831
|
+
}>;
|
|
832
|
+
/**
|
|
833
|
+
* One layer of a canvas: `draw` turns `data` and the view into draw commands;
|
|
834
|
+
* the other fields control caching, visibility, coordinate space and hit-testing.
|
|
835
|
+
*
|
|
836
|
+
* @template TData - The data object passed to each draw call.
|
|
837
|
+
*/
|
|
838
|
+
interface RenderLayer<TData> {
|
|
839
|
+
/** Unique identifier used in visibility maps and ordering arrays. When a
|
|
840
|
+
* cache is in use, an id must identify the same logical layer across
|
|
841
|
+
* frames — reusing it for a different layer can serve cross-layer commands. */
|
|
842
|
+
id: string;
|
|
843
|
+
/** Human-readable name for UI toggles. */
|
|
844
|
+
label: string;
|
|
845
|
+
/**
|
|
846
|
+
* Emit a DrawCommand tree, in the coordinates `space` names. A world-space
|
|
847
|
+
* layer must NOT apply the view transform itself.
|
|
848
|
+
*/
|
|
849
|
+
draw: (data: TData, view: View, dims: Dims) => DrawCommand[];
|
|
850
|
+
/**
|
|
851
|
+
* Optional cache key. When present and a `LayerCommandCache` is supplied to
|
|
852
|
+
* `drawLayers`, the layer's previous `DrawCommand[]` is reused as long as
|
|
853
|
+
* every entry is `Object.is`-equal to the previous call's. A layer with no
|
|
854
|
+
* `deps` rebuilds on every frame.
|
|
855
|
+
*
|
|
856
|
+
* **The returned commands must be treated as immutable.** A cached tree is
|
|
857
|
+
* handed to the renderer again on later frames, so mutating a tree you
|
|
858
|
+
* previously returned corrupts the cache silently rather than erroring.
|
|
859
|
+
*
|
|
860
|
+
* **Screen-space layers are not protected against a stale `view`/`dims`
|
|
861
|
+
* the way world-space layers are** (see `space` below) — include them in
|
|
862
|
+
* `deps` if `draw` reads them.
|
|
863
|
+
*/
|
|
864
|
+
deps?: (data: TData, view: View, dims: Dims) => readonly unknown[];
|
|
865
|
+
/** Whether the layer is shown when no explicit visibility entry exists.
|
|
866
|
+
* Defaults to `true` when absent. */
|
|
867
|
+
defaultVisible?: boolean;
|
|
868
|
+
/** When true, the layer is always drawn regardless of the visibility map. */
|
|
869
|
+
alwaysOn?: boolean;
|
|
870
|
+
/**
|
|
871
|
+
* Coordinate space the layer draws in.
|
|
872
|
+
*
|
|
873
|
+
* - `'world'` (default): the layer's `draw` returns world-space commands;
|
|
874
|
+
* `drawLayers` wraps them in a `kind: 'group'` with `viewToMat3(view)`
|
|
875
|
+
* automatically.
|
|
876
|
+
* - `'screen'`: the layer's `draw` returns screen-space (CSS-pixel)
|
|
877
|
+
* commands; `drawLayers` passes them through unchanged. World-anchored
|
|
878
|
+
* chrome inside a screen-space layer must call `worldToScreen` or wrap
|
|
879
|
+
* the relevant subset with `viewToMat3(view)` manually.
|
|
880
|
+
*/
|
|
881
|
+
space?: 'world' | 'screen';
|
|
882
|
+
/**
|
|
883
|
+
* Where the layer learns that state `draw` reads, outside the scene and the
|
|
884
|
+
* props, has changed. The canvas painting it subscribes while the layer is
|
|
885
|
+
* mounted and repaints on every notification.
|
|
886
|
+
*/
|
|
887
|
+
subscribe?: RedrawSource['subscribe'];
|
|
888
|
+
/**
|
|
889
|
+
* Full-screen passes run over this layer's own pixels before it joins the
|
|
890
|
+
* frame. See `GroupDrawCommand.effects` for what a pass may read, and
|
|
891
|
+
* {@link LayerGroup} to run one chain over several layers at once.
|
|
892
|
+
*/
|
|
893
|
+
effects?: readonly Effect[];
|
|
894
|
+
/**
|
|
895
|
+
* Whether the renderer may keep this layer's pixels between frames and
|
|
896
|
+
* composite them as one quad instead of drawing its commands again — see
|
|
897
|
+
* {@link LayerRetainPolicy} for when `drawLayers` does. `false` never
|
|
898
|
+
* retains it, `true` retains it whatever its size; either way only a layer
|
|
899
|
+
* with `deps`, drawn through a cache, and without `effects`.
|
|
900
|
+
*/
|
|
901
|
+
retain?: boolean;
|
|
902
|
+
/**
|
|
903
|
+
* Optional hit-test for **consumer-attached** layers.
|
|
904
|
+
*
|
|
905
|
+
* Only layers registered through `CanvasExtensionApi.registerLayer` are
|
|
906
|
+
* hit-tested, last-registered-first, ahead of the kit's own selection
|
|
907
|
+
* chrome. First non-null result wins; null means "I don't claim this hit,
|
|
908
|
+
* try the next layer."
|
|
909
|
+
*
|
|
910
|
+
* Layers that reach the draw stack some other way — a `Tool.overlay`, an
|
|
911
|
+
* entry in the `layers` map — are painted but never hit-tested, so defining
|
|
912
|
+
* `hitTest` on one has no effect.
|
|
913
|
+
*
|
|
914
|
+
* Coordinates are world-space.
|
|
915
|
+
*/
|
|
916
|
+
hitTest?: (worldX: number, worldY: number, data: TData, view: View, dims: Dims,
|
|
917
|
+
/** Chrome-caps visibility predicate. When supplied, the layer must
|
|
918
|
+
* not return a hit from any chrome element whose id reports
|
|
919
|
+
* `false`. Absent → every element is hittable. */
|
|
920
|
+
isVisible?: (id: string) => boolean) => LayerHit | null;
|
|
921
|
+
/**
|
|
922
|
+
* Called on every pointermove when no gesture is currently captured, so a
|
|
923
|
+
* layer can track hover state. Coords are world-space, and the layer does
|
|
924
|
+
* its own throttling.
|
|
925
|
+
*/
|
|
926
|
+
onUncapturedMove?: (worldX: number, worldY: number, evt: PointerEvent, view: View, dims: Dims) => void;
|
|
927
|
+
/** Called when the cursor leaves the canvas element. */
|
|
928
|
+
onUncapturedLeave?: () => void;
|
|
929
|
+
}
|
|
930
|
+
/** Where one layer's commands landed in {@link drawLayers}' output,
|
|
931
|
+
* `[start, end)`, and the CPU milliseconds its `draw` took. A layer group's
|
|
932
|
+
* run is one span under the group's id. */
|
|
933
|
+
interface LayerDrawSpan {
|
|
934
|
+
id: string;
|
|
935
|
+
start: number;
|
|
936
|
+
end: number;
|
|
937
|
+
buildMs: number;
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Walk visible layers and concatenate their emitted DrawCommand arrays into
|
|
941
|
+
* one flat list, ready to feed to `WeaselRenderer.render(commands)`.
|
|
942
|
+
*
|
|
943
|
+
* A layer whose `draw` throws is dropped for the frame and reported through
|
|
944
|
+
* `onLayerError` — the rest of the frame still paints.
|
|
945
|
+
*
|
|
946
|
+
* `groups` brackets runs of consecutive layers so they composite as one — see
|
|
947
|
+
* `LayerGroup`. `spans`, when passed, receives one {@link LayerDrawSpan} per
|
|
948
|
+
* layer drawn. `retain` decides which unchanged layers the renderer keeps
|
|
949
|
+
* as pixels between frames; `false` keeps none.
|
|
950
|
+
*/
|
|
951
|
+
declare function drawLayers<TData>(layers: RenderLayer<TData>[], data: TData, visibility: Record<string, boolean>, order: string[] | undefined, view: View | undefined, dims: Dims, cache?: LayerCommandCache, onLayerError?: (failure: LayerDrawFailure) => void, groups?: readonly LayerGroup[], spans?: LayerDrawSpan[], retain?: LayerRetainPolicy | false): DrawCommand[];
|
|
952
|
+
/**
|
|
953
|
+
* Resolve one layer's visibility: `alwaysOn` wins, then an explicit entry in
|
|
954
|
+
* `visibility`, then `defaultVisible`, defaulting to shown.
|
|
955
|
+
*/
|
|
956
|
+
declare function isLayerVisible<TData>(layer: RenderLayer<TData>, visibility: Record<string, boolean>): boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Does this layer reach the screen at all — membership of
|
|
959
|
+
* {@link paintedLayers}, asked of one layer.
|
|
960
|
+
*
|
|
961
|
+
* **A listed `order` is the whole list**, so omission from it drops a layer
|
|
962
|
+
* that `visibility` would have shown, and `alwaysOn` does not rescue it.
|
|
963
|
+
* Hit-testing asks this, not `isLayerVisible`.
|
|
964
|
+
*/
|
|
965
|
+
declare function isLayerPainted<TData>(layer: RenderLayer<TData>, visibility: Record<string, boolean>, order: readonly string[] | undefined): boolean;
|
|
966
|
+
/**
|
|
967
|
+
* The layers that reach the screen, in the order they are drawn: `order`
|
|
968
|
+
* sequences them and drops what it leaves out, then `visibility` drops what is
|
|
969
|
+
* hidden. What `drawLayers` paints, and what a view narrows its stack with.
|
|
970
|
+
*/
|
|
971
|
+
declare function paintedLayers<TData>(layers: readonly RenderLayer<TData>[], visibility: Record<string, boolean>, order: readonly string[] | undefined): RenderLayer<TData>[];
|
|
972
|
+
/**
|
|
973
|
+
* Draw one layer and put its commands in the space its `space` declares:
|
|
974
|
+
* world-space output wrapped in a `viewToMat3(view)` group, screen-space
|
|
975
|
+
* output passed through.
|
|
976
|
+
*
|
|
977
|
+
* Anything rendering layers through a view goes through here.
|
|
978
|
+
*
|
|
979
|
+
* A `draw` that throws yields no commands, and `onLayerError` is told which
|
|
980
|
+
* layer it was. The layer's cache entry goes with it, so the next frame is a
|
|
981
|
+
* real re-attempt.
|
|
982
|
+
*/
|
|
983
|
+
declare function drawOneLayer<TData>(layer: RenderLayer<TData>, data: TData, view: View, dims: Dims, cache?: LayerCommandCache, onLayerError?: (failure: LayerDrawFailure) => void): DrawCommand[];
|
|
984
|
+
/** Whether `b` matches `a` entry for entry under `Object.is` — how
|
|
985
|
+
* `RenderLayer.deps` is compared, and any cache keyed the same way. */
|
|
986
|
+
declare function depsUnchanged(a: readonly unknown[], b: readonly unknown[]): boolean;
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Paths that are no node, drawn over the scene: a region a tool would take,
|
|
990
|
+
* the result an operation would make before it is applied.
|
|
991
|
+
*/
|
|
992
|
+
|
|
993
|
+
/** One path to draw, in world coordinates, and what it is. */
|
|
994
|
+
interface TransientPath {
|
|
995
|
+
path: Path;
|
|
996
|
+
/** Omitted reads as `'chrome'`. */
|
|
997
|
+
role?: OverlayRole;
|
|
998
|
+
/** Paint the path wears, drawn in place of the role's fill and under the
|
|
999
|
+
* role's outline: a result shown as it will look once made. */
|
|
1000
|
+
paint?: PathPaint;
|
|
1001
|
+
}
|
|
1002
|
+
/** How one role reads. The stroke is one screen pixel wide at any zoom. */
|
|
1003
|
+
interface PathOverlayStyle {
|
|
1004
|
+
fill?: CommandPaint;
|
|
1005
|
+
stroke?: CommandPaint;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* The kit's roles: `'chrome'` for a path shown for reference, `'picked'` for
|
|
1009
|
+
* one a gesture has taken, and `'remove'` for one it would delete.
|
|
1010
|
+
*/
|
|
1011
|
+
declare const PATH_OVERLAY_ROLES: Readonly<Record<string, PathOverlayStyle>>;
|
|
1012
|
+
/** The paths an overlay holds, and the layer that draws them. */
|
|
1013
|
+
interface PathOverlay {
|
|
1014
|
+
get(): readonly TransientPath[];
|
|
1015
|
+
/** Replace every path. */
|
|
1016
|
+
set(paths: readonly TransientPath[]): void;
|
|
1017
|
+
clear(): void;
|
|
1018
|
+
/** A world-space layer drawing the paths in order, repainting on each change. */
|
|
1019
|
+
layer: RenderLayer<unknown>;
|
|
1020
|
+
}
|
|
1021
|
+
/** Options for {@link createPathOverlay}. */
|
|
1022
|
+
interface PathOverlayOptions {
|
|
1023
|
+
/** The layer's id; see `RenderLayer.id`. */
|
|
1024
|
+
id: string;
|
|
1025
|
+
label?: string;
|
|
1026
|
+
/** Styles per role, merged over {@link PATH_OVERLAY_ROLES}. A role with
|
|
1027
|
+
* none paints as `'chrome'`. */
|
|
1028
|
+
roles?: Readonly<Record<string, PathOverlayStyle>>;
|
|
1029
|
+
}
|
|
1030
|
+
/** A store of transient paths and the layer that draws it; hand the layer to
|
|
1031
|
+
* a tool's `overlay` or a canvas's `layers`. */
|
|
1032
|
+
declare function createPathOverlay({ id, label, roles }: PathOverlayOptions): PathOverlay;
|
|
1033
|
+
|
|
1034
|
+
/** Cancel-key prefix. Each hook instance appends its own id, so two runners
|
|
1035
|
+
* sharing an animator do not cancel each other. */
|
|
1036
|
+
declare const VIEW_ANIMATION_KEY = "view";
|
|
1037
|
+
/** How the camera should move. */
|
|
1038
|
+
interface ViewAnimationOptions {
|
|
1039
|
+
/** Duration in ms. Default the `view.animationMs` kit setting, else `DEFAULT_VIEW_ANIMATION_MS`;
|
|
1040
|
+
* 0 under `prefers-reduced-motion`. */
|
|
1041
|
+
ms?: number;
|
|
1042
|
+
/** Easing curve. Default `easeOutCubic`. */
|
|
1043
|
+
easing?: EasingSpec;
|
|
1044
|
+
/** Replace the kit's log-scale / fixed-anchor curve. */
|
|
1045
|
+
interpolator?: InterpolatorFactory<View>;
|
|
1046
|
+
/** Fires when the target is reached. Not called on cancel. */
|
|
1047
|
+
onDone?: () => void;
|
|
1048
|
+
}
|
|
1049
|
+
/** Options accepted by {@link ViewAnimationApi.animateToBounds}. */
|
|
1050
|
+
interface AnimateToBoundsOptions extends FitViewToBoundsOptions, ViewAnimationOptions {
|
|
1051
|
+
}
|
|
1052
|
+
/** What the runner reads and writes. On `<SceneCanvas>` this is the same
|
|
1053
|
+
* channel `view.set` uses, so a camera animation on an uncontrolled canvas
|
|
1054
|
+
* costs no React render. */
|
|
1055
|
+
interface ViewChannel {
|
|
1056
|
+
get(): View;
|
|
1057
|
+
set(v: View): void;
|
|
1058
|
+
}
|
|
1059
|
+
/** The camera animation surface. Its own animations run one at a time. */
|
|
1060
|
+
interface ViewAnimationApi {
|
|
1061
|
+
/** Glide from the live view to `to`. A thunk receives the pending target when
|
|
1062
|
+
* one is in flight, so successive discrete steps compound. */
|
|
1063
|
+
animate(to: View | ((base: View) => View), opts?: ViewAnimationOptions): void;
|
|
1064
|
+
/** `fitViewToBounds` composed with `animate`. */
|
|
1065
|
+
animateToBounds(bounds: FramedBox, dims: ViewportDims, opts?: AnimateToBoundsOptions): void;
|
|
1066
|
+
/** Cancel. The view stays where it is — no jump to the target. */
|
|
1067
|
+
stop(): void;
|
|
1068
|
+
isAnimating(): boolean;
|
|
1069
|
+
/** Where the in-flight animation is heading, or null when none is. */
|
|
1070
|
+
target(): View | null;
|
|
1071
|
+
/** Cancel unless the write that prompted this came from the runner's own
|
|
1072
|
+
* per-frame write. Feed it from every channel that can move the camera. */
|
|
1073
|
+
stopIfExternal(): void;
|
|
1074
|
+
/**
|
|
1075
|
+
* The view as a {@link Target}, for running another animation on it: a shake
|
|
1076
|
+
* or a nudge adds to a camera animation in flight, and neither cancels the
|
|
1077
|
+
* other. Move it with the animator this runner was given, and without this
|
|
1078
|
+
* runner's cancel key. `stop` and an outside write leave such an animation
|
|
1079
|
+
* running.
|
|
1080
|
+
*/
|
|
1081
|
+
readonly viewTarget: Target<View>;
|
|
1082
|
+
}
|
|
1083
|
+
/** A `View` as the four numbers an animation moves: `x`, `y`, `scale.x`, `scale.y`. */
|
|
1084
|
+
declare const viewAxes: TargetAxes<View>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Animate the viewport `View`. Runs on the kit's {@link Animator} — pass one to
|
|
1087
|
+
* share a canvas's animator, or omit it and the hook makes its own. A caller
|
|
1088
|
+
* that always has one should use {@link useViewAnimationOn}, which builds none.
|
|
1089
|
+
*
|
|
1090
|
+
* Every animation from one instance registers under that instance's cancel key,
|
|
1091
|
+
* so starting one cancels whatever *it* had in flight, and each starts from where
|
|
1092
|
+
* the last one was rather than a captured value — an interrupted camera never jumps.
|
|
1093
|
+
* Two instances on one animator are independent. The view is a target
|
|
1094
|
+
* ({@link ViewAnimationApi.viewTarget}), so other animations can add to the camera's.
|
|
1095
|
+
*/
|
|
1096
|
+
declare function useViewAnimation(view: ViewChannel, animator?: Animator): ViewAnimationApi;
|
|
1097
|
+
/** {@link useViewAnimation} on an animator the caller owns. Constructs no
|
|
1098
|
+
* animator of its own, so the camera runs on exactly the one passed. */
|
|
1099
|
+
declare function useViewAnimationOn(view: ViewChannel, animator: Animator): ViewAnimationApi;
|
|
1100
|
+
|
|
1101
|
+
/** Paths drawn over the canvas until the function `show` returns is called.
|
|
1102
|
+
* A later `show` replaces what an earlier one drew, and the earlier one's
|
|
1103
|
+
* function then takes nothing down. */
|
|
1104
|
+
interface PreviewPathsDep {
|
|
1105
|
+
show(paths: readonly TransientPath[]): () => void;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/** The `snap` dep: what a drawn or dragged point locks to. */
|
|
1109
|
+
|
|
1110
|
+
type Point$4 = {
|
|
1111
|
+
x: number;
|
|
1112
|
+
y: number;
|
|
1113
|
+
};
|
|
1114
|
+
/** Geometry a gesture brings to snap to that is in no scene node: what stays
|
|
1115
|
+
* put of a path whose anchors it is dragging. World coords. */
|
|
1116
|
+
interface SnapGeometry {
|
|
1117
|
+
paths?: readonly Path[];
|
|
1118
|
+
/** Points to snap to as anchors. */
|
|
1119
|
+
anchors?: readonly Point$4[];
|
|
1120
|
+
}
|
|
1121
|
+
/** What builds a gesture's input subspace while `snap.constrain` is held:
|
|
1122
|
+
* an angle step in radians about `origin` (a rotate's every multiple of
|
|
1123
|
+
* it, required), an axis or 45° lock about the press, or a resize's
|
|
1124
|
+
* aspect. */
|
|
1125
|
+
type SnapConstrain = {
|
|
1126
|
+
step: number;
|
|
1127
|
+
} | 'aspect' | 'axis';
|
|
1128
|
+
/** The box a resize drags, as drawn, in its own frame. */
|
|
1129
|
+
interface SnapResizeBox {
|
|
1130
|
+
bounds: FramedBox;
|
|
1131
|
+
/** Its frame into ctx coordinates, an affine map. Default: the identity. */
|
|
1132
|
+
toWorld?: (p: Point$4) => Point$4;
|
|
1133
|
+
}
|
|
1134
|
+
/** What a gesture tells the snap dep when it starts. Points are ctx
|
|
1135
|
+
* coordinates: world in 2D. */
|
|
1136
|
+
interface SnapBegin {
|
|
1137
|
+
gesture: SnapGesture;
|
|
1138
|
+
press: Point$4;
|
|
1139
|
+
/** The subject, whose geometry offers no targets. */
|
|
1140
|
+
ids?: readonly string[];
|
|
1141
|
+
/** The container a subject not yet in the scene lands in: an insert's
|
|
1142
|
+
* target. Absent for the top of the tree, or a gesture with `ids`. */
|
|
1143
|
+
parent?: string;
|
|
1144
|
+
/** Resize: the sides the drag pins. An axis left `free` is an edge handle. */
|
|
1145
|
+
handle?: ResizeAnchor;
|
|
1146
|
+
/** Resize: the box `handle` belongs to. Default: the subject's drawn box,
|
|
1147
|
+
* axis-aligned. */
|
|
1148
|
+
box?: SnapResizeBox;
|
|
1149
|
+
/** Rotate, handle: the point the angle turns about. Default `press`. */
|
|
1150
|
+
pivot?: Point$4;
|
|
1151
|
+
/** Rotate: the subject's angle at press, radians. Default 0. */
|
|
1152
|
+
theta0?: number;
|
|
1153
|
+
/** Angle gestures: the reach as an angle, radians, in place of screen px
|
|
1154
|
+
* through the press radius; it overrides each source's `reachPx` and is
|
|
1155
|
+
* not capped. */
|
|
1156
|
+
reachRad?: number;
|
|
1157
|
+
/** Point gestures: the fixed end of what the gesture draws — a span's
|
|
1158
|
+
* start, the previous anchor, the anchor a handle pulls from. Tangent and
|
|
1159
|
+
* perpendicular targets are measured from it, a `constrain` step turns
|
|
1160
|
+
* about it, and no point target on it is offered. */
|
|
1161
|
+
origin?: Point$4;
|
|
1162
|
+
also?: SnapGeometry;
|
|
1163
|
+
constrain?: SnapConstrain;
|
|
1164
|
+
/** How the camera's world maps into the parallax plane the gesture's points
|
|
1165
|
+
* are in, read each frame; absent or null in the camera's own world. */
|
|
1166
|
+
plane?: () => PlaneMap | null;
|
|
1167
|
+
/** Sources asked for this gesture only, after the canvas's own, under the
|
|
1168
|
+
* same ranking; one sharing an id with a source still asked throws. Their
|
|
1169
|
+
* points are 2D world coordinates, so a 3D host does not take them. */
|
|
1170
|
+
sources?: readonly SnapSource[];
|
|
1171
|
+
/** Ids of sources this gesture does not ask: listed, registered or a
|
|
1172
|
+
* canvas default. */
|
|
1173
|
+
omit?: readonly string[];
|
|
1174
|
+
}
|
|
1175
|
+
/** The snap roles held this frame. */
|
|
1176
|
+
interface SnapMods {
|
|
1177
|
+
/** No source answers; the input subspace still applies. */
|
|
1178
|
+
suspend: boolean;
|
|
1179
|
+
constrain: boolean;
|
|
1180
|
+
/** Angle gestures: the angle stays at `theta0`, which becomes a required
|
|
1181
|
+
* target. */
|
|
1182
|
+
hold?: boolean;
|
|
1183
|
+
}
|
|
1184
|
+
/** Where a session put one frame's point, and the marks to draw for it. */
|
|
1185
|
+
interface SnapOutcome {
|
|
1186
|
+
point: Point$4;
|
|
1187
|
+
/** Whether some target holds the point. */
|
|
1188
|
+
held: boolean;
|
|
1189
|
+
marks: readonly SnapMark[];
|
|
1190
|
+
}
|
|
1191
|
+
/** One gesture's snapping, from press to release. */
|
|
1192
|
+
interface SnapSession {
|
|
1193
|
+
/** Where `p` lands. */
|
|
1194
|
+
at(p: Point$4, mods: SnapMods): SnapOutcome;
|
|
1195
|
+
/** Where the angle `theta` (radians, about `pivot`) lands. */
|
|
1196
|
+
angle(theta: number, mods: SnapMods): {
|
|
1197
|
+
theta: number;
|
|
1198
|
+
marks: readonly SnapMark[];
|
|
1199
|
+
};
|
|
1200
|
+
/** Clears the gesture's marks. */
|
|
1201
|
+
end(): void;
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Snapping, for every gesture that snaps: each one begins a session at press
|
|
1205
|
+
* and asks it, frame by frame, where its point lands. Points are ctx
|
|
1206
|
+
* coordinates — world in 2D, screen in a 3D host.
|
|
1207
|
+
*/
|
|
1208
|
+
interface SnapDep {
|
|
1209
|
+
/** Start a gesture's snap session. */
|
|
1210
|
+
begin(req: SnapBegin): SnapSession;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/** The snap source contract: what a target set offers a snap session, and
|
|
1214
|
+
* the marks a session draws for what it met. */
|
|
1215
|
+
|
|
1216
|
+
type Point$3 = {
|
|
1217
|
+
x: number;
|
|
1218
|
+
y: number;
|
|
1219
|
+
};
|
|
1220
|
+
/** The positions a target allows: `at` plus any combination of `dirs`. No
|
|
1221
|
+
* dirs is a point, one a line, two a plane. */
|
|
1222
|
+
interface Locus<P = Point$3> {
|
|
1223
|
+
at: P;
|
|
1224
|
+
dirs: readonly P[];
|
|
1225
|
+
/** One interval per dir, in multiples of it: a segment or a bounded face. */
|
|
1226
|
+
span?: readonly (readonly [number, number])[];
|
|
1227
|
+
}
|
|
1228
|
+
/** One locus a source offers one probe. */
|
|
1229
|
+
interface SourceCandidate<P = Point$3> {
|
|
1230
|
+
/** The id of a probe the source was offered. */
|
|
1231
|
+
probe: string;
|
|
1232
|
+
locus: Locus<P>;
|
|
1233
|
+
/** The result must meet one required candidate, whatever its reach. */
|
|
1234
|
+
required?: boolean;
|
|
1235
|
+
/** Drawn when the result meets this candidate. A function is handed the
|
|
1236
|
+
* resolved move, so the marks can sit where the probe landed. */
|
|
1237
|
+
mark?: SnapMarks<P> | ((delta: P) => SnapMarks<P>);
|
|
1238
|
+
}
|
|
1239
|
+
/** `'handle'` is an angle about an anchor, as `'rotate'` is about a pivot,
|
|
1240
|
+
* but asks only sources that name it. */
|
|
1241
|
+
type SnapGesture = 'point' | 'move' | 'resize' | 'rotate' | 'handle';
|
|
1242
|
+
/** The sides of a box a gesture moves on one axis; null for neither. */
|
|
1243
|
+
type SnapEdge = 'min' | 'max' | 'both' | null;
|
|
1244
|
+
/** Which sides of the subject's box a gesture moves, per axis. */
|
|
1245
|
+
interface SnapEdges {
|
|
1246
|
+
x: SnapEdge;
|
|
1247
|
+
y: SnapEdge;
|
|
1248
|
+
}
|
|
1249
|
+
/** A point on the subject that should land on a locus. */
|
|
1250
|
+
interface SnapProbeAt<P = Point$3> {
|
|
1251
|
+
id: string;
|
|
1252
|
+
at: P;
|
|
1253
|
+
role: ProbeRole;
|
|
1254
|
+
}
|
|
1255
|
+
/** What a session asks a source for, once per frame. */
|
|
1256
|
+
interface SnapCollect<P = Point$3> {
|
|
1257
|
+
gesture: SnapGesture;
|
|
1258
|
+
/** The probes this source matches, where the unsnapped gesture puts them. */
|
|
1259
|
+
probes: readonly SnapProbeAt<P>[];
|
|
1260
|
+
/** The unsnapped move from the press. A probe at `at` here lands at
|
|
1261
|
+
* `at - delta0 + delta` for the resolved `delta` a function mark gets. */
|
|
1262
|
+
delta0: P;
|
|
1263
|
+
/** The subject's drawn box, stroke included, where the unsnapped gesture
|
|
1264
|
+
* puts it: a move's union of boxes, or the box a resize drags. Absent for
|
|
1265
|
+
* other gestures. */
|
|
1266
|
+
box?: FramedBox;
|
|
1267
|
+
/** Which sides of `box` the gesture moves on each axis. Default: both, as
|
|
1268
|
+
* a move does. */
|
|
1269
|
+
edges?: SnapEdges;
|
|
1270
|
+
/** `id`'s drawn box, measured as `box` is. Absent in a host with no 2D
|
|
1271
|
+
* scene. */
|
|
1272
|
+
drawnBox?(id: string): FramedBox | undefined;
|
|
1273
|
+
/** The subject: the nodes the gesture moves or resizes. Absent for a
|
|
1274
|
+
* gesture with none, such as drawing a new shape. */
|
|
1275
|
+
ids?: readonly string[];
|
|
1276
|
+
/** Where a gesture with no subject yet puts what it draws: the container a
|
|
1277
|
+
* new node lands in. Absent for the top of the tree. */
|
|
1278
|
+
parent?: string;
|
|
1279
|
+
/** Nodes that offer no targets: what the gesture moves. */
|
|
1280
|
+
exclude: readonly string[];
|
|
1281
|
+
/** Only these nodes offer targets. */
|
|
1282
|
+
include?: readonly string[];
|
|
1283
|
+
/** Where the geometry being drawn starts; tangent and perpendicular targets
|
|
1284
|
+
* are measured from it. */
|
|
1285
|
+
origin?: P;
|
|
1286
|
+
also?: SnapGeometry;
|
|
1287
|
+
/** `px` screen pixels as world units: a radius to cull targets by. */
|
|
1288
|
+
reachWorld(px: number): number;
|
|
1289
|
+
/** The reach, in screen px, the session applies to this source: its own
|
|
1290
|
+
* `reachPx`, else the canvas's. Candidates past it are dropped anyway. */
|
|
1291
|
+
reachPx: number;
|
|
1292
|
+
/** Absent in a host with no 2D scene. */
|
|
1293
|
+
scene?: Scene<unknown, string, unknown>;
|
|
1294
|
+
/** How the camera's world maps into the parallax plane the probes are in.
|
|
1295
|
+
* Absent in the camera's own world. A target the camera draws, a grid or
|
|
1296
|
+
* a ruler guide, is carried through it. */
|
|
1297
|
+
plane?: PlaneMap | null;
|
|
1298
|
+
}
|
|
1299
|
+
/** What a rotate or handle drag asks a source for, once per frame. Angles
|
|
1300
|
+
* are radians about `pivot`, in the frame `rotationOf` reads. */
|
|
1301
|
+
interface AngleCollect {
|
|
1302
|
+
pivot: Point$3;
|
|
1303
|
+
/** Where the gesture was pressed: its distance from `pivot` is the radius
|
|
1304
|
+
* the default marks are drawn at. */
|
|
1305
|
+
press: Point$3;
|
|
1306
|
+
/** The angle at press. */
|
|
1307
|
+
theta0: number;
|
|
1308
|
+
/** The unsnapped angle now. */
|
|
1309
|
+
theta: number;
|
|
1310
|
+
/** The subject. */
|
|
1311
|
+
ids: readonly string[];
|
|
1312
|
+
/** Nodes that offer no targets: the subject and everything under it. */
|
|
1313
|
+
exclude: readonly string[];
|
|
1314
|
+
mods: SnapMods;
|
|
1315
|
+
also?: SnapGeometry;
|
|
1316
|
+
/** Absent in a host with no 2D scene. */
|
|
1317
|
+
scene?: Scene<unknown, string, unknown>;
|
|
1318
|
+
/** `id`'s world rotation, read as the subject's is; undefined for a node
|
|
1319
|
+
* that cannot turn. */
|
|
1320
|
+
rotationOf?(id: string): number | undefined;
|
|
1321
|
+
}
|
|
1322
|
+
/** An angle a source offers. The session compares it round the circle, so
|
|
1323
|
+
* any whole turn of it is the same target. */
|
|
1324
|
+
interface AngleCandidate {
|
|
1325
|
+
angle: number;
|
|
1326
|
+
/** The result must land on one required angle, whatever its reach. */
|
|
1327
|
+
required?: boolean;
|
|
1328
|
+
/** Drawn when the result lands on it. Default: a ray from the pivot along
|
|
1329
|
+
* the snapped angle, labeled in degrees. */
|
|
1330
|
+
mark?: SnapMarks;
|
|
1331
|
+
}
|
|
1332
|
+
/** A set of snap targets. */
|
|
1333
|
+
interface SnapSource<P = Point$3> {
|
|
1334
|
+
id: string;
|
|
1335
|
+
/** Default `'target'`. A fallback never displaces a target in reach. */
|
|
1336
|
+
tier?: SnapTier;
|
|
1337
|
+
/** Overrides the canvas's reach for this source, in screen px. */
|
|
1338
|
+
reachPx?: number;
|
|
1339
|
+
/** The probe roles it matches; it is never offered a probe of another. */
|
|
1340
|
+
roles: readonly ProbeRole[];
|
|
1341
|
+
/** Default: every gesture but `'rotate'` and `'handle'`. */
|
|
1342
|
+
gestures?: readonly SnapGesture[];
|
|
1343
|
+
collect(q: SnapCollect<P>): Iterable<SourceCandidate<P>>;
|
|
1344
|
+
/** Angle targets, for a source whose `gestures` include `'rotate'` or `'handle'`. */
|
|
1345
|
+
angles?(q: AngleCollect): Iterable<AngleCandidate>;
|
|
1346
|
+
}
|
|
1347
|
+
/** One mark, or several, for one candidate. */
|
|
1348
|
+
type SnapMarks<P = Point$3> = SnapMark<P> | readonly SnapMark<P>[];
|
|
1349
|
+
/** What a session draws for a candidate the result meets. World coords. */
|
|
1350
|
+
type SnapMark<P = Point$3> = {
|
|
1351
|
+
kind: 'point';
|
|
1352
|
+
at: P;
|
|
1353
|
+
glyph: string;
|
|
1354
|
+
label?: string;
|
|
1355
|
+
color?: string;
|
|
1356
|
+
} | {
|
|
1357
|
+
kind: 'line';
|
|
1358
|
+
from: P;
|
|
1359
|
+
to: P;
|
|
1360
|
+
color?: string;
|
|
1361
|
+
} | {
|
|
1362
|
+
kind: 'gap';
|
|
1363
|
+
from: P;
|
|
1364
|
+
to: P;
|
|
1365
|
+
value: number;
|
|
1366
|
+
color?: string;
|
|
1367
|
+
} | {
|
|
1368
|
+
kind: 'distance';
|
|
1369
|
+
from: P;
|
|
1370
|
+
to: P;
|
|
1371
|
+
value: number;
|
|
1372
|
+
color?: string;
|
|
1373
|
+
};
|
|
1374
|
+
/** `<SceneCanvas snap>`. */
|
|
1375
|
+
interface SceneCanvasSnap {
|
|
1376
|
+
/** Sources ahead of the presets' `snapSources` and any `useSnapSource`.
|
|
1377
|
+
* One source per id is asked: the last listed, in the order prop,
|
|
1378
|
+
* presets, `useSnapSource` in mount order. A canvas default (`'rotation'`,
|
|
1379
|
+
* `'path-snap'`) loses to any of them. */
|
|
1380
|
+
sources?: readonly SnapSource[];
|
|
1381
|
+
/** Ids of canvas defaults to leave out: `'rotation'` stops a rotate
|
|
1382
|
+
* snapping to quarter turns and other nodes' angles (Shift's step is the
|
|
1383
|
+
* rotate's own and stays), and `'path-snap'` stops a point gesture (the
|
|
1384
|
+
* pen, an anchor drag, a drawn line's ends, a measurement) snapping to
|
|
1385
|
+
* other nodes' anchors. */
|
|
1386
|
+
omit?: readonly string[];
|
|
1387
|
+
/** The reach of a source that sets none, in screen px. Default: the kit
|
|
1388
|
+
* setting `targets.snapPx`. */
|
|
1389
|
+
reachPx?: number;
|
|
1390
|
+
/** How a pose's origin is read, for the `origin` probe a grid or a ruler
|
|
1391
|
+
* guide snaps: a pose neither a rect nor a `Path` needs its own. Default
|
|
1392
|
+
* `AUTO_ORIGIN_PROJECTION`. */
|
|
1393
|
+
originProjection?: OriginProjection<unknown>;
|
|
1394
|
+
/** Whether the canvas draws the snap marks. Default `true`. With `false`
|
|
1395
|
+
* the marks are still written to the `snapReadout` dep's store, for a
|
|
1396
|
+
* layer of the consumer's own. */
|
|
1397
|
+
readout?: boolean;
|
|
1398
|
+
/** The readout's default colors and line width, for a mark that sets no `color`. */
|
|
1399
|
+
readoutStyle?: SnapReadoutStyle;
|
|
1400
|
+
}
|
|
1401
|
+
/** The snap readout's colors and line width, for a mark that sets no `color`. */
|
|
1402
|
+
interface SnapReadoutStyle {
|
|
1403
|
+
/** Points, lines and their labels. Default orange, as the path marker. */
|
|
1404
|
+
color?: string;
|
|
1405
|
+
/** Gap and distance marks. Default blue, as the guides. */
|
|
1406
|
+
gapColor?: string;
|
|
1407
|
+
/** Stroke width in screen px. Default 1. */
|
|
1408
|
+
lineWidth?: number;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
type Point$2 = {
|
|
1412
|
+
x: number;
|
|
1413
|
+
y: number;
|
|
1414
|
+
};
|
|
1415
|
+
/** The marks of the snap in flight, for the readout to draw. */
|
|
1416
|
+
interface SnapOutcomeStore<P = Point$2> {
|
|
1417
|
+
get(): readonly SnapMark<P>[];
|
|
1418
|
+
set(marks: readonly SnapMark<P>[]): void;
|
|
1419
|
+
subscribe(listener: () => void): () => void;
|
|
1420
|
+
}
|
|
1421
|
+
/** An empty outcome store, which notifies only when the marks change. */
|
|
1422
|
+
declare function createSnapOutcomeStore<P = Point$2>(): SnapOutcomeStore<P>;
|
|
1423
|
+
|
|
1424
|
+
/** The `snapReadout` dep: where marks go to be drawn. */
|
|
1425
|
+
interface SnapReadoutDep {
|
|
1426
|
+
store: SnapOutcomeStore;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Consumer-supplied node factory for one insert `kind`. Given the drag AABB
|
|
1431
|
+
* and the tool's `extras`, returns the node's `data` (in the consumer's own
|
|
1432
|
+
* data shape) plus an optional `pose` override — the dep supplies id, layer,
|
|
1433
|
+
* and the undoable insert op. Return `null` to reject the insert.
|
|
1434
|
+
*
|
|
1435
|
+
* A factory registered for a kit kind (`rect`, `line`, …) fully replaces the
|
|
1436
|
+
* kit's default `{ path, fill }` factory for that kind; a factory for a novel
|
|
1437
|
+
* kind adds support the kit doesn't ship (e.g. `text`). To change only the
|
|
1438
|
+
* paint of a kit shape, pass an {@link InsertPaint}. See
|
|
1439
|
+
* `SceneCanvas`'s `insertNodeFactories` prop.
|
|
1440
|
+
*/
|
|
1441
|
+
type InsertNodeFactory = (bounds: {
|
|
1442
|
+
x: number;
|
|
1443
|
+
y: number;
|
|
1444
|
+
width: number;
|
|
1445
|
+
height: number;
|
|
1446
|
+
}, extras: InsertExtras) => {
|
|
1447
|
+
data: unknown;
|
|
1448
|
+
pose?: unknown;
|
|
1449
|
+
} | null;
|
|
1450
|
+
/**
|
|
1451
|
+
* The paint a kit-built shape is inserted with. `kind` is the shape being
|
|
1452
|
+
* built and `seq` counts this canvas's inserts from 1. A key left out stays
|
|
1453
|
+
* off the node, so its painter's default applies; `null` is "none". A pencil
|
|
1454
|
+
* trail too short to fit is built as a rect and asks as one. A line and an
|
|
1455
|
+
* open pen path are inserted unfilled: a fill given to either is dropped.
|
|
1456
|
+
* `fillRule` is the rule a path that carries one is built with, where the
|
|
1457
|
+
* kit's own is nonzero; a rect or an ellipse has none to set.
|
|
1458
|
+
*
|
|
1459
|
+
* It paints only the shapes the kit builds: an `InsertNodeFactory` owns its
|
|
1460
|
+
* node's whole `data`. See `SceneCanvas`'s `insertPaint` prop.
|
|
1461
|
+
*/
|
|
1462
|
+
type InsertPaint = (kind: string, seq: number) => {
|
|
1463
|
+
fill?: Fill | null;
|
|
1464
|
+
stroke?: Stroke | null;
|
|
1465
|
+
fillRule?: PathFillRule;
|
|
1466
|
+
};
|
|
1467
|
+
/** The default {@link InsertPaint}: the next color of the kit palette, as a
|
|
1468
|
+
* fill on a closed shape, a fill and a stroke on a pen path, and a stroke
|
|
1469
|
+
* alone on a line or a pencil trail. */
|
|
1470
|
+
declare const paletteInsertPaint: InsertPaint;
|
|
1471
|
+
|
|
1472
|
+
/** The `data` a `kit:text` node carries. */
|
|
1473
|
+
interface TextNodeData {
|
|
1474
|
+
text: string;
|
|
1475
|
+
style?: TextStyle;
|
|
1476
|
+
runs?: readonly StyledRun[];
|
|
1477
|
+
fill?: Fill | null;
|
|
1478
|
+
stroke?: Stroke | null;
|
|
1479
|
+
verticalAlign?: TextVerticalAlign;
|
|
1480
|
+
/** Paint for the whole pose box, drawn under the glyphs. `fill` is the
|
|
1481
|
+
* glyphs' own paint, so a box behind them needs a key of its own. */
|
|
1482
|
+
background?: Fill | null;
|
|
1483
|
+
/** World units between the pose box and the box the text lays out in, on
|
|
1484
|
+
* every side. */
|
|
1485
|
+
padding?: number;
|
|
1486
|
+
/** What happens to text that runs past the pose box: `'visible'` (the
|
|
1487
|
+
* default) draws it there, `'clip'` cuts it at the box's edge. */
|
|
1488
|
+
overflow?: TextOverflow;
|
|
1489
|
+
}
|
|
1490
|
+
/** How a text node treats lines that run past its box. */
|
|
1491
|
+
type TextOverflow = 'visible' | 'clip';
|
|
1492
|
+
/** The box a text node's lines lay out in: its pose box, inset by
|
|
1493
|
+
* `data.padding` and never past its center. */
|
|
1494
|
+
declare function textBoxOf(d: Pick<TextNodeData, 'padding'>, p: RectPose): {
|
|
1495
|
+
x: number;
|
|
1496
|
+
y: number;
|
|
1497
|
+
width: number;
|
|
1498
|
+
height: number;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
/** The smallest box a node may be drawn or resized to, in world units. */
|
|
1502
|
+
interface MinSize {
|
|
1503
|
+
width: number;
|
|
1504
|
+
height: number;
|
|
1505
|
+
}
|
|
1506
|
+
/** A node's minimum, from `data.minSize`, or `null` when it has none. A
|
|
1507
|
+
* side that is not a positive number holds nothing. */
|
|
1508
|
+
declare function minSizeOf(data: unknown): MinSize | null;
|
|
1509
|
+
|
|
1510
|
+
/** How a sticky note looks as it is made, named as the text node it becomes
|
|
1511
|
+
* names them. Every field but `fill` has a default, in {@link STICKY_DEFAULTS}. */
|
|
1512
|
+
interface StickyStyle {
|
|
1513
|
+
/** The note itself, painted over its whole box. */
|
|
1514
|
+
background?: Fill;
|
|
1515
|
+
/** The text's paint. Absent, the text style's default. */
|
|
1516
|
+
fill?: Fill;
|
|
1517
|
+
/** World units from the note's edge to its text, on every side. */
|
|
1518
|
+
padding?: number;
|
|
1519
|
+
/** Typography for the note's text. */
|
|
1520
|
+
style?: TextStyle;
|
|
1521
|
+
verticalAlign?: TextVerticalAlign;
|
|
1522
|
+
/** What happens to text that outgrows the note. */
|
|
1523
|
+
overflow?: TextOverflow;
|
|
1524
|
+
/** The smallest note a drag makes or a resize leaves, in world units. */
|
|
1525
|
+
minSize?: MinSize;
|
|
1526
|
+
/** The note a click makes, centered on the click, in world units. A drag
|
|
1527
|
+
* makes the note it draws. */
|
|
1528
|
+
size?: {
|
|
1529
|
+
width: number;
|
|
1530
|
+
height: number;
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
/** The look a sticky note takes for any field its tool leaves out. */
|
|
1534
|
+
declare const STICKY_DEFAULTS: {
|
|
1535
|
+
readonly background: {
|
|
1536
|
+
readonly paint: {
|
|
1537
|
+
readonly kind: "solid";
|
|
1538
|
+
readonly color: "#fff1a6ff";
|
|
1539
|
+
};
|
|
1540
|
+
};
|
|
1541
|
+
readonly padding: 12;
|
|
1542
|
+
readonly style: {
|
|
1543
|
+
readonly fontSize: 18;
|
|
1544
|
+
readonly align: "center";
|
|
1545
|
+
readonly wrap: true;
|
|
1546
|
+
};
|
|
1547
|
+
readonly verticalAlign: "center";
|
|
1548
|
+
readonly overflow: "clip";
|
|
1549
|
+
readonly minSize: {
|
|
1550
|
+
readonly width: 48;
|
|
1551
|
+
readonly height: 48;
|
|
1552
|
+
};
|
|
1553
|
+
readonly size: {
|
|
1554
|
+
readonly width: 160;
|
|
1555
|
+
readonly height: 160;
|
|
1556
|
+
};
|
|
1557
|
+
};
|
|
1558
|
+
/**
|
|
1559
|
+
* A sticky note's `data`: a text node with a `background`, so the `kit:text`
|
|
1560
|
+
* painter draws it and the text editor edits it with no sticky case of its
|
|
1561
|
+
* own. `look` is the `sticky` insert's extras, which carry the tool's
|
|
1562
|
+
* {@link StickyStyle}.
|
|
1563
|
+
*/
|
|
1564
|
+
declare function stickyData(look: StickyStyle & {
|
|
1565
|
+
text?: string;
|
|
1566
|
+
}): TextNodeData & {
|
|
1567
|
+
minSize: MinSize;
|
|
1568
|
+
};
|
|
1569
|
+
/** The kit's `sticky` insert as an `InsertNodeFactory`, for a canvas that
|
|
1570
|
+
* wraps it — to tag the data with a `kind`, say — under `insertNodeFactories`. */
|
|
1571
|
+
declare const stickyNodeFactory: InsertNodeFactory;
|
|
1572
|
+
|
|
1573
|
+
/** Per-axis limits on a view's position. Any side may be left open. */
|
|
1574
|
+
interface PanBounds {
|
|
1575
|
+
minX?: number;
|
|
1576
|
+
maxX?: number;
|
|
1577
|
+
minY?: number;
|
|
1578
|
+
maxY?: number;
|
|
1579
|
+
}
|
|
1580
|
+
/** Momentum settings for a pan: how quickly a flung view slows, when it stops,
|
|
1581
|
+
* and what happens at the pan limits. The `DecayLoopConfig` fields a caller
|
|
1582
|
+
* chooses up front, without the per-gesture `velocity` / `onTick`. */
|
|
1583
|
+
interface InertiaConfig {
|
|
1584
|
+
friction?: number;
|
|
1585
|
+
minSpeed?: number;
|
|
1586
|
+
/** What to do when inertial pan reaches `bounds`. Default: no clamping. */
|
|
1587
|
+
boundary?: 'stop' | 'bounce' | 'spring';
|
|
1588
|
+
/** View-coordinate limits for boundary clamping. Requires `boundary` to take effect. */
|
|
1589
|
+
bounds?: PanBounds;
|
|
1590
|
+
}
|
|
1591
|
+
/** How a decay should run: its starting velocity, how fast it slows, and what
|
|
1592
|
+
* happens if it reaches the pan limits. */
|
|
1593
|
+
interface DecayLoopConfig {
|
|
1594
|
+
velocity: {
|
|
1595
|
+
vx: number;
|
|
1596
|
+
vy: number;
|
|
1597
|
+
};
|
|
1598
|
+
friction?: number;
|
|
1599
|
+
minSpeed?: number;
|
|
1600
|
+
/** Bounds for boundary clamping. Requires `boundary` to take effect. */
|
|
1601
|
+
viewBounds?: PanBounds;
|
|
1602
|
+
/**
|
|
1603
|
+
* What to do when the accumulated position hits `viewBounds`. Default: no clamping.
|
|
1604
|
+
* - `'stop'`: clamp at boundary, kill velocity component.
|
|
1605
|
+
* - `'bounce'`: linear reflection — flip velocity sign, magnitude preserved.
|
|
1606
|
+
* - `'spring'`: damped reflection — flip velocity sign and shrink magnitude
|
|
1607
|
+
* by `SPRING_DAMPING` per bounce so the motion settles naturally.
|
|
1608
|
+
*/
|
|
1609
|
+
boundary?: 'stop' | 'bounce' | 'spring';
|
|
1610
|
+
/** Starting position for internal boundary tracking. Required when `viewBounds` is set. */
|
|
1611
|
+
initialPosition?: {
|
|
1612
|
+
x: number;
|
|
1613
|
+
y: number;
|
|
1614
|
+
};
|
|
1615
|
+
onTick: (dx: number, dy: number) => void;
|
|
1616
|
+
onEnd?: () => void;
|
|
1617
|
+
}
|
|
1618
|
+
/** A rAF loop that coasts a value to a stop under friction, reporting the
|
|
1619
|
+
* per-frame delta. What turns a released pan drag into momentum scrolling. */
|
|
1620
|
+
declare function useDecayLoop(): {
|
|
1621
|
+
start: (config: DecayLoopConfig) => void;
|
|
1622
|
+
cancel: () => void;
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
/** A node as a transform frame previews it: its stored pose, and its data where that changes. */
|
|
1626
|
+
interface TransformPreviewNode {
|
|
1627
|
+
id: string;
|
|
1628
|
+
pose: unknown;
|
|
1629
|
+
data?: unknown;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Something that changes other nodes along with a whole-node transform — a
|
|
1633
|
+
* move, resize, rotate, flip, align, distribute, or nudge. The
|
|
1634
|
+
* `transformFollowers` dep holds every one, and each transform runs them all,
|
|
1635
|
+
* in order.
|
|
1636
|
+
*/
|
|
1637
|
+
interface TransformFollower {
|
|
1638
|
+
/** The other nodes a drag's frame changes, given the stored pose the frame
|
|
1639
|
+
* puts each transformed node in: what `finish` would commit for it.
|
|
1640
|
+
* `data` holds the data the followers before this one previewed, by id. */
|
|
1641
|
+
preview(frame: ReadonlyMap<string, unknown>, data: ReadonlyMap<string, unknown>): readonly TransformPreviewNode[];
|
|
1642
|
+
/** `ops`, the batch so far, with this follower's ops added after it; null
|
|
1643
|
+
* when it refuses the transform. */
|
|
1644
|
+
finish(ops: readonly Op[], label: string): Op[] | null;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* The lifecycle the ongoing transform actions (`move`, `resize`, `rotate`)
|
|
1649
|
+
* share: what their committed batch is called in history, whether it is
|
|
1650
|
+
* recorded at all, and the callbacks fired as the gesture opens and closes.
|
|
1651
|
+
*
|
|
1652
|
+
* Move and rotate read it from their binding's params; resize reads it from
|
|
1653
|
+
* the `resizePolicy` dep, where the rest of its options already live.
|
|
1654
|
+
*/
|
|
1655
|
+
|
|
1656
|
+
/** The lifecycle options, as a binding's params or the resize policy carry
|
|
1657
|
+
* them. */
|
|
1658
|
+
interface GestureLifecycleOptions {
|
|
1659
|
+
/** History label for the committed batch. Unset, the batch takes its first
|
|
1660
|
+
* op's label (a layout drop or a behavior names its own), else the
|
|
1661
|
+
* action's. */
|
|
1662
|
+
label?: string;
|
|
1663
|
+
/** Commit through `scene.untracked`: the edit lands, but no undo entry
|
|
1664
|
+
* records it and the consumer `applyOps` hook is bypassed. Unset, any
|
|
1665
|
+
* behavior's `defaultTransient: true` turns it on. */
|
|
1666
|
+
transient?: boolean;
|
|
1667
|
+
/** Fired once the gesture starts changing poses, with the ids it moves. */
|
|
1668
|
+
onGestureStart?(ids: string[]): void;
|
|
1669
|
+
/** Fired once per `onGestureStart`: `true` when the gesture wrote to the
|
|
1670
|
+
* document, `false` on cancel, abort, or a release with nothing to write. */
|
|
1671
|
+
onGestureEnd?(committed: boolean): void;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/** Optional consumer seam: given a node and the affine `m` that a pose-transform
|
|
1675
|
+
* action applied to the node's POSE, return updated `data` with the node's
|
|
1676
|
+
* data-held geometry transformed by `m`, or `null` if this node has no
|
|
1677
|
+
* data-held geometry (the kit leaves `data` alone). */
|
|
1678
|
+
interface GeometryProjection {
|
|
1679
|
+
transform(node: {
|
|
1680
|
+
id?: string;
|
|
1681
|
+
data: unknown;
|
|
1682
|
+
pose: unknown;
|
|
1683
|
+
}, m: Affine): unknown | null;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/** What a handle drag holds fixed: its direction from the anchor, or its length. */
|
|
1687
|
+
type HandleLock = 'angle' | 'length';
|
|
1688
|
+
/** Which handle locks are held for every handle drag, on top of the modifiers.
|
|
1689
|
+
* Both together freeze the handle. */
|
|
1690
|
+
interface HandleLocks {
|
|
1691
|
+
angle: boolean;
|
|
1692
|
+
length: boolean;
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* The params `editAnchors` reads, through `<SceneCanvas tune>` or a binding.
|
|
1696
|
+
* Read on every move, so a change mid-drag reaches the drag.
|
|
1697
|
+
*/
|
|
1698
|
+
type EditAnchorsParams = {
|
|
1699
|
+
/** A lock held for every handle drag without a modifier: Shift holds the
|
|
1700
|
+
* angle, Mod (Cmd or Ctrl) the length. Under `<SceneCanvas>` this is where
|
|
1701
|
+
* the `handleLock.angle` and `handleLock.length` toggles start from; once
|
|
1702
|
+
* one is pressed, the locks the `editAnchors` dep holds decide. */
|
|
1703
|
+
handleLock?: HandleLock | null;
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* A path drawn from another form the node keeps beside it, such as a curve
|
|
1708
|
+
* solved through the points it passes. The node's path stays the geometry
|
|
1709
|
+
* every reader draws and hit-tests; `data.representation` holds the form,
|
|
1710
|
+
* named by its `kind`. A preset that knows a kind brings a
|
|
1711
|
+
* {@link PathRepresentation} for it (`PathEditExtension.representation`),
|
|
1712
|
+
* through which path edit shows and edits the form. Where none is on, path
|
|
1713
|
+
* edit edits the drawn path, and the edit drops the form.
|
|
1714
|
+
*/
|
|
1715
|
+
|
|
1716
|
+
/** What `data.representation` holds: a form named by `kind`, with whatever
|
|
1717
|
+
* that kind keeps. */
|
|
1718
|
+
interface PathForm {
|
|
1719
|
+
readonly kind: string;
|
|
1720
|
+
readonly [field: string]: unknown;
|
|
1721
|
+
}
|
|
1722
|
+
type Point$1 = {
|
|
1723
|
+
x: number;
|
|
1724
|
+
y: number;
|
|
1725
|
+
};
|
|
1726
|
+
/** The outline of an anchor's marker, in screen space: `size` px across at
|
|
1727
|
+
* `at`, with the anchor's neighbors along its subpath, null past an open
|
|
1728
|
+
* end. */
|
|
1729
|
+
type AnchorMarkerShape = (at: Point$1, size: number, prev: Point$1 | null, next: Point$1 | null) => PolygonPath;
|
|
1730
|
+
/** How path edit reads and writes one kind of {@link PathForm}. */
|
|
1731
|
+
interface PathRepresentation {
|
|
1732
|
+
/** The `kind` of the forms it reads. */
|
|
1733
|
+
readonly kind: string;
|
|
1734
|
+
/** What path edit shows and moves for a node holding `form`, whose drawn
|
|
1735
|
+
* path in world space is `path`. Null when `form` does not describe
|
|
1736
|
+
* `path`: path edit then edits `path`, and the edit drops the form. */
|
|
1737
|
+
editPath(path: PolygonPath, form: PathForm): PolygonPath | null;
|
|
1738
|
+
/**
|
|
1739
|
+
* The drawn path an edit makes, and the form to keep beside it: `edited` is
|
|
1740
|
+
* an edit of what {@link editPath} gave, `path` the drawn path it was given
|
|
1741
|
+
* from. Null when `form` does not describe `path`; the edit is then stored
|
|
1742
|
+
* as drawn, without the form. Runs on every commit of an edit and every
|
|
1743
|
+
* frame of one in flight.
|
|
1744
|
+
*/
|
|
1745
|
+
store(path: PolygonPath, form: PathForm, edited: PolygonPath): {
|
|
1746
|
+
path: PolygonPath;
|
|
1747
|
+
form: PathForm;
|
|
1748
|
+
} | null;
|
|
1749
|
+
/** The marker of each anchor of the edit path, by flat index. An anchor
|
|
1750
|
+
* with none draws path edit's square. */
|
|
1751
|
+
anchorMarkers?(form: PathForm): readonly (AnchorMarkerShape | null)[];
|
|
1752
|
+
/**
|
|
1753
|
+
* A press at world point `at` on the drawn outline of the node in path
|
|
1754
|
+
* edit: the drag it starts, or null when it starts none there. A
|
|
1755
|
+
* representation that has this takes every segment press, in place of
|
|
1756
|
+
* Bend segment.
|
|
1757
|
+
*/
|
|
1758
|
+
segmentPress?(deps: ActionDeps, at: Point$1): (() => OngoingHandle) | null;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* What a feature adds to path edit without path edit knowing it: marks drawn
|
|
1763
|
+
* on the open path, parts of it to press, marks a click selects and Delete
|
|
1764
|
+
* removes, a share in shaping an anchor or handle drag, what an edit must keep
|
|
1765
|
+
* true when it commits, and how a path drawn from another form is edited. A
|
|
1766
|
+
* preset carries its extensions as `FeaturePreset.pathEdit`; core consults
|
|
1767
|
+
* them in preset order.
|
|
1768
|
+
*/
|
|
1769
|
+
|
|
1770
|
+
/** A mark an extension drew that is selected in place of anchors: Delete
|
|
1771
|
+
* acts on it, and selecting anchors clears it. */
|
|
1772
|
+
interface PathEditMark {
|
|
1773
|
+
/** The extension that drew it. */
|
|
1774
|
+
owner: string;
|
|
1775
|
+
/** Which of its marks, in the extension's own numbering. */
|
|
1776
|
+
index: number;
|
|
1777
|
+
}
|
|
1778
|
+
/** The open path as an extension's marks and parts read it. */
|
|
1779
|
+
interface PathEditTarget {
|
|
1780
|
+
/** The node being edited. */
|
|
1781
|
+
id: string;
|
|
1782
|
+
/** Its committed pose and data. */
|
|
1783
|
+
node: {
|
|
1784
|
+
pose: unknown;
|
|
1785
|
+
data: unknown;
|
|
1786
|
+
};
|
|
1787
|
+
/** The path as drawn now, in-flight edits included, in world space. */
|
|
1788
|
+
path: PolygonPath;
|
|
1789
|
+
/** `path`'s anchors. */
|
|
1790
|
+
anchors: AnchorSet;
|
|
1791
|
+
}
|
|
1792
|
+
/** What {@link PathEditExtension.marks} draws with. */
|
|
1793
|
+
interface PathEditMarksCtx extends PathEditTarget {
|
|
1794
|
+
view: View;
|
|
1795
|
+
/** World space to the screen space the marks are drawn in. */
|
|
1796
|
+
toScreen(p: {
|
|
1797
|
+
x: number;
|
|
1798
|
+
y: number;
|
|
1799
|
+
}): {
|
|
1800
|
+
x: number;
|
|
1801
|
+
y: number;
|
|
1802
|
+
};
|
|
1803
|
+
/** Chrome-caps' answer for a chrome id; marks gated by one ask it. */
|
|
1804
|
+
isVisible(chromeId: string): boolean;
|
|
1805
|
+
/** The selected mark's index when this extension owns it, else null. */
|
|
1806
|
+
selected: number | null;
|
|
1807
|
+
}
|
|
1808
|
+
/** A grabbable point an extension adds to the open path. A press on it
|
|
1809
|
+
* routes as an affordance hit of kind `hitKind`. */
|
|
1810
|
+
interface PathEditPart {
|
|
1811
|
+
x: number;
|
|
1812
|
+
y: number;
|
|
1813
|
+
hitKind: string;
|
|
1814
|
+
/** Chrome-caps id it is hit-tested under, beside `path-edit.anchors`. */
|
|
1815
|
+
chromeId?: string;
|
|
1816
|
+
/** Hit radius in screen px; path edit's anchor radius when left out. */
|
|
1817
|
+
hitRadiusPx?: number;
|
|
1818
|
+
/** Pushes the part `px` screen pixels from (x, y) along the world-space
|
|
1819
|
+
* `normal`, so it keeps its distance at any zoom. */
|
|
1820
|
+
standoff?: {
|
|
1821
|
+
px: number;
|
|
1822
|
+
normal: {
|
|
1823
|
+
x: number;
|
|
1824
|
+
y: number;
|
|
1825
|
+
};
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
type Point = {
|
|
1829
|
+
x: number;
|
|
1830
|
+
y: number;
|
|
1831
|
+
};
|
|
1832
|
+
/** An anchor or handle drag on the open path, as it starts. */
|
|
1833
|
+
interface PathEditDragStart extends Omit<PathEditTarget, 'node'> {
|
|
1834
|
+
/** The node's committed pose and data; null when it cannot be read. */
|
|
1835
|
+
node: PathEditTarget['node'] | null;
|
|
1836
|
+
/** What the press grabbed: an anchor, or one of its handles. */
|
|
1837
|
+
part: 'anchor' | 'controlIn' | 'controlOut';
|
|
1838
|
+
/** The pressed anchor, as a flat index. */
|
|
1839
|
+
anchorIndex: number;
|
|
1840
|
+
/** The anchors an anchor drag moves, as flat indices; empty for a handle
|
|
1841
|
+
* drag, or when Shift took the pressed anchor out of the selection. */
|
|
1842
|
+
dragging: readonly number[];
|
|
1843
|
+
/** The view's world-to-screen scale at the press, to measure in screen
|
|
1844
|
+
* pixels by; absent without a view. */
|
|
1845
|
+
scale?: {
|
|
1846
|
+
x: number;
|
|
1847
|
+
y: number;
|
|
1848
|
+
};
|
|
1849
|
+
/** The canvas's `snap` dep, to begin a session on; absent without one. */
|
|
1850
|
+
snap?: SnapDep;
|
|
1851
|
+
}
|
|
1852
|
+
/** A handle drag's move, as {@link PathEditDrag.handle} reads it. */
|
|
1853
|
+
interface PathEditHandleMove {
|
|
1854
|
+
/** The handle locks in force this move, modifiers included. */
|
|
1855
|
+
locks: HandleLocks;
|
|
1856
|
+
}
|
|
1857
|
+
/** One extension's share of a drag in flight. Every member is optional. */
|
|
1858
|
+
interface PathEditDrag {
|
|
1859
|
+
/**
|
|
1860
|
+
* For an anchor drag, anchors that follow it and the share of its delta
|
|
1861
|
+
* each moves by, keyed by flat index. Read every move. When any extension
|
|
1862
|
+
* gives one, the drag moves its dragged anchors in full and every anchor
|
|
1863
|
+
* named by the largest share given, and moves no symmetric images.
|
|
1864
|
+
*/
|
|
1865
|
+
weights?(): ReadonlyMap<number, number>;
|
|
1866
|
+
/** For a handle drag, where the handle goes, given `to`: where the pointer
|
|
1867
|
+
* and the locks in force put it. Extensions answer in turn, each from the
|
|
1868
|
+
* last one's answer. */
|
|
1869
|
+
handle?(to: Point, move: PathEditHandleMove): Point;
|
|
1870
|
+
/** A wheel turned while the drag is in flight. Return true to claim it;
|
|
1871
|
+
* the drag then redoes its last move. */
|
|
1872
|
+
wheel?(wheel: {
|
|
1873
|
+
deltaX: number;
|
|
1874
|
+
deltaY: number;
|
|
1875
|
+
deltaZ: number;
|
|
1876
|
+
}): boolean;
|
|
1877
|
+
/** Overlays to draw while the drag is in flight, for `current`, the path
|
|
1878
|
+
* as the drag has made it. */
|
|
1879
|
+
overlays?(current: AnchorSet): readonly OngoingOverlay[];
|
|
1880
|
+
/** The drag is over, committed or canceled. */
|
|
1881
|
+
end?(): void;
|
|
1882
|
+
}
|
|
1883
|
+
/** Another node an edit changes along with the edited one. */
|
|
1884
|
+
interface PathEditOther {
|
|
1885
|
+
id: string;
|
|
1886
|
+
/** Its new path, in world space, stored where the node keeps its own. */
|
|
1887
|
+
path?: PolygonPath;
|
|
1888
|
+
/** Data fields to set on it. */
|
|
1889
|
+
data?: Record<string, unknown>;
|
|
1890
|
+
/** Delete it: what it kept true no longer has anything to hold. */
|
|
1891
|
+
remove?: boolean;
|
|
1892
|
+
}
|
|
1893
|
+
/** What an edit commits once an extension has finished it. */
|
|
1894
|
+
interface FinishedPathEdit {
|
|
1895
|
+
path: PolygonPath;
|
|
1896
|
+
/** Data fields to set beside the path. */
|
|
1897
|
+
data?: Record<string, unknown>;
|
|
1898
|
+
/** Other nodes the edit changes, committed in the same history entry and previewed with it. */
|
|
1899
|
+
others?: readonly PathEditOther[];
|
|
1900
|
+
}
|
|
1901
|
+
/** The scene as {@link PathEditExtension.finishEdit} reads it, for an edit that reaches past one node. */
|
|
1902
|
+
interface PathEditFinishCtx {
|
|
1903
|
+
/** The edited node's id. */
|
|
1904
|
+
id: string;
|
|
1905
|
+
/** A node's committed pose, data and dependencies; null when there is none. */
|
|
1906
|
+
node(id: string): {
|
|
1907
|
+
pose: unknown;
|
|
1908
|
+
data: unknown;
|
|
1909
|
+
dependsOn?: readonly string[] | 'children';
|
|
1910
|
+
} | null;
|
|
1911
|
+
/** A node's committed editable path, in world space; null when it has none. */
|
|
1912
|
+
path(id: string): PolygonPath | null;
|
|
1913
|
+
/** The nodes that list `id` in their `dependsOn`, directly or through others. */
|
|
1914
|
+
dependents(id: string): readonly string[];
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* The scene as {@link PathEditExtension.finishTransform} reads it: `node` and
|
|
1918
|
+
* `path` answer each node as the transform leaves it, `before` as it was.
|
|
1919
|
+
*/
|
|
1920
|
+
interface PathTransformFinishCtx extends Omit<PathEditFinishCtx, 'id'> {
|
|
1921
|
+
/** The nodes the transform moves, resizes or turns. */
|
|
1922
|
+
ids: readonly string[];
|
|
1923
|
+
/** A node's committed editable path before the transform, in world space; null when it has none. */
|
|
1924
|
+
before(id: string): PolygonPath | null;
|
|
1925
|
+
}
|
|
1926
|
+
/** One feature's share of path edit. Every member is optional. */
|
|
1927
|
+
interface PathEditExtension {
|
|
1928
|
+
/** Names it as a {@link PathEditMark}'s owner. Unique per canvas. */
|
|
1929
|
+
readonly id: string;
|
|
1930
|
+
/** Draw commands for the open path, in screen space, under its anchor
|
|
1931
|
+
* markers. Called every frame the overlay paints. */
|
|
1932
|
+
marks?(ctx: PathEditMarksCtx): DrawCommand[];
|
|
1933
|
+
/** Grabbable points on the open path, pressed ahead of its segments and
|
|
1934
|
+
* behind its anchors. */
|
|
1935
|
+
parts?(target: PathEditTarget): readonly PathEditPart[];
|
|
1936
|
+
/** The index of this extension's mark a click at `screen` (in the
|
|
1937
|
+
* overlay's screen space) lands on, or -1. Asked when a click misses
|
|
1938
|
+
* every anchor. */
|
|
1939
|
+
markAt?(target: PathEditTarget, toScreen: PathEditMarksCtx['toScreen'], screen: {
|
|
1940
|
+
x: number;
|
|
1941
|
+
y: number;
|
|
1942
|
+
}): number;
|
|
1943
|
+
/** Remove mark `index` of the node `target` names, committing through
|
|
1944
|
+
* `store`. Delete in path edit calls it on the selected mark. */
|
|
1945
|
+
deleteMark?(target: PathEditTarget, index: number, store: PathEditStore): void;
|
|
1946
|
+
/** Its share of an anchor or handle drag starting on the open path, or
|
|
1947
|
+
* null to sit it out. Asked once, at the press. */
|
|
1948
|
+
drag?(start: PathEditDragStart): PathEditDrag | null;
|
|
1949
|
+
/**
|
|
1950
|
+
* `worldPath`, an edit of `node`'s committed path, finished so whatever
|
|
1951
|
+
* this extension keeps true holds — the path, and any data fields that
|
|
1952
|
+
* change with it, and any other nodes it has to move to keep it. Null when
|
|
1953
|
+
* it cannot hold, and the edit should then not happen. Runs on every commit
|
|
1954
|
+
* of an edit and every frame of one in flight. `ctx` reads the rest of the
|
|
1955
|
+
* scene; it is absent where an edit has no scene behind it.
|
|
1956
|
+
*/
|
|
1957
|
+
finishEdit?(node: {
|
|
1958
|
+
pose: unknown;
|
|
1959
|
+
data: unknown;
|
|
1960
|
+
}, worldPath: PolygonPath, origins?: readonly (PointOrigin | null)[], ctx?: PathEditFinishCtx): FinishedPathEdit | null;
|
|
1961
|
+
/**
|
|
1962
|
+
* The other nodes a whole-node transform — a move, resize, rotate, flip or
|
|
1963
|
+
* nudge — changes along with the nodes it transforms, so whatever this
|
|
1964
|
+
* extension keeps true across nodes holds; committed in the transform's
|
|
1965
|
+
* history entry. Null when the transform should not happen. An entry
|
|
1966
|
+
* naming a node the transform itself moves is ignored.
|
|
1967
|
+
*/
|
|
1968
|
+
finishTransform?(ctx: PathTransformFinishCtx): readonly PathEditOther[] | null;
|
|
1969
|
+
/** How path edit reads and writes the nodes whose `data.representation`
|
|
1970
|
+
* is of its kind. */
|
|
1971
|
+
representation?: PathRepresentation;
|
|
1972
|
+
}
|
|
1973
|
+
/** Commits a node's new path and data as one history entry, with no
|
|
1974
|
+
* extension finishing it. */
|
|
1975
|
+
type PathEditStore = (id: string, worldPath: PolygonPath, label: string, data?: Record<string, unknown>) => void;
|
|
1976
|
+
/**
|
|
1977
|
+
* Data fields that describe how a node's geometry was made, or name its
|
|
1978
|
+
* anchors, and so mean nothing once the geometry is replaced some other way.
|
|
1979
|
+
* A writer replacing a node's path drops them: a held warp, path
|
|
1980
|
+
* constraints, a skin, the form a path was drawn from.
|
|
1981
|
+
*/
|
|
1982
|
+
declare const GEOMETRY_BOUND_DATA: readonly string[];
|
|
1983
|
+
/** `data` without the fields in {@link GEOMETRY_BOUND_DATA}, other than `keep`. */
|
|
1984
|
+
declare function withoutGeometryBoundData<T>(data: T, keep?: readonly string[]): T;
|
|
1985
|
+
|
|
1986
|
+
/** An edit as {@link EditAnchorsDep.finishEdit} finishes it: the edited node's world path, and the other nodes' that move with it. */
|
|
1987
|
+
interface FinishedEditFrame {
|
|
1988
|
+
path: unknown;
|
|
1989
|
+
others: readonly {
|
|
1990
|
+
id: string;
|
|
1991
|
+
path: unknown;
|
|
1992
|
+
}[];
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Adapter dep for `editAnchorsAction`: narrow read/write access to the
|
|
1996
|
+
* editable polygon of a single node, so anchor-edit actions need not know
|
|
1997
|
+
* whether it lives directly on the node's pose (`pose.kind === 'polygon'`)
|
|
1998
|
+
* or on `node.data.path`.
|
|
1999
|
+
*
|
|
2000
|
+
* In-flight edit state is surfaced through the dispatcher's
|
|
2001
|
+
* `OngoingHandle.previewIds/previewPose/previewData` triple, not this dep.
|
|
2002
|
+
*/
|
|
2003
|
+
interface EditAnchorsDep {
|
|
2004
|
+
/** Id of the node currently being edited. Empty string means no node is
|
|
2005
|
+
* currently in edit mode — the chrome and gesture both opt out. */
|
|
2006
|
+
editingId: string;
|
|
2007
|
+
/** Enter/exit edit mode for a specific node. Pass `null` (or an empty
|
|
2008
|
+
* string) to exit. */
|
|
2009
|
+
setEditingId(id: string | null): void;
|
|
2010
|
+
/** Returns the COMMITTED editable polygon in world coordinates, or
|
|
2011
|
+
* null if this node has no editable polygon. For a node whose path was
|
|
2012
|
+
* drawn from a form a `PathRepresentation` reads, it is that form's edit
|
|
2013
|
+
* path, which `applyEdit` turns back into the drawn path. Does NOT consult in-
|
|
2014
|
+
* flight previews — callers that need live state read the dispatcher's
|
|
2015
|
+
* in-flight handles. */
|
|
2016
|
+
getEditablePath(id: string): unknown;
|
|
2017
|
+
/** The drawn geometry, in world coordinates, whose outline is a segment press, where it
|
|
2018
|
+
* differs from `getEditablePath`'s: a path drawn from a form. Absent, `getEditablePath`'s. */
|
|
2019
|
+
getOutlinePath?(id: string): unknown;
|
|
2020
|
+
/** Returns where the polygon is stored — `'pose'` when `node.pose`
|
|
2021
|
+
* IS the polygon, `'data'` when it lives on `node.data.path` with a
|
|
2022
|
+
* rect pose, or `null` when the node has no editable polygon. */
|
|
2023
|
+
getStorageKind(id: string): 'pose' | 'data' | null;
|
|
2024
|
+
/** Returns the node's raw `pose` and `data` so storage-aware actions
|
|
2025
|
+
* can capture origin state at gesture-start and synthesize a matching
|
|
2026
|
+
* `previewPose` / `previewData` during `onMove`. Returns null when the
|
|
2027
|
+
* node is gone. */
|
|
2028
|
+
getNodeShape(id: string): {
|
|
2029
|
+
pose: unknown;
|
|
2030
|
+
data: unknown;
|
|
2031
|
+
} | null;
|
|
2032
|
+
/** Commit `worldPath` as the new value for `id`, as one history entry
|
|
2033
|
+
* labeled `label`: a setPose when the pose IS the polygon, a batched
|
|
2034
|
+
* setPose+update when it lives on data.path. Given `origins` (from
|
|
2035
|
+
* `editAnchorSetTracked`), its per-anchor data (skin, vertex colors) is
|
|
2036
|
+
* renumbered in that entry. The edit is finished first (see `finishEdit`); one an extension cannot
|
|
2037
|
+
* finish commits nothing. */
|
|
2038
|
+
applyEdit(id: string, worldPath: unknown, label: string, origins?: readonly (PointOrigin | null)[]): void;
|
|
2039
|
+
/** The ops `applyEdit` would commit for the same arguments, unapplied, so
|
|
2040
|
+
* a caller can make the edit part of a larger batch — the pen joining
|
|
2041
|
+
* two paths edits one node and deletes the other in one undo step.
|
|
2042
|
+
* Optional; a caller that needs it declines the composite edit without
|
|
2043
|
+
* it. Returns `[]` when `id` has no editable polygon, or when an
|
|
2044
|
+
* extension cannot finish the edit. */
|
|
2045
|
+
editOps?(id: string, worldPath: unknown, label: string, origins?: readonly (PointOrigin | null)[]): Op[];
|
|
2046
|
+
/**
|
|
2047
|
+
* Anchors currently selected within the edited path, as **flat anchor
|
|
2048
|
+
* indices** — the same numbering `enumerateAnchors` produces and the
|
|
2049
|
+
* `anchor:N` affordance kinds carry.
|
|
2050
|
+
*
|
|
2051
|
+
* Selection is transient UI state, deliberately not part of the scene:
|
|
2052
|
+
* it is cleared whenever `editingId` changes, and any edit that
|
|
2053
|
+
* renumbers anchors (insert, delete) is responsible for leaving it
|
|
2054
|
+
* coherent. Empty means "no anchor selected" — the keyboard actions
|
|
2055
|
+
* (nudge, delete) no-op rather than acting on all anchors.
|
|
2056
|
+
*/
|
|
2057
|
+
selectedAnchors: ReadonlySet<number>;
|
|
2058
|
+
/** Replace the anchor selection. Pass an empty iterable to clear. */
|
|
2059
|
+
setSelectedAnchors(next: Iterable<number>): void;
|
|
2060
|
+
/** In-flight anchor-marquee rect in world coords, or null when no
|
|
2061
|
+
* marquee drag is active. */
|
|
2062
|
+
marquee: {
|
|
2063
|
+
x: number;
|
|
2064
|
+
y: number;
|
|
2065
|
+
width: number;
|
|
2066
|
+
height: number;
|
|
2067
|
+
} | null;
|
|
2068
|
+
/** Set or clear the in-flight marquee rect. */
|
|
2069
|
+
setMarquee(rect: {
|
|
2070
|
+
x: number;
|
|
2071
|
+
y: number;
|
|
2072
|
+
width: number;
|
|
2073
|
+
height: number;
|
|
2074
|
+
} | null): void;
|
|
2075
|
+
/** The path-edit tool in use, or null for plain anchor editing — one of a
|
|
2076
|
+
* set of named tools, such as `'simplifyBrush'`, that each change what a
|
|
2077
|
+
* plain drag in path edit does. Always null with no path open. */
|
|
2078
|
+
tool: string | null;
|
|
2079
|
+
/** Switch path-edit tool, or pass null for plain anchor editing. */
|
|
2080
|
+
setTool(id: string | null): void;
|
|
2081
|
+
/** The handle locks held for every handle drag, on top of the modifiers —
|
|
2082
|
+
* what the `handleLock.angle` and `handleLock.length` toggles set. Absent,
|
|
2083
|
+
* the drag holds what its `handleLock` param names. Unlike the anchor
|
|
2084
|
+
* selection, they outlast a change of edited path. */
|
|
2085
|
+
handleLocks?: HandleLocks;
|
|
2086
|
+
/** Replace the held handle locks. Absent, the toggles are unavailable. */
|
|
2087
|
+
setHandleLocks?(next: HandleLocks): void;
|
|
2088
|
+
/**
|
|
2089
|
+
* `worldPath`, an edit of `id`'s committed path, finished by every
|
|
2090
|
+
* extension's `finishEdit` in turn — path constraints made to hold, say —
|
|
2091
|
+
* with the paths of any other nodes that move with it. Null when one cannot
|
|
2092
|
+
* finish it, and the edit should then not happen. `applyEdit` and `editOps`
|
|
2093
|
+
* run it themselves; an ongoing edit calls it each frame so its preview is
|
|
2094
|
+
* what they will commit. Optional: absent, edits stand as they are.
|
|
2095
|
+
*/
|
|
2096
|
+
finishEdit?(id: string, worldPath: unknown, origins?: readonly (PointOrigin | null)[]): FinishedEditFrame | null;
|
|
2097
|
+
/**
|
|
2098
|
+
* Commit `worldPath` for `id` with `data` laid over its data, as one
|
|
2099
|
+
* history entry, finished by no extension: what an extension writing its
|
|
2100
|
+
* own data with a path it already solved commits through. Optional.
|
|
2101
|
+
*/
|
|
2102
|
+
store?: PathEditStore;
|
|
2103
|
+
/** The canvas's path-edit extensions, in order. */
|
|
2104
|
+
extensions?: readonly PathEditExtension[];
|
|
2105
|
+
/**
|
|
2106
|
+
* The extension mark selected in place of anchors, or null. Selecting one
|
|
2107
|
+
* clears the anchor selection and selecting anchors clears it, so Delete
|
|
2108
|
+
* acts on one or the other. Optional.
|
|
2109
|
+
*/
|
|
2110
|
+
selectedMark?: PathEditMark | null;
|
|
2111
|
+
/** Select an extension's mark, or pass null to clear. */
|
|
2112
|
+
setSelectedMark?(mark: PathEditMark | null): void;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
/** Context handed to every content handler for one ingest event. */
|
|
2116
|
+
interface IngestCtx {
|
|
2117
|
+
/** World-space arrival point (drop / pointed imperative ingest); `null`
|
|
2118
|
+
* for paste and point-less calls — handlers pick their own policy
|
|
2119
|
+
* (the kit image handler centers on the viewport). */
|
|
2120
|
+
point: {
|
|
2121
|
+
x: number;
|
|
2122
|
+
y: number;
|
|
2123
|
+
} | null;
|
|
2124
|
+
/** Visible canvas area in world coordinates. */
|
|
2125
|
+
viewportWorldRect(): {
|
|
2126
|
+
x: number;
|
|
2127
|
+
y: number;
|
|
2128
|
+
width: number;
|
|
2129
|
+
height: number;
|
|
2130
|
+
};
|
|
2131
|
+
/** The kit insert dep — id/layer/undoable-op supplied; the canonical way
|
|
2132
|
+
* for a handler to mint a node (`insert.commit(bounds, { kind, ... })`). */
|
|
2133
|
+
insert: InsertDep;
|
|
2134
|
+
/** The canvas's snap dep, for a handler that places what it inserts where a
|
|
2135
|
+
* gesture would: begin a session, take `at()`, `end()`. Its points are ctx
|
|
2136
|
+
* coordinates: world on a 2D canvas, screen in a 3D host. */
|
|
2137
|
+
snap?: SnapDep;
|
|
2138
|
+
/** Raw op commit for handlers that build their own ops. */
|
|
2139
|
+
applyOps(ops: Op[], label?: string): void;
|
|
2140
|
+
scene: Scene<unknown, string, unknown>;
|
|
2141
|
+
selection: SelectionApi;
|
|
2142
|
+
/** Consumer file→src resolver (SceneCanvas `ingestion.resolveSrc`).
|
|
2143
|
+
* When absent, the kit image handler embeds as a `data:` URI. */
|
|
2144
|
+
resolveSrc?: (file: File) => Promise<string>;
|
|
2145
|
+
/** Kit SVG-handler options (SceneCanvas `ingestion.svg`) — e.g.
|
|
2146
|
+
* `{ unpack: unpackSvgFiles }` (from `@weasel-js/svg`) to parse SVG files
|
|
2147
|
+
* into scene nodes. */
|
|
2148
|
+
svg?: SvgIngestOptions;
|
|
2149
|
+
/** Clipboard-paste seam — present when the hosting `SceneCanvas` supplied
|
|
2150
|
+
* an adapter with `commitPaste`. `reviver` comes from
|
|
2151
|
+
* `SceneCanvasProps.ingestion.clipboard`. Absent ⇒ the kit weasel-JSON
|
|
2152
|
+
* handler declines inert (dwarn, nothing ingested) — its matched items
|
|
2153
|
+
* were already consumed at match time, so they do NOT fall through;
|
|
2154
|
+
* only match-level misses flow on to other handlers. */
|
|
2155
|
+
clipboard?: ClipboardIngestCtx;
|
|
2156
|
+
/** Set to `true` by the kit weasel-JSON handler when it successfully
|
|
2157
|
+
* pastes a payload in this event. `kit:svg`'s `text/plain` SVG fallback
|
|
2158
|
+
* reads this to decline the SVG flavor of a copy whose weasel-JSON flavor
|
|
2159
|
+
* already ingested (avoids a double-paste when both flavors ride one
|
|
2160
|
+
* clipboard event). */
|
|
2161
|
+
consumedWeaselPayload?: boolean;
|
|
2162
|
+
/** Full action-deps bag, for consumer handlers that need more. */
|
|
2163
|
+
deps: ActionDeps;
|
|
2164
|
+
}
|
|
2165
|
+
/** A handler for content arriving by paste, drop or file picker. Handlers are
|
|
2166
|
+
* matched by MIME glob or predicate and run highest-priority first; the kit's
|
|
2167
|
+
* own register at a low priority so a consumer's handler wins by default. */
|
|
2168
|
+
interface ContentHandlerEntry {
|
|
2169
|
+
/** Stable identifier — used for unregistration and debugging
|
|
2170
|
+
* (`'kit:image'`, `'app:csv'`). */
|
|
2171
|
+
id: string;
|
|
2172
|
+
/** MIME glob(s) (`'image/*'`, `'text/csv'`) or an item predicate. A drop
|
|
2173
|
+
* or paste keeps string flavors of any exact MIME named here or in
|
|
2174
|
+
* `types` while the handler is registered, so a handler can claim a drag
|
|
2175
|
+
* from the app's own UI by a type of its own. */
|
|
2176
|
+
match: string | string[] | ((item: IngestItem) => boolean);
|
|
2177
|
+
/** For a predicate `match`: the MIME globs it could say yes to. A drag
|
|
2178
|
+
* still in flight shows its MIMEs and no contents, so a predicate cannot be
|
|
2179
|
+
* asked about it; this is what it is asked instead. Without it, no drag
|
|
2180
|
+
* can be refused while this handler is registered. */
|
|
2181
|
+
types?: readonly string[];
|
|
2182
|
+
/** Higher runs earlier. Kit defaults register at -100 so any consumer
|
|
2183
|
+
* handler (default 0) beats them. */
|
|
2184
|
+
priority?: number;
|
|
2185
|
+
handle(items: IngestItem[], ctx: IngestCtx): void | Promise<void>;
|
|
2186
|
+
}
|
|
2187
|
+
/** Register a content handler. Returns a disposer that removes it. */
|
|
2188
|
+
declare function registerContentHandler(entry: ContentHandlerEntry): () => void;
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* Options for the kit `image/svg+xml` content handler, threaded from
|
|
2192
|
+
* SceneCanvas's `ingestion={{ svg }}` prop.
|
|
2193
|
+
*/
|
|
2194
|
+
interface SvgIngestOptions {
|
|
2195
|
+
/** Parse dropped/pasted/picked SVG files into native scene nodes (path /
|
|
2196
|
+
* text leaves under containers mirroring the source `<g>` structure)
|
|
2197
|
+
* instead of the default single embedded-image node.
|
|
2198
|
+
*
|
|
2199
|
+
* Pass `unpackSvgFiles` from `@weasel-js/svg`:
|
|
2200
|
+
*
|
|
2201
|
+
* ```ts
|
|
2202
|
+
* import { unpackSvgFiles } from '@weasel-js/svg';
|
|
2203
|
+
* <SceneCanvas ingestion={{ svg: { unpack: unpackSvgFiles } }} />
|
|
2204
|
+
* ```
|
|
2205
|
+
*
|
|
2206
|
+
* It is injected rather than flagged on with `true` because the SVG parser
|
|
2207
|
+
* lives in `@weasel-js/svg`, which depends on this package. */
|
|
2208
|
+
unpack?: SvgUnpacker;
|
|
2209
|
+
}
|
|
2210
|
+
/** Parses SVG files and inserts the resulting nodes into `ctx.scene`, as one
|
|
2211
|
+
* `applyOps` batch per file. Implemented by `unpackSvgFiles` in
|
|
2212
|
+
* `@weasel-js/svg`; see {@link SvgIngestOptions.unpack}. */
|
|
2213
|
+
type SvgUnpacker = (files: File[], ctx: IngestCtx) => Promise<void>;
|
|
2214
|
+
/**
|
|
2215
|
+
* Clipboard-paste seam consumed by the kit weasel-JSON content handler
|
|
2216
|
+
* (`IngestCtx.clipboard`). Built by `<SceneCanvas>` from its own synthesized
|
|
2217
|
+
* adapter + the `ingestion.clipboard` prop; absent when the consumer set
|
|
2218
|
+
* `ingestion.clipboard.enabled === false` or the adapter lacks `commitPaste`.
|
|
2219
|
+
* Absence makes the handler decline inert (dwarn, nothing ingested) — its
|
|
2220
|
+
* matched items were already consumed at match time and do not fall through
|
|
2221
|
+
* to other handlers.
|
|
2222
|
+
*/
|
|
2223
|
+
interface ClipboardIngestCtx {
|
|
2224
|
+
/** The hosting canvas's adapter — `commitPaste` materializes the pasted
|
|
2225
|
+
* nodes (fresh ids, offset applied); insertion still goes through ops. */
|
|
2226
|
+
adapter: InsertAdapter<{
|
|
2227
|
+
id: string;
|
|
2228
|
+
}>;
|
|
2229
|
+
/** JSON reviver for the weasel wire payload (typed arrays etc.) — from
|
|
2230
|
+
* `SceneCanvasProps.ingestion.clipboard.reviver`. */
|
|
2231
|
+
reviver?: (key: string, value: unknown) => unknown;
|
|
2232
|
+
/** Told what a paste left out and why — from
|
|
2233
|
+
* `SceneCanvasProps.ingestion.clipboard.onOmitted`. */
|
|
2234
|
+
onOmitted?: (omitted: PasteOmission[]) => void;
|
|
2235
|
+
}
|
|
2236
|
+
/** Dep for the `ingest` action (external-content ingestion). */
|
|
2237
|
+
interface IngestionDep {
|
|
2238
|
+
/** Visible canvas area in world coordinates. */
|
|
2239
|
+
viewportWorldRect(): {
|
|
2240
|
+
x: number;
|
|
2241
|
+
y: number;
|
|
2242
|
+
width: number;
|
|
2243
|
+
height: number;
|
|
2244
|
+
};
|
|
2245
|
+
/** Consumer file→src resolver (from SceneCanvas's `ingestion` prop).
|
|
2246
|
+
* Live accessor — read it at use time. Destructuring (or copying the
|
|
2247
|
+
* property early) snapshots the current value and won't track later
|
|
2248
|
+
* prop changes across an `await`. */
|
|
2249
|
+
resolveSrc?: (file: File) => Promise<string>;
|
|
2250
|
+
/** Kit SVG-handler options (from SceneCanvas's `ingestion` prop).
|
|
2251
|
+
* Live accessor, same caveat as `resolveSrc`. */
|
|
2252
|
+
svg?: SvgIngestOptions;
|
|
2253
|
+
/** Clipboard-paste seam for the kit weasel-JSON handler.
|
|
2254
|
+
* Live accessor, same caveat as `resolveSrc`. */
|
|
2255
|
+
clipboard?: ClipboardIngestCtx;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
/** The gesture an insert's bounds came from, in the same coordinates: `bounds`
|
|
2259
|
+
* is the box `start` and `end` span, or with `fromCenter`, the box centered
|
|
2260
|
+
* on `start` reaching `end`. A host whose bounds lose information on the
|
|
2261
|
+
* way, a 3D one casting them onto a plane, reads the ends instead. */
|
|
2262
|
+
interface InsertEnds {
|
|
2263
|
+
start: {
|
|
2264
|
+
x: number;
|
|
2265
|
+
y: number;
|
|
2266
|
+
};
|
|
2267
|
+
end: {
|
|
2268
|
+
x: number;
|
|
2269
|
+
y: number;
|
|
2270
|
+
};
|
|
2271
|
+
fromCenter?: boolean;
|
|
2272
|
+
}
|
|
2273
|
+
/** Adapter dep for `insertAction`. The `extras` carry the active tool's kind
|
|
2274
|
+
* + per-kind geometry. */
|
|
2275
|
+
interface InsertDep {
|
|
2276
|
+
/**
|
|
2277
|
+
* Materialise a new node from the given drag-rect bounds and typed
|
|
2278
|
+
* per-kind extras. Returns the new node's id, or `null` if the consumer
|
|
2279
|
+
* rejected the insert (e.g. sub-threshold bounds, unknown kind).
|
|
2280
|
+
*/
|
|
2281
|
+
commit(bounds: {
|
|
2282
|
+
x: number;
|
|
2283
|
+
y: number;
|
|
2284
|
+
width: number;
|
|
2285
|
+
height: number;
|
|
2286
|
+
}, extras: InsertExtras,
|
|
2287
|
+
/** Absent when no gesture made the bounds: a path the pen or spiro
|
|
2288
|
+
* drew, or content a paste ingests. A click-place reads as a drag out
|
|
2289
|
+
* from its center. */
|
|
2290
|
+
ends?: InsertEnds): NodeId | null;
|
|
2291
|
+
/**
|
|
2292
|
+
* What `commit` would apply, unapplied: the new node's id and the ops that
|
|
2293
|
+
* insert it, for a caller that has more to put in the same undo step. The
|
|
2294
|
+
* pen joins two paths this way. Without it such a caller declines.
|
|
2295
|
+
*/
|
|
2296
|
+
build?(bounds: {
|
|
2297
|
+
x: number;
|
|
2298
|
+
y: number;
|
|
2299
|
+
width: number;
|
|
2300
|
+
height: number;
|
|
2301
|
+
}, extras: InsertExtras, ends?: InsertEnds): {
|
|
2302
|
+
id: NodeId;
|
|
2303
|
+
ops: Op[];
|
|
2304
|
+
} | null;
|
|
2305
|
+
/** The scene layer `commit` puts the node on. An insert on a layer carrying
|
|
2306
|
+
* `parallax` is dragged out in that plane's world, so `bounds` arrive
|
|
2307
|
+
* there too. Omitted: the camera's world. */
|
|
2308
|
+
layer?(): string;
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2311
|
+
* What `editAnchorsAction` keeps a path symmetric under. Asked once at the
|
|
2312
|
+
* press, with the id of the path being edited; answer every transform of the
|
|
2313
|
+
* symmetry group except the identity, in world coordinates. Of those, the
|
|
2314
|
+
* ones the path is already its own image under are held through the drag:
|
|
2315
|
+
* each image of a dragged anchor or handle follows it, and one a transform
|
|
2316
|
+
* fixes stays where that transform allows.
|
|
2317
|
+
*/
|
|
2318
|
+
interface PathSymmetryDep {
|
|
2319
|
+
transforms(id: string): readonly Affine[];
|
|
2320
|
+
}
|
|
2321
|
+
/** Where the `insert` dep puts what it makes. Read at each insert. A node
|
|
2322
|
+
* goes onto the container's layer, with its pose made local to it when the
|
|
2323
|
+
* scene composes frames; an id naming no container is the same as `null`. */
|
|
2324
|
+
interface InsertIntoDep {
|
|
2325
|
+
get(): string | null;
|
|
2326
|
+
}
|
|
2327
|
+
/** Holder for the insert gesture in flight in one input scope. `gesture` is
|
|
2328
|
+
* `insertAction`'s own state, opaque to everything else, and `null` between
|
|
2329
|
+
* gestures. A source must return the same object on every read. */
|
|
2330
|
+
interface InsertLive {
|
|
2331
|
+
gesture: unknown;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
/**
|
|
2335
|
+
* Layout-strategy lookup by container id, consumed by `moveAction` to run
|
|
2336
|
+
* the drag-time reflow pass. Sourced by `<SceneCanvas>` from the layout each
|
|
2337
|
+
* container declares on its scene node. `getLayout` returns null for a
|
|
2338
|
+
* container that declares none, so the reflow pass is a no-op then.
|
|
2339
|
+
*/
|
|
2340
|
+
interface LayoutDep {
|
|
2341
|
+
getLayout(containerId: string): LayoutStrategy<unknown> | null;
|
|
2342
|
+
/** Which container wins when several contain the drop point. Default
|
|
2343
|
+
* `'innermost'`. */
|
|
2344
|
+
dropTarget?: LayoutDropTargetMode;
|
|
2345
|
+
/** Carries displaced siblings to their slots over time. Absent, they snap. */
|
|
2346
|
+
reflow?: ReflowTransition<unknown> | null;
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
* Whether the nodes `ids` may be dropped into the container `parent`. A move
|
|
2350
|
+
* consults it before reparenting anything: reparent-on-drop passes over a
|
|
2351
|
+
* refused container to the nearest one around it that admits them, and the
|
|
2352
|
+
* layout drop treats a refused layout container as if it were not there.
|
|
2353
|
+
* Absent, every container takes any drop.
|
|
2354
|
+
*/
|
|
2355
|
+
type CanDropIntoDep = (parent: string, ids: readonly string[]) => boolean;
|
|
2356
|
+
|
|
2357
|
+
/**
|
|
2358
|
+
* The deps behind text editing, the clipboard, and Slice.
|
|
2359
|
+
*/
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Dep for `enterTextEditAction`.
|
|
2363
|
+
*
|
|
2364
|
+
* Wrap the return value of `useTextEdit` / `useSceneTextEdit` to source this
|
|
2365
|
+
* dep. The `isTextNode` predicate is optional — when absent the action fires
|
|
2366
|
+
* unconditionally (the binding spec acts as the gate).
|
|
2367
|
+
*
|
|
2368
|
+
* @example
|
|
2369
|
+
* ```ts
|
|
2370
|
+
* const textEdit = useSceneTextEdit(scene, container);
|
|
2371
|
+
* useDepSource('textEdit', () => ({
|
|
2372
|
+
* startEdit: textEdit.startEdit,
|
|
2373
|
+
* isTextNode: textEdit.isTextNode,
|
|
2374
|
+
* }));
|
|
2375
|
+
* ```
|
|
2376
|
+
*/
|
|
2377
|
+
interface TextEditDep {
|
|
2378
|
+
/** Begin editing the node with `id`. */
|
|
2379
|
+
startEdit(id: string, opts?: {
|
|
2380
|
+
caret?: number | 'all';
|
|
2381
|
+
}): void;
|
|
2382
|
+
/**
|
|
2383
|
+
* Optional predicate: returns `true` when the node with `id` is a text node.
|
|
2384
|
+
* When absent the action fires on any selected node (binding spec is the gate).
|
|
2385
|
+
* When present and returning `false`, the invocation is a no-op.
|
|
2386
|
+
*/
|
|
2387
|
+
isTextNode?(id: string): boolean;
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* Clipboard dep — the imperative surface `useClipboardOps` returns.
|
|
2391
|
+
*
|
|
2392
|
+
* Consumers publish their live clipboard through `useDepSource('clipboard',
|
|
2393
|
+
* …)` from inside the `<DepRegistryProvider>` (i.e. under `<SceneCanvas>`).
|
|
2394
|
+
* The kit deliberately does not build one for them: `useClipboardOps` needs
|
|
2395
|
+
* an adapter and a selection reader that only the consumer can supply.
|
|
2396
|
+
*/
|
|
2397
|
+
interface ClipboardDep {
|
|
2398
|
+
copy(): void;
|
|
2399
|
+
paste(at?: {
|
|
2400
|
+
worldX: number;
|
|
2401
|
+
worldY: number;
|
|
2402
|
+
}): void;
|
|
2403
|
+
isEmpty(): boolean;
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* The commit behind the Slice action. `commit` receives the cut as a polyline
|
|
2407
|
+
* of at least two points (world coords): the drag's two ends for a straight
|
|
2408
|
+
* cut, its whole trail for a freehand one, the placed points for a
|
|
2409
|
+
* click-by-click one, whose last point equals its first when it closes into
|
|
2410
|
+
* a loop. `<SceneCanvas>` publishes one over its scene (`useSliceDepSource`);
|
|
2411
|
+
* a consumer replaces it with `useSliceDep`.
|
|
2412
|
+
*/
|
|
2413
|
+
interface SliceDep {
|
|
2414
|
+
commit(cut: ReadonlyArray<Point2>): void;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
/** Minimal view API the action layer consumes. */
|
|
2418
|
+
interface ViewApi {
|
|
2419
|
+
get(): View;
|
|
2420
|
+
set(v: View): void;
|
|
2421
|
+
/** How this camera's world maps into the world the invocation edits in,
|
|
2422
|
+
* when that is a parallax plane — set by `inPlane` on the view it hands a
|
|
2423
|
+
* wrapped action. Absent or null: the camera's own world. */
|
|
2424
|
+
plane?(): PlaneMap | null;
|
|
2425
|
+
/** How the world the invocation edits in maps into the world `layer`'s
|
|
2426
|
+
* nodes are stored in, read now — set by `inPlane` alongside `plane`.
|
|
2427
|
+
* Absent or null: the same world. */
|
|
2428
|
+
planeOf?(layer: string): PlaneMap | null;
|
|
2429
|
+
/** Optional recenter callback. When wired, `viewportZoomAction`'s `reset`
|
|
2430
|
+
* branch (Cmd-0) calls this instead of resetting to identity. Return the
|
|
2431
|
+
* target `View` to let the action animate there; return nothing to keep
|
|
2432
|
+
* dispatching the view yourself. */
|
|
2433
|
+
recenter?(): View | void;
|
|
2434
|
+
/** Optional canvas-local host dimensions (CSS px). When wired,
|
|
2435
|
+
* `viewportZoomAction`'s keyboard branches (Cmd+= / Cmd+-) anchor at the
|
|
2436
|
+
* host center instead of the top-left origin. Null when the host isn't
|
|
2437
|
+
* measurable (unmounted). */
|
|
2438
|
+
hostSize?(): {
|
|
2439
|
+
width: number;
|
|
2440
|
+
height: number;
|
|
2441
|
+
} | null;
|
|
2442
|
+
/** Optional camera animation. `<SceneCanvas>` wires these three; a consumer
|
|
2443
|
+
* publishing their own `view` dep need not, and actions fall back to `set`. */
|
|
2444
|
+
animate?(to: View, opts?: ViewAnimationOptions): void;
|
|
2445
|
+
stopAnimation?(): void;
|
|
2446
|
+
/** Where an in-flight camera animation is heading, or null. Compute the next
|
|
2447
|
+
* discrete step from this so repeated presses compound. */
|
|
2448
|
+
animationTarget?(): View | null;
|
|
2449
|
+
/** Optional momentum decay. `<SceneCanvas>` wires this from `useDecayLoop`;
|
|
2450
|
+
* a consumer publishing their own `view` dep need not, and `viewport.dragPan`
|
|
2451
|
+
* simply lands the pan without coasting. */
|
|
2452
|
+
decay?(config: DecayLoopConfig): void;
|
|
2453
|
+
stopDecay?(): void;
|
|
2454
|
+
/** Whether a scene layer reaches the screen in this view — its own
|
|
2455
|
+
* `layerVisibility` / `layerOrder`, on top of the scene's `visible` flag.
|
|
2456
|
+
* Absent: this view paints every layer the scene shows. Selecting actions
|
|
2457
|
+
* pass over what the asking view does not paint. */
|
|
2458
|
+
layerIsPainted?(layerId: string): boolean;
|
|
2459
|
+
}
|
|
2460
|
+
/** The part of the asking view a region hit-test consults. `get` is its
|
|
2461
|
+
* camera, which a parallax layer is picked through. */
|
|
2462
|
+
type HitTestView = RegionPickView;
|
|
2463
|
+
/**
|
|
2464
|
+
* Topmost-node-at-world-point dep, for any action that needs a single-best
|
|
2465
|
+
* pick. The dep walks hits front-to-back and returns the first id not in
|
|
2466
|
+
* `exclude`. Pass moving-node roots + their descendants when the caller
|
|
2467
|
+
* wants to ignore the nodes it's manipulating.
|
|
2468
|
+
*/
|
|
2469
|
+
type NodeAtPointDep = (point: {
|
|
2470
|
+
x: number;
|
|
2471
|
+
y: number;
|
|
2472
|
+
}, exclude?: Iterable<NodeId>) => NodeId | null;
|
|
2473
|
+
/** What an area-selecting action needs: a way to ask what a region covers,
|
|
2474
|
+
* and a way to read and replace the selection. */
|
|
2475
|
+
interface AreaSelectDep {
|
|
2476
|
+
/** Return ids of all scene nodes whose AABB overlaps `bounds`, skipping any
|
|
2477
|
+
* on a layer `view` — the view the gesture ran in — does not paint. */
|
|
2478
|
+
hitTestArea(bounds: {
|
|
2479
|
+
x: number;
|
|
2480
|
+
y: number;
|
|
2481
|
+
width: number;
|
|
2482
|
+
height: number;
|
|
2483
|
+
}, view?: HitTestView): NodeId[];
|
|
2484
|
+
/** Return the current selection id list. */
|
|
2485
|
+
getSelection(): NodeId[];
|
|
2486
|
+
/** Replace the current selection. */
|
|
2487
|
+
setSelection(ids: NodeId[]): void;
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* Adapter dep for `lassoSelectAction`: polygon-lasso hit-testing +
|
|
2491
|
+
* selection read/write.
|
|
2492
|
+
*/
|
|
2493
|
+
interface LassoSelectDep {
|
|
2494
|
+
/**
|
|
2495
|
+
* Hit-test against a closed polygon (vertex order CW or CCW; last→first
|
|
2496
|
+
* closing edge is implicit). Returns matching node ids.
|
|
2497
|
+
* Optional — when absent, `lassoSelectAction` falls back to AABB via
|
|
2498
|
+
* `hitTestArea`.
|
|
2499
|
+
*/
|
|
2500
|
+
hitTestLasso?(polygon: ReadonlyArray<{
|
|
2501
|
+
x: number;
|
|
2502
|
+
y: number;
|
|
2503
|
+
}>, mode: 'centers' | 'intersect' | 'enclosed', view?: HitTestView): string[];
|
|
2504
|
+
/** Return ids of nodes whose AABB overlaps the given rect (fallback). */
|
|
2505
|
+
hitTestArea(bounds: {
|
|
2506
|
+
x: number;
|
|
2507
|
+
y: number;
|
|
2508
|
+
width: number;
|
|
2509
|
+
height: number;
|
|
2510
|
+
}, view?: HitTestView): string[];
|
|
2511
|
+
/** Return the current selection id list. */
|
|
2512
|
+
getSelection(): string[];
|
|
2513
|
+
/** Replace the current selection. */
|
|
2514
|
+
setSelection(ids: string[]): void;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
/**
|
|
2518
|
+
* Per-kind extra geometry passed to `InsertDep.commit`.
|
|
2519
|
+
*
|
|
2520
|
+
* Built-in tools populate a typed variant so the kit's default factory can
|
|
2521
|
+
* render the true tool params (line endpoints, polygon side count, star
|
|
2522
|
+
* geometry, pencil sample list). Consumer-defined tools may pass any
|
|
2523
|
+
* `{ kind: string; ... }` payload; the kit's factory falls back to AABB
|
|
2524
|
+
* inscription for unknown kinds.
|
|
2525
|
+
*
|
|
2526
|
+
* `bounds` is still passed alongside as a useful AABB pose hint — factories
|
|
2527
|
+
* may use it as the node's pose even when richer geometry is available. Any may carry a `minSize`
|
|
2528
|
+
* (`{ width, height }`), which the kit's factories keep as `data.minSize` so a resize holds to it.
|
|
2529
|
+
*/
|
|
2530
|
+
type InsertExtras = {
|
|
2531
|
+
kind: 'rect';
|
|
2532
|
+
} | {
|
|
2533
|
+
kind: 'ellipse';
|
|
2534
|
+
} | {
|
|
2535
|
+
kind: 'line';
|
|
2536
|
+
a: {
|
|
2537
|
+
x: number;
|
|
2538
|
+
y: number;
|
|
2539
|
+
};
|
|
2540
|
+
b: {
|
|
2541
|
+
x: number;
|
|
2542
|
+
y: number;
|
|
2543
|
+
};
|
|
2544
|
+
} | {
|
|
2545
|
+
kind: 'polygon';
|
|
2546
|
+
sides: number;
|
|
2547
|
+
rotation: number;
|
|
2548
|
+
center?: {
|
|
2549
|
+
x: number;
|
|
2550
|
+
y: number;
|
|
2551
|
+
};
|
|
2552
|
+
radius?: number;
|
|
2553
|
+
} | {
|
|
2554
|
+
kind: 'star';
|
|
2555
|
+
points: number;
|
|
2556
|
+
innerRadiusRatio: number;
|
|
2557
|
+
rotation: number;
|
|
2558
|
+
center?: {
|
|
2559
|
+
x: number;
|
|
2560
|
+
y: number;
|
|
2561
|
+
};
|
|
2562
|
+
outerRadius?: number;
|
|
2563
|
+
} | {
|
|
2564
|
+
kind: 'pencil';
|
|
2565
|
+
samples: ReadonlyArray<DragSample>;
|
|
2566
|
+
} | {
|
|
2567
|
+
kind: 'text';
|
|
2568
|
+
text?: string;
|
|
2569
|
+
}
|
|
2570
|
+
/** A sticky note: a text node with a background, in the look its tool names. */
|
|
2571
|
+
| ({
|
|
2572
|
+
kind: 'sticky';
|
|
2573
|
+
text?: string;
|
|
2574
|
+
} & StickyStyle)
|
|
2575
|
+
/** A finished path in world coords, as the pen tool commits one. `bounds`
|
|
2576
|
+
* is its AABB. An open path takes no fill. `data` is laid under the path
|
|
2577
|
+
* and paint on the node's data: the form the path was drawn from
|
|
2578
|
+
* (`data.representation`), say. */
|
|
2579
|
+
| {
|
|
2580
|
+
kind: 'path';
|
|
2581
|
+
path: _weasel_js_geom.PolygonPath;
|
|
2582
|
+
closed: boolean;
|
|
2583
|
+
data?: Readonly<Record<string, unknown>>;
|
|
2584
|
+
} | {
|
|
2585
|
+
kind: 'image';
|
|
2586
|
+
src?: string;
|
|
2587
|
+
opacity?: number;
|
|
2588
|
+
/** Chrome-only: what the in-flight drag paints. Read by the overlay
|
|
2589
|
+
* layer, ignored by the insert dep. */
|
|
2590
|
+
preview?: 'bitmap' | 'outline';
|
|
2591
|
+
} | {
|
|
2592
|
+
kind: string;
|
|
2593
|
+
[extra: string]: unknown;
|
|
2594
|
+
};
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* Adapter dep for `resizeAction`: bounds-frame behaviors (e.g.
|
|
2598
|
+
* `clampMinSize`) and group-expansion (`expandIds`). Snapping is the `snap`
|
|
2599
|
+
* dep's.
|
|
2600
|
+
*
|
|
2601
|
+
* The generic is erased to `unknown` at the schema entry; consumers cast at
|
|
2602
|
+
* the call site.
|
|
2603
|
+
*/
|
|
2604
|
+
interface ResizePolicy<TPose> extends GestureLifecycleOptions {
|
|
2605
|
+
/** Bounds-frame constraints. Constrained to `TPose extends Bounds` since
|
|
2606
|
+
* constraints read/write `{x,y,width,height}`. For non-rect TPose pass `[]`. */
|
|
2607
|
+
constraints: TPose extends FramedBox ? BoundsConstraint<TPose>[] : never[];
|
|
2608
|
+
/** Group-expansion at gesture start. Identity (`ids => ids`) when group
|
|
2609
|
+
* resize isn't wanted. */
|
|
2610
|
+
expandIds: (ids: string[]) => string[];
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
/**
|
|
2614
|
+
* The names an action may declare in `requires`, and what each resolves to.
|
|
2615
|
+
*
|
|
2616
|
+
* This is the whole vocabulary of things an action can reach — selection,
|
|
2617
|
+
* scene, view, history, and the rest. The interface is declared in
|
|
2618
|
+
* `@weasel-js/routing`, which knows that an action names its dependencies but
|
|
2619
|
+
* owns only `activeTool` among them; these entries are the kit's, merged in from
|
|
2620
|
+
* outside exactly the way a consumer merges its own
|
|
2621
|
+
* (`declare module '@weasel-js/core'`).
|
|
2622
|
+
*/
|
|
2623
|
+
declare module '@weasel-js/routing' {
|
|
2624
|
+
interface DepSchema {
|
|
2625
|
+
/** Kit selection state — ids of currently selected nodes. */
|
|
2626
|
+
selection: SelectionApi;
|
|
2627
|
+
/** Current viewport — camera position + scale. */
|
|
2628
|
+
view: ViewApi;
|
|
2629
|
+
/**
|
|
2630
|
+
* Scene tree — structural reads + undoable mutations.
|
|
2631
|
+
*
|
|
2632
|
+
* The entry uses the fully-erased form `Scene<unknown, string, unknown>`
|
|
2633
|
+
* because `DepSchema` must be concrete; any `Scene<MyData, MyLayer,
|
|
2634
|
+
* MyPose>` is assignable to it. Actions that need a typed scene back
|
|
2635
|
+
* should cast: `deps.scene as Scene<MyData, MyLayer, MyPose>`.
|
|
2636
|
+
*/
|
|
2637
|
+
scene: Scene<unknown, string, unknown>;
|
|
2638
|
+
/** Undo/redo history bound to the current scene. */
|
|
2639
|
+
history: History;
|
|
2640
|
+
/** Area-select dep — AABB hit-test + selection read/write. Override
|
|
2641
|
+
* per-consumer for custom hit-testing (e.g. contain-mode). */
|
|
2642
|
+
areaSelect: AreaSelectDep;
|
|
2643
|
+
/** Topmost node at a world-space point. Optional: actions that read this
|
|
2644
|
+
* (e.g. `moveAction` reparent-on-drop) fall back to a no-op when the dep
|
|
2645
|
+
* isn't registered. */
|
|
2646
|
+
nodeAtPoint?: NodeAtPointDep;
|
|
2647
|
+
/** Insert dep — node factory for drag-to-insert. Override per-consumer to
|
|
2648
|
+
* provide a typed node factory (e.g. with custom data payloads). */
|
|
2649
|
+
insert: InsertDep;
|
|
2650
|
+
/** Where `insertAction` keeps its gesture in flight, so
|
|
2651
|
+
* `insert.adjustRotation` reaches the one in its own input scope.
|
|
2652
|
+
* Sourced by `<SceneCanvas>`; without it the rotation does nothing. */
|
|
2653
|
+
insertLive?: InsertLive;
|
|
2654
|
+
/** The params an action starts with in this scope when its binding
|
|
2655
|
+
* passes `given`, `<SceneCanvas tune>` included: what a tool's chrome
|
|
2656
|
+
* reads to draw what the action it binds will make. Sourced by
|
|
2657
|
+
* `<SceneCanvas>`. */
|
|
2658
|
+
actionParams?: (id: string, given?: Record<string, unknown>) => Record<string, unknown>;
|
|
2659
|
+
/** The container the `insert` dep puts new nodes into — every shape a
|
|
2660
|
+
* tool draws and every dropped image or text. Absent, or answering
|
|
2661
|
+
* `null`: the top of the tree. */
|
|
2662
|
+
insertInto?: InsertIntoDep;
|
|
2663
|
+
/** Snap dep: the sessions a gesture snaps through, over `<SceneCanvas
|
|
2664
|
+
* snap>`'s sources. Absent means no snapping. */
|
|
2665
|
+
snap?: SnapDep;
|
|
2666
|
+
/** The store the snap readout layer draws, for an action's own marks. Sourced by `<SceneCanvas>`. */
|
|
2667
|
+
snapReadout?: SnapReadoutDep;
|
|
2668
|
+
/**
|
|
2669
|
+
* The canvas's debug sink.
|
|
2670
|
+
* Sourced by `<SceneCanvas>`; absent while its `debug` overlay is off.
|
|
2671
|
+
* Actions report what they did here, and the overlay draws it.
|
|
2672
|
+
*/
|
|
2673
|
+
debug?: DebugSink;
|
|
2674
|
+
/** Where an action's `preview` draws what it would make, over the canvas.
|
|
2675
|
+
* Sourced by `<SceneCanvas>`. */
|
|
2676
|
+
previewPaths?: PreviewPathsDep;
|
|
2677
|
+
/** Viewport point of a world point on this canvas, or null before it mounts.
|
|
2678
|
+
* Sourced by `<SceneCanvas>`. */
|
|
2679
|
+
worldToClient?: (x: number, y: number) => {
|
|
2680
|
+
x: number;
|
|
2681
|
+
y: number;
|
|
2682
|
+
} | null;
|
|
2683
|
+
/** Lasso-select dep — polygon hit-test + selection read/write. */
|
|
2684
|
+
lassoSelect: LassoSelectDep;
|
|
2685
|
+
/** Edit-anchors dep — narrow read/write of one polygon's path. If
|
|
2686
|
+
* absent, `editAnchorsAction`'s `start` returns an empty handle (no-op). */
|
|
2687
|
+
editAnchors: EditAnchorsDep;
|
|
2688
|
+
/** What changes other nodes along with a whole-node transform, in order;
|
|
2689
|
+
* add one with `useTransformFollower`. Absent: only what it transforms changes. */
|
|
2690
|
+
transformFollowers?: readonly TransformFollower[];
|
|
2691
|
+
/** The transforms a path being edited should stay its own image under.
|
|
2692
|
+
* Absent: an anchor drag moves only what is dragged. */
|
|
2693
|
+
pathSymmetry?: PathSymmetryDep;
|
|
2694
|
+
/**
|
|
2695
|
+
* Text-edit dep — activates the in-place text editing overlay. Sourced
|
|
2696
|
+
* from consumer via `useTextEdit` / `useSceneTextEdit`.
|
|
2697
|
+
*
|
|
2698
|
+
* The optional `isTextNode` predicate guards against entering edit mode on
|
|
2699
|
+
* non-text nodes. A binding can pre-filter instead with a
|
|
2700
|
+
* `target: 'kind:text:selected'` spec; the guard remains for consumers who
|
|
2701
|
+
* bind the broader `'selected-body'` target or opted out of routing.
|
|
2702
|
+
*/
|
|
2703
|
+
textEdit: TextEditDep;
|
|
2704
|
+
/**
|
|
2705
|
+
* Resize-policy dep — bounds constraints, point-snap behaviors and
|
|
2706
|
+
* group expansion for `resizeAction`. Optional: when omitted,
|
|
2707
|
+
* `resizeAction` falls back to identity defaults. Consumers wire via
|
|
2708
|
+
* `useDepSource('resizePolicy', ...)` or the `useResizePolicy` helper.
|
|
2709
|
+
*/
|
|
2710
|
+
resizePolicy?: ResizePolicy<unknown>;
|
|
2711
|
+
/**
|
|
2712
|
+
* How to read and rewrite a pose — bounds, translate, remap, rotation. Every
|
|
2713
|
+
* built-in action that touches a pose reads it. Sourced by `<SceneCanvas>`
|
|
2714
|
+
* from its `poseDescriptor` prop; `AUTO_POSE_DESCRIPTOR` when absent.
|
|
2715
|
+
*/
|
|
2716
|
+
poseDescriptor?: PoseDescriptor<unknown>;
|
|
2717
|
+
/** Whether the box resize, rotate, flip, align, and distribute work against
|
|
2718
|
+
* includes the stroke. From `<SceneCanvas geometry.boundsIncludeStroke>`;
|
|
2719
|
+
* absent means `true`. */
|
|
2720
|
+
boundsIncludeStroke?: boolean;
|
|
2721
|
+
/**
|
|
2722
|
+
* Booleans adapter — read selection ids, fetch world-space `Path`s,
|
|
2723
|
+
* compare z-order, and mint result nodes for Pathfinder ops.
|
|
2724
|
+
*
|
|
2725
|
+
* Consumers wire via `useBooleansAdapter(adapter)`.
|
|
2726
|
+
*/
|
|
2727
|
+
booleansAdapter?: BooleansAdapter;
|
|
2728
|
+
/**
|
|
2729
|
+
* Create Outlines adapter — read selection ids, resolve text nodes, and
|
|
2730
|
+
* mint the path nodes that replace them. Consumers wire it with
|
|
2731
|
+
* `useCreateOutlinesAdapter(adapter)`; the `createOutlines` action reads it
|
|
2732
|
+
* in both its `enabled` predicate and its invoker.
|
|
2733
|
+
*/
|
|
2734
|
+
createOutlinesAdapter?: CreateOutlinesAdapter;
|
|
2735
|
+
/** Gesture dispatcher control surface, so an action can abort an
|
|
2736
|
+
* in-flight handle (Escape cancels a drag, etc.). */
|
|
2737
|
+
dispatcher?: {
|
|
2738
|
+
cancelAll(reason: 'commit' | 'cancel'): void;
|
|
2739
|
+
};
|
|
2740
|
+
/**
|
|
2741
|
+
* Layout-strategy lookup. Sourced by `<SceneCanvas>` from the scene.
|
|
2742
|
+
* Optional: absent (or all-null) → `moveAction` skips reflow.
|
|
2743
|
+
*/
|
|
2744
|
+
layout?: LayoutDep;
|
|
2745
|
+
/** Which containers a move may drop into; see {@link CanDropIntoDep}. */
|
|
2746
|
+
canDropInto?: CanDropIntoDep;
|
|
2747
|
+
/**
|
|
2748
|
+
* Slice dep — the commit for the Slice action. `<SceneCanvas>` publishes
|
|
2749
|
+
* `useSliceDepSource`; a consumer overrides it with `useSliceDep`.
|
|
2750
|
+
*
|
|
2751
|
+
* Optional: when absent, `sliceAction` is a no-op.
|
|
2752
|
+
*/
|
|
2753
|
+
slice?: SliceDep;
|
|
2754
|
+
/** Clipboard dep; see {@link ClipboardDep}. `clipboard.copy` and
|
|
2755
|
+
* `clipboard.cut` both no-op when it is absent. */
|
|
2756
|
+
clipboard?: ClipboardDep;
|
|
2757
|
+
/**
|
|
2758
|
+
* Optional consumer commit hook. When present, `moveAction` (and other
|
|
2759
|
+
* default actions) submit their committed ops through it instead of
|
|
2760
|
+
* `scene.applyBatch`, so apps with their own history integration
|
|
2761
|
+
* (checkpoint + push entry) capture the gesture as one undo entry.
|
|
2762
|
+
* When absent, commits fall back to `scene.applyBatch`.
|
|
2763
|
+
*/
|
|
2764
|
+
applyOps?: (ops: Op[], label: string) => void;
|
|
2765
|
+
/**
|
|
2766
|
+
* Ingestion dep — canvas viewport rect + consumer file→src resolver.
|
|
2767
|
+
* Optional: when absent, the `ingest` action no-ops (there is no
|
|
2768
|
+
* placement geometry to work with).
|
|
2769
|
+
*/
|
|
2770
|
+
ingestion?: IngestionDep;
|
|
2771
|
+
/**
|
|
2772
|
+
* Optional consumer seam for the eager-sync layer: lets pose-transform
|
|
2773
|
+
* actions (resize/move/nudge/flip — NOT rotate) ALSO rewrite a node's
|
|
2774
|
+
* data-held geometry. Given a node and the affine `m` applied to its pose,
|
|
2775
|
+
* `transform(node, m)` returns updated `data` (geometry mapped by `m`) or
|
|
2776
|
+
* `null` for nodes with no data-held geometry.
|
|
2777
|
+
*
|
|
2778
|
+
* Strictly opt-in: when absent (or when `transform` returns null), the kit
|
|
2779
|
+
* emits only the pose op and leaves `data` untouched. Rotate intentionally
|
|
2780
|
+
* never consults this seam (rotation lives on the pose, baked at render).
|
|
2781
|
+
*/
|
|
2782
|
+
geometryProjection?: GeometryProjection;
|
|
2783
|
+
/**
|
|
2784
|
+
* The surface's own camera. Inside a `<CanvasView>`, `view` answers that
|
|
2785
|
+
* view's camera and this one does not change: an action bound in a view
|
|
2786
|
+
* that must move the main camera — a minimap's pan — reads this.
|
|
2787
|
+
*/
|
|
2788
|
+
rootView: ViewApi;
|
|
2789
|
+
/**
|
|
2790
|
+
* The pointer store in scope: where the pointer is, in which view. Shared
|
|
2791
|
+
* by every surface under one `<PointerContextProvider>`.
|
|
2792
|
+
*/
|
|
2793
|
+
pointer?: _weasel_js_routing_react.PointerContextValue;
|
|
2794
|
+
/**
|
|
2795
|
+
* The touch or pen long-press being held, if any: where, since when, how
|
|
2796
|
+
* far through, and whether any binding would fire on it. Sourced by
|
|
2797
|
+
* `<SceneCanvas>` from its gesture dispatcher; press feedback reads it.
|
|
2798
|
+
*/
|
|
2799
|
+
longPress?: LongPressState;
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
export { type SnapCollect as $, type AnchorMarkerShape as A, type PathEditTarget as B, type ContentHandlerEntry as C, type Dims as D, type EditAnchorsDep as E, type FitViewToBoundsOptions as F, type GestureLifecycleOptions as G, type HandleLocks as H, type InertiaConfig as I, type FinishedEditFrame as J, type PathSymmetryDep as K, type LayerHit as L, type BooleanOpOptions as M, type BooleansAdapter as N, type BooleanOp as O, type PathEditMark as P, type PathPaint as Q, type RenderLayer as R, type SnapSource as S, type TransformFollower as T, type BooleanOpResult as U, type ViewAnimationOptions as V, type BooleanStrokes as W, type SnapMods as X, type SourceCandidate as Y, type SnapProbeAt as Z, _resetPaintKindsForTests as _, type PathEditExtension as a, type SnapEdges as a$, type SnapMark as a0, type SnapDep as a1, type SnapOutcome as a2, type SnapReadoutStyle as a3, type AngleCandidate as a4, type AngleCollect as a5, type AnimateToBoundsOptions as a6, type AreaSelectDep as a7, type BooleanOpPreview as a8, type BooleanPreviewPiece as a9, type NodeAtPointDep as aA, type OutlinePathSpec as aB, PATH_OVERLAY_ROLES as aC, type PaintKind as aD, type PaintKindEditorProps as aE, type PaintKindFamily as aF, type PaintKindLoader as aG, type PanBounds as aH, type PathEditDrag as aI, type PathEditDragStart as aJ, type PathEditFinishCtx as aK, type PathEditHandleMove as aL, type PathEditMarksCtx as aM, type PathEditOther as aN, type PathEditPart as aO, type PathEditStore as aP, type PathForm as aQ, type PathOverlay as aR, type PathOverlayOptions as aS, type PathOverlayStyle as aT, type PathRepresentation as aU, type PathTransformFinishCtx as aV, type PreviewPathsDep as aW, type ResizePolicy as aX, STICKY_DEFAULTS as aY, type SnapBegin as aZ, type SnapEdge as a_, type CanDropIntoDep as aa, type ClipboardDep as ab, type ClipboardIngestCtx as ac, type CreateOutlinesResult as ad, type CustomPaintContext as ae, DEFAULT_LAYER_RETAIN as af, type DecayLoopConfig as ag, type FinishedPathEdit as ah, GEOMETRY_BOUND_DATA as ai, type HandleLock as aj, type HitTestView as ak, type IngestCtx as al, type IngestionDep as am, type InsertDep as an, type InsertEnds as ao, type InsertExtras as ap, type InsertIntoDep as aq, type InsertLive as ar, type LassoSelectDep as as, type LayerCommandCache as at, type LayerDrawFailure as au, type LayerDrawSpan as av, type LayerRetainPolicy as aw, type LayoutDep as ax, type Locus as ay, type MinSize as az, type SnapGesture as b, type SnapMarks as b0, type SnapReadoutDep as b1, type SvgUnpacker as b2, type TextEditDep as b3, type TextNodeData as b4, type TransformPreviewNode as b5, type TransientPath as b6, VIEW_ANIMATION_KEY as b7, type ViewAnimationApi as b8, type ViewApi as b9, registerPaintKindLoader as bA, seedTile as bB, stickyData as bC, stickyNodeFactory as bD, subscribeToSources as bE, switchGradientKind as bF, textBoxOf as bG, useDecayLoop as bH, useViewAnimation as bI, useViewAnimationOn as bJ, viewAxes as bK, withoutGeometryBoundData as bL, type ViewChannel as ba, applyBooleanOp as bb, applyCreateOutlines as bc, asPaint as bd, createPathOverlay as be, createSnapOutcomeStore as bf, depsUnchanged as bg, drawLayers as bh, drawOneLayer as bi, fitViewToBounds as bj, getPaintKind as bk, isLayerPainted as bl, isLayerVisible as bm, listGradientKinds as bn, listPaintKinds as bo, minSizeOf as bp, paintKindOf as bq, paintKindRegistry as br, paintedLayers as bs, paintsLayer as bt, paletteInsertPaint as bu, pathPaintOf as bv, patternFamily as bw, previewBooleanOp as bx, registerContentHandler as by, registerPaintKind as bz, type SnapConstrain as c, type SnapResizeBox as d, type SnapGeometry as e, type SnapOutcomeStore as f, type SnapSession as g, type ViewportDims as h, type RedrawSource as i, type EditAnchorsParams as j, type SliceDep as k, type StickyStyle as l, type ChromeState as m, type LayerGroup as n, type GeometryProjection as o, type InsertNodeFactory as p, type InsertPaint as q, type SvgIngestOptions as r, type SceneCanvasSnap as s, type Affordance as t, type AffordanceRegion as u, type AffordanceBinding as v, type CommonAffordanceScratch as w, type TextOverflow as x, type CreateOutlinesAdapter as y, type PaintKindEntry as z };
|