@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameLoop.js","names":["useFrameLoop","dirtyRef","useRef","aliveRef","paintingRef","paintRef","useLatest","paint","syncRef","options","subsRef","beforeRef","retriedRef","rearmRef","runPaint","useCallback","
|
|
1
|
+
{"version":3,"file":"useFrameLoop.js","names":["useFrameLoop","dirtyRef","useRef","aliveRef","paintingRef","paintRef","useLatest","paint","syncRef","options","subsRef","beforeRef","resumeRef","lastTimeRef","retriedRef","rearmRef","runPaint","useCallback","time","at","landed","fn","err","frame","useVisibleRaf","requestRedraw","subscribeFrame","subscribeBeforePaint","subscribeResume","useLayoutEffect","subs","before","resume"],"sources":["../../src/canvas/useFrameLoop.ts"],"sourcesContent":["/**\n * The frame loop behind `<Canvas>`: a dirty flag, one frame in flight at a\n * time, and a subscriber set notified after a paint lands. When frames may run\n * at all is `useVisibleRaf`'s question, not this hook's — a redraw requested\n * while nothing can see the surface is held there and re-armed on resume.\n *\n * @internal Not consumer surface. Canvas exposes `requestRedraw` and\n * `subscribeFrame` on its ref handle; this is how they are implemented.\n */\n\nimport { useCallback, useInsertionEffect, useLayoutEffect, useRef } from 'react';\nimport { useLatest, useVisibleRaf, type VisibleRafTarget } from '@weasel-js/react';\n\nexport interface FrameLoop {\n /** Mark the surface dirty and schedule a frame. Identity is stable for the\n * lifetime of the component — consumers capture it. */\n requestRedraw(): void;\n /** Run `fn` after every landed paint, with the frame's time. Returns an\n * unsubscribe. */\n subscribeFrame(fn: (time: number) => void): () => void;\n /** Run `fn` on every frame just before its paint, with the frame's time.\n * Returns an unsubscribe. */\n subscribeBeforePaint(fn: (time: number) => void): () => void;\n /** Run `fn` when the loop leaves suspension, before the frame that follows.\n * Returns an unsubscribe. */\n subscribeResume(fn: () => void): () => void;\n}\n\nexport interface FrameLoopOptions {\n /** Paint in the caller's own stack — the commit or event that asked for the\n * redraw — instead of on the next animation frame. Read live, so toggling\n * it takes effect from the next `requestRedraw` on. */\n syncPaint?: boolean;\n /** The surface being painted. Given one, the loop also stops while that\n * element sits outside the viewport, not only while the tab is hidden. */\n target?: VisibleRafTarget;\n}\n\n/**\n * @param paint Runs on the frame; returns whether pixels landed. A `false`\n * leaves the surface dirty and notifies nobody, so the next request retries.\n */\nexport function useFrameLoop(paint: () => boolean, options: FrameLoopOptions = {}): FrameLoop {\n const dirtyRef = useRef(true);\n const aliveRef = useRef(true);\n const paintingRef = useRef(false);\n const paintRef = useLatest(paint);\n const syncRef = useLatest(options.syncPaint ?? false);\n const subsRef = useRef<Set<(time: number) => void>>(new Set());\n const beforeRef = useRef<Set<(time: number) => void>>(new Set());\n const resumeRef = useRef<Set<() => void>>(new Set());\n /** The last time handed to subscribers. A sync paint reads the clock at the\n * call and a rAF frame carries its frame's start, so within one animation\n * frame the second can be the earlier of the two. */\n const lastTimeRef = useRef(-Infinity);\n\n /** Set while recovering from a paint that threw, so one bad frame is retried\n * and a permanently throwing one still doesn't spin at frame rate. */\n const retriedRef = useRef(false);\n /** `frame.request`, which doesn't exist until after `runPaint` is built. */\n const rearmRef = useRef<(() => void) | null>(null);\n\n const runPaint = useCallback((at: number) => {\n const time = Math.max(at, lastTimeRef.current);\n lastTimeRef.current = time;\n dirtyRef.current = false;\n paintingRef.current = true;\n let landed = false;\n try {\n for (const fn of beforeRef.current) fn(time);\n landed = paintRef.current();\n if (!landed) {\n dirtyRef.current = true;\n return;\n }\n retriedRef.current = false;\n // Notified inside the guard: a subscriber calling `requestRedraw` under\n // `syncPaint` would otherwise re-enter this synchronously, without bound.\n for (const fn of subsRef.current) fn(time);\n } catch (err) {\n // A throw skips the `!landed` branch above, so without this the surface\n // is left clean but unpainted — the pixels on screen are whatever the\n // last landed frame left, and nothing repaints until something\n // unrelated happens to request a redraw. That is how a single\n // malformed node blanked a whole document until the pointer moved.\n dirtyRef.current = true;\n if (!retriedRef.current) {\n retriedRef.current = true;\n rearmRef.current?.();\n }\n throw err;\n } finally {\n paintingRef.current = false;\n }\n }, [paintRef]);\n\n const frame = useVisibleRaf(\n useCallback((time: number) => {\n if (!aliveRef.current || !dirtyRef.current) return;\n runPaint(time);\n }, [runPaint]),\n {\n target: options.target,\n onResume: useCallback(() => { for (const fn of resumeRef.current) fn(); }, []),\n },\n );\n useInsertionEffect(() => {\n rearmRef.current = () => { frame.request(); };\n });\n\n const requestRedraw = useCallback(() => {\n dirtyRef.current = true;\n // The gate suppresses the sync path too: a background tab still commits\n // React updates, and that is the one paint browser throttling does not stop.\n // A request made from inside a draw or a frame subscriber would recurse\n // forever if it painted here, so re-entrant ones fall through to a frame.\n if (syncRef.current && aliveRef.current && !paintingRef.current && frame.isVisible()) {\n runPaint(performance.now());\n return;\n }\n frame.request();\n }, [frame, runPaint, syncRef]);\n\n const subscribeFrame = useCallback((fn: (time: number) => void) => {\n subsRef.current.add(fn);\n return () => { subsRef.current.delete(fn); };\n }, []);\n const subscribeBeforePaint = useCallback((fn: (time: number) => void) => {\n beforeRef.current.add(fn);\n return () => { beforeRef.current.delete(fn); };\n }, []);\n\n const subscribeResume = useCallback((fn: () => void) => {\n resumeRef.current.add(fn);\n return () => { resumeRef.current.delete(fn); };\n }, []);\n\n // `requestRedraw` outlives the component: `@weasel-js/hud` calls it from a\n // `.then()`, and `viewRegistry.attachSurface` hands it to the consumer.\n // Re-armed in setup because refs survive StrictMode's simulated remount, and\n // a layout effect so the arming precedes Canvas's own layout effects — the\n // sync-paint path runs in one of those.\n useLayoutEffect(() => {\n aliveRef.current = true;\n const subs = subsRef.current;\n const before = beforeRef.current;\n const resume = resumeRef.current;\n return () => {\n aliveRef.current = false;\n subs.clear();\n before.clear();\n resume.clear();\n };\n }, []);\n\n return { requestRedraw, subscribeFrame, subscribeBeforePaint, subscribeResume };\n}\n"],"mappings":";;;AA0CA,SAAgBA,EAAa,GAAsB,IAA4B,CAAC,GAAc;CAC5F,IAAMC,IAAWC,EAAO,EAAI,GACtBC,IAAWD,EAAO,EAAI,GACtBE,IAAcF,EAAO,EAAK,GAC1BG,IAAWC,EAAUC,CAAK,GAC1BC,IAAUF,EAAUG,EAAQ,aAAa,EAAK,GAC9CC,IAAUR,kBAAoC,IAAI,IAAI,CAAC,GACvDS,IAAYT,kBAAoC,IAAI,IAAI,CAAC,GACzDU,IAAYV,kBAAwB,IAAI,IAAI,CAAC,GAI7CW,IAAcX,EAAO,SAAS,GAI9BY,IAAaZ,EAAO,EAAK,GAEzBa,IAAWb,EAA4B,IAAI,GAE3Cc,IAAWC,GAAa,MAAe;EAC3C,IAAMC,IAAO,KAAK,IAAIC,GAAIN,EAAY,OAAO;EAG7C,AAFA,EAAY,UAAUK,GACtB,EAAS,UAAU,IACnB,EAAY,UAAU;EACtB,IAAIE,IAAS;EACb,IAAI;GACF,KAAK,IAAMC,KAAMV,EAAU,SAAS,EAAGO,CAAI;GAE3C,IADA,IAASb,EAAS,QAAQ,GACtB,CAACe,GAAQ;IACX,EAAS,UAAU;IACnB;GACF;GACA,EAAW,UAAU;GAGrB,KAAK,IAAMC,KAAMX,EAAQ,SAAS,EAAGQ,CAAI;EAC3C,SAASI,GAAK;GAWZ,MALA,EAAS,UAAU,IACdR,EAAW,YACd,EAAW,UAAU,IACrBC,EAAS,UAAU,IAEfO;EACR,UAAU;GACR,EAAY,UAAU;EACxB;CACF,GAAG,CAACjB,CAAQ,CAAC,GAEPkB,IAAQC,EACZP,GAAa,MAAiB;EAC5B,AAAKd,EAAS,WAAYF,EAAS,WACnCe,EAASE,CAAI;CACf,GAAG,CAACF,CAAQ,CAAC,GACb;EACE,QAAQP,EAAQ;EAChB,UAAUQ,QAAkB;GAAE,KAAK,IAAMI,KAAMT,EAAU,SAAS,EAAG;EAAG,GAAG,CAAC,CAAC;CAC/E,CACF;CACA,QAAyB;EACvB,EAAS,gBAAgB;GAAE,EAAM,QAAQ;EAAG;CAC9C,CAAC;CAED,IAAMa,IAAgBR,QAAkB;EAMtC,IALA,EAAS,UAAU,IAKfT,EAAQ,WAAWL,EAAS,WAAW,CAACC,EAAY,WAAWmB,EAAM,UAAU,GAAG;GACpF,EAAS,YAAY,IAAI,CAAC;GAC1B;EACF;EACA,EAAM,QAAQ;CAChB,GAAG;EAACA;EAAOP;EAAUR;CAAO,CAAC,GAEvBkB,IAAiBT,GAAa,OAClCP,EAAQ,QAAQ,IAAIW,CAAE,SACT;EAAE,EAAQ,QAAQ,OAAOA,CAAE;CAAG,IAC1C,CAAC,CAAC,GACCM,IAAuBV,GAAa,OACxCN,EAAU,QAAQ,IAAIU,CAAE,SACX;EAAE,EAAU,QAAQ,OAAOA,CAAE;CAAG,IAC5C,CAAC,CAAC,GAECO,IAAkBX,GAAa,OACnCL,EAAU,QAAQ,IAAIS,CAAE,SACX;EAAE,EAAU,QAAQ,OAAOA,CAAE;CAAG,IAC5C,CAAC,CAAC;CAoBL,OAbAQ,QAAsB;EACpB,EAAS,UAAU;EACnB,IAAMC,IAAOpB,EAAQ,SACfqB,IAASpB,EAAU,SACnBqB,IAASpB,EAAU;EACzB,aAAa;GAIX,AAHA,EAAS,UAAU,IACnBkB,EAAK,MAAM,GACXC,EAAO,MAAM,GACbC,EAAO,MAAM;EACf;CACF,GAAG,CAAC,CAAC,GAEE;EAAE;EAAe;EAAgB;EAAsB;CAAgB;AAChF"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { hostAnchorCss as e, hostAnchorRect as t } from "./hostAnchor.js";
|
|
2
|
+
import { watchElementMove as n } from "./watchElementMove.js";
|
|
3
3
|
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
4
|
-
import { useLatest as o } from "@weasel-js/react";
|
|
4
|
+
import { useLatest as o, useVisibleRaf as s } from "@weasel-js/react";
|
|
5
5
|
//#region src/canvas/useHostAnchor.ts
|
|
6
|
-
function
|
|
7
|
-
let [
|
|
8
|
-
let
|
|
9
|
-
if (!
|
|
10
|
-
|
|
6
|
+
function c(c, l) {
|
|
7
|
+
let [u, d] = a(null), [f, p] = a(null), m = r((e) => d(e), []), h = o(c), { align: g, offset: _, padding: v = 0 } = l, { x: y, y: b } = g, { x, y: S } = _, C = r(() => {
|
|
8
|
+
let n = h.current();
|
|
9
|
+
if (!n) {
|
|
10
|
+
p(null);
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
let r =
|
|
13
|
+
let r = n.getBoundingClientRect(), i = u?.getBoundingClientRect(), a = {
|
|
14
14
|
width: window.innerWidth,
|
|
15
15
|
height: window.innerHeight
|
|
16
16
|
}, o = {
|
|
17
|
-
x:
|
|
18
|
-
y
|
|
19
|
-
}, s =
|
|
17
|
+
x: y,
|
|
18
|
+
y: b
|
|
19
|
+
}, s = t({
|
|
20
20
|
host: {
|
|
21
21
|
x: r.left,
|
|
22
22
|
y: r.top,
|
|
@@ -30,42 +30,44 @@ function s(s, c) {
|
|
|
30
30
|
viewport: a,
|
|
31
31
|
align: o,
|
|
32
32
|
offset: {
|
|
33
|
-
x
|
|
34
|
-
y:
|
|
33
|
+
x,
|
|
34
|
+
y: S
|
|
35
35
|
},
|
|
36
|
-
padding:
|
|
36
|
+
padding: v
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
p(e(s, o, a));
|
|
39
39
|
}, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
v,
|
|
40
|
+
h,
|
|
41
|
+
u,
|
|
43
42
|
y,
|
|
44
43
|
b,
|
|
45
44
|
x,
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
S,
|
|
46
|
+
v
|
|
47
|
+
]), w = s(C);
|
|
48
48
|
return i(() => {
|
|
49
|
-
|
|
50
|
-
let e = () =>
|
|
49
|
+
C();
|
|
50
|
+
let e = () => w.request();
|
|
51
51
|
window.addEventListener("scroll", e, !0), window.addEventListener("resize", e);
|
|
52
52
|
let t = typeof ResizeObserver < "u" ? new ResizeObserver(e) : null;
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
u && t?.observe(u);
|
|
54
|
+
let r = h.current();
|
|
55
|
+
r && t?.observe(r);
|
|
56
|
+
let i = r ? n(r, e) : void 0;
|
|
57
|
+
return () => {
|
|
58
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), w.cancel(), t?.disconnect(), i?.();
|
|
57
59
|
};
|
|
58
60
|
}, [
|
|
59
|
-
S,
|
|
60
61
|
C,
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
w,
|
|
63
|
+
u,
|
|
64
|
+
h
|
|
63
65
|
]), {
|
|
64
|
-
ref:
|
|
65
|
-
style:
|
|
66
|
+
ref: m,
|
|
67
|
+
style: f
|
|
66
68
|
};
|
|
67
69
|
}
|
|
68
70
|
//#endregion
|
|
69
|
-
export {
|
|
71
|
+
export { c as useHostAnchor };
|
|
70
72
|
|
|
71
73
|
//# sourceMappingURL=useHostAnchor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHostAnchor.js","names":["useHostAnchor","panel","setPanel","useState","style","setStyle","ref","useCallback","el","resolve","useLatest","resolveHost","options","alignX","alignY","align","offsetX","offsetY","offset","recompute","hostEl","h","p","viewport","rect","hostAnchorRect","hostAnchorCss","padding","raf","useVisibleRaf","useEffect","schedule","observer"],"sources":["../../src/canvas/useHostAnchor.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport {
|
|
1
|
+
{"version":3,"file":"useHostAnchor.js","names":["useHostAnchor","panel","setPanel","useState","style","setStyle","ref","useCallback","el","resolve","useLatest","resolveHost","options","alignX","alignY","align","offsetX","offsetY","offset","recompute","hostEl","h","p","viewport","rect","hostAnchorRect","hostAnchorCss","padding","raf","useVisibleRaf","useEffect","schedule","observer","unwatchMove","watchElementMove"],"sources":["../../src/canvas/useHostAnchor.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport { useLatest, useVisibleRaf } from '@weasel-js/react';\nimport {\n hostAnchorCss, hostAnchorRect,\n type HostAnchorAlign, type HostAnchorOffset,\n} from './hostAnchor';\nimport { watchElementMove } from './watchElementMove';\n\n/** Options for {@link useHostAnchor}. */\nexport interface UseHostAnchorOptions {\n align: HostAnchorAlign;\n offset: HostAnchorOffset;\n /** Minimum gap kept between the panel and the viewport edge. Default 0. */\n padding?: number;\n}\n\n/** CSS the caller spreads onto the panel; which edges appear follows `align`. */\nexport type HostAnchorStyle = { top?: number; right?: number; bottom?: number; left?: number };\n\n/**\n * Hold a fixed-position panel against a host element's corner, kept inside the\n * viewport, following it through scrolls, resizes, and reflows, a host moved by\n * its neighbors included.\n *\n * `resolveHost` runs on every recompute, so a host that mounts late or is found\n * by selector works the same as one held in a ref. Put the returned `ref` on the\n * panel: until it is measured the panel counts as zero-sized, which resolves to\n * the bare corner, so the first paint lands where an unclamped anchor would and\n * measurement only ever pulls it back on screen.\n */\nexport function useHostAnchor(\n resolveHost: () => Element | null,\n options: UseHostAnchorOptions,\n): { ref: (el: HTMLElement | null) => void; style: HostAnchorStyle | null } {\n const [panel, setPanel] = useState<HTMLElement | null>(null);\n const [style, setStyle] = useState<HostAnchorStyle | null>(null);\n const ref = useCallback((el: HTMLElement | null) => setPanel(el), []);\n\n // Held in a ref so a caller passing an inline arrow doesn't re-subscribe\n // every render.\n const resolve = useLatest(resolveHost);\n\n const { align, offset, padding = 0 } = options;\n const { x: alignX, y: alignY } = align;\n const { x: offsetX, y: offsetY } = offset;\n\n const recompute = useCallback(() => {\n const hostEl = resolve.current();\n if (!hostEl) {\n setStyle(null);\n return;\n }\n const h = hostEl.getBoundingClientRect();\n const p = panel?.getBoundingClientRect();\n const viewport = { width: window.innerWidth, height: window.innerHeight };\n const align = { x: alignX, y: alignY };\n const rect = hostAnchorRect({\n host: { x: h.left, y: h.top, width: h.width, height: h.height },\n panel: { width: p?.width ?? 0, height: p?.height ?? 0 },\n viewport,\n align,\n offset: { x: offsetX, y: offsetY },\n padding,\n });\n setStyle(hostAnchorCss(rect, align, viewport));\n }, [resolve, panel, alignX, alignY, offsetX, offsetY, padding]);\n\n // Coalesces bursts of scroll/resize into one frame, and holds the work while\n // the tab is hidden rather than dropping it.\n const raf = useVisibleRaf(recompute);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- measures layout\n recompute();\n const schedule = () => raf.request();\n window.addEventListener('scroll', schedule, true);\n window.addEventListener('resize', schedule);\n const observer =\n typeof ResizeObserver !== 'undefined' ? new ResizeObserver(schedule) : null;\n if (panel) observer?.observe(panel);\n const hostEl = resolve.current();\n if (hostEl) observer?.observe(hostEl);\n const unwatchMove = hostEl ? watchElementMove(hostEl, schedule) : undefined;\n\n return () => {\n window.removeEventListener('scroll', schedule, true);\n window.removeEventListener('resize', schedule);\n raf.cancel();\n observer?.disconnect();\n unwatchMove?.();\n };\n }, [recompute, raf, panel, resolve]);\n\n return { ref, style };\n}\n"],"mappings":";;;;;AA8BA,SAAgBA,EACd,GACA,GAC0E;CAC1E,IAAM,CAACC,GAAOC,KAAYC,EAA6B,IAAI,GACrD,CAACC,GAAOC,KAAYF,EAAiC,IAAI,GACzDG,IAAMC,GAAa,MAA2BL,EAASM,CAAE,GAAG,CAAC,CAAC,GAI9DC,IAAUC,EAAUC,CAAW,GAE/B,EAAE,UAAO,WAAQ,aAAU,MAAMC,GACjC,EAAE,GAAGC,GAAQ,GAAGC,MAAWC,GAC3B,EAAKC,GAAS,GAAGC,MAAYC,GAE7BC,IAAYZ,QAAkB;EAClC,IAAMa,IAASX,EAAQ,QAAQ;EAC/B,IAAI,CAACW,GAAQ;GACX,EAAS,IAAI;GACb;EACF;EACA,IAAMC,IAAID,EAAO,sBAAsB,GACjCE,IAAIrB,GAAO,sBAAsB,GACjCsB,IAAW;GAAE,OAAO,OAAO;GAAY,QAAQ,OAAO;EAAY,GAClER,IAAQ;GAAE,GAAGF;GAAQ,GAAGC;EAAO,GAC/BU,IAAOC,EAAe;GAC1B,MAAM;IAAE,GAAGJ,EAAE;IAAM,GAAGA,EAAE;IAAK,OAAOA,EAAE;IAAO,QAAQA,EAAE;GAAO;GAC9D,OAAO;IAAE,OAAOC,GAAG,SAAS;IAAG,QAAQA,GAAG,UAAU;GAAE;GACtD;GACA;GACA,QAAQ;IAAKN;IAAS,GAAGC;GAAQ;GACjC;EACF,CAAC;EACD,EAASS,EAAcF,GAAMT,GAAOQ,CAAQ,CAAC;CAC/C,GAAG;EAACd;EAASR;EAAOY;EAAQC;EAAQE;EAASC;EAASU;CAAO,CAAC,GAIxDC,IAAMC,EAAcV,CAAS;CAwBnC,OAtBAW,QAAgB;EAEd,EAAU;EACV,IAAMC,UAAiBH,EAAI,QAAQ;EAEnC,AADA,OAAO,iBAAiB,UAAUG,GAAU,EAAI,GAChD,OAAO,iBAAiB,UAAUA,CAAQ;EAC1C,IAAMC,IACJ,OAAO,iBAAmB,MAAc,IAAI,eAAeD,CAAQ,IAAI;EACzE,AAAI9B,KAAO+B,GAAU,QAAQ/B,CAAK;EAClC,IAAMmB,IAASX,EAAQ,QAAQ;EAC/B,AAAIW,KAAQY,GAAU,QAAQZ,CAAM;EACpC,IAAMa,IAAcb,IAASc,EAAiBd,GAAQW,CAAQ,IAAI,KAAA;EAElE,aAAa;GAKX,AAJA,OAAO,oBAAoB,UAAUA,GAAU,EAAI,GACnD,OAAO,oBAAoB,UAAUA,CAAQ,GAC7CH,EAAI,OAAO,GACXI,GAAU,WAAW,GACrBC,IAAc;EAChB;CACF,GAAG;EAACd;EAAWS;EAAK3B;EAAOQ;CAAO,CAAC,GAE5B;EAAE;EAAK;CAAM;AACtB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { paintKindRegistry as e } from "../core/paintKinds.js";
|
|
2
|
-
import { subscribeImageReady as t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { paintKindRegistry as e } from "../core/paint/paintKinds.js";
|
|
2
|
+
import { subscribeImageReady as t } from "@weasel-js/renderer";
|
|
3
|
+
import { useEffect as n } from "react";
|
|
4
|
+
import { subscribeGlyphReady as r } from "@weasel-js/font";
|
|
5
5
|
//#region src/canvas/useLateContentRedraw.ts
|
|
6
6
|
function i(i) {
|
|
7
|
-
|
|
8
|
-
let
|
|
7
|
+
n(() => {
|
|
8
|
+
let n = [
|
|
9
9
|
t(i),
|
|
10
|
-
|
|
10
|
+
r(i),
|
|
11
11
|
e.subscribe(i)
|
|
12
12
|
];
|
|
13
13
|
return () => {
|
|
14
|
-
for (let e of
|
|
14
|
+
for (let e of n) e();
|
|
15
15
|
};
|
|
16
16
|
}, [i]);
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLateContentRedraw.js","names":["useLateContentRedraw","offs","subscribeImageReady","requestRedraw","subscribeGlyphReady","paintKindRegistry","off"],"sources":["../../src/canvas/useLateContentRedraw.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { subscribeGlyphReady } from '@weasel-js/font';\nimport { subscribeImageReady } from '
|
|
1
|
+
{"version":3,"file":"useLateContentRedraw.js","names":["useLateContentRedraw","offs","subscribeImageReady","requestRedraw","subscribeGlyphReady","paintKindRegistry","off"],"sources":["../../src/canvas/useLateContentRedraw.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { subscribeGlyphReady } from '@weasel-js/font';\nimport { subscribeImageReady } from '@weasel-js/renderer';\nimport { paintKindRegistry } from 'core/paint/paintKinds';\n\n/**\n * Repaint whenever something a frame could not draw becomes drawable: an image\n * finishes decoding, a deferred glyph bake or font load lands, or a paint kind\n * registers late. Each of these drew nothing (or a placeholder) on the frame\n * that asked for it and says nothing further unless a surface is listening.\n */\nexport function useLateContentRedraw(requestRedraw: () => void): void {\n useEffect(() => {\n const offs = [\n subscribeImageReady(requestRedraw),\n subscribeGlyphReady(requestRedraw),\n paintKindRegistry.subscribe(requestRedraw),\n ];\n return () => { for (const off of offs) off(); };\n }, [requestRedraw]);\n}\n"],"mappings":";;;;;AAWA,SAAgBA,EAAqB,GAAiC;CACpE,QAAgB;EACd,IAAMC,IAAO;GACXC,EAAoBC,CAAa;GACjCC,EAAoBD,CAAa;GACjCE,EAAkB,UAAUF,CAAa;EAC3C;EACA,aAAa;GAAE,KAAK,IAAMG,KAAOL,GAAM,EAAI;EAAG;CAChD,GAAG,CAACE,CAAa,CAAC;AACpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useCallback as e, useSyncExternalStore as t } from "react";
|
|
2
|
+
//#region src/canvas/useSceneLayerList.ts
|
|
3
|
+
var n = () => {}, r = (e) => typeof e?.getLayers == "function" ? e.getLayers().map((e) => e.id).join("\n") : "";
|
|
4
|
+
function i(i) {
|
|
5
|
+
let a = e((e) => i?.subscribeLayers?.(e) ?? n, [i]), o = e(() => r(i), [i]);
|
|
6
|
+
return t(a, o, o);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { i as useSceneLayerList };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=useSceneLayerList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSceneLayerList.js","names":["UNSUBSCRIBED","read","adapter","l","useSceneLayerList","subscribe","useCallback","listener","snapshot","useSyncExternalStore"],"sources":["../../src/canvas/useSceneLayerList.ts"],"sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\n\ninterface LayerListSource {\n getLayers?: () => readonly { id: string }[];\n subscribeLayers?: (listener: () => void) => () => void;\n}\n\nconst UNSUBSCRIBED = (): void => {};\n\nconst read = (adapter: LayerListSource | undefined): string =>\n typeof adapter?.getLayers === 'function' ? adapter.getLayers().map((l) => l.id).join('\\n') : '';\n\n/**\n * The adapter's scene-layer ids as a render input: a string that changes when\n * a layer is added, removed, or reordered. A scene write repaints without\n * re-rendering, so the adapter's `subscribeLayers` is what tells React.\n */\nexport function useSceneLayerList(adapter: LayerListSource | undefined): string {\n const subscribe = useCallback(\n (listener: () => void) => adapter?.subscribeLayers?.(listener) ?? UNSUBSCRIBED,\n [adapter],\n );\n const snapshot = useCallback(() => read(adapter), [adapter]);\n return useSyncExternalStore(subscribe, snapshot, snapshot);\n}\n"],"mappings":";;AAOA,IAAMA,UAA2B,CAAC,GAE5BC,KAAQ,MACZ,OAAOC,GAAS,aAAc,aAAaA,EAAQ,UAAU,CAAC,CAAC,KAAK,MAAMC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI;AAO/F,SAAgBC,EAAkB,GAA8C;CAC9E,IAAMC,IAAYC,GACf,MAAyBJ,GAAS,kBAAkBK,CAAQ,KAAKP,GAClE,CAACE,CAAO,CACV,GACMM,IAAWF,QAAkBL,EAAKC,CAAO,GAAG,CAACA,CAAO,CAAC;CAC3D,OAAOO,EAAqBJ,GAAWG,GAAUA,CAAQ;AAC3D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useLayoutEffect as e, useRef as t } from "react";
|
|
2
|
+
import { useLatest as n } from "@weasel-js/react";
|
|
3
|
+
//#region src/canvas/useSurfaceInput.ts
|
|
4
|
+
function r(r, a) {
|
|
5
|
+
let o = n(a), s = t(null);
|
|
6
|
+
e(() => {
|
|
7
|
+
let e = r.current;
|
|
8
|
+
s.current?.element !== e && (s.current?.detach(), s.current = e ? {
|
|
9
|
+
element: e,
|
|
10
|
+
detach: i(e, o)
|
|
11
|
+
} : null);
|
|
12
|
+
}), e(() => () => {
|
|
13
|
+
s.current?.detach(), s.current = null;
|
|
14
|
+
}, []);
|
|
15
|
+
}
|
|
16
|
+
function i(e, t) {
|
|
17
|
+
let n = !1, r = {
|
|
18
|
+
pointerdown: () => {
|
|
19
|
+
t.current.focusOnPress && e.focus(), n = !0;
|
|
20
|
+
},
|
|
21
|
+
pointermove: (r) => {
|
|
22
|
+
n || t.current.onHover(e, r);
|
|
23
|
+
},
|
|
24
|
+
pointerup: () => {
|
|
25
|
+
n = !1;
|
|
26
|
+
},
|
|
27
|
+
pointerleave: () => {
|
|
28
|
+
n = !1, t.current.onLeave();
|
|
29
|
+
},
|
|
30
|
+
contextmenu: (e) => e.preventDefault(),
|
|
31
|
+
focus: (e) => t.current.onFocus?.(e),
|
|
32
|
+
blur: (e) => t.current.onBlur?.(e)
|
|
33
|
+
};
|
|
34
|
+
for (let [t, n] of Object.entries(r)) e.addEventListener(t, n);
|
|
35
|
+
return () => {
|
|
36
|
+
for (let [t, n] of Object.entries(r)) e.removeEventListener(t, n);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { r as useSurfaceInput };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=useSurfaceInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSurfaceInput.js","names":["useSurfaceInput","live","useLatest","handlers","attached","useRef","useLayoutEffect","element","elementRef","listen","pressed","listeners","event","type","fn"],"sources":["../../src/canvas/useSurfaceInput.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\n\n/** What a surface does with the input its element receives. */\nexport interface SurfaceInputHandlers {\n /** Focus the element on a press, so keys reach it without a click first. */\n focusOnPress: boolean;\n onFocus?: (event: FocusEvent) => void;\n onBlur?: (event: FocusEvent) => void;\n /** The pointer moved over the element with no button held. */\n onHover(element: HTMLElement, event: PointerEvent): void;\n /** The pointer left the element. */\n onLeave(): void;\n}\n\n/**\n * Listen on whichever element `elementRef` holds, moving the listeners when\n * it holds another. Handlers are read at event time, so a new set never\n * re-attaches.\n *\n * Tracks one fact about the pointer, whether a button is down, because hover\n * stands down for as long as one is. Everything else about a press is the\n * gesture dispatcher's, which listens on this same element.\n *\n * Suppresses the browser's context menu: right-click is a gesture surface\n * tools may consume.\n */\nexport function useSurfaceInput(\n elementRef: { readonly current: HTMLElement | null },\n handlers: SurfaceInputHandlers,\n): void {\n const live = useLatest(handlers);\n const attached = useRef<{ element: HTMLElement; detach: () => void } | null>(null);\n\n useLayoutEffect(() => {\n const element = elementRef.current;\n if (attached.current?.element === element) return;\n attached.current?.detach();\n attached.current = element ? { element, detach: listen(element, live) } : null;\n });\n useLayoutEffect(() => () => {\n attached.current?.detach();\n attached.current = null;\n }, []);\n}\n\nfunction listen(element: HTMLElement, live: { readonly current: SurfaceInputHandlers }): () => void {\n let pressed = false;\n const listeners: Record<string, (event: Event) => void> = {\n pointerdown: () => {\n if (live.current.focusOnPress) element.focus();\n pressed = true;\n },\n pointermove: (event) => {\n if (!pressed) live.current.onHover(element, event as PointerEvent);\n },\n pointerup: () => { pressed = false; },\n pointerleave: () => {\n pressed = false;\n live.current.onLeave();\n },\n contextmenu: (event) => event.preventDefault(),\n focus: (event) => live.current.onFocus?.(event as FocusEvent),\n blur: (event) => live.current.onBlur?.(event as FocusEvent),\n };\n for (const [type, fn] of Object.entries(listeners)) element.addEventListener(type, fn);\n return () => {\n for (const [type, fn] of Object.entries(listeners)) element.removeEventListener(type, fn);\n };\n}\n"],"mappings":";;;AA2BA,SAAgBA,EACd,GACA,GACM;CACN,IAAMC,IAAOC,EAAUC,CAAQ,GACzBC,IAAWC,EAA4D,IAAI;CAQjF,AANAC,QAAsB;EACpB,IAAMC,IAAUC,EAAW;EAC3B,AAAIJ,EAAS,SAAS,YAAYG,MAClCH,EAAS,SAAS,OAAO,GACzB,EAAS,UAAUG,IAAU;GAAE;GAAS,QAAQE,EAAOF,GAASN,CAAI;EAAE,IAAI;CAC5E,CAAC,GACDK,cAA4B;EAE1B,AADAF,EAAS,SAAS,OAAO,GACzB,EAAS,UAAU;CACrB,GAAG,CAAC,CAAC;AACP;AAEA,SAASK,EAAO,GAAsB,GAA8D;CAClG,IAAIC,IAAU,IACRC,IAAoD;EACxD,mBAAmB;GAEjB,AADIV,EAAK,QAAQ,gBAAcM,EAAQ,MAAM,GAC7C,IAAU;EACZ;EACA,cAAc,MAAU;GACtB,AAAKG,KAAST,EAAK,QAAQ,QAAQM,GAASK,CAAqB;EACnE;EACA,iBAAiB;GAAE,IAAU;EAAO;EACpC,oBAAoB;GAElB,AADA,IAAU,IACVX,EAAK,QAAQ,QAAQ;EACvB;EACA,cAAc,MAAUW,EAAM,eAAe;EAC7C,QAAQ,MAAUX,EAAK,QAAQ,UAAUW,CAAmB;EAC5D,OAAO,MAAUX,EAAK,QAAQ,SAASW,CAAmB;CAC5D;CACA,KAAK,IAAM,CAACC,GAAMC,MAAO,OAAO,QAAQH,CAAS,GAAG,EAAQ,iBAAiBE,GAAMC,CAAE;CACrF,aAAa;EACX,KAAK,IAAM,CAACD,GAAMC,MAAO,OAAO,QAAQH,CAAS,GAAG,EAAQ,oBAAoBE,GAAMC,CAAE;CAC1F;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useLayoutEffect as e } from "react";
|
|
2
|
+
import { resolveCursorTier as t } from "@weasel-js/cursor";
|
|
3
|
+
//#region src/canvas/useToolCursor.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
let n = e.hotkeyEngaged ?? e.active, r = n === null ? void 0 : e.registry[n];
|
|
6
|
+
if (r?.cursor) {
|
|
7
|
+
if (typeof r.cursor != "function") return t(r.cursor);
|
|
8
|
+
try {
|
|
9
|
+
return t(r.cursor());
|
|
10
|
+
} catch {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function r(t, r, i, a) {
|
|
16
|
+
let o = r ? n(r) : void 0, s = o === void 0 ? "" : o.kind === "css" ? `css|${o.css}` : `${o.glyph}|${o.angle}|${o.size}|${o.worldRadius}`;
|
|
17
|
+
e(() => {
|
|
18
|
+
t.setBase(o ?? null, a ?? "");
|
|
19
|
+
}, [
|
|
20
|
+
t,
|
|
21
|
+
s,
|
|
22
|
+
i,
|
|
23
|
+
a
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as useToolCursor };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=useToolCursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolCursor.js","names":["resolveToolsCursor","id","tools","tool","resolveCursorTier","useToolCursor","tier","key","rest","sink","element"],"sources":["../../src/canvas/useToolCursor.ts"],"sourcesContent":["import { useLayoutEffect } from 'react';\nimport { resolveCursorTier, type CursorSink, type ResolvedCursor } from '@weasel-js/cursor';\nimport type { ToolsApi } from '../tools/overlayBinding';\n\nfunction resolveToolsCursor(tools: ToolsApi): ResolvedCursor | undefined {\n const id = tools.hotkeyEngaged ?? tools.active;\n const tool = id === null ? undefined : tools.registry[id];\n if (!tool?.cursor) return undefined;\n if (typeof tool.cursor !== 'function') return resolveCursorTier(tool.cursor);\n try {\n return resolveCursorTier(tool.cursor());\n } catch {\n return undefined;\n }\n}\n\n/**\n * Writes the active tool's cursor to `sink` as its base, and `rest` (the\n * element's own cursor) for when the tool declares none.\n *\n * `element` is what the sink writes to, named so the base is written again\n * when a detached surface's input element arrives a render late.\n */\nexport function useToolCursor(\n sink: CursorSink,\n tools: ToolsApi | undefined,\n element: HTMLElement | null | undefined,\n rest: string | undefined,\n): void {\n const tier = tools ? resolveToolsCursor(tools) : undefined;\n // Keyed on the value, not the object: the tier is rebuilt every render.\n const key = tier === undefined\n ? ''\n : tier.kind === 'css'\n ? `css|${tier.css}`\n : `${tier.glyph}|${tier.angle}|${tier.size}|${tier.worldRadius}`;\n useLayoutEffect(() => {\n sink.setBase(tier ?? null, rest ?? '');\n // `tier` is a fresh object each render; the key is its identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [sink, key, element, rest]);\n}\n"],"mappings":";;;AAIA,SAASA,EAAmB,GAA6C;CACvE,IAAMC,IAAKC,EAAM,iBAAiBA,EAAM,QAClCC,IAAOF,MAAO,OAAO,KAAA,IAAYC,EAAM,SAASD;CACtD,IAAKE,GAAM,QACX;MAAI,OAAOA,EAAK,UAAW,YAAY,OAAOC,EAAkBD,EAAK,MAAM;EAC3E,IAAI;GACF,OAAOC,EAAkBD,EAAK,OAAO,CAAC;EACxC,QAAQ;GACN;EACF;CAL2E;AAM7E;AASA,SAAgBE,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAOJ,IAAQF,EAAmBE,CAAK,IAAI,KAAA,GAE3CK,IAAMD,MAAS,KAAA,IACjB,KACAA,EAAK,SAAS,QACZ,OAAOA,EAAK,QACZ,GAAGA,EAAK,MAAM,GAAGA,EAAK,MAAM,GAAGA,EAAK,KAAK,GAAGA,EAAK;CACvD,QAAsB;EACpB,EAAK,QAAQA,KAAQ,MAAME,KAAQ,EAAE;CAGvC,GAAG;EAACC;EAAMF;EAAKG;EAASF;CAAI,CAAC;AAC/B"}
|
|
@@ -1,73 +1,41 @@
|
|
|
1
1
|
import { unionAABB as e } from "../core/geometry/unionBounds.js";
|
|
2
|
-
import {
|
|
3
|
-
import { buildChromeState as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { useLatest as
|
|
2
|
+
import { framedBounds as t } from "../core/geometry/poseDescriptor.js";
|
|
3
|
+
import { buildChromeState as n } from "../core/selection/chromeState.js";
|
|
4
|
+
import { useCallback as r, useMemo as i } from "react";
|
|
5
|
+
import { useLatest as a } from "@weasel-js/react";
|
|
6
6
|
//#region src/canvas/useViewHelpers.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var o = () => {}, s = () => !0;
|
|
8
|
+
function c(e, t) {
|
|
9
9
|
return typeof e.getWorldPose == "function" ? e.getWorldPose(t) : e.getPose(t);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
let { adapter:
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
11
|
+
function l(l) {
|
|
12
|
+
let { adapter: u, geometry: d, boundsOf: f, boundsOfPose: p, selection: m, gestureSource: h, previewPoseExtra: g, getIsVisible: _ } = l, v = r((e, n) => p ? p(e, n) : t(n, d), [p, d]), y = i(() => {
|
|
13
|
+
if (f) return f;
|
|
14
|
+
if (u) return (e) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
return r ? {
|
|
18
|
-
...n,
|
|
19
|
-
rotation: r
|
|
20
|
-
} : n;
|
|
16
|
+
return t(c(u, e), d);
|
|
21
17
|
} catch {
|
|
22
18
|
return null;
|
|
23
19
|
}
|
|
24
20
|
};
|
|
25
21
|
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]),
|
|
30
|
-
if (!
|
|
22
|
+
f,
|
|
23
|
+
u,
|
|
24
|
+
d
|
|
25
|
+
]), b = r((e) => {
|
|
26
|
+
if (!u) return null;
|
|
31
27
|
try {
|
|
32
|
-
return
|
|
28
|
+
return c(u, e);
|
|
33
29
|
} catch {
|
|
34
30
|
return null;
|
|
35
31
|
}
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
let t = D.current.previewPoseExtra;
|
|
45
|
-
if (t) {
|
|
46
|
-
let n = t(e);
|
|
47
|
-
if (n != null) return n;
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}, [v, D]), A = o((e) => {
|
|
51
|
-
if (v) {
|
|
52
|
-
let t = n(v, e);
|
|
53
|
-
if (t) return t;
|
|
54
|
-
let i = r(v, e);
|
|
55
|
-
if (i != null) return C(e, i);
|
|
56
|
-
}
|
|
57
|
-
let t = D.current.previewPoseExtra;
|
|
58
|
-
if (t) {
|
|
59
|
-
let n = t(e);
|
|
60
|
-
if (n != null) return C(e, n);
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}, [
|
|
64
|
-
v,
|
|
65
|
-
C,
|
|
66
|
-
D
|
|
67
|
-
]), j = o((e) => A(e) || (O ? O(e) : null), [A, O]), M = s(() => a({
|
|
68
|
-
selection: _,
|
|
69
|
-
multiActive: E,
|
|
70
|
-
effectiveBoundsOf: j,
|
|
32
|
+
}, [u]), x = m.length > 1, S = a(g), C = i(() => f ?? y, [f, y]), w = r((e) => S.current?.(e) ?? null, [S]), T = r((e) => {
|
|
33
|
+
let t = w(e);
|
|
34
|
+
return t == null ? null : v(e, t);
|
|
35
|
+
}, [w, v]), E = r((e) => T(e) || (C ? C(e) : null), [T, C]), D = i(() => n({
|
|
36
|
+
selection: m,
|
|
37
|
+
multiActive: x,
|
|
38
|
+
effectiveBoundsOf: E,
|
|
71
39
|
modifiers: {
|
|
72
40
|
alt: !1,
|
|
73
41
|
shift: !1,
|
|
@@ -75,46 +43,39 @@ function f(f) {
|
|
|
75
43
|
ctrl: !1
|
|
76
44
|
},
|
|
77
45
|
canRotate: (e) => {
|
|
78
|
-
if (!
|
|
79
|
-
let t =
|
|
80
|
-
return t == null ||
|
|
46
|
+
if (!d.supportsRotation) return !0;
|
|
47
|
+
let t = b(e);
|
|
48
|
+
return t == null || d.supportsRotation(t);
|
|
81
49
|
}
|
|
82
50
|
}), [
|
|
83
|
-
_,
|
|
84
|
-
E,
|
|
85
|
-
j,
|
|
86
51
|
m,
|
|
87
|
-
|
|
52
|
+
x,
|
|
53
|
+
E,
|
|
54
|
+
d,
|
|
55
|
+
b
|
|
88
56
|
]);
|
|
89
57
|
return {
|
|
90
58
|
helpers: {
|
|
91
|
-
getEffectivePose: (e) =>
|
|
92
|
-
getEffectiveBounds:
|
|
59
|
+
getEffectivePose: (e) => w(e) ?? b(e),
|
|
60
|
+
getEffectiveBounds: E,
|
|
93
61
|
getGestureBounds: () => {
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
let
|
|
97
|
-
for (let e of n)
|
|
98
|
-
|
|
99
|
-
if (a) for (let e of a) i.push(e);
|
|
100
|
-
return e(i);
|
|
62
|
+
let t = [];
|
|
63
|
+
for (let e of new Set(h?.ids() ?? [])) t.push(T(e));
|
|
64
|
+
let n = h?.bounds();
|
|
65
|
+
if (n) for (let e of n) t.push(e);
|
|
66
|
+
return e(t);
|
|
101
67
|
},
|
|
102
|
-
subscribeGestures: (e) =>
|
|
103
|
-
getGestureVersion: () =>
|
|
104
|
-
getChromeState: () =>
|
|
105
|
-
getPreviewSources: () =>
|
|
106
|
-
getGestureOverlays: () =>
|
|
107
|
-
getIsVisible: () =>
|
|
68
|
+
subscribeGestures: (e) => h?.subscribe(e) ?? o,
|
|
69
|
+
getGestureVersion: () => h?.getVersion() ?? 0,
|
|
70
|
+
getChromeState: () => D,
|
|
71
|
+
getPreviewSources: () => h?.previewSources() ?? [],
|
|
72
|
+
getGestureOverlays: () => h?.overlays() ?? [],
|
|
73
|
+
getIsVisible: () => _?.() ?? s
|
|
108
74
|
},
|
|
109
|
-
chromeState:
|
|
110
|
-
committedPoseOf: T,
|
|
111
|
-
effectiveBoundsOf: O,
|
|
112
|
-
previewToolPose: k,
|
|
113
|
-
previewToolBounds: A,
|
|
114
|
-
previewExtraRef: D
|
|
75
|
+
chromeState: D
|
|
115
76
|
};
|
|
116
77
|
}
|
|
117
78
|
//#endregion
|
|
118
|
-
export {
|
|
79
|
+
export { l as useViewHelpers };
|
|
119
80
|
|
|
120
81
|
//# sourceMappingURL=useViewHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useViewHelpers.js","names":["noOpUnsubscribe","alwaysVisible","worldPoseOf","adapter","id","useViewHelpers","opts","boxOf","useCallback","boundsOfPose","pose","geometry","baseBoundsOf","useMemo","boundsOf","b","rot","committedPoseOf","multiActive","selection","previewExtraRef","useLatest","effectiveBoundsOf","previewToolPose","tools","p","firstPreviewPose","extra","previewToolBounds","firstPreviewBounds","boundsWithPreview","chromeState","buildChromeState","ids","aggregatePreviewIds","extraIds","gestureSource","parts","extraBounds","unionAABB","fn","toolPreviewSources","getIsVisible"],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { firstPreviewPose, firstPreviewBounds, aggregatePreviewIds, toolPreviewSources } from './toolPreview';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { ToolsApi } from '../tools/overlayBinding';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded, so a consumer that wants the union\n * with the rest of the scene still walks its own ids through\n * `getEffectiveBounds`. It exists because every other lookup here is keyed\n * by node id, which can't answer \"where is the shape the user is drawing\n * right now\" — a drag-to-insert has no id until pointer-up.\n *\n * Select-only gestures are deliberately excluded: a marquee or lasso has\n * geometry but proposes no content, and a consumer sizing itself to the\n * gesture must not grow because the user swept a selection rectangle.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent (a union of several oriented boxes has no single\n * orientation to report).\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal — the other half of the\n * `useSyncExternalStore` contract for everything on this object that moves\n * during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions (a slider bound to an ongoing action pumps the same way). It\n * fires on the pump, not on a diff: a pump that changed nothing observable\n * still notifies, so don't hang expensive work directly off the callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state\n * (that tool re-renders on its own).\n *\n * Without a gesture source wired — a bare `<Canvas>` — this is a no-op\n * subscription that never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** Returns the live ChromeState built once per render. Affordances and\n * custom layers that need overlay-aware selection state (selection ids,\n * bounds, multi-union AABB, modifier flags) read from this. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view, in resolution\n * order: tool-side first (hotkey → active → registry → ambient), then the\n * handles in flight on this view's dispatcher. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n *\n * The rule table is the surface's; the context it resolves against is this\n * view's selection, camera and in-flight action — so the predicate belongs\n * here rather than on {@link CanvasSurfaceHelpers}. Unwired, it is the\n * universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled. Layers that\n * want to participate in `hitboxes`/`bounds`/etc. visualization can\n * call into this from their `draw` callback. Returns `null` when\n * debug is off — no-op for production renders. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`.\n * What a layer receives as its `data` argument, unchanged: the two halves\n * are split so a per-view set can be built independently of the surface's,\n * not to make layers ask for one. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n /** Only `getPose` is read here — the narrow slice keeps this hook off the\n * full adapter contract. */\n adapter: { getPose(id: string): TPose } | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n selection: readonly NodeId[];\n tools: ToolsApi | undefined;\n gestureSource: GestureSource | undefined;\n /** Dispatcher-published preview overlays, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on them. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n previewIdsExtra: (() => Iterable<string> | null) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n chromeState: ChromeState;\n /** Committed pose straight from the adapter, no overlay applied. */\n committedPoseOf(id: string): TPose | null;\n /** Bounds resolver after the `boundsOf` / adapter fallback, before previews. */\n effectiveBoundsOf: ((id: string) => Bounds | null) | undefined;\n previewToolPose(id: string): TPose | null;\n previewToolBounds(id: string): Bounds | null;\n /** Live dispatcher preview extras, for callers outside this bundle. */\n previewExtraRef: React.MutableRefObject<{\n previewPoseExtra: ((id: string) => unknown) | undefined;\n previewIdsExtra: (() => Iterable<string> | null) | undefined;\n }>;\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against.\n *\n * This is a hook, so it runs once per component. That is the point — N views\n * cannot be a loop inside one component, but they can be N components each\n * calling this once.\n */\n/** The composed pose when the adapter resolves one, its stored pose otherwise.\n * Adapters predating `getWorldPose` are absolute-pose, where the two agree. */\nfunction worldPoseOf<TPose>(\n adapter: { getPose(id: string): TPose; getWorldPose?(id: string): TPose },\n id: string,\n): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, selection, tools, gestureSource,\n previewPoseExtra, previewIdsExtra, getIsVisible,\n } = opts;\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : geometry.getBounds(pose)),\n [boundsOfPose, geometry],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n const pose = worldPoseOf(adapter, id);\n const b = geometry.getBounds(pose);\n const rot = geometry.getRotation?.(pose);\n return rot ? { ...b, rotation: rot } : b;\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, geometry]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const multiActive = selection.length > 1;\n\n const previewExtraRef = useLatest({ previewPoseExtra, previewIdsExtra });\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n\n // The live overlay a gesture proposes for `id`: the active tool's published\n // preview first, then the dispatcher's preview extras. `null` when nothing\n // is mid-gesture — callers fall through to committed state.\n const previewToolPose = useCallback((id: string): TPose | null => {\n if (tools) {\n const p = firstPreviewPose(tools, id);\n if (p != null) return p as TPose;\n }\n const extra = previewExtraRef.current.previewPoseExtra;\n if (extra) {\n const p = extra(id);\n if (p != null) return p as TPose;\n }\n return null;\n }, [tools, previewExtraRef]);\n const previewToolBounds = useCallback((id: string): Bounds | null => {\n if (tools) {\n const b = firstPreviewBounds(tools, id);\n if (b) return b;\n const p = firstPreviewPose(tools, id);\n if (p != null) return boxOf(id, p as TPose);\n }\n const extra = previewExtraRef.current.previewPoseExtra;\n if (extra) {\n const p = extra(id);\n if (p != null) return boxOf(id, p as TPose);\n }\n return null;\n }, [tools, boxOf, previewExtraRef]);\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewToolBounds(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewToolBounds, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n selection,\n multiActive,\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Rotation-capability predicate. Reads the committed pose (gestures\n // don't change descriptor capability) and asks the geometry. Absent\n // adapter / unknown ids fall back to `true` so the affordance stays\n // visible — preserves pre-existing behavior for consumers that wire\n // bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n }),\n [selection, multiActive, boundsWithPreview, geometry, committedPoseOf],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n const tp = previewToolPose(id);\n if (tp != null) return tp;\n return committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // In-flight ids come from both preview sources the ghost layer walks:\n // tool-published `previewIds()` and the dispatcher's in-flight handles\n // (via `gestureSource.ids()`). Using the same sets keeps this from\n // disagreeing with what the user sees ghosted.\n const ids = aggregatePreviewIds(tools);\n const extraIds = gestureSource?.ids();\n if (extraIds) for (const id of extraIds) ids.add(id);\n\n const parts: (Bounds | null)[] = [];\n for (const id of ids) parts.push(previewToolBounds(id));\n // Nascent inserts have no id to look up — they arrive as ready-made\n // world AABBs.\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => [\n ...toolPreviewSources(tools),\n ...(gestureSource?.previewSources() ?? []),\n ],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((id: string) => boolean) => getIsVisible?.() ?? alwaysVisible,\n };\n\n return {\n helpers,\n chromeState,\n committedPoseOf,\n effectiveBoundsOf,\n previewToolPose,\n previewToolBounds,\n previewExtraRef,\n };\n}\n"],"mappings":";;;;;;AAaA,IAAMA,UAA8B,CAAC,GAE/BC,UAA+B;AAgLrC,SAASC,EACP,GACA,GACO;CACP,OAAO,OAAOC,EAAQ,gBAAiB,aAAaA,EAAQ,aAAaC,CAAE,IAAID,EAAQ,QAAQC,CAAE;AACnG;AAEA,SAAgBC,EACd,GAC0B;CAC1B,IAAM,EACJ,YAAS,aAAU,aAAU,iBAAc,cAAW,UAAO,kBAC7D,qBAAkB,oBAAiB,oBACjCC,GACEC,IAAQC,GACX,GAAY,MACVC,IAAeA,EAAaL,GAAIM,CAAI,IAAIC,EAAS,UAAUD,CAAI,GAClE,CAACD,GAAcE,CAAQ,CACzB,GAEMC,IAAeC,QAAc;EACjC,IAAIC,GAAU,OAAOA;EACrB,IAAKX,GACL,QAAQ,MAA8B;GACpC,IAAI;IAGF,IAAMO,IAAOR,EAAYC,GAASC,CAAE,GAC9BW,IAAIJ,EAAS,UAAUD,CAAI,GAC3BM,IAAML,EAAS,cAAcD,CAAI;IACvC,OAAOM,IAAM;KAAE,GAAGD;KAAG,UAAUC;IAAI,IAAID;GACzC,QAAQ;IACN,OAAO;GACT;EACF;CACF,GAAG;EAACD;EAAUX;EAASQ;CAAQ,CAAC,GAE1BM,IAAkBT,GAAa,MAA6B;EAChE,IAAI,CAACL,GAAS,OAAO;EACrB,IAAI;GACF,OAAOD,EAAYC,GAASC,CAAE;EAChC,QAAQ;GACN,OAAO;EACT;CACF,GAAG,CAACD,CAAO,CAAC,GAENe,IAAcC,EAAU,SAAS,GAEjCC,IAAkBC,EAAU;EAAE;EAAkB;CAAgB,CAAC,GAEjEC,IAAoBT,QAAcC,KAAYF,GAAc,CAACE,GAAUF,CAAY,CAAC,GAKpFW,IAAkBf,GAAa,MAA6B;EAChE,IAAIgB,GAAO;GACT,IAAMC,IAAIC,EAAiBF,GAAOpB,CAAE;GACpC,IAAIqB,KAAK,MAAM,OAAOA;EACxB;EACA,IAAME,IAAQP,EAAgB,QAAQ;EACtC,IAAIO,GAAO;GACT,IAAMF,IAAIE,EAAMvB,CAAE;GAClB,IAAIqB,KAAK,MAAM,OAAOA;EACxB;EACA,OAAO;CACT,GAAG,CAACD,GAAOJ,CAAe,CAAC,GACrBQ,IAAoBpB,GAAa,MAA8B;EACnE,IAAIgB,GAAO;GACT,IAAMT,IAAIc,EAAmBL,GAAOpB,CAAE;GACtC,IAAIW,GAAG,OAAOA;GACd,IAAMU,IAAIC,EAAiBF,GAAOpB,CAAE;GACpC,IAAIqB,KAAK,MAAM,OAAOlB,EAAMH,GAAIqB,CAAU;EAC5C;EACA,IAAME,IAAQP,EAAgB,QAAQ;EACtC,IAAIO,GAAO;GACT,IAAMF,IAAIE,EAAMvB,CAAE;GAClB,IAAIqB,KAAK,MAAM,OAAOlB,EAAMH,GAAIqB,CAAU;EAC5C;EACA,OAAO;CACT,GAAG;EAACD;EAAOjB;EAAOa;CAAe,CAAC,GAQ5BU,IAAoBtB,GAAa,MACnBoB,EAAkBxB,CAChC,MACGkB,IAAoBA,EAAkBlB,CAAE,IAAI,OAClD,CAACwB,GAAmBN,CAAiB,CAAC,GAEnCS,IAA2BlB,QACzBmB,EAAiB;EACrB;EACA;EACA,mBAAmBF;EACnB,WAAW;GAAE,KAAK;GAAO,OAAO;GAAO,MAAM;GAAO,MAAM;EAAM;EAMhE,YAAY,MAAO;GACjB,IAAI,CAACnB,EAAS,kBAAkB,OAAO;GACvC,IAAMD,IAAOO,EAAgBb,CAAE;GAE/B,OADIM,KAAQ,QACLC,EAAS,iBAAiBD,CAAI;EACvC;CACF,CAAC,GACD;EAACS;EAAWD;EAAaY;EAAmBnB;EAAUM;CAAe,CACvE;CAsCA,OAAO;EACL,SAAA;GApCA,mBAAmB,MACNM,EAAgBnB,CACvB,KACGa,EAAgBb,CAAE;GAE3B,oBAAoB0B;GACpB,wBAAuC;IAKrC,IAAMG,IAAMC,EAAoBV,CAAK,GAC/BW,IAAWC,GAAe,IAAI;IACpC,IAAID,GAAU,KAAK,IAAM/B,KAAM+B,GAAU,EAAI,IAAI/B,CAAE;IAEnD,IAAMiC,IAA2B,CAAC;IAClC,KAAK,IAAMjC,KAAM6B,GAAK,EAAM,KAAKL,EAAkBxB,CAAE,CAAC;IAGtD,IAAMkC,IAAcF,GAAe,OAAO;IAC1C,IAAIE,GAAa,KAAK,IAAMvB,KAAKuB,GAAa,EAAM,KAAKvB,CAAC;IAC1D,OAAOwB,EAAUF,CAAK;GACxB;GACA,oBAAoB,MAClBD,GAAe,UAAUI,CAAE,KAAKxC;GAClC,yBAAiCoC,GAAe,WAAW,KAAK;GAChE,sBAAsBL;GACtB,yBAA0D,CACxD,GAAGU,EAAmBjB,CAAK,GAC3B,GAAIY,GAAe,eAAe,KAAK,CAAC,CAC1C;GACA,0BAAqDA,GAAe,SAAS,KAAK,CAAC;GACnF,oBAA+CM,IAAe,KAAKzC;EAInE;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useViewHelpers.js","names":["noOpUnsubscribe","alwaysVisible","worldPoseOf","adapter","id","useViewHelpers","opts","boxOf","useCallback","boundsOfPose","pose","framedBounds","geometry","baseBoundsOf","useMemo","boundsOf","committedPoseOf","multiActive","selection","previewPoseExtraRef","useLatest","previewPoseExtra","effectiveBoundsOf","previewPoseOf","previewBoundsOf","p","boundsWithPreview","chromeState","buildChromeState","parts","gestureSource","extraBounds","b","unionAABB","fn","getIsVisible"],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { framedBounds } from 'core/geometry/poseDescriptor';\nimport { useLatest } from '@weasel-js/react';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded. Select-only gestures are excluded\n * too: a marquee or lasso has geometry but proposes no content.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent.\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal, for everything on this\n * object that moves during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions. It fires on the pump, not on a diff: a pump that changed nothing\n * observable still notifies, so don't hang expensive work directly off the\n * callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state.\n * Without a gesture source wired — a bare `<Canvas>` — it never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** The live ChromeState built once per render: overlay-aware selection\n * state for affordances and custom layers. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view: the handles in\n * flight on its dispatcher, in dispatch order. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n * Unwired, it is the universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled, for layers to\n * call from their `draw` callback. `null` when debug is off. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`, and\n * what a layer receives as its `data` argument. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\n/** What a view's pose and bounds lookups read of an adapter. */\nexport interface ViewPoseAdapter<TPose> {\n getPose(id: string): TPose;\n /** Where the node is drawn, when the adapter composes poses. An adapter\n * without it stores absolute poses, where the two agree. */\n getWorldPose?(id: string): TPose;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n adapter: ViewPoseAdapter<TPose> | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n selection: readonly NodeId[];\n gestureSource: GestureSource | undefined;\n /** The dispatcher's preview pose for an id, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on it. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n chromeState: ChromeState;\n}\n\nfunction worldPoseOf<TPose>(adapter: ViewPoseAdapter<TPose>, id: string): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against. A canvas with N views mounts N components each\n * calling this once.\n */\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, selection, gestureSource,\n previewPoseExtra, getIsVisible,\n } = opts;\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : framedBounds(pose, geometry)),\n [boundsOfPose, geometry],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n return framedBounds(worldPoseOf(adapter, id), geometry);\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, geometry]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const multiActive = selection.length > 1;\n\n const previewPoseExtraRef = useLatest(previewPoseExtra);\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n\n const previewPoseOf = useCallback((id: string): TPose | null => {\n const p = previewPoseExtraRef.current?.(id);\n return p != null ? (p as TPose) : null;\n }, [previewPoseExtraRef]);\n const previewBoundsOf = useCallback((id: string): Bounds | null => {\n const p = previewPoseOf(id);\n return p != null ? boxOf(id, p) : null;\n }, [previewPoseOf, boxOf]);\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewBoundsOf(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewBoundsOf, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n selection,\n multiActive,\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Absent adapter / unknown ids fall back to `true` so the affordance\n // stays visible for consumers that wire bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n }),\n [selection, multiActive, boundsWithPreview, geometry, committedPoseOf],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n return previewPoseOf(id) ?? committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // The same id sets the ghost layer walks, so this cannot disagree with\n // what the user sees ghosted.\n const parts: (Bounds | null)[] = [];\n for (const id of new Set(gestureSource?.ids() ?? [])) parts.push(previewBoundsOf(id));\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => gestureSource?.previewSources() ?? [],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((id: string) => boolean) => getIsVisible?.() ?? alwaysVisible,\n };\n\n return { helpers, chromeState };\n}\n"],"mappings":";;;;;;AAYA,IAAMA,UAA8B,CAAC,GAE/BC,UAA+B;AAyIrC,SAASC,EAAmB,GAAiC,GAAmB;CAC9E,OAAO,OAAOC,EAAQ,gBAAiB,aAAaA,EAAQ,aAAaC,CAAE,IAAID,EAAQ,QAAQC,CAAE;AACnG;AAOA,SAAgBC,EACd,GAC0B;CAC1B,IAAM,EACJ,YAAS,aAAU,aAAU,iBAAc,cAAW,kBACtD,qBAAkB,oBAChBC,GACEC,IAAQC,GACX,GAAY,MACVC,IAAeA,EAAaL,GAAIM,CAAI,IAAIC,EAAaD,GAAME,CAAQ,GACtE,CAACH,GAAcG,CAAQ,CACzB,GAEMC,IAAeC,QAAc;EACjC,IAAIC,GAAU,OAAOA;EACrB,IAAKZ,GACL,QAAQ,MAA8B;GACpC,IAAI;IAGF,OAAOQ,EAAaT,EAAYC,GAASC,CAAE,GAAGQ,CAAQ;GACxD,QAAQ;IACN,OAAO;GACT;EACF;CACF,GAAG;EAACG;EAAUZ;EAASS;CAAQ,CAAC,GAE1BI,IAAkBR,GAAa,MAA6B;EAChE,IAAI,CAACL,GAAS,OAAO;EACrB,IAAI;GACF,OAAOD,EAAYC,GAASC,CAAE;EAChC,QAAQ;GACN,OAAO;EACT;CACF,GAAG,CAACD,CAAO,CAAC,GAENc,IAAcC,EAAU,SAAS,GAEjCC,IAAsBC,EAAUC,CAAgB,GAEhDC,IAAoBR,QAAcC,KAAYF,GAAc,CAACE,GAAUF,CAAY,CAAC,GAEpFU,IAAgBf,GAAa,MACvBW,EAAoB,UAAUf,CAAE,KACR,MACjC,CAACe,CAAmB,CAAC,GAClBK,IAAkBhB,GAAa,MAA8B;EACjE,IAAMiB,IAAIF,EAAcnB,CAAE;EAC1B,OAAOqB,KAAK,OAAsB,OAAflB,EAAMH,GAAIqB,CAAC;CAChC,GAAG,CAACF,GAAehB,CAAK,CAAC,GAQnBmB,IAAoBlB,GAAa,MACnBgB,EAAgBpB,CAC9B,MACGkB,IAAoBA,EAAkBlB,CAAE,IAAI,OAClD,CAACoB,GAAiBF,CAAiB,CAAC,GAEjCK,IAA2Bb,QACzBc,EAAiB;EACrB;EACA;EACA,mBAAmBF;EACnB,WAAW;GAAE,KAAK;GAAO,OAAO;GAAO,MAAM;GAAO,MAAM;EAAM;EAGhE,YAAY,MAAO;GACjB,IAAI,CAACd,EAAS,kBAAkB,OAAO;GACvC,IAAMF,IAAOM,EAAgBZ,CAAE;GAE/B,OADIM,KAAQ,QACLE,EAAS,iBAAiBF,CAAI;EACvC;CACF,CAAC,GACD;EAACQ;EAAWD;EAAaS;EAAmBd;EAAUI;CAAe,CACvE;CAyBA,OAAO;EAAE,SAAA;GAtBP,mBAAmB,MACVO,EAAcnB,CAAE,KAAKY,EAAgBZ,CAAE;GAEhD,oBAAoBsB;GACpB,wBAAuC;IAGrC,IAAMG,IAA2B,CAAC;IAClC,KAAK,IAAMzB,KAAM,IAAI,IAAI0B,GAAe,IAAI,KAAK,CAAC,CAAC,GAAG,EAAM,KAAKN,EAAgBpB,CAAE,CAAC;IACpF,IAAM2B,IAAcD,GAAe,OAAO;IAC1C,IAAIC,GAAa,KAAK,IAAMC,KAAKD,GAAa,EAAM,KAAKC,CAAC;IAC1D,OAAOC,EAAUJ,CAAK;GACxB;GACA,oBAAoB,MAClBC,GAAe,UAAUI,CAAE,KAAKlC;GAClC,yBAAiC8B,GAAe,WAAW,KAAK;GAChE,sBAAsBH;GACtB,yBAA0DG,GAAe,eAAe,KAAK,CAAC;GAC9F,0BAAqDA,GAAe,SAAS,KAAK,CAAC;GACnF,oBAA+CK,IAAe,KAAKlC;EAG5D;EAAS;CAAY;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewInputs.js","names":["ViewInputsContext","createContext","ViewInputsProvider","useOptionalViewInputs","useContext"],"sources":["../../src/canvas/viewInputs.tsx"],"sourcesContent":["/**\n * What {@link useViewHelpers} needs that belongs to the surface rather than to\n * one view: the adapter, the geometry
|
|
1
|
+
{"version":3,"file":"viewInputs.js","names":["ViewInputsContext","createContext","ViewInputsProvider","useOptionalViewInputs","useContext"],"sources":["../../src/canvas/viewInputs.tsx"],"sourcesContent":["/**\n * What {@link useViewHelpers} needs that belongs to the surface rather than to\n * one view: the adapter, the geometry and the bounds resolver.\n *\n * These are read during a view's render, so they travel as context rather than\n * on the `SurfaceHandle`, which is not attached until an effect runs.\n */\nimport { createContext, useContext, type ReactNode } from 'react';\nimport type { UseViewHelpersOpts } from './useViewHelpers';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { View } from 'core/viewport/view';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { PlaneMap } from 'core/viewport/parallax';\nimport type { ChromeCaps } from 'features/chrome-caps/useChromeCaps';\nimport type { PickView } from './SceneCanvas/useSceneSelectTool';\n\nexport type { ViewRuleInputs } from 'features/chrome-caps/useChromeCaps';\n\n/**\n * @internal Provided by the surface, consumed by `<CanvasView>`.\n *\n * The scene-shaped half only. What a gesture is doing right now is read from\n * the asking view's own dispatcher, not from here.\n */\nexport interface SurfaceViewInputs\n extends Pick<UseViewHelpersOpts<unknown>, 'adapter' | 'geometry'> {\n /** A node's box for chrome, drawn under `view` — the camera of the view\n * asking, since a node on a parallax plane lands somewhere else in each. */\n boundsOf: ((id: string, view?: View | null) => Bounds | null) | undefined;\n /** How `view`'s world maps into the parallax plane `id` is drawn through,\n * or null when its layer moves with the camera. */\n planeOfNode?: ((id: string, view?: View | null) => PlaneMap | null) | undefined;\n /** `boundsOf` for `id` drawn at an in-flight `pose`, under `view`. */\n boundsOfPose?: ((id: string, pose: unknown, view?: View | null) => Bounds | null) | undefined;\n /** Every id under a world point, bottom-first. `view` is the view the\n * point was produced under — a screen-pixel tolerance cannot be converted\n * without its scale, nor a layer judged without its paint, and the world\n * point carries neither. */\n pickEvery?: (worldX: number, worldY: number, view?: PickView | null) => string[];\n /** The one id a click resolves to, collapsing parent/child the way the\n * select tool does. Falls back to `pickEvery`'s last when absent. */\n pickBest?: (worldX: number, worldY: number, view?: PickView | null) => string | null;\n /** A hit node's routing-trait kind, so `target: 'kind:text'` bindings match. */\n kindOfNode?: (id: string) => string | undefined;\n /** The surface's chrome-caps rule table, evaluated against a view's own\n * context. */\n chromeCaps?: ChromeCaps;\n /** The surface's selection, which a view shares unless it was given one of\n * its own. */\n selectionApi: SelectionApi;\n /** The rotate badge the surface's selection overlay paints, which every\n * view drawing that overlay has to make grabbable where it is drawn. */\n rotationBadge?: { distancePx: number; sizePx: number } | null;\n}\n\nconst ViewInputsContext = createContext<SurfaceViewInputs | null>(null);\n\n/** @internal */\nexport function ViewInputsProvider(\n { value, children }: { value: SurfaceViewInputs; children: ReactNode },\n) {\n return <ViewInputsContext.Provider value={value}>{children}</ViewInputsContext.Provider>;\n}\n\n/** The hosting surface's view-helper inputs, or `null` outside one. */\nexport function useOptionalViewInputs(): SurfaceViewInputs | null {\n return useContext(ViewInputsContext);\n}\n"],"mappings":";;;AAuDA,IAAMA,IAAoBC,EAAwC,IAAI;AAGtE,SAAgBC,EACd,EAAE,UAAO,eACT;CACA,OAAO,kBAACF,EAAkB,UAAnB;EAAmC;EAAQ;CAAqC,CAAA;AACzF;AAGA,SAAgBG,IAAkD;CAChE,OAAOC,EAAWJ,CAAiB;AACrC"}
|