@weasel-js/core 1.7.0 → 1.7.2
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 +794 -0
- package/README.md +14 -8
- package/dist/WeaselProvider.js +15 -0
- package/dist/WeaselProvider.js.map +1 -0
- package/dist/affordances/composeAffordanceLayer.js +224 -0
- package/dist/affordances/composeAffordanceLayer.js.map +1 -0
- package/dist/affordances/cornerResize.js +69 -0
- package/dist/affordances/cornerResize.js.map +1 -0
- package/dist/affordances/hitAffordanceRegions.js +138 -0
- package/dist/affordances/hitAffordanceRegions.js.map +1 -0
- package/dist/affordances/pathAnchors.js +66 -0
- package/dist/affordances/pathAnchors.js.map +1 -0
- package/dist/affordances/rotationHandle.js +103 -0
- package/dist/affordances/rotationHandle.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +118 -0
- package/dist/animation/behaviors/momentum.js.map +1 -0
- package/dist/animation/colorHelpers.js +135 -0
- package/dist/animation/colorHelpers.js.map +1 -0
- package/dist/animation/colorRegistry.js +37 -0
- package/dist/animation/colorRegistry.js.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/loop.js +62 -0
- package/dist/animation/loop.js.map +1 -0
- package/dist/animation/observe.js +23 -0
- package/dist/animation/observe.js.map +1 -0
- package/dist/animation/poseHelpers.js +50 -0
- package/dist/animation/poseHelpers.js.map +1 -0
- package/dist/animation/reflow.js +121 -0
- package/dist/animation/reflow.js.map +1 -0
- package/dist/animation/rig/bindRig.js +74 -0
- package/dist/animation/rig/bindRig.js.map +1 -0
- package/dist/animation/rig/blendPoses.js +43 -0
- package/dist/animation/rig/blendPoses.js.map +1 -0
- package/dist/animation/rig/mirrorPose.js +19 -0
- package/dist/animation/rig/mirrorPose.js.map +1 -0
- package/dist/animation/rig/resolveSkeleton.js +33 -0
- package/dist/animation/rig/resolveSkeleton.js.map +1 -0
- package/dist/animation/rig/solveIk.js +103 -0
- package/dist/animation/rig/solveIk.js.map +1 -0
- package/dist/animation/rig/types.js +12 -0
- package/dist/animation/rig/types.js.map +1 -0
- package/dist/animation/rig/useRig.js +23 -0
- package/dist/animation/rig/useRig.js.map +1 -0
- package/dist/animation/slew.js +27 -0
- package/dist/animation/slew.js.map +1 -0
- package/dist/animation/stagger.js +138 -0
- package/dist/animation/stagger.js.map +1 -0
- package/dist/animation/timeline/booking.js +106 -0
- package/dist/animation/timeline/booking.js.map +1 -0
- package/dist/animation/timeline/createTimeline.js +116 -0
- package/dist/animation/timeline/createTimeline.js.map +1 -0
- package/dist/animation/timeline/sampleTrack.js +29 -0
- package/dist/animation/timeline/sampleTrack.js.map +1 -0
- package/dist/animation/useAnimator.js +329 -0
- package/dist/animation/useAnimator.js.map +1 -0
- package/dist/animation/wrappers/animateLifecycle.js +40 -0
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
- package/dist/animation/wrappers/animateOnSetPose.js +44 -0
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
- package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-vCdt55xm.d.ts} +2 -2
- package/dist/{builtins-DLn2lCr_.d.ts → builtins-C-gRyVRx.d.ts} +742 -513
- package/dist/canvas/Canvas.js +608 -0
- package/dist/canvas/Canvas.js.map +1 -0
- package/dist/canvas/CanvasView.js +255 -0
- package/dist/canvas/CanvasView.js.map +1 -0
- package/dist/canvas/CursorCoordsHud.js +102 -0
- package/dist/canvas/CursorCoordsHud.js.map +1 -0
- package/dist/canvas/DrawCanvas.js +67 -0
- package/dist/canvas/DrawCanvas.js.map +1 -0
- package/dist/canvas/MinimapCanvas.js +139 -0
- package/dist/canvas/MinimapCanvas.js.map +1 -0
- package/dist/canvas/ModalityHud.js +66 -0
- package/dist/canvas/ModalityHud.js.map +1 -0
- package/dist/canvas/NodeShape.js +391 -0
- package/dist/canvas/NodeShape.js.map +1 -0
- package/dist/canvas/PickHud.js +93 -0
- package/dist/canvas/PickHud.js.map +1 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
- package/dist/canvas/SceneCanvas/features.js +97 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +992 -0
- package/dist/canvas/SceneCanvas.js.map +1 -0
- package/dist/canvas/SceneViewCanvas.js +54 -0
- package/dist/canvas/SceneViewCanvas.js.map +1 -0
- package/dist/canvas/accentColor.js +9 -0
- package/dist/canvas/accentColor.js.map +1 -0
- package/dist/canvas/affordanceAt.js +63 -0
- package/dist/canvas/affordanceAt.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +65 -0
- package/dist/canvas/buildSceneTree.js.map +1 -0
- package/dist/canvas/canvasRenderer.js +89 -0
- package/dist/canvas/canvasRenderer.js.map +1 -0
- package/dist/canvas/colorOverrides.js +16 -0
- package/dist/canvas/colorOverrides.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +43 -0
- package/dist/canvas/defaultDrawOne.js.map +1 -0
- package/dist/canvas/deps/areaSelect.js +19 -0
- package/dist/canvas/deps/areaSelect.js.map +1 -0
- package/dist/canvas/deps/debug.js +9 -0
- package/dist/canvas/deps/debug.js.map +1 -0
- package/dist/canvas/deps/dispatcher.js +11 -0
- package/dist/canvas/deps/dispatcher.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +101 -0
- package/dist/canvas/deps/editAnchors.js.map +1 -0
- package/dist/canvas/deps/geometryProjection.js +11 -0
- package/dist/canvas/deps/geometryProjection.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +51 -0
- package/dist/canvas/deps/hitTestArea.js.map +1 -0
- package/dist/canvas/deps/ingestion.js +31 -0
- package/dist/canvas/deps/ingestion.js.map +1 -0
- package/dist/canvas/deps/insert.js +116 -0
- package/dist/canvas/deps/insert.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +20 -0
- package/dist/canvas/deps/lassoSelect.js.map +1 -0
- package/dist/canvas/deps/layout.js +34 -0
- package/dist/canvas/deps/layout.js.map +1 -0
- package/dist/canvas/deps/nodeAtPoint.js +19 -0
- package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
- package/dist/canvas/deps/poseComposition.js +11 -0
- package/dist/canvas/deps/poseComposition.js.map +1 -0
- package/dist/canvas/deps/poseDescriptor.js +12 -0
- package/dist/canvas/deps/poseDescriptor.js.map +1 -0
- package/dist/canvas/deps/resizePolicy.js +35 -0
- package/dist/canvas/deps/resizePolicy.js.map +1 -0
- package/dist/canvas/deps/slice.js +99 -0
- package/dist/canvas/deps/slice.js.map +1 -0
- package/dist/canvas/deps/snap.js +11 -0
- package/dist/canvas/deps/snap.js.map +1 -0
- package/dist/canvas/deps/textEdit.js +21 -0
- package/dist/canvas/deps/textEdit.js.map +1 -0
- package/dist/canvas/deps/view.js +43 -0
- package/dist/canvas/deps/view.js.map +1 -0
- package/dist/canvas/derivedPath.js +47 -0
- package/dist/canvas/derivedPath.js.map +1 -0
- package/dist/canvas/drawEnvelope.js +22 -0
- package/dist/canvas/drawEnvelope.js.map +1 -0
- package/dist/canvas/getNodeAtPoint.js +18 -0
- package/dist/canvas/getNodeAtPoint.js.map +1 -0
- package/dist/canvas/hostAnchor.js +29 -0
- package/dist/canvas/hostAnchor.js.map +1 -0
- package/dist/canvas/hud.module.js +18 -0
- package/dist/canvas/hud.module.js.map +1 -0
- package/dist/canvas/insertPreviewExtent.js +103 -0
- package/dist/canvas/insertPreviewExtent.js.map +1 -0
- package/dist/canvas/kitRequirements.js +177 -0
- package/dist/canvas/kitRequirements.js.map +1 -0
- package/dist/canvas/layerOrder.js +66 -0
- package/dist/canvas/layerOrder.js.map +1 -0
- package/dist/canvas/layerSlots.js +14 -0
- package/dist/canvas/layerSlots.js.map +1 -0
- package/dist/canvas/minimapMath.js +80 -0
- package/dist/canvas/minimapMath.js.map +1 -0
- package/dist/canvas/mountedCanvases.js +20 -0
- package/dist/canvas/mountedCanvases.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js +17 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -0
- package/dist/canvas/paintCull.js +20 -0
- package/dist/canvas/paintCull.js.map +1 -0
- package/dist/canvas/pickWalk.js +158 -0
- package/dist/canvas/pickWalk.js.map +1 -0
- package/dist/canvas/planeClips.js +30 -0
- package/dist/canvas/planeClips.js.map +1 -0
- package/dist/canvas/poseRotation.js +35 -0
- package/dist/canvas/poseRotation.js.map +1 -0
- package/dist/canvas/rasterToPng.js +21 -0
- package/dist/canvas/rasterToPng.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +32 -0
- package/dist/canvas/renderDebugSnapshot.js.map +1 -0
- package/dist/canvas/renderNeeds.js +25 -0
- package/dist/canvas/renderNeeds.js.map +1 -0
- package/dist/canvas/renderSceneToPixels.js +143 -0
- package/dist/canvas/renderSceneToPixels.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +270 -0
- package/dist/canvas/sceneAdapter.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +37 -0
- package/dist/canvas/sceneLayerPaint.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +20 -0
- package/dist/canvas/sceneSlotWiring.js.map +1 -0
- package/dist/canvas/sceneViewRender.js +72 -0
- package/dist/canvas/sceneViewRender.js.map +1 -0
- package/dist/canvas/slopsDebugLayer.js +61 -0
- package/dist/canvas/slopsDebugLayer.js.map +1 -0
- package/dist/canvas/surfaceContribution.js +15 -0
- package/dist/canvas/surfaceContribution.js.map +1 -0
- package/dist/canvas/toolPreview.js +39 -0
- package/dist/canvas/toolPreview.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +11 -0
- package/dist/canvas/useCanvasRenderer.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +60 -0
- package/dist/canvas/useFrameLoop.js.map +1 -0
- package/dist/canvas/useHostAnchor.js +71 -0
- package/dist/canvas/useHostAnchor.js.map +1 -0
- package/dist/canvas/useLateContentRedraw.js +21 -0
- package/dist/canvas/useLateContentRedraw.js.map +1 -0
- package/dist/canvas/useRedrawOn.js +21 -0
- package/dist/canvas/useRedrawOn.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +120 -0
- package/dist/canvas/useViewHelpers.js.map +1 -0
- package/dist/canvas/viewInputs.js +17 -0
- package/dist/canvas/viewInputs.js.map +1 -0
- package/dist/canvas/viewRegistry.js +61 -0
- package/dist/canvas/viewRegistry.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +14 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -0
- package/dist/clipboard.d.ts +10 -5
- package/dist/clipboard.js +3 -5
- package/dist/clone.d.ts +3 -3
- package/dist/clone.js +2 -5
- package/dist/core/adapters/arrayAdapter.js +85 -0
- package/dist/core/adapters/arrayAdapter.js.map +1 -0
- package/dist/core/adapters/useArrayAdapter.js +13 -0
- package/dist/core/adapters/useArrayAdapter.js.map +1 -0
- package/dist/core/applyOps.js +12 -0
- package/dist/core/applyOps.js.map +1 -0
- package/dist/core/device/index.js +4 -0
- package/dist/core/device/targets.js +17 -0
- package/dist/core/device/targets.js.map +1 -0
- package/dist/core/device/useDeviceProfile.js +75 -0
- package/dist/core/device/useDeviceProfile.js.map +1 -0
- package/dist/core/fillInPoseFrame.js +102 -0
- package/dist/core/fillInPoseFrame.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +93 -0
- package/dist/core/geometry/poseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseRotation.js +58 -0
- package/dist/core/geometry/poseRotation.js.map +1 -0
- package/dist/core/geometry/regionHit.js +102 -0
- package/dist/core/geometry/regionHit.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +60 -0
- package/dist/core/geometry/unionBounds.js.map +1 -0
- package/dist/core/gradient.js +136 -0
- package/dist/core/gradient.js.map +1 -0
- package/dist/core/isPlainObject.js +11 -0
- package/dist/core/isPlainObject.js.map +1 -0
- package/dist/core/layers/render.js +150 -0
- package/dist/core/layers/render.js.map +1 -0
- package/dist/core/markerInset.js +24 -0
- package/dist/core/markerInset.js.map +1 -0
- package/dist/core/mixed.js +6 -0
- package/dist/core/mixed.js.map +1 -0
- package/dist/core/ops/arrange.js +31 -0
- package/dist/core/ops/arrange.js.map +1 -0
- package/dist/core/ops/create.js +32 -0
- package/dist/core/ops/create.js.map +1 -0
- package/dist/core/ops/createHistory.js +20 -0
- package/dist/core/ops/createHistory.js.map +1 -0
- package/dist/core/ops/delete.js +89 -0
- package/dist/core/ops/delete.js.map +1 -0
- package/dist/core/ops/registry.js +17 -0
- package/dist/core/ops/registry.js.map +1 -0
- package/dist/core/ops/reorder/algorithms.js +55 -0
- package/dist/core/ops/reorder/algorithms.js.map +1 -0
- package/dist/core/ops/reorder/index.js +140 -0
- package/dist/core/ops/reorder/index.js.map +1 -0
- package/dist/core/ops/reparent.js +52 -0
- package/dist/core/ops/reparent.js.map +1 -0
- package/dist/core/ops/select.js +34 -0
- package/dist/core/ops/select.js.map +1 -0
- package/dist/core/ops/setData.js +34 -0
- package/dist/core/ops/setData.js.map +1 -0
- package/dist/core/ops/setLayer.js +34 -0
- package/dist/core/ops/setLayer.js.map +1 -0
- package/dist/core/ops/setLayout.js +31 -0
- package/dist/core/ops/setLayout.js.map +1 -0
- package/dist/core/ops/setPath.js +57 -0
- package/dist/core/ops/setPath.js.map +1 -0
- package/dist/core/ops/setText.js +34 -0
- package/dist/core/ops/setText.js.map +1 -0
- package/dist/core/ops/slot.js +37 -0
- package/dist/core/ops/slot.js.map +1 -0
- package/dist/core/ops/transform.js +42 -0
- package/dist/core/ops/transform.js.map +1 -0
- package/dist/core/paintKinds.js +156 -0
- package/dist/core/paintKinds.js.map +1 -0
- package/dist/core/scene/NodeProperties.js +20 -0
- package/dist/core/scene/NodeProperties.js.map +1 -0
- package/dist/core/scene/NodeRouting.js +24 -0
- package/dist/core/scene/NodeRouting.js.map +1 -0
- package/dist/core/scene/arrivals.js +12 -0
- package/dist/core/scene/arrivals.js.map +1 -0
- package/dist/core/scene/composeFrame.js +29 -0
- package/dist/core/scene/composeFrame.js.map +1 -0
- package/dist/core/scene/depMemo.js +18 -0
- package/dist/core/scene/depMemo.js.map +1 -0
- package/dist/core/scene/dependents.js +66 -0
- package/dist/core/scene/dependents.js.map +1 -0
- package/dist/core/scene/derivedPath.js +31 -0
- package/dist/core/scene/derivedPath.js.map +1 -0
- package/dist/core/scene/effectivePose.js +78 -0
- package/dist/core/scene/effectivePose.js.map +1 -0
- package/dist/core/scene/kitRegistry.js +33 -0
- package/dist/core/scene/kitRegistry.js.map +1 -0
- package/dist/core/scene/layoutPass.js +96 -0
- package/dist/core/scene/layoutPass.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +83 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -0
- package/dist/core/scene/nodeMemo.js +28 -0
- package/dist/core/scene/nodeMemo.js.map +1 -0
- package/dist/core/scene/poseFeed.js +87 -0
- package/dist/core/scene/poseFeed.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +52 -0
- package/dist/core/scene/poseOverrides.js.map +1 -0
- package/dist/core/scene/poseSnapshot.js +54 -0
- package/dist/core/scene/poseSnapshot.js.map +1 -0
- package/dist/core/scene/scene.js +1271 -0
- package/dist/core/scene/scene.js.map +1 -0
- package/dist/core/scene/types.js +6 -0
- package/dist/core/scene/types.js.map +1 -0
- package/dist/core/scene/useScene.js +32 -0
- package/dist/core/scene/useScene.js.map +1 -0
- package/dist/core/selection/chromeState.js +31 -0
- package/dist/core/selection/chromeState.js.map +1 -0
- package/dist/core/selection/selectionTarget.js +6 -0
- package/dist/core/selection/selectionTarget.js.map +1 -0
- package/dist/core/selection/useSelection.js +71 -0
- package/dist/core/selection/useSelection.js.map +1 -0
- package/dist/core/shapeKinds.js +54 -0
- package/dist/core/shapeKinds.js.map +1 -0
- package/dist/core/strokeMarkerShapes.js +139 -0
- package/dist/core/strokeMarkerShapes.js.map +1 -0
- package/dist/core/strokeMarkers.js +28 -0
- package/dist/core/strokeMarkers.js.map +1 -0
- package/dist/core/stylus/stylus.js +39 -0
- package/dist/core/stylus/stylus.js.map +1 -0
- package/dist/core/stylus/usePointerStylus.js +51 -0
- package/dist/core/stylus/usePointerStylus.js.map +1 -0
- package/dist/core/usePaintKinds.js +17 -0
- package/dist/core/usePaintKinds.js.map +1 -0
- package/dist/core/viewport/clampView.js +24 -0
- package/dist/core/viewport/clampView.js.map +1 -0
- package/dist/core/viewport/clientToWorld.js +8 -0
- package/dist/core/viewport/clientToWorld.js.map +1 -0
- package/dist/core/viewport/createVelocityTracker.js +39 -0
- package/dist/core/viewport/createVelocityTracker.js.map +1 -0
- package/dist/core/viewport/fitToBounds.js +18 -0
- package/dist/core/viewport/fitToBounds.js.map +1 -0
- package/dist/core/viewport/fitViewToBounds.js +36 -0
- package/dist/core/viewport/fitViewToBounds.js.map +1 -0
- package/dist/core/viewport/interpolateView.js +34 -0
- package/dist/core/viewport/interpolateView.js.map +1 -0
- package/dist/core/viewport/meanScale.js +8 -0
- package/dist/core/viewport/meanScale.js.map +1 -0
- package/dist/core/viewport/parallax.js +111 -0
- package/dist/core/viewport/parallax.js.map +1 -0
- package/dist/core/viewport/pxExtent.js +42 -0
- package/dist/core/viewport/pxExtent.js.map +1 -0
- package/dist/core/viewport/sceneNodeClientRect.js +18 -0
- package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
- package/dist/core/viewport/screenSlop.js +27 -0
- package/dist/core/viewport/screenSlop.js.map +1 -0
- package/dist/core/viewport/useAutoCenter.js +32 -0
- package/dist/core/viewport/useAutoCenter.js.map +1 -0
- package/dist/core/viewport/useCanvasSize.js +29 -0
- package/dist/core/viewport/useCanvasSize.js.map +1 -0
- package/dist/core/viewport/useDecayLoop.js +63 -0
- package/dist/core/viewport/useDecayLoop.js.map +1 -0
- package/dist/core/viewport/useVelocityTracker.js +10 -0
- package/dist/core/viewport/useVelocityTracker.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +63 -0
- package/dist/core/viewport/useViewAnimation.js.map +1 -0
- package/dist/core/viewport/view.js +37 -0
- package/dist/core/viewport/view.js.map +1 -0
- package/dist/core/viewport/viewTransform.js +11 -0
- package/dist/core/viewport/viewTransform.js.map +1 -0
- package/dist/core/viewport/viewportWorldRect.js +13 -0
- package/dist/core/viewport/viewportWorldRect.js.map +1 -0
- package/dist/core/viewport/wheelHandler.js +30 -0
- package/dist/core/viewport/wheelHandler.js.map +1 -0
- package/dist/core/viewport/zoomAt.js +22 -0
- package/dist/core/viewport/zoomAt.js.map +1 -0
- package/dist/core/viewport/zoomBounds.js +20 -0
- package/dist/core/viewport/zoomBounds.js.map +1 -0
- package/dist/{pointSnapToGrid-Dp2IxLGb.d.ts → cornerHandles-BCrDp_mH.d.ts} +3 -13
- package/dist/debug/createDebugOverlayLayer.js +358 -0
- package/dist/debug/createDebugOverlayLayer.js.map +1 -0
- package/dist/debug/createDebugSink.js +83 -0
- package/dist/debug/createDebugSink.js.map +1 -0
- package/dist/debug/defaultTheme.js +31 -0
- package/dist/debug/defaultTheme.js.map +1 -0
- package/dist/debug/flag.js +41 -0
- package/dist/debug/flag.js.map +1 -0
- package/dist/debug/frameStats.js +16 -0
- package/dist/debug/frameStats.js.map +1 -0
- package/dist/debug/parseDebugFlags.js +32 -0
- package/dist/debug/parseDebugFlags.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
- package/dist/features/chrome-caps/conditions.js +36 -0
- package/dist/features/chrome-caps/conditions.js.map +1 -0
- package/dist/features/chrome-caps/defaults.js +26 -0
- package/dist/features/chrome-caps/defaults.js.map +1 -0
- package/dist/features/chrome-caps/index.js +7 -0
- package/dist/features/chrome-caps/resolve.js +23 -0
- package/dist/features/chrome-caps/resolve.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +27 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
- package/dist/features/cursor/paintedCursorLayer.js +60 -0
- package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
- package/dist/features/focus/gateLayer.js +14 -0
- package/dist/features/focus/gateLayer.js.map +1 -0
- package/dist/features/focus/useCanvasFocus.js +29 -0
- package/dist/features/focus/useCanvasFocus.js.map +1 -0
- package/dist/features/groups/children.js +23 -0
- package/dist/features/groups/children.js.map +1 -0
- package/dist/features/groups/composePose.js +67 -0
- package/dist/features/groups/composePose.js.map +1 -0
- package/dist/features/groups/nestedHit.js +40 -0
- package/dist/features/groups/nestedHit.js.map +1 -0
- package/dist/features/groups/unionOfChildren.js +15 -0
- package/dist/features/groups/unionOfChildren.js.map +1 -0
- package/dist/features/images/imageCache.js +94 -0
- package/dist/features/images/imageCache.js.map +1 -0
- package/dist/features/ingestion/contentHandlers.js +37 -0
- package/dist/features/ingestion/contentHandlers.js.map +1 -0
- package/dist/features/ingestion/imageHandler.js +45 -0
- package/dist/features/ingestion/imageHandler.js.map +1 -0
- package/dist/features/ingestion/index.js +8 -0
- package/dist/features/ingestion/openFilePicker.js +15 -0
- package/dist/features/ingestion/openFilePicker.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +26 -0
- package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +58 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +39 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
- package/dist/features/longPress/longPressFeedback.js +96 -0
- package/dist/features/longPress/longPressFeedback.js.map +1 -0
- package/dist/features/meshPaint/bake.js +79 -0
- package/dist/features/meshPaint/bake.js.map +1 -0
- package/dist/features/meshPaint/bakeCache.js +59 -0
- package/dist/features/meshPaint/bakeCache.js.map +1 -0
- package/dist/features/meshPaint/handles.js +86 -0
- package/dist/features/meshPaint/handles.js.map +1 -0
- package/dist/features/meshPaint/lazyKind.js +1298 -0
- package/dist/features/meshPaint/lazyKind.js.map +1 -0
- package/dist/features/meshPaint/meshPaint.js +236 -0
- package/dist/features/meshPaint/meshPaint.js.map +1 -0
- package/dist/features/meshPaint/meshShader.js +6 -0
- package/dist/features/meshPaint/meshShader.js.map +1 -0
- package/dist/features/meshPaint/register.js +7 -0
- package/dist/features/meshPaint/register.js.map +1 -0
- package/dist/features/meshPaint/surface.js +110 -0
- package/dist/features/meshPaint/surface.js.map +1 -0
- package/dist/features/minimap/actions.js +53 -0
- package/dist/features/minimap/actions.js.map +1 -0
- package/dist/features/minimap/createMinimapContribution.js +96 -0
- package/dist/features/minimap/createMinimapContribution.js.map +1 -0
- package/dist/features/minimap/layers.js +103 -0
- package/dist/features/minimap/layers.js.map +1 -0
- package/dist/features/modes/modeLayers.js +113 -0
- package/dist/features/modes/modeLayers.js.map +1 -0
- package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
- package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
- package/dist/features/parallax/createParallaxLayer.js +26 -0
- package/dist/features/parallax/createParallaxLayer.js.map +1 -0
- package/dist/features/parallax/createParallaxPlane.js +26 -0
- package/dist/features/parallax/createParallaxPlane.js.map +1 -0
- package/dist/features/paths/anchorEdits.js +156 -0
- package/dist/features/paths/anchorEdits.js.map +1 -0
- package/dist/features/paths/anchors.js +154 -0
- package/dist/features/paths/anchors.js.map +1 -0
- package/dist/features/paths/booleans.js +2 -0
- package/dist/features/paths/index.js +15 -0
- package/dist/features/paths/markerCommands.js +116 -0
- package/dist/features/paths/markerCommands.js.map +1 -0
- package/dist/features/paths/markerSites.js +59 -0
- package/dist/features/paths/markerSites.js.map +1 -0
- package/dist/features/paths/markers.js +95 -0
- package/dist/features/paths/markers.js.map +1 -0
- package/dist/features/paths/nearestAnchor.js +36 -0
- package/dist/features/paths/nearestAnchor.js.map +1 -0
- package/dist/features/paths/originProjection.js +16 -0
- package/dist/features/paths/originProjection.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
- package/dist/features/paths/pathInWorld.js +41 -0
- package/dist/features/paths/pathInWorld.js.map +1 -0
- package/dist/features/paths/pathLayer.js +44 -0
- package/dist/features/paths/pathLayer.js.map +1 -0
- package/dist/features/paths/penPreviewLayer.js +220 -0
- package/dist/features/paths/penPreviewLayer.js.map +1 -0
- package/dist/features/paths/poseDescriptor.js +39 -0
- package/dist/features/paths/poseDescriptor.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js +230 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -0
- package/dist/features/patterns/index.js +23 -0
- package/dist/features/patterns/index.js.map +1 -0
- package/dist/features/patterns/patterns-builtin.js +38 -0
- package/dist/features/patterns/patterns-builtin.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +57 -0
- package/dist/features/patterns/resolveSpec.js.map +1 -0
- package/dist/features/patterns/tileGeometry.js +158 -0
- package/dist/features/patterns/tileGeometry.js.map +1 -0
- package/dist/features/pointer/PointerContext.js +45 -0
- package/dist/features/pointer/PointerContext.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +70 -0
- package/dist/features/poseRun/usePoseRun.js.map +1 -0
- package/dist/features/selection/SelectionContext.js +46 -0
- package/dist/features/selection/SelectionContext.js.map +1 -0
- package/dist/features/selection/overlay.js +442 -0
- package/dist/features/selection/overlay.js.map +1 -0
- package/dist/features/simulation/createSimulation.js +61 -0
- package/dist/features/simulation/createSimulation.js.map +1 -0
- package/dist/features/simulation/types.js +6 -0
- package/dist/features/simulation/types.js.map +1 -0
- package/dist/features/simulation/useSimulation.js +74 -0
- package/dist/features/simulation/useSimulation.js.map +1 -0
- package/dist/features/text/domRuns.js +258 -0
- package/dist/features/text/domRuns.js.map +1 -0
- package/dist/features/text/fitTextPose.js +38 -0
- package/dist/features/text/fitTextPose.js.map +1 -0
- package/dist/features/text/hitTest.js +45 -0
- package/dist/features/text/hitTest.js.map +1 -0
- package/dist/features/text/renderLabel.js +14 -0
- package/dist/features/text/renderLabel.js.map +1 -0
- package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
- package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
- package/dist/features/text/runs/flagRange.js +53 -0
- package/dist/features/text/runs/flagRange.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +135 -0
- package/dist/features/text/runs/rangeStyle.js.map +1 -0
- package/dist/features/text/textCommand.js +59 -0
- package/dist/features/text/textCommand.js.map +1 -0
- package/dist/features/text/textLayer.js +35 -0
- package/dist/features/text/textLayer.js.map +1 -0
- package/dist/features/text/textToPath.js +181 -0
- package/dist/features/text/textToPath.js.map +1 -0
- package/dist/features/text/useSceneTextEdit.js +138 -0
- package/dist/features/text/useSceneTextEdit.js.map +1 -0
- package/dist/features/text/useTextEdit.js +465 -0
- package/dist/features/text/useTextEdit.js.map +1 -0
- package/dist/features/tiling/createTiledLayer.js +63 -0
- package/dist/features/tiling/createTiledLayer.js.map +1 -0
- package/dist/features/tiling/tiledProject.js +14 -0
- package/dist/features/tiling/tiledProject.js.map +1 -0
- package/dist/features/viewports/viewResolver.js +59 -0
- package/dist/features/viewports/viewResolver.js.map +1 -0
- package/dist/features/viewports/viewportLayer.js +58 -0
- package/dist/features/viewports/viewportLayer.js.map +1 -0
- package/dist/icons/ArrowIcon.js +23 -0
- package/dist/icons/ArrowIcon.js.map +1 -0
- package/dist/icons/EllipseIcon.js +21 -0
- package/dist/icons/EllipseIcon.js.map +1 -0
- package/dist/icons/EyedropperIcon.js +49 -0
- package/dist/icons/EyedropperIcon.js.map +1 -0
- package/dist/icons/HandIcon.js +59 -0
- package/dist/icons/HandIcon.js.map +1 -0
- package/dist/icons/ImageIcon.js +34 -0
- package/dist/icons/ImageIcon.js.map +1 -0
- package/dist/icons/LassoIcon.js +22 -0
- package/dist/icons/LassoIcon.js.map +1 -0
- package/dist/icons/LineIcon.js +22 -0
- package/dist/icons/LineIcon.js.map +1 -0
- package/dist/icons/PenIcon.js +36 -0
- package/dist/icons/PenIcon.js.map +1 -0
- package/dist/icons/PencilIcon.js +25 -0
- package/dist/icons/PencilIcon.js.map +1 -0
- package/dist/icons/PolygonIcon.js +19 -0
- package/dist/icons/PolygonIcon.js.map +1 -0
- package/dist/icons/RectIcon.js +37 -0
- package/dist/icons/RectIcon.js.map +1 -0
- package/dist/icons/SelectIcon.js +20 -0
- package/dist/icons/SelectIcon.js.map +1 -0
- package/dist/icons/StarIcon.js +19 -0
- package/dist/icons/StarIcon.js.map +1 -0
- package/dist/icons/TextIcon.js +19 -0
- package/dist/icons/TextIcon.js.map +1 -0
- package/dist/icons/UnknownIcon.js +33 -0
- package/dist/icons/UnknownIcon.js.map +1 -0
- package/dist/icons/_base.js +12 -0
- package/dist/icons/_base.js.map +1 -0
- package/dist/index.d.ts +1960 -1891
- package/dist/index.js +312 -13
- package/dist/input/keyState.js +76 -0
- package/dist/input/keyState.js.map +1 -0
- package/dist/input/useKeyState.js +22 -0
- package/dist/input/useKeyState.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js +32 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -0
- package/dist/interactions/actions/align/align.js +81 -0
- package/dist/interactions/actions/align/align.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +120 -0
- package/dist/interactions/actions/booleans/booleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +20 -0
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
- package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
- package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
- package/dist/interactions/actions/defaults/align.js +71 -0
- package/dist/interactions/actions/defaults/align.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js +75 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/booleans.js +52 -0
- package/dist/interactions/actions/defaults/booleans.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
- package/dist/interactions/actions/defaults/clearSelection.js +19 -0
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/clipboard.js +78 -0
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
- package/dist/interactions/actions/defaults/clone.js +107 -0
- package/dist/interactions/actions/defaults/clone.js.map +1 -0
- package/dist/interactions/actions/defaults/createOutlines.js +47 -0
- package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
- package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
- package/dist/interactions/actions/defaults/delete.js +61 -0
- package/dist/interactions/actions/defaults/delete.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +66 -0
- package/dist/interactions/actions/defaults/distribute.js.map +1 -0
- package/dist/interactions/actions/defaults/duplicate.js +83 -0
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
- package/dist/interactions/actions/defaults/editAnchors.js +100 -0
- package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/escape.js +26 -0
- package/dist/interactions/actions/defaults/escape.js.map +1 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/flip.js +119 -0
- package/dist/interactions/actions/defaults/flip.js.map +1 -0
- package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
- package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
- package/dist/interactions/actions/defaults/group.js +131 -0
- package/dist/interactions/actions/defaults/group.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/ingest.js +58 -0
- package/dist/interactions/actions/defaults/ingest.js.map +1 -0
- package/dist/interactions/actions/defaults/insert.js +288 -0
- package/dist/interactions/actions/defaults/insert.js.map +1 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
- package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/move.js +760 -0
- package/dist/interactions/actions/defaults/move.js.map +1 -0
- package/dist/interactions/actions/defaults/nudge.js +110 -0
- package/dist/interactions/actions/defaults/nudge.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +143 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -0
- package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/resize.js +335 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +184 -0
- package/dist/interactions/actions/defaults/rotate.js.map +1 -0
- package/dist/interactions/actions/defaults/selectAll.js +27 -0
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +27 -0
- package/dist/interactions/actions/defaults/setFill.js.map +1 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/setStroke.js +36 -0
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/slice.js +39 -0
- package/dist/interactions/actions/defaults/slice.js.map +1 -0
- package/dist/interactions/actions/defaults/sliceOps.js +60 -0
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
- package/dist/interactions/actions/defaults/toolActivate.js +35 -0
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
- package/dist/interactions/actions/defaults/undoRedo.js +51 -0
- package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +42 -0
- package/dist/interactions/actions/distribute/distribute.js.map +1 -0
- package/dist/interactions/actions/distribute/plan.js +29 -0
- package/dist/interactions/actions/distribute/plan.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/handles.js +43 -0
- package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +35 -0
- package/dist/interactions/actions/flip/helpers.js.map +1 -0
- package/dist/interactions/actions/geometryProjection.js +18 -0
- package/dist/interactions/actions/geometryProjection.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +44 -0
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +37 -0
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +84 -0
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
- package/dist/interactions/actions/planeInput.js +181 -0
- package/dist/interactions/actions/planeInput.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +9 -0
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
- package/dist/interactions/actions/poseFrame.js +38 -0
- package/dist/interactions/actions/poseFrame.js.map +1 -0
- package/dist/interactions/actions/previewOverrides.js +25 -0
- package/dist/interactions/actions/previewOverrides.js.map +1 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +31 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/index.js +8 -0
- package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
- package/dist/interactions/actions/resize/cornerHandles.js +72 -0
- package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +60 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -0
- package/dist/interactions/actions/resolvePreviews.js +61 -0
- package/dist/interactions/actions/resolvePreviews.js.map +1 -0
- package/dist/interactions/actions/rotate/geometry.js +46 -0
- package/dist/interactions/actions/rotate/geometry.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +27 -0
- package/dist/interactions/actions/rotate/handle.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js +42 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +142 -0
- package/dist/interactions/actions/useStandardActions.js.map +1 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
- package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
- package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
- package/dist/interactions/gestures/shared/originProjection.js +42 -0
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
- package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
- package/dist/interactions/gestures/shared/snap.js +24 -0
- package/dist/interactions/gestures/shared/snap.js.map +1 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
- package/dist/layout/arrivals.js +36 -0
- package/dist/layout/arrivals.js.map +1 -0
- package/dist/{math-MCQcf_gc.d.ts → math-Drrw4ewZ.d.ts} +8 -116
- package/dist/math.d.ts +4 -5
- package/dist/math.js +6 -4
- package/dist/mesh.d.ts +268 -0
- package/dist/mesh.js +7 -0
- package/dist/move.d.ts +7 -49
- package/dist/move.js +3 -142
- package/dist/originProjection-DEklpDc_.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-D-OH-tu5.d.ts} +0 -4
- package/dist/registerProgram-ateHDGjw.d.ts +193 -0
- package/dist/renderer/DrawCommand.js +6 -0
- package/dist/renderer/DrawCommand.js.map +1 -0
- package/dist/renderer/WeaselRenderer.js +328 -0
- package/dist/renderer/WeaselRenderer.js.map +1 -0
- package/dist/renderer/cache/GLImageCache.js +64 -0
- package/dist/renderer/cache/GLImageCache.js.map +1 -0
- package/dist/renderer/cache/GLMeshCache.js +102 -0
- package/dist/renderer/cache/GLMeshCache.js.map +1 -0
- package/dist/renderer/cache/GLTextureCache.js +51 -0
- package/dist/renderer/cache/GLTextureCache.js.map +1 -0
- package/dist/renderer/cache/GradientRampAtlas.js +82 -0
- package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
- package/dist/renderer/cache/cache.js +13 -0
- package/dist/renderer/cache/cache.js.map +1 -0
- package/dist/renderer/cache/markerCommandCache.js +59 -0
- package/dist/renderer/cache/markerCommandCache.js.map +1 -0
- package/dist/renderer/cache/outlineMeshCache.js +15 -0
- package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
- package/dist/renderer/cache/strokeMeshCache.js +44 -0
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
- package/dist/renderer/cullDrawCommands.js +89 -0
- package/dist/renderer/cullDrawCommands.js.map +1 -0
- package/dist/renderer/draw.js +1109 -0
- package/dist/renderer/draw.js.map +1 -0
- package/dist/renderer/drawBatch.js +168 -0
- package/dist/renderer/drawBatch.js.map +1 -0
- package/dist/renderer/effects/EffectTargets.js +45 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -0
- package/dist/renderer/effects/builtins.js +31 -0
- package/dist/renderer/effects/builtins.js.map +1 -0
- package/dist/renderer/effects/composite.js +9 -0
- package/dist/renderer/effects/composite.js.map +1 -0
- package/dist/renderer/effects/effectPrelude.js +10 -0
- package/dist/renderer/effects/effectPrelude.js.map +1 -0
- package/dist/renderer/effects/types.js +10 -0
- package/dist/renderer/effects/types.js.map +1 -0
- package/dist/renderer/index.js +19 -0
- package/dist/renderer/math/color.js +341 -0
- package/dist/renderer/math/color.js.map +1 -0
- package/dist/renderer/math/mat3.js +71 -0
- package/dist/renderer/math/mat3.js.map +1 -0
- package/dist/renderer/math/patternSpace.js +22 -0
- package/dist/renderer/math/patternSpace.js.map +1 -0
- package/dist/renderer/math/viewToMat3.js +19 -0
- package/dist/renderer/math/viewToMat3.js.map +1 -0
- package/dist/renderer/paintResources.js +18 -0
- package/dist/renderer/paintResources.js.map +1 -0
- package/dist/renderer/paintScratch.js +37 -0
- package/dist/renderer/paintScratch.js.map +1 -0
- package/dist/renderer/shaders/ShaderProgram.js +74 -0
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
- package/dist/renderer/shaders/batchFill.js +118 -0
- package/dist/renderer/shaders/batchFill.js.map +1 -0
- package/dist/renderer/shaders/customPrelude.js +34 -0
- package/dist/renderer/shaders/customPrelude.js.map +1 -0
- package/dist/renderer/shaders/extractUniformNames.js +184 -0
- package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
- package/dist/renderer/shaders/glyphPaint.js +61 -0
- package/dist/renderer/shaders/glyphPaint.js.map +1 -0
- package/dist/renderer/shaders/gradFill.js +30 -0
- package/dist/renderer/shaders/gradFill.js.map +1 -0
- package/dist/renderer/shaders/imageFill.js +14 -0
- package/dist/renderer/shaders/imageFill.js.map +1 -0
- package/dist/renderer/shaders/pathFill.js +13 -0
- package/dist/renderer/shaders/pathFill.js.map +1 -0
- package/dist/renderer/shaders/patternFill.js +24 -0
- package/dist/renderer/shaders/patternFill.js.map +1 -0
- package/dist/renderer/shaders/registerProgram.js +18 -0
- package/dist/renderer/shaders/registerProgram.js.map +1 -0
- package/dist/renderer/spriteSheet.js +14 -0
- package/dist/renderer/spriteSheet.js.map +1 -0
- package/dist/renderer/state/GroupState.js +77 -0
- package/dist/renderer/state/GroupState.js.map +1 -0
- package/dist/renderer/syntheticItalic.js +6 -0
- package/dist/renderer/syntheticItalic.js.map +1 -0
- package/dist/renderer/textures/registerTexture.js +14 -0
- package/dist/renderer/textures/registerTexture.js.map +1 -0
- package/dist/renderer.d.ts +11 -21
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -0
- package/dist/style.css +2 -0
- package/dist/test-hook/createTestHook.js +39 -0
- package/dist/test-hook/createTestHook.js.map +1 -0
- package/dist/test-hook/install.js +12 -0
- package/dist/test-hook/install.js.map +1 -0
- package/dist/test-seams-fYf6m5pu.d.ts +356 -0
- package/dist/test-seams.d.ts +6 -0
- package/dist/test-seams.js +3 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
- package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
- package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
- package/dist/tools/builtin/hand/useHandTool.js +31 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
- package/dist/tools/builtin/image/useImageTool.js +41 -0
- package/dist/tools/builtin/image/useImageTool.js.map +1 -0
- package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
- package/dist/tools/builtin/line/useLineTool.js +33 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -0
- package/dist/tools/builtin/pen/usePenTool.js +414 -0
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
- package/dist/tools/builtin/pickTopMostHit.js +45 -0
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
- package/dist/tools/builtin/rect/useRectTool.js +32 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +109 -0
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
- package/dist/tools/builtin/select/useSelectTool.js +162 -0
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
- package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
- package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +263 -0
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
- package/dist/tools/builtin/star/useStarTool.js +82 -0
- package/dist/tools/builtin/star/useStarTool.js.map +1 -0
- package/dist/tools/builtin/text/useTextTool.js +177 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -0
- package/dist/tools/overlayBinding.js +8 -0
- package/dist/tools/overlayBinding.js.map +1 -0
- package/dist/tools/prefs.js +47 -0
- package/dist/tools/prefs.js.map +1 -0
- package/dist/tools/useKeybindings.js +66 -0
- package/dist/tools/useKeybindings.js.map +1 -0
- package/dist/{types-D-9QWBy5.d.ts → types-A37hYkeR.d.ts} +185 -15
- package/dist/{types-qYpyTAiZ.d.ts → types-B_9g6hMM.d.ts} +32 -6
- package/dist/util/color.js +26 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/constrainTo45.js +17 -0
- package/dist/util/constrainTo45.js.map +1 -0
- package/dist/util/paint.js +72 -0
- package/dist/util/paint.js.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -19
- package/dist/chunk-3TY6FHAF.js +0 -170
- package/dist/chunk-3TY6FHAF.js.map +0 -1
- package/dist/chunk-DGWNNKGD.js +0 -248
- package/dist/chunk-DGWNNKGD.js.map +0 -1
- package/dist/chunk-G4ZGQMY7.js +0 -33372
- package/dist/chunk-G4ZGQMY7.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-LU4IJ52W.js +0 -111
- package/dist/chunk-LU4IJ52W.js.map +0 -1
- package/dist/chunk-M24CLARN.js +0 -28
- package/dist/chunk-M24CLARN.js.map +0 -1
- package/dist/chunk-NE27EOLP.js +0 -146
- package/dist/chunk-NE27EOLP.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-UPZY4ART.js +0 -29
- package/dist/chunk-UPZY4ART.js.map +0 -1
- package/dist/chunk-WPNA6L5O.js +0 -250
- package/dist/chunk-WPNA6L5O.js.map +0 -1
- package/dist/chunk-XMAWPGTK.js +0 -128
- package/dist/chunk-XMAWPGTK.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-CY5UKlZh.d.ts +0 -98
- package/dist/index.css +0 -62
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -36
- package/dist/insert.js +0 -81
- package/dist/insert.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/move.js.map +0 -1
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -62
- package/dist/renderer.css.map +0 -1
- package/dist/renderer.js.map +0 -1
- package/dist/resize.js.map +0 -1
- package/dist/routing.js.map +0 -1
- package/dist/types-D2tTKEU0.d.ts +0 -18
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { rectToPlane as e, toPlane as t } from "../../core/viewport/parallax.js";
|
|
2
|
+
import { poseDescriptorForNode as n, visualBoundsViaDescriptor as r } from "../../core/geometry/poseDescriptor.js";
|
|
3
|
+
import { AUTO_POSE_DESCRIPTOR as i } from "../../interactions/actions/resize/autoPoseDescriptor.js";
|
|
4
|
+
import { findShapeSilhouette as a } from "../NodeShape.js";
|
|
5
|
+
import { pickWalk as o, scenePickSource as s } from "../pickWalk.js";
|
|
6
|
+
import { polygonRegion as c, poseOutline as l, rectRegion as u, regionBoundsOf as d, regionOf as f, regionTakes as p } from "../../core/geometry/regionHit.js";
|
|
7
|
+
import { pathIntersectsRect as m } from "@weasel-js/geom";
|
|
8
|
+
//#region src/canvas/deps/hitTestArea.ts
|
|
9
|
+
function h(e, t, n) {
|
|
10
|
+
let r = e?.get?.();
|
|
11
|
+
return {
|
|
12
|
+
...n ? { poseComposition: n } : {},
|
|
13
|
+
...t ? { alphaOf: t } : {},
|
|
14
|
+
...e?.layerIsPainted ? { layerIsPainted: (t) => e.layerIsPainted(t) } : {},
|
|
15
|
+
...r ? { camera: r } : {}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function g(e, t, n, r = i, a = {}) {
|
|
19
|
+
return v(e, u(t), "intersect", n, r, a);
|
|
20
|
+
}
|
|
21
|
+
function _(e, t, n, r, a = i, o = {}) {
|
|
22
|
+
let s = c(t);
|
|
23
|
+
return s ? v(e, s, n, r, a, o) : [];
|
|
24
|
+
}
|
|
25
|
+
function v(e, t, i, c, u, f) {
|
|
26
|
+
let h = (e) => ({
|
|
27
|
+
includeContainers: f.includeContainers === !0,
|
|
28
|
+
clipAdmits: (t, i, a) => {
|
|
29
|
+
let o = n(u, i);
|
|
30
|
+
return m(t, r(a, o)) && m(t, e.bounds);
|
|
31
|
+
},
|
|
32
|
+
hits: (t, r) => {
|
|
33
|
+
let o = n(u, t), s = d(t, r, o);
|
|
34
|
+
return p(e, i, r, s, () => a(t, r) ?? l(r, s));
|
|
35
|
+
},
|
|
36
|
+
inPlane: (t) => h(y(e, t))
|
|
37
|
+
});
|
|
38
|
+
return o(s(e, c), h(t));
|
|
39
|
+
}
|
|
40
|
+
function y(n, r) {
|
|
41
|
+
let i = [];
|
|
42
|
+
for (let e of n.verts) {
|
|
43
|
+
let n = t(r, e);
|
|
44
|
+
i.push(n.x, n.y);
|
|
45
|
+
}
|
|
46
|
+
return f(i, e(r, n.bounds), n.isRect);
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { g as hitTestArea, _ as hitTestLassoPolygon, h as regionPickOptions };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=hitTestArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitTestArea.js","names":["regionPickOptions","camera","view","poseComposition","alphaOf","layer","hitTestArea","AUTO_POSE_DESCRIPTOR","walkArea","scene","rectRegion","bounds","opts","descriptor","query","hitTestLassoPolygon","region","polygonRegion","polygon","mode","regionQuery","g","poseDescriptorForNode","node","pathIntersectsRect","clip","visualBoundsViaDescriptor","pose","r","b","regionBoundsOf","regionTakes","findShapeSilhouette","poseOutline","regionInPlane","m","pickWalk","scenePickSource","coords","v","p","toPlane","regionOf","rectToPlane"],"sources":["../../../src/canvas/deps/hitTestArea.ts"],"sourcesContent":["/**\n * Shared, silhouette-aware area hit-test used by both `areaSelect` (marquee)\n * and `lassoSelect` dep sources, and by `sceneToAdapter`.\n *\n * The per-node decision is `regionTakes` (`core/geometry/regionHit`), which\n * `arrayAdapter` shares. This module supplies the scene walk — layers, clips,\n * pose composition, containers — and the node's drawn outline: the painter's\n * world-frame silhouette (`findShapeSilhouette`), which is what reaches the\n * kit's own inserted shapes, whose geometry sits on `node.data` behind a bare\n * `{x,y,w,h}` pose. With no painter the outline is the pose rect, rotated if\n * the pose is.\n */\nimport type { Scene, NodeId } from 'core/scene/types';\nimport { pathIntersectsRect } from '@weasel-js/geom';\nimport type { LassoHitMode } from 'core/adapters/types';\nimport {\n poseDescriptorForNode,\n visualBoundsViaDescriptor,\n type PoseDescriptor,\n} from 'interactions/actions/resize/geometry';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\nimport {\n pickWalk,\n scenePickSource,\n type PickQuery,\n type ScenePickSourceOptions,\n} from 'canvas/pickWalk';\nimport { rectToPlane, toPlane, type PlaneMap } from 'core/viewport/parallax';\n\nexport { hiddenLayerIds } from 'canvas/pickWalk';\nimport type { HitTestView } from 'interactions/actions/depSchema';\nimport type { PoseComposition } from 'features/groups/composePose';\nimport { findShapeSilhouette } from 'canvas/NodeShape';\nimport {\n polygonRegion,\n poseOutline,\n rectRegion,\n regionBoundsOf,\n regionOf,\n regionTakes,\n type SelectRegion,\n} from 'core/geometry/regionHit';\n\nexport interface AABBBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** What a region query takes back beyond leaves. */\nexport interface RegionQueryOptions {\n /** Default `false`: a region that takes a container and its children\n * selects the same ink twice. A bare-adapter consumer, which has nothing\n * to fold children back into their container, asks for them. */\n includeContainers?: boolean;\n}\n\n\n/** The pick options a region dep hands the shared walk: the asking view's\n * layer gate and camera, the surface's alpha, and the scene's pose\n * composition. */\nexport function regionPickOptions(\n view: HitTestView | undefined,\n alphaOf: ((id: string) => number) | undefined,\n poseComposition: PoseComposition<unknown> | undefined,\n): ScenePickSourceOptions<unknown> {\n const camera = view?.get?.();\n return {\n ...(poseComposition ? { poseComposition } : {}),\n ...(alphaOf ? { alphaOf } : {}),\n ...(view?.layerIsPainted ? { layerIsPainted: (layer: string) => view.layerIsPainted!(layer) } : {}),\n ...(camera ? { camera } : {}),\n };\n}\n\n/** Marquee entry point: every node the rect `bounds` meets. */\nexport function hitTestArea(\n scene: Scene<unknown, string, unknown>,\n bounds: AABBBounds,\n opts?: ScenePickSourceOptions<unknown>,\n descriptor: PoseDescriptor<unknown> = AUTO_POSE_DESCRIPTOR,\n query: RegionQueryOptions = {},\n): NodeId[] {\n return walkArea(scene, rectRegion(bounds), 'intersect', opts, descriptor, query);\n}\n\n/**\n * Every node an arbitrary closed area polygon meets. `area` is interleaved\n * `[x0,y0,x1,y1,…]`; `areaBounds` is its AABB, derived when omitted.\n */\nexport function hitTestAreaPolygon(\n scene: Scene<unknown, string, unknown>,\n area: ArrayLike<number>,\n areaBounds?: AABBBounds,\n /** True when `area` IS its own bounding rect, so `areaBounds` containment\n * implies containment in the area proper. Never pass this for a lasso\n * polygon — a node inside the hull's box can miss the hull. */\n areaIsRect = false,\n /** The asking view's alpha and layer accessors. A bare scene answers for\n * itself; a view that dims or reorders layers has to supply its own. */\n opts?: ScenePickSourceOptions<unknown>,\n /** How to read this scene's poses. Default `AUTO_POSE_DESCRIPTOR`. */\n descriptor: PoseDescriptor<unknown> = AUTO_POSE_DESCRIPTOR,\n query: RegionQueryOptions = {},\n): NodeId[] {\n const region = regionOf(area, areaBounds, areaIsRect);\n return region ? walkArea(scene, region, 'intersect', opts, descriptor, query) : [];\n}\n\n/**\n * Lasso entry point: which nodes a closed lasso polygon picks under `mode`\n * (see `regionTakes`).\n */\nexport function hitTestLassoPolygon(\n scene: Scene<unknown, string, unknown>,\n polygon: ReadonlyArray<{ x: number; y: number }>,\n mode: LassoHitMode,\n opts?: ScenePickSourceOptions<unknown>,\n descriptor: PoseDescriptor<unknown> = AUTO_POSE_DESCRIPTOR,\n query: RegionQueryOptions = {},\n): NodeId[] {\n const region = polygonRegion(polygon);\n return region ? walkArea(scene, region, mode, opts, descriptor, query) : [];\n}\n\n/** The walk every region query shares: skip containers unless asked, gate on\n * the clip, and let `regionTakes` decide each node. */\nfunction walkArea(\n scene: Scene<unknown, string, unknown>,\n region: SelectRegion,\n mode: LassoHitMode,\n opts: ScenePickSourceOptions<unknown> | undefined,\n descriptor: PoseDescriptor<unknown>,\n query: RegionQueryOptions,\n): NodeId[] {\n const regionQuery = (r: SelectRegion): PickQuery<unknown> => ({\n includeContainers: query.includeContainers === true,\n clipAdmits: (clip, node, pose) => {\n const g = poseDescriptorForNode(descriptor, node);\n return pathIntersectsRect(clip, visualBoundsViaDescriptor(pose, g))\n && pathIntersectsRect(clip, r.bounds);\n },\n hits: (node, pose) => {\n // The descriptor sees the node here, so a pose shape whose extent\n // depends on `node.data` bounds itself rather than its pose's default.\n const g = poseDescriptorForNode(descriptor, node);\n const b = regionBoundsOf(node as object, pose, g);\n return regionTakes(r, mode, pose, b, () =>\n findShapeSilhouette(node as never, pose) ?? poseOutline(pose, b));\n },\n inPlane: (m) => regionQuery(regionInPlane(r, m)),\n });\n return pickWalk<unknown>(scenePickSource(scene, opts), regionQuery(region)) as NodeId[];\n}\n\n/** `r` carried into a plane's world. The map is axis-aligned, so a rect stays\n * one; a flipped axis reverses the winding, which no region test reads. */\nfunction regionInPlane(r: SelectRegion, m: PlaneMap): SelectRegion {\n const coords: number[] = [];\n for (const v of r.verts) {\n const p = toPlane(m, v);\n coords.push(p.x, p.y);\n }\n return regionOf(coords, rectToPlane(m, r.bounds), r.isRect)!;\n}\n"],"mappings":";;;;;;;;AA8DA,SAAgBA,EACd,GACA,GACA,GACiC;CACjC,IAAMC,IAASC,GAAM,MAAM;CAC3B,OAAO;EACL,GAAIC,IAAkB,EAAE,mBAAgB,IAAI,CAAC;EAC7C,GAAIC,IAAU,EAAE,WAAQ,IAAI,CAAC;EAC7B,GAAIF,GAAM,iBAAiB,EAAE,iBAAiB,MAAkBA,EAAK,eAAgBG,CAAK,EAAE,IAAI,CAAC;EACjG,GAAIJ,IAAS,EAAE,UAAO,IAAI,CAAC;CAC7B;AACF;AAGA,SAAgBK,EACd,GACA,GACA,GACA,IAAsCC,GACtC,IAA4B,CAAC,GACnB;CACV,OAAOC,EAASC,GAAOC,EAAWC,CAAM,GAAG,aAAaC,GAAMC,GAAYC,CAAK;AACjF;AA6BA,SAAgBC,EACd,GACA,GACA,GACA,GACA,IAAsCR,GACtC,IAA4B,CAAC,GACnB;CACV,IAAMS,IAASC,EAAcC,CAAO;CACpC,OAAOF,IAASR,EAASC,GAAOO,GAAQG,GAAMP,GAAMC,GAAYC,CAAK,IAAI,CAAC;AAC5E;AAIA,SAASN,EACP,GACA,GACA,GACA,GACA,GACA,GACU;CACV,IAAMY,KAAe,OAAyC;EAC5D,mBAAmBN,EAAM,sBAAsB;EAC/C,aAAa,GAAM,GAAM,MAAS;GAChC,IAAMO,IAAIC,EAAsBT,GAAYU,CAAI;GAChD,OAAOC,EAAmBC,GAAMC,EAA0BC,GAAMN,CAAC,CAAC,KAC7DG,EAAmBC,GAAMG,EAAE,MAAM;EACxC;EACA,OAAO,GAAM,MAAS;GAGpB,IAAMP,IAAIC,EAAsBT,GAAYU,CAAI,GAC1CM,IAAIC,EAAeP,GAAgBI,GAAMN,CAAC;GAChD,OAAOU,EAAYH,GAAGT,GAAMQ,GAAME,SAChCG,EAAoBT,GAAeI,CAAI,KAAKM,EAAYN,GAAME,CAAC,CAAC;EACpE;EACA,UAAU,MAAMT,EAAYc,EAAcN,GAAGO,CAAC,CAAC;CACjD;CACA,OAAOC,EAAkBC,EAAgB5B,GAAOG,CAAI,GAAGQ,EAAYJ,CAAM,CAAC;AAC5E;AAIA,SAASkB,EAAc,GAAiB,GAA2B;CACjE,IAAMI,IAAmB,CAAC;CAC1B,KAAK,IAAMC,KAAKX,EAAE,OAAO;EACvB,IAAMY,IAAIC,EAAQN,GAAGI,CAAC;EACtB,EAAO,KAAKC,EAAE,GAAGA,EAAE,CAAC;CACtB;CACA,OAAOE,EAASJ,GAAQK,EAAYR,GAAGP,EAAE,MAAM,GAAGA,EAAE,MAAM;AAC5D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { viewportWorldRect as e } from "../../core/viewport/viewportWorldRect.js";
|
|
2
|
+
import { useLatest as t } from "@weasel-js/react";
|
|
3
|
+
import { useDepSource as n } from "@weasel-js/routing/react";
|
|
4
|
+
//#region src/canvas/deps/ingestion.ts
|
|
5
|
+
function r(r, i, a, o, s) {
|
|
6
|
+
let c = t(i), l = t(a), u = t(o), d = t(s);
|
|
7
|
+
n("ingestion", () => ({
|
|
8
|
+
viewportWorldRect() {
|
|
9
|
+
let t = r.current;
|
|
10
|
+
return t ? e(c.current(), t.getBoundingClientRect()) : {
|
|
11
|
+
x: 0,
|
|
12
|
+
y: 0,
|
|
13
|
+
width: 0,
|
|
14
|
+
height: 0
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
get resolveSrc() {
|
|
18
|
+
return l.current;
|
|
19
|
+
},
|
|
20
|
+
get svg() {
|
|
21
|
+
return u.current;
|
|
22
|
+
},
|
|
23
|
+
get clipboard() {
|
|
24
|
+
return d.current;
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { r as useIngestionDepSource };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=ingestion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingestion.js","names":["useIngestionDepSource","getViewRef","useLatest","getView","resolveSrcRef","resolveSrc","svgRef","svg","clipboardRef","clipboard","canvas","canvasRef","viewportWorldRect"],"sources":["../../../src/canvas/deps/ingestion.ts"],"sourcesContent":["/**\n * `useIngestionDepSource` — wires the `ingestion` dep consumed by\n * `ingestAction`, for the canvas's own view. Computes the visible world rect\n * from the canvas's client rect + current view, and forwards the consumer's\n * optional `resolveSrc`. A `<CanvasView>` overlays this dep with its own rect.\n */\nimport type { RefObject } from 'react';\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { ClipboardIngestCtx, IngestionDep, SvgIngestOptions } from 'interactions/actions/depSchema';\nimport { viewportWorldRect } from 'core/viewport/viewportWorldRect';\nimport type { View } from 'core/viewport/view';\n\nexport function useIngestionDepSource(\n canvasRef: RefObject<HTMLElement | null>,\n getView: () => View,\n resolveSrc?: (file: File) => Promise<string>,\n svg?: SvgIngestOptions,\n clipboard?: ClipboardIngestCtx,\n): void {\n const getViewRef = useLatest(getView);\n const resolveSrcRef = useLatest(resolveSrc);\n const svgRef = useLatest(svg);\n const clipboardRef = useLatest(clipboard);\n\n useDepSource('ingestion', (): IngestionDep => ({\n viewportWorldRect() {\n const canvas = canvasRef.current;\n if (!canvas) return { x: 0, y: 0, width: 0, height: 0 };\n return viewportWorldRect(getViewRef.current(), canvas.getBoundingClientRect());\n },\n get resolveSrc() {\n return resolveSrcRef.current;\n },\n get svg() {\n return svgRef.current;\n },\n get clipboard() {\n return clipboardRef.current;\n },\n }));\n}\n"],"mappings":";;;;AAaA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAaC,EAAUC,CAAO,GAC9BC,IAAgBF,EAAUG,CAAU,GACpCC,IAASJ,EAAUK,CAAG,GACtBC,IAAeN,EAAUO,CAAS;CAExC,EAAa,oBAAkC;EAC7C,oBAAoB;GAClB,IAAMC,IAASC,EAAU;GAEzB,OADKD,IACEE,EAAkBX,EAAW,QAAQ,GAAGS,EAAO,sBAAsB,CAAC,IADzD;IAAE,GAAG;IAAG,GAAG;IAAG,OAAO;IAAG,QAAQ;GAAE;EAExD;EACA,IAAI,aAAa;GACf,OAAON,EAAc;EACvB;EACA,IAAI,MAAM;GACR,OAAOE,EAAO;EAChB;EACA,IAAI,YAAY;GACd,OAAOE,EAAa;EACtB;CACF,EAAE;AACJ"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { asNodeId as e } from "../../core/scene/types.js";
|
|
2
|
+
import { createInsertOp as t } from "../../core/ops/create.js";
|
|
3
|
+
import { cycleFill as n, solid as r, strokeOf as i } from "../../util/paint.js";
|
|
4
|
+
import { insertPreviewExtent as a } from "../insertPreviewExtent.js";
|
|
5
|
+
import { ellipsePath as o, linePath as s, polygonFromPoints as c, rectPath as l, regularPolygonPath as u, schneiderFit as d, starPath as f } from "@weasel-js/geom";
|
|
6
|
+
import { useRef as p } from "react";
|
|
7
|
+
import { useLatest as m } from "@weasel-js/react";
|
|
8
|
+
import { useDepSource as h } from "@weasel-js/routing/react";
|
|
9
|
+
//#region src/canvas/deps/insert.ts
|
|
10
|
+
function g(g, _, v) {
|
|
11
|
+
let y = m(g), b = m(_), x = m(v), S = p(0);
|
|
12
|
+
h("insert", () => {
|
|
13
|
+
let p = y.current, m = b.current, h = p.layers[0]?.id ?? "default";
|
|
14
|
+
return {
|
|
15
|
+
layer: () => h,
|
|
16
|
+
commit(g, _) {
|
|
17
|
+
let v = _.kind, y = ++S.current, b = e(`kit-${v}-${y}`);
|
|
18
|
+
for (; p.get(b) !== void 0;) y = ++S.current, b = e(`kit-${v}-${y}`);
|
|
19
|
+
let C = n(y), w = r(C), T = a({
|
|
20
|
+
shape: v,
|
|
21
|
+
bounds: g,
|
|
22
|
+
extras: _
|
|
23
|
+
}), E = T.bounds, D = x.current?.[v];
|
|
24
|
+
if (D) {
|
|
25
|
+
let e = D(g, _);
|
|
26
|
+
return e === null ? null : (m.applyOps([t({
|
|
27
|
+
node: {
|
|
28
|
+
id: b,
|
|
29
|
+
kind: "leaf",
|
|
30
|
+
layer: h,
|
|
31
|
+
pose: e.pose ?? E,
|
|
32
|
+
data: e.data
|
|
33
|
+
},
|
|
34
|
+
label: `Insert ${v}`
|
|
35
|
+
})], `Insert ${v}`), b);
|
|
36
|
+
}
|
|
37
|
+
let O = T.geometry, k;
|
|
38
|
+
switch (O.kind) {
|
|
39
|
+
case "line":
|
|
40
|
+
k = {
|
|
41
|
+
path: s(O.a, O.b),
|
|
42
|
+
fill: w,
|
|
43
|
+
stroke: i(C, 2)
|
|
44
|
+
};
|
|
45
|
+
break;
|
|
46
|
+
case "polygon":
|
|
47
|
+
k = {
|
|
48
|
+
path: u(O.center, O.radius, O.sides, O.rotation),
|
|
49
|
+
fill: w
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
case "star":
|
|
53
|
+
k = {
|
|
54
|
+
path: f(O.center, O.outerRadius, O.points, O.innerRadius, O.rotation),
|
|
55
|
+
fill: w
|
|
56
|
+
};
|
|
57
|
+
break;
|
|
58
|
+
case "pencil": {
|
|
59
|
+
let e = O.samples;
|
|
60
|
+
k = e.length >= 4 ? {
|
|
61
|
+
path: d(e, 2),
|
|
62
|
+
stroke: i(C, 2)
|
|
63
|
+
} : e.length >= 2 ? {
|
|
64
|
+
path: c(e),
|
|
65
|
+
stroke: i(C, 2)
|
|
66
|
+
} : {
|
|
67
|
+
path: l(0, 0, T.bounds.width, T.bounds.height),
|
|
68
|
+
fill: w
|
|
69
|
+
};
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case "box": switch (v) {
|
|
73
|
+
case "rect":
|
|
74
|
+
k = {
|
|
75
|
+
path: l(0, 0, T.bounds.width, T.bounds.height),
|
|
76
|
+
fill: w
|
|
77
|
+
};
|
|
78
|
+
break;
|
|
79
|
+
case "ellipse":
|
|
80
|
+
k = {
|
|
81
|
+
path: o(T.bounds),
|
|
82
|
+
fill: w
|
|
83
|
+
};
|
|
84
|
+
break;
|
|
85
|
+
case "text":
|
|
86
|
+
k = { text: _.text ?? "" };
|
|
87
|
+
break;
|
|
88
|
+
case "image": {
|
|
89
|
+
let e = _;
|
|
90
|
+
k = { image: {
|
|
91
|
+
src: e.src ?? "",
|
|
92
|
+
...e.opacity === void 0 ? {} : { opacity: e.opacity }
|
|
93
|
+
} };
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
default: return console.warn(`weasel insertDep: no factory for kind="${v}". Skipping insert.`), null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return m.applyOps([t({
|
|
100
|
+
node: {
|
|
101
|
+
id: b,
|
|
102
|
+
kind: "leaf",
|
|
103
|
+
layer: h,
|
|
104
|
+
pose: E,
|
|
105
|
+
data: k
|
|
106
|
+
},
|
|
107
|
+
label: `Insert ${v}`
|
|
108
|
+
})], `Insert ${v}`), b;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { g as useInsertDepSource };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=insert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert.js","names":["e","useInsertDepSource","sceneRef","useLatest","scene","adapterRef","adapter","factoriesRef","factories","insertSeqRef","useRef","sc","ad","layer","kind","extras","seq","id","asNodeId","color","cycleFill","fill","solid","extent","insertPreviewExtent","pose","factory","built","bounds","createInsertOp","geom","data","linePath","strokeOf","regularPolygonPath","starPath","samples","schneiderFit","polygonFromPoints","rectPath","ellipsePath"],"sources":["../../../src/canvas/deps/insert.ts"],"sourcesContent":["/**\n * `useInsertDepSource` — wires the `insert` dep consumed by `insertAction`.\n *\n * Provides kit-side kind→data factories for the 6 builtin shape kinds\n * (`rect`, `ellipse`, `line`, `polygon`, `star`, `pencil`). Acceptable because\n * these kinds are kit-shipped tools; a future phase can expose a\n * `nodeFactories` prop for consumer-defined kinds.\n *\n * `line`, `polygon`, `star` and `pencil` receive the drag AABB from the\n * insertAction invoker, but `extras` may carry richer geometry (endpoints,\n * center+radius+rotation, point trail). `insertPreviewExtent` resolves the\n * two into the node's real extent — the same resolution the live preview\n * and the reported gesture bounds use.\n */\nimport { useRef } from 'react';\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { InsertDep, InsertExtras } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { Op } from 'core/ops/types';\nimport { createInsertOp } from 'core/ops/create';\nimport {\n rectPath,\n ellipsePath,\n regularPolygonPath,\n starPath,\n linePath,\n polygonFromPoints,\n schneiderFit,\n} from '@weasel-js/geom';\nimport { insertPreviewExtent } from '../insertPreviewExtent';\nimport { cycleFill, solid, strokeOf } from '../../util/paint';\n\ninterface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * Consumer-supplied node factory for one insert `kind`. Given the drag AABB\n * and the tool's `extras`, returns the node's `data` (in the consumer's own\n * data shape) plus an optional `pose` override — the dep supplies id, layer,\n * and the undoable insert op. Return `null` to reject the insert.\n *\n * A factory registered for a kit kind (`rect`, `line`, …) fully replaces the\n * kit's default `{ path, fill }` factory for that kind; a factory for a novel\n * kind adds support the kit doesn't ship (e.g. `text`). See\n * `SceneCanvas`'s `insertNodeFactories` prop.\n */\nexport type InsertNodeFactory = (\n bounds: { x: number; y: number; width: number; height: number },\n extras: InsertExtras,\n) => { data: unknown; pose?: unknown } | null;\n\nexport function useInsertDepSource(\n scene: Scene<unknown, string, unknown>,\n adapter: OpsApplier,\n factories?: Record<string, InsertNodeFactory>,\n): void {\n const sceneRef = useLatest(scene);\n const adapterRef = useLatest(adapter);\n const factoriesRef = useLatest(factories);\n const insertSeqRef = useRef(0);\n\n useDepSource('insert', (): InsertDep => {\n const sc = sceneRef.current;\n const ad = adapterRef.current;\n\n const layer = (sc.layers[0]?.id ?? 'default') as string;\n return {\n layer: () => layer,\n commit(bounds, extras): NodeId | null {\n const kind = extras.kind;\n // Walk the seq counter forward until we land on an id that doesn't\n // already exist in the scene. Handles two cases:\n // 1. Fresh mount after localStorage rehydration — the scene starts\n // with `kit-${kind}-1` etc. already populated; bare ++seq would\n // collide on the first insert.\n // 2. Hot-reload re-mounts the hook with a reset counter.\n let seq = ++insertSeqRef.current;\n let id = asNodeId(`kit-${kind}-${seq}`);\n while (sc.get(id) !== undefined) {\n seq = ++insertSeqRef.current;\n id = asNodeId(`kit-${kind}-${seq}`);\n }\n const color = cycleFill(seq);\n const fill = solid(color);\n\n // The nascent node's extent — drag AABB reconciled with whatever\n // richer geometry `extras` carries.\n const extent = insertPreviewExtent({ shape: kind, bounds, extras });\n const pose: unknown = extent.bounds;\n\n // Consumer factory wins over the kit default for this kind (and is the\n // only way to insert consumer-defined kinds like `text`). It owns the\n // node's data + optional pose; the dep still supplies id/layer/op.\n const factory = factoriesRef.current?.[kind];\n if (factory) {\n const built = factory(bounds, extras);\n if (built === null) return null;\n ad.applyOps(\n [createInsertOp({ node: { id, kind: 'leaf', layer, pose: built.pose ?? pose, data: built.data } as unknown as { id: string }, label: `Insert ${kind}` })],\n `Insert ${kind}`,\n );\n return id;\n }\n\n const geom = extent.geometry;\n let data: unknown;\n\n switch (geom.kind) {\n case 'line':\n data = { path: linePath(geom.a, geom.b), fill, stroke: strokeOf(color, 2) };\n break;\n case 'polygon':\n data = {\n path: regularPolygonPath(geom.center, geom.radius, geom.sides, geom.rotation),\n fill,\n };\n break;\n case 'star':\n data = {\n path: starPath(geom.center, geom.outerRadius, geom.points, geom.innerRadius, geom.rotation),\n fill,\n };\n break;\n case 'pencil': {\n const samples = geom.samples as { x: number; y: number }[];\n if (samples.length >= 4) {\n data = { path: schneiderFit(samples, 2.0), stroke: strokeOf(color, 2) };\n } else if (samples.length >= 2) {\n data = { path: polygonFromPoints(samples), stroke: strokeOf(color, 2) };\n } else {\n data = { path: rectPath(0, 0, extent.bounds.width, extent.bounds.height), fill };\n }\n break;\n }\n case 'box':\n switch (kind) {\n case 'rect':\n // Geometry-in-local-frame: the rect path lives at the origin and\n // the pose carries position. `pathInPoseFrame` rebases a rect path\n // onto the pose box regardless of the stored coords, so origin vs.\n // duplicated-pose-coords render identically — don't double-count\n // the position. (#13)\n data = { path: rectPath(0, 0, extent.bounds.width, extent.bounds.height), fill };\n break;\n case 'ellipse':\n data = { path: ellipsePath(extent.bounds), fill };\n break;\n case 'text': {\n // The built-in `useTextTool` drags an empty text box you then type\n // into (edit is entered via `enterTextEdit`), so `extras` carries\n // no content and `text` defaults to `''`. The kit:text painter\n // matches on `data.text != null` and applies style defaults at\n // render time, so a bare `{ text }` is a complete, editable node.\n const e = extras as Partial<{ text: string }>;\n data = { text: e.text ?? '' };\n break;\n }\n case 'image': {\n // The bitmap is loaded + cached by `imageCache` keyed on `src`;\n // only the (serializable) `src` lives on the node.\n const e = extras as Partial<{ src: string; opacity: number }>;\n data = {\n image: {\n src: e.src ?? '',\n ...(e.opacity !== undefined ? { opacity: e.opacity } : {}),\n },\n };\n break;\n }\n default:\n console.warn(`weasel insertDep: no factory for kind=\"${kind}\". Skipping insert.`);\n return null;\n }\n break;\n }\n\n ad.applyOps(\n [createInsertOp({ node: { id, kind: 'leaf', layer, pose, data } as unknown as { id: string }, label: `Insert ${kind}` })],\n `Insert ${kind}`,\n );\n return id;\n },\n };\n });\n}\n"],"mappings":";;;;;;;;;AAsDA,SAAgBC,EACd,GACA,GACA,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK,GAC1BC,IAAaF,EAAUG,CAAO,GAC9BC,IAAeJ,EAAUK,CAAS,GAClCC,IAAeC,EAAO,CAAC;CAE7B,EAAa,gBAA2B;EACtC,IAAMC,IAAKT,EAAS,SACdU,IAAKP,EAAW,SAEhBQ,IAASF,EAAG,OAAO,EAAE,EAAE,MAAM;EACnC,OAAO;GACL,aAAaE;GACb,OAAO,GAAQ,GAAuB;IACpC,IAAMC,IAAOC,EAAO,MAOhBC,IAAM,EAAEP,EAAa,SACrBQ,IAAKC,EAAS,OAAOJ,EAAK,GAAGE,GAAK;IACtC,OAAOL,EAAG,IAAIM,CAAE,MAAM,KAAA,IAEpB,AADA,IAAM,EAAER,EAAa,SACrB,IAAKS,EAAS,OAAOJ,EAAK,GAAGE,GAAK;IAEpC,IAAMG,IAAQC,EAAUJ,CAAG,GACrBK,IAAOC,EAAMH,CAAK,GAIlBI,IAASC,EAAoB;KAAE,OAAOV;KAAM;KAAQ;IAAO,CAAC,GAC5DW,IAAgBF,EAAO,QAKvBG,IAAUnB,EAAa,UAAUO;IACvC,IAAIY,GAAS;KACX,IAAMC,IAAQD,EAAQE,GAAQb,CAAM;KAMpC,OALIY,MAAU,OAAa,QAC3Bf,EAAG,SACD,CAACiB,EAAe;MAAE,MAAM;OAAE;OAAI,MAAM;OAAQ;OAAO,MAAMF,EAAM,QAAQF;OAAM,MAAME,EAAM;MAAK;MAAgC,OAAO,UAAUb;KAAO,CAAC,CAAC,GACxJ,UAAUA,GACZ,GACOG;IACT;IAEA,IAAMa,IAAOP,EAAO,UAChBQ;IAEJ,QAAQD,EAAK,MAAb;KACE,KAAK;MACH,IAAO;OAAE,MAAME,EAASF,EAAK,GAAGA,EAAK,CAAC;OAAG;OAAM,QAAQG,EAASd,GAAO,CAAC;MAAE;MAC1E;KACF,KAAK;MACH,IAAO;OACL,MAAMe,EAAmBJ,EAAK,QAAQA,EAAK,QAAQA,EAAK,OAAOA,EAAK,QAAQ;OAC5E;MACF;MACA;KACF,KAAK;MACH,IAAO;OACL,MAAMK,EAASL,EAAK,QAAQA,EAAK,aAAaA,EAAK,QAAQA,EAAK,aAAaA,EAAK,QAAQ;OAC1F;MACF;MACA;KACF,KAAK,UAAU;MACb,IAAMM,IAAUN,EAAK;MACrB,AAKEC,IALEK,EAAQ,UAAU,IACb;OAAE,MAAMC,EAAaD,GAAS,CAAG;OAAG,QAAQH,EAASd,GAAO,CAAC;MAAE,IAC7DiB,EAAQ,UAAU,IACpB;OAAE,MAAME,EAAkBF,CAAO;OAAG,QAAQH,EAASd,GAAO,CAAC;MAAE,IAE/D;OAAE,MAAMoB,EAAS,GAAG,GAAGhB,EAAO,OAAO,OAAOA,EAAO,OAAO,MAAM;OAAG;MAAK;MAEjF;KACF;KACA,KAAK,OACH,QAAQT,GAAR;MACE,KAAK;OAMH,IAAO;QAAE,MAAMyB,EAAS,GAAG,GAAGhB,EAAO,OAAO,OAAOA,EAAO,OAAO,MAAM;QAAG;OAAK;OAC/E;MACF,KAAK;OACH,IAAO;QAAE,MAAMiB,EAAYjB,EAAO,MAAM;QAAG;OAAK;OAChD;MACF,KAAK;OAOH,IAAO,EAAE,MAAMvB,EAAE,QAAQ,GAAG;OAC5B;MAEF,KAAK,SAAS;OAGZ,IAAM,IAAIe;OACV,IAAO,EACL,OAAO;QACL,KAAK,EAAE,OAAO;QACd,GAAI,EAAE,YAAY,KAAA,IAAqC,CAAC,IAA1B,EAAE,SAAS,EAAE,QAAQ;OACrD,EACF;OACA;MACF;MACA,SAEE,OADA,QAAQ,KAAK,0CAA0CD,EAAK,oBAAoB,GACzE;KACX;IAEJ;IAMA,OAJAF,EAAG,SACD,CAACiB,EAAe;KAAE,MAAM;MAAE;MAAI,MAAM;MAAQ;MAAO;MAAM;KAAK;KAAgC,OAAO,UAAUf;IAAO,CAAC,CAAC,GACxH,UAAUA,GACZ,GACOG;GACT;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { hitTestArea as e, hitTestLassoPolygon as t, regionPickOptions as n } from "./hitTestArea.js";
|
|
2
|
+
import { useLatest as r } from "@weasel-js/react";
|
|
3
|
+
import { useDepSource as i } from "@weasel-js/routing/react";
|
|
4
|
+
//#region src/canvas/deps/lassoSelect.ts
|
|
5
|
+
function a(a, o, s, c, l) {
|
|
6
|
+
let u = r(a), d = r(o), f = r(s), p = r(l);
|
|
7
|
+
i("lassoSelect", () => {
|
|
8
|
+
let r = u.current, i = d.current, a = f.current, o = p.current;
|
|
9
|
+
return {
|
|
10
|
+
hitTestLasso: (e, i, s) => t(r, e, i, n(s, o, c), a),
|
|
11
|
+
hitTestArea: (t, i) => e(r, t, n(i, o, c), a),
|
|
12
|
+
getSelection: () => i.current,
|
|
13
|
+
setSelection: (e) => i.set(e)
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as useLassoSelectDepSource };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=lassoSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lassoSelect.js","names":["hitTestAreaShared","useLassoSelectDepSource","sceneRef","useLatest","scene","selectionRef","selection","descriptorRef","descriptor","alphaOfRef","alphaOf","sc","s","d","a","hitTestLassoPolygon","polygon","mode","regionPickOptions","view","poseComposition","hitTestArea","bounds","ids"],"sources":["../../../src/canvas/deps/lassoSelect.ts"],"sourcesContent":["/**\n * `useLassoSelectDepSource` — wires the `lassoSelect` dep consumed by\n * `lassoSelectAction`: `hitTestLasso` tests the lasso polygon itself, and\n * `hitTestArea` is the same silhouette-aware rect test `areaSelect` uses.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { LassoSelectDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { hitTestArea as hitTestAreaShared, hitTestLassoPolygon, regionPickOptions } from './hitTestArea';\nimport type { PoseComposition } from 'features/groups/composePose';\n\nexport function useLassoSelectDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n descriptor?: PoseDescriptor<unknown>,\n poseComposition?: PoseComposition<unknown>,\n /** The painted alpha the surface's layers apply, which every view shares. */\n alphaOf?: (id: string) => number,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const descriptorRef = useLatest(descriptor);\n const alphaOfRef = useLatest(alphaOf);\n\n useDepSource('lassoSelect', (): LassoSelectDep => {\n const sc = sceneRef.current;\n const s = selectionRef.current;\n const d = descriptorRef.current;\n const a = alphaOfRef.current;\n return {\n hitTestLasso: (polygon, mode, view) =>\n hitTestLassoPolygon(sc, polygon, mode, regionPickOptions(view, a, poseComposition), d),\n hitTestArea: (bounds, view) =>\n hitTestAreaShared(sc, bounds, regionPickOptions(view, a, poseComposition), d),\n getSelection: () => s.current as NodeId[],\n setSelection: (ids) => s.set(ids as NodeId[]),\n };\n });\n}\n"],"mappings":";;;;AAcA,SAAgBC,EACd,GACA,GACA,GACA,GAEA,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK,GAC1BC,IAAeF,EAAUG,CAAS,GAClCC,IAAgBJ,EAAUK,CAAU,GACpCC,IAAaN,EAAUO,CAAO;CAEpC,EAAa,qBAAqC;EAChD,IAAMC,IAAKT,EAAS,SACdU,IAAIP,EAAa,SACjBQ,IAAIN,EAAc,SAClBO,IAAIL,EAAW;EACrB,OAAO;GACL,eAAe,GAAS,GAAM,MAC5BM,EAAoBJ,GAAIK,GAASC,GAAMC,EAAkBC,GAAML,GAAGM,CAAe,GAAGP,CAAC;GACvF,cAAc,GAAQ,MACpBb,EAAkBW,GAAIW,GAAQJ,EAAkBC,GAAML,GAAGM,CAAe,GAAGP,CAAC;GAC9E,oBAAoBD,EAAE;GACtB,eAAe,MAAQA,EAAE,IAAIW,CAAe;EAC9C;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { asNodeId as e } from "../../core/scene/types.js";
|
|
2
|
+
import { useEffect as t } from "react";
|
|
3
|
+
import { useLatest as n } from "@weasel-js/react";
|
|
4
|
+
import { useDepSource as r } from "@weasel-js/routing/react";
|
|
5
|
+
//#region src/canvas/deps/layout.ts
|
|
6
|
+
function i(i, a, o, s) {
|
|
7
|
+
let c = n({
|
|
8
|
+
layouts: a,
|
|
9
|
+
dropTarget: o,
|
|
10
|
+
reflow: s
|
|
11
|
+
});
|
|
12
|
+
r("layout", () => ({
|
|
13
|
+
getLayout: (t) => {
|
|
14
|
+
let n = i.layoutOf(e(t));
|
|
15
|
+
if (n !== null) return n;
|
|
16
|
+
let r = c.current.layouts;
|
|
17
|
+
return r ? typeof r == "function" ? r(t) : r[t] ?? null : null;
|
|
18
|
+
},
|
|
19
|
+
dropTarget: c.current.dropTarget,
|
|
20
|
+
get reflow() {
|
|
21
|
+
return c.current.reflow ?? null;
|
|
22
|
+
}
|
|
23
|
+
})), t(() => i.onReflow((e) => {
|
|
24
|
+
let t = c.current.reflow;
|
|
25
|
+
if (t) for (let n of e) {
|
|
26
|
+
let e = n.id;
|
|
27
|
+
t.settle(e, t.poseOf(e) === void 0 ? { from: n.from } : void 0);
|
|
28
|
+
}
|
|
29
|
+
}), [i, c]);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { i as useLayoutDepSource };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","names":["useLayoutDepSource","ref","useLatest","useDepSource","declared","scene","asNodeId","containerId","l","useEffect","glide","m","moves","id"],"sources":["../../../src/canvas/deps/layout.ts"],"sourcesContent":["/**\n * `useLayoutDepSource` — wires the `layout` dep consumed by `moveAction`'s\n * drag-time reflow pass. A container's layout is the one its scene node\n * declares (`scene.layoutOf`); `<SceneCanvas>`'s `layouts` prop (a static map\n * or a resolver fn) fills in for containers that declare none. Carries the\n * `layoutDropTarget` mode, and hands every reflow the scene records to the\n * reflow transition so it glides as a drag's does. Always registers; returns\n * null per-container when no layout is configured, so the reflow pass is a\n * no-op without churning dep registration on prop changes.\n */\nimport { useEffect } from 'react';\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { LayoutDep } from 'interactions/actions/depSchema';\nimport type { Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { LayoutDropTargetMode, ReflowTransition } from '../../layout/types';\nimport type { SceneToAdapterOptions } from '../sceneAdapter';\n\n// Reuse the canonical `layouts` option type from the scene adapter under the\n// dep's erased generics (`unknown`/`string`/`unknown`) so the public surface\n// stays a single source of truth.\ntype LayoutsProp = NonNullable<SceneToAdapterOptions<unknown, string, unknown>['layouts']>;\n\nexport function useLayoutDepSource(\n scene: Scene<unknown, string, unknown>,\n layouts: LayoutsProp | undefined,\n dropTarget?: LayoutDropTargetMode,\n reflow?: ReflowTransition<unknown> | null,\n): void {\n const ref = useLatest({ layouts, dropTarget, reflow });\n\n useDepSource('layout', (): LayoutDep => ({\n getLayout: (containerId) => {\n const declared = scene.layoutOf(asNodeId(containerId));\n if (declared !== null) return declared;\n const l = ref.current.layouts;\n if (!l) return null;\n return typeof l === 'function' ? l(containerId) : (l[containerId] ?? null);\n },\n dropTarget: ref.current.dropTarget,\n get reflow() { return ref.current.reflow ?? null; },\n }));\n\n useEffect(() => scene.onReflow((moves) => {\n const glide = ref.current.reflow;\n if (!glide) return;\n for (const m of moves) {\n // One already gliding carries on from where it is shown.\n const id = m.id as string;\n glide.settle(id, glide.poseOf(id) === undefined ? { from: m.from } : undefined);\n }\n }), [scene, ref]);\n}\n"],"mappings":";;;;;AAwBA,SAAgBA,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAMC,EAAU;EAAE;EAAS;EAAY;CAAO,CAAC;CAcrD,AAZAC,EAAa,iBAA4B;EACvC,YAAY,MAAgB;GAC1B,IAAMC,IAAWC,EAAM,SAASC,EAASC,CAAW,CAAC;GACrD,IAAIH,MAAa,MAAM,OAAOA;GAC9B,IAAMI,IAAIP,EAAI,QAAQ;GAEtB,OADKO,IACE,OAAOA,KAAM,aAAaA,EAAED,CAAW,IAAKC,EAAED,MAAgB,OADtD;EAEjB;EACA,YAAYN,EAAI,QAAQ;EACxB,IAAI,SAAS;GAAE,OAAOA,EAAI,QAAQ,UAAU;EAAM;CACpD,EAAE,GAEFQ,QAAgBJ,EAAM,UAAU,MAAU;EACxC,IAAMK,IAAQT,EAAI,QAAQ;EAC1B,IAAKS,GACL,KAAK,IAAMC,KAAKC,GAAO;GAErB,IAAMC,IAAKF,EAAE;GACb,EAAM,OAAOE,GAAIH,EAAM,OAAOG,CAAE,MAAM,KAAA,IAAY,EAAE,MAAMF,EAAE,KAAK,IAAI,KAAA,CAAS;EAChF;CACF,CAAC,GAAG,CAACN,GAAOJ,CAAG,CAAC;AAClB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { asNodeId as e } from "../../core/scene/types.js";
|
|
2
|
+
import { useLatest as t } from "@weasel-js/react";
|
|
3
|
+
import { useDepSource as n } from "@weasel-js/routing/react";
|
|
4
|
+
//#region src/canvas/deps/nodeAtPoint.ts
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = t(r);
|
|
7
|
+
n("nodeAtPoint", () => (t, n) => {
|
|
8
|
+
let r = i.current(t.x, t.y);
|
|
9
|
+
if (r.length === 0) return null;
|
|
10
|
+
if (!n) return e(r[r.length - 1]);
|
|
11
|
+
let a = n instanceof Set ? n : new Set(n);
|
|
12
|
+
for (let t = r.length - 1; t >= 0; t--) if (!a.has(e(r[t]))) return e(r[t]);
|
|
13
|
+
return null;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as useNodeAtPointDepSource };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=nodeAtPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeAtPoint.js","names":["useNodeAtPointDepSource","pickRef","useLatest","pickEvery","ids","point","exclude","asNodeId","ex","i"],"sources":["../../../src/canvas/deps/nodeAtPoint.ts"],"sourcesContent":["/**\n * `useNodeAtPointDepSource` — wires the `nodeAtPoint` dep consumed by\n * `moveAction` (reparent-on-drop) and any other action needing a\n * single-best pick. Delegates to `<SceneCanvas>`'s `pickEvery` (the\n * back-to-front pose-walking picker) so consumer-supplied geometry\n * overrides are honored automatically.\n *\n * The exclude set is consulted front-to-back: the dep returns the\n * topmost id that isn't in `exclude`, which lets callers ignore the\n * node(s) they're currently manipulating without separate plumbing.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { NodeAtPointDep } from 'interactions/actions/depSchema';\nimport { asNodeId } from 'core/scene/types';\n\nexport function useNodeAtPointDepSource(\n pickEvery: (worldX: number, worldY: number) => string[],\n): void {\n const pickRef = useLatest(pickEvery);\n\n useDepSource('nodeAtPoint', (): NodeAtPointDep => {\n return (point, exclude) => {\n const ids = pickRef.current(point.x, point.y);\n if (ids.length === 0) return null;\n if (!exclude) {\n // `pickEvery` returns back-to-front; topmost is the last entry.\n return asNodeId(ids[ids.length - 1]);\n }\n const ex = exclude instanceof Set ? exclude : new Set(exclude);\n for (let i = ids.length - 1; i >= 0; i--) {\n if (!ex.has(asNodeId(ids[i]))) return asNodeId(ids[i]);\n }\n return null;\n };\n });\n}\n"],"mappings":";;;;AAgBA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAUC,EAAUC,CAAS;CAEnC,EAAa,sBACH,GAAO,MAAY;EACzB,IAAMC,IAAMH,EAAQ,QAAQI,EAAM,GAAGA,EAAM,CAAC;EAC5C,IAAID,EAAI,WAAW,GAAG,OAAO;EAC7B,IAAI,CAACE,GAEH,OAAOC,EAASH,EAAIA,EAAI,SAAS,EAAE;EAErC,IAAMI,IAAKF,aAAmB,MAAMA,IAAU,IAAI,IAAIA,CAAO;EAC7D,KAAK,IAAIG,IAAIL,EAAI,SAAS,GAAGK,KAAK,GAAG,KACnC,IAAI,CAACD,EAAG,IAAID,EAASH,EAAIK,EAAE,CAAC,GAAG,OAAOF,EAASH,EAAIK,EAAE;EAEvD,OAAO;CACT,CACD;AACH"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useLatest as e } from "@weasel-js/react";
|
|
2
|
+
import { useDepSource as t } from "@weasel-js/routing/react";
|
|
3
|
+
//#region src/canvas/deps/poseComposition.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = e(n);
|
|
6
|
+
t("poseComposition", () => r.current);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as usePoseCompositionDepSource };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=poseComposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poseComposition.js","names":["usePoseCompositionDepSource","ref","useLatest","composition"],"sources":["../../../src/canvas/deps/poseComposition.ts"],"sourcesContent":["import { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { PoseComposition } from 'features/groups/composePose';\n\n/** Publish the scene's pose-composition strategy to the built-in actions.\n * Absent is the absolute-pose model: `scenePoseFrame` falls back to identity\n * and every world/local conversion in an action is a no-op. */\nexport function usePoseCompositionDepSource(\n composition: PoseComposition<unknown> | undefined,\n): void {\n const ref = useLatest(composition);\n useDepSource('poseComposition', () => ref.current);\n}\n"],"mappings":";;;AAOA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAMC,EAAUC,CAAW;CACjC,EAAa,yBAAyBF,EAAI,OAAO;AACnD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AUTO_POSE_DESCRIPTOR as e } from "../../interactions/actions/resize/autoPoseDescriptor.js";
|
|
2
|
+
import { useLatest as t } from "@weasel-js/react";
|
|
3
|
+
import { useDepSource as n } from "@weasel-js/routing/react";
|
|
4
|
+
//#region src/canvas/deps/poseDescriptor.ts
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = t(r);
|
|
7
|
+
n("poseDescriptor", () => i.current ?? e);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as usePoseDescriptorDepSource };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=poseDescriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poseDescriptor.js","names":["usePoseDescriptorDepSource","ref","useLatest","descriptor","AUTO_POSE_DESCRIPTOR"],"sources":["../../../src/canvas/deps/poseDescriptor.ts"],"sourcesContent":["import { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\n\n/** Publish the pose descriptor every built-in action reads. */\nexport function usePoseDescriptorDepSource(\n descriptor: PoseDescriptor<unknown> | undefined,\n): void {\n const ref = useLatest(descriptor);\n useDepSource('poseDescriptor', () => ref.current ?? AUTO_POSE_DESCRIPTOR);\n}\n"],"mappings":";;;;AAMA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAMC,EAAUC,CAAU;CAChC,EAAa,wBAAwBF,EAAI,WAAWG,CAAoB;AAC1E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DEFAULT_RESIZE_BEHAVIORS as e } from "../../interactions/actions/resize/behaviors/index.js";
|
|
2
|
+
import { useLatest as t } from "@weasel-js/react";
|
|
3
|
+
import { useDepSource as n } from "@weasel-js/routing/react";
|
|
4
|
+
//#region src/canvas/deps/resizePolicy.ts
|
|
5
|
+
var r = (e) => e, i = Object.freeze([]);
|
|
6
|
+
function a(a) {
|
|
7
|
+
let o = t(a);
|
|
8
|
+
n("resizePolicy", () => {
|
|
9
|
+
let t = o.current;
|
|
10
|
+
return {
|
|
11
|
+
label: t.label,
|
|
12
|
+
transient: t.transient,
|
|
13
|
+
onGestureStart: t.onGestureStart,
|
|
14
|
+
onGestureEnd: t.onGestureEnd,
|
|
15
|
+
constraints: t.constraints ?? e,
|
|
16
|
+
pointSnap: t.pointSnap ?? i,
|
|
17
|
+
expandIds: t.expandIds ?? r
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function o(e) {
|
|
22
|
+
return {
|
|
23
|
+
constraints: e.behaviors,
|
|
24
|
+
pointSnap: e.pointSnapBehaviors,
|
|
25
|
+
expandIds: e.expandIds,
|
|
26
|
+
label: e.resizeLabel,
|
|
27
|
+
transient: e.transient,
|
|
28
|
+
onGestureStart: e.onGestureStart,
|
|
29
|
+
onGestureEnd: e.onGestureEnd
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { o as resizePolicyOptions, a as useResizePolicy };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=resizePolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizePolicy.js","names":["IDENTITY_EXPAND","ids","EMPTY","useResizePolicy","optsRef","useLatest","options","o","DEFAULT_RESIZE_BEHAVIORS","resizePolicyOptions"],"sources":["../../../src/canvas/deps/resizePolicy.ts"],"sourcesContent":["/**\n * `useResizePolicy` — wires the `resizePolicy` dep consumed\n * by `resizeAction`.\n *\n * - `constraints` — bounds-frame constraints (e.g. `lockAspectWithModifier`).\n * - `pointSnap` — world-space anchor-point snap behaviors.\n * - `expandIds` — group-expansion at gesture start.\n * - `label`, `transient`, `onGestureStart`, `onGestureEnd` — the commit's\n * history label and recording, and the gesture's lifecycle callbacks.\n *\n * Every field is optional; omitted fields fall back to kit defaults\n * (`DEFAULT_RESIZE_BEHAVIORS` — shift = aspect lock; pass `[]` to disable —\n * then `[]`, `ids => ids`).\n *\n * Built once per render and stabilised by `useDepSource` (which reads via a\n * ref internally), so callers can pass fresh closures without triggering\n * re-registration.\n *\n * @see ResizePolicy — the dep schema entry.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { ResizePolicy } from 'interactions/actions/depSchema';\nimport type {\n PointSnapBehavior,\n BoundsConstraint,\n} from 'interactions/gestures/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { DEFAULT_RESIZE_BEHAVIORS } from 'interactions/actions/resize/behaviors';\nimport type { GestureLifecycleOptions } from 'interactions/actions/gestureLifecycle';\nimport type { UseResizeOptions } from 'interactions/actions/resize/options';\n\n/** Options for `useResizePolicy`. Each omitted field falls back to the kit\n * default. */\nexport interface UseResizePolicyOptions<TPose> extends GestureLifecycleOptions {\n constraints?: TPose extends Bounds ? BoundsConstraint<TPose>[] : never[];\n pointSnap?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never[];\n expandIds?: (ids: string[]) => string[];\n}\n\nconst IDENTITY_EXPAND = (ids: string[]) => ids;\nconst EMPTY: readonly unknown[] = Object.freeze([]);\n\n/** Publish how resizing should behave — constraints, point snapping, group\n * expansion — for the resize action to consult. */\nexport function useResizePolicy<TPose>(\n options: UseResizePolicyOptions<TPose>,\n): void {\n const optsRef = useLatest(options);\n\n useDepSource('resizePolicy', (): ResizePolicy<unknown> => {\n const o = optsRef.current;\n return {\n label: o.label,\n transient: o.transient,\n onGestureStart: o.onGestureStart,\n onGestureEnd: o.onGestureEnd,\n constraints: (o.constraints ?? DEFAULT_RESIZE_BEHAVIORS) as ResizePolicy<unknown>['constraints'],\n pointSnap: (o.pointSnap ?? (EMPTY as unknown[])) as ResizePolicy<unknown>['pointSnap'],\n expandIds: o.expandIds ?? IDENTITY_EXPAND,\n };\n });\n}\n\n/** `<SceneCanvas selectTool.resize>` as {@link useResizePolicy} options.\n * `resizable` is read by `<SceneCanvas>` itself. */\nexport function resizePolicyOptions<TPose>(o: UseResizeOptions<TPose>): UseResizePolicyOptions<TPose> {\n return {\n constraints: o.behaviors as UseResizePolicyOptions<TPose>['constraints'],\n pointSnap: o.pointSnapBehaviors as UseResizePolicyOptions<TPose>['pointSnap'],\n expandIds: o.expandIds,\n label: o.resizeLabel,\n transient: o.transient,\n onGestureStart: o.onGestureStart,\n onGestureEnd: o.onGestureEnd,\n };\n}\n"],"mappings":";;;;AAwCA,IAAMA,KAAmB,MAAkBC,GACrCC,IAA4B,OAAO,OAAO,CAAC,CAAC;AAIlD,SAAgBC,EACd,GACM;CACN,IAAMC,IAAUC,EAAUC,CAAO;CAEjC,EAAa,sBAA6C;EACxD,IAAMC,IAAIH,EAAQ;EAClB,OAAO;GACL,OAAOG,EAAE;GACT,WAAWA,EAAE;GACb,gBAAgBA,EAAE;GAClB,cAAcA,EAAE;GAChB,aAAcA,EAAE,eAAeC;GAC/B,WAAYD,EAAE,aAAcL;GAC5B,WAAWK,EAAE,aAAaP;EAC5B;CACF,CAAC;AACH;AAIA,SAAgBS,EAA2B,GAA2D;CACpG,OAAO;EACL,aAAaF,EAAE;EACf,WAAWA,EAAE;EACb,WAAWA,EAAE;EACb,OAAOA,EAAE;EACT,WAAWA,EAAE;EACb,gBAAgBA,EAAE;EAClB,cAAcA,EAAE;CAClB;AACF"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { poseDescriptorForNode as e } from "../../core/geometry/poseDescriptor.js";
|
|
2
|
+
import { AUTO_POSE_DESCRIPTOR as t } from "../../interactions/actions/resize/autoPoseDescriptor.js";
|
|
3
|
+
import { scenePoseFrame as n } from "../../interactions/actions/poseFrame.js";
|
|
4
|
+
import { freshNodeId as r } from "../../interactions/actions/defaults/freshNodeId.js";
|
|
5
|
+
import { pathInWorld as i, worldEditToStorage as a } from "../../features/paths/pathInWorld.js";
|
|
6
|
+
import { computeSliceOps as o } from "../../interactions/actions/defaults/sliceOps.js";
|
|
7
|
+
import { useLatest as s } from "@weasel-js/react";
|
|
8
|
+
import { useDepSource as c } from "@weasel-js/routing/react";
|
|
9
|
+
//#region src/canvas/deps/slice.ts
|
|
10
|
+
function l(e) {
|
|
11
|
+
let t = s(e);
|
|
12
|
+
c("slice", () => t.current);
|
|
13
|
+
}
|
|
14
|
+
function u(a, l, u, h, g) {
|
|
15
|
+
let _ = s(a), v = s(l), y = s(u), b = s(h), x = s(g);
|
|
16
|
+
c("slice", () => ({ commit(a) {
|
|
17
|
+
let s = _.current, c = n(s, b.current), l = x.current ?? t, u = [], h = /* @__PURE__ */ new Map();
|
|
18
|
+
for (let t of s.renderOrderNodes()) {
|
|
19
|
+
let n = p(s, t);
|
|
20
|
+
if (!n) continue;
|
|
21
|
+
let r = d(e(l, t), c.world(t.id));
|
|
22
|
+
r && (h.set(t.id, r), u.push({
|
|
23
|
+
node: t,
|
|
24
|
+
index: m(s, t),
|
|
25
|
+
worldPath: i(n, r.box)
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
let g = v.current, { ops: S, nextSelection: C } = o({
|
|
29
|
+
leaves: u,
|
|
30
|
+
cut: a,
|
|
31
|
+
nextId: r,
|
|
32
|
+
selection: g.get(),
|
|
33
|
+
placePiece: (e, t) => {
|
|
34
|
+
let n = f(h.get(e.node.id), t);
|
|
35
|
+
return {
|
|
36
|
+
pose: c.local(e.node.id, n.pose),
|
|
37
|
+
path: n.path
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
S.length !== 0 && (y.current.applyOps(S, "Slice"), C && g.set(C));
|
|
42
|
+
} }));
|
|
43
|
+
}
|
|
44
|
+
function d(e, t) {
|
|
45
|
+
let n = e.getBounds(t);
|
|
46
|
+
if (!n || ![
|
|
47
|
+
n.x,
|
|
48
|
+
n.y,
|
|
49
|
+
n.width,
|
|
50
|
+
n.height
|
|
51
|
+
].every(Number.isFinite)) return null;
|
|
52
|
+
let r = e.getRotation?.(t) ?? 0;
|
|
53
|
+
return {
|
|
54
|
+
world: t,
|
|
55
|
+
g: e,
|
|
56
|
+
box: {
|
|
57
|
+
x: n.x,
|
|
58
|
+
y: n.y,
|
|
59
|
+
width: n.width,
|
|
60
|
+
height: n.height,
|
|
61
|
+
rotation: r
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function f({ world: e, g: t, box: n }, r) {
|
|
66
|
+
let i = !!t.withRotation && t.supportsRotation?.(e) !== !1, o = n.rotation ?? 0;
|
|
67
|
+
if (o !== 0 && !i) {
|
|
68
|
+
let i = a({
|
|
69
|
+
...n,
|
|
70
|
+
rotation: 0
|
|
71
|
+
}, r);
|
|
72
|
+
return {
|
|
73
|
+
pose: t.fromBounds(i.pose, e),
|
|
74
|
+
path: i.path
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
let { pose: s, path: c } = a(n, r), l = {
|
|
78
|
+
x: s.x,
|
|
79
|
+
y: s.y,
|
|
80
|
+
width: s.width,
|
|
81
|
+
height: s.height
|
|
82
|
+
}, u = t.remapBounds(e, t.getBounds(e), l);
|
|
83
|
+
return {
|
|
84
|
+
pose: o === 0 ? u : t.withRotation(u, o),
|
|
85
|
+
path: c
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function p(e, t) {
|
|
89
|
+
if (t.kind !== "leaf" || t.derivePath || t.derivePose || e.isLocked(t.id)) return null;
|
|
90
|
+
let n = t.data?.path;
|
|
91
|
+
return n && (n.kind === "rect" || n.kind === "polygon") ? n : null;
|
|
92
|
+
}
|
|
93
|
+
function m(e, t) {
|
|
94
|
+
return (t.parent == null ? e.roots : e.childrenOf(t.parent)).indexOf(t.id);
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { l as useSliceDep, u as useSliceDepSource };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=slice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice.js","names":["useSliceDep","depRef","useLatest","dep","useSliceDepSource","sceneRef","scene","selectionRef","selection","adapterRef","adapter","compositionRef","poseComposition","descriptorRef","poseDescriptor","sc","frame","scenePoseFrame","descriptor","AUTO_POSE_DESCRIPTOR","leaves","drawnAt","node","path","sliceablePath","drawn","drawnPose","poseDescriptorForNode","siblingIndex","pathInWorld","sel","computeSliceOps","freshNodeId","stored","storePiece","leaf","piece","ops","nextSelection","b","g","world","rotation","keepsRotation","box","baked","worldEditToStorage","dst","pose"],"sources":["../../../src/canvas/deps/slice.ts"],"sourcesContent":["/**\n * The `slice` dep `sliceAction` and `useSliceTool` commit their cuts through.\n *\n * `<SceneCanvas>` publishes `useSliceDepSource` over its own scene. A consumer\n * replaces it with `useSliceDep` (or `useDepSource('slice', …)`) from under\n * the canvas; the newest registration wins, and a canvas child registers\n * after the canvas's own.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { SliceDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId, Node } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { Op } from 'core/ops/types';\nimport type { Path } from '@weasel-js/geom';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { pathInWorld, worldEditToStorage, type PathInWorldPose } from 'features/paths/pathInWorld';\nimport { scenePoseFrame } from 'interactions/actions/poseFrame';\nimport { freshNodeId } from 'interactions/actions/defaults/freshNodeId';\nimport { computeSliceOps, type SliceLeaf } from 'interactions/actions/defaults/sliceOps';\nimport type { PoseComposition } from 'features/groups/composePose';\n\n/** Publish how a slice (knife cut) is performed, so the `slice` action can\n * run against the consumer's geometry. */\nexport function useSliceDep(dep: SliceDep): void {\n const depRef = useLatest(dep);\n\n useDepSource('slice', (): SliceDep => depRef.current);\n}\n\ninterface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * The kit `slice` dep: cut every leaf the cut crosses and swap it for its\n * pieces in one undoable batch.\n *\n * A leaf is cut when its `data.path` is a `Path` and `poseDescriptor` can read\n * its world pose as a box and a rotation; a leaf on a locked layer, or one\n * whose geometry derives from other nodes, is passed over. Each path is drawn\n * into world space the way the renderer draws it, so a child is cut where it\n * appears, and each piece is mapped back into the source's frame: it keeps the\n * source's rotation in its pose when the descriptor can write one\n * (`withRotation`), and has the rotation baked into its path otherwise. The\n * piece's pose is then stored in its parent's frame through `poseComposition`.\n * The pieces of a selected leaf take its place in the selection.\n */\nexport function useSliceDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n adapter: OpsApplier,\n poseComposition?: PoseComposition<unknown>,\n poseDescriptor?: PoseDescriptor<unknown>,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const adapterRef = useLatest(adapter);\n const compositionRef = useLatest(poseComposition);\n const descriptorRef = useLatest(poseDescriptor);\n\n useDepSource('slice', (): SliceDep => ({\n commit(cut) {\n const sc = sceneRef.current;\n const frame = scenePoseFrame(sc, compositionRef.current);\n const descriptor = descriptorRef.current ?? AUTO_POSE_DESCRIPTOR;\n const leaves: SliceLeaf<Node<unknown, string, unknown>>[] = [];\n const drawnAt = new Map<string, DrawnPose>();\n for (const node of sc.renderOrderNodes()) {\n const path = sliceablePath(sc, node);\n if (!path) continue;\n const drawn = drawnPose(poseDescriptorForNode(descriptor, node), frame.world(node.id));\n if (!drawn) continue;\n drawnAt.set(node.id, drawn);\n leaves.push({ node, index: siblingIndex(sc, node), worldPath: pathInWorld(path, drawn.box) });\n }\n\n const sel = selectionRef.current;\n const { ops, nextSelection } = computeSliceOps({\n leaves,\n cut,\n nextId: freshNodeId,\n selection: sel.get(),\n placePiece: (leaf, piece) => {\n const stored = storePiece(drawnAt.get(leaf.node.id)!, piece);\n return { pose: frame.local(leaf.node.id, stored.pose), path: stored.path };\n },\n });\n if (ops.length === 0) return;\n adapterRef.current.applyOps(ops, 'Slice');\n if (nextSelection) sel.set(nextSelection as NodeId[]);\n },\n }));\n}\n\n/** A leaf's world pose, and the box and rotation its path is drawn through. */\ninterface DrawnPose {\n world: unknown;\n g: PoseDescriptor<unknown>;\n box: PathInWorldPose;\n}\n\nfunction drawnPose(g: PoseDescriptor<unknown>, world: unknown): DrawnPose | null {\n const b = g.getBounds(world);\n if (!b || ![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null;\n const rotation = g.getRotation?.(world) ?? 0;\n return { world, g, box: { x: b.x, y: b.y, width: b.width, height: b.height, rotation } };\n}\n\n/** A world-space piece as a world pose of the source's kind plus the path it draws. */\nfunction storePiece({ world, g, box }: DrawnPose, piece: Path): { pose: unknown; path: Path } {\n const keepsRotation = !!g.withRotation && g.supportsRotation?.(world) !== false;\n const rotation = box.rotation ?? 0;\n if (rotation !== 0 && !keepsRotation) {\n const baked = worldEditToStorage({ ...box, rotation: 0 }, piece);\n return { pose: g.fromBounds(baked.pose, world), path: baked.path };\n }\n const { pose: b, path } = worldEditToStorage(box, piece);\n const dst = { x: b.x, y: b.y, width: b.width, height: b.height };\n const pose = g.remapBounds(world, g.getBounds(world), dst);\n return { pose: rotation !== 0 ? g.withRotation!(pose, rotation) : pose, path };\n}\n\nfunction sliceablePath(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): Path | null {\n if (node.kind !== 'leaf' || node.derivePath || node.derivePose) return null;\n if (scene.isLocked(node.id)) return null;\n const path = (node.data as { path?: unknown } | null)?.path as Path | undefined;\n return path && (path.kind === 'rect' || path.kind === 'polygon') ? path : null;\n}\n\nfunction siblingIndex(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): number {\n const siblings = node.parent == null ? scene.roots : scene.childrenOf(node.parent);\n return siblings.indexOf(node.id);\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgBA,EAAY,GAAqB;CAC/C,IAAMC,IAASC,EAAUC,CAAG;CAE5B,EAAa,eAAyBF,EAAO,OAAO;AACtD;AAoBA,SAAgBG,EACd,GACA,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAWH,EAAUI,CAAK,GAC1BC,IAAeL,EAAUM,CAAS,GAClCC,IAAaP,EAAUQ,CAAO,GAC9BC,IAAiBT,EAAUU,CAAe,GAC1CC,IAAgBX,EAAUY,CAAc;CAE9C,EAAa,gBAA0B,EACrC,OAAO,GAAK;EACV,IAAMC,IAAKV,EAAS,SACdW,IAAQC,EAAeF,GAAIJ,EAAe,OAAO,GACjDO,IAAaL,EAAc,WAAWM,GACtCC,IAAsD,CAAC,GACvDC,oBAAU,IAAI,IAAuB;EAC3C,KAAK,IAAMC,KAAQP,EAAG,iBAAiB,GAAG;GACxC,IAAMQ,IAAOC,EAAcT,GAAIO,CAAI;GACnC,IAAI,CAACC,GAAM;GACX,IAAME,IAAQC,EAAUC,EAAsBT,GAAYI,CAAI,GAAGN,EAAM,MAAMM,EAAK,EAAE,CAAC;GACrF,AAAKG,MACLJ,EAAQ,IAAIC,EAAK,IAAIG,CAAK,GAC1BL,EAAO,KAAK;IAAE;IAAM,OAAOQ,EAAab,GAAIO,CAAI;IAAG,WAAWO,EAAYN,GAAME,EAAM,GAAG;GAAE,CAAC;EAC9F;EAEA,IAAMK,IAAMvB,EAAa,SACnB,EAAE,QAAK,qBAAkBwB,EAAgB;GAC7C;GACA;GACA,QAAQC;GACR,WAAWF,EAAI,IAAI;GACnB,aAAa,GAAM,MAAU;IAC3B,IAAMG,IAASC,EAAWb,EAAQ,IAAIc,EAAK,KAAK,EAAE,GAAIC,CAAK;IAC3D,OAAO;KAAE,MAAMpB,EAAM,MAAMmB,EAAK,KAAK,IAAIF,EAAO,IAAI;KAAG,MAAMA,EAAO;IAAK;GAC3E;EACF,CAAC;EACD,AAAII,EAAI,WAAW,MACnB5B,EAAW,QAAQ,SAAS4B,GAAK,OAAO,GACpCC,KAAeR,EAAI,IAAIQ,CAAyB;CACtD,EACF,EAAE;AACJ;AASA,SAASZ,EAAU,GAA4B,GAAkC;CAC/E,IAAMa,IAAIC,EAAE,UAAUC,CAAK;CAC3B,IAAI,CAACF,KAAK,CAAC;EAACA,EAAE;EAAGA,EAAE;EAAGA,EAAE;EAAOA,EAAE;CAAM,CAAC,CAAC,MAAM,OAAO,QAAQ,GAAG,OAAO;CACxE,IAAMG,IAAWF,EAAE,cAAcC,CAAK,KAAK;CAC3C,OAAO;EAAE;EAAO;EAAG,KAAK;GAAE,GAAGF,EAAE;GAAG,GAAGA,EAAE;GAAG,OAAOA,EAAE;GAAO,QAAQA,EAAE;GAAQ;EAAS;CAAE;AACzF;AAGA,SAASL,EAAW,EAAE,UAAO,MAAG,UAAkB,GAA4C;CAC5F,IAAMS,IAAgB,CAAC,CAACH,EAAE,gBAAgBA,EAAE,mBAAmBC,CAAK,MAAM,IACpEC,IAAWE,EAAI,YAAY;CACjC,IAAIF,MAAa,KAAK,CAACC,GAAe;EACpC,IAAME,IAAQC,EAAmB;GAAE,GAAGF;GAAK,UAAU;EAAE,GAAGR,CAAK;EAC/D,OAAO;GAAE,MAAMI,EAAE,WAAWK,EAAM,MAAMJ,CAAK;GAAG,MAAMI,EAAM;EAAK;CACnE;CACA,IAAM,EAAE,MAAMN,GAAG,YAASO,EAAmBF,GAAKR,CAAK,GACjDW,IAAM;EAAE,GAAGR,EAAE;EAAG,GAAGA,EAAE;EAAG,OAAOA,EAAE;EAAO,QAAQA,EAAE;CAAO,GACzDS,IAAOR,EAAE,YAAYC,GAAOD,EAAE,UAAUC,CAAK,GAAGM,CAAG;CACzD,OAAO;EAAE,MAAML,MAAa,IAAsCM,IAAlCR,EAAE,aAAcQ,GAAMN,CAAQ;EAAU;CAAK;AAC/E;AAEA,SAASlB,EAAc,GAAwC,GAAmD;CAEhH,IADIF,EAAK,SAAS,UAAUA,EAAK,cAAcA,EAAK,cAChDhB,EAAM,SAASgB,EAAK,EAAE,GAAG,OAAO;CACpC,IAAMC,IAAQD,EAAK,MAAoC;CACvD,OAAOC,MAASA,EAAK,SAAS,UAAUA,EAAK,SAAS,aAAaA,IAAO;AAC5E;AAEA,SAASK,EAAa,GAAwC,GAA8C;CAE1G,QADiBN,EAAK,UAAU,OAAOhB,EAAM,QAAQA,EAAM,WAAWgB,EAAK,MAAM,EAAA,CACjE,QAAQA,EAAK,EAAE;AACjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useLatest as e } from "@weasel-js/react";
|
|
2
|
+
import { useDepSource as t } from "@weasel-js/routing/react";
|
|
3
|
+
//#region src/canvas/deps/snap.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = e(n);
|
|
6
|
+
t("snap", () => ({ point: (e) => r.current?.(e) ?? e }));
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useSnapDepSource };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=snap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snap.js","names":["useSnapDepSource","snapRef","useLatest","snapPoint","p"],"sources":["../../../src/canvas/deps/snap.ts"],"sourcesContent":["/**\n * `useSnapDepSource` — wires the `snap` dep consumed by `insertAction`.\n *\n * Sourced from `<SceneCanvas toolOptions={{ snapPoint }} />`. The dep is a\n * live thunk over a ref, so toggling snap on/off (WeaselDraw's snap-to-grid\n * switch) takes effect on the next gesture without remounting the registry.\n *\n * Always registered (hooks can't be conditional); when no `snapPoint` is\n * supplied the dep's `point` is the identity function, which is the same\n * behavior actions fall back to when the dep is absent entirely.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { SnapDep } from 'interactions/actions/depSchema';\n\nexport function useSnapDepSource(\n snapPoint: ((p: { x: number; y: number }) => { x: number; y: number }) | undefined,\n): void {\n const snapRef = useLatest(snapPoint);\n\n useDepSource('snap', (): SnapDep => ({\n point: (p) => snapRef.current?.(p) ?? p,\n }));\n}\n"],"mappings":";;;AAeA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAUC,EAAUC,CAAS;CAEnC,EAAa,eAAwB,EACnC,QAAQ,MAAMF,EAAQ,UAAUG,CAAC,KAAKA,EACxC,EAAE;AACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useLatest as e } from "@weasel-js/react";
|
|
2
|
+
import { useDepSource as t } from "@weasel-js/routing/react";
|
|
3
|
+
//#region src/canvas/deps/textEdit.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = e(n);
|
|
6
|
+
t("textEdit", () => {
|
|
7
|
+
let e = r.current;
|
|
8
|
+
return {
|
|
9
|
+
startEdit(e, t) {
|
|
10
|
+
process.env.NODE_ENV !== "production" && console.warn("weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.");
|
|
11
|
+
},
|
|
12
|
+
isTextNode(t) {
|
|
13
|
+
return e.get(t)?.data?.kind === "text";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as useTextEditDepSource };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=textEdit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textEdit.js","names":["useTextEditDepSource","sceneRef","useLatest","scene","sc","id"],"sources":["../../../src/canvas/deps/textEdit.ts"],"sourcesContent":["/**\n * `useTextEditDepSource` — wires the `textEdit` dep consumed by\n * `enterTextEditAction`. Kit-default implementation is a no-op stub for\n * `startEdit` plus a convention-based `isTextNode` predicate\n * (`data.kind === 'text'`). Consumers wanting real text editing override the\n * dep via their own `useDepSource('textEdit', ...)` sourced from a\n * `useSceneTextEdit` instance.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { TextEditDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\n\nexport function useTextEditDepSource(\n scene: Scene<unknown, string, unknown>,\n): void {\n const sceneRef = useLatest(scene);\n\n useDepSource('textEdit', (): TextEditDep => {\n const sc = sceneRef.current;\n return {\n startEdit(_id: string, _opts?: { caret?: number | 'all' }) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. ' +\n 'Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.',\n );\n }\n },\n isTextNode(id: string) {\n const node = sc.get(id as NodeId);\n return (node?.data as { kind?: string } | null | undefined)?.kind === 'text';\n },\n };\n });\n}\n"],"mappings":";;;AAaA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK;CAEhC,EAAa,kBAA+B;EAC1C,IAAMC,IAAKH,EAAS;EACpB,OAAO;GACL,UAAU,GAAa,GAAoC;IACzD,AAAA,QAAA,IAAA,aAA6B,gBAC3B,QAAQ,KACN,4LAEF;GAEJ;GACA,WAAW,GAAY;IAErB,OADaG,EAAG,IAAIC,CACZ,CAAA,EAAM,MAA+C,SAAS;GACxE;EACF;CACF,CAAC;AACH"}
|