@weasel-js/core 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +587 -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 +41 -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 +40 -39
- package/dist/barrel/paint.js +12 -11
- package/dist/barrel/paths.js +39 -13
- package/dist/barrel/renderer.js +24 -14
- package/dist/barrel/routing.js +69 -58
- package/dist/barrel/scene.js +48 -37
- package/dist/barrel/text.js +10 -9
- package/dist/barrel/viewport.js +47 -45
- package/dist/canvas/Canvas.js +189 -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 +110 -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/canvasPassThrough.js +72 -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 +36 -29
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +318 -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 +83 -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 +19 -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 +30 -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 +68 -35
- 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/useBuiltinRigTools.js +65 -0
- package/dist/canvas/SceneCanvas/useBuiltinRigTools.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 +29 -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/useCanvasDispatcher.js +24 -14
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +30 -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 +110 -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 +40 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +100 -44
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js +163 -0
- package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useScenePicking.js +69 -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 +159 -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 +108 -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 +274 -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 +53 -31
- 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 +156 -71
- 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/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 +253 -63
- 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 +176 -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/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 +58 -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/view.js +46 -34
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +154 -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 +116 -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 +65 -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 +41 -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 +20 -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 +63 -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 +36 -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 +202 -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 +91 -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/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 +112 -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 +7 -3
- package/dist/clipboard.js +4 -3
- package/dist/{clone-C0eADtS0.d.ts → clone-DZDrfIlU.d.ts} +20 -53
- package/dist/clone.d.ts +5 -4
- 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/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/pages/fitViewToPage.js +13 -11
- package/dist/core/pages/fitViewToPage.js.map +1 -1
- package/dist/core/pages/pages.js +73 -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 +16 -12
- 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/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/editMode.js +11 -11
- package/dist/core/scene/editMode.js.map +1 -1
- package/dist/core/scene/effectivePose.js +167 -51
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +95 -75
- package/dist/core/scene/fieldEdits.js.map +1 -1
- package/dist/core/scene/historyFacade.js +126 -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 +118 -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 +90 -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 +133 -80
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +62 -49
- package/dist/core/scene/sceneEdits.js.map +1 -1
- package/dist/core/scene/sceneMutators.js +44 -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 +89 -73
- package/dist/core/scene/sceneRecording.js.map +1 -1
- package/dist/core/scene/sceneSelection.js +23 -16
- package/dist/core/scene/sceneSelection.js.map +1 -1
- package/dist/core/scene/sceneState.js +54 -36
- package/dist/core/scene/sceneState.js.map +1 -1
- package/dist/core/scene/serialization.js +87 -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 +15 -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 +25 -18
- 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 +43 -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-Camw_yeu.d.ts +169 -0
- package/dist/debug/createDebugOverlayLayer.js +303 -215
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js +68 -47
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/defaultTheme.js +16 -4
- package/dist/debug/defaultTheme.js.map +1 -1
- 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/parseDebugFlags.js +25 -17
- 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-Cgfu_G9s.d.ts +3581 -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 +52 -26
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +80 -34
- 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 +178 -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 +78 -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 +109 -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 +71 -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/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 +91 -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 +31 -0
- package/dist/features/snap/roles.js.map +1 -0
- package/dist/features/snap/rotationSource.js +30 -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 +79 -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 +129 -0
- package/dist/features/snap/session2d.js.map +1 -0
- package/dist/features/snap/spanSnap.js +77 -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 +556 -0
- package/dist/icons2.table.js +9 -0
- package/dist/icons2.table.js.map +1 -0
- package/dist/index.d.ts +4259 -5074
- package/dist/index.js +340 -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 +76 -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 +67 -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 +61 -33
- 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 +52 -35
- 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 +79 -52
- 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 +62 -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 +31 -0
- package/dist/interactions/actions/drawnBoxes.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/action.js +248 -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 +61 -19
- 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 +119 -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 +93 -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 +71 -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/placeAction.js +108 -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 +57 -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 +87 -52
- package/dist/interactions/actions/move/action.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +56 -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 +43 -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 +83 -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 +72 -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 +40 -25
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -1
- package/dist/interactions/actions/move/layout/container.js +92 -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 +136 -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 +85 -56
- package/dist/interactions/actions/move/session.js.map +1 -1
- package/dist/interactions/actions/move/translate.js +58 -43
- package/dist/interactions/actions/move/translate.js.map +1 -1
- 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 +68 -39
- 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 +75 -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 +95 -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 +68 -42
- package/dist/interactions/actions/rotate/action.js.map +1 -1
- package/dist/interactions/actions/rotate/commit.js +39 -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 +115 -76
- package/dist/interactions/actions/rotate/session.js.map +1 -1
- package/dist/interactions/actions/selectionSubtree.js +124 -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 +50 -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/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 +80 -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 +7 -6
- package/dist/move.js +4 -3
- package/dist/{originProjection-CoNVpITV.d.ts → options-p9GZMXbY.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 +10 -28
- package/dist/resize.js +6 -7
- 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 +22 -16
- package/dist/test-hook/useTestHook.js.map +1 -1
- package/dist/test-seams.d.ts +164 -1
- package/dist/test-seams.js +8 -3
- package/dist/tools/builtin/bone/boneActions.js +96 -70
- package/dist/tools/builtin/bone/boneActions.js.map +1 -1
- package/dist/tools/builtin/bone/boneOverlay.js +49 -36
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -1
- package/dist/tools/builtin/bone/placedRig.js +18 -14
- package/dist/tools/builtin/bone/placedRig.js.map +1 -1
- package/dist/tools/builtin/bone/rigEditState.js +22 -13
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -1
- package/dist/tools/builtin/bone/useBoneTool.js +68 -41
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -1
- 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 +60 -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/builtin/weight/useWeightTool.js +66 -42
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -1
- package/dist/tools/builtin/weight/weightActions.js +93 -65
- package/dist/tools/builtin/weight/weightActions.js.map +1 -1
- package/dist/tools/builtin/weight/weightOverlay.js +47 -30
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -1
- 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-CHVXGfYm.d.ts} +5 -5
- 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 +35 -23
- 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/util/constrainTo45.js +0 -17
- package/dist/util/constrainTo45.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeReads.js","names":[
|
|
1
|
+
{"version":3,"file":"treeReads.js","names":[],"sources":["../../../src/core/scene/treeReads.ts"],"sourcesContent":["/** The scene's reads of one node and its place in the tree. */\nimport type { Node, NodeId, Scene } from './types';\n\nexport function createTreeReads<TData, TLayer extends string, TPose>(\n nodes: ReadonlyMap<NodeId, Node<TData, TLayer, TPose>>,\n): Pick<Scene<TData, TLayer, TPose>, 'get' | 'incarnation' | 'childrenOf' | 'ancestorsOf'> {\n // Keyed by node object: every entry into `nodes` is a fresh object and\n // every edit mutates it in place, which is exactly an incarnation's lifetime.\n const incarnations = new WeakMap<object, number>();\n let nextIncarnation = 1;\n\n return {\n get: (id) => nodes.get(id),\n\n incarnation(id) {\n const node = nodes.get(id);\n if (!node) return undefined;\n let token = incarnations.get(node);\n if (token === undefined) {\n token = nextIncarnation++;\n incarnations.set(node, token);\n }\n return token;\n },\n\n childrenOf(id) {\n const n = nodes.get(id);\n return n && n.kind === 'container' ? n.children : [];\n },\n\n ancestorsOf(id) {\n const out: NodeId[] = [];\n let cur = nodes.get(id)?.parent ?? null;\n while (cur !== null) {\n out.push(cur);\n cur = nodes.get(cur)?.parent ?? null;\n }\n return out;\n },\n };\n}\n"],"mappings":";AAGA,SAAgB,gBACd,OACyF;CAGzF,MAAM,+BAAe,IAAI,QAAwB;CACjD,IAAI,kBAAkB;CAEtB,OAAO;EACL,MAAM,OAAO,MAAM,IAAI,EAAE;EAEzB,YAAY,IAAI;GACd,MAAM,OAAO,MAAM,IAAI,EAAE;GACzB,IAAI,CAAC,MAAM,OAAO;GAClB,IAAI,QAAQ,aAAa,IAAI,IAAI;GACjC,IAAI,UAAU,QAAW;IACvB,QAAQ;IACR,aAAa,IAAI,MAAM,KAAK;GAC9B;GACA,OAAO;EACT;EAEA,WAAW,IAAI;GACb,MAAM,IAAI,MAAM,IAAI,EAAE;GACtB,OAAO,KAAK,EAAE,SAAS,cAAc,EAAE,WAAW,CAAC;EACrD;EAEA,YAAY,IAAI;GACd,MAAM,MAAgB,CAAC;GACvB,IAAI,MAAM,MAAM,IAAI,EAAE,CAAC,EAAE,UAAU;GACnC,OAAO,QAAQ,MAAM;IACnB,IAAI,KAAK,GAAG;IACZ,MAAM,MAAM,IAAI,GAAG,CAAC,EAAE,UAAU;GAClC;GACA,OAAO;EACT;CACF;AACF"}
|
package/dist/core/scene/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["asNodeId","s"],"sources":["../../../src/core/scene/types.ts"],"sourcesContent":["import type { History, SerializedHistory } from '@weasel-js/history';\nimport type { SerializedSceneHistory } from './historyForm';\nimport type { ParallaxOpts } from '../viewport/parallax';\nimport type { UnitScope } from '@weasel-js/quantity';\nimport type { LayoutStrategy } from '../../layout/types';\nimport type { AddLayerSpec, LayerRecord, SystemLayerRecord, SystemLayerSpec, UserLayerRecord } from './layerTypes';\nimport type { LayoutFrame, LayoutMove } from './layoutTypes';\nimport type { PoseComposition } from './composeFrame';\nimport type { PoseLinear } from '@weasel-js/geom';\nimport type { PoseHold, PoseOverride, PoseOverrides } from './poseOverrideTypes';\nimport type { SerializedLayer, SerializedNode, SerializedScene } from './serializedTypes';\n\nexport type { AddLayerSpec, LayerRecord, SystemLayerRecord, SystemLayerSpec, UserLayerRecord };\nexport type { LayoutFrame, LayoutMove, PoseHold, PoseOverride, PoseOverrides, SerializedLayer, SerializedNode, SerializedScene };\n\n/**\n * Axis-aligned rectangle pose with optional rotation. Rotation is in\n * radians, pivoted on the unrotated AABB center; absent === 0.\n */\nexport interface RectPose {\n x: number;\n y: number;\n width: number;\n height: number;\n /** Rotation in radians around the unrotated AABB center. Absent === 0. */\n rotation?: number;\n /** A skew or per-axis scale the box and rotation cannot hold; see\n * {@link PoseLinear}. Absent is the identity. */\n transform?: PoseLinear;\n}\n\n/**\n * # SceneNode — the thing in the scene\n *\n * Everything the user sees on the canvas — a shape, a group, an annotation,\n * a tile — is a node. Containers and leaves are both nodes; the kit has no\n * other concept of \"scene element.\"\n *\n * Every node carries three independent slots, plus its tree position:\n *\n * - **`data: TData`** — app-defined payload. The kit never inspects it.\n * - **`pose: TPose`** — local transform, relative to the node's direct\n * parent (or world, for root nodes).\n * - **`layer: TLayer`** — a string tag associating the node with a\n * visual `RenderLayer` at draw time. Separate from `LayerRecord` (the\n * per-layer visible/locked metadata held by the `Scene`).\n *\n * Nodes are addressed by `NodeId` everywhere outside the scene tree. Don't\n * hold references to a `Node` object across scene updates; look up by id\n * when you need the latest.\n *\n * The kit-internal name is `Node`; the public re-export is `SceneNode`\n * (avoids collision with DOM `Node` at call sites).\n */\n\n/** Opaque branded id. Treat as opaque outside the kit. */\nimport type { NodeId } from '@weasel-js/routing';\nexport type { NodeId };\n\n/** Brand a string as a NodeId. */\nexport const asNodeId = (s: string): NodeId => s as NodeId;\n\nimport type { DerivedDep, Bivariant, DerivePathFn, DerivePoseFn, ClipFromPoseFn, CopiesFromPoseFn } from './nodeFnTypes';\nexport type { DerivedDep, Bivariant, DerivePathFn, DerivePoseFn, ClipFromPoseFn, CopiesFromPoseFn };\n\ninterface NodeBase<TData, TLayer extends string, TPose> {\n id: NodeId;\n layer: TLayer;\n pose: TPose;\n data: TData;\n parent: NodeId | null;\n /** Nodes whose poses this node's geometry is computed from. Fixed at add\n * time. Absent or empty means the node's geometry is authored, which is the\n * normal case.\n *\n * `'children'` means \"my own children, in child order\" — a container that\n * hugs its contents, which a fixed id list cannot express because\n * reparenting would have to maintain it. The two forms differ in lifetime\n * as well as in membership: deleting a node deletes everything that names\n * it in `dependsOn`, but a container outlives the children it derives\n * from — an emptied group is still a group. */\n dependsOn?: readonly NodeId[] | 'children';\n /** Whether the hit-test walk can return this node. Default `true`; `false`\n * makes it transparent to picking, so a click on it lands on whatever is\n * behind — normally its own container.\n *\n * For content a container owns rather than content the user selects on its\n * own: the label inside a box, a body's rows. It does not hide the node\n * from anything else — it still paints, still clips, and a consumer can\n * still select it by id. */\n pickable?: boolean;\n /** Computes this node's path from its dependencies, in `dependsOn` order —\n * each one the node and the pose it is painted at.\n * A dependency that has been removed arrives as `undefined`.\n * Returning `null` means \"nothing to draw right now\". Re-evaluated when a\n * dependency's world pose changes, never authored. */\n derivePath?: DerivePathFn<TPose, TData, TLayer>;\n /** Computes this node's pose from its dependencies' poses, the same way\n * `derivePath` computes its path — same `dependsOn` list, same\n * registry-keyed serialization.\n *\n * Where a derived path is resolved at paint time and reaches only the\n * painter, a derived pose is what the node *is* at: it feeds bounds,\n * hit-testing, selection chrome, snapping and layout, and every reader\n * gets it through `effectivePose`. A pose override still wins over it.\n *\n * Returning `null` means \"I have nothing to derive from right now\", and\n * the node falls back to its authored `pose`. `setPose` on a derived node\n * still writes that authored pose; it is simply not what anything reads. */\n derivePose?: DerivePoseFn<TPose, TData, TLayer>;\n}\n\n/** A node with no children — a shape, a label, an image. */\nexport interface LeafNode<TData, TLayer extends string, TPose = RectPose>\n extends NodeBase<TData, TLayer, TPose> {\n kind: 'leaf';\n}\n\n/** A node with an ordered list of children. This is the real group: what\n * Cmd+G creates, what SVG `<g>` round-trips to. A container has its own pose,\n * which its children's poses are relative to, and may optionally clip them. */\nexport interface ContainerNode<TData, TLayer extends string, TPose = RectPose>\n extends NodeBase<TData, TLayer, TPose> {\n kind: 'container';\n children: NodeId[];\n /** Optional clip-path source. Re-evaluated each render. Returning `null`\n * means \"no clip for this container right now\"; an empty / zero-area path\n * means \"clip everything out\" (children render nowhere). */\n clipFromPose?: ClipFromPoseFn<TPose>;\n /** Draws the whole subtree again under each affine it returns, on top of\n * the original, which still draws once as authored. The copies are paint,\n * not nodes: nothing stores them, so they follow every edit to the\n * children, and a pick that lands on one answers with the child it copies.\n * A copy is a copy of the clipped content — the clip travels with it.\n * Re-evaluated each render; `null` or `[]` draws no copies. */\n copiesFromPose?: CopiesFromPoseFn<TPose, TData, TLayer>;\n /** How this container arranges its children. Whenever the container's\n * child set or order changes, or its bounds change size, the scene hands\n * the change to the strategy — `depart` for children that left it,\n * `arrive` for children that joined it, `childPoses` otherwise — and records the poses it writes in the same\n * undo entry as the change. A drag reads it too: it is the layout `move`\n * reflows and drops against. */\n layout?: LayoutStrategy<TPose>;\n /** The unit system this container's contents are written in, and what one\n * of its base units is worth in the enclosing scope's. It covers the\n * children, not the container; `sceneUnitScopes` reads the chain. */\n units?: UnitScope;\n}\n\n/** A node in the scene tree: either a leaf or a container. Re-exported\n * publicly as `SceneNode`, to avoid colliding with the DOM's `Node`. */\nexport type Node<TData, TLayer extends string, TPose = RectPose> =\n | LeafNode<TData, TLayer, TPose>\n | ContainerNode<TData, TLayer, TPose>;\n\n/** What `Scene.add` needs to mint a node. Everything except the id is\n * required; the id is generated unless one is supplied. */\nexport interface AddNodeSpec<TData, TLayer extends string, TPose = RectPose> {\n kind: 'leaf' | 'container';\n layer: TLayer;\n pose: TPose;\n data: TData;\n parent?: NodeId | null;\n index?: number;\n /** Explicit id wins over the Scene's `generateId` and the kit default. */\n id?: NodeId;\n /** Mirrors `SceneNode.pickable`. Omit for the default, which is pickable. */\n pickable?: boolean;\n /** Only meaningful when `kind === 'container'`. Attach a clip-path function\n * to the node; ignored for leaves. Mirrors `ContainerNode.clipFromPose`. */\n clipFromPose?: ClipFromPoseFn<TPose>;\n /** Mirrors `ContainerNode.copiesFromPose`; ignored for leaves. */\n copiesFromPose?: CopiesFromPoseFn<TPose, TData, TLayer>;\n /** Mirrors `SceneNode.dependsOn`. */\n dependsOn?: readonly NodeId[] | 'children';\n /** Mirrors `SceneNode.derivePath`. Taken as a live function; its registry key is\n * looked up from it, never passed in. */\n derivePath?: DerivePathFn<TPose, TData, TLayer>;\n /** Mirrors `SceneNode.derivePose`, on the same terms as `derivePath`. */\n derivePose?: DerivePoseFn<TPose, TData, TLayer>;\n /** Mirrors `ContainerNode.layout`; ignored for leaves. */\n layout?: LayoutStrategy<TPose>;\n /** Mirrors `ContainerNode.units`; ignored for leaves. */\n units?: UnitScope;\n}\n\n/** A custom scene mutation registered with `Scene.registerOp`: how to apply\n * it and how to undo it. The pair is what makes it participate in history. */\nexport interface RegisteredOp<P> {\n apply: (payload: P) => void;\n revert: (payload: P) => void;\n /** Opts this kind into coalescing under `UseSceneOptions.coalesceWindowMs`:\n * two entries of this kind that return the same key inside the window\n * merge, and undoing the merged entry calls `revert` with the first\n * payload only. Declare it only when `revert` restores an absolute state\n * (a stored \"from\" value), never for a relative payload such as a delta.\n * Omitted, or returning `undefined`, the op is always its own entry. */\n coalesceKey?: (payload: P) => string | undefined;\n}\n\n/** Per-scene registry mapping string keys to live function references.\n * Passed to `createScene({ ..., registry })` and `sceneFromJSON(json, { registry })`.\n * Each function-field type has its own keyed map. */\nexport interface SceneRegistry<TPose, TData = unknown, TLayer extends string = string> {\n /** Maps registry keys to `clipFromPose` factory functions for container nodes. */\n clipFromPose?: Readonly<Record<string, ClipFromPoseFn<TPose>>>;\n /** Maps registry keys to `copiesFromPose` functions for container nodes. */\n copiesFromPose?: Readonly<Record<string, CopiesFromPoseFn<TPose, TData, TLayer>>>;\n /** Maps registry keys to `derivePath` functions for nodes with `dependsOn`. */\n derivePath?: Readonly<Record<string, DerivePathFn<TPose, TData, TLayer>>>;\n /** Maps registry keys to `derivePose` functions for nodes with `dependsOn`. */\n derivePose?: Readonly<Record<string, DerivePoseFn<TPose, TData, TLayer>>>;\n /** Maps registry keys to container layout strategies. */\n layout?: Readonly<Record<string, LayoutStrategy<TPose>>>;\n // A new function field is a row in `NODE_FN_FIELDS` (core/scene/nodeFnFields.ts)\n // plus its entry here; the field name is the registry key by construction.\n}\n\n/**\n * Decides what one edit's changes to containers do to their children.\n * `arrivals` maps each container to the ids that joined it — by an `add`\n * under it or a `move` into it, whatever op or call made them — in the order\n * they arrived. `changed` names every container whose child set or order\n * changed, or whose pose changed size, arrivals included. Both are read once\n * the edit's other mutations have landed.\n *\n * Return the poses to write, in each node's stored frame; they become part of\n * the same edit, and so of the same undo step. An empty map writes nothing.\n * Return `null` to refuse: the whole edit is reverted (see\n * `SceneArrivalRefused`).\n *\n * Runs only for live edits. Undo, redo and a restored history replay the\n * arrangement that was decided the first time. With none installed, a scene\n * holding declared layouts (`ContainerNode.layout`) runs its own.\n */\nexport type SceneArrivalHandler<TPose> = (\n arrivals: ReadonlyMap<NodeId, readonly NodeId[]>,\n changed: ReadonlySet<NodeId>,\n /** The nodes that left each container in the edit, by the container they\n * left — removed, or moved out. */\n departures: ReadonlyMap<NodeId, readonly NodeId[]>,\n) => ReadonlyMap<NodeId, TPose> | null;\n\n/** Options for `useScene` — the layers the scene has, what it starts out\n * holding, and how its history behaves. */\nexport interface UseSceneOptions<TData, TLayer extends string, TPose = RectPose> {\n systemLayers: readonly SystemLayerSpec<TLayer>[];\n initial?: readonly AddNodeSpec<TData, TLayer, TPose>[];\n ops?: Readonly<Record<string, RegisteredOp<unknown>>>;\n historyLimit?: number;\n /** Window (ms) within which consecutive same-shaped mutations merge into\n * the previous undo entry (matching per-op coalesce keys — e.g. repeated\n * `setPose` on the same node, or repeated `applyBatch` calls whose ops\n * carry matching `coalesceKey` multisets). `0` (default) disables\n * coalescing: every mutation is a discrete undo entry. Undo of a\n * coalesced entry returns to the state before the first merged mutation;\n * redo restores the latest. `scene.batch` entries never coalesce. */\n coalesceWindowMs?: number;\n generateId?: () => NodeId;\n /** Per-scene registry for non-serializable function fields (clipFromPose, etc.).\n * Required only when serializing/deserializing scenes that use function fields. */\n registry?: SceneRegistry<TPose, TData, TLayer>;\n /** How a child's pose folds into its container's. Default: it does not, and every pose is world. */\n composition?: PoseComposition<TPose>;\n /** How laid-out containers are measured. See {@link LayoutFrame}. */\n layoutFrame?: LayoutFrame<TPose>;\n /** When supplied, `scene.applyBatch` consults this on every call. If it returns a non-null\n * `Journal`, ops are routed to the journal's `applyBatch` instead of recording a new\n * parent-history entry, and undo and redo step that journal. The scene state changes as\n * normal; only the history tracking differs.\n *\n * When the accessor isn't known at scene-construction time, wire it after\n * construction via `scene.setActiveJournalAccessor(fn)`. */\n getActiveJournal?: () => import('@weasel-js/history').Journal | null;\n /** Re-render the host on every scene mutation. Default `true`. Set `false`\n * when the scene is read by a frame loop rather than by a render — a game\n * loop, a simulation — and nothing in the host's DOM derives from it.\n * Read by `useScene`; `createScene` ignores it. */\n subscribe?: boolean;\n}\n\n/**\n * The kit-owned scene tree: nodes, layers, and the undo history over both.\n *\n * A scene is logical, not visual — it says what exists and where, and nothing\n * about how it is painted. Every mutating method is undoable, and reads are\n * snapshots rather than live views. Nodes are addressed by `NodeId`; hold ids\n * across mutations, not node objects.\n *\n * Three type parameters keep it domain-agnostic: `TData` is the app's payload,\n * which the kit never inspects; `TPose` is the transform shape, `RectPose` by\n * default; `TLayer` is the union of layer names.\n */\nexport interface Scene<TData, TLayer extends string, TPose = RectPose> {\n // Reads\n readonly nodes: ReadonlyMap<NodeId, Node<TData, TLayer, TPose>>;\n readonly roots: readonly NodeId[];\n readonly layers: readonly LayerRecord<TLayer>[];\n /** The registry this scene resolves node functions against — the consumer's\n * entries over the kit's. */\n readonly registry: SceneRegistry<TPose, TData, TLayer>;\n /** See {@link UseSceneOptions.composition}. */\n readonly composition: PoseComposition<TPose>;\n get(id: NodeId): Node<TData, TLayer, TPose> | undefined;\n /** A token for the node `id` names right now, for telling one node from a\n * later one that reuses its id. It holds for as long as the node stays in\n * the scene, whatever edits it takes, and is different every time the id\n * enters the scene — by `add`, by an undo or redo that brings it back, or\n * by `loadState`. `undefined` when `id` is not in the scene. Compare tokens\n * for equality only; their order means nothing. */\n incarnation(id: NodeId): number | undefined;\n childrenOf(id: NodeId): readonly NodeId[];\n ancestorsOf(id: NodeId): readonly NodeId[];\n renderOrder(): Iterable<NodeId>;\n /** The same layer-major sequence as {@link Scene.renderOrder}, as the nodes\n * themselves. Prefer this wherever the ids are only going to be resolved\n * back to nodes. Cached until a structural edit, so repeat calls hand back\n * the same array — a snapshot, not a live view, and not yours to mutate. */\n renderOrderNodes(): readonly Node<TData, TLayer, TPose>[];\n /** The nodes on one layer, in render order. Cached alongside\n * {@link Scene.renderOrderNodes} until a structural edit. A snapshot, not\n * a live view, and not yours to mutate. An unknown layer id yields an\n * empty array. */\n nodesOnLayer(layer: TLayer): readonly Node<TData, TLayer, TPose>[];\n\n /** A fresh id from this scene's `generateId`, or the kit default: the id\n * `add` would give a spec with none. For code that has to name a node\n * before it exists, such as one building an insert op. */\n mintId(): NodeId;\n\n // Mutations (all auto-undoable)\n add(spec: AddNodeSpec<TData, TLayer, TPose>): NodeId;\n /** Delete `id`, its **entire subtree**, and **everything that derives from**\n * any of those nodes — a node listing one of them in `dependsOn` goes too,\n * along with its own subtree, transitively. A dependent can live anywhere in\n * the tree, so this deletes nodes the caller never named and may unlink\n * several disjoint subtrees at once. Recorded as one undoable step; `undo()`\n * restores every one of them where it was, child order intact. */\n remove(id: NodeId): void;\n /** {@link remove} over several roots at once, as a **single** undoable step.\n * Ids resolve against the tree as it stands at the call, so an id that\n * another one would cascade away is absorbed rather than removed twice —\n * which is what makes it safe to pass a whole selection. Throws if any id is\n * not in the scene; an empty list does nothing and records no step. */\n removeMany(ids: readonly NodeId[]): void;\n /** Every node {@link removeMany} would take if given `ids`: each id, its\n * subtree, everything deriving from any of those, and those nodes' subtrees\n * in turn. Ids not in the scene come back unchanged.\n *\n * A set, not a restore order: a dependent can be reached before the parent\n * it sits under, which is also in the closure. */\n removalClosure(ids: readonly NodeId[]): readonly NodeId[];\n update(id: NodeId, patch: { data: TData }): void;\n setPose(id: NodeId, pose: TPose): void;\n /** Retag `id` to `layer`. On a **container this cascades**: every descendant\n * is moved to the same layer, recorded as a **single** undo step.\n *\n * Invariants:\n * - **Layer floor** — a child may not render below its parent, so retagging\n * to a layer *below* the node's parent throws. Retagging to the parent's\n * layer or any higher one is allowed; a node with no parent is\n * unconstrained.\n * - **No-op elision** — setting the layer a node already has does nothing\n * and pushes **no** history entry. */\n setLayer(id: NodeId, layer: TLayer): void;\n /** Point `id` at a different set of dependencies — retargeting an edge's end\n * onto another node, or switching a container between an id list and\n * `'children'`. Recorded as one undoable step.\n *\n * Order is significant: a derivation reads its dependencies positionally,\n * so `[b, a]` is not `[a, b]`. Ids need not be in the scene — a declared\n * dependency that appears later invalidates the node when it does, the same\n * as one declared at `add`. Passing `undefined` drops the declaration, after\n * which nothing cascades the node away.\n *\n * **No-op elision** — declaring what the node already declares does nothing\n * and pushes no history entry. */\n setDependsOn(id: NodeId, dependsOn: readonly NodeId[] | 'children' | undefined): void;\n /** Give container `id` a different layout — a strategy, its key in\n * `SceneRegistry.layout`, or `null` for none — and re-arrange its children\n * under it, as one undoable step. Throws for a leaf, or a key the registry\n * does not hold. A registered layout is recorded by its key, so a\n * serialized history restores it; an unregistered one lives only as long\n * as the session.\n *\n * **No-op elision** — setting the layout a container already has does\n * nothing and pushes no history entry. */\n setLayout(id: NodeId, layout: LayoutStrategy<TPose> | string | null): void;\n /** Reparent `id` under `parent` (or to a root when `parent` is `null`) at\n * `index` within the new sibling list, appending when `index` is omitted.\n * Siblings are reindexed. Recorded as one undoable step.\n *\n * Rejected (throws) when:\n * - `parent` exists but is a **leaf**, not a container;\n * - the move would form a **cycle** — `parent` is `id` itself or one of\n * `id`'s own descendants;\n * - it would drop `id` **below its new parent's layer** (child may not\n * render below its parent).\n *\n * `move(id, null)` — detaching to a root — is always allowed regardless of\n * layer, since a root has no parent to render beneath. */\n move(id: NodeId, parent: NodeId | null, index?: number): void;\n /** Shift `id` to `index` within its **current** parent's child list. Unlike\n * {@link move}, the parent never changes — only sibling order. */\n reorder(id: NodeId, index: number): void;\n setLayerVisible(layer: TLayer, visible: boolean): void;\n /** Lock or unlock a layer. A locked layer still paints, but its nodes are\n * out of reach: picking and area selection pass over them, the selection\n * drops them, and every node mutation on them throws. Locking is never\n * blocked by the lock, and neither are the other layer operations. */\n setLayerLocked(layer: TLayer, locked: boolean): void;\n /** Set or clear (`undefined`) a layer's parallax — see\n * `LayerRecord.parallax`. Undoable; an animation tweening it writes inside\n * {@link Scene.untracked} so no frame becomes an undo step. */\n setLayerParallax(layer: TLayer, parallax: ParallaxOpts | undefined): void;\n /** Whether `id` sits on a locked layer or under a container that does.\n * A container's lock covers its whole subtree, whatever layers the\n * descendants are tagged to. An id not in the scene is not locked. */\n isLocked(id: NodeId): boolean;\n /** Run `fn` with the lock guard lifted, for a programmatic edit that has to\n * reach a locked node. Undo and redo never need it. */\n unlocked<T>(fn: () => T): T;\n addLayer(spec: AddLayerSpec<TLayer>): void;\n /** Drop a user layer and every node tagged to it, as one undoable step.\n * Removal cascades, so this also deletes nodes **on other layers** that\n * derive from a node on this one. */\n removeLayer(layer: TLayer): void;\n renameLayer(layer: TLayer, name: string): void;\n moveLayer(layer: TLayer, index: number): void;\n\n // Custom op seam\n registerOp<P>(kind: string, handler: RegisteredOp<P>): void;\n recordOp<P>(op: { kind: string; payload: P }): void;\n\n /** Install (or clear with `null`) the active-journal accessor after scene\n * construction, for a journal source built with `scene.history` as a\n * dependency. Overrides any `getActiveJournal` set in `UseSceneOptions`. */\n setActiveJournalAccessor(\n fn: (() => import('@weasel-js/history').Journal | null) | null,\n ): void;\n\n /** Install what the scene does when nodes join a container, replacing any\n * handler installed before; `null` removes it. Returns a function that\n * removes this handler, and does nothing once another has replaced it.\n * See {@link SceneArrivalHandler}. */\n setArrivalHandler(handler: SceneArrivalHandler<TPose> | null): () => void;\n\n /** Apply a batch of ops against `adapter` as one undo entry.\n *\n * The entry holds the scene writes the ops made, as a direct call records\n * them, and beside them any op that wrote no scene state, bound to\n * `adapter`. Undo restores those writes; it does not call an op's\n * `invert()` or the adapter again. **What an op states is not recorded**:\n * one applied over a document that already holds its result, as after an\n * `untracked` preview, records a write from that pose to itself, and undo\n * goes nowhere. Put the document back first.\n *\n * The entry lands in the open `batch` when there is one, else on the\n * active journal, else on the scene's own history, where it can coalesce\n * under `coalesceWindowMs` with one whose ops' keys match.\n *\n * Returns false when the arrival handler refused the batch: it is reverted\n * and unrecorded. Inside `batch` it is true; that batch may still refuse. */\n applyBatch(ops: import('core/ops/types').Op[], label: string, adapter: unknown): boolean;\n\n // Selection\n\n /** The transient set of active ids — \"operate on these N as a unit\".\n * Shared by every view over this scene unless a view supplies its own\n * (see `CanvasView.selection`). Not document content: it never appears\n * in `toJSON`. It does ride on history entries, so undo and redo put\n * back the selection an edit was made under; changing it is never an\n * undo step of its own. Removing a node deselects it. */\n getSelection(): readonly NodeId[];\n setSelection(ids: readonly NodeId[]): void;\n\n // Ephemeral presentation state\n\n /** Per-node pose / alpha overrides the render and hit-test paths read\n * through. Like {@link Scene.getSelection} this is not document content:\n * writes are never recorded, never serialized, and do not bump\n * {@link Scene.getVersion}. See {@link PoseOverrides}. */\n readonly overrides: PoseOverrides<TPose>;\n\n // History\n /** The scene's undo/redo engine, in the shape `@weasel-js/history` defines.\n * Mutating members route through\n * the scene's own wrappers, so an undo driven through this bumps\n * {@link Scene.getVersion} and notifies subscribers exactly as\n * {@link Scene.undo} does; `getVersion` / `subscribe` on it report the\n * engine's history version, not the scene's. */\n readonly history: History;\n undo(): boolean;\n redo(): boolean;\n canUndo(): boolean;\n canRedo(): boolean;\n batch<T>(label: string, fn: () => T): T;\n /** The layout container `id` declares, or `null` for a leaf or a\n * container that declares none. */\n layoutOf(id: NodeId): LayoutStrategy<TPose> | null;\n /** Declare the unit scope of container `id`, or clear it with `null`. */\n setUnits(id: NodeId, units: UnitScope | null): void;\n /** Called with the poses each live edit's layout pass wrote, after the\n * edit lands — never for an undo or redo, which restore poses rather than\n * arrange them. What a reflow animation glides from. */\n onReflow(listener: (moves: readonly LayoutMove<TPose>[]) => void): () => void;\n /** Run `fn` with every mutation applied but none recorded — for writes\n * that are not edits, such as a simulation stepping poses each frame.\n * Undo and redo move between recorded states and never restore an\n * untracked write; the next recorded change starts from whatever the\n * untracked writes left, so undoing it lands there. A `batch` inside\n * records nothing; inside a `batch`, these writes stay out of its entry.\n * Notifies once, reverts `fn`'s writes if it throws, and throws on\n * `applyBatch` and `history.apply` / `applyOps`, which exist to record. */\n untracked<T>(fn: () => T): T;\n /** Read-only snapshot of every history entry currently reachable from\n * the present state. Oldest applied first, then redoable entries in\n * the order they'd be re-applied. Each entry id is stable. */\n historyEntries(): readonly { id: string; label: string }[];\n /** Index of the \"current state\". Equals the count of applied entries;\n * `0` means \"nothing applied\" (initial). */\n historyIndex(): number;\n /** Jump to the given history index, clamped to [0, total]. Returns true\n * if any movement occurred. */\n jumpToHistoryIndex(index: number): boolean;\n\n // History persistence\n /** Snapshot the undo/redo history in a JSON-serializable form (the\n * engine's `SerializedHistory`, marked with the scene's recorded form).\n * An entry holds the scene's own ops, whichever way the edit was made.\n * An op handed to `applyBatch` that wrote no scene state is held as\n * itself, and an entry with a nameless one is dropped. Payload\n * JSON-safety (e.g. typed arrays inside poses) is the caller's concern.\n * Do not call mid-`batch` — the open batch's ops are not yet recorded. */\n serializeHistory(): SerializedSceneHistory;\n /** Replace the undo/redo history from a `serializeHistory()` snapshot.\n * Call on a scene whose node/layer state already matches the snapshot's\n * head state (i.e. right after `loadState` from the paired scene\n * snapshot); node state is NOT mutated. Ops re-registered via\n * `registerOp` before this call round-trip; unknown kinds become no-op\n * placeholders; external ops rebuild via the global op-factory registry\n * and replay against the `setHistoryAdapter` accessor. Restored entries\n * never coalesce with new ones. Notifies once. A snapshot that is not in\n * the current recorded form (see `SCENE_HISTORY_FORM`) is dropped:\n * the history is left as it was. Do not call mid-`batch`:\n * the stacks are replaced underneath the open batch, whose eventual\n * flush would graft onto (and evict against) the restored stacks. */\n restoreHistory(snapshot: SerializedHistory): void;\n /** Install (or clear with `null`) the accessor for the adapter that\n * RESTORED external ops apply against on undo/redo: the ops handed to\n * `applyBatch` that wrote no scene state, such as a selection change,\n * rebuilt from a `restoreHistory` snapshot. Resolved lazily at each\n * apply, so wiring order relative to `restoreHistory` doesn't matter.\n * Live `applyBatch` entries are unaffected (they bind their call-site\n * adapter). If unset when a restored op applies, the op is a debug-warned\n * no-op. */\n setHistoryAdapter(fn: (() => unknown) | null): void;\n\n // Serialization\n /** Snapshot the current scene state to a JSON-serializable shape.\n * History (undo/redo stacks) is NOT captured. Function fields like\n * `ContainerNode.clipFromPose` are translated to string keys via the\n * scene's registry; throws if any function field has no matching key. */\n toJSON(): SerializedScene<TData, TLayer, TPose>;\n /** Replace this scene's entire node + layer state in place from a snapshot\n * produced by `toJSON()`. Unlike `sceneFromJSON`, the existing Scene\n * instance is preserved — holders such as `<SceneCanvas>` keep their\n * reference. History (undo/redo) is cleared, matching `sceneFromJSON`.\n * Bumps `getVersion()` and notifies subscribers exactly once. Selected\n * ids the snapshot does not hold leave the selection, and every pose\n * override is cleared.\n *\n * Throws inside any other edit — `batch`, `untracked`, `applyBatch`, an\n * undo — which would revert to a state this replaces. Throws on an unsupported version or unknown registry/layer ids; on a\n * malformed snapshot the scene is left empty or partially populated (callers should treat a\n * `loadState` throw as fatal and reload). Snapshots from `toJSON()` are\n * always well-formed. */\n loadState(json: SerializedScene<TData, TLayer, TPose>): void;\n\n // Subscription (used by useScene; also for non-React observers)\n subscribe(listener: () => void): () => void;\n /** Monotonically increasing version. Snapshot for `useSyncExternalStore`. */\n getVersion(): number;\n}\n"],"mappings":";AA4DA,IAAaA,KAAY,MAAsBC"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/core/scene/types.ts"],"sourcesContent":["import type { History, SerializedHistory } from '@weasel-js/history';\nimport type { SerializedSceneHistory } from './historyForm';\nimport type { ParallaxOpts } from '../viewport/parallax';\nimport type { UnitScope } from '@weasel-js/quantity';\nimport type { LayoutStrategy } from '../../layout/types';\nimport type { AddLayerSpec, LayerRecord, SystemLayerRecord, SystemLayerSpec, UserLayerRecord } from './layerTypes';\nimport type { LayoutFrame, LayoutMove } from './layoutTypes';\nimport type { PoseComposition } from './composeFrame';\nimport type { PoseRemoval, PoseWrite, PoseWriteOrigin, RemovedNode, ScenePoseReports } from './poseWrites';\nimport type { PoseHold, PoseOverride, PoseOverrides } from './poseOverrideTypes';\nimport type { SerializedLayer, SerializedNode, SerializedScene } from './serializedTypes';\nimport type { UseSceneOptions } from './useSceneOptions';\n\nimport type { RectPose } from '../geometry/rectPose';\nexport type { RectPose };\nexport type { AddLayerSpec, LayerRecord, SystemLayerRecord, SystemLayerSpec, UserLayerRecord };\nexport type { UseSceneOptions };\nexport type { PoseRemoval, PoseWrite, PoseWriteOrigin, RemovedNode, ScenePoseReports };\nexport type { LayoutFrame, LayoutMove, PoseHold, PoseOverride, PoseOverrides, SerializedLayer, SerializedNode, SerializedScene };\n\n/**\n * # SceneNode — the thing in the scene\n *\n * Everything the user sees on the canvas — a shape, a group, an annotation,\n * a tile — is a node. Containers and leaves are both nodes; the kit has no\n * other concept of \"scene element.\"\n *\n * Every node carries three independent slots, plus its tree position:\n *\n * - **`data: TData`** — app-defined payload. The kit never inspects it.\n * - **`pose: TPose`** — local transform, relative to the node's direct\n * parent (or world, for root nodes).\n * - **`layer: TLayer`** — a string tag associating the node with a\n * visual `RenderLayer` at draw time. Separate from `LayerRecord` (the\n * per-layer visible/locked metadata held by the `Scene`).\n *\n * Nodes are addressed by `NodeId` everywhere outside the scene tree. Don't\n * hold references to a `Node` object across scene updates; look up by id\n * when you need the latest.\n *\n * The kit-internal name is `Node`; the public re-export is `SceneNode`\n * (avoids collision with DOM `Node` at call sites).\n */\n\n/** Opaque branded id. Treat as opaque outside the kit. */\nimport type { NodeId } from '@weasel-js/routing';\nexport type { NodeId };\n\n/** Brand a string as a NodeId. */\nexport const asNodeId = (s: string): NodeId => s as NodeId;\n\nimport type { DerivedDep, Bivariant, DerivePathFn, DerivePoseFn, ClipFromPoseFn, CopiesFromPoseFn } from './nodeFnTypes';\nexport type { DerivedDep, Bivariant, DerivePathFn, DerivePoseFn, ClipFromPoseFn, CopiesFromPoseFn };\n\ninterface NodeBase<TData, TLayer extends string, TPose> {\n id: NodeId;\n layer: TLayer;\n pose: TPose;\n data: TData;\n parent: NodeId | null;\n /** Nodes whose poses this node's geometry is computed from. Fixed at add\n * time. Absent or empty means the node's geometry is authored, which is the\n * normal case.\n *\n * `'children'` means \"my own children, in child order\" — a container that\n * hugs its contents, which a fixed id list cannot express because\n * reparenting would have to maintain it. The two forms differ in lifetime\n * as well as in membership: deleting a node deletes everything that names\n * it in `dependsOn`, but a container outlives the children it derives\n * from — an emptied group is still a group. */\n dependsOn?: readonly NodeId[] | 'children';\n /** Whether the hit-test walk can return this node. Default `true`; `false`\n * makes it transparent to picking, so a click on it lands on whatever is\n * behind — normally its own container.\n *\n * For content a container owns rather than content the user selects on its\n * own: the label inside a box, a body's rows. It does not hide the node\n * from anything else — it still paints, still clips, and a consumer can\n * still select it by id. */\n pickable?: boolean;\n /** Not drawn, with its whole subtree: picking, area selection, select-all,\n * snapping and the selection pass over it, and an SVG export writes it with\n * `display=\"none\"`. Absent means shown; `Scene.isHidden` folds in its\n * ancestors' flags and its layer's visibility. */\n hidden?: boolean;\n /** Out of reach, with its whole subtree: still drawn, but picking and area\n * selection pass over it, the selection drops it, and every edit to it\n * throws, as on a locked layer. Absent means unlocked; `Scene.isLocked`\n * folds in its ancestors' and its layer's. */\n locked?: boolean;\n /** Computes this node's path from its dependencies, in `dependsOn` order —\n * each one the node and the pose it is painted at.\n * A dependency that has been removed arrives as `undefined`.\n * Returning `null` means \"nothing to draw right now\". Re-evaluated when a\n * dependency's world pose changes, never authored. */\n derivePath?: DerivePathFn<TPose, TData, TLayer>;\n /** Computes this node's pose from its dependencies' poses, the same way\n * `derivePath` computes its path — same `dependsOn` list, same\n * registry-keyed serialization.\n *\n * Where a derived path is resolved at paint time and reaches only the\n * painter, a derived pose is what the node *is* at: it feeds bounds,\n * hit-testing, selection chrome, snapping and layout, and every reader\n * gets it through `effectivePose`. A pose override still wins over it.\n *\n * Returning `null` means \"I have nothing to derive from right now\", and\n * the node falls back to its authored `pose`. `setPose` on a derived node\n * still writes that authored pose; it is simply not what anything reads. */\n derivePose?: DerivePoseFn<TPose, TData, TLayer>;\n}\n\n/** A node with no children — a shape, a label, an image. */\nexport interface LeafNode<TData, TLayer extends string, TPose = RectPose>\n extends NodeBase<TData, TLayer, TPose> {\n kind: 'leaf';\n}\n\n/** A node with an ordered list of children. This is the real group: what\n * Cmd+G creates, what SVG `<g>` round-trips to. A container has its own pose,\n * which its children's poses are relative to, and may optionally clip them. */\nexport interface ContainerNode<TData, TLayer extends string, TPose = RectPose>\n extends NodeBase<TData, TLayer, TPose> {\n kind: 'container';\n children: NodeId[];\n /** Optional clip-path source. Re-evaluated each render. Returning `null`\n * means \"no clip for this container right now\"; an empty / zero-area path\n * means \"clip everything out\" (children render nowhere). */\n clipFromPose?: ClipFromPoseFn<TPose>;\n /** Draws the whole subtree again under each affine it returns, on top of\n * the original, which still draws once as authored. The copies are paint,\n * not nodes: nothing stores them, so they follow every edit to the\n * children, and a pick that lands on one answers with the child it copies.\n * A copy is a copy of the clipped content — the clip travels with it.\n * Re-evaluated each render; `null` or `[]` draws no copies. */\n copiesFromPose?: CopiesFromPoseFn<TPose, TData, TLayer>;\n /** How this container arranges its children. Whenever the container's\n * child set or order changes, or its bounds change size, the scene hands\n * the change to the strategy — `depart` for children that left it,\n * `arrive` for children that joined it, `childPoses` otherwise — and records the poses it writes in the same\n * undo entry as the change. A drag reads it too: it is the layout `move`\n * reflows and drops against. */\n layout?: LayoutStrategy<TPose>;\n /** The unit system this container's contents are written in, and what one\n * of its base units is worth in the enclosing scope's. It covers the\n * children, not the container; `sceneUnitScopes` reads the chain. */\n units?: UnitScope;\n}\n\n/** A node in the scene tree: either a leaf or a container. Re-exported\n * publicly as `SceneNode`, to avoid colliding with the DOM's `Node`. */\nexport type Node<TData, TLayer extends string, TPose = RectPose> =\n | LeafNode<TData, TLayer, TPose>\n | ContainerNode<TData, TLayer, TPose>;\n\n/** What `Scene.add` needs to mint a node. Everything except the id is\n * required; the id is generated unless one is supplied. */\nexport interface AddNodeSpec<TData, TLayer extends string, TPose = RectPose> {\n kind: 'leaf' | 'container';\n layer: TLayer;\n pose: TPose;\n data: TData;\n parent?: NodeId | null;\n index?: number;\n /** Explicit id wins over the Scene's `generateId` and the kit default. */\n id?: NodeId;\n /** Mirrors `SceneNode.pickable`. Omit for the default, which is pickable. */\n pickable?: boolean;\n /** Mirrors `SceneNode.hidden`. */\n hidden?: boolean;\n /** Mirrors `SceneNode.locked`. */\n locked?: boolean;\n /** Only meaningful when `kind === 'container'`. Attach a clip-path function\n * to the node; ignored for leaves. Mirrors `ContainerNode.clipFromPose`. */\n clipFromPose?: ClipFromPoseFn<TPose>;\n /** Mirrors `ContainerNode.copiesFromPose`; ignored for leaves. */\n copiesFromPose?: CopiesFromPoseFn<TPose, TData, TLayer>;\n /** Mirrors `SceneNode.dependsOn`. */\n dependsOn?: readonly NodeId[] | 'children';\n /** Mirrors `SceneNode.derivePath`. Taken as a live function; its registry key is\n * looked up from it, never passed in. */\n derivePath?: DerivePathFn<TPose, TData, TLayer>;\n /** Mirrors `SceneNode.derivePose`, on the same terms as `derivePath`. */\n derivePose?: DerivePoseFn<TPose, TData, TLayer>;\n /** Mirrors `ContainerNode.layout`; ignored for leaves. */\n layout?: LayoutStrategy<TPose>;\n /** Mirrors `ContainerNode.units`; ignored for leaves. */\n units?: UnitScope;\n}\n\n/** A custom scene mutation registered with `Scene.registerOp`: how to apply\n * it and how to undo it. The pair is what makes it participate in history. */\nexport interface RegisteredOp<P> {\n apply: (payload: P) => void;\n revert: (payload: P) => void;\n /** Opts this kind into coalescing under `UseSceneOptions.coalesceWindowMs`:\n * two entries of this kind that return the same key inside the window\n * merge, and undoing the merged entry calls `revert` with the first\n * payload only. Declare it only when `revert` restores an absolute state\n * (a stored \"from\" value), never for a relative payload such as a delta.\n * Omitted, or returning `undefined`, the op is always its own entry. */\n coalesceKey?: (payload: P) => string | undefined;\n}\n\n/** Per-scene registry mapping string keys to live function references.\n * Passed to `createScene({ ..., registry })` and `sceneFromJSON(json, { registry })`.\n * Each function-field type has its own keyed map. */\nexport interface SceneRegistry<TPose, TData = unknown, TLayer extends string = string> {\n /** Maps registry keys to `clipFromPose` factory functions for container nodes. */\n clipFromPose?: Readonly<Record<string, ClipFromPoseFn<TPose>>>;\n /** Maps registry keys to `copiesFromPose` functions for container nodes. */\n copiesFromPose?: Readonly<Record<string, CopiesFromPoseFn<TPose, TData, TLayer>>>;\n /** Maps registry keys to `derivePath` functions for nodes with `dependsOn`. */\n derivePath?: Readonly<Record<string, DerivePathFn<TPose, TData, TLayer>>>;\n /** Maps registry keys to `derivePose` functions for nodes with `dependsOn`. */\n derivePose?: Readonly<Record<string, DerivePoseFn<TPose, TData, TLayer>>>;\n /** Maps registry keys to container layout strategies. */\n layout?: Readonly<Record<string, LayoutStrategy<TPose>>>;\n // A new function field is a row in `NODE_FN_FIELDS` (core/scene/nodeFnFields.ts)\n // plus its entry here; the field name is the registry key by construction.\n}\n\n/**\n * Decides what one edit's changes to containers do to their children.\n * `arrivals` maps each container to the ids that joined it — by an `add`\n * under it or a `move` into it, whatever op or call made them — in the order\n * they arrived. `changed` names every container whose child set or order\n * changed, or whose pose changed size, arrivals included. Both are read once\n * the edit's other mutations have landed.\n *\n * Return the poses to write, in each node's stored frame; they become part of\n * the same edit, and so of the same undo step. An empty map writes nothing.\n * Return `null` to refuse: the whole edit is reverted (see\n * `SceneArrivalRefused`).\n *\n * Runs only for live edits. Undo, redo and a restored history replay the\n * arrangement that was decided the first time. With none installed, a scene\n * holding declared layouts (`ContainerNode.layout`) runs its own.\n */\nexport type SceneArrivalHandler<TPose> = (\n arrivals: ReadonlyMap<NodeId, readonly NodeId[]>,\n changed: ReadonlySet<NodeId>,\n /** The nodes that left each container in the edit, by the container they\n * left — removed, or moved out. */\n departures: ReadonlyMap<NodeId, readonly NodeId[]>,\n) => ReadonlyMap<NodeId, TPose> | null;\n\n/**\n * The kit-owned scene tree: nodes, layers, and the undo history over both.\n *\n * A scene is logical, not visual — it says what exists and where, and nothing\n * about how it is painted. Every mutating method is undoable, and reads are\n * snapshots rather than live views. Nodes are addressed by `NodeId`; hold ids\n * across mutations, not node objects.\n *\n * Three type parameters keep it domain-agnostic: `TData` is the app's payload,\n * which the kit never inspects; `TPose` is the transform shape, `RectPose` by\n * default; `TLayer` is the union of layer names.\n */\nexport interface Scene<TData, TLayer extends string, TPose = RectPose>\n extends ScenePoseReports<TPose, Node<TData, TLayer, TPose>> {\n // Reads\n readonly nodes: ReadonlyMap<NodeId, Node<TData, TLayer, TPose>>;\n readonly roots: readonly NodeId[];\n readonly layers: readonly LayerRecord<TLayer>[];\n /** The registry this scene resolves node functions against — the consumer's\n * entries over the kit's. */\n readonly registry: SceneRegistry<TPose, TData, TLayer>;\n /** See {@link UseSceneOptions.composition}. */\n readonly composition: PoseComposition<TPose>;\n get(id: NodeId): Node<TData, TLayer, TPose> | undefined;\n /** A token for the node `id` names right now, for telling one node from a\n * later one that reuses its id. It holds for as long as the node stays in\n * the scene, whatever edits it takes, and is different every time the id\n * enters the scene — by `add`, by an undo or redo that brings it back, or\n * by `loadState`. `undefined` when `id` is not in the scene. Compare tokens\n * for equality only; their order means nothing. */\n incarnation(id: NodeId): number | undefined;\n childrenOf(id: NodeId): readonly NodeId[];\n ancestorsOf(id: NodeId): readonly NodeId[];\n renderOrder(): Iterable<NodeId>;\n /** The same layer-major sequence as {@link Scene.renderOrder}, as the nodes\n * themselves. Prefer this wherever the ids are only going to be resolved\n * back to nodes. Cached until a structural edit, so repeat calls hand back\n * the same array — a snapshot, not a live view, and not yours to mutate. */\n renderOrderNodes(): readonly Node<TData, TLayer, TPose>[];\n /** The nodes on one layer, in render order. Cached alongside\n * {@link Scene.renderOrderNodes} until a structural edit. A snapshot, not\n * a live view, and not yours to mutate. An unknown layer id yields an\n * empty array. */\n nodesOnLayer(layer: TLayer): readonly Node<TData, TLayer, TPose>[];\n\n /** A fresh id from this scene's `generateId`, or the kit default: the id\n * `add` would give a spec with none. For code that has to name a node\n * before it exists, such as one building an insert op. */\n mintId(): NodeId;\n\n // Mutations (all auto-undoable)\n add(spec: AddNodeSpec<TData, TLayer, TPose>): NodeId;\n /** Delete `id`, its **entire subtree**, and **everything that derives from**\n * any of those nodes — a node listing one of them in `dependsOn` goes too,\n * along with its own subtree, transitively. A dependent can live anywhere in\n * the tree, so this deletes nodes the caller never named and may unlink\n * several disjoint subtrees at once. Recorded as one undoable step; `undo()`\n * restores every one of them where it was, child order intact. */\n remove(id: NodeId): void;\n /** {@link remove} over several roots at once, as a **single** undoable step.\n * Ids resolve against the tree as it stands at the call, so an id that\n * another one would cascade away is absorbed rather than removed twice —\n * which is what makes it safe to pass a whole selection. Throws if any id is\n * not in the scene; an empty list does nothing and records no step. */\n removeMany(ids: readonly NodeId[]): void;\n /** Every node {@link removeMany} would take if given `ids`: each id, its\n * subtree, everything deriving from any of those, and those nodes' subtrees\n * in turn. Ids not in the scene come back unchanged.\n *\n * A set, not a restore order: a dependent can be reached before the parent\n * it sits under, which is also in the closure. */\n removalClosure(ids: readonly NodeId[]): readonly NodeId[];\n update(id: NodeId, patch: { data: TData }): void;\n setPose(id: NodeId, pose: TPose): void;\n /** Retag `id` to `layer`. On a **container this cascades**: every descendant\n * is moved to the same layer, recorded as a **single** undo step.\n *\n * Invariants:\n * - **Layer floor** — a child may not render below its parent, so retagging\n * to a layer *below* the node's parent throws. Retagging to the parent's\n * layer or any higher one is allowed; a node with no parent is\n * unconstrained.\n * - **No-op elision** — setting the layer a node already has does nothing\n * and pushes **no** history entry. */\n setLayer(id: NodeId, layer: TLayer): void;\n /** Point `id` at a different set of dependencies — retargeting an edge's end\n * onto another node, or switching a container between an id list and\n * `'children'`. Recorded as one undoable step.\n *\n * Order is significant: a derivation reads its dependencies positionally,\n * so `[b, a]` is not `[a, b]`. Ids need not be in the scene — a declared\n * dependency that appears later invalidates the node when it does, the same\n * as one declared at `add`. Passing `undefined` drops the declaration, after\n * which nothing cascades the node away.\n *\n * **No-op elision** — declaring what the node already declares does nothing\n * and pushes no history entry. */\n setDependsOn(id: NodeId, dependsOn: readonly NodeId[] | 'children' | undefined): void;\n /** Give container `id` a different layout — a strategy, its key in\n * `SceneRegistry.layout`, or `null` for none — and re-arrange its children\n * under it, as one undoable step. Throws for a leaf, or a key the registry\n * does not hold. A registered layout is recorded by its key, so a\n * serialized history restores it; an unregistered one lives only as long\n * as the session.\n *\n * **No-op elision** — setting the layout a container already has does\n * nothing and pushes no history entry. */\n setLayout(id: NodeId, layout: LayoutStrategy<TPose> | string | null): void;\n /** Reparent `id` under `parent` (or to a root when `parent` is `null`) at\n * `index` within the new sibling list, appending when `index` is omitted.\n * Siblings are reindexed. Recorded as one undoable step.\n *\n * Rejected (throws) when:\n * - `parent` exists but is a **leaf**, not a container;\n * - the move would form a **cycle** — `parent` is `id` itself or one of\n * `id`'s own descendants;\n * - it would drop `id` **below its new parent's layer** (child may not\n * render below its parent).\n *\n * `move(id, null)` — detaching to a root — is always allowed regardless of\n * layer, since a root has no parent to render beneath. */\n move(id: NodeId, parent: NodeId | null, index?: number): void;\n /** Shift `id` to `index` within its **current** parent's child list. Unlike\n * {@link move}, the parent never changes — only sibling order. */\n reorder(id: NodeId, index: number): void;\n /** Show or hide a layer. Hiding drops its nodes from the selection. */\n setLayerVisible(layer: TLayer, visible: boolean): void;\n /** Lock or unlock a layer. A locked layer still paints, but its nodes are\n * out of reach: picking and area selection pass over them, the selection\n * drops them, and every node mutation on them throws. Locking is never\n * blocked by the lock, and neither are the other layer operations. */\n setLayerLocked(layer: TLayer, locked: boolean): void;\n /** Set or clear (`undefined`) a layer's parallax — see\n * `LayerRecord.parallax`. Undoable; an animation tweening it writes inside\n * {@link Scene.untracked} so no frame becomes an undo step. */\n setLayerParallax(layer: TLayer, parallax: ParallaxOpts | undefined): void;\n /** Whether `id` is locked: it or an ancestor carries `locked`, or sits on a\n * locked layer. A lock covers its whole subtree, whatever layers the\n * descendants are tagged to. An id not in the scene is not locked. */\n isLocked(id: NodeId): boolean;\n /** Whether `id` is not drawn: its own layer is hidden, or it or an ancestor\n * carries `hidden`. A hidden layer hides only the nodes tagged to it. An\n * id not in the scene is not hidden. */\n isHidden(id: NodeId): boolean;\n /** Hide or show node `id` and its subtree — see `SceneNode.hidden`. One\n * undo step; hiding drops the subtree from the selection. Never blocked by\n * a lock, and setting what the node already has records nothing. */\n setHidden(id: NodeId, hidden: boolean): void;\n /** Lock or unlock node `id` and its subtree — see `SceneNode.locked`. One\n * undo step; locking drops the subtree from the selection. Never blocked\n * by a lock, and setting what the node already has records nothing. */\n setLocked(id: NodeId, locked: boolean): void;\n /** Run `fn` with the lock guard lifted, for a programmatic edit that has to\n * reach a locked node. Undo and redo never need it. */\n unlocked<T>(fn: () => T): T;\n addLayer(spec: AddLayerSpec<TLayer>): void;\n /** Drop a user layer and every node tagged to it, as one undoable step.\n * Removal cascades, so this also deletes nodes **on other layers** that\n * derive from a node on this one. */\n removeLayer(layer: TLayer): void;\n renameLayer(layer: TLayer, name: string): void;\n moveLayer(layer: TLayer, index: number): void;\n\n // Custom op seam\n registerOp<P>(kind: string, handler: RegisteredOp<P>): void;\n recordOp<P>(op: { kind: string; payload: P }): void;\n\n /** Install (or clear with `null`) the active-journal accessor after scene\n * construction, for a journal source built with `scene.history` as a\n * dependency. Overrides any `getActiveJournal` set in `UseSceneOptions`. */\n setActiveJournalAccessor(\n fn: (() => import('@weasel-js/history').Journal | null) | null,\n ): void;\n\n /** Install what the scene does when nodes join a container, replacing any\n * handler installed before; `null` removes it. Returns a function that\n * removes this handler, and does nothing once another has replaced it.\n * See {@link SceneArrivalHandler}. */\n setArrivalHandler(handler: SceneArrivalHandler<TPose> | null): () => void;\n\n /** Apply a batch of ops against `adapter` as one undo entry.\n *\n * The entry holds the scene writes the ops made, as a direct call records\n * them, and beside them any op that wrote no scene state, bound to\n * `adapter`. Undo restores those writes; it does not call an op's\n * `invert()` or the adapter again. **What an op states is not recorded**:\n * one applied over a document that already holds its result, as after an\n * `untracked` preview, records a write from that pose to itself, and undo\n * goes nowhere. Put the document back first.\n *\n * The entry lands in the open `batch` when there is one, else on the\n * active journal, else on the scene's own history, where it can coalesce\n * under `coalesceWindowMs` with one whose ops' keys match.\n *\n * Returns false when the arrival handler refused the batch: it is reverted\n * and unrecorded. Inside `batch` it is true; that batch may still refuse. */\n applyBatch(ops: import('core/ops/types').Op[], label: string, adapter: unknown): boolean;\n\n // Selection\n\n /** The transient set of active ids — \"operate on these N as a unit\".\n * Shared by every view over this scene unless a view supplies its own\n * (see `CanvasView.selection`). Not document content: it never appears\n * in `toJSON`. It does ride on history entries, so undo and redo put\n * back the selection an edit was made under; changing it is never an\n * undo step of its own. Removing a node deselects it. */\n getSelection(): readonly NodeId[];\n setSelection(ids: readonly NodeId[]): void;\n\n // Ephemeral presentation state\n\n /** Per-node pose / alpha overrides the render and hit-test paths read\n * through. Like {@link Scene.getSelection} this is not document content:\n * writes are never recorded, never serialized, and do not bump\n * {@link Scene.getVersion}. See {@link PoseOverrides}. */\n readonly overrides: PoseOverrides<TPose>;\n\n // History\n /** The scene's undo/redo engine, in the shape `@weasel-js/history` defines.\n * Mutating members route through\n * the scene's own wrappers, so an undo driven through this bumps\n * {@link Scene.getVersion} and notifies subscribers exactly as\n * {@link Scene.undo} does; `getVersion` / `subscribe` on it report the\n * engine's history version, not the scene's. */\n readonly history: History;\n undo(): boolean;\n redo(): boolean;\n canUndo(): boolean;\n canRedo(): boolean;\n batch<T>(label: string, fn: () => T): T;\n /** The layout container `id` declares, or `null` for a leaf or a\n * container that declares none. */\n layoutOf(id: NodeId): LayoutStrategy<TPose> | null;\n /** Declare the unit scope of container `id`, or clear it with `null`. */\n setUnits(id: NodeId, units: UnitScope | null): void;\n /** Run `fn` with every mutation applied but none recorded — for writes\n * that are not edits, such as a simulation stepping poses each frame.\n * Undo and redo move between recorded states and never restore an\n * untracked write; the next recorded change starts from whatever the\n * untracked writes left, so undoing it lands there. A `batch` inside\n * records nothing; inside a `batch`, these writes stay out of its entry.\n * Notifies once, reverts `fn`'s writes if it throws, and throws on\n * `applyBatch` and `history.apply` / `applyOps`, which exist to record. */\n untracked<T>(fn: () => T): T;\n /** Read-only snapshot of every history entry currently reachable from\n * the present state. Oldest applied first, then redoable entries in\n * the order they'd be re-applied. Each entry id is stable. */\n historyEntries(): readonly { id: string; label: string }[];\n /** Index of the \"current state\". Equals the count of applied entries;\n * `0` means \"nothing applied\" (initial). */\n historyIndex(): number;\n /** Jump to the given history index, clamped to [0, total]. Returns true\n * if any movement occurred. */\n jumpToHistoryIndex(index: number): boolean;\n\n // History persistence\n /** Snapshot the undo/redo history in a JSON-serializable form (the\n * engine's `SerializedHistory`, marked with the scene's recorded form).\n * An entry holds the scene's own ops, whichever way the edit was made.\n * An op handed to `applyBatch` that wrote no scene state is held as\n * itself, and an entry with a nameless one is dropped. Payload\n * JSON-safety (e.g. typed arrays inside poses) is the caller's concern.\n * Do not call mid-`batch` — the open batch's ops are not yet recorded. */\n serializeHistory(): SerializedSceneHistory;\n /** Replace the undo/redo history from a `serializeHistory()` snapshot.\n * Call on a scene whose node/layer state already matches the snapshot's\n * head state (i.e. right after `loadState` from the paired scene\n * snapshot); node state is NOT mutated. Ops re-registered via\n * `registerOp` before this call round-trip; unknown kinds become no-op\n * placeholders; external ops rebuild via the global op-factory registry\n * and replay against the `setHistoryAdapter` accessor. Restored entries\n * never coalesce with new ones. Notifies once. A snapshot that is not in\n * the current recorded form (see `SCENE_HISTORY_FORM`) is dropped:\n * the history is left as it was. Do not call mid-`batch`:\n * the stacks are replaced underneath the open batch, whose eventual\n * flush would graft onto (and evict against) the restored stacks. */\n restoreHistory(snapshot: SerializedHistory): void;\n /** Install (or clear with `null`) the accessor for the adapter that\n * RESTORED external ops apply against on undo/redo: the ops handed to\n * `applyBatch` that wrote no scene state, such as a selection change,\n * rebuilt from a `restoreHistory` snapshot. Resolved lazily at each\n * apply, so wiring order relative to `restoreHistory` doesn't matter.\n * Live `applyBatch` entries are unaffected (they bind their call-site\n * adapter). If unset when a restored op applies, the op is a debug-warned\n * no-op. */\n setHistoryAdapter(fn: (() => unknown) | null): void;\n\n // Serialization\n /** Snapshot the current scene state to a JSON-serializable shape.\n * History (undo/redo stacks) is NOT captured. Function fields like\n * `ContainerNode.clipFromPose` are translated to string keys via the\n * scene's registry; throws if any function field has no matching key. */\n toJSON(): SerializedScene<TData, TLayer, TPose>;\n /** Replace this scene's entire node + layer state in place from a snapshot\n * produced by `toJSON()`. Unlike `sceneFromJSON`, the existing Scene\n * instance is preserved — holders such as `<SceneCanvas>` keep their\n * reference. History (undo/redo) is cleared, matching `sceneFromJSON`.\n * Bumps `getVersion()` and notifies subscribers exactly once. Selected\n * ids the snapshot does not hold leave the selection, and every pose\n * override is cleared.\n *\n * Throws inside any other edit — `batch`, `untracked`, `applyBatch`, an\n * undo — which would revert to a state this replaces. Throws on an unsupported version or unknown registry/layer ids; on a\n * malformed snapshot the scene is left empty or partially populated (callers should treat a\n * `loadState` throw as fatal and reload). Snapshots from `toJSON()` are\n * always well-formed. */\n loadState(json: SerializedScene<TData, TLayer, TPose>): void;\n\n // Subscription (used by useScene; also for non-React observers)\n subscribe(listener: () => void): () => void;\n /** Monotonically increasing version. Snapshot for `useSyncExternalStore`. */\n getVersion(): number;\n}\n"],"mappings":";;AAiDA,IAAa,YAAY,MAAsB"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { unionAABB
|
|
2
|
-
import { poseDescriptorForNode
|
|
1
|
+
import { unionAABB } from "../geometry/unionBounds.js";
|
|
2
|
+
import { poseDescriptorForNode, visualBoundsViaDescriptor } from "../geometry/poseDescriptor.js";
|
|
3
|
+
|
|
3
4
|
//#region src/core/scene/unionOfChildren.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A container's pose as the envelope of what it holds, read through
|
|
7
|
+
* `descriptor` — a rotated member contributes the extent of its ink. Register
|
|
8
|
+
* the result under `UNION_OF_CHILDREN` in `createScene`'s `registry` to teach
|
|
9
|
+
* a scene how to size its groups around a pose shape the kit cannot read.
|
|
10
|
+
*
|
|
11
|
+
* Returns `null` for an emptied container, which falls back to its authored
|
|
12
|
+
* pose rather than collapsing to a zero box at the origin.
|
|
13
|
+
*/
|
|
14
|
+
function unionOfChildrenVia(descriptor) {
|
|
15
|
+
return (node, deps) => {
|
|
16
|
+
const boxes = [];
|
|
17
|
+
for (const d of deps) if (d !== void 0) boxes.push(visualBoundsViaDescriptor(d.pose, poseDescriptorForNode(descriptor, d)));
|
|
18
|
+
const u = unionAABB(boxes);
|
|
19
|
+
return u === null ? null : poseDescriptorForNode(descriptor, node).fromBounds(u, node.pose);
|
|
10
20
|
};
|
|
11
21
|
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { r as unionOfChildrenVia };
|
|
14
22
|
|
|
23
|
+
//#endregion
|
|
24
|
+
export { unionOfChildrenVia };
|
|
15
25
|
//# sourceMappingURL=unionOfChildren.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionOfChildren.js","names":[
|
|
1
|
+
{"version":3,"file":"unionOfChildren.js","names":[],"sources":["../../../src/core/scene/unionOfChildren.ts"],"sourcesContent":["import { unionAABB } from 'core/geometry/unionBounds';\nimport {\n poseDescriptorForNode,\n visualBoundsViaDescriptor,\n type PoseDescriptor,\n} from 'core/geometry/poseDescriptor';\nimport type { DerivePoseFn } from 'core/scene/types';\n\n/**\n * A container's pose as the envelope of what it holds, read through\n * `descriptor` — a rotated member contributes the extent of its ink. Register\n * the result under `UNION_OF_CHILDREN` in `createScene`'s `registry` to teach\n * a scene how to size its groups around a pose shape the kit cannot read.\n *\n * Returns `null` for an emptied container, which falls back to its authored\n * pose rather than collapsing to a zero box at the origin.\n */\nexport function unionOfChildrenVia<TPose>(\n descriptor: PoseDescriptor<TPose>,\n): DerivePoseFn<TPose> {\n return (node, deps) => {\n const boxes = [];\n for (const d of deps) {\n if (d !== undefined) {\n boxes.push(visualBoundsViaDescriptor(d.pose, poseDescriptorForNode(descriptor, d)));\n }\n }\n const u = unionAABB(boxes);\n return u === null\n ? null\n : poseDescriptorForNode(descriptor, node).fromBounds(u, node.pose);\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,mBACd,YACqB;CACrB,QAAQ,MAAM,SAAS;EACrB,MAAM,QAAQ,CAAC;EACf,KAAK,MAAM,KAAK,MACd,IAAI,MAAM,QACR,MAAM,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,YAAY,CAAC,CAAC,CAAC;EAGtF,MAAM,IAAI,UAAU,KAAK;EACzB,OAAO,MAAM,OACT,OACA,sBAAsB,YAAY,IAAI,CAAC,CAAC,WAAW,GAAG,KAAK,IAAI;CACrE;AACF"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { scopesOf
|
|
1
|
+
import { scopesOf } from "@weasel-js/quantity";
|
|
2
|
+
|
|
2
3
|
//#region src/core/scene/unitScopes.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The unit scopes enclosing node `id`, outermost first, under the scene's own
|
|
6
|
+
* `root`: what `resolveScoped` and `formatScoped` take for a value that
|
|
7
|
+
* positions or sizes it. A container's own scope covers its children, so it
|
|
8
|
+
* is counted only under `inclusive`, for a value written inside it.
|
|
9
|
+
*/
|
|
10
|
+
function sceneUnitScopes(scene, id, root, opts = {}) {
|
|
11
|
+
return scopesOf(id, root, {
|
|
12
|
+
parentOf: (at) => scene.get(at)?.parent,
|
|
13
|
+
scopeOf: (at) => scene.get(at)?.units,
|
|
14
|
+
...opts.inclusive ? { inclusive: true } : {}
|
|
8
15
|
});
|
|
9
16
|
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { t as sceneUnitScopes };
|
|
12
17
|
|
|
18
|
+
//#endregion
|
|
19
|
+
export { sceneUnitScopes };
|
|
13
20
|
//# sourceMappingURL=unitScopes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unitScopes.js","names":[
|
|
1
|
+
{"version":3,"file":"unitScopes.js","names":[],"sources":["../../../src/core/scene/unitScopes.ts"],"sourcesContent":["import { scopesOf, type UnitScope } from '@weasel-js/quantity';\nimport type { NodeId } from './types';\n\n/** What reading scopes needs of a scene. A `Scene` satisfies it. */\nexport interface ScopedScene {\n get(id: NodeId): { kind: string; parent: NodeId | null; units?: UnitScope } | undefined;\n}\n\n/**\n * The unit scopes enclosing node `id`, outermost first, under the scene's own\n * `root`: what `resolveScoped` and `formatScoped` take for a value that\n * positions or sizes it. A container's own scope covers its children, so it\n * is counted only under `inclusive`, for a value written inside it.\n */\nexport function sceneUnitScopes(\n scene: ScopedScene,\n id: NodeId,\n root: UnitScope,\n opts: { inclusive?: boolean } = {},\n): UnitScope[] {\n return scopesOf(id, root, {\n parentOf: (at) => scene.get(at)?.parent,\n scopeOf: (at) => scene.get(at)?.units,\n ...(opts.inclusive ? { inclusive: true } : {}),\n });\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgB,gBACd,OACA,IACA,MACA,OAAgC,CAAC,GACpB;CACb,OAAO,SAAS,IAAI,MAAM;EACxB,WAAW,OAAO,MAAM,IAAI,EAAE,CAAC,EAAE;EACjC,UAAU,OAAO,MAAM,IAAI,EAAE,CAAC,EAAE;EAChC,GAAI,KAAK,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AACH"}
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import { asNodeId
|
|
2
|
-
import { createScene
|
|
3
|
-
import { useRef
|
|
1
|
+
import { asNodeId } from "./types.js";
|
|
2
|
+
import { createScene } from "./scene.js";
|
|
3
|
+
import { useRef, useSyncExternalStore } from "react";
|
|
4
|
+
|
|
4
5
|
//#region src/core/scene/useScene.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/** A subscribe function that never notifies. `useSyncExternalStore` still runs
|
|
7
|
+
* (hooks are unconditional) but the host is never re-rendered by the store. */
|
|
8
|
+
var NEVER_SUBSCRIBE = () => () => {};
|
|
9
|
+
var DEFAULT_LAYER = "default";
|
|
10
|
+
function isTrivialOptions(options) {
|
|
11
|
+
return !!options && typeof options === "object" && "items" in options && !("systemLayers" in options);
|
|
8
12
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
function buildScene(options) {
|
|
14
|
+
if (!isTrivialOptions(options)) return createScene(options);
|
|
15
|
+
return createScene({
|
|
16
|
+
systemLayers: [{ id: DEFAULT_LAYER }],
|
|
17
|
+
historyLimit: options.historyLimit,
|
|
18
|
+
generateId: options.generateId,
|
|
19
|
+
initial: options.items.map((item) => ({
|
|
15
20
|
kind: "leaf",
|
|
16
|
-
layer:
|
|
17
|
-
pose:
|
|
18
|
-
data:
|
|
19
|
-
id:
|
|
21
|
+
layer: DEFAULT_LAYER,
|
|
22
|
+
pose: item,
|
|
23
|
+
data: item,
|
|
24
|
+
id: asNodeId(item.id)
|
|
20
25
|
}))
|
|
21
|
-
})
|
|
26
|
+
});
|
|
22
27
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
/** Create and subscribe to a scene. */
|
|
29
|
+
function useScene(options) {
|
|
30
|
+
const sceneRef = useRef(null);
|
|
31
|
+
if (sceneRef.current === null) sceneRef.current = buildScene(options);
|
|
32
|
+
const scene = sceneRef.current;
|
|
33
|
+
const subscribed = options?.subscribe !== false;
|
|
34
|
+
useSyncExternalStore(subscribed ? scene.subscribe : NEVER_SUBSCRIBE, scene.getVersion, scene.getVersion);
|
|
35
|
+
return scene;
|
|
28
36
|
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { c as useScene };
|
|
31
37
|
|
|
38
|
+
//#endregion
|
|
39
|
+
export { useScene };
|
|
32
40
|
//# sourceMappingURL=useScene.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScene.js","names":[
|
|
1
|
+
{"version":3,"file":"useScene.js","names":[],"sources":["../../../src/core/scene/useScene.ts"],"sourcesContent":["import { useRef, useSyncExternalStore } from 'react';\nimport { createScene } from './scene';\nimport type { NodeId, Scene, UseSceneOptions } from './types';\nimport { asNodeId } from './types';\n\n/** Trivial-form options: a flat list of items, no layers, no parenting. The\n * full `useScene` form is reachable any time by adding `systemLayers`.\n *\n * `historyLimit` and `generateId` are accepted because they're orthogonal to\n * the \"what's in the scene\" question. `ops` is intentionally omitted — if\n * you need custom ops, your app state already lives outside the \"flat list\n * of rects\" frame and you should reach for the full `UseSceneOptions`. */\nexport interface UseSceneTrivialOptions<TItem extends { id: string }> {\n items: readonly TItem[];\n historyLimit?: number;\n generateId?: () => NodeId;\n /** Re-render the host on every scene mutation. Default `true`. See\n * {@link UseSceneOptions.subscribe}. */\n subscribe?: boolean;\n}\n\n/** A subscribe function that never notifies. `useSyncExternalStore` still runs\n * (hooks are unconditional) but the host is never re-rendered by the store. */\nconst NEVER_SUBSCRIBE = () => () => {};\n\nconst DEFAULT_LAYER = 'default' as const;\ntype DefaultLayer = typeof DEFAULT_LAYER;\n\nfunction isTrivialOptions<TItem extends { id: string }>(\n options: unknown,\n): options is UseSceneTrivialOptions<TItem> {\n return (\n !!options\n && typeof options === 'object'\n && 'items' in (options as Record<string, unknown>)\n && !('systemLayers' in (options as Record<string, unknown>))\n );\n}\n\nfunction buildScene(options: unknown): Scene<unknown, string, unknown> {\n if (!isTrivialOptions(options)) {\n return createScene(options as UseSceneOptions<unknown, string, unknown>);\n }\n return createScene<unknown, DefaultLayer, unknown>({\n systemLayers: [{ id: DEFAULT_LAYER }],\n historyLimit: options.historyLimit,\n generateId: options.generateId,\n initial: options.items.map((item) => ({\n kind: 'leaf',\n layer: DEFAULT_LAYER,\n pose: item,\n data: item,\n id: asNodeId(item.id),\n })),\n });\n}\n\n/** React hook returning a kit-owned `Scene`. The Scene is constructed once\n * per host component and tracked via `useSyncExternalStore`, so React re-\n * renders on every Scene mutation (including undo/redo) unless\n * `subscribe: false` opts out.\n *\n * Two call shapes:\n * - **Trivial**: `useScene({ items })` — one auto-registered system layer\n * named `'default'`, each item added as a leaf with `pose === data === item`.\n * Cheapest path for \"a flat list of rects.\"\n * - **Full**: `useScene({ systemLayers, initial?, ops?, ... })` — explicit\n * layers, parenting, and custom op registration. */\nexport function useScene<TItem extends { id: string }>(\n options: UseSceneTrivialOptions<TItem>,\n): Scene<TItem, DefaultLayer, TItem>;\n/** The full call shape: explicit layers, initial nodes, custom ops, and\n * history configuration. */\nexport function useScene<TData, TLayer extends string, TPose = import('./composePose').RectPose>(\n options: UseSceneOptions<TData, TLayer, TPose>,\n): Scene<TData, TLayer, TPose>;\n/** Create and subscribe to a scene. */\nexport function useScene(options: unknown): unknown {\n const sceneRef = useRef<Scene<unknown, string, unknown> | null>(null);\n if (sceneRef.current === null) sceneRef.current = buildScene(options);\n const scene = sceneRef.current;\n const subscribed = (options as { subscribe?: boolean } | null)?.subscribe !== false;\n useSyncExternalStore(\n subscribed ? scene.subscribe : NEVER_SUBSCRIBE,\n scene.getVersion,\n scene.getVersion,\n );\n return scene;\n}\n"],"mappings":";;;;;;;AAuBA,IAAM,8BAA8B,CAAC;AAErC,IAAM,gBAAgB;AAGtB,SAAS,iBACP,SAC0C;CAC1C,OACE,CAAC,CAAC,WACC,OAAO,YAAY,YACnB,WAAY,WACZ,EAAE,kBAAmB;AAE5B;AAEA,SAAS,WAAW,SAAmD;CACrE,IAAI,CAAC,iBAAiB,OAAO,GAC3B,OAAO,YAAY,OAAoD;CAEzE,OAAO,YAA4C;EACjD,cAAc,CAAC,EAAE,IAAI,cAAc,CAAC;EACpC,cAAc,QAAQ;EACtB,YAAY,QAAQ;EACpB,SAAS,QAAQ,MAAM,KAAK,UAAU;GACpC,MAAM;GACN,OAAO;GACP,MAAM;GACN,MAAM;GACN,IAAI,SAAS,KAAK,EAAE;EACtB,EAAE;CACJ,CAAC;AACH;;AAsBA,SAAgB,SAAS,SAA2B;CAClD,MAAM,WAAW,OAA+C,IAAI;CACpE,IAAI,SAAS,YAAY,MAAM,SAAS,UAAU,WAAW,OAAO;CACpE,MAAM,QAAQ,SAAS;CACvB,MAAM,aAAc,SAA4C,cAAc;CAC9E,qBACE,aAAa,MAAM,YAAY,iBAC/B,MAAM,YACN,MAAM,UACR;CACA,OAAO;AACT"}
|
|
@@ -1,31 +1,55 @@
|
|
|
1
|
-
import { unionAABB
|
|
1
|
+
import { unionAABB } from "../geometry/unionBounds.js";
|
|
2
|
+
|
|
2
3
|
//#region src/core/selection/chromeState.ts
|
|
3
|
-
|
|
4
|
+
/** Nothing selected, nothing resolvable — what a caller reads before a
|
|
5
|
+
* surface has attached, or where chrome state has no owner. */
|
|
6
|
+
var EMPTY_CHROME_STATE = {
|
|
4
7
|
selection: [],
|
|
5
|
-
multiActive:
|
|
8
|
+
multiActive: false,
|
|
6
9
|
boundsOf: () => null,
|
|
7
10
|
unionBounds: null,
|
|
8
11
|
modifiers: {
|
|
9
|
-
alt:
|
|
10
|
-
shift:
|
|
11
|
-
meta:
|
|
12
|
-
ctrl:
|
|
12
|
+
alt: false,
|
|
13
|
+
shift: false,
|
|
14
|
+
meta: false,
|
|
15
|
+
ctrl: false
|
|
13
16
|
}
|
|
14
17
|
};
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
/** Whether chrome goes on something painted on `layer`, as `gate` — a
|
|
19
|
+
* `ChromeState`, a `ViewApi` — says. No layer, or no gate: it does. */
|
|
20
|
+
function paintsLayer(gate, layer) {
|
|
21
|
+
return layer === void 0 || gate?.layerIsPainted?.(layer) !== false;
|
|
22
|
+
}
|
|
23
|
+
function buildChromeState(args) {
|
|
24
|
+
const { effectiveBoundsOf, modifiers, canRotate, layerIsPainted, layerOf } = args;
|
|
25
|
+
const gate = { ...layerIsPainted ? { layerIsPainted } : {} };
|
|
26
|
+
const shown = () => {
|
|
27
|
+
if (!layerIsPainted || !layerOf) return args.selection;
|
|
28
|
+
const kept = args.selection.filter((id) => paintsLayer(gate, layerOf(id)));
|
|
29
|
+
return kept.length === args.selection.length ? args.selection : kept;
|
|
30
|
+
};
|
|
31
|
+
const multi = () => {
|
|
32
|
+
const ids = shown();
|
|
33
|
+
return args.multiActive && (ids === args.selection || ids.length > 1);
|
|
34
|
+
};
|
|
17
35
|
return {
|
|
18
|
-
selection
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
get selection() {
|
|
37
|
+
return shown();
|
|
38
|
+
},
|
|
39
|
+
get multiActive() {
|
|
40
|
+
return multi();
|
|
41
|
+
},
|
|
42
|
+
boundsOf: effectiveBoundsOf,
|
|
43
|
+
modifiers,
|
|
44
|
+
canRotate: canRotate ?? (() => true),
|
|
45
|
+
...gate,
|
|
23
46
|
get unionBounds() {
|
|
24
|
-
|
|
47
|
+
if (!multi()) return null;
|
|
48
|
+
return unionAABB(shown().map((id) => effectiveBoundsOf(id)));
|
|
25
49
|
}
|
|
26
50
|
};
|
|
27
51
|
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { t as EMPTY_CHROME_STATE, n as buildChromeState };
|
|
30
52
|
|
|
53
|
+
//#endregion
|
|
54
|
+
export { EMPTY_CHROME_STATE, buildChromeState, paintsLayer };
|
|
31
55
|
//# sourceMappingURL=chromeState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chromeState.js","names":[
|
|
1
|
+
{"version":3,"file":"chromeState.js","names":[],"sources":["../../../src/core/selection/chromeState.ts"],"sourcesContent":["import type { NodeId } from '../scene/types';\nimport type { ModifierState } from '../modifierState';\nimport type { Bounds } from '../viewport/fitViewToBounds';\nimport { unionAABB } from 'core/geometry/unionBounds';\n\nexport type { Bounds };\n\n/** Nothing selected, nothing resolvable — what a caller reads before a\n * surface has attached, or where chrome state has no owner. */\nexport const EMPTY_CHROME_STATE: ChromeState = {\n selection: [],\n multiActive: false,\n boundsOf: () => null,\n unionBounds: null,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n};\n\n/**\n * Read-only state that affordances consult on every render and hit-test\n * call. Built via `buildChromeState` and held across renders, so affordances\n * must not cache anything they read from it.\n */\nexport interface ChromeState {\n /** Currently selected ids. Live; reflects useSelection's React state,\n * less any on a layer this view does not paint. */\n readonly selection: readonly NodeId[];\n /** True when the canvas is in multi-mode AND >= 2 ids are selected, and\n * still >= 2 once `selection` drops the ones this view does not paint. */\n readonly multiActive: boolean;\n /** Bounds for any selection member id. Honors active-tool overlay state\n * (move/resize/rotate ghosts → ghost bounds; otherwise → committed\n * pose bounds). Returns null for unknown ids or ids whose bounds aren't\n * computable. */\n boundsOf(id: string): Bounds | null;\n /** Multi-union AABB when `multiActive`. Recomputed from `boundsOf` over\n * every selected id on each read, expanding rotated members to the extent\n * of their ink; null otherwise. */\n readonly unionBounds: Bounds | null;\n /** Active modifier state at the moment of the call. */\n readonly modifiers: ModifierState;\n /** True iff the node's pose-descriptor declares it can carry a rotation.\n * Affordances consult this to decide whether to expose rotate cursors /\n * drag-bands. Defaults to `true` when the descriptor doesn't declare\n * (back-compat) or when the id is unknown — the rotation gesture will\n * no-op visually for poses without AABB fields, but the affordance\n * doesn't lie about the cursor. Optional on the interface so unit-test\n * call sites that construct `ChromeState` by hand keep compiling;\n * affordances should treat an absent predicate as \"true\". */\n canRotate?(id: string): boolean;\n /** Whether a scene layer reaches the screen in the view this state was\n * built for — its `layerVisibility` / `layerOrder`, as `ViewApi` answers\n * it. Absent: the view paints every layer the scene shows. An affordance\n * that reads it puts no chrome on a node whose layer it says `false` to. */\n layerIsPainted?(layerId: string): boolean;\n}\n\nexport interface BuildChromeStateArgs {\n selection: readonly NodeId[];\n multiActive: boolean;\n effectiveBoundsOf: (id: string) => Bounds | null;\n modifiers: ModifierState;\n /** Optional rotation-support predicate. When omitted, `canRotate` returns\n * `true` for every id — preserves pre-existing affordance behavior for\n * unit-test call sites that don't wire pose-descriptor capability. */\n canRotate?: (id: string) => boolean;\n layerIsPainted?: (layerId: string) => boolean;\n /** The scene layer a selected id is painted on. With `layerIsPainted`,\n * drops from `selection` every id this view does not paint. */\n layerOf?: (id: string) => string | undefined;\n}\n\n/** Whether chrome goes on something painted on `layer`, as `gate` — a\n * `ChromeState`, a `ViewApi` — says. No layer, or no gate: it does. */\nexport function paintsLayer(\n gate: { layerIsPainted?(layerId: string): boolean } | null | undefined,\n layer: string | undefined,\n): boolean {\n return layer === undefined || gate?.layerIsPainted?.(layer) !== false;\n}\n\nexport function buildChromeState(args: BuildChromeStateArgs): ChromeState {\n const { effectiveBoundsOf, modifiers, canRotate, layerIsPainted, layerOf } = args;\n const gate = { ...(layerIsPainted ? { layerIsPainted } : {}) };\n // Read per call, like `unionBounds`: the view's layer settings change under a memoized state.\n const shown = (): readonly NodeId[] => {\n if (!layerIsPainted || !layerOf) return args.selection;\n const kept = args.selection.filter((id) => paintsLayer(gate, layerOf(id)));\n return kept.length === args.selection.length ? args.selection : kept;\n };\n const multi = (): boolean => {\n const ids = shown();\n return args.multiActive && (ids === args.selection || ids.length > 1);\n };\n return {\n get selection() { return shown(); },\n get multiActive() { return multi(); },\n boundsOf: effectiveBoundsOf,\n modifiers,\n canRotate: canRotate ?? (() => true),\n ...gate,\n // Not cached: the state is memoized across renders, and poses move under\n // it (a committed move, a live preview) without any of its inputs changing.\n get unionBounds() {\n if (!multi()) return null;\n return unionAABB(shown().map((id) => effectiveBoundsOf(id)));\n },\n };\n}\n"],"mappings":";;;;;AASA,IAAa,qBAAkC;CAC7C,WAAW,CAAC;CACZ,aAAa;CACb,gBAAgB;CAChB,aAAa;CACb,WAAW;EAAE,KAAK;EAAO,OAAO;EAAO,MAAM;EAAO,MAAM;CAAM;AAClE;;;AA0DA,SAAgB,YACd,MACA,OACS;CACT,OAAO,UAAU,UAAa,MAAM,iBAAiB,KAAK,MAAM;AAClE;AAEA,SAAgB,iBAAiB,MAAyC;CACxE,MAAM,EAAE,mBAAmB,WAAW,WAAW,gBAAgB,YAAY;CAC7E,MAAM,OAAO,EAAE,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC,EAAG;CAE7D,MAAM,cAAiC;EACrC,IAAI,CAAC,kBAAkB,CAAC,SAAS,OAAO,KAAK;EAC7C,MAAM,OAAO,KAAK,UAAU,QAAQ,OAAO,YAAY,MAAM,QAAQ,EAAE,CAAC,CAAC;EACzE,OAAO,KAAK,WAAW,KAAK,UAAU,SAAS,KAAK,YAAY;CAClE;CACA,MAAM,cAAuB;EAC3B,MAAM,MAAM,MAAM;EAClB,OAAO,KAAK,gBAAgB,QAAQ,KAAK,aAAa,IAAI,SAAS;CACrE;CACA,OAAO;EACL,IAAI,YAAY;GAAE,OAAO,MAAM;EAAG;EAClC,IAAI,cAAc;GAAE,OAAO,MAAM;EAAG;EACpC,UAAU;EACV;EACA,WAAW,oBAAoB;EAC/B,GAAG;EAGH,IAAI,cAAc;GAChB,IAAI,CAAC,MAAM,GAAG,OAAO;GACrB,OAAO,UAAU,MAAM,CAAC,CAAC,KAAK,OAAO,kBAAkB,EAAE,CAAC,CAAC;EAC7D;CACF;AACF"}
|
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
//#region src/core/selection/readOnlySelection.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var methodViews = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
var apiViews = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
var ignore = () => {};
|
|
5
|
+
function readOnlyAdapterMethods(methods) {
|
|
6
|
+
let view = methodViews.get(methods);
|
|
7
|
+
if (!view) {
|
|
8
|
+
view = {
|
|
9
|
+
getSelection: () => methods.getSelection(),
|
|
10
|
+
setSelection: ignore
|
|
11
|
+
};
|
|
12
|
+
methodViews.set(methods, view);
|
|
13
|
+
}
|
|
14
|
+
return view;
|
|
9
15
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A view of `api` that reads the live selection and ignores every write.
|
|
18
|
+
* `api` itself is untouched and still writes.
|
|
19
|
+
*
|
|
20
|
+
* One view per `api`, and one set of `adapterMethods` per `api.adapterMethods`,
|
|
21
|
+
* so either is as stable a memo or effect dependency as the object it wraps.
|
|
22
|
+
*/
|
|
23
|
+
function readOnlySelection(api) {
|
|
24
|
+
const adapterMethods = readOnlyAdapterMethods(api.adapterMethods);
|
|
25
|
+
const cached = apiViews.get(api);
|
|
26
|
+
if (cached && cached.adapterMethods === adapterMethods) return cached;
|
|
27
|
+
const view = {
|
|
14
28
|
get current() {
|
|
15
|
-
return
|
|
29
|
+
return api.current;
|
|
16
30
|
},
|
|
17
|
-
get:
|
|
18
|
-
contains:
|
|
19
|
-
set:
|
|
20
|
-
add:
|
|
21
|
-
remove:
|
|
22
|
-
toggle:
|
|
23
|
-
clear:
|
|
24
|
-
applyClick:
|
|
25
|
-
adapterMethods
|
|
31
|
+
get: api.get,
|
|
32
|
+
contains: api.contains,
|
|
33
|
+
set: ignore,
|
|
34
|
+
add: ignore,
|
|
35
|
+
remove: ignore,
|
|
36
|
+
toggle: ignore,
|
|
37
|
+
clear: ignore,
|
|
38
|
+
applyClick: ignore,
|
|
39
|
+
adapterMethods
|
|
26
40
|
};
|
|
27
|
-
|
|
41
|
+
apiViews.set(api, view);
|
|
42
|
+
return view;
|
|
28
43
|
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { i as readOnlySelection };
|
|
31
44
|
|
|
45
|
+
//#endregion
|
|
46
|
+
export { readOnlySelection };
|
|
32
47
|
//# sourceMappingURL=readOnlySelection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOnlySelection.js","names":[
|
|
1
|
+
{"version":3,"file":"readOnlySelection.js","names":[],"sources":["../../../src/core/selection/readOnlySelection.ts"],"sourcesContent":["import type { SelectionApi } from './useSelection';\n\ntype AdapterMethods = SelectionApi['adapterMethods'];\n\nconst methodViews = new WeakMap<AdapterMethods, AdapterMethods>();\nconst apiViews = new WeakMap<SelectionApi, SelectionApi>();\n\nconst ignore = (): void => {};\n\nfunction readOnlyAdapterMethods(methods: AdapterMethods): AdapterMethods {\n let view = methodViews.get(methods);\n if (!view) {\n view = { getSelection: () => methods.getSelection(), setSelection: ignore };\n methodViews.set(methods, view);\n }\n return view;\n}\n\n/**\n * A view of `api` that reads the live selection and ignores every write.\n * `api` itself is untouched and still writes.\n *\n * One view per `api`, and one set of `adapterMethods` per `api.adapterMethods`,\n * so either is as stable a memo or effect dependency as the object it wraps.\n */\nexport function readOnlySelection(api: SelectionApi): SelectionApi {\n const adapterMethods = readOnlyAdapterMethods(api.adapterMethods);\n const cached = apiViews.get(api);\n if (cached && cached.adapterMethods === adapterMethods) return cached;\n const view: SelectionApi = {\n get current() { return api.current; },\n get: api.get,\n contains: api.contains,\n set: ignore,\n add: ignore,\n remove: ignore,\n toggle: ignore,\n clear: ignore,\n applyClick: ignore,\n adapterMethods,\n };\n apiViews.set(api, view);\n return view;\n}\n"],"mappings":";AAIA,IAAM,8BAAc,IAAI,QAAwC;AAChE,IAAM,2BAAW,IAAI,QAAoC;AAEzD,IAAM,eAAqB,CAAC;AAE5B,SAAS,uBAAuB,SAAyC;CACvE,IAAI,OAAO,YAAY,IAAI,OAAO;CAClC,IAAI,CAAC,MAAM;EACT,OAAO;GAAE,oBAAoB,QAAQ,aAAa;GAAG,cAAc;EAAO;EAC1E,YAAY,IAAI,SAAS,IAAI;CAC/B;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,kBAAkB,KAAiC;CACjE,MAAM,iBAAiB,uBAAuB,IAAI,cAAc;CAChE,MAAM,SAAS,SAAS,IAAI,GAAG;CAC/B,IAAI,UAAU,OAAO,mBAAmB,gBAAgB,OAAO;CAC/D,MAAM,OAAqB;EACzB,IAAI,UAAU;GAAE,OAAO,IAAI;EAAS;EACpC,KAAK,IAAI;EACT,UAAU,IAAI;EACd,KAAK;EACL,KAAK;EACL,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,YAAY;EACZ;CACF;CACA,SAAS,IAAI,KAAK,IAAI;CACtB,OAAO;AACT"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
//#region src/core/selection/selectionTarget.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/** Synthetic id a canvas uses to address the
|
|
3
|
+
* union-AABB target when 2+ real ids are selected. The selection-overlay
|
|
4
|
+
* layer and the affordance hit-tester both resolve it to `ChromeState`'s
|
|
5
|
+
* `unionBounds`; consumers wiring their own selection-overlay layer can
|
|
6
|
+
* reference the same constant.
|
|
7
|
+
*
|
|
8
|
+
* Lives in `core/selection` (next to `ChromeState`) because it's a
|
|
9
|
+
* selection-derived concept, not a tool concept — `affordances/`,
|
|
10
|
+
* `features/selection/`, and `tools/` all consume it, so it must sit at
|
|
11
|
+
* the bottom of the layering (`core` → `affordances` → `tools` →
|
|
12
|
+
* `features`). */
|
|
13
|
+
var MULTI_RESIZE_TARGET_ID = "__weasel:multi-selection";
|
|
5
14
|
|
|
15
|
+
//#endregion
|
|
16
|
+
export { MULTI_RESIZE_TARGET_ID };
|
|
6
17
|
//# sourceMappingURL=selectionTarget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionTarget.js","names":[
|
|
1
|
+
{"version":3,"file":"selectionTarget.js","names":[],"sources":["../../../src/core/selection/selectionTarget.ts"],"sourcesContent":["/** Synthetic id a canvas uses to address the\n * union-AABB target when 2+ real ids are selected. The selection-overlay\n * layer and the affordance hit-tester both resolve it to `ChromeState`'s\n * `unionBounds`; consumers wiring their own selection-overlay layer can\n * reference the same constant.\n *\n * Lives in `core/selection` (next to `ChromeState`) because it's a\n * selection-derived concept, not a tool concept — `affordances/`,\n * `features/selection/`, and `tools/` all consume it, so it must sit at\n * the bottom of the layering (`core` → `affordances` → `tools` →\n * `features`). */\nexport const MULTI_RESIZE_TARGET_ID = '__weasel:multi-selection';\n"],"mappings":";;;;;;;;;;;;AAWA,IAAa,yBAAyB"}
|