@weasel-js/core 1.9.4 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +750 -0
- package/README.md +5 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -83
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +3 -2
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +54 -100
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +5 -4
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +48 -136
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +8 -7
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -31
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +35 -39
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +12 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +42 -36
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +41 -51
- package/dist/canvas/Canvas.js +281 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +169 -188
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +22 -23
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +39 -56
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +28 -29
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +51 -54
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +40 -29
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +73 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js +15 -14
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +39 -37
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +76 -80
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +303 -707
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +41 -47
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +81 -61
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +40 -44
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +12 -12
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +49 -68
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +65 -54
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +44 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +8 -8
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +43 -41
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +2 -6
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +10 -10
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +34 -23
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +23 -22
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +6 -6
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +16 -16
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/textPainter.js +1 -1
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +6 -8
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickWalk.js +52 -50
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +1 -3
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +12 -12
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -83
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -132
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +1 -1
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +36 -35
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +23 -11
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +46 -37
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useFrameLoop.js +11 -12
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +42 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +25 -27
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-2a5hVbBd.d.ts} +122 -77
- package/dist/clone.d.ts +4 -8
- package/dist/clone.js +0 -2
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +13 -13
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +61 -14
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +35 -37
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +4 -5
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +1 -1
- package/dist/core/layers/children.js.map +1 -0
- package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/ops/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +103 -92
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +65 -64
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/{features/groups → core/scene}/composePose.js +18 -18
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +38 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +116 -70
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +83 -71
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +105 -12
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +9 -9
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +72 -71
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +66 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -36
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +3 -2
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/scene.js +81 -690
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +90 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +8 -5
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +8 -8
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +7 -7
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +100 -100
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +25 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +5 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +47 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -16
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +42 -55
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +170 -178
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +95 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +4507 -8459
- package/dist/index.js +275 -320
- package/dist/input/keyState.js +14 -14
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +23 -23
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +69 -78
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +98 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +41 -43
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +19 -19
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +35 -40
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +19 -15
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +14 -15
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +30 -31
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +9 -3
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +20 -22
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +19 -21
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +1 -1
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +72 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +48 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/move/action.js +87 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +24 -23
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +59 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +15 -40
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +8 -8
- package/dist/interactions/actions/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +17 -64
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +26 -26
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +55 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +74 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +56 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +77 -72
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.js.map +1 -1
- package/dist/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -2
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +6 -4
- package/dist/{originProjection-gHnOup4e.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
- package/dist/renderer.d.ts +1 -92
- package/dist/renderer.js +2 -19
- package/dist/resize.d.ts +11 -22
- package/dist/resize.js +1 -1
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +161 -163
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +4 -4
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +43 -71
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +67 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +8 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +20 -14
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-k-5Oqh-U.d.ts → types-CIKDwlsP.d.ts} +84 -164
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -60
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -146
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -114
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -125
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -79
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -388
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
- package/dist/builtins-DPcdghtB.d.ts +0 -1223
- package/dist/canvas/MinimapCanvas.js +0 -140
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -82
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -94
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseFrame.js +0 -44
- package/dist/core/geometry/poseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/scene/pickability.js +0 -6
- package/dist/core/scene/pickability.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -104
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -239
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -85
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -22
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -167
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -159
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -149
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/strokeToPath.js +0 -40
- package/dist/features/paths/strokeToPath.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/commandPaint.js +0 -18
- package/dist/features/patterns/commandPaint.js.map +0 -1
- package/dist/features/patterns/index.js +0 -11
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/rasterizeTile.js +0 -17
- package/dist/features/patterns/rasterizeTile.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -65
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -51
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domOffsets.js +0 -82
- package/dist/features/text/domOffsets.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -230
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -48
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/isTextData.js +0 -8
- package/dist/features/text/isTextData.js.map +0 -1
- package/dist/features/text/overlayDirection.js +0 -15
- package/dist/features/text/overlayDirection.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -133
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -60
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -491
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -65
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -91
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -125
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -287
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -778
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -341
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -185
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/math-J-ACHyEg.d.ts +0 -159
- package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -333
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -74
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -68
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw/batch.js +0 -133
- package/dist/renderer/draw/batch.js.map +0 -1
- package/dist/renderer/draw/clip.js +0 -89
- package/dist/renderer/draw/clip.js.map +0 -1
- package/dist/renderer/draw/customShader.js +0 -230
- package/dist/renderer/draw/customShader.js.map +0 -1
- package/dist/renderer/draw/drawTriangles.js +0 -8
- package/dist/renderer/draw/drawTriangles.js.map +0 -1
- package/dist/renderer/draw/effects.js +0 -28
- package/dist/renderer/draw/effects.js.map +0 -1
- package/dist/renderer/draw/flushBatch.js +0 -35
- package/dist/renderer/draw/flushBatch.js.map +0 -1
- package/dist/renderer/draw/gradient.js +0 -90
- package/dist/renderer/draw/gradient.js.map +0 -1
- package/dist/renderer/draw/image.js +0 -38
- package/dist/renderer/draw/image.js.map +0 -1
- package/dist/renderer/draw/mesh.js +0 -16
- package/dist/renderer/draw/mesh.js.map +0 -1
- package/dist/renderer/draw/paintBind.js +0 -70
- package/dist/renderer/draw/paintBind.js.map +0 -1
- package/dist/renderer/draw/pathPaint.js +0 -142
- package/dist/renderer/draw/pathPaint.js.map +0 -1
- package/dist/renderer/draw/scratchPass.js +0 -83
- package/dist/renderer/draw/scratchPass.js.map +0 -1
- package/dist/renderer/draw/stencil.js +0 -28
- package/dist/renderer/draw/stencil.js.map +0 -1
- package/dist/renderer/draw/text.js +0 -167
- package/dist/renderer/draw/text.js.map +0 -1
- package/dist/renderer/draw/uniforms.js +0 -77
- package/dist/renderer/draw/uniforms.js.map +0 -1
- package/dist/renderer/draw.js +0 -79
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -48
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -11
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/math/color.js +0 -321
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -80
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -31
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -14
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -25
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -34
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-DM2B87-g.d.ts +0 -356
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.js","names":["clientToWorldHelper","_Fragment","alwaysVisible","resolveToolsCursor","id","tools","tool","resolveCursorTier","ctxBase","base","NO_LAYER_VISIBILITY","toWorld","override","canvas","clientX","clientY","clientToWorld","view","CanvasInner","dprProp","adapterProp","layersMap","geometry","AUTO_POSE_DESCRIPTOR","viewProp","debugProp","props","debugKey","resolvedDebugConfig","useMemo","parseDebugFlags","debugSink","createDebugSink","committedDebugSinkRef","useLatest","getDebug","useCallback","adapter","canvasRef","useRef","ownCanvasRef","setOwnCanvas","el","detached","paintInto","inputElement","paintTarget","paintTargetRef","paintRect","paintRectRef","helpersForLayersRef","dimsRef","getIsVisibleRef","getIsVisible","layerVisibilityRef","layerVisibility","layerOrderRef","layerOrder","paintRef","useFrameLoop","contentVersionRef","contentVersion","paintedVersionRef","getPaintedVersion","extrasVersion","setExtrasVersion","useState","extrasRef","registerLayer","layer","n","hitTestExtrasIn","layers","isVisible","visibility","order","only","isLayerPainted","hit","worldX","worldY","data","dims","useCanvasView","hitTestExtras","frame","viewRef","element","registerMountedCanvas","getView","paintedCursor","createPaintedCursorState","paintedCursorLayer","createPaintedCursorLayer","requestRedraw","getSurfaceRect","origin","w","h","ref","subscribeFrame","subscribeBeforePaint","subscribeResume","setView","subscribeView","lease","useCanvasRenderer","useRedrawOnRestore","useRedrawOnDensityChange","layerCacheRef","viewRegistry","useOptionalViewRegistry","noopAdapter","effectiveAdapter","noopSelection","effectiveSelection","selection","effectiveAdapterRef","clientToWorldRef","toolsCtxBase","controlledView","c","rect","ops","label","pickEveryRef","pickEvery","pickBestRef","pickBest","stablePickEveryForHud","pe","raw","wx","wy","stablePickBestForHud","toWorldForHud","selectedIdsForWiring","viewHelpers","viewChromeState","useViewHelpers","surfaceHelpers","helpersForLayers","pointerDownRef","backgroundLayer","backgroundFill","fill","commandFill","sceneLayersKey","syncSceneLayers","useSceneLayerList","standardLayers","grid","isCustomEntry","cellHighlight","sceneCfg","sceneLayers","buildSceneLayers","effectiveBoundsOf","ids","aggregatePreviewIds","extra","previewExtraRef","selSlot","cfg","createSelectionOverlayLayer","out","composeOrderedLayers","decorationLayer","placeToolOverlays","viewRegistryVersion","useSyncExternalStore","cb","surfaceLayersRef","r","x","y","layersWithDebug","withViews","createDebugOverlayLayer","useEffect","redraw","offs","off","useRedrawOn","redrawOn","shaderIdKey","shaders","paintInputs","paintInputsRef","useInsertionEffect","adoptControlled","helpersRef","debugSinkRef","useLayoutEffect","paint","paintLayers","sink","dprIn","vis","paintFlattenTolerance","groups","paintShaders","i","renderer","spans","frameStats","paintT0","commands","drawLayers","viewToMat3","frameStatsOf","width","height","flattenTolerance","layerGroups","syncPaint","layerCache","clearSubscribers","seen","getProgramSource","programSourceRegistry","now","changed","src","toolsCursorTier","toolsCursor","effectiveStyle","style","toolsPainted","toolsPaintedKey","layersForMoveRef","press","autoFocusOnPointerDown","release","hover","e","leave","onDown","onMove","onUp","onLeave","onMenu","huds","Fragment","cursorCoordsHud","CursorCoordsHud","pickHud","PickHud","modalityHud","ModalityHud","Canvas","forwardRef"],"sources":["../../src/canvas/Canvas.tsx"],"sourcesContent":["/**\n * Low-level WebGL surface + viewport + pointer routing primitive.\n * Composes layers into a single GL render pass, applies a view transform,\n * routes pointer/keyboard events to the supplied `tools.dispatcher`, and\n * exposes scene-agnostic slot props (`backgroundFill`, `cursorCoordsHud`,\n * `pickHud`).\n *\n * Canvas owns NO scene-shaped state — selection, picking, kind registry,\n * scene-aware overlays — all live in `<SceneCanvas>` (the public consumer\n * entry point) which wraps `<Canvas>`.\n *\n * The `layers` prop is a map keyed by slot name. Standard slots render at a\n * canonical position; custom entries (any other key, value carrying `.layer`)\n * insert at `after`/`before` an existing slot, defaulting to the top.\n *\n * @internal\n * @deprecated Bare `<Canvas>` is not a supported consumer surface.\n * Use `<SceneCanvas>` instead. Re-promotion is tracked in\n * `docs/TODO.md`.\n */\n\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport type React from 'react';\nimport type { FillStyle } from '@weasel-js/paint';\nimport { composeOrderedLayers, placeToolOverlays } from './layerOrder';\nimport { buildSceneLayers, type CanvasAdapter, type SceneSlotConfig } from './buildSceneLayer';\n\nexport { buildSceneLayer, buildSceneLayers } from './buildSceneLayer';\nexport type { SceneSlotConfig } from './buildSceneLayer';\nimport {\n STANDARD_SLOTS,\n isCustomEntry,\n type CustomLayerEntry,\n} from './layerSlots';\nexport { STANDARD_SLOTS, isCustomEntry } from './layerSlots';\nexport type { StandardSlotName, CustomLayerEntry } from './layerSlots';\nimport type { CanvasExtensionApi } from './canvasExtension';\nimport { registerMountedCanvas } from './mountedCanvases';\nimport type { ToolsApi } from '../tools/overlayBinding';\nimport { aggregatePreviewIds } from './toolPreview';\nimport type { GestureSource } from './gestureBounds';\nimport { useViewHelpers } from './useViewHelpers';\nimport { useCanvasView } from './useCanvasView';\nimport { useOptionalViewRegistry } from './viewRegistry';\nimport { useFrameLoop } from './useFrameLoop';\nimport { useRedrawOn } from './useRedrawOn';\nimport type { CanvasHelpers, CanvasSurfaceHelpers } from './useViewHelpers';\n\nimport type { ToolCtx } from '@weasel-js/routing';\nimport { useLatest } from '@weasel-js/react';\nimport type { Op } from 'core/ops/types';\nimport { dispatchApplyBatch } from 'core/applyOps';\nimport type { View } from 'core/viewport/view';\nimport { clientToWorld as clientToWorldHelper } from 'core/viewport/clientToWorld';\nimport {\n drawLayers, isLayerPainted,\n type Dims, type LayerCommandCache, type LayerDrawSpan, type LayerGroup, type RedrawSource, type RenderLayer,\n} from 'core/layers/render';\nimport { viewToMat3, type ShaderProgramHandle } from '../renderer';\nimport { useCanvasRenderer, useRedrawOnDensityChange, useRedrawOnRestore } from './useCanvasRenderer';\nimport { useSceneLayerList } from './useSceneLayerList';\nimport { getProgramSource, programSourceRegistry } from '../renderer/shaders/registerProgram';\nimport {\n type SelectionApi,\n} from 'core/selection/useSelection';\nimport type {\n MoveAdapter,\n ResizeAdapter,\n RotateAdapter,\n} from 'core/adapters/types';\nimport {\n createSelectionOverlayLayer,\n type SelectionOverlayLayerOpts,\n} from 'features/selection/overlay';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { CanvasDebugSink, DebugConfig } from '../debug/types';\nimport { parseDebugFlags } from '../debug/parseDebugFlags';\nimport { createDebugSink } from '../debug/createDebugSink';\nimport { createDebugOverlayLayer } from '../debug/createDebugOverlayLayer';\nimport { frameStatsOf } from '../debug/frameStats';\n\nconst alwaysVisible = (_id: string): boolean => true;\nimport { resolveCursorTier } from '@weasel-js/cursor';\nimport type { ResolvedCursor } from '@weasel-js/cursor';\nimport { createPaintedCursorState } from '@weasel-js/cursor';\nimport type { PaintedCursor, PaintedCursorState } from '@weasel-js/cursor';\nimport { createPaintedCursorLayer } from '../features/cursor/paintedCursorLayer';\nimport { commandFill } from '../features/patterns/commandPaint';\n\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { CursorCoordsHud } from './CursorCoordsHud';\nimport { PickHud } from './PickHud';\nimport { ModalityHud } from './ModalityHud';\n\n\n\n/** Selection-overlay slot config — passed through to `createSelectionOverlayLayer`,\n * minus the `getSelection`/`getPose` Canvas wires automatically. */\nexport type SelectionOverlaySlotConfig<TPose> = Omit<\n SelectionOverlayLayerOpts<TPose>,\n 'getSelection' | 'getPose'\n> & {\n /** Override the auto-wired pose lookup (overlay-aware → adapter fallback). */\n poseById?: (id: string) => TPose | null;\n};\n\n\n/** Per-slot config union. The key narrows it in practice. */\nexport type StandardSlotConfig<TNode extends { id: string }, TPose> =\n | SceneSlotConfig<TNode, TPose>\n | SelectionOverlaySlotConfig<TPose>;\n\n/** What may fill one of the canvas's named layer slots: a config the canvas\n * builds the layer from, a pre-built layer, or `null` to leave the slot\n * empty. */\nexport type LayerSlotValue<TNode extends { id: string }, TPose> =\n | StandardSlotConfig<TNode, TPose>\n | CustomLayerEntry\n | null;\n\n/** The canvas's render stack, as named slots. The standard slots (grid,\n * scene, selection overlay, cell highlight) fix where a layer sits in the\n * stack; scene and selection overlay can be configured, and every one can be\n * given a layer of your own or switched off. Further keys add custom layers.\n * `TSceneSlot` is what the scene slot accepts: `<SceneCanvas>` takes a\n * partial config and fills the rest from its defaults. */\nexport type LayersMap<\n TNode extends { id: string },\n TPose,\n TSceneSlot = SceneSlotConfig<TNode, TPose>,\n> = {\n /** Grid slot, beneath the scene. Takes a pre-built layer (`{ layer }`) —\n * e.g. `createGridLayer` from `@weasel-js/guides` — or `null`. */\n grid?: CustomLayerEntry | null;\n scene?: TSceneSlot | null;\n /** Selection-overlay slot. Canvas constructs the layer from a\n * `SelectionOverlaySlotConfig`; pass a `CustomLayerEntry` (`{ layer }`) to\n * supply a pre-built layer (e.g. from `<SceneCanvas>`). */\n selectionOverlay?: SelectionOverlaySlotConfig<TPose> | CustomLayerEntry | null;\n /** Cell-highlight overlay slot, drawn immediately after the grid. Takes a\n * pre-built layer (`{ layer }`) — e.g. `createCellHighlightLayer` from\n * `@weasel-js/guides` — or `null`. */\n cellHighlight?: CustomLayerEntry | null;\n} & {\n [customKey: string]: LayerSlotValue<TNode, TPose> | TSceneSlot | undefined;\n};\n\n/**\n * Props for `<Canvas>` — the low-level WebGL surface + viewport +\n * pointer routing primitive.\n *\n * Canvas is scene-agnostic. It owns the GL surface, view state, pointer/\n * keyboard dispatch, and slot composition. It does NOT own selection state,\n * picking logic, kind registries, or scene-aware overlays — those belong in\n * `<SceneCanvas>`.\n */\nexport interface CanvasProps<TNode extends { id: string } = { id: string }, TPose = unknown> {\n /** CSS-pixel width. */\n width: number;\n /** CSS-pixel height. */\n height: number;\n\n /** Drawing-buffer density (device pixels per CSS pixel). When omitted the\n * canvas reads `window.devicePixelRatio` per paint — the long-standing\n * screen behavior. Supplying it makes density an explicit parameter, the\n * same contract the headless `renderSceneToPixels` path follows (that\n * path never reads ambient density at all). */\n dpr?: number;\n\n /** Flatness tolerance for curve tessellation, in world units. Forwarded to\n * `WeaselRendererOptions.flattenTolerance`. Leave unset for the cached\n * default (`DEFAULT_FLATTEN_TOLERANCE`, 0.5); a scene whose world unit is\n * not a pixel — feet, inches, millimetres — needs a value scaled to its\n * unit or sub-unit curves flatten to a handful of vertices. */\n flattenTolerance?: number;\n\n /** The version of whatever content this canvas draws, sampled at paint time\n * and reported by {@link CanvasExtensionApi.getPaintedVersion}.\n * `<SceneCanvas>` wires this to `scene.getVersion`. Chrome that must not\n * show DOM ahead of pixels compares the two and defers a frame. */\n contentVersion?: () => number;\n\n /** Paint inside the React commit rather than on the next animation frame.\n * Costs a synchronous paint per commit and per redraw request; buys\n * single-commit consistency between React-rendered DOM and canvas pixels.\n * For consumers with DOM chrome pinned to canvas content that cannot\n * tolerate a frame of skew. Live: toggling it switches modes from the next\n * redraw on. A redraw requested from inside a layer's `draw`, or from a\n * `subscribeFrame` callback, still waits for a frame — painting it in place\n * would recurse. */\n syncPaint?: boolean;\n\n /** External state the paint reads that no layer declares — typically what\n * an `alphaFor` consults. Each source is subscribed while mounted and\n * repaints the canvas when it notifies. A layer that reads outside state\n * declares it on `RenderLayer.subscribe` instead. */\n redrawOn?: readonly RedrawSource[];\n\n /**\n * Combined adapter for scene-slot rendering, bounds computation, and\n * move/resize/rotate gesture math. Optional — bare-Canvas consumers that\n * don't need a scene slot may omit it.\n *\n * Canvas threads this adapter into layer factories and gesture hooks. The\n * type is the move/resize/rotate intersection plus the *optional* scene-tree\n * methods (`getLayers`/`getNode`/`getChildren`) — present on a hierarchical\n * `SceneCanvasAdapter`, absent on flat adapters. The `buildSceneLayer` path\n * feature-detects them at draw time.\n *\n * `<SceneCanvas>` synthesizes this from a `Scene`; bare-`<Canvas>` consumers\n * must supply it explicitly when using the scene or selection-overlay slots.\n */\n adapter?: CanvasAdapter<TNode, TPose>;\n\n /** Layer map. See module docstring for slot semantics. */\n layers: LayersMap<TNode, TPose>;\n\n /**\n * Current selection state. Canvas is a pure pass-through — it owns no\n * selection state of its own. When absent, Canvas behaves as if nothing is\n * selected: no selection chrome, no select-on-click, no clear-on-background.\n *\n * `<SceneCanvas>` always supplies this from its internal `useSelection`.\n * Bare-`<Canvas>` consumers may omit it for non-selection use cases (e.g.\n * force-graph renderers or read-only viewers).\n */\n selection?: SelectionApi;\n\n\n /**\n * How to read and rewrite a pose. Drives the default `boundsOf` fallback and\n * the selection-overlay bounds.\n * Defaults to the rect identity (`AUTO_POSE_DESCRIPTOR`).\n *\n * This is a math helper, not a scene-shaped concern — it converts a pose\n * value to an AABB and extracts rotation for the selection chrome. Bare-\n * Canvas consumers that use a non-rect pose type should supply this.\n */\n poseDescriptor?: PoseDescriptor<TPose>;\n\n // --- Gesture overrides (escape hatches for non-rect / group-aware apps) ---\n /**\n * Used by `PickHud` to display the list of ids under the cursor.\n * NOT used for tool routing — see `getNodeAtPoint` for that.\n * `<SceneCanvas>` passes its internal pick function here so the HUD\n * stays in sync with the scene's actual hit-test order.\n */\n pickEvery?: (worldX: number, worldY: number) => string | string[] | null;\n /**\n * Override for committed bounds lookup. When supplied, takes precedence over\n * the `poseDescriptor`-derived fallback. Used by the selection overlay, the\n * multi-select union AABB, and `helpersRef.getEffectiveBounds`. Optional —\n * bare-Canvas consumers that use a custom bounds shape should supply this;\n * `<SceneCanvas>` derives it from its scene adapter and passes it via the\n * scene-slot layer config rather than this prop.\n */\n boundsOf?: (id: string) => Bounds | null;\n /** Bounds of `id` drawn at an in-flight pose — how chrome boxes a preview.\n * Defaults to the `poseDescriptor`'s box of that pose. */\n boundsOfPose?: (id: string, pose: TPose) => Bounds | null;\n /**\n * Custom pointer-to-world coordinate transform. When supplied, overrides the\n * default `(clientX - canvasRect.left) / scale + pan` calculation. Useful\n * for consumers that apply an additional CSS transform to the canvas element.\n */\n clientToWorld?: (canvas: HTMLElement, cx: number, cy: number) => [number, number];\n\n /**\n * Paint into a caller-owned canvas at a rect on it, instead of an element\n * this component creates. `x`/`y` are the rect's top-left in that canvas's\n * CSS pixels; the rect's size is the existing `width`/`height` props.\n *\n * Requires `inputElement`: with no element of its own there is nowhere for\n * pointer input, focus or the cursor to live, and nothing renders.\n *\n * N canvases can then share one GL context and one buffer.\n */\n paintInto?: { canvas: HTMLCanvasElement | null; x: number; y: number };\n /**\n * The element pointer input, focus and the cursor come from, and the element\n * every client→world conversion measures. Only read alongside `paintInto`;\n * an attached canvas uses the one it renders.\n */\n inputElement?: HTMLElement | null;\n\n // --- Visuals / DOM passthrough ---\n className?: string;\n style?: React.CSSProperties;\n tabIndex?: number;\n /** Fired when the canvas element gains focus. The canvas is focusable by\n * default (`tabIndex` 0), so consumers driving focus-dependent chrome —\n * a focus ring, a \"keyboard shortcuts active\" hint — need to observe it. */\n onFocus?: React.FocusEventHandler<HTMLCanvasElement>;\n /** Fired when the canvas element loses focus. */\n onBlur?: React.FocusEventHandler<HTMLCanvasElement>;\n /**\n * When `true` (default), the canvas element receives focus on `pointerdown`\n * so keyboard events (tool hotkeys, undo/redo) are captured without a\n * separate click-to-focus step. Set to `false` for canvases embedded inside\n * a larger focus-managed layout where auto-focus would steal focus from\n * sibling inputs.\n */\n autoFocusOnPointerDown?: boolean;\n\n /** Opt-in keyboard-driven actions wired against the canvas's effective\n * selection. Each key turns the action on; values may be `true` (defaults)\n * or a config dict. Omitting a key leaves the action unbound. */\n /** Tool primitive substrate. Pointer/keyboard/wheel events are routed\n * through `tools.dispatcher`. */\n tools?: import('../tools/overlayBinding').ToolsApi;\n\n /** Controlled viewport. When supplied, Canvas does not own the value —\n * the consumer must supply `onViewChange` and re-render with the new\n * view. See `View` JSDoc for the camera-position convention. */\n view?: View;\n /** Initial viewport for the uncontrolled path. Default `{x:0, y:0}`. */\n defaultView?: View;\n /** Fires whenever the viewport changes — in both controlled and\n * uncontrolled modes. */\n onViewChange?: (next: View) => void;\n /**\n * Optional world-space rect that constrains pan. When supplied, every\n * `setView` call passes through `clampView(next, viewBounds, {width, height})`\n * before commit, keeping the visible rect inside `viewBounds`. If the visible\n * rect is larger than the bounds along an axis (zoomed out past extent), that\n * axis is centered. Has no effect on `scale`.\n *\n * A viewport concern, not scene-shaped. Consumers that want the pan to stay\n * inside a document page boundary should wire this with the page dimensions.\n */\n viewBounds?: { x: number; y: number; width: number; height: number };\n /**\n * Mutable ref Canvas writes overlay-aware pose/bounds lookups to on every\n * render. Custom layers can read it from inside their `draw` closure to\n * reflect in-flight gestures (move/resize/rotate) instead of the committed\n * scene. Both lookups apply when an id is in the active overlay; otherwise\n * they fall back to the adapter.\n *\n * Useful for custom layers that render scene content outside of the standard\n * slot system and need to stay in sync with gesture previews.\n */\n helpersRef?: React.MutableRefObject<CanvasHelpers<TPose> | null>;\n\n /**\n * Debug overlay configuration.\n * - `undefined` (default): read `?debug=…` from the URL.\n * - `false`: force off, ignore URL.\n * - `DebugConfig` object: force on with that config, ignore URL.\n *\n * When enabled, the Canvas appends a screen-space `debug-overlay` layer\n * at the top of the layer stack and threads a `DebugSink` into every\n * interaction hook so they record hit math + handle positions.\n */\n debug?: DebugConfig | false;\n\n /** Test-only escape hatch: writes the live debug sink to this ref so tests\n * can call `snapshot()` after a render. No effect when debug is off. */\n debugSinkRef?: React.MutableRefObject<CanvasDebugSink | null>;\n\n /**\n * Custom shader programs to compile on the renderer. Each handle must come\n * from a module-level `registerProgram()` call. Compiled once per handle id\n * on first render (or on context restore). Pass a stable reference (e.g.\n * defined at module scope) — the array is read at renderer init time.\n * Re-registering one of these ids with new source repaints the canvas, and\n * the renderer recompiles it for that frame.\n */\n shaders?: ShaderProgramHandle[];\n\n /**\n * Extra source of ids whose committed paint should be suppressed during the\n * current frame (in addition to those reported by the tools' `previewIds()`).\n *\n * Wired by `<SceneCanvas>` to expose the new gesture-dispatcher's in-flight\n * handles: as legacy hooks are removed from tools, the\n * source-hide for move/clone/etc. needs to follow the preview-ghost layer\n * onto the dispatcher's `OngoingHandle.previewIds()`. Optional — bare\n * `<Canvas>` consumers don't need to wire it.\n */\n previewIdsExtra?: () => Iterable<string> | null;\n\n /**\n * Extra preview-pose lookup checked after the active tool's `previewPose`\n * misses. Wired by `<SceneCanvas>` to expose the gesture-dispatcher's\n * in-flight `OngoingHandle.previewPose(id)` so selection chrome (resize/\n * rotation handles, AABB outline) tracks the ghost during dispatcher-driven\n * drags. Returns `null` / `undefined` when no preview is in flight.\n */\n previewPoseExtra?: (id: string) => unknown;\n\n /**\n * In-flight gesture state `<Canvas>` can't see for itself. Backs the\n * `getGestureBounds` / `subscribeGestures` / `getGestureVersion` trio on\n * `helpersRef`; wired by `<SceneCanvas>` from the gesture dispatcher\n * (`createGestureSource`). Leaving it unwired is fine — those three then\n * report \"no gesture in flight\" and never fire.\n */\n gestureSource?: GestureSource;\n\n /**\n * FillStyle applied to the full canvas surface behind the scene. Accepts the\n * kit's `FillStyle` union (solid / pattern / linear-gradient / radial-gradient /\n * conic-gradient) so consumers don't have to author a background node just to\n * colorize the canvas.\n *\n * Rendered as a screen-space layer slotted before `'scene'` — independent of\n * pan / zoom. Canvas owns this layer; `<SceneCanvas>` forwards its own\n * `backgroundFill` prop verbatim so consumer apps see no breaking change.\n */\n backgroundFill?: FillStyle;\n\n /**\n * Dev HUD: when true, mounts a fixed-position widget showing live cursor\n * coords in both viewport (client) and canvas (world) frames. Useful for\n * diagnosing pointer-coord drift / pan-zoom misalignment without\n * instrumenting events.\n */\n cursorCoordsHud?: boolean;\n\n /**\n * Dev HUD: when true, mounts a fixed-position widget just below the\n * cursor-coords HUD listing the ids returned by `pickEvery(world)` under\n * the cursor. Useful for diagnosing hit-test order and container/leaf\n * overlap during select-tool work.\n */\n pickHud?: boolean;\n\n /**\n * Dev HUD: mounts a fixed-position widget below the pick HUD reporting\n * the active modality mode, the active-slot tool, and the hotkey stack.\n * Pass `true` to enable with no mode (renders `—` for the mode line —\n * useful until the modality machine is wired). Pass an object to supply\n * the current mode id.\n */\n modalityHud?: boolean | { modeId?: string };\n\n /**\n * Optional single-best hit resolver for the `pickHud` — the id this point\n * would select on a bare click. When omitted the HUD skips the bold-best\n * highlight. `<SceneCanvas>` forwards its `internalPickBest` here so the\n * HUD shows the same best-candidate SceneCanvas would pick.\n */\n pickBest?: (worldX: number, worldY: number) => string | null;\n\n\n /**\n * Optional mode-owned decoration layer. When supplied, Canvas inserts it\n * between the scene-render slot and the tool-overlay slot so decoration\n * draw commands (e.g. path-edit anchor dots) paint above scene content but\n * below tool overlays (drag rects, etc.).\n *\n * Slot ordering: scene → (scoping mask) → **decoration** → tool overlay → chrome.\n *\n * Wired by the modality machine after it activates a mode whose\n * `ModeDefinition` supplies a `paint()` factory. Omitting this prop is a\n * no-op — existing consumers are unaffected.\n */\n decorationLayer?: RenderLayer<unknown>;\n\n /**\n * Chrome-caps visibility resolver. When supplied, Canvas:\n * - exposes the predicate on `helpersForLayers.getIsVisible` so\n * custom layers (notably `composeAffordanceLayer`) can gate\n * paint by chrome id;\n * - threads it into the affordance-pipeline `HitTestContext.isVisible`\n * so the same gate applies to hit-testing.\n *\n * Called fresh per draw / per hitTest, so the consumer can return a\n * predicate that closes over per-frame `ChromeCtx`. Omit to leave\n * every chrome element visible (pre-chrome-caps behavior).\n */\n getIsVisible?: () => (id: string) => boolean;\n\n /**\n * Show or hide whole render layers by id. An id absent from the map falls\n * back to the layer's own `defaultVisible`, and a layer marked `alwaysOn`\n * ignores the map entirely.\n *\n * Hiding a layer also stops it claiming pointer events through\n * `hitTestExtras` — a layer nobody can see must not swallow a click.\n *\n * This is `getIsVisible`'s coarser sibling: that one gates individual\n * chrome elements *within* a layer, this one gates the layer.\n */\n layerVisibility?: Record<string, boolean>;\n\n /**\n * Draw order, by layer id, bottom first. Omit for the order the layers\n * arrive in.\n *\n * **A listed order is the whole list:** any layer whose id is missing from\n * it is not drawn. Reordering two layers means naming all of them.\n */\n layerOrder?: string[];\n\n /**\n * Runs of consecutive layers that composite as one — the surface for\n * blurring the world while the chrome above it stays sharp. Members are\n * named by layer id, and a layer in no group draws exactly as it did\n * before. See {@link LayerGroup}.\n */\n layerGroups?: readonly LayerGroup[];\n}\n\nexport type {\n CanvasViewHelpers,\n CanvasSurfaceHelpers,\n CanvasHelpers,\n} from './useViewHelpers';\n\nfunction resolveToolsCursor(\n tools: ToolsApi,\n ctxBase?: () => Omit<ToolCtx, 'scratch'>,\n): ResolvedCursor | undefined {\n const id = tools.hotkeyEngaged ?? tools.active;\n const tool = id === null ? undefined : tools.registry[id];\n if (!tool?.cursor) return undefined;\n if (typeof tool.cursor !== 'function') return resolveCursorTier(tool.cursor);\n if (!ctxBase) return undefined;\n // Function form: invoke at render time with the live base ctx.\n //\n // `ctx.scratch` is always null here. It used to be the tool-routing\n // dispatcher's in-flight gesture scratch, which is how `grab` became\n // `grabbing` and how select swapped to `move` — mid-gesture cursors are now\n // `Action.activeCursor`, applied imperatively by the hover pump. A tool that\n // wants a cursor driven by its own state closes over its own ref (the pen\n // does, for its close-path hint).\n try {\n const base = ctxBase();\n return resolveCursorTier(tool.cursor({ ...base, scratch: null }));\n } catch {\n return undefined;\n }\n}\n\n/** Stable empty map, so an omitted `layerVisibility` doesn't remake the paint\n * effect's deps every render. */\nconst NO_LAYER_VISIBILITY: Record<string, boolean> = {};\n\n/** Client coords to world, through the `clientToWorld` prop when one is\n * supplied and the canvas rect otherwise. Every pointer path in this file\n * goes through here so the two cannot drift. */\nfunction toWorld(\n canvas: HTMLElement,\n clientX: number,\n clientY: number,\n view: View,\n override: CanvasProps<never, never>['clientToWorld'],\n): [number, number] {\n if (override) return override(canvas, clientX, clientY);\n return clientToWorldHelper(clientX, clientY, canvas.getBoundingClientRect(), view);\n}\n\nfunction CanvasInner<TNode extends { id: string }, TPose>(\n props: CanvasProps<TNode, TPose>,\n ref: React.ForwardedRef<CanvasExtensionApi>,\n) {\n const {\n width,\n height,\n dpr: dprProp,\n flattenTolerance,\n contentVersion,\n syncPaint = false,\n redrawOn,\n adapter: adapterProp,\n layers: layersMap,\n selection,\n boundsOf,\n boundsOfPose,\n pickEvery,\n clientToWorld,\n paintInto,\n inputElement,\n poseDescriptor: geometry = AUTO_POSE_DESCRIPTOR as unknown as PoseDescriptor<TPose>,\n className,\n style,\n tabIndex = 0,\n onFocus,\n onBlur,\n autoFocusOnPointerDown = true,\n helpersRef,\n tools,\n view: viewProp,\n defaultView,\n onViewChange,\n viewBounds,\n debug: debugProp,\n debugSinkRef,\n shaders,\n previewIdsExtra,\n previewPoseExtra,\n gestureSource,\n backgroundFill,\n cursorCoordsHud,\n pickHud,\n modalityHud,\n pickBest,\n decorationLayer,\n getIsVisible,\n layerVisibility,\n layerOrder,\n layerGroups,\n } = props;\n\n // Resolve debug config: explicit prop wins; `undefined` falls back to URL;\n // `false` forces off. Keyed on content, so a config written inline does not\n // rebuild the sink, and lose what it has recorded, on every render.\n const debugKey = debugProp === undefined ? undefined : JSON.stringify(debugProp);\n const resolvedDebugConfig = useMemo<DebugConfig | null>(() => {\n if (debugKey !== undefined) return (JSON.parse(debugKey) as DebugConfig | false) || null;\n if (typeof window === 'undefined') return null;\n return parseDebugFlags(window.location.search);\n }, [debugKey]);\n\n // Lazily build one sink per Canvas mount (per resolved config).\n const debugSink = useMemo<CanvasDebugSink | null>(() => {\n if (resolvedDebugConfig === null) return null;\n return createDebugSink(resolvedDebugConfig);\n }, [resolvedDebugConfig]);\n const committedDebugSinkRef = useLatest(debugSink);\n const getDebug = useCallback(() => committedDebugSinkRef.current, [committedDebugSinkRef]);\n\n const adapter = adapterProp;\n\n // The element input comes from and every client→world conversion measures.\n // Normally the `<canvas>` this component renders; under `paintInto` it is\n // the caller's `inputElement` instead — nothing downstream of here asks\n // which of the two it is holding, because nothing downstream needs a canvas.\n const canvasRef = useRef<HTMLElement | null>(null);\n // The `<canvas>` this component rendered, if it rendered one. `paint` is the\n // only thing that needs a real canvas, for `getContext`.\n const ownCanvasRef = useRef<HTMLCanvasElement | null>(null);\n // Stable, so a commit does not detach the element: an inline ref is nulled\n // until the layout phase reaches it, and a sync paint asked for before that\n // finds no canvas.\n const setOwnCanvas = useCallback((el: HTMLCanvasElement | null) => {\n ownCanvasRef.current = el;\n canvasRef.current = el;\n }, []);\n const detached = !!paintInto;\n // The detached input element reaches `canvasRef` at commit; the own canvas\n // arrives through `setOwnCanvas`, React's ref callback.\n useInsertionEffect(() => {\n if (detached) canvasRef.current = inputElement ?? null;\n });\n // Where pixels go. Split from `canvasRef` only when detached.\n const paintTarget = detached ? (paintInto.canvas ?? null) : null;\n const paintTargetRef = useLatest(paintTarget);\n const paintRect = detached ? { x: paintInto.x, y: paintInto.y } : null;\n const paintRectRef = useLatest(paintRect);\n\n // Read by `hitTestExtras`, which is built once and must see live values.\n const helpersForLayersRef = useRef<CanvasHelpers<TPose> | null>(null);\n const dimsRef = useLatest({ width, height });\n const getIsVisibleRef = useLatest(getIsVisible);\n const layerVisibilityRef = useLatest(layerVisibility);\n const layerOrderRef = useLatest(layerOrder);\n\n // React does not drive the paint; the frame loop does. The thunk defers to\n // `paint` below, which needs inputs this render has not computed yet.\n const paintRef = useRef<() => boolean>(() => false);\n const { requestRedraw, subscribeFrame, subscribeBeforePaint, subscribeResume } = useFrameLoop(\n useCallback(() => paintRef.current(), []),\n { syncPaint, target: canvasRef },\n );\n\n const contentVersionRef = useLatest(contentVersion);\n const paintedVersionRef = useRef(0);\n const getPaintedVersion = useCallback(() => paintedVersionRef.current, []);\n\n // The `layersWithDebug` memo reads `extrasRef.current`, so registration has\n // to bump state to re-run it. Rare (a HUD attaching, a loupe mounting).\n const [extrasVersion, setExtrasVersion] = useState(0);\n const extrasRef = useRef<Set<RenderLayer<unknown>>>(new Set());\n const registerLayer = useCallback((layer: RenderLayer<unknown>) => {\n extrasRef.current.add(layer);\n setExtrasVersion(n => n + 1);\n return () => {\n extrasRef.current.delete(layer);\n setExtrasVersion(n => n + 1);\n };\n }, []);\n\n // Hit-test registered layers topmost-first. Registration order is draw\n // order, so the last-registered layer is on top and gets first refusal —\n // the reverse of the Set's iteration order.\n //\n // `<SceneCanvas>` folds this into its `affordanceAt` thunk. Canvas can't do\n // that itself: it has the layers but not the dispatcher.\n const hitTestExtrasIn = useCallback((\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n only?: readonly RenderLayer<unknown>[],\n ) => {\n const layers = [...extrasRef.current].reverse();\n const isVisible = getIsVisibleRef.current?.() ?? alwaysVisible;\n const visibility = layerVisibilityRef.current ?? NO_LAYER_VISIBILITY;\n const order = layerOrderRef.current;\n for (const layer of layers) {\n if (!layer.hitTest) continue;\n if (only && !only.includes(layer)) continue;\n if (!isLayerPainted(layer, visibility, order)) continue;\n const hit = layer.hitTest(worldX, worldY, data, view, dims, isVisible);\n if (hit) return { layerId: layer.id, hit };\n }\n return null;\n }, [getIsVisibleRef, layerOrderRef, layerVisibilityRef]);\n\n const {\n viewRef, controlledView, setView, getView, subscribeView,\n adoptControlled, announceControlled, clearSubscribers,\n } = useCanvasView({ view: viewProp, defaultView, onViewChange, viewBounds, dimsRef, requestRedraw });\n\n const hitTestExtras = useCallback((\n worldX: number,\n worldY: number,\n frame?: { view: View; dims: Dims },\n ) => hitTestExtrasIn(\n worldX,\n worldY,\n frame?.view ?? viewRef.current,\n frame?.dims ?? dimsRef.current,\n helpersForLayersRef.current,\n ), [hitTestExtrasIn, dimsRef, viewRef]);\n\n useLayoutEffect(() => {\n const element = canvasRef.current;\n if (!element) return;\n return registerMountedCanvas({ element, getView });\n }, [detached, inputElement, getView]);\n\n // The painted tier's channel. `<Canvas>` owns it because it owns both ends:\n // the tool cursor that feeds it and the frame loop that has to repaint when\n // it changes. The hover pump reaches it through the ref handle below.\n const paintedCursor = useMemo<PaintedCursorState>(() => createPaintedCursorState(), []);\n const paintedCursorLayer = useMemo(\n () => createPaintedCursorLayer(paintedCursor),\n [paintedCursor],\n );\n // An idle pointermove repaints nothing on its own, so a cursor the compositor\n // is not drawing needs its own pump. The store stays quiet unless something\n // painted is actually on screen.\n useEffect(() => paintedCursor.subscribe(() => { requestRedraw(); }), [paintedCursor, requestRedraw]);\n\n const getSurfaceRect = useCallback(() => {\n const origin = paintRectRef.current;\n const { width: w, height: h } = dimsRef.current;\n return { x: origin?.x ?? 0, y: origin?.y ?? 0, width: w, height: h };\n }, [dimsRef, paintRectRef]);\n\n useImperativeHandle(ref, () => ({\n // Named rather than read off `canvasRef` so the handle rebuilds when a\n // detached surface's input element arrives, which is a render later.\n element: detached ? inputElement ?? null : canvasRef.current,\n surface: detached ? paintInto?.canvas ?? null : ownCanvasRef.current,\n getSurfaceRect,\n requestRedraw,\n subscribeFrame,\n subscribeBeforePaint,\n subscribeResume,\n registerLayer,\n hitTestExtras,\n getView,\n setView,\n subscribeView,\n getPaintedVersion,\n paintedCursor,\n getDebug,\n }), [canvasRef, ownCanvasRef, detached, inputElement, paintInto?.canvas,\n getSurfaceRect, requestRedraw, subscribeFrame, subscribeBeforePaint, subscribeResume,\n registerLayer,\n hitTestExtras, getView, setView, subscribeView, getPaintedVersion,\n paintedCursor, getDebug]);\n\n // Created on the first paint, rebuilt when the paint target moves, and\n // freed on unmount.\n const lease = useCanvasRenderer();\n useRedrawOnRestore(lease, requestRedraw);\n useRedrawOnDensityChange(requestRedraw, dprProp);\n const layerCacheRef = useRef<LayerCommandCache>(new Map());\n\n // Views registered on this surface — declared as `views` descriptors or\n // mounted as `<CanvasView>` children. Null outside a surface that mounts a\n // registry, which is the single-view case.\n const viewRegistry = useOptionalViewRegistry();\n\n // Internal hooks always run (rules of hooks). They consult a noop adapter\n // when none is supplied; their controllers are then unused because the\n // gesture wiring below only enables move/resize when `adapter` is present.\n const noopAdapter = useMemo(\n () =>\n ({\n getPose: () => ({}) as TPose,\n getNodes: () => [],\n }) as unknown as MoveAdapter<TNode, TPose>\n & ResizeAdapter<TNode, TPose>\n & RotateAdapter<TNode, TPose>,\n [],\n );\n const effectiveAdapter = (adapter ?? noopAdapter) as MoveAdapter<TNode, TPose>\n & ResizeAdapter<TNode, TPose>\n & RotateAdapter<TNode, TPose>;\n\n // Canvas owns no selection state. The `selection` prop is the sole source.\n // When absent, behave as if no selection exists (no chrome, no overlay).\n // A no-op fallback keeps all downstream reads safe without branching.\n const noopSelection = useMemo<SelectionApi>(\n () => ({\n current: [],\n get: () => [],\n contains: () => false,\n set: () => {},\n add: () => {},\n remove: () => {},\n toggle: () => {},\n clear: () => {},\n applyClick: () => {},\n adapterMethods: {\n getSelection: () => [],\n setSelection: () => {},\n },\n }),\n [],\n );\n const effectiveSelection: SelectionApi = selection ?? noopSelection;\n\n // Base ctx for the function form of `Tool.cursor` — the last consumer of\n // `ToolCtx` now that the tool-routing dispatcher is gone. The cursor is\n // resolved during render, so the ctx carries this render's values; only\n // `applyOps`, which a cursor function could call later, reads a ref.\n const effectiveAdapterRef = useLatest(effectiveAdapter);\n const clientToWorldRef = useLatest(clientToWorld);\n const toolsCtxBase = () => {\n const view = controlledView ?? viewRef.current;\n const c = detached ? inputElement ?? null : canvasRef.current;\n const rect = c ? c.getBoundingClientRect() : (typeof DOMRect !== 'undefined' ? new DOMRect() : ({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 } as DOMRect));\n return {\n worldX: 0,\n worldY: 0,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n selection: effectiveSelection,\n adapter: effectiveAdapter,\n applyOps: (ops: Op[], label: string) => {\n dispatchApplyBatch(effectiveAdapterRef.current, ops, label);\n },\n view,\n setView,\n canvasRect: rect,\n debug: debugSink ?? undefined,\n };\n };\n\n // Stable wrappers for HUD props — read the ref at call time so the HUDs\n // don't reinstall their useEffect on every render when the prop identity\n // changes (e.g. when SceneCanvas re-renders with a new lambda reference).\n // pickEvery and pickBest are HUD-only.\n const pickEveryRef = useLatest(pickEvery);\n const pickBestRef = useLatest(pickBest);\n const stablePickEveryForHud = useCallback(\n (wx: number, wy: number): readonly string[] => {\n const pe = pickEveryRef.current;\n if (!pe) return [];\n const raw = pe(wx, wy);\n if (!raw) return [];\n return Array.isArray(raw) ? raw : [raw];\n },\n [pickEveryRef],\n );\n const stablePickBestForHud = useCallback(\n (wx: number, wy: number): string | null => pickBestRef.current?.(wx, wy) ?? null,\n [pickBestRef],\n );\n const toWorldForHud = useCallback((clientX: number, clientY: number): [number, number] => {\n const el = canvasRef.current;\n if (!el) return [clientX, clientY];\n return toWorld(el, clientX, clientY, viewRef.current, clientToWorldRef.current);\n }, [clientToWorldRef, viewRef]);\n // Selection-driven action gestures (delete/nudge/undoRedo/duplicate) used\n // to be wired here via legacy hooks. They now go through the Actions\n // Registry / dispatcher path; consumers register them via the kit's\n // standard descriptors (see `useStandardActions`).\n\n const selectedIdsForWiring = effectiveSelection.current;\n\n // One view's overlay-aware state. A hook, so N views are N components each\n // calling it once — not a loop in this body.\n const {\n helpers: viewHelpers,\n chromeState: viewChromeState,\n effectiveBoundsOf,\n previewExtraRef,\n } = useViewHelpers<TPose>({\n adapter,\n geometry,\n boundsOf,\n boundsOfPose,\n selection: selectedIdsForWiring,\n tools,\n gestureSource,\n previewPoseExtra,\n previewIdsExtra,\n getIsVisible: () => getIsVisibleRef.current?.() ?? alwaysVisible,\n });\n\n // The affordance-layer hit-test used to be wired into the tool-routing\n // dispatcher from here, so its pointerdown could walk tool overlays\n // top-down. `<SceneCanvas>` now composes the equivalent walk into the\n // `affordanceAt` thunk it hands `useGestureDispatcher` — over registered\n // layers via `hitTestExtras` above, and over selection chrome itself.\n\n const surfaceHelpers: CanvasSurfaceHelpers = {\n getDebug: () => debugSink,\n };\n const helpersForLayers: CanvasHelpers<TPose> = { ...viewHelpers, ...surfaceHelpers, viewId: null };\n\n // Pointer-pressed flag. The only thing `<Canvas>` still needs to know about\n // pointer state: `onUncapturedMove` means \"hover\", so it stands down while a\n // button is held. Everything else about pointer input — thresholds, click and\n // double-click synthesis, drag handles, the document-level backstop for a\n // release that lands off-canvas — belongs to `useGestureDispatcher`, which\n // attaches its own listeners to this same element.\n const pointerDownRef = useRef(false);\n\n // Background-fill layer: screen-space, emits a single full-canvas rect with\n // the configured FillStyle. Drawn beneath every other layer.\n // Independent of pan / zoom — backgrounds are canvas chrome, not world content.\n const backgroundLayer = useMemo<RenderLayer<unknown> | null>(() => {\n if (!backgroundFill) return null;\n return {\n id: 'scene-background-fill',\n label: 'Background fill',\n space: 'screen',\n draw: (_data, _view, dims) => {\n const rect = { x: 0, y: 0, width: dims.width, height: dims.height };\n const fill = commandFill(backgroundFill, rect);\n return fill ? [{ kind: 'path', path: { kind: 'rect', ...rect }, fill }] : [];\n },\n };\n }, [backgroundFill]);\n\n const { key: sceneLayersKey, sync: syncSceneLayers } = useSceneLayerList(adapter);\n const layers = useMemo<RenderLayer<unknown>[]>(() => {\n const standardLayers: Partial<\n Record<(typeof STANDARD_SLOTS)[number], RenderLayer<unknown>>\n > = {};\n\n const grid = layersMap.grid;\n if (isCustomEntry(grid)) standardLayers.grid = grid.layer;\n const cellHighlight = layersMap.cellHighlight;\n if (isCustomEntry(cellHighlight)) standardLayers.cellHighlight = cellHighlight.layer;\n\n const sceneCfg = layersMap.scene as SceneSlotConfig<TNode, TPose> | null | undefined;\n let sceneLayers: Array<{ key: string; layer: RenderLayer<unknown> }> | undefined;\n if (\n sceneCfg &&\n !isCustomEntry(sceneCfg) &&\n (sceneCfg as SceneSlotConfig<TNode, TPose>).drawOne\n ) {\n sceneLayers = buildSceneLayers<TNode, TPose>(\n sceneCfg,\n adapter,\n debugSink,\n effectiveBoundsOf,\n () => {\n const ids = aggregatePreviewIds(tools);\n const extra = previewExtraRef.current.previewIdsExtra?.();\n if (extra) {\n for (const id of extra) ids.add(id);\n }\n return ids.size > 0 ? ids : null;\n },\n );\n }\n\n const selSlot = layersMap.selectionOverlay as\n | SelectionOverlaySlotConfig<TPose>\n | CustomLayerEntry\n | null\n | undefined;\n if (isCustomEntry(selSlot)) {\n // Pre-built layer (e.g. from SceneCanvas) — pass through directly.\n standardLayers.selectionOverlay = selSlot.layer;\n } else if (selSlot !== null) {\n const cfg = (selSlot ?? {}) as SelectionOverlaySlotConfig<TPose>;\n standardLayers.selectionOverlay = createSelectionOverlayLayer<TPose>({\n ...cfg,\n // A consumer-supplied pose lookup still needs the configured geometry\n // to project with; without one the layer reads bounds off the chrome\n // state and never calls either.\n ...(cfg.poseById\n ? { getPose: cfg.poseById, poseDescriptor: cfg.poseDescriptor ?? geometry }\n : {}),\n });\n }\n\n const out: RenderLayer<unknown>[] = composeOrderedLayers(\n layersMap, standardLayers, sceneLayers, backgroundLayer ?? undefined,\n );\n // Decoration layer: above scene, below tool overlay (per slot ordering doc).\n if (decorationLayer) out.push(decorationLayer);\n if (tools) {\n placeToolOverlays(out, standardLayers.selectionOverlay, tools.getActiveOverlays);\n }\n return out;\n // `sceneLayersKey` stands for `adapter.getLayers()`, which `buildSceneLayers` reads.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [layersMap, adapter, effectiveBoundsOf, debugSink, tools, backgroundLayer,\n decorationLayer, geometry, previewExtraRef, sceneLayersKey]);\n\n const viewRegistryVersion = useSyncExternalStore(\n useCallback((cb: () => void) => viewRegistry?.subscribe(cb) ?? (() => {}), [viewRegistry]),\n () => viewRegistry?.getVersion() ?? 0,\n () => 0,\n );\n\n // The stack a view paints through its own camera is this canvas's, before\n // the views themselves are folded in — otherwise a view would contain\n // itself. Published by reference and read at draw time.\n const surfaceLayersRef = useLatest<readonly RenderLayer<unknown>[]>(layers);\n useEffect(() => {\n viewRegistry?.attachSurface({\n origin: () => {\n const c = canvasRef.current;\n if (!c) return { left: 0, top: 0 };\n const r = c.getBoundingClientRect();\n return { left: r.left, top: r.top };\n },\n view: () => viewRef.current,\n dims: () => dimsRef.current,\n layers: () => surfaceLayersRef.current,\n requestRedraw,\n chromeState: () => helpersForLayersRef.current!.getChromeState(),\n hitTestExtras: hitTestExtrasIn,\n claimsAbove: (x, y) => {\n const view = viewRef.current;\n return hitTestExtrasIn(\n view.x + x / view.scale.x, view.y + y / view.scale.y,\n view, dimsRef.current, helpersForLayersRef.current,\n ) !== null;\n },\n });\n }, [viewRegistry, canvasRef, requestRedraw, hitTestExtrasIn, dimsRef, surfaceLayersRef, viewRef]);\n\n // Append the debug overlay layer at the very top of the stack when debug\n // is enabled. The layer reads from `debugSink.snapshot()` and paints in\n // screen space.\n const layersWithDebug = useMemo(() => {\n // Views paint through the surface's own stack, so they sit above it and\n // below both the debug overlay and externally-registered layers.\n const withViews = viewRegistry\n ? [...layers, ...viewRegistry.list().filter((r) => r.paint).map((r) => r.layer as RenderLayer<unknown>)]\n : layers;\n const base = debugSink && resolvedDebugConfig\n ? [...withViews, createDebugOverlayLayer({ sink: debugSink, config: resolvedDebugConfig })]\n : withViews;\n // The cursor goes last: it is the one thing that is always in front of\n // everything, including a consumer's own registered layers.\n return [...base, ...extrasRef.current, paintedCursorLayer];\n // extrasVersion drives re-reads of extrasRef when layers are registered/detached;\n // viewRegistryVersion does the same for registered views.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [layers, debugSink, resolvedDebugConfig, extrasVersion, viewRegistry, viewRegistryVersion,\n paintedCursorLayer]);\n\n useEffect(() => {\n const redraw = (): void => { requestRedraw(); };\n const offs: (() => void)[] = [];\n for (const layer of layersWithDebug) if (layer.subscribe) offs.push(layer.subscribe(redraw));\n return () => { for (const off of offs) off(); };\n }, [layersWithDebug, requestRedraw]);\n\n useRedrawOn(redrawOn, requestRedraw);\n\n const shaderIdKey = shaders?.map((h) => h.id).join('|') ?? '';\n\n // Everything the paint, hit-testing and the view registry read that a React\n // render owns. `useLatest` and the insertion effect below publish committed\n // renders only, ahead of every layout effect in the commit, any of which may\n // ask for a sync paint.\n const paintInputs = {\n layers: layersWithDebug, width, height, debugSink,\n frameStats: resolvedDebugConfig?.fps === true,\n dpr: dprProp, layerVisibility, layerOrder, layerGroups, shaders,\n flattenTolerance,\n };\n const paintInputsRef = useLatest(paintInputs);\n useInsertionEffect(() => {\n adoptControlled();\n helpersForLayersRef.current = helpersForLayers;\n if (helpersRef) helpersRef.current = helpersForLayers;\n if (debugSinkRef) debugSinkRef.current = debugSink;\n });\n useLayoutEffect(() => {\n announceControlled();\n });\n\n const paint = useCallback((): boolean => {\n const c = paintTargetRef.current ?? ownCanvasRef.current;\n if (!c || syncSceneLayers()) return false;\n const rect = paintRectRef.current;\n const {\n layers: paintLayers, width: w, height: h, debugSink: sink, frameStats,\n dpr: dprIn, layerVisibility: vis, layerOrder: order,\n flattenTolerance: paintFlattenTolerance,\n layerGroups: groups, shaders: paintShaders,\n } = paintInputsRef.current;\n\n // Clear sink at the top of every paint so per-frame records don't leak.\n sink?.beginFrame();\n if (sink) {\n for (let i = 0; i < paintLayers.length; i++) {\n const layer = paintLayers[i];\n if (layer.id === 'debug-overlay') continue;\n sink.recordLayer(layer.id, layer.label, layer.space ?? 'world', i);\n }\n }\n\n const renderer = lease.bind(c, { width: w, height: h, dpr: dprIn }, {\n tile: rect,\n flattenTolerance: paintFlattenTolerance,\n shaders: paintShaders,\n });\n // No WebGL2 (jsdom), or a context that is lost for now: nothing to paint.\n if (!renderer) return false;\n\n const view = viewRef.current;\n const spans: LayerDrawSpan[] | undefined = sink && frameStats ? [] : undefined;\n const paintT0 = spans ? performance.now() : 0;\n const commands = drawLayers(\n paintLayers,\n helpersForLayersRef.current,\n vis ?? NO_LAYER_VISIBILITY,\n order,\n view,\n { width: w, height: h },\n layerCacheRef.current,\n undefined,\n groups,\n spans,\n );\n renderer.render(commands, viewToMat3(view), spans ? { spans } : undefined);\n if (sink && spans) sink.recordFrame(frameStatsOf(spans, renderer.lastFrameStats(), performance.now() - paintT0));\n paintedVersionRef.current = contentVersionRef.current?.() ?? 0;\n return true;\n }, [contentVersionRef, lease, paintInputsRef, paintRectRef, paintTargetRef, syncSceneLayers, viewRef]);\n useInsertionEffect(() => {\n paintRef.current = paint;\n });\n\n // A tripwire, not a list of values this effect uses: every paint input that\n // arrives on a render must appear here, or changing it paints stale.\n // `viewChromeState` stands in for the whole overlay-aware set the layer\n // helpers expose — it re-memoizes on exactly the selection, bounds and\n // preview inputs they read. What moves between renders instead (a scene\n // write, a gesture pump, a late image decode) pushes its own redraw.\n // Layout, not passive, so a `syncPaint` surface lands its pixels in the same\n // commit as the DOM.\n useLayoutEffect(() => {\n requestRedraw();\n }, [layersWithDebug, width, height, viewProp, debugSink, dprProp, flattenTolerance,\n layerVisibility, layerOrder, layerGroups, shaderIdKey, syncPaint,\n viewChromeState, getIsVisible, paintTarget, paintRect?.x, paintRect?.y, requestRedraw]);\n\n useEffect(() => {\n const layerCache = layerCacheRef.current;\n return () => {\n layerCache.clear();\n clearSubscribers();\n };\n }, [clearSubscribers]);\n\n useEffect(() => {\n if (!shaderIdKey) return;\n const ids = shaderIdKey.split('|');\n let seen = ids.map(getProgramSource);\n return programSourceRegistry.subscribe(() => {\n const now = ids.map(getProgramSource);\n const changed = now.some((src, i) => src !== seen[i]);\n seen = now;\n if (changed) requestRedraw();\n });\n }, [shaderIdKey, requestRedraw]);\n\n // Resolved during render, so it reads this render's view, not the ref's\n // last committed one.\n const toolsCursorTier = tools\n ? resolveToolsCursor(tools, toolsCtxBase)\n : undefined;\n // A painted tool cursor gets `none` here and the layer draws it instead.\n const toolsCursor =\n toolsCursorTier === undefined\n ? undefined\n : toolsCursorTier.kind === 'css'\n ? toolsCursorTier.css\n : 'none';\n const effectiveStyle: React.CSSProperties | undefined = toolsCursor\n ? { ...style, cursor: toolsCursor }\n : style;\n const toolsPainted: PaintedCursor | null =\n toolsCursorTier?.kind === 'painted' ? toolsCursorTier : null;\n // Keyed on the value, not the object: the tier is rebuilt every render, and\n // publishing from render would notify a repaint mid-render.\n const toolsPaintedKey = toolsPainted\n ? `${toolsPainted.glyph}|${toolsPainted.angle}|${toolsPainted.size}|${toolsPainted.worldRadius}`\n : '';\n useEffect(() => {\n paintedCursor.setBase(toolsPainted);\n // `toolsPainted` is a fresh object each render; the key is its identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [paintedCursor, toolsPaintedKey]);\n\n // The four pointer handlers, for whichever element takes input: JSX props on\n // the `<canvas>` this component renders, listeners on the caller's when\n // detached.\n const layersForMoveRef = useLatest(layersWithDebug);\n const press = useCallback((el: HTMLElement): void => {\n if (autoFocusOnPointerDown) el.focus();\n pointerDownRef.current = true;\n }, [autoFocusOnPointerDown]);\n const release = useCallback((): void => { pointerDownRef.current = false; }, []);\n const hover = useCallback((el: HTMLElement, e: PointerEvent): void => {\n if (pointerDownRef.current) return;\n const view = viewRef.current;\n const [worldX, worldY] = toWorld(el, e.clientX, e.clientY, view, clientToWorldRef.current);\n const visibility = layerVisibilityRef.current ?? NO_LAYER_VISIBILITY;\n // Same gate as `hitTestExtrasIn`: a layer nobody can see takes no input.\n for (const layer of layersForMoveRef.current) {\n if (!layer.onUncapturedMove || !isLayerPainted(layer, visibility, layerOrderRef.current)) continue;\n layer.onUncapturedMove(worldX, worldY, e, view, dimsRef.current);\n }\n }, [clientToWorldRef, dimsRef, layerOrderRef, layerVisibilityRef, layersForMoveRef, viewRef]);\n const leave = useCallback((): void => {\n pointerDownRef.current = false;\n for (const layer of layersForMoveRef.current) layer.onUncapturedLeave?.();\n }, [layersForMoveRef]);\n useEffect(() => {\n if (!detached || !inputElement) return;\n const el = inputElement;\n const onDown = (): void => press(el);\n const onMove = (e: PointerEvent): void => hover(el, e);\n const onUp = release;\n const onLeave = leave;\n const onMenu = (e: Event): void => e.preventDefault();\n el.addEventListener('pointerdown', onDown);\n el.addEventListener('pointermove', onMove);\n el.addEventListener('pointerup', onUp);\n el.addEventListener('pointerleave', onLeave);\n el.addEventListener('contextmenu', onMenu);\n return () => {\n el.removeEventListener('pointerdown', onDown);\n el.removeEventListener('pointermove', onMove);\n el.removeEventListener('pointerup', onUp);\n el.removeEventListener('pointerleave', onLeave);\n el.removeEventListener('contextmenu', onMenu);\n };\n }, [detached, inputElement, press, hover, release, leave]);\n\n // The cursor is a tool's, but under `paintInto` it has no element of ours to\n // sit on. Written imperatively rather than by the caller, so a tool's cursor\n // keeps working without the caller mirroring tool state.\n useEffect(() => {\n if (!detached || !inputElement) return;\n inputElement.style.cursor = toolsCursor ?? '';\n }, [detached, inputElement, toolsCursor]);\n\n const huds = (\n <>\n {cursorCoordsHud && (\n <CursorCoordsHud\n canvasRef={canvasRef}\n {...(detached ? { anchorRef: canvasRef } : {})}\n viewRef={viewRef}\n toWorld={toWorldForHud}\n />\n )}\n {pickHud && (\n <PickHud\n canvasRef={canvasRef}\n {...(detached ? { anchorRef: canvasRef } : {})}\n viewRef={viewRef}\n toWorld={toWorldForHud}\n pickEvery={stablePickEveryForHud}\n pickBest={stablePickBestForHud}\n />\n )}\n {modalityHud && (\n <ModalityHud\n canvasRef={canvasRef}\n {...(detached ? { anchorRef: canvasRef } : {})}\n modeId={typeof modalityHud === 'object' ? modalityHud.modeId : undefined}\n />\n )}\n </>\n );\n\n // Detached: no element of our own, but the HUDs are DOM and still belong to\n // this pane. Held until the input element arrives — `useHostAnchor` resolves\n // its host on mount and again only when the panel or the window moves, so a\n // HUD mounted against a null host would latch off.\n if (detached) return inputElement ? huds : null;\n\n return (\n <>\n <canvas\n ref={setOwnCanvas}\n width={width}\n height={height}\n tabIndex={tabIndex}\n className={className}\n style={effectiveStyle}\n onFocus={onFocus}\n onBlur={onBlur}\n onPointerDown={(e) => press(e.currentTarget)}\n onPointerMove={(e) => hover(e.currentTarget, e.nativeEvent)}\n onPointerUp={release}\n onPointerLeave={leave}\n // Suppress the browser's default right-click menu over the canvas.\n // Canvases are interaction surfaces; the browser's context menu\n // (Save Image / Inspect Element / etc.) is almost never what the\n // user wants, and right-click is a useful gesture surface that\n // tools may consume. Consumers using right-click for their own\n // gestures should add their own onContextMenu handler — calling\n // `e.preventDefault()` is the no-op default; calling something\n // else still works (this handler runs before the default menu).\n onContextMenu={(e) => e.preventDefault()}\n />\n {huds}\n </>\n );\n}\n\n/**\n * Forward-ref'd `<canvas>` wrapper. Generic over the object and pose types —\n * TypeScript will infer them from the `adapter` (or `move`/`resize`) prop.\n */\nexport const Canvas = forwardRef(CanvasInner) as <\n TNode extends { id: string } = { id: string },\n TPose = TNode,\n>(\n props: CanvasProps<TNode, TPose> & { ref?: React.ForwardedRef<CanvasExtensionApi> },\n) => ReturnType<typeof CanvasInner>;\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,IAAME,MAAiB,MAAyB;AA6ahD,SAASC,GACP,GACA,GAC4B;CAC5B,IAAMC,IAAKC,EAAM,iBAAiBA,EAAM,QAClCC,IAAOF,MAAO,OAAO,KAAA,IAAYC,EAAM,SAASD;CACtD,IAAKE,GAAM,QACX;MAAI,OAAOA,EAAK,UAAW,YAAY,OAAOC,EAAkBD,EAAK,MAAM;EAC3E,IAAKE,GASL,IAAI;GACF,IAAMC,IAAOD,EAAQ;GACrB,OAAOD,EAAkBD,EAAK,OAAO;IAAE,GAAGG;IAAM,SAAS;GAAK,CAAC,CAAC;EAClE,QAAQ;GACN;EACF;CAf2E;AAgB7E;AAIA,IAAMC,KAA+C,CAAC;AAKtD,SAASC,GACP,GACA,GACA,GACA,GACA,GACkB;CAElB,OADIC,IAAiBA,EAASC,GAAQC,GAASC,CAAO,IAC/Cf,EAAoBc,GAASC,GAASF,EAAO,sBAAsB,GAAGI,CAAI;AACnF;AAEA,SAASC,EACP,GACA,IACA;CACA,IAA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AA;EACGmP,MACC,kBAACC,IAAD;GACa;GACX,GAAK1M,IAAW,EAAE,WAAWL,EAAU,IAAI,CAAC;GACnC;GACT,SAASiG;EACV,CAAA;EAEF+G,MACC,kBAACC,IAAD;GACa;GACX,GAAK5M,IAAW,EAAE,WAAWL,EAAU,IAAI,CAAC;GACnC;GACT,SAASiG;GACT,WAAWN;GACX,UAAUK;EACX,CAAA;EAEFkH,MACC,kBAACC,IAAD;GACa;GACX,GAAK9M,IAAW,EAAE,WAAWL,EAAU,IAAI,CAAC;GAC5C,QAAQ,OAAOkN,MAAgB,WAAWA,GAAY,SAAS,KAAA;EAChE,CAAA;CAEH,EAAA,CAAA;CASJ,OAFI7M,IAAiBE,IAAeqM,KAAO,OAGzC,mBAAAjP,IAAA,EAAA,UAAA,CACE,kBAAC,UAAD;EACE,KAAKwC;EACE;EACC;EACE;EACC;EACX,OAAOyL;EACE;EACD;EACR,gBAAgB,MAAMK,GAAM,EAAE,aAAa;EAC3C,gBAAgB,MAAMG,GAAM,EAAE,eAAe,EAAE,WAAW;EAC1D,aAAaD;EACb,gBAAgBG;EAShB,gBAAgB,MAAM,EAAE,eAAe;CACxC,CAAA,GACAM,EACD,EAAA,CAAA;AAEN;AAMA,IAAaQ,IAASC,GAAWzO,CAAW"}
|
|
1
|
+
{"version":3,"file":"Canvas.js","names":["clientToWorld","clientToWorldHelper","alwaysVisible","NO_SELECTION","NO_LAYER_VISIBILITY","CanvasInner","dprProp","layersMap","clientToWorld$1","geometry","AUTO_POSE_DESCRIPTOR","debugProp","props","debugSink","debugOverlay","useDebugSink","canvasRef","useRef","ownCanvasRef","setOwnCanvas","useCallback","el","detached","paintInto","inputElement","paintTarget","paintTargetRef","useLatest","paintRect","paintRectRef","helpersForLayersRef","dimsRef","gateRef","paintRef","useCanvasSurface","contentVersionRef","contentVersion","paintedVersionRef","getPaintedVersion","extrasVersion","setExtrasVersion","useState","extrasRef","registerLayer","layer","n","hitTestExtrasIn","layers","gate","isVisible","visibility","order","only","isLayerPainted","hit","worldX","worldY","data","view","dims","controlledView","viewState","hitTestExtras","frame","viewRef","clientToWorldRef","toWorld","clientX","clientY","override","clientToWorld","element","registerMountedCanvas","getView","paintedCursor","useMemo","createPaintedCursorState","paintedCursorLayer","createPaintedCursorLayer","requestRedraw","cursorSink","createCursorSink","getSurfaceRect","origin","w","h","ref","subscribeFrame","subscribeBeforePaint","subscribeResume","setView","subscribeView","getDebug","layerCacheRef","viewRegistry","useOptionalViewRegistry","selectedIdsForWiring","selection","viewHelpers","viewChromeState","useViewHelpers","surfaceHelpers","helpersForLayers","backgroundLayer","backgroundFill","createBackgroundFillLayer","standardLayers","slot","entry","isCustomEntry","out","composeOrderedLayers","decorationLayer","tools","placeToolOverlays","viewRegistryVersion","useSyncExternalStore","cb","surfaceLayersRef","c","r","corner","x","y","layersWithDebug","withViews","redraw","offs","off","shaderIdKey","shaderKeyOf","shaders","paintInputsRef","useInsertionEffect","adoptControlled","helpersRef","debugSinkRef","useLayoutEffect","paint","rect","paintLayers","sink","timed","dprIn","paintFlattenTolerance","groups","paintShaders","debugFrame","beginDebugFrame","renderer","lease","vis","spans","commands","drawLayers","viewToMat3","width","height","flattenTolerance","layerVisibility","layerOrder","layerGroups","syncPaint","getIsVisible","useEffect","layerCache","clearSubscribers","useToolCursor","style","useSurfaceInput","autoFocusOnPointerDown","e","surfaceBox","className","Canvas","forwardRef"],"sources":["../../src/canvas/Canvas.tsx"],"sourcesContent":["/**\n * Low-level WebGL surface + viewport primitive. Composes layers into a single GL render pass,\n * applies a view transform, and delivers hover to the layers that ask for it. It routes no\n * gesture: `<SceneCanvas>` mounts the gesture dispatcher on this same element. Canvas owns NO\n * scene-shaped state — selection, picking, kind registry, scene-aware overlays all live in\n * `<SceneCanvas>`, which wraps it.\n *\n * The `layers` prop is a map keyed by slot name, every slot already a layer. Standard slots\n * render at a canonical position; custom entries (any other key, value carrying `.layer`) insert\n * at `after`/`before` an existing slot, defaulting to the top.\n *\n * @internal\n * @deprecated Bare `<Canvas>` is not a supported consumer surface.\n * Use `<SceneCanvas>` instead.\n */\n\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport type React from 'react';\nimport type { Paint } from '@weasel-js/paint';\nimport { composeOrderedLayers, placeToolOverlays } from './layerOrder';\nimport { STANDARD_SLOTS, isCustomEntry, type CanvasLayers } from './layerSlots';\nimport type { CanvasExtensionApi } from './canvasExtension';\nimport { registerMountedCanvas } from './mountedCanvases';\nimport type { GestureSource } from './gestureBounds';\nimport { useViewHelpers } from './useViewHelpers';\nimport { useSurfaceInput } from './useSurfaceInput';\nimport type { CanvasViewState } from './useCanvasView';\nimport { useOptionalViewRegistry } from './viewRegistry';\nimport { useCanvasSurface } from './useCanvasSurface';\nimport type { CanvasHelpers, CanvasSurfaceHelpers, ViewPoseAdapter } from './useViewHelpers';\n\nimport { useLatest } from '@weasel-js/react';\nimport type { View } from 'core/viewport/view';\nimport { clientToWorld as clientToWorldHelper } from 'core/viewport/clientToWorld';\nimport {\n drawLayers, isLayerPainted,\n type Dims, type LayerCommandCache, type LayerGroup, type RedrawSource, type RenderLayer,\n} from 'core/layers/render';\nimport { viewToMat3, type ShaderProgramHandle } from '@weasel-js/renderer';\nimport { createBackgroundFillLayer } from 'core/layers/backgroundFill';\nimport { shaderKeyOf } from './canvasRenderer';\nimport { surfaceBox } from './surfaceBox';\nimport {\n type SelectionApi,\n} from 'core/selection/useSelection';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { CanvasDebugSink, DebugConfig } from '../debug/types';\nimport { beginDebugFrame, useDebugSink } from '../debug/useDebugSink';\n\nconst alwaysVisible = (_id: string): boolean => true;\nimport { createCursorSink, createPaintedCursorState } from '@weasel-js/cursor';\nimport type { PaintedCursorState } from '@weasel-js/cursor';\nimport { useToolCursor } from './useToolCursor';\nimport { createPaintedCursorLayer } from './paintedCursorLayer';\n\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\n/**\n * Props for `<Canvas>`. Canvas is scene-agnostic: it owns the GL surface, view state, hover\n * delivery, and slot composition, and not gesture dispatch, selection state, picking logic,\n * kind registries, or scene-aware overlays.\n */\nexport interface CanvasProps<TPose = unknown> {\n /** CSS-pixel width. */\n width: number;\n /** CSS-pixel height. */\n height: number;\n\n /** Drawing-buffer density (device pixels per CSS pixel). When omitted the\n * canvas reads `window.devicePixelRatio` per paint. */\n dpr?: number;\n\n /** Flatness tolerance for curve tessellation, in world units. Forwarded to\n * `WeaselRendererOptions.flattenTolerance`. Leave unset for the cached\n * default (`DEFAULT_FLATTEN_TOLERANCE`, 0.5); a scene whose world unit is\n * not a pixel — feet, inches, millimetres — needs a value scaled to its\n * unit or sub-unit curves flatten to a handful of vertices. */\n flattenTolerance?: number;\n\n /** The version of whatever content this canvas draws, sampled at paint time\n * and reported by {@link CanvasExtensionApi.getPaintedVersion}.\n * `<SceneCanvas>` wires this to `scene.getVersion`. Chrome that must not\n * show DOM ahead of pixels compares the two and defers a frame. */\n contentVersion?: () => number;\n\n /** Paint inside the React commit rather than on the next animation frame.\n * Costs a synchronous paint per commit and per redraw request; buys\n * single-commit consistency between React-rendered DOM and canvas pixels.\n * For consumers with DOM chrome pinned to canvas content that cannot\n * tolerate a frame of skew. Live: toggling it switches modes from the next\n * redraw on. A redraw requested from inside a layer's `draw`, or from a\n * `subscribeFrame` callback, still waits for a frame — painting it in place\n * would recurse. */\n syncPaint?: boolean;\n\n /** External state the paint reads that no layer declares — typically what\n * an `alphaFor` consults. Each source is subscribed while mounted and\n * repaints the canvas when it notifies. A layer that reads outside state\n * declares it on `RenderLayer.subscribe` instead. */\n redrawOn?: readonly RedrawSource[];\n\n /** Adapter the pose and bounds lookups on `helpersRef` read. */\n adapter?: ViewPoseAdapter<TPose>;\n\n /** Layer map. See module docstring for slot semantics. */\n layers: CanvasLayers;\n\n /**\n * Current selection state; Canvas owns none of its own and never writes it. When absent,\n * Canvas behaves as if nothing is selected: no selection chrome.\n */\n selection?: SelectionApi;\n\n\n /**\n * How to read and rewrite a pose. Drives the default `boundsOf` fallback and the\n * selection-overlay bounds. Defaults to the rect identity (`AUTO_POSE_DESCRIPTOR`); supply\n * one for a non-rect pose type.\n */\n poseDescriptor?: PoseDescriptor<TPose>;\n\n /**\n * Override for committed bounds lookup, taking precedence over the `poseDescriptor`-derived\n * fallback. Used by the selection overlay, the multi-select union AABB, and\n * `helpersRef.getEffectiveBounds`.\n */\n boundsOf?: (id: string) => Bounds | null;\n /** Bounds of `id` drawn at an in-flight pose — how chrome boxes a preview.\n * Defaults to the `poseDescriptor`'s box of that pose. */\n boundsOfPose?: (id: string, pose: TPose) => Bounds | null;\n /**\n * Custom pointer-to-world coordinate transform, overriding the default canvas-rect\n * calculation. Useful for consumers that apply an additional CSS transform to the canvas\n * element.\n */\n clientToWorld?: (canvas: HTMLElement, cx: number, cy: number) => [number, number];\n\n /**\n * Paint into a caller-owned canvas at a rect on it, instead of an element\n * this component creates. `x`/`y` are the rect's top-left in that canvas's\n * CSS pixels; the rect's size is the existing `width`/`height` props.\n *\n * Requires `inputElement`: with no element of its own there is nowhere for\n * pointer input, focus or the cursor to live, and nothing renders.\n *\n * N canvases can then share one GL context and one buffer.\n */\n paintInto?: { canvas: HTMLCanvasElement | null; x: number; y: number };\n /**\n * The element pointer input, focus and the cursor come from, and the element\n * every client→world conversion measures. Only read alongside `paintInto`;\n * an attached canvas uses the one it renders.\n */\n inputElement?: HTMLElement | null;\n\n /** Class for the `<canvas>` this component renders. Under `paintInto` it\n * renders none, and the input element is the caller's to style. */\n className?: string;\n /** Inline style for the `<canvas>` this component renders; a tool's cursor\n * is merged over it. Not applied under `paintInto`, where only that cursor\n * is written, onto the input element. */\n style?: React.CSSProperties;\n /** Tab order of the `<canvas>` this component renders. Default 0, so the\n * canvas is focusable. Not applied under `paintInto`: whether the input\n * element can take focus is the caller's to decide. */\n tabIndex?: number;\n /** Fired when the element input comes from gains focus: the canvas, or\n * under `paintInto` the `inputElement`. Called with the DOM event. */\n onFocus?: (event: FocusEvent) => void;\n /** Fired when that element loses focus. */\n onBlur?: (event: FocusEvent) => void;\n /**\n * When `true` (default), the canvas element receives focus on `pointerdown` so keyboard\n * events are captured without a separate click-to-focus step. Set to `false` where\n * auto-focus would steal focus from sibling inputs.\n */\n autoFocusOnPointerDown?: boolean;\n\n /** The tool set. Canvas reads the active tool's cursor and its overlays;\n * it dispatches nothing to a tool. */\n tools?: import('../tools/overlayBinding').ToolsApi;\n\n /** The camera this surface looks through, from `useCanvasView`. Whoever\n * made it holds the view props; the surface adopts and announces a\n * controlled view among its own effects, and repaints when one moves. */\n viewState: CanvasViewState;\n /**\n * Mutable ref Canvas writes overlay-aware pose/bounds lookups to on every render. Custom\n * layers can read it from inside their `draw` closure to reflect in-flight gestures\n * (move/resize/rotate) instead of the committed scene; an id outside the active overlay\n * falls back to the adapter.\n */\n helpersRef?: React.MutableRefObject<CanvasHelpers<TPose> | null>;\n\n /**\n * Debug overlay configuration.\n * - `undefined` (default): read `?debug=…` from the URL.\n * - `false`: force off, ignore URL.\n * - `DebugConfig` object: force on with that config, ignore URL.\n *\n * When enabled, the Canvas appends a screen-space `debug-overlay` layer and builds the\n * sink it paints: each paint records into it, and the layer helpers and the ref handle's\n * `getDebug` hand it to whatever else records.\n */\n debug?: DebugConfig | false;\n\n /** Test-only escape hatch: writes the live debug sink to this ref so tests\n * can call `snapshot()` after a render. No effect when debug is off. */\n debugSinkRef?: React.MutableRefObject<CanvasDebugSink | null>;\n\n /**\n * Shader programs to compile before the frame that first draws them; one\n * not named here compiles on that frame. Each handle comes from a\n * module-level `registerProgram()`. The array is read at each paint and\n * registered again when its ids change, so a handle added after mount is\n * picked up. Re-registering one of these ids with new source repaints the\n * canvas, and the renderer recompiles it for that frame.\n */\n shaders?: ShaderProgramHandle[];\n\n /**\n * Preview-pose lookup, so selection chrome tracks the ghost during dispatcher-driven\n * drags. Returns `null` / `undefined` when no preview is in flight.\n */\n previewPoseExtra?: (id: string) => unknown;\n\n /**\n * In-flight gesture state `<Canvas>` can't see for itself. Backs the `getGestureBounds` /\n * `subscribeGestures` / `getGestureVersion` trio on `helpersRef`. Unwired, those three\n * report \"no gesture in flight\" and never fire.\n */\n gestureSource?: GestureSource;\n\n /**\n * Fill for the full canvas surface, drawn as a screen-space layer beneath every other\n * layer, the grid and anything anchored before it included — independent of pan / zoom.\n */\n backgroundFill?: Paint;\n\n /**\n * Mode-owned decoration layer (e.g. path-edit anchor dots). Composed as a `decorationLayer`\n * entry in `layers` with no anchor, which this prop replaces: it paints above every slot\n * and every other custom layer, and beneath a tool's `'top'` overlays. A tool's\n * selection-anchored overlays sit beneath it too while there is selection chrome to anchor\n * them; with that slot empty they fall to the tail and paint above it.\n */\n decorationLayer?: RenderLayer<unknown>;\n\n /**\n * Chrome-caps visibility resolver. Exposed on `helpersForLayers.getIsVisible` so custom\n * layers (notably `composeAffordanceLayer`) can gate paint by chrome id, and threaded into\n * hit-testing so the same gate applies there. Called fresh per draw / per hitTest. Omit to\n * leave every chrome element visible.\n */\n getIsVisible?: () => (id: string) => boolean;\n\n /**\n * Show or hide whole render layers by id. An id absent from the map falls\n * back to the layer's own `defaultVisible`, and a layer marked `alwaysOn`\n * ignores the map entirely.\n *\n * Hiding a layer also stops it claiming pointer events through\n * `hitTestExtras` — a layer nobody can see must not swallow a click.\n *\n * This is `getIsVisible`'s coarser sibling: that one gates individual\n * chrome elements *within* a layer, this one gates the layer.\n */\n layerVisibility?: Record<string, boolean>;\n\n /**\n * Draw order, by layer id, bottom first. Omit for the order the layers\n * arrive in.\n *\n * **A listed order is the whole list:** any layer whose id is missing from\n * it is not drawn. Reordering two layers means naming all of them.\n */\n layerOrder?: string[];\n\n /**\n * Runs of consecutive layers that composite as one — the surface for blurring the world\n * while the chrome above it stays sharp. Members are named by layer id. See\n * {@link LayerGroup}.\n */\n layerGroups?: readonly LayerGroup[];\n}\n\n\nconst NO_SELECTION: SelectionApi['current'] = [];\n\nconst NO_LAYER_VISIBILITY: Record<string, boolean> = {};\n\nfunction CanvasInner<TPose>(\n props: CanvasProps<TPose>,\n ref: React.ForwardedRef<CanvasExtensionApi>,\n) {\n const {\n width,\n height,\n dpr: dprProp,\n flattenTolerance,\n contentVersion,\n syncPaint = false,\n redrawOn,\n adapter,\n layers: layersMap,\n selection,\n boundsOf,\n boundsOfPose,\n clientToWorld,\n paintInto,\n inputElement,\n poseDescriptor: geometry = AUTO_POSE_DESCRIPTOR as unknown as PoseDescriptor<TPose>,\n className,\n style,\n tabIndex = 0,\n onFocus,\n onBlur,\n autoFocusOnPointerDown = true,\n helpersRef,\n tools,\n viewState,\n debug: debugProp,\n debugSinkRef,\n shaders,\n previewPoseExtra,\n gestureSource,\n backgroundFill,\n decorationLayer,\n getIsVisible,\n layerVisibility,\n layerOrder,\n layerGroups,\n } = props;\n\n const { sink: debugSink, overlay: debugOverlay, frameStats, getDebug } = useDebugSink(debugProp);\n\n // The element input comes from and every client→world conversion measures: the `<canvas>`\n // this component renders, or under `paintInto` the caller's `inputElement`.\n const canvasRef = useRef<HTMLElement | null>(null);\n // The `<canvas>` this component rendered, if it rendered one. `paint` is the\n // only thing that needs a real canvas, for `getContext`.\n const ownCanvasRef = useRef<HTMLCanvasElement | null>(null);\n // Stable, so a commit does not detach the element: an inline ref is nulled\n // until the layout phase reaches it, and a sync paint asked for before that\n // finds no canvas.\n const setOwnCanvas = useCallback((el: HTMLCanvasElement | null) => {\n ownCanvasRef.current = el;\n canvasRef.current = el;\n }, []);\n const detached = !!paintInto;\n // The detached input element reaches `canvasRef` at commit; the own canvas\n // arrives through `setOwnCanvas`, React's ref callback.\n useInsertionEffect(() => {\n if (detached) canvasRef.current = inputElement ?? null;\n });\n // Where pixels go. Split from `canvasRef` only when detached.\n const paintTarget = detached ? (paintInto.canvas ?? null) : null;\n const paintTargetRef = useLatest(paintTarget);\n const paintRect = detached ? { x: paintInto.x, y: paintInto.y } : null;\n const paintRectRef = useLatest(paintRect);\n\n // Read by `hitTestExtras`, which is built once and must see live values.\n const helpersForLayersRef = useRef<CanvasHelpers<TPose> | null>(null);\n const dimsRef = useLatest({ width, height });\n // Which layers reach the screen, and which chrome within them: asked by the\n // paint and by every hit-test.\n const gateRef = useLatest({ getIsVisible, layerVisibility, layerOrder });\n\n // React does not drive the paint; the frame loop does. The thunk defers to\n // `paint` below, which needs inputs this render has not computed yet.\n const paintRef = useRef<() => boolean>(() => false);\n const { lease, requestRedraw, subscribeFrame, subscribeBeforePaint, subscribeResume } = useCanvasSurface(\n useCallback(() => paintRef.current(), []),\n { syncPaint, target: canvasRef, dpr: dprProp, redrawOn, shaders },\n );\n\n const contentVersionRef = useLatest(contentVersion);\n const paintedVersionRef = useRef(0);\n const getPaintedVersion = useCallback(() => paintedVersionRef.current, []);\n\n // The `layersWithDebug` memo reads `extrasRef.current`, so registration has\n // to bump state to re-run it. Rare (a HUD attaching, a loupe mounting).\n const [extrasVersion, setExtrasVersion] = useState(0);\n const extrasRef = useRef<Set<RenderLayer<unknown>>>(new Set());\n const registerLayer = useCallback((layer: RenderLayer<unknown>) => {\n extrasRef.current.add(layer);\n setExtrasVersion(n => n + 1);\n return () => {\n extrasRef.current.delete(layer);\n setExtrasVersion(n => n + 1);\n };\n }, []);\n\n // Hit-test registered layers topmost-first: registration order is draw order, so the\n // last-registered layer gets first refusal. `<SceneCanvas>` folds this into its\n // `affordanceAt` thunk; Canvas has the layers but not the dispatcher.\n const hitTestExtrasIn = useCallback((\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n only?: readonly RenderLayer<unknown>[],\n ) => {\n const layers = [...extrasRef.current].reverse();\n const gate = gateRef.current;\n const isVisible = gate.getIsVisible?.() ?? alwaysVisible;\n const visibility = gate.layerVisibility ?? NO_LAYER_VISIBILITY;\n const order = gate.layerOrder;\n for (const layer of layers) {\n if (!layer.hitTest) continue;\n if (only && !only.includes(layer)) continue;\n if (!isLayerPainted(layer, visibility, order)) continue;\n const hit = layer.hitTest(worldX, worldY, data, view, dims, isVisible);\n if (hit) return { layerId: layer.id, hit };\n }\n return null;\n }, [gateRef]);\n\n const {\n viewRef, controlled: controlledView, setView, getView, subscribeView,\n adoptControlled, announceControlled, clearSubscribers,\n } = viewState;\n\n const hitTestExtras = useCallback((\n worldX: number,\n worldY: number,\n frame?: { view: View; dims: Dims },\n ) => hitTestExtrasIn(\n worldX,\n worldY,\n frame?.view ?? viewRef.current,\n frame?.dims ?? dimsRef.current,\n helpersForLayersRef.current,\n ), [hitTestExtrasIn, dimsRef, viewRef]);\n\n // The one client→world conversion: hover, the view registry and both\n // handles answer with it, so a `clientToWorld` override reaches all of them\n // or none.\n const clientToWorldRef = useLatest(clientToWorld);\n const toWorld = useCallback((clientX: number, clientY: number): [number, number] => {\n const el = canvasRef.current;\n if (!el) return [clientX, clientY];\n const override = clientToWorldRef.current;\n if (override) return override(el, clientX, clientY);\n return clientToWorldHelper(clientX, clientY, el.getBoundingClientRect(), viewRef.current);\n }, [clientToWorldRef, viewRef]);\n\n useLayoutEffect(() => {\n const element = canvasRef.current;\n if (!element) return;\n return registerMountedCanvas({ element, getView });\n }, [detached, inputElement, getView]);\n\n // The painted tier's channel. `<Canvas>` owns it because it owns both ends:\n // the tool cursor that feeds it and the frame loop that has to repaint when\n // it changes. The hover pump reaches it through the ref handle below.\n const paintedCursor = useMemo<PaintedCursorState>(() => createPaintedCursorState(), []);\n const paintedCursorLayer = useMemo(\n () => createPaintedCursorLayer(paintedCursor),\n [paintedCursor],\n );\n // An idle pointermove repaints nothing on its own, so a cursor the compositor\n // is not drawing needs its own pump. The store stays quiet unless something\n // painted is actually on screen.\n useEffect(() => paintedCursor.subscribe(() => { requestRedraw(); }), [paintedCursor, requestRedraw]);\n // The one writer of the input element's `cursor` style: the tool's cursor\n // from here, a hover cursor from the pump, which reaches it through the handle.\n const cursorSink = useMemo(\n () => createCursorSink({ element: () => canvasRef.current, painted: () => paintedCursor }),\n [paintedCursor],\n );\n\n const getSurfaceRect = useCallback(() => {\n const origin = paintRectRef.current;\n const { width: w, height: h } = dimsRef.current;\n return { x: origin?.x ?? 0, y: origin?.y ?? 0, width: w, height: h };\n }, [dimsRef, paintRectRef]);\n\n useImperativeHandle(ref, () => ({\n // Named rather than read off `canvasRef` so the handle rebuilds when a\n // detached surface's input element arrives, which is a render later.\n element: detached ? inputElement ?? null : canvasRef.current,\n surface: detached ? paintInto?.canvas ?? null : ownCanvasRef.current,\n getSurfaceRect,\n clientToWorld: toWorld,\n requestRedraw,\n subscribeFrame,\n subscribeBeforePaint,\n subscribeResume,\n registerLayer,\n hitTestExtras,\n getView,\n setView,\n subscribeView,\n getPaintedVersion,\n paintedCursor,\n cursorSink,\n getDebug,\n }), [canvasRef, ownCanvasRef, detached, inputElement, paintInto?.canvas,\n getSurfaceRect, toWorld, requestRedraw, subscribeFrame, subscribeBeforePaint, subscribeResume,\n registerLayer,\n hitTestExtras, getView, setView, subscribeView, getPaintedVersion,\n paintedCursor, cursorSink, getDebug]);\n\n const layerCacheRef = useRef<LayerCommandCache>(new Map());\n\n // Views registered on this surface — declared as `views` descriptors or\n // mounted as `<CanvasView>` children. Null outside a surface that mounts a\n // registry, which is the single-view case.\n const viewRegistry = useOptionalViewRegistry();\n\n const selectedIdsForWiring = selection?.current ?? NO_SELECTION;\n\n // One view's overlay-aware state. A hook, so N views are N components each\n // calling it once — not a loop in this body.\n const { helpers: viewHelpers, chromeState: viewChromeState } = useViewHelpers<TPose>({\n adapter,\n geometry,\n boundsOf,\n boundsOfPose,\n selection: selectedIdsForWiring,\n gestureSource,\n previewPoseExtra,\n getIsVisible: () => gateRef.current.getIsVisible?.() ?? alwaysVisible,\n });\n\n const surfaceHelpers: CanvasSurfaceHelpers = {\n getDebug: () => debugSink,\n };\n const helpersForLayers: CanvasHelpers<TPose> = { ...viewHelpers, ...surfaceHelpers, viewId: null };\n\n const backgroundLayer = useMemo(\n () => (backgroundFill ? createBackgroundFillLayer(backgroundFill) : undefined),\n [backgroundFill],\n );\n\n const layers = useMemo<RenderLayer<unknown>[]>(() => {\n const standardLayers: Partial<\n Record<(typeof STANDARD_SLOTS)[number], RenderLayer<unknown>>\n > = {};\n for (const slot of ['grid', 'cellHighlight', 'selectionOverlay'] as const) {\n const entry = layersMap[slot];\n if (isCustomEntry(entry)) standardLayers[slot] = entry.layer;\n }\n const out: RenderLayer<unknown>[] = composeOrderedLayers(\n decorationLayer ? { ...layersMap, decorationLayer: { layer: decorationLayer } } : layersMap,\n standardLayers, layersMap.scene?.layers, backgroundLayer,\n );\n if (tools) {\n placeToolOverlays(out, standardLayers.selectionOverlay, tools.getActiveOverlays);\n }\n return out;\n }, [layersMap, tools, backgroundLayer, decorationLayer]);\n\n const viewRegistryVersion = useSyncExternalStore(\n useCallback((cb: () => void) => viewRegistry?.subscribe(cb) ?? (() => {}), [viewRegistry]),\n () => viewRegistry?.getVersion() ?? 0,\n () => 0,\n );\n\n // The stack a view paints through its own camera is this canvas's, before\n // the views themselves are folded in — otherwise a view would contain\n // itself. Published by reference and read at draw time.\n const surfaceLayersRef = useLatest<readonly RenderLayer<unknown>[]>(layers);\n useEffect(() => {\n return viewRegistry?.attachSurface({\n origin: () => {\n const c = canvasRef.current;\n if (!c) return { left: 0, top: 0 };\n const r = c.getBoundingClientRect();\n return { left: r.left, top: r.top };\n },\n view: () => viewRef.current,\n dims: () => dimsRef.current,\n layers: () => surfaceLayersRef.current,\n requestRedraw,\n chromeState: () => helpersForLayersRef.current!.getChromeState(),\n hitTestExtras: hitTestExtrasIn,\n clientToWorld: toWorld,\n claimsAbove: (x, y) => {\n const corner = canvasRef.current?.getBoundingClientRect();\n const [worldX, worldY] = toWorld(x + (corner?.left ?? 0), y + (corner?.top ?? 0));\n return hitTestExtrasIn(worldX, worldY, viewRef.current, dimsRef.current, helpersForLayersRef.current) !== null;\n },\n });\n }, [viewRegistry, canvasRef, requestRedraw, hitTestExtrasIn, dimsRef, surfaceLayersRef, viewRef, toWorld]);\n\n const layersWithDebug = useMemo(() => {\n // Views paint through the surface's own stack, so they sit above it and\n // below both the debug overlay and externally-registered layers.\n const withViews = viewRegistry\n ? [...layers, ...viewRegistry.list().filter((r) => r.paint).map((r) => r.layer as RenderLayer<unknown>)]\n : layers;\n const base = debugOverlay ? [...withViews, debugOverlay] : withViews;\n // The cursor goes last: it is the one thing that is always in front of\n // everything, including a consumer's own registered layers.\n return [...base, ...extrasRef.current, paintedCursorLayer];\n // extrasVersion drives re-reads of extrasRef when layers are registered/detached;\n // viewRegistryVersion does the same for registered views.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [layers, debugOverlay, extrasVersion, viewRegistry, viewRegistryVersion,\n paintedCursorLayer]);\n\n useEffect(() => {\n const redraw = (): void => { requestRedraw(); };\n const offs: (() => void)[] = [];\n for (const layer of layersWithDebug) if (layer.subscribe) offs.push(layer.subscribe(redraw));\n return () => { for (const off of offs) off(); };\n }, [layersWithDebug, requestRedraw]);\n\n const shaderIdKey = shaderKeyOf(shaders);\n\n // Everything the paint, hit-testing and the view registry read that a React\n // render owns. `useLatest` and the insertion effect below publish committed\n // renders only, ahead of every layout effect in the commit, any of which may\n // ask for a sync paint.\n const paintInputs = {\n layers: layersWithDebug, width, height, debugSink, frameStats,\n dpr: dprProp, layerGroups, shaders,\n flattenTolerance,\n };\n const paintInputsRef = useLatest(paintInputs);\n useInsertionEffect(() => {\n adoptControlled();\n helpersForLayersRef.current = helpersForLayers;\n if (helpersRef) helpersRef.current = helpersForLayers;\n if (debugSinkRef) debugSinkRef.current = debugSink;\n });\n useLayoutEffect(() => {\n announceControlled();\n });\n\n const paint = useCallback((): boolean => {\n const c = paintTargetRef.current ?? ownCanvasRef.current;\n if (!c) return false;\n const rect = paintRectRef.current;\n const {\n layers: paintLayers, width: w, height: h, debugSink: sink, frameStats: timed,\n dpr: dprIn,\n flattenTolerance: paintFlattenTolerance,\n layerGroups: groups, shaders: paintShaders,\n } = paintInputsRef.current;\n\n const debugFrame = beginDebugFrame(sink, timed, paintLayers);\n\n const renderer = lease.bind(c, { width: w, height: h, dpr: dprIn }, {\n tile: rect,\n flattenTolerance: paintFlattenTolerance,\n shaders: paintShaders,\n });\n // No WebGL2 (jsdom), or a context that is lost for now: nothing to paint.\n if (!renderer) return false;\n\n const view = viewRef.current;\n const { layerVisibility: vis, layerOrder: order } = gateRef.current;\n const spans = debugFrame?.time();\n const commands = drawLayers(\n paintLayers,\n helpersForLayersRef.current,\n vis ?? NO_LAYER_VISIBILITY,\n order,\n view,\n { width: w, height: h },\n layerCacheRef.current,\n undefined,\n groups,\n spans,\n );\n renderer.render(commands, viewToMat3(view), spans ? { spans } : undefined);\n debugFrame?.end(renderer.lastFrameStats());\n paintedVersionRef.current = contentVersionRef.current?.() ?? 0;\n return true;\n }, [contentVersionRef, gateRef, lease, paintInputsRef, paintRectRef, paintTargetRef, viewRef]);\n useInsertionEffect(() => {\n paintRef.current = paint;\n });\n\n // A tripwire, not a list of values this effect uses: every paint input that\n // arrives on a render must appear here, or changing it paints stale.\n // `viewChromeState` stands in for the whole overlay-aware set the layer\n // helpers expose — it re-memoizes on exactly the selection, bounds and\n // preview inputs they read. What moves between renders instead (a scene\n // write, a gesture pump, a late image decode) pushes its own redraw.\n // Layout, not passive, so a `syncPaint` surface lands its pixels in the same\n // commit as the DOM.\n useLayoutEffect(() => {\n requestRedraw();\n }, [layersWithDebug, width, height, debugSink, dprProp, flattenTolerance,\n controlledView?.x, controlledView?.y, controlledView?.scale.x, controlledView?.scale.y,\n layerVisibility, layerOrder, layerGroups, shaderIdKey, syncPaint,\n viewChromeState, getIsVisible, paintTarget, paintRect?.x, paintRect?.y, requestRedraw]);\n\n useEffect(() => {\n const layerCache = layerCacheRef.current;\n return () => {\n layerCache.clear();\n clearSubscribers();\n };\n }, [clearSubscribers]);\n\n useToolCursor(cursorSink, tools, detached ? inputElement : null, style?.cursor);\n\n useSurfaceInput(canvasRef, {\n focusOnPress: autoFocusOnPointerDown,\n onFocus,\n onBlur,\n onHover: (_el, e) => {\n const view = viewRef.current;\n const [worldX, worldY] = toWorld(e.clientX, e.clientY);\n const visibility = layerVisibility ?? NO_LAYER_VISIBILITY;\n // Same gate as `hitTestExtrasIn`: a layer nobody can see takes no input.\n for (const layer of layersWithDebug) {\n if (!layer.onUncapturedMove || !isLayerPainted(layer, visibility, layerOrder)) continue;\n layer.onUncapturedMove(worldX, worldY, e, view, { width, height });\n }\n },\n onLeave: () => {\n for (const layer of layersWithDebug) layer.onUncapturedLeave?.();\n },\n });\n\n if (detached) return null;\n\n return (\n <canvas\n ref={setOwnCanvas}\n width={width}\n height={height}\n tabIndex={tabIndex}\n {...surfaceBox(width, height, className, style)}\n />\n );\n}\n\n/** Forward-ref'd `<canvas>` wrapper. Generic over the pose type, inferred from the\n * `adapter` prop. */\nexport const Canvas = forwardRef(CanvasInner) as <TPose = unknown>(\n props: CanvasProps<TPose> & { ref?: React.ForwardedRef<CanvasExtensionApi> },\n) => ReturnType<typeof CanvasInner>;\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAME,MAAiB,MAAyB,IA8O1CC,KAAwC,CAAC,GAEzCC,KAA+C,CAAC;AAEtD,SAASC,GACP,GACA,IACA;CACA,IAAM,EACJ,UACA,WACA,KAAKC,GACL,sBACA,oBACA,gBAAY,IACZ,cACA,aACA,QAAQC,GACR,eACA,cACA,kBACA,eAAAC,IACA,cACA,iBACA,gBAAgBC,KAAWC,GAC3B,eACA,WACA,eAAW,GACX,aACA,YACA,6BAAyB,IACzB,gBACA,UACA,eACA,OAAOC,IACP,kBACA,YACA,sBACA,mBACA,mBACA,oBACA,kBACA,oBACA,eACA,oBACEC,GAEE,EAAE,MAAMC,GAAW,SAASC,GAAc,gBAAY,iBAAaC,GAAaJ,EAAS,GAIzFK,IAAYC,EAA2B,IAAI,GAG3CC,IAAeD,EAAiC,IAAI,GAIpDE,KAAeC,GAAa,MAAiC;EAEjE,AADA,EAAa,UAAUC,GACv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