@weasel-js/core 1.9.4 → 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 +750 -0
- package/README.md +5 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -83
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +3 -2
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +54 -100
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +5 -4
- 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 +48 -136
- 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 +8 -7
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -31
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +35 -39
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +12 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +42 -36
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +41 -51
- package/dist/canvas/Canvas.js +281 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +169 -188
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +22 -23
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +39 -56
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +28 -29
- package/dist/canvas/NodeShape.js.map +1 -1
- 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 +66 -107
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +51 -54
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +40 -29
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +73 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js +15 -14
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- 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.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 +39 -37
- 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 +76 -80
- 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 +303 -707
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +41 -47
- 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 +81 -61
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +40 -44
- 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/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +49 -68
- 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 +65 -54
- 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 +44 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +8 -8
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +43 -41
- 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 +2 -6
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- 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 +12 -12
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +10 -10
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +34 -23
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +23 -22
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +6 -6
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +16 -16
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/textPainter.js +1 -1
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +6 -8
- 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 +52 -50
- 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 +1 -3
- 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 +12 -12
- 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 -83
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -132
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +1 -1
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +36 -35
- 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 +23 -11
- 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 +46 -37
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useFrameLoop.js +11 -12
- 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 +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- 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 +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-2a5hVbBd.d.ts} +122 -77
- package/dist/clone.d.ts +4 -8
- package/dist/clone.js +0 -2
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +13 -13
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- 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 +61 -14
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +35 -37
- 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 +4 -5
- package/dist/core/geometry/unionBounds.js.map +1 -1
- 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/{features/focus → core/layers}/gateLayer.js +2 -2
- 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/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js.map +1 -1
- 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} +103 -92
- 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/arrivalWindow.js +65 -64
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- 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 +116 -70
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +83 -71
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +105 -12
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- 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 +9 -9
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +72 -71
- package/dist/core/scene/nodeStore.js.map +1 -1
- 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/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -36
- 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.map +1 -1
- package/dist/core/scene/scene.js +81 -690
- 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 +8 -5
- package/dist/core/scene/serialization.js.map +1 -1
- 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/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 +7 -7
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +100 -100
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- 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.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +25 -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/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 +5 -0
- 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 -16
- 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 +42 -55
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +170 -178
- 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 +95 -82
- 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 +4507 -8459
- package/dist/index.js +275 -320
- package/dist/input/keyState.js +14 -14
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +23 -23
- 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} +19 -19
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
- package/dist/interactions/actions/clipboard/clipboardOps.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 +10 -37
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +41 -43
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- 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/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +19 -19
- 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 +35 -40
- 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 +19 -15
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +14 -15
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +30 -31
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +9 -3
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +20 -22
- 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 +1 -1
- 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/{defaults/distribute.js → distribute/action.js} +18 -19
- 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} +19 -21
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
- 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 +1 -1
- 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/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/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/snapToContainer.js +24 -23
- 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 +15 -40
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +8 -8
- 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 +17 -64
- 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 +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +26 -26
- 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/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +77 -72
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
- 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/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 -2
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +6 -4
- package/dist/{originProjection-gHnOup4e.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-Bqk-11Rl.d.ts +73 -0
- package/dist/renderer.d.ts +1 -92
- package/dist/renderer.js +2 -19
- package/dist/resize.d.ts +11 -22
- package/dist/resize.js +1 -1
- package/dist/style.css +1 -1
- 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.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- 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.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +161 -163
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- 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.map +1 -1
- 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 +4 -4
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +43 -71
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +67 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +8 -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 +20 -14
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-k-5Oqh-U.d.ts → types-CIKDwlsP.d.ts} +84 -164
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -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 -60
- 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 -146
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -114
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -125
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -79
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -388
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
- package/dist/builtins-DPcdghtB.d.ts +0 -1223
- package/dist/canvas/MinimapCanvas.js +0 -140
- 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 -82
- 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 -94
- 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/poseFrame.js +0 -44
- package/dist/core/geometry/poseFrame.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/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/scene/pickability.js +0 -6
- package/dist/core/scene/pickability.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/features/cursor/paintedCursorLayer.js.map +0 -1
- 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 -104
- 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 -239
- 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 -85
- 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 -22
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -167
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -159
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -149
- 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/strokeToPath.js +0 -40
- package/dist/features/paths/strokeToPath.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/commandPaint.js +0 -18
- package/dist/features/patterns/commandPaint.js.map +0 -1
- package/dist/features/patterns/index.js +0 -11
- 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/rasterizeTile.js +0 -17
- package/dist/features/patterns/rasterizeTile.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -65
- 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 -51
- 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/domOffsets.js +0 -82
- package/dist/features/text/domOffsets.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -230
- 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 -48
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/isTextData.js +0 -8
- package/dist/features/text/isTextData.js.map +0 -1
- package/dist/features/text/overlayDirection.js +0 -15
- package/dist/features/text/overlayDirection.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 -133
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -60
- 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 -491
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -65
- 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 -91
- 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.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -125
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -287
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -778
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -341
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -185
- 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-J-ACHyEg.d.ts +0 -159
- package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -333
- 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 -74
- 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 -68
- 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/batch.js +0 -133
- package/dist/renderer/draw/batch.js.map +0 -1
- package/dist/renderer/draw/clip.js +0 -89
- package/dist/renderer/draw/clip.js.map +0 -1
- package/dist/renderer/draw/customShader.js +0 -230
- package/dist/renderer/draw/customShader.js.map +0 -1
- package/dist/renderer/draw/drawTriangles.js +0 -8
- package/dist/renderer/draw/drawTriangles.js.map +0 -1
- package/dist/renderer/draw/effects.js +0 -28
- package/dist/renderer/draw/effects.js.map +0 -1
- package/dist/renderer/draw/flushBatch.js +0 -35
- package/dist/renderer/draw/flushBatch.js.map +0 -1
- package/dist/renderer/draw/gradient.js +0 -90
- package/dist/renderer/draw/gradient.js.map +0 -1
- package/dist/renderer/draw/image.js +0 -38
- package/dist/renderer/draw/image.js.map +0 -1
- package/dist/renderer/draw/mesh.js +0 -16
- package/dist/renderer/draw/mesh.js.map +0 -1
- package/dist/renderer/draw/paintBind.js +0 -70
- package/dist/renderer/draw/paintBind.js.map +0 -1
- package/dist/renderer/draw/pathPaint.js +0 -142
- package/dist/renderer/draw/pathPaint.js.map +0 -1
- package/dist/renderer/draw/scratchPass.js +0 -83
- package/dist/renderer/draw/scratchPass.js.map +0 -1
- package/dist/renderer/draw/stencil.js +0 -28
- package/dist/renderer/draw/stencil.js.map +0 -1
- package/dist/renderer/draw/text.js +0 -167
- package/dist/renderer/draw/text.js.map +0 -1
- package/dist/renderer/draw/uniforms.js +0 -77
- package/dist/renderer/draw/uniforms.js.map +0 -1
- package/dist/renderer/draw.js +0 -79
- 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 -48
- 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 -11
- 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 -20
- package/dist/renderer/math/color.js +0 -321
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -80
- 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 -31
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -14
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -25
- 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 -34
- 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-DM2B87-g.d.ts +0 -356
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { PATH_L as e, PATH_M as t, PATH_Z as n } from "@weasel-js/geom";
|
|
2
|
-
//#region src/core/strokeMarkerShapes.ts
|
|
3
|
-
function r(r, i, a = !0) {
|
|
4
|
-
let o = r.length / 2, s = new Uint8Array(a ? o + 1 : o);
|
|
5
|
-
s[0] = t;
|
|
6
|
-
for (let t = 1; t < o; t++) s[t] = e;
|
|
7
|
-
a && (s[o] = n);
|
|
8
|
-
let c = new Float32Array(r.length);
|
|
9
|
-
for (let e = 0; e < r.length; e++) c[e] = r[e] * i;
|
|
10
|
-
return {
|
|
11
|
-
kind: "polygon",
|
|
12
|
-
commands: s,
|
|
13
|
-
coords: c,
|
|
14
|
-
fillRule: "nonzero"
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function i(e, t, n, i = 32) {
|
|
18
|
-
let a = [];
|
|
19
|
-
for (let n = 0; n < i; n++) {
|
|
20
|
-
let r = n / i * Math.PI * 2;
|
|
21
|
-
a.push(e + t * Math.cos(r), t * Math.sin(r));
|
|
22
|
-
}
|
|
23
|
-
return r(a, n);
|
|
24
|
-
}
|
|
25
|
-
var a = [
|
|
26
|
-
{
|
|
27
|
-
id: "arrow",
|
|
28
|
-
reads: [],
|
|
29
|
-
inset: 3,
|
|
30
|
-
path: ({ size: e }) => r([
|
|
31
|
-
0,
|
|
32
|
-
0,
|
|
33
|
-
-3,
|
|
34
|
-
-1.5,
|
|
35
|
-
-3,
|
|
36
|
-
1.5
|
|
37
|
-
], e)
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "arrow-open",
|
|
41
|
-
reads: [],
|
|
42
|
-
inset: 0,
|
|
43
|
-
fill: "none",
|
|
44
|
-
outline: { width: 1 },
|
|
45
|
-
path: ({ size: e }) => r([
|
|
46
|
-
-2.867,
|
|
47
|
-
-2.007,
|
|
48
|
-
0,
|
|
49
|
-
0,
|
|
50
|
-
-2.867,
|
|
51
|
-
2.007
|
|
52
|
-
], e, !1)
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "arrow-concave",
|
|
56
|
-
reads: [],
|
|
57
|
-
inset: 3,
|
|
58
|
-
path: ({ size: e }) => r([
|
|
59
|
-
0,
|
|
60
|
-
0,
|
|
61
|
-
-3,
|
|
62
|
-
-1.5,
|
|
63
|
-
-2,
|
|
64
|
-
0,
|
|
65
|
-
-3,
|
|
66
|
-
1.5
|
|
67
|
-
], e)
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: "diamond",
|
|
71
|
-
reads: [],
|
|
72
|
-
inset: 4,
|
|
73
|
-
path: ({ size: e }) => r([
|
|
74
|
-
0,
|
|
75
|
-
0,
|
|
76
|
-
-2,
|
|
77
|
-
-1.2,
|
|
78
|
-
-4,
|
|
79
|
-
0,
|
|
80
|
-
-2,
|
|
81
|
-
1.2
|
|
82
|
-
], e)
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
id: "diamond-hollow",
|
|
86
|
-
reads: [],
|
|
87
|
-
inset: 4,
|
|
88
|
-
fill: "none",
|
|
89
|
-
outline: { width: .5 },
|
|
90
|
-
path: ({ size: e }) => r([
|
|
91
|
-
0,
|
|
92
|
-
0,
|
|
93
|
-
-2,
|
|
94
|
-
-1.2,
|
|
95
|
-
-4,
|
|
96
|
-
0,
|
|
97
|
-
-2,
|
|
98
|
-
1.2
|
|
99
|
-
], e)
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "circle",
|
|
103
|
-
reads: [],
|
|
104
|
-
inset: 2,
|
|
105
|
-
path: ({ size: e }) => i(-1, 1, e)
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
id: "square",
|
|
109
|
-
reads: [],
|
|
110
|
-
inset: 2,
|
|
111
|
-
path: ({ size: e }) => r([
|
|
112
|
-
0,
|
|
113
|
-
-1,
|
|
114
|
-
0,
|
|
115
|
-
1,
|
|
116
|
-
-2,
|
|
117
|
-
1,
|
|
118
|
-
-2,
|
|
119
|
-
-1
|
|
120
|
-
], e)
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: "bar",
|
|
124
|
-
reads: [],
|
|
125
|
-
inset: 0,
|
|
126
|
-
fill: "none",
|
|
127
|
-
outline: { width: 1 },
|
|
128
|
-
path: ({ size: e }) => r([
|
|
129
|
-
0,
|
|
130
|
-
-1.5,
|
|
131
|
-
0,
|
|
132
|
-
1.5
|
|
133
|
-
], e, !1)
|
|
134
|
-
}
|
|
135
|
-
];
|
|
136
|
-
//#endregion
|
|
137
|
-
export { a as BUILTIN_MARKERS };
|
|
138
|
-
|
|
139
|
-
//# sourceMappingURL=strokeMarkerShapes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strokeMarkerShapes.js","names":["poly","n","pts","commands","close","PATH_M","i","PATH_L","PATH_Z","coords","size","circle","segments","theta","cx","r","BUILTIN_MARKERS"],"sources":["../../src/core/strokeMarkerShapes.ts"],"sourcesContent":["/**\n * The kit's built-in stroke-marker vocabulary.\n *\n * Every entry is authored with its anchor at the origin and pointing +X, so\n * the line arrives from -X and no geometry sits at positive X. Coordinates are\n * in units of `MarkerCtx.size`, which defaults to the resolved stroke width —\n * one definition is therefore correct at any line weight.\n *\n * Not to be confused with `features/paths/markers.ts`, which builds\n * decorative chrome shapes and is unrelated.\n */\n\nimport { PATH_M, PATH_L, PATH_Z, type PolygonPath } from '@weasel-js/geom';\nimport type { MarkerCtx, MarkerEntry } from './strokeMarkers';\n\nfunction poly(pts: readonly number[], size: number, close = true): PolygonPath {\n const n = pts.length / 2;\n const commands = new Uint8Array(close ? n + 1 : n);\n commands[0] = PATH_M;\n for (let i = 1; i < n; i++) commands[i] = PATH_L;\n if (close) commands[n] = PATH_Z;\n const coords = new Float32Array(pts.length);\n for (let i = 0; i < pts.length; i++) coords[i] = pts[i] * size;\n return { kind: 'polygon', commands, coords, fillRule: 'nonzero' };\n}\n\n/** Circle of radius `r` centred at `cx`, in marker units. */\nfunction circle(cx: number, r: number, size: number, segments = 32): PolygonPath {\n const pts: number[] = [];\n for (let i = 0; i < segments; i++) {\n const theta = (i / segments) * Math.PI * 2;\n pts.push(cx + r * Math.cos(theta), r * Math.sin(theta));\n }\n return poly(pts, size);\n}\n\n/** The markers the registry is seeded with: `arrow`, `arrow-open`,\n * `arrow-concave`, `diamond`, `diamond-hollow`, `circle`, `square` and `bar`. */\nexport const BUILTIN_MARKERS: readonly MarkerEntry[] = [\n {\n id: 'arrow',\n reads: [],\n inset: 3,\n path: ({ size }: MarkerCtx) => poly([0, 0, -3, -1.5, -3, 1.5], size),\n },\n {\n id: 'arrow-open',\n reads: [],\n inset: 0,\n fill: 'none',\n outline: { width: 1 },\n // Open at the back, so the ribbon runs to the vertex and the arms meet it.\n // Arms 3.5 long at ±35°: the back opening is 4 units against 2 units of\n // arm, so the V still reads open. Shorter or narrower and the two arms\n // close the gap themselves and it paints as a solid triangle.\n path: ({ size }: MarkerCtx) =>\n poly([-2.867, -2.007, 0, 0, -2.867, 2.007], size, false),\n },\n {\n id: 'arrow-concave',\n reads: [],\n inset: 3,\n path: ({ size }: MarkerCtx) => poly([0, 0, -3, -1.5, -2, 0, -3, 1.5], size),\n },\n {\n id: 'diamond',\n reads: [],\n inset: 4,\n path: ({ size }: MarkerCtx) => poly([0, 0, -2, -1.2, -4, 0, -2, 1.2], size),\n },\n {\n id: 'diamond-hollow',\n reads: [],\n inset: 4,\n fill: 'none',\n outline: { width: 0.5 },\n path: ({ size }: MarkerCtx) => poly([0, 0, -2, -1.2, -4, 0, -2, 1.2], size),\n },\n {\n id: 'circle',\n reads: [],\n inset: 2,\n path: ({ size }: MarkerCtx) => circle(-1, 1, size),\n },\n {\n id: 'square',\n reads: [],\n inset: 2,\n path: ({ size }: MarkerCtx) => poly([0, -1, 0, 1, -2, 1, -2, -1], size),\n },\n {\n id: 'bar',\n reads: [],\n inset: 0,\n fill: 'none',\n outline: { width: 1 },\n path: ({ size }: MarkerCtx) => poly([0, -1.5, 0, 1.5], size, false),\n },\n];\n"],"mappings":";;AAeA,SAASA,EAAK,GAAwB,GAAc,IAAQ,IAAmB;CAC7E,IAAMC,IAAIC,EAAI,SAAS,GACjBC,IAAW,IAAI,WAAWC,IAAQH,IAAI,IAAIA,CAAC;CACjD,EAAS,KAAKI;CACd,KAAK,IAAIC,IAAI,GAAGA,IAAIL,GAAG,KAAK,EAASK,KAAKC;CAC1C,AAAIH,MAAO,EAASH,KAAKO;CACzB,IAAMC,IAAS,IAAI,aAAaP,EAAI,MAAM;CAC1C,KAAK,IAAII,IAAI,GAAGA,IAAIJ,EAAI,QAAQ,KAAK,EAAOI,KAAKJ,EAAII,KAAKI;CAC1D,OAAO;EAAE,MAAM;EAAW;EAAU;EAAQ,UAAU;CAAU;AAClE;AAGA,SAASC,EAAO,GAAY,GAAW,GAAc,IAAW,IAAiB;CAC/E,IAAMT,IAAgB,CAAC;CACvB,KAAK,IAAII,IAAI,GAAGA,IAAIM,GAAU,KAAK;EACjC,IAAMC,IAASP,IAAIM,IAAY,KAAK,KAAK;EACzC,EAAI,KAAKE,IAAKC,IAAI,KAAK,IAAIF,CAAK,GAAGE,IAAI,KAAK,IAAIF,CAAK,CAAC;CACxD;CACA,OAAOb,EAAKE,GAAKQ,CAAI;AACvB;AAIA,IAAaM,IAA0C;CACrD;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,OAAO,EAAE,cAAsBhB,EAAK;GAAC;GAAG;GAAG;GAAI;GAAM;GAAI;EAAG,GAAGU,CAAI;CACrE;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,MAAM;EACN,SAAS,EAAE,OAAO,EAAE;EAKpB,OAAO,EAAE,cACPV,EAAK;GAAC;GAAQ;GAAQ;GAAG;GAAG;GAAQ;EAAK,GAAGU,GAAM,EAAK;CAC3D;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,OAAO,EAAE,cAAsBV,EAAK;GAAC;GAAG;GAAG;GAAI;GAAM;GAAI;GAAG;GAAI;EAAG,GAAGU,CAAI;CAC5E;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,OAAO,EAAE,cAAsBV,EAAK;GAAC;GAAG;GAAG;GAAI;GAAM;GAAI;GAAG;GAAI;EAAG,GAAGU,CAAI;CAC5E;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,MAAM;EACN,SAAS,EAAE,OAAO,GAAI;EACtB,OAAO,EAAE,cAAsBV,EAAK;GAAC;GAAG;GAAG;GAAI;GAAM;GAAI;GAAG;GAAI;EAAG,GAAGU,CAAI;CAC5E;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,OAAO,EAAE,cAAsBC,EAAO,IAAI,GAAGD,CAAI;CACnD;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,OAAO,EAAE,cAAsBV,EAAK;GAAC;GAAG;GAAI;GAAG;GAAG;GAAI;GAAG;GAAI;EAAE,GAAGU,CAAI;CACxE;CACA;EACE,IAAI;EACJ,OAAO,CAAC;EACR,OAAO;EACP,MAAM;EACN,SAAS,EAAE,OAAO,EAAE;EACpB,OAAO,EAAE,cAAsBV,EAAK;GAAC;GAAG;GAAM;GAAG;EAAG,GAAGU,GAAM,EAAK;CACpE;AACF"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BUILTIN_MARKERS as e } from "./strokeMarkerShapes.js";
|
|
2
|
-
import { createReflectable as t } from "@weasel-js/registry";
|
|
3
|
-
//#region src/core/strokeMarkers.ts
|
|
4
|
-
var n = t();
|
|
5
|
-
function r() {
|
|
6
|
-
for (let t of e) n.push(t.id, t, { source: "kit" });
|
|
7
|
-
}
|
|
8
|
-
r();
|
|
9
|
-
var i = n.reflection;
|
|
10
|
-
function a() {
|
|
11
|
-
return n.getVersion();
|
|
12
|
-
}
|
|
13
|
-
function o(e) {
|
|
14
|
-
return n.push(e.id, e);
|
|
15
|
-
}
|
|
16
|
-
function s(e) {
|
|
17
|
-
return e === void 0 ? void 0 : n.get(e);
|
|
18
|
-
}
|
|
19
|
-
function c() {
|
|
20
|
-
return n.entries().map((e) => e.value);
|
|
21
|
-
}
|
|
22
|
-
function l() {
|
|
23
|
-
n.clear(), r();
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { l as _resetMarkersForTests, s as getMarker, c as listMarkers, a as markerGeneration, i as markerRegistry, o as registerMarker };
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=strokeMarkers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strokeMarkers.js","names":["MARKERS","createReflectable","seedBuiltins","entry","BUILTIN_MARKERS","markerRegistry","markerGeneration","registerMarker","getMarker","key","listMarkers","_resetMarkersForTests"],"sources":["../../src/core/strokeMarkers.ts"],"sourcesContent":["/**\n * The stroke-marker registry — arrowheads and other line terminators.\n *\n * Keyed by string, because a key is what sits in `stroke.markerEnd`. That is\n * the difference from `registerNodeShape`, which resolves by first-matching\n * predicate and whose `id` is only a label.\n *\n * A built-in's SVG slot lives in `@weasel-js/svg` and cannot be imported here\n * without inverting a package dependency, so an entry carries `toSvg` for that\n * package to consume — the same split `PaintKindEntry` uses.\n */\n\nimport type { FillStyle, MarkerKey, Stroke } from '@weasel-js/paint';\nimport type { Path } from '@weasel-js/geom';\nimport { createReflectable, type Reflection } from '@weasel-js/registry';\nimport { BUILTIN_MARKERS } from './strokeMarkerShapes';\n\n/** What an entry's `path` is given. Entries that ignore it may return a\n * constant path. */\nexport interface MarkerCtx {\n /** One geometry unit, in the same world units the ribbon is tessellated in.\n * Defaults to the resolved stroke width. */\n readonly size: number;\n /** The stroke this marker belongs to, already width-resolved. */\n readonly stroke: Stroke;\n}\n\n/** `'line'` means the stroke's own paint — SVG 2's `context-stroke`, as the\n * default rather than an opt-in. */\nexport type MarkerPaint = FillStyle | 'line' | 'none';\n\n/** A stroke-marker registry entry: a terminator's geometry, paint and inset. */\nexport interface MarkerEntry {\n /** `'kit:'`-free for built-ins so the key matches the SVG attribute value;\n * consumers should prefix (`'app-my-head'`). A key becomes the `id` of the\n * emitted `<marker>` def, so it must be a valid XML name — no colons. */\n id: MarkerKey;\n /** Geometry with its anchor at the origin, pointing +X, in units of\n * `ctx.size`. An arbitrary anchor is expressed by where the geometry is\n * drawn, which is why there is no `refX`/`refY`. */\n path(ctx: MarkerCtx): Path;\n /** Default `'line'`. */\n fill?: MarkerPaint;\n /** Outline width is in the same units as `path`. `false` (the default)\n * means no outline. */\n outline?: { width: number; paint?: MarkerPaint } | false;\n /** How far back along the line the stroke stops, in units of `ctx.size`.\n * Default 0. A property of the shape, not a setting on the stroke: an open\n * V needs 0 or its arms stop meeting the line. */\n inset?: number;\n /** `'auto'` (default) follows the line; a number is a fixed angle in\n * radians, ignoring the line — SVG's `orient=\"<angle>\"`. */\n orient?: 'auto' | number;\n /** The stroke fields `path` reads besides `ctx.size` — `[]` for a shape\n * drawn from size alone. Declared, a head is reused across stroke objects\n * whose listed fields are equal; omitted, only across frames that pass the\n * same stroke object, since `path` might read any of it. */\n reads?: readonly (keyof Stroke)[];\n /** Emits the `<marker>` def. Consumed by `@weasel-js/svg`. */\n toSvg?(id: string, entry: MarkerEntry): string;\n}\n\nconst MARKERS = createReflectable<MarkerEntry>();\n\nfunction seedBuiltins(): void {\n for (const entry of BUILTIN_MARKERS) MARKERS.push(entry.id, entry, { source: 'kit' });\n}\nseedBuiltins();\n\n/** Every registered marker, with the overrides each displaced. */\nexport const markerRegistry: Reflection<MarkerEntry> = MARKERS.reflection;\n\n/** Bumped whenever the registered set changes, for caches of marker geometry. */\nexport function markerGeneration(): number {\n return MARKERS.getVersion();\n}\n\n/** Register a marker. Returns a disposer. Re-registering an existing id is an\n * override; disposing it uncovers whatever it displaced rather than deleting the key. */\nexport function registerMarker(entry: MarkerEntry): () => void {\n return MARKERS.push(entry.id, entry);\n}\n\n/** The entry for `key`, or `undefined`. */\nexport function getMarker(key: string | undefined): MarkerEntry | undefined {\n return key === undefined ? undefined : MARKERS.get(key);\n}\n\n/** Every registered marker, built-ins first, in registration order. */\nexport function listMarkers(): readonly MarkerEntry[] {\n return MARKERS.entries().map((e) => e.value);\n}\n\n/** Test helper. Do not call from product code. */\nexport function _resetMarkersForTests(): void {\n MARKERS.clear();\n seedBuiltins();\n}\n"],"mappings":";;;AA8DA,IAAMA,IAAUC,EAA+B;AAE/C,SAASC,IAAqB;CAC5B,KAAK,IAAMC,KAASC,GAAiB,EAAQ,KAAKD,EAAM,IAAIA,GAAO,EAAE,QAAQ,MAAM,CAAC;AACtF;AACAD,EAAa;AAGb,IAAaG,IAA0CL,EAAQ;AAG/D,SAAgBM,IAA2B;CACzC,OAAON,EAAQ,WAAW;AAC5B;AAIA,SAAgBO,EAAe,GAAgC;CAC7D,OAAOP,EAAQ,KAAKG,EAAM,IAAIA,CAAK;AACrC;AAGA,SAAgBK,EAAU,GAAkD;CAC1E,OAAOC,MAAQ,KAAA,IAAY,KAAA,IAAYT,EAAQ,IAAIS,CAAG;AACxD;AAGA,SAAgBC,IAAsC;CACpD,OAAOV,EAAQ,QAAQ,CAAC,CAAC,KAAK,MAAM,EAAE,KAAK;AAC7C;AAGA,SAAgBW,IAA8B;CAE5C,AADAX,EAAQ,MAAM,GACdE,EAAa;AACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meanScale.js","names":["meanScale","s"],"sources":["../../../src/core/viewport/meanScale.ts"],"sourcesContent":["/**\n * Geometric mean of a per-axis scale's magnitudes, so a flipped (negative)\n * axis counts by its size. Degenerates to that size when the two axes are\n * equal; otherwise sits between them.\n *\n * **Not for hit-testing.** A screen-pixel length is not one world distance\n * under non-uniform zoom, and collapsing it to a scalar makes a pickable\n * region too generous on one axis and too mean on the other. Use `pxExtent`\n * for a per-axis world length, or `withinPxBox` / `withinPxRadius` to compare\n * in screen space directly. Chrome hit-tests moved off this in 2026-08.\n *\n * Nor for placing chrome or measuring a pick slop: `standoff` and\n * `strokeHitTest`'s `slop` work on screen, which stays exact under a rotated\n * target where no per-axis world answer exists.\n *\n * What legitimately remains is a stroke width for a line that is not\n * axis-aligned. A ribbon takes one world width, and the renderer resolves a\n * `{ px }` width through this same mean, so a picker reading ink widths must\n * too. An axis-aligned line has an exact answer — `pxExtent` on its cross\n * axis, as the grid layer does.\n */\nexport function meanScale(s: { x: number; y: number }): number {\n return Math.sqrt(Math.abs(s.x * s.y));\n}\n"],"mappings":";AAqBA,SAAgBA,EAAU,GAAqC;CAC7D,OAAO,KAAK,KAAK,KAAK,IAAIC,EAAE,IAAIA,EAAE,CAAC,CAAC;AACtC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//#region src/core/viewport/pxExtent.ts
|
|
2
|
-
function e(e, t, n = 0) {
|
|
3
|
-
if (!n) return {
|
|
4
|
-
x: e / Math.abs(t.x),
|
|
5
|
-
y: e / Math.abs(t.y)
|
|
6
|
-
};
|
|
7
|
-
let r = Math.cos(n), i = Math.sin(n);
|
|
8
|
-
return {
|
|
9
|
-
x: e * Math.hypot(r / t.x, i / t.y),
|
|
10
|
-
y: e * Math.hypot(i / t.x, r / t.y)
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function t(e, t, n) {
|
|
14
|
-
return {
|
|
15
|
-
x: e * n.x,
|
|
16
|
-
y: t * n.y
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function n(e, n, r, i) {
|
|
20
|
-
let a = t(e, n, i);
|
|
21
|
-
return Math.abs(a.x) <= r && Math.abs(a.y) <= r;
|
|
22
|
-
}
|
|
23
|
-
function r(e, n, r, i) {
|
|
24
|
-
let a = t(e, n, i);
|
|
25
|
-
return a.x * a.x + a.y * a.y <= r * r;
|
|
26
|
-
}
|
|
27
|
-
function i(e, t, n, r) {
|
|
28
|
-
let i = Math.sign(r.x * r.y) || 1, a = t.x * r.y * i, o = t.y * r.x * i, s = Math.hypot(a, o) || 1;
|
|
29
|
-
return a /= s, o /= s, {
|
|
30
|
-
x: e.x + a * n / r.x,
|
|
31
|
-
y: e.y + o * n / r.y,
|
|
32
|
-
nx: a,
|
|
33
|
-
ny: o
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function a(e, t) {
|
|
37
|
-
return Math.atan2(Math.sin(e) * t.y, Math.cos(e) * t.x);
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { e as pxExtent, t as scaleDelta, a as screenAngleOf, i as standoff, n as withinPxBox, r as withinPxRadius };
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=pxExtent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pxExtent.js","names":["pxExtent","rotation","px","scale","c","s","scaleDelta","dx","dy","withinPxBox","withinPxRadius","standoff","k","nx","normal","ny","l","anchor","screenAngleOf"],"sources":["../../../src/core/viewport/pxExtent.ts"],"sourcesContent":["/**\n * Screen-pixel lengths in world units, per axis.\n *\n * Chrome declares its hit zones in screen pixels — an 8px handle stays 8px at\n * every zoom, because it paints in screen space. Converting one such length to\n * world units with a single scalar (see `meanScale`) is exact only under\n * uniform zoom; per-axis it is too generous on one axis and too mean on the\n * other, so the pickable region stops matching the painted one.\n *\n * Prefer {@link withinPxBox} / {@link withinPxRadius}, which compare in screen\n * space and so can't drift from the paint at all. {@link pxExtent} is for the\n * cases that must stay in world units — a tolerance handed to geometry that\n * doesn't know about the view.\n */\n\nexport interface Scale2 {\n x: number;\n y: number;\n}\n\n/** One screen-pixel length as world-space extents, per axis. `scale` is a\n * view's, so neither axis is zero (see `View`).\n *\n * With `rotation`, the axes are a frame turned that far from world, and each\n * extent is how far along it an edge across it must move to move `px` on\n * screen — which, under non-uniform zoom, is not the extent along the screen\n * axis nearest to it. */\nexport function pxExtent(px: number, scale: Scale2, rotation = 0): { x: number; y: number } {\n if (!rotation) {\n return {\n x: px / Math.abs(scale.x),\n y: px / Math.abs(scale.y),\n };\n }\n const c = Math.cos(rotation), s = Math.sin(rotation);\n return {\n x: px * Math.hypot(c / scale.x, s / scale.y),\n y: px * Math.hypot(s / scale.x, c / scale.y),\n };\n}\n\n/** World delta → screen delta. Only the scale participates: translation\n * cancels in a difference, and the kit's views carry no skew. */\nexport function scaleDelta(dx: number, dy: number, scale: Scale2): { x: number; y: number } {\n return { x: dx * scale.x, y: dy * scale.y };\n}\n\n/**\n * Is a world-space delta inside a screen-space square of half-extent `px`?\n *\n * The square is axis-aligned **on screen**, which is what a handle painted in\n * screen space actually is — so this stays true under non-uniform zoom and\n * under a rotated target, where an axis-aligned world-space test is a rotated\n * rectangle on screen.\n */\nexport function withinPxBox(dx: number, dy: number, px: number, scale: Scale2): boolean {\n const s = scaleDelta(dx, dy, scale);\n return Math.abs(s.x) <= px && Math.abs(s.y) <= px;\n}\n\n/** Is a world-space delta inside a screen-space circle of radius `px`? */\nexport function withinPxRadius(dx: number, dy: number, px: number, scale: Scale2): boolean {\n const s = scaleDelta(dx, dy, scale);\n return s.x * s.x + s.y * s.y <= px * px;\n}\n\n/**\n * A world point pushed `px` screen pixels off an edge, along the edge's normal\n * as it lands on screen. `normal` is the edge's outward normal in world space.\n *\n * Scaling the world normal by the view is not the same thing: under\n * non-uniform zoom the image of a normal is no longer perpendicular to the\n * image of its edge, so chrome placed that way drifts sideways and sits closer\n * than `px`. Returns the point in world coords and the on-screen unit normal.\n */\nexport function standoff(\n anchor: { x: number; y: number },\n normal: { x: number; y: number },\n px: number,\n scale: Scale2,\n): { x: number; y: number; nx: number; ny: number } {\n // The edge's screen normal is S⁻ᵀn, here scaled by det S to stay finite.\n const k = Math.sign(scale.x * scale.y) || 1;\n let nx = normal.x * scale.y * k;\n let ny = normal.y * scale.x * k;\n const l = Math.hypot(nx, ny) || 1;\n nx /= l;\n ny /= l;\n return { x: anchor.x + (nx * px) / scale.x, y: anchor.y + (ny * px) / scale.y, nx, ny };\n}\n\n/** The screen angle a frame turned `rotation` from world lands its x axis at.\n * Equals `rotation` under uniform zoom; non-uniform zoom bends it. */\nexport function screenAngleOf(rotation: number, scale: Scale2): number {\n return Math.atan2(Math.sin(rotation) * scale.y, Math.cos(rotation) * scale.x);\n}\n"],"mappings":";AA2BA,SAAgBA,EAAS,GAAY,GAAe,IAAW,GAA6B;CAC1F,IAAI,CAACC,GACH,OAAO;EACL,GAAGC,IAAK,KAAK,IAAIC,EAAM,CAAC;EACxB,GAAGD,IAAK,KAAK,IAAIC,EAAM,CAAC;CAC1B;CAEF,IAAMC,IAAI,KAAK,IAAIH,CAAQ,GAAGI,IAAI,KAAK,IAAIJ,CAAQ;CACnD,OAAO;EACL,GAAGC,IAAK,KAAK,MAAME,IAAID,EAAM,GAAGE,IAAIF,EAAM,CAAC;EAC3C,GAAGD,IAAK,KAAK,MAAMG,IAAIF,EAAM,GAAGC,IAAID,EAAM,CAAC;CAC7C;AACF;AAIA,SAAgBG,EAAW,GAAY,GAAY,GAAyC;CAC1F,OAAO;EAAE,GAAGC,IAAKJ,EAAM;EAAG,GAAGK,IAAKL,EAAM;CAAE;AAC5C;AAUA,SAAgBM,EAAY,GAAY,GAAY,GAAY,GAAwB;CACtF,IAAMJ,IAAIC,EAAWC,GAAIC,GAAIL,CAAK;CAClC,OAAO,KAAK,IAAIE,EAAE,CAAC,KAAKH,KAAM,KAAK,IAAIG,EAAE,CAAC,KAAKH;AACjD;AAGA,SAAgBQ,EAAe,GAAY,GAAY,GAAY,GAAwB;CACzF,IAAML,IAAIC,EAAWC,GAAIC,GAAIL,CAAK;CAClC,OAAOE,EAAE,IAAIA,EAAE,IAAIA,EAAE,IAAIA,EAAE,KAAKH,IAAKA;AACvC;AAWA,SAAgBS,EACd,GACA,GACA,GACA,GACkD;CAElD,IAAMC,IAAI,KAAK,KAAKT,EAAM,IAAIA,EAAM,CAAC,KAAK,GACtCU,IAAKC,EAAO,IAAIX,EAAM,IAAIS,GAC1BG,IAAKD,EAAO,IAAIX,EAAM,IAAIS,GACxBI,IAAI,KAAK,MAAMH,GAAIE,CAAE,KAAK;CAGhC,OAFA,KAAMC,GACN,KAAMA,GACC;EAAE,GAAGC,EAAO,IAAKJ,IAAKX,IAAMC,EAAM;EAAG,GAAGc,EAAO,IAAKF,IAAKb,IAAMC,EAAM;EAAG;EAAI;CAAG;AACxF;AAIA,SAAgBe,EAAc,GAAkB,GAAuB;CACrE,OAAO,KAAK,MAAM,KAAK,IAAIjB,CAAQ,IAAIE,EAAM,GAAG,KAAK,IAAIF,CAAQ,IAAIE,EAAM,CAAC;AAC9E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paintedCursorLayer.js","names":["PAINTED_CURSOR_LAYER_ID","pathCache","pathFor","p","d","pathFromD","commandFor","op","createPaintedCursorLayer","frame","state","glyph","GLYPHS","cursor","scale","view","worldSized","size","cursorWorldSize","ops","cursorPaintOps","chromeLineWidthScale","a","b","c","e","f","cursorPaintMatrix"],"sources":["../../../src/features/cursor/paintedCursorLayer.ts"],"sourcesContent":["/**\n * The painted tier: draws a cursor glyph into the scene when it is too big,\n * or too tied to the view, to be a CSS `url()` cursor.\n *\n * A layer rather than something each tool draws in its own overlay, because\n * the alternative is every tool re-wiring the same thing. Riding the layer\n * system also means anything that reaches the cursor pipeline through a layer\n * claim — a HUD widget's `cursorAt` — gets the painted tier without knowing\n * this exists.\n *\n * Screen-space: the glyph is chrome at the pointer, not content in the\n * document, so it must not pan or zoom with the camera. What *does* track the\n * camera is a world-sized glyph's size, and `view.scale` is read for that.\n */\n\nimport { GLYPHS } from '@weasel-js/cursor';\nimport {\n chromeLineWidthScale,\n cursorPaintMatrix,\n cursorPaintOps,\n cursorWorldSize,\n} from '@weasel-js/cursor';\nimport type { CursorPaintOp } from '@weasel-js/cursor';\nimport type { DrawCommand, PathDrawCommand } from '../../renderer';\nimport type { RenderLayer } from 'core/layers/render';\nimport { pathFromD, type Path } from '@weasel-js/geom';\nimport type { PaintedCursorState } from '@weasel-js/cursor';\n\n/** Layer id, so a consumer can order or hide it like any other. */\nexport const PAINTED_CURSOR_LAYER_ID = 'painted-cursor';\n\n/**\n * `d` strings are fixed by the glyph set, so the parse is done once per glyph\n * member for the life of the process. Handing the renderer the same `Path`\n * object every frame also lets its own mesh cache hit.\n */\nconst pathCache = new Map<string, Path>();\nfunction pathFor(d: string): Path {\n let p = pathCache.get(d);\n if (p === undefined) {\n p = pathFromD(d);\n pathCache.set(d, p);\n }\n return p;\n}\n\nfunction commandFor(op: CursorPaintOp): PathDrawCommand {\n return {\n kind: 'path',\n path: pathFor(op.d),\n ...(op.fill !== undefined ? { fill: { color: op.fill } } : {}),\n ...(op.stroke !== undefined\n ? {\n stroke: {\n paint: { color: op.stroke.color },\n width: op.stroke.width,\n cap: 'round' as const,\n join: 'round' as const,\n },\n }\n : {}),\n };\n}\n\n/**\n * A screen-space layer that draws the glyph `state` currently holds at the pointer,\n * or nothing when it holds none. `<Canvas>` mounts one over its own state already.\n */\nexport function createPaintedCursorLayer(state: PaintedCursorState): RenderLayer<unknown> {\n return {\n id: PAINTED_CURSOR_LAYER_ID,\n label: 'Painted cursor',\n space: 'screen',\n draw: (_data, view) => {\n const frame = state.current();\n if (!frame) return [];\n const { cursor, at } = frame;\n const glyph = GLYPHS[cursor.glyph];\n if (!glyph) return [];\n\n // A world-sized glyph is measured against the live camera, and holds its\n // line weight in CSS px while its geometry grows — a ring at a 400px\n // radius drawn with scaled weight is a filled blob, not a cursor.\n // Radial, so a single radius needs one scale factor; average the axes.\n const scale = (view.scale.x + view.scale.y) / 2;\n const worldSized = cursor.worldRadius !== undefined;\n const size = worldSized\n ? cursorWorldSize(glyph, cursor.worldRadius as number, scale)\n : (cursor.size ?? 24);\n if (!(size > 0) || !Number.isFinite(size)) return [];\n\n const ops = cursorPaintOps(\n glyph,\n worldSized ? { lineWidthScale: chromeLineWidthScale(glyph, size) } : {},\n );\n const [a, b, c, d, e, f] = cursorPaintMatrix(glyph, {\n size,\n angle: cursor.angle,\n at,\n });\n // Column-major, the layout `Mat3` documents.\n const transform = new Float32Array([a, b, 0, c, d, 0, e, f, 1]);\n const children: DrawCommand[] = ops.map(commandFor);\n return [{ kind: 'group', transform, children }];\n },\n };\n}\n"],"mappings":";;;AA6BA,IAAaA,IAA0B,kBAOjCC,oBAAY,IAAI,IAAkB;AACxC,SAASC,EAAQ,GAAiB;CAChC,IAAIC,IAAIF,EAAU,IAAIG,CAAC;CAKvB,OAJID,MAAM,KAAA,MACR,IAAIE,EAAUD,CAAC,GACfH,EAAU,IAAIG,GAAGD,CAAC,IAEbA;AACT;AAEA,SAASG,EAAW,GAAoC;CACtD,OAAO;EACL,MAAM;EACN,MAAMJ,EAAQK,EAAG,CAAC;EAClB,GAAIA,EAAG,SAAS,KAAA,IAA2C,CAAC,IAAhC,EAAE,MAAM,EAAE,OAAOA,EAAG,KAAK,EAAE;EACvD,GAAIA,EAAG,WAAW,KAAA,IASd,CAAC,IARD,EACE,QAAQ;GACN,OAAO,EAAE,OAAOA,EAAG,OAAO,MAAM;GAChC,OAAOA,EAAG,OAAO;GACjB,KAAK;GACL,MAAM;EACR,EACF;CAEN;AACF;AAMA,SAAgBC,EAAyB,GAAiD;CACxF,OAAO;EACL,IAAIR;EACJ,OAAO;EACP,OAAO;EACP,OAAO,GAAO,MAAS;GACrB,IAAMS,IAAQC,EAAM,QAAQ;GAC5B,IAAI,CAACD,GAAO,OAAO,CAAC;GACpB,IAAM,EAAE,WAAQ,UAAOA,GACjBE,IAAQC,EAAOC,EAAO;GAC5B,IAAI,CAACF,GAAO,OAAO,CAAC;GAMpB,IAAMG,KAASC,EAAK,MAAM,IAAIA,EAAK,MAAM,KAAK,GACxCC,IAAaH,EAAO,gBAAgB,KAAA,GACpCI,IAAOD,IACTE,EAAgBP,GAAOE,EAAO,aAAuBC,CAAK,IACzDD,EAAO,QAAQ;GACpB,IAAI,EAAEI,IAAO,MAAM,CAAC,OAAO,SAASA,CAAI,GAAG,OAAO,CAAC;GAEnD,IAAME,IAAMC,EACVT,GACAK,IAAa,EAAE,gBAAgBK,EAAqBV,GAAOM,CAAI,EAAE,IAAI,CAAC,CACxE,GACM,CAACK,GAAGC,GAAGC,GAAGpB,GAAGqB,GAAGC,KAAKC,EAAkBhB,GAAO;IAClD;IACA,OAAOE,EAAO;IACd;GACF,CAAC;GAID,OAAO,CAAC;IAAE,MAAM;IAAS,WAAA,IAFH,aAAa;KAACS;KAAGC;KAAG;KAAGC;KAAGpB;KAAG;KAAGqB;KAAGC;KAAG;IAAC,CAEpC;IAAW,UADJP,EAAI,IAAIb,CACJ;GAAS,CAAC;EAChD;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateLayer.js","names":["gateLayer","opts","wrapped","layer","visible","data","view","dims","deps","hitTest","args","subscribeToSources"],"sources":["../../../src/features/focus/gateLayer.ts"],"sourcesContent":["/**\n * `RenderLayer` wrapper that conditionally emits draw commands based on a\n * predicate. Most common use: hide selection-overlay handles when the\n * canvas isn't focused.\n *\n * The predicate is a getter (`() => boolean`), not a static value, because\n * RenderLayers are constructed once but their `draw` runs every frame —\n * a static value would lock in whatever the predicate returned at\n * construction time.\n */\nimport { subscribeToSources, type RenderLayer } from 'core/layers/render';\n\n/** Options for `gateLayer`. */\nexport interface GateLayerOptions<TData> {\n /** The wrapped layer. Everything but `draw`, `hitTest`, and `deps` flows\n * through unchanged. */\n layer: RenderLayer<TData>;\n /** Returns `true` to render the layer this frame, `false` to skip. */\n visible: () => boolean;\n}\n\n/** Wrap a render layer so it only draws, and is only hit, while `visible()`\n * is true. The predicate is consulted per frame, which is how chrome follows\n * canvas focus without the layer knowing anything about focus. */\nexport function gateLayer<TData>(opts: GateLayerOptions<TData>): RenderLayer<TData> {\n const { layer, visible } = opts;\n const wrapped: RenderLayer<TData> = {\n ...layer,\n draw: (data, view, dims) => (visible() ? layer.draw(data, view, dims) : []),\n };\n const { deps, hitTest } = layer;\n if (deps) wrapped.deps = (data, view, dims) => [visible(), ...deps(data, view, dims)];\n if (hitTest) wrapped.hitTest = (...args) => (visible() ? hitTest(...args) : null);\n if (layer.subscribe) wrapped.subscribe = subscribeToSources([layer]);\n return wrapped;\n}\n"],"mappings":";;AAwBA,SAAgBA,EAAiB,GAAmD;CAClF,IAAM,EAAE,UAAO,eAAYC,GACrBC,IAA8B;EAClC,GAAGC;EACH,OAAO,GAAM,GAAM,MAAUC,EAAQ,IAAID,EAAM,KAAKE,GAAMC,GAAMC,CAAI,IAAI,CAAC;CAC3E,GACM,EAAE,SAAM,eAAYJ;CAI1B,OAHIK,MAAM,EAAQ,QAAQ,GAAM,GAAM,MAAS,CAACJ,EAAQ,GAAG,GAAGI,EAAKH,GAAMC,GAAMC,CAAI,CAAC,IAChFE,MAAS,EAAQ,WAAW,GAAGC,MAAUN,EAAQ,IAAIK,EAAQ,GAAGC,CAAI,IAAI,OACxEP,EAAM,cAAW,EAAQ,YAAYQ,EAAmB,CAACR,CAAK,CAAC,IAC5DD;AACT"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useCallback as e, useMemo as t, useRef as n, useState as r } from "react";
|
|
2
|
-
//#region src/features/focus/useCanvasFocus.ts
|
|
3
|
-
function i(i = {}) {
|
|
4
|
-
let { initial: a = !1, tabIndex: o = 0 } = i, [s, c] = r(a), l = n(a), u = e(() => {
|
|
5
|
-
l.current || (l.current = !0, c(!0));
|
|
6
|
-
}, []), d = e(() => {
|
|
7
|
-
l.current && (l.current = !1, c(!1));
|
|
8
|
-
}, []), f = e(() => l.current, []), p = e((e) => {
|
|
9
|
-
l.current !== e && (l.current = e, c(e));
|
|
10
|
-
}, []);
|
|
11
|
-
return {
|
|
12
|
-
focused: s,
|
|
13
|
-
focusProps: t(() => ({
|
|
14
|
-
tabIndex: o,
|
|
15
|
-
onFocus: u,
|
|
16
|
-
onBlur: d
|
|
17
|
-
}), [
|
|
18
|
-
o,
|
|
19
|
-
u,
|
|
20
|
-
d
|
|
21
|
-
]),
|
|
22
|
-
getFocused: f,
|
|
23
|
-
setFocused: p
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { i as useCanvasFocus };
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=useCanvasFocus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCanvasFocus.js","names":["useCanvasFocus","options","focused","setFocusedState","useState","initial","focusedRef","useRef","onFocus","useCallback","onBlur","getFocused","setFocused","next","useMemo","tabIndex"],"sources":["../../../src/features/focus/useCanvasFocus.ts"],"sourcesContent":["/**\n * Track DOM focus on a canvas (or any focusable host element). Returns the\n * live `focused` boolean, props to spread onto the focusable element, and a\n * stable `getFocused()` getter for use inside per-frame closures (notably\n * `RenderLayer.draw`, which is constructed once but called every frame).\n *\n * Pure feature module — no Canvas/SceneCanvas integration. Consumers compose\n * the hook + `gateLayer` (or their own gate) to hide affordances when blurred.\n */\nimport { useCallback, useMemo, useRef, useState } from 'react';\n\n/** Options for `useCanvasFocus`. */\nexport interface UseCanvasFocusOptions {\n /** Initial focus state. Default `false` — handles hidden until first click. */\n initial?: boolean;\n /** `tabIndex` to set on the focusable element. Default `0` (focusable in\n * document tab order). Set to `-1` for programmatic-only focus. */\n tabIndex?: number;\n}\n\n/** What `useCanvasFocus` hands back: the focus state, the props that\n * maintain it, and a getter for reading it from per-frame code. */\nexport interface CanvasFocusReturn {\n /** Live boolean — true when the element has DOM focus. Triggers re-renders\n * when the focus state changes (set via React state). */\n focused: boolean;\n /** Spread onto the focusable element (e.g. the canvas). Includes\n * `tabIndex`, `onFocus`, `onBlur`. */\n focusProps: {\n tabIndex: number;\n onFocus: () => void;\n onBlur: () => void;\n };\n /** Stable getter for the live focused state. Use inside per-frame closures\n * like `RenderLayer.draw`, where the layer is constructed once and\n * reading `focused` directly would capture the value at construction\n * time. The getter always returns the current value. */\n getFocused: () => boolean;\n /** Imperative focus / blur. Useful for tests and programmatic control. */\n setFocused: (next: boolean) => void;\n}\n\n/** Track DOM focus on the canvas, so chrome that should only show while the\n * canvas is focused can be gated on it. */\nexport function useCanvasFocus(options: UseCanvasFocusOptions = {}): CanvasFocusReturn {\n const { initial = false, tabIndex = 0 } = options;\n const [focused, setFocusedState] = useState<boolean>(initial);\n // Every state change goes through a handler below that writes this first.\n const focusedRef = useRef<boolean>(initial);\n\n const onFocus = useCallback(() => {\n if (!focusedRef.current) {\n focusedRef.current = true;\n setFocusedState(true);\n }\n }, []);\n const onBlur = useCallback(() => {\n if (focusedRef.current) {\n focusedRef.current = false;\n setFocusedState(false);\n }\n }, []);\n const getFocused = useCallback(() => focusedRef.current, []);\n const setFocused = useCallback((next: boolean) => {\n if (focusedRef.current === next) return;\n focusedRef.current = next;\n setFocusedState(next);\n }, []);\n\n // Stable until tabIndex changes, so it can be spread onto memoized elements\n // without retriggering downstream effects.\n const focusProps = useMemo(() => ({ tabIndex, onFocus, onBlur }), [tabIndex, onFocus, onBlur]);\n\n return {\n focused,\n focusProps,\n getFocused,\n setFocused,\n };\n}\n"],"mappings":";;AA4CA,SAAgBA,EAAe,IAAiC,CAAC,GAAsB;CACrF,IAAM,EAAE,aAAU,IAAO,cAAW,MAAMC,GACpC,CAACC,GAASC,KAAmBC,EAAkBC,CAAO,GAEtDC,IAAaC,EAAgBF,CAAO,GAEpCG,IAAUC,QAAkB;EAChC,AAAKH,EAAW,YACd,EAAW,UAAU,IACrBH,EAAgB,EAAI;CAExB,GAAG,CAAC,CAAC,GACCO,IAASD,QAAkB;EAC/B,AAAIH,EAAW,YACb,EAAW,UAAU,IACrBH,EAAgB,EAAK;CAEzB,GAAG,CAAC,CAAC,GACCQ,IAAaF,QAAkBH,EAAW,SAAS,CAAC,CAAC,GACrDM,IAAaH,GAAa,MAAkB;EAChD,AAAIH,EAAW,YAAYO,MAC3B,EAAW,UAAUA,GACrBV,EAAgBU,CAAI;CACtB,GAAG,CAAC,CAAC;CAML,OAAO;EACL;EACA,YAJiBC,SAAe;GAAE;GAAU;GAAS;EAAO,IAAI;GAACC;GAAUP;GAASE;EAAM,CAI1F;EACA;EACA;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"children.js","names":["createChildrenLayer","opts","getChildren","ids","out","id","sub","data","view","cmd"],"sources":["../../../src/features/groups/children.ts"],"sourcesContent":["/**\n * Z-ordered child renderer — replaces the manual `for (id of getChildren()) ...`\n * pattern with a `RenderLayer` factory that consumes an `OrderedAdapter`.\n *\n * Children are drawn in z-order (forward iteration: index 0 = bottom). The\n * caller supplies a `drawChild` callback that emits `DrawCommand[]` for one\n * object; this layer is the boilerplate-free way to plug a scene graph's\n * z-order into the layer composition system.\n *\n * If the adapter doesn't implement `getChildren` (it's optional on\n * `OrderedAdapter`), the layer is a silent no-op — adopt z-order incrementally\n * without breaking existing layers.\n */\n\nimport type { DrawCommand } from '../../renderer';\nimport type { RenderLayer } from 'core/layers/render';\nimport type { View } from 'core/viewport/view';\nimport type { OrderedAdapter } from 'core/adapters/types';\n\n/** Options for `createChildrenLayer`. */\nexport interface CreateChildrenLayerOpts<TData> {\n /** Layer id for the visibility/order map. Default `'children'`. */\n id?: string;\n /** Human-readable label. Default `'Children'`. */\n label?: string;\n /** Source of `getChildren`. Only the read side is used. */\n adapter: Pick<OrderedAdapter, 'getChildren'>;\n /** Parent id (null = root). Function form lets the layer follow a moving\n * selection or focus. Default `null`. */\n parentId?: string | null | (() => string | null);\n /** Draw one child. Called once per id in z-order (bottom → top). The\n * per-child outputs are concatenated into the layer's `DrawCommand[]`. */\n drawChild(id: string, data: TData, view: View): DrawCommand[];\n /** Forwarded to the produced `RenderLayer`. */\n defaultVisible?: boolean;\n /** Forwarded to the produced `RenderLayer`. */\n alwaysOn?: boolean;\n}\n\n/** Build a `RenderLayer` that draws an `OrderedAdapter`'s children in z-order. */\nexport function createChildrenLayer<TData = unknown>(\n opts: CreateChildrenLayerOpts<TData>,\n): RenderLayer<TData> {\n return {\n id: opts.id ?? 'children',\n label: opts.label ?? 'Children',\n defaultVisible: opts.defaultVisible,\n alwaysOn: opts.alwaysOn,\n draw: (data, view) => {\n const getChildren = opts.adapter.getChildren;\n if (!getChildren) return [];\n const parent =\n typeof opts.parentId === 'function'\n ? opts.parentId()\n : opts.parentId ?? null;\n const ids = getChildren(parent);\n const out: DrawCommand[] = [];\n for (const id of ids) {\n const sub = opts.drawChild(id, data, view);\n for (const cmd of sub) out.push(cmd);\n }\n return out;\n },\n };\n}\n"],"mappings":";AAwCA,SAAgBA,EACd,GACoB;CACpB,OAAO;EACL,IAAIC,EAAK,MAAM;EACf,OAAOA,EAAK,SAAS;EACrB,gBAAgBA,EAAK;EACrB,UAAUA,EAAK;EACf,OAAO,GAAM,MAAS;GACpB,IAAMC,IAAcD,EAAK,QAAQ;GACjC,IAAI,CAACC,GAAa,OAAO,CAAC;GAK1B,IAAMC,IAAMD,EAHV,OAAOD,EAAK,YAAa,aACrBA,EAAK,SAAS,IACdA,EAAK,YAAY,IACO,GACxBG,IAAqB,CAAC;GAC5B,KAAK,IAAMC,KAAMF,GAAK;IACpB,IAAMG,IAAML,EAAK,UAAUI,GAAIE,GAAMC,CAAI;IACzC,KAAK,IAAMC,KAAOH,GAAK,EAAI,KAAKG,CAAG;GACrC;GACA,OAAOL;EACT;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composePose.js","names":["composeRectPose","child","parent","translateRectPose","pose","dx","dy","decomposeRectPose","world","turn","c","r","s","cx","x","y","cy","composeRigidPose","pr","wcx","wcy","decomposeRigidPose","ux","uy","RECT_POSE_COMPOSITION","RIGID_POSE_COMPOSITION","worldPoseLookup","composeWorldPose","adapter","id","compose","IDENTITY_POSE_COMPOSITION","frameAtOrAbove","rebaseLocalPose"],"sources":["../../../src/features/groups/composePose.ts"],"sourcesContent":["/**\n * Pose composition for hierarchical scene graphs.\n *\n * As of the nesting change, `getPose(id)` on adapters returns the\n * **local** pose — relative to the object's direct parent. Anything in the\n * kit that needs to draw, hit-test, snap, or otherwise reason about world\n * coordinates routes through `composeWorldPose`, which walks the parent\n * chain and folds local poses together via a consumer-supplied `compose`.\n *\n * Pose shape is generic, so the compose strategy is too. For the common\n * `{x, y, width, height}` axis-aligned rect, use `composeRectPose` —\n * translation only, child dimensions preserved. Custom pose shapes (paths,\n * matrix transforms) supply their own.\n *\n * The inverse — `rebaseLocalPose` — converts a world-space pose into a\n * local pose under a target parent. Used when reparenting so the visual\n * world position of a child is preserved across the parent change.\n */\n\n/** Re-exported; the declaration lives in `core/scene/types.ts`, which names\n * it and may not import from features. */\nimport type { RectPose } from 'core/scene/types';\nexport type { RectPose };\n\n/** Re-exported from `core/scene/composeFrame.ts`, for the same reason. */\nimport {\n IDENTITY_POSE_COMPOSITION,\n composeWorldPose,\n frameAtOrAbove,\n rebaseLocalPose,\n type PoseAdapter,\n type PoseClosure,\n type PoseComposition,\n} from 'core/scene/composeFrame';\nexport { IDENTITY_POSE_COMPOSITION, composeWorldPose, frameAtOrAbove, rebaseLocalPose };\nexport type { PoseAdapter, PoseClosure, PoseComposition };\n\n/**\n * Default `compose` for axis-aligned rectangles. Adds translation; preserves\n * child width/height. Treat as the canonical compose for any\n * `{x, y, width, height}` pose under a translation-only hierarchy.\n *\n * Generic over the concrete pose type so callers with a wider pose\n * (e.g. `RectPose & { rotation }`) can pass it through; the extra fields\n * are taken from the child unchanged.\n */\nexport function composeRectPose<TPose extends RectPose>(parent: TPose, child: TPose): TPose {\n return {\n ...child,\n x: parent.x + child.x,\n y: parent.y + child.y,\n };\n}\n\n/**\n * Translate a `RectPose`-shaped pose by `(dx, dy)`. Suitable as the default\n * `translatePose` for `useMove` when poses carry top-level `x`/`y`. Other\n * fields (width/height, plus any extra props on `TPose`) are preserved.\n */\nexport function translateRectPose<TPose extends RectPose>(pose: TPose, dx: number, dy: number): TPose {\n return { ...pose, x: pose.x + dx, y: pose.y + dy };\n}\n\n/** Inverse of `composeRectPose` — subtracts parent translation. */\nexport function decomposeRectPose<TPose extends RectPose>(parent: TPose, world: TPose): TPose {\n return {\n ...world,\n x: world.x - parent.x,\n y: world.y - parent.y,\n };\n}\n\n/** Turn `(x, y)` about `(cx, cy)` by `r` radians. */\nfunction turn(cx: number, cy: number, r: number, x: number, y: number): [number, number] {\n const c = Math.cos(r);\n const s = Math.sin(r);\n return [cx + (x - cx) * c - (y - cy) * s, cy + (x - cx) * s + (y - cy) * c];\n}\n\n/**\n * `compose` for a container whose pose defines a **frame**: the child's local\n * pose is offset into the parent's unrotated box, then the whole thing is\n * turned about the parent's center. Rotations add; the child keeps its size.\n *\n * Reduces to `composeRectPose` when the parent is upright, so a scene that\n * never rotates a container behaves identically under either strategy.\n *\n * Exact for translation and rotation. A parent carrying scale is outside what\n * this can express — see `PoseClosure`.\n */\nexport function composeRigidPose<TPose extends RectPose>(parent: TPose, child: TPose): TPose {\n const pr = parent.rotation ?? 0;\n const [wcx, wcy] = turn(\n parent.x + parent.width / 2,\n parent.y + parent.height / 2,\n pr,\n parent.x + child.x + child.width / 2,\n parent.y + child.y + child.height / 2,\n );\n return {\n ...child,\n x: wcx - child.width / 2,\n y: wcy - child.height / 2,\n rotation: (child.rotation ?? 0) + pr,\n };\n}\n\n/** Inverse of `composeRigidPose` — un-turns about the parent's center, then\n * subtracts the parent's offset. */\nexport function decomposeRigidPose<TPose extends RectPose>(parent: TPose, world: TPose): TPose {\n const pr = parent.rotation ?? 0;\n const [ux, uy] = turn(\n parent.x + parent.width / 2,\n parent.y + parent.height / 2,\n -pr,\n world.x + world.width / 2,\n world.y + world.height / 2,\n );\n return {\n ...world,\n x: ux - parent.x - world.width / 2,\n y: uy - parent.y - world.height / 2,\n rotation: (world.rotation ?? 0) - pr,\n };\n}\n\n/** Translation-only composition over `RectPose`. What a scene wants when a\n * container groups its children but never turns them. */\nexport const RECT_POSE_COMPOSITION: PoseComposition<RectPose> = {\n compose: composeRectPose,\n decompose: decomposeRectPose,\n closure: 'translation',\n};\n\n/** Composition over `RectPose` where a container's pose is a frame: rotating\n * the container rotates its contents. */\nexport const RIGID_POSE_COMPOSITION: PoseComposition<RectPose> = {\n compose: composeRigidPose,\n decompose: decomposeRigidPose,\n closure: 'rigid',\n};\n\n/**\n * Build a `(id) => world pose | null` callback over a `PoseAdapter`.\n * Convenience for RenderLayers that take a `getPose` callback (selection\n * overlays, debug layers, etc.) so consumers don't hand-write a\n * `composeWorldPose` call per layer.\n *\n * Returns `null` when `adapter.getPose` or `adapter.getParent` throws — the\n * common case is an id removed mid-render between selection state and the\n * next paint. Layers should treat `null` as \"skip this id.\"\n */\nexport function worldPoseLookup<TPose>(\n adapter: PoseAdapter<TPose>,\n compose: (parent: TPose, child: TPose) => TPose,\n): (id: string) => TPose | null {\n return (id: string) => {\n try {\n return composeWorldPose(adapter, id, compose);\n } catch {\n return null;\n }\n };\n}\n"],"mappings":";;AA8CA,SAAgBA,EAAwC,GAAe,GAAqB;CAC1F,OAAO;EACL,GAAGC;EACH,GAAGC,EAAO,IAAID,EAAM;EACpB,GAAGC,EAAO,IAAID,EAAM;CACtB;AACF;AAOA,SAAgBE,EAA0C,GAAa,GAAY,GAAmB;CACpG,OAAO;EAAE,GAAGC;EAAM,GAAGA,EAAK,IAAIC;EAAI,GAAGD,EAAK,IAAIE;CAAG;AACnD;AAGA,SAAgBC,EAA0C,GAAe,GAAqB;CAC5F,OAAO;EACL,GAAGC;EACH,GAAGA,EAAM,IAAIN,EAAO;EACpB,GAAGM,EAAM,IAAIN,EAAO;CACtB;AACF;AAGA,SAASO,EAAK,GAAY,GAAY,GAAW,GAAW,GAA6B;CACvF,IAAMC,IAAI,KAAK,IAAIC,CAAC,GACdC,IAAI,KAAK,IAAID,CAAC;CACpB,OAAO,CAACE,KAAMC,IAAID,KAAMH,KAAKK,IAAIC,KAAMJ,GAAGI,KAAMF,IAAID,KAAMD,KAAKG,IAAIC,KAAMN,CAAC;AAC5E;AAaA,SAAgBO,EAAyC,GAAe,GAAqB;CAC3F,IAAMC,IAAKhB,EAAO,YAAY,GACxB,CAACiB,GAAKC,KAAOX,EACjBP,EAAO,IAAIA,EAAO,QAAQ,GAC1BA,EAAO,IAAIA,EAAO,SAAS,GAC3BgB,GACAhB,EAAO,IAAID,EAAM,IAAIA,EAAM,QAAQ,GACnCC,EAAO,IAAID,EAAM,IAAIA,EAAM,SAAS,CACtC;CACA,OAAO;EACL,GAAGA;EACH,GAAGkB,IAAMlB,EAAM,QAAQ;EACvB,GAAGmB,IAAMnB,EAAM,SAAS;EACxB,WAAWA,EAAM,YAAY,KAAKiB;CACpC;AACF;AAIA,SAAgBG,EAA2C,GAAe,GAAqB;CAC7F,IAAMH,IAAKhB,EAAO,YAAY,GACxB,CAACoB,GAAIC,KAAMd,EACfP,EAAO,IAAIA,EAAO,QAAQ,GAC1BA,EAAO,IAAIA,EAAO,SAAS,GAC3B,CAACgB,GACDV,EAAM,IAAIA,EAAM,QAAQ,GACxBA,EAAM,IAAIA,EAAM,SAAS,CAC3B;CACA,OAAO;EACL,GAAGA;EACH,GAAGc,IAAKpB,EAAO,IAAIM,EAAM,QAAQ;EACjC,GAAGe,IAAKrB,EAAO,IAAIM,EAAM,SAAS;EAClC,WAAWA,EAAM,YAAY,KAAKU;CACpC;AACF;AAIA,IAAaM,IAAmD;CAC9D,SAASxB;CACT,WAAWO;CACX,SAAS;AACX,GAIakB,IAAoD;CAC/D,SAASR;CACT,WAAWI;CACX,SAAS;AACX;AAYA,SAAgBK,EACd,GACA,GAC8B;CAC9B,QAAQ,MAAe;EACrB,IAAI;GACF,OAAOC,EAAiBC,GAASC,GAAIC,CAAO;EAC9C,QAAQ;GACN,OAAO;EACT;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nestedHit.js","names":["nestedHitTester","d","opts","AUTO_POSE_DESCRIPTOR","isGroup","worldOf","worldPoseLookup","adapter","ancestorChain","chain","cur","id","hitLeaf","objs","i","o","w","b","poseDescriptorForNode","wx","wy","leaf","alt","selection"],"sources":["../../../src/features/groups/nestedHit.ts"],"sourcesContent":["import { worldPoseLookup } from './composePose';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\n\n/** @internal */\ninterface HitAdapter<TNode extends { id: string }, TPose> {\n getNode: (id: string) => TNode | undefined;\n getNodes: () => TNode[];\n getPose: (id: string) => TPose;\n getParent: (id: string) => string | null;\n}\n\n/** Options for `nestedHitTester`. */\nexport interface NestedHitOpts<TNode extends { id: string }, TPose> {\n /** Compose a child's local pose into world coords given its parent's world\n * pose. Same shape as `composeRectPose` (the default expectation). */\n composePose: (parent: TPose, child: TPose) => TPose;\n /** How to read world poses. Default `AUTO_POSE_DESCRIPTOR`. */\n poseDescriptor?: PoseDescriptor<TPose>;\n /** Predicate for \"this object is a nesting parent body\". The leaf scan\n * skips objects for which this returns true so a click on a parent's\n * painted body resolves to a child leaf, not the parent itself. Default:\n * never (treat every object as hittable). */\n isGroup?: (id: string, obj: TNode | undefined) => boolean;\n}\n\n/** Hit-test entry points for a nested scene: one that always picks the\n * outermost ancestor, and one that steps deeper on alt-click. */\nexport interface NestedHitTester {\n /** Outermost-ancestor pick. Suitable as the chrome-level `pickEvery`: a\n * casual click selects the whole top-level ancestor. Returns `null` on\n * empty space. */\n pickOutermost: (worldX: number, worldY: number) => string | null;\n /** Alt-aware selection-update pick. Without `alt`, returns the outermost\n * ancestor (same as `pickOutermost`). With `alt`, returns one level\n * deeper than the deepest currently-selected ancestor in the leaf's\n * chain — repeated alt-clicks step ancestor → descendant → leaf. With\n * `alt` and nothing in the chain selected, jumps straight to the leaf.\n * Plug into `useSelectTool({ pickBest })`. */\n pickBest: (\n worldX: number,\n worldY: number,\n alt: boolean,\n selection: readonly string[],\n ) => string | null;\n}\n\n/** Build hit-testers that respect containers: a plain click selects the\n * top-level ancestor, and alt-clicking descends one level at a time toward\n * the leaf actually under the pointer. */\nexport function nestedHitTester<TNode extends { id: string }, TPose>(\n adapter: HitAdapter<TNode, TPose>,\n opts: NestedHitOpts<TNode, TPose>,\n): NestedHitTester {\n const d = (opts.poseDescriptor ?? AUTO_POSE_DESCRIPTOR) as PoseDescriptor<TPose>;\n const isGroup = opts.isGroup ?? (() => false);\n const worldOf = worldPoseLookup(adapter, opts.composePose);\n\n const ancestorChain = (id: string): string[] => {\n const chain: string[] = [];\n let cur: string | null = id;\n while (cur !== null) {\n chain.unshift(cur);\n cur = adapter.getParent(cur);\n }\n return chain;\n };\n\n const hitLeaf = (wx: number, wy: number): string | null => {\n const objs = adapter.getNodes();\n for (let i = objs.length - 1; i >= 0; i--) {\n const o = objs[i];\n if (isGroup(o.id, o)) continue;\n const w = worldOf(o.id);\n if (!w) continue;\n const b = poseDescriptorForNode(d, o).getBounds(w);\n if (wx >= b.x && wx <= b.x + b.width && wy >= b.y && wy <= b.y + b.height) {\n return o.id;\n }\n }\n return null;\n };\n\n const pickOutermost = (wx: number, wy: number): string | null => {\n const leaf = hitLeaf(wx, wy);\n return leaf === null ? null : ancestorChain(leaf)[0];\n };\n\n const pickBest = (\n wx: number,\n wy: number,\n alt: boolean,\n selection: readonly string[],\n ): string | null => {\n const leaf = hitLeaf(wx, wy);\n if (leaf === null) return null;\n const chain = ancestorChain(leaf);\n if (!alt) return chain[0];\n for (let i = chain.length - 1; i >= 0; i--) {\n if (selection.includes(chain[i])) {\n return chain[Math.min(i + 1, chain.length - 1)];\n }\n }\n return chain[chain.length - 1];\n };\n\n return { pickOutermost, pickBest };\n}\n"],"mappings":";;;;AAkDA,SAAgBA,EACd,GACA,GACiB;CACjB,IAAMC,IAAKC,EAAK,kBAAkBC,GAC5BC,IAAUF,EAAK,kBAAkB,KACjCG,IAAUC,EAAgBC,GAASL,EAAK,WAAW,GAEnDM,KAAiB,MAAyB;EAC9C,IAAMC,IAAkB,CAAC,GACrBC,IAAqBC;EACzB,OAAOD,MAAQ,OAEb,AADAD,EAAM,QAAQC,CAAG,GACjB,IAAMH,EAAQ,UAAUG,CAAG;EAE7B,OAAOD;CACT,GAEMG,KAAW,GAAY,MAA8B;EACzD,IAAMC,IAAON,EAAQ,SAAS;EAC9B,KAAK,IAAIO,IAAID,EAAK,SAAS,GAAGC,KAAK,GAAG,KAAK;GACzC,IAAMC,IAAIF,EAAKC;GACf,IAAIV,EAAQW,EAAE,IAAIA,CAAC,GAAG;GACtB,IAAMC,IAAIX,EAAQU,EAAE,EAAE;GACtB,IAAI,CAACC,GAAG;GACR,IAAMC,IAAIC,EAAsBjB,GAAGc,CAAC,CAAC,CAAC,UAAUC,CAAC;GACjD,IAAIG,KAAMF,EAAE,KAAKE,KAAMF,EAAE,IAAIA,EAAE,SAASG,KAAMH,EAAE,KAAKG,KAAMH,EAAE,IAAIA,EAAE,QACjE,OAAOF,EAAE;EAEb;EACA,OAAO;CACT;CAyBA,OAAO;EAAE,gBAvBc,GAAY,MAA8B;GAC/D,IAAMM,IAAOT,EAAQO,GAAIC,CAAE;GAC3B,OAAOC,MAAS,OAAO,OAAOb,EAAca,CAAI,CAAC,CAAC;EACpD;EAoBwB,WAjBtB,GACA,GACA,GACA,MACkB;GAClB,IAAMA,IAAOT,EAAQO,GAAIC,CAAE;GAC3B,IAAIC,MAAS,MAAM,OAAO;GAC1B,IAAMZ,IAAQD,EAAca,CAAI;GAChC,IAAI,CAACC,GAAK,OAAOb,EAAM;GACvB,KAAK,IAAIK,IAAIL,EAAM,SAAS,GAAGK,KAAK,GAAG,KACrC,IAAIS,EAAU,SAASd,EAAMK,EAAE,GAC7B,OAAOL,EAAM,KAAK,IAAIK,IAAI,GAAGL,EAAM,SAAS,CAAC;GAGjD,OAAOA,EAAMA,EAAM,SAAS;EAC9B;CAEiC;AACnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unionOfChildren.js","names":["unionOfChildrenVia","boxes","d","deps","visualBoundsViaDescriptor","poseDescriptorForNode","descriptor","u","unionAABB","node"],"sources":["../../../src/features/groups/unionOfChildren.ts"],"sourcesContent":["import { unionAABB } from 'core/geometry/unionBounds';\nimport {\n poseDescriptorForNode,\n visualBoundsViaDescriptor,\n type PoseDescriptor,\n} from 'interactions/actions/resize/geometry';\nimport type { DerivePoseFn } from 'core/scene/types';\n\n/**\n * A container's pose as the envelope of what it holds, read through\n * `descriptor` — a rotated member contributes the extent of its ink. Register\n * the result under `UNION_OF_CHILDREN` in `createScene`'s `registry` to teach\n * a scene how to size its groups around a pose shape the kit cannot read.\n *\n * Returns `null` for an emptied container, which falls back to its authored\n * pose rather than collapsing to a zero box at the origin.\n */\nexport function unionOfChildrenVia<TPose>(\n descriptor: PoseDescriptor<TPose>,\n): DerivePoseFn<TPose> {\n return (node, deps) => {\n const boxes = [];\n for (const d of deps) {\n if (d !== undefined) {\n boxes.push(visualBoundsViaDescriptor(d.pose, poseDescriptorForNode(descriptor, d)));\n }\n }\n const u = unionAABB(boxes);\n return u === null\n ? null\n : poseDescriptorForNode(descriptor, node).fromBounds(u, node.pose);\n };\n}\n"],"mappings":";;;AAiBA,SAAgBA,EACd,GACqB;CACrB,QAAQ,GAAM,MAAS;EACrB,IAAMC,IAAQ,CAAC;EACf,KAAK,IAAMC,KAAKC,GACd,AAAID,MAAM,KAAA,KACRD,EAAM,KAAKG,EAA0BF,EAAE,MAAMG,EAAsBC,GAAYJ,CAAC,CAAC,CAAC;EAGtF,IAAMK,IAAIC,EAAUP,CAAK;EACzB,OAAOM,MAAM,OACT,OACAF,EAAsBC,GAAYG,CAAI,CAAC,CAAC,WAAWF,GAAGE,EAAK,IAAI;CACrE;AACF"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { maxImageTextureSide as e, releaseImageSource as t } from "../../renderer/cache/GLImageCache.js";
|
|
2
|
-
//#region src/features/images/imageCache.ts
|
|
3
|
-
var n = 16777216, r = 4, i = 300, a = 150, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
|
|
4
|
-
function l(e) {
|
|
5
|
-
return /^data:image\/svg\+xml[;,]/i.test(e) ? !0 : !/^(data|blob):/i.test(e) && /\.svgz?$/i.test(e.replace(/[?#].*$/, ""));
|
|
6
|
-
}
|
|
7
|
-
function u() {
|
|
8
|
-
if (typeof Image > "u" || typeof createImageBitmap > "u") throw Error("weasel imageCache: no DOM image loader in this environment");
|
|
9
|
-
}
|
|
10
|
-
async function d(e) {
|
|
11
|
-
let t = new Image();
|
|
12
|
-
return t.crossOrigin = "anonymous", t.src = e, await t.decode(), t;
|
|
13
|
-
}
|
|
14
|
-
function f(e) {
|
|
15
|
-
let t = c.get(e);
|
|
16
|
-
return t || (t = d(e), c.set(e, t), t.catch(() => c.delete(e))), t;
|
|
17
|
-
}
|
|
18
|
-
async function p(e, t) {
|
|
19
|
-
let n = await f(e), r = t?.width ?? (n.naturalWidth || i), o = t?.height ?? (n.naturalHeight || a), s = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(r, o) : Object.assign(document.createElement("canvas"), {
|
|
20
|
-
width: r,
|
|
21
|
-
height: o
|
|
22
|
-
}), c = s.getContext("2d");
|
|
23
|
-
if (!c) throw Error("weasel imageCache: no 2D context to rasterize an SVG");
|
|
24
|
-
return c.drawImage(n, 0, 0, r, o), createImageBitmap(s);
|
|
25
|
-
}
|
|
26
|
-
var m = async (e, t) => (u(), l(e) ? p(e, t) : createImageBitmap(await d(e)));
|
|
27
|
-
function h() {
|
|
28
|
-
for (let e of s) e();
|
|
29
|
-
}
|
|
30
|
-
function g(e) {
|
|
31
|
-
let t = { status: "loading" };
|
|
32
|
-
o.set(e, t), m(e).then((n) => {
|
|
33
|
-
o.get(e) === t && (o.set(e, {
|
|
34
|
-
status: "ready",
|
|
35
|
-
bitmap: n,
|
|
36
|
-
...l(e) ? { vector: {
|
|
37
|
-
natural: {
|
|
38
|
-
width: n.width,
|
|
39
|
-
height: n.height
|
|
40
|
-
},
|
|
41
|
-
scale: 1,
|
|
42
|
-
failed: /* @__PURE__ */ new Set(),
|
|
43
|
-
floor: 0
|
|
44
|
-
} } : {}
|
|
45
|
-
}), h());
|
|
46
|
-
}, () => {
|
|
47
|
-
o.get(e) === t && (o.set(e, { status: "error" }), h());
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function _(t, r) {
|
|
51
|
-
let i = Math.max(r.width / t.width, r.height / t.height);
|
|
52
|
-
if (!(i > 0) || !Number.isFinite(i)) return;
|
|
53
|
-
let a = e(), o = Math.min(a / t.width, a / t.height, Math.sqrt(n / (t.width * t.height)));
|
|
54
|
-
return Math.min(2 ** Math.ceil(Math.log2(i)), o);
|
|
55
|
-
}
|
|
56
|
-
function v(e, n, i, a) {
|
|
57
|
-
if (i.pending !== void 0) return;
|
|
58
|
-
let s = _(i.natural, a);
|
|
59
|
-
if (s === void 0) return;
|
|
60
|
-
let c = s > i.scale;
|
|
61
|
-
c && i.shrunkTo === i.scale && (i.floor = Math.max(i.floor, s));
|
|
62
|
-
let l = c ? s : Math.max(s, i.floor);
|
|
63
|
-
if (!(!c && l * r > i.scale)) {
|
|
64
|
-
for (let e of i.failed) if (l === e || c && e > i.scale && l >= e) return;
|
|
65
|
-
i.pending = l, m(e, {
|
|
66
|
-
width: Math.max(1, Math.round(i.natural.width * l)),
|
|
67
|
-
height: Math.max(1, Math.round(i.natural.height * l))
|
|
68
|
-
}).then((r) => {
|
|
69
|
-
if (o.get(e) !== n) return;
|
|
70
|
-
i.pending = void 0;
|
|
71
|
-
let a = n.bitmap;
|
|
72
|
-
n.bitmap = r, i.shrunkTo = c ? void 0 : l, i.scale = l, a && a !== r && t(a), h();
|
|
73
|
-
}, () => {
|
|
74
|
-
o.get(e) === n && (i.pending = void 0, i.failed.add(l));
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function y(e, t) {
|
|
79
|
-
let n = o.get(e);
|
|
80
|
-
if (!n) {
|
|
81
|
-
g(e);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
return t && n.vector && v(e, n, n.vector, t), n.bitmap;
|
|
85
|
-
}
|
|
86
|
-
function b(e) {
|
|
87
|
-
return o.get(e)?.status ?? "idle";
|
|
88
|
-
}
|
|
89
|
-
function x(e) {
|
|
90
|
-
let n = o.get(e);
|
|
91
|
-
o.delete(e), c.delete(e), n?.bitmap && t(n.bitmap);
|
|
92
|
-
}
|
|
93
|
-
function S(e) {
|
|
94
|
-
o.get(e)?.status === "error" && (g(e), h());
|
|
95
|
-
}
|
|
96
|
-
function C(e) {
|
|
97
|
-
return s.add(e), () => {
|
|
98
|
-
s.delete(e);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
export { y as getImageBitmap, b as imageStatus, l as isVectorImageSrc, x as releaseImage, S as retryImage, C as subscribeImageReady };
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=imageCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageCache.js","names":["MAX_VECTOR_RASTER_PIXELS","SHRINK_SLACK","FALLBACK_WIDTH","FALLBACK_HEIGHT","cache","subscribers","decodedVectors","isVectorImageSrc","src","requireDom","decodeImage","img","decodeVector","decoded","rasterizeVector","width","size","height","canvas","c2d","loader","notify","cb","startLoad","entry","bitmap","rasterScaleFor","need","drawnAt","natural","side","maxImageTextureSide","cap","maybeReraster","v","wanted","grow","target","f","old","releaseImageSource","getImageBitmap","imageStatus","releaseImage","retryImage","subscribeImageReady"],"sources":["../../../src/features/images/imageCache.ts"],"sourcesContent":["/**\n * imageCache — the kit's per-`src` image loader + cache.\n *\n * The shape-painter chain (`kit:image` in `NodeShape.ts`) is synchronous, but\n * decoding an image is async. This module bridges the two: `getImageBitmap` is\n * a synchronous read that returns the decoded `ImageBitmap` when ready, and\n * otherwise returns `undefined` and lazily kicks off a de-duped async load.\n * When a load resolves (or errors), every `subscribeImageReady` listener fires\n * — `<SceneCanvas>` subscribes and calls `requestRedraw()`, so the painter\n * re-runs and emits the now-ready bitmap.\n *\n * `src` is any browser-loadable image string: a remote URL, a `blob:` URL, or\n * a `data:image/…;base64,…` URI (the embedded-bytes path). The decoded bitmap\n * lives only here, keyed by `src` — never in node `data` — so `scene.toJSON()`\n * round-trips the (serializable) `src` string untouched.\n */\n\nimport { maxImageTextureSide, releaseImageSource } from 'renderer/cache/GLImageCache';\n\n/** Public shape of an image node's `data`. `src` round-trips through\n * serialization; the decoded bitmap is held in this cache, not on the node. */\nexport interface ImageNodeData {\n image: {\n src: string;\n opacity?: number;\n /** The part of the bitmap drawn into the pose rect, as fractions of the\n * bitmap's width and height from its top-left. Omitted draws the whole\n * bitmap. Fractions, so the data means the same thing before the bitmap\n * has decoded and after `src` is swapped for another resolution. */\n source?: { x: number; y: number; width: number; height: number };\n /** Mirror the drawn region within the pose rect. The rect does not move. */\n flipX?: boolean;\n flipY?: boolean;\n };\n}\n\n/** Where an image is in its load: never requested, in flight, decoded, or\n * failed. Renderers paint a placeholder for anything but `'ready'`. */\nexport type ImageStatus = 'idle' | 'loading' | 'ready' | 'error';\n\n/** A size in device pixels. */\nexport interface ImageRasterSize {\n width: number;\n height: number;\n}\n\n/** A vector source's raster bookkeeping. `scale` is the current raster's size\n * over the natural one, always a power of two unless a cap cut it short. */\ninterface VectorRaster {\n natural: ImageRasterSize;\n scale: number;\n pending?: number;\n failed: Set<number>;\n /** The scale the last shrink left, until something asks for more. */\n shrunkTo?: number;\n /** The largest scale a shrunk raster was asked to grow back to. One raster\n * serves every size a source is drawn at, so that request may be a second\n * consumer the shrink starved; shrinking below it again would loop. */\n floor: number;\n}\n\ninterface Entry {\n status: ImageStatus;\n bitmap?: ImageBitmap;\n vector?: VectorRaster;\n}\n\n/** `size` is absent for the first load, which decodes at natural size. */\ntype Loader = (src: string, size?: ImageRasterSize) => Promise<ImageBitmap>;\n\n/** One vector raster may hold at most 64MB of RGBA. */\nconst MAX_VECTOR_RASTER_PIXELS = 4096 * 4096;\n/** A raster is only shrunk once it is this many times larger than needed, so\n * zooming back and forth across a bucket edge does not re-raster each way. */\nconst SHRINK_SLACK = 4;\n// CSS default object size, as `kit:svg` measures a viewBox-only SVG.\nconst FALLBACK_WIDTH = 300;\nconst FALLBACK_HEIGHT = 150;\n\nconst cache = new Map<string, Entry>();\nconst subscribers = new Set<() => void>();\nconst decodedVectors = new Map<string, Promise<HTMLImageElement>>();\n\n/** True when `src` names SVG — a `data:image/svg+xml` URI, or a URL whose path\n * ends in `.svg`/`.svgz`. Such sources re-rasterize at the size they are drawn\n * at; everything else decodes once. A `blob:` URL carries no type and counts\n * as raster. */\nexport function isVectorImageSrc(src: string): boolean {\n if (/^data:image\\/svg\\+xml[;,]/i.test(src)) return true;\n if (/^(data|blob):/i.test(src)) return false;\n return /\\.svgz?$/i.test(src.replace(/[?#].*$/, ''));\n}\n\nfunction requireDom(): void {\n if (typeof Image === 'undefined' || typeof createImageBitmap === 'undefined') {\n throw new Error('weasel imageCache: no DOM image loader in this environment');\n }\n}\n\nasync function decodeImage(src: string): Promise<HTMLImageElement> {\n const img = new Image();\n img.crossOrigin = 'anonymous';\n img.src = src;\n await img.decode();\n return img;\n}\n\nfunction decodeVector(src: string): Promise<HTMLImageElement> {\n let decoded = decodedVectors.get(src);\n if (!decoded) {\n decoded = decodeImage(src);\n decodedVectors.set(src, decoded);\n decoded.catch(() => decodedVectors.delete(src));\n }\n return decoded;\n}\n\n// `createImageBitmap` rejects SVG blobs and resamples an SVG `<img>` rather\n// than re-drawing it, so vectors go through a canvas `drawImage` at full size.\nasync function rasterizeVector(src: string, size?: ImageRasterSize): Promise<ImageBitmap> {\n const img = await decodeVector(src);\n const width = size?.width ?? (img.naturalWidth || FALLBACK_WIDTH);\n const height = size?.height ?? (img.naturalHeight || FALLBACK_HEIGHT);\n const canvas: OffscreenCanvas | HTMLCanvasElement = typeof OffscreenCanvas !== 'undefined'\n ? new OffscreenCanvas(width, height)\n : Object.assign(document.createElement('canvas'), { width, height });\n const c2d = canvas.getContext('2d') as CanvasDrawImage | null;\n if (!c2d) throw new Error('weasel imageCache: no 2D context to rasterize an SVG');\n c2d.drawImage(img, 0, 0, width, height);\n return createImageBitmap(canvas);\n}\n\nconst defaultLoader: Loader = async (src, size) => {\n requireDom();\n if (isVectorImageSrc(src)) return rasterizeVector(src, size);\n return createImageBitmap(await decodeImage(src));\n};\n\nlet loader: Loader = defaultLoader;\n\nfunction notify(): void {\n for (const cb of subscribers) cb();\n}\n\nfunction startLoad(src: string): void {\n const entry: Entry = { status: 'loading' };\n cache.set(src, entry);\n loader(src).then(\n (bitmap) => {\n // The entry may have been replaced/cleared mid-flight (reset, etc.);\n // only commit if this src is still the one we started loading.\n if (cache.get(src) !== entry) return;\n cache.set(src, {\n status: 'ready',\n bitmap,\n ...(isVectorImageSrc(src)\n ? { vector: { natural: { width: bitmap.width, height: bitmap.height }, scale: 1, failed: new Set<number>(), floor: 0 } }\n : {}),\n });\n notify();\n },\n () => {\n // Cache the error so a broken `src` doesn't reload-storm.\n if (cache.get(src) !== entry) return;\n cache.set(src, { status: 'error' });\n notify();\n },\n );\n}\n\n/** The raster scale `drawnAt` calls for: the next power of two at or above the\n * natural-to-drawn ratio, capped by texture size and the pixel ceiling. */\nfunction rasterScaleFor(natural: ImageRasterSize, drawnAt: ImageRasterSize): number | undefined {\n const need = Math.max(drawnAt.width / natural.width, drawnAt.height / natural.height);\n if (!(need > 0) || !Number.isFinite(need)) return undefined;\n const side = maxImageTextureSide();\n const cap = Math.min(\n side / natural.width,\n side / natural.height,\n Math.sqrt(MAX_VECTOR_RASTER_PIXELS / (natural.width * natural.height)),\n );\n return Math.min(2 ** Math.ceil(Math.log2(need)), cap);\n}\n\nfunction maybeReraster(src: string, entry: Entry, v: VectorRaster, drawnAt: ImageRasterSize): void {\n if (v.pending !== undefined) return;\n const wanted = rasterScaleFor(v.natural, drawnAt);\n if (wanted === undefined) return;\n const grow = wanted > v.scale;\n if (grow && v.shrunkTo === v.scale) v.floor = Math.max(v.floor, wanted);\n const target = grow ? wanted : Math.max(wanted, v.floor);\n if (!grow && target * SHRINK_SLACK > v.scale) return;\n for (const f of v.failed) if (target === f || (grow && f > v.scale && target >= f)) return;\n\n v.pending = target;\n const size = {\n width: Math.max(1, Math.round(v.natural.width * target)),\n height: Math.max(1, Math.round(v.natural.height * target)),\n };\n loader(src, size).then(\n (bitmap) => {\n if (cache.get(src) !== entry) return;\n v.pending = undefined;\n const old = entry.bitmap;\n entry.bitmap = bitmap;\n v.shrunkTo = grow ? undefined : target;\n v.scale = target;\n if (old && old !== bitmap) releaseImageSource(old);\n notify();\n },\n () => {\n // The previous raster keeps painting; only this scale is given up on.\n if (cache.get(src) !== entry) return;\n v.pending = undefined;\n v.failed.add(target);\n },\n );\n}\n\n/** Synchronous read. Returns the decoded bitmap when ready; otherwise returns\n * `undefined` and lazily starts a de-duped async load for `src`.\n *\n * `drawnAt` is the size in device pixels the image is about to cover. A\n * vector source ({@link isVectorImageSrc}) uses it to re-rasterize in\n * power-of-two steps — the current raster is returned until the sharper one\n * is ready. Raster sources ignore it. */\nexport function getImageBitmap(src: string, drawnAt?: ImageRasterSize): ImageBitmap | undefined {\n const entry = cache.get(src);\n if (!entry) {\n startLoad(src);\n return undefined;\n }\n if (drawnAt && entry.vector) maybeReraster(src, entry, entry.vector, drawnAt);\n return entry.bitmap;\n}\n\n/** Current load status for `src` (`'idle'` if never requested). */\nexport function imageStatus(src: string): ImageStatus {\n return cache.get(src)?.status ?? 'idle';\n}\n\n/**\n * Forget `src`: drop its decoded bitmap, its decoded SVG, and the texture every\n * live renderer holds for it, and abandon a load in flight. The cache is keyed\n * by `src` across every scene on the page, so it cannot know when the last use\n * is gone; whoever does know calls this. A later {@link getImageBitmap} for the\n * same `src` loads it again.\n */\nexport function releaseImage(src: string): void {\n const entry = cache.get(src);\n cache.delete(src);\n decodedVectors.delete(src);\n if (entry?.bitmap) releaseImageSource(entry.bitmap);\n}\n\n/** Load a `src` whose last load failed again. Does nothing for a `src` in any\n * other state; one that failed otherwise stays `'error'` for the page's life. */\nexport function retryImage(src: string): void {\n if (cache.get(src)?.status !== 'error') return;\n startLoad(src);\n notify();\n}\n\n/** Subscribe to load-resolution events (fires after any `src` resolves or\n * errors). Returns an unsubscribe. */\nexport function subscribeImageReady(cb: () => void): () => void {\n subscribers.add(cb);\n return () => {\n subscribers.delete(cb);\n };\n}\n\n/** @internal test seam — override the async loader so unit tests don't need\n * a real DOM image. Not part of the public barrel. */\nexport function __setImageLoaderForTests(fn: Loader): void {\n loader = fn;\n}\n\n/** @internal test seam — clear cache + subscribers and restore the default\n * loader. Not part of the public barrel. */\nexport function _resetImageCacheForTests(): void {\n cache.clear();\n subscribers.clear();\n decodedVectors.clear();\n loader = defaultLoader;\n}\n"],"mappings":";;AAuEA,IAAMA,IAA2B,UAG3BC,IAAe,GAEfC,IAAiB,KACjBC,IAAkB,KAElBC,oBAAQ,IAAI,IAAmB,GAC/BC,oBAAc,IAAI,IAAgB,GAClCC,oBAAiB,IAAI,IAAuC;AAMlE,SAAgBC,EAAiB,GAAsB;CAGrD,OAFI,6BAA6B,KAAKC,CAAG,IAAU,KACnD,CAAI,iBAAiB,KAAKA,CAAG,KACtB,YAAY,KAAKA,EAAI,QAAQ,WAAW,EAAE,CAAC;AACpD;AAEA,SAASC,IAAmB;CAC1B,IAAI,OAAO,QAAU,OAAe,OAAO,oBAAsB,KAC/D,MAAU,MAAM,4DAA4D;AAEhF;AAEA,eAAeC,EAAY,GAAwC;CACjE,IAAMC,IAAM,IAAI,MAAM;CAItB,OAHA,EAAI,cAAc,aAClB,EAAI,MAAMH,GACV,MAAMG,EAAI,OAAO,GACVA;AACT;AAEA,SAASC,EAAa,GAAwC;CAC5D,IAAIC,IAAUP,EAAe,IAAIE,CAAG;CAMpC,OALKK,MACH,IAAUH,EAAYF,CAAG,GACzBF,EAAe,IAAIE,GAAKK,CAAO,GAC/BA,EAAQ,YAAYP,EAAe,OAAOE,CAAG,CAAC,IAEzCK;AACT;AAIA,eAAeC,EAAgB,GAAa,GAA8C;CACxF,IAAMH,IAAM,MAAMC,EAAaJ,CAAG,GAC5BO,IAAQC,GAAM,UAAUL,EAAI,gBAAgBT,IAC5Ce,IAASD,GAAM,WAAWL,EAAI,iBAAiBR,IAC/Ce,IAA8C,OAAO,kBAAoB,MAC3E,IAAI,gBAAgBH,GAAOE,CAAM,IACjC,OAAO,OAAO,SAAS,cAAc,QAAQ,GAAG;EAAE;EAAO;CAAO,CAAC,GAC/DE,IAAMD,EAAO,WAAW,IAAI;CAClC,IAAI,CAACC,GAAK,MAAU,MAAM,sDAAsD;CAEhF,OADAA,EAAI,UAAUR,GAAK,GAAG,GAAGI,GAAOE,CAAM,GAC/B,kBAAkBC,CAAM;AACjC;AAQA,IAAIE,IAAiB,OANgB,GAAK,OACxCX,EAAW,GACPF,EAAiBC,CAAG,IAAUM,EAAgBN,GAAKQ,CAAI,IACpD,kBAAkB,MAAMN,EAAYF,CAAG,CAAC;AAKjD,SAASa,IAAe;CACtB,KAAK,IAAMC,KAAMjB,GAAa,EAAG;AACnC;AAEA,SAASkB,EAAU,GAAmB;CACpC,IAAMC,IAAe,EAAE,QAAQ,UAAU;CAEzC,AADApB,EAAM,IAAII,GAAKgB,CAAK,GACpBJ,EAAOZ,CAAG,CAAC,CAAC,MACT,MAAW;EAGV,AAAIJ,EAAM,IAAII,CAAG,MAAMgB,MACvBpB,EAAM,IAAII,GAAK;GACb,QAAQ;GACR;GACA,GAAID,EAAiBC,CAAG,IACpB,EAAE,QAAQ;IAAE,SAAS;KAAE,OAAOiB,EAAO;KAAO,QAAQA,EAAO;IAAO;IAAG,OAAO;IAAG,wBAAQ,IAAI,IAAY;IAAG,OAAO;GAAE,EAAE,IACrH,CAAC;EACP,CAAC,GACDJ,EAAO;CACT,SACM;EAEJ,AAAIjB,EAAM,IAAII,CAAG,MAAMgB,MACvBpB,EAAM,IAAII,GAAK,EAAE,QAAQ,QAAQ,CAAC,GAClCa,EAAO;CACT,CACF;AACF;AAIA,SAASK,EAAe,GAA0B,GAA8C;CAC9F,IAAMC,IAAO,KAAK,IAAIC,EAAQ,QAAQC,EAAQ,OAAOD,EAAQ,SAASC,EAAQ,MAAM;CACpF,IAAI,EAAEF,IAAO,MAAM,CAAC,OAAO,SAASA,CAAI,GAAG;CAC3C,IAAMG,IAAOC,EAAoB,GAC3BC,IAAM,KAAK,IACfF,IAAOD,EAAQ,OACfC,IAAOD,EAAQ,QACf,KAAK,KAAK7B,KAA4B6B,EAAQ,QAAQA,EAAQ,OAAO,CACvE;CACA,OAAO,KAAK,IAAI,KAAK,KAAK,KAAK,KAAK,KAAKF,CAAI,CAAC,GAAGK,CAAG;AACtD;AAEA,SAASC,EAAc,GAAa,GAAc,GAAiB,GAAgC;CACjG,IAAIC,EAAE,YAAY,KAAA,GAAW;CAC7B,IAAMC,IAAST,EAAeQ,EAAE,SAASN,CAAO;CAChD,IAAIO,MAAW,KAAA,GAAW;CAC1B,IAAMC,IAAOD,IAASD,EAAE;CACxB,AAAIE,KAAQF,EAAE,aAAaA,EAAE,UAAO,EAAE,QAAQ,KAAK,IAAIA,EAAE,OAAOC,CAAM;CACtE,IAAME,IAASD,IAAOD,IAAS,KAAK,IAAIA,GAAQD,EAAE,KAAK;CACvD,IAAI,GAACE,KAAQC,IAASpC,IAAeiC,EAAE,QACvC;OAAK,IAAMI,KAAKJ,EAAE,QAAQ,IAAIG,MAAWC,KAAMF,KAAQE,IAAIJ,EAAE,SAASG,KAAUC,GAAI;EAOpF,AALA,EAAE,UAAUD,GAKZjB,EAAOZ,GAAK;GAHV,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM0B,EAAE,QAAQ,QAAQG,CAAM,CAAC;GACvD,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAMH,EAAE,QAAQ,SAASG,CAAM,CAAC;EAE/C,CAAI,CAAC,CAAC,MACf,MAAW;GACV,IAAIjC,EAAM,IAAII,CAAG,MAAMgB,GAAO;GAC9B,EAAE,UAAU,KAAA;GACZ,IAAMe,IAAMf,EAAM;GAKlB,AAJA,EAAM,SAASC,GACf,EAAE,WAAWW,IAAO,KAAA,IAAYC,GAChC,EAAE,QAAQA,GACNE,KAAOA,MAAQd,KAAQe,EAAmBD,CAAG,GACjDlB,EAAO;EACT,SACM;GAEJ,AAAIjB,EAAM,IAAII,CAAG,MAAMgB,MACvB,EAAE,UAAU,KAAA,GACZU,EAAE,OAAO,IAAIG,CAAM;EACrB,CACF;CAxBoF;AAyBtF;AASA,SAAgBI,EAAe,GAAa,GAAoD;CAC9F,IAAMjB,IAAQpB,EAAM,IAAII,CAAG;CAC3B,IAAI,CAACgB,GAAO;EACV,EAAUhB,CAAG;EACb;CACF;CAEA,OADIoB,KAAWJ,EAAM,UAAQS,EAAczB,GAAKgB,GAAOA,EAAM,QAAQI,CAAO,GACrEJ,EAAM;AACf;AAGA,SAAgBkB,EAAY,GAA0B;CACpD,OAAOtC,EAAM,IAAII,CAAG,CAAC,EAAE,UAAU;AACnC;AASA,SAAgBmC,EAAa,GAAmB;CAC9C,IAAMnB,IAAQpB,EAAM,IAAII,CAAG;CAG3B,AAFAJ,EAAM,OAAOI,CAAG,GAChBF,EAAe,OAAOE,CAAG,GACrBgB,GAAO,UAAQgB,EAAmBhB,EAAM,MAAM;AACpD;AAIA,SAAgBoB,EAAW,GAAmB;CAC5C,AAAIxC,EAAM,IAAII,CAAG,CAAC,EAAE,WAAW,YAC/Be,EAAUf,CAAG,GACba,EAAO;AACT;AAIA,SAAgBwB,EAAoB,GAA4B;CAE9D,OADAxC,EAAY,IAAIiB,CAAE,SACL;EACX,EAAY,OAAOA,CAAE;CACvB;AACF"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./imageHandler.js";
|
|
2
|
-
import "./svgHandler.js";
|
|
3
|
-
import "./weaselJsonHandler.js";
|
|
4
|
-
import { registerContentHandler as e } from "./contentHandlers.js";
|
|
5
|
-
import { acquireKitContentHandlers as t } from "./registerKitHandlers.js";
|
|
6
|
-
import { openFilePicker as n } from "./openFilePicker.js";
|
|
7
|
-
import { itemsFromFiles as r } from "@weasel-js/routing";
|
|
8
|
-
export { t as acquireKitContentHandlers, r as itemsFromFiles, n as openFilePicker, e as registerContentHandler };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { resolveColor as e } from "../../renderer/math/color.js";
|
|
2
|
-
import { evalPatch as t, isValidPatch as n, patchBounds as r } from "./surface.js";
|
|
3
|
-
import { lerpColorArray as i } from "@weasel-js/paint";
|
|
4
|
-
//#region src/features/meshPaint/bake.ts
|
|
5
|
-
var a = 256, o = 10;
|
|
6
|
-
function s(e) {
|
|
7
|
-
return Math.max(24, Math.ceil(e / o));
|
|
8
|
-
}
|
|
9
|
-
function c(e) {
|
|
10
|
-
let t = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
11
|
-
for (let s of e) {
|
|
12
|
-
if (!n(s)) continue;
|
|
13
|
-
let e = r(s);
|
|
14
|
-
t = Math.min(t, e.x), i = Math.min(i, e.y), a = Math.max(a, e.x + e.width), o = Math.max(o, e.y + e.height);
|
|
15
|
-
}
|
|
16
|
-
return !Number.isFinite(t) || a <= t || o <= i ? null : {
|
|
17
|
-
x: t,
|
|
18
|
-
y: i,
|
|
19
|
-
width: a - t,
|
|
20
|
-
height: o - i
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function l(e, t, n, r) {
|
|
24
|
-
let a = i(e[0], e[1], t, r), o = i(e[3], e[2], t, r);
|
|
25
|
-
return i(a, o, n, r);
|
|
26
|
-
}
|
|
27
|
-
function u(r, i = "rgb", o = a) {
|
|
28
|
-
let u = c(r);
|
|
29
|
-
if (!u) return null;
|
|
30
|
-
let f = new Uint8ClampedArray(o * o * 4), p = s(o), m = (e) => ({
|
|
31
|
-
x: (e.x - u.x) / u.width * (o - 1) + .5,
|
|
32
|
-
y: (e.y - u.y) / u.height * (o - 1) + .5
|
|
33
|
-
});
|
|
34
|
-
for (let a of r) {
|
|
35
|
-
if (!n(a)) continue;
|
|
36
|
-
let r = a.colors.map((t) => e(t));
|
|
37
|
-
for (let e = 0; e < p; e++) for (let n = 0; n < p; n++) {
|
|
38
|
-
let s = e / p, c = (e + 1) / p, u = n / p, h = (n + 1) / p, g = [
|
|
39
|
-
{
|
|
40
|
-
at: m(t(a, s, u)),
|
|
41
|
-
color: l(r, s, u, i)
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
at: m(t(a, c, u)),
|
|
45
|
-
color: l(r, c, u, i)
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
at: m(t(a, c, h)),
|
|
49
|
-
color: l(r, c, h, i)
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
at: m(t(a, s, h)),
|
|
53
|
-
color: l(r, s, h, i)
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
d(f, o, g[0], g[1], g[2]), d(f, o, g[0], g[2], g[3]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
pixels: f,
|
|
61
|
-
size: o,
|
|
62
|
-
box: u
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function d(e, t, n, r, i) {
|
|
66
|
-
let a = Math.max(0, Math.floor(Math.min(n.at.x, r.at.x, i.at.x))), o = Math.min(t - 1, Math.ceil(Math.max(n.at.x, r.at.x, i.at.x))), s = Math.max(0, Math.floor(Math.min(n.at.y, r.at.y, i.at.y))), c = Math.min(t - 1, Math.ceil(Math.max(n.at.y, r.at.y, i.at.y)));
|
|
67
|
-
if (o < a || c < s) return;
|
|
68
|
-
let l = (r.at.x - n.at.x) * (i.at.y - n.at.y) - (i.at.x - n.at.x) * (r.at.y - n.at.y);
|
|
69
|
-
if (!(Math.abs(l) < 1e-9)) for (let u = s; u <= c; u++) for (let s = a; s <= o; s++) {
|
|
70
|
-
let a = s + .5, o = u + .5, c = ((r.at.x - a) * (i.at.y - o) - (i.at.x - a) * (r.at.y - o)) / l, d = ((i.at.x - a) * (n.at.y - o) - (n.at.x - a) * (i.at.y - o)) / l, f = 1 - c - d;
|
|
71
|
-
if (c < -1e-6 || d < -1e-6 || f < -1e-6) continue;
|
|
72
|
-
let p = (u * t + s) * 4;
|
|
73
|
-
for (let t = 0; t < 4; t++) e[p + t] = (c * n.color[t] + d * r.color[t] + f * i.color[t]) * 255;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { a as MESH_BAKE_SIZE, u as bakeMesh, c as meshBounds };
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=bake.js.map
|