@weasel-js/core 1.9.3 → 1.9.4
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 +356 -0
- package/README.md +2 -2
- package/dist/WeaselProvider.js +5 -5
- package/dist/affordances/composeAffordanceLayer.js +10 -20
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +25 -17
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +27 -20
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/rotationHandle.js +18 -18
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/momentum.js +93 -55
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/loop.js +10 -12
- package/dist/animation/loop.js.map +1 -1
- package/dist/animation/reflow.js +8 -8
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/stagger.js +64 -56
- package/dist/animation/stagger.js.map +1 -1
- package/dist/animation/timeline/booking.js +62 -54
- package/dist/animation/timeline/booking.js.map +1 -1
- package/dist/animation/timeline/createTimeline.js +85 -76
- package/dist/animation/timeline/createTimeline.js.map +1 -1
- package/dist/animation/timeline/sampleTrack.js +13 -5
- package/dist/animation/timeline/sampleTrack.js.map +1 -1
- package/dist/animation/useAnimator.js +45 -35
- package/dist/animation/useAnimator.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +31 -24
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +28 -26
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js +13 -0
- package/dist/animation/wrappers/instantPose.js.map +1 -0
- package/dist/{poseDescriptor-D-OH-tu5.d.ts → autoPoseDescriptor-Ct7yqivU.d.ts} +28 -3
- package/dist/barrel/chrome.js +16 -0
- package/dist/barrel/input.js +19 -0
- package/dist/barrel/interactions.js +42 -0
- package/dist/barrel/paint.js +18 -0
- package/dist/barrel/paths.js +19 -0
- package/dist/barrel/renderer.js +20 -0
- package/dist/barrel/routing.js +51 -0
- package/dist/barrel/text.js +18 -0
- package/dist/barrel/viewport.js +52 -0
- package/dist/builtins-DPcdghtB.d.ts +1223 -0
- package/dist/canvas/Canvas.js +363 -448
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +164 -165
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +37 -32
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +49 -43
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/MinimapCanvas.js +26 -25
- package/dist/canvas/MinimapCanvas.js.map +1 -1
- package/dist/canvas/NodeShape.js +59 -377
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js +50 -47
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +167 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +13 -13
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +67 -0
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/coordTrace.js +10 -0
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +112 -70
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +1 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js +12 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +29 -28
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
- package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
- package/dist/canvas/SceneCanvas/props.js +38 -0
- package/dist/canvas/SceneCanvas/props.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +46 -48
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +33 -33
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +534 -788
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +45 -43
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +91 -0
- package/dist/canvas/buildSceneLayer.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +16 -19
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +68 -52
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/deps/changes.js +13 -0
- package/dist/canvas/deps/changes.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +28 -28
- package/dist/canvas/deps/insert.js +119 -91
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/slice.js +46 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +10 -9
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/derivedPath.js +46 -23
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +7 -7
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/kitRequirements.js +2 -2
- package/dist/canvas/kitRequirements.js.map +1 -1
- package/dist/canvas/layerOrder.js +13 -6
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/minimapMath.js +12 -10
- package/dist/canvas/minimapMath.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +34 -0
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/imagePainter.js +87 -0
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/memo.js +9 -0
- package/dist/canvas/nodeShapes/memo.js.map +1 -0
- package/dist/canvas/nodeShapes/nodePaint.js +57 -0
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
- package/dist/canvas/nodeShapes/pathPainter.js +38 -0
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/poseBox.js +20 -0
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/shapePainter.js +72 -0
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/textPainter.js +55 -0
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +10 -11
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/canvas/pickWalk.js +52 -63
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/poseRotation.js +11 -23
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/renderDebugSnapshot.js +5 -5
- package/dist/canvas/renderSceneToPixels.js +3 -1
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +66 -148
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +112 -0
- package/dist/canvas/sceneClipboard.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +39 -40
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/useCanvasRenderer.js +14 -6
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasView.js +58 -0
- package/dist/canvas/useCanvasView.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +35 -26
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +21 -0
- package/dist/canvas/useSceneLayerList.js.map +1 -0
- package/dist/clipboard.d.ts +10 -6
- package/dist/clone.d.ts +4 -3
- package/dist/core/adapters/arrayAdapter.js +48 -39
- package/dist/core/adapters/arrayAdapter.js.map +1 -1
- package/dist/core/device/index.js +5 -4
- package/dist/core/device/useDeviceProfile.js +38 -44
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/device/watchDevicePixelRatio.js +17 -0
- package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
- package/dist/core/fillInPoseFrame.js.map +1 -1
- package/dist/core/geometry/poseDescriptor.js +21 -19
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/poseFrame.js +44 -0
- package/dist/core/geometry/poseFrame.js.map +1 -0
- package/dist/core/geometry/poseRotation.js.map +1 -1
- package/dist/core/geometry/regionHit.js +9 -10
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/unionBounds.js +31 -29
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +2 -11
- package/dist/core/ops/arrange.js +1 -0
- package/dist/core/ops/arrange.js.map +1 -1
- package/dist/core/ops/create.js +10 -5
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/delete.js +12 -24
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +43 -40
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +34 -0
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -0
- package/dist/core/paintKinds.js +5 -5
- package/dist/core/paintKinds.js.map +1 -1
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/appliedLog.js +37 -0
- package/dist/core/scene/appliedLog.js.map +1 -0
- package/dist/core/scene/arrivalWindow.js +101 -0
- package/dist/core/scene/arrivalWindow.js.map +1 -0
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/historyFacade.js +84 -0
- package/dist/core/scene/historyFacade.js.map +1 -0
- package/dist/core/scene/kitOps.js +173 -0
- package/dist/core/scene/kitOps.js.map +1 -0
- package/dist/core/scene/layerStack.js +38 -0
- package/dist/core/scene/layerStack.js.map +1 -0
- package/dist/core/scene/lockGuard.js +37 -0
- package/dist/core/scene/lockGuard.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +5 -6
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +45 -19
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +126 -0
- package/dist/core/scene/nodeStore.js.map +1 -0
- package/dist/core/scene/pickability.js +6 -0
- package/dist/core/scene/pickability.js.map +1 -0
- package/dist/core/scene/poseFeed.js +38 -38
- package/dist/core/scene/poseFeed.js.map +1 -1
- package/dist/core/scene/poseOverrides.js +34 -38
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/renderOrder.js +84 -0
- package/dist/core/scene/renderOrder.js.map +1 -0
- package/dist/core/scene/scene.js +289 -866
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/serialization.js +68 -0
- package/dist/core/scene/serialization.js.map +1 -0
- package/dist/core/scene/treeOrder.js +13 -0
- package/dist/core/scene/treeOrder.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/viewport/meanScale.js +1 -1
- package/dist/core/viewport/meanScale.js.map +1 -1
- package/dist/core/viewport/view.js +12 -12
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/zoomBounds.js +10 -8
- package/dist/core/viewport/zoomBounds.js.map +1 -1
- package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-CtCb8a3G.d.ts} +1 -1
- package/dist/debug/createDebugOverlayLayer.js +14 -14
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/flag.js +2 -41
- package/dist/features/chrome-caps/useHoverTracking.js +22 -17
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/focus/gateLayer.js +3 -4
- package/dist/features/focus/gateLayer.js.map +1 -1
- package/dist/features/images/imageCache.js +19 -9
- package/dist/features/images/imageCache.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +14 -11
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/index.js +1 -1
- package/dist/features/ingestion/registerKitHandlers.js +7 -7
- package/dist/features/ingestion/weaselJsonHandler.js +17 -14
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/meshPaint/lazyKind.js +201 -35
- package/dist/features/meshPaint/lazyKind.js.map +1 -1
- package/dist/features/meshPaint/meshPaint.js +82 -79
- package/dist/features/meshPaint/meshPaint.js.map +1 -1
- package/dist/features/minimap/createMinimapContribution.js +42 -42
- package/dist/features/minimap/layers.js +44 -62
- package/dist/features/minimap/layers.js.map +1 -1
- package/dist/features/parallax/createParallaxPlane.js +10 -14
- package/dist/features/parallax/createParallaxPlane.js.map +1 -1
- package/dist/features/paths/anchorEdits.js +19 -8
- package/dist/features/paths/anchorEdits.js.map +1 -1
- package/dist/features/paths/anchors.js +31 -26
- package/dist/features/paths/anchors.js.map +1 -1
- package/dist/features/paths/booleans.js +2 -2
- package/dist/features/paths/index.js +13 -11
- package/dist/features/paths/markerCommands.js +37 -36
- package/dist/features/paths/markerCommands.js.map +1 -1
- package/dist/features/paths/pathInWorld.js +19 -19
- package/dist/features/paths/pathInWorld.js.map +1 -1
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/strokeToPath.js +40 -0
- package/dist/features/paths/strokeToPath.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -1
- package/dist/features/patterns/commandPaint.js +18 -0
- package/dist/features/patterns/commandPaint.js.map +1 -0
- package/dist/features/patterns/index.js +5 -17
- package/dist/features/patterns/index.js.map +1 -1
- package/dist/features/patterns/rasterizeTile.js +17 -0
- package/dist/features/patterns/rasterizeTile.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +52 -44
- package/dist/features/patterns/resolveSpec.js.map +1 -1
- package/dist/features/poseRun/usePoseRun.js +8 -3
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/SelectionContext.js +5 -0
- package/dist/features/selection/SelectionContext.js.map +1 -1
- package/dist/features/selection/overlay.js +18 -18
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/domOffsets.js +82 -0
- package/dist/features/text/domOffsets.js.map +1 -0
- package/dist/features/text/domRuns.js +103 -131
- package/dist/features/text/domRuns.js.map +1 -1
- package/dist/features/text/hitTest.js +5 -2
- package/dist/features/text/hitTest.js.map +1 -1
- package/dist/features/text/isTextData.js +8 -0
- package/dist/features/text/isTextData.js.map +1 -0
- package/dist/features/text/overlayDirection.js +15 -0
- package/dist/features/text/overlayDirection.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +32 -34
- package/dist/features/text/runs/rangeStyle.js.map +1 -1
- package/dist/features/text/textCommand.js +34 -33
- package/dist/features/text/textCommand.js.map +1 -1
- package/dist/features/text/textToPath.js +40 -40
- package/dist/features/text/textToPath.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +76 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/text/useTextEdit.js +184 -160
- package/dist/features/text/useTextEdit.js.map +1 -1
- package/dist/features/tiling/createTiledLayer.js +24 -22
- package/dist/features/tiling/createTiledLayer.js.map +1 -1
- package/dist/index.d.ts +11033 -7749
- package/dist/index.js +316 -309
- package/dist/input/keyState.js +42 -43
- package/dist/input/keyState.js.map +1 -1
- package/dist/input/useKeyModifiers.js +11 -0
- package/dist/input/useKeyModifiers.js.map +1 -0
- package/dist/interactions/actions/align/align.js +8 -8
- package/dist/interactions/actions/clipboard/clipboardOps.js +34 -32
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -1
- package/dist/interactions/actions/defaultCommitAdapter.js +20 -18
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/align.js +9 -10
- package/dist/interactions/actions/defaults/align.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +59 -81
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js +35 -38
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/clipboard.js +26 -10
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -1
- package/dist/interactions/actions/defaults/clone.js +44 -60
- package/dist/interactions/actions/defaults/clone.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +40 -0
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +14 -13
- package/dist/interactions/actions/defaults/distribute.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +17 -57
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/editAnchors.js +18 -18
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/flip.js +52 -46
- package/dist/interactions/actions/defaults/flip.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +43 -48
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +35 -33
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insert.js +50 -51
- package/dist/interactions/actions/defaults/insert.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +7 -7
- package/dist/interactions/actions/defaults/lassoSelect.js +67 -70
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/move.js +267 -249
- package/dist/interactions/actions/defaults/move.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +40 -68
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
- package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +2 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/resize.js +104 -98
- package/dist/interactions/actions/defaults/resize.js.map +1 -1
- package/dist/interactions/actions/defaults/rotate.js +111 -110
- package/dist/interactions/actions/defaults/rotate.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +7 -7
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -4
- package/dist/interactions/actions/defaults/setStroke.js +12 -12
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
- package/dist/interactions/actions/defaults/sliceOps.js +19 -19
- package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/geometry.js +28 -23
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/helpers.js +30 -17
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/hitSelection.js +8 -0
- package/dist/interactions/actions/hitSelection.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +32 -21
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/gestureAdapter.js +32 -15
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +33 -0
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +18 -18
- package/dist/interactions/actions/poseDescriptorDep.js +16 -4
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +11 -6
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/previewOverrides.js +5 -5
- package/dist/interactions/actions/previewOverrides.js.map +1 -1
- package/dist/interactions/actions/selectionSubtree.js +69 -0
- package/dist/interactions/actions/selectionSubtree.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +66 -62
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
- package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +8 -6
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/{math-Drrw4ewZ.d.ts → math-J-ACHyEg.d.ts} +1 -2
- package/dist/math.d.ts +2 -3
- package/dist/move.d.ts +12 -11
- package/dist/{originProjection-DEklpDc_.d.ts → originProjection-gHnOup4e.d.ts} +1 -1
- package/dist/{registerProgram-BMZRDgrh.d.ts → registerProgram-T9S_PfAX.d.ts} +18 -7
- package/dist/renderer/DrawCommand.js.map +1 -1
- package/dist/renderer/WeaselRenderer.js +75 -73
- package/dist/renderer/WeaselRenderer.js.map +1 -1
- package/dist/renderer/cache/GLImageCache.js +15 -5
- package/dist/renderer/cache/GLImageCache.js.map +1 -1
- package/dist/renderer/cache/GLMeshCache.js +23 -23
- package/dist/renderer/cache/GLMeshCache.js.map +1 -1
- package/dist/renderer/cache/GLTextureCache.js +18 -1
- package/dist/renderer/cache/GLTextureCache.js.map +1 -1
- package/dist/renderer/cache/cache.js.map +1 -1
- package/dist/renderer/cache/markerCommandCache.js.map +1 -1
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -1
- package/dist/renderer/cullDrawCommands.js +11 -11
- package/dist/renderer/draw/batch.js +133 -0
- package/dist/renderer/draw/batch.js.map +1 -0
- package/dist/renderer/draw/clip.js +89 -0
- package/dist/renderer/draw/clip.js.map +1 -0
- package/dist/renderer/draw/customShader.js +230 -0
- package/dist/renderer/draw/customShader.js.map +1 -0
- package/dist/renderer/draw/drawTriangles.js +8 -0
- package/dist/renderer/draw/drawTriangles.js.map +1 -0
- package/dist/renderer/draw/effects.js +28 -0
- package/dist/renderer/draw/effects.js.map +1 -0
- package/dist/renderer/draw/flushBatch.js +35 -0
- package/dist/renderer/draw/flushBatch.js.map +1 -0
- package/dist/renderer/draw/gradient.js +90 -0
- package/dist/renderer/draw/gradient.js.map +1 -0
- package/dist/renderer/draw/image.js +38 -0
- package/dist/renderer/draw/image.js.map +1 -0
- package/dist/renderer/draw/mesh.js +16 -0
- package/dist/renderer/draw/mesh.js.map +1 -0
- package/dist/renderer/draw/paintBind.js +70 -0
- package/dist/renderer/draw/paintBind.js.map +1 -0
- package/dist/renderer/draw/pathPaint.js +142 -0
- package/dist/renderer/draw/pathPaint.js.map +1 -0
- package/dist/renderer/draw/scratchPass.js +83 -0
- package/dist/renderer/draw/scratchPass.js.map +1 -0
- package/dist/renderer/draw/stencil.js +28 -0
- package/dist/renderer/draw/stencil.js.map +1 -0
- package/dist/renderer/draw/text.js +167 -0
- package/dist/renderer/draw/text.js.map +1 -0
- package/dist/renderer/draw/uniforms.js +77 -0
- package/dist/renderer/draw/uniforms.js.map +1 -0
- package/dist/renderer/draw.js +60 -1116
- package/dist/renderer/draw.js.map +1 -1
- package/dist/renderer/effects/EffectTargets.js +3 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -1
- package/dist/renderer/effects/composite.js +7 -5
- package/dist/renderer/effects/composite.js.map +1 -1
- package/dist/renderer/index.js +18 -17
- package/dist/renderer/math/color.js +63 -83
- package/dist/renderer/math/color.js.map +1 -1
- package/dist/renderer/math/mat3.js +15 -11
- package/dist/renderer/math/mat3.js.map +1 -1
- package/dist/renderer/math/viewToMat3.js +1 -1
- package/dist/renderer/math/viewToMat3.js.map +1 -1
- package/dist/renderer/shaders/ShaderProgram.js +13 -13
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -1
- package/dist/renderer/shaders/glyphPaint.js +3 -3
- package/dist/renderer/shaders/glyphPaint.js.map +1 -1
- package/dist/renderer/shaders/gradFill.js +2 -1
- package/dist/renderer/shaders/gradFill.js.map +1 -1
- package/dist/renderer/shaders/pathFill.js +2 -1
- package/dist/renderer/shaders/pathFill.js.map +1 -1
- package/dist/renderer/shaders/patternFill.js +2 -1
- package/dist/renderer/shaders/patternFill.js.map +1 -1
- package/dist/renderer/shaders/registerProgram.js.map +1 -1
- package/dist/renderer/strokeLengths.js.map +1 -1
- package/dist/renderer/textures/registerTexture.js +25 -5
- package/dist/renderer/textures/registerTexture.js.map +1 -1
- package/dist/renderer.d.ts +16 -15
- package/dist/renderer.js +17 -16
- package/dist/resize.d.ts +5 -6
- package/dist/resize.js +5 -5
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js +12 -6
- package/dist/test-hook/install.js.map +1 -1
- package/dist/{test-seams-CuIxe0xY.d.ts → test-seams-DM2B87-g.d.ts} +4 -4
- package/dist/test-seams.d.ts +2 -2
- package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js +1 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js +11 -11
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +1 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +153 -103
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +1 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +24 -23
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +51 -48
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js +17 -0
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +49 -54
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +22 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +1 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/useKeybindings.js +14 -30
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-B_9g6hMM.d.ts → types-B4iJRHC3.d.ts} +5 -1
- package/dist/{types-A37hYkeR.d.ts → types-k-5Oqh-U.d.ts} +31 -7
- package/dist/util/color.js +3 -3
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +20 -18
- package/dist/autoPoseDescriptor-vCdt55xm.d.ts +0 -27
- package/dist/builtins-C-VgUlWI.d.ts +0 -4514
- package/dist/core/isPlainObject.js.map +0 -1
- package/dist/debug/flag.js.map +0 -1
- package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
- package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
- package/dist/renderer/shaders/imageFill.js +0 -14
- package/dist/renderer/shaders/imageFill.js.map +0 -1
- package/dist/tools/prefs.js +0 -62
- package/dist/tools/prefs.js.map +0 -1
|
@@ -2,32 +2,33 @@ import { defineTool as e } from "../../overlayBinding.js";
|
|
|
2
2
|
import t from "../../../icons/StarIcon.js";
|
|
3
3
|
import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
|
|
4
4
|
import { useCallback as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useLatest as s } from "@weasel-js/react";
|
|
6
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
7
|
+
import { cursorFor as l } from "@weasel-js/cursor";
|
|
7
8
|
//#region src/tools/builtin/star/useStarTool.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let { points:
|
|
9
|
+
var u = 3, d = 32;
|
|
10
|
+
function f(f = {}) {
|
|
11
|
+
let { points: p = 5, innerRatio: m = .5, label: h = "Star", behaviors: g } = f, _ = a(p), v = s(m), [, y] = o(0), b = r(() => y((e) => e + 1), []), x = i(() => ({
|
|
11
12
|
id: "star.adjustPoints",
|
|
12
13
|
label: "Star — adjust points",
|
|
13
14
|
invoker: {
|
|
14
15
|
timing: "immediate",
|
|
15
16
|
run: (e, t) => {
|
|
16
17
|
let n = t, r = n?.delta ?? (n?.deltaY !== void 0 && n.deltaY !== 0 ? n.deltaY > 0 ? 1 : -1 : 0);
|
|
17
|
-
r !== 0 && (
|
|
18
|
+
r !== 0 && (_.current = r > 0 ? Math.min(d, _.current + 1) : Math.max(u, _.current - 1), b());
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
}), [
|
|
21
|
+
}), [b]);
|
|
21
22
|
return i(() => e({
|
|
22
23
|
id: "star",
|
|
23
24
|
capabilities: ["creates-shapes"],
|
|
24
25
|
hookName: "useStarTool",
|
|
25
|
-
cursor:
|
|
26
|
-
actions: [
|
|
26
|
+
cursor: l("crosshairStar", { fallback: "crosshair" }),
|
|
27
|
+
actions: [x],
|
|
27
28
|
presentation: {
|
|
28
|
-
label:
|
|
29
|
+
label: h,
|
|
29
30
|
group: "shape",
|
|
30
|
-
icon: /* @__PURE__ */
|
|
31
|
+
icon: /* @__PURE__ */ c(t, {})
|
|
31
32
|
},
|
|
32
33
|
bindings: [
|
|
33
34
|
{
|
|
@@ -36,10 +37,10 @@ function d(d = {}) {
|
|
|
36
37
|
opts: {
|
|
37
38
|
params: () => ({
|
|
38
39
|
kind: "star",
|
|
39
|
-
points:
|
|
40
|
-
innerRadiusRatio:
|
|
40
|
+
points: _.current,
|
|
41
|
+
innerRadiusRatio: v.current
|
|
41
42
|
}),
|
|
42
|
-
...n(
|
|
43
|
+
...n(g)
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
{
|
|
@@ -74,9 +75,14 @@ function d(d = {}) {
|
|
|
74
75
|
opts: { params: { delta: -1 } }
|
|
75
76
|
}
|
|
76
77
|
]
|
|
77
|
-
}), [
|
|
78
|
+
}), [
|
|
79
|
+
x,
|
|
80
|
+
g,
|
|
81
|
+
h,
|
|
82
|
+
v
|
|
83
|
+
]);
|
|
78
84
|
}
|
|
79
85
|
//#endregion
|
|
80
|
-
export {
|
|
86
|
+
export { f as useStarTool };
|
|
81
87
|
|
|
82
88
|
//# sourceMappingURL=useStarTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStarTool.js","names":["StarIcon","MIN_POINTS","MAX_POINTS","useStarTool","initialPoints","
|
|
1
|
+
{"version":3,"file":"useStarTool.js","names":["StarIcon","MIN_POINTS","MAX_POINTS","useStarTool","initialPoints","options","pointsRef","useRef","innerRatioRef","useLatest","innerRatio","setPointsTick","useState","bumpPoints","useCallback","n","adjustPointsAction","useMemo","p","params","step","defineTool","cursorFor","insertBindingBehaviors","behaviors","label"],"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 { useLatest } from '@weasel-js/react';\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. Consumers wanting\n * per-instance ratios should override the `insert` 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 = 0.5,\n label = 'Star',\n behaviors,\n } = options;\n const pointsRef = useRef(initialPoints);\n const innerRatioRef = useLatest(innerRatio);\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,\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, label, innerRatioRef],\n );\n}\n"],"mappings":";;;;;;;;AAwBA,IAAMC,IAAa,GACbC,IAAa;AAYnB,SAAgBC,EACd,IAA8B,CAAC,GACnB;CACZ,IAAM,EACJ,QAAQC,IAAgB,GACxB,gBAAa,IACb,WAAQ,QACR,iBACEC,GACEC,IAAYC,EAAOH,CAAa,GAChCI,IAAgBC,EAAUC,CAAU,GACpC,GAAGC,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,IAAIlB,GAAYI,EAAU,UAAU,CAAC,IAC1C,KAAK,IAAIL,GAAYK,EAAU,UAAU,CAAC,GAC9CO,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;GACA,OAAO;GACP,MAAM,kBAAChB,GAAD,CAAW,CAAA;EACnB;EACA,UAAU;GAGR;IACE,MAAM,EAAE,MAAM,OAAO;IACrB,UAAU;IACV,MAAM;KACJ,eAAe;MACb,MAAM;MACN,QAAQM,EAAU;MAClB,kBAAkBE,EAAc;KAClC;KACA,GAAGe,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;EAACR;EAAoBQ;EAAWC;EAAOjB;CAAa,CACtD;AACF"}
|
|
@@ -1 +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
|
|
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 type { PrefGroup } from '@weasel-js/prefs';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\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 keybinding: { key: 'T' },\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 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: {\n ...flag('Bold', 'bold'),\n pair: { with: ['italic', 'underline', 'strikethrough', 'overline'], label: 'Character style' },\n },\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 PrefGroup;\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,YAAY,EAAE,KAAK,IAAI;EACvB,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,SAAS;AACX;AAWF,EAAY,UAAU;CACpB,MAAM;CACN,aAAa;CACb,UAAU;EACR,MAAM;GACJ,GAAGD,EAAK,QAAQ,MAAM;GACtB,MAAM;IAAE,MAAM;KAAC;KAAU;KAAa;KAAiB;IAAU;IAAG,OAAO;GAAkB;EAC/F;EACA,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,CAAC,GAAG;IAAE;IAAG;KAAE,OAAO;KAAa,OAAO;KAAa,OAAO,CAAC,IAAI;IAAE;IAAG;KAAE,OAAO;KAAa,OAAO;KAAa,OAAO,CAAC,IAAI;IAAE;IAAG;KAAE,OAAO;KAAc,OAAO;KAAc,OAAO,CAAC,IAAI;IAAE;GAAC;EAC7O;EACA,iBAAiB;GACf,MAAM;GACN,MAAM;GACN,aAAa;GACb,SAAS;GACT,SAAS;GACT,SAAS,CAAC;IAAE,OAAO;IAAU,OAAO;IAAU,OAAO,CAAC,GAAG;GAAE,GAAG;IAAE,OAAO;IAAc,OAAO;IAAc,OAAO,CAAC,IAAI;GAAE,CAAC;EAC3H;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,CAAC,IAAI;GACZ,aAAa;GACb,MAAM;GACN,SAAS;EACX;EACA,eAAe;GACb,MAAM;GACN,MAAM;GACN,OAAO,CAAC,OAAO;GACf,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"}
|
|
@@ -4,29 +4,12 @@ import { useEffect as r, useRef as i } from "react";
|
|
|
4
4
|
import { useLatest as a } from "@weasel-js/react";
|
|
5
5
|
import { useActionsRegistry as o } from "@weasel-js/routing/react";
|
|
6
6
|
//#region src/tools/useKeybindings.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
rect: { key: "R" },
|
|
10
|
-
ellipse: { key: "E" },
|
|
11
|
-
line: { key: "\\" },
|
|
12
|
-
polygon: { key: "G" },
|
|
13
|
-
pencil: { key: "N" },
|
|
14
|
-
text: { key: "T" },
|
|
15
|
-
hand: { key: "H" },
|
|
16
|
-
pen: { key: "P" }
|
|
17
|
-
};
|
|
18
|
-
function c(c, l = {}) {
|
|
19
|
-
let u = a(c), d = a(l), f = i(c.active), p = o();
|
|
7
|
+
function s(s, c = {}) {
|
|
8
|
+
let l = a(s), u = a(c), d = i(s.active), f = o(), { disable: p = !1 } = c;
|
|
20
9
|
r(() => {
|
|
21
|
-
if (
|
|
22
|
-
let r = [];
|
|
23
|
-
for (let [e, t] of Object.entries(s)) u.current.has(e) && r.push({
|
|
24
|
-
toolId: e,
|
|
25
|
-
keyOpts: t
|
|
26
|
-
});
|
|
27
|
-
let i = u.current.registry;
|
|
10
|
+
if (p || !f || Object.keys(l.current.registry).length === 0) return;
|
|
11
|
+
let r = [], i = l.current.registry;
|
|
28
12
|
for (let e in i) {
|
|
29
|
-
if (e in s) continue;
|
|
30
13
|
let t = i[e].keybinding;
|
|
31
14
|
if (!t) continue;
|
|
32
15
|
let n = typeof t.key == "string" ? [t.key] : t.key;
|
|
@@ -41,26 +24,27 @@ function c(c, l = {}) {
|
|
|
41
24
|
let a = [];
|
|
42
25
|
if (r.length > 0) {
|
|
43
26
|
let n = e(r);
|
|
44
|
-
a.push(
|
|
27
|
+
a.push(f.register(t(n, (e) => u.current.isToolEligible?.(e) ?? !0)));
|
|
45
28
|
}
|
|
46
|
-
return a.push(
|
|
47
|
-
let e =
|
|
29
|
+
return a.push(f.register(n(() => {
|
|
30
|
+
let e = u.current.defaultTool;
|
|
48
31
|
if (e === null) return null;
|
|
49
|
-
let t = e ??
|
|
32
|
+
let t = e ?? d.current;
|
|
50
33
|
if (!t) return null;
|
|
51
|
-
let n =
|
|
34
|
+
let n = l.current;
|
|
52
35
|
return !n.has(t) || n.active === t ? null : t;
|
|
53
36
|
}))), () => {
|
|
54
37
|
for (let e of a) e();
|
|
55
38
|
};
|
|
56
39
|
}, [
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
f,
|
|
41
|
+
s,
|
|
42
|
+
l,
|
|
59
43
|
u,
|
|
60
|
-
|
|
44
|
+
p
|
|
61
45
|
]);
|
|
62
46
|
}
|
|
63
47
|
//#endregion
|
|
64
|
-
export {
|
|
48
|
+
export { s as useKeybindings };
|
|
65
49
|
|
|
66
50
|
//# sourceMappingURL=useKeybindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeybindings.js","names":["
|
|
1
|
+
{"version":3,"file":"useKeybindings.js","names":["useKeybindings","toolsRef","useLatest","tools","optionsRef","options","initialActiveRef","useRef","registry","useActionsRegistry","disable","specs","allTools","toolId","binding","keys","key","unregisters","bindings","buildToolActivateBindings","makeToolActivateAction","makeToolResetToDefaultAction","opt","target","api","u"],"sources":["../../src/tools/useKeybindings.ts"],"sourcesContent":["// src/tools/useKeybindings.ts\nimport { useEffect, useRef } from 'react';\nimport { useActionsRegistry } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport {\n makeToolActivateAction,\n buildToolActivateBindings,\n type ToolActivateBindingSpec,\n} from 'interactions/actions/defaults/toolActivate';\nimport { makeToolResetToDefaultAction } from 'interactions/actions/defaults/toolResetToDefault';\nimport type { ToolsApi } from './overlayBinding';\n\n/** Options for `useKeybindings`. */\nexport interface UseKeybindingsOptions {\n /** Skip all wiring. Useful for touch apps or test isolation. */\n disable?: boolean;\n /** Tool id Escape switches to. When omitted, defaults to whatever\n * `tools.active` was when the hook first ran (i.e. the initial active\n * tool). Pass `null` to disable Escape-returns-to-default behavior. */\n defaultTool?: string | null;\n /**\n * Gate for keyboard tool activation: return false to refuse a tool the\n * active mode doesn't allow. `<SceneCanvas>` wires this from\n * its `modes` registry + each tool's `eligibility.capabilities`, using the same predicate\n * `ToolPalette` uses to grey a button out — so the grey-out becomes a\n * guarantee rather than a hint.\n *\n * Omit for consumers with no mode registry: every tool stays activatable.\n */\n isToolEligible?: (toolId: string) => boolean;\n}\n\n/** Wire the single-key tool-activation shortcuts (V, P, T, …) and Escape to\n * return to the default tool. Activation is gated on what the active mode\n * allows, so a key cannot reach a tool the palette greys out. */\nexport function useKeybindings(\n tools: ToolsApi,\n options: UseKeybindingsOptions = {},\n): void {\n const toolsRef = useLatest(tools);\n const optionsRef = useLatest(options);\n // Snapshot the initial active tool — used as the Escape target when the\n // consumer doesn't pass an explicit `defaultTool`. Captured in a ref\n // (not state) so it survives re-renders without re-syncing.\n const initialActiveRef = useRef(tools.active);\n\n // Held-key engagement is not here: a tool declares `ToolDef.hotkey` and\n // assembly registers `tool.offhand` from the declaration.\n const registry = useActionsRegistry();\n\n // --- Tool-activate: register one parametric `tool.activate` action.\n // The single descriptor carries a `defaultBinding: BoundGesture[]` with one\n // entry per tool — each entry pairs a key spec with `opts.params.toolId`.\n // The invoker reads `params.toolId` and calls `setActive`. Imperative\n // callers (palette, toolbar) reach the same effect via\n // `registry.trigger('tool.activate', { toolId })`.\n //\n // Every key comes from a `ToolDef.keybinding` in the tools registry.\n const { disable = false } = options;\n useEffect(() => {\n if (disable) return;\n if (!registry) return;\n // No tools, no tool keys: nothing to activate and nothing to return to.\n if (Object.keys(toolsRef.current.registry).length === 0) return;\n\n const specs: ToolActivateBindingSpec[] = [];\n\n const allTools = toolsRef.current.registry;\n for (const toolId in allTools) {\n const binding = allTools[toolId].keybinding;\n if (!binding) continue;\n // `KeyBinding.key` may be an array of aliases: one binding per key.\n const keys = typeof binding.key === 'string' ? [binding.key] : binding.key;\n for (const key of keys) {\n if (!key) continue;\n specs.push({ toolId, keyOpts: { ...binding, key } });\n }\n }\n\n const unregisters: Array<() => void> = [];\n\n if (specs.length > 0) {\n const bindings = buildToolActivateBindings(specs);\n unregisters.push(registry.register(makeToolActivateAction(\n bindings,\n (toolId) => optionsRef.current.isToolEligible?.(toolId) ?? true,\n )));\n }\n\n // Escape-returns-to-default. Registered here rather than in the deleted\n // document listener so it competes in the dispatcher's Escape ladder\n // instead of firing in parallel with it — see\n // `makeToolResetToDefaultAction` for the ordering and the behavior\n // change that implies.\n unregisters.push(registry.register(makeToolResetToDefaultAction(() => {\n const opt = optionsRef.current.defaultTool;\n if (opt === null) return null;\n const target = opt ?? initialActiveRef.current;\n if (!target) return null;\n const api = toolsRef.current;\n if (!api.has(target) || api.active === target) return null;\n return target;\n })));\n\n return () => { for (const u of unregisters) u(); };\n }, [registry, tools, toolsRef, optionsRef, disable]);\n}\n\n"],"mappings":";;;;;;AAmCA,SAAgBA,EACd,GACA,IAAiC,CAAC,GAC5B;CACN,IAAMC,IAAWC,EAAUC,CAAK,GAC1BC,IAAaF,EAAUG,CAAO,GAI9BC,IAAmBC,EAAOJ,EAAM,MAAM,GAItCK,IAAWC,EAAmB,GAU9B,EAAE,aAAU,OAAUJ;CAC5B,QAAgB;EAId,IAHIK,KACA,CAACF,KAED,OAAO,KAAKP,EAAS,QAAQ,QAAQ,CAAC,CAAC,WAAW,GAAG;EAEzD,IAAMU,IAAmC,CAAC,GAEpCC,IAAWX,EAAS,QAAQ;EAClC,KAAK,IAAMY,KAAUD,GAAU;GAC7B,IAAME,IAAUF,EAASC,EAAO,CAAC;GACjC,IAAI,CAACC,GAAS;GAEd,IAAMC,IAAO,OAAOD,EAAQ,OAAQ,WAAW,CAACA,EAAQ,GAAG,IAAIA,EAAQ;GACvE,KAAK,IAAME,KAAOD,GAChB,AAAKC,KACLL,EAAM,KAAK;IAAE;IAAQ,SAAS;KAAE,GAAGG;KAAS;IAAI;GAAE,CAAC;EAEvD;EAEA,IAAMG,IAAiC,CAAC;EAExC,IAAIN,EAAM,SAAS,GAAG;GACpB,IAAMO,IAAWC,EAA0BR,CAAK;GAChD,EAAY,KAAKH,EAAS,SAASY,EACjCF,IACC,MAAWd,EAAW,QAAQ,iBAAiBS,CAAM,KAAK,EAC7D,CAAC,CAAC;EACJ;EAiBA,OAVAI,EAAY,KAAKT,EAAS,SAASa,QAAmC;GACpE,IAAMC,IAAMlB,EAAW,QAAQ;GAC/B,IAAIkB,MAAQ,MAAM,OAAO;GACzB,IAAMC,IAASD,KAAOhB,EAAiB;GACvC,IAAI,CAACiB,GAAQ,OAAO;GACpB,IAAMC,IAAMvB,EAAS;GAErB,OADI,CAACuB,EAAI,IAAID,CAAM,KAAKC,EAAI,WAAWD,IAAe,OAC/CA;EACT,CAAC,CAAC,CAAC,SAEU;GAAE,KAAK,IAAME,KAAKR,GAAa,EAAE;EAAG;CACnD,GAAG;EAACT;EAAUL;EAAOF;EAAUG;EAAYM;CAAO,CAAC;AACrD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SnapTarget, P as PlaneMap, M as MoveAdapter, I as InsertAdapter } from './types-
|
|
1
|
+
import { S as SnapTarget, P as PlaneMap, M as MoveAdapter, I as InsertAdapter } from './types-k-5Oqh-U.js';
|
|
2
2
|
import { Op } from '@weasel-js/history';
|
|
3
3
|
import { Bounds, ModifierState, View, ResizeAnchor } from '@weasel-js/routing';
|
|
4
4
|
|
|
@@ -132,6 +132,10 @@ interface BehaviorResult<TPose> {
|
|
|
132
132
|
transform?: GroupTransform;
|
|
133
133
|
/** @deprecated Return `transform` instead. Legacy primary-only pose override; supported via internal shim. */
|
|
134
134
|
pose?: TPose;
|
|
135
|
+
/** Preview poses for individual dragged ids, each replacing the group
|
|
136
|
+
* transform for that id this frame. For a behavior that will commit its
|
|
137
|
+
* nodes where one translation cannot put them, such as a slot each. */
|
|
138
|
+
poses?: ReadonlyMap<string, TPose>;
|
|
135
139
|
snap?: SnapTarget<TPose> | null;
|
|
136
140
|
}
|
|
137
141
|
/** @deprecated Renamed to `BehaviorResult`. Kept as an alias for one release cycle. */
|
|
@@ -304,6 +304,31 @@ interface LayoutStrategy<TPose> {
|
|
|
304
304
|
interface ClipboardSnapshot {
|
|
305
305
|
items: unknown[];
|
|
306
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* A copied node a paste did not make, and why:
|
|
309
|
+
*
|
|
310
|
+
* - `dependency-not-copied` — it derives from the nodes in `missing`, which
|
|
311
|
+
* were not copied with it.
|
|
312
|
+
* - `derivation-not-registered` — it derives from other nodes through a
|
|
313
|
+
* function that did not survive the clipboard and is not in the scene's
|
|
314
|
+
* registry.
|
|
315
|
+
* - `container-not-pasted` — its container was left out.
|
|
316
|
+
*/
|
|
317
|
+
interface PasteOmission {
|
|
318
|
+
/** The id the node had when it was copied. */
|
|
319
|
+
id: string;
|
|
320
|
+
reason: 'dependency-not-copied' | 'derivation-not-registered' | 'container-not-pasted';
|
|
321
|
+
missing?: string[];
|
|
322
|
+
}
|
|
323
|
+
/** What `commitPaste` is told beyond the snapshot and the offset. */
|
|
324
|
+
interface PasteCtx {
|
|
325
|
+
dropPoint?: {
|
|
326
|
+
worldX: number;
|
|
327
|
+
worldY: number;
|
|
328
|
+
};
|
|
329
|
+
/** Called once per copied node the paste leaves out. */
|
|
330
|
+
onOmit?: (omission: PasteOmission) => void;
|
|
331
|
+
}
|
|
307
332
|
/**
|
|
308
333
|
* SnapTarget — where a dragged node would re-parent to if released.
|
|
309
334
|
*
|
|
@@ -382,6 +407,10 @@ interface MoveAdapter<TNode extends {
|
|
|
382
407
|
setParent?(id: string, parentId: string | null): void;
|
|
383
408
|
/** Optional: see SceneAdapter.applyOps. */
|
|
384
409
|
applyOps?(ops: Op[], label: string): void;
|
|
410
|
+
/** Optional. Show each node at its pose without writing the document, so
|
|
411
|
+
* nothing is recorded; `null` withdraws a node's preview. What a behavior
|
|
412
|
+
* that keeps moving nodes after the gesture ends writes each frame. */
|
|
413
|
+
previewPoses?(poses: ReadonlyMap<string, TPose | null>): void;
|
|
385
414
|
findSnapTarget?(draggedId: string, worldX: number, worldY: number): SnapTarget<TPose> | null;
|
|
386
415
|
/** Optional: ordered children of `parentId`, `null` for the root siblings.
|
|
387
416
|
* One contract with {@link OrderedAdapter.getChildren} — the two land on
|
|
@@ -519,12 +548,7 @@ interface InsertAdapter<TNode extends {
|
|
|
519
548
|
commitPaste?(clipboard: ClipboardSnapshot, offset: {
|
|
520
549
|
dx: number;
|
|
521
550
|
dy: number;
|
|
522
|
-
}, ctx?:
|
|
523
|
-
dropPoint?: {
|
|
524
|
-
worldX: number;
|
|
525
|
-
worldY: number;
|
|
526
|
-
};
|
|
527
|
-
}): TNode[];
|
|
551
|
+
}, ctx?: PasteCtx): TNode[];
|
|
528
552
|
/** Snapshot the current selection into the clipboard payload shape.
|
|
529
553
|
* Optional — required by `useClipboard.copy` / `cut` and `useClone`'s
|
|
530
554
|
* ghost capture, ignored by other consumers. */
|
|
@@ -581,4 +605,4 @@ interface OrderedAdapter {
|
|
|
581
605
|
setChildOrder?(parentId: string | null, ids: string[]): void;
|
|
582
606
|
}
|
|
583
607
|
|
|
584
|
-
export { type AreaSelectAdapter as A, type ContainerBounds as C, type DropRegion as D, type InsertAdapter as I, type LayoutStrategy as L, type MoveAdapter as M, type OrderedAdapter as O, type PlaneMap as P, type RegionPickView as R, type SnapTarget as S, type ParallaxOpts as a, type SceneAdapter as b, type LayoutDropTargetMode as c, type ReflowTransition as d, type
|
|
608
|
+
export { type AreaSelectAdapter as A, rectToPlane as B, type ContainerBounds as C, type DropRegion as D, toPlane as E, type InsertAdapter as I, type LayoutStrategy as L, type MoveAdapter as M, type OrderedAdapter as O, type PlaneMap as P, type RegionPickView as R, type SnapTarget as S, type ParallaxOpts as a, type SceneAdapter as b, type LayoutDropTargetMode as c, type ReflowTransition as d, type PasteOmission as e, type LayerEnumerableAdapter as f, type LassoHitMode as g, type ResizeAdapter as h, type RotateAdapter as i, type LassoSelectAdapter as j, type ClipboardSnapshot as k, type PasteCtx as l, type DropTarget as m, type LayoutArrival as n, type LayoutChild as o, type LayoutContainer as p, type LayoutDragged as q, type LayoutSnap as r, type ReflowGlideOptions as s, type ScalarOrXY as t, deriveParallaxView as u, fromPlane as v, planeMap as w, planeMatrix as x, planeToPlane as y, rectFromPlane as z };
|
package/dist/util/color.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
function e(e) {
|
|
3
3
|
if (!e.startsWith("#")) return e;
|
|
4
4
|
let t = e.slice(1);
|
|
5
|
-
if (t.length === 3) {
|
|
6
|
-
let e
|
|
7
|
-
return `#${e}${e}${n}${n}${r}${r}
|
|
5
|
+
if (t.length === 3 || t.length === 4) {
|
|
6
|
+
let [e, n, r, i = "f"] = t.toLowerCase();
|
|
7
|
+
return `#${e}${e}${n}${n}${r}${r}${i}${i}`;
|
|
8
8
|
}
|
|
9
9
|
return t.length === 6 ? `#${t}ff` : t.length === 8 ? e.toLowerCase() : e;
|
|
10
10
|
}
|
package/dist/util/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","names":["toHex8","color","hex","r","g","b","
|
|
1
|
+
{"version":3,"file":"color.js","names":["toHex8","color","hex","r","g","b","a","getAlpha01","withAlpha01","aa","alpha01","eight","mergeAlphaFromPrev","picked","prev"],"sources":["../../src/util/color.ts"],"sourcesContent":["/** Color hex8 helpers. All stored colors are `#rrggbbaa`. `<input type=\"color\">`\n * only round-trips the 6-char form, so call-sites pad the saved alpha back on\n * when the user picks via the native widget. */\n\n/** Expand `#rgb` / `#rgba` / `#rrggbb` to `#rrggbbaa`. Pads `ff` when no alpha\n * channel is present. Non-hex inputs (named colors, `rgba(...)`) are\n * returned unchanged — the kit's renderer accepts arbitrary CSS, and\n * we only normalize the hex shapes we actually persist. */\nexport function toHex8(color: string): string {\n if (!color.startsWith('#')) return color;\n const hex = color.slice(1);\n if (hex.length === 3 || hex.length === 4) {\n const [r, g, b, a = 'f'] = hex.toLowerCase();\n return `#${r}${r}${g}${g}${b}${b}${a}${a}`;\n }\n if (hex.length === 6) return `#${hex}ff`;\n if (hex.length === 8) return color.toLowerCase();\n return color;\n}\n\n/** Return the alpha channel of `color` as 0..1. Defaults to 1 when the\n * color is not in 8-char hex form. */\nexport function getAlpha01(color: string): number {\n if (!color.startsWith('#') || color.length !== 9) return 1;\n const a = parseInt(color.slice(7, 9), 16);\n return Number.isFinite(a) ? a / 255 : 1;\n}\n\n/** Replace the alpha channel of `color` with `alpha01` (clamped to 0..1).\n * Expands shorter hex forms first. Pass-through for non-hex inputs. */\nexport function withAlpha01(color: string, alpha01: number): string {\n const a = Math.max(0, Math.min(1, alpha01));\n const aa = Math.round(a * 255).toString(16).padStart(2, '0');\n const eight = toHex8(color);\n if (!eight.startsWith('#') || eight.length !== 9) return color;\n return `${eight.slice(0, 7)}${aa}`;\n}\n\n/** Merge a freshly-picked color with the previous color's alpha channel.\n * If `picked` is already in 8-char hex form (`#rrggbbaa`, length 9), it is\n * used as-is — its explicit alpha is preserved. Otherwise the alpha from\n * `prev` is adopted, which handles the common case where `<input type=\"color\">`\n * strips the alpha channel and returns a bare 6-char hex. */\nexport function mergeAlphaFromPrev(picked: string, prev: string): string {\n if (picked.length === 9 && picked.startsWith('#')) return picked.toLowerCase();\n return withAlpha01(picked, getAlpha01(prev));\n}\n"],"mappings":";AAQA,SAAgBA,EAAO,GAAuB;CAC5C,IAAI,CAACC,EAAM,WAAW,GAAG,GAAG,OAAOA;CACnC,IAAMC,IAAMD,EAAM,MAAM,CAAC;CACzB,IAAIC,EAAI,WAAW,KAAKA,EAAI,WAAW,GAAG;EACxC,IAAM,CAACC,GAAGC,GAAGC,GAAGC,IAAI,OAAOJ,EAAI,YAAY;EAC3C,OAAO,IAAIC,IAAIA,IAAIC,IAAIA,IAAIC,IAAIA,IAAIC,IAAIA;CACzC;CAGA,OAFIJ,EAAI,WAAW,IAAU,IAAIA,EAAI,MACjCA,EAAI,WAAW,IAAUD,EAAM,YAAY,IACxCA;AACT;AAIA,SAAgBM,EAAW,GAAuB;CAChD,IAAI,CAACN,EAAM,WAAW,GAAG,KAAKA,EAAM,WAAW,GAAG,OAAO;CACzD,IAAMK,IAAI,SAASL,EAAM,MAAM,GAAG,CAAC,GAAG,EAAE;CACxC,OAAO,OAAO,SAASK,CAAC,IAAIA,IAAI,MAAM;AACxC;AAIA,SAAgBE,EAAY,GAAe,GAAyB;CAElE,IAAMC,IAAK,KAAK,MADN,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGC,CAAO,CACnB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,GACrDC,IAAQX,EAAOC,CAAK;CAE1B,OADI,CAACU,EAAM,WAAW,GAAG,KAAKA,EAAM,WAAW,IAAUV,IAClD,GAAGU,EAAM,MAAM,GAAG,CAAC,IAAIF;AAChC;AAOA,SAAgBG,EAAmB,GAAgB,GAAsB;CAEvE,OADIC,EAAO,WAAW,KAAKA,EAAO,WAAW,GAAG,IAAUA,EAAO,YAAY,IACtEL,EAAYK,GAAQN,EAAWO,CAAI,CAAC;AAC7C"}
|
package/dist/util/paint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paint.js","names":["DEFAULT_FILL_COLOR","DEFAULT_STROKE_COLOR","srgb","hexToColorLiteral","hex","DEFAULT_PALETTE","cycleFill","palette","entry","entries","seq","color","resolvePaletteColor","colorLiteralToHex","fallback","GHOST_STROKE","solid","a","getAlpha01","rgb","strokeOf","strokeWith","DEFAULT_SHAPE_FILL","paintAlpha","paint","paintWithAlpha","alpha01","paintWithColor","next","alpha"],"sources":["../../src/util/paint.ts"],"sourcesContent":["/** Kit-shipped default paint constants.\n *\n * Single source of truth for the colors the built-in tools and the default\n * fill/stroke actions reach for. Consumers that want to match the kit's\n * out-of-the-box look (e.g. seed their own active-paint state) should import\n * these rather than re-declaring the literals.\n *\n * All values are `#rrggbbaa` so they round-trip through the kit's hex8 alpha\n * helpers (`util/color`) without ambiguity.\n */\nimport {\n colorLiteralToHex,\n hexToColorLiteral,\n resolvePaletteColor,\n type ColorLiteral,\n type FillStyle,\n type Palette,\n type Stroke,\n} from '@weasel-js/paint';\nimport { getAlpha01 } from './color';\n\n/** Default fill paint for shapes and the fill action — opaque white. */\nexport const DEFAULT_FILL_COLOR = '#ffffffff';\n\n/** Default stroke paint for shapes and the stroke action — opaque black. */\nexport const DEFAULT_STROKE_COLOR = '#000000ff';\n\nconst srgb = (hex: string): ColorLiteral => hexToColorLiteral(hex) as ColorLiteral;\n\n/** Default fill palette cycled through for auto-generated shape nodes\n * (the kit's built-in shape tools and the `insert` action). */\nexport const DEFAULT_PALETTE: Palette = {\n entries: [\n { name: 'sage', color: srgb('#7fb069') },\n { name: 'tan', color: srgb('#d4a574') },\n { name: 'lavender', color: srgb('#a48bd4') },\n { name: 'sky', color: srgb('#7ab8d4') },\n { name: 'rose', color: srgb('#d47a7a') },\n ],\n};\n\n/** The `seq`th color of `palette`'s entries as hex, wrapping past the end.\n * An entry that resolves to nothing, or to a space with no hex form, gives\n * `fallback`. */\nexport function cycleFill(seq: number, palette: Palette = DEFAULT_PALETTE, fallback = DEFAULT_FILL_COLOR): string {\n const { entries } = palette;\n const entry = entries[((seq % entries.length) + entries.length) % entries.length];\n const color = entry && resolvePaletteColor(palette, { ref: entry.name });\n return (color && colorLiteralToHex(color)) ?? fallback;\n}\n\n/** Preview / \"ghost\" stroke color used by drag-to-draw tool overlays and the\n * selected-anchor highlight. Derived from the first palette entry so the\n * preview chrome matches the default insert color. */\nexport const GHOST_STROKE: string = cycleFill(0);\n\n/**\n * A solid paint from a color string — the authoring shorthand for the one\n * shape a node's `data.fill` (and a `Stroke.paint`) may take.\n *\n * An alpha channel in `color` moves to `opacity`, because that is where every\n * paint kind carries its alpha; leaving it in the hex too would multiply the\n * two in the renderer.\n */\nexport function solid(color: string):
|
|
1
|
+
{"version":3,"file":"paint.js","names":["DEFAULT_FILL_COLOR","DEFAULT_STROKE_COLOR","srgb","hexToColorLiteral","hex","DEFAULT_PALETTE","cycleFill","palette","entry","entries","seq","color","resolvePaletteColor","colorLiteralToHex","fallback","GHOST_STROKE","solid","a","getAlpha01","rgb","strokeOf","strokeWith","DEFAULT_SHAPE_FILL","paintAlpha","paint","paintWithAlpha","alpha01","paintWithColor","next","alpha"],"sources":["../../src/util/paint.ts"],"sourcesContent":["/** Kit-shipped default paint constants.\n *\n * Single source of truth for the colors the built-in tools and the default\n * fill/stroke actions reach for. Consumers that want to match the kit's\n * out-of-the-box look (e.g. seed their own active-paint state) should import\n * these rather than re-declaring the literals.\n *\n * All values are `#rrggbbaa` so they round-trip through the kit's hex8 alpha\n * helpers (`util/color`) without ambiguity.\n */\nimport {\n colorLiteralToHex,\n hexToColorLiteral,\n resolvePaletteColor,\n type ColorLiteral,\n type CommandStroke,\n type FillStyle,\n type Palette,\n type SolidFill,\n type Stroke,\n} from '@weasel-js/paint';\nimport { getAlpha01 } from './color';\n\n/** Default fill paint for shapes and the fill action — opaque white. */\nexport const DEFAULT_FILL_COLOR = '#ffffffff';\n\n/** Default stroke paint for shapes and the stroke action — opaque black. */\nexport const DEFAULT_STROKE_COLOR = '#000000ff';\n\nconst srgb = (hex: string): ColorLiteral => hexToColorLiteral(hex) as ColorLiteral;\n\n/** Default fill palette cycled through for auto-generated shape nodes\n * (the kit's built-in shape tools and the `insert` action). */\nexport const DEFAULT_PALETTE: Palette = {\n entries: [\n { name: 'sage', color: srgb('#7fb069') },\n { name: 'tan', color: srgb('#d4a574') },\n { name: 'lavender', color: srgb('#a48bd4') },\n { name: 'sky', color: srgb('#7ab8d4') },\n { name: 'rose', color: srgb('#d47a7a') },\n ],\n};\n\n/** The `seq`th color of `palette`'s entries as hex, wrapping past the end.\n * An entry that resolves to nothing, or to a space with no hex form, gives\n * `fallback`. */\nexport function cycleFill(seq: number, palette: Palette = DEFAULT_PALETTE, fallback = DEFAULT_FILL_COLOR): string {\n const { entries } = palette;\n const entry = entries[((seq % entries.length) + entries.length) % entries.length];\n const color = entry && resolvePaletteColor(palette, { ref: entry.name });\n return (color && colorLiteralToHex(color)) ?? fallback;\n}\n\n/** Preview / \"ghost\" stroke color used by drag-to-draw tool overlays and the\n * selected-anchor highlight. Derived from the first palette entry so the\n * preview chrome matches the default insert color. */\nexport const GHOST_STROKE: string = cycleFill(0);\n\n/**\n * A solid paint from a color string — the authoring shorthand for the one\n * shape a node's `data.fill` (and a `Stroke.paint`) may take.\n *\n * An alpha channel in `color` moves to `opacity`, because that is where every\n * paint kind carries its alpha; leaving it in the hex too would multiply the\n * two in the renderer.\n */\nexport function solid(color: string): SolidFill {\n const a = getAlpha01(color);\n const rgb = color.length === 9 && color.startsWith('#') ? color.slice(0, 7) : color;\n return a === 1 ? { color: rgb } : { color: rgb, opacity: a };\n}\n\n/** A solid stroke of `color` at `width` world units. Authoring shorthand for\n * `{ paint: solid(color), width }`. */\nexport function strokeOf(color: string, width = 1): CommandStroke & { paint: SolidFill } {\n return { paint: solid(color), width };\n}\n\n/** A stroke painted with `paint` at `width` world units — `strokeOf`'s sibling\n * for a gradient or pattern, which has no color to pass. */\nexport function strokeWith(paint: FillStyle, width = 1): Stroke {\n return { paint, width };\n}\n\n/** The kit's default node paint — what a shape with no declared fill paints. */\nexport const DEFAULT_SHAPE_FILL: FillStyle = { color: '#888' };\n\n/**\n * The 0..1 alpha a paint paints at.\n *\n * Every paint kind carries its alpha in `opacity` — that is the one slot a\n * gradient or a pattern has, so it is the slot all of them use.\n */\nexport function paintAlpha(paint: FillStyle | undefined): number {\n return paint?.opacity ?? 1;\n}\n\n/** `paint` painting at `alpha01` (clamped to 0..1). */\nexport function paintWithAlpha(paint: FillStyle, alpha01: number): FillStyle {\n return { ...paint, opacity: Math.max(0, Math.min(1, alpha01)) };\n}\n\n/**\n * `paint` recolored to `color`, keeping everything else about it.\n *\n * A solid paint takes the new color; a gradient or a pattern has no single\n * color to replace, so it is superseded by a solid one — picking a color off\n * a swatch means \"paint this color\". An alpha channel in `color` wins;\n * without one, the paint's existing opacity carries over.\n */\nexport function paintWithColor(paint: FillStyle | undefined, color: string): FillStyle {\n const next = solid(color);\n const explicitAlpha = color.length === 9 && color.startsWith('#');\n if (explicitAlpha || paint === undefined) return next;\n const alpha = paintAlpha(paint);\n return alpha === 1 ? next : { ...next, opacity: alpha };\n}\n"],"mappings":";;;AAwBA,IAAaA,IAAqB,aAGrBC,IAAuB,aAE9BC,KAAQ,MAA8BC,EAAkBC,CAAG,GAIpDC,IAA2B,EACtC,SAAS;CACP;EAAE,MAAM;EAAQ,OAAOH,EAAK,SAAS;CAAE;CACvC;EAAE,MAAM;EAAO,OAAOA,EAAK,SAAS;CAAE;CACtC;EAAE,MAAM;EAAY,OAAOA,EAAK,SAAS;CAAE;CAC3C;EAAE,MAAM;EAAO,OAAOA,EAAK,SAAS;CAAE;CACtC;EAAE,MAAM;EAAQ,OAAOA,EAAK,SAAS;CAAE;AACzC,EACF;AAKA,SAAgBI,EAAU,GAAa,IAAmBD,GAAiB,IAAWL,GAA4B;CAChH,IAAM,EAAE,eAAYO,GACdC,IAAQC,GAAUC,IAAMD,EAAQ,SAAUA,EAAQ,UAAUA,EAAQ,SACpEE,IAAQH,KAASI,EAAoBL,GAAS,EAAE,KAAKC,EAAM,KAAK,CAAC;CACvE,QAAQG,KAASE,EAAkBF,CAAK,MAAMG;AAChD;AAKA,IAAaC,IAAuBT,EAAU,CAAC;AAU/C,SAAgBU,EAAM,GAA0B;CAC9C,IAAMC,IAAIC,EAAWP,CAAK,GACpBQ,IAAMR,EAAM,WAAW,KAAKA,EAAM,WAAW,GAAG,IAAIA,EAAM,MAAM,GAAG,CAAC,IAAIA;CAC9E,OAAOM,MAAM,IAAI,EAAE,OAAOE,EAAI,IAAI;EAAE,OAAOA;EAAK,SAASF;CAAE;AAC7D;AAIA,SAAgBG,EAAS,GAAe,IAAQ,GAAyC;CACvF,OAAO;EAAE,OAAOJ,EAAML,CAAK;EAAG;CAAM;AACtC;AAIA,SAAgBU,EAAW,GAAkB,IAAQ,GAAW;CAC9D,OAAO;EAAE;EAAO;CAAM;AACxB;AAGA,IAAaC,IAAgC,EAAE,OAAO,OAAO;AAQ7D,SAAgBC,EAAW,GAAsC;CAC/D,OAAOC,GAAO,WAAW;AAC3B;AAGA,SAAgBC,EAAe,GAAkB,GAA4B;CAC3E,OAAO;EAAE,GAAGD;EAAO,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGE,CAAO,CAAC;CAAE;AAChE;AAUA,SAAgBC,EAAe,GAA8B,GAA0B;CACrF,IAAMC,IAAOZ,EAAML,CAAK;CAExB,IADsBA,EAAM,WAAW,KAAKA,EAAM,WAAW,GAAG,KAC3Ca,MAAU,KAAA,GAAW,OAAOI;CACjD,IAAMC,IAAQN,EAAWC,CAAK;CAC9B,OAAOK,MAAU,IAAID,IAAO;EAAE,GAAGA;EAAM,SAASC;CAAM;AACxD"}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/core",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "Domain-agnostic 2D scene graph primitives for React: viewport math, drag/resize/insert/clone interactions, layered canvas rendering.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "orochi235",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"sideEffects": [
|
|
18
|
+
"*.css",
|
|
18
19
|
"./src/import-shims/mesh.ts",
|
|
19
20
|
"./src/features/meshPaint/register.ts",
|
|
20
21
|
"./dist/mesh.js",
|
|
@@ -81,27 +82,28 @@
|
|
|
81
82
|
"./package.json": "./package.json"
|
|
82
83
|
},
|
|
83
84
|
"scripts": {
|
|
84
|
-
"build": "vite build && tsup",
|
|
85
|
+
"build": "vite build && tsup && node ../labkit/scripts/build-css.mjs --if-built",
|
|
85
86
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
88
|
-
"@weasel-js/font": "1.9.
|
|
89
|
+
"@weasel-js/font": "1.9.4",
|
|
89
90
|
"react": ">=18"
|
|
90
91
|
},
|
|
91
92
|
"dependencies": {
|
|
92
|
-
"@msb235/blits": "0.
|
|
93
|
-
"@weasel-js/cursor": "1.9.
|
|
94
|
-
"@weasel-js/geom": "1.9.
|
|
95
|
-
"@weasel-js/gestures": "1.9.
|
|
96
|
-
"@weasel-js/history": "1.9.
|
|
97
|
-
"@weasel-js/modes": "1.9.
|
|
98
|
-
"@weasel-js/
|
|
99
|
-
"@weasel-js/
|
|
100
|
-
"@weasel-js/
|
|
101
|
-
"@weasel-js/
|
|
102
|
-
"@weasel-js/
|
|
103
|
-
"@weasel-js/
|
|
104
|
-
"@weasel-js/
|
|
93
|
+
"@msb235/blits": "0.8.1",
|
|
94
|
+
"@weasel-js/cursor": "1.9.4",
|
|
95
|
+
"@weasel-js/geom": "1.9.4",
|
|
96
|
+
"@weasel-js/gestures": "1.9.4",
|
|
97
|
+
"@weasel-js/history": "1.9.4",
|
|
98
|
+
"@weasel-js/modes": "1.9.4",
|
|
99
|
+
"@weasel-js/paint": "1.9.4",
|
|
100
|
+
"@weasel-js/prefs": "1.9.4",
|
|
101
|
+
"@weasel-js/quantity": "1.9.4",
|
|
102
|
+
"@weasel-js/react": "1.9.4",
|
|
103
|
+
"@weasel-js/registry": "1.9.4",
|
|
104
|
+
"@weasel-js/routing": "1.9.4",
|
|
105
|
+
"@weasel-js/select": "1.9.4",
|
|
106
|
+
"@weasel-js/text": "1.9.4",
|
|
105
107
|
"earcut": "3.2.3",
|
|
106
108
|
"polygon-clipping": "^0.15.7"
|
|
107
109
|
},
|
|
@@ -119,7 +121,7 @@
|
|
|
119
121
|
"2d"
|
|
120
122
|
],
|
|
121
123
|
"devDependencies": {
|
|
122
|
-
"@weasel-js/modes": "1.9.
|
|
123
|
-
"@weasel-js/theme": "1.9.
|
|
124
|
+
"@weasel-js/modes": "1.9.4",
|
|
125
|
+
"@weasel-js/theme": "1.9.4"
|
|
124
126
|
}
|
|
125
127
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Path } from '@weasel-js/geom';
|
|
2
|
-
import { P as PoseDescriptor } from './poseDescriptor-D-OH-tu5.js';
|
|
3
|
-
|
|
4
|
-
/** True for Path-shaped poses (`{kind: 'polygon' | 'rect'}`). Useful for
|
|
5
|
-
* callers that need to fork between `pathPoseDescriptor` and
|
|
6
|
-
* `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire
|
|
7
|
-
* `poseDescriptor` explicitly. */
|
|
8
|
-
declare function isPathLike(p: unknown): p is Path;
|
|
9
|
-
/** True for a pose with numeric top-level `x`/`y`/`width`/`height` — the only
|
|
10
|
-
* shape the rect descriptor and the kit's built-in painters can read. */
|
|
11
|
-
declare function isRectPose(p: unknown): p is {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
rotation?: number;
|
|
17
|
-
};
|
|
18
|
-
/** Per-call dispatch: if the pose looks like a Path, route to
|
|
19
|
-
* `pathPoseDescriptor`; otherwise treat as a plain rect pose. Avoids forcing
|
|
20
|
-
* demos with Path TPose to wire `poseDescriptor={pathPoseDescriptor}`
|
|
21
|
-
* explicitly. `getRotation` surfaces a `pose.rotation` field on non-Path poses
|
|
22
|
-
* so demos using rect-with-rotation shapes (e.g. `RotatedPose`) don't have to
|
|
23
|
-
* wire `poseDescriptor={ROTATED_POSE_DESCRIPTOR}` just to get rotated
|
|
24
|
-
* selection chrome and rotation-aware corner hit-tests. */
|
|
25
|
-
declare const AUTO_POSE_DESCRIPTOR: PoseDescriptor<unknown>;
|
|
26
|
-
|
|
27
|
-
export { AUTO_POSE_DESCRIPTOR as A, isRectPose as a, isPathLike as i };
|