@weasel-js/core 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1106 -0
- package/README.md +7 -5
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -93
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +27 -18
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +65 -104
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +22 -21
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +38 -88
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +32 -24
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -29
- 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/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/{autoPoseDescriptor-vCdt55xm.d.ts → autoPoseDescriptor-DHg5KqaJ.d.ts} +1 -1
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +16 -0
- package/dist/barrel/input.js +18 -0
- package/dist/barrel/interactions.js +38 -0
- package/dist/barrel/paint.js +11 -0
- package/dist/barrel/paths.js +12 -0
- package/dist/barrel/renderer.js +14 -0
- package/dist/barrel/routing.js +57 -0
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -0
- package/dist/barrel/viewport.js +42 -0
- package/dist/canvas/Canvas.js +280 -559
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +147 -167
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +53 -49
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +40 -51
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +55 -374
- 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/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +126 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +64 -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 +46 -0
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +138 -85
- 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/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +74 -43
- 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 +31 -34
- 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 +39 -0
- package/dist/canvas/SceneCanvas/props.js.map +1 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +48 -48
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +74 -78
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +311 -969
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +42 -46
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +111 -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 +67 -55
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +12 -12
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.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/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +38 -57
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +130 -91
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +26 -26
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +6 -5
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +47 -22
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +4 -8
- 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/insertPreviewExtent.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/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.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 +68 -0
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
- package/dist/canvas/nodeShapes/pathPainter.js +39 -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 +11 -14
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickWalk.js +59 -68
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +9 -23
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +11 -11
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -81
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -214
- 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/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +39 -39
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +26 -6
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +67 -0
- package/dist/canvas/useCanvasView.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +39 -31
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +11 -0
- package/dist/canvas/useSceneLayerList.js.map +1 -0
- package/dist/canvas/useSurfaceInput.js +42 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +25 -27
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +16 -19
- package/dist/{types-B_9g6hMM.d.ts → clone-2a5hVbBd.d.ts} +123 -74
- package/dist/clone.d.ts +4 -7
- package/dist/clone.js +0 -2
- package/dist/core/device/index.js +5 -4
- package/dist/core/device/targets.js.map +1 -1
- 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/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +68 -19
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +31 -34
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +30 -29
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +2 -11
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +1 -1
- package/dist/core/layers/children.js.map +1 -0
- package/dist/core/layers/gateLayer.js +13 -0
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- 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/createHistory.js +9 -9
- package/dist/core/ops/createHistory.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/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +282 -105
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.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 +102 -0
- package/dist/core/scene/arrivalWindow.js.map +1 -0
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/{features/groups → core/scene}/composePose.js +18 -18
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +38 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +130 -0
- package/dist/core/scene/historyFacade.js.map +1 -0
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +185 -0
- package/dist/core/scene/kitOps.js.map +1 -0
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +131 -0
- package/dist/core/scene/layerStack.js.map +1 -0
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/core/scene/lockGuard.js +37 -0
- package/dist/core/scene/lockGuard.js.map +1 -0
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +10 -11
- 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 +127 -0
- package/dist/core/scene/nodeStore.js.map +1 -0
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +66 -0
- package/dist/core/scene/outerOps.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/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -40
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +3 -2
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js +84 -0
- package/dist/core/scene/renderOrder.js.map +1 -0
- package/dist/core/scene/scene.js +80 -1266
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +90 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +71 -0
- package/dist/core/scene/serialization.js.map +1 -0
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.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/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +8 -8
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +9 -9
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.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-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +97 -97
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/flag.js +2 -41
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +22 -17
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +28 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +7 -7
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +22 -14
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +47 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -14
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +44 -52
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +171 -179
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +100 -93
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +8473 -9141
- package/dist/index.js +269 -307
- package/dist/input/keyState.js +38 -39
- 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/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +18 -20
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +20 -20
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +69 -78
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +31 -15
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +44 -42
- 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/action.js +98 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +7 -32
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +60 -84
- 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/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.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/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +13 -53
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +40 -50
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +44 -38
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +11 -12
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +40 -69
- 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/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/reorder.js +2 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +14 -8
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +7 -4
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js +12 -12
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
- package/dist/interactions/actions/defaults/sliceOps.js +8 -10
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/distribute/action.js +66 -0
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +7 -9
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +30 -27
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +30 -17
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.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/insert/action.js +72 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +48 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.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/action.js +87 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- 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 +39 -27
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +59 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +22 -30
- 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/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +16 -63
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +16 -4
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +25 -20
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +55 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +74 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +56 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/selectionSubtree.js +69 -0
- package/dist/interactions/actions/selectionSubtree.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +87 -78
- 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 +62 -41
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.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/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -3
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +14 -11
- package/dist/{originProjection-DEklpDc_.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/{poseDescriptor-D-OH-tu5.d.ts → poseDescriptor-Bqk-11Rl.d.ts} +26 -36
- package/dist/renderer.d.ts +1 -91
- package/dist/renderer.js +2 -18
- package/dist/resize.d.ts +10 -22
- package/dist/resize.js +6 -6
- 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-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.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/image/useImageTool.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 +198 -150
- 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/pickTopMostHit.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/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +25 -24
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +42 -67
- 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 +72 -82
- 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 +9 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +12 -22
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-A37hYkeR.d.ts → types-CIKDwlsP.d.ts} +113 -169
- package/dist/util/color.js +3 -3
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +28 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -62
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -138
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -106
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -116
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -71
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -378
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/builtins-C-VgUlWI.d.ts +0 -4514
- package/dist/canvas/MinimapCanvas.js +0 -139
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -80
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -85
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/isPlainObject.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/debug/flag.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js +0 -14
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -94
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -236
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -103
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -26
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -156
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -154
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -148
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/index.js +0 -23
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -57
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -46
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -258
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -45
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -135
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -59
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -467
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -63
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -107
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js +0 -66
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -119
- package/dist/interactions/actions/defaults/flip.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/interactions/actions/defaults/insert.js +0 -288
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -156
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -760
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -335
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -184
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/math-Drrw4ewZ.d.ts +0 -160
- package/dist/registerProgram-BMZRDgrh.d.ts +0 -197
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -331
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -64
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -51
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw.js +0 -1135
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -45
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -9
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -19
- package/dist/renderer/math/color.js +0 -341
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -76
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -30
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/imageFill.js +0 -14
- package/dist/renderer/shaders/imageFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -13
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -24
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -14
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-CuIxe0xY.d.ts +0 -356
- package/dist/tools/prefs.js +0 -62
- package/dist/tools/prefs.js.map +0 -1
|
@@ -1,74 +1,106 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AUTO_POSE_DESCRIPTOR as e } from "../../core/geometry/autoPoseDescriptor.js";
|
|
2
|
+
import { createRigSeat as t } from "./rigSeat.js";
|
|
3
|
+
import { bindSkins as n, dataRestPath as r } from "./skinBinding.js";
|
|
4
|
+
import { mat3 as i } from "@weasel-js/geom";
|
|
5
|
+
import { resolveSkeleton as a } from "@weasel-js/animator";
|
|
4
6
|
//#region src/animation/rig/bindRig.ts
|
|
5
|
-
function
|
|
6
|
-
return (
|
|
7
|
-
let a =
|
|
7
|
+
function o(e) {
|
|
8
|
+
return (t, { rest: n, fromRest: r }) => {
|
|
9
|
+
let a = e.getBounds(n), o = a.x + a.width / 2, s = a.y + a.height / 2, [c, l] = i.apply(r, o, s), u = e.translate ? e.translate(n, c - o, l - s) : e.remapBounds(n, a, {
|
|
8
10
|
...a,
|
|
9
11
|
x: a.x + c - o,
|
|
10
12
|
y: a.y + l - s
|
|
11
13
|
});
|
|
12
|
-
if (!
|
|
13
|
-
let d =
|
|
14
|
-
return
|
|
14
|
+
if (!e.withRotation) return u;
|
|
15
|
+
let d = e.getRotation?.(n) ?? 0, f = Math.cos(d), p = Math.sin(d);
|
|
16
|
+
return e.withRotation(u, Math.atan2(r[1] * f + r[4] * p, r[0] * f + r[3] * p));
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
|
-
function
|
|
18
|
-
let {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
function s(e) {
|
|
20
|
+
let n = t(e.skeleton), { rig: r, binding: i } = c(e, n);
|
|
21
|
+
return n.binding = i, r;
|
|
22
|
+
}
|
|
23
|
+
function c(t, s) {
|
|
24
|
+
let { scene: c, skeleton: l } = t, u = t.descriptor ?? e, d = t.apply ?? o(u), f = a(l, {}), p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
25
|
+
let t = p.get(e);
|
|
26
|
+
if (t) return t;
|
|
27
|
+
let n = f.get(e);
|
|
28
|
+
if (!n) throw Error(`bindRig: the skeleton has no joint "${e}".`);
|
|
29
|
+
if (t = i.invert(n) ?? void 0, !t) throw Error(`bindRig: joint "${e}" is singular at the bind pose.`);
|
|
30
|
+
return p.set(e, t), t;
|
|
31
|
+
}, h = n(c, t.skins ?? {}, t.restPath ?? r, u);
|
|
32
|
+
h.joints.forEach(m);
|
|
33
|
+
let g = [];
|
|
34
|
+
for (let [e, n] of Object.entries(t.bindings ?? {})) {
|
|
35
|
+
m(e);
|
|
36
|
+
let r = f.get(e);
|
|
37
|
+
for (let i of typeof n == "string" ? [n] : n) {
|
|
38
|
+
if (t.skins && i in t.skins) throw Error(`bindRig: node "${i}" is both bound to joint "${e}" and skinned.`);
|
|
39
|
+
let n = c.get(i);
|
|
40
|
+
if (!n) throw Error(`bindRig: joint "${e}" is bound to node "${i}", which the scene lacks.`);
|
|
41
|
+
g.push({
|
|
42
|
+
node: i,
|
|
43
|
+
joint: e,
|
|
30
44
|
rest: n.pose,
|
|
31
45
|
restWorld: r,
|
|
32
|
-
restInverse: i,
|
|
33
46
|
entry: { pose: n.pose }
|
|
34
47
|
});
|
|
35
48
|
}
|
|
36
49
|
}
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
for (let e of
|
|
50
|
+
let _ = f, v = !1, y = () => {
|
|
51
|
+
if (v) {
|
|
52
|
+
v = !1;
|
|
53
|
+
for (let e of g) c.overrides.clear(e.node);
|
|
54
|
+
h.release();
|
|
41
55
|
}
|
|
42
|
-
}
|
|
56
|
+
}, b = () => {
|
|
57
|
+
s.shown = !1, y();
|
|
58
|
+
}, x = (e) => {
|
|
59
|
+
let t = a(l, e), { root: n } = s;
|
|
60
|
+
if (n) for (let [e, r] of t) t.set(e, i.multiply(n, r));
|
|
61
|
+
_ = t;
|
|
62
|
+
let r = /* @__PURE__ */ new Map(), o = (e) => {
|
|
63
|
+
let n = r.get(e);
|
|
64
|
+
return n || (n = i.multiply(t.get(e), m(e)), r.set(e, n)), n;
|
|
65
|
+
};
|
|
66
|
+
for (let e of g) {
|
|
67
|
+
let n = t.get(e.joint);
|
|
68
|
+
e.entry.pose = d(n, {
|
|
69
|
+
joint: e.joint,
|
|
70
|
+
node: e.node,
|
|
71
|
+
rest: e.rest,
|
|
72
|
+
restWorld: e.restWorld,
|
|
73
|
+
fromRest: o(e.joint)
|
|
74
|
+
}), v || c.overrides.set(e.node, e.entry);
|
|
75
|
+
}
|
|
76
|
+
h.joints.forEach(o), h.show(r), v = !0, s.shown = !0, c.overrides.commit();
|
|
77
|
+
}, { target: S } = s;
|
|
43
78
|
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}),
|
|
59
|
-
}
|
|
60
|
-
|
|
79
|
+
rig: {
|
|
80
|
+
skeleton: l,
|
|
81
|
+
target: S,
|
|
82
|
+
pose(e, t) {
|
|
83
|
+
s.committed = e, t && (s.root = t), x(S.read());
|
|
84
|
+
},
|
|
85
|
+
place(e) {
|
|
86
|
+
s.root = e, x(S.read());
|
|
87
|
+
},
|
|
88
|
+
world: () => _,
|
|
89
|
+
bake(e = "Bake rig pose") {
|
|
90
|
+
v && (c.batch(e, () => {
|
|
91
|
+
for (let e of g) e.entry.pose !== void 0 && c.setPose(e.node, e.entry.pose);
|
|
92
|
+
h.write();
|
|
93
|
+
}), b());
|
|
94
|
+
},
|
|
95
|
+
release: b
|
|
61
96
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}), f());
|
|
67
|
-
},
|
|
68
|
-
release: f
|
|
97
|
+
binding: {
|
|
98
|
+
show: x,
|
|
99
|
+
drop: y
|
|
100
|
+
}
|
|
69
101
|
};
|
|
70
102
|
}
|
|
71
103
|
//#endregion
|
|
72
|
-
export {
|
|
104
|
+
export { s as bindRig, c as bindRigOn, o as rigidRigApply };
|
|
73
105
|
|
|
74
106
|
//# sourceMappingURL=bindRig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindRig.js","names":["rigidRigApply","b","descriptor","rest","cx","cy","nx","ny","mat3","fromRest","moved","r0","ux","uy","bindRig","options","apply","AUTO_POSE_DESCRIPTOR","restWorlds","resolveSkeleton","skeleton","bound","joint","ids","restWorld","restInverse","node","scene","world","installed","release","local","pose","root","name","m","w","delta","label"],"sources":["../../../src/animation/rig/bindRig.ts"],"sourcesContent":["import type { PoseDescriptor } from '../../core/geometry/poseDescriptor';\nimport type { NodeId, PoseOverride, PoseOverrides } from '../../core/scene/types';\nimport { AUTO_POSE_DESCRIPTOR } from '../../interactions/actions/resize/autoPoseDescriptor';\nimport { mat3, type GlMat3 } from '../../renderer/math/mat3';\nimport { resolveSkeleton } from './resolveSkeleton';\nimport type { Pose, Skeleton } from './types';\n\n/** The part of a scene a rig writes to. */\nexport interface RigScene<TPose> {\n get(id: NodeId): { pose: TPose } | undefined;\n readonly overrides: PoseOverrides<TPose>;\n setPose(id: NodeId, pose: TPose): void;\n batch<T>(label: string, fn: () => T): T;\n}\n\n/** What a `RigApply` knows about the node it is posing. */\nexport interface RigApplyContext<TPose> {\n /** The joint the node rides. */\n joint: string;\n node: NodeId;\n /** The node's document pose when the rig was bound — where it sits at the\n * bind pose. */\n rest: TPose;\n /** The joint's world transform at the bind pose. */\n restWorld: GlMat3;\n /** `world * inverse(restWorld)`: the motion since the bind pose, in world\n * space. Carrying `rest` by it is what welding the node to the joint means. */\n fromRest: GlMat3;\n}\n\n/** Turns a joint's world transform into a pose for one bound node. The only\n * part of a rig that knows the scene's pose shape. */\nexport type RigApply<TPose> = (world: GlMat3, ctx: RigApplyContext<TPose>) => TPose;\n\n/** Options for `bindRig`. */\nexport interface BindRigOptions<TPose> {\n scene: RigScene<TPose>;\n skeleton: Skeleton;\n /** Joint name → the node or nodes that ride it. Each node keeps the offset\n * from its joint that it has at the bind pose. */\n bindings: Readonly<Record<string, NodeId | readonly NodeId[]>>;\n /** Default: {@link rigidRigApply} over `descriptor`. */\n apply?: RigApply<TPose>;\n /** The descriptor the default `apply` reads and writes poses through.\n * Default `AUTO_POSE_DESCRIPTOR`. */\n descriptor?: PoseDescriptor<TPose>;\n}\n\n/** A skeleton bound to scene nodes, as `bindRig` returns it. */\nexport interface Rig {\n readonly skeleton: Skeleton;\n /**\n * Resolve `pose` and move every bound node to it, through the scene's pose\n * overrides — no history entry, no document write, no version bump — then\n * commit them. The per-frame write. `root` places the rig in the world, and\n * may mirror it.\n */\n pose(pose: Pose, root?: GlMat3): void;\n /** The joint world transforms the last `pose` resolved, root applied. */\n world(): ReadonlyMap<string, GlMat3>;\n /** Write the current frame into the bound nodes' document poses as one\n * undo entry, and drop the overrides. Later frames stay relative to the\n * bind-time rest, so baking does not compound. */\n bake(label?: string): void;\n /** Drop the overrides; the nodes show their document poses again until the\n * next `pose`. */\n release(): void;\n}\n\n/**\n * Carries a node rigidly with its joint: the rest pose's center moves by\n * `fromRest`, and its rotation turns with the rest pose's x-axis. Scale in the\n * joint chain moves positions but not sizes — the pose model holds no shear,\n * and a sized pose under anisotropic scale would need one. Write an `apply`\n * that reads `world` to size nodes from joint scale.\n */\nexport function rigidRigApply<TPose>(descriptor: PoseDescriptor<TPose>): RigApply<TPose> {\n return (_world, { rest, fromRest }) => {\n const b = descriptor.getBounds(rest);\n const cx = b.x + b.width / 2;\n const cy = b.y + b.height / 2;\n const [nx, ny] = mat3.apply(fromRest, cx, cy);\n const moved = descriptor.translate\n ? descriptor.translate(rest, nx - cx, ny - cy)\n : descriptor.remapBounds(rest, b, { ...b, x: b.x + nx - cx, y: b.y + ny - cy });\n if (!descriptor.withRotation) return moved;\n const r0 = descriptor.getRotation?.(rest) ?? 0;\n const ux = Math.cos(r0);\n const uy = Math.sin(r0);\n return descriptor.withRotation(\n moved,\n Math.atan2(fromRest[1] * ux + fromRest[4] * uy, fromRest[0] * ux + fromRest[3] * uy),\n );\n };\n}\n\ninterface Bound<TPose> {\n node: NodeId;\n joint: string;\n rest: TPose;\n restWorld: GlMat3;\n restInverse: GlMat3;\n entry: PoseOverride<TPose>;\n}\n\n/**\n * Bind a skeleton's joints to scene nodes. Nodes are written in world space\n * and the rig resolves its own hierarchy, so bound nodes are best left\n * unparented, or under containers whose pose does not compose into theirs;\n * the scene's tree stays free to order and group them for drawing.\n */\nexport function bindRig<TPose>(options: BindRigOptions<TPose>): Rig {\n const { scene, skeleton } = options;\n const apply = options.apply ?? rigidRigApply(options.descriptor ?? (AUTO_POSE_DESCRIPTOR as PoseDescriptor<TPose>));\n const restWorlds = resolveSkeleton(skeleton, {});\n\n const bound: Bound<TPose>[] = [];\n for (const [joint, ids] of Object.entries(options.bindings)) {\n const restWorld = restWorlds.get(joint);\n if (!restWorld) throw new Error(`bindRig: the skeleton has no joint \"${joint}\".`);\n const restInverse = mat3.invert(restWorld);\n if (!restInverse) throw new Error(`bindRig: joint \"${joint}\" is singular at the bind pose.`);\n for (const node of typeof ids === 'string' ? [ids] : (ids as readonly NodeId[])) {\n const n = scene.get(node);\n if (!n) throw new Error(`bindRig: joint \"${joint}\" is bound to node \"${node}\", which the scene lacks.`);\n bound.push({ node, joint, rest: n.pose, restWorld, restInverse, entry: { pose: n.pose } });\n }\n }\n\n let world: ReadonlyMap<string, GlMat3> = restWorlds;\n let installed = false;\n\n const release = () => {\n if (!installed) return;\n installed = false;\n for (const b of bound) scene.overrides.clear(b.node);\n };\n\n return {\n skeleton,\n pose(pose, root) {\n const local = resolveSkeleton(skeleton, pose);\n if (root) for (const [name, m] of local) local.set(name, mat3.multiply(root, m));\n world = local;\n const fromRest = new Map<string, GlMat3>();\n for (const b of bound) {\n const w = local.get(b.joint)!;\n let delta = fromRest.get(b.joint);\n if (!delta) {\n delta = mat3.multiply(w, b.restInverse);\n fromRest.set(b.joint, delta);\n }\n b.entry.pose = apply(w, { joint: b.joint, node: b.node, rest: b.rest, restWorld: b.restWorld, fromRest: delta });\n if (!installed) scene.overrides.set(b.node, b.entry);\n }\n installed = true;\n scene.overrides.commit();\n },\n world: () => world,\n bake(label = 'Bake rig pose') {\n if (!installed) return;\n scene.batch(label, () => {\n for (const b of bound) if (b.entry.pose !== undefined) scene.setPose(b.node, b.entry.pose);\n });\n release();\n },\n release,\n };\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"bindRig.js","names":["rigidRigApply","b","descriptor","rest","cx","cy","nx","ny","mat3","fromRest","moved","r0","ux","uy","bindRig","seat","createRigSeat","options","bindRigOn","binding","rig","AUTO_POSE_DESCRIPTOR","apply","restWorlds","resolveSkeleton","skeleton","restInverses","restInverseOf","inverse","joint","restWorld","skins","bindSkins","scene","dataRestPath","bound","ids","node","world","installed","drop","release","show","local","pose","root","name","m","motionOf","delta","w","at","target","label"],"sources":["../../../src/animation/rig/bindRig.ts"],"sourcesContent":["import type { PoseDescriptor } from '../../core/geometry/poseDescriptor';\nimport type { NodeId, PoseOverride } from '../../core/scene/types';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport { mat3, type GlMat3 } from '@weasel-js/geom';\nimport type { Target } from '@weasel-js/animator';\nimport { resolveSkeleton } from '@weasel-js/animator';\nimport type { Pose, Skeleton } from '@weasel-js/animator';\nimport type { Skin } from '@weasel-js/animator';\nimport { createRigSeat, type RigBinding, type RigSeat } from './rigSeat';\nimport { bindSkins, dataRestPath, type RestPath, type SkinScene } from './skinBinding';\n\n/** The part of a scene a rig writes to. */\nexport interface RigScene<TPose> extends SkinScene<TPose> {\n batch<T>(label: string, fn: () => T): T;\n}\n\n/** What a `RigApply` knows about the node it is posing. */\nexport interface RigApplyContext<TPose> {\n /** The joint the node rides. */\n joint: string;\n node: NodeId;\n /** The node's document pose when the rig was bound — where it sits at the\n * bind pose. */\n rest: TPose;\n /** The joint's world transform at the bind pose. */\n restWorld: GlMat3;\n /** `world * inverse(restWorld)`: the motion since the bind pose, in world\n * space. Carrying `rest` by it is what welding the node to the joint means. */\n fromRest: GlMat3;\n}\n\n/** Turns a joint's world transform into a pose for one bound node. The only\n * part of a rig that knows the scene's pose shape. */\nexport type RigApply<TPose> = (world: GlMat3, ctx: RigApplyContext<TPose>) => TPose;\n\n/** Options for `bindRig`. */\nexport interface BindRigOptions<TPose> {\n scene: RigScene<TPose>;\n skeleton: Skeleton;\n /** Joint name → the node or nodes that ride it. Each node keeps the offset\n * from its joint that it has at the bind pose. */\n bindings?: Readonly<Record<string, NodeId | readonly NodeId[]>>;\n /** Node id → the weights its path bends by. Where a bound node moves whole with one joint,\n * a skinned node's points each follow their own joints, and the rig shows the bent path\n * through the node's pose override, posed at the path's bounds. */\n skins?: Readonly<Record<NodeId, Skin>>;\n /** Where a skinned node's path is drawn when the rig is bound. Default\n * {@link dataRestPath}: the node's `data.path`, through its pose. */\n restPath?: RestPath<TPose>;\n /** Default: {@link rigidRigApply} over `descriptor`. */\n apply?: RigApply<TPose>;\n /** The descriptor the default `apply` reads and writes poses through.\n * Default `AUTO_POSE_DESCRIPTOR`. */\n descriptor?: PoseDescriptor<TPose>;\n}\n\n/** A skeleton bound to scene nodes, as `bindRig` returns it. */\nexport interface Rig {\n readonly skeleton: Skeleton;\n /**\n * The rig's pose as a value an animator moves. Its committed value starts as `{}`, the bind\n * pose, and each frame the rig is posed with what the target shows. A clip is a\n * `SampledTrack<Pose>` given this as its `target`: clips on one rig crossfade by their\n * `weight`s, weights short of 1 leave the rest to the committed pose, and a `spring` or\n * `tween` from a pose away from the committed one adds on top. `animator.hold` shows a pose made elsewhere the same way, an\n * IK solve included.\n */\n readonly target: Target<Pose>;\n /**\n * Commit `pose` and move every bound node to what the target now shows, which is `pose`\n * unless something is animating the target; a hold on it weighs the new pose in when it is\n * next read, at the animator's next frame or the hold's `touch()`. Writes go through the scene's pose overrides —\n * no history entry, no document write, no version bump — and are committed. `root`, where\n * given, replaces the placement, as {@link Rig.place}.\n */\n pose(pose: Pose, root?: GlMat3): void;\n /** Place the rig in the world by `root`, which may mirror it, and pose it there. It stays\n * until placed again; with no `root`, the rig goes back to where its skeleton puts it. */\n place(root?: GlMat3): void;\n /** The joint world transforms as the rig was last posed, root applied. */\n world(): ReadonlyMap<string, GlMat3>;\n /** Write the current frame into the bound nodes' document poses as one\n * undo entry, and drop the overrides. A skinned node's bent path goes into\n * its `data.path`. Later frames stay relative to the bind-time rest, so\n * baking does not compound. */\n bake(label?: string): void;\n /** Drop the overrides; the nodes show their document poses again until the\n * rig is next posed. */\n release(): void;\n}\n\n/**\n * Carries a node rigidly with its joint: the rest pose's center moves by\n * `fromRest`, and its rotation turns with the rest pose's x-axis. Scale in the\n * joint chain moves positions but not sizes — the pose model holds no shear,\n * and a sized pose under anisotropic scale would need one. Write an `apply`\n * that reads `world` to size nodes from joint scale.\n */\nexport function rigidRigApply<TPose>(descriptor: PoseDescriptor<TPose>): RigApply<TPose> {\n return (_world, { rest, fromRest }) => {\n const b = descriptor.getBounds(rest);\n const cx = b.x + b.width / 2;\n const cy = b.y + b.height / 2;\n const [nx, ny] = mat3.apply(fromRest, cx, cy);\n const moved = descriptor.translate\n ? descriptor.translate(rest, nx - cx, ny - cy)\n : descriptor.remapBounds(rest, b, { ...b, x: b.x + nx - cx, y: b.y + ny - cy });\n if (!descriptor.withRotation) return moved;\n const r0 = descriptor.getRotation?.(rest) ?? 0;\n const ux = Math.cos(r0);\n const uy = Math.sin(r0);\n return descriptor.withRotation(\n moved,\n Math.atan2(fromRest[1] * ux + fromRest[4] * uy, fromRest[0] * ux + fromRest[3] * uy),\n );\n };\n}\n\ninterface Bound<TPose> {\n node: NodeId;\n joint: string;\n rest: TPose;\n restWorld: GlMat3;\n entry: PoseOverride<TPose>;\n}\n\n/**\n * Bind a skeleton's joints to scene nodes. Nodes are written in world space\n * and the rig resolves its own hierarchy, so bound nodes are best left\n * unparented, or under containers whose pose does not compose into theirs;\n * the scene's tree stays free to order and group them for drawing.\n */\nexport function bindRig<TPose>(options: BindRigOptions<TPose>): Rig {\n const seat = createRigSeat(options.skeleton);\n const { rig, binding } = bindRigOn(options, seat);\n seat.binding = binding;\n return rig;\n}\n\n/** {@link bindRig} on a seat the caller keeps. The rig shows the seat's target once its\n * `binding` is the seat's. */\nexport function bindRigOn<TPose>(\n options: BindRigOptions<TPose>,\n seat: RigSeat,\n): { rig: Rig; binding: RigBinding } {\n const { scene, skeleton } = options;\n const descriptor = options.descriptor ?? (AUTO_POSE_DESCRIPTOR as PoseDescriptor<TPose>);\n const apply = options.apply ?? rigidRigApply(descriptor);\n const restWorlds = resolveSkeleton(skeleton, {});\n const restInverses = new Map<string, GlMat3>();\n const restInverseOf = (joint: string): GlMat3 => {\n let inverse = restInverses.get(joint);\n if (inverse) return inverse;\n const restWorld = restWorlds.get(joint);\n if (!restWorld) throw new Error(`bindRig: the skeleton has no joint \"${joint}\".`);\n inverse = mat3.invert(restWorld) ?? undefined;\n if (!inverse) throw new Error(`bindRig: joint \"${joint}\" is singular at the bind pose.`);\n restInverses.set(joint, inverse);\n return inverse;\n };\n\n const skins = bindSkins(scene, options.skins ?? {}, options.restPath ?? dataRestPath, descriptor);\n skins.joints.forEach(restInverseOf);\n\n const bound: Bound<TPose>[] = [];\n for (const [joint, ids] of Object.entries(options.bindings ?? {})) {\n restInverseOf(joint);\n const restWorld = restWorlds.get(joint)!;\n for (const node of typeof ids === 'string' ? [ids] : (ids as readonly NodeId[])) {\n if (options.skins && node in options.skins) {\n throw new Error(`bindRig: node \"${node}\" is both bound to joint \"${joint}\" and skinned.`);\n }\n const n = scene.get(node);\n if (!n) throw new Error(`bindRig: joint \"${joint}\" is bound to node \"${node}\", which the scene lacks.`);\n bound.push({ node, joint, rest: n.pose, restWorld, entry: { pose: n.pose } });\n }\n }\n\n let world: ReadonlyMap<string, GlMat3> = restWorlds;\n let installed = false;\n\n const drop = () => {\n if (!installed) return;\n installed = false;\n for (const b of bound) scene.overrides.clear(b.node);\n skins.release();\n };\n const release = () => {\n seat.shown = false;\n drop();\n };\n\n const show = (pose: Pose): void => {\n const local = resolveSkeleton(skeleton, pose);\n const { root } = seat;\n if (root) for (const [name, m] of local) local.set(name, mat3.multiply(root, m));\n world = local;\n const fromRest = new Map<string, GlMat3>();\n const motionOf = (joint: string): GlMat3 => {\n let delta = fromRest.get(joint);\n if (!delta) {\n delta = mat3.multiply(local.get(joint)!, restInverseOf(joint));\n fromRest.set(joint, delta);\n }\n return delta;\n };\n for (const b of bound) {\n const w = local.get(b.joint)!;\n b.entry.pose = apply(w, { joint: b.joint, node: b.node, rest: b.rest, restWorld: b.restWorld, fromRest: motionOf(b.joint) });\n if (!installed) scene.overrides.set(b.node, b.entry);\n }\n skins.joints.forEach(motionOf);\n skins.show(fromRest);\n installed = true;\n seat.shown = true;\n scene.overrides.commit();\n };\n\n const { target } = seat;\n const rig: Rig = {\n skeleton,\n target,\n pose(pose, at) {\n seat.committed = pose;\n if (at) seat.root = at;\n show(target.read());\n },\n place(at) {\n seat.root = at;\n show(target.read());\n },\n world: () => world,\n bake(label = 'Bake rig pose') {\n if (!installed) return;\n scene.batch(label, () => {\n for (const b of bound) if (b.entry.pose !== undefined) scene.setPose(b.node, b.entry.pose);\n skins.write();\n });\n release();\n },\n release,\n };\n return { rig, binding: { show, drop } };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AUTO_POSE_DESCRIPTOR as e } from "../../core/geometry/autoPoseDescriptor.js";
|
|
2
|
+
import { createRigSeat as t } from "./rigSeat.js";
|
|
3
|
+
import { useSeatedRig as n } from "./useRig.js";
|
|
4
|
+
import { poseFrameInverseOf as r, poseFrameOf as i } from "@weasel-js/geom";
|
|
5
|
+
import { useMemo as a, useState as o, useSyncExternalStore as s } from "react";
|
|
6
|
+
//#region src/animation/rig/rigNode.ts
|
|
7
|
+
var c = (e, t, n) => e ? [e[0] * t + e[2] * n + e[4], e[1] * t + e[3] * n + e[5]] : [t, n];
|
|
8
|
+
function l(t, n, r = e) {
|
|
9
|
+
let a = r.getBounds(n), o = i(n), s = r.getRotation?.(n) ?? 0;
|
|
10
|
+
return { joints: t.joints.map((e) => {
|
|
11
|
+
if (e.parent != null) return e;
|
|
12
|
+
let [t, n] = c(o, a.x + e.bind.x, a.y + e.bind.y);
|
|
13
|
+
return {
|
|
14
|
+
...e,
|
|
15
|
+
bind: {
|
|
16
|
+
...e.bind,
|
|
17
|
+
x: t,
|
|
18
|
+
y: n,
|
|
19
|
+
rotation: e.bind.rotation + s
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}) };
|
|
23
|
+
}
|
|
24
|
+
function u(t, n, i = e) {
|
|
25
|
+
let a = i.getBounds(n), o = r(n), s = i.getRotation?.(n) ?? 0;
|
|
26
|
+
return { joints: t.joints.map((e) => {
|
|
27
|
+
if (e.parent != null) return e;
|
|
28
|
+
let [t, n] = c(o, e.bind.x, e.bind.y);
|
|
29
|
+
return {
|
|
30
|
+
...e,
|
|
31
|
+
bind: {
|
|
32
|
+
...e.bind,
|
|
33
|
+
x: t - a.x,
|
|
34
|
+
y: n - a.y,
|
|
35
|
+
rotation: e.bind.rotation - s
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}) };
|
|
39
|
+
}
|
|
40
|
+
var d = /* @__PURE__ */ new Map(), f = () => () => {}, p = () => d;
|
|
41
|
+
function m(e, t, n, r = d) {
|
|
42
|
+
let i = e.get(t);
|
|
43
|
+
if (!i) throw Error(`rigFromNode: the rig is node "${t}", which the scene lacks.`);
|
|
44
|
+
let a = i.data?.skeleton;
|
|
45
|
+
if (!a) throw Error(`rigFromNode: node "${t}" has no skeleton in its data.`);
|
|
46
|
+
let o = {
|
|
47
|
+
skeleton: l(a, i.pose, n),
|
|
48
|
+
bindings: {},
|
|
49
|
+
skins: {},
|
|
50
|
+
refs: [i.pose, i.data]
|
|
51
|
+
}, s = (t) => {
|
|
52
|
+
for (let n of e.childrenOf(t)) {
|
|
53
|
+
let t = e.get(n);
|
|
54
|
+
if (!t) continue;
|
|
55
|
+
let i = t.data, a = r.get(n) ?? i?.skin;
|
|
56
|
+
o.refs.push(n, t.pose, t.data, a), a ? o.skins[n] = a : i?.joint !== void 0 && (o.bindings[i.joint] ??= []).push(n), s(n);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return s(t), o;
|
|
60
|
+
}
|
|
61
|
+
var h = (e, t) => e === t || e.refs.length === t.refs.length && e.refs.every((e, n) => e === t.refs[n]);
|
|
62
|
+
function g(t, n, r = e) {
|
|
63
|
+
let { skeleton: i, bindings: a, skins: o } = m(t, n, r);
|
|
64
|
+
return {
|
|
65
|
+
skeleton: i,
|
|
66
|
+
bindings: a,
|
|
67
|
+
skins: o
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function _(r) {
|
|
71
|
+
let { scene: i, node: c, apply: l, descriptor: u, restPath: d, painting: g } = r, _ = s(i.subscribe, i.getVersion), v = s(g?.listen ?? f, g?.painted ?? p), y = a(() => m(i, c, u ?? e, v), [
|
|
72
|
+
i,
|
|
73
|
+
c,
|
|
74
|
+
u,
|
|
75
|
+
_,
|
|
76
|
+
v
|
|
77
|
+
]), [b, x] = o(y), S = h(b, y) ? b : y;
|
|
78
|
+
S !== b && x(y);
|
|
79
|
+
let C = JSON.stringify(S.skeleton.joints.map((e) => e.name)), w = a(() => t(S.skeleton), [C]);
|
|
80
|
+
return n({
|
|
81
|
+
scene: i,
|
|
82
|
+
skeleton: S.skeleton,
|
|
83
|
+
bindings: S.bindings,
|
|
84
|
+
skins: S.skins,
|
|
85
|
+
apply: l,
|
|
86
|
+
descriptor: u,
|
|
87
|
+
restPath: d
|
|
88
|
+
}, w);
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { l as placeSkeleton, g as rigFromNode, u as unplaceSkeleton, _ as useRigNode };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=rigNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rigNode.js","names":["through","m","x","y","placeSkeleton","AUTO_POSE_DESCRIPTOR","box","descriptor","pose","frame","poseFrameOf","turn","skeleton","joint","unplaceSkeleton","inverse","poseFrameInverseOf","UNPAINTED","noWord","unpainted","read","node","scene","id","local","out","walk","child","parent","n","data","skin","painted","sameRefs","a","b","r","i","rigFromNode","useRigNode","options","version","useSyncExternalStore","painting","next","useMemo","held","setHeld","useState","parts","joints","seat","createRigSeat","useSeatedRig"],"sources":["../../../src/animation/rig/rigNode.ts"],"sourcesContent":["import { useMemo, useState, useSyncExternalStore } from 'react';\nimport { poseFrameInverseOf, poseFrameOf } from '@weasel-js/geom';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport type { PoseDescriptor } from '../../core/geometry/poseDescriptor';\nimport type { NodeId } from '../../core/scene/types';\nimport type { BindRigOptions, Rig, RigScene } from './bindRig';\nimport type { Skin } from '@weasel-js/animator';\nimport type { Skeleton } from '@weasel-js/animator';\nimport { createRigSeat } from './rigSeat';\nimport { useSeatedRig } from './useRig';\n\n/** What a rig reads from node data: a `skeleton` on the node that is the rig, and on the nodes\n * under it a `skin` for a path that bends or a `joint` for a node that rides one whole. */\nexport interface RigNodeData {\n /** Joints relative to the node's pose: its box's top-left corner, turned as the node is. */\n skeleton?: Skeleton;\n skin?: Skin;\n joint?: string;\n}\n\n/** Weights to bind in place of the document's, and word of when they change. A `RigEditState`\n * is one: it holds what a stroke of the weight tool has painted and not yet written. */\nexport interface PaintedSkins {\n /** By node. A new map whenever the weights change. */\n painted(): ReadonlyMap<NodeId, Skin>;\n listen(fn: () => void): () => void;\n}\n\n/** The part of a scene `rigFromNode` reads. */\nexport interface RigNodeSource<TPose> {\n get(id: NodeId): { pose: TPose; data?: unknown } | undefined;\n childrenOf(id: NodeId): readonly NodeId[];\n}\n\n/** The skeleton, bindings, and skins a rig node declares, as `bindRig` takes them. */\nexport interface RigNodeParts {\n skeleton: Skeleton;\n bindings: Record<string, NodeId[]>;\n skins: Record<NodeId, Skin>;\n}\n\ninterface Reading extends RigNodeParts {\n /** Every node, pose, and data object the parts were read from, to tell when they are stale. */\n refs: unknown[];\n}\n\ntype Affine = readonly [number, number, number, number, number, number];\nconst through = (m: Affine | null, x: number, y: number): [number, number] =>\n (m ? [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]] : [x, y]);\n\n/**\n * A skeleton as a rig node's data keeps it, moved to where the node's pose puts it: its root\n * joints are offset from the pose box's top-left corner and turned as the node is. Joints\n * under a root are relative to their parents and are left as they are.\n */\nexport function placeSkeleton<TPose>(\n skeleton: Skeleton,\n pose: TPose,\n descriptor: PoseDescriptor<TPose> = AUTO_POSE_DESCRIPTOR as PoseDescriptor<TPose>,\n): Skeleton {\n const box = descriptor.getBounds(pose);\n const frame = poseFrameOf(pose);\n const turn = descriptor.getRotation?.(pose) ?? 0;\n return {\n joints: skeleton.joints.map((joint) => {\n if (joint.parent != null) return joint;\n const [x, y] = through(frame, box.x + joint.bind.x, box.y + joint.bind.y);\n return { ...joint, bind: { ...joint.bind, x, y, rotation: joint.bind.rotation + turn } };\n }),\n };\n}\n\n/** The inverse of {@link placeSkeleton}: a skeleton in the scene's space, as the node at\n * `pose` would keep it in its data. */\nexport function unplaceSkeleton<TPose>(\n skeleton: Skeleton,\n pose: TPose,\n descriptor: PoseDescriptor<TPose> = AUTO_POSE_DESCRIPTOR as PoseDescriptor<TPose>,\n): Skeleton {\n const box = descriptor.getBounds(pose);\n const inverse = poseFrameInverseOf(pose);\n const turn = descriptor.getRotation?.(pose) ?? 0;\n return {\n joints: skeleton.joints.map((joint) => {\n if (joint.parent != null) return joint;\n const [x, y] = through(inverse, joint.bind.x, joint.bind.y);\n return { ...joint, bind: { ...joint.bind, x: x - box.x, y: y - box.y, rotation: joint.bind.rotation - turn } };\n }),\n };\n}\n\nconst UNPAINTED: ReadonlyMap<NodeId, Skin> = new Map();\nconst noWord = (): (() => void) => () => {};\nconst unpainted = (): ReadonlyMap<NodeId, Skin> => UNPAINTED;\n\nfunction read<TPose>(\n scene: RigNodeSource<TPose>,\n id: NodeId,\n descriptor: PoseDescriptor<TPose>,\n painted: ReadonlyMap<NodeId, Skin> = UNPAINTED,\n): Reading {\n const node = scene.get(id);\n if (!node) throw new Error(`rigFromNode: the rig is node \"${id}\", which the scene lacks.`);\n const local = (node.data as RigNodeData | null | undefined)?.skeleton;\n if (!local) throw new Error(`rigFromNode: node \"${id}\" has no skeleton in its data.`);\n\n const skeleton = placeSkeleton(local, node.pose, descriptor);\n\n const out: Reading = { skeleton, bindings: {}, skins: {}, refs: [node.pose, node.data] };\n const walk = (parent: NodeId): void => {\n for (const child of scene.childrenOf(parent)) {\n const n = scene.get(child);\n if (!n) continue;\n const data = n.data as RigNodeData | null | undefined;\n const skin = painted.get(child) ?? data?.skin;\n out.refs.push(child, n.pose, n.data, skin);\n if (skin) out.skins[child] = skin;\n else if (data?.joint !== undefined) (out.bindings[data.joint] ??= []).push(child);\n walk(child);\n }\n };\n walk(id);\n return out;\n}\n\nconst sameRefs = (a: Reading, b: Reading): boolean =>\n a === b || (a.refs.length === b.refs.length && a.refs.every((r, i) => r === b.refs[i]));\n\n/**\n * Read a rig out of the scene: the skeleton in `id`'s `data.skeleton`, placed by that node's\n * pose, and under it every node whose data has a `skin` or names a `joint`.\n */\nexport function rigFromNode<TPose>(\n scene: RigNodeSource<TPose>,\n id: NodeId,\n descriptor: PoseDescriptor<TPose> = AUTO_POSE_DESCRIPTOR as PoseDescriptor<TPose>,\n): RigNodeParts {\n const { skeleton, bindings, skins } = read(scene, id, descriptor);\n return { skeleton, bindings, skins };\n}\n\n/** Options for `useRigNode`. */\nexport interface UseRigNodeOptions<TPose>\n extends Pick<BindRigOptions<TPose>, 'apply' | 'descriptor' | 'restPath'> {\n scene: RigScene<TPose> & RigNodeSource<TPose> & {\n subscribe(listener: () => void): () => void;\n getVersion(): number;\n };\n /** The node whose data holds the skeleton. */\n node: NodeId;\n /** Weights bound in place of a node's `data.skin` while they are held. Give it the\n * `RigEditState` the weight tool has, and a stroke bends the path as it is painted. */\n painting?: PaintedSkins;\n}\n\n/**\n * A {@link Rig} read from a node, as {@link rigFromNode} reads it. It is bound again when the\n * rig node or a node under it changes its pose or data, or when nodes under it come or go; an\n * edit elsewhere in the scene leaves it alone. A rig bound again keeps its `target`, with the\n * animations running on it, its committed pose, and its placement, unless the skeleton's\n * joints were added, removed, renamed, or reordered: then it starts at the bind pose with a\n * new `target`.\n */\nexport function useRigNode<TPose>(options: UseRigNodeOptions<TPose>): Rig {\n const { scene, node, apply, descriptor, restPath, painting } = options;\n const version = useSyncExternalStore(scene.subscribe, scene.getVersion);\n const painted = useSyncExternalStore(painting?.listen ?? noWord, painting?.painted ?? unpainted);\n const next = useMemo(\n () => read(scene, node, descriptor ?? (AUTO_POSE_DESCRIPTOR as PoseDescriptor<TPose>), painted),\n // `version` is what says the scene may answer differently.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [scene, node, descriptor, version, painted],\n );\n // Each read makes new objects; the rig must outlive a read that found nothing changed.\n const [held, setHeld] = useState(next);\n const parts = sameRefs(held, next) ? held : next;\n if (parts !== held) setHeld(next);\n const joints = JSON.stringify(parts.skeleton.joints.map((joint) => joint.name));\n // A pose target's axes are its joints' names in order, so the seat holds while those do.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const seat = useMemo(() => createRigSeat(parts.skeleton), [joints]);\n return useSeatedRig({\n scene, skeleton: parts.skeleton, bindings: parts.bindings, skins: parts.skins, apply, descriptor, restPath,\n }, seat);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createTarget as e, skeletonAxes as t } from "@weasel-js/animator";
|
|
2
|
+
//#region src/animation/rig/rigSeat.ts
|
|
3
|
+
function n(n) {
|
|
4
|
+
let r = {
|
|
5
|
+
committed: {},
|
|
6
|
+
root: void 0,
|
|
7
|
+
binding: null,
|
|
8
|
+
shown: !1,
|
|
9
|
+
target: e({
|
|
10
|
+
get: () => r.committed,
|
|
11
|
+
set: (e) => {
|
|
12
|
+
r.committed = e;
|
|
13
|
+
},
|
|
14
|
+
axes: t(n),
|
|
15
|
+
show: (e) => r.binding?.show(e)
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
return r;
|
|
19
|
+
}
|
|
20
|
+
function r(e, t) {
|
|
21
|
+
e.binding = t, e.shown && t.show(e.target.read());
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { n as createRigSeat, r as seatBinding };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=rigSeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rigSeat.js","names":["createRigSeat","seat","createTarget","pose","skeletonAxes","skeleton","seatBinding","binding"],"sources":["../../../src/animation/rig/rigSeat.ts"],"sourcesContent":["import type { GlMat3 } from '@weasel-js/geom';\nimport { createTarget, skeletonAxes, type Pose, type Skeleton, type Target } from '@weasel-js/animator';\n\n/** One binding of a rig to the scene: what a seat shows its pose through. */\nexport interface RigBinding {\n show(pose: Pose): void;\n /** Drop the overrides, leaving the seat as it is. */\n drop(): void;\n}\n\n/**\n * A rig's pose apart from the binding that shows it: the target, the committed pose, and the\n * placement. A rig bound again on the seat it had goes on under the animations running on its\n * target.\n */\nexport interface RigSeat {\n readonly target: Target<Pose>;\n committed: Pose;\n root: GlMat3 | undefined;\n binding: RigBinding | null;\n /** Whether the pose is on screen: set as a binding shows it, cleared as the rig is released. */\n shown: boolean;\n}\n\n/** A seat at the bind pose, for a skeleton with these joints in this order. */\nexport function createRigSeat(skeleton: Skeleton): RigSeat {\n const seat: RigSeat = {\n committed: {},\n root: undefined,\n binding: null,\n shown: false,\n target: createTarget<Pose>({\n get: () => seat.committed,\n set: (pose) => { seat.committed = pose; },\n axes: skeletonAxes(skeleton),\n show: (pose) => seat.binding?.show(pose),\n }),\n };\n return seat;\n}\n\n/** Make `binding` the one `seat` shows through, and show it what the last one had on screen. */\nexport function seatBinding(seat: RigSeat, binding: RigBinding): void {\n seat.binding = binding;\n if (seat.shown) binding.show(seat.target.read());\n}\n"],"mappings":";;AAyBA,SAAgBA,EAAc,GAA6B;CACzD,IAAMC,IAAgB;EACpB,WAAW,CAAC;EACZ,MAAM,KAAA;EACN,SAAS;EACT,OAAO;EACP,QAAQC,EAAmB;GACzB,WAAWD,EAAK;GAChB,MAAM,MAAS;IAAE,EAAK,YAAYE;GAAM;GACxC,MAAMC,EAAaC,CAAQ;GAC3B,OAAO,MAASJ,EAAK,SAAS,KAAKE,CAAI;EACzC,CAAC;CACH;CACA,OAAOF;AACT;AAGA,SAAgBK,EAAY,GAAe,GAA2B;CAEpE,AADA,EAAK,UAAUC,GACXN,EAAK,SAAOM,EAAQ,KAAKN,EAAK,OAAO,KAAK,CAAC;AACjD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { boundsOfPath as e, pathInWorld as t } from "@weasel-js/geom";
|
|
2
|
+
import { skinPath as n } from "@weasel-js/animator";
|
|
3
|
+
//#region src/animation/rig/skinBinding.ts
|
|
4
|
+
function r(e) {
|
|
5
|
+
let n = e.data?.path;
|
|
6
|
+
return n ? t(n, e.pose) : null;
|
|
7
|
+
}
|
|
8
|
+
function i(t, r, i, a) {
|
|
9
|
+
let o = [], s = /* @__PURE__ */ new Set();
|
|
10
|
+
for (let [e, n] of Object.entries(r)) {
|
|
11
|
+
let r = t.get(e);
|
|
12
|
+
if (!r) throw Error(`bindRig: a skin names node "${e}", which the scene lacks.`);
|
|
13
|
+
let a = i(r);
|
|
14
|
+
if (!a) throw Error(`bindRig: node "${e}" has no path to skin.`);
|
|
15
|
+
for (let e in n) s.add(e);
|
|
16
|
+
o.push({
|
|
17
|
+
node: e,
|
|
18
|
+
skin: n,
|
|
19
|
+
rest: a,
|
|
20
|
+
restPose: r.pose,
|
|
21
|
+
entry: {}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
let c = !1;
|
|
25
|
+
return {
|
|
26
|
+
joints: [...s],
|
|
27
|
+
show(r) {
|
|
28
|
+
for (let i of o) {
|
|
29
|
+
let o = n(i.rest, i.skin, r);
|
|
30
|
+
i.entry.path = o, i.entry.pose = a.fromBounds(e(o), i.restPose), c || t.overrides.set(i.node, i.entry);
|
|
31
|
+
}
|
|
32
|
+
c = !0;
|
|
33
|
+
},
|
|
34
|
+
write() {
|
|
35
|
+
for (let e of o) {
|
|
36
|
+
let { path: n, pose: r } = e.entry;
|
|
37
|
+
if (n === void 0 || r === void 0) continue;
|
|
38
|
+
let i = t.get(e.node)?.data;
|
|
39
|
+
t.update(e.node, { data: {
|
|
40
|
+
...i,
|
|
41
|
+
path: n
|
|
42
|
+
} }), t.setPose(e.node, r);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
release() {
|
|
46
|
+
if (c) {
|
|
47
|
+
c = !1;
|
|
48
|
+
for (let e of o) t.overrides.clear(e.node);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { i as bindSkins, r as dataRestPath };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=skinBinding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skinBinding.js","names":["dataRestPath","path","node","pathInWorld","bindSkins","skinned","joints","id","skin","skins","scene","rest","restPath","joint","installed","s","skinPath","motions","descriptor","boundsOfPath","pose","data"],"sources":["../../../src/animation/rig/skinBinding.ts"],"sourcesContent":["import { boundsOfPath, pathInWorld, type GlMat3, type Path, type PathInWorldPose } from '@weasel-js/geom';\nimport type { PoseDescriptor } from '../../core/geometry/poseDescriptor';\nimport type { NodeId, PoseOverride, PoseOverrides } from '../../core/scene/types';\nimport { skinPath, type Skin } from '@weasel-js/animator';\n\n/** The part of a scene a rig's skins read and write. */\nexport interface SkinScene<TPose> {\n get(id: NodeId): { pose: TPose; data?: unknown } | undefined;\n readonly overrides: PoseOverrides<TPose>;\n setPose(id: NodeId, pose: TPose): void;\n update(id: NodeId, patch: { data: never }): void;\n}\n\n/** Where a node's path is drawn, for a skin to bend: `null` for a node with none. */\nexport type RestPath<TPose> = (node: { pose: TPose; data?: unknown }) => Path | null;\n\n/** The path in a node's `data.path`, carried through its pose as `kit:path` paints it. */\nexport function dataRestPath<TPose>(node: { pose: TPose; data?: unknown }): Path | null {\n const path = (node.data as { path?: Path } | null | undefined)?.path;\n return path ? pathInWorld(path, node.pose as PathInWorldPose) : null;\n}\n\ninterface Skinned<TPose> {\n node: NodeId;\n skin: Skin;\n rest: Path;\n restPose: TPose;\n entry: PoseOverride<TPose>;\n}\n\n/** A rig's skinned nodes, as `bindSkins` returns them. */\nexport interface SkinBinding {\n /** Every joint a skin weighs. */\n readonly joints: readonly string[];\n /** Bend each skinned path by `motions`, which holds every one of `joints`, into its node's\n * pose override. The caller commits the overrides. */\n show(motions: ReadonlyMap<string, GlMat3>): void;\n /** Write each bent path and its bounds into the document. */\n write(): void;\n release(): void;\n}\n\n/** Read each skinned node's rest path and ready an override for it. */\nexport function bindSkins<TPose>(\n scene: SkinScene<TPose>,\n skins: Readonly<Record<NodeId, Skin>>,\n restPath: RestPath<TPose>,\n descriptor: PoseDescriptor<TPose>,\n): SkinBinding {\n const skinned: Skinned<TPose>[] = [];\n const joints = new Set<string>();\n for (const [id, skin] of Object.entries(skins) as [NodeId, Skin][]) {\n const node = scene.get(id);\n if (!node) throw new Error(`bindRig: a skin names node \"${id}\", which the scene lacks.`);\n const rest = restPath(node);\n if (!rest) throw new Error(`bindRig: node \"${id}\" has no path to skin.`);\n for (const joint in skin) joints.add(joint);\n skinned.push({ node: id, skin, rest, restPose: node.pose, entry: {} });\n }\n let installed = false;\n return {\n joints: [...joints],\n show(motions) {\n for (const s of skinned) {\n const path = skinPath(s.rest, s.skin, motions);\n s.entry.path = path;\n s.entry.pose = descriptor.fromBounds(boundsOfPath(path), s.restPose);\n if (!installed) scene.overrides.set(s.node, s.entry);\n }\n installed = true;\n },\n write() {\n for (const s of skinned) {\n const { path, pose } = s.entry;\n if (path === undefined || pose === undefined) continue;\n const data = scene.get(s.node)?.data;\n scene.update(s.node, { data: { ...(data as object), path } as never });\n scene.setPose(s.node, pose);\n }\n },\n release() {\n if (!installed) return;\n installed = false;\n for (const s of skinned) scene.overrides.clear(s.node);\n },\n };\n}\n"],"mappings":";;;AAiBA,SAAgBA,EAAoB,GAAoD;CACtF,IAAMC,IAAQC,EAAK,MAA6C;CAChE,OAAOD,IAAOE,EAAYF,GAAMC,EAAK,IAAuB,IAAI;AAClE;AAuBA,SAAgBE,EACd,GACA,GACA,GACA,GACa;CACb,IAAMC,IAA4B,CAAC,GAC7BC,oBAAS,IAAI,IAAY;CAC/B,KAAK,IAAM,CAACC,GAAIC,MAAS,OAAO,QAAQC,CAAK,GAAuB;EAClE,IAAMP,IAAOQ,EAAM,IAAIH,CAAE;EACzB,IAAI,CAACL,GAAM,MAAU,MAAM,+BAA+BK,EAAG,0BAA0B;EACvF,IAAMI,IAAOC,EAASV,CAAI;EAC1B,IAAI,CAACS,GAAM,MAAU,MAAM,kBAAkBJ,EAAG,uBAAuB;EACvE,KAAK,IAAMM,KAASL,GAAM,EAAO,IAAIK,CAAK;EAC1C,EAAQ,KAAK;GAAE,MAAMN;GAAI;GAAM;GAAM,UAAUL,EAAK;GAAM,OAAO,CAAC;EAAE,CAAC;CACvE;CACA,IAAIY,IAAY;CAChB,OAAO;EACL,QAAQ,CAAC,GAAGR,CAAM;EAClB,KAAK,GAAS;GACZ,KAAK,IAAMS,KAAKV,GAAS;IACvB,IAAMJ,IAAOe,EAASD,EAAE,MAAMA,EAAE,MAAME,CAAO;IAG7C,AAFA,EAAE,MAAM,OAAOhB,GACf,EAAE,MAAM,OAAOiB,EAAW,WAAWC,EAAalB,CAAI,GAAGc,EAAE,QAAQ,GAC9DD,KAAWJ,EAAM,UAAU,IAAIK,EAAE,MAAMA,EAAE,KAAK;GACrD;GACA,IAAY;EACd;EACA,QAAQ;GACN,KAAK,IAAMA,KAAKV,GAAS;IACvB,IAAM,EAAE,SAAM,YAASU,EAAE;IACzB,IAAId,MAAS,KAAA,KAAamB,MAAS,KAAA,GAAW;IAC9C,IAAMC,IAAOX,EAAM,IAAIK,EAAE,IAAI,CAAC,EAAE;IAEhC,AADAL,EAAM,OAAOK,EAAE,MAAM,EAAE,MAAM;KAAE,GAAIM;KAAiB;IAAK,EAAW,CAAC,GACrEX,EAAM,QAAQK,EAAE,MAAMK,CAAI;GAC5B;EACF;EACA,UAAU;GACR,IAAKN,GACL;QAAY;IACZ,KAAK,IAAMC,KAAKV,GAAS,EAAM,UAAU,MAAMU,EAAE,IAAI;GADzC;EAEd;CACF;AACF"}
|
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createRigSeat as e, seatBinding as t } from "./rigSeat.js";
|
|
2
|
+
import { bindRigOn as n } from "./bindRig.js";
|
|
3
|
+
import { useEffect as r, useMemo as i } from "react";
|
|
3
4
|
//#region src/animation/rig/useRig.ts
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
function a(e) {
|
|
6
|
+
return o(e, null);
|
|
7
|
+
}
|
|
8
|
+
function o(a, o) {
|
|
9
|
+
let { scene: s, skeleton: c, bindings: l, skins: u, restPath: d, apply: f, descriptor: p } = a, m = i(() => {
|
|
10
|
+
let t = o ?? e(c), r = n({
|
|
11
|
+
scene: s,
|
|
12
|
+
skeleton: c,
|
|
13
|
+
bindings: l,
|
|
14
|
+
skins: u,
|
|
15
|
+
restPath: d,
|
|
16
|
+
apply: f,
|
|
17
|
+
descriptor: p
|
|
18
|
+
}, t);
|
|
19
|
+
return t.binding ??= r.binding, {
|
|
20
|
+
seat: t,
|
|
21
|
+
...r
|
|
22
|
+
};
|
|
23
|
+
}, [
|
|
15
24
|
s,
|
|
16
|
-
c
|
|
25
|
+
c,
|
|
26
|
+
l,
|
|
27
|
+
u,
|
|
28
|
+
d,
|
|
29
|
+
f,
|
|
30
|
+
p,
|
|
31
|
+
o
|
|
17
32
|
]);
|
|
18
|
-
return
|
|
33
|
+
return r(() => (t(m.seat, m.binding), () => m.binding.drop()), [m]), m.rig;
|
|
19
34
|
}
|
|
20
35
|
//#endregion
|
|
21
|
-
export {
|
|
36
|
+
export { a as useRig, o as useSeatedRig };
|
|
22
37
|
|
|
23
38
|
//# sourceMappingURL=useRig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRig.js","names":["useRig","options","
|
|
1
|
+
{"version":3,"file":"useRig.js","names":["useRig","useSeatedRig","options","made","useMemo","seat","kept","createRigSeat","skeleton","bound","bindRigOn","scene","bindings","skins","restPath","apply","descriptor","useEffect","seatBinding"],"sources":["../../../src/animation/rig/useRig.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { bindRigOn, type BindRigOptions, type Rig } from './bindRig';\nimport { createRigSeat, seatBinding, type RigSeat } from './rigSeat';\n\n/**\n * A {@link Rig} bound for the component's lifetime, its overrides dropped on\n * unmount. Rebinds — re-reading every node's rest pose — whenever an option's\n * identity changes, so hoist or memoize `skeleton`, `bindings`, and `skins`.\n */\nexport function useRig<TPose>(options: BindRigOptions<TPose>): Rig {\n return useSeatedRig(options, null);\n}\n\n/** {@link useRig} on a seat that outlives a rebind; `null` makes a seat for each binding. */\nexport function useSeatedRig<TPose>(options: BindRigOptions<TPose>, kept: RigSeat | null): Rig {\n const { scene, skeleton, bindings, skins, restPath, apply, descriptor } = options;\n const made = useMemo(() => {\n const seat = kept ?? createRigSeat(skeleton);\n const bound = bindRigOn({ scene, skeleton, bindings, skins, restPath, apply, descriptor }, seat);\n seat.binding ??= bound.binding;\n return { seat, ...bound };\n }, [scene, skeleton, bindings, skins, restPath, apply, descriptor, kept]);\n useEffect(() => {\n seatBinding(made.seat, made.binding);\n return () => made.binding.drop();\n }, [made]);\n return made.rig;\n}\n"],"mappings":";;;;AASA,SAAgBA,EAAc,GAAqC;CACjE,OAAOC,EAAaC,GAAS,IAAI;AACnC;AAGA,SAAgBD,EAAoB,GAAgC,GAA2B;CAC7F,IAAM,EAAE,UAAO,aAAU,aAAU,UAAO,aAAU,UAAO,kBAAeC,GACpEC,IAAOC,QAAc;EACzB,IAAMC,IAAOC,KAAQC,EAAcC,CAAQ,GACrCC,IAAQC,EAAU;GAAE;GAAO;GAAU;GAAU;GAAO;GAAU;GAAO;EAAW,GAAGL,CAAI;EAE/F,OADA,EAAK,YAAYI,EAAM,SAChB;GAAE;GAAM,GAAGA;EAAM;CAC1B,GAAG;EAACE;EAAOH;EAAUI;EAAUC;EAAOC;EAAUC;EAAOC;EAAYV;CAAI,CAAC;CAKxE,OAJAW,SACEC,EAAYf,EAAK,MAAMA,EAAK,OAAO,SACtBA,EAAK,QAAQ,KAAK,IAC9B,CAACA,CAAI,CAAC,GACFA,EAAK;AACd"}
|
|
@@ -1,40 +1,48 @@
|
|
|
1
1
|
import { tweenPose as e } from "../poseHelpers.js";
|
|
2
|
+
import { setPoseInstant as t } from "./instantPose.js";
|
|
2
3
|
//#region src/animation/wrappers/animateLifecycle.ts
|
|
3
|
-
function
|
|
4
|
-
let
|
|
4
|
+
function n(n, r, i) {
|
|
5
|
+
let a = i.ms ?? 200, o = /* @__PURE__ */ new Set();
|
|
5
6
|
return {
|
|
6
|
-
...
|
|
7
|
-
insertNode(
|
|
8
|
-
if (
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
id:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
...n,
|
|
8
|
+
insertNode(o, s) {
|
|
9
|
+
if (n.insertNode(o, s), !i.enterFrom) return;
|
|
10
|
+
let c = n.getPose(o.id), l = i.enterFrom(c);
|
|
11
|
+
n.poseTarget?.(o.id, i.geometry) || t(n, o.id, l), e(r, n, {
|
|
12
|
+
id: o.id,
|
|
13
|
+
from: l,
|
|
14
|
+
to: c,
|
|
15
|
+
ms: a,
|
|
16
|
+
easing: i.easing,
|
|
17
|
+
geometry: i.geometry,
|
|
16
18
|
recordOp: !1
|
|
17
19
|
});
|
|
18
20
|
},
|
|
19
|
-
removeNode(
|
|
20
|
-
if (!
|
|
21
|
-
|
|
21
|
+
removeNode(t) {
|
|
22
|
+
if (!i.exitTo) {
|
|
23
|
+
n.removeNode(t);
|
|
22
24
|
return;
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (o.has(t)) return;
|
|
27
|
+
o.add(t);
|
|
28
|
+
let s = () => {}, c = n.poseTarget?.(t, i.geometry), l = c?.committed(), u = () => {
|
|
29
|
+
o.delete(t) && (s(), c && c.commit(l), n.removeNode(t));
|
|
30
|
+
}, d = n.getPose(t), f = e(r, n, {
|
|
31
|
+
id: t,
|
|
32
|
+
to: i.exitTo(d),
|
|
33
|
+
ms: a,
|
|
34
|
+
easing: i.easing,
|
|
35
|
+
geometry: i.geometry,
|
|
31
36
|
recordOp: !1,
|
|
32
|
-
onDone:
|
|
37
|
+
onDone: u
|
|
38
|
+
});
|
|
39
|
+
s = r.watch((e) => {
|
|
40
|
+
(e.type === "cancel" || e.type === "interrupt") && e.animation.id === f.id && u();
|
|
33
41
|
});
|
|
34
42
|
}
|
|
35
43
|
};
|
|
36
44
|
}
|
|
37
45
|
//#endregion
|
|
38
|
-
export {
|
|
46
|
+
export { n as animateLifecycle };
|
|
39
47
|
|
|
40
48
|
//# sourceMappingURL=animateLifecycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animateLifecycle.js","names":["animateLifecycle","ms","opts","adapter","object","index","final","start","tweenPose","animator","id","current"],"sources":["../../../src/animation/wrappers/animateLifecycle.ts"],"sourcesContent":["import { tweenPose } from '../poseHelpers';\nimport
|
|
1
|
+
{"version":3,"file":"animateLifecycle.js","names":["animateLifecycle","ms","opts","leaving","adapter","object","index","final","start","setPoseInstant","tweenPose","animator","id","unwatch","target","home","remove","current","handle","event"],"sources":["../../../src/animation/wrappers/animateLifecycle.ts"],"sourcesContent":["import { tweenPose, type PoseAnimationAdapter } from '../poseHelpers';\nimport { setPoseInstant } from './instantPose';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { Animator, EasingSpec } from '@weasel-js/animator';\n\n/** How nodes enter and leave. `enterFrom` derives the pose a new node starts\n * at, given where it belongs; `exitTo` derives the pose a departing node\n * animates to before it is actually removed. Omit either to leave that\n * transition instant. */\nexport interface LifecycleAnimation<TPose> {\n /** Pose to animate the new object FROM at insert. */\n enterFrom?: (final: TPose) => TPose;\n /** Pose to animate the existing object TO at remove. */\n exitTo?: (current: TPose) => TPose;\n ms?: number;\n easing?: EasingSpec;\n geometry?: PoseDescriptor<TPose>;\n}\n\n/** The part of an adapter `animateLifecycle` reads and wraps. The adapter `sceneToAdapter` and\n * `useSceneAdapter` build is one. */\nexport interface LifecycleAdapter<TNode extends { id: string }, TPose> extends PoseAnimationAdapter<TPose> {\n insertNode(node: TNode, index?: number): void;\n removeNode(id: string): void;\n}\n\n/** Wrap an adapter so inserts and removals animate — the scene-graph\n * equivalent of CSS enter/leave transitions. The result is the adapter it\n * was given, with `insertNode` and `removeNode` replaced. */\nexport function animateLifecycle<\n TNode extends { id: string },\n TPose,\n A extends LifecycleAdapter<TNode, TPose> = LifecycleAdapter<TNode, TPose>,\n>(\n adapter: A & LifecycleAdapter<TNode, TPose>,\n animator: Animator,\n opts: LifecycleAnimation<TPose>,\n): A {\n const ms = opts.ms ?? 200;\n const leaving = new Set<string>();\n\n return {\n ...adapter,\n insertNode(object: TNode, index?: number): void {\n adapter.insertNode(object, index);\n if (!opts.enterFrom) return;\n const final = adapter.getPose(object.id);\n const start = opts.enterFrom(final);\n // A pose target shows the start pose itself; without one it has to be written.\n if (!adapter.poseTarget?.(object.id, opts.geometry)) setPoseInstant(adapter, object.id, start);\n tweenPose(animator, adapter, {\n id: object.id,\n from: start,\n to: final,\n ms,\n easing: opts.easing,\n geometry: opts.geometry,\n recordOp: false,\n });\n },\n removeNode(id: string): void {\n if (!opts.exitTo) {\n adapter.removeNode(id);\n return;\n }\n if (leaving.has(id)) return;\n leaving.add(id);\n let unwatch = (): void => {};\n const target = adapter.poseTarget?.(id, opts.geometry);\n const home = target?.committed();\n const remove = (): void => {\n if (!leaving.delete(id)) return;\n unwatch();\n // The exit pose was only for show: the node is removed as it stood, so undo restores that.\n if (target) target.commit(home as TPose);\n adapter.removeNode(id);\n };\n const current = adapter.getPose(id);\n const handle = tweenPose(animator, adapter, {\n id,\n to: opts.exitTo(current),\n ms,\n easing: opts.easing,\n geometry: opts.geometry,\n recordOp: false,\n onDone: remove,\n });\n // A canceled tween never calls onDone, and the node still has to go.\n unwatch = animator.watch((event) => {\n if ((event.type === 'cancel' || event.type === 'interrupt') && event.animation.id === handle.id) remove();\n });\n },\n } as A;\n}\n"],"mappings":";;;AA6BA,SAAgBA,EAKd,GACA,GACA,GACG;CACH,IAAMC,IAAKC,EAAK,MAAM,KAChBC,oBAAU,IAAI,IAAY;CAEhC,OAAO;EACL,GAAGC;EACH,WAAW,GAAe,GAAsB;GAE9C,IADAA,EAAQ,WAAWC,GAAQC,CAAK,GAC5B,CAACJ,EAAK,WAAW;GACrB,IAAMK,IAAQH,EAAQ,QAAQC,EAAO,EAAE,GACjCG,IAAQN,EAAK,UAAUK,CAAK;GAGlC,AADKH,EAAQ,aAAaC,EAAO,IAAIH,EAAK,QAAQ,KAAGO,EAAeL,GAASC,EAAO,IAAIG,CAAK,GAC7FE,EAAUC,GAAUP,GAAS;IAC3B,IAAIC,EAAO;IACX,MAAMG;IACN,IAAID;IACJ;IACA,QAAQL,EAAK;IACb,UAAUA,EAAK;IACf,UAAU;GACZ,CAAC;EACH;EACA,WAAW,GAAkB;GAC3B,IAAI,CAACA,EAAK,QAAQ;IAChB,EAAQ,WAAWU,CAAE;IACrB;GACF;GACA,IAAIT,EAAQ,IAAIS,CAAE,GAAG;GACrB,EAAQ,IAAIA,CAAE;GACd,IAAIC,UAAsB,CAAC,GACrBC,IAASV,EAAQ,aAAaQ,GAAIV,EAAK,QAAQ,GAC/Ca,IAAOD,GAAQ,UAAU,GACzBE,UAAqB;IACzB,AAAKb,EAAQ,OAAOS,CAAE,MACtBC,EAAQ,GAEJC,KAAQA,EAAO,OAAOC,CAAa,GACvCX,EAAQ,WAAWQ,CAAE;GACvB,GACMK,IAAUb,EAAQ,QAAQQ,CAAE,GAC5BM,IAASR,EAAUC,GAAUP,GAAS;IAC1C;IACA,IAAIF,EAAK,OAAOe,CAAO;IACvB;IACA,QAAQf,EAAK;IACb,UAAUA,EAAK;IACf,UAAU;IACV,QAAQc;GACV,CAAC;GAED,IAAUL,EAAS,OAAO,MAAU;IAClC,CAAKQ,EAAM,SAAS,YAAYA,EAAM,SAAS,gBAAgBA,EAAM,UAAU,OAAOD,EAAO,MAAIF,EAAO;GAC1G,CAAC;EACH;CACF;AACF"}
|