@weasel-js/core 1.7.0 → 1.7.1
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 +764 -0
- package/README.md +7 -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-BT_vp9FO.d.ts} +2 -2
- package/dist/{builtins-DLn2lCr_.d.ts → builtins-BSUfH8nU.d.ts} +738 -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 +75 -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 +98 -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-CDcZOV8h.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 +44 -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.css +2 -62
- package/dist/index.d.ts +1955 -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 +96 -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 +656 -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 +332 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +181 -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 +168 -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 +32 -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-CUMxmZzn.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-BSn4xiEy.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-CjSXMf8X.d.ts} +3 -3
- 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/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-CA54-mAZ.d.ts} +181 -13
- package/dist/{types-qYpyTAiZ.d.ts → types-DSjd6W3n.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 +29 -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.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,136 @@
|
|
|
1
|
+
import { resolveColor as e, rgbaToHex as t } from "../renderer/math/color.js";
|
|
2
|
+
import { lerpColorArray as n } from "@weasel-js/paint";
|
|
3
|
+
//#region src/core/gradient.ts
|
|
4
|
+
function r(e) {
|
|
5
|
+
return e == null ? !1 : e.fill === "linear-gradient" || e.fill === "radial-gradient" || e.fill === "conic-gradient";
|
|
6
|
+
}
|
|
7
|
+
function i(t) {
|
|
8
|
+
return [...t].sort((e, t) => e.offset - t.offset).map((t) => ({
|
|
9
|
+
offset: t.offset,
|
|
10
|
+
rgba: e(t.color)
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
function a(e, t, r = "rgb") {
|
|
14
|
+
if (e.length === 0) return o;
|
|
15
|
+
let i = e[0], a = e[e.length - 1];
|
|
16
|
+
if (t <= i.offset) return i.rgba;
|
|
17
|
+
if (t >= a.offset) return a.rgba;
|
|
18
|
+
for (let i = 0; i < e.length - 1; i++) {
|
|
19
|
+
let a = e[i], o = e[i + 1];
|
|
20
|
+
if (t < a.offset || t > o.offset) continue;
|
|
21
|
+
let s = o.offset - a.offset;
|
|
22
|
+
if (s <= 0) return o.rgba;
|
|
23
|
+
let c = (t - a.offset) / s, [l, u, d, f] = n(a.rgba, o.rgba, c, r);
|
|
24
|
+
return [
|
|
25
|
+
l,
|
|
26
|
+
u,
|
|
27
|
+
d,
|
|
28
|
+
f
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return a.rgba;
|
|
32
|
+
}
|
|
33
|
+
var o = [
|
|
34
|
+
0,
|
|
35
|
+
0,
|
|
36
|
+
0,
|
|
37
|
+
0
|
|
38
|
+
];
|
|
39
|
+
function s(e, n, r = "rgb") {
|
|
40
|
+
return e.length === 0 ? "rgba(0,0,0,0)" : t(a(i(e), n, r));
|
|
41
|
+
}
|
|
42
|
+
function c(e, t) {
|
|
43
|
+
if (e.fill === t) return e;
|
|
44
|
+
let n = {
|
|
45
|
+
stops: e.stops,
|
|
46
|
+
units: e.units,
|
|
47
|
+
interpolate: e.interpolate,
|
|
48
|
+
opacity: e.opacity
|
|
49
|
+
}, { center: r, radius: i, angle: a } = l(e);
|
|
50
|
+
if (t === "linear-gradient") {
|
|
51
|
+
let e = Math.cos(a) * i, t = Math.sin(a) * i;
|
|
52
|
+
return {
|
|
53
|
+
fill: "linear-gradient",
|
|
54
|
+
from: {
|
|
55
|
+
x: r.x - e,
|
|
56
|
+
y: r.y - t
|
|
57
|
+
},
|
|
58
|
+
to: {
|
|
59
|
+
x: r.x + e,
|
|
60
|
+
y: r.y + t
|
|
61
|
+
},
|
|
62
|
+
...n
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return t === "radial-gradient" ? {
|
|
66
|
+
fill: "radial-gradient",
|
|
67
|
+
center: r,
|
|
68
|
+
radius: i,
|
|
69
|
+
...n
|
|
70
|
+
} : {
|
|
71
|
+
fill: "conic-gradient",
|
|
72
|
+
center: r,
|
|
73
|
+
angle: a,
|
|
74
|
+
...n
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function l(e) {
|
|
78
|
+
if (e.fill === "linear-gradient") {
|
|
79
|
+
let t = e.to.x - e.from.x, n = e.to.y - e.from.y;
|
|
80
|
+
return {
|
|
81
|
+
center: {
|
|
82
|
+
x: (e.from.x + e.to.x) / 2,
|
|
83
|
+
y: (e.from.y + e.to.y) / 2
|
|
84
|
+
},
|
|
85
|
+
radius: Math.hypot(t, n) / 2,
|
|
86
|
+
angle: Math.atan2(n, t)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return e.fill === "radial-gradient" ? {
|
|
90
|
+
center: e.center,
|
|
91
|
+
radius: e.radius,
|
|
92
|
+
angle: 0
|
|
93
|
+
} : {
|
|
94
|
+
center: e.center,
|
|
95
|
+
radius: u(e.units),
|
|
96
|
+
angle: e.angle
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function u(e) {
|
|
100
|
+
return e === "bounds" ? .5 : 50;
|
|
101
|
+
}
|
|
102
|
+
function d(e, t, n, r) {
|
|
103
|
+
let i = {
|
|
104
|
+
x: t.x + t.width / 2,
|
|
105
|
+
y: t.y + t.height / 2
|
|
106
|
+
};
|
|
107
|
+
return e === "linear-gradient" ? {
|
|
108
|
+
fill: "linear-gradient",
|
|
109
|
+
from: {
|
|
110
|
+
x: t.x,
|
|
111
|
+
y: i.y
|
|
112
|
+
},
|
|
113
|
+
to: {
|
|
114
|
+
x: t.x + t.width,
|
|
115
|
+
y: i.y
|
|
116
|
+
},
|
|
117
|
+
stops: n,
|
|
118
|
+
units: r
|
|
119
|
+
} : e === "radial-gradient" ? {
|
|
120
|
+
fill: "radial-gradient",
|
|
121
|
+
center: i,
|
|
122
|
+
radius: Math.max(t.width, t.height) / 2,
|
|
123
|
+
stops: n,
|
|
124
|
+
units: r
|
|
125
|
+
} : {
|
|
126
|
+
fill: "conic-gradient",
|
|
127
|
+
center: i,
|
|
128
|
+
angle: 0,
|
|
129
|
+
stops: n,
|
|
130
|
+
units: r
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { d as gradientForBounds, l as gradientGeometry, r as isGradientFill, i as resolveGradientStops, s as sampleGradientStops, a as sampleResolvedStops, c as withGradientKind };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=gradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.js","names":["isGradientFill","fill","resolveGradientStops","stops","a","b","s","resolveColor","sampleResolvedStops","TRANSPARENT","first","last","lo","hi","span","f","r","g","lerpColorArray","space","sampleGradientStops","rgbaToHex","t","withGradientKind","kind","common","gradientGeometry","dx","angle","radius","dy","center","conicArmRadius","units","gradientForBounds","bounds"],"sources":["../../src/core/gradient.ts"],"sourcesContent":["/**\n * Gradient helpers shared by renderers, editors and exporters: reading a\n * color out of a stop list, and moving a gradient between its three kinds.\n *\n * The stop list is the part every consumer agrees on; the geometry\n * (`from`/`to`, `center`, `radius`, `angle`) differs per kind, which is what\n * `withGradientKind` exists to translate.\n */\n\nimport { resolveColor, rgbaToHex } from '../renderer/math/color';\nimport { lerpColorArray } from '@weasel-js/paint';\nimport type { ColorSpace, FillStyle, GradStop, GradientFill, GradientKind } from '@weasel-js/paint';\n\n/** A stop with its color already parsed to 0..1 RGBA. */\nexport interface ResolvedGradientStop {\n offset: number;\n rgba: readonly [number, number, number, number];\n}\n\n/** Narrow a paint to the gradient members of `FillStyle`. The three\n * discriminants are the union's own definition of `GradientFill`, so every\n * consumer that reaches for gradient geometry starts here. */\nexport function isGradientFill(fill: FillStyle | null | undefined): fill is GradientFill {\n if (fill == null) return false;\n return fill.fill === 'linear-gradient'\n || fill.fill === 'radial-gradient'\n || fill.fill === 'conic-gradient';\n}\n\n/**\n * Sort a stop list by offset and parse each color to 0..1 RGBA — the reading\n * of a stop list that `sampleResolvedStops` works from, hoisted out so a\n * caller sampling many positions (the GL ramp) parses each color once.\n *\n * Colors go through `resolveColor`, so any CSS color the kit understands is a\n * legal stop, not just hex.\n */\nexport function resolveGradientStops(stops: readonly GradStop[]): ResolvedGradientStop[] {\n return [...stops]\n .sort((a, b) => a.offset - b.offset)\n .map((s) => ({ offset: s.offset, rgba: resolveColor(s.color) }));\n}\n\n/**\n * RGBA (0..1) at position `t` along resolved stops: flat extension past\n * either end, interpolation between neighbors in `space`, alpha included.\n *\n * The single definition of what a stop list means. The GL ramp texture bakes\n * this at 256 positions and an editor calls it per pixel of a track; a second\n * implementation is a gradient that paints differently from its own swatch.\n *\n * `space` is a gradient's `interpolate`. Alpha is linear in every space —\n * only the color channels travel through OKLab or OKLCh.\n *\n * Returns transparent black for an empty list.\n */\nexport function sampleResolvedStops(\n stops: readonly ResolvedGradientStop[], t: number, space: ColorSpace = 'rgb',\n): readonly [number, number, number, number] {\n if (stops.length === 0) return TRANSPARENT;\n const first = stops[0];\n const last = stops[stops.length - 1];\n if (t <= first.offset) return first.rgba;\n if (t >= last.offset) return last.rgba;\n\n for (let i = 0; i < stops.length - 1; i++) {\n const lo = stops[i];\n const hi = stops[i + 1];\n if (t < lo.offset || t > hi.offset) continue;\n const span = hi.offset - lo.offset;\n // Coincident stops are a hard color break: take the later one.\n if (span <= 0) return hi.rgba;\n const f = (t - lo.offset) / span;\n const [r, g, b, a] = lerpColorArray(lo.rgba, hi.rgba, f, space);\n return [r, g, b, a];\n }\n return last.rgba;\n}\n\nconst TRANSPARENT: readonly [number, number, number, number] = [0, 0, 0, 0];\n\n/**\n * Color at position `t` (0..1) along a stop list, as a hex string — the same\n * sampling the GL ramp texture bakes, so an editor track and the painted\n * gradient cannot disagree.\n *\n * Returns transparent black for an empty list.\n */\nexport function sampleGradientStops(\n stops: readonly GradStop[], t: number, space: ColorSpace = 'rgb',\n): string {\n if (stops.length === 0) return 'rgba(0,0,0,0)';\n return rgbaToHex(sampleResolvedStops(resolveGradientStops(stops), t, space));\n}\n\n/**\n * Retarget a gradient to a different kind, preserving stops, `units` and\n * `opacity`, and carrying the geometry across as faithfully as the kinds\n * allow.\n *\n * Linear carries a segment; radial and conic carry a center. Converting\n * between them keeps the center fixed and reads the radius / angle off the\n * segment, so switching kind in an editor moves the paint as little as\n * possible instead of snapping to an arbitrary default.\n *\n * Lossy in both directions, because the kinds hold different information: a\n * radial gradient stores no angle, so a round trip through one leaves the\n * segment horizontal; a conic stores no radius, so a round trip through one\n * resets the segment's length. An editor that wants a kind switch to be\n * undoable should keep the original paint rather than converting back.\n */\nexport function withGradientKind(fill: GradientFill, kind: GradientKind): GradientFill {\n if (fill.fill === kind) return fill;\n const common = {\n stops: fill.stops, units: fill.units,\n interpolate: fill.interpolate, opacity: fill.opacity,\n };\n const { center, radius, angle } = gradientGeometry(fill);\n\n if (kind === 'linear-gradient') {\n const dx = Math.cos(angle) * radius;\n const dy = Math.sin(angle) * radius;\n return {\n fill: 'linear-gradient',\n from: { x: center.x - dx, y: center.y - dy },\n to: { x: center.x + dx, y: center.y + dy },\n ...common,\n };\n }\n if (kind === 'radial-gradient') {\n return { fill: 'radial-gradient', center, radius, ...common };\n }\n return { fill: 'conic-gradient', center, angle, ...common };\n}\n\n/**\n * Center / radius / angle for any gradient kind — the shared polar reading\n * `withGradientKind` converts through, and what on-canvas handles position\n * themselves from.\n *\n * For a linear gradient the center is the segment midpoint, the radius is\n * half its length, and the angle is its direction.\n */\nexport function gradientGeometry(fill: GradientFill): {\n center: { x: number; y: number };\n radius: number;\n angle: number;\n} {\n if (fill.fill === 'linear-gradient') {\n const dx = fill.to.x - fill.from.x;\n const dy = fill.to.y - fill.from.y;\n return {\n center: { x: (fill.from.x + fill.to.x) / 2, y: (fill.from.y + fill.to.y) / 2 },\n radius: Math.hypot(dx, dy) / 2,\n angle: Math.atan2(dy, dx),\n };\n }\n if (fill.fill === 'radial-gradient') {\n return { center: fill.center, radius: fill.radius, angle: 0 };\n }\n return { center: fill.center, radius: conicArmRadius(fill.units), angle: fill.angle };\n}\n\n/**\n * Conic gradients carry no radius, but converting one to a linear or radial\n * gradient needs a non-zero length to build from.\n *\n * Unit-dependent, and that is the whole point: `'bounds'` geometry runs `0..1`\n * across the box, so a pixel-flavored default there does not mean \"a bit under\n * half the box\", it means fifty times it.\n */\nfunction conicArmRadius(units: GradientFill['units']): number {\n return units === 'bounds' ? 0.5 : 50;\n}\n\n/**\n * A gradient spanning a box left edge to right edge through its vertical\n * center (linear) or filling it (radial / conic) — the sensible starting\n * geometry when a consumer turns a solid fill into a gradient and has only\n * the shape's bounds to go on.\n */\nexport function gradientForBounds(\n kind: GradientKind,\n bounds: { x: number; y: number; width: number; height: number },\n stops: GradStop[],\n units?: GradientFill['units'],\n): GradientFill {\n const center = { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 };\n if (kind === 'linear-gradient') {\n return {\n fill: 'linear-gradient',\n from: { x: bounds.x, y: center.y },\n to: { x: bounds.x + bounds.width, y: center.y },\n stops,\n units,\n };\n }\n if (kind === 'radial-gradient') {\n return {\n fill: 'radial-gradient',\n center,\n radius: Math.max(bounds.width, bounds.height) / 2,\n stops,\n units,\n };\n }\n return { fill: 'conic-gradient', center, angle: 0, stops, units };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/core/isPlainObject.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e === Object.prototype || e === null || Object.getPrototypeOf(e) === null;
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
return typeof t == "object" && !!t && e(Object.getPrototypeOf(t));
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as isPlainObject, e as isPlainPrototype };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=isPlainObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPlainObject.js","names":["isPlainPrototype","proto","isPlainObject","value"],"sources":["../../src/core/isPlainObject.ts"],"sourcesContent":["/** Whether `proto` is the prototype a plain object has: `null`, or some\n * realm's `Object.prototype`. Comparing against this realm's alone misses\n * objects made in an iframe, a VM context, or by `structuredClone` under jsdom. */\nexport function isPlainPrototype(proto: object | null): boolean {\n return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null;\n}\n\n/** Whether `value` is a plain object — a literal or `Object.create(null)` — from any realm. */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && isPlainPrototype(Object.getPrototypeOf(value));\n}\n"],"mappings":";AAGA,SAAgBA,EAAiB,GAA+B;CAC9D,OAAOC,MAAU,OAAO,aAAaA,MAAU,QAAQ,OAAO,eAAeA,CAAK,MAAM;AAC1F;AAGA,SAAgBC,EAAc,GAAkD;CAC9E,OAAO,OAAOC,KAAU,cAAYA,KAAkBH,EAAiB,OAAO,eAAeG,CAAK,CAAC;AACrG"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { viewToMat3 as e } from "../../renderer/math/viewToMat3.js";
|
|
2
|
+
//#region src/core/layers/render.ts
|
|
3
|
+
var t = {
|
|
4
|
+
x: 0,
|
|
5
|
+
y: 0,
|
|
6
|
+
scale: {
|
|
7
|
+
x: 1,
|
|
8
|
+
y: 1
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function n({ layerId: e, error: t }) {
|
|
12
|
+
console.error(`[weasel] layer "${e}" threw while drawing; it painted nothing this frame.`, t);
|
|
13
|
+
}
|
|
14
|
+
function r(e) {
|
|
15
|
+
return (t) => {
|
|
16
|
+
let n = (typeof e == "function" ? e() : e).flatMap((e) => e.subscribe ? [e.subscribe(t)] : []);
|
|
17
|
+
return () => {
|
|
18
|
+
for (let e of n) e();
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function i() {
|
|
23
|
+
return typeof performance < "u" ? performance.now() : Date.now();
|
|
24
|
+
}
|
|
25
|
+
function a(e, r, a, l, d, f, p, m = n, h, g) {
|
|
26
|
+
let _ = new Map(e.map((e) => [e.id, e])), v = l ? l.map((e) => _.get(e)).filter((e) => e !== void 0) : e, y = d ?? t, b = [];
|
|
27
|
+
if (p) for (let e of [...p.keys()]) _.has(e) || p.delete(e);
|
|
28
|
+
let x = o(h, _.keys()), S = /* @__PURE__ */ new Set(), C = null, w = () => {
|
|
29
|
+
if (!C) return;
|
|
30
|
+
let e = b.length, t = g ? i() : 0;
|
|
31
|
+
for (let e of s(C.group, C.children, y, f)) b.push(e);
|
|
32
|
+
g?.push({
|
|
33
|
+
id: C.group.id,
|
|
34
|
+
start: e,
|
|
35
|
+
end: b.length,
|
|
36
|
+
buildMs: C.buildMs + i() - t
|
|
37
|
+
}), C = null;
|
|
38
|
+
};
|
|
39
|
+
for (let e of v) {
|
|
40
|
+
if (!c(e, a)) continue;
|
|
41
|
+
let t = g ? i() : 0, n = u(e, r, y, f, p, m), o = g ? i() - t : 0;
|
|
42
|
+
if (n.length === 0) {
|
|
43
|
+
g?.push({
|
|
44
|
+
id: e.id,
|
|
45
|
+
start: b.length,
|
|
46
|
+
end: b.length,
|
|
47
|
+
buildMs: o
|
|
48
|
+
});
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
let s = x?.get(e.id);
|
|
52
|
+
if (C && C.group !== s && w(), !s) {
|
|
53
|
+
let t = b.length;
|
|
54
|
+
for (let e of n) b.push(e);
|
|
55
|
+
g?.push({
|
|
56
|
+
id: e.id,
|
|
57
|
+
start: t,
|
|
58
|
+
end: b.length,
|
|
59
|
+
buildMs: o
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
C ||= (S.has(s) && console.warn(`[weasel] layer group "${s.id}" is not one run — another layer is drawn between its members, so it composites as more than one pass over more than one buffer. Move its members together in the layer order.`), S.add(s), {
|
|
64
|
+
group: s,
|
|
65
|
+
children: [],
|
|
66
|
+
buildMs: 0
|
|
67
|
+
}), C.buildMs += o;
|
|
68
|
+
for (let e of n) C.children.push(e);
|
|
69
|
+
}
|
|
70
|
+
return w(), b;
|
|
71
|
+
}
|
|
72
|
+
function o(e, t) {
|
|
73
|
+
if (!e || e.length === 0) return null;
|
|
74
|
+
let n = [...t], r = /* @__PURE__ */ new Map();
|
|
75
|
+
for (let t of e) for (let e of t.layers) {
|
|
76
|
+
let i = !1;
|
|
77
|
+
for (let a of n) {
|
|
78
|
+
if (a !== e && !a.startsWith(`${e}:`)) continue;
|
|
79
|
+
i = !0;
|
|
80
|
+
let n = r.get(a);
|
|
81
|
+
if (n !== t) {
|
|
82
|
+
if (n) {
|
|
83
|
+
console.warn(`[weasel] layer "${a}" is claimed by layer groups "${n.id}" and "${t.id}"; it stays in "${n.id}".`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
r.set(a, t);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
i || console.warn(`[weasel] layer group "${t.id}" names "${e}", which matches no layer being drawn, so it groups nothing. Check the id against the layer stack — a scene with declared layers draws as "scene:<layerId>", which "scene" covers.`);
|
|
90
|
+
}
|
|
91
|
+
return r;
|
|
92
|
+
}
|
|
93
|
+
function s(e, t, n, r) {
|
|
94
|
+
let i = typeof e.effects == "function" ? e.effects(n, r) : e.effects, a = i && i.length > 0 ? i : void 0;
|
|
95
|
+
return !a && e.alpha === void 0 && e.colorMatrix === void 0 ? t : [{
|
|
96
|
+
kind: "group",
|
|
97
|
+
...a ? { effects: a } : {},
|
|
98
|
+
...e.alpha === void 0 ? {} : { alpha: e.alpha },
|
|
99
|
+
...e.colorMatrix === void 0 ? {} : { colorMatrix: e.colorMatrix },
|
|
100
|
+
children: t
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
|
+
function c(e, t) {
|
|
104
|
+
return e.alwaysOn ? !0 : e.id in t ? t[e.id] : e.defaultVisible ?? !0;
|
|
105
|
+
}
|
|
106
|
+
function l(e, t, n) {
|
|
107
|
+
return n && !n.includes(e.id) ? !1 : c(e, t);
|
|
108
|
+
}
|
|
109
|
+
function u(t, r, i, a, o, s = n) {
|
|
110
|
+
let c;
|
|
111
|
+
try {
|
|
112
|
+
c = d(t, r, i, a, o);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return o?.delete(t.id), s({
|
|
115
|
+
layerId: t.id,
|
|
116
|
+
error: e
|
|
117
|
+
}), [];
|
|
118
|
+
}
|
|
119
|
+
if (c.length === 0) return [];
|
|
120
|
+
let l = t.effects && t.effects.length > 0 ? t.effects : void 0;
|
|
121
|
+
return (t.space ?? "world") === "screen" ? l ? [{
|
|
122
|
+
kind: "group",
|
|
123
|
+
effects: l,
|
|
124
|
+
children: c
|
|
125
|
+
}] : c : [{
|
|
126
|
+
kind: "group",
|
|
127
|
+
transform: e(i),
|
|
128
|
+
...l ? { effects: l } : {},
|
|
129
|
+
children: c
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
function d(e, t, n, r, i) {
|
|
133
|
+
if (!i || !e.deps) return e.draw(t, n, r);
|
|
134
|
+
let a = e.deps(t, n, r), o = i.get(e.id);
|
|
135
|
+
if (o && f(o.deps, a)) return o.cmds;
|
|
136
|
+
let s = e.draw(t, n, r);
|
|
137
|
+
return i.set(e.id, {
|
|
138
|
+
deps: a,
|
|
139
|
+
cmds: s
|
|
140
|
+
}), s;
|
|
141
|
+
}
|
|
142
|
+
function f(e, t) {
|
|
143
|
+
if (e.length !== t.length) return !1;
|
|
144
|
+
for (let n = 0; n < e.length; n++) if (!Object.is(e[n], t[n])) return !1;
|
|
145
|
+
return !0;
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { f as depsUnchanged, a as drawLayers, u as drawOneLayer, l as isLayerPainted, c as isLayerVisible, r as subscribeToSources };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","names":["IDENTITY_VIEW","reportLayerFailure","layerId","error","subscribeToSources","offs","sources","l","listener","off","clockMs","drawLayers","layerById","layers","sequence","order","id","v","view","out","cache","groupOf","groupMembership","groups","bracketed","run","closeRun","start","t0","spans","c","wrapGroup","dims","layer","isLayerVisible","visibility","cmds","drawOneLayer","data","onLayerError","buildMs","group","stack","layerIds","byLayer","name","matched","claimed","declared","effects","children","isLayerPainted","layerCommands","viewToMat3","deps","entry","depsUnchanged","a","b","i"],"sources":["../../../src/core/layers/render.ts"],"sourcesContent":["import { viewToMat3, type DrawCommand } from '../../renderer';\nimport type { Effect } from '../../renderer/effects/types';\nimport type { View } from 'core/viewport/view';\n\nconst IDENTITY_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n\n/**\n * Canvas size in CSS pixels — passed to `draw` for layers that anchor to\n * canvas edges (e.g. the debug overlay's layer-list panel). The GL backend\n * supplies it explicitly so layers don't have to know about DPR.\n */\nexport interface Dims {\n width: number;\n height: number;\n}\n\n/**\n * What a layer's `draw` threw, and which layer threw it.\n *\n * A `draw` runs on the frame loop, so a throw that escapes it surfaces as an\n * uncaught `requestAnimationFrame` error on the window and takes the whole\n * frame with it — every other layer included. One broken layer painting\n * nothing, named in the console, is the lesser wrong.\n */\nexport interface LayerDrawFailure {\n layerId: string;\n error: unknown;\n}\n\n/** Default report: name the layer, keep the frame. */\nfunction reportLayerFailure({ layerId, error }: LayerDrawFailure): void {\n console.error(\n `[weasel] layer \"${layerId}\" threw while drawing; it painted nothing this frame.`,\n error,\n );\n}\n\n/**\n * Several consecutive layers composited as one.\n *\n * A layer's own `effects` run over that layer alone, which is the wrong\n * picture whenever a pass reads neighboring pixels: `blur(A over B)` is not\n * `blur(A) over blur(B)`, and it costs a buffer and a pass chain per layer. A\n * group draws its members into one buffer, runs one chain over it, and\n * composites the result back once.\n *\n * Membership is by `RenderLayer.id` — the same names `layerOrder` and\n * `layerVisibility` use, not the `layers` map's slot keys.\n *\n * Only *consecutive* members share a buffer, because anything drawn between\n * two members has to land between them. A group whose members are separated in\n * the render order is drawn as one bracket per run, with a warning: the\n * picture is right, the declaration almost certainly is not.\n *\n * This is a render-stack bracket, not a scene `ContainerNode` — it holds no\n * ids, survives no reload, and nothing in the scene knows about it.\n */\nexport interface LayerGroup {\n /** Names the group in warnings; not a layer id and never drawn. */\n id: string;\n /**\n * Member layer ids. Order here is ignored — the render order decides.\n *\n * A name claims that layer and every layer under it in the `:` namespace, so\n * `'scene'` covers the `scene:<layerId>` layers a scene with declared layers\n * draws as — the same set `before`/`after: 'scene'` anchors against. The\n * separator is required: `'scene'` does not reach `scenery`. A name matching\n * no layer being drawn is warned about rather than ignored.\n */\n layers: readonly string[];\n /**\n * Passes over the group's combined pixels, in order. A thunk is re-read on\n * every frame, so an animating radius costs no React render; an array is\n * read once per frame either way.\n */\n effects?: readonly Effect[] | ((view: View, dims: Dims) => readonly Effect[]);\n /** Opacity applied to the group's composited result, not to each member. */\n alpha?: number;\n /** 4×5 color matrix (row-major, 20 numbers) applied to the composited\n * result. See `GroupDrawCommand.colorMatrix`. */\n colorMatrix?: number[];\n}\n\n/** One layer's memoized output, keyed by layer id. Owned by the canvas that\n * calls `drawLayers`, not by `drawLayers` itself — the function is pure. */\nexport type LayerCommandCache = Map<\n string,\n { deps: readonly unknown[]; cmds: DrawCommand[] }\n>;\n\n/**\n * A single named render sub-layer within a canvas renderer.\n *\n * @template TData - The data object passed to each draw call.\n */\n/** Something outside React whose changes a paint reads — a mode registry, a\n * scoping lookup. A notification repaints the canvas; the listener takes no\n * arguments and the returned function unsubscribes. */\nexport interface RedrawSource {\n subscribe(listener: () => void): () => void;\n}\n\n/** The `subscribe` for a layer that draws `sources`: it notifies whenever any\n * of them does. A thunk is read when the subscription is made. Every layer\n * that draws other layers declares this, so wrapping never silences what\n * repaints a source. */\nexport function subscribeToSources(\n sources: readonly { subscribe?: RedrawSource['subscribe'] }[]\n | (() => readonly { subscribe?: RedrawSource['subscribe'] }[]),\n): RedrawSource['subscribe'] {\n return (listener) => {\n const list = typeof sources === 'function' ? sources() : sources;\n const offs = list.flatMap((l) => (l.subscribe ? [l.subscribe(listener)] : []));\n return () => { for (const off of offs) off(); };\n };\n}\n\n/** One layer of a canvas: `draw` turns `data` and the view into draw commands;\n * the other fields control caching, visibility, coordinate space and hit-testing. */\nexport interface RenderLayer<TData> {\n /** Unique identifier used in visibility maps and ordering arrays. When a\n * cache is in use, an id must identify the same logical layer across\n * frames — reusing it for a different layer can serve cross-layer commands. */\n id: string;\n /** Human-readable name for UI toggles. */\n label: string;\n /**\n * Emit a DrawCommand tree for the GL backend to dispatch.\n *\n * For world-space layers (the default), emit commands in WORLD COORDS —\n * `drawLayers` automatically wraps them in `{ kind: 'group', transform:\n * viewToMat3(view), ... }` before handing them to the renderer. Do NOT\n * apply the view transform yourself.\n *\n * For screen-space layers (`space: 'screen'`), emit commands in CSS-pixel\n * coords directly; `drawLayers` passes them through unchanged. If part\n * of a screen-space layer's output needs to track the view, wrap that\n * subset manually with `viewToMat3(view)`.\n */\n draw: (data: TData, view: View, dims: Dims) => DrawCommand[];\n /**\n * Optional cache key. When present and a `LayerCommandCache` is supplied to\n * `drawLayers`, the layer's previous `DrawCommand[]` is reused as long as\n * every entry is `Object.is`-equal to the previous call's. A layer with no\n * `deps` rebuilds on every frame.\n *\n * **The returned commands must be treated as immutable.** A cached tree is\n * handed to the renderer again on later frames, so mutating a tree you\n * previously returned corrupts the cache silently rather than erroring.\n *\n * **Screen-space layers are not protected against a stale `view`/`dims`\n * the way world-space layers are** (see `space` below) — include them in\n * `deps` if `draw` reads them.\n */\n deps?: (data: TData, view: View, dims: Dims) => readonly unknown[];\n /**\n * Whether the layer is shown when no explicit visibility entry exists.\n * Defaults to `true` when absent.\n */\n defaultVisible?: boolean;\n /**\n * When true, the layer is always drawn regardless of the visibility map.\n * Useful for layers that must never be hidden (e.g. base grid).\n */\n alwaysOn?: boolean;\n /**\n * Coordinate space the layer draws in.\n *\n * - `'world'` (default): the layer's `draw` returns world-space commands;\n * `drawLayers` wraps them in a `kind: 'group'` with `viewToMat3(view)`\n * automatically.\n * - `'screen'`: the layer's `draw` returns screen-space (CSS-pixel)\n * commands; `drawLayers` passes them through unchanged. World-anchored\n * chrome inside a screen-space layer must call `worldToScreen` or wrap\n * the relevant subset with `viewToMat3(view)` manually.\n */\n space?: 'world' | 'screen';\n /**\n * Where the layer learns that state `draw` reads, outside the scene and the\n * props, has changed. The canvas painting it subscribes while the layer is\n * mounted and repaints on every notification, so a layer reading a mode\n * registry needs no consumer code to follow a mode switch.\n */\n subscribe?: RedrawSource['subscribe'];\n /**\n * Full-screen passes run over this layer's own pixels before it joins the\n * frame — a blur here blurs the world and leaves the HUD drawn above it\n * sharp, which is the thing a CSS `filter` on the `<canvas>` cannot do.\n *\n * Costs nothing while empty: the renderer allocates no offscreen buffer\n * until a layer actually declares one. See `GroupDrawCommand.effects` for\n * what a pass may read, and {@link LayerGroup} to run one chain over\n * several layers at once instead of one chain each.\n */\n effects?: readonly Effect[];\n /**\n * Optional hit-test for **consumer-attached** layers.\n *\n * Only layers registered through `CanvasExtensionApi.registerLayer` are\n * hit-tested: `hitTestExtras` walks them last-registered-first on\n * pointerdown, and `<SceneCanvas>` folds the result into its `affordanceAt`\n * thunk ahead of the kit's own selection chrome. First non-null result\n * wins; null means \"I don't claim this hit, try the next layer.\"\n *\n * Layers that reach the draw stack some other way — a `Tool.overlay`, an\n * entry in the `layers` map — are painted but never hit-tested, so defining\n * `hitTest` on one has no effect. (The kit's own chrome doesn't need it: it\n * goes through `buildAffordanceAt`.)\n *\n * Coordinates are world-space. The `data` arg is the layer's\n * configured data slot (same as `draw`); `view` and `dims` mirror\n * `draw`'s arguments.\n */\n hitTest?: (\n worldX: number,\n worldY: number,\n data: TData,\n view: View,\n dims: Dims,\n /** Chrome-caps visibility predicate. When supplied, the layer must\n * not return a hit from any chrome element whose id reports\n * `false`. Absent → every element is hittable. */\n isVisible?: (id: string) => boolean,\n ) => import('../../affordances/types').LayerHit | null;\n /**\n * Called on every pointermove when no gesture is currently captured.\n * Lets layers (e.g. HUD widgets) track hover state without participating\n * in the drag pipeline. Coords are world-space; the layer is responsible\n * for any further conversion (e.g. world→screen for screen-space layers)\n * and for its own throttling.\n */\n onUncapturedMove?: (\n worldX: number,\n worldY: number,\n evt: PointerEvent,\n view: View,\n dims: Dims,\n ) => void;\n /**\n * Called when the cursor leaves the canvas element. Lets layers clear\n * any hover state they're holding.\n */\n onUncapturedLeave?: () => void;\n}\n\n/** Where one layer's commands landed in {@link drawLayers}' output,\n * `[start, end)`, and the CPU milliseconds its `draw` took. A layer group's\n * run is one span under the group's id. */\nexport interface LayerDrawSpan {\n id: string;\n start: number;\n end: number;\n buildMs: number;\n}\n\nfunction clockMs(): number {\n return typeof performance !== 'undefined' ? performance.now() : Date.now();\n}\n\n/**\n * Walk visible layers and concatenate their emitted DrawCommand arrays into\n * one flat list, ready to feed to `WeaselRenderer.render(commands)`.\n *\n * Visibility resolution order:\n * 1. `alwaysOn` — always drawn, ignores visibility map.\n * 2. Explicit entry in `visibility` map — overrides default.\n * 3. `layer.defaultVisible` — falls back to `true` when absent.\n *\n * Transform composition: world-space layers (the default; `space` unset or\n * `'world'`) have their commands wrapped in a `kind: 'group'` with\n * `viewToMat3(view)` before they reach the renderer. Screen-space layers\n * (`space: 'screen'`) pass through unchanged.\n *\n * A layer whose `draw` throws is dropped for the frame and reported through\n * `onLayerError` — the rest of the frame still paints.\n *\n * `groups` brackets runs of consecutive layers so they composite as one — see\n * `LayerGroup`. A layer named by no group is emitted exactly as it was before\n * groups existed, and a frame that declares none allocates nothing.\n *\n * `spans`, when passed, receives one {@link LayerDrawSpan} per layer drawn.\n */\nexport function drawLayers<TData>(\n layers: RenderLayer<TData>[],\n data: TData,\n visibility: Record<string, boolean>,\n order: string[] | undefined,\n view: View | undefined,\n dims: Dims,\n cache?: LayerCommandCache,\n onLayerError: (failure: LayerDrawFailure) => void = reportLayerFailure,\n groups?: readonly LayerGroup[],\n spans?: LayerDrawSpan[],\n): DrawCommand[] {\n const layerById = new Map(layers.map((l) => [l.id, l]));\n const sequence = order\n ? order.map((id) => layerById.get(id)).filter((l): l is RenderLayer<TData> => l !== undefined)\n : layers;\n const v = view ?? IDENTITY_VIEW;\n const out: DrawCommand[] = [];\n\n if (cache) {\n for (const id of [...cache.keys()]) {\n if (!layerById.has(id)) cache.delete(id);\n }\n }\n\n const groupOf = groupMembership(groups, layerById.keys());\n const bracketed = new Set<LayerGroup>();\n let run: { group: LayerGroup; children: DrawCommand[]; buildMs: number } | null = null;\n\n const closeRun = () => {\n if (!run) return;\n const start = out.length;\n const t0 = spans ? clockMs() : 0;\n for (const c of wrapGroup(run.group, run.children, v, dims)) out.push(c);\n spans?.push({ id: run.group.id, start, end: out.length, buildMs: run.buildMs + clockMs() - t0 });\n run = null;\n };\n\n for (const layer of sequence) {\n // `order` is already applied by `sequence`; passing it again would be a\n // second, redundant lookup for the same answer.\n if (!isLayerVisible(layer, visibility)) continue;\n\n const t0 = spans ? clockMs() : 0;\n const cmds = drawOneLayer(layer, data, v, dims, cache, onLayerError);\n const buildMs = spans ? clockMs() - t0 : 0;\n // A layer that painted nothing neither joins a run nor breaks one. Letting\n // it break one would split a group over a debug overlay that is switched\n // on but currently empty.\n if (cmds.length === 0) {\n spans?.push({ id: layer.id, start: out.length, end: out.length, buildMs });\n continue;\n }\n\n const group = groupOf?.get(layer.id);\n if (run && run.group !== group) closeRun();\n if (!group) {\n const start = out.length;\n for (const c of cmds) out.push(c);\n spans?.push({ id: layer.id, start, end: out.length, buildMs });\n continue;\n }\n if (!run) {\n if (bracketed.has(group)) {\n console.warn(\n `[weasel] layer group \"${group.id}\" is not one run — another layer is drawn ` +\n 'between its members, so it composites as more than one pass over more than ' +\n 'one buffer. Move its members together in the layer order.',\n );\n }\n bracketed.add(group);\n run = { group, children: [], buildMs: 0 };\n }\n run.buildMs += buildMs;\n for (const c of cmds) run.children.push(c);\n }\n closeRun();\n\n return out;\n}\n\n/**\n * Layer id → the group that owns it.\n *\n * A member name claims the layer of that exact id and every layer under it in\n * the `:` namespace, so `'scene'` claims the whole split scene slot. First\n * claim wins across groups, so a second one is a declaration bug rather than a\n * silent reassignment; the same group naming a layer twice — `['scene',\n * 'scene:tiles']` — is redundant, not a conflict, and passes quietly.\n */\nfunction groupMembership(\n groups: readonly LayerGroup[] | undefined,\n layerIds: Iterable<string>,\n): Map<string, LayerGroup> | null {\n if (!groups || groups.length === 0) return null;\n const stack = [...layerIds];\n const byLayer = new Map<string, LayerGroup>();\n for (const group of groups) {\n for (const name of group.layers) {\n let matched = false;\n for (const id of stack) {\n if (id !== name && !id.startsWith(`${name}:`)) continue;\n matched = true;\n const claimed = byLayer.get(id);\n if (claimed === group) continue;\n if (claimed) {\n console.warn(\n `[weasel] layer \"${id}\" is claimed by layer groups \"${claimed.id}\" and ` +\n `\"${group.id}\"; it stays in \"${claimed.id}\".`,\n );\n continue;\n }\n byLayer.set(id, group);\n }\n if (!matched) {\n console.warn(\n `[weasel] layer group \"${group.id}\" names \"${name}\", which matches no layer ` +\n 'being drawn, so it groups nothing. Check the id against the layer stack — a ' +\n 'scene with declared layers draws as \"scene:<layerId>\", which \"scene\" covers.',\n );\n }\n }\n }\n return byLayer;\n}\n\n/**\n * Put one run of a group's commands under its shared compositing.\n *\n * No transform: every member already carries its own space wrap, so a second\n * one here would apply the view twice to world layers and once to screen ones.\n * A group that composites plainly gets no wrapper at all — an extra group\n * command that changes nothing is still a push and a pop per frame.\n */\nfunction wrapGroup(\n group: LayerGroup,\n children: DrawCommand[],\n view: View,\n dims: Dims,\n): DrawCommand[] {\n const declared = typeof group.effects === 'function'\n ? group.effects(view, dims)\n : group.effects;\n const effects = declared && declared.length > 0 ? declared : undefined;\n if (!effects && group.alpha === undefined && group.colorMatrix === undefined) return children;\n return [{\n kind: 'group',\n ...(effects ? { effects } : {}),\n ...(group.alpha !== undefined ? { alpha: group.alpha } : {}),\n ...(group.colorMatrix !== undefined ? { colorMatrix: group.colorMatrix } : {}),\n children,\n }];\n}\n\n/**\n * Resolve one layer's visibility: `alwaysOn` wins, then an explicit entry in\n * `visibility`, then `defaultVisible`, defaulting to shown.\n */\nexport function isLayerVisible<TData>(\n layer: RenderLayer<TData>,\n visibility: Record<string, boolean>,\n): boolean {\n if (layer.alwaysOn) return true;\n if (layer.id in visibility) return visibility[layer.id]!;\n return layer.defaultVisible ?? true;\n}\n\n/**\n * Does this layer reach the screen at all — both gates, in the order\n * `drawLayers` applies them.\n *\n * **A listed `order` is the whole list**, so omission from it drops a layer\n * that `visibility` would have shown, and `alwaysOn` does not rescue it.\n * Hit-testing asks this, not `isLayerVisible`: a layer that is not painted\n * but still claims pointer events is a pointer landing on nothing the user\n * can see.\n */\nexport function isLayerPainted<TData>(\n layer: RenderLayer<TData>,\n visibility: Record<string, boolean>,\n order: string[] | undefined,\n): boolean {\n if (order && !order.includes(layer.id)) return false;\n return isLayerVisible(layer, visibility);\n}\n\n/**\n * Draw one layer and put its commands in the space its `space` declares:\n * world-space output wrapped in a `viewToMat3(view)` group, screen-space\n * output passed through.\n *\n * Anything rendering layers through a view — the canvas itself, a viewport\n * node's inner pass — goes through here. A second copy of this rule that\n * forgets the wrap draws world content at raw world coords, which looks\n * plausible at the identity view and wrong everywhere else.\n *\n * A `draw` that throws yields no commands, and `onLayerError` is told which\n * layer it was. The layer's cache entry goes with it, so the next frame is a\n * real re-attempt rather than a stale tree served under fresh deps.\n */\nexport function drawOneLayer<TData>(\n layer: RenderLayer<TData>,\n data: TData,\n view: View,\n dims: Dims,\n cache?: LayerCommandCache,\n onLayerError: (failure: LayerDrawFailure) => void = reportLayerFailure,\n): DrawCommand[] {\n let cmds: DrawCommand[];\n try {\n cmds = layerCommands(layer, data, view, dims, cache);\n } catch (error) {\n cache?.delete(layer.id);\n onLayerError({ layerId: layer.id, error });\n return [];\n }\n if (cmds.length === 0) return [];\n const effects = layer.effects && layer.effects.length > 0 ? layer.effects : undefined;\n if ((layer.space ?? 'world') === 'screen') {\n return effects ? [{ kind: 'group', effects, children: cmds }] : cmds;\n }\n return [{ kind: 'group', transform: viewToMat3(view), ...(effects ? { effects } : {}), children: cmds }];\n}\n\n/**\n * One layer's own commands, from cache when its deps are unchanged.\n *\n * What is cached is the layer's raw output, before the space wrap above. The\n * wrap is a function of `view`, and a layer whose content does not depend on\n * the camera is entitled to leave `view` out of its deps — caching the wrapped\n * group would then serve a stale transform the moment the camera moved.\n */\nfunction layerCommands<TData>(\n layer: RenderLayer<TData>,\n data: TData,\n view: View,\n dims: Dims,\n cache: LayerCommandCache | undefined,\n): DrawCommand[] {\n if (!cache || !layer.deps) return layer.draw(data, view, dims);\n\n const deps = layer.deps(data, view, dims);\n const entry = cache.get(layer.id);\n if (entry && depsUnchanged(entry.deps, deps)) return entry.cmds;\n\n const cmds = layer.draw(data, view, dims);\n cache.set(layer.id, { deps, cmds });\n return cmds;\n}\n\n/** Whether `b` matches `a` entry for entry under `Object.is` — how\n * `RenderLayer.deps` is compared, and any cache keyed the same way. */\nexport function depsUnchanged(a: readonly unknown[], b: readonly unknown[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return false;\n }\n return true;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getMarker as e } from "./strokeMarkers.js";
|
|
2
|
+
import { resolveScreenLength as t } from "@weasel-js/paint";
|
|
3
|
+
//#region src/core/markerInset.ts
|
|
4
|
+
function n(e, n, r = 1) {
|
|
5
|
+
return typeof e == "string" || e.size === void 0 ? n : t(e.size, r);
|
|
6
|
+
}
|
|
7
|
+
function r(e) {
|
|
8
|
+
return typeof e == "string" ? e : e.key;
|
|
9
|
+
}
|
|
10
|
+
function i(t, i, a = 1) {
|
|
11
|
+
if (t === void 0) return 0;
|
|
12
|
+
let o = e(r(t));
|
|
13
|
+
return o === void 0 ? 0 : (o.inset ?? 0) * n(t, i, a);
|
|
14
|
+
}
|
|
15
|
+
function a(e, t) {
|
|
16
|
+
return {
|
|
17
|
+
start: i(e.markerStart, t),
|
|
18
|
+
end: i(e.markerEnd, t)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as markerInset, r as markerKeyOf, n as resolveMarkerSize, a as strokeInsets };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=markerInset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markerInset.js","names":["resolveMarkerSize","ref","strokeWidth","resolveScreenLength","scale","markerKeyOf","markerInset","entry","getMarker","strokeInsets","stroke"],"sources":["../../src/core/markerInset.ts"],"sourcesContent":["/**\n * Resolving a `MarkerRef` to the distance the ribbon must stop short.\n *\n * The tessellation layer takes these as plain numbers and knows nothing about\n * the registry — keeping that layer free of upward dependencies is deliberate.\n * The ribbon cache, the SVG serializer and `inkReach` all resolve through here,\n * so the ribbon, the export and the hit region cannot disagree about where the\n * line ends.\n */\n\nimport { resolveScreenLength, type MarkerRef, type Stroke } from '@weasel-js/paint';\nimport { getMarker } from './strokeMarkers';\n\n/** The size of one marker unit, in the same world units as `strokeWidth`.\n * `scale` is the view scale a `{ px }` size resolves against, as a `{ px }`\n * stroke width does. */\nexport function resolveMarkerSize(ref: MarkerRef, strokeWidth: number, scale = 1): number {\n if (typeof ref === 'string' || ref.size === undefined) return strokeWidth;\n return resolveScreenLength(ref.size, scale);\n}\n\n/** The registry key a `MarkerRef` names, whether given bare or with a size. */\nexport function markerKeyOf(ref: MarkerRef): string {\n return typeof ref === 'string' ? ref : ref.key;\n}\n\n/**\n * How far back the ribbon stops for `ref`, in world units. Zero for an absent\n * marker, an unregistered key, or an open head — never throws, because an\n * unknown key is a data problem and dropping the head is the graceful answer.\n */\nexport function markerInset(ref: MarkerRef | undefined, strokeWidth: number, scale = 1): number {\n if (ref === undefined) return 0;\n const entry = getMarker(markerKeyOf(ref));\n if (entry === undefined) return 0;\n return (entry.inset ?? 0) * resolveMarkerSize(ref, strokeWidth, scale);\n}\n\n/** The start and end insets a stroke asks for. `markerMid` never insets —\n * trimming at an interior vertex would cut the line in two. */\nexport function strokeInsets(stroke: Stroke, strokeWidth: number): { start: number; end: number } {\n return {\n start: markerInset(stroke.markerStart, strokeWidth),\n end: markerInset(stroke.markerEnd, strokeWidth),\n };\n}\n"],"mappings":";;;AAgBA,SAAgBA,EAAkB,GAAgB,GAAqB,IAAQ,GAAW;CAExF,OADI,OAAOC,KAAQ,YAAYA,EAAI,SAAS,KAAA,IAAkBC,IACvDC,EAAoBF,EAAI,MAAMG,CAAK;AAC5C;AAGA,SAAgBC,EAAY,GAAwB;CAClD,OAAO,OAAOJ,KAAQ,WAAWA,IAAMA,EAAI;AAC7C;AAOA,SAAgBK,EAAY,GAA4B,GAAqB,IAAQ,GAAW;CAC9F,IAAIL,MAAQ,KAAA,GAAW,OAAO;CAC9B,IAAMM,IAAQC,EAAUH,EAAYJ,CAAG,CAAC;CAExC,OADIM,MAAU,KAAA,IAAkB,KACxBA,EAAM,SAAS,KAAKP,EAAkBC,GAAKC,GAAaE,CAAK;AACvE;AAIA,SAAgBK,EAAa,GAAgB,GAAqD;CAChG,OAAO;EACL,OAAOH,EAAYI,EAAO,aAAaR,CAAW;EAClD,KAAKI,EAAYI,EAAO,WAAWR,CAAW;CAChD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixed.js","names":["MIXED"],"sources":["../../src/core/mixed.ts"],"sourcesContent":["/**\n * The kit-wide \"these values disagree\" sentinel. Used wherever a value is\n * aggregated across more than one source and the sources don't agree — e.g.\n * a UI panel aggregating a property across a multi-node selection, or text\n * styling aggregated across the runs in a character range. One symbol, one\n * `isMixed` check, regardless of what's being aggregated.\n */\nexport const MIXED: unique symbol = Symbol('weasel:mixed');\n/** The type of {@link MIXED}. Property panels use it to say \"the selection\n * does not agree on this value\" without colliding with any real value. */\nexport type Mixed = typeof MIXED;\n"],"mappings":";AAOA,IAAaA,IAAuB,OAAO,cAAc"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { registerOpFactory as e } from "./registry.js";
|
|
2
|
+
//#region src/core/ops/arrange.ts
|
|
3
|
+
function t(e, n, r) {
|
|
4
|
+
let i = { ...e.placed ? { placed: e.placed } : {} };
|
|
5
|
+
return {
|
|
6
|
+
name: "arrange",
|
|
7
|
+
args: i,
|
|
8
|
+
label: "Arrange",
|
|
9
|
+
get coalesceKey() {
|
|
10
|
+
return i.placed === void 0 ? void 0 : `arrange:${i.placed.map((e) => e.id).sort().join(",")}`;
|
|
11
|
+
},
|
|
12
|
+
apply(e) {
|
|
13
|
+
i.placed === void 0 && (i.placed = n?.() ?? []);
|
|
14
|
+
let t = r ?? ((t, n) => e.setPose(t, n));
|
|
15
|
+
for (let e of i.placed) t(e.id, e.to);
|
|
16
|
+
return i.placed.length > 0 ? void 0 : "noop";
|
|
17
|
+
},
|
|
18
|
+
invert() {
|
|
19
|
+
return t({ placed: [...i.placed ?? []].reverse().map((e) => ({
|
|
20
|
+
id: e.id,
|
|
21
|
+
from: e.to,
|
|
22
|
+
to: e.from
|
|
23
|
+
})) }, void 0, r);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
e("arrange", (e) => t(e));
|
|
28
|
+
//#endregion
|
|
29
|
+
export { t as createArrangeOp };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=arrange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrange.js","names":["createArrangeOp","self","args","p","compute","set","write","adapter","id","pose","registerOpFactory"],"sources":["../../../src/core/ops/arrange.ts"],"sourcesContent":["import type { Op } from './types';\nimport { registerOpFactory } from './registry';\n\ninterface ArrangeAdapter {\n setPose(id: string, pose: unknown): void;\n}\n\n/** One pose write an {@link createArrangeOp} made. */\nexport interface ArrangedPose {\n id: string;\n from: unknown;\n to: unknown;\n}\n\n/** Arguments to {@link createArrangeOp}. */\nexport interface ArrangeArgs {\n /** The writes to make. Absent until a computed arrangement has run once. */\n placed?: ArrangedPose[];\n}\n\n/**\n * Op: write a set of poses decided when the op first applies, not when it is\n * built. The scene appends one to an edit that moves nodes into a container,\n * and `compute` asks the container what to do with them after the rest of\n * the edit has landed. Every later apply — redo, or a rebuild from a\n * serialized history — replays the writes it recorded, so the arrangement is\n * decided once. `write` replaces the adapter's `setPose` for this op and its\n * inverses — the scene passes its own, since not every adapter an edit is\n * applied through can write poses.\n */\nexport function createArrangeOp(\n args: ArrangeArgs,\n compute?: () => ArrangedPose[],\n write?: (id: string, pose: unknown) => void,\n): Op {\n const self: ArrangeArgs = { ...(args.placed ? { placed: args.placed } : {}) };\n return {\n name: 'arrange',\n args: self,\n label: 'Arrange',\n // Names what it moved, so a coalesced entry never undoes to a pose only\n // a later push wrote.\n get coalesceKey() {\n return self.placed === undefined ? undefined : `arrange:${self.placed.map((p) => p.id).sort().join(',')}`;\n },\n apply(adapter) {\n if (self.placed === undefined) self.placed = compute?.() ?? [];\n const set = write ?? ((id: string, pose: unknown) => (adapter as ArrangeAdapter).setPose(id, pose));\n for (const p of self.placed) set(p.id, p.to);\n return self.placed.length > 0 ? undefined : 'noop';\n },\n invert() {\n const placed = self.placed ?? [];\n return createArrangeOp({\n placed: [...placed].reverse().map((p) => ({ id: p.id, from: p.to, to: p.from })),\n }, undefined, write);\n },\n };\n}\n\nregisterOpFactory<ArrangeArgs>('arrange', (args) => createArrangeOp(args));\n"],"mappings":";;AA8BA,SAAgBA,EACd,GACA,GACA,GACI;CACJ,IAAMC,IAAoB,EAAE,GAAIC,EAAK,SAAS,EAAE,QAAQA,EAAK,OAAO,IAAI,CAAC,EAAG;CAC5E,OAAO;EACL,MAAM;EACN,MAAMD;EACN,OAAO;EAGP,IAAI,cAAc;GAChB,OAAOA,EAAK,WAAW,KAAA,IAAY,KAAA,IAAY,WAAWA,EAAK,OAAO,KAAK,MAAME,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EACxG;EACA,MAAM,GAAS;GACb,AAAIF,EAAK,WAAW,KAAA,MAAW,EAAK,SAASG,IAAU,KAAK,CAAC;GAC7D,IAAMC,IAAMC,OAAW,GAAY,MAAmBC,EAA2B,QAAQC,GAAIC,CAAI;GACjG,KAAK,IAAMN,KAAKF,EAAK,QAAQ,EAAIE,EAAE,IAAIA,EAAE,EAAE;GAC3C,OAAOF,EAAK,OAAO,SAAS,IAAI,KAAA,IAAY;EAC9C;EACA,SAAS;GAEP,OAAOD,EAAgB,EACrB,QAAQ,CAAC,GAFIC,EAAK,UAAU,CAAC,CAEX,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,OAAO;IAAE,IAAIE,EAAE;IAAI,MAAMA,EAAE;IAAI,IAAIA,EAAE;GAAK,EAAE,EACjF,GAAG,KAAA,GAAWG,CAAK;EACrB;CACF;AACF;AAEAI,EAA+B,YAAY,MAASV,EAAgBE,CAAI,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { registerOpFactory as e } from "./registry.js";
|
|
2
|
+
import { parentOf as t, resolveSlot as n, slotFromIndex as r } from "./slot.js";
|
|
3
|
+
import { createDeleteOp as i } from "./delete.js";
|
|
4
|
+
//#region src/core/ops/create.ts
|
|
5
|
+
function a(e) {
|
|
6
|
+
let { node: a, label: o } = e, s = e.slot ?? r(e.index);
|
|
7
|
+
return {
|
|
8
|
+
name: "insert",
|
|
9
|
+
args: {
|
|
10
|
+
node: a,
|
|
11
|
+
label: o,
|
|
12
|
+
slot: s
|
|
13
|
+
},
|
|
14
|
+
label: o,
|
|
15
|
+
apply(e) {
|
|
16
|
+
let r = e, i = t(a);
|
|
17
|
+
r.insertNode(a, n(r.getChildren?.(i), s));
|
|
18
|
+
},
|
|
19
|
+
invert() {
|
|
20
|
+
return i({
|
|
21
|
+
node: a,
|
|
22
|
+
label: o,
|
|
23
|
+
slot: s
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
e("insert", (e) => a(e));
|
|
29
|
+
//#endregion
|
|
30
|
+
export { a as createInsertOp };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","names":["createInsertOp","args","slot","slotFromIndex","a","adapter","parentId","parentOf","node","resolveSlot","createDeleteOp","registerOpFactory"],"sources":["../../../src/core/ops/create.ts"],"sourcesContent":["import type { Op } from './types';\nimport { createDeleteOp } from './delete';\nimport { registerOpFactory } from './registry';\nimport { parentOf, resolveSlot, slotFromIndex, type OrderedReader, type SiblingSlot } from './slot';\n\ninterface InsertAdapter<TNode> extends OrderedReader {\n /** When `index` is supplied, insert at that position; adapters that ignore\n * the second arg (or don't expose it) fall back to their default\n * placement (typically append-to-end). */\n insertNode(node: TNode, index?: number): void;\n}\n\n/** Type alias for ops produced by `createInsertOp`. Carries no extra type info today;\n * exists so consumers can name the op type when needed. */\nexport type InsertOp = Op;\n\n/** Arguments to {@link createInsertOp}: the node to insert and where among its siblings. */\nexport interface InsertArgs<TNode extends { id: string }> {\n node: TNode;\n label?: string;\n /** Sibling ordinal to insert at. Sugar for `slot: { index }` — the weaker\n * of the two forms, and all a fresh-insert callsite can know. */\n index?: number;\n /** Full slot, anchor included. Produced only by `captureSlot` (via a\n * delete op's `invert`), and supersedes `index` when present. */\n slot?: SiblingSlot;\n}\n\n/** Op: insert `node` into the scene; inverts to a delete of the same id. */\nexport function createInsertOp<TNode extends { id: string }>(args: InsertArgs<TNode>): InsertOp {\n const { node, label } = args;\n const slot: SiblingSlot = args.slot ?? slotFromIndex(args.index);\n return {\n name: 'insert',\n args: { node, label, slot },\n label,\n apply(adapter) {\n const a = adapter as InsertAdapter<TNode>;\n const parentId = parentOf(node);\n a.insertNode(node, resolveSlot(a.getChildren?.(parentId), slot));\n },\n invert() {\n return createDeleteOp({ node, label, slot });\n },\n };\n}\n\nregisterOpFactory<InsertArgs<{ id: string }>>('insert', (args) => createInsertOp(args));\n"],"mappings":";;;;AA6BA,SAAgBA,EAA6C,GAAmC;CAC9F,IAAM,EAAE,SAAM,aAAUC,GAClBC,IAAoBD,EAAK,QAAQE,EAAcF,EAAK,KAAK;CAC/D,OAAO;EACL,MAAM;EACN,MAAM;GAAE;GAAM;GAAO;EAAK;EAC1B;EACA,MAAM,GAAS;GACb,IAAMG,IAAIC,GACJC,IAAWC,EAASC,CAAI;GAC9B,EAAE,WAAWA,GAAMC,EAAYL,EAAE,cAAcE,CAAQ,GAAGJ,CAAI,CAAC;EACjE;EACA,SAAS;GACP,OAAOQ,EAAe;IAAE;IAAM;IAAO;GAAK,CAAC;EAC7C;CACF;AACF;AAEAC,EAA8C,WAAW,MAASX,EAAeC,CAAI,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { rebuildOp as e } from "./registry.js";
|
|
2
|
+
import { dlog as t, dwarn as n } from "../../debug/flag.js";
|
|
3
|
+
import { createHistory as r } from "@weasel-js/history";
|
|
4
|
+
//#region src/core/ops/createHistory.ts
|
|
5
|
+
var i = {
|
|
6
|
+
log: (e) => t("history", e),
|
|
7
|
+
warn: (e) => n("history", e)
|
|
8
|
+
};
|
|
9
|
+
function a(t, n = {}) {
|
|
10
|
+
let a = n.rebuildOp;
|
|
11
|
+
return r(t, {
|
|
12
|
+
debug: i,
|
|
13
|
+
...n,
|
|
14
|
+
rebuildOp: (t, n) => a?.(t, n) ?? e(t, n)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as createHistory };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=createHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHistory.js","names":["createHistory","createHistoryEngine","kitLogger","dlog","message","dwarn","createHistory$1","custom","options","createHistory","adapter","name","args","rebuildOp"],"sources":["../../../src/core/ops/createHistory.ts"],"sourcesContent":["import {\n createHistory as createHistoryEngine,\n type History,\n type CreateHistoryOptions,\n type HistoryLogger,\n} from '@weasel-js/history';\nimport { rebuildOp } from './registry';\nimport { dlog, dwarn } from '../../debug/flag';\n\n/** Routes the engine's diagnostics into the kit's `history` debug namespace,\n * so `localStorage.setItem('weasel.debug', '1')` still surfaces them. */\nconst kitLogger: HistoryLogger = {\n log: (message) => dlog('history', message),\n warn: (message) => dwarn('history', message),\n};\n\n/**\n * Build an op-batched undo/redo `History`, defaulting restore-time op\n * hydration to core's global op-factory registry and its diagnostics to the\n * kit's debug namespace.\n *\n * The engine in `@weasel-js/history` is registry-agnostic: it can only rebuild\n * a serialized `(name, args)` pair through the `rebuildOp` hook it is handed,\n * which is what lets that package build without depending on core. Core owns\n * the registry, so this wrapper supplies it — meaning `createHistory(adapter)`\n * with no options still restores kit-emitted ops, exactly as before.\n *\n * A caller-supplied `rebuildOp` wins; return `null` from it to fall through to\n * the registry.\n */\nexport function createHistory(adapter: unknown, options: CreateHistoryOptions = {}): History {\n const custom = options.rebuildOp;\n return createHistoryEngine(adapter, {\n debug: kitLogger,\n ...options,\n rebuildOp: (name, args) => custom?.(name, args) ?? rebuildOp(name, args),\n });\n}\n"],"mappings":";;;;AAWA,IAAME,IAA2B;CAC/B,MAAM,MAAYC,EAAK,WAAWC,CAAO;CACzC,OAAO,MAAYC,EAAM,WAAWD,CAAO;AAC7C;AAgBA,SAAgBJ,EAAc,GAAkB,IAAgC,CAAC,GAAY;CAC3F,IAAMO,IAASC,EAAQ;CACvB,OAAOP,EAAoBS,GAAS;EAClC,OAAOR;EACP,GAAGM;EACH,YAAY,GAAM,MAASD,IAASI,GAAMC,CAAI,KAAKC,EAAUF,GAAMC,CAAI;CACzE,CAAC;AACH"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { registerOpFactory as e } from "./registry.js";
|
|
2
|
+
import { captureSlot as t, parentOf as n, slotFromIndex as r } from "./slot.js";
|
|
3
|
+
import { createInsertOp as i } from "./create.js";
|
|
4
|
+
//#region src/core/ops/delete.ts
|
|
5
|
+
function a(e, t, n) {
|
|
6
|
+
return e.getChildren?.(t)?.indexOf(n) ?? -1;
|
|
7
|
+
}
|
|
8
|
+
function o(e, t) {
|
|
9
|
+
let { getChildren: r, getNode: i } = e;
|
|
10
|
+
if (!r || !i) return null;
|
|
11
|
+
let o = e.getRemovalClosure?.([t]), s = /* @__PURE__ */ new Map();
|
|
12
|
+
if (o) for (let t of o) {
|
|
13
|
+
let n = i.call(e, t);
|
|
14
|
+
n && s.set(t, n);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
let n = (t) => {
|
|
18
|
+
let a = i.call(e, t);
|
|
19
|
+
if (a) {
|
|
20
|
+
s.set(t, a);
|
|
21
|
+
for (let i of r.call(e, t)) n(i);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
n(t);
|
|
25
|
+
}
|
|
26
|
+
let c = [...s.values()].filter((e) => {
|
|
27
|
+
let t = n(e);
|
|
28
|
+
return t === null || !s.has(t);
|
|
29
|
+
}).map((t) => ({
|
|
30
|
+
node: t,
|
|
31
|
+
index: a(e, n(t), t.id)
|
|
32
|
+
})).sort((e, t) => e.index - t.index), l = [], u = (t) => {
|
|
33
|
+
l.push(t);
|
|
34
|
+
let n = r.call(e, t.node.id);
|
|
35
|
+
for (let e = 0; e < n.length; e++) {
|
|
36
|
+
let t = s.get(n[e]);
|
|
37
|
+
t && u({
|
|
38
|
+
node: t,
|
|
39
|
+
index: e
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
for (let e of c) u(e);
|
|
44
|
+
return l;
|
|
45
|
+
}
|
|
46
|
+
function s(e) {
|
|
47
|
+
let { node: a, label: c } = e, l = e.slot ?? r(e.index), u = {
|
|
48
|
+
node: a,
|
|
49
|
+
label: c,
|
|
50
|
+
slot: l,
|
|
51
|
+
cascaded: e.cascaded
|
|
52
|
+
}, d = e.cascaded ?? [];
|
|
53
|
+
return {
|
|
54
|
+
name: "delete",
|
|
55
|
+
args: u,
|
|
56
|
+
label: c,
|
|
57
|
+
apply(e) {
|
|
58
|
+
let r = e, i = t(r, n(a), a.id);
|
|
59
|
+
i && (l = i, u.slot = i);
|
|
60
|
+
let s = o(r, a.id);
|
|
61
|
+
s && (d = s, u.cascaded = s), r.removeNode(a.id);
|
|
62
|
+
},
|
|
63
|
+
invert() {
|
|
64
|
+
let e = d, t = l, n = i({
|
|
65
|
+
node: a,
|
|
66
|
+
label: c,
|
|
67
|
+
slot: t
|
|
68
|
+
});
|
|
69
|
+
return e.length === 0 ? n : {
|
|
70
|
+
label: c,
|
|
71
|
+
apply(t) {
|
|
72
|
+
let r = t;
|
|
73
|
+
for (let i of e) r.getNode?.(i.node.id) || (i.node.id === a.id ? n.apply(t) : r.insertNode(i.node, i.index));
|
|
74
|
+
},
|
|
75
|
+
invert: () => s({
|
|
76
|
+
node: a,
|
|
77
|
+
label: c,
|
|
78
|
+
slot: t,
|
|
79
|
+
cascaded: e
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
e("delete", (e) => s(e));
|
|
86
|
+
//#endregion
|
|
87
|
+
export { s as createDeleteOp };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=delete.js.map
|