@weasel-js/core 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1006 -0
- package/README.md +28 -9
- 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-BT_vp9FO.d.ts} +2 -2
- package/dist/{builtins-HWyuLzE-.d.ts → builtins-BSUfH8nU.d.ts} +1301 -508
- 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 +75 -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 +98 -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-7mCcm6qG.d.ts → cornerHandles-CDcZOV8h.d.ts} +54 -71
- 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 +44 -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.css +2 -86
- package/dist/index.d.ts +2349 -2609
- 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 +96 -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 +656 -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 +332 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +181 -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 +168 -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 +32 -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-CUMxmZzn.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 -48
- package/dist/move.js +3 -142
- package/dist/originProjection-BSn4xiEy.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-CjSXMf8X.d.ts} +3 -3
- 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 +18 -20
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.d.ts +1 -1
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -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-CxC8P6W0.d.ts → types-CA54-mAZ.d.ts} +188 -17
- package/dist/{types-D_74YlWs.d.ts → types-DSjd6W3n.d.ts} +35 -12
- 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 -18
- package/dist/chunk-44EWMJV2.js +0 -128
- package/dist/chunk-44EWMJV2.js.map +0 -1
- package/dist/chunk-4RJP2N2L.js +0 -143
- package/dist/chunk-4RJP2N2L.js.map +0 -1
- package/dist/chunk-BJN5ZRIJ.js +0 -167
- package/dist/chunk-BJN5ZRIJ.js.map +0 -1
- package/dist/chunk-D4AAWR64.js +0 -28
- package/dist/chunk-D4AAWR64.js.map +0 -1
- package/dist/chunk-DOBSZOPR.js +0 -29
- package/dist/chunk-DOBSZOPR.js.map +0 -1
- package/dist/chunk-H6N2JSZ3.js +0 -248
- package/dist/chunk-H6N2JSZ3.js.map +0 -1
- package/dist/chunk-HPFJUUTF.js +0 -167
- package/dist/chunk-HPFJUUTF.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-MZAIDI6D.js +0 -32492
- package/dist/chunk-MZAIDI6D.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-RMR4QMM6.js +0 -250
- package/dist/chunk-RMR4QMM6.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-BXdz8GF2.d.ts +0 -158
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -37
- 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/options-CzjxFoYZ.d.ts +0 -67
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -86
- 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,263 @@
|
|
|
1
|
+
import { viewToTransform as e } from "../../../core/viewport/view.js";
|
|
2
|
+
import { worldToScreen as t } from "../../../core/viewport/viewTransform.js";
|
|
3
|
+
import { withinPxRadius as n } from "../../../core/viewport/pxExtent.js";
|
|
4
|
+
import { sliceAction as r } from "../../../interactions/actions/defaults/slice.js";
|
|
5
|
+
import { defineTool as i } from "../../overlayBinding.js";
|
|
6
|
+
import { OVERLAY_ROLE_STROKES as a } from "../../../canvas/overlayRoleStrokes.js";
|
|
7
|
+
import { ellipsePath as o, polylineFromPoints as s } from "@weasel-js/geom";
|
|
8
|
+
import { useMemo as c, useRef as l } from "react";
|
|
9
|
+
import { useLatest as u } from "@weasel-js/react";
|
|
10
|
+
import { ActionDisabledReason as d } from "@weasel-js/routing";
|
|
11
|
+
//#region src/tools/builtin/slice/useSliceTool.ts
|
|
12
|
+
var f = 3;
|
|
13
|
+
function p(p = {}) {
|
|
14
|
+
let m = l({ points: [] }), h = u({ closeHitRadius: p.closeHitRadius ?? 8 }), g = c(() => {
|
|
15
|
+
let e = /* @__PURE__ */ new Set(), t = null, n = null, r = () => {
|
|
16
|
+
for (let t of [...e]) t();
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
notify: r,
|
|
20
|
+
listen(t) {
|
|
21
|
+
return e.add(t), () => {
|
|
22
|
+
e.delete(t);
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
pointer: () => t,
|
|
26
|
+
follow(e) {
|
|
27
|
+
e && e !== t && (n?.(), t = e, n = e.subscribe(r));
|
|
28
|
+
},
|
|
29
|
+
unfollow() {
|
|
30
|
+
n?.(), n = null, t = null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, []), _ = c(() => {
|
|
34
|
+
let e = () => m.current.points, t = () => e().length > 0 || d.NotApplicable, i = () => {
|
|
35
|
+
m.current.points = [], g.unfollow(), g.notify();
|
|
36
|
+
}, a = (t) => {
|
|
37
|
+
let n = e().slice();
|
|
38
|
+
i(), n.length >= 2 && t.slice?.commit(n);
|
|
39
|
+
}, o = (t, r, i) => {
|
|
40
|
+
let o = e(), s = o[0], c = t.view?.get().scale ?? {
|
|
41
|
+
x: 1,
|
|
42
|
+
y: 1
|
|
43
|
+
};
|
|
44
|
+
if (o.length >= 3 && n(r - s.x, i - s.y, h.current.closeHitRadius, c)) {
|
|
45
|
+
o.push({
|
|
46
|
+
x: s.x,
|
|
47
|
+
y: s.y
|
|
48
|
+
}), a(t);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
o.push({
|
|
52
|
+
x: r,
|
|
53
|
+
y: i
|
|
54
|
+
}), g.follow(t.pointer), g.notify();
|
|
55
|
+
}, s = { capability: "edits-page" };
|
|
56
|
+
return [
|
|
57
|
+
r,
|
|
58
|
+
{
|
|
59
|
+
id: "slice.addPoint",
|
|
60
|
+
label: "Slice — place point",
|
|
61
|
+
eligible: s,
|
|
62
|
+
requires: [
|
|
63
|
+
"slice",
|
|
64
|
+
"view",
|
|
65
|
+
"pointer"
|
|
66
|
+
],
|
|
67
|
+
enabled: (e) => e?.slice ? !0 : d.NotApplicable,
|
|
68
|
+
invoker: {
|
|
69
|
+
timing: "immediate",
|
|
70
|
+
run: (e, t) => {
|
|
71
|
+
let n = t;
|
|
72
|
+
n?.pressX !== void 0 && n.pressY !== void 0 && o(e, n.pressX, n.pressY);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "slice.dragPoint",
|
|
78
|
+
label: "Slice — drag out a point",
|
|
79
|
+
eligible: s,
|
|
80
|
+
requires: [
|
|
81
|
+
"slice",
|
|
82
|
+
"view",
|
|
83
|
+
"pointer"
|
|
84
|
+
],
|
|
85
|
+
enabled: t,
|
|
86
|
+
invoker: {
|
|
87
|
+
timing: "ongoing",
|
|
88
|
+
start: () => ({
|
|
89
|
+
onMove: () => {},
|
|
90
|
+
onEnd: (t, n) => {
|
|
91
|
+
if (n === "cancel" || e().length === 0) return;
|
|
92
|
+
let r = t.drag?.current ?? t.world;
|
|
93
|
+
o(t.deps, r.x, r.y);
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "slice.finish",
|
|
100
|
+
label: "Slice — cut along the points",
|
|
101
|
+
eligible: s,
|
|
102
|
+
requires: ["slice"],
|
|
103
|
+
enabled: t,
|
|
104
|
+
invoker: {
|
|
105
|
+
timing: "immediate",
|
|
106
|
+
run: (t, n) => {
|
|
107
|
+
n?.viaDoubleClick && e().pop(), a(t);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "slice.dropPoint",
|
|
113
|
+
label: "Slice — take back the last point",
|
|
114
|
+
eligible: s,
|
|
115
|
+
enabled: t,
|
|
116
|
+
invoker: {
|
|
117
|
+
timing: "immediate",
|
|
118
|
+
run: () => {
|
|
119
|
+
e().pop(), e().length === 0 ? i() : g.notify();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "slice.cancel",
|
|
125
|
+
label: "Slice — discard the points",
|
|
126
|
+
eligible: s,
|
|
127
|
+
enabled: t,
|
|
128
|
+
invoker: {
|
|
129
|
+
timing: "immediate",
|
|
130
|
+
run: () => i()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
}, [g, h]), v = c(() => ({
|
|
135
|
+
id: "slice-pending-cut",
|
|
136
|
+
label: "Slice — pending cut",
|
|
137
|
+
space: "screen",
|
|
138
|
+
subscribe: g.listen,
|
|
139
|
+
draw: (n, r) => {
|
|
140
|
+
let i = m.current.points;
|
|
141
|
+
if (i.length === 0) return [];
|
|
142
|
+
let c = e(r), l = (e) => {
|
|
143
|
+
let [n, r] = t(e.x, e.y, c);
|
|
144
|
+
return {
|
|
145
|
+
x: n,
|
|
146
|
+
y: r
|
|
147
|
+
};
|
|
148
|
+
}, u = i.map(l), d = g.pointer()?.get();
|
|
149
|
+
d && u.push(l({
|
|
150
|
+
x: d.worldX,
|
|
151
|
+
y: d.worldY
|
|
152
|
+
}));
|
|
153
|
+
let p = a.cut, h = [];
|
|
154
|
+
u.length >= 2 && h.push({
|
|
155
|
+
kind: "path",
|
|
156
|
+
path: s(u),
|
|
157
|
+
stroke: p
|
|
158
|
+
});
|
|
159
|
+
for (let e of i.map(l)) h.push({
|
|
160
|
+
kind: "path",
|
|
161
|
+
path: o({
|
|
162
|
+
x: e.x - f,
|
|
163
|
+
y: e.y - f,
|
|
164
|
+
width: 6,
|
|
165
|
+
height: 6
|
|
166
|
+
}),
|
|
167
|
+
fill: p.paint
|
|
168
|
+
});
|
|
169
|
+
return h;
|
|
170
|
+
}
|
|
171
|
+
}), [g]), { keybinding: y } = p;
|
|
172
|
+
return c(() => i({
|
|
173
|
+
id: "slice",
|
|
174
|
+
capabilities: ["edits-page"],
|
|
175
|
+
hookName: "useSliceTool",
|
|
176
|
+
cursor: "crosshair",
|
|
177
|
+
presentation: {
|
|
178
|
+
label: "Slice",
|
|
179
|
+
group: "shape"
|
|
180
|
+
},
|
|
181
|
+
...y === null ? {} : { keybinding: y ?? { key: "K" } },
|
|
182
|
+
actions: _,
|
|
183
|
+
overlay: v,
|
|
184
|
+
onDeactivate: () => {
|
|
185
|
+
m.current.points = [], g.unfollow(), g.notify();
|
|
186
|
+
},
|
|
187
|
+
bindings: [
|
|
188
|
+
{
|
|
189
|
+
spec: {
|
|
190
|
+
kind: "click",
|
|
191
|
+
mods: {
|
|
192
|
+
shift: "optional",
|
|
193
|
+
alt: "optional"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
actionId: "slice.addPoint"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
spec: {
|
|
200
|
+
kind: "doubleClick",
|
|
201
|
+
mods: {
|
|
202
|
+
shift: "optional",
|
|
203
|
+
alt: "optional"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
actionId: "slice.finish",
|
|
207
|
+
opts: { params: { viaDoubleClick: !0 } }
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
spec: {
|
|
211
|
+
kind: "drag",
|
|
212
|
+
mods: {
|
|
213
|
+
shift: "optional",
|
|
214
|
+
alt: "optional"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
actionId: "slice.dragPoint"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
spec: { kind: "drag" },
|
|
221
|
+
actionId: "slice"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
spec: {
|
|
225
|
+
kind: "drag",
|
|
226
|
+
mods: { alt: !0 }
|
|
227
|
+
},
|
|
228
|
+
actionId: "slice",
|
|
229
|
+
opts: { params: { cut: "freehand" } }
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
spec: {
|
|
233
|
+
kind: "key",
|
|
234
|
+
key: "Enter"
|
|
235
|
+
},
|
|
236
|
+
actionId: "slice.finish"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
spec: {
|
|
240
|
+
kind: "key",
|
|
241
|
+
key: "Escape"
|
|
242
|
+
},
|
|
243
|
+
actionId: "slice.cancel"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
spec: {
|
|
247
|
+
kind: "key",
|
|
248
|
+
key: "Backspace"
|
|
249
|
+
},
|
|
250
|
+
actionId: "slice.dropPoint"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}), [
|
|
254
|
+
_,
|
|
255
|
+
v,
|
|
256
|
+
y,
|
|
257
|
+
g
|
|
258
|
+
]);
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
export { p as useSliceTool };
|
|
262
|
+
|
|
263
|
+
//# sourceMappingURL=useSliceTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSliceTool.js","names":["VERTEX_RADIUS_PX","useSliceTool","scratchRef","useRef","optsRef","useLatest","options","live","useMemo","listeners","pointer","offPointer","notify","fn","next","actions","points","pending","ActionDisabledReason","reset","commit","cut","deps","place","pts","first","scale","withinPxRadius","x","y","eligible","sliceAction","\"slice\"","p","params","reason","at","endCtx","overlay","t","viewToTransform","view","toScreen","worldToScreen","run","stroke","OVERLAY_ROLE_STROKES","\"cut\"","out","polylineFromPoints","ellipsePath","defineTool","keybinding"],"sources":["../../../../src/tools/builtin/slice/useSliceTool.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport type { RenderLayer } from 'core/layers/render';\nimport type { DrawCommand } from '../../../renderer';\nimport type { Action, ActionDeps, InvocationCtx, ToolKeybinding } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { SliceDep, ViewApi } from 'interactions/actions/depSchema';\nimport type { PointerContextValue } from 'features/pointer/PointerContext';\nimport { sliceAction } from 'interactions/actions/defaults/slice';\nimport { withinPxRadius } from 'core/viewport/pxExtent';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { viewToTransform } from 'core/viewport/view';\nimport { ellipsePath, polylineFromPoints } from '@weasel-js/geom';\nimport { OVERLAY_ROLE_STROKES } from 'canvas/overlayRoleStrokes';\n\n/** Options for `useSliceTool`. */\nexport interface UseSliceToolOptions {\n /** Override the default keybinding (`{ key: 'K' }`). Pass `null` to omit. */\n keybinding?: ToolKeybinding | null;\n /** Screen-px radius around the first point within which a click closes the\n * cut into a loop and commits it. Default `8`. */\n closeHitRadius?: number;\n}\n\n/** The click-by-click cut in progress, in world coords. */\nexport interface SliceScratch {\n points: { x: number; y: number }[];\n}\n\nconst VERTEX_RADIUS_PX = 3;\n\n/**\n * Knife tool. A drag cuts along a straight line, and an Alt-drag along its\n * freehand trail, through `sliceAction`. Clicks place a cut one point at a\n * time: Enter or a double-click commits it, Escape discards it, Backspace\n * takes back the last point, and a click on the first point closes it into a\n * loop and commits. While points are placed, a drag places one more where it\n * is released instead of cutting on its own.\n *\n * Every cut goes to the `slice` dep, which decides what it does to the scene.\n * `<SceneCanvas>` publishes one that cuts every path the cut crosses. The pending cut paints through\n * `Tool.overlay`, trailing to the pointer when the host publishes one.\n */\nexport function useSliceTool(options: UseSliceToolOptions = {}): Tool<null> {\n const scratchRef = useRef<SliceScratch>({ points: [] });\n const optsRef = useLatest({ closeHitRadius: options.closeHitRadius ?? 8 });\n\n // What the overlay layer's `subscribe` hears: a change to the points, and,\n // while any are placed, every move of the pointer the rubber band follows.\n const live = useMemo(() => {\n const listeners = new Set<() => void>();\n let pointer: PointerContextValue | null = null;\n let offPointer: (() => void) | null = null;\n const notify = (): void => { for (const fn of [...listeners]) fn(); };\n return {\n notify,\n listen(fn: () => void): () => void {\n listeners.add(fn);\n return () => { listeners.delete(fn); };\n },\n pointer: () => pointer,\n follow(next: PointerContextValue | undefined): void {\n if (!next || next === pointer) return;\n offPointer?.();\n pointer = next;\n offPointer = next.subscribe(notify);\n },\n unfollow(): void {\n offPointer?.();\n offPointer = null;\n pointer = null;\n },\n };\n }, []);\n\n const actions = useMemo<Action[]>(() => {\n const points = () => scratchRef.current.points;\n const pending = () => (points().length > 0 ? true : ActionDisabledReason.NotApplicable);\n\n const reset = (): void => {\n scratchRef.current.points = [];\n live.unfollow();\n live.notify();\n };\n const commit = (deps: ActionDeps): void => {\n const cut = points().slice();\n reset();\n if (cut.length >= 2) (deps.slice as SliceDep | undefined)?.commit(cut);\n };\n const place = (deps: ActionDeps, x: number, y: number): void => {\n const pts = points();\n const first = pts[0];\n const scale = (deps.view as ViewApi | undefined)?.get().scale ?? { x: 1, y: 1 };\n if (pts.length >= 3 && withinPxRadius(x - first.x, y - first.y, optsRef.current.closeHitRadius, scale)) {\n pts.push({ x: first.x, y: first.y });\n commit(deps);\n return;\n }\n pts.push({ x, y });\n live.follow(deps.pointer as PointerContextValue | undefined);\n live.notify();\n };\n\n const eligible = { capability: 'edits-page' } as const;\n return [\n sliceAction,\n {\n id: 'slice.addPoint',\n label: 'Slice — place point',\n eligible,\n requires: ['slice', 'view', 'pointer'],\n enabled: (deps) => (deps?.['slice'] ? true : ActionDisabledReason.NotApplicable),\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const p = params as { pressX?: number; pressY?: number } | undefined;\n if (p?.pressX === undefined || p.pressY === undefined) return;\n place(deps, p.pressX, p.pressY);\n },\n },\n },\n {\n id: 'slice.dragPoint',\n label: 'Slice — drag out a point',\n eligible,\n requires: ['slice', 'view', 'pointer'],\n enabled: pending,\n invoker: {\n timing: 'ongoing',\n start: () => ({\n onMove: () => {},\n onEnd: (endCtx: InvocationCtx, reason: 'commit' | 'cancel') => {\n if (reason === 'cancel' || points().length === 0) return;\n const at = endCtx.drag?.current ?? endCtx.world;\n place(endCtx.deps, at.x, at.y);\n },\n }),\n },\n },\n {\n id: 'slice.finish',\n label: 'Slice — cut along the points',\n eligible,\n requires: ['slice'],\n enabled: pending,\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n // A double click arrives after both of its clicks, so the second\n // has already placed a point on top of the first.\n if ((params as { viaDoubleClick?: boolean } | undefined)?.viaDoubleClick) points().pop();\n commit(deps);\n },\n },\n },\n {\n id: 'slice.dropPoint',\n label: 'Slice — take back the last point',\n eligible,\n enabled: pending,\n invoker: {\n timing: 'immediate',\n run: () => {\n points().pop();\n if (points().length === 0) reset();\n else live.notify();\n },\n },\n },\n {\n id: 'slice.cancel',\n label: 'Slice — discard the points',\n eligible,\n // Declining with nothing placed leaves Escape to the ambient `escape`.\n enabled: pending,\n invoker: { timing: 'immediate', run: () => reset() },\n },\n ];\n }, [live, optsRef]);\n\n const overlay = useMemo<RenderLayer<unknown>>(() => ({\n id: 'slice-pending-cut',\n label: 'Slice — pending cut',\n space: 'screen',\n subscribe: live.listen,\n draw: (_data, view) => {\n const pts = scratchRef.current.points;\n if (pts.length === 0) return [];\n const t = viewToTransform(view);\n const toScreen = (p: { x: number; y: number }) => {\n const [x, y] = worldToScreen(p.x, p.y, t);\n return { x, y };\n };\n const run = pts.map(toScreen);\n const at = live.pointer()?.get();\n if (at) run.push(toScreen({ x: at.worldX, y: at.worldY }));\n const stroke = OVERLAY_ROLE_STROKES['cut'];\n const out: DrawCommand[] = [];\n if (run.length >= 2) out.push({ kind: 'path', path: polylineFromPoints(run), stroke });\n for (const p of pts.map(toScreen)) {\n out.push({\n kind: 'path',\n path: ellipsePath({\n x: p.x - VERTEX_RADIUS_PX,\n y: p.y - VERTEX_RADIUS_PX,\n width: VERTEX_RADIUS_PX * 2,\n height: VERTEX_RADIUS_PX * 2,\n }),\n fill: stroke.paint,\n });\n }\n return out;\n },\n }), [live]);\n\n const { keybinding } = options;\n return useMemo(() => defineTool<null>({\n id: 'slice',\n capabilities: ['edits-page'],\n hookName: 'useSliceTool',\n cursor: 'crosshair',\n presentation: { label: 'Slice', group: 'shape' },\n ...(keybinding === null ? {} : { keybinding: keybinding ?? { key: 'K' } }),\n actions,\n overlay,\n onDeactivate: () => {\n scratchRef.current.points = [];\n live.unfollow();\n live.notify();\n },\n bindings: [\n { spec: { kind: 'click', mods: { shift: 'optional', alt: 'optional' } }, actionId: 'slice.addPoint' },\n {\n spec: { kind: 'doubleClick', mods: { shift: 'optional', alt: 'optional' } },\n actionId: 'slice.finish',\n opts: { params: { viaDoubleClick: true } },\n },\n // Ahead of the cutting drags: it declines unless points are placed.\n { spec: { kind: 'drag', mods: { shift: 'optional', alt: 'optional' } }, actionId: 'slice.dragPoint' },\n { spec: { kind: 'drag' }, actionId: 'slice' },\n { spec: { kind: 'drag', mods: { alt: true } }, actionId: 'slice', opts: { params: { cut: 'freehand' } } },\n { spec: { kind: 'key', key: 'Enter' }, actionId: 'slice.finish' },\n { spec: { kind: 'key', key: 'Escape' }, actionId: 'slice.cancel' },\n { spec: { kind: 'key', key: 'Backspace' }, actionId: 'slice.dropPoint' },\n ],\n }), [actions, overlay, keybinding, live]);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/StarIcon.js";
|
|
3
|
+
import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
|
|
4
|
+
import { useCallback as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
6
|
+
import { cursorFor as c } from "@weasel-js/cursor";
|
|
7
|
+
//#region src/tools/builtin/star/useStarTool.tsx
|
|
8
|
+
var l = 3, u = 32;
|
|
9
|
+
function d(d = {}) {
|
|
10
|
+
let { points: f = 5, innerRatio: p = .5, behaviors: m } = d, h = a(f), g = a(p), [, _] = o(0), v = r(() => _((e) => e + 1), []), y = i(() => ({
|
|
11
|
+
id: "star.adjustPoints",
|
|
12
|
+
label: "Star — adjust points",
|
|
13
|
+
invoker: {
|
|
14
|
+
timing: "immediate",
|
|
15
|
+
run: (e, t) => {
|
|
16
|
+
let n = t, r = n?.delta ?? (n?.deltaY !== void 0 && n.deltaY !== 0 ? n.deltaY > 0 ? 1 : -1 : 0);
|
|
17
|
+
r !== 0 && (h.current = r > 0 ? Math.min(u, h.current + 1) : Math.max(l, h.current - 1), v());
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}), [v]);
|
|
21
|
+
return i(() => e({
|
|
22
|
+
id: "star",
|
|
23
|
+
capabilities: ["creates-shapes"],
|
|
24
|
+
hookName: "useStarTool",
|
|
25
|
+
cursor: c("crosshairStar", { fallback: "crosshair" }),
|
|
26
|
+
actions: [y],
|
|
27
|
+
presentation: {
|
|
28
|
+
label: "Star",
|
|
29
|
+
group: "shape",
|
|
30
|
+
icon: /* @__PURE__ */ s(t, {})
|
|
31
|
+
},
|
|
32
|
+
bindings: [
|
|
33
|
+
{
|
|
34
|
+
spec: { kind: "drag" },
|
|
35
|
+
actionId: "insert",
|
|
36
|
+
opts: {
|
|
37
|
+
params: () => ({
|
|
38
|
+
kind: "star",
|
|
39
|
+
points: h.current,
|
|
40
|
+
innerRadiusRatio: g.current
|
|
41
|
+
}),
|
|
42
|
+
...n(m)
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
spec: {
|
|
47
|
+
kind: "wheel",
|
|
48
|
+
phase: "engaged"
|
|
49
|
+
},
|
|
50
|
+
actionId: "star.adjustPoints"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
spec: {
|
|
54
|
+
kind: "wheel",
|
|
55
|
+
phase: "engaged",
|
|
56
|
+
mods: { shift: !0 }
|
|
57
|
+
},
|
|
58
|
+
actionId: "insert.adjustRotation"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
spec: {
|
|
62
|
+
kind: "key",
|
|
63
|
+
key: "ArrowUp"
|
|
64
|
+
},
|
|
65
|
+
actionId: "star.adjustPoints",
|
|
66
|
+
opts: { params: { delta: 1 } }
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
spec: {
|
|
70
|
+
kind: "key",
|
|
71
|
+
key: "ArrowDown"
|
|
72
|
+
},
|
|
73
|
+
actionId: "star.adjustPoints",
|
|
74
|
+
opts: { params: { delta: -1 } }
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}), [y, m]);
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { d as useStarTool };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=useStarTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStarTool.js","names":["StarIcon","MIN_POINTS","MAX_POINTS","useStarTool","initialPoints","initialInnerRatio","options","pointsRef","useRef","innerRatioRef","setPointsTick","useState","bumpPoints","useCallback","n","adjustPointsAction","useMemo","p","params","step","defineTool","cursorFor","insertBindingBehaviors","behaviors"],"sources":["../../../../src/tools/builtin/star/useStarTool.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { StarIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport type { Action } from '@weasel-js/routing';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/** A point in world coordinates. */\nexport interface StarPoint { x: number; y: number }\n\n/** Options for `useStarTool`. */\nexport interface UseStarToolOptions extends InsertToolOptions {\n label?: string;\n /** Initial point count. Persists across gestures (Illustrator\n * convention), adjustable mid-drag via ArrowUp/Down or wheel\n * (range 3–32). */\n points?: number;\n /** Inner-radius / outer-radius ratio. Default 0.5. Fixed for now;\n * consumers wanting per-instance ratios should override the `insert`\n * dep. */\n innerRatio?: number;\n}\n\nconst MIN_POINTS = 3;\nconst MAX_POINTS = 32;\n\n/**\n * Drag-from-center star tool. Pointerdown sets center; drag determines\n * outer radius + rotation; release commits via `insertAction`. Inner\n * radius = outer × `innerRatio` (default 0.5). Point count defaults to\n * 5, adjustable mid-gesture via ArrowUp/Down or wheel.\n *\n * Live preview painted by the dispatcher overlay layer reading\n * `insertAction.overlay()`. Consumers wanting custom star geometry\n * override the `insert` dep.\n */\nexport function useStarTool<TNode extends { id: string } = { id: string }>(\n options: UseStarToolOptions = {},\n): Tool<null> {\n const {\n points: initialPoints = 5,\n innerRatio: initialInnerRatio = 0.5,\n behaviors,\n } = options;\n const pointsRef = useRef(initialPoints);\n const innerRatioRef = useRef(initialInnerRatio);\n const [, setPointsTick] = useState(0);\n const bumpPoints = useCallback(() => setPointsTick((n) => n + 1), []);\n\n // Wheel-to-adjust-points action. Phase-gated to `[engaged]` so it\n // fires only mid-drag.\n const adjustPointsAction = useMemo<Action>(\n () => ({\n id: 'star.adjustPoints',\n label: 'Star — adjust points',\n invoker: {\n timing: 'immediate' as const,\n run: (_deps, params) => {\n const p = params as { deltaY?: number; delta?: number } | undefined;\n // `delta` comes from the ArrowUp/ArrowDown key bindings; `deltaY`\n // from the wheel. Wheel up (deltaY > 0 under natural scrolling)\n // adds a point.\n const step = p?.delta ?? (p?.deltaY !== undefined && p.deltaY !== 0\n ? (p.deltaY > 0 ? 1 : -1)\n : 0);\n if (step === 0) return;\n pointsRef.current = step > 0\n ? Math.min(MAX_POINTS, pointsRef.current + 1)\n : Math.max(MIN_POINTS, pointsRef.current - 1);\n bumpPoints();\n },\n },\n }),\n [bumpPoints],\n );\n\n void ({} as TNode);\n\n return useMemo(\n () =>\n defineTool<null>({\n id: 'star',\n capabilities: ['creates-shapes'],\n hookName: 'useStarTool',\n cursor: cursorFor('crosshairStar', { fallback: 'crosshair' }),\n // Registered by <ToolActionsMounter>, inside the ActionsProvider —\n // see `ToolDef.actions` for why the hook can't register it itself.\n actions: [adjustPointsAction],\n presentation: {\n label: 'Star',\n group: 'shape',\n icon: <StarIcon />,\n },\n bindings: [\n // Default = drag from corner; anchor dot in the overlay sells\n // the click point. Alt flips to center mode (live toggle).\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: {\n params: () => ({\n kind: 'star',\n points: pointsRef.current,\n innerRadiusRatio: innerRatioRef.current,\n }),\n ...insertBindingBehaviors(behaviors),\n },\n },\n {\n spec: { kind: 'wheel', phase: 'engaged' },\n actionId: 'star.adjustPoints',\n },\n {\n spec: { kind: 'wheel', phase: 'engaged', mods: { shift: true } },\n actionId: 'insert.adjustRotation',\n },\n // ArrowUp/Down → adjust point count. Ported off the phase table for\n // the same reason as polygon's: as an `initial.keyDown` route the\n // key was claimed on the tool pipeline while `nudge.*` matched the\n // same press on the interactions dispatcher, so both fired.\n {\n spec: { kind: 'key', key: 'ArrowUp' },\n actionId: 'star.adjustPoints',\n opts: { params: { delta: 1 } },\n },\n {\n spec: { kind: 'key', key: 'ArrowDown' },\n actionId: 'star.adjustPoints',\n opts: { params: { delta: -1 } },\n },\n ],\n }),\n [adjustPointsAction, behaviors],\n );\n}\n"],"mappings":";;;;;;;AAwBA,IAAMC,IAAa,GACbC,IAAa;AAYnB,SAAgBC,EACd,IAA8B,CAAC,GACnB;CACZ,IAAM,EACJ,QAAQC,IAAgB,GACxB,YAAYC,IAAoB,IAChC,iBACEC,GACEC,IAAYC,EAAOJ,CAAa,GAChCK,IAAgBD,EAAOH,CAAiB,GACxC,GAAGK,KAAiBC,EAAS,CAAC,GAC9BC,IAAaC,QAAkBH,GAAe,MAAMI,IAAI,CAAC,GAAG,CAAC,CAAC,GAI9DC,IAAqBC,SAClB;EACL,IAAI;EACJ,OAAO;EACP,SAAS;GACP,QAAQ;GACR,MAAM,GAAO,MAAW;IACtB,IAAMC,IAAIC,GAIJC,IAAOF,GAAG,UAAUA,GAAG,WAAW,KAAA,KAAaA,EAAE,WAAW,IAC7DA,EAAE,SAAS,IAAI,IAAI,KACpB;IACJ,AAAIE,MAAS,MACb,EAAU,UAAUA,IAAO,IACvB,KAAK,IAAIjB,GAAYK,EAAU,UAAU,CAAC,IAC1C,KAAK,IAAIN,GAAYM,EAAU,UAAU,CAAC,GAC9CK,EAAW;GACb;EACF;CACF,IACA,CAACA,CAAU,CACb;CAIA,OAAOI,QAEHI,EAAiB;EACf,IAAI;EACJ,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,iBAAiB,EAAE,UAAU,YAAY,CAAC;EAG5D,SAAS,CAACN,CAAkB;EAC5B,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACf,GAAD,CAAW,CAAA;EACnB;EACA,UAAU;GAGR;IACE,MAAM,EAAE,MAAM,OAAO;IACrB,UAAU;IACV,MAAM;KACJ,eAAe;MACb,MAAM;MACN,QAAQO,EAAU;MAClB,kBAAkBE,EAAc;KAClC;KACA,GAAGa,EAAuBC,CAAS;IACrC;GACF;GACA;IACE,MAAM;KAAE,MAAM;KAAS,OAAO;IAAU;IACxC,UAAU;GACZ;GACA;IACE,MAAM;KAAE,MAAM;KAAS,OAAO;KAAW,MAAM,EAAE,OAAO,GAAK;IAAE;IAC/D,UAAU;GACZ;GAKA;IACE,MAAM;KAAE,MAAM;KAAO,KAAK;IAAU;IACpC,UAAU;IACV,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;GAC/B;GACA;IACE,MAAM;KAAE,MAAM;KAAO,KAAK;IAAY;IACtC,UAAU;IACV,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE;GAChC;EACF;CACF,CAAC,GACH,CAACR,GAAoBQ,CAAS,CAChC;AACF"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/TextIcon.js";
|
|
3
|
+
import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
|
|
4
|
+
import { createElement as r, useMemo as i } from "react";
|
|
5
|
+
//#region src/tools/builtin/text/useTextTool.ts
|
|
6
|
+
var a = {
|
|
7
|
+
label: "Text",
|
|
8
|
+
icon: r(t),
|
|
9
|
+
group: "type"
|
|
10
|
+
};
|
|
11
|
+
function o(t = {}) {
|
|
12
|
+
let { behaviors: r } = t;
|
|
13
|
+
return i(() => e({
|
|
14
|
+
id: "text",
|
|
15
|
+
capabilities: ["creates-text"],
|
|
16
|
+
hookName: "useTextTool",
|
|
17
|
+
cursor: "text",
|
|
18
|
+
presentation: a,
|
|
19
|
+
bindings: [{
|
|
20
|
+
spec: { kind: "drag" },
|
|
21
|
+
actionId: "insert",
|
|
22
|
+
opts: {
|
|
23
|
+
params: { kind: "text" },
|
|
24
|
+
...n(r)
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
spec: {
|
|
28
|
+
kind: "click",
|
|
29
|
+
target: "selected-body"
|
|
30
|
+
},
|
|
31
|
+
actionId: "enterTextEdit"
|
|
32
|
+
}]
|
|
33
|
+
}), [r]);
|
|
34
|
+
}
|
|
35
|
+
var s = {
|
|
36
|
+
toDisplay: (e) => Math.round(e * 1e3) / 10,
|
|
37
|
+
fromDisplay: (e) => Math.round(e * 1e3) / 1e5,
|
|
38
|
+
suffix: "%"
|
|
39
|
+
}, c = (e, t) => ({
|
|
40
|
+
kind: "boolean",
|
|
41
|
+
name: e,
|
|
42
|
+
description: `${e} for the characters in the range.`,
|
|
43
|
+
icon: t,
|
|
44
|
+
control: "toggle",
|
|
45
|
+
pair: "Character style",
|
|
46
|
+
default: !1
|
|
47
|
+
});
|
|
48
|
+
o.options = {
|
|
49
|
+
name: "Text",
|
|
50
|
+
description: "Character styling for the selected range.",
|
|
51
|
+
children: {
|
|
52
|
+
bold: c("Bold", "bold"),
|
|
53
|
+
italic: c("Italic", "italic"),
|
|
54
|
+
underline: c("Underline", "underline"),
|
|
55
|
+
strikethrough: c("Strikethrough", "strikethrough"),
|
|
56
|
+
overline: c("Overline", "overline"),
|
|
57
|
+
script: {
|
|
58
|
+
kind: "enum",
|
|
59
|
+
name: "Script",
|
|
60
|
+
description: "Raise or lower the range off the baseline, at a smaller size.",
|
|
61
|
+
control: "toggle",
|
|
62
|
+
clearable: !0,
|
|
63
|
+
default: void 0,
|
|
64
|
+
options: [{
|
|
65
|
+
value: "super",
|
|
66
|
+
label: "Superscript",
|
|
67
|
+
icon: "superscript"
|
|
68
|
+
}, {
|
|
69
|
+
value: "sub",
|
|
70
|
+
label: "Subscript",
|
|
71
|
+
icon: "subscript"
|
|
72
|
+
}]
|
|
73
|
+
},
|
|
74
|
+
textTransform: {
|
|
75
|
+
kind: "enum",
|
|
76
|
+
name: "Case",
|
|
77
|
+
description: "Draw the range in capitals, lowercase or title case. The text itself is unchanged.",
|
|
78
|
+
control: "toggle",
|
|
79
|
+
default: "none",
|
|
80
|
+
options: [
|
|
81
|
+
{
|
|
82
|
+
value: "none",
|
|
83
|
+
label: "None",
|
|
84
|
+
short: "–"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: "uppercase",
|
|
88
|
+
label: "Uppercase",
|
|
89
|
+
short: "AA"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
value: "lowercase",
|
|
93
|
+
label: "Lowercase",
|
|
94
|
+
short: "aa"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
value: "capitalize",
|
|
98
|
+
label: "Capitalize",
|
|
99
|
+
short: "Aa"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
fontVariantCaps: {
|
|
104
|
+
kind: "enum",
|
|
105
|
+
name: "Small caps",
|
|
106
|
+
description: "Draw lowercase letters in the range as smaller capitals. The text itself is unchanged.",
|
|
107
|
+
control: "toggle",
|
|
108
|
+
default: "normal",
|
|
109
|
+
options: [{
|
|
110
|
+
value: "normal",
|
|
111
|
+
label: "Normal",
|
|
112
|
+
short: "–"
|
|
113
|
+
}, {
|
|
114
|
+
value: "small-caps",
|
|
115
|
+
label: "Small caps",
|
|
116
|
+
short: "Sc"
|
|
117
|
+
}]
|
|
118
|
+
},
|
|
119
|
+
fontFamily: {
|
|
120
|
+
kind: "font-family",
|
|
121
|
+
name: "Font",
|
|
122
|
+
description: "Typeface for the range.",
|
|
123
|
+
default: void 0
|
|
124
|
+
},
|
|
125
|
+
fontWeight: {
|
|
126
|
+
kind: "font-weight",
|
|
127
|
+
name: "Weight",
|
|
128
|
+
description: "Weight of the range, from the faces its family has.",
|
|
129
|
+
default: void 0
|
|
130
|
+
},
|
|
131
|
+
fontSize: {
|
|
132
|
+
kind: "number",
|
|
133
|
+
name: "Size",
|
|
134
|
+
description: "Type size.",
|
|
135
|
+
min: 1,
|
|
136
|
+
step: 1,
|
|
137
|
+
default: 16
|
|
138
|
+
},
|
|
139
|
+
letterSpacing: {
|
|
140
|
+
kind: "number",
|
|
141
|
+
name: "Tracking",
|
|
142
|
+
short: "VA",
|
|
143
|
+
description: "Space added between characters.",
|
|
144
|
+
step: .1,
|
|
145
|
+
default: 0
|
|
146
|
+
},
|
|
147
|
+
baselineShift: {
|
|
148
|
+
kind: "number",
|
|
149
|
+
name: "Baseline shift",
|
|
150
|
+
short: "Shift",
|
|
151
|
+
description: "Raise or lower the range, in ems of the inherited size.",
|
|
152
|
+
step: .001,
|
|
153
|
+
unit: s,
|
|
154
|
+
default: 0
|
|
155
|
+
},
|
|
156
|
+
fontScale: {
|
|
157
|
+
kind: "number",
|
|
158
|
+
name: "Scale",
|
|
159
|
+
description: "Size of the range against the inherited size.",
|
|
160
|
+
min: .01,
|
|
161
|
+
step: .001,
|
|
162
|
+
unit: s,
|
|
163
|
+
default: 1
|
|
164
|
+
},
|
|
165
|
+
fill: {
|
|
166
|
+
kind: "color",
|
|
167
|
+
name: "Color",
|
|
168
|
+
description: "Ink for the range.",
|
|
169
|
+
alpha: !0,
|
|
170
|
+
default: "#000000"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
//#endregion
|
|
175
|
+
export { o as useTextTool };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=useTextTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextTool.js","names":["TextIcon","PRESENTATION","createElement","useTextTool","options","useMemo","defineTool","insertBindingBehaviors","behaviors","PERCENT","v","flag","name"],"sources":["../../../../src/tools/builtin/text/useTextTool.ts"],"sourcesContent":["import { useMemo, createElement } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport type { ToolPrefGroup } from '../../prefs';\nimport { TextIcon } from '../../../icons';\n\nconst PRESENTATION = {\n label: 'Text',\n icon: createElement(TextIcon),\n group: 'type',\n};\n\n/** Text tool. Drag-rect insertion is owned end-to-end by the dispatcher's\n * `insertAction` (kind: `'text'`); click-on-selected-text-node enters edit\n * mode via the `enterTextEdit` action.\n *\n * Consumers must register both the `insert` dep (e.g. through\n * `SceneCanvas`'s `useInsertDepSource`) and the `textEdit` dep\n * (`enterTextEditAction`'s contract — see\n * `src/interactions/actions/defaults/enterTextEdit.ts`). Custom node\n * factories and hit gating belong on those deps, not on the tool. */\nexport function useTextTool(options: InsertToolOptions = {}): Tool<undefined> {\n const { behaviors } = options;\n return useMemo<Tool<undefined>>(\n () =>\n defineTool<undefined>({\n id: 'text',\n capabilities: ['creates-text'],\n hookName: 'useTextTool',\n cursor: 'text',\n presentation: PRESENTATION,\n bindings: [\n { spec: { kind: 'drag' }, actionId: 'insert', opts: { params: { kind: 'text' }, ...insertBindingBehaviors(behaviors) } },\n { spec: { kind: 'click', target: 'selected-body' }, actionId: 'enterTextEdit' },\n ],\n }),\n [behaviors],\n );\n}\n\n/** Both script primitives are fractions of the inherited size, so both read\n * as percentages. The step is a tenth of a point because the field snaps the\n * *displayed* value to it, and a coarser one would render a superscript's\n * 58.3% as 60% and commit that on the next edit. */\nconst PERCENT = {\n toDisplay: (v: number) => Math.round(v * 1000) / 10,\n // Rounded rather than divided: 33.3 / 100 is 0.33299999999999996, and that\n // dust would be written into the document and shown back on the next read.\n fromDisplay: (v: number) => Math.round(v * 1000) / 100_000,\n suffix: '%',\n};\n\n/** A run flag: on or off per character, drawn as one segment of a bar. */\nconst flag = (name: string, icon: string) =>\n ({\n kind: 'boolean',\n name,\n description: `${name} for the characters in the range.`,\n icon,\n control: 'toggle',\n pair: 'Character style',\n default: false,\n }) as const;\n\n/**\n * What the tool offers while a caret range is active — the character half of\n * text styling, against the node-level Character group a selection shows.\n *\n * Keyed by {@link StyledRun} field, so a host reads values out of a\n * `RangeStyle` and writes a `RunStylePatch` back with no name mapping of its\n * own. `script` is a preset over `baselineShift` and `fontScale`, so all three\n * are here and naming either primitive overrides that half.\n */\nuseTextTool.options = {\n name: 'Text',\n description: 'Character styling for the selected range.',\n children: {\n bold: flag('Bold', 'bold'),\n italic: flag('Italic', 'italic'),\n underline: flag('Underline', 'underline'),\n strikethrough: flag('Strikethrough', 'strikethrough'),\n overline: flag('Overline', 'overline'),\n // Clearable: the two values are exclusive *and* absent is a third state,\n // so clicking the lit segment turns the script off.\n script: {\n kind: 'enum',\n name: 'Script',\n description: 'Raise or lower the range off the baseline, at a smaller size.',\n control: 'toggle',\n clearable: true,\n default: undefined,\n options: [\n { value: 'super', label: 'Superscript', icon: 'superscript' },\n { value: 'sub', label: 'Subscript', icon: 'subscript' },\n ],\n },\n textTransform: {\n kind: 'enum',\n name: 'Case',\n description: 'Draw the range in capitals, lowercase or title case. The text itself is unchanged.',\n control: 'toggle',\n default: 'none',\n options: [{ value: 'none', label: 'None', short: '–' }, { value: 'uppercase', label: 'Uppercase', short: 'AA' }, { value: 'lowercase', label: 'Lowercase', short: 'aa' }, { value: 'capitalize', label: 'Capitalize', short: 'Aa' }],\n },\n fontVariantCaps: {\n kind: 'enum',\n name: 'Small caps',\n description: 'Draw lowercase letters in the range as smaller capitals. The text itself is unchanged.',\n control: 'toggle',\n default: 'normal',\n options: [{ value: 'normal', label: 'Normal', short: '–' }, { value: 'small-caps', label: 'Small caps', short: 'Sc' }],\n },\n fontFamily: {\n kind: 'font-family',\n name: 'Font',\n description: 'Typeface for the range.',\n default: undefined,\n },\n // Listed from the weights the range's family has registered. Bold is a\n // preset over it: toggling Bold clears it, picking one clears Bold.\n fontWeight: {\n kind: 'font-weight',\n name: 'Weight',\n description: 'Weight of the range, from the faces its family has.',\n default: undefined,\n },\n fontSize: { kind: 'number', name: 'Size', description: 'Type size.', min: 1, step: 1, default: 16 },\n letterSpacing: {\n kind: 'number',\n name: 'Tracking',\n // The typographic term, short enough for a strip; `name` stays the\n // accessible one.\n short: 'VA',\n description: 'Space added between characters.',\n step: 0.1,\n default: 0,\n },\n baselineShift: {\n kind: 'number',\n name: 'Baseline shift',\n short: 'Shift',\n description: 'Raise or lower the range, in ems of the inherited size.',\n step: 0.001,\n unit: PERCENT,\n default: 0,\n },\n fontScale: {\n kind: 'number',\n name: 'Scale',\n description: 'Size of the range against the inherited size.',\n min: 0.01,\n step: 0.001,\n unit: PERCENT,\n default: 1,\n },\n fill: {\n kind: 'color',\n name: 'Color',\n description: 'Ink for the range.',\n alpha: true,\n default: '#000000',\n },\n },\n} satisfies ToolPrefGroup;\n"],"mappings":";;;;;AAOA,IAAMC,IAAe;CACnB,OAAO;CACP,MAAMC,EAAcF,CAAQ;CAC5B,OAAO;AACT;AAWA,SAAgBG,EAAY,IAA6B,CAAC,GAAoB;CAC5E,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAsB;EACpB,IAAI;EACJ,cAAc,CAAC,cAAc;EAC7B,UAAU;EACV,QAAQ;EACR,cAAcL;EACd,UAAU,CACR;GAAE,MAAM,EAAE,MAAM,OAAO;GAAG,UAAU;GAAU,MAAM;IAAE,QAAQ,EAAE,MAAM,OAAO;IAAG,GAAGM,EAAuBC,CAAS;GAAE;EAAE,GACvH;GAAE,MAAM;IAAE,MAAM;IAAS,QAAQ;GAAgB;GAAG,UAAU;EAAgB,CAChF;CACF,CAAC,GACH,CAACA,CAAS,CACZ;AACF;AAMA,IAAMC,IAAU;CACd,YAAY,MAAc,KAAK,MAAMC,IAAI,GAAI,IAAI;CAGjD,cAAc,MAAc,KAAK,MAAMA,IAAI,GAAI,IAAI;CACnD,QAAQ;AACV,GAGMC,KAAQ,GAAc,OACzB;CACC,MAAM;CACN;CACA,aAAa,GAAGC,EAAK;CACrB;CACA,SAAS;CACT,MAAM;CACN,SAAS;AACX;AAWF,EAAY,UAAU;CACpB,MAAM;CACN,aAAa;CACb,UAAU;EACR,MAAMD,EAAK,QAAQ,MAAM;EACzB,QAAQA,EAAK,UAAU,QAAQ;EAC/B,WAAWA,EAAK,aAAa,WAAW;EACxC,eAAeA,EAAK,iBAAiB,eAAe;EACpD,UAAUA,EAAK,YAAY,UAAU;EAGrC,QAAQ;GACN,MAAM;GACN,MAAM;GACN,aAAa;GACb,SAAS;GACT,WAAW;GACX,SAAS,KAAA;GACT,SAAS,CACP;IAAE,OAAO;IAAS,OAAO;IAAe,MAAM;GAAc,GAC5D;IAAE,OAAO;IAAO,OAAO;IAAa,MAAM;GAAY,CACxD;EACF;EACA,eAAe;GACb,MAAM;GACN,MAAM;GACN,aAAa;GACb,SAAS;GACT,SAAS;GACT,SAAS;IAAC;KAAE,OAAO;KAAQ,OAAO;KAAQ,OAAO;IAAI;IAAG;KAAE,OAAO;KAAa,OAAO;KAAa,OAAO;IAAK;IAAG;KAAE,OAAO;KAAa,OAAO;KAAa,OAAO;IAAK;IAAG;KAAE,OAAO;KAAc,OAAO;KAAc,OAAO;IAAK;GAAC;EACrO;EACA,iBAAiB;GACf,MAAM;GACN,MAAM;GACN,aAAa;GACb,SAAS;GACT,SAAS;GACT,SAAS,CAAC;IAAE,OAAO;IAAU,OAAO;IAAU,OAAO;GAAI,GAAG;IAAE,OAAO;IAAc,OAAO;IAAc,OAAO;GAAK,CAAC;EACvH;EACA,YAAY;GACV,MAAM;GACN,MAAM;GACN,aAAa;GACb,SAAS,KAAA;EACX;EAGA,YAAY;GACV,MAAM;GACN,MAAM;GACN,aAAa;GACb,SAAS,KAAA;EACX;EACA,UAAU;GAAE,MAAM;GAAU,MAAM;GAAQ,aAAa;GAAc,KAAK;GAAG,MAAM;GAAG,SAAS;EAAG;EAClG,eAAe;GACb,MAAM;GACN,MAAM;GAGN,OAAO;GACP,aAAa;GACb,MAAM;GACN,SAAS;EACX;EACA,eAAe;GACb,MAAM;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;GACN,MAAMF;GACN,SAAS;EACX;EACA,WAAW;GACT,MAAM;GACN,MAAM;GACN,aAAa;GACb,KAAK;GACL,MAAM;GACN,MAAMA;GACN,SAAS;EACX;EACA,MAAM;GACJ,MAAM;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;CACF;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineTool as e } from "@weasel-js/routing";
|
|
2
|
+
import { useTools as t } from "@weasel-js/routing/react";
|
|
3
|
+
//#region src/tools/overlayBinding.ts
|
|
4
|
+
var n = t;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { e as defineTool, n as useTools };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=overlayBinding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayBinding.js","names":["useTools","routingUseTools","useTools$1","useTools","defineTool"],"sources":["../../src/tools/overlayBinding.ts"],"sourcesContent":["/**\n * The routing types that carry an overlay, bound to the kit's `RenderLayer`.\n *\n * `@weasel-js/routing` never reads an overlay — it collects the live ones and\n * hands them back in scope order — so it leaves the element type open. What a\n * weasel canvas draws is a `RenderLayer`, and every kit call site should see\n * that rather than `unknown`, so core binds the parameter once, here, and\n * re-exports these names under the ones they have always had.\n */\nimport type { RenderLayer } from 'core/layers/render';\nimport { useTools as routingUseTools, useContributions as routingUseContributions } from '@weasel-js/routing/react';\nimport type {\n Contribution as RoutingContribution,\n ContributionChrome as RoutingContributionChrome,\n Tool as RoutingTool,\n ToolDef as RoutingToolDef,\n AnyToolOf,\n} from '@weasel-js/routing';\nimport type {\n ToolsApi as RoutingToolsApi,\n UseToolsOptions as RoutingUseToolsOptions,\n ContributionsApi as RoutingContributionsApi,\n UseContributionsOptions as RoutingUseContributionsOptions,\n} from '@weasel-js/routing/react';\n\n/** What a canvas overlay is, at this layer. */\nexport type Overlay = RenderLayer<unknown>;\n\ndeclare module '@weasel-js/routing' {\n interface OverlaySchema { overlay: RenderLayer<unknown> }\n}\n\n/** Routing's `Contribution`, with overlays typed as `RenderLayer`. */\nexport type Contribution = RoutingContribution<Overlay>;\n/** Routing's `ContributionChrome`, with overlays typed as `RenderLayer`. */\nexport type ContributionChrome = RoutingContributionChrome<Overlay>;\n/** Routing's `Tool`, with overlays typed as `RenderLayer`. */\nexport type Tool<TScratch = unknown> = RoutingTool<TScratch, Overlay>;\n/** A `Tool` of any scratch type: the element type for a list of mixed tools. */\nexport type AnyTool = AnyToolOf<Overlay>;\n/** Routing's `ToolDef` (what `defineTool` takes), with overlays typed as `RenderLayer`. */\nexport type ToolDef<TScratch = void> = RoutingToolDef<TScratch, Overlay>;\n/** Routing's `ToolsApi`, with overlays typed as `RenderLayer`. */\nexport type ToolsApi = RoutingToolsApi<Overlay>;\n/** Routing's `UseToolsOptions`, with overlays typed as `RenderLayer`. */\nexport type UseToolsOptions = RoutingUseToolsOptions<Overlay>;\nexport type ContributionsApi = RoutingContributionsApi<Overlay>;\nexport type UseContributionsOptions = RoutingUseContributionsOptions<Overlay>;\n\n// Routing's own authoring functions: the `OverlaySchema` merge above makes\n// their overlay default `Overlay`, so there is one `defineTool`, not a wrapper.\nexport { defineTool } from '@weasel-js/routing';\n/** Routing's `useTools`, typed for `RenderLayer` overlays. */\nexport const useTools: (opts: UseToolsOptions) => ToolsApi = routingUseTools;\nexport const useContributions: (opts: UseContributionsOptions) => ContributionsApi =\n routingUseContributions;\n"],"mappings":";;;AAqDA,IAAaA,IAAgDC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { formatUnit as e, unitScale as t } from "@weasel-js/quantity";
|
|
2
|
+
//#region src/tools/prefs.ts
|
|
3
|
+
function n(n, r, i) {
|
|
4
|
+
let a;
|
|
5
|
+
try {
|
|
6
|
+
a = t(n, r);
|
|
7
|
+
} catch (e) {
|
|
8
|
+
throw Error(`prefUnit: ${e instanceof Error ? e.message : String(e)}`);
|
|
9
|
+
}
|
|
10
|
+
let o = i?.precision === void 0 ? void 0 : 10 ** i.precision, s = i?.suffix ?? r, c = { [s]: 1 };
|
|
11
|
+
for (let e of Object.keys(n.units)) {
|
|
12
|
+
let r = t(n, e), i = r.factor / a.factor, o = (r.offset - a.offset) / a.factor;
|
|
13
|
+
c[e] = o === 0 ? i : {
|
|
14
|
+
factor: i,
|
|
15
|
+
offset: o
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
toDisplay: (e) => {
|
|
20
|
+
let t = (e - a.offset) / a.factor;
|
|
21
|
+
return o === void 0 ? t : Math.round(t * o) / o;
|
|
22
|
+
},
|
|
23
|
+
fromDisplay: (e) => e * a.factor + a.offset,
|
|
24
|
+
suffix: s,
|
|
25
|
+
accepts: c,
|
|
26
|
+
format: (t) => `${e(t, r, n, {
|
|
27
|
+
precision: i?.precision ?? 2,
|
|
28
|
+
suffix: !1
|
|
29
|
+
})}${s}`
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var r = {
|
|
33
|
+
number: !0,
|
|
34
|
+
boolean: !0,
|
|
35
|
+
string: !0,
|
|
36
|
+
enum: !0,
|
|
37
|
+
color: !0,
|
|
38
|
+
paint: !0,
|
|
39
|
+
object: !0
|
|
40
|
+
};
|
|
41
|
+
function i(e) {
|
|
42
|
+
return Object.hasOwn(r, e.kind);
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { r as TOOL_PREF_KINDS, i as isBuiltinToolPref, n as prefUnit };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=prefs.js.map
|