@weasel-js/core 1.6.1 → 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 +1006 -0
- package/README.md +28 -9
- 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-HWyuLzE-.d.ts → builtins-BSUfH8nU.d.ts} +1301 -508
- 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-7mCcm6qG.d.ts → cornerHandles-CDcZOV8h.d.ts} +54 -71
- 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 -86
- package/dist/index.d.ts +2349 -2609
- 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 -48
- 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 +18 -20
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.d.ts +1 -1
- 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-CxC8P6W0.d.ts → types-CA54-mAZ.d.ts} +188 -17
- package/dist/{types-D_74YlWs.d.ts → types-DSjd6W3n.d.ts} +35 -12
- package/dist/util/color.js +26 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/constrainTo45.js +17 -0
- package/dist/util/constrainTo45.js.map +1 -0
- package/dist/util/paint.js +72 -0
- package/dist/util/paint.js.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -18
- package/dist/chunk-44EWMJV2.js +0 -128
- package/dist/chunk-44EWMJV2.js.map +0 -1
- package/dist/chunk-4RJP2N2L.js +0 -143
- package/dist/chunk-4RJP2N2L.js.map +0 -1
- package/dist/chunk-BJN5ZRIJ.js +0 -167
- package/dist/chunk-BJN5ZRIJ.js.map +0 -1
- package/dist/chunk-D4AAWR64.js +0 -28
- package/dist/chunk-D4AAWR64.js.map +0 -1
- package/dist/chunk-DOBSZOPR.js +0 -29
- package/dist/chunk-DOBSZOPR.js.map +0 -1
- package/dist/chunk-H6N2JSZ3.js +0 -248
- package/dist/chunk-H6N2JSZ3.js.map +0 -1
- package/dist/chunk-HPFJUUTF.js +0 -167
- package/dist/chunk-HPFJUUTF.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-MZAIDI6D.js +0 -32492
- package/dist/chunk-MZAIDI6D.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-RMR4QMM6.js +0 -250
- package/dist/chunk-RMR4QMM6.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-BXdz8GF2.d.ts +0 -158
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -37
- 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/options-CzjxFoYZ.d.ts +0 -67
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -86
- 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,37 @@
|
|
|
1
|
+
//#region src/core/ops/slot.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
let r = e.getChildren?.(t);
|
|
4
|
+
if (!r) return null;
|
|
5
|
+
let i = r.indexOf(n);
|
|
6
|
+
return i < 0 ? null : {
|
|
7
|
+
index: i,
|
|
8
|
+
before: i + 1 < r.length ? r[i + 1] : null
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function t(e, t) {
|
|
12
|
+
if (t.before !== null) {
|
|
13
|
+
if (t.before !== void 0 && e) {
|
|
14
|
+
let n = e.indexOf(t.before);
|
|
15
|
+
if (n >= 0) return n;
|
|
16
|
+
}
|
|
17
|
+
return t.index >= 0 ? t.index : void 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function n(e, t) {
|
|
21
|
+
if (!e.getChildren) return null;
|
|
22
|
+
let n = e.getParent ? e.getParent(t) : null, r = e.getChildren(n).indexOf(t);
|
|
23
|
+
return r < 0 ? null : {
|
|
24
|
+
parentId: n,
|
|
25
|
+
index: r
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function r(e) {
|
|
29
|
+
return { index: e ?? -1 };
|
|
30
|
+
}
|
|
31
|
+
function i(e) {
|
|
32
|
+
return e.parent ?? null;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { e as captureSlot, n as locateChild, i as parentOf, t as resolveSlot, r as slotFromIndex };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.js","names":["captureSlot","siblings","a","parentId","id","resolveSlot","slot","at","locateChild","index","slotFromIndex","parentOf","node"],"sources":["../../../src/core/ops/slot.ts"],"sourcesContent":["/** Sibling-order read seam. Optional everywhere: a flat adapter has none. */\nexport interface OrderedReader {\n getChildren?(parentId: string | null): string[];\n}\n\n/**\n * A node's position among its siblings, recorded so an op can put it back.\n *\n * Recorded as an anchor (`before`) plus an ordinal (`index`). The anchor is\n * the source of truth: `History` replays a batch's inverses in reverse order,\n * so an ordinal captured before the mutation is replayed against a list that\n * has not been refilled yet and clamps to the end, while \"put this back before\n * `e`\" stays true however much else has already moved. The ordinal is the\n * fallback for the cases the anchor cannot cover — an adapter with no\n * `getChildren` seam, or an anchor that is itself gone by replay time.\n */\nexport interface SiblingSlot {\n /** Ordinal among the siblings. `-1` means \"nowhere in particular\". */\n index: number;\n /** Id of the sibling that followed at capture time; `null` when the node\n * was last. Absent when nothing observed it — `null` survives JSON and\n * `undefined` does not, so the two stay distinguishable across a\n * serialize/restore round trip. */\n before?: string | null;\n}\n\n/** Observe `id`'s slot among `parentId`'s children. `null` when the adapter\n * has no ordering seam or `id` isn't there — callers keep whatever weaker\n * slot they already had rather than overwriting it with a guess. */\nexport function captureSlot(\n a: OrderedReader,\n parentId: string | null,\n id: string,\n): SiblingSlot | null {\n const siblings = a.getChildren?.(parentId);\n if (!siblings) return null;\n const i = siblings.indexOf(id);\n if (i < 0) return null;\n return { index: i, before: i + 1 < siblings.length ? siblings[i + 1]! : null };\n}\n\n/**\n * Index `slot` denotes in `siblings`, which must NOT contain the node being\n * placed. `undefined` means \"no position\" — the caller appends, or lets the\n * adapter's default placement stand.\n */\nexport function resolveSlot(\n siblings: readonly string[] | undefined,\n slot: SiblingSlot,\n): number | undefined {\n if (slot.before === null) return undefined;\n if (slot.before !== undefined && siblings) {\n const at = siblings.indexOf(slot.before);\n if (at >= 0) return at;\n }\n return slot.index >= 0 ? slot.index : undefined;\n}\n\n/** The reads that locate a live node: its parent, and that parent's children. */\nexport interface ParentedReader {\n getParent?(id: string): string | null;\n getChildren?(parentId: string | null): readonly string[];\n}\n\n/** A node's parent (`null` at the top level) and its ordinal among that\n * parent's children — the position a replacement takes to keep its z-order. */\nexport interface ChildPosition {\n parentId: string | null;\n index: number;\n}\n\n/** Where `id` sits under its parent. An adapter with no `getParent` is flat,\n * as the reorder ops read it. `null` when there is no `getChildren` or it\n * does not list `id`. */\nexport function locateChild(a: ParentedReader, id: string): ChildPosition | null {\n if (!a.getChildren) return null;\n const parentId = a.getParent ? a.getParent(id) : null;\n const index = a.getChildren(parentId).indexOf(id);\n return index < 0 ? null : { parentId, index };\n}\n\n/** Normalize the `index` sugar every op factory accepts into a slot. */\nexport function slotFromIndex(index: number | undefined): SiblingSlot {\n return { index: index ?? -1 };\n}\n\n/** The parent a node claims. Nodes in a flat adapter have none. */\nexport function parentOf(node: object): string | null {\n return ((node as { parent?: unknown }).parent ?? null) as string | null;\n}\n"],"mappings":";AA6BA,SAAgBA,EACd,GACA,GACA,GACoB;CACpB,IAAMC,IAAWC,EAAE,cAAcC,CAAQ;CACzC,IAAI,CAACF,GAAU,OAAO;CACtB,IAAM,IAAIA,EAAS,QAAQG,CAAE;CAE7B,OADI,IAAI,IAAU,OACX;EAAE,OAAO;EAAG,QAAQ,IAAI,IAAIH,EAAS,SAASA,EAAS,IAAI,KAAM;CAAK;AAC/E;AAOA,SAAgBI,EACd,GACA,GACoB;CACpB,IAAIC,EAAK,WAAW,MACpB;MAAIA,EAAK,WAAW,KAAA,KAAaL,GAAU;GACzC,IAAMM,IAAKN,EAAS,QAAQK,EAAK,MAAM;GACvC,IAAIC,KAAM,GAAG,OAAOA;EACtB;EACA,OAAOD,EAAK,SAAS,IAAIA,EAAK,QAAQ,KAAA;CADtC;AAEF;AAkBA,SAAgBE,EAAY,GAAmB,GAAkC;CAC/E,IAAI,CAACN,EAAE,aAAa,OAAO;CAC3B,IAAMC,IAAWD,EAAE,YAAYA,EAAE,UAAUE,CAAE,IAAI,MAC3CK,IAAQP,EAAE,YAAYC,CAAQ,CAAC,CAAC,QAAQC,CAAE;CAChD,OAAOK,IAAQ,IAAI,OAAO;EAAE;EAAU;CAAM;AAC9C;AAGA,SAAgBC,EAAc,GAAwC;CACpE,OAAO,EAAE,OAAOD,KAAS,GAAG;AAC9B;AAGA,SAAgBE,EAAS,GAA6B;CACpD,OAASC,EAA8B,UAAU;AACnD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { registerOpFactory as e } from "./registry.js";
|
|
2
|
+
//#region src/core/ops/transform.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
let { id: r, from: i, to: a, label: o, coalesceKey: s = `transform:${r}` } = e;
|
|
5
|
+
return {
|
|
6
|
+
name: "transform",
|
|
7
|
+
args: {
|
|
8
|
+
id: r,
|
|
9
|
+
from: i,
|
|
10
|
+
to: a,
|
|
11
|
+
label: o,
|
|
12
|
+
coalesceKey: s
|
|
13
|
+
},
|
|
14
|
+
label: o,
|
|
15
|
+
coalesceKey: s,
|
|
16
|
+
apply(e) {
|
|
17
|
+
if (e.setPose(r, a), n(i, a)) return !1;
|
|
18
|
+
},
|
|
19
|
+
invert() {
|
|
20
|
+
return t({
|
|
21
|
+
id: r,
|
|
22
|
+
from: a,
|
|
23
|
+
to: i,
|
|
24
|
+
label: o,
|
|
25
|
+
coalesceKey: s
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
e("transform", (e) => t(e));
|
|
31
|
+
function n(e, t) {
|
|
32
|
+
if (e === t) return !0;
|
|
33
|
+
if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
|
|
34
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
35
|
+
if (n.length !== r.length) return !1;
|
|
36
|
+
for (let r of n) if (e[r] !== t[r]) return !1;
|
|
37
|
+
return !0;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { t as createTransformOp };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","names":["createTransformOp","id","args","adapter","to","poseShallowEqual","from","registerOpFactory","a","b","ka","kb","k"],"sources":["../../../src/core/ops/transform.ts"],"sourcesContent":["import type { Op } from './types';\nimport { registerOpFactory } from './registry';\n\ninterface TransformAdapter<TPose> {\n setPose(id: string, pose: TPose): void;\n}\n\n/** Arguments to {@link createTransformOp}: replace node `id`'s pose `from` → `to`. */\nexport interface TransformArgs<TPose> {\n id: string;\n from: TPose;\n to: TPose;\n label?: string;\n coalesceKey?: string;\n}\n\n/** Op: set an object's pose, inverting back to `from`. `coalesceKey` defaults to\n * `transform:${id}` so successive pose writes to the same node (drag-move,\n * resize, repeated nudges) merge into one undo entry within the history's\n * coalesce window. Pass an explicit key (or a unique one) to opt out. */\nexport function createTransformOp<TPose>(args: TransformArgs<TPose>): Op {\n const { id, from, to, label, coalesceKey = `transform:${id}` } = args;\n return {\n name: 'transform',\n args: { id, from, to, label, coalesceKey },\n label,\n coalesceKey,\n apply(adapter) {\n // Always call setPose so consumers that inspect op behavior (tests,\n // overlays) see a consistent \"this op writes (id, to)\" signal. When\n // from and to are structurally identical, additionally report a\n // no-op to history so the entry can be skipped from the undo stack.\n // setPose(id, to) is idempotent in this branch — adapters write the\n // same pose they already had.\n (adapter as TransformAdapter<TPose>).setPose(id, to);\n if (poseShallowEqual(from, to)) return false;\n return undefined;\n },\n invert() {\n return createTransformOp<TPose>({ id, from: to, to: from, label, coalesceKey });\n },\n };\n}\n\nregisterOpFactory<TransformArgs<unknown>>('transform', (args) => createTransformOp(args));\n\nfunction poseShallowEqual<TPose>(a: TPose, b: TPose): boolean {\n if (a === b) return true;\n if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') return false;\n const ka = Object.keys(a as object);\n const kb = Object.keys(b as object);\n if (ka.length !== kb.length) return false;\n for (const k of ka) {\n if ((a as Record<string, unknown>)[k] !== (b as Record<string, unknown>)[k]) return false;\n }\n return true;\n}\n"],"mappings":";;AAoBA,SAAgBA,EAAyB,GAAgC;CACvE,IAAM,EAAE,OAAI,SAAM,OAAI,UAAO,iBAAc,aAAaC,QAASC;CACjE,OAAO;EACL,MAAM;EACN,MAAM;GAAE;GAAI;GAAM;GAAI;GAAO;EAAY;EACzC;EACA;EACA,MAAM,GAAS;GAQb,IADAC,EAAqC,QAAQF,GAAIG,CAAE,GAC/CC,EAAiBC,GAAMF,CAAE,GAAG,OAAO;EAEzC;EACA,SAAS;GACP,OAAOJ,EAAyB;IAAE;IAAI,MAAMI;IAAI,IAAIE;IAAM;IAAO;GAAY,CAAC;EAChF;CACF;AACF;AAEAC,EAA0C,cAAc,MAASP,EAAkBE,CAAI,CAAC;AAExF,SAASG,EAAwB,GAAU,GAAmB;CAC5D,IAAIG,MAAMC,GAAG,OAAO;CACpB,IAAID,MAAM,QAAQC,MAAM,QAAQ,OAAOD,KAAM,YAAY,OAAOC,KAAM,UAAU,OAAO;CACvF,IAAMC,IAAK,OAAO,KAAKF,CAAW,GAC5BG,IAAK,OAAO,KAAKF,CAAW;CAClC,IAAIC,EAAG,WAAWC,EAAG,QAAQ,OAAO;CACpC,KAAK,IAAMC,KAAKF,GACd,IAAKF,EAA8BI,OAAQH,EAA8BG,IAAI,OAAO;CAEtF,OAAO;AACT"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { gradientForBounds as e, isGradientFill as t, withGradientKind as n } from "./gradient.js";
|
|
2
|
+
import { bumpNodeMemoGeneration as r } from "./scene/nodeMemo.js";
|
|
3
|
+
import { getProgramSource as i, registerProgram as a } from "../renderer/shaders/registerProgram.js";
|
|
4
|
+
import { createReflectable as o } from "@weasel-js/registry";
|
|
5
|
+
//#region src/core/paintKinds.ts
|
|
6
|
+
var s = [
|
|
7
|
+
{
|
|
8
|
+
id: "solid",
|
|
9
|
+
label: "Solid",
|
|
10
|
+
icon: "paintSolid",
|
|
11
|
+
seed: (e) => ({ color: e }),
|
|
12
|
+
colorOf: (e) => (e.fill ?? "solid") === "solid" ? e.color : void 0
|
|
13
|
+
},
|
|
14
|
+
c("linear-gradient", "Linear", "paintLinear"),
|
|
15
|
+
c("radial-gradient", "Radial", "paintRadial"),
|
|
16
|
+
c("conic-gradient", "Conic", "paintConic"),
|
|
17
|
+
{
|
|
18
|
+
id: "pattern",
|
|
19
|
+
label: "Pattern",
|
|
20
|
+
icon: "paintPattern",
|
|
21
|
+
seed: (e) => ({
|
|
22
|
+
fill: "pattern",
|
|
23
|
+
pattern: {
|
|
24
|
+
tile: "hatch",
|
|
25
|
+
color: e
|
|
26
|
+
},
|
|
27
|
+
units: "bounds"
|
|
28
|
+
}),
|
|
29
|
+
colorOf: (e) => e.fill === "pattern" ? e.pattern.color : void 0
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
function c(t, n, r) {
|
|
33
|
+
return {
|
|
34
|
+
id: t,
|
|
35
|
+
label: n,
|
|
36
|
+
icon: r,
|
|
37
|
+
seed: (n) => e(t, l, u(n), "bounds"),
|
|
38
|
+
colorOf: (e) => e.stops?.[0]?.color,
|
|
39
|
+
stopsOf: (e) => e.stops,
|
|
40
|
+
fromStops: (n) => e(t, l, n, "bounds")
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var l = {
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0,
|
|
46
|
+
width: 1,
|
|
47
|
+
height: 1
|
|
48
|
+
};
|
|
49
|
+
function u(e) {
|
|
50
|
+
let t = e.slice(0, 7).toLowerCase() === "#ffffff";
|
|
51
|
+
return [{
|
|
52
|
+
offset: 0,
|
|
53
|
+
color: e
|
|
54
|
+
}, {
|
|
55
|
+
offset: 1,
|
|
56
|
+
color: t ? "#000000ff" : "#ffffffff"
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
59
|
+
var d = o();
|
|
60
|
+
function f() {
|
|
61
|
+
for (let e of s) d.push(e.id, e, { source: "kit" });
|
|
62
|
+
}
|
|
63
|
+
f(), d.subscribe(r);
|
|
64
|
+
var p = d.reflection;
|
|
65
|
+
function m(e) {
|
|
66
|
+
return e;
|
|
67
|
+
}
|
|
68
|
+
function h(e) {
|
|
69
|
+
if (e.stopsOf === void 0 != (e.fromStops === void 0)) {
|
|
70
|
+
let t = e.stopsOf === void 0 ? "stopsOf" : "fromStops";
|
|
71
|
+
throw Error(`weasel registerPaintKind: kind "${e.id}" is missing ${t}. A gradient kind reads as a stop list and builds from one; supply both or neither.`);
|
|
72
|
+
}
|
|
73
|
+
if (e.inPoseFrame === void 0 != (e.toBoundsFrame === void 0)) {
|
|
74
|
+
let t = e.inPoseFrame === void 0 ? "inPoseFrame" : "toBoundsFrame";
|
|
75
|
+
throw Error(`weasel registerPaintKind: kind "${e.id}" is missing ${t}. A kind that converts one frame direction and not the other drifts on the next resize; supply both or neither.`);
|
|
76
|
+
}
|
|
77
|
+
for (let [t, n] of Object.entries(e.programs ?? {})) {
|
|
78
|
+
let e = i(t);
|
|
79
|
+
(!e || e.vert !== n.vert || e.frag !== n.frag) && a(t, n.vert, n.frag);
|
|
80
|
+
}
|
|
81
|
+
return d.push(e.id, e);
|
|
82
|
+
}
|
|
83
|
+
function g(e) {
|
|
84
|
+
let t = e ?? "solid", n = d.get(t);
|
|
85
|
+
return !n && _.has(t) && S(t).catch(() => {}), n;
|
|
86
|
+
}
|
|
87
|
+
var _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), y = [["mesh-gradient", async () => (await import("../features/meshPaint/lazyKind.js")).meshGradientKind]];
|
|
88
|
+
function b() {
|
|
89
|
+
_.clear(), v.clear();
|
|
90
|
+
for (let [e, t] of y) _.set(e, t);
|
|
91
|
+
}
|
|
92
|
+
b();
|
|
93
|
+
function x(e, t) {
|
|
94
|
+
return _.set(e, t), () => {
|
|
95
|
+
_.get(e) === t && _.delete(e);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function S(e) {
|
|
99
|
+
let t = v.get(e);
|
|
100
|
+
if (t) return t;
|
|
101
|
+
let n = _.get(e)().then((t) => {
|
|
102
|
+
if (t.id !== e) throw Error(`weasel: the loader for paint kind "${e}" resolved to "${t.id}".`);
|
|
103
|
+
d.has(e) || h(t);
|
|
104
|
+
}).catch((t) => {
|
|
105
|
+
throw console.error(`weasel: paint kind "${e}" failed to load:`, t), t;
|
|
106
|
+
});
|
|
107
|
+
return v.set(e, n), n;
|
|
108
|
+
}
|
|
109
|
+
function C(e) {
|
|
110
|
+
return d.has(e) || _.has(e);
|
|
111
|
+
}
|
|
112
|
+
function w(e) {
|
|
113
|
+
let t = e ?? [..._.keys()], n = [];
|
|
114
|
+
for (let e of t) if (!d.has(e)) {
|
|
115
|
+
if (!_.has(e)) return Promise.reject(/* @__PURE__ */ Error(`weasel warmPaintKinds: "${e}" is neither registered nor loadable.`));
|
|
116
|
+
n.push(S(e));
|
|
117
|
+
}
|
|
118
|
+
return Promise.all(n).then(() => void 0);
|
|
119
|
+
}
|
|
120
|
+
function T(e) {
|
|
121
|
+
let t, n = [];
|
|
122
|
+
return () => {
|
|
123
|
+
let r = d.entries();
|
|
124
|
+
return r !== t && (t = r, n = Object.freeze(e(r))), n;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function E() {
|
|
128
|
+
return D();
|
|
129
|
+
}
|
|
130
|
+
var D = T((e) => e.map((e) => e.value));
|
|
131
|
+
function O() {
|
|
132
|
+
return k();
|
|
133
|
+
}
|
|
134
|
+
var k = T((e) => e.map((e) => e.value).filter((e) => e.stopsOf && e.fromStops));
|
|
135
|
+
function A(e, r) {
|
|
136
|
+
let i = j(e), a = g(r);
|
|
137
|
+
if (!i?.stopsOf || !a?.fromStops) return;
|
|
138
|
+
if (i.id === a.id) return e;
|
|
139
|
+
if (t(e) && t({ fill: r })) return n(e, r);
|
|
140
|
+
let { interpolate: o, opacity: s } = e;
|
|
141
|
+
return {
|
|
142
|
+
...a.fromStops(i.stopsOf(e)),
|
|
143
|
+
...o === void 0 ? {} : { interpolate: o },
|
|
144
|
+
...s === void 0 ? {} : { opacity: s }
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function j(e) {
|
|
148
|
+
return g(e.fill ?? "solid");
|
|
149
|
+
}
|
|
150
|
+
function M() {
|
|
151
|
+
d.clear(), f(), b();
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { M as _resetPaintKindsForTests, m as asPaint, g as getPaintKind, C as isPaintKindKnown, O as listGradientKinds, E as listPaintKinds, j as paintKindOf, p as paintKindRegistry, h as registerPaintKind, x as registerPaintKindLoader, A as switchGradientKind, w as warmPaintKinds };
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=paintKinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paintKinds.js","names":["BUILTINS","paint","gradientKind","gradientForBounds","id","UNIT_BOX","twoStopRamp","color","stops","isWhite","KINDS","createReflectable","seedBuiltins","entry","bumpNodeMemoGeneration","paintKindRegistry","asPaint","registerPaintKind","missing","src","have","getProgramSource","registerProgram","getPaintKind","kind","LOADERS","startLoad","LOADS","LAZY_BUILTINS","seedLoaders","load","registerPaintKindLoader","running","done","err","isPaintKindKnown","warmPaintKinds","ids","kinds","loads","derivedList","from","list","entries","derive","listPaintKinds","allKinds","all","listGradientKinds","gradientKinds","switchGradientKind","paintKindOf","to","isGradientFill","withGradientKind","interpolate","opacity","fill","_resetPaintKindsForTests"],"sources":["../../src/core/paintKinds.ts"],"sourcesContent":["/**\n * The paint-kind registry — what makes `FillStyle` open.\n *\n * A consumer registers a sixth kind and it renders, converts between the\n * bounds and pose frames, and serializes, with no kit edits. The five built-in\n * kinds are registered here at module load so an editor's kind bar can\n * enumerate every kind through one list.\n *\n * Each kit layer consults this registry for a kind it does not recognize and\n * otherwise runs its own built-in branch. That split is not laziness: a built-in\n * kind's render slot lives in the GL renderer, its serialize slot lives in\n * `@weasel-js/svg`, and neither can be imported from here without inverting a\n * package dependency.\n */\n\nimport type {\n ColorSpace, FillStyle, GradientFill, GradientKind, GradientUnits, GradStop, TilePatternSpec,\n} from '@weasel-js/paint';\nimport { gradientForBounds, isGradientFill, withGradientKind } from './gradient';\nimport { bumpNodeMemoGeneration } from './scene/nodeMemo';\nimport type { ComponentType } from 'react';\nimport { createReflectable, type ReflectedEntry, type Reflection } from '@weasel-js/registry';\nimport type { FillPoseBox } from './fillInPoseFrame';\nimport type { GlMat3 } from '../renderer/math/mat3';\nimport type { ShaderProgram } from '../renderer/shaders/ShaderProgram';\nimport { getProgramSource, registerProgram, type ProgramSource } from '../renderer/shaders/registerProgram';\n\n/** A compiled GL program. A paint kind gets one from\n * {@link PaintBindContext.program} and hands it back from `bind`. */\nexport type PaintProgram = ShaderProgram;\n\n/**\n * `FillStyle`'s discriminant, open on the string the way `ChromeId` is: the\n * five kinds the kit ships, plus whatever a consumer registers.\n */\nexport type PaintKind = 'solid' | 'linear-gradient' | 'radial-gradient' | 'conic-gradient' | 'pattern' | (string & {});\n\n/** What a registered kind's editor renders. `PaintInput` in `@weasel-js/ui`\n * is the control that mounts it. */\nexport interface PaintKindEditorProps {\n value: FillStyle;\n onInput?(next: FillStyle): void;\n onChange(next: FillStyle): void;\n}\n\n/**\n * The lifetime a paint kind's GPU state belongs to: one renderer on one live\n * context. The object itself is the key — a kind caches textures in a\n * `WeakMap` on it, so two renderers sharing a context never trade them — and\n * `onRelease` is where it frees them.\n */\nexport interface PaintResources {\n /** Run `release` once, when this lifetime ends: the renderer is disposed, or\n * its context was lost and restored. Free every GL object made under it\n * there. */\n onRelease(release: () => void): void;\n}\n\n/**\n * The renderer surface a paint kind binds against, narrowed to what a paint\n * needs. The full `DrawContext` is not consumer surface.\n */\nexport interface PaintBindContext {\n readonly gl: WebGL2RenderingContext;\n /** The group alpha this draw inherits — multiply it into the paint's own. */\n readonly alpha: number;\n /**\n * The compiled program for a `registerProgram` id, compiled against this\n * renderer on first use. `null` when no source is registered under `id` or\n * compilation failed.\n */\n program(id: string): PaintProgram | null;\n /** Send `u_proj` and `u_model`, which every kit vertex shader takes. */\n setProjAndModel(program: PaintProgram): void;\n /**\n * `u_worldInv` for a paint declaring `units` — the inverse of the transform\n * from the paint's space to the frame the geometry arrives in. Paired with\n * the vertex shader's `v_world` varying this is *the* paint-space\n * convention; it is not gradient-specific.\n *\n * `null` when that space has no inverse — a transform or view that flattens\n * an axis. Nothing the paint draws there means anything, so `bind` should\n * return `null` and draw nothing.\n */\n spaceInverse(units: GradientUnits | undefined): GlMat3 | null;\n /**\n * The transform from the space `units` names to device pixels of the target\n * this draw lands in — screen pixels times the pixel ratio on screen, output\n * pixels in a headless render. It is what a paint baking a texture measures\n * its resolution against. `null` where `spaceInverse` is.\n */\n spaceToDevice(units: GradientUnits | undefined): GlMat3 | null;\n /** The largest texture side this context accepts, `MAX_TEXTURE_SIZE`. */\n readonly maxTextureSize: number;\n /** The lifetime GPU state made for this draw belongs to. Stable across the\n * frames of one renderer, so it is the key for a kind's texture cache. */\n readonly resources: PaintResources;\n /**\n * Bake a stop ramp into the frame's ramp atlas, bind that atlas to a texture\n * unit, and return the `v` the ramp's own row sits at — every ramp in a\n * frame shares one texture, so a paint must sample at the returned `v` and\n * not at a constant.\n *\n * `space` is the blend the stops are baked through, defaulting to `'rgb'`.\n * It is part of the atlas key, so the same stops under two spaces take two\n * rows rather than colliding.\n */\n bindRamp(stops: GradStop[], unit: number, space?: ColorSpace): number;\n}\n\n/**\n * One paint kind.\n *\n * `seed`, `label` and `colorOf` are the editor's slots and every kind has\n * them. The rest are optional because a kind may not need them — but\n * `inPoseFrame` and `toBoundsFrame` come as a pair or not at all: a kind that\n * converts one direction and not the other paints correctly once and then\n * drifts on the next resize.\n */\nexport interface PaintKindEntry {\n id: string;\n label: string;\n /** Glyph naming this kind in an editor's kind bar, as an icon name the UI\n * layer resolves — the same indirection `ToolPrefBase.icon` uses. A kind\n * without one is named by its `label`. */\n icon?: string;\n /** A paint of this kind seeded from a color — what an editor writes when a\n * consumer switches a solid to this kind. */\n seed(fromColor: string): FillStyle;\n /** The single color this paint shows, or `undefined` when it has none. */\n colorOf(paint: FillStyle): string | undefined;\n /** Editor slot. */\n Editor?: ComponentType<PaintKindEditorProps>;\n /**\n * The stop list this paint reads as. With `fromStops`, it is what makes a\n * kind a gradient: `listGradientKinds` returns the kinds carrying both, and\n * `switchGradientKind` converts between any two of them through the list.\n */\n stopsOf?(paint: FillStyle): GradStop[];\n /** A paint of this kind built from a stop list, in `bounds` units. The\n * converse of `stopsOf`; supply both or neither. */\n fromStops?(stops: GradStop[]): FillStyle;\n /**\n * Render slot: bind program, uniforms and textures for `fill` and return the\n * bound program; `null` declines the paint.\n *\n * Binding is split from drawing on purpose — a caller owning its own stencil\n * state (an inner/outer-aligned stroke, an even-odd fill) must issue its own\n * draw call, and the kit's draw wrapper would clobber that state. Shader\n * output must be premultiplied: `outColor = vec4(rgb * a, a)`.\n *\n * The geometry is not always the node's own. Text below the outline tier\n * paints by drawing a quad over its glyphs' screen box into an offscreen\n * buffer and masking that with glyph coverage, so a paint must come from\n * `v_world` through `spaceInverse`, not from where `a_position` happens to\n * lie.\n */\n bind?(ctx: PaintBindContext, fill: FillStyle): PaintProgram | null;\n /** Bounds frame → the frame the node is painted in. */\n inPoseFrame?(fill: FillStyle, box: FillPoseBox): FillStyle;\n /** The inverse. Required whenever `inPoseFrame` is supplied. */\n toBoundsFrame?(fill: FillStyle, box: FillPoseBox): FillStyle;\n /**\n * The `<defs>` entry backing a `url(#id)` reference.\n *\n * SVG has paint servers for two gradients and a pattern and nothing else, so\n * a kind beyond those has no element to target: write a foreign-namespaced\n * one under the `wzl:` prefix `@weasel-js/svg` declares on the root whenever\n * a document holds such a paint. That package emits the fallback color\n * beside the reference on its own, from `colorOf`.\n */\n toSvg?(id: string, fill: FillStyle): string;\n /**\n * Shader programs `bind` looks up through `ctx.program`, keyed by program\n * id; registering the kind registers them. Declaring them here rather than\n * calling `registerProgram` at import keeps a kind loaded by\n * {@link registerPaintKindLoader} free of core's registries.\n */\n programs?: Readonly<Record<string, ProgramSource>>;\n}\n\nconst BUILTINS: readonly PaintKindEntry[] = [\n {\n id: 'solid',\n label: 'Solid',\n icon: 'paintSolid',\n seed: (color) => ({ color }),\n colorOf: (paint) => ((paint.fill ?? 'solid') === 'solid'\n ? (paint as { color: string }).color\n : undefined),\n },\n gradientKind('linear-gradient', 'Linear', 'paintLinear'),\n gradientKind('radial-gradient', 'Radial', 'paintRadial'),\n gradientKind('conic-gradient', 'Conic', 'paintConic'),\n {\n id: 'pattern',\n label: 'Pattern',\n icon: 'paintPattern',\n seed: (color) => ({\n fill: 'pattern',\n pattern: { tile: 'hatch', color },\n units: 'bounds',\n }),\n colorOf: (paint) => (paint.fill === 'pattern'\n ? (paint.pattern as Partial<TilePatternSpec>).color\n : undefined),\n },\n];\n\nfunction gradientKind(id: GradientKind, label: string, icon: string): PaintKindEntry {\n return {\n id,\n label,\n icon,\n // `bounds` units make the seed independent of the node's actual size.\n seed: (color) => gradientForBounds(id, UNIT_BOX, twoStopRamp(color), 'bounds'),\n colorOf: (paint) => (paint as Partial<GradientFill>).stops?.[0]?.color,\n stopsOf: (paint) => (paint as GradientFill).stops,\n fromStops: (stops) => gradientForBounds(id, UNIT_BOX, stops, 'bounds'),\n };\n}\n\nconst UNIT_BOX = { x: 0, y: 0, width: 1, height: 1 };\n\n/** `color` to a contrasting end — white reads against any hue; against white\n * itself, black does. */\nfunction twoStopRamp(color: string): GradStop[] {\n const isWhite = color.slice(0, 7).toLowerCase() === '#ffffff';\n return [{ offset: 0, color }, { offset: 1, color: isWhite ? '#000000ff' : '#ffffffff' }];\n}\n\nconst KINDS = createReflectable<PaintKindEntry>();\n\nfunction seedBuiltins(): void {\n for (const entry of BUILTINS) KINDS.push(entry.id, entry, { source: 'kit' });\n}\nseedBuiltins();\n// `NodeShape`'s paint slot memoizes per node and resolves a fill's frame\n// inside it, so the kind set is ambient state that memo cannot see change.\nKINDS.subscribe(bumpNodeMemoGeneration);\n\n/** Every registered paint kind, with the overrides each displaced. */\nexport const paintKindRegistry: Reflection<PaintKindEntry> = KINDS.reflection;\n\n/**\n * A consumer's own paint, typed as a `FillStyle`.\n *\n * `FillStyle` stays a closed union: opening its discriminant would widen every\n * built-in member and break the narrowing the kit's own branches depend on.\n * A registered kind declares its own interface instead and passes it through\n * here — the kit reads only `fill` and hands the whole object back to that\n * kind's slots.\n */\nexport function asPaint<T extends { fill: string }>(paint: T): FillStyle {\n return paint as unknown as FillStyle;\n}\n\n/** Register a paint kind. Returns a disposer that removes it. Re-registering an\n * existing id is an override; disposing it uncovers whatever it displaced. */\nexport function registerPaintKind(entry: PaintKindEntry): () => void {\n if ((entry.stopsOf === undefined) !== (entry.fromStops === undefined)) {\n const missing = entry.stopsOf === undefined ? 'stopsOf' : 'fromStops';\n throw new Error(\n `weasel registerPaintKind: kind \"${entry.id}\" is missing ${missing}. A ` +\n 'gradient kind reads as a stop list and builds from one; supply both or neither.',\n );\n }\n if ((entry.inPoseFrame === undefined) !== (entry.toBoundsFrame === undefined)) {\n const missing = entry.inPoseFrame === undefined ? 'inPoseFrame' : 'toBoundsFrame';\n throw new Error(\n `weasel registerPaintKind: kind \"${entry.id}\" is missing ${missing}. A kind ` +\n 'that converts one frame direction and not the other drifts on the next ' +\n 'resize; supply both or neither.',\n );\n }\n for (const [id, src] of Object.entries(entry.programs ?? {})) {\n const have = getProgramSource(id);\n if (!have || have.vert !== src.vert || have.frag !== src.frag) registerProgram(id, src.vert, src.frag);\n }\n // Re-registering a built-in id is how a consumer closes a gap the kit leaves,\n // so disposing that override puts the built-in back rather than deleting the\n // kind.\n return KINDS.push(entry.id, entry);\n}\n\n/** The entry for `kind`, or `undefined`. A lookup that misses on a kind with\n * a loader starts that load; see {@link registerPaintKindLoader}. */\nexport function getPaintKind(kind: string | undefined): PaintKindEntry | undefined {\n const id = kind ?? 'solid';\n const entry = KINDS.get(id);\n if (!entry && LOADERS.has(id)) void startLoad(id).catch(() => {});\n return entry;\n}\n\n/** Resolves with the entry for a kind that is loaded on first use. */\nexport type PaintKindLoader = () => Promise<PaintKindEntry>;\n\nconst LOADERS = new Map<string, PaintKindLoader>();\n\n/** One load per kind, kept after it settles: a failed load is not retried on\n * every frame that meets the kind. */\nconst LOADS = new Map<string, Promise<void>>();\n\n// A built-in kind heavy enough to keep off a consumer's bundle until a paint\n// of it turns up. Importing the module statically still registers it at once.\nconst LAZY_BUILTINS: ReadonlyArray<readonly [string, PaintKindLoader]> = [\n ['mesh-gradient', async () => (await import('../features/meshPaint/lazyKind')).meshGradientKind],\n];\n\nfunction seedLoaders(): void {\n LOADERS.clear();\n LOADS.clear();\n for (const [id, load] of LAZY_BUILTINS) LOADERS.set(id, load);\n}\nseedLoaders();\n\n/**\n * Declare a paint kind that is loaded the first time something looks it up,\n * so its code stays out of the bundle until a paint of it appears — typically\n * `() => import('./myKind').then((m) => m.myKindEntry)`.\n *\n * Until it lands the kind is unregistered: the renderer draws nothing for its\n * paints, and every other reader treats it as unknown. Registering it fires\n * `paintKindRegistry`'s subscribers, which is what `<SceneCanvas>` repaints\n * on. Call {@link warmPaintKinds} to load ahead of the first frame instead.\n *\n * A kind that is already registered never calls its loader. Returns a\n * disposer that removes the loader.\n */\nexport function registerPaintKindLoader(id: string, load: PaintKindLoader): () => void {\n LOADERS.set(id, load);\n return () => {\n if (LOADERS.get(id) === load) LOADERS.delete(id);\n };\n}\n\nfunction startLoad(id: string): Promise<void> {\n const running = LOADS.get(id);\n if (running) return running;\n const load = LOADERS.get(id)!;\n const done = load().then(\n (entry) => {\n if (entry.id !== id) {\n throw new Error(`weasel: the loader for paint kind \"${id}\" resolved to \"${entry.id}\".`);\n }\n if (!KINDS.has(id)) registerPaintKind(entry);\n },\n ).catch((err: unknown) => {\n console.error(`weasel: paint kind \"${id}\" failed to load:`, err);\n throw err;\n });\n LOADS.set(id, done);\n return done;\n}\n\n/** Is `id` registered, or declared with a loader? */\nexport function isPaintKindKnown(id: string): boolean {\n return KINDS.has(id) || LOADERS.has(id);\n}\n\n/**\n * Load paint kinds ahead of their first use, so the first frame that meets\n * one draws it rather than a blank. With no list, loads every kind that has a\n * loader — the kit's lazily loaded built-ins (`mesh-gradient`) plus any a\n * consumer declared with {@link registerPaintKindLoader}.\n *\n * Resolves once every kind is registered; a kind already registered counts\n * as loaded. Rejects when a load fails, or for a kind that is neither\n * registered nor loadable.\n */\nexport function warmPaintKinds(kinds?: readonly string[]): Promise<void> {\n const ids = kinds ?? [...LOADERS.keys()];\n const loads: Promise<void>[] = [];\n for (const id of ids) {\n if (KINDS.has(id)) continue;\n if (!LOADERS.has(id)) {\n return Promise.reject(new Error(\n `weasel warmPaintKinds: \"${id}\" is neither registered nor loadable.`,\n ));\n }\n loads.push(startLoad(id));\n }\n return Promise.all(loads).then(() => undefined);\n}\n\n/** A list derived from the registry, recomputed only when it changes — so\n * its identity is a `useSyncExternalStore` snapshot. */\nfunction derivedList(\n derive: (all: readonly ReflectedEntry<PaintKindEntry>[]) => readonly PaintKindEntry[],\n): () => readonly PaintKindEntry[] {\n let from: readonly ReflectedEntry<PaintKindEntry>[] | undefined;\n let list: readonly PaintKindEntry[] = [];\n return () => {\n const entries = KINDS.entries();\n if (entries !== from) {\n from = entries;\n list = Object.freeze(derive(entries));\n }\n return list;\n };\n}\n\n/** Every registered kind, built-ins first, in registration order. The same\n * array until the registry changes. */\nexport function listPaintKinds(): readonly PaintKindEntry[] {\n return allKinds();\n}\nconst allKinds = derivedList((all) => all.map((e) => e.value));\n\n/** Every registered gradient kind — the ones that read as and build from a\n * stop list — in registration order. The same array until the registry\n * changes. */\nexport function listGradientKinds(): readonly PaintKindEntry[] {\n return gradientKinds();\n}\nconst gradientKinds = derivedList(\n (all) => all.map((e) => e.value).filter((entry) => entry.stopsOf && entry.fromStops),\n);\n\n/**\n * `paint` retargeted to gradient kind `kind`, or `undefined` when either side\n * is not a gradient kind.\n *\n * Between two of the stop gradients this is `withGradientKind`, which carries\n * the geometry. Any other pair goes through the stop list — `stopsOf` on the\n * way out, `fromStops` on the way in — keeping `interpolate` and `opacity`.\n * Lossy wherever the kinds hold different information; an editor that wants a\n * switch to be undoable should keep the original paint.\n */\nexport function switchGradientKind(paint: FillStyle, kind: PaintKind): FillStyle | undefined {\n const from = paintKindOf(paint);\n const to = getPaintKind(kind);\n if (!from?.stopsOf || !to?.fromStops) return undefined;\n if (from.id === to.id) return paint;\n if (isGradientFill(paint) && isGradientFill({ fill: kind } as FillStyle)) {\n return withGradientKind(paint, kind as GradientKind);\n }\n const { interpolate, opacity } = paint as { interpolate?: ColorSpace; opacity?: number };\n return {\n ...to.fromStops(from.stopsOf(paint)),\n ...(interpolate !== undefined ? { interpolate } : {}),\n ...(opacity !== undefined ? { opacity } : {}),\n } as FillStyle;\n}\n\n/** The registry entry for a paint, or `undefined` when its kind is unknown. */\nexport function paintKindOf(fill: FillStyle): PaintKindEntry | undefined {\n return getPaintKind(fill.fill ?? 'solid');\n}\n\n/** @internal Test helper — do not call from product code. */\nexport function _resetPaintKindsForTests(): void {\n KINDS.clear();\n seedBuiltins();\n seedLoaders();\n}\n"],"mappings":";;;;;AAqLA,IAAMA,IAAsC;CAC1C;EACE,IAAI;EACJ,OAAO;EACP,MAAM;EACN,OAAO,OAAW,EAAE,SAAM;EAC1B,UAAU,OAAYC,EAAM,QAAQ,aAAa,UAC5CA,EAA4B,QAC7B,KAAA;CACN;CACAC,EAAa,mBAAmB,UAAU,aAAa;CACvDA,EAAa,mBAAmB,UAAU,aAAa;CACvDA,EAAa,kBAAkB,SAAS,YAAY;CACpD;EACE,IAAI;EACJ,OAAO;EACP,MAAM;EACN,OAAO,OAAW;GAChB,MAAM;GACN,SAAS;IAAE,MAAM;IAAS;GAAM;GAChC,OAAO;EACT;EACA,UAAU,MAAWD,EAAM,SAAS,YAC/BA,EAAM,QAAqC,QAC5C,KAAA;CACN;AACF;AAEA,SAASC,EAAa,GAAkB,GAAe,GAA8B;CACnF,OAAO;EACL;EACA;EACA;EAEA,OAAO,MAAUC,EAAkBC,GAAIC,GAAUC,EAAYC,CAAK,GAAG,QAAQ;EAC7E,UAAU,MAAWN,EAAgC,QAAQ,EAAE,EAAE;EACjE,UAAU,MAAWA,EAAuB;EAC5C,YAAY,MAAUE,EAAkBC,GAAIC,GAAUG,GAAO,QAAQ;CACvE;AACF;AAEA,IAAMH,IAAW;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;CAAG,QAAQ;AAAE;AAInD,SAASC,EAAY,GAA2B;CAC9C,IAAMG,IAAUF,EAAM,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,MAAM;CACpD,OAAO,CAAC;EAAE,QAAQ;EAAG;CAAM,GAAG;EAAE,QAAQ;EAAG,OAAOE,IAAU,cAAc;CAAY,CAAC;AACzF;AAEA,IAAMC,IAAQC,EAAkC;AAEhD,SAASC,IAAqB;CAC5B,KAAK,IAAMC,KAASb,GAAU,EAAM,KAAKa,EAAM,IAAIA,GAAO,EAAE,QAAQ,MAAM,CAAC;AAC7E;AACAD,EAAa,GAGbF,EAAM,UAAUI,CAAsB;AAGtC,IAAaC,IAAgDL,EAAM;AAWnE,SAAgBM,EAAoC,GAAqB;CACvE,OAAOf;AACT;AAIA,SAAgBgB,EAAkB,GAAmC;CACnE,IAAKJ,EAAM,YAAY,KAAA,MAAgBA,EAAM,cAAc,KAAA,IAAY;EACrE,IAAMK,IAAUL,EAAM,YAAY,KAAA,IAAY,YAAY;EAC1D,MAAU,MACR,mCAAmCA,EAAM,GAAG,eAAeK,EAAQ,oFAErE;CACF;CACA,IAAKL,EAAM,gBAAgB,KAAA,MAAgBA,EAAM,kBAAkB,KAAA,IAAY;EAC7E,IAAMK,IAAUL,EAAM,gBAAgB,KAAA,IAAY,gBAAgB;EAClE,MAAU,MACR,mCAAmCA,EAAM,GAAG,eAAeK,EAAQ,gHAGrE;CACF;CACA,KAAK,IAAM,CAACd,GAAIe,MAAQ,OAAO,QAAQN,EAAM,YAAY,CAAC,CAAC,GAAG;EAC5D,IAAMO,IAAOC,EAAiBjB,CAAE;EAChC,CAAI,CAACgB,KAAQA,EAAK,SAASD,EAAI,QAAQC,EAAK,SAASD,EAAI,SAAMG,EAAgBlB,GAAIe,EAAI,MAAMA,EAAI,IAAI;CACvG;CAIA,OAAOT,EAAM,KAAKG,EAAM,IAAIA,CAAK;AACnC;AAIA,SAAgBU,EAAa,GAAsD;CACjF,IAAMnB,IAAKoB,KAAQ,SACbX,IAAQH,EAAM,IAAIN,CAAE;CAE1B,OADI,CAACS,KAASY,EAAQ,IAAIrB,CAAE,KAAGsB,EAAetB,CAAE,CAAC,CAAC,YAAY,CAAC,CAAC,GACzDS;AACT;AAKA,IAAMY,oBAAU,IAAI,IAA6B,GAI3CE,oBAAQ,IAAI,IAA2B,GAIvCC,IAAmE,CACvE,CAAC,iBAAiB,aAAa,MAAM,OAAO,qCAAA,CAAmC,gBAAgB,CACjG;AAEA,SAASC,IAAoB;CAE3B,AADAJ,EAAQ,MAAM,GACdE,EAAM,MAAM;CACZ,KAAK,IAAM,CAACvB,GAAI0B,MAASF,GAAe,EAAQ,IAAIxB,GAAI0B,CAAI;AAC9D;AACAD,EAAY;AAeZ,SAAgBE,EAAwB,GAAY,GAAmC;CAErF,OADAN,EAAQ,IAAIrB,GAAI0B,CAAI,SACP;EACX,AAAIL,EAAQ,IAAIrB,CAAE,MAAM0B,KAAML,EAAQ,OAAOrB,CAAE;CACjD;AACF;AAEA,SAASsB,EAAU,GAA2B;CAC5C,IAAMM,IAAUL,EAAM,IAAIvB,CAAE;CAC5B,IAAI4B,GAAS,OAAOA;CAEpB,IAAMC,IADOR,EAAQ,IAAIrB,CACZ,CAAA,CAAK,CAAC,CAAC,MACjB,MAAU;EACT,IAAIS,EAAM,OAAOT,GACf,MAAU,MAAM,sCAAsCA,EAAG,iBAAiBS,EAAM,GAAG,GAAG;EAExF,AAAKH,EAAM,IAAIN,CAAE,KAAGa,EAAkBJ,CAAK;CAC7C,CACF,CAAC,CAAC,OAAO,MAAiB;EAExB,MADA,QAAQ,MAAM,uBAAuBT,EAAG,oBAAoB8B,CAAG,GACzDA;CACR,CAAC;CAED,OADAP,EAAM,IAAIvB,GAAI6B,CAAI,GACXA;AACT;AAGA,SAAgBE,EAAiB,GAAqB;CACpD,OAAOzB,EAAM,IAAIN,CAAE,KAAKqB,EAAQ,IAAIrB,CAAE;AACxC;AAYA,SAAgBgC,EAAe,GAA0C;CACvE,IAAMC,IAAMC,KAAS,CAAC,GAAGb,EAAQ,KAAK,CAAC,GACjCc,IAAyB,CAAC;CAChC,KAAK,IAAMnC,KAAMiC,GACf,IAAI,GAAM,IAAIjC,CAAE,GAChB;MAAI,CAACqB,EAAQ,IAAIrB,CAAE,GACjB,OAAO,QAAQ,OAAO,gBAAI,MACxB,2BAA2BA,EAAG,sCAChC,CAAC;EAEH,EAAM,KAAKsB,EAAUtB,CAAE,CAAC;CAFrB;CAIL,OAAO,QAAQ,IAAImC,CAAK,CAAC,CAAC,WAAW,KAAA,CAAS;AAChD;AAIA,SAASC,EACP,GACiC;CACjC,IAAIC,GACAC,IAAkC,CAAC;CACvC,aAAa;EACX,IAAMC,IAAUjC,EAAM,QAAQ;EAK9B,OAJIiC,MAAYF,MACd,IAAOE,GACP,IAAO,OAAO,OAAOC,EAAOD,CAAO,CAAC,IAE/BD;CACT;AACF;AAIA,SAAgBG,IAA4C;CAC1D,OAAOC,EAAS;AAClB;AACA,IAAMA,IAAWN,GAAa,MAAQO,EAAI,KAAK,MAAM,EAAE,KAAK,CAAC;AAK7D,SAAgBC,IAA+C;CAC7D,OAAOC,EAAc;AACvB;AACA,IAAMA,IAAgBT,GACnB,MAAQO,EAAI,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,MAAUlC,EAAM,WAAWA,EAAM,SAAS,CACrF;AAYA,SAAgBqC,EAAmB,GAAkB,GAAwC;CAC3F,IAAMT,IAAOU,EAAYlD,CAAK,GACxBmD,IAAK7B,EAAaC,CAAI;CAC5B,IAAI,CAACiB,GAAM,WAAW,CAACW,GAAI,WAAW;CACtC,IAAIX,EAAK,OAAOW,EAAG,IAAI,OAAOnD;CAC9B,IAAIoD,EAAepD,CAAK,KAAKoD,EAAe,EAAE,MAAM7B,EAAK,CAAc,GACrE,OAAO8B,EAAiBrD,GAAOuB,CAAoB;CAErD,IAAM,EAAE,gBAAa,eAAYvB;CACjC,OAAO;EACL,GAAGmD,EAAG,UAAUX,EAAK,QAAQxC,CAAK,CAAC;EACnC,GAAIsD,MAAgB,KAAA,IAA8B,CAAC,IAAnB,EAAE,eAAY;EAC9C,GAAIC,MAAY,KAAA,IAA0B,CAAC,IAAf,EAAE,WAAQ;CACxC;AACF;AAGA,SAAgBL,EAAY,GAA6C;CACvE,OAAO5B,EAAakC,EAAK,QAAQ,OAAO;AAC1C;AAGA,SAAgBC,IAAiC;CAG/C,AAFAhD,EAAM,MAAM,GACZE,EAAa,GACbiB,EAAY;AACd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/core/scene/NodeProperties.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = [], t = /* @__PURE__ */ new Map();
|
|
4
|
+
return {
|
|
5
|
+
register(n) {
|
|
6
|
+
if (t.has(n.name)) throw Error(`createNodeProperties: duplicate kind name "${n.name}"`);
|
|
7
|
+
t.set(n.name, n), e.push(n);
|
|
8
|
+
},
|
|
9
|
+
get(e) {
|
|
10
|
+
return t.get(e);
|
|
11
|
+
},
|
|
12
|
+
list() {
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as createNodeProperties };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=NodeProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeProperties.js","names":["createNodeProperties","entries","byName","entry","name"],"sources":["../../../src/core/scene/NodeProperties.ts"],"sourcesContent":["import type { ToolPrefGroup } from 'tools/prefs';\n\n/**\n * NodePropertiesEntry — one kind's entry in the **properties trait's**\n * registry: a declarative schema of the kind's editable properties.\n *\n * Leaf keys inside `schema` are dotted node paths (`pose.x`,\n * `data.fill`, `data.style.fontSize`) — a path of any depth rooted at\n * `pose` or `data` — so schema consumers (weasel-ui `SelectionPanel`)\n * can read/aggregate/write generically with no per-kind code. Group\n * keys are organizational only; they do not contribute to the node\n * path.\n *\n * Kind names share the routing trait's vocabulary — an entry registered\n * as `'rect'` describes nodes `NodeRouting.classify` maps to `'rect'`.\n * See `docs/superpowers/specs/2026-07-20-selection-panel-design.md` and\n * the trait taxonomy in\n * `docs/superpowers/specs/2026-05-24-node-traits-reframe-design.md`.\n */\nexport interface NodePropertiesEntry {\n /** Kind name — same vocabulary as the routing trait. */\n name: string;\n /** Property schema for this kind. */\n schema: ToolPrefGroup;\n}\n\n/**\n * NodeProperties — the **properties trait's** registry. Each trait of a\n * node (shape, routing, properties, …) is its own registry; this one\n * answers \"what editable properties does this kind expose?\" Consumed by\n * weasel-ui's `<SelectionPanel>`.\n *\n * (Supersedes the speculative `NodePropertyRows` name in the traits\n * spec — the stored value is a schema, not render contributors.)\n */\nexport interface NodeProperties {\n /** Register a kind. Throws if a kind with this name is already\n * registered. */\n register(entry: NodePropertiesEntry): void;\n /** Lookup a kind's entry by name. */\n get(name: string): NodePropertiesEntry | undefined;\n /** Enumerate registered kinds in registration order. */\n list(): readonly NodePropertiesEntry[];\n}\n\n/** Build a registry of per-node-kind property descriptors, which schema-driven\n * property panels read to know what a node exposes. Registering a duplicate\n * kind name throws. */\nexport function createNodeProperties(): NodeProperties {\n const entries: NodePropertiesEntry[] = [];\n const byName = new Map<string, NodePropertiesEntry>();\n return {\n register(entry) {\n if (byName.has(entry.name)) {\n throw new Error(\n `createNodeProperties: duplicate kind name \"${entry.name}\"`,\n );\n }\n byName.set(entry.name, entry);\n entries.push(entry);\n },\n get(name) {\n return byName.get(name);\n },\n list() {\n return entries;\n },\n };\n}\n"],"mappings":";AAgDA,SAAgBA,IAAuC;CACrD,IAAMC,IAAiC,CAAC,GAClCC,oBAAS,IAAI,IAAiC;CACpD,OAAO;EACL,SAAS,GAAO;GACd,IAAIA,EAAO,IAAIC,EAAM,IAAI,GACvB,MAAU,MACR,8CAA8CA,EAAM,KAAK,EAC3D;GAGF,AADAD,EAAO,IAAIC,EAAM,MAAMA,CAAK,GAC5BF,EAAQ,KAAKE,CAAK;EACpB;EACA,IAAI,GAAM;GACR,OAAOD,EAAO,IAAIE,CAAI;EACxB;EACA,OAAO;GACL,OAAOH;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/core/scene/NodeRouting.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = [], t = /* @__PURE__ */ new Map();
|
|
4
|
+
return {
|
|
5
|
+
register(n) {
|
|
6
|
+
if (t.has(n.name)) throw Error(`createNodeRouting: duplicate kind name "${n.name}"`);
|
|
7
|
+
t.set(n.name, n), e.push(n);
|
|
8
|
+
},
|
|
9
|
+
classify(t) {
|
|
10
|
+
for (let n of e) if (n.matches(t)) return n.name;
|
|
11
|
+
return "unknown";
|
|
12
|
+
},
|
|
13
|
+
get(e) {
|
|
14
|
+
return t.get(e);
|
|
15
|
+
},
|
|
16
|
+
list() {
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { e as createNodeRouting };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=NodeRouting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeRouting.js","names":["createNodeRouting","entries","byName","kind","data","name"],"sources":["../../../src/core/scene/NodeRouting.ts"],"sourcesContent":["/**\n * NodeRoutingEntry — a routing-trait classifier entry.\n *\n * The kit consults `NodeRouting` (the routing trait's registry)\n * to derive a kind string for each scene node. Other traits (shape,\n * label, icon, …) are independent registries — fields like `label`\n * or `icon` are NOT future additions to this interface. See:\n * `docs/superpowers/specs/2026-05-24-node-traits-reframe-design.md`.\n */\nexport interface NodeRoutingEntry {\n /** Unique kind name. Routing tables key on this string. Consumer-defined;\n * the kit places no constraint beyond uniqueness within a registry. */\n name: string;\n /** Predicate over a node's `data` payload. First registered kind whose\n * `matches` returns true claims the node. */\n matches: (data: unknown) => boolean;\n}\n\n/**\n * NodeRouting — the **routing trait's** registry. Each trait of a\n * node (shape, routing, label, icon, affordances, …) is its own\n * registry; this one answers \"what routing-kind string does this\n * node's data map to?\" The result flows into declarative tool-routing\n * tables (`{ target: 'rect', actionId: 'move' }`).\n *\n * Other traits (shape painters, future label/icon/propertyRows\n * registries) are their own registries — they are NOT optional\n * fields on `NodeRoutingEntry`. See:\n * `docs/superpowers/specs/2026-05-24-node-traits-reframe-design.md`.\n *\n * Instances are constructed by `<SceneCanvas>` from its `routing` prop\n * and used to classify each hit node's `data` into a `kind` string when\n * building `getNodeAtPoint`. Direct use from consumer code is supported\n * but not required for the common SceneCanvas flow.\n */\nexport interface NodeRouting {\n /** Register a kind. Order matters: first match wins during `classify`.\n * Throws if a kind with this name is already registered. */\n register(kind: NodeRoutingEntry): void;\n /** Walk registered kinds in registration order; return the first kind\n * whose `matches(data)` returns true, or `'unknown'` if none match. */\n classify(data: unknown): string;\n /** Lookup a kind entry by name. */\n get(name: string): NodeRoutingEntry | undefined;\n /** Enumerate registered kinds in registration order. */\n list(): readonly NodeRoutingEntry[];\n}\n\n/** Build a registry of per-node-kind routing entries, which decide how a node\n * kind is drawn, hit-tested and serialized. Registering a duplicate kind name\n * throws. */\nexport function createNodeRouting(): NodeRouting {\n const entries: NodeRoutingEntry[] = [];\n const byName = new Map<string, NodeRoutingEntry>();\n return {\n register(kind) {\n if (byName.has(kind.name)) {\n throw new Error(\n `createNodeRouting: duplicate kind name \"${kind.name}\"`,\n );\n }\n byName.set(kind.name, kind);\n entries.push(kind);\n },\n classify(data) {\n for (const kind of entries) {\n if (kind.matches(data)) return kind.name;\n }\n return 'unknown';\n },\n get(name) {\n return byName.get(name);\n },\n list() {\n return entries;\n },\n };\n}\n"],"mappings":";AAmDA,SAAgBA,IAAiC;CAC/C,IAAMC,IAA8B,CAAC,GAC/BC,oBAAS,IAAI,IAA8B;CACjD,OAAO;EACL,SAAS,GAAM;GACb,IAAIA,EAAO,IAAIC,EAAK,IAAI,GACtB,MAAU,MACR,2CAA2CA,EAAK,KAAK,EACvD;GAGF,AADAD,EAAO,IAAIC,EAAK,MAAMA,CAAI,GAC1BF,EAAQ,KAAKE,CAAI;EACnB;EACA,SAAS,GAAM;GACb,KAAK,IAAMA,KAAQF,GACjB,IAAIE,EAAK,QAAQC,CAAI,GAAG,OAAOD,EAAK;GAEtC,OAAO;EACT;EACA,IAAI,GAAM;GACR,OAAOD,EAAO,IAAIG,CAAI;EACxB;EACA,OAAO;GACL,OAAOJ;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/core/scene/arrivals.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
arrivals;
|
|
4
|
+
constructor(e) {
|
|
5
|
+
let t = [...e.keys()].map((e) => `"${e}"`).join(", ");
|
|
6
|
+
super(`Scene: ${t} refused the nodes joining it`), this.name = "SceneArrivalRefused", this.arrivals = e;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as SceneArrivalRefused };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=arrivals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrivals.js","names":["SceneArrivalRefused","where","arrivals","id"],"sources":["../../../src/core/scene/arrivals.ts"],"sourcesContent":["import type { NodeId } from './types';\n\n/**\n * Thrown by a scene edit — `batch`, `untracked`, or a bare `add` / `move` —\n * whose arrivals the scene's arrival handler refused. The edit has already\n * been reverted when this reaches the caller. An op-driven edit\n * (`applyBatch`, `history.applyOps`, a journal's `applyBatch`) is reverted\n * the same way but does not throw: nothing lands, as with a drop onto a\n * container that takes none.\n */\nexport class SceneArrivalRefused extends Error {\n /** The nodes refused, by the container they were joining. */\n readonly arrivals: ReadonlyMap<NodeId, readonly NodeId[]>;\n\n constructor(arrivals: ReadonlyMap<NodeId, readonly NodeId[]>) {\n const where = [...arrivals.keys()].map((id) => `\"${id}\"`).join(', ');\n super(`Scene: ${where} refused the nodes joining it`);\n this.name = 'SceneArrivalRefused';\n this.arrivals = arrivals;\n }\n}\n"],"mappings":";AAUA,IAAaA,IAAb,cAAyC,MAAM;CAE7C;CAEA,YAAY,GAAkD;EAC5D,IAAMC,IAAQ,CAAC,GAAGC,EAAS,KAAK,CAAC,CAAC,CAAC,KAAK,MAAO,IAAIC,EAAG,EAAE,CAAC,CAAC,KAAK,IAAI;EAGnE,AAFA,MAAM,UAAUF,EAAM,8BAA8B,GACpD,KAAK,OAAO,uBACZ,KAAK,WAAWC;CAClB;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/core/scene/composeFrame.ts
|
|
2
|
+
var e = {
|
|
3
|
+
compose: (e, t) => t,
|
|
4
|
+
decompose: (e, t) => t,
|
|
5
|
+
closure: "identity"
|
|
6
|
+
};
|
|
7
|
+
function t(e, t, n) {
|
|
8
|
+
let r = [t], i = /* @__PURE__ */ new Set([t]), a = e.getParent(t);
|
|
9
|
+
for (; a !== null && !i.has(a);) i.add(a), (e.definesFrame?.(a) ?? !0) && r.push(a), a = e.getParent(a);
|
|
10
|
+
let o = e.getPose(r[r.length - 1]);
|
|
11
|
+
for (let t = r.length - 2; t >= 0; t--) o = n(o, e.getPose(r[t]));
|
|
12
|
+
return o;
|
|
13
|
+
}
|
|
14
|
+
function n(e, n, i, a, o) {
|
|
15
|
+
let s = r(e, i);
|
|
16
|
+
return s === null ? n : o(t(e, s, a), n);
|
|
17
|
+
}
|
|
18
|
+
function r(e, t) {
|
|
19
|
+
let n = /* @__PURE__ */ new Set(), r = t;
|
|
20
|
+
for (; r !== null && !n.has(r);) {
|
|
21
|
+
if (e.definesFrame?.(r) ?? !0) return r;
|
|
22
|
+
n.add(r), r = e.getParent(r);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { e as IDENTITY_POSE_COMPOSITION, t as composeWorldPose, r as frameAtOrAbove, n as rebaseLocalPose };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=composeFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeFrame.js","names":["IDENTITY_POSE_COMPOSITION","child","world","composeWorldPose","chain","id","seen","cursor","adapter","i","compose","rebaseLocalPose","frame","frameAtOrAbove","newParentId","worldPose","decompose"],"sources":["../../../src/core/scene/composeFrame.ts"],"sourcesContent":["/**\n * Folding a node's pose up its parent chain to world, and back down. Lives\n * under `core/` so the scene can lay out in world without reaching up into\n * `features/`; `features/groups/composePose` re-exports all of it.\n */\n\n/** Minimal adapter needed by `composeWorldPose` and friends — pose lookup plus parent walk. */\nexport interface PoseAdapter<TPose> {\n getPose(id: string): TPose;\n getParent(id: string): string | null;\n /** Whether `id`'s pose is a frame its children are expressed in. Absent\n * means every node is one. A container whose pose derives from its children\n * is not: its children share its frame, so the fold passes over it. */\n definesFrame?(id: string): boolean;\n}\n\n/**\n * The transforms a `compose` represents **exactly**. A parent transform wider\n * than its strategy's closure is rounded to the nearest pose — for `'rigid'`\n * that means an anisotropically scaled parent turns a rotated child into a\n * parallelogram, which `{x, y, width, height, rotation}` cannot hold, so the\n * shear is dropped.\n *\n * Measured over 50,000 random parent/child pairs: rotation and translation\n * compose to within 5.7e-13, anisotropic scale to a right-angle error of 0.99.\n * See `docs/superpowers/specs/2026-09-10-group-as-frame-design.md`.\n */\nexport type PoseClosure = 'identity' | 'translation' | 'rigid';\n\n/** Consumer's pose-composition strategy for hierarchical scenes. `compose`\n * folds a child's pose (in parent's frame) up to the next frame; `decompose`\n * is its inverse. Default is IDENTITY — an absolute-pose scene where every\n * node already stores world coords (parent is grouping-only, no transform). */\nexport interface PoseComposition<TPose> {\n compose: (parent: TPose, child: TPose) => TPose;\n decompose: (parent: TPose, world: TPose) => TPose;\n closure: PoseClosure;\n}\n\n/** Default pose-composition strategy: IDENTITY. Both `compose` and\n * `decompose` return the child/world pose unchanged, modeling an\n * absolute-pose scene where every node stores world coords and parents are\n * grouping-only (no transform). With this strategy `composeWorldPose`\n * returns a node's own raw pose and `rebaseLocalPose` is a no-op. */\nexport const IDENTITY_POSE_COMPOSITION: PoseComposition<unknown> = {\n compose: (_parent, child) => child,\n decompose: (_parent, world) => world,\n closure: 'identity',\n};\n\n/**\n * Walk `id`'s parent chain (root first to id last) and fold local poses into\n * a world pose via `compose`. Returns the world pose for `id`. Cycle-safe:\n * a visited-set guard breaks if the chain ever loops back to itself.\n *\n * `compose(parent, child)` interprets `child` as expressed *in `parent`'s\n * local frame* and returns the equivalent pose in the next frame up. For a\n * standard translation-only rect: `world = { x: p.x + c.x, y: p.y + c.y,\n * width: c.width, height: c.height }`.\n */\nexport function composeWorldPose<TPose>(\n adapter: PoseAdapter<TPose>,\n id: string,\n compose: (parent: TPose, child: TPose) => TPose,\n): TPose {\n const chain: string[] = [id];\n const seen = new Set<string>([id]);\n let cursor: string | null = adapter.getParent(id);\n while (cursor !== null) {\n if (seen.has(cursor)) break;\n seen.add(cursor);\n if (adapter.definesFrame?.(cursor) ?? true) chain.push(cursor);\n cursor = adapter.getParent(cursor);\n }\n // chain is [id, parent, grandparent, ..., root]; fold from the root down.\n let world = adapter.getPose(chain[chain.length - 1]);\n for (let i = chain.length - 2; i >= 0; i--) {\n world = compose(world, adapter.getPose(chain[i]));\n }\n return world;\n}\n\n/**\n * Convert `worldPose` into a local pose expressed under `newParentId`'s\n * frame. Used when reparenting so the child's visual world position is\n * preserved despite the change of frame. Inverse of one `compose` step.\n *\n * `decompose(parent, world)` returns the local pose `child` such that\n * `compose(parent, child) === world`. For axis-aligned rects:\n * `child = { ...world, x: world.x - parent.x, y: world.y - parent.y }`.\n *\n * Pass `newParentId === null` for the root frame; the function returns\n * `worldPose` unchanged.\n */\nexport function rebaseLocalPose<TPose>(\n adapter: PoseAdapter<TPose>,\n worldPose: TPose,\n newParentId: string | null,\n compose: (parent: TPose, child: TPose) => TPose,\n decompose: (parent: TPose, world: TPose) => TPose,\n): TPose {\n const frame = frameAtOrAbove(adapter, newParentId);\n if (frame === null) return worldPose;\n return decompose(composeWorldPose(adapter, frame, compose), worldPose);\n}\n\n/** The nearest node at or above `id` whose pose is a frame, or `null` for the\n * root frame. Cycle-safe, like `composeWorldPose`. */\nexport function frameAtOrAbove<TPose>(\n adapter: PoseAdapter<TPose>,\n id: string | null,\n): string | null {\n const seen = new Set<string>();\n let cursor = id;\n while (cursor !== null && !seen.has(cursor)) {\n if (adapter.definesFrame?.(cursor) ?? true) return cursor;\n seen.add(cursor);\n cursor = adapter.getParent(cursor);\n }\n return null;\n}\n"],"mappings":";AA4CA,IAAaA,IAAsD;CACjE,UAAU,GAAS,MAAUC;CAC7B,YAAY,GAAS,MAAUC;CAC/B,SAAS;AACX;AAYA,SAAgBC,EACd,GACA,GACA,GACO;CACP,IAAMC,IAAkB,CAACC,CAAE,GACrBC,oBAAO,IAAI,IAAY,CAACD,CAAE,CAAC,GAC7BE,IAAwBC,EAAQ,UAAUH,CAAE;CAChD,OAAOE,MAAW,QACZ,GAAK,IAAIA,CAAM,IAGnB,AAFAD,EAAK,IAAIC,CAAM,IACXC,EAAQ,eAAeD,CAAM,KAAK,OAAMH,EAAM,KAAKG,CAAM,GAC7D,IAASC,EAAQ,UAAUD,CAAM;CAGnC,IAAIL,IAAQM,EAAQ,QAAQJ,EAAMA,EAAM,SAAS,EAAE;CACnD,KAAK,IAAIK,IAAIL,EAAM,SAAS,GAAGK,KAAK,GAAG,KACrC,IAAQC,EAAQR,GAAOM,EAAQ,QAAQJ,EAAMK,EAAE,CAAC;CAElD,OAAOP;AACT;AAcA,SAAgBS,EACd,GACA,GACA,GACA,GACA,GACO;CACP,IAAMC,IAAQC,EAAeL,GAASM,CAAW;CAEjD,OADIF,MAAU,OAAaG,IACpBC,EAAUb,EAAiBK,GAASI,GAAOF,CAAO,GAAGK,CAAS;AACvE;AAIA,SAAgBF,EACd,GACA,GACe;CACf,IAAMP,oBAAO,IAAI,IAAY,GACzBC,IAASF;CACb,OAAOE,MAAW,QAAQ,CAACD,EAAK,IAAIC,CAAM,IAAG;EAC3C,IAAIC,EAAQ,eAAeD,CAAM,KAAK,IAAM,OAAOA;EAEnD,AADAD,EAAK,IAAIC,CAAM,GACf,IAASC,EAAQ,UAAUD,CAAM;CACnC;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { samePoseValue as e, snapshotPose as t } from "./poseSnapshot.js";
|
|
2
|
+
//#region src/core/scene/depMemo.ts
|
|
3
|
+
function n(e, n) {
|
|
4
|
+
e.nodes.length = 0, e.poses.length = 0;
|
|
5
|
+
for (let r of n) e.nodes.push(r?.node), e.poses.push(r === void 0 ? void 0 : t(r.pose));
|
|
6
|
+
}
|
|
7
|
+
function r(t, n, r) {
|
|
8
|
+
if (t.nodes.length !== n.length) return !1;
|
|
9
|
+
for (let i = 0; i < n.length; i++) {
|
|
10
|
+
let a = r(n[i]);
|
|
11
|
+
if (t.nodes[i] !== (a === void 0 ? void 0 : a.node) || a !== void 0 && !e(t.poses[i], a.pose)) return !1;
|
|
12
|
+
}
|
|
13
|
+
return !0;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as recordDeps, r as sameDeps };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=depMemo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depMemo.js","names":["recordDeps","dep","deps","into","snapshotPose","sameDeps","record","ids","depOf","samePoseValue"],"sources":["../../../src/core/scene/depMemo.ts"],"sourcesContent":["/**\n * What a memoized derivation was derived *from*, so a hit can re-check it.\n *\n * A derivation keyed on the deriving node's own authored pose only notices a\n * change someone pushed. A dependency that moved with nothing pushed behind\n * it — an ancestor's frame moving, a removal, a dependency appearing — is\n * invisible to that key. Recording each dependency's node identity and a copy\n * of the pose it resolved to, and comparing both on the hit path, is what\n * notices it without a trigger.\n */\nimport { samePoseValue, snapshotPose } from './poseSnapshot';\nimport type { DerivedDep, NodeId } from './types';\n\n/** Each dependency's node — an identity, so a restored clone is a different\n * one — and a copy of the pose it resolved to. */\nexport interface DepRecord<TPose> {\n nodes: (object | undefined)[];\n poses: (TPose | undefined)[];\n}\n\n/** Record what `deps` resolved to, in place. Mutating the record is what\n * updates the memo slot, which holds this object. */\nexport function recordDeps<TPose>(\n into: DepRecord<TPose>,\n deps: readonly (DerivedDep<TPose> | undefined)[],\n): void {\n into.nodes.length = 0;\n into.poses.length = 0;\n for (const dep of deps) {\n into.nodes.push(dep?.node);\n into.poses.push(dep === undefined ? undefined : snapshotPose(dep.pose));\n }\n}\n\n/** Whether the dependencies still resolve to the same nodes at the same poses\n * the record was taken from. Resolves them one at a time rather than taking\n * an array: this is the hit path, and it walks every derived node's every\n * dependency on every frame. */\nexport function sameDeps<TPose>(\n record: DepRecord<TPose>,\n ids: readonly NodeId[],\n depOf: (id: NodeId) => DerivedDep<TPose> | undefined,\n): boolean {\n if (record.nodes.length !== ids.length) return false;\n for (let i = 0; i < ids.length; i++) {\n const dep = depOf(ids[i]);\n if (record.nodes[i] !== (dep === undefined ? undefined : dep.node)) return false;\n if (dep !== undefined && !samePoseValue(record.poses[i], dep.pose)) return false;\n }\n return true;\n}\n"],"mappings":";;AAsBA,SAAgBA,EACd,GACA,GACM;CAEN,AADA,EAAK,MAAM,SAAS,GACpB,EAAK,MAAM,SAAS;CACpB,KAAK,IAAMC,KAAOC,GAEhB,AADAC,EAAK,MAAM,KAAKF,GAAK,IAAI,GACzBE,EAAK,MAAM,KAAKF,MAAQ,KAAA,IAAY,KAAA,IAAYG,EAAaH,EAAI,IAAI,CAAC;AAE1E;AAMA,SAAgBI,EACd,GACA,GACA,GACS;CACT,IAAIC,EAAO,MAAM,WAAWC,EAAI,QAAQ,OAAO;CAC/C,KAAK,IAAI,IAAI,GAAG,IAAIA,EAAI,QAAQ,KAAK;EACnC,IAAMN,IAAMO,EAAMD,EAAI,EAAE;EAExB,IADID,EAAO,MAAM,QAAQL,MAAQ,KAAA,IAAY,KAAA,IAAYA,EAAI,SACzDA,MAAQ,KAAA,KAAa,CAACQ,EAAcH,EAAO,MAAM,IAAIL,EAAI,IAAI,GAAG,OAAO;CAC7E;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/core/scene/dependents.ts
|
|
2
|
+
var e = Object.freeze([]);
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = t.dependsOn;
|
|
5
|
+
return r === void 0 ? e : r === "children" ? n(t.id) : r;
|
|
6
|
+
}
|
|
7
|
+
function n() {
|
|
8
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
9
|
+
function r(e) {
|
|
10
|
+
let r = n.get(e);
|
|
11
|
+
if (r !== void 0) {
|
|
12
|
+
for (let n of r) {
|
|
13
|
+
let r = t.get(n);
|
|
14
|
+
r !== void 0 && (r.delete(e), r.size === 0 && t.delete(n));
|
|
15
|
+
}
|
|
16
|
+
n.delete(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
add(e, i) {
|
|
21
|
+
if (r(e), i.length !== 0) {
|
|
22
|
+
n.set(e, [...i]);
|
|
23
|
+
for (let n of i) {
|
|
24
|
+
let r = t.get(n);
|
|
25
|
+
r === void 0 && (r = /* @__PURE__ */ new Set(), t.set(n, r)), r.add(e);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
remove(e) {
|
|
30
|
+
r(e);
|
|
31
|
+
},
|
|
32
|
+
clear() {
|
|
33
|
+
t.clear(), n.clear();
|
|
34
|
+
},
|
|
35
|
+
isEmpty() {
|
|
36
|
+
return t.size === 0;
|
|
37
|
+
},
|
|
38
|
+
dependentsOf(n) {
|
|
39
|
+
let r = t.get(n);
|
|
40
|
+
return r === void 0 ? e : [...r];
|
|
41
|
+
},
|
|
42
|
+
transitiveDependentsOf(n) {
|
|
43
|
+
let r = t.get(n);
|
|
44
|
+
if (r === void 0) return e;
|
|
45
|
+
let i = /* @__PURE__ */ new Set(), a = [...r];
|
|
46
|
+
for (; a.length > 0;) {
|
|
47
|
+
let e = a.pop();
|
|
48
|
+
if (!i.has(e)) {
|
|
49
|
+
i.add(e);
|
|
50
|
+
for (let n of t.get(e) ?? []) a.push(n);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return i;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function r(e, t) {
|
|
58
|
+
if (e === t) return !0;
|
|
59
|
+
if (e === void 0 || t === void 0 || e === "children" || t === "children" || e.length !== t.length) return !1;
|
|
60
|
+
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
61
|
+
return !0;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { n as createDependentsIndex, t as dependencyIdsOf, r as sameDependsOn };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=dependents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependents.js","names":["NONE","dependencyIdsOf","deps","node","childrenOf","createDependentsIndex","forward","reverse","detachOwnDeps","old","id","dep","set","direct","out","stack","next","d","sameDependsOn","a","b","i"],"sources":["../../../src/core/scene/dependents.ts"],"sourcesContent":["/**\n * Which nodes must recompute when a given node's pose changes — the reverse\n * index, plus {@link dependencyIdsOf}, the forward read it is built from.\n */\nimport type { NodeId } from './types';\n\nconst NONE: readonly NodeId[] = Object.freeze([]);\n\n/**\n * The nodes `node`'s geometry derives from: the ids it named, or its own\n * children when it named `'children'`.\n *\n * The `'children'` form is deliberately absent from the reverse index — a\n * container is not a dependent of the children it hugs, or deleting one child\n * would cascade the whole group away. Its invalidation is the ancestor walk in\n * `scene.ts` instead.\n */\nexport function dependencyIdsOf(\n node: { id: NodeId; dependsOn?: readonly NodeId[] | 'children' },\n childrenOf: (id: NodeId) => readonly NodeId[],\n): readonly NodeId[] {\n const deps = node.dependsOn;\n if (deps === undefined) return NONE;\n return deps === 'children' ? childrenOf(node.id) : deps;\n}\n\nexport interface DependentsIndex {\n add(id: NodeId, deps: readonly NodeId[]): void;\n /** Forget what `id` declared. Deliberately not symmetric: who depends on\n * `id` is those nodes' declaration, not `id`'s, and outlives its removal. */\n remove(id: NodeId): void;\n /** Forget every registration. */\n clear(): void;\n /** True when nothing derives from anything. */\n isEmpty(): boolean;\n dependentsOf(id: NodeId): Iterable<NodeId>;\n /** Nodes that derive from `id` directly or through a chain. Excludes `id`\n * itself unless a cycle leads back to it. */\n transitiveDependentsOf(id: NodeId): Iterable<NodeId>;\n}\n\nexport function createDependentsIndex(): DependentsIndex {\n /** dependency -> nodes deriving from it */\n const forward = new Map<NodeId, Set<NodeId>>();\n /** dependent -> the dependencies it registered against */\n const reverse = new Map<NodeId, readonly NodeId[]>();\n\n /** Drop `id`'s registrations against its current dependencies. Shared by\n * `add` (which re-registers after) and `remove` (which does not). */\n function detachOwnDeps(id: NodeId): void {\n const old = reverse.get(id);\n if (old === undefined) return;\n for (const dep of old) {\n const set = forward.get(dep);\n if (set === undefined) continue;\n set.delete(id);\n if (set.size === 0) forward.delete(dep);\n }\n reverse.delete(id);\n }\n\n return {\n add(id, deps) {\n detachOwnDeps(id);\n if (deps.length === 0) return;\n reverse.set(id, [...deps]);\n for (const dep of deps) {\n let set = forward.get(dep);\n if (set === undefined) { set = new Set(); forward.set(dep, set); }\n set.add(id);\n }\n },\n\n remove(id) {\n detachOwnDeps(id);\n },\n\n clear() {\n forward.clear();\n reverse.clear();\n },\n\n isEmpty() {\n return forward.size === 0;\n },\n\n dependentsOf(id) {\n const set = forward.get(id);\n return set === undefined ? NONE : [...set];\n },\n\n transitiveDependentsOf(id) {\n // Runs per node per frame; the miss must not allocate.\n const direct = forward.get(id);\n if (direct === undefined) return NONE;\n const out = new Set<NodeId>();\n const stack: NodeId[] = [...direct];\n while (stack.length > 0) {\n const next = stack.pop()!;\n if (out.has(next)) continue; // also what stops a cycle\n out.add(next);\n for (const d of forward.get(next) ?? []) stack.push(d);\n }\n return out;\n },\n };\n}\n\n/**\n * Whether two `dependsOn` values name the same thing, so a retarget to what a\n * node already declares can be elided. Order is part of it: a router reads its\n * ends positionally, and swapping them reverses the edge.\n */\nexport function sameDependsOn(\n a: readonly NodeId[] | 'children' | undefined,\n b: readonly NodeId[] | 'children' | undefined,\n): boolean {\n if (a === b) return true;\n if (a === undefined || b === undefined) return false;\n if (a === 'children' || b === 'children') return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n}\n"],"mappings":";AAMA,IAAMA,IAA0B,OAAO,OAAO,CAAC,CAAC;AAWhD,SAAgBC,EACd,GACA,GACmB;CACnB,IAAMC,IAAOC,EAAK;CAElB,OADID,MAAS,KAAA,IAAkBF,IACxBE,MAAS,aAAaE,EAAWD,EAAK,EAAE,IAAID;AACrD;AAiBA,SAAgBG,IAAyC;CAEvD,IAAMC,oBAAU,IAAI,IAAyB,GAEvCC,oBAAU,IAAI,IAA+B;CAInD,SAASC,EAAc,GAAkB;EACvC,IAAMC,IAAMF,EAAQ,IAAIG,CAAE;EAC1B,IAAID,MAAQ,KAAA,GACZ;QAAK,IAAME,KAAOF,GAAK;IACrB,IAAMG,IAAMN,EAAQ,IAAIK,CAAG;IAC3B,AAAIC,MAAQ,KAAA,MACZA,EAAI,OAAOF,CAAE,GACTE,EAAI,SAAS,KAAGN,EAAQ,OAAOK,CAAG;GACxC;GACA,EAAQ,OAAOD,CAAE;EADjB;CAEF;CAEA,OAAO;EACL,IAAI,GAAI,GAAM;GAEZ,IADAF,EAAcE,CAAE,GACZR,EAAK,WAAW,GACpB;MAAQ,IAAIQ,GAAI,CAAC,GAAGR,CAAI,CAAC;IACzB,KAAK,IAAMS,KAAOT,GAAM;KACtB,IAAIU,IAAMN,EAAQ,IAAIK,CAAG;KAEzB,AADIC,MAAQ,KAAA,MAAa,oBAAM,IAAI,IAAI,GAAGN,EAAQ,IAAIK,GAAKC,CAAG,IAC9DA,EAAI,IAAIF,CAAE;IACZ;GALyB;EAM3B;EAEA,OAAO,GAAI;GACT,EAAcA,CAAE;EAClB;EAEA,QAAQ;GAEN,AADAJ,EAAQ,MAAM,GACdC,EAAQ,MAAM;EAChB;EAEA,UAAU;GACR,OAAOD,EAAQ,SAAS;EAC1B;EAEA,aAAa,GAAI;GACf,IAAMM,IAAMN,EAAQ,IAAII,CAAE;GAC1B,OAAOE,MAAQ,KAAA,IAAYZ,IAAO,CAAC,GAAGY,CAAG;EAC3C;EAEA,uBAAuB,GAAI;GAEzB,IAAMC,IAASP,EAAQ,IAAII,CAAE;GAC7B,IAAIG,MAAW,KAAA,GAAW,OAAOb;GACjC,IAAMc,oBAAM,IAAI,IAAY,GACtBC,IAAkB,CAAC,GAAGF,CAAM;GAClC,OAAOE,EAAM,SAAS,IAAG;IACvB,IAAMC,IAAOD,EAAM,IAAI;IACvB,IAAI,GAAI,IAAIC,CAAI,GAChB;OAAI,IAAIA,CAAI;KACZ,KAAK,IAAMC,KAAKX,EAAQ,IAAIU,CAAI,KAAK,CAAC,GAAG,EAAM,KAAKC,CAAC;IADzC;GAEd;GACA,OAAOH;EACT;CACF;AACF;AAOA,SAAgBI,EACd,GACA,GACS;CACT,IAAIC,MAAMC,GAAG,OAAO;CAGpB,IAFID,MAAM,KAAA,KAAaC,MAAM,KAAA,KACzBD,MAAM,cAAcC,MAAM,cAC1BD,EAAE,WAAWC,EAAE,QAAQ,OAAO;CAClC,KAAK,IAAIC,IAAI,GAAGA,IAAIF,EAAE,QAAQ,KAAK,IAAIA,EAAEE,OAAOD,EAAEC,IAAI,OAAO;CAC7D,OAAO;AACT"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { dropPoseKeyedMemoSlots as e, nodeMemo as t } from "./nodeMemo.js";
|
|
2
|
+
import { recordDeps as n, sameDeps as r } from "./depMemo.js";
|
|
3
|
+
import { dependencyIdsOf as i } from "./dependents.js";
|
|
4
|
+
//#region src/core/scene/derivedPath.ts
|
|
5
|
+
var a = "kit:derivedPath", o = /* @__PURE__ */ new Set(), s = 0;
|
|
6
|
+
function c(n, c, u, d = a) {
|
|
7
|
+
let f = n.derivePath;
|
|
8
|
+
if (f === void 0) return null;
|
|
9
|
+
let p = i(n, u);
|
|
10
|
+
if (p.length === 0) return null;
|
|
11
|
+
if (o.has(n.id)) return s++, null;
|
|
12
|
+
o.add(n.id);
|
|
13
|
+
let m = s;
|
|
14
|
+
try {
|
|
15
|
+
let i = !1, a = t(n, d, n.pose, () => (i = !0, l(n, f, p.map(c), {
|
|
16
|
+
nodes: [],
|
|
17
|
+
poses: [],
|
|
18
|
+
path: null
|
|
19
|
+
})));
|
|
20
|
+
return !i && !r(a, p, c) && l(n, f, p.map(c), a), s !== m && e(n), a.path;
|
|
21
|
+
} finally {
|
|
22
|
+
o.delete(n.id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function l(e, t, r, i) {
|
|
26
|
+
return i.path = t(e, r), n(i, r), i;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { c as resolveDerivedPath };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=derivedPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivedPath.js","names":["SLOT","resolving","cycleHits","resolveDerivedPath","derivePath","node","ids","dependencyIdsOf","childrenOf","hitsBefore","computed","record","nodeMemo","memoSlot","draw","depOf","sameDeps","dropPoseKeyedMemoSlots","deps","recordDeps","into"],"sources":["../../../src/core/scene/derivedPath.ts"],"sourcesContent":["/**\n * `resolveDerivedPath` — the path a node computes from its dependencies.\n *\n * It sits beside `derivedPose` rather than in `canvas/` because a *pose* can\n * now derive from a dependency's path: an edge label is positioned along the\n * route it labels, and `effectivePose` is what resolves it. The render walk's\n * wrapper stays in `canvas/derivedPath.ts`.\n *\n * Invalidation is both pushed and pulled. The scene pushes — dropping the\n * dependent's memo slot on the edits it performs — and on a memo hit this\n * module re-resolves the dependencies and compares their poses *by value*\n * against the ones the cached path was drawn from. The pull is what covers a\n * dependency that moved with no scene edit behind it: a lookup answering poses\n * of its own (`sceneDepLookup(scene, toPose)`), an ancestor's frame moving, a\n * dependency appearing or going away. Value, not reference: a pose override\n * mutates its buffer in place, so the reference never moves.\n *\n * The pull covers poses only. A derivation is handed each dependency's whole\n * node, so one reading `data` or `layer` still rides on the scene's push.\n */\nimport type { Path } from '@weasel-js/geom';\nimport { dependencyIdsOf } from './dependents';\nimport { dropPoseKeyedMemoSlots, nodeMemo } from './nodeMemo';\nimport { recordDeps, sameDeps, type DepRecord } from './depMemo';\nimport type { DerivedDep, NodeId } from './types';\n\nconst SLOT = 'kit:derivedPath';\n\n/** The subset of a node this module reads. Structural so a `Node` satisfies it\n * without importing the full generic shape. */\nexport interface PathDerivingNode<TPose> {\n id: NodeId;\n pose: TPose;\n /** Read only by the memo, which keys on its reference alongside the pose. */\n data?: unknown;\n dependsOn?: readonly NodeId[] | 'children';\n derivePath?: (\n node: never,\n deps: readonly (DerivedDep<TPose> | undefined)[],\n ) => Path | null;\n}\n\n/** A cached path, with what it was drawn from. */\ninterface PathMemo<TPose> extends DepRecord<TPose> {\n path: Path | null;\n}\n\n/** Ids whose path is on the stack. A dependency graph is meant to be acyclic\n * and `dependsOn` is unvalidated; now that a path can read another path, a\n * cycle has to resolve to `null` at whichever node closes it rather than\n * overflowing the stack. */\nconst resolving = new Set<NodeId>();\n\n/** Bumped each time the guard above fires, so a value computed from a\n * fallback is not cached — it is an artifact of which node was asked first. */\nlet cycleHits = 0;\n\n/**\n * The path `node` computes from its dependencies, or `null` when it derives\n * from nothing (the normal case) or its `derivePath` has nothing to draw.\n *\n * `depOf` supplies each dependency — its node, the pose it is painted at, and\n * its own path; one it cannot resolve reaches `derivePath` as `undefined`.\n * `childrenOf` answers a node whose `dependsOn` is `'children'`.\n *\n * `memoSlot` separates a `depOf` that answers different poses than the scene's\n * own — the memo key cannot see which lookup filled it.\n */\nexport function resolveDerivedPath<TPose>(\n node: PathDerivingNode<TPose>,\n depOf: (id: NodeId) => DerivedDep<TPose> | undefined,\n childrenOf: (id: NodeId) => readonly NodeId[],\n memoSlot: string = SLOT,\n): Path | null {\n const derivePath = node.derivePath;\n if (derivePath === undefined) return null;\n const ids = dependencyIdsOf(node, childrenOf);\n if (ids.length === 0) return null;\n if (resolving.has(node.id)) {\n cycleHits++;\n return null;\n }\n resolving.add(node.id);\n const hitsBefore = cycleHits;\n try {\n let computed = false;\n const record = nodeMemo<PathMemo<TPose>>(node, memoSlot, node.pose, () => {\n computed = true;\n return draw(node, derivePath, ids.map(depOf), { nodes: [], poses: [], path: null });\n });\n // Mutating the record in place is what updates the memo slot, which holds\n // this object.\n if (!computed && !sameDeps(record, ids, depOf)) {\n draw(node, derivePath, ids.map(depOf), record);\n }\n if (cycleHits !== hitsBefore) dropPoseKeyedMemoSlots(node);\n return record.path;\n } finally {\n resolving.delete(node.id);\n }\n}\n\n/** Run `derivePath` against `deps` and record what it was run against. */\nfunction draw<TPose>(\n node: PathDerivingNode<TPose>,\n derivePath: NonNullable<PathDerivingNode<TPose>['derivePath']>,\n deps: readonly (DerivedDep<TPose> | undefined)[],\n into: PathMemo<TPose>,\n): PathMemo<TPose> {\n into.path = derivePath(node as never, deps);\n recordDeps(into, deps);\n return into;\n}\n\n"],"mappings":";;;;AA0BA,IAAMA,IAAO,mBAyBPC,oBAAY,IAAI,IAAY,GAI9BC,IAAY;AAahB,SAAgBC,EACd,GACA,GACA,GACA,IAAmBH,GACN;CACb,IAAMI,IAAaC,EAAK;CACxB,IAAID,MAAe,KAAA,GAAW,OAAO;CACrC,IAAME,IAAMC,EAAgBF,GAAMG,CAAU;CAC5C,IAAIF,EAAI,WAAW,GAAG,OAAO;CAC7B,IAAIL,EAAU,IAAII,EAAK,EAAE,GAEvB,OADA,KACO;CAET,EAAU,IAAIA,EAAK,EAAE;CACrB,IAAMI,IAAaP;CACnB,IAAI;EACF,IAAIQ,IAAW,IACTC,IAASC,EAA0BP,GAAMQ,GAAUR,EAAK,aAC5D,IAAW,IACJS,EAAKT,GAAMD,GAAYE,EAAI,IAAIS,CAAK,GAAG;GAAE,OAAO,CAAC;GAAG,OAAO,CAAC;GAAG,MAAM;EAAK,CAAC,EACnF;EAOD,OAJI,CAACL,KAAY,CAACM,EAASL,GAAQL,GAAKS,CAAK,KAC3CD,EAAKT,GAAMD,GAAYE,EAAI,IAAIS,CAAK,GAAGJ,CAAM,GAE3CT,MAAcO,KAAYQ,EAAuBZ,CAAI,GAClDM,EAAO;CAChB,UAAU;EACR,EAAU,OAAON,EAAK,EAAE;CAC1B;AACF;AAGA,SAASS,EACP,GACA,GACA,GACA,GACiB;CAGjB,OAFA,EAAK,OAAOV,EAAWC,GAAea,CAAI,GAC1CC,EAAWC,GAAMF,CAAI,GACdE;AACT"}
|