@weasel-js/core 1.7.0 → 1.7.2
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 +794 -0
- package/README.md +14 -8
- package/dist/WeaselProvider.js +15 -0
- package/dist/WeaselProvider.js.map +1 -0
- package/dist/affordances/composeAffordanceLayer.js +224 -0
- package/dist/affordances/composeAffordanceLayer.js.map +1 -0
- package/dist/affordances/cornerResize.js +69 -0
- package/dist/affordances/cornerResize.js.map +1 -0
- package/dist/affordances/hitAffordanceRegions.js +138 -0
- package/dist/affordances/hitAffordanceRegions.js.map +1 -0
- package/dist/affordances/pathAnchors.js +66 -0
- package/dist/affordances/pathAnchors.js.map +1 -0
- package/dist/affordances/rotationHandle.js +103 -0
- package/dist/affordances/rotationHandle.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +118 -0
- package/dist/animation/behaviors/momentum.js.map +1 -0
- package/dist/animation/colorHelpers.js +135 -0
- package/dist/animation/colorHelpers.js.map +1 -0
- package/dist/animation/colorRegistry.js +37 -0
- package/dist/animation/colorRegistry.js.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/loop.js +62 -0
- package/dist/animation/loop.js.map +1 -0
- package/dist/animation/observe.js +23 -0
- package/dist/animation/observe.js.map +1 -0
- package/dist/animation/poseHelpers.js +50 -0
- package/dist/animation/poseHelpers.js.map +1 -0
- package/dist/animation/reflow.js +121 -0
- package/dist/animation/reflow.js.map +1 -0
- package/dist/animation/rig/bindRig.js +74 -0
- package/dist/animation/rig/bindRig.js.map +1 -0
- package/dist/animation/rig/blendPoses.js +43 -0
- package/dist/animation/rig/blendPoses.js.map +1 -0
- package/dist/animation/rig/mirrorPose.js +19 -0
- package/dist/animation/rig/mirrorPose.js.map +1 -0
- package/dist/animation/rig/resolveSkeleton.js +33 -0
- package/dist/animation/rig/resolveSkeleton.js.map +1 -0
- package/dist/animation/rig/solveIk.js +103 -0
- package/dist/animation/rig/solveIk.js.map +1 -0
- package/dist/animation/rig/types.js +12 -0
- package/dist/animation/rig/types.js.map +1 -0
- package/dist/animation/rig/useRig.js +23 -0
- package/dist/animation/rig/useRig.js.map +1 -0
- package/dist/animation/slew.js +27 -0
- package/dist/animation/slew.js.map +1 -0
- package/dist/animation/stagger.js +138 -0
- package/dist/animation/stagger.js.map +1 -0
- package/dist/animation/timeline/booking.js +106 -0
- package/dist/animation/timeline/booking.js.map +1 -0
- package/dist/animation/timeline/createTimeline.js +116 -0
- package/dist/animation/timeline/createTimeline.js.map +1 -0
- package/dist/animation/timeline/sampleTrack.js +29 -0
- package/dist/animation/timeline/sampleTrack.js.map +1 -0
- package/dist/animation/useAnimator.js +329 -0
- package/dist/animation/useAnimator.js.map +1 -0
- package/dist/animation/wrappers/animateLifecycle.js +40 -0
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
- package/dist/animation/wrappers/animateOnSetPose.js +44 -0
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
- package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-vCdt55xm.d.ts} +2 -2
- package/dist/{builtins-DLn2lCr_.d.ts → builtins-C-gRyVRx.d.ts} +742 -513
- package/dist/canvas/Canvas.js +608 -0
- package/dist/canvas/Canvas.js.map +1 -0
- package/dist/canvas/CanvasView.js +255 -0
- package/dist/canvas/CanvasView.js.map +1 -0
- package/dist/canvas/CursorCoordsHud.js +102 -0
- package/dist/canvas/CursorCoordsHud.js.map +1 -0
- package/dist/canvas/DrawCanvas.js +67 -0
- package/dist/canvas/DrawCanvas.js.map +1 -0
- package/dist/canvas/MinimapCanvas.js +139 -0
- package/dist/canvas/MinimapCanvas.js.map +1 -0
- package/dist/canvas/ModalityHud.js +66 -0
- package/dist/canvas/ModalityHud.js.map +1 -0
- package/dist/canvas/NodeShape.js +391 -0
- package/dist/canvas/NodeShape.js.map +1 -0
- package/dist/canvas/PickHud.js +93 -0
- package/dist/canvas/PickHud.js.map +1 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
- package/dist/canvas/SceneCanvas/features.js +97 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +992 -0
- package/dist/canvas/SceneCanvas.js.map +1 -0
- package/dist/canvas/SceneViewCanvas.js +54 -0
- package/dist/canvas/SceneViewCanvas.js.map +1 -0
- package/dist/canvas/accentColor.js +9 -0
- package/dist/canvas/accentColor.js.map +1 -0
- package/dist/canvas/affordanceAt.js +63 -0
- package/dist/canvas/affordanceAt.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +65 -0
- package/dist/canvas/buildSceneTree.js.map +1 -0
- package/dist/canvas/canvasRenderer.js +89 -0
- package/dist/canvas/canvasRenderer.js.map +1 -0
- package/dist/canvas/colorOverrides.js +16 -0
- package/dist/canvas/colorOverrides.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +43 -0
- package/dist/canvas/defaultDrawOne.js.map +1 -0
- package/dist/canvas/deps/areaSelect.js +19 -0
- package/dist/canvas/deps/areaSelect.js.map +1 -0
- package/dist/canvas/deps/debug.js +9 -0
- package/dist/canvas/deps/debug.js.map +1 -0
- package/dist/canvas/deps/dispatcher.js +11 -0
- package/dist/canvas/deps/dispatcher.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +101 -0
- package/dist/canvas/deps/editAnchors.js.map +1 -0
- package/dist/canvas/deps/geometryProjection.js +11 -0
- package/dist/canvas/deps/geometryProjection.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +51 -0
- package/dist/canvas/deps/hitTestArea.js.map +1 -0
- package/dist/canvas/deps/ingestion.js +31 -0
- package/dist/canvas/deps/ingestion.js.map +1 -0
- package/dist/canvas/deps/insert.js +116 -0
- package/dist/canvas/deps/insert.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +20 -0
- package/dist/canvas/deps/lassoSelect.js.map +1 -0
- package/dist/canvas/deps/layout.js +34 -0
- package/dist/canvas/deps/layout.js.map +1 -0
- package/dist/canvas/deps/nodeAtPoint.js +19 -0
- package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
- package/dist/canvas/deps/poseComposition.js +11 -0
- package/dist/canvas/deps/poseComposition.js.map +1 -0
- package/dist/canvas/deps/poseDescriptor.js +12 -0
- package/dist/canvas/deps/poseDescriptor.js.map +1 -0
- package/dist/canvas/deps/resizePolicy.js +35 -0
- package/dist/canvas/deps/resizePolicy.js.map +1 -0
- package/dist/canvas/deps/slice.js +99 -0
- package/dist/canvas/deps/slice.js.map +1 -0
- package/dist/canvas/deps/snap.js +11 -0
- package/dist/canvas/deps/snap.js.map +1 -0
- package/dist/canvas/deps/textEdit.js +21 -0
- package/dist/canvas/deps/textEdit.js.map +1 -0
- package/dist/canvas/deps/view.js +43 -0
- package/dist/canvas/deps/view.js.map +1 -0
- package/dist/canvas/derivedPath.js +47 -0
- package/dist/canvas/derivedPath.js.map +1 -0
- package/dist/canvas/drawEnvelope.js +22 -0
- package/dist/canvas/drawEnvelope.js.map +1 -0
- package/dist/canvas/getNodeAtPoint.js +18 -0
- package/dist/canvas/getNodeAtPoint.js.map +1 -0
- package/dist/canvas/hostAnchor.js +29 -0
- package/dist/canvas/hostAnchor.js.map +1 -0
- package/dist/canvas/hud.module.js +18 -0
- package/dist/canvas/hud.module.js.map +1 -0
- package/dist/canvas/insertPreviewExtent.js +103 -0
- package/dist/canvas/insertPreviewExtent.js.map +1 -0
- package/dist/canvas/kitRequirements.js +177 -0
- package/dist/canvas/kitRequirements.js.map +1 -0
- package/dist/canvas/layerOrder.js +66 -0
- package/dist/canvas/layerOrder.js.map +1 -0
- package/dist/canvas/layerSlots.js +14 -0
- package/dist/canvas/layerSlots.js.map +1 -0
- package/dist/canvas/minimapMath.js +80 -0
- package/dist/canvas/minimapMath.js.map +1 -0
- package/dist/canvas/mountedCanvases.js +20 -0
- package/dist/canvas/mountedCanvases.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js +17 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -0
- package/dist/canvas/paintCull.js +20 -0
- package/dist/canvas/paintCull.js.map +1 -0
- package/dist/canvas/pickWalk.js +158 -0
- package/dist/canvas/pickWalk.js.map +1 -0
- package/dist/canvas/planeClips.js +30 -0
- package/dist/canvas/planeClips.js.map +1 -0
- package/dist/canvas/poseRotation.js +35 -0
- package/dist/canvas/poseRotation.js.map +1 -0
- package/dist/canvas/rasterToPng.js +21 -0
- package/dist/canvas/rasterToPng.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +32 -0
- package/dist/canvas/renderDebugSnapshot.js.map +1 -0
- package/dist/canvas/renderNeeds.js +25 -0
- package/dist/canvas/renderNeeds.js.map +1 -0
- package/dist/canvas/renderSceneToPixels.js +143 -0
- package/dist/canvas/renderSceneToPixels.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +270 -0
- package/dist/canvas/sceneAdapter.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +37 -0
- package/dist/canvas/sceneLayerPaint.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +20 -0
- package/dist/canvas/sceneSlotWiring.js.map +1 -0
- package/dist/canvas/sceneViewRender.js +72 -0
- package/dist/canvas/sceneViewRender.js.map +1 -0
- package/dist/canvas/slopsDebugLayer.js +61 -0
- package/dist/canvas/slopsDebugLayer.js.map +1 -0
- package/dist/canvas/surfaceContribution.js +15 -0
- package/dist/canvas/surfaceContribution.js.map +1 -0
- package/dist/canvas/toolPreview.js +39 -0
- package/dist/canvas/toolPreview.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +11 -0
- package/dist/canvas/useCanvasRenderer.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +60 -0
- package/dist/canvas/useFrameLoop.js.map +1 -0
- package/dist/canvas/useHostAnchor.js +71 -0
- package/dist/canvas/useHostAnchor.js.map +1 -0
- package/dist/canvas/useLateContentRedraw.js +21 -0
- package/dist/canvas/useLateContentRedraw.js.map +1 -0
- package/dist/canvas/useRedrawOn.js +21 -0
- package/dist/canvas/useRedrawOn.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +120 -0
- package/dist/canvas/useViewHelpers.js.map +1 -0
- package/dist/canvas/viewInputs.js +17 -0
- package/dist/canvas/viewInputs.js.map +1 -0
- package/dist/canvas/viewRegistry.js +61 -0
- package/dist/canvas/viewRegistry.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +14 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -0
- package/dist/clipboard.d.ts +10 -5
- package/dist/clipboard.js +3 -5
- package/dist/clone.d.ts +3 -3
- package/dist/clone.js +2 -5
- package/dist/core/adapters/arrayAdapter.js +85 -0
- package/dist/core/adapters/arrayAdapter.js.map +1 -0
- package/dist/core/adapters/useArrayAdapter.js +13 -0
- package/dist/core/adapters/useArrayAdapter.js.map +1 -0
- package/dist/core/applyOps.js +12 -0
- package/dist/core/applyOps.js.map +1 -0
- package/dist/core/device/index.js +4 -0
- package/dist/core/device/targets.js +17 -0
- package/dist/core/device/targets.js.map +1 -0
- package/dist/core/device/useDeviceProfile.js +75 -0
- package/dist/core/device/useDeviceProfile.js.map +1 -0
- package/dist/core/fillInPoseFrame.js +102 -0
- package/dist/core/fillInPoseFrame.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +93 -0
- package/dist/core/geometry/poseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseRotation.js +58 -0
- package/dist/core/geometry/poseRotation.js.map +1 -0
- package/dist/core/geometry/regionHit.js +102 -0
- package/dist/core/geometry/regionHit.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +60 -0
- package/dist/core/geometry/unionBounds.js.map +1 -0
- package/dist/core/gradient.js +136 -0
- package/dist/core/gradient.js.map +1 -0
- package/dist/core/isPlainObject.js +11 -0
- package/dist/core/isPlainObject.js.map +1 -0
- package/dist/core/layers/render.js +150 -0
- package/dist/core/layers/render.js.map +1 -0
- package/dist/core/markerInset.js +24 -0
- package/dist/core/markerInset.js.map +1 -0
- package/dist/core/mixed.js +6 -0
- package/dist/core/mixed.js.map +1 -0
- package/dist/core/ops/arrange.js +31 -0
- package/dist/core/ops/arrange.js.map +1 -0
- package/dist/core/ops/create.js +32 -0
- package/dist/core/ops/create.js.map +1 -0
- package/dist/core/ops/createHistory.js +20 -0
- package/dist/core/ops/createHistory.js.map +1 -0
- package/dist/core/ops/delete.js +89 -0
- package/dist/core/ops/delete.js.map +1 -0
- package/dist/core/ops/registry.js +17 -0
- package/dist/core/ops/registry.js.map +1 -0
- package/dist/core/ops/reorder/algorithms.js +55 -0
- package/dist/core/ops/reorder/algorithms.js.map +1 -0
- package/dist/core/ops/reorder/index.js +140 -0
- package/dist/core/ops/reorder/index.js.map +1 -0
- package/dist/core/ops/reparent.js +52 -0
- package/dist/core/ops/reparent.js.map +1 -0
- package/dist/core/ops/select.js +34 -0
- package/dist/core/ops/select.js.map +1 -0
- package/dist/core/ops/setData.js +34 -0
- package/dist/core/ops/setData.js.map +1 -0
- package/dist/core/ops/setLayer.js +34 -0
- package/dist/core/ops/setLayer.js.map +1 -0
- package/dist/core/ops/setLayout.js +31 -0
- package/dist/core/ops/setLayout.js.map +1 -0
- package/dist/core/ops/setPath.js +57 -0
- package/dist/core/ops/setPath.js.map +1 -0
- package/dist/core/ops/setText.js +34 -0
- package/dist/core/ops/setText.js.map +1 -0
- package/dist/core/ops/slot.js +37 -0
- package/dist/core/ops/slot.js.map +1 -0
- package/dist/core/ops/transform.js +42 -0
- package/dist/core/ops/transform.js.map +1 -0
- package/dist/core/paintKinds.js +156 -0
- package/dist/core/paintKinds.js.map +1 -0
- package/dist/core/scene/NodeProperties.js +20 -0
- package/dist/core/scene/NodeProperties.js.map +1 -0
- package/dist/core/scene/NodeRouting.js +24 -0
- package/dist/core/scene/NodeRouting.js.map +1 -0
- package/dist/core/scene/arrivals.js +12 -0
- package/dist/core/scene/arrivals.js.map +1 -0
- package/dist/core/scene/composeFrame.js +29 -0
- package/dist/core/scene/composeFrame.js.map +1 -0
- package/dist/core/scene/depMemo.js +18 -0
- package/dist/core/scene/depMemo.js.map +1 -0
- package/dist/core/scene/dependents.js +66 -0
- package/dist/core/scene/dependents.js.map +1 -0
- package/dist/core/scene/derivedPath.js +31 -0
- package/dist/core/scene/derivedPath.js.map +1 -0
- package/dist/core/scene/effectivePose.js +78 -0
- package/dist/core/scene/effectivePose.js.map +1 -0
- package/dist/core/scene/kitRegistry.js +33 -0
- package/dist/core/scene/kitRegistry.js.map +1 -0
- package/dist/core/scene/layoutPass.js +96 -0
- package/dist/core/scene/layoutPass.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +83 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -0
- package/dist/core/scene/nodeMemo.js +28 -0
- package/dist/core/scene/nodeMemo.js.map +1 -0
- package/dist/core/scene/poseFeed.js +87 -0
- package/dist/core/scene/poseFeed.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +52 -0
- package/dist/core/scene/poseOverrides.js.map +1 -0
- package/dist/core/scene/poseSnapshot.js +54 -0
- package/dist/core/scene/poseSnapshot.js.map +1 -0
- package/dist/core/scene/scene.js +1271 -0
- package/dist/core/scene/scene.js.map +1 -0
- package/dist/core/scene/types.js +6 -0
- package/dist/core/scene/types.js.map +1 -0
- package/dist/core/scene/useScene.js +32 -0
- package/dist/core/scene/useScene.js.map +1 -0
- package/dist/core/selection/chromeState.js +31 -0
- package/dist/core/selection/chromeState.js.map +1 -0
- package/dist/core/selection/selectionTarget.js +6 -0
- package/dist/core/selection/selectionTarget.js.map +1 -0
- package/dist/core/selection/useSelection.js +71 -0
- package/dist/core/selection/useSelection.js.map +1 -0
- package/dist/core/shapeKinds.js +54 -0
- package/dist/core/shapeKinds.js.map +1 -0
- package/dist/core/strokeMarkerShapes.js +139 -0
- package/dist/core/strokeMarkerShapes.js.map +1 -0
- package/dist/core/strokeMarkers.js +28 -0
- package/dist/core/strokeMarkers.js.map +1 -0
- package/dist/core/stylus/stylus.js +39 -0
- package/dist/core/stylus/stylus.js.map +1 -0
- package/dist/core/stylus/usePointerStylus.js +51 -0
- package/dist/core/stylus/usePointerStylus.js.map +1 -0
- package/dist/core/usePaintKinds.js +17 -0
- package/dist/core/usePaintKinds.js.map +1 -0
- package/dist/core/viewport/clampView.js +24 -0
- package/dist/core/viewport/clampView.js.map +1 -0
- package/dist/core/viewport/clientToWorld.js +8 -0
- package/dist/core/viewport/clientToWorld.js.map +1 -0
- package/dist/core/viewport/createVelocityTracker.js +39 -0
- package/dist/core/viewport/createVelocityTracker.js.map +1 -0
- package/dist/core/viewport/fitToBounds.js +18 -0
- package/dist/core/viewport/fitToBounds.js.map +1 -0
- package/dist/core/viewport/fitViewToBounds.js +36 -0
- package/dist/core/viewport/fitViewToBounds.js.map +1 -0
- package/dist/core/viewport/interpolateView.js +34 -0
- package/dist/core/viewport/interpolateView.js.map +1 -0
- package/dist/core/viewport/meanScale.js +8 -0
- package/dist/core/viewport/meanScale.js.map +1 -0
- package/dist/core/viewport/parallax.js +111 -0
- package/dist/core/viewport/parallax.js.map +1 -0
- package/dist/core/viewport/pxExtent.js +42 -0
- package/dist/core/viewport/pxExtent.js.map +1 -0
- package/dist/core/viewport/sceneNodeClientRect.js +18 -0
- package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
- package/dist/core/viewport/screenSlop.js +27 -0
- package/dist/core/viewport/screenSlop.js.map +1 -0
- package/dist/core/viewport/useAutoCenter.js +32 -0
- package/dist/core/viewport/useAutoCenter.js.map +1 -0
- package/dist/core/viewport/useCanvasSize.js +29 -0
- package/dist/core/viewport/useCanvasSize.js.map +1 -0
- package/dist/core/viewport/useDecayLoop.js +63 -0
- package/dist/core/viewport/useDecayLoop.js.map +1 -0
- package/dist/core/viewport/useVelocityTracker.js +10 -0
- package/dist/core/viewport/useVelocityTracker.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +63 -0
- package/dist/core/viewport/useViewAnimation.js.map +1 -0
- package/dist/core/viewport/view.js +37 -0
- package/dist/core/viewport/view.js.map +1 -0
- package/dist/core/viewport/viewTransform.js +11 -0
- package/dist/core/viewport/viewTransform.js.map +1 -0
- package/dist/core/viewport/viewportWorldRect.js +13 -0
- package/dist/core/viewport/viewportWorldRect.js.map +1 -0
- package/dist/core/viewport/wheelHandler.js +30 -0
- package/dist/core/viewport/wheelHandler.js.map +1 -0
- package/dist/core/viewport/zoomAt.js +22 -0
- package/dist/core/viewport/zoomAt.js.map +1 -0
- package/dist/core/viewport/zoomBounds.js +20 -0
- package/dist/core/viewport/zoomBounds.js.map +1 -0
- package/dist/{pointSnapToGrid-Dp2IxLGb.d.ts → cornerHandles-BCrDp_mH.d.ts} +3 -13
- package/dist/debug/createDebugOverlayLayer.js +358 -0
- package/dist/debug/createDebugOverlayLayer.js.map +1 -0
- package/dist/debug/createDebugSink.js +83 -0
- package/dist/debug/createDebugSink.js.map +1 -0
- package/dist/debug/defaultTheme.js +31 -0
- package/dist/debug/defaultTheme.js.map +1 -0
- package/dist/debug/flag.js +41 -0
- package/dist/debug/flag.js.map +1 -0
- package/dist/debug/frameStats.js +16 -0
- package/dist/debug/frameStats.js.map +1 -0
- package/dist/debug/parseDebugFlags.js +32 -0
- package/dist/debug/parseDebugFlags.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
- package/dist/features/chrome-caps/conditions.js +36 -0
- package/dist/features/chrome-caps/conditions.js.map +1 -0
- package/dist/features/chrome-caps/defaults.js +26 -0
- package/dist/features/chrome-caps/defaults.js.map +1 -0
- package/dist/features/chrome-caps/index.js +7 -0
- package/dist/features/chrome-caps/resolve.js +23 -0
- package/dist/features/chrome-caps/resolve.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +27 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
- package/dist/features/cursor/paintedCursorLayer.js +60 -0
- package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
- package/dist/features/focus/gateLayer.js +14 -0
- package/dist/features/focus/gateLayer.js.map +1 -0
- package/dist/features/focus/useCanvasFocus.js +29 -0
- package/dist/features/focus/useCanvasFocus.js.map +1 -0
- package/dist/features/groups/children.js +23 -0
- package/dist/features/groups/children.js.map +1 -0
- package/dist/features/groups/composePose.js +67 -0
- package/dist/features/groups/composePose.js.map +1 -0
- package/dist/features/groups/nestedHit.js +40 -0
- package/dist/features/groups/nestedHit.js.map +1 -0
- package/dist/features/groups/unionOfChildren.js +15 -0
- package/dist/features/groups/unionOfChildren.js.map +1 -0
- package/dist/features/images/imageCache.js +94 -0
- package/dist/features/images/imageCache.js.map +1 -0
- package/dist/features/ingestion/contentHandlers.js +37 -0
- package/dist/features/ingestion/contentHandlers.js.map +1 -0
- package/dist/features/ingestion/imageHandler.js +45 -0
- package/dist/features/ingestion/imageHandler.js.map +1 -0
- package/dist/features/ingestion/index.js +8 -0
- package/dist/features/ingestion/openFilePicker.js +15 -0
- package/dist/features/ingestion/openFilePicker.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +26 -0
- package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +58 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +39 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
- package/dist/features/longPress/longPressFeedback.js +96 -0
- package/dist/features/longPress/longPressFeedback.js.map +1 -0
- package/dist/features/meshPaint/bake.js +79 -0
- package/dist/features/meshPaint/bake.js.map +1 -0
- package/dist/features/meshPaint/bakeCache.js +59 -0
- package/dist/features/meshPaint/bakeCache.js.map +1 -0
- package/dist/features/meshPaint/handles.js +86 -0
- package/dist/features/meshPaint/handles.js.map +1 -0
- package/dist/features/meshPaint/lazyKind.js +1298 -0
- package/dist/features/meshPaint/lazyKind.js.map +1 -0
- package/dist/features/meshPaint/meshPaint.js +236 -0
- package/dist/features/meshPaint/meshPaint.js.map +1 -0
- package/dist/features/meshPaint/meshShader.js +6 -0
- package/dist/features/meshPaint/meshShader.js.map +1 -0
- package/dist/features/meshPaint/register.js +7 -0
- package/dist/features/meshPaint/register.js.map +1 -0
- package/dist/features/meshPaint/surface.js +110 -0
- package/dist/features/meshPaint/surface.js.map +1 -0
- package/dist/features/minimap/actions.js +53 -0
- package/dist/features/minimap/actions.js.map +1 -0
- package/dist/features/minimap/createMinimapContribution.js +96 -0
- package/dist/features/minimap/createMinimapContribution.js.map +1 -0
- package/dist/features/minimap/layers.js +103 -0
- package/dist/features/minimap/layers.js.map +1 -0
- package/dist/features/modes/modeLayers.js +113 -0
- package/dist/features/modes/modeLayers.js.map +1 -0
- package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
- package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
- package/dist/features/parallax/createParallaxLayer.js +26 -0
- package/dist/features/parallax/createParallaxLayer.js.map +1 -0
- package/dist/features/parallax/createParallaxPlane.js +26 -0
- package/dist/features/parallax/createParallaxPlane.js.map +1 -0
- package/dist/features/paths/anchorEdits.js +156 -0
- package/dist/features/paths/anchorEdits.js.map +1 -0
- package/dist/features/paths/anchors.js +154 -0
- package/dist/features/paths/anchors.js.map +1 -0
- package/dist/features/paths/booleans.js +2 -0
- package/dist/features/paths/index.js +15 -0
- package/dist/features/paths/markerCommands.js +116 -0
- package/dist/features/paths/markerCommands.js.map +1 -0
- package/dist/features/paths/markerSites.js +59 -0
- package/dist/features/paths/markerSites.js.map +1 -0
- package/dist/features/paths/markers.js +95 -0
- package/dist/features/paths/markers.js.map +1 -0
- package/dist/features/paths/nearestAnchor.js +36 -0
- package/dist/features/paths/nearestAnchor.js.map +1 -0
- package/dist/features/paths/originProjection.js +16 -0
- package/dist/features/paths/originProjection.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
- package/dist/features/paths/pathInWorld.js +41 -0
- package/dist/features/paths/pathInWorld.js.map +1 -0
- package/dist/features/paths/pathLayer.js +44 -0
- package/dist/features/paths/pathLayer.js.map +1 -0
- package/dist/features/paths/penPreviewLayer.js +220 -0
- package/dist/features/paths/penPreviewLayer.js.map +1 -0
- package/dist/features/paths/poseDescriptor.js +39 -0
- package/dist/features/paths/poseDescriptor.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js +230 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -0
- package/dist/features/patterns/index.js +23 -0
- package/dist/features/patterns/index.js.map +1 -0
- package/dist/features/patterns/patterns-builtin.js +38 -0
- package/dist/features/patterns/patterns-builtin.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +57 -0
- package/dist/features/patterns/resolveSpec.js.map +1 -0
- package/dist/features/patterns/tileGeometry.js +158 -0
- package/dist/features/patterns/tileGeometry.js.map +1 -0
- package/dist/features/pointer/PointerContext.js +45 -0
- package/dist/features/pointer/PointerContext.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +70 -0
- package/dist/features/poseRun/usePoseRun.js.map +1 -0
- package/dist/features/selection/SelectionContext.js +46 -0
- package/dist/features/selection/SelectionContext.js.map +1 -0
- package/dist/features/selection/overlay.js +442 -0
- package/dist/features/selection/overlay.js.map +1 -0
- package/dist/features/simulation/createSimulation.js +61 -0
- package/dist/features/simulation/createSimulation.js.map +1 -0
- package/dist/features/simulation/types.js +6 -0
- package/dist/features/simulation/types.js.map +1 -0
- package/dist/features/simulation/useSimulation.js +74 -0
- package/dist/features/simulation/useSimulation.js.map +1 -0
- package/dist/features/text/domRuns.js +258 -0
- package/dist/features/text/domRuns.js.map +1 -0
- package/dist/features/text/fitTextPose.js +38 -0
- package/dist/features/text/fitTextPose.js.map +1 -0
- package/dist/features/text/hitTest.js +45 -0
- package/dist/features/text/hitTest.js.map +1 -0
- package/dist/features/text/renderLabel.js +14 -0
- package/dist/features/text/renderLabel.js.map +1 -0
- package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
- package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
- package/dist/features/text/runs/flagRange.js +53 -0
- package/dist/features/text/runs/flagRange.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +135 -0
- package/dist/features/text/runs/rangeStyle.js.map +1 -0
- package/dist/features/text/textCommand.js +59 -0
- package/dist/features/text/textCommand.js.map +1 -0
- package/dist/features/text/textLayer.js +35 -0
- package/dist/features/text/textLayer.js.map +1 -0
- package/dist/features/text/textToPath.js +181 -0
- package/dist/features/text/textToPath.js.map +1 -0
- package/dist/features/text/useSceneTextEdit.js +138 -0
- package/dist/features/text/useSceneTextEdit.js.map +1 -0
- package/dist/features/text/useTextEdit.js +465 -0
- package/dist/features/text/useTextEdit.js.map +1 -0
- package/dist/features/tiling/createTiledLayer.js +63 -0
- package/dist/features/tiling/createTiledLayer.js.map +1 -0
- package/dist/features/tiling/tiledProject.js +14 -0
- package/dist/features/tiling/tiledProject.js.map +1 -0
- package/dist/features/viewports/viewResolver.js +59 -0
- package/dist/features/viewports/viewResolver.js.map +1 -0
- package/dist/features/viewports/viewportLayer.js +58 -0
- package/dist/features/viewports/viewportLayer.js.map +1 -0
- package/dist/icons/ArrowIcon.js +23 -0
- package/dist/icons/ArrowIcon.js.map +1 -0
- package/dist/icons/EllipseIcon.js +21 -0
- package/dist/icons/EllipseIcon.js.map +1 -0
- package/dist/icons/EyedropperIcon.js +49 -0
- package/dist/icons/EyedropperIcon.js.map +1 -0
- package/dist/icons/HandIcon.js +59 -0
- package/dist/icons/HandIcon.js.map +1 -0
- package/dist/icons/ImageIcon.js +34 -0
- package/dist/icons/ImageIcon.js.map +1 -0
- package/dist/icons/LassoIcon.js +22 -0
- package/dist/icons/LassoIcon.js.map +1 -0
- package/dist/icons/LineIcon.js +22 -0
- package/dist/icons/LineIcon.js.map +1 -0
- package/dist/icons/PenIcon.js +36 -0
- package/dist/icons/PenIcon.js.map +1 -0
- package/dist/icons/PencilIcon.js +25 -0
- package/dist/icons/PencilIcon.js.map +1 -0
- package/dist/icons/PolygonIcon.js +19 -0
- package/dist/icons/PolygonIcon.js.map +1 -0
- package/dist/icons/RectIcon.js +37 -0
- package/dist/icons/RectIcon.js.map +1 -0
- package/dist/icons/SelectIcon.js +20 -0
- package/dist/icons/SelectIcon.js.map +1 -0
- package/dist/icons/StarIcon.js +19 -0
- package/dist/icons/StarIcon.js.map +1 -0
- package/dist/icons/TextIcon.js +19 -0
- package/dist/icons/TextIcon.js.map +1 -0
- package/dist/icons/UnknownIcon.js +33 -0
- package/dist/icons/UnknownIcon.js.map +1 -0
- package/dist/icons/_base.js +12 -0
- package/dist/icons/_base.js.map +1 -0
- package/dist/index.d.ts +1960 -1891
- package/dist/index.js +312 -13
- package/dist/input/keyState.js +76 -0
- package/dist/input/keyState.js.map +1 -0
- package/dist/input/useKeyState.js +22 -0
- package/dist/input/useKeyState.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js +32 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -0
- package/dist/interactions/actions/align/align.js +81 -0
- package/dist/interactions/actions/align/align.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +120 -0
- package/dist/interactions/actions/booleans/booleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +20 -0
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
- package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
- package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
- package/dist/interactions/actions/defaults/align.js +71 -0
- package/dist/interactions/actions/defaults/align.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js +75 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/booleans.js +52 -0
- package/dist/interactions/actions/defaults/booleans.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
- package/dist/interactions/actions/defaults/clearSelection.js +19 -0
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/clipboard.js +78 -0
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
- package/dist/interactions/actions/defaults/clone.js +107 -0
- package/dist/interactions/actions/defaults/clone.js.map +1 -0
- package/dist/interactions/actions/defaults/createOutlines.js +47 -0
- package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
- package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
- package/dist/interactions/actions/defaults/delete.js +61 -0
- package/dist/interactions/actions/defaults/delete.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +66 -0
- package/dist/interactions/actions/defaults/distribute.js.map +1 -0
- package/dist/interactions/actions/defaults/duplicate.js +83 -0
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
- package/dist/interactions/actions/defaults/editAnchors.js +100 -0
- package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/escape.js +26 -0
- package/dist/interactions/actions/defaults/escape.js.map +1 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/flip.js +119 -0
- package/dist/interactions/actions/defaults/flip.js.map +1 -0
- package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
- package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
- package/dist/interactions/actions/defaults/group.js +131 -0
- package/dist/interactions/actions/defaults/group.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/ingest.js +58 -0
- package/dist/interactions/actions/defaults/ingest.js.map +1 -0
- package/dist/interactions/actions/defaults/insert.js +288 -0
- package/dist/interactions/actions/defaults/insert.js.map +1 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
- package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/move.js +760 -0
- package/dist/interactions/actions/defaults/move.js.map +1 -0
- package/dist/interactions/actions/defaults/nudge.js +110 -0
- package/dist/interactions/actions/defaults/nudge.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +143 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -0
- package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/resize.js +335 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +184 -0
- package/dist/interactions/actions/defaults/rotate.js.map +1 -0
- package/dist/interactions/actions/defaults/selectAll.js +27 -0
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +27 -0
- package/dist/interactions/actions/defaults/setFill.js.map +1 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/setStroke.js +36 -0
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/slice.js +39 -0
- package/dist/interactions/actions/defaults/slice.js.map +1 -0
- package/dist/interactions/actions/defaults/sliceOps.js +60 -0
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
- package/dist/interactions/actions/defaults/toolActivate.js +35 -0
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
- package/dist/interactions/actions/defaults/undoRedo.js +51 -0
- package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +42 -0
- package/dist/interactions/actions/distribute/distribute.js.map +1 -0
- package/dist/interactions/actions/distribute/plan.js +29 -0
- package/dist/interactions/actions/distribute/plan.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/handles.js +43 -0
- package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +35 -0
- package/dist/interactions/actions/flip/helpers.js.map +1 -0
- package/dist/interactions/actions/geometryProjection.js +18 -0
- package/dist/interactions/actions/geometryProjection.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +44 -0
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +37 -0
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +84 -0
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
- package/dist/interactions/actions/planeInput.js +181 -0
- package/dist/interactions/actions/planeInput.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +9 -0
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
- package/dist/interactions/actions/poseFrame.js +38 -0
- package/dist/interactions/actions/poseFrame.js.map +1 -0
- package/dist/interactions/actions/previewOverrides.js +25 -0
- package/dist/interactions/actions/previewOverrides.js.map +1 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +31 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/index.js +8 -0
- package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
- package/dist/interactions/actions/resize/cornerHandles.js +72 -0
- package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +60 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -0
- package/dist/interactions/actions/resolvePreviews.js +61 -0
- package/dist/interactions/actions/resolvePreviews.js.map +1 -0
- package/dist/interactions/actions/rotate/geometry.js +46 -0
- package/dist/interactions/actions/rotate/geometry.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +27 -0
- package/dist/interactions/actions/rotate/handle.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js +42 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +142 -0
- package/dist/interactions/actions/useStandardActions.js.map +1 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
- package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
- package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
- package/dist/interactions/gestures/shared/originProjection.js +42 -0
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
- package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
- package/dist/interactions/gestures/shared/snap.js +24 -0
- package/dist/interactions/gestures/shared/snap.js.map +1 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
- package/dist/layout/arrivals.js +36 -0
- package/dist/layout/arrivals.js.map +1 -0
- package/dist/{math-MCQcf_gc.d.ts → math-Drrw4ewZ.d.ts} +8 -116
- package/dist/math.d.ts +4 -5
- package/dist/math.js +6 -4
- package/dist/mesh.d.ts +268 -0
- package/dist/mesh.js +7 -0
- package/dist/move.d.ts +7 -49
- package/dist/move.js +3 -142
- package/dist/originProjection-DEklpDc_.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-D-OH-tu5.d.ts} +0 -4
- package/dist/registerProgram-ateHDGjw.d.ts +193 -0
- package/dist/renderer/DrawCommand.js +6 -0
- package/dist/renderer/DrawCommand.js.map +1 -0
- package/dist/renderer/WeaselRenderer.js +328 -0
- package/dist/renderer/WeaselRenderer.js.map +1 -0
- package/dist/renderer/cache/GLImageCache.js +64 -0
- package/dist/renderer/cache/GLImageCache.js.map +1 -0
- package/dist/renderer/cache/GLMeshCache.js +102 -0
- package/dist/renderer/cache/GLMeshCache.js.map +1 -0
- package/dist/renderer/cache/GLTextureCache.js +51 -0
- package/dist/renderer/cache/GLTextureCache.js.map +1 -0
- package/dist/renderer/cache/GradientRampAtlas.js +82 -0
- package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
- package/dist/renderer/cache/cache.js +13 -0
- package/dist/renderer/cache/cache.js.map +1 -0
- package/dist/renderer/cache/markerCommandCache.js +59 -0
- package/dist/renderer/cache/markerCommandCache.js.map +1 -0
- package/dist/renderer/cache/outlineMeshCache.js +15 -0
- package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
- package/dist/renderer/cache/strokeMeshCache.js +44 -0
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
- package/dist/renderer/cullDrawCommands.js +89 -0
- package/dist/renderer/cullDrawCommands.js.map +1 -0
- package/dist/renderer/draw.js +1109 -0
- package/dist/renderer/draw.js.map +1 -0
- package/dist/renderer/drawBatch.js +168 -0
- package/dist/renderer/drawBatch.js.map +1 -0
- package/dist/renderer/effects/EffectTargets.js +45 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -0
- package/dist/renderer/effects/builtins.js +31 -0
- package/dist/renderer/effects/builtins.js.map +1 -0
- package/dist/renderer/effects/composite.js +9 -0
- package/dist/renderer/effects/composite.js.map +1 -0
- package/dist/renderer/effects/effectPrelude.js +10 -0
- package/dist/renderer/effects/effectPrelude.js.map +1 -0
- package/dist/renderer/effects/types.js +10 -0
- package/dist/renderer/effects/types.js.map +1 -0
- package/dist/renderer/index.js +19 -0
- package/dist/renderer/math/color.js +341 -0
- package/dist/renderer/math/color.js.map +1 -0
- package/dist/renderer/math/mat3.js +71 -0
- package/dist/renderer/math/mat3.js.map +1 -0
- package/dist/renderer/math/patternSpace.js +22 -0
- package/dist/renderer/math/patternSpace.js.map +1 -0
- package/dist/renderer/math/viewToMat3.js +19 -0
- package/dist/renderer/math/viewToMat3.js.map +1 -0
- package/dist/renderer/paintResources.js +18 -0
- package/dist/renderer/paintResources.js.map +1 -0
- package/dist/renderer/paintScratch.js +37 -0
- package/dist/renderer/paintScratch.js.map +1 -0
- package/dist/renderer/shaders/ShaderProgram.js +74 -0
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
- package/dist/renderer/shaders/batchFill.js +118 -0
- package/dist/renderer/shaders/batchFill.js.map +1 -0
- package/dist/renderer/shaders/customPrelude.js +34 -0
- package/dist/renderer/shaders/customPrelude.js.map +1 -0
- package/dist/renderer/shaders/extractUniformNames.js +184 -0
- package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
- package/dist/renderer/shaders/glyphPaint.js +61 -0
- package/dist/renderer/shaders/glyphPaint.js.map +1 -0
- package/dist/renderer/shaders/gradFill.js +30 -0
- package/dist/renderer/shaders/gradFill.js.map +1 -0
- package/dist/renderer/shaders/imageFill.js +14 -0
- package/dist/renderer/shaders/imageFill.js.map +1 -0
- package/dist/renderer/shaders/pathFill.js +13 -0
- package/dist/renderer/shaders/pathFill.js.map +1 -0
- package/dist/renderer/shaders/patternFill.js +24 -0
- package/dist/renderer/shaders/patternFill.js.map +1 -0
- package/dist/renderer/shaders/registerProgram.js +18 -0
- package/dist/renderer/shaders/registerProgram.js.map +1 -0
- package/dist/renderer/spriteSheet.js +14 -0
- package/dist/renderer/spriteSheet.js.map +1 -0
- package/dist/renderer/state/GroupState.js +77 -0
- package/dist/renderer/state/GroupState.js.map +1 -0
- package/dist/renderer/syntheticItalic.js +6 -0
- package/dist/renderer/syntheticItalic.js.map +1 -0
- package/dist/renderer/textures/registerTexture.js +14 -0
- package/dist/renderer/textures/registerTexture.js.map +1 -0
- package/dist/renderer.d.ts +11 -21
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -0
- package/dist/style.css +2 -0
- package/dist/test-hook/createTestHook.js +39 -0
- package/dist/test-hook/createTestHook.js.map +1 -0
- package/dist/test-hook/install.js +12 -0
- package/dist/test-hook/install.js.map +1 -0
- package/dist/test-seams-fYf6m5pu.d.ts +356 -0
- package/dist/test-seams.d.ts +6 -0
- package/dist/test-seams.js +3 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
- package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
- package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
- package/dist/tools/builtin/hand/useHandTool.js +31 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
- package/dist/tools/builtin/image/useImageTool.js +41 -0
- package/dist/tools/builtin/image/useImageTool.js.map +1 -0
- package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
- package/dist/tools/builtin/line/useLineTool.js +33 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -0
- package/dist/tools/builtin/pen/usePenTool.js +414 -0
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
- package/dist/tools/builtin/pickTopMostHit.js +45 -0
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
- package/dist/tools/builtin/rect/useRectTool.js +32 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +109 -0
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
- package/dist/tools/builtin/select/useSelectTool.js +162 -0
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
- package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
- package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +263 -0
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
- package/dist/tools/builtin/star/useStarTool.js +82 -0
- package/dist/tools/builtin/star/useStarTool.js.map +1 -0
- package/dist/tools/builtin/text/useTextTool.js +177 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -0
- package/dist/tools/overlayBinding.js +8 -0
- package/dist/tools/overlayBinding.js.map +1 -0
- package/dist/tools/prefs.js +47 -0
- package/dist/tools/prefs.js.map +1 -0
- package/dist/tools/useKeybindings.js +66 -0
- package/dist/tools/useKeybindings.js.map +1 -0
- package/dist/{types-D-9QWBy5.d.ts → types-A37hYkeR.d.ts} +185 -15
- package/dist/{types-qYpyTAiZ.d.ts → types-B_9g6hMM.d.ts} +32 -6
- package/dist/util/color.js +26 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/constrainTo45.js +17 -0
- package/dist/util/constrainTo45.js.map +1 -0
- package/dist/util/paint.js +72 -0
- package/dist/util/paint.js.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -19
- package/dist/chunk-3TY6FHAF.js +0 -170
- package/dist/chunk-3TY6FHAF.js.map +0 -1
- package/dist/chunk-DGWNNKGD.js +0 -248
- package/dist/chunk-DGWNNKGD.js.map +0 -1
- package/dist/chunk-G4ZGQMY7.js +0 -33372
- package/dist/chunk-G4ZGQMY7.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-LU4IJ52W.js +0 -111
- package/dist/chunk-LU4IJ52W.js.map +0 -1
- package/dist/chunk-M24CLARN.js +0 -28
- package/dist/chunk-M24CLARN.js.map +0 -1
- package/dist/chunk-NE27EOLP.js +0 -146
- package/dist/chunk-NE27EOLP.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-UPZY4ART.js +0 -29
- package/dist/chunk-UPZY4ART.js.map +0 -1
- package/dist/chunk-WPNA6L5O.js +0 -250
- package/dist/chunk-WPNA6L5O.js.map +0 -1
- package/dist/chunk-XMAWPGTK.js +0 -128
- package/dist/chunk-XMAWPGTK.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-CY5UKlZh.d.ts +0 -98
- package/dist/index.css +0 -62
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -36
- package/dist/insert.js +0 -81
- package/dist/insert.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/move.js.map +0 -1
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -62
- package/dist/renderer.css.map +0 -1
- package/dist/renderer.js.map +0 -1
- package/dist/resize.js.map +0 -1
- package/dist/routing.js.map +0 -1
- package/dist/types-D2tTKEU0.d.ts +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layerOrder.js","names":["STANDARD_SLOT_SET","STANDARD_SLOTS","composeOrderedLayers","afterByParent","beforeByParent","tail","allCustomKeys","key","value","layersMap","isCustomEntry","arr","emitted","out","background","emitChild","child","emitBefore","emitAfter","parentKey","slot","sceneLayers","sl","layer","standardLayers","t","ref","placeToolOverlays","before","overlays","after","at","selectionOverlay","ordered"],"sources":["../../src/canvas/layerOrder.ts"],"sourcesContent":["import type { RenderLayer } from '../core/layers/render';\nimport type { LayerSlotValue } from './Canvas';\nimport { STANDARD_SLOTS, isCustomEntry } from './layerSlots';\nimport type { OverlayPosition } from '@weasel-js/routing';\n\nconst STANDARD_SLOT_SET = new Set<string>(STANDARD_SLOTS);\n\n/**\n * Compose the final ordered layer list from a layersMap and the resolved\n * standard-slot layers.\n *\n * Semantics:\n * - Standard slots are emitted in `STANDARD_SLOTS` order.\n * - Each standard-slot layer is preceded by its `before` chain (deepest first)\n * and followed by its `after` chain (ancestors first).\n * - `after: 'X'` / `before: 'X'` accept standard slot names OR other\n * custom-layer keys, and chains may mix the two — a custom anchored\n * `before` a slot can itself carry an `after` chain, and vice versa.\n * - Customs with neither `after` nor `before` go to a tail bucket emitted\n * after all standard slots.\n * - Dangling references (target unresolvable) go to the tail with a\n * `console.warn`. Cycles are detected and broken with a warning.\n *\n * Pure function — no side effects beyond `console.warn` on malformed input.\n */\nexport function composeOrderedLayers<TNode extends { id: string }, TPose>(\n layersMap: Record<string, LayerSlotValue<TNode, TPose> | null | undefined>,\n standardLayers: Partial<Record<(typeof STANDARD_SLOTS)[number], RenderLayer<unknown>>>,\n /** When the `scene` slot is split into per-scene-layer canvas layers (keyed\n * `scene:<layerId>`), pass them here in render order. Each key becomes an\n * anchor point, so customs can target `before/after: 'scene:<layerId>'`.\n * `before/after: 'scene'` still works (before the first / after the last).\n * When omitted, the `scene` slot uses `standardLayers.scene` as before. */\n sceneLayers?: ReadonlyArray<{ key: string; layer: RenderLayer<unknown> }>,\n /** Drawn beneath everything else, grid and customs anchored before the\n * scene included — a fill that must never cover what is laid over it. */\n background?: RenderLayer<unknown>,\n): RenderLayer<unknown>[] {\n // Map<parent key, [{ key, layer }, ...]> — children grouped by their declared anchor.\n const afterByParent = new Map<string, Array<{ key: string; layer: RenderLayer<unknown> }>>();\n const beforeByParent = new Map<string, Array<{ key: string; layer: RenderLayer<unknown> }>>();\n const tail: Array<{ key: string; layer: RenderLayer<unknown> }> = [];\n const allCustomKeys = new Set<string>();\n\n for (const [key, value] of Object.entries(layersMap)) {\n if (STANDARD_SLOT_SET.has(key)) continue;\n if (!isCustomEntry(value)) continue;\n allCustomKeys.add(key);\n if (value.after) {\n const arr = afterByParent.get(value.after) ?? [];\n arr.push({ key, layer: value.layer });\n afterByParent.set(value.after, arr);\n } else if (value.before) {\n const arr = beforeByParent.get(value.before) ?? [];\n arr.push({ key, layer: value.layer });\n beforeByParent.set(value.before, arr);\n } else {\n tail.push({ key, layer: value.layer });\n }\n }\n\n const emitted = new Set<string>();\n const out: RenderLayer<unknown>[] = background ? [background] : [];\n\n function emitChild(child: { key: string; layer: RenderLayer<unknown> }) {\n if (emitted.has(child.key)) {\n // Cycle — already emitted via another path. Warn once.\n console.warn(`composeOrderedLayers: cycle detected involving custom layer \"${child.key}\"`);\n return;\n }\n emitted.add(child.key);\n emitBefore(child.key);\n out.push(child.layer);\n emitAfter(child.key);\n }\n\n function emitAfter(parentKey: string) {\n for (const child of afterByParent.get(parentKey) ?? []) emitChild(child);\n }\n\n function emitBefore(parentKey: string) {\n for (const child of beforeByParent.get(parentKey) ?? []) emitChild(child);\n }\n\n for (const slot of STANDARD_SLOTS) {\n if (slot === 'scene' && sceneLayers) {\n // Split scene slot: emit each per-scene-layer canvas layer in order, with\n // its own anchor point. `before/after: 'scene'` brackets the whole group.\n emitBefore('scene');\n for (const sl of sceneLayers) {\n emitBefore(sl.key);\n out.push(sl.layer);\n emitAfter(sl.key);\n }\n emitAfter('scene');\n continue;\n }\n emitBefore(slot);\n const layer = standardLayers[slot];\n if (layer) out.push(layer);\n emitAfter(slot);\n }\n\n // Tail customs (neither after nor before).\n for (const t of tail) {\n if (emitted.has(t.key)) continue;\n emitted.add(t.key);\n out.push(t.layer);\n }\n\n // Orphans: customs that declared an `after`/`before` but never got emitted\n // (target didn't resolve through any chain to a known standard slot or custom).\n for (const key of allCustomKeys) {\n if (emitted.has(key)) continue;\n const value = layersMap[key];\n if (!isCustomEntry(value)) continue;\n const ref = value.after ?? value.before;\n console.warn(`composeOrderedLayers: dangling reference \"${ref}\" from custom layer \"${key}\" — falling back to tail`);\n emitted.add(key);\n out.push(value.layer);\n }\n\n return out;\n}\n\n/**\n * Splice a tool's positioned overlays into an already-composed layer list.\n *\n * `'top'` appends; the other two anchor on the selection-chrome layer's index\n * in `ordered`. With no selection chrome present the anchored overlays fall\n * back to the tail, keeping their relative order. Mutates and returns\n * `ordered`.\n */\nexport function placeToolOverlays(\n ordered: RenderLayer<unknown>[],\n selectionOverlay: RenderLayer<unknown> | undefined,\n overlays: (position: OverlayPosition) => RenderLayer<unknown>[],\n): RenderLayer<unknown>[] {\n const before = overlays('before-selection');\n const after = overlays('after-selection');\n const at = selectionOverlay ? ordered.indexOf(selectionOverlay) : -1;\n if (at >= 0) {\n ordered.splice(at + 1, 0, ...after);\n ordered.splice(at, 0, ...before);\n } else {\n ordered.push(...before, ...after);\n }\n ordered.push(...overlays('top'));\n return ordered;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/canvas/layerSlots.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"grid",
|
|
4
|
+
"cellHighlight",
|
|
5
|
+
"scene",
|
|
6
|
+
"selectionOverlay"
|
|
7
|
+
];
|
|
8
|
+
function t(e) {
|
|
9
|
+
return !!e && typeof e == "object" && "layer" in e;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { e as STANDARD_SLOTS, t as isCustomEntry };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=layerSlots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layerSlots.js","names":["STANDARD_SLOTS","isCustomEntry","v"],"sources":["../../src/canvas/layerSlots.ts"],"sourcesContent":["import type { RenderLayer } from '../core/layers/render';\n\n/** Standard slot names — render in this canonical order.\n * `cellHighlight` is not an anchor for custom layers: it sits between the\n * grid and the scene, so anchor to one of those. */\n/** @internal */\nexport const STANDARD_SLOTS = [\n 'grid',\n 'cellHighlight',\n 'scene',\n 'selectionOverlay',\n] as const;\n\n/** Names of the slots `<Canvas>` supports out of the box (excluding the implicit cell-highlight overlay). */\nexport type StandardSlotName = Exclude<(typeof STANDARD_SLOTS)[number], 'cellHighlight'>;\n\n/** Custom layer entry — any key not in `STANDARD_SLOTS`. The presence of\n * `.layer` discriminates this from a slot config. */\nexport interface CustomLayerEntry {\n layer: RenderLayer<unknown>;\n /** Insert immediately after the named standard slot or another custom-layer key. */\n after?: StandardSlotName | (string & {});\n /** Insert immediately before the named standard slot or another custom-layer key. */\n before?: StandardSlotName | (string & {});\n}\n\nexport function isCustomEntry(v: unknown): v is CustomLayerEntry {\n return !!v && typeof v === 'object' && 'layer' in (v as Record<string, unknown>);\n}\n"],"mappings":";AAMA,IAAaA,IAAiB;CAC5B;CACA;CACA;CACA;AACF;AAeA,SAAgBC,EAAc,GAAmC;CAC/D,OAAO,CAAC,CAACC,KAAK,OAAOA,KAAM,YAAY,WAAYA;AACrD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { documentPose as e } from "../core/scene/effectivePose.js";
|
|
2
|
+
import { poseDescriptorForNode as t } from "../core/geometry/poseDescriptor.js";
|
|
3
|
+
//#region src/canvas/minimapMath.ts
|
|
4
|
+
var n = 8, r = {
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 0,
|
|
7
|
+
scale: {
|
|
8
|
+
x: 1,
|
|
9
|
+
y: 1
|
|
10
|
+
}
|
|
11
|
+
}, i = "#ffffff", a = 1, o = [2, 3];
|
|
12
|
+
function s(e, t, n) {
|
|
13
|
+
let r = Math.max(1, t.width - n * 2), i = Math.max(1, t.height - n * 2);
|
|
14
|
+
if (e.width <= 0 || e.height <= 0) return {
|
|
15
|
+
x: e.x - t.width / 2,
|
|
16
|
+
y: e.y - t.height / 2,
|
|
17
|
+
scale: {
|
|
18
|
+
x: 1,
|
|
19
|
+
y: 1
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
let a = r / e.width, o = i / e.height, s = Math.min(a, o), c = e.x + e.width / 2, l = e.y + e.height / 2;
|
|
23
|
+
return {
|
|
24
|
+
x: c - t.width / (2 * s),
|
|
25
|
+
y: l - t.height / (2 * s),
|
|
26
|
+
scale: {
|
|
27
|
+
x: s,
|
|
28
|
+
y: s
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function c(n, r) {
|
|
33
|
+
let i = Infinity, a = Infinity, o = -Infinity, s = -Infinity, c = !1;
|
|
34
|
+
for (let l of n.nodes.values()) {
|
|
35
|
+
if (l.kind !== "leaf") continue;
|
|
36
|
+
let u = t(r, l).getBounds(e(n, l));
|
|
37
|
+
u.x < i && (i = u.x), u.y < a && (a = u.y);
|
|
38
|
+
let d = u.x + u.width, f = u.y + u.height;
|
|
39
|
+
d > o && (o = d), f > s && (s = f), c = !0;
|
|
40
|
+
}
|
|
41
|
+
return c ? {
|
|
42
|
+
x: i,
|
|
43
|
+
y: a,
|
|
44
|
+
width: o - i,
|
|
45
|
+
height: s - a
|
|
46
|
+
} : null;
|
|
47
|
+
}
|
|
48
|
+
function l(e, t, i, a, o = {}) {
|
|
49
|
+
let l = o.padding ?? n;
|
|
50
|
+
if (typeof i == "function") return i(e, t);
|
|
51
|
+
if (i === "scene") {
|
|
52
|
+
let n = c(e, a);
|
|
53
|
+
return n === null ? r : s(n, t, l);
|
|
54
|
+
}
|
|
55
|
+
return s(i.rect, t, l);
|
|
56
|
+
}
|
|
57
|
+
function u(e, t, n = {}) {
|
|
58
|
+
return {
|
|
59
|
+
kind: "path",
|
|
60
|
+
path: {
|
|
61
|
+
kind: "rect",
|
|
62
|
+
x: e.x,
|
|
63
|
+
y: e.y,
|
|
64
|
+
width: t.width / e.scale.x,
|
|
65
|
+
height: t.height / e.scale.y
|
|
66
|
+
},
|
|
67
|
+
stroke: {
|
|
68
|
+
paint: {
|
|
69
|
+
fill: "solid",
|
|
70
|
+
color: n.stroke ?? i
|
|
71
|
+
},
|
|
72
|
+
width: n.width ?? a,
|
|
73
|
+
dash: n.dash ?? [...o]
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { r as FALLBACK_FIT_VIEW, l as computeFitView, u as computeIndicatorCommand };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=minimapMath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimapMath.js","names":["DEFAULT_FIT_PADDING","FALLBACK_FIT_VIEW","DEFAULT_INDICATOR_STROKE","DEFAULT_INDICATOR_WIDTH","DEFAULT_INDICATOR_DASH","fitRectInto","availW","dims","padding","availH","rect","sx","sy","worldCx","worldCy","sceneLeafBounds","minX","minY","maxX","maxY","any","node","scene","b","poseDescriptorForNode","descriptor","documentPose","right","bottom","computeFitView","opts","fit","computeIndicatorCommand","mainView","mainViewDims","style"],"sources":["../../src/canvas/minimapMath.ts"],"sourcesContent":["/**\n * Pure math helpers for `<MinimapCanvas>`.\n *\n * `computeFitView` derives a `View` that fits a chosen world rect into a\n * minimap canvas of given pixel dims. `computeIndicatorCommand` builds the\n * dashed \"visible window\" rect — the main canvas's screen window projected\n * into the minimap's own screen coordinates.\n *\n * Neither helper touches GL, the DOM, or the renderer; they're pure\n * functions, unit-testable with `expect`.\n */\nimport { documentPose } from '../core/scene';\nimport type { Scene } from '../core/scene';\nimport type { View } from '../core/viewport/view';\nimport type { Bounds, ViewportDims } from '../core/viewport/fitViewToBounds';\nimport { poseDescriptorForNode, type PoseDescriptor } from '../core/geometry/poseDescriptor';\nimport type { PathDrawCommand } from '../renderer/DrawCommand';\n\n/** Inset (CSS px) around the fit rect on each side. Matches the spec note. */\nconst DEFAULT_FIT_PADDING = 8;\n\n/**\n * Fallback view returned when there is nothing to fit (empty scene, etc.).\n * Identity view at the origin — produces a 1:1 mapping centered on (0, 0).\n */\nexport const FALLBACK_FIT_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n\n/**\n * Fit policy for `<MinimapCanvas>` / `computeFitView`.\n *\n * - `\"scene\"` — union of leaf-node pose AABBs (via the pose descriptor).\n * - `{ kind: \"world\", rect }` — caller-supplied world rect.\n * - `(scene, dims) => View` — caller derives the view directly.\n */\nexport type MinimapFit<TData, TLayer extends string, TPose> =\n | 'scene'\n | { kind: 'world'; rect: Bounds }\n | ((scene: Scene<TData, TLayer, TPose>, dims: ViewportDims) => View);\n\n/** Style for the visible-window indicator rect drawn over the minimap. */\nexport interface IndicatorStyle {\n /** Stroke color (any CSS color). Defaults to `'#ffffff'`. */\n stroke?: string;\n /** Stroke width in CSS px. Defaults to `1`. */\n width?: number;\n /** Dash pattern in CSS px. Defaults to `[2, 3]`. */\n dash?: number[];\n}\n\nconst DEFAULT_INDICATOR_STROKE = '#ffffff';\nconst DEFAULT_INDICATOR_WIDTH = 1;\nconst DEFAULT_INDICATOR_DASH: readonly number[] = [2, 3];\n\n/** Internal: fit a world rect uniformly into dims with padding. */\nfunction fitRectInto(rect: Bounds, dims: ViewportDims, padding: number): View {\n const availW = Math.max(1, dims.width - padding * 2);\n const availH = Math.max(1, dims.height - padding * 2);\n // Degenerate rect (zero / negative area): fall back to identity at the\n // rect's top-left so we at least center *something* sensible.\n if (rect.width <= 0 || rect.height <= 0) {\n return {\n x: rect.x - dims.width / 2,\n y: rect.y - dims.height / 2,\n scale: { x: 1, y: 1 },\n };\n }\n const sx = availW / rect.width;\n const sy = availH / rect.height;\n const s = Math.min(sx, sy);\n const worldCx = rect.x + rect.width / 2;\n const worldCy = rect.y + rect.height / 2;\n return {\n x: worldCx - dims.width / (2 * s),\n y: worldCy - dims.height / (2 * s),\n scale: { x: s, y: s },\n };\n}\n\n/**\n * Compute the AABB union of all leaf-node poses in the scene, via\n * `descriptor`. Container nodes are skipped — their effective bounds come\n * from their descendant leaves. Returns `null` when the scene has no\n * leaves.\n */\nfunction sceneLeafBounds<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n descriptor: PoseDescriptor<TPose>,\n): Bounds | null {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let any = false;\n for (const node of scene.nodes.values()) {\n if (node.kind !== 'leaf') continue;\n const b = poseDescriptorForNode(descriptor, node).getBounds(documentPose(scene, node));\n if (b.x < minX) minX = b.x;\n if (b.y < minY) minY = b.y;\n const right = b.x + b.width;\n const bottom = b.y + b.height;\n if (right > maxX) maxX = right;\n if (bottom > maxY) maxY = bottom;\n any = true;\n }\n if (!any) return null;\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/** Options for {@link computeFitView}. */\nexport interface ComputeFitViewOptions {\n /** Inset (CSS px) around the fit rect on each side. Defaults to `8`. */\n padding?: number;\n}\n\n/**\n * Derive a `View` that fits the chosen world rect into a minimap of\n * `dims.width × dims.height` CSS px. Uniform scale on both axes; the rect\n * is centered with `padding` (default 8) on each side. The smaller-axis\n * fit ratio wins, so the whole rect is visible.\n *\n * - `fit === \"scene\"`: union AABB of leaf-node poses via `descriptor`.\n * Empty scene → {@link FALLBACK_FIT_VIEW}.\n * - `fit` is `{ kind: \"world\", rect }`: fit `rect`. A degenerate rect\n * (zero or negative area) falls back to identity scale centered on the\n * rect's top-left — we don't divide by zero.\n * - `fit` is a function: called with `(scene, dims)`; its return is\n * passed through unchanged.\n */\nexport function computeFitView<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n dims: ViewportDims,\n fit: MinimapFit<TData, TLayer, TPose>,\n descriptor: PoseDescriptor<TPose>,\n opts: ComputeFitViewOptions = {},\n): View {\n const padding = opts.padding ?? DEFAULT_FIT_PADDING;\n\n if (typeof fit === 'function') {\n return fit(scene, dims);\n }\n if (fit === 'scene') {\n const rect = sceneLeafBounds(scene, descriptor);\n if (rect === null) return FALLBACK_FIT_VIEW;\n return fitRectInto(rect, dims, padding);\n }\n // { kind: 'world', rect }\n return fitRectInto(fit.rect, dims, padding);\n}\n\n/**\n * Build the visible-window indicator `DrawCommand` for the minimap.\n *\n * The main canvas's visible world rect is:\n * ```\n * worldX = mainView.x\n * worldY = mainView.y\n * worldW = mainViewDims.width / mainView.scale.x\n * worldH = mainViewDims.height / mainView.scale.y\n * ```\n * That world rect is then transformed into the minimap's screen\n * coordinates through `minimapView`.\n *\n * The returned command is a dashed-stroke `path` rect with no fill.\n */\nexport function computeIndicatorCommand(\n mainView: View,\n mainViewDims: ViewportDims,\n style: IndicatorStyle = {},\n): PathDrawCommand {\n // World-space rect: returned as-is. The caller wraps the command list\n // (scene + extras) in a group transformed by the minimap's view, so the\n // indicator lands in screen coords automatically. Returning screen coords\n // here would get the view transform applied a second time — a bug that\n // manifested as the indicator drifting at non-identity minimap scale.\n const x = mainView.x;\n const y = mainView.y;\n const width = mainViewDims.width / mainView.scale.x;\n const height = mainViewDims.height / mainView.scale.y;\n return {\n kind: 'path',\n path: { kind: 'rect', x, y, width, height },\n stroke: {\n paint: { fill: 'solid', color: style.stroke ?? DEFAULT_INDICATOR_STROKE },\n width: style.width ?? DEFAULT_INDICATOR_WIDTH,\n dash: style.dash ?? [...DEFAULT_INDICATOR_DASH],\n },\n };\n}\n"],"mappings":";;;AAmBA,IAAMA,IAAsB,GAMfC,IAA0B;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAE;AAAE,GAwBrEC,IAA2B,WAC3BC,IAA0B,GAC1BC,IAA4C,CAAC,GAAG,CAAC;AAGvD,SAASC,EAAY,GAAc,GAAoB,GAAuB;CAC5E,IAAMC,IAAS,KAAK,IAAI,GAAGC,EAAK,QAAQC,IAAU,CAAC,GAC7CC,IAAS,KAAK,IAAI,GAAGF,EAAK,SAASC,IAAU,CAAC;CAGpD,IAAIE,EAAK,SAAS,KAAKA,EAAK,UAAU,GACpC,OAAO;EACL,GAAGA,EAAK,IAAIH,EAAK,QAAQ;EACzB,GAAGG,EAAK,IAAIH,EAAK,SAAS;EAC1B,OAAO;GAAE,GAAG;GAAG,GAAG;EAAE;CACtB;CAEF,IAAMI,IAAKL,IAASI,EAAK,OACnBE,IAAKH,IAASC,EAAK,QACnB,IAAI,KAAK,IAAIC,GAAIC,CAAE,GACnBC,IAAUH,EAAK,IAAIA,EAAK,QAAQ,GAChCI,IAAUJ,EAAK,IAAIA,EAAK,SAAS;CACvC,OAAO;EACL,GAAGG,IAAUN,EAAK,SAAS,IAAI;EAC/B,GAAGO,IAAUP,EAAK,UAAU,IAAI;EAChC,OAAO;GAAE,GAAG;GAAG,GAAG;EAAE;CACtB;AACF;AAQA,SAASQ,EACP,GACA,GACe;CACf,IAAIC,IAAO,UACPC,IAAO,UACPC,IAAO,WACPC,IAAO,WACPC,IAAM;CACV,KAAK,IAAMC,KAAQC,EAAM,MAAM,OAAO,GAAG;EACvC,IAAID,EAAK,SAAS,QAAQ;EAC1B,IAAME,IAAIC,EAAsBC,GAAYJ,CAAI,CAAC,CAAC,UAAUK,EAAaJ,GAAOD,CAAI,CAAC;EAErF,AADIE,EAAE,IAAIP,MAAM,IAAOO,EAAE,IACrBA,EAAE,IAAIN,MAAM,IAAOM,EAAE;EACzB,IAAMI,IAAQJ,EAAE,IAAIA,EAAE,OAChBK,IAASL,EAAE,IAAIA,EAAE;EAGvB,AAFII,IAAQT,MAAM,IAAOS,IACrBC,IAAST,MAAM,IAAOS,IAC1B,IAAM;CACR;CAEA,OADKR,IACE;EAAE,GAAGJ;EAAM,GAAGC;EAAM,OAAOC,IAAOF;EAAM,QAAQG,IAAOF;CAAK,IADlD;AAEnB;AAsBA,SAAgBY,EACd,GACA,GACA,GACA,GACA,IAA8B,CAAC,GACzB;CACN,IAAMrB,IAAUsB,EAAK,WAAW9B;CAEhC,IAAI,OAAO+B,KAAQ,YACjB,OAAOA,EAAIT,GAAOf,CAAI;CAExB,IAAIwB,MAAQ,SAAS;EACnB,IAAMrB,IAAOK,EAAgBO,GAAOG,CAAU;EAE9C,OADIf,MAAS,OAAaT,IACnBI,EAAYK,GAAMH,GAAMC,CAAO;CACxC;CAEA,OAAOH,EAAY0B,EAAI,MAAMxB,GAAMC,CAAO;AAC5C;AAiBA,SAAgBwB,EACd,GACA,GACA,IAAwB,CAAC,GACR;CAUjB,OAAO;EACL,MAAM;EACN,MAAM;GAAE,MAAM;GAAQ,GANdC,EAAS;GAMQ,GALjBA,EAAS;GAKW,OAJhBC,EAAa,QAAQD,EAAS,MAAM;GAIb,QAHtBC,EAAa,SAASD,EAAS,MAAM;EAGR;EAC1C,QAAQ;GACN,OAAO;IAAE,MAAM;IAAS,OAAOE,EAAM,UAAUjC;GAAyB;GACxE,OAAOiC,EAAM,SAAShC;GACtB,MAAMgC,EAAM,QAAQ,CAAC,GAAG/B,CAAsB;EAChD;CACF;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/canvas/mountedCanvases.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Map();
|
|
3
|
+
function t(t) {
|
|
4
|
+
return e.set(t.element, t), () => {
|
|
5
|
+
e.get(t.element) === t && e.delete(t.element);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function n(t, n) {
|
|
9
|
+
if (n instanceof Node) for (let r = n; r && t.contains(r); r = r.parentNode) {
|
|
10
|
+
let t = e.get(r);
|
|
11
|
+
if (t) return t;
|
|
12
|
+
}
|
|
13
|
+
let r = null;
|
|
14
|
+
for (let n of e.values()) t.contains(n.element) && (!r || r.element.compareDocumentPosition(n.element) & Node.DOCUMENT_POSITION_PRECEDING) && (r = n);
|
|
15
|
+
return r;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as findMountedCanvas, t as registerMountedCanvas };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=mountedCanvases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mountedCanvases.js","names":["mounted","registerMountedCanvas","entry","findMountedCanvas","hint","n","root","hit","first"],"sources":["../../src/canvas/mountedCanvases.ts"],"sourcesContent":["/**\n * Every mounted kit canvas, keyed by the element its input and its\n * client→world conversions measure. DOM chrome that is handed only an element\n * — a text-edit container — finds the camera beneath it here instead of making\n * the consumer thread the view through by hand.\n */\nimport type { View } from 'core/viewport/view';\n\nexport interface MountedCanvas {\n readonly element: HTMLElement;\n getView(): View;\n}\n\nconst mounted = new Map<HTMLElement, MountedCanvas>();\n\n/** Register `entry` until the returned disposer runs. */\nexport function registerMountedCanvas(entry: MountedCanvas): () => void {\n mounted.set(entry.element, entry);\n return () => {\n if (mounted.get(entry.element) === entry) mounted.delete(entry.element);\n };\n}\n\n/**\n * The kit canvas at or inside `root`. When `hint` is given, the canvas that\n * contains it wins — the one a click actually landed on. Otherwise the first\n * in document order.\n */\nexport function findMountedCanvas(root: Element, hint?: EventTarget | null): MountedCanvas | null {\n if (hint instanceof Node) {\n for (let n: Node | null = hint; n && root.contains(n); n = n.parentNode) {\n const hit = mounted.get(n as HTMLElement);\n if (hit) return hit;\n }\n }\n let first: MountedCanvas | null = null;\n for (const entry of mounted.values()) {\n if (!root.contains(entry.element)) continue;\n if (\n !first\n || first.element.compareDocumentPosition(entry.element) & Node.DOCUMENT_POSITION_PRECEDING\n ) {\n first = entry;\n }\n }\n return first;\n}\n"],"mappings":";AAaA,IAAMA,oBAAU,IAAI,IAAgC;AAGpD,SAAgBC,EAAsB,GAAkC;CAEtE,OADAD,EAAQ,IAAIE,EAAM,SAASA,CAAK,SACnB;EACX,AAAIF,EAAQ,IAAIE,EAAM,OAAO,MAAMA,KAAOF,EAAQ,OAAOE,EAAM,OAAO;CACxE;AACF;AAOA,SAAgBC,EAAkB,GAAe,GAAiD;CAChG,IAAIC,aAAgB,MAClB,KAAK,IAAIC,IAAiBD,GAAMC,KAAKC,EAAK,SAASD,CAAC,GAAG,IAAIA,EAAE,YAAY;EACvE,IAAME,IAAMP,EAAQ,IAAIK,CAAgB;EACxC,IAAIE,GAAK,OAAOA;CAClB;CAEF,IAAIC,IAA8B;CAClC,KAAK,IAAMN,KAASF,EAAQ,OAAO,GACjC,AAAKM,EAAK,SAASJ,EAAM,OAAO,MAE9B,CAACM,KACEA,EAAM,QAAQ,wBAAwBN,EAAM,OAAO,IAAI,KAAK,iCAE/D,IAAQA;CAGZ,OAAOM;AACT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/canvas/overlayRoleStrokes.ts
|
|
2
|
+
var e = {
|
|
3
|
+
cut: {
|
|
4
|
+
paint: { color: "#e23b3b" },
|
|
5
|
+
width: 1,
|
|
6
|
+
dash: [6, 4]
|
|
7
|
+
},
|
|
8
|
+
connector: {
|
|
9
|
+
paint: { color: "#7ba7c7" },
|
|
10
|
+
width: 2,
|
|
11
|
+
dash: [4, 4]
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as OVERLAY_ROLE_STROKES };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=overlayRoleStrokes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayRoleStrokes.js","names":["OVERLAY_ROLE_STROKES"],"sources":["../../src/canvas/overlayRoleStrokes.ts"],"sourcesContent":["import type { Stroke } from '@weasel-js/paint';\n\n/** How each `polyline` overlay role reads. An action publishes the run and\n * the word; this table is the whole of the paint, for the dispatcher overlay\n * and for any tool previewing the same kind of run between gestures. */\nexport const OVERLAY_ROLE_STROKES: Readonly<Record<string, Stroke>> = {\n cut: { paint: { color: '#e23b3b' }, width: 1, dash: [6, 4] },\n connector: { paint: { color: '#7ba7c7' }, width: 2, dash: [4, 4] },\n};\n"],"mappings":";AAKA,IAAaA,IAAyD;CACpE,KAAK;EAAE,OAAO,EAAE,OAAO,UAAU;EAAG,OAAO;EAAG,MAAM,CAAC,GAAG,CAAC;CAAE;CAC3D,WAAW;EAAE,OAAO,EAAE,OAAO,UAAU;EAAG,OAAO;EAAG,MAAM,CAAC,GAAG,CAAC;CAAE;AACnE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { mat3 as e } from "../renderer/math/mat3.js";
|
|
2
|
+
import { viewToMat3 as t } from "../renderer/math/viewToMat3.js";
|
|
3
|
+
import { boundsMissRect as n } from "../renderer/cullDrawCommands.js";
|
|
4
|
+
import { poseRotationOf as r } from "../core/geometry/poseRotation.js";
|
|
5
|
+
import { rotationMatrixAbout as i } from "./poseRotation.js";
|
|
6
|
+
//#region src/canvas/paintCull.ts
|
|
7
|
+
function a(a, o, s) {
|
|
8
|
+
let c = o, l = t(o);
|
|
9
|
+
return (u, d, f = o) => {
|
|
10
|
+
f !== c && (c = f, l = t(f));
|
|
11
|
+
let p = a(u, d, f);
|
|
12
|
+
if (!p) return !1;
|
|
13
|
+
let m = r(d), h = m ? e.multiply(l, i(m.cx, m.cy, m.rotation)) : l;
|
|
14
|
+
return n(p, h, s);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as paintMissesView };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=paintCull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paintCull.js","names":["paintMissesView","last","view","toScreen","viewToMat3","layerView","b","paintBounds","node","pose","r","poseRotationOf","m","mat3","rotationMatrixAbout","boundsMissRect","rect"],"sources":["../../src/canvas/paintCull.ts"],"sourcesContent":["import type { View } from 'core/viewport/view';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { poseRotationOf } from 'core/geometry/poseRotation';\nimport { boundsMissRect, type CullRect } from '../renderer/cullDrawCommands';\nimport { mat3, type GlMat3 } from '../renderer/math/mat3';\nimport { viewToMat3 } from '../renderer/math/viewToMat3';\nimport { rotationMatrixAbout } from './poseRotation';\n\n/** Where a node's paint can reach, before its pose rotation — the scene\n * slot's `paintBounds`. `null` means unknown, and the node is painted. */\nexport type PaintBoundsFn<TNode, TPose> = (node: TNode, pose: TPose, view: View) => Bounds | null;\n\n/**\n * A predicate true for the nodes whose paint cannot reach `rect` (screen\n * pixels) under `view`, by `paintBounds` taken through the pose rotation\n * `wrapNodeOutput` applies and then the view. A node `paintBounds` cannot\n * bound is never culled.\n */\nexport function paintMissesView<TNode, TPose>(\n paintBounds: PaintBoundsFn<TNode, TPose>,\n view: View,\n rect: CullRect,\n): (node: TNode, pose: TPose, layerView?: View) => boolean {\n // `layerView` is a parallax plane's own view; planes are few, so one slot\n // of memo covers a walk that meets them layer by layer.\n let last = view;\n let toScreen = viewToMat3(view);\n return (node, pose, layerView = view) => {\n if (layerView !== last) { last = layerView; toScreen = viewToMat3(layerView); }\n const b = paintBounds(node, pose, layerView);\n if (!b) return false;\n const r = poseRotationOf(pose);\n const m = r ? mat3.multiply(toScreen, rotationMatrixAbout(r.cx, r.cy, r.rotation) as GlMat3) : toScreen;\n return boundsMissRect(b, m, rect);\n };\n}\n"],"mappings":";;;;;;AAkBA,SAAgBA,EACd,GACA,GACA,GACyD;CAGzD,IAAIC,IAAOC,GACPC,IAAWC,EAAWF,CAAI;CAC9B,QAAQ,GAAM,GAAM,IAAYA,MAAS;EACvC,AAAIG,MAAcJ,MAAQ,IAAOI,GAAW,IAAWD,EAAWC,CAAS;EAC3E,IAAMC,IAAIC,EAAYC,GAAMC,GAAMJ,CAAS;EAC3C,IAAI,CAACC,GAAG,OAAO;EACf,IAAMI,IAAIC,EAAeF,CAAI,GACvBG,IAAIF,IAAIG,EAAK,SAASV,GAAUW,EAAoBJ,EAAE,IAAIA,EAAE,IAAIA,EAAE,QAAQ,CAAW,IAAIP;EAC/F,OAAOY,EAAeT,GAAGM,GAAGI,CAAI;CAClC;AACF"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { planeMap as e } from "../core/viewport/parallax.js";
|
|
2
|
+
import { composeWorldPose as t } from "../core/scene/composeFrame.js";
|
|
3
|
+
import { resolveDerivedPath as n } from "../core/scene/derivedPath.js";
|
|
4
|
+
import { definesFrame as r, effectivePose as i } from "../core/scene/effectivePose.js";
|
|
5
|
+
import { asNodeId as a } from "../core/scene/types.js";
|
|
6
|
+
import { findShapeSilhouette as o } from "./NodeShape.js";
|
|
7
|
+
import { clipCarrier as s } from "./planeClips.js";
|
|
8
|
+
//#region src/canvas/pickWalk.ts
|
|
9
|
+
var c = [];
|
|
10
|
+
function l(e, t, n) {
|
|
11
|
+
return e.kind === "container" ? typeof e.clipFromPose == "function" ? e.clipFromPose(t) : o(e, t, { derivedPath: n }) : null;
|
|
12
|
+
}
|
|
13
|
+
function u(e, t) {
|
|
14
|
+
let n = t.includeContainers ?? !0, r = t.includeLocked === !0 ? void 0 : e.isLocked, i = [], a = /* @__PURE__ */ new Map(), o = s(e.planeOf ?? null), c = (t) => {
|
|
15
|
+
let n = a.get(t.id);
|
|
16
|
+
if (n !== void 0) return n;
|
|
17
|
+
let r = l(t, e.poseOf(t), e.derivedPathOf?.(t));
|
|
18
|
+
return a.set(t.id, r), r;
|
|
19
|
+
}, u = /* @__PURE__ */ new Map(), d = (n) => {
|
|
20
|
+
if (n === void 0 || e.planeOf === void 0) return t;
|
|
21
|
+
let r = u.get(n);
|
|
22
|
+
if (r === void 0) {
|
|
23
|
+
let i = e.planeOf(n);
|
|
24
|
+
r = i === null ? t : t.inPlane?.(i) ?? null, u.set(n, r);
|
|
25
|
+
}
|
|
26
|
+
return r;
|
|
27
|
+
};
|
|
28
|
+
for (let t of e.order()) {
|
|
29
|
+
if (!n && t.kind === "container" || t.pickable === !1 || t.layer !== void 0 && e.layerIsPainted?.(t.layer) === !1 || e.alphaOf !== void 0 && e.alphaOf(t.id) <= 0 || r !== void 0 && r(t)) continue;
|
|
30
|
+
let a = d(t.layer);
|
|
31
|
+
if (a === null) continue;
|
|
32
|
+
let s = e.poseOf(t), l = e.derivedPathOf?.(t);
|
|
33
|
+
if (!a.hits(t, s, l)) continue;
|
|
34
|
+
let u = !1;
|
|
35
|
+
for (let n of e.parentsOf(t)) {
|
|
36
|
+
let e = c(n);
|
|
37
|
+
if (e !== null && !a.clipAdmits(o(e, n.layer, t.layer), t, s, l)) {
|
|
38
|
+
u = !0;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
u || i.push(t.id);
|
|
43
|
+
}
|
|
44
|
+
return i;
|
|
45
|
+
}
|
|
46
|
+
function d(e) {
|
|
47
|
+
let t = null;
|
|
48
|
+
for (let n of e.layers ?? []) n.locked === !0 && (t ??= /* @__PURE__ */ new Set()).add(n.id);
|
|
49
|
+
if (t === null) return null;
|
|
50
|
+
let n = t;
|
|
51
|
+
return (t) => {
|
|
52
|
+
let r = e.get(a(t)), i = /* @__PURE__ */ new Set();
|
|
53
|
+
for (; r !== void 0 && !i.has(r.id);) {
|
|
54
|
+
if (n.has(r.layer)) return !0;
|
|
55
|
+
i.add(r.id), r = r.parent === null ? void 0 : e.get(r.parent);
|
|
56
|
+
}
|
|
57
|
+
return !1;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function f(e) {
|
|
61
|
+
let t = /* @__PURE__ */ new Set();
|
|
62
|
+
for (let n of e ?? []) n.visible === !1 && t.add(n.id);
|
|
63
|
+
return t;
|
|
64
|
+
}
|
|
65
|
+
function p(e, o = {}) {
|
|
66
|
+
let s = f(e.layers), l = d(e), { getPose: u, alphaOf: p, layerIsPainted: h } = o, g = null, _ = typeof e.overrides?.ids == "function";
|
|
67
|
+
if (!p && _) for (let t of e.overrides.ids()) {
|
|
68
|
+
let n = e.overrides.get(t)?.alpha;
|
|
69
|
+
n !== void 0 && n <= 0 && (g ??= /* @__PURE__ */ new Set()).add(t);
|
|
70
|
+
}
|
|
71
|
+
let v = p ?? (_ ? g ? (e) => +!g.has(e) : void 0 : (t) => e.overrides.get(a(t))?.alpha ?? 1), y = o.poseComposition, b = y !== void 0 && y.closure !== "identity" ? {
|
|
72
|
+
getPose: (t) => {
|
|
73
|
+
let n = e.get(a(t));
|
|
74
|
+
return n ? i(e, n) : void 0;
|
|
75
|
+
},
|
|
76
|
+
getParent: (t) => e.get(a(t))?.parent ?? null,
|
|
77
|
+
definesFrame: (t) => {
|
|
78
|
+
let n = e.get(a(t));
|
|
79
|
+
return n === void 0 || r(n);
|
|
80
|
+
}
|
|
81
|
+
} : null, x = u ? (e) => u(e.id) : b ? (e) => t(b, e.id, y.compose) : (t) => i(e, t), S = (t) => e.childrenOf(t), C = (t) => {
|
|
82
|
+
let r = e.get(t);
|
|
83
|
+
if (r !== void 0) return {
|
|
84
|
+
node: r,
|
|
85
|
+
pose: x(r),
|
|
86
|
+
get path() {
|
|
87
|
+
return n(r, C, S);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}, w = (e) => {
|
|
91
|
+
let t = e;
|
|
92
|
+
return t.dependsOn === void 0 ? null : n(t, C, S);
|
|
93
|
+
}, T = o.camera ? m(e.layers, o.camera) : null;
|
|
94
|
+
return {
|
|
95
|
+
...T ? { planeOf: T } : {},
|
|
96
|
+
order: () => e.renderOrderNodes(),
|
|
97
|
+
derivedPathOf: w,
|
|
98
|
+
poseOf: x,
|
|
99
|
+
parentsOf(t) {
|
|
100
|
+
let n = t.parent ?? null;
|
|
101
|
+
if (n === null) return c;
|
|
102
|
+
let r = [], i = /* @__PURE__ */ new Set();
|
|
103
|
+
for (; n !== null && !i.has(n);) {
|
|
104
|
+
i.add(n);
|
|
105
|
+
let t = e.get(a(n));
|
|
106
|
+
if (!t) break;
|
|
107
|
+
r.push(t), n = t.parent ?? null;
|
|
108
|
+
}
|
|
109
|
+
return r;
|
|
110
|
+
},
|
|
111
|
+
...v ? { alphaOf: v } : {},
|
|
112
|
+
...l ? { isLocked: (e) => l(e.id) } : {},
|
|
113
|
+
...s.size > 0 || h ? { layerIsPainted: (e) => !s.has(e) && (h === void 0 || h(e)) } : {}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function m(t, n) {
|
|
117
|
+
let r = null;
|
|
118
|
+
for (let i of t ?? []) i.parallax && (r ??= /* @__PURE__ */ new Map()).set(i.id, e(n, i.parallax));
|
|
119
|
+
if (r === null) return null;
|
|
120
|
+
let i = r;
|
|
121
|
+
return (e) => i.get(e) ?? null;
|
|
122
|
+
}
|
|
123
|
+
function h(e, t = {}) {
|
|
124
|
+
let n = e, r = typeof e.getChildren == "function" && typeof e.getNode == "function", i = /* @__PURE__ */ new Map(), a = (t) => typeof e.getWorldPose == "function" ? e.getWorldPose(t) : e.getPose(t), o = (e) => ({
|
|
125
|
+
...n.getNode(e),
|
|
126
|
+
id: e,
|
|
127
|
+
pose: a(e)
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
order() {
|
|
131
|
+
if (!r) return i = /* @__PURE__ */ new Map(), e.getNodes().map((e) => ({
|
|
132
|
+
...e,
|
|
133
|
+
id: e.id,
|
|
134
|
+
pose: a(e.id)
|
|
135
|
+
}));
|
|
136
|
+
let t = [], s = /* @__PURE__ */ new Map(), c = (e, r) => {
|
|
137
|
+
for (let i of n.getChildren(e)) {
|
|
138
|
+
let e = o(i);
|
|
139
|
+
r && s.set(i, r), t.push(e), c(i, e);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return c(null, null), i = s, t;
|
|
143
|
+
},
|
|
144
|
+
...t.alphaOf ? { alphaOf: t.alphaOf } : {},
|
|
145
|
+
...t.layerIsPainted ? { layerIsPainted: t.layerIsPainted } : {},
|
|
146
|
+
...t.planeOf ? { planeOf: t.planeOf } : {},
|
|
147
|
+
poseOf: (e) => a(e.id),
|
|
148
|
+
parentsOf(e) {
|
|
149
|
+
let t = [], n = i.get(e.id), r = /* @__PURE__ */ new Set();
|
|
150
|
+
for (; n && !r.has(n.id);) r.add(n.id), t.push(n), n = i.get(n.id);
|
|
151
|
+
return t;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { h as adapterPickSource, f as hiddenLayerIds, l as ownClipOf, u as pickWalk, p as scenePickSource, m as scenePlaneOf };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=pickWalk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickWalk.js","names":["EMPTY_PARENTS","ownClipOf","node","pose","findShapeSilhouette","derived","pickWalk","includeContainers","q","isLocked","src","out","clipPath","carry","clipCarrier","clipOf","cached","ancestor","resolved","planeQueries","queryFor","layer","found","map","query","clipped","clip","lockedNodeTest","locked","scene","lockedLayers","cur","asNodeId","id","seen","hiddenLayerIds","layers","scenePickSource","hidden","opts","faded","enumerable","alphaOf","a","readAlpha","composition","chain","effectivePose","definesFrame","poseOf","getPose","composeWorldPose","childrenOf","depOf","dep","resolveDerivedPath","derivedPathOf","n","planeOf","scenePlaneOf","parentId","parent","layerIsPainted","maps","l","planeMap","camera","adapterPickSource","hier","adapter","hierarchical","parents","worldPose","nodeOf","next","visit","childId","gates"],"sources":["../../src/canvas/pickWalk.ts"],"sourcesContent":["/**\n * The one hit-test walk.\n *\n * Four walks used to answer this question — two point queries, two area\n * queries — over the same tree with the same gates. They drifted three times\n * without a failing test, because nothing held them to each other. Everything\n * that decides whether a node *can* be hit lives here now; a query supplies\n * only the shape test and the clip predicate for its own region.\n *\n * The gates, in the order the walk applies them:\n * 1. containers, when the query does not want them\n * 2. the layer is painted at all — scene visibility, and the asking view's\n * `layerVisibility` / `layerOrder`\n * 3. painted alpha is above zero\n * 4. the node is not locked, unless the query asks for locked nodes\n * 5. the query's own shape test\n * 6. every ancestor clip admits the query region\n *\n * 2, 3 and 6 are all \"the renderer did not put this on screen\". A pick path\n * that skips one answers for a node the user cannot see. 4 is the other axis:\n * a locked node is on screen and still out of reach.\n */\n\nimport type { Path } from '@weasel-js/geom';\nimport { findShapeSilhouette } from 'canvas/NodeShape';\nimport type { DerivedDep, Node, NodeId, Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport { definesFrame, effectivePose } from 'core/scene/effectivePose';\nimport { resolveDerivedPath } from './derivedPath';\nimport { composeWorldPose, type PoseAdapter, type PoseComposition } from 'features/groups/composePose';\nimport { planeMap, type ParallaxOpts, type PlaneMap } from 'core/viewport/parallax';\nimport type { View } from 'core/viewport/view';\nimport { clipCarrier } from './planeClips';\n\n/** Shared, never mutated: most scenes are flat and every node returns it. */\nconst EMPTY_PARENTS: readonly never[] = [];\n\n/** The subset of a node the walk itself reads. Deliberately structural: a\n * bare adapter's node satisfies it as readily as a `SceneNode`. */\nexport interface PickCandidate<TPose> {\n id: string;\n kind?: string;\n layer?: string;\n pose: TPose;\n /** `false` makes the node transparent to the walk — see `SceneNode.pickable`. */\n pickable?: boolean;\n clipFromPose?: (pose: TPose) => Path | null;\n}\n\n/**\n * Everything the walk reads that a **view** owns.\n *\n * A layer must not hold state a view owns, so none of these are closed over\n * at construction — each is asked per walk, of the view being dispatched to.\n */\nexport interface PickSource<TPose> {\n /** Candidates in paint order, back-to-front. Containers included; the\n * query decides whether they can be hit. */\n order(): readonly PickCandidate<TPose>[];\n /** The pose the renderer draws — override-aware. Not `node.pose`, which is\n * how the render and pick paths came to disagree about where a node is. */\n poseOf(node: PickCandidate<TPose>): TPose;\n /** Ancestors, innermost first. Only walked for candidates that already\n * passed their own shape test. */\n parentsOf(node: PickCandidate<TPose>): readonly PickCandidate<TPose>[];\n /** Painted alpha for the asking view: the view's `alphaFor` times any\n * per-node override alpha. Omit when the source has no alpha concept. */\n alphaOf?(id: string): number;\n /** Whether this layer reaches the screen in the asking view. Omit for a\n * source with no layers. */\n layerIsPainted?(layer: string): boolean;\n /** Whether the node is locked — painted, but not something a pointer can\n * take. Omit for a source with no lock concept. */\n isLocked?(node: PickCandidate<TPose>): boolean;\n /** The path a node computes from its dependencies' poses, or null when it\n * derives nothing. Only a scene-backed source can answer — deriving needs\n * the dependencies' poses — so a bare adapter omits it, and every derived\n * node there keeps answering from its own (placeholder) pose. */\n derivedPathOf?(node: PickCandidate<TPose>): Path | null;\n /** How the asking view's world maps into a parallax layer's, or null for a\n * layer that moves with the camera. Omit for a source with no planes. */\n planeOf?(layer: string): PlaneMap | null;\n}\n\n/** One hit-test question: what region, and what counts as covering it. */\nexport interface PickQuery<TPose> {\n /** Default `true`. The area walks exclude containers so a marquee does not\n * return a container and its children both. */\n includeContainers?: boolean;\n /** Default `false`. Every selecting or editing query passes over locked\n * nodes; one that only samples what is painted can take them back. */\n includeLocked?: boolean;\n /** Does this node, drawn at this pose, cover the query region? `derived`\n * is the node's resolved path when it has one — a derived node's pose is a\n * placeholder, so a region test that reads only the pose answers for the\n * wrong box. */\n hits(node: PickCandidate<TPose>, pose: TPose, derived?: Path | null): boolean;\n /**\n * Does an ancestor's clip leave anything of `node` for this query to hit?\n *\n * A point query asks point-in-clip and ignores the node. An area query has\n * to ask about the node as well: the clip and the area can overlap where\n * the node is not, and the node and the clip can overlap where the area is\n * not, and only the two terms together reject both.\n */\n clipAdmits(\n clip: Path,\n node: PickCandidate<TPose>,\n pose: TPose,\n derived?: Path | null,\n ): boolean;\n /** The same question asked in a parallax plane's world: the region carried\n * through `map`, and any screen-pixel slop re-derived at the plane's scale.\n * A query without it cannot reach nodes on a plane — it would test them\n * where their poses sit rather than where they are painted. */\n inPlane?(map: PlaneMap): PickQuery<TPose>;\n}\n\n/** The clip a container imposes on its subtree, or null when it imposes none. */\nexport function ownClipOf<TPose>(\n node: PickCandidate<TPose>,\n pose: TPose,\n derived?: Path | null,\n): Path | null {\n if (node.kind !== 'container') return null;\n if (typeof node.clipFromPose === 'function') return node.clipFromPose(pose);\n return findShapeSilhouette(\n node as unknown as Node<unknown, string, TPose>,\n pose,\n { derivedPath: derived },\n );\n}\n\n/**\n * Collect every candidate the query hits, back-to-front — the last element is\n * the topmost, which is the order `pickTopMostHit` expects.\n */\nexport function pickWalk<TPose>(\n src: PickSource<TPose>,\n q: PickQuery<TPose>,\n): string[] {\n const includeContainers = q.includeContainers ?? true;\n const isLocked = q.includeLocked === true ? undefined : src.isLocked;\n const out: string[] = [];\n\n // Resolving a container's clip means `clipFromPose` or a silhouette build,\n // which is the expensive half; the predicate against it is cheap. So the\n // *path* is memoized per container for the walk and the predicate re-runs\n // per candidate — `clipAdmits` needs the candidate, and caching its answer\n // per container would answer the wrong question for an area query.\n const clipPath = new Map<string, Path | null>();\n // A clip is in its container's plane; the query is in the candidate's.\n const carry = clipCarrier(src.planeOf ?? null);\n\n const clipOf = (ancestor: PickCandidate<TPose>): Path | null => {\n const cached = clipPath.get(ancestor.id);\n if (cached !== undefined) return cached;\n const resolved = ownClipOf(\n ancestor, src.poseOf(ancestor), src.derivedPathOf?.(ancestor),\n );\n clipPath.set(ancestor.id, resolved);\n return resolved;\n };\n\n // One reprojected query per plane per walk; `null` marks a plane this\n // query cannot reach.\n const planeQueries = new Map<string, PickQuery<TPose> | null>();\n const queryFor = (layer: string | undefined): PickQuery<TPose> | null => {\n if (layer === undefined || src.planeOf === undefined) return q;\n let found = planeQueries.get(layer);\n if (found === undefined) {\n const map = src.planeOf(layer);\n found = map === null ? q : (q.inPlane?.(map) ?? null);\n planeQueries.set(layer, found);\n }\n return found;\n };\n\n for (const node of src.order()) {\n if (!includeContainers && node.kind === 'container') continue;\n // Transparent to picking: the click belongs to whatever is behind it,\n // which for a label inside a box is the box.\n if (node.pickable === false) continue;\n if (node.layer !== undefined && src.layerIsPainted?.(node.layer) === false) continue;\n if (src.alphaOf !== undefined && src.alphaOf(node.id) <= 0) continue;\n if (isLocked !== undefined && isLocked(node)) continue;\n\n const query = queryFor(node.layer);\n if (query === null) continue;\n const pose = src.poseOf(node);\n const derived = src.derivedPathOf?.(node);\n if (!query.hits(node, pose, derived)) continue;\n\n let clipped = false;\n for (const ancestor of src.parentsOf(node)) {\n const clip = clipOf(ancestor);\n if (clip === null) continue;\n if (!query.clipAdmits(carry(clip, ancestor.layer, node.layer), node, pose, derived)) {\n clipped = true;\n break;\n }\n }\n if (clipped) continue;\n\n out.push(node.id);\n }\n\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Sources\n// ---------------------------------------------------------------------------\n\n/** Answers `Scene.isLocked` from the layer records and parent links alone,\n * so a partial scene stand-in works too. Null when nothing is locked, which\n * is what keeps the gate off the walk in the common case. */\nfunction lockedNodeTest(\n scene: Pick<Scene<unknown, string, unknown>, 'layers' | 'get'>,\n): ((id: string) => boolean) | null {\n let locked: Set<string> | null = null;\n for (const layer of scene.layers ?? []) {\n if (layer.locked === true) (locked ??= new Set()).add(layer.id);\n }\n if (locked === null) return null;\n const lockedLayers = locked;\n return (id) => {\n let cur = scene.get(asNodeId(id));\n const seen = new Set<string>();\n while (cur !== undefined && !seen.has(cur.id)) {\n if (lockedLayers.has(cur.layer)) return true;\n seen.add(cur.id);\n cur = cur.parent === null ? undefined : scene.get(cur.parent);\n }\n return false;\n };\n}\n\n/** Layer ids the scene reports as hidden. Only an explicit `false` hides a\n * layer: a partial scene stand-in that omits the flag stays pickable. */\nexport function hiddenLayerIds(\n layers: readonly { id: string; visible?: boolean }[] | undefined,\n): Set<string> {\n const out = new Set<string>();\n for (const layer of layers ?? []) {\n if (layer.visible === false) out.add(layer.id);\n }\n return out;\n}\n\n/**\n * The two answers a pick needs from the view it is asked for rather than from\n * the data behind it: how that view paints a node, and whether it paints a\n * layer at all. A scene and a bare adapter take the same pair.\n */\nexport interface ViewPickGates {\n /** Painted alpha: the view's `alphaFor` times any per-node override alpha.\n * A node painted at alpha 0 cannot be hit. */\n alphaOf?: (id: string) => number;\n /** Whether a node's `layer` reaches the screen in the asking view. */\n layerIsPainted?: (layer: string) => boolean;\n}\n\n/** The gates a bare adapter takes from its view, plus how that view's camera\n * maps into each parallax layer — see `scenePlaneOf`. */\nexport interface AdapterPickGates extends ViewPickGates {\n planeOf?: (layer: string) => PlaneMap | null;\n}\n\nexport interface ScenePickSourceOptions<TPose> extends ViewPickGates {\n /** Pose lookup, when the caller holds an adapter that already resolves\n * overrides. Defaults to `effectivePose` against the scene's own. */\n getPose?: (id: string) => TPose;\n /** The asking view's composed alpha — `alphaFor(id)` times override alpha.\n * Defaults to the override alpha alone, which is all a bare scene knows. */\n alphaOf?: (id: string) => number;\n /** The asking view's answer to \"does this scene layer reach the screen\",\n * which is `layerVisibility` and `layerOrder` on top of the scene's own\n * `visible` flag. Consulted after the scene's flag, never instead of it. */\n layerIsPainted?: (layer: string) => boolean;\n /** How a child's stored pose folds into its parent's frame. Needed because\n * picking tests where a node is drawn, and under a composing strategy that\n * is not where its own pose says. Ignored when `getPose` already answers in\n * world coordinates. */\n poseComposition?: PoseComposition<TPose>;\n /** The asking view's camera. With it, a layer carrying `parallax` is picked\n * through its plane; without it, every layer is taken to move with the\n * camera. */\n camera?: View;\n}\n\nexport function scenePickSource<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n opts: ScenePickSourceOptions<TPose> = {},\n): PickSource<TPose> {\n const hidden = hiddenLayerIds(scene.layers);\n const locked = lockedNodeTest(scene as never);\n const { getPose, alphaOf, layerIsPainted } = opts;\n\n // Resolved once per walk rather than once per candidate: a scene with\n // nothing faded has nothing to say about alpha, and asking it per node is a\n // Map lookup on a linear scan that has no other reason to touch the\n // override table. Needs enumeration — a partial scene stand-in carrying\n // only `get` falls back to reading per node.\n let faded: Set<string> | null = null;\n const enumerable = typeof scene.overrides?.ids === 'function';\n if (!alphaOf && enumerable) {\n for (const id of scene.overrides.ids()) {\n const a = scene.overrides.get(id)?.alpha;\n if (a !== undefined && a <= 0) (faded ??= new Set()).add(id);\n }\n }\n const readAlpha = alphaOf\n ?? (enumerable\n ? (faded ? (id: string) => (faded.has(id) ? 0 : 1) : undefined)\n : (id: string) => scene.overrides.get(asNodeId(id))?.alpha ?? 1);\n\n // A composing strategy makes a node's own pose local, so picking has to fold\n // the parent chain the same way the render walk does or it tests where the\n // node is stored rather than where it is drawn.\n const composition = opts.poseComposition;\n const chain: PoseAdapter<TPose> | null =\n composition !== undefined && composition.closure !== 'identity'\n ? {\n getPose: (id: string) => {\n const n = scene.get(asNodeId(id));\n return n ? effectivePose(scene, n) : (undefined as unknown as TPose);\n },\n getParent: (id: string) => scene.get(asNodeId(id))?.parent ?? null,\n definesFrame: (id: string) => {\n const n = scene.get(asNodeId(id));\n return n === undefined || definesFrame(n);\n },\n }\n : null;\n\n const poseOf = getPose\n ? (node: PickCandidate<TPose>) => getPose(node.id)\n : chain\n ? (node: PickCandidate<TPose>) => composeWorldPose(chain, node.id, composition!.compose)\n : (node: PickCandidate<TPose>) => effectivePose(scene, node as never);\n\n // Through `poseOf`, not the document pose: a derived node has to be tested\n // where the renderer draws its dependencies, which is what an override says.\n const childrenOf = (id: NodeId): readonly NodeId[] => scene.childrenOf(id);\n const depOf = (id: NodeId): DerivedDep<TPose> | undefined => {\n const dep = scene.get(id);\n if (dep === undefined) return undefined;\n return {\n node: dep as Node<unknown, string, TPose>,\n pose: poseOf(dep as never),\n get path(): Path | null {\n return resolveDerivedPath(dep as never, depOf, childrenOf);\n },\n };\n };\n\n const derivedPathOf = (node: PickCandidate<TPose>): Path | null => {\n const n = node as unknown as Node<TData, TLayer, TPose>;\n if (n.dependsOn === undefined) return null;\n return resolveDerivedPath(n, depOf, childrenOf);\n };\n\n const planeOf = opts.camera ? scenePlaneOf(scene.layers, opts.camera) : null;\n\n return {\n ...(planeOf ? { planeOf } : {}),\n order: () => scene.renderOrderNodes() as unknown as readonly PickCandidate<TPose>[],\n derivedPathOf,\n poseOf,\n parentsOf(node) {\n let parentId = (node as { parent?: string | null }).parent ?? null;\n if (parentId === null) return EMPTY_PARENTS;\n const chain: PickCandidate<TPose>[] = [];\n const seen = new Set<string>();\n while (parentId !== null) {\n if (seen.has(parentId)) break;\n seen.add(parentId);\n const parent = scene.get(asNodeId(parentId));\n if (!parent) break;\n chain.push(parent as unknown as PickCandidate<TPose>);\n parentId = parent.parent ?? null;\n }\n return chain;\n },\n // Absent entirely when nothing is faded, so the walk skips the gate.\n ...(readAlpha ? { alphaOf: readAlpha } : {}),\n ...(locked ? { isLocked: (node: PickCandidate<TPose>) => locked(node.id) } : {}),\n ...(hidden.size > 0 || layerIsPainted\n ? {\n layerIsPainted: (layer: string) =>\n !hidden.has(layer) && (layerIsPainted === undefined || layerIsPainted(layer)),\n }\n : {}),\n };\n}\n\n/** Each parallax layer's plane map under `camera`, or null when no layer is a\n * plane — which keeps the per-layer lookup off the walk entirely. */\nexport function scenePlaneOf(\n layers: readonly { id: string; parallax?: ParallaxOpts }[] | undefined,\n camera: View,\n): ((layer: string) => PlaneMap | null) | null {\n let maps: Map<string, PlaneMap> | null = null;\n for (const l of layers ?? []) {\n if (l.parallax) (maps ??= new Map()).set(l.id, planeMap(camera, l.parallax));\n }\n if (maps === null) return null;\n const found = maps;\n return (layer) => found.get(layer) ?? null;\n}\n\n/** The adapter surface the walk can reach without a `Scene`. */\ninterface PickAdapter<TPose> {\n /** Composed world pose, when the adapter has a composition strategy.\n * Falls back to `getPose`, which is the same value under the\n * absolute-pose model. */\n getWorldPose?(id: string): TPose;\n getNodes(): readonly { id: string }[];\n getPose(id: string): TPose;\n getNode?: (id: string) => unknown;\n getChildren?: (parentId: string | null) => readonly string[];\n}\n\n/**\n * A source over a bare `SelectAdapter`, for consumers with no `Scene`.\n *\n * A hierarchical adapter is walked depth-first, parents before children —\n * the same back-to-front order `renderOrderNodes` produces for a single\n * layer. A flat adapter falls back to `getNodes()`, which carries no\n * parentage, so nothing clips.\n *\n * `gates` come from whichever view is picking, never from the adapter.\n */\nexport function adapterPickSource<TPose>(\n adapter: PickAdapter<TPose>,\n gates: AdapterPickGates = {},\n): PickSource<TPose> {\n const hier = adapter as Required<Pick<PickAdapter<TPose>, 'getNode' | 'getChildren'>>;\n const hierarchical =\n typeof adapter.getChildren === 'function' && typeof adapter.getNode === 'function';\n\n // Rebuilt per walk: the tree may have changed between queries, and a walk\n // is the only thing that reads it.\n let parents = new Map<string, PickCandidate<TPose>>();\n\n // The adapter composes if it has a strategy; `getPose` alone is the node's\n // own pose, which is not where a framed child is drawn.\n const worldPose = (id: string): TPose =>\n (typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id));\n\n const nodeOf = (id: string): PickCandidate<TPose> => {\n const raw = hier.getNode(id) as Partial<PickCandidate<TPose>>;\n return { ...raw, id, pose: worldPose(id) } as PickCandidate<TPose>;\n };\n\n return {\n order() {\n if (!hierarchical) {\n parents = new Map();\n return adapter.getNodes().map((n) => ({\n ...(n as object), id: n.id, pose: worldPose(n.id),\n })) as PickCandidate<TPose>[];\n }\n const out: PickCandidate<TPose>[] = [];\n const next = new Map<string, PickCandidate<TPose>>();\n const visit = (parentId: string | null, parent: PickCandidate<TPose> | null): void => {\n for (const childId of hier.getChildren(parentId)) {\n const node = nodeOf(childId);\n if (parent) next.set(childId, parent);\n out.push(node);\n visit(childId, node);\n }\n };\n visit(null, null);\n parents = next;\n return out;\n },\n ...(gates.alphaOf ? { alphaOf: gates.alphaOf } : {}),\n ...(gates.layerIsPainted ? { layerIsPainted: gates.layerIsPainted } : {}),\n ...(gates.planeOf ? { planeOf: gates.planeOf } : {}),\n poseOf: (node) => worldPose(node.id),\n parentsOf(node) {\n const chain: PickCandidate<TPose>[] = [];\n let cur = parents.get(node.id);\n const seen = new Set<string>();\n while (cur && !seen.has(cur.id)) {\n seen.add(cur.id);\n chain.push(cur);\n cur = parents.get(cur.id);\n }\n return chain;\n },\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { mat3 as e } from "../renderer/math/mat3.js";
|
|
2
|
+
import { planeMatrix as t, planeToPlane as n } from "../core/viewport/parallax.js";
|
|
3
|
+
import { transformPath as r } from "@weasel-js/geom";
|
|
4
|
+
//#region src/canvas/planeClips.ts
|
|
5
|
+
function i(e) {
|
|
6
|
+
if (e === null) return (e) => e;
|
|
7
|
+
let i = (t) => t === void 0 ? null : e(t), a = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
return (e, o, s) => {
|
|
9
|
+
let c = i(s), l = n(i(o), c);
|
|
10
|
+
if (l === null) return e;
|
|
11
|
+
let u = a.get(e);
|
|
12
|
+
u === void 0 && a.set(e, u = /* @__PURE__ */ new Map());
|
|
13
|
+
let d = u.get(c);
|
|
14
|
+
return d === void 0 && u.set(c, d = r(e, t(l))), d;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function a(r, i) {
|
|
18
|
+
let a = n(r, i);
|
|
19
|
+
return a === null ? void 0 : e.fromAffine(t(a));
|
|
20
|
+
}
|
|
21
|
+
function o(e, i) {
|
|
22
|
+
let a = e;
|
|
23
|
+
if (i === null || !a || a.kind !== "polygon" && a.kind !== "rect") return e;
|
|
24
|
+
let o = n(i, null);
|
|
25
|
+
return o === null ? e : r(e, t(o));
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { i as clipCarrier, o as pathFromPlane, a as planeTransform };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=planeClips.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planeClips.js","names":["clipCarrier","planeOf","clip","mapOf","layer","cache","to","toLayer","m","planeToPlane","fromLayer","byTarget","out","transformPath","planeMatrix","planeTransform","from","mat3","pathFromPlane","p","path","back"],"sources":["../../src/canvas/planeClips.ts"],"sourcesContent":["import { type Path, transformPath } from '@weasel-js/geom';\nimport { planeMatrix, planeToPlane, type PlaneMap } from 'core/viewport/parallax';\nimport { mat3, type GlMat3 } from '../renderer/math/mat3';\n\n/**\n * Carries a container's clip into the world a descendant is drawn or picked\n * in. A clip is built from the container's pose, so it is in the container's\n * plane; a child on another plane reads it in its own. Null `planeOf` means no\n * layer is a plane, and every clip passes through untouched.\n *\n * Memoized per clip path and target plane, so a container with many children\n * on one other plane maps its clip once.\n */\nexport function clipCarrier(\n planeOf: ((layer: string) => PlaneMap | null) | null,\n): (clip: Path, fromLayer: string | undefined, toLayer: string | undefined) => Path {\n if (planeOf === null) return (clip) => clip;\n const mapOf = (layer: string | undefined) => (layer === undefined ? null : planeOf(layer));\n const cache = new WeakMap<Path, Map<PlaneMap | null, Path>>();\n return (clip, fromLayer, toLayer) => {\n const to = mapOf(toLayer);\n const m = planeToPlane(mapOf(fromLayer), to);\n if (m === null) return clip;\n let byTarget = cache.get(clip);\n if (byTarget === undefined) cache.set(clip, byTarget = new Map());\n let out = byTarget.get(to);\n if (out === undefined) byTarget.set(to, out = transformPath(clip, planeMatrix(m)));\n return out;\n };\n}\n\n/** The group transform that draws `from`'s world inside `to`'s, where `null`\n * is the camera's. Undefined when they are the same world. */\nexport function planeTransform(from: PlaneMap | null, to: PlaneMap | null): GlMat3 | undefined {\n const m = planeToPlane(from, to);\n return m === null ? undefined : mat3.fromAffine(planeMatrix(m));\n}\n\n/** A path in a plane's world, in the camera's. Anything that is not a path\n * passes through. */\nexport function pathFromPlane<T>(path: T, m: PlaneMap | null): T {\n const p = path as { kind?: string } | null;\n if (m === null || !p || (p.kind !== 'polygon' && p.kind !== 'rect')) return path;\n const back = planeToPlane(m, null);\n return back === null ? path : transformPath(path as unknown as Path, planeMatrix(back)) as unknown as T;\n}\n"],"mappings":";;;;AAaA,SAAgBA,EACd,GACkF;CAClF,IAAIC,MAAY,MAAM,QAAQ,MAASC;CACvC,IAAMC,KAAS,MAA+BC,MAAU,KAAA,IAAY,OAAOH,EAAQG,CAAK,GAClFC,oBAAQ,IAAI,QAA0C;CAC5D,QAAQ,GAAM,GAAW,MAAY;EACnC,IAAMC,IAAKH,EAAMI,CAAO,GAClBC,IAAIC,EAAaN,EAAMO,CAAS,GAAGJ,CAAE;EAC3C,IAAIE,MAAM,MAAM,OAAON;EACvB,IAAIS,IAAWN,EAAM,IAAIH,CAAI;EAC7B,AAAIS,MAAa,KAAA,KAAWN,EAAM,IAAIH,GAAM,oBAAW,IAAI,IAAI,CAAC;EAChE,IAAIU,IAAMD,EAAS,IAAIL,CAAE;EAEzB,OADIM,MAAQ,KAAA,KAAWD,EAAS,IAAIL,GAAI,IAAMO,EAAcX,GAAMY,EAAYN,CAAC,CAAC,CAAC,GAC1EI;CACT;AACF;AAIA,SAAgBG,EAAe,GAAuB,GAAyC;CAC7F,IAAMP,IAAIC,EAAaO,GAAMV,CAAE;CAC/B,OAAOE,MAAM,OAAO,KAAA,IAAYS,EAAK,WAAWH,EAAYN,CAAC,CAAC;AAChE;AAIA,SAAgBU,EAAiB,GAAS,GAAuB;CAC/D,IAAMC,IAAIC;CACV,IAAIZ,MAAM,QAAQ,CAACW,KAAMA,EAAE,SAAS,aAAaA,EAAE,SAAS,QAAS,OAAOC;CAC5E,IAAMC,IAAOZ,EAAaD,GAAG,IAAI;CACjC,OAAOa,MAAS,OAAOD,IAAOP,EAAcO,GAAyBN,EAAYO,CAAI,CAAC;AACxF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { poseRotationOf as e } from "../core/geometry/poseRotation.js";
|
|
2
|
+
import { rotateAboutPoint as t } from "@weasel-js/geom";
|
|
3
|
+
//#region src/canvas/poseRotation.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
return new Float32Array([
|
|
6
|
+
e[0],
|
|
7
|
+
e[1],
|
|
8
|
+
0,
|
|
9
|
+
e[2],
|
|
10
|
+
e[3],
|
|
11
|
+
0,
|
|
12
|
+
e[4],
|
|
13
|
+
e[5],
|
|
14
|
+
1
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
function r(e, r, i) {
|
|
18
|
+
return n(t(e, r, i));
|
|
19
|
+
}
|
|
20
|
+
function i(e, t, n, i, a) {
|
|
21
|
+
return r(e + n / 2, t + i / 2, a);
|
|
22
|
+
}
|
|
23
|
+
function a(t, n) {
|
|
24
|
+
if (t.length === 0) return t;
|
|
25
|
+
let i = e(n);
|
|
26
|
+
return i ? [{
|
|
27
|
+
kind: "group",
|
|
28
|
+
transform: r(i.cx, i.cy, i.rotation),
|
|
29
|
+
children: t
|
|
30
|
+
}] : t;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { i as rotateAroundAABBCenter, r as rotationMatrixAbout, a as wrapWithPoseRotation };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=poseRotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poseRotation.js","names":["mat3ToRenderMatrix","m","rotationMatrixAbout","rotateAboutPoint","cx","cy","rotation","rotateAroundAABBCenter","x","width","y","height","wrapWithPoseRotation","cmds","r","poseRotationOf","pose"],"sources":["../../src/canvas/poseRotation.ts"],"sourcesContent":["/**\n * Pose rotation helpers — extracted from `SceneCanvas` so the kit can apply\n * the auto-rotation wrap around EVERY per-node `drawOne` (consumer-supplied\n * or default), not only around the default painter's output.\n *\n * Without this, consumers who supply a custom `drawOne` get no rotation\n * visualization even though selection chrome (which reads `pose.rotation`\n * directly) does rotate — the rect sits still while its chrome spins.\n *\n * `wrapWithPoseRotation` is applied by `wrapNodeOutput` in both scene walks —\n * `buildSceneLayer` (main canvas) and `buildSceneViewCommands` (detached\n * renders) — and directly by `usePreviewGhostLayer.buildSubtree` (in-flight\n * preview), so every code path produces rotated geometry uniformly.\n */\nimport type { DrawCommand } from '../renderer';\nimport { poseRotationOf } from 'core/geometry/poseRotation';\nimport { rotateAboutPoint, type Mat3 } from '@weasel-js/geom';\n\n/** Expand a kernel 6-tuple affine `[a, b, c, d, e, f]` (DOMMatrix order) into\n * the 9-element column-major `[a, b, 0, c, d, 0, tx, ty, 1]` `Float32Array`\n * the `kind: 'group'` DrawCommand wrap consumes for `uniformMatrix3fv`. Pure\n * shape glue — the rotate-about-point MATH lives in the kernel. */\nfunction mat3ToRenderMatrix(m: Mat3): Float32Array {\n return new Float32Array([m[0], m[1], 0, m[2], m[3], 0, m[4], m[5], 1]);\n}\n\n/** Rotation by `rotation` about `(cx, cy)` as the render-tree's column-major\n * 3×3 affine. Composes on the kernel's `rotateAboutPoint` (single owner of the\n * rotate-about-point math); this only reshapes 6→9 for the WebGL upload. */\nexport function rotationMatrixAbout(cx: number, cy: number, rotation: number): Float32Array {\n return mat3ToRenderMatrix(rotateAboutPoint(cx, cy, rotation));\n}\n\n/** Rotation matrix about the AABB center of `(x, y, width, height)`. The pivot\n * matches `poseRotationOf` (the shared rotation convention). */\nexport function rotateAroundAABBCenter(\n x: number, y: number, width: number, height: number, rotation: number,\n): Float32Array {\n return rotationMatrixAbout(x + width / 2, y + height / 2, rotation);\n}\n\n/** Wrap a per-node draw-command list in a rotation group when the pose\n * carries a non-zero `rotation` and AABB fields (`x`, `y`, `width`,\n * `height`). The wrap rotates the emitted geometry around the AABB\n * center, matching the rotation-handle math and `pathInWorld` so chrome\n * + geometry stay aligned.\n *\n * No-ops when `cmds` is empty, when `pose.rotation` is missing/zero, or\n * when any of the AABB fields are missing (the wrap requires a center\n * to rotate about). Painters / consumers that need different rotation\n * semantics (e.g. pivot at origin) should still wrap themselves. */\nexport function wrapWithPoseRotation(\n cmds: DrawCommand[],\n pose: unknown,\n): DrawCommand[] {\n if (cmds.length === 0) return cmds;\n const r = poseRotationOf(pose);\n if (!r) return cmds;\n return [{\n kind: 'group',\n transform: rotationMatrixAbout(r.cx, r.cy, r.rotation),\n children: cmds,\n }];\n}\n"],"mappings":";;;AAsBA,SAASA,EAAmB,GAAuB;CACjD,OAAO,IAAI,aAAa;EAACC,EAAE;EAAIA,EAAE;EAAI;EAAGA,EAAE;EAAIA,EAAE;EAAI;EAAGA,EAAE;EAAIA,EAAE;EAAI;CAAC,CAAC;AACvE;AAKA,SAAgBC,EAAoB,GAAY,GAAY,GAAgC;CAC1F,OAAOF,EAAmBG,EAAiBC,GAAIC,GAAIC,CAAQ,CAAC;AAC9D;AAIA,SAAgBC,EACd,GAAW,GAAW,GAAe,GAAgB,GACvC;CACd,OAAOL,EAAoBM,IAAIC,IAAQ,GAAGC,IAAIC,IAAS,GAAGL,CAAQ;AACpE;AAYA,SAAgBM,EACd,GACA,GACe;CACf,IAAIC,EAAK,WAAW,GAAG,OAAOA;CAC9B,IAAMC,IAAIC,EAAeC,CAAI;CAE7B,OADKF,IACE,CAAC;EACN,MAAM;EACN,WAAWZ,EAAoBY,EAAE,IAAIA,EAAE,IAAIA,EAAE,QAAQ;EACrD,UAAUD;CACZ,CAAC,IALcA;AAMjB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/canvas/rasterToPng.ts
|
|
2
|
+
async function e(e) {
|
|
3
|
+
let t = new ImageData(new Uint8ClampedArray(e.data), e.width, e.height);
|
|
4
|
+
if (typeof OffscreenCanvas < "u") {
|
|
5
|
+
let n = new OffscreenCanvas(e.width, e.height), r = n.getContext("2d");
|
|
6
|
+
if (!r) throw Error("rasterToPng: no 2D context");
|
|
7
|
+
return r.putImageData(t, 0, 0), n.convertToBlob({ type: "image/png" });
|
|
8
|
+
}
|
|
9
|
+
if (typeof document > "u") throw Error("rasterToPng: no canvas in this environment");
|
|
10
|
+
let n = document.createElement("canvas");
|
|
11
|
+
n.width = e.width, n.height = e.height;
|
|
12
|
+
let r = n.getContext("2d");
|
|
13
|
+
if (!r) throw Error("rasterToPng: no 2D context");
|
|
14
|
+
return r.putImageData(t, 0, 0), new Promise((e, t) => {
|
|
15
|
+
n.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("rasterToPng: encoding failed")), "image/png");
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { e as rasterToPng };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=rasterToPng.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rasterToPng.js","names":["rasterToPng","pixels","image","canvas","ctx","b","resolve","reject"],"sources":["../../src/canvas/rasterToPng.ts"],"sourcesContent":["import type { RasterImage } from './renderSceneToPixels';\n\n/** Encode a raster as a PNG `Blob` — for download, upload, or the clipboard.\n * Needs a 2D canvas: `OffscreenCanvas` where there is one, else the DOM's. */\nexport async function rasterToPng(image: RasterImage): Promise<Blob> {\n const pixels = new ImageData(new Uint8ClampedArray(image.data), image.width, image.height);\n if (typeof OffscreenCanvas !== 'undefined') {\n const canvas = new OffscreenCanvas(image.width, image.height);\n const ctx = canvas.getContext('2d');\n if (!ctx) throw new Error('rasterToPng: no 2D context');\n ctx.putImageData(pixels, 0, 0);\n return canvas.convertToBlob({ type: 'image/png' });\n }\n if (typeof document === 'undefined') throw new Error('rasterToPng: no canvas in this environment');\n const canvas = document.createElement('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n const ctx = canvas.getContext('2d');\n if (!ctx) throw new Error('rasterToPng: no 2D context');\n ctx.putImageData(pixels, 0, 0);\n return new Promise((resolve, reject) => {\n canvas.toBlob((b) => (b ? resolve(b) : reject(new Error('rasterToPng: encoding failed'))), 'image/png');\n });\n}\n"],"mappings":";AAIA,eAAsBA,EAAY,GAAmC;CACnE,IAAMC,IAAS,IAAI,UAAU,IAAI,kBAAkBC,EAAM,IAAI,GAAGA,EAAM,OAAOA,EAAM,MAAM;CACzF,IAAI,OAAO,kBAAoB,KAAa;EAC1C,IAAMC,IAAS,IAAI,gBAAgBD,EAAM,OAAOA,EAAM,MAAM,GACtDE,IAAMD,EAAO,WAAW,IAAI;EAClC,IAAI,CAACC,GAAK,MAAU,MAAM,4BAA4B;EAEtD,OADAA,EAAI,aAAaH,GAAQ,GAAG,CAAC,GACtBE,EAAO,cAAc,EAAE,MAAM,YAAY,CAAC;CACnD;CACA,IAAI,OAAO,WAAa,KAAa,MAAU,MAAM,4CAA4C;CACjG,IAAMA,IAAS,SAAS,cAAc,QAAQ;CAE9C,AADA,EAAO,QAAQD,EAAM,OACrB,EAAO,SAASA,EAAM;CACtB,IAAME,IAAMD,EAAO,WAAW,IAAI;CAClC,IAAI,CAACC,GAAK,MAAU,MAAM,4BAA4B;CAEtD,OADAA,EAAI,aAAaH,GAAQ,GAAG,CAAC,GACtB,IAAI,SAAS,GAAS,MAAW;EACtC,EAAO,QAAQ,MAAOI,IAAIC,EAAQD,CAAC,IAAIE,EAAO,gBAAI,MAAM,8BAA8B,CAAC,GAAI,WAAW;CACxG,CAAC;AACH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mat3 as e } from "../renderer/math/mat3.js";
|
|
2
|
+
import { buildDebugOverlayCommands as t } from "../debug/createDebugOverlayLayer.js";
|
|
3
|
+
import { renderSceneToPixels as n } from "./renderSceneToPixels.js";
|
|
4
|
+
//#region src/canvas/renderDebugSnapshot.ts
|
|
5
|
+
function r(e) {
|
|
6
|
+
return n(i(e));
|
|
7
|
+
}
|
|
8
|
+
function i(n) {
|
|
9
|
+
let { view: r, size: i, debug: a, config: o, pixelRatio: s = 1, ...c } = n, l = t(a, o, r, i);
|
|
10
|
+
return {
|
|
11
|
+
...c,
|
|
12
|
+
sourceRect: {
|
|
13
|
+
x: r.x,
|
|
14
|
+
y: r.y,
|
|
15
|
+
width: i.width / r.scale.x,
|
|
16
|
+
height: i.height / r.scale.y
|
|
17
|
+
},
|
|
18
|
+
scale: {
|
|
19
|
+
x: r.scale.x * s,
|
|
20
|
+
y: r.scale.y * s
|
|
21
|
+
},
|
|
22
|
+
overlay: s === 1 ? l : [{
|
|
23
|
+
kind: "group",
|
|
24
|
+
transform: e.scaled(e.identity(), s, s),
|
|
25
|
+
children: l
|
|
26
|
+
}]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { i as debugSnapshotArgs, r as renderDebugSnapshot };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=renderDebugSnapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDebugSnapshot.js","names":["renderDebugSnapshot","renderSceneToPixels","debugSnapshotArgs","args","rest","overlay","buildDebugOverlayCommands","debug","config","view","size","pixelRatio","mat3"],"sources":["../../src/canvas/renderDebugSnapshot.ts"],"sourcesContent":["/**\n * `renderDebugSnapshot` — the canvas as its debug overlay showed it, scene and\n * overlay in one raster, for attaching to a bug report.\n */\nimport { renderSceneToPixels, type RasterImage, type RenderSceneToPixelsArgs } from './renderSceneToPixels';\nimport { buildDebugOverlayCommands } from '../debug/createDebugOverlayLayer';\nimport type { DebugConfig, DebugSnapshot } from '../debug/types';\nimport type { View } from '../core/viewport/view';\nimport { mat3 } from '../renderer/math/mat3';\n\n/** The canvas to reproduce — its camera, its size, and what its debug overlay\n * had recorded — plus how to rasterize the scene under it. */\nexport interface RenderDebugSnapshotArgs<TData, TLayer extends string, TPose>\n extends Omit<RenderSceneToPixelsArgs<TData, TLayer, TPose>, 'sourceRect' | 'scale' | 'overlay'> {\n /** The camera the canvas was looking through. */\n view: View;\n /** The canvas's size in CSS pixels. */\n size: { width: number; height: number };\n /** Output pixels per CSS pixel. Default 1; pass `devicePixelRatio` for what\n * the screen showed. */\n pixelRatio?: number;\n /** What the overlay draws — a canvas's `getDebug()?.snapshot()`. */\n debug: DebugSnapshot;\n /** Which overlay features to draw, as on `<Canvas debug>`. The frame panel\n * shows the recorded paint cost but no rate: a still image has no frames. */\n config: DebugConfig;\n}\n\n/**\n * Rasterize the scene through `view` at `size` and paint the debug overlay\n * over it, the way the canvas composed them. Built on `renderSceneToPixels`,\n * so the scene pixels are the screen's pixels at that resolution, and\n * synchronous like it: `await warmRender({ render: debugSnapshotArgs(args) })`\n * first. Encode the result with `rasterToPng` to attach it somewhere.\n */\nexport function renderDebugSnapshot<TData, TLayer extends string, TPose>(\n args: RenderDebugSnapshotArgs<TData, TLayer, TPose>,\n): RasterImage {\n return renderSceneToPixels(debugSnapshotArgs(args));\n}\n\n/** What {@link renderDebugSnapshot} hands `renderSceneToPixels`: the source\n * rect and scale that reproduce the canvas, with the overlay composed on top. */\nexport function debugSnapshotArgs<TData, TLayer extends string, TPose>(\n args: RenderDebugSnapshotArgs<TData, TLayer, TPose>,\n): RenderSceneToPixelsArgs<TData, TLayer, TPose> {\n const { view, size, debug, config, pixelRatio = 1, ...rest } = args;\n const overlay = buildDebugOverlayCommands(debug, config, view, size);\n return {\n ...rest,\n sourceRect: { x: view.x, y: view.y, width: size.width / view.scale.x, height: size.height / view.scale.y },\n scale: { x: view.scale.x * pixelRatio, y: view.scale.y * pixelRatio },\n overlay: pixelRatio === 1\n ? overlay\n : [{ kind: 'group', transform: mat3.scaled(mat3.identity(), pixelRatio, pixelRatio), children: overlay }],\n };\n}\n"],"mappings":";;;;AAmCA,SAAgBA,EACd,GACa;CACb,OAAOC,EAAoBC,EAAkBC,CAAI,CAAC;AACpD;AAIA,SAAgBD,EACd,GAC+C;CAC/C,IAAM,EAAE,SAAM,SAAM,UAAO,WAAQ,gBAAa,GAAG,GAAGE,MAASD,GACzDE,IAAUC,EAA0BC,GAAOC,GAAQC,GAAMC,CAAI;CACnE,OAAO;EACL,GAAGN;EACH,YAAY;GAAE,GAAGK,EAAK;GAAG,GAAGA,EAAK;GAAG,OAAOC,EAAK,QAAQD,EAAK,MAAM;GAAG,QAAQC,EAAK,SAASD,EAAK,MAAM;EAAE;EACzG,OAAO;GAAE,GAAGA,EAAK,MAAM,IAAIE;GAAY,GAAGF,EAAK,MAAM,IAAIE;EAAW;EACpE,SAASA,MAAe,IACpBN,IACA,CAAC;GAAE,MAAM;GAAS,WAAWO,EAAK,OAAOA,EAAK,SAAS,GAAGD,GAAYA,CAAU;GAAG,UAAUN;EAAQ,CAAC;CAC5G;AACF"}
|