@weasel-js/core 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1106 -0
- package/README.md +7 -5
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -93
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +27 -18
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +65 -104
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +22 -21
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +38 -88
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +32 -24
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -29
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js +13 -0
- package/dist/animation/wrappers/instantPose.js.map +1 -0
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/{autoPoseDescriptor-vCdt55xm.d.ts → autoPoseDescriptor-DHg5KqaJ.d.ts} +1 -1
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +16 -0
- package/dist/barrel/input.js +18 -0
- package/dist/barrel/interactions.js +38 -0
- package/dist/barrel/paint.js +11 -0
- package/dist/barrel/paths.js +12 -0
- package/dist/barrel/renderer.js +14 -0
- package/dist/barrel/routing.js +57 -0
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -0
- package/dist/barrel/viewport.js +42 -0
- package/dist/canvas/Canvas.js +280 -559
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +147 -167
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +53 -49
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +40 -51
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +55 -374
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js +50 -47
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +126 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +64 -0
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/coordTrace.js +46 -0
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +138 -85
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +74 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js +12 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +31 -34
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
- package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
- package/dist/canvas/SceneCanvas/props.js +39 -0
- package/dist/canvas/SceneCanvas/props.js.map +1 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +48 -48
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +74 -78
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +311 -969
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +42 -46
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +111 -0
- package/dist/canvas/buildSceneLayer.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +16 -19
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +67 -55
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +12 -12
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/changes.js +13 -0
- package/dist/canvas/deps/changes.js.map +1 -0
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +38 -57
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +130 -91
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +26 -26
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +6 -5
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +47 -22
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +4 -8
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/kitRequirements.js +2 -2
- package/dist/canvas/kitRequirements.js.map +1 -1
- package/dist/canvas/layerOrder.js +13 -6
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +34 -0
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/imagePainter.js +87 -0
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/memo.js +9 -0
- package/dist/canvas/nodeShapes/memo.js.map +1 -0
- package/dist/canvas/nodeShapes/nodePaint.js +68 -0
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
- package/dist/canvas/nodeShapes/pathPainter.js +39 -0
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/poseBox.js +20 -0
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/shapePainter.js +72 -0
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/textPainter.js +55 -0
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +11 -14
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickWalk.js +59 -68
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +9 -23
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +11 -11
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -81
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -214
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +112 -0
- package/dist/canvas/sceneClipboard.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +39 -39
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +26 -6
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +67 -0
- package/dist/canvas/useCanvasView.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +39 -31
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +11 -0
- package/dist/canvas/useSceneLayerList.js.map +1 -0
- package/dist/canvas/useSurfaceInput.js +42 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +25 -27
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +16 -19
- package/dist/{types-B_9g6hMM.d.ts → clone-2a5hVbBd.d.ts} +123 -74
- package/dist/clone.d.ts +4 -7
- package/dist/clone.js +0 -2
- package/dist/core/device/index.js +5 -4
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +38 -44
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/device/watchDevicePixelRatio.js +17 -0
- package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
- package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +68 -19
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +31 -34
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +30 -29
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +2 -11
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +1 -1
- package/dist/core/layers/children.js.map +1 -0
- package/dist/core/layers/gateLayer.js +13 -0
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/ops/arrange.js +1 -0
- package/dist/core/ops/arrange.js.map +1 -1
- package/dist/core/ops/create.js +10 -5
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js +12 -24
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +43 -40
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +34 -0
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -0
- package/dist/core/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +282 -105
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/appliedLog.js +37 -0
- package/dist/core/scene/appliedLog.js.map +1 -0
- package/dist/core/scene/arrivalWindow.js +102 -0
- package/dist/core/scene/arrivalWindow.js.map +1 -0
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/{features/groups → core/scene}/composePose.js +18 -18
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +38 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +130 -0
- package/dist/core/scene/historyFacade.js.map +1 -0
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +185 -0
- package/dist/core/scene/kitOps.js.map +1 -0
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +131 -0
- package/dist/core/scene/layerStack.js.map +1 -0
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/core/scene/lockGuard.js +37 -0
- package/dist/core/scene/lockGuard.js.map +1 -0
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +10 -11
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +45 -19
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +127 -0
- package/dist/core/scene/nodeStore.js.map +1 -0
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +66 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseFeed.js +38 -38
- package/dist/core/scene/poseFeed.js.map +1 -1
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -40
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +3 -2
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js +84 -0
- package/dist/core/scene/renderOrder.js.map +1 -0
- package/dist/core/scene/scene.js +80 -1266
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +90 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +71 -0
- package/dist/core/scene/serialization.js.map +1 -0
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.js.map +1 -0
- package/dist/core/scene/treeOrder.js +13 -0
- package/dist/core/scene/treeOrder.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +8 -8
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +9 -9
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/core/viewport/zoomBounds.js +10 -8
- package/dist/core/viewport/zoomBounds.js.map +1 -1
- package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +97 -97
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/flag.js +2 -41
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +22 -17
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +28 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +7 -7
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +22 -14
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +47 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -14
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +44 -52
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +171 -179
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +100 -93
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +8473 -9141
- package/dist/index.js +269 -307
- package/dist/input/keyState.js +38 -39
- package/dist/input/keyState.js.map +1 -1
- package/dist/input/useKeyModifiers.js +11 -0
- package/dist/input/useKeyModifiers.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +18 -20
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +20 -20
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +69 -78
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +31 -15
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +44 -42
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +98 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +7 -32
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +60 -84
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js +35 -38
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +40 -0
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +13 -53
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +40 -50
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +44 -38
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +11 -12
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +40 -69
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
- package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/reorder.js +2 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +14 -8
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +7 -4
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js +12 -12
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
- package/dist/interactions/actions/defaults/sliceOps.js +8 -10
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/distribute/action.js +66 -0
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +7 -9
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +30 -27
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +30 -17
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/hitSelection.js +8 -0
- package/dist/interactions/actions/hitSelection.js.map +1 -0
- package/dist/interactions/actions/insert/action.js +72 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +48 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
- package/dist/interactions/actions/move/action.js +87 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +39 -27
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +59 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +22 -30
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +33 -0
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
- package/dist/interactions/actions/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +16 -63
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +16 -4
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +25 -20
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +55 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +74 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +56 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/selectionSubtree.js +69 -0
- package/dist/interactions/actions/selectionSubtree.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +87 -78
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
- package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +62 -41
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -3
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +14 -11
- package/dist/{originProjection-DEklpDc_.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/{poseDescriptor-D-OH-tu5.d.ts → poseDescriptor-Bqk-11Rl.d.ts} +26 -36
- package/dist/renderer.d.ts +1 -91
- package/dist/renderer.js +2 -18
- package/dist/resize.d.ts +10 -22
- package/dist/resize.js +6 -6
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js +12 -6
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js +1 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js +11 -11
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +1 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +198 -150
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +1 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +25 -24
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +42 -67
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js +17 -0
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +72 -82
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +22 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +9 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +12 -22
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-A37hYkeR.d.ts → types-CIKDwlsP.d.ts} +113 -169
- package/dist/util/color.js +3 -3
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +28 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -62
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -138
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -106
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -116
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -71
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -378
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/builtins-C-VgUlWI.d.ts +0 -4514
- package/dist/canvas/MinimapCanvas.js +0 -139
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -80
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -85
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/isPlainObject.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/debug/flag.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js +0 -14
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -94
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -236
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -103
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -26
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -156
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -154
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -148
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/index.js +0 -23
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -57
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -46
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -258
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -45
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -135
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -59
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -467
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -63
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -107
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js +0 -66
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -119
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
- package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -288
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -156
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -760
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -335
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -184
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/math-Drrw4ewZ.d.ts +0 -160
- package/dist/registerProgram-BMZRDgrh.d.ts +0 -197
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -331
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -64
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -51
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw.js +0 -1135
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -45
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -9
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -19
- package/dist/renderer/math/color.js +0 -341
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -76
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -30
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/imageFill.js +0 -14
- package/dist/renderer/shaders/imageFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -13
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -24
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -14
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-CuIxe0xY.d.ts +0 -356
- package/dist/tools/prefs.js +0 -62
- package/dist/tools/prefs.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDebugOverlayLayer.js","names":["rectPath","FPS_WINDOW","createDebugOverlayLayer","fpsHistory","config","buildDebugOverlayCommands","sink","view","dims","theme","DEFAULT_DEBUG_THEME","strokes","DEFAULT_DEBUG_STROKES","s","snapshot","t","viewToTransform","out","emitViewport","emitHitboxes","emitBounds","emitHandles","emitOrigins","emitSnap","emitIds","emitLayersPanel","emitFramePanel","frameTimes","approxCircleScreen","approxEllipseScreen","cx","cy","r","segments","cmds","coords","PATH_M","rx","i","PATH_L","theta","ry","PATH_Z","rotatedRectScreen","x","y","w","rotatePoint","sx","sy","worldToScreen","rectPath$1","h","strokeOf","fill","stroke","path","sw","sh","pts","p","commands","b","horiz","vert","o","color","c","cmd","textCommandFromRuns","lines","l","maxW","line","boxW","boxH","MONO","MONO_CHAR_W","LINE_H","emitTextPanel","maxLen","bg","fixed","v","decimals","width","span","history","interval","rows","frame","labelW","label","count","value","unit","rec","fx","fy","from","ax0","ay0","ax1","ay1","segment","signed","to","x0","y0","x1","y1"],"sources":["../../src/debug/createDebugOverlayLayer.ts"],"sourcesContent":["import type { DrawCommand, PathDrawCommand } from '../renderer';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { rotatePoint } from 'interactions/actions/rotate/geometry';\nimport { PATH_L, PATH_M, PATH_Z, type PolygonPath } from '@weasel-js/geom';\nimport { textCommandFromRuns } from 'features/text/textCommand';\nimport type {\n DebugConfig,\n DebugSnapshot,\n DebugStroke,\n DebugStrokes,\n DebugTheme,\n FrameStats,\n RecordedViewport,\n} from './types';\nimport { DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME } from './defaultTheme';\n\n/** @internal */\ninterface CreateDebugOverlayLayerOpts {\n sink: { snapshot(): DebugSnapshot };\n config: DebugConfig;\n}\n\nconst FPS_WINDOW = 60;\n\n/**\n * Screen-space `RenderLayer` that paints the sink's snapshot. Appended at\n * the top of the Canvas's layer stack when `debug` is enabled. World-space\n * coords in the snapshot are projected through `view` here, since the\n * layer itself runs at identity transform.\n */\nexport function createDebugOverlayLayer({\n sink,\n config,\n}: CreateDebugOverlayLayerOpts): RenderLayer<unknown> {\n // Timestamps of the last FPS_WINDOW draws; survives across draws within\n // one Canvas mount.\n const fpsHistory: number[] = [];\n return {\n id: 'debug-overlay',\n label: 'Debug overlay',\n space: 'screen',\n alwaysOn: true,\n draw: (_data, view, dims) => {\n if (config.fps) {\n fpsHistory.push(typeof performance !== 'undefined' ? performance.now() : Date.now());\n if (fpsHistory.length > FPS_WINDOW) fpsHistory.shift();\n } else if (fpsHistory.length > 0) {\n fpsHistory.length = 0;\n }\n return buildDebugOverlayCommands(sink.snapshot(), config, view, dims, fpsHistory);\n },\n };\n}\n\n/**\n * The debug overlay's draw commands for one snapshot, in screen space (CSS\n * pixels of a `dims`-sized canvas looking through `view`). What the overlay\n * layer paints each frame, and what `renderDebugSnapshot` rasterizes.\n *\n * `frameTimes` are `performance.now()` stamps of recent paints, oldest first;\n * the frame panel derives its rate from them and shows none without two.\n */\nexport function buildDebugOverlayCommands(\n snapshot: DebugSnapshot,\n config: DebugConfig,\n view: View,\n dims: Dims,\n frameTimes: readonly number[] = [],\n): DrawCommand[] {\n const theme: DebugTheme = { ...DEFAULT_DEBUG_THEME, ...(config.theme ?? {}) };\n const strokes: DebugStrokes = { ...DEFAULT_DEBUG_STROKES, ...(config.strokes ?? {}) };\n const s = snapshot;\n const t = viewToTransform(view);\n const out: DrawCommand[] = [];\n\n if (config.viewport && s.viewport) emitViewport(out, s.viewport, view, dims, theme, strokes);\n if (config.hitboxes) emitHitboxes(out, s, view, t, theme, strokes);\n if (config.bounds) emitBounds(out, s, view, t, theme, strokes);\n if (config.handles) emitHandles(out, s, t, theme, strokes);\n if (config.origins) emitOrigins(out, s, t, theme);\n if (config.snap) emitSnap(out, s, t, theme, strokes);\n if (config.ids) emitIds(out, s, t, theme);\n if (config.layers) emitLayersPanel(out, s, dims, theme);\n if (config.fps) emitFramePanel(out, frameTimes, s.frame, theme);\n return out;\n}\n\n// --- emitters (screen-space) ---\n\nfunction approxCircleScreen(cx: number, cy: number, r: number, segments = 24): PolygonPath {\n return approxEllipseScreen(cx, cy, r, r, segments);\n}\n\nfunction approxEllipseScreen(cx: number, cy: number, rx: number, ry: number, segments = 24): PolygonPath {\n // Commands: M + (segments-1) L + Z. Coords: (segments) × 2 — pairs for\n // the moveTo and the (segments-1) lineTos. PATH_Z consumes no coords.\n const cmds = new Uint8Array(segments + 1);\n const coords = new Float32Array(segments * 2);\n cmds[0] = PATH_M;\n coords[0] = cx + rx;\n coords[1] = cy;\n for (let i = 1; i < segments; i++) {\n cmds[i] = PATH_L;\n const theta = (i / segments) * Math.PI * 2;\n coords[i * 2] = cx + rx * Math.cos(theta);\n coords[i * 2 + 1] = cy + ry * Math.sin(theta);\n }\n cmds[segments] = PATH_Z;\n return { kind: 'polygon', commands: cmds, coords, fillRule: 'nonzero' };\n}\n\n/** A world rect turned `rotation` about its center, as the screen quad it\n * lands on. */\nfunction rotatedRectScreen(\n r: { x: number; y: number; width: number; height: number; rotation: number },\n t: ReturnType<typeof viewToTransform>,\n): PolygonPath {\n const cx = r.x + r.width / 2, cy = r.y + r.height / 2;\n const coords = new Float32Array(8);\n const corners = [[r.x, r.y], [r.x + r.width, r.y], [r.x + r.width, r.y + r.height], [r.x, r.y + r.height]];\n corners.forEach(([x, y], i) => {\n const w = rotatePoint(x, y, cx, cy, r.rotation);\n const [sx, sy] = worldToScreen(w.x, w.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]),\n coords,\n fillRule: 'nonzero',\n };\n}\n\nfunction rectPath(x: number, y: number, w: number, h: number): { kind: 'rect'; x: number; y: number; width: number; height: number } {\n return { kind: 'rect', x, y, width: w, height: h };\n}\n\n/** A `DebugStroke` + color as the renderer's stroke shape. `dash` is dropped\n * when empty rather than passed through, so a solid line stays solid. */\nfunction strokeOf(s: DebugStroke, color: string) {\n return {\n paint: { fill: 'solid' as const, color },\n width: s.width,\n ...(s.dash && s.dash.length > 0 ? { dash: [...s.dash] } : {}),\n };\n}\n\nfunction emitHitboxes(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const fill = { fill: 'solid' as const, color: theme.hitboxFill };\n const stroke = strokeOf(strokes.hitbox, theme.hitboxStroke);\n for (const h of s.hitboxes) {\n if (h.shape.kind === 'rect' && h.shape.rotation) {\n const path = rotatedRectScreen({ ...h.shape, rotation: h.shape.rotation }, t);\n out.push({ kind: 'path', path, fill, stroke });\n } else if (h.shape.kind === 'rect') {\n const [sx, sy] = worldToScreen(h.shape.x, h.shape.y, t);\n const sw = h.shape.width * view.scale.x;\n const sh = h.shape.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), fill, stroke });\n } else if (h.shape.kind === 'circle') {\n const [cx, cy] = worldToScreen(h.shape.cx, h.shape.cy, t);\n const rx = h.shape.r * Math.abs(view.scale.x);\n const ry = h.shape.r * Math.abs(view.scale.y);\n out.push({ kind: 'path', path: approxEllipseScreen(cx, cy, rx, ry), fill, stroke });\n } else if (h.shape.kind === 'polygon' && h.shape.points.length > 2) {\n const pts = h.shape.points;\n const coords = new Float32Array(pts.length * 2);\n pts.forEach((p, i) => {\n const [sx, sy] = worldToScreen(p.x, p.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n const commands = new Uint8Array(pts.length + 1).fill(PATH_L);\n commands[0] = PATH_M;\n commands[pts.length] = PATH_Z;\n out.push({ kind: 'path', path: { kind: 'polygon', commands, coords, fillRule: 'nonzero' }, fill, stroke });\n }\n // 'path' kind: v1 punt — matches 2D behavior.\n }\n}\n\nfunction emitBounds(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.bounds, theme.bounds);\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n const sw = b.bounds.width * view.scale.x;\n const sh = b.bounds.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), stroke });\n }\n}\n\nfunction emitHandles(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.handle, theme.handle);\n for (const h of s.handles) {\n const [cx, cy] = worldToScreen(h.position.x, h.position.y, t);\n const horiz: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx - 4, cy, cx + 4, cy]),\n fillRule: 'nonzero',\n };\n const vert: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx, cy - 4, cx, cy + 4]),\n fillRule: 'nonzero',\n };\n out.push({ kind: 'path', path: horiz, stroke });\n out.push({ kind: 'path', path: vert, stroke });\n }\n}\n\nfunction emitOrigins(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n const fill = { fill: 'solid' as const, color: theme.origin };\n for (const o of s.origins) {\n const [cx, cy] = worldToScreen(o.point.x, o.point.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(cx, cy, 3), fill });\n }\n}\n\nfunction emitSnap(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const color = theme.snap;\n for (const c of s.snap) {\n const [cx, cy] = worldToScreen(c.point.x, c.point.y, t);\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: approxCircleScreen(cx, cy, 4),\n ...(c.accepted\n ? { fill: { fill: 'solid' as const, color } }\n : { stroke: strokeOf(strokes.snap, color) }),\n };\n out.push(cmd);\n }\n}\n\nfunction emitIds(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n // Pulls from the bounds stream — every consumer that records bounds\n // (selection overlay's handle math, the kit's per-node debug shim) gets\n // an id label for free.\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n out.push(textCommandFromRuns(\n sx + 2,\n sy + 11,\n [{ text: b.id, fill: { fill: 'solid', color: theme.idText } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 10 },\n ));\n }\n}\n\nfunction emitLayersPanel(\n out: DrawCommand[],\n s: DebugSnapshot,\n dims: Dims,\n theme: DebugTheme,\n): void {\n if (s.layers.length === 0) return;\n const lineH = 14;\n const padX = 6;\n const padY = 4;\n const lines = s.layers.map((l) => `[${l.index}] ${l.id} (${l.space})`);\n // Approximate width: 11px font, monospaced — assume each glyph ≈6.6px.\n // 2D path uses ctx.measureText; we don't have a ctx here, so fall back\n // to a character-count estimate. Pixel-level accuracy is not load-bearing\n // for a debug panel; right-edge anchoring stays correct.\n const charW = 6.6;\n let maxW = 0;\n for (const line of lines) maxW = Math.max(maxW, line.length * charW);\n const boxW = maxW + padX * 2;\n const boxH = lines.length * lineH + padY * 2;\n const x = dims.width - boxW - 8;\n const y = 8;\n out.push({\n kind: 'path',\n path: rectPath(x, y, boxW, boxH),\n fill: { fill: 'solid', color: theme.layerTextBg },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * lineH,\n [{ text: lines[i], fill: { fill: 'solid', color: theme.layerText } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 },\n ));\n }\n}\n\nconst MONO = { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 };\nconst MONO_CHAR_W = 6.6;\nconst LINE_H = 14;\n\n/** A dark box holding monospace lines, at `(x, y)`; `y < 0` anchors its bottom\n * that far above `bottom`. Width is estimated from the character count — there\n * is no text measurer here, and a debug panel does not need one. */\nfunction emitTextPanel(\n out: DrawCommand[],\n lines: readonly string[],\n x: number,\n y: number,\n color: string,\n bg: string,\n): void {\n const padX = 6;\n const padY = 4;\n let maxLen = 0;\n for (const l of lines) maxLen = Math.max(maxLen, l.length);\n out.push({\n kind: 'path',\n path: rectPath(x, y, maxLen * MONO_CHAR_W + padX * 2, lines.length * LINE_H + padY * 2),\n fill: { fill: 'solid', color: bg },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * LINE_H,\n [{ text: lines[i], fill: { fill: 'solid', color } }],\n MONO,\n ));\n }\n}\n\n/** Fixed-width number, right-aligned, `decimals` places: `%{width}.{decimals}f`. */\nfunction fixed(v: number, width: number, decimals: number): string {\n return v.toFixed(decimals).padStart(width);\n}\n\nfunction emitFramePanel(\n out: DrawCommand[],\n history: readonly number[],\n frame: FrameStats | null,\n theme: DebugTheme,\n): void {\n const span = history.length >= 2 ? history[history.length - 1] - history[0] : 0;\n const interval = span > 0 ? span / (history.length - 1) : null;\n // Columns: label, draw-call count, value, unit — every row the same width,\n // so decimals line up down the panel.\n const rows: [label: string, count: number | null, value: number | null, unit: string][] = [\n ['fps', null, interval ? 1000 / interval : null, ' '],\n ['frame', null, interval, 'ms'],\n ];\n if (frame) {\n rows.push(['paint', frame.drawCalls, frame.paintMs, 'ms']);\n for (const l of frame.layers) rows.push([l.id, l.drawCalls, l.ms, 'ms']);\n }\n let labelW = 0;\n for (const [label] of rows) labelW = Math.max(labelW, label.length);\n const line = (label: string, count: string, value: string, unit: string) =>\n `${label.padEnd(labelW)} ${count.padStart(5)} ${value.padStart(7)} ${unit}`;\n const lines = rows.map(([label, count, value, unit]) =>\n line(label, count === null ? '' : String(count), value === null ? '—' : fixed(value, 7, 2), unit));\n if (frame) lines.splice(2, 0, line('', 'draws', 'cpu', ' '));\n emitTextPanel(out, lines, 8, 8, theme.fpsText, theme.fpsTextBg);\n}\n\nfunction emitViewport(\n out: DrawCommand[],\n rec: RecordedViewport,\n view: View,\n dims: Dims,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const t = viewToTransform(view);\n const stroke = strokeOf(strokes.viewport, theme.viewport);\n // Where the viewport the gesture started from sits in the current camera.\n const { from, to } = rec;\n const [fx, fy] = worldToScreen(from.x, from.y, t);\n out.push({\n kind: 'path',\n path: rectPath(fx, fy, (dims.width / from.scale.x) * view.scale.x, (dims.height / from.scale.y) * view.scale.y),\n stroke,\n });\n if (rec.anchor) {\n const [ax0, ay0] = worldToScreen(rec.anchor.x, rec.anchor.y, viewToTransform(from));\n const [ax1, ay1] = worldToScreen(rec.anchor.x, rec.anchor.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(ax0, ay0, 2.5), fill: { fill: 'solid', color: theme.viewport } });\n if (Math.hypot(ax1 - ax0, ay1 - ay0) > 0.5) {\n out.push({ kind: 'path', path: segment(ax0, ay0, ax1, ay1), stroke });\n }\n out.push({ kind: 'path', path: approxCircleScreen(ax1, ay1, 6), stroke: strokeOf({ width: strokes.viewport.width }, theme.viewport) });\n }\n const text = rec.kind === 'pan'\n ? `pan Δ ${signed((from.x - to.x) * to.scale.x)} ${signed((from.y - to.y) * to.scale.y)} px`\n : `zoom ×${(to.scale.x / from.scale.x).toFixed(3)} ${from.scale.x.toFixed(3)} → ${to.scale.x.toFixed(3)}`;\n emitTextPanel(out, [text], 8, dims.height - LINE_H - 16, theme.viewport, theme.layerTextBg);\n}\n\nfunction signed(v: number): string {\n const r = Math.abs(v) < 0.05 ? 0 : v;\n return `${r >= 0 ? '+' : '-'}${Math.abs(r).toFixed(1)}`.padStart(8);\n}\n\nfunction segment(x0: number, y0: number, x1: number, y1: number): PolygonPath {\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([x0, y0, x1, y1]),\n fillRule: 'nonzero',\n };\n}\n"],"mappings":";;;;;;;AAyBA,IAAMC,IAAa;AAQnB,SAAgBC,EAAwB,EACtC,SACA,aACoD;CAGpD,IAAMC,IAAuB,CAAC;CAC9B,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AO,GAAGnD,KAAK,IAAI,MAAM,MAAM,KAAK,IAAIA,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC;AACpE;AAEA,SAASwE,EAAQ,GAAY,GAAY,GAAY,GAAyB;CAC5E,OAAO;EACL,MAAM;EACN,UAAU,IAAI,WAAW,CAACpE,GAAQG,CAAM,CAAC;EACzC,QAAQ,IAAI,aAAa;GAACoE;GAAIC;GAAIC;GAAIC;EAAE,CAAC;EACzC,UAAU;CACZ;AACF"}
|
|
1
|
+
{"version":3,"file":"createDebugOverlayLayer.js","names":["rectPath","DEBUG_OVERLAY_ID","FPS_WINDOW","createDebugOverlayLayer","fpsHistory","config","buildDebugOverlayCommands","sink","view","dims","theme","DEFAULT_DEBUG_THEME","strokes","DEFAULT_DEBUG_STROKES","s","snapshot","t","viewToTransform","out","emitViewport","emitHitboxes","emitBounds","emitHandles","emitOrigins","emitSnap","emitIds","emitLayersPanel","emitFramePanel","frameTimes","approxCircleScreen","approxEllipseScreen","cx","cy","r","segments","cmds","coords","PATH_M","rx","i","PATH_L","theta","ry","PATH_Z","rotatedRectScreen","x","y","w","rotatePoint","sx","sy","worldToScreen","rectPath$1","h","strokeOf","fill","stroke","path","sw","sh","pts","p","commands","b","horiz","vert","o","color","c","cmd","textCommandFromRuns","lines","l","maxW","line","boxW","boxH","MONO","MONO_CHAR_W","LINE_H","emitTextPanel","maxLen","bg","fixed","v","decimals","width","span","history","interval","rows","frame","labelW","label","count","value","unit","rec","fx","fy","from","ax0","ay0","ax1","ay1","segment","signed","to","x0","y0","x1","y1"],"sources":["../../src/debug/createDebugOverlayLayer.ts"],"sourcesContent":["import type { DrawCommand, PathDrawCommand } from '@weasel-js/renderer';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { rotatePoint } from 'interactions/actions/rotate/geometry';\nimport { PATH_L, PATH_M, PATH_Z, type PolygonPath } from '@weasel-js/geom';\nimport { textCommandFromRuns } from '@weasel-js/renderer';\nimport type {\n DebugConfig,\n DebugSnapshot,\n DebugStroke,\n DebugStrokes,\n DebugTheme,\n FrameStats,\n RecordedViewport,\n} from './types';\nimport { DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME } from './defaultTheme';\n\n/** What `createDebugOverlayLayer` paints from: a sink to snapshot and the features to draw. */\nexport interface CreateDebugOverlayLayerOpts {\n sink: { snapshot(): DebugSnapshot };\n config: DebugConfig;\n}\n\nexport const DEBUG_OVERLAY_ID = 'debug-overlay';\nconst FPS_WINDOW = 60;\n\n/**\n * Screen-space `RenderLayer` that paints the sink's snapshot. Appended at\n * the top of the Canvas's layer stack when `debug` is enabled. World-space\n * coords in the snapshot are projected through `view` here, since the\n * layer itself runs at identity transform.\n */\nexport function createDebugOverlayLayer({\n sink,\n config,\n}: CreateDebugOverlayLayerOpts): RenderLayer<unknown> {\n // Timestamps of the last FPS_WINDOW draws, kept for the life of the layer.\n const fpsHistory: number[] = [];\n return {\n id: DEBUG_OVERLAY_ID,\n label: 'Debug overlay',\n space: 'screen',\n alwaysOn: true,\n draw: (_data, view, dims) => {\n if (config.fps) {\n fpsHistory.push(typeof performance !== 'undefined' ? performance.now() : Date.now());\n if (fpsHistory.length > FPS_WINDOW) fpsHistory.shift();\n } else if (fpsHistory.length > 0) {\n fpsHistory.length = 0;\n }\n return buildDebugOverlayCommands(sink.snapshot(), config, view, dims, fpsHistory);\n },\n };\n}\n\n/**\n * The debug overlay's draw commands for one snapshot, in screen space (CSS\n * pixels of a `dims`-sized canvas looking through `view`). What the overlay\n * layer paints each frame, and what `renderDebugSnapshot` rasterizes.\n *\n * `frameTimes` are `performance.now()` stamps of recent paints, oldest first;\n * the frame panel derives its rate from them and shows none without two.\n */\nexport function buildDebugOverlayCommands(\n snapshot: DebugSnapshot,\n config: DebugConfig,\n view: View,\n dims: Dims,\n frameTimes: readonly number[] = [],\n): DrawCommand[] {\n const theme: DebugTheme = { ...DEFAULT_DEBUG_THEME, ...(config.theme ?? {}) };\n const strokes: DebugStrokes = { ...DEFAULT_DEBUG_STROKES, ...(config.strokes ?? {}) };\n const s = snapshot;\n const t = viewToTransform(view);\n const out: DrawCommand[] = [];\n\n if (config.viewport && s.viewport) emitViewport(out, s.viewport, view, dims, theme, strokes);\n if (config.hitboxes) emitHitboxes(out, s, view, t, theme, strokes);\n if (config.bounds) emitBounds(out, s, view, t, theme, strokes);\n if (config.handles) emitHandles(out, s, t, theme, strokes);\n if (config.origins) emitOrigins(out, s, t, theme);\n if (config.snap) emitSnap(out, s, t, theme, strokes);\n if (config.ids) emitIds(out, s, t, theme);\n if (config.layers) emitLayersPanel(out, s, dims, theme);\n if (config.fps) emitFramePanel(out, frameTimes, s.frame, theme);\n return out;\n}\n\n// --- emitters (screen-space) ---\n\nfunction approxCircleScreen(cx: number, cy: number, r: number, segments = 24): PolygonPath {\n return approxEllipseScreen(cx, cy, r, r, segments);\n}\n\nfunction approxEllipseScreen(cx: number, cy: number, rx: number, ry: number, segments = 24): PolygonPath {\n // Commands: M + (segments-1) L + Z. Coords: (segments) × 2 — pairs for\n // the moveTo and the (segments-1) lineTos. PATH_Z consumes no coords.\n const cmds = new Uint8Array(segments + 1);\n const coords = new Float32Array(segments * 2);\n cmds[0] = PATH_M;\n coords[0] = cx + rx;\n coords[1] = cy;\n for (let i = 1; i < segments; i++) {\n cmds[i] = PATH_L;\n const theta = (i / segments) * Math.PI * 2;\n coords[i * 2] = cx + rx * Math.cos(theta);\n coords[i * 2 + 1] = cy + ry * Math.sin(theta);\n }\n cmds[segments] = PATH_Z;\n return { kind: 'polygon', commands: cmds, coords, fillRule: 'nonzero' };\n}\n\n/** A world rect turned `rotation` about its center, as the screen quad it\n * lands on. */\nfunction rotatedRectScreen(\n r: { x: number; y: number; width: number; height: number; rotation: number },\n t: ReturnType<typeof viewToTransform>,\n): PolygonPath {\n const cx = r.x + r.width / 2, cy = r.y + r.height / 2;\n const coords = new Float32Array(8);\n const corners = [[r.x, r.y], [r.x + r.width, r.y], [r.x + r.width, r.y + r.height], [r.x, r.y + r.height]];\n corners.forEach(([x, y], i) => {\n const w = rotatePoint(x, y, cx, cy, r.rotation);\n const [sx, sy] = worldToScreen(w.x, w.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]),\n coords,\n fillRule: 'nonzero',\n };\n}\n\nfunction rectPath(x: number, y: number, w: number, h: number): { kind: 'rect'; x: number; y: number; width: number; height: number } {\n return { kind: 'rect', x, y, width: w, height: h };\n}\n\n/** A `DebugStroke` + color as the renderer's stroke shape. `dash` is dropped\n * when empty rather than passed through, so a solid line stays solid. */\nfunction strokeOf(s: DebugStroke, color: string) {\n return {\n paint: { kind: 'solid' as const, color },\n width: s.width,\n ...(s.dash && s.dash.length > 0 ? { dash: [...s.dash] } : {}),\n };\n}\n\nfunction emitHitboxes(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const fill = { kind: 'solid' as const, color: theme.hitboxFill };\n const stroke = strokeOf(strokes.hitbox, theme.hitboxStroke);\n for (const h of s.hitboxes) {\n if (h.shape.kind === 'rect' && h.shape.rotation) {\n const path = rotatedRectScreen({ ...h.shape, rotation: h.shape.rotation }, t);\n out.push({ kind: 'path', path, fill: { paint: fill }, stroke });\n } else if (h.shape.kind === 'rect') {\n const [sx, sy] = worldToScreen(h.shape.x, h.shape.y, t);\n const sw = h.shape.width * view.scale.x;\n const sh = h.shape.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), fill: { paint: fill }, stroke });\n } else if (h.shape.kind === 'circle') {\n const [cx, cy] = worldToScreen(h.shape.cx, h.shape.cy, t);\n const rx = h.shape.r * Math.abs(view.scale.x);\n const ry = h.shape.r * Math.abs(view.scale.y);\n out.push({ kind: 'path', path: approxEllipseScreen(cx, cy, rx, ry), fill: { paint: fill }, stroke });\n } else if (h.shape.kind === 'polygon' && h.shape.points.length > 2) {\n const pts = h.shape.points;\n const coords = new Float32Array(pts.length * 2);\n pts.forEach((p, i) => {\n const [sx, sy] = worldToScreen(p.x, p.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n const commands = new Uint8Array(pts.length + 1).fill(PATH_L);\n commands[0] = PATH_M;\n commands[pts.length] = PATH_Z;\n out.push({ kind: 'path', path: { kind: 'polygon', commands, coords, fillRule: 'nonzero' }, fill: { paint: fill }, stroke });\n }\n // 'path' kind: v1 punt — matches 2D behavior.\n }\n}\n\nfunction emitBounds(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.bounds, theme.bounds);\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n const sw = b.bounds.width * view.scale.x;\n const sh = b.bounds.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), stroke });\n }\n}\n\nfunction emitHandles(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.handle, theme.handle);\n for (const h of s.handles) {\n const [cx, cy] = worldToScreen(h.position.x, h.position.y, t);\n const horiz: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx - 4, cy, cx + 4, cy]),\n fillRule: 'nonzero',\n };\n const vert: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx, cy - 4, cx, cy + 4]),\n fillRule: 'nonzero',\n };\n out.push({ kind: 'path', path: horiz, stroke });\n out.push({ kind: 'path', path: vert, stroke });\n }\n}\n\nfunction emitOrigins(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n const fill = { kind: 'solid' as const, color: theme.origin };\n for (const o of s.origins) {\n const [cx, cy] = worldToScreen(o.point.x, o.point.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(cx, cy, 3), fill: { paint: fill } });\n }\n}\n\nfunction emitSnap(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const color = theme.snap;\n for (const c of s.snap) {\n const [cx, cy] = worldToScreen(c.point.x, c.point.y, t);\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: approxCircleScreen(cx, cy, 4),\n ...(c.accepted\n ? { fill: { paint: { kind: 'solid' as const, color } } }\n : { stroke: strokeOf(strokes.snap, color) }),\n };\n out.push(cmd);\n }\n}\n\nfunction emitIds(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n // Pulls from the bounds stream — every consumer that records bounds\n // (selection overlay's handle math, the kit's per-node debug shim) gets\n // an id label for free.\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n out.push(textCommandFromRuns(\n sx + 2,\n sy + 11,\n [{ text: b.id, fill: { paint: { kind: 'solid', color: theme.idText } } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 10 },\n ));\n }\n}\n\nfunction emitLayersPanel(\n out: DrawCommand[],\n s: DebugSnapshot,\n dims: Dims,\n theme: DebugTheme,\n): void {\n if (s.layers.length === 0) return;\n const lineH = 14;\n const padX = 6;\n const padY = 4;\n const lines = s.layers.map((l) => `[${l.index}] ${l.id} (${l.space})`);\n // Approximate width: 11px font, monospaced — assume each glyph ≈6.6px.\n // 2D path uses ctx.measureText; we don't have a ctx here, so fall back\n // to a character-count estimate. Pixel-level accuracy is not load-bearing\n // for a debug panel; right-edge anchoring stays correct.\n const charW = 6.6;\n let maxW = 0;\n for (const line of lines) maxW = Math.max(maxW, line.length * charW);\n const boxW = maxW + padX * 2;\n const boxH = lines.length * lineH + padY * 2;\n const x = dims.width - boxW - 8;\n const y = 8;\n out.push({\n kind: 'path',\n path: rectPath(x, y, boxW, boxH),\n fill: { paint: { kind: 'solid', color: theme.layerTextBg } },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * lineH,\n [{ text: lines[i], fill: { paint: { kind: 'solid', color: theme.layerText } } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 },\n ));\n }\n}\n\nconst MONO = { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 };\nconst MONO_CHAR_W = 6.6;\nconst LINE_H = 14;\n\n/** A dark box holding monospace lines, at `(x, y)`; `y < 0` anchors its bottom\n * that far above `bottom`. Width is estimated from the character count — there\n * is no text measurer here, and a debug panel does not need one. */\nfunction emitTextPanel(\n out: DrawCommand[],\n lines: readonly string[],\n x: number,\n y: number,\n color: string,\n bg: string,\n): void {\n const padX = 6;\n const padY = 4;\n let maxLen = 0;\n for (const l of lines) maxLen = Math.max(maxLen, l.length);\n out.push({\n kind: 'path',\n path: rectPath(x, y, maxLen * MONO_CHAR_W + padX * 2, lines.length * LINE_H + padY * 2),\n fill: { paint: { kind: 'solid', color: bg } },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * LINE_H,\n [{ text: lines[i], fill: { paint: { kind: 'solid', color } } }],\n MONO,\n ));\n }\n}\n\n/** Fixed-width number, right-aligned, `decimals` places: `%{width}.{decimals}f`. */\nfunction fixed(v: number, width: number, decimals: number): string {\n return v.toFixed(decimals).padStart(width);\n}\n\nfunction emitFramePanel(\n out: DrawCommand[],\n history: readonly number[],\n frame: FrameStats | null,\n theme: DebugTheme,\n): void {\n const span = history.length >= 2 ? history[history.length - 1] - history[0] : 0;\n const interval = span > 0 ? span / (history.length - 1) : null;\n // Columns: label, draw-call count, value, unit — every row the same width,\n // so decimals line up down the panel.\n const rows: [label: string, count: number | null, value: number | null, unit: string][] = [\n ['fps', null, interval ? 1000 / interval : null, ' '],\n ['frame', null, interval, 'ms'],\n ];\n if (frame) {\n rows.push(['paint', frame.drawCalls, frame.paintMs, 'ms']);\n for (const l of frame.layers) rows.push([l.id, l.drawCalls, l.ms, 'ms']);\n }\n let labelW = 0;\n for (const [label] of rows) labelW = Math.max(labelW, label.length);\n const line = (label: string, count: string, value: string, unit: string) =>\n `${label.padEnd(labelW)} ${count.padStart(5)} ${value.padStart(7)} ${unit}`;\n const lines = rows.map(([label, count, value, unit]) =>\n line(label, count === null ? '' : String(count), value === null ? '—' : fixed(value, 7, 2), unit));\n if (frame) lines.splice(2, 0, line('', 'draws', 'cpu', ' '));\n emitTextPanel(out, lines, 8, 8, theme.fpsText, theme.fpsTextBg);\n}\n\nfunction emitViewport(\n out: DrawCommand[],\n rec: RecordedViewport,\n view: View,\n dims: Dims,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const t = viewToTransform(view);\n const stroke = strokeOf(strokes.viewport, theme.viewport);\n // Where the viewport the gesture started from sits in the current camera.\n const { from, to } = rec;\n const [fx, fy] = worldToScreen(from.x, from.y, t);\n out.push({\n kind: 'path',\n path: rectPath(fx, fy, (dims.width / from.scale.x) * view.scale.x, (dims.height / from.scale.y) * view.scale.y),\n stroke,\n });\n if (rec.anchor) {\n const [ax0, ay0] = worldToScreen(rec.anchor.x, rec.anchor.y, viewToTransform(from));\n const [ax1, ay1] = worldToScreen(rec.anchor.x, rec.anchor.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(ax0, ay0, 2.5), fill: { paint: { kind: 'solid', color: theme.viewport } } });\n if (Math.hypot(ax1 - ax0, ay1 - ay0) > 0.5) {\n out.push({ kind: 'path', path: segment(ax0, ay0, ax1, ay1), stroke });\n }\n out.push({ kind: 'path', path: approxCircleScreen(ax1, ay1, 6), stroke: strokeOf({ width: strokes.viewport.width }, theme.viewport) });\n }\n const text = rec.kind === 'pan'\n ? `pan Δ ${signed((from.x - to.x) * to.scale.x)} ${signed((from.y - to.y) * to.scale.y)} px`\n : `zoom ×${(to.scale.x / from.scale.x).toFixed(3)} ${from.scale.x.toFixed(3)} → ${to.scale.x.toFixed(3)}`;\n emitTextPanel(out, [text], 8, dims.height - LINE_H - 16, theme.viewport, theme.layerTextBg);\n}\n\nfunction signed(v: number): string {\n const r = Math.abs(v) < 0.05 ? 0 : v;\n return `${r >= 0 ? '+' : '-'}${Math.abs(r).toFixed(1)}`.padStart(8);\n}\n\nfunction segment(x0: number, y0: number, x1: number, y1: number): PolygonPath {\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([x0, y0, x1, y1]),\n fillRule: 'nonzero',\n };\n}\n"],"mappings":";;;;;;;AAyBA,IAAaC,IAAmB,iBAC1BC,IAAa;AAQnB,SAAgBC,EAAwB,EACtC,SACA,aACoD;CAEpD,IAAMC,IAAuB,CAAC;CAC9B,OAAO;EACL,IAAIH;EACJ,OAAO;EACP,OAAO;EACP,UAAU;EACV,OAAO,GAAO,GAAM,OACdI,EAAO,OACTD,EAAW,KAAK,OAAO,cAAgB,MAAc,YAAY,IAAI,IAAI,KAAK,IAAI,CAAC,GAC/EA,EAAW,SAASF,KAAYE,EAAW,MAAM,KAC5CA,EAAW,SAAS,MAC7B,EAAW,SAAS,IAEfE,EAA0BC,EAAK,SAAS,GAAGF,GAAQG,GAAMC,GAAML,CAAU;CAEpF;AACF;AAUA,SAAgBE,EACd,GACA,GACA,GACA,GACA,IAAgC,CAAC,GAClB;CACf,IAAMI,IAAoB;EAAE,GAAGC;EAAqB,GAAIN,EAAO,SAAS,CAAC;CAAG,GACtEO,IAAwB;EAAE,GAAGC;EAAuB,GAAIR,EAAO,WAAW,CAAC;CAAG,GAC9ES,IAAIC,GACJC,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IC;GAAIC;EAAE,CAAC;EACzC,UAAU;CACZ;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDebugSink.js","names":["createDebugSink","snap","config","anchor","stats"],"sources":["../../src/debug/createDebugSink.ts"],"sourcesContent":["import type {\n CanvasDebugSink,\n DebugConfig,\n DebugSnapshot,\n HandleKind,\n HitShape,\n} from './types';\n\n/**\n * Build a sink that stores recorded primitives in arrays keyed by feature.\n *
|
|
1
|
+
{"version":3,"file":"createDebugSink.js","names":["createDebugSink","snap","config","anchor","stats"],"sources":["../../src/debug/createDebugSink.ts"],"sourcesContent":["import type {\n CanvasDebugSink,\n DebugConfig,\n DebugSnapshot,\n HandleKind,\n HitShape,\n} from './types';\n\n/**\n * Build a sink that stores recorded primitives in arrays keyed by feature.\n * A `recordX` call no-ops when its flag in `config` is off, so callers can\n * record unconditionally.\n *\n * `beginFrame()` clears every per-frame array. Snap, the latest viewport\n * record, and the last frame's stats survive across frames. `snapshot()`\n * returns live references — no copy.\n */\nexport function createDebugSink(config: DebugConfig): CanvasDebugSink {\n const snap: DebugSnapshot = {\n hitboxes: [],\n handles: [],\n bounds: [],\n origins: [],\n snap: [],\n layers: [],\n viewport: null,\n frame: null,\n };\n return {\n recordHitbox(id, kind, shape: HitShape) {\n if (!config.hitboxes) return;\n snap.hitboxes.push({ id, kind, shape });\n },\n recordHandle(id, position, kind: HandleKind) {\n if (!config.handles) return;\n snap.handles.push({ id, position, kind });\n },\n recordBounds(id, bounds) {\n if (!config.bounds) return;\n snap.bounds.push({ id, bounds });\n },\n recordOrigin(id, point) {\n if (!config.origins) return;\n snap.origins.push({ id, point });\n },\n recordSnapCandidate(point, accepted) {\n if (!config.snap) return;\n snap.snap.push({ point, accepted });\n },\n recordLayer(id, label, space, index) {\n if (!config.layers) return;\n snap.layers.push({ id, label, space, index });\n },\n recordViewport(kind, from, to, anchor) {\n if (!config.viewport) return;\n snap.viewport = anchor ? { kind, from, to, anchor } : { kind, from, to };\n },\n recordFrame(stats) {\n if (!config.fps) return;\n snap.frame = stats;\n },\n beginFrame() {\n snap.hitboxes.length = 0;\n snap.handles.length = 0;\n snap.bounds.length = 0;\n snap.origins.length = 0;\n snap.layers.length = 0;\n },\n clearSnap() {\n snap.snap.length = 0;\n },\n snapshot() {\n return snap;\n },\n };\n}\n"],"mappings":";AAiBA,SAAgBA,EAAgB,GAAsC;CACpE,IAAMC,IAAsB;EAC1B,UAAU,CAAC;EACX,SAAS,CAAC;EACV,QAAQ,CAAC;EACT,SAAS,CAAC;EACV,MAAM,CAAC;EACP,QAAQ,CAAC;EACT,UAAU;EACV,OAAO;CACT;CACA,OAAO;EACL,aAAa,GAAI,GAAM,GAAiB;GACtC,AAAKC,EAAO,YACZD,EAAK,SAAS,KAAK;IAAE;IAAI;IAAM;GAAM,CAAC;EACxC;EACA,aAAa,GAAI,GAAU,GAAkB;GAC3C,AAAKC,EAAO,WACZD,EAAK,QAAQ,KAAK;IAAE;IAAI;IAAU;GAAK,CAAC;EAC1C;EACA,aAAa,GAAI,GAAQ;GACvB,AAAKC,EAAO,UACZD,EAAK,OAAO,KAAK;IAAE;IAAI;GAAO,CAAC;EACjC;EACA,aAAa,GAAI,GAAO;GACtB,AAAKC,EAAO,WACZD,EAAK,QAAQ,KAAK;IAAE;IAAI;GAAM,CAAC;EACjC;EACA,oBAAoB,GAAO,GAAU;GACnC,AAAKC,EAAO,QACZD,EAAK,KAAK,KAAK;IAAE;IAAO;GAAS,CAAC;EACpC;EACA,YAAY,GAAI,GAAO,GAAO,GAAO;GACnC,AAAKC,EAAO,UACZD,EAAK,OAAO,KAAK;IAAE;IAAI;IAAO;IAAO;GAAM,CAAC;EAC9C;EACA,eAAe,GAAM,GAAM,GAAI,GAAQ;GACrC,AAAKC,EAAO,aACZ,EAAK,WAAWC,IAAS;IAAE;IAAM;IAAM;IAAI;GAAO,IAAI;IAAE;IAAM;IAAM;GAAG;EACzE;EACA,YAAY,GAAO;GACjB,AAAKD,EAAO,QACZ,EAAK,QAAQE;EACf;EACA,aAAa;GAKX,AAJA,EAAK,SAAS,SAAS,GACvB,EAAK,QAAQ,SAAS,GACtB,EAAK,OAAO,SAAS,GACrB,EAAK,QAAQ,SAAS,GACtB,EAAK,OAAO,SAAS;EACvB;EACA,YAAY;GACV,EAAK,KAAK,SAAS;EACrB;EACA,WAAW;GACT,OAAOH;EACT;CACF;AACF"}
|
package/dist/debug/flag.js
CHANGED
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function n() {
|
|
4
|
-
let t = {
|
|
5
|
-
all: !1,
|
|
6
|
-
set: /* @__PURE__ */ new Set()
|
|
7
|
-
};
|
|
8
|
-
if (typeof localStorage > "u") return t;
|
|
9
|
-
try {
|
|
10
|
-
for (let t of e) {
|
|
11
|
-
let e = localStorage.getItem(t);
|
|
12
|
-
if (e != null && e !== "") return e === "1" || e === "true" || e === "*" ? {
|
|
13
|
-
all: !0,
|
|
14
|
-
set: /* @__PURE__ */ new Set()
|
|
15
|
-
} : {
|
|
16
|
-
all: !1,
|
|
17
|
-
set: new Set(e.split(/[\s,]+/).filter(Boolean))
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
} catch {
|
|
22
|
-
return t;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function r() {
|
|
26
|
-
return t === null && (t = n()), t;
|
|
27
|
-
}
|
|
28
|
-
function i(e) {
|
|
29
|
-
let t = r();
|
|
30
|
-
return t.all ? !0 : e === void 0 ? t.set.size > 0 : t.set.has(e);
|
|
31
|
-
}
|
|
32
|
-
function a(e, ...t) {
|
|
33
|
-
i(e) && console.debug(`[${e}]`, ...t);
|
|
34
|
-
}
|
|
35
|
-
function o(e, ...t) {
|
|
36
|
-
i(e) && console.warn(`[${e}]`, ...t);
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { a as dlog, o as dwarn, i as isDebugEnabled };
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=flag.js.map
|
|
1
|
+
import { dlog as e, dwarn as t, isDebugEnabled as n } from "@weasel-js/routing";
|
|
2
|
+
export { e as dlog, t as dwarn, n as isDebugEnabled };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameStats.js","names":["frameStatsOf","render","layers","l","i"],"sources":["../../src/debug/frameStats.ts"],"sourcesContent":["import type { LayerDrawSpan } from 'core/layers/render';\nimport type { RenderStats } from '
|
|
1
|
+
{"version":3,"file":"frameStats.js","names":["frameStatsOf","render","layers","l","i"],"sources":["../../src/debug/frameStats.ts"],"sourcesContent":["import type { LayerDrawSpan } from 'core/layers/render';\nimport type { RenderStats } from '@weasel-js/renderer';\nimport type { FrameStats } from './types';\n\n/** One paint's {@link FrameStats}: each layer's build time from `drawLayers`\n * joined with its dispatch cost from the renderer, span for span. */\nexport function frameStatsOf(layers: readonly LayerDrawSpan[], render: RenderStats, paintMs: number): FrameStats {\n return {\n paintMs,\n drawCalls: render.drawCalls,\n layers: layers.map((l, i) => ({\n id: l.id,\n drawCalls: render.spans[i]?.drawCalls ?? 0,\n ms: l.buildMs + (render.spans[i]?.ms ?? 0),\n })),\n };\n}\n"],"mappings":";AAMA,SAAgBA,EAAa,GAAkC,GAAqB,GAA6B;CAC/G,OAAO;EACL;EACA,WAAWC,EAAO;EAClB,QAAQC,EAAO,KAAK,GAAG,OAAO;GAC5B,IAAIC,EAAE;GACN,WAAWF,EAAO,MAAMG,EAAE,EAAE,aAAa;GACzC,IAAID,EAAE,WAAWF,EAAO,MAAMG,EAAE,EAAE,MAAM;EAC1C,EAAE;CACJ;AACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DEBUG_OVERLAY_ID as e, createDebugOverlayLayer as t } from "./createDebugOverlayLayer.js";
|
|
2
|
+
import { parseDebugFlags as n } from "./parseDebugFlags.js";
|
|
3
|
+
import { createDebugSink as r } from "./createDebugSink.js";
|
|
4
|
+
import { frameStatsOf as i } from "./frameStats.js";
|
|
5
|
+
import { useCallback as a, useMemo as o } from "react";
|
|
6
|
+
import { useLatest as s } from "@weasel-js/react";
|
|
7
|
+
//#region src/debug/useDebugSink.ts
|
|
8
|
+
var c = {
|
|
9
|
+
sink: null,
|
|
10
|
+
overlay: null,
|
|
11
|
+
frameStats: !1
|
|
12
|
+
};
|
|
13
|
+
function l(e) {
|
|
14
|
+
let i = e === void 0 ? void 0 : JSON.stringify(e), l = o(() => {
|
|
15
|
+
let e = i === void 0 ? typeof window > "u" ? null : n(window.location.search) : JSON.parse(i) || null;
|
|
16
|
+
if (!e) return c;
|
|
17
|
+
let a = r(e);
|
|
18
|
+
return {
|
|
19
|
+
sink: a,
|
|
20
|
+
overlay: t({
|
|
21
|
+
sink: a,
|
|
22
|
+
config: e
|
|
23
|
+
}),
|
|
24
|
+
frameStats: e.fps === !0
|
|
25
|
+
};
|
|
26
|
+
}, [i]), u = s(l.sink), d = a(() => u.current, [u]);
|
|
27
|
+
return {
|
|
28
|
+
...l,
|
|
29
|
+
getDebug: d
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function u(t, n, r) {
|
|
33
|
+
if (!t) return null;
|
|
34
|
+
t.beginFrame();
|
|
35
|
+
for (let n = 0; n < r.length; n++) {
|
|
36
|
+
let i = r[n];
|
|
37
|
+
i.id !== e && t.recordLayer(i.id, i.label, i.space ?? "world", n);
|
|
38
|
+
}
|
|
39
|
+
let a, o = 0;
|
|
40
|
+
return {
|
|
41
|
+
time: () => {
|
|
42
|
+
if (n) return a = [], o = performance.now(), a;
|
|
43
|
+
},
|
|
44
|
+
end: (e) => {
|
|
45
|
+
a && t.recordFrame(i(a, e, performance.now() - o));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { u as beginDebugFrame, l as useDebugSink };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=useDebugSink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebugSink.js","names":["OFF","useDebugSink","key","debug","state","useMemo","config","parseDebugFlags","sink","createDebugSink","createDebugOverlayLayer","committed","useLatest","getDebug","useCallback","beginDebugFrame","i","layers","layer","DEBUG_OVERLAY_ID","spans","startedAt","frameStats","frameStatsOf","render"],"sources":["../../src/debug/useDebugSink.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { RenderStats } from '@weasel-js/renderer';\nimport type { LayerDrawSpan, RenderLayer } from 'core/layers/render';\nimport type { CanvasDebugSink, DebugConfig } from './types';\nimport { parseDebugFlags } from './parseDebugFlags';\nimport { createDebugSink } from './createDebugSink';\nimport { createDebugOverlayLayer, DEBUG_OVERLAY_ID } from './createDebugOverlayLayer';\nimport { frameStatsOf } from './frameStats';\n\n/** A surface's debug state for one resolved config. */\nexport interface SurfaceDebug {\n /** Null when debugging is off. */\n sink: CanvasDebugSink | null;\n /** The layer that paints the sink, for the top of the surface's stack. */\n overlay: RenderLayer<unknown> | null;\n /** Whether a paint should time itself for the frame panel. */\n frameStats: boolean;\n /** The sink of the last committed render. Stable. */\n getDebug: () => CanvasDebugSink | null;\n}\n\nconst OFF = { sink: null, overlay: null, frameStats: false };\n\n/**\n * Resolve a surface's `debug` prop and hold what it turns on. `undefined`\n * reads `?debug=…` from the URL, `false` forces it off, and a config forces it\n * on. Keyed on the config's content, so one written inline keeps its sink, and\n * what the sink and the overlay have accumulated, from render to render.\n */\nexport function useDebugSink(debug: DebugConfig | false | undefined): SurfaceDebug {\n const key = debug === undefined ? undefined : JSON.stringify(debug);\n const state = useMemo(() => {\n const config = key !== undefined\n ? (JSON.parse(key) as DebugConfig | false) || null\n : typeof window === 'undefined' ? null : parseDebugFlags(window.location.search);\n if (!config) return OFF;\n const sink = createDebugSink(config);\n return { sink, overlay: createDebugOverlayLayer({ sink, config }), frameStats: config.fps === true };\n }, [key]);\n const committed = useLatest(state.sink);\n const getDebug = useCallback(() => committed.current, [committed]);\n return { ...state, getDebug };\n}\n\n/** One paint's recording, from {@link beginDebugFrame}. */\nexport interface DebugFrame {\n /** Start the paint clock. Returns the list `drawLayers` fills, or\n * `undefined` when the frame panel is off and nothing is timed. */\n time(): LayerDrawSpan[] | undefined;\n /** Record what the timed paint cost. A no-op unless `time` was called. */\n end(render: RenderStats): void;\n}\n\n/**\n * Open a paint's recording: clear the sink's per-frame records and note the\n * stack about to be drawn, bottom first. Returns `null` with no sink.\n */\nexport function beginDebugFrame(\n sink: CanvasDebugSink | null,\n frameStats: boolean,\n layers: readonly RenderLayer<unknown>[],\n): DebugFrame | null {\n if (!sink) return null;\n sink.beginFrame();\n for (let i = 0; i < layers.length; i++) {\n const layer = layers[i]!;\n if (layer.id === DEBUG_OVERLAY_ID) continue;\n sink.recordLayer(layer.id, layer.label, layer.space ?? 'world', i);\n }\n let spans: LayerDrawSpan[] | undefined;\n let startedAt = 0;\n return {\n time: () => {\n if (!frameStats) return undefined;\n spans = [];\n startedAt = performance.now();\n return spans;\n },\n end: (render) => {\n if (spans) sink.recordFrame(frameStatsOf(spans, render, performance.now() - startedAt));\n },\n };\n}\n"],"mappings":";;;;;;;AAsBA,IAAMA,IAAM;CAAE,MAAM;CAAM,SAAS;CAAM,YAAY;AAAM;AAQ3D,SAAgBC,EAAa,GAAsD;CACjF,IAAMC,IAAMC,MAAU,KAAA,IAAY,KAAA,IAAY,KAAK,UAAUA,CAAK,GAC5DC,IAAQC,QAAc;EAC1B,IAAMC,IAASJ,MAAQ,KAAA,IAEnB,OAAO,SAAW,MAAc,OAAOK,EAAgB,OAAO,SAAS,MAAM,IAD5E,KAAK,MAAML,CAAG,KAA6B;EAEhD,IAAI,CAACI,GAAQ,OAAON;EACpB,IAAMQ,IAAOC,EAAgBH,CAAM;EACnC,OAAO;GAAE;GAAM,SAASI,EAAwB;IAAE;IAAM;GAAO,CAAC;GAAG,YAAYJ,EAAO,QAAQ;EAAK;CACrG,GAAG,CAACJ,CAAG,CAAC,GACFS,IAAYC,EAAUR,EAAM,IAAI,GAChCS,IAAWC,QAAkBH,EAAU,SAAS,CAACA,CAAS,CAAC;CACjE,OAAO;EAAE,GAAGP;EAAO;CAAS;AAC9B;AAeA,SAAgBW,EACd,GACA,GACA,GACmB;CACnB,IAAI,CAACP,GAAM,OAAO;CAClB,EAAK,WAAW;CAChB,KAAK,IAAIQ,IAAI,GAAGA,IAAIC,EAAO,QAAQ,KAAK;EACtC,IAAMC,IAAQD,EAAOD;EACrB,AAAIE,EAAM,OAAOC,KACjBX,EAAK,YAAYU,EAAM,IAAIA,EAAM,OAAOA,EAAM,SAAS,SAASF,CAAC;CACnE;CACA,IAAII,GACAC,IAAY;CAChB,OAAO;EACL,YAAY;GACV,IAAKC,GAGL,OAFA,IAAQ,CAAC,GACT,IAAY,YAAY,IAAI,GACrBF;EACT;EACA,MAAM,MAAW;GACf,AAAIA,KAAOZ,EAAK,YAAYe,EAAaH,GAAOI,GAAQ,YAAY,IAAI,IAAIH,CAAS,CAAC;EACxF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildChromeCtx.js","names":["buildChromeCtx","args"],"sources":["../../../src/features/chrome-caps/buildChromeCtx.ts"],"sourcesContent":["/**\n * Pure assembler for {@link ChromeCtx}
|
|
1
|
+
{"version":3,"file":"buildChromeCtx.js","names":["buildChromeCtx","args"],"sources":["../../../src/features/chrome-caps/buildChromeCtx.ts"],"sourcesContent":["/**\n * Pure assembler for {@link ChromeCtx}. Sources are passed as plain values\n * rather than the live objects they come from, which keeps `chrome-caps`\n * from depending on React or the dispatcher's concrete type.\n */\n\nimport type { NodeId } from '../../core/scene/types';\nimport type { ModifierState } from '../../interactions/gestures/types';\nimport type { View } from '../../core/viewport/view';\nimport type { ChromeCtx } from './types';\n\n/** The pieces of live canvas state a `ChromeCtx` is assembled from. */\nexport interface BuildChromeCtxArgs {\n focused: boolean;\n selection: readonly NodeId[];\n multiActive: boolean;\n modifiers: ModifierState;\n action: { kind: string | null; id: string | null };\n hover: NodeId | null;\n view: View;\n}\n\n/** Gather the current canvas state into the context that chrome-visibility\n * rules are evaluated against. Rebuilt per frame. */\nexport function buildChromeCtx(args: BuildChromeCtxArgs): ChromeCtx {\n return {\n focused: args.focused,\n selection: args.selection,\n multiActive: args.multiActive,\n modifiers: args.modifiers,\n action: args.action,\n hover: args.hover,\n view: args.view,\n };\n}\n"],"mappings":";AAwBA,SAAgBA,EAAe,GAAqC;CAClE,OAAO;EACL,SAASC,EAAK;EACd,WAAWA,EAAK;EAChB,aAAaA,EAAK;EAClB,WAAWA,EAAK;EAChB,QAAQA,EAAK;EACb,OAAOA,EAAK;EACZ,MAAMA,EAAK;CACb;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.js","names":["cond","condition","evaluate","rule","ctx","combineAll","asRule","other","combineAny","value","left","a","right","b","when","fn","and","cs","or","not","c","always","ALWAYS","never","NEVER","focused","gesturing","actionIs","kind","selectionEmpty","selectionIs","n","selectionAtLeast","multiActive","hovering","hoveringSelected","modifierHeld","m","zoomAtLeast","z","modeIs","modeIn","modes","modeNot","capabilityIs","cap","capabilityIn","caps","capabilityAll","capabilityNot","coarsePointer","canHover"],"sources":["../../../src/features/chrome-caps/conditions.ts"],"sourcesContent":["import type { Condition } from './types';\nimport type { Rule } from '@weasel-js/routing';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { evaluate, ALWAYS, NEVER } from '@weasel-js/routing';\nimport type { ModifierState } from '../../interactions/gestures/types';\n\n/**\n * Promote a Rule tree to a fluent Condition. The function form evaluates\n * the tree against a RuleCtx; combinator methods produce new Conditions\n * wrapping `all`/`any`/`not` nodes.\n *\n * **Chain semantics: strict left-to-right.** No boolean precedence.\n * `focused.or(hovering).and(selectionIs(1))` evaluates\n * `((focused || hovering) && selectionIs(1))` — NOT\n * `(focused || (hovering && selectionIs(1)))` as standard precedence\n * would give. For grouped disjunction, use the top-level `or` / `and` /\n * `not` helpers or name intermediates.\n *\n * Combinators flatten same-kind nesting on construction so `a.and(b).and(c)`\n * produces `{ all: [a, b, c] }` rather than `{ all: [{ all: [a, b] }, c] }`.\n * Canonical form simplifies downstream introspection.\n *\n * Use {@link when} for the inline-lambda escape hatch.\n */\nexport function cond(rule: Rule): Condition {\n const fn = (ctx: RuleCtx) => evaluate(rule, ctx);\n const condition = fn as Condition;\n (condition as { rule: Rule }).rule = rule;\n condition.and = (other) => cond(combineAll(rule, asRule(other)));\n condition.or = (other) => cond(combineAny(rule, asRule(other)));\n condition.andNot = (other) => cond(combineAll(rule, { not: asRule(other) }));\n condition.orNot = (other) => cond(combineAny(rule, { not: asRule(other) }));\n return condition;\n}\n\nfunction asRule(value: Condition | Rule): Rule {\n return typeof value === 'function' ? (value as Condition).rule : value;\n}\n\nfunction combineAll(a: Rule, b: Rule): Rule {\n const left = 'all' in a ? a.all : [a];\n const right = 'all' in b ? b.all : [b];\n return { all: [...left, ...right] };\n}\n\nfunction combineAny(a: Rule, b: Rule): Rule {\n const left = 'any' in a ? a.any : [a];\n const right = 'any' in b ? b.any : [b];\n return { any: [...left, ...right] };\n}\n\n/** Inline-lambda escape hatch. Wraps the closure as a `when` rule node. */\nexport function when(fn: (ctx: RuleCtx) => boolean): Condition {\n return cond({ when: fn });\n}\n\n// ─── Variadic helpers (for grouped expressions) ─────────────────────\n\n/** `(a && b && c && ...)` — useful when chain mixing makes left-to-right\n * semantics ambiguous. */\nexport function and(...cs: (Condition | Rule)[]): Condition {\n return cond({ all: cs.map(asRule) });\n}\n\n/** `(a || b || c || ...)` — preferred over `.or` chains when mixed with\n * `.and` to make grouping explicit. */\nexport function or(...cs: (Condition | Rule)[]): Condition {\n return cond({ any: cs.map(asRule) });\n}\n\n/** `!c` — top-level negation. Most rules use `.andNot()` / `.orNot()`\n * instead; this is for the lead-with-negation case. */\nexport function not(c: Condition | Rule): Condition {\n return cond({ not: asRule(c) });\n}\n\n// ─── Constant atoms ─────────────────────────────────────────────────\n\n/** Always true. The fallback for any chrome id without a registered rule. */\nexport const always: Condition = cond(ALWAYS);\n\n/** Always false. Useful for \"turn this chrome off entirely\":\n * `chromeVisibility={{ 'snap.guides': never }}`. */\nexport const never: Condition = cond(NEVER);\n\n// ─── Focus / action atoms ───────────────────────────────────────────\n\n/** Canvas surface currently focused. */\nexport const focused: Condition = cond({ focused: true });\n\n/** Any action currently in flight (read: user is gesturing). */\nexport const gesturing: Condition = cond({ gesturing: true });\n\n/** A path is currently in anchor-edit mode. */\nexport const editingAnchors: Condition = cond({ editingAnchors: true });\n\n/** Current selection is resizable (every selected node passes the consumer's\n * `selectTool.resize.resizable` predicate). Absent predicate → resizable. */\nexport const resizable: Condition = cond({ resizable: true });\n\n/** Active action's kind matches `kind` (e.g. `actionIs('move')`). */\nexport const actionIs = (kind: string): Condition => cond({ actionIs: kind });\n\n// ─── Selection atoms ────────────────────────────────────────────────\n\n/** Nothing selected. */\nexport const selectionEmpty: Condition = cond({ selection: { empty: true } });\n\n/** Exactly `n` items selected. */\nexport const selectionIs = (n: number): Condition => cond({ selection: { is: n } });\n\n/** At least `n` items selected. `selectionAtLeast(1)` is the common\n * \"something is selected\" check. */\nexport const selectionAtLeast = (n: number): Condition => cond({ selection: { atLeast: n } });\n\n/** Multi-mode handle behavior active (single shared union-bounds\n * handle vs per-item handles). Implemented as a `when` because\n * `multiActive` is a derived single-call read on RuleCtx, not a\n * selector-table key. Stable; safe to introspect. */\nexport const multiActive: Condition = cond({ when: (c) => c.multiActive });\n\n// ─── Hover atoms ────────────────────────────────────────────────────\n\n/** Pointer is hovering some node. */\nexport const hovering: Condition = cond({ hovering: true });\n\n/** Pointer is hovering a node that is currently selected. */\nexport const hoveringSelected: Condition = cond({ hoveringSelected: true });\n\n// ─── Modifier atoms ─────────────────────────────────────────────────\n\n/** Named modifier key currently held. */\nexport const modifierHeld = (m: keyof ModifierState): Condition => cond({ modifierHeld: m });\n\n// ─── View atoms ─────────────────────────────────────────────────────\n\n/** View scale (uniform or geometric mean for non-uniform) is at least\n * `z`. Useful for \"hide hairline chrome at low zoom\" rules. */\nexport const zoomAtLeast = (z: number): Condition => cond({ zoomAtLeast: z });\n\n// ─── Mode + capability atoms (new) ─────────────────────────────────\n\n/** Active mode equals `m`. */\nexport const modeIs = (m: string): Condition => cond({ mode: m });\n\n/** Active mode is one of `modes`. */\nexport const modeIn = (modes: readonly string[]): Condition => cond({ mode: { in: modes } });\n\n/** Active mode is NOT `m`. */\nexport const modeNot = (m: string): Condition => cond({ mode: { not: m } });\n\n/** Active mode's `allows` includes capability `cap`. */\nexport const capabilityIs = (cap: string): Condition => cond({ capability: cap });\n\n/** Active mode's `allows` includes ANY of `caps` (OR). */\nexport const capabilityIn = (caps: readonly string[]): Condition => cond({ capability: { in: caps } });\n\n/** Active mode's `allows` includes ALL of `caps` (AND). */\nexport const capabilityAll = (caps: readonly string[]): Condition => cond({ capability: [...caps] });\n\n/** Active mode's `allows` does NOT include capability `cap`. */\nexport const capabilityNot = (cap: string): Condition => cond({ capability: { not: cap } });\n\n// ─── Device atoms ───────────────────────────────────────────────────\n\n/** Primary pointer is imprecise (touch, most styluses). Absent device\n * profile → false, so a rule written with this atom is inert on the\n * mouse-shaped default rather than silently flipping. */\nexport const coarsePointer: Condition = cond({ coarsePointer: true });\n\n/** Primary pointer can hover. Absent device profile → true. Pair with\n * `not(...)` to gate chrome that only makes sense with a hovering\n * pointer: `not(canHover)` is \"this device cannot hover\". */\nexport const canHover: Condition = cond({ canHover: true });\n"],"mappings":";;AAwBA,SAAgBA,EAAK,GAAuB;CAE1C,IAAMC,KADM,MAAiBC,EAASC,GAAMC,CAAG;CAO/C,OALA,EAA8B,OAAOD,GACrC,EAAU,OAAU,MAAUH,EAAKK,EAAWF,GAAMG,EAAOC,CAAK,CAAC,CAAC,GAClE,EAAU,MAAU,MAAUP,EAAKQ,EAAWL,GAAMG,EAAOC,CAAK,CAAC,CAAC,GAClE,EAAU,UAAU,MAAUP,EAAKK,EAAWF,GAAM,EAAE,KAAKG,EAAOC,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ctx","combineAll","asRule","other","combineAny","value","left","a","right","b","when","fn","and","cs","or","not","c","always","ALWAYS","never","NEVER","focused","gesturing","actionIs","kind","selectionEmpty","selectionIs","n","selectionAtLeast","multiActive","hovering","hoveringSelected","modifierHeld","m","zoomAtLeast","z","modeIs","modeIn","modes","modeNot","capabilityIs","cap","capabilityIn","caps","capabilityAll","capabilityNot","coarsePointer","canHover"],"sources":["../../../src/features/chrome-caps/conditions.ts"],"sourcesContent":["import type { Condition } from './types';\nimport type { Rule } from '@weasel-js/routing';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { evaluate, ALWAYS, NEVER } from '@weasel-js/routing';\nimport type { ModifierState } from '../../interactions/gestures/types';\n\n/**\n * Promote a Rule tree to a fluent Condition.\n *\n * **Chain semantics: strict left-to-right.** No boolean precedence.\n * `focused.or(hovering).and(selectionIs(1))` evaluates\n * `((focused || hovering) && selectionIs(1))`. For grouped disjunction, use\n * the top-level `or` / `and` / `not` helpers or name intermediates.\n *\n * Combinators flatten same-kind nesting on construction so `a.and(b).and(c)`\n * produces `{ all: [a, b, c] }`.\n */\nexport function cond(rule: Rule): Condition {\n const fn = (ctx: RuleCtx) => evaluate(rule, ctx);\n const condition = fn as Condition;\n (condition as { rule: Rule }).rule = rule;\n condition.and = (other) => cond(combineAll(rule, asRule(other)));\n condition.or = (other) => cond(combineAny(rule, asRule(other)));\n condition.andNot = (other) => cond(combineAll(rule, { not: asRule(other) }));\n condition.orNot = (other) => cond(combineAny(rule, { not: asRule(other) }));\n return condition;\n}\n\nfunction asRule(value: Condition | Rule): Rule {\n return typeof value === 'function' ? (value as Condition).rule : value;\n}\n\nfunction combineAll(a: Rule, b: Rule): Rule {\n const left = 'all' in a ? a.all : [a];\n const right = 'all' in b ? b.all : [b];\n return { all: [...left, ...right] };\n}\n\nfunction combineAny(a: Rule, b: Rule): Rule {\n const left = 'any' in a ? a.any : [a];\n const right = 'any' in b ? b.any : [b];\n return { any: [...left, ...right] };\n}\n\n/** Inline-lambda escape hatch. Wraps the closure as a `when` rule node. */\nexport function when(fn: (ctx: RuleCtx) => boolean): Condition {\n return cond({ when: fn });\n}\n\n// ─── Variadic helpers (for grouped expressions) ─────────────────────\n\n/** `(a && b && c && ...)` — useful when chain mixing makes left-to-right\n * semantics ambiguous. */\nexport function and(...cs: (Condition | Rule)[]): Condition {\n return cond({ all: cs.map(asRule) });\n}\n\n/** `(a || b || c || ...)` — preferred over `.or` chains when mixed with\n * `.and` to make grouping explicit. */\nexport function or(...cs: (Condition | Rule)[]): Condition {\n return cond({ any: cs.map(asRule) });\n}\n\n/** `!c` — top-level negation. Most rules use `.andNot()` / `.orNot()`\n * instead; this is for the lead-with-negation case. */\nexport function not(c: Condition | Rule): Condition {\n return cond({ not: asRule(c) });\n}\n\n// ─── Constant atoms ─────────────────────────────────────────────────\n\n/** Always true. The fallback for any chrome id without a registered rule. */\nexport const always: Condition = cond(ALWAYS);\n\n/** Always false. Useful for \"turn this chrome off entirely\":\n * `chromeVisibility={{ 'snap.guides': never }}`. */\nexport const never: Condition = cond(NEVER);\n\n// ─── Focus / action atoms ───────────────────────────────────────────\n\n/** Canvas surface currently focused. */\nexport const focused: Condition = cond({ focused: true });\n\n/** Any action currently in flight (read: user is gesturing). */\nexport const gesturing: Condition = cond({ gesturing: true });\n\n/** A path is currently in anchor-edit mode. */\nexport const editingAnchors: Condition = cond({ editingAnchors: true });\n\n/** Current selection is resizable (every selected node passes the consumer's\n * `selectTool.resize.resizable` predicate). Absent predicate → resizable. */\nexport const resizable: Condition = cond({ resizable: true });\n\n/** Active action's kind matches `kind` (e.g. `actionIs('move')`). */\nexport const actionIs = (kind: string): Condition => cond({ actionIs: kind });\n\n// ─── Selection atoms ────────────────────────────────────────────────\n\n/** Nothing selected. */\nexport const selectionEmpty: Condition = cond({ selection: { empty: true } });\n\n/** Exactly `n` items selected. */\nexport const selectionIs = (n: number): Condition => cond({ selection: { is: n } });\n\n/** At least `n` items selected. `selectionAtLeast(1)` is the common\n * \"something is selected\" check. */\nexport const selectionAtLeast = (n: number): Condition => cond({ selection: { atLeast: n } });\n\n/** Multi-mode handle behavior active (single shared union-bounds\n * handle vs per-item handles). */\nexport const multiActive: Condition = cond({ when: (c) => c.multiActive });\n\n// ─── Hover atoms ────────────────────────────────────────────────────\n\n/** Pointer is hovering some node. */\nexport const hovering: Condition = cond({ hovering: true });\n\n/** Pointer is hovering a node that is currently selected. */\nexport const hoveringSelected: Condition = cond({ hoveringSelected: true });\n\n// ─── Modifier atoms ─────────────────────────────────────────────────\n\n/** Named modifier key currently held. */\nexport const modifierHeld = (m: keyof ModifierState): Condition => cond({ modifierHeld: m });\n\n// ─── View atoms ─────────────────────────────────────────────────────\n\n/** View scale (uniform or geometric mean for non-uniform) is at least\n * `z`. Useful for \"hide hairline chrome at low zoom\" rules. */\nexport const zoomAtLeast = (z: number): Condition => cond({ zoomAtLeast: z });\n\n// ─── Mode + capability atoms ───────────────────────────────────────\n\n/** Active mode equals `m`. */\nexport const modeIs = (m: string): Condition => cond({ mode: m });\n\n/** Active mode is one of `modes`. */\nexport const modeIn = (modes: readonly string[]): Condition => cond({ mode: { in: modes } });\n\n/** Active mode is NOT `m`. */\nexport const modeNot = (m: string): Condition => cond({ mode: { not: m } });\n\n/** Active mode's `allows` includes capability `cap`. */\nexport const capabilityIs = (cap: string): Condition => cond({ capability: cap });\n\n/** Active mode's `allows` includes ANY of `caps` (OR). */\nexport const capabilityIn = (caps: readonly string[]): Condition => cond({ capability: { in: caps } });\n\n/** Active mode's `allows` includes ALL of `caps` (AND). */\nexport const capabilityAll = (caps: readonly string[]): Condition => cond({ capability: [...caps] });\n\n/** Active mode's `allows` does NOT include capability `cap`. */\nexport const capabilityNot = (cap: string): Condition => cond({ capability: { not: cap } });\n\n// ─── Device atoms ───────────────────────────────────────────────────\n\n/** Primary pointer is imprecise (touch, most styluses). Absent device\n * profile → false. */\nexport const coarsePointer: Condition = cond({ coarsePointer: true });\n\n/** Primary pointer can hover. Absent device profile → true. */\nexport const canH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EAAE,YAAY,EAAE,IAAI+C,EAAK,EAAE,CAAC,GAGxFC,KAAiB,MAAuChD,EAAK,EAAE,YAAY,CAAC,GAAG+C,CAAI,EAAE,CAAC,GAGtFE,KAAiB,MAA2BjD,EAAK,EAAE,YAAY,EAAE,KAAK6C,EAAI,EAAE,CAAC,GAM7EK,IAA2BlD,EAAK,EAAE,eAAe,GAAK,CAAC,GAGvDmD,IAAsBnD,EAAK,EAAE,UAAU,GAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":["defaultVisibilityRules"],"sources":["../../../src/features/chrome-caps/defaults.ts"],"sourcesContent":["import type { VisibilityRules } from './types';\nimport type { Rule } from '@weasel-js/routing';\n\n/**\n * Kit-shipped defaults. Merged with the consumer's `chromeVisibility` map\n * at resolve time; consumer entries take precedence per id.\n *\n *
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["defaultVisibilityRules"],"sources":["../../../src/features/chrome-caps/defaults.ts"],"sourcesContent":["import type { VisibilityRules } from './types';\nimport type { Rule } from '@weasel-js/routing';\n\n/**\n * Kit-shipped defaults. Merged with the consumer's `chromeVisibility` map\n * at resolve time; consumer entries take precedence per id.\n *\n * Gating is written in terms of **capabilities, not mode ids**. A\n * capability rule keeps holding when a new mode is added that permits the\n * same thing; a mode rule has to be found and edited every time.\n */\nexport const defaultVisibilityRules: VisibilityRules = {\n // Off whenever an anchor-editing overlay has taken over the visuals.\n 'selection.outline': {\n all: [\n { selection: { atLeast: 1 } },\n { capability: { not: 'edits-anchors' } },\n ],\n } as Rule,\n\n // Handles hide during an action so the moving / resizing object isn't\n // visually crowded; they reappear on commit.\n 'selection.resize-handles': {\n all: [\n { selection: { atLeast: 1 } },\n { not: { gesturing: true } },\n { capability: 'transforms-selection' },\n { resizable: true },\n ],\n } as Rule,\n\n 'selection.rotation-handle': {\n all: [\n { selection: { atLeast: 1 } },\n { focused: true },\n { not: { gesturing: true } },\n { capability: 'transforms-selection' },\n ],\n } as Rule,\n\n // Transient action chrome — only shown during the matching action.\n 'action.marquee': { actionIs: 'marquee' } as Rule,\n 'action.lasso': { actionIs: 'lasso' } as Rule,\n 'action.move-ghosts': { actionIs: 'move' } as Rule,\n\n // Path-edit chrome — gated on there actually being an edited path, not on\n // `{ mode: 'path-edit' }`: consumers with no mode registry report mode\n // `'normal'`, and one defining its own anchor-editing mode uses another id.\n // A state selector rather than a `capability:` one on purpose: the\n // capability says the user *may* edit anchors, which is not the same as\n // a path *being* edited.\n 'path-edit.anchors': { editingAnchors: true } as Rule,\n 'path-edit.overlay': { editingAnchors: true } as Rule,\n\n // Snap system — guides during any action; targets consumer-driven for now.\n 'snap.guides': { gesturing: true } as Rule,\n // 'snap.targets' — no default; consumer-driven for now.\n\n // 'grid' / 'debug.*' — no default; visibility is driven by dedicated\n // boolean props on <SceneCanvas>.\n};\n"],"mappings":";AAWA,IAAaA,IAA0C;CAErD,qBAAqB,EACnB,KAAK,CACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,GAC5B,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,CACzC,EACF;CAIA,4BAA4B,EAC1B,KAAK;EACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;EAC5B,EAAE,KAAK,EAAE,WAAW,GAAK,EAAE;EAC3B,EAAE,YAAY,uBAAuB;EACrC,EAAE,WAAW,GAAK;CACpB,EACF;CAEA,6BAA6B,EAC3B,KAAK;EACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;EAC5B,EAAE,SAAS,GAAK;EAChB,EAAE,KAAK,EAAE,WAAW,GAAK,EAAE;EAC3B,EAAE,YAAY,uBAAuB;CACvC,EACF;CAGA,kBAAsB,EAAE,UAAU,UAAU;CAC5C,gBAAsB,EAAE,UAAU,QAAQ;CAC1C,sBAAsB,EAAE,UAAU,OAAO;CAQzC,qBAAqB,EAAE,gBAAgB,GAAK;CAC5C,qBAAqB,EAAE,gBAAgB,GAAK;CAG5C,eAAe,EAAE,WAAW,GAAK;AAKnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","names":["resolveVisibility","merged","consumer","defaultVisibilityRules","ruleCtx","ctx","viewZoom","DEFAULT_ALLOWED_CAPABILITIES","entry","id","evaluate"],"sources":["../../../src/features/chrome-caps/resolve.ts"],"sourcesContent":["import type { ChromeCtx, ChromeId, VisibilityRules } from './types';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { DEFAULT_ALLOWED_CAPABILITIES } from '@weasel-js/routing';\nimport { evaluate } from '@weasel-js/routing';\nimport { defaultVisibilityRules } from './defaults';\nimport { viewZoom } from 'core/viewport/view';\n\n/**\n * Build the per-frame visibility check
|
|
1
|
+
{"version":3,"file":"resolve.js","names":["resolveVisibility","merged","consumer","defaultVisibilityRules","ruleCtx","ctx","viewZoom","DEFAULT_ALLOWED_CAPABILITIES","entry","id","evaluate"],"sources":["../../../src/features/chrome-caps/resolve.ts"],"sourcesContent":["import type { ChromeCtx, ChromeId, VisibilityRules } from './types';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { DEFAULT_ALLOWED_CAPABILITIES } from '@weasel-js/routing';\nimport { evaluate } from '@weasel-js/routing';\nimport { defaultVisibilityRules } from './defaults';\nimport { viewZoom } from 'core/viewport/view';\n\n/**\n * Build the per-frame visibility check: consumer rules merged on top of\n * the kit defaults, evaluated against `ctx`.\n *\n * `ChromeCtx` is the legacy shape; surfaces still on it get `mode='normal'`\n * and `DEFAULT_ALLOWED_CAPABILITIES` filled in here, so a caller that never\n * opted into modality behaves exactly like one sitting in normal mode.\n */\nexport function resolveVisibility(\n consumer: VisibilityRules | undefined,\n ctx: ChromeCtx | RuleCtx,\n): (id: ChromeId) => boolean {\n const merged: VisibilityRules = consumer\n ? { ...defaultVisibilityRules, ...consumer }\n : defaultVisibilityRules;\n const ruleCtx: RuleCtx = 'mode' in ctx\n ? ctx\n : {\n ...ctx,\n zoom: viewZoom(ctx.view),\n mode: 'normal',\n allowedCapabilities: DEFAULT_ALLOWED_CAPABILITIES,\n };\n return (id) => {\n const entry = merged[id];\n if (entry === undefined) return true;\n if (typeof entry === 'function') return entry(ruleCtx);\n return evaluate(entry, ruleCtx);\n };\n}\n"],"mappings":";;;;AAeA,SAAgBA,EACd,GACA,GAC2B;CAC3B,IAAMC,IAA0BC,IAC5B;EAAE,GAAGC;EAAwB,GAAGD;CAAS,IACzCC,GACEC,IAAmB,UAAUC,IAC/BA,IACA;EACA,GAAGA;EACH,MAAMC,EAASD,EAAI,IAAI;EACvB,MAAM;EACN,qBAAqBE;CACvB;CACF,QAAQ,MAAO;EACb,IAAMC,IAAQP,EAAOQ;EAGrB,OAFID,MAAU,KAAA,IAAkB,KAC5B,OAAOA,KAAU,aAAmBA,EAAMJ,CAAO,IAC9CM,EAASF,GAAOJ,CAAO;CAChC;AACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { viewZoom as e } from "../../core/viewport/view.js";
|
|
2
|
+
import { resolveVisibility as t } from "./resolve.js";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
import { useLatest as r } from "@weasel-js/react";
|
|
5
|
+
import { DEFAULT_ALLOWED_CAPABILITIES as i, buildRuleCtx as a } from "@weasel-js/routing";
|
|
6
|
+
//#region src/features/chrome-caps/useChromeCaps.ts
|
|
7
|
+
var o = {
|
|
8
|
+
alt: !1,
|
|
9
|
+
ctrl: !1,
|
|
10
|
+
meta: !1,
|
|
11
|
+
shift: !1
|
|
12
|
+
};
|
|
13
|
+
function s(t, n) {
|
|
14
|
+
let { resizable: r } = t;
|
|
15
|
+
return a({
|
|
16
|
+
focused: t.focused,
|
|
17
|
+
selection: n.selection,
|
|
18
|
+
multiActive: n.selection.length > 1,
|
|
19
|
+
modifiers: t.modifiers ?? o,
|
|
20
|
+
action: n.action,
|
|
21
|
+
hover: t.hover,
|
|
22
|
+
zoom: e(n.view),
|
|
23
|
+
mode: t.mode?.id ?? "normal",
|
|
24
|
+
allowedCapabilities: t.mode?.allowedCapabilities ?? i,
|
|
25
|
+
selectionResizable: r ? n.selection.every((e) => r(e)) : void 0,
|
|
26
|
+
editingAnchors: t.editingAnchors,
|
|
27
|
+
device: t.device
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function c(e) {
|
|
31
|
+
let i = r(e);
|
|
32
|
+
return n(() => {
|
|
33
|
+
let e = (e) => {
|
|
34
|
+
let t = i.current;
|
|
35
|
+
return s({
|
|
36
|
+
focused: !t.getFocused || t.getFocused(),
|
|
37
|
+
modifiers: t.getModifiers?.(),
|
|
38
|
+
hover: t.getHover(),
|
|
39
|
+
mode: t.getMode?.(),
|
|
40
|
+
resizable: t.resizable,
|
|
41
|
+
editingAnchors: t.editingAnchors(),
|
|
42
|
+
device: t.device
|
|
43
|
+
}, e);
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
ruleCtx: (t) => i.current.getMode ? e(t) : void 0,
|
|
47
|
+
isVisible: (n) => t(i.current.rules, e(n))
|
|
48
|
+
};
|
|
49
|
+
}, [i]);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { s as surfaceRuleCtx, c as useChromeCaps };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=useChromeCaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChromeCaps.js","names":["NO_MODIFIERS","surfaceRuleCtx","surface","buildRuleCtx","view","viewZoom","DEFAULT_ALLOWED_CAPABILITIES","resizable","id","useChromeCaps","live","useLatest","source","useMemo","build","now","inputs","resolveVisibility"],"sources":["../../../src/features/chrome-caps/useChromeCaps.ts"],"sourcesContent":["/**\n * The rule context a surface's chrome-visibility rules and action eligibility\n * are evaluated against, and the hook that keeps one for `<SceneCanvas>`.\n */\nimport { useMemo } from 'react';\nimport type { ActiveMode } from '@weasel-js/modes';\nimport { useLatest } from '@weasel-js/react';\nimport {\n buildRuleCtx,\n DEFAULT_ALLOWED_CAPABILITIES,\n type DeviceProfile,\n type ModifierState,\n type RuleCtx,\n} from '@weasel-js/routing';\nimport type { NodeId } from '../../core/scene/types';\nimport { viewZoom, type View } from '../../core/viewport/view';\nimport { resolveVisibility } from './resolve';\nimport type { VisibilityRules } from './types';\n\n/**\n * The part of a rule context that belongs to one view. Everything else a\n * `RuleCtx` carries — mode, capabilities, device, focus — is the surface's and\n * the same for every view drawn on it.\n */\nexport interface ViewRuleInputs {\n selection: readonly NodeId[];\n view: View;\n /** What that view's dispatcher currently has in flight. */\n action: { kind: string | null; id: string | null };\n}\n\n/** The part of a rule context that belongs to the surface. */\nexport interface SurfaceRuleInputs {\n focused: boolean;\n /** The modifier keys held. Absent means none, so `modifierHeld` never matches. */\n modifiers?: ModifierState | undefined;\n hover: NodeId | null;\n /** Absent on a surface with no mode registry, which behaves as normal mode. */\n mode: ActiveMode | undefined;\n /** Whether one node may be resized. Absent means every node may. */\n resizable: ((id: string) => boolean) | undefined;\n editingAnchors: boolean;\n device: DeviceProfile;\n}\n\nconst NO_MODIFIERS = { alt: false, ctrl: false, meta: false, shift: false };\n\n/** One view's rule context on a surface. */\nexport function surfaceRuleCtx(surface: SurfaceRuleInputs, view: ViewRuleInputs): RuleCtx {\n const { resizable } = surface;\n return buildRuleCtx({\n focused: surface.focused,\n selection: view.selection,\n multiActive: view.selection.length > 1,\n modifiers: surface.modifiers ?? NO_MODIFIERS,\n action: view.action,\n hover: surface.hover,\n zoom: viewZoom(view.view),\n mode: surface.mode?.id ?? 'normal',\n // An empty set would make every `capability:` rule false and hide the\n // chrome those rules gate.\n allowedCapabilities: surface.mode?.allowedCapabilities ?? DEFAULT_ALLOWED_CAPABILITIES,\n // Left undefined without a predicate, which `resizable:` reads as resizable.\n selectionResizable: resizable ? view.selection.every((id) => resizable(id)) : undefined,\n editingAnchors: surface.editingAnchors,\n device: surface.device,\n });\n}\n\n/** Where a surface's rule context comes from. Read at the moment a rule is\n * evaluated, never at render. */\nexport interface ChromeCapsSource {\n /** The surface's rule table, over the kit defaults. */\n rules: VisibilityRules | undefined;\n /** The active mode. Absent when no mode registry is wired. */\n getMode: (() => ActiveMode) | undefined;\n /** Absent means the surface always counts as focused. */\n getFocused: (() => boolean) | undefined;\n getHover: () => NodeId | null;\n /** Absent means no modifier key ever counts as held. */\n getModifiers?: (() => ModifierState) | undefined;\n resizable: ((id: string) => boolean) | undefined;\n editingAnchors: () => boolean;\n device: DeviceProfile;\n}\n\n/**\n * A surface's chrome-caps answers for one view. The rules are surface-wide on\n * purpose — one consumer table, one set of kit defaults — but a rule keyed on\n * selection, camera or the in-flight action answers differently per view, so\n * the caller supplies that part and both the paint gate and the dispatcher's\n * eligibility filter read the same context.\n */\nexport interface ChromeCaps {\n /** `undefined` when the surface gates nothing: no mode registry is wired. */\n ruleCtx(inputs: ViewRuleInputs): RuleCtx | undefined;\n isVisible(inputs: ViewRuleInputs): (id: string) => boolean;\n}\n\n/** The chrome-caps answers for a surface. The object keeps its identity for\n * the life of the component and reads `source` as of the last commit. */\nexport function useChromeCaps(source: ChromeCapsSource): ChromeCaps {\n const live = useLatest(source);\n return useMemo(() => {\n const build = (inputs: ViewRuleInputs): RuleCtx => {\n const now = live.current;\n return surfaceRuleCtx({\n focused: now.getFocused ? now.getFocused() : true,\n modifiers: now.getModifiers?.(),\n hover: now.getHover(),\n mode: now.getMode?.(),\n resizable: now.resizable,\n editingAnchors: now.editingAnchors(),\n device: now.device,\n }, inputs);\n };\n return {\n ruleCtx: (inputs) => (live.current.getMode ? build(inputs) : undefined),\n isVisible: (inputs) => resolveVisibility(live.current.rules, build(inputs)),\n };\n }, [live]);\n}\n"],"mappings":";;;;;;AA6CA,IAAMA,IAAe;CAAE,KAAK;CAAO,MAAM;CAAO,MAAM;CAAO,OAAO;AAAM;AAG1E,SAAgBC,EAAe,GAA4B,GAA+B;CACxF,IAAM,EAAE,iBAAcC;CACtB,OAAOC,EAAa;EAClB,SAASD,EAAQ;EACjB,WAAWE,EAAK;EAChB,aAAaA,EAAK,UAAU,SAAS;EACrC,WAAWF,EAAQ,aAAaF;EAChC,QAAQI,EAAK;EACb,OAAOF,EAAQ;EACf,MAAMG,EAASD,EAAK,IAAI;EACxB,MAAMF,EAAQ,MAAM,MAAM;EAG1B,qBAAqBA,EAAQ,MAAM,uBAAuBI;EAE1D,oBAAoBC,IAAYH,EAAK,UAAU,OAAO,MAAOG,EAAUC,CAAE,CAAC,IAAI,KAAA;EAC9E,gBAAgBN,EAAQ;EACxB,QAAQA,EAAQ;CAClB,CAAC;AACH;AAkCA,SAAgBO,EAAc,GAAsC;CAClE,IAAMC,IAAOC,EAAUC,CAAM;CAC7B,OAAOC,QAAc;EACnB,IAAMC,KAAS,MAAoC;GACjD,IAAMC,IAAML,EAAK;GACjB,OAAOT,EAAe;IACpB,SAAS,GAAI,cAAac,EAAI,WAAW;IACzC,WAAWA,EAAI,eAAe;IAC9B,OAAOA,EAAI,SAAS;IACpB,MAAMA,EAAI,UAAU;IACpB,WAAWA,EAAI;IACf,gBAAgBA,EAAI,eAAe;IACnC,QAAQA,EAAI;GACd,GAAGC,CAAM;EACX;EACA,OAAO;GACL,UAAU,MAAYN,EAAK,QAAQ,UAAUI,EAAME,CAAM,IAAI,KAAA;GAC7D,YAAY,MAAWC,EAAkBP,EAAK,QAAQ,OAAOI,EAAME,CAAM,CAAC;EAC5E;CACF,GAAG,CAACN,CAAI,CAAC;AACX"}
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useLatest as
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n, useRef as r } from "react";
|
|
2
|
+
import { useLatest as i } from "@weasel-js/react";
|
|
3
3
|
//#region src/features/chrome-caps/useHoverTracking.ts
|
|
4
|
-
function
|
|
5
|
-
let {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (!e) return;
|
|
4
|
+
function a(a) {
|
|
5
|
+
let { nodeAtClientPoint: o, enabled: s = !0 } = a, c = r(null), l = i(o), u = r(null), d = r(s), f = r(null), p = e(() => {
|
|
6
|
+
f.current?.(), f.current = null, c.current = null;
|
|
7
|
+
let e = u.current;
|
|
8
|
+
if (!e || !d.current) return;
|
|
10
9
|
let t = (e) => {
|
|
11
|
-
|
|
10
|
+
c.current = l.current(e.clientX, e.clientY)?.id ?? null;
|
|
12
11
|
}, n = () => {
|
|
13
|
-
|
|
12
|
+
c.current = null;
|
|
14
13
|
};
|
|
15
|
-
|
|
14
|
+
e.addEventListener("pointermove", t), e.addEventListener("pointerleave", n), f.current = () => {
|
|
16
15
|
e.removeEventListener("pointermove", t), e.removeEventListener("pointerleave", n);
|
|
17
16
|
};
|
|
18
|
-
}, [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
}, [l]);
|
|
18
|
+
t(() => (d.current = s, p(), () => {
|
|
19
|
+
f.current?.(), f.current = null, c.current = null;
|
|
20
|
+
}), [s, p]);
|
|
21
|
+
let m = e((e) => {
|
|
22
|
+
u.current !== e && (u.current = e, p());
|
|
23
|
+
}, [p]), h = e(() => c.current, []);
|
|
24
|
+
return n(() => ({
|
|
25
|
+
getHover: h,
|
|
26
|
+
canvasRef: m
|
|
27
|
+
}), [h, m]);
|
|
23
28
|
}
|
|
24
29
|
//#endregion
|
|
25
|
-
export {
|
|
30
|
+
export { a as useHoverTracking };
|
|
26
31
|
|
|
27
32
|
//# sourceMappingURL=useHoverTracking.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHoverTracking.js","names":["useHoverTracking","args","hoverRef","useRef","nodeAtRef","useLatest","nodeAtClientPoint","
|
|
1
|
+
{"version":3,"file":"useHoverTracking.js","names":["useHoverTracking","args","hoverRef","useRef","nodeAtRef","useLatest","nodeAtClientPoint","elementRef","enabledRef","enabled","detachRef","sync","useCallback","el","onMove","onLeave","canvasRef","element","getHover","useMemo"],"sources":["../../../src/features/chrome-caps/useHoverTracking.ts"],"sourcesContent":["/** Last-hovered NodeId for chrome-caps rules. */\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { NodeId } from '../../core/scene/types';\n\n/** Options for `useHoverTracking`. */\nexport interface UseHoverTrackingArgs {\n /** Topmost id under a client point, or null. */\n nodeAtClientPoint: (clientX: number, clientY: number) => { id: NodeId } | null;\n enabled?: boolean;\n}\n\n/** What `useHoverTracking` returns. Both members keep their identity. */\nexport interface HoverTracking {\n /** The node the pointer is over, or null. */\n getHover: () => NodeId | null;\n /** Hand it the element to track, or null to stop: a callback ref, so an\n * element that mounts after the hook is tracked from the moment it arrives. */\n canvasRef: (element: HTMLElement | null) => void;\n}\n\n/** Track which node the pointer is over. Returns a getter rather than state,\n * so a pointer move does not re-render the component. Cleared on\n * `pointerleave`. */\nexport function useHoverTracking(args: UseHoverTrackingArgs): HoverTracking {\n const { nodeAtClientPoint, enabled = true } = args;\n const hoverRef = useRef<NodeId | null>(null);\n const nodeAtRef = useLatest(nodeAtClientPoint);\n const elementRef = useRef<HTMLElement | null>(null);\n const enabledRef = useRef(enabled);\n const detachRef = useRef<(() => void) | null>(null);\n\n const sync = useCallback(() => {\n detachRef.current?.();\n detachRef.current = null;\n hoverRef.current = null;\n const el = elementRef.current;\n if (!el || !enabledRef.current) return;\n const onMove = (e: PointerEvent) => {\n hoverRef.current = nodeAtRef.current(e.clientX, e.clientY)?.id ?? null;\n };\n const onLeave = () => { hoverRef.current = null; };\n el.addEventListener('pointermove', onMove);\n el.addEventListener('pointerleave', onLeave);\n detachRef.current = () => {\n el.removeEventListener('pointermove', onMove);\n el.removeEventListener('pointerleave', onLeave);\n };\n }, [nodeAtRef]);\n\n useEffect(() => {\n enabledRef.current = enabled;\n sync();\n return () => {\n detachRef.current?.();\n detachRef.current = null;\n hoverRef.current = null;\n };\n }, [enabled, sync]);\n\n const canvasRef = useCallback((element: HTMLElement | null) => {\n if (elementRef.current === element) return;\n elementRef.current = element;\n sync();\n }, [sync]);\n const getHover = useCallback(() => hoverRef.current, []);\n\n return useMemo(() => ({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
2
|
-
import {
|
|
2
|
+
import { UNKNOWN_MIME as t, mimeMatchesGlob as n } from "@weasel-js/gestures";
|
|
3
3
|
//#region src/features/ingestion/contentHandlers.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
let t =
|
|
8
|
-
t >= 0 &&
|
|
4
|
+
var r = [];
|
|
5
|
+
function i(e) {
|
|
6
|
+
return r.push(e), () => {
|
|
7
|
+
let t = r.indexOf(e);
|
|
8
|
+
t >= 0 && r.splice(t, 1);
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return [...
|
|
11
|
+
function a(e) {
|
|
12
|
+
return [...e].sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function o() {
|
|
15
|
+
return a(r);
|
|
16
|
+
}
|
|
17
|
+
function s(e, t) {
|
|
15
18
|
let { match: r } = e;
|
|
16
19
|
if (typeof r == "function") try {
|
|
17
|
-
return r(
|
|
20
|
+
return r(t);
|
|
18
21
|
} catch (t) {
|
|
19
22
|
return console.warn(`weasel ingest: handler "${e.id}" match predicate threw`, t), !1;
|
|
20
23
|
}
|
|
21
|
-
return (Array.isArray(r) ? r : [r]).some((e) => t
|
|
24
|
+
return (Array.isArray(r) ? r : [r]).some((e) => n(t.mime, e));
|
|
25
|
+
}
|
|
26
|
+
function c(e, i = r) {
|
|
27
|
+
return e.some((e) => e.kind === void 0 ? e.mime === t || i.some((t) => {
|
|
28
|
+
let r = typeof t.match == "function" ? t.types : [t.match].flat();
|
|
29
|
+
return r === void 0 || r.some((t) => n(e.mime, t));
|
|
30
|
+
}) : i.some((t) => s(t, e)));
|
|
22
31
|
}
|
|
23
|
-
async function
|
|
24
|
-
let
|
|
25
|
-
for (let e of
|
|
26
|
-
if (
|
|
27
|
-
let t =
|
|
28
|
-
t.length !== 0 && (
|
|
32
|
+
async function l(t, n, r = {}) {
|
|
33
|
+
let i = t, c = [], l = r.handlers ? a(r.handlers) : o();
|
|
34
|
+
for (let e of l) {
|
|
35
|
+
if (i.length === 0) break;
|
|
36
|
+
let t = i.filter((t) => s(e, t));
|
|
37
|
+
t.length !== 0 && (i = i.filter((e) => !t.includes(e)), c.push(Promise.resolve().then(() => e.handle(t, n)).catch((t) => {
|
|
29
38
|
console.warn(`weasel ingest: handler "${e.id}" threw`, t);
|
|
30
39
|
})));
|
|
31
40
|
}
|
|
32
|
-
|
|
41
|
+
i.length > 0 && e("ingest", `no content handler matched ${i.length} item(s):`, i.map((e) => e.mime).join(", ")), await Promise.all(c);
|
|
33
42
|
}
|
|
34
43
|
//#endregion
|
|
35
|
-
export {
|
|
44
|
+
export { c as couldClaim, o as getContentHandlers, i as registerContentHandler, l as runIngest };
|
|
36
45
|
|
|
37
46
|
//# sourceMappingURL=contentHandlers.js.map
|