@weasel-js/core 1.10.0 → 1.10.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 +168 -0
- package/README.md +33 -0
- package/dist/affordances/composeAffordanceLayer.js +21 -21
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +48 -32
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js +50 -28
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotateCursor.js +12 -0
- package/dist/affordances/rotateCursor.js.map +1 -0
- package/dist/affordances/rotationHandle.js +40 -43
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/rig/rigNode.js +9 -3
- package/dist/animation/rig/rigNode.js.map +1 -1
- package/dist/animation/rig/rigSeat.js +46 -13
- package/dist/animation/rig/rigSeat.js.map +1 -1
- package/dist/animation/rig/skinBinding.js +22 -14
- package/dist/animation/rig/skinBinding.js.map +1 -1
- package/dist/barrel/canvas.js +29 -28
- package/dist/barrel/interactions.js +33 -32
- package/dist/barrel/paths.js +11 -10
- package/dist/barrel/routing.js +49 -48
- package/dist/barrel/scene.js +10 -10
- package/dist/barrel/viewport.js +24 -21
- package/dist/canvas/Canvas.js +6 -17
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +34 -37
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +3 -3
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +3 -3
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +24 -23
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +40 -49
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +297 -259
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +3 -24
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +37 -29
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +11 -11
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -1
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +45 -109
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +49 -41
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +64 -96
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +3 -4
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +77 -80
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +3 -3
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/SurfaceCanvas.js +40 -0
- package/dist/canvas/SurfaceCanvas.js.map +1 -0
- package/dist/canvas/adapterDerivedPath.js +13 -13
- package/dist/canvas/adapterDerivedPath.js.map +1 -1
- package/dist/canvas/adapterPickSource.js +34 -0
- package/dist/canvas/adapterPickSource.js.map +1 -0
- package/dist/canvas/affordanceAt.js +1 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +56 -34
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/copiesAbove.js +27 -0
- package/dist/canvas/copiesAbove.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +24 -23
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +45 -50
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +30 -15
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +134 -100
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/layout.js +9 -15
- package/dist/canvas/deps/layout.js.map +1 -1
- package/dist/canvas/derivedPath.js +53 -29
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js +33 -31
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/overChildren.js +29 -0
- package/dist/canvas/overChildren.js.map +1 -0
- package/dist/canvas/paintedCursorLayer.js.map +1 -1
- package/dist/canvas/pickReach.js +23 -0
- package/dist/canvas/pickReach.js.map +1 -0
- package/dist/canvas/pickWalk.js +51 -80
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +14 -35
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +11 -10
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +38 -44
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/useCanvasView.js +42 -44
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useSceneAdapter.js +22 -0
- package/dist/canvas/useSceneAdapter.js.map +1 -0
- package/dist/canvas/useSurfaceInput.js +13 -16
- package/dist/canvas/useSurfaceInput.js.map +1 -1
- package/dist/canvas/viewRegistry.js +31 -23
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/wrapNodeOutput.js +7 -2
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +1 -1
- package/dist/{clone-2a5hVbBd.d.ts → clone-C0eADtS0.d.ts} +13 -13
- package/dist/clone.d.ts +2 -2
- package/dist/core/geometry/poseDescriptor.js +49 -23
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +2 -2
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js.map +1 -1
- package/dist/core/layers/children.js +1 -3
- package/dist/core/layers/children.js.map +1 -1
- package/dist/core/ops/create.js +2 -2
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/delete.js +19 -23
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +3 -7
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +2 -4
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
- package/dist/core/ops/reparent.js +0 -1
- package/dist/core/ops/reparent.js.map +1 -1
- package/dist/core/ops/slot.js +3 -6
- package/dist/core/ops/slot.js.map +1 -1
- package/dist/core/pages/fitViewToPage.js +15 -0
- package/dist/core/pages/fitViewToPage.js.map +1 -0
- package/dist/core/pages/pages.js +65 -0
- package/dist/core/pages/pages.js.map +1 -0
- package/dist/core/pages/pagesLayer.js +27 -0
- package/dist/core/pages/pagesLayer.js.map +1 -0
- package/dist/core/paint/meshKindLazy.js +2 -2
- package/dist/core/paint/meshKindLazy.js.map +1 -1
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/core/scene/composePose.js +58 -20
- package/dist/core/scene/composePose.js.map +1 -1
- package/dist/core/scene/effectivePose.js +5 -1
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/historyFacade.js +19 -13
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/nodeFnFields.js +7 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/outerOps.js +2 -1
- package/dist/core/scene/outerOps.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +1 -1
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/sceneRecording.js +2 -1
- package/dist/core/scene/sceneRecording.js.map +1 -1
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +28 -30
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -1
- package/dist/core/viewport/useViewAnimation.js +70 -69
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +8 -5
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/zoomAt.js +11 -2
- package/dist/core/viewport/zoomAt.js.map +1 -1
- package/dist/{cornerHandles-BEshc4z3.d.ts → cornerHandles-BSKbyuvQ.d.ts} +1 -1
- package/dist/features/paths/editablePath.js +24 -8
- package/dist/features/paths/editablePath.js.map +1 -1
- package/dist/features/paths/index.js +4 -4
- package/dist/features/paths/shapeGenerator.js +89 -0
- package/dist/features/paths/shapeGenerator.js.map +1 -0
- package/dist/features/paths/usePathEdit.js +13 -13
- package/dist/features/poseRun/usePoseRun.js +25 -25
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +82 -64
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewResolver.js +28 -24
- package/dist/features/viewports/viewResolver.js.map +1 -1
- package/dist/icons/SliceIcon.js +24 -0
- package/dist/icons/SliceIcon.js.map +1 -0
- package/dist/index.d.ts +956 -581
- package/dist/index.js +260 -251
- package/dist/interactions/actions/align/align.js +9 -9
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/booleans.js +18 -18
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +35 -30
- package/dist/interactions/actions/clone/action.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +56 -59
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
- package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
- package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
- package/dist/interactions/actions/defaults/bendSegment.js +46 -0
- package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
- package/dist/interactions/actions/defaults/copySubtree.js +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +32 -17
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
- package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +16 -31
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +28 -23
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
- package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/distribute/distribute.js +8 -8
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/action.js +58 -55
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/preview.js +26 -0
- package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
- package/dist/interactions/actions/flip/action.js.map +1 -1
- package/dist/interactions/actions/geometryProjection.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +37 -30
- package/dist/interactions/actions/insert/action.js.map +1 -1
- package/dist/interactions/actions/insert/frame.js +9 -2
- package/dist/interactions/actions/insert/frame.js.map +1 -1
- package/dist/interactions/actions/insert/repositionAction.js +31 -0
- package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +32 -32
- package/dist/interactions/actions/move/action.js +29 -25
- package/dist/interactions/actions/move/action.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +12 -6
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +32 -23
- package/dist/interactions/actions/move/capture.js.map +1 -1
- package/dist/interactions/actions/move/frame.js +2 -14
- package/dist/interactions/actions/move/frame.js.map +1 -1
- package/dist/interactions/actions/move/session.js +1 -1
- package/dist/interactions/actions/move/session.js.map +1 -1
- package/dist/interactions/actions/move/translate.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/replaceWithPaths.js +13 -13
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -1
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -1
- package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
- package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
- package/dist/interactions/actions/resize/action.js +31 -20
- package/dist/interactions/actions/resize/action.js.map +1 -1
- package/dist/interactions/actions/resize/commit.js.map +1 -1
- package/dist/interactions/actions/resize/frame.js +29 -15
- package/dist/interactions/actions/resize/frame.js.map +1 -1
- package/dist/interactions/actions/resize/replay.js +47 -0
- package/dist/interactions/actions/resize/replay.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -35
- package/dist/interactions/actions/resize/session.js.map +1 -1
- package/dist/interactions/actions/resolveOverlays.js +2 -1
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +40 -25
- package/dist/interactions/actions/rotate/action.js.map +1 -1
- package/dist/interactions/actions/rotate/frame.js +1 -1
- package/dist/interactions/actions/rotate/frame.js.map +1 -1
- package/dist/interactions/actions/rotate/replay.js +22 -0
- package/dist/interactions/actions/rotate/replay.js.map +1 -0
- package/dist/interactions/actions/rotate/session.js +42 -32
- package/dist/interactions/actions/rotate/session.js.map +1 -1
- package/dist/interactions/actions/transform-again/action.js +63 -0
- package/dist/interactions/actions/transform-again/action.js.map +1 -0
- package/dist/interactions/actions/transform-again/memory.js +35 -0
- package/dist/interactions/actions/transform-again/memory.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +101 -83
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/move.d.ts +4 -4
- package/dist/{originProjection-PPT88jZv.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
- package/dist/resize.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +16 -15
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +111 -111
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js +11 -14
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +15 -14
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +22 -18
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +1 -1
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +2 -1
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +42 -40
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +18 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +2 -2
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/{types-CIKDwlsP.d.ts → types-DBbbCy0i.d.ts} +22 -15
- package/dist/version.js +1 -1
- package/package.json +22 -22
- package/dist/canvas/surface.module.js +0 -6
- package/dist/canvas/surface.module.js.map +0 -1
- package/dist/canvas/surfaceBox.js +0 -16
- package/dist/canvas/surfaceBox.js.map +0 -1
- package/dist/layout/arrivals.js +0 -33
- package/dist/layout/arrivals.js.map +0 -1
|
@@ -325,6 +325,11 @@ interface SnapTarget<TPose = unknown> {
|
|
|
325
325
|
* **Pose semantics:** `getPose` / `setPose` work in **local** coordinates —
|
|
326
326
|
* relative to the node's direct parent (or world, for root-parented nodes).
|
|
327
327
|
* `getWorldPose`, where an adapter has it, is the composed reading.
|
|
328
|
+
*
|
|
329
|
+
* **Every adapter carries the tree:** `getNode`, `getParent`, and
|
|
330
|
+
* `getChildren`. A list with no nesting is a tree whose nodes are all roots:
|
|
331
|
+
* `getParent` answers `null` and `getChildren(null)` answers every id,
|
|
332
|
+
* bottom first.
|
|
328
333
|
*/
|
|
329
334
|
/** Narrow adapter for move. Apps without container-snapping leave out `findSnapTarget`. */
|
|
330
335
|
interface MoveAdapter<TNode extends {
|
|
@@ -333,10 +338,8 @@ interface MoveAdapter<TNode extends {
|
|
|
333
338
|
getNode(id: string): TNode | undefined;
|
|
334
339
|
getNodes(): TNode[];
|
|
335
340
|
getPose(id: string): TPose;
|
|
336
|
-
/**
|
|
337
|
-
|
|
338
|
-
* (`pickTopMostHit`), and group-pose composition. Flat scenes may omit. */
|
|
339
|
-
getParent?(id: string): string | null;
|
|
341
|
+
/** The node's container, `null` for a root. */
|
|
342
|
+
getParent(id: string): string | null;
|
|
340
343
|
/** Optional paint depth, read by `pickTopMostHit` to resolve two *siblings*
|
|
341
344
|
* whose bodies both cover the pointer. Without it the hit list's own order
|
|
342
345
|
* decides, which is right for a back-to-front walk and wrong for anything
|
|
@@ -344,7 +347,7 @@ interface MoveAdapter<TNode extends {
|
|
|
344
347
|
getZIndex?(id: string): number | null | undefined;
|
|
345
348
|
compareZ?(a: string, b: string): number;
|
|
346
349
|
setPose(id: string, pose: TPose): void;
|
|
347
|
-
/** Optional. Used only by reparent ops;
|
|
350
|
+
/** Optional. Used only by reparent ops; an adapter that never reparents may omit. */
|
|
348
351
|
setParent?(id: string, parentId: string | null): void;
|
|
349
352
|
/** Optional. The commit point of a gesture. When omitted, ops are applied
|
|
350
353
|
* against the adapter one by one; an adapter with a history of its own
|
|
@@ -361,12 +364,12 @@ interface MoveAdapter<TNode extends {
|
|
|
361
364
|
* it answers `undefined`. */
|
|
362
365
|
poseTarget?(id: string, descriptor?: PoseDescriptor<TPose>): Target<TPose> | undefined;
|
|
363
366
|
findSnapTarget?(draggedId: string, worldX: number, worldY: number): SnapTarget<TPose> | null;
|
|
364
|
-
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*/
|
|
369
|
-
getChildren
|
|
367
|
+
/** Ordered children of `parentId`, `null` for the root siblings, in
|
|
368
|
+
* z-order: index 0 is the bottom. One contract with
|
|
369
|
+
* {@link OrderedAdapter.getChildren} — the two land on the same adapter
|
|
370
|
+
* object. Picking walks it, and the ops read a node's sibling slot from it.
|
|
371
|
+
* A node with no children answers `[]`. */
|
|
372
|
+
getChildren(parentId: string | null): string[];
|
|
370
373
|
/** Optional: layout strategy attached to a container, or null if the
|
|
371
374
|
* container uses absolute positioning. When present, a move uses it to
|
|
372
375
|
* compute drop targets, sibling reflow, and the commit op batch. */
|
|
@@ -455,6 +458,11 @@ interface LassoSelectAdapter extends AreaSelectAdapter {
|
|
|
455
458
|
interface InsertAdapter<TNode extends {
|
|
456
459
|
id: string;
|
|
457
460
|
}> {
|
|
461
|
+
getNode(id: string): TNode | undefined;
|
|
462
|
+
getParent(id: string): string | null;
|
|
463
|
+
/** Ordered children of `parentId`, `null` for the root siblings. An insert
|
|
464
|
+
* resolves its sibling slot against it. */
|
|
465
|
+
getChildren(parentId: string | null): string[];
|
|
458
466
|
/** Materialize a new node from drag-rect bounds (drag-to-insert tools).
|
|
459
467
|
* Optional: `sceneToAdapter` only fills it in when `options.commitInsert`
|
|
460
468
|
* is supplied. */
|
|
@@ -507,8 +515,7 @@ interface LayerEnumerableAdapter<TLayer extends string = string> {
|
|
|
507
515
|
subscribeLayers?(listener: () => void): () => void;
|
|
508
516
|
}
|
|
509
517
|
/**
|
|
510
|
-
*
|
|
511
|
-
* method is absent.
|
|
518
|
+
* Sibling z-order: what the reorder ops read and write.
|
|
512
519
|
*
|
|
513
520
|
* **Convention:** array order IS z-order. Index 0 is the bottom of the
|
|
514
521
|
* stack, the last index is the top. Hit-testing should iterate the returned
|
|
@@ -519,10 +526,10 @@ interface OrderedAdapter {
|
|
|
519
526
|
/** Ordered children of `parentId` (or root siblings if null), in z-order:
|
|
520
527
|
* index 0 is bottom, last index is top. The same contract
|
|
521
528
|
* {@link MoveAdapter.getChildren} declares — one method, two readers. */
|
|
522
|
-
getChildren
|
|
529
|
+
getChildren(parentId: string | null): string[];
|
|
523
530
|
/** Rewrite the order of `parentId`'s children. Length and contents must
|
|
524
531
|
* match the existing children — reorder only, no add/remove. */
|
|
525
|
-
setChildOrder
|
|
532
|
+
setChildOrder(parentId: string | null, ids: string[]): void;
|
|
526
533
|
}
|
|
527
534
|
|
|
528
535
|
export { type AreaSelectAdapter as A, toPlane as B, 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 ParallaxOpts as P, type RegionPickView as R, type SnapTarget as S, type PlaneMap as a, type LayoutDropTargetMode as b, type ReflowTransition as c, type PasteOmission as d, type LayerEnumerableAdapter as e, type LassoHitMode as f, type ResizeAdapter as g, type RotateAdapter as h, type LassoSelectAdapter as i, type ClipboardSnapshot as j, type PasteCtx as k, type DropTarget as l, type LayoutArrival as m, type LayoutChild as n, type LayoutContainer as o, type LayoutDragged as p, type LayoutSnap as q, type ReflowGlideOptions as r, type ScalarOrXY as s, deriveParallaxView as t, fromPlane as u, planeMap as v, planeMatrix as w, planeToPlane as x, rectFromPlane as y, rectToPlane as z };
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/core",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "A 2D scene-graph engine for React, rendered on WebGL2: the scene tree, viewport math, pointer and keyboard input, layered rendering, and op-based undo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "orochi235",
|
|
@@ -86,29 +86,29 @@
|
|
|
86
86
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@weasel-js/font": "1.10.
|
|
89
|
+
"@weasel-js/font": "1.10.1",
|
|
90
90
|
"react": ">=18"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@msb235/blits": "0.10.0",
|
|
94
|
-
"@weasel-js/animator": "1.10.
|
|
95
|
-
"@weasel-js/cursor": "1.10.
|
|
96
|
-
"@weasel-js/geom": "1.10.
|
|
97
|
-
"@weasel-js/gestures": "1.10.
|
|
98
|
-
"@weasel-js/history": "1.10.
|
|
99
|
-
"@weasel-js/modes": "1.10.
|
|
100
|
-
"@weasel-js/paint": "1.10.
|
|
101
|
-
"@weasel-js/prefs": "1.10.
|
|
102
|
-
"@weasel-js/quantity": "1.10.
|
|
103
|
-
"@weasel-js/react": "1.10.
|
|
104
|
-
"@weasel-js/registry": "1.10.
|
|
105
|
-
"@weasel-js/renderer": "1.10.
|
|
106
|
-
"@weasel-js/routing": "1.10.
|
|
107
|
-
"@weasel-js/select": "1.10.
|
|
108
|
-
"@weasel-js/simulation": "1.10.
|
|
109
|
-
"@weasel-js/stroke": "1.10.
|
|
110
|
-
"@weasel-js/text": "1.10.
|
|
111
|
-
"@weasel-js/text-dom": "1.10.
|
|
94
|
+
"@weasel-js/animator": "1.10.1",
|
|
95
|
+
"@weasel-js/cursor": "1.10.1",
|
|
96
|
+
"@weasel-js/geom": "1.10.1",
|
|
97
|
+
"@weasel-js/gestures": "1.10.1",
|
|
98
|
+
"@weasel-js/history": "1.10.1",
|
|
99
|
+
"@weasel-js/modes": "1.10.1",
|
|
100
|
+
"@weasel-js/paint": "1.10.1",
|
|
101
|
+
"@weasel-js/prefs": "1.10.1",
|
|
102
|
+
"@weasel-js/quantity": "1.10.1",
|
|
103
|
+
"@weasel-js/react": "1.10.1",
|
|
104
|
+
"@weasel-js/registry": "1.10.1",
|
|
105
|
+
"@weasel-js/renderer": "1.10.1",
|
|
106
|
+
"@weasel-js/routing": "1.10.1",
|
|
107
|
+
"@weasel-js/select": "1.10.1",
|
|
108
|
+
"@weasel-js/simulation": "1.10.1",
|
|
109
|
+
"@weasel-js/stroke": "1.10.1",
|
|
110
|
+
"@weasel-js/text": "1.10.1",
|
|
111
|
+
"@weasel-js/text-dom": "1.10.1",
|
|
112
112
|
"earcut": "3.2.3",
|
|
113
113
|
"polygon-clipping": "^0.15.7"
|
|
114
114
|
},
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"2d"
|
|
127
127
|
],
|
|
128
128
|
"devDependencies": {
|
|
129
|
-
"@weasel-js/modes": "1.10.
|
|
130
|
-
"@weasel-js/theme": "1.10.
|
|
129
|
+
"@weasel-js/modes": "1.10.1",
|
|
130
|
+
"@weasel-js/theme": "1.10.1"
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"surface.module.js","names":["surface","surface_module_default"],"sources":["../../src/canvas/surface.module.css"],"sourcesContent":["/* The CSS size of a canvas the kit renders: its `width` and `height` props.\n Zero specificity, so a class the consumer passes resizes the element. */\n:where(.surface) {\n width: var(--wzl-surface-width);\n height: var(--wzl-surface-height);\n}\n"],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import e from "./surface.module.js";
|
|
2
|
-
//#region src/canvas/surfaceBox.ts
|
|
3
|
-
function t(t, n, r, i) {
|
|
4
|
-
return {
|
|
5
|
-
className: r ? `${e.surface} ${r}` : e.surface,
|
|
6
|
-
style: {
|
|
7
|
-
...i,
|
|
8
|
-
"--wzl-surface-width": `${t}px`,
|
|
9
|
-
"--wzl-surface-height": `${n}px`
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { t as surfaceBox };
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=surfaceBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"surfaceBox.js","names":["s","surface_module_default","surfaceBox","className","style","width","height"],"sources":["../../src/canvas/surfaceBox.ts"],"sourcesContent":["/// <reference path=\"../css-modules.d.ts\" />\nimport type { CSSProperties } from 'react';\nimport s from './surface.module.css';\n\n/** The class and style for a `<canvas>` the kit renders at `width` × `height`\n * CSS pixels. The renderer sizes only the drawing buffer, so without these\n * the element is as large as its buffer: `dpr` times too big. */\nexport function surfaceBox(\n width: number,\n height: number,\n className?: string,\n style?: CSSProperties,\n): { className: string; style: CSSProperties } {\n return {\n className: className ? `${s.surface} ${className}` : s.surface,\n style: { ...style, '--wzl-surface-width': `${width}px`, '--wzl-surface-height': `${height}px` } as CSSProperties,\n };\n}\n"],"mappings":";;AAOA,SAAgBE,EACd,GACA,GACA,GACA,GAC6C;CAC7C,OAAO;EACL,WAAWC,IAAY,GAAGH,EAAE,QAAQ,GAAGG,MAAcH,EAAE;EACvD,OAAO;GAAE,GAAGI;GAAO,uBAAuB,GAAGC,EAAM;GAAK,wBAAwB,GAAGC,EAAO;EAAI;CAChG;AACF"}
|
package/dist/layout/arrivals.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { poseDescriptorForNode as e } from "../core/geometry/poseDescriptor.js";
|
|
2
|
-
import { AUTO_POSE_DESCRIPTOR as t } from "../core/geometry/autoPoseDescriptor.js";
|
|
3
|
-
import { runLayoutPass as n } from "../core/scene/layoutPass.js";
|
|
4
|
-
import { useEffect as r } from "react";
|
|
5
|
-
import { useLatest as i } from "@weasel-js/react";
|
|
6
|
-
//#region src/layout/arrivals.ts
|
|
7
|
-
function a(r, i) {
|
|
8
|
-
let { layouts: a } = i, o = typeof a == "function" ? a : (e) => a[e] ?? null, s = (e) => r.layoutOf(e) ?? o(e), c = i.poseDescriptor ?? t, l = (t) => e(c, r.get(t)), u = {
|
|
9
|
-
bounds: (e, t) => l(t).getBounds(e),
|
|
10
|
-
remap: (e, t, n, r) => l(r).remapBounds(e, t, n)
|
|
11
|
-
};
|
|
12
|
-
return (e, t, i) => n(r, s, e, t, u, i);
|
|
13
|
-
}
|
|
14
|
-
function o(e, t) {
|
|
15
|
-
let n = i(t), o = t.layouts !== void 0;
|
|
16
|
-
r(() => {
|
|
17
|
-
if (o) return e.setArrivalHandler((t, r, i) => {
|
|
18
|
-
let { layouts: o, poseDescriptor: s } = n.current;
|
|
19
|
-
return o ? a(e, {
|
|
20
|
-
layouts: o,
|
|
21
|
-
poseDescriptor: s
|
|
22
|
-
})(t, r, i) : /* @__PURE__ */ new Map();
|
|
23
|
-
});
|
|
24
|
-
}, [
|
|
25
|
-
e,
|
|
26
|
-
o,
|
|
27
|
-
n
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { a as layoutArrivalHandler, o as useLayoutArrivals };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=arrivals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrivals.js","names":["layoutArrivalHandler","opts","getLayout","layouts","id","layoutOf","scene","d","AUTO_POSE_DESCRIPTOR","descriptorOf","poseDescriptorForNode","frame","pose","from","to","runLayoutPass","arrivals","changed","departures","useLayoutArrivals","latest","useLatest","wired"],"sources":["../../src/layout/arrivals.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { runLayoutPass, type ResolvedLayoutFrame } from 'core/scene/layoutPass';\nimport type { NodeId, Scene, SceneArrivalHandler } from 'core/scene/types';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport type { LayoutStrategy } from './types';\n\n/** Where a container's layout comes from: a map by container id, or a\n * resolver. The same shape `<SceneCanvas layouts>` takes. */\nexport type LayoutSource<TPose> =\n | Record<string, LayoutStrategy<TPose>>\n | ((containerId: string) => LayoutStrategy<TPose> | null);\n\n/** Options for {@link layoutArrivalHandler} and {@link useLayoutArrivals}. */\nexport interface LayoutArrivalOptions<TPose> {\n layouts: LayoutSource<TPose>;\n /** How poses are read and resized. Default `AUTO_POSE_DESCRIPTOR`. */\n poseDescriptor?: PoseDescriptor<TPose>;\n}\n\n/**\n * A scene arrival handler over `layouts`: the scene's own layout pass\n * (`depart` for children that left a container, `arrive` for children that\n * joined it, `childPoses` for any other change to its children or size),\n * measured through the canvas's pose\n * descriptor. A container that declares its own layout\n * (`ContainerNode.layout`) is arranged by that one; `layouts` fills in for\n * the rest.\n */\nexport function layoutArrivalHandler<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n opts: LayoutArrivalOptions<TPose>,\n): SceneArrivalHandler<TPose> {\n const { layouts } = opts;\n const getLayout = typeof layouts === 'function'\n ? layouts\n : (id: string) => layouts[id] ?? null;\n const layoutOf = (id: NodeId) => scene.layoutOf(id) ?? getLayout(id as string);\n const d = (opts.poseDescriptor ?? AUTO_POSE_DESCRIPTOR) as PoseDescriptor<TPose>;\n const descriptorOf = (id: NodeId) => poseDescriptorForNode(d, scene.get(id));\n const frame: ResolvedLayoutFrame<TPose> = {\n bounds: (pose, id) => descriptorOf(id).getBounds(pose),\n remap: (pose, from, to, id) => descriptorOf(id).remapBounds(pose, from, to),\n };\n return (arrivals, changed, departures) =>\n runLayoutPass(scene, layoutOf, arrivals, changed, frame, departures);\n}\n\n/**\n * Install {@link layoutArrivalHandler} on `scene` for as long as the calling\n * component is mounted. `<SceneCanvas layouts>` does this itself; call it\n * when a canvas is wired by hand through `sceneToAdapter({ layouts })`.\n */\nexport function useLayoutArrivals<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n opts: Partial<LayoutArrivalOptions<TPose>>,\n): void {\n const latest = useLatest(opts);\n const wired = opts.layouts !== undefined;\n useEffect(() => {\n if (!wired) return;\n return scene.setArrivalHandler((arrivals, changed, departures) => {\n const { layouts, poseDescriptor } = latest.current;\n if (!layouts) return new Map();\n return layoutArrivalHandler(scene, { layouts, poseDescriptor })(arrivals, changed, departures);\n });\n }, [scene, wired, latest]);\n}\n"],"mappings":";;;;;;AA8BA,SAAgBA,EACd,GACA,GAC4B;CAC5B,IAAM,EAAE,eAAYC,GACdC,IAAY,OAAOC,KAAY,aACjCA,KACC,MAAeA,EAAQC,MAAO,MAC7BC,KAAY,MAAeC,EAAM,SAASF,CAAE,KAAKF,EAAUE,CAAY,GACvEG,IAAKN,EAAK,kBAAkBO,GAC5BC,KAAgB,MAAeC,EAAsBH,GAAGD,EAAM,IAAIF,CAAE,CAAC,GACrEO,IAAoC;EACxC,SAAS,GAAM,MAAOF,EAAaL,CAAE,CAAC,CAAC,UAAUQ,CAAI;EACrD,QAAQ,GAAM,GAAM,GAAI,MAAOH,EAAaL,CAAE,CAAC,CAAC,YAAYQ,GAAMC,GAAMC,CAAE;CAC5E;CACA,QAAQ,GAAU,GAAS,MACzBC,EAAcT,GAAOD,GAAUW,GAAUC,GAASN,GAAOO,CAAU;AACvE;AAOA,SAAgBC,EACd,GACA,GACM;CACN,IAAMC,IAASC,EAAUpB,CAAI,GACvBqB,IAAQrB,EAAK,YAAY,KAAA;CAC/B,QAAgB;EACd,IAAKqB,GACL,OAAOhB,EAAM,mBAAmB,GAAU,GAAS,MAAe;GAChE,IAAM,EAAE,YAAS,sBAAmBc,EAAO;GAE3C,OADKjB,IACEH,EAAqBM,GAAO;IAAE;IAAS;GAAe,CAAC,CAAC,CAACU,GAAUC,GAASC,CAAU,oBADxE,IAAI,IAAI;EAE/B,CAAC;CACH,GAAG;EAACZ;EAAOgB;EAAOF;CAAM,CAAC;AAC3B"}
|