@weasel-js/core 1.9.3 → 1.9.4
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 +356 -0
- package/README.md +2 -2
- package/dist/WeaselProvider.js +5 -5
- package/dist/affordances/composeAffordanceLayer.js +10 -20
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +25 -17
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +27 -20
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/rotationHandle.js +18 -18
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/momentum.js +93 -55
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/loop.js +10 -12
- package/dist/animation/loop.js.map +1 -1
- package/dist/animation/reflow.js +8 -8
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/stagger.js +64 -56
- package/dist/animation/stagger.js.map +1 -1
- package/dist/animation/timeline/booking.js +62 -54
- package/dist/animation/timeline/booking.js.map +1 -1
- package/dist/animation/timeline/createTimeline.js +85 -76
- package/dist/animation/timeline/createTimeline.js.map +1 -1
- package/dist/animation/timeline/sampleTrack.js +13 -5
- package/dist/animation/timeline/sampleTrack.js.map +1 -1
- package/dist/animation/useAnimator.js +45 -35
- package/dist/animation/useAnimator.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +31 -24
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +28 -26
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js +13 -0
- package/dist/animation/wrappers/instantPose.js.map +1 -0
- package/dist/{poseDescriptor-D-OH-tu5.d.ts → autoPoseDescriptor-Ct7yqivU.d.ts} +28 -3
- package/dist/barrel/chrome.js +16 -0
- package/dist/barrel/input.js +19 -0
- package/dist/barrel/interactions.js +42 -0
- package/dist/barrel/paint.js +18 -0
- package/dist/barrel/paths.js +19 -0
- package/dist/barrel/renderer.js +20 -0
- package/dist/barrel/routing.js +51 -0
- package/dist/barrel/text.js +18 -0
- package/dist/barrel/viewport.js +52 -0
- package/dist/builtins-DPcdghtB.d.ts +1223 -0
- package/dist/canvas/Canvas.js +363 -448
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +164 -165
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +37 -32
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +49 -43
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/MinimapCanvas.js +26 -25
- package/dist/canvas/MinimapCanvas.js.map +1 -1
- package/dist/canvas/NodeShape.js +59 -377
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js +50 -47
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +167 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +13 -13
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +67 -0
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/coordTrace.js +10 -0
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +112 -70
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +1 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js +12 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +29 -28
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
- package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
- package/dist/canvas/SceneCanvas/props.js +38 -0
- package/dist/canvas/SceneCanvas/props.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +46 -48
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +33 -33
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +534 -788
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +45 -43
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +91 -0
- package/dist/canvas/buildSceneLayer.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +16 -19
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +68 -52
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/deps/changes.js +13 -0
- package/dist/canvas/deps/changes.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +28 -28
- package/dist/canvas/deps/insert.js +119 -91
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/slice.js +46 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +10 -9
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/derivedPath.js +46 -23
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +7 -7
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/kitRequirements.js +2 -2
- package/dist/canvas/kitRequirements.js.map +1 -1
- package/dist/canvas/layerOrder.js +13 -6
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/minimapMath.js +12 -10
- package/dist/canvas/minimapMath.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +34 -0
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/imagePainter.js +87 -0
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/memo.js +9 -0
- package/dist/canvas/nodeShapes/memo.js.map +1 -0
- package/dist/canvas/nodeShapes/nodePaint.js +57 -0
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
- package/dist/canvas/nodeShapes/pathPainter.js +38 -0
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/poseBox.js +20 -0
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/shapePainter.js +72 -0
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/textPainter.js +55 -0
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +10 -11
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/canvas/pickWalk.js +52 -63
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/poseRotation.js +11 -23
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/renderDebugSnapshot.js +5 -5
- package/dist/canvas/renderSceneToPixels.js +3 -1
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +66 -148
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +112 -0
- package/dist/canvas/sceneClipboard.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +39 -40
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/useCanvasRenderer.js +14 -6
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasView.js +58 -0
- package/dist/canvas/useCanvasView.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +35 -26
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +21 -0
- package/dist/canvas/useSceneLayerList.js.map +1 -0
- package/dist/clipboard.d.ts +10 -6
- package/dist/clone.d.ts +4 -3
- package/dist/core/adapters/arrayAdapter.js +48 -39
- package/dist/core/adapters/arrayAdapter.js.map +1 -1
- package/dist/core/device/index.js +5 -4
- package/dist/core/device/useDeviceProfile.js +38 -44
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/device/watchDevicePixelRatio.js +17 -0
- package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
- package/dist/core/fillInPoseFrame.js.map +1 -1
- package/dist/core/geometry/poseDescriptor.js +21 -19
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/poseFrame.js +44 -0
- package/dist/core/geometry/poseFrame.js.map +1 -0
- package/dist/core/geometry/poseRotation.js.map +1 -1
- package/dist/core/geometry/regionHit.js +9 -10
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/unionBounds.js +31 -29
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +2 -11
- package/dist/core/ops/arrange.js +1 -0
- package/dist/core/ops/arrange.js.map +1 -1
- package/dist/core/ops/create.js +10 -5
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/delete.js +12 -24
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +43 -40
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +34 -0
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -0
- package/dist/core/paintKinds.js +5 -5
- package/dist/core/paintKinds.js.map +1 -1
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/appliedLog.js +37 -0
- package/dist/core/scene/appliedLog.js.map +1 -0
- package/dist/core/scene/arrivalWindow.js +101 -0
- package/dist/core/scene/arrivalWindow.js.map +1 -0
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/historyFacade.js +84 -0
- package/dist/core/scene/historyFacade.js.map +1 -0
- package/dist/core/scene/kitOps.js +173 -0
- package/dist/core/scene/kitOps.js.map +1 -0
- package/dist/core/scene/layerStack.js +38 -0
- package/dist/core/scene/layerStack.js.map +1 -0
- package/dist/core/scene/lockGuard.js +37 -0
- package/dist/core/scene/lockGuard.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +5 -6
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +45 -19
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +126 -0
- package/dist/core/scene/nodeStore.js.map +1 -0
- package/dist/core/scene/pickability.js +6 -0
- package/dist/core/scene/pickability.js.map +1 -0
- package/dist/core/scene/poseFeed.js +38 -38
- package/dist/core/scene/poseFeed.js.map +1 -1
- package/dist/core/scene/poseOverrides.js +34 -38
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/renderOrder.js +84 -0
- package/dist/core/scene/renderOrder.js.map +1 -0
- package/dist/core/scene/scene.js +289 -866
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/serialization.js +68 -0
- package/dist/core/scene/serialization.js.map +1 -0
- package/dist/core/scene/treeOrder.js +13 -0
- package/dist/core/scene/treeOrder.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/viewport/meanScale.js +1 -1
- package/dist/core/viewport/meanScale.js.map +1 -1
- package/dist/core/viewport/view.js +12 -12
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/zoomBounds.js +10 -8
- package/dist/core/viewport/zoomBounds.js.map +1 -1
- package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-CtCb8a3G.d.ts} +1 -1
- package/dist/debug/createDebugOverlayLayer.js +14 -14
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/flag.js +2 -41
- package/dist/features/chrome-caps/useHoverTracking.js +22 -17
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/focus/gateLayer.js +3 -4
- package/dist/features/focus/gateLayer.js.map +1 -1
- package/dist/features/images/imageCache.js +19 -9
- package/dist/features/images/imageCache.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +14 -11
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/index.js +1 -1
- package/dist/features/ingestion/registerKitHandlers.js +7 -7
- package/dist/features/ingestion/weaselJsonHandler.js +17 -14
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/meshPaint/lazyKind.js +201 -35
- package/dist/features/meshPaint/lazyKind.js.map +1 -1
- package/dist/features/meshPaint/meshPaint.js +82 -79
- package/dist/features/meshPaint/meshPaint.js.map +1 -1
- package/dist/features/minimap/createMinimapContribution.js +42 -42
- package/dist/features/minimap/layers.js +44 -62
- package/dist/features/minimap/layers.js.map +1 -1
- package/dist/features/parallax/createParallaxPlane.js +10 -14
- package/dist/features/parallax/createParallaxPlane.js.map +1 -1
- package/dist/features/paths/anchorEdits.js +19 -8
- package/dist/features/paths/anchorEdits.js.map +1 -1
- package/dist/features/paths/anchors.js +31 -26
- package/dist/features/paths/anchors.js.map +1 -1
- package/dist/features/paths/booleans.js +2 -2
- package/dist/features/paths/index.js +13 -11
- package/dist/features/paths/markerCommands.js +37 -36
- package/dist/features/paths/markerCommands.js.map +1 -1
- package/dist/features/paths/pathInWorld.js +19 -19
- package/dist/features/paths/pathInWorld.js.map +1 -1
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/strokeToPath.js +40 -0
- package/dist/features/paths/strokeToPath.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -1
- package/dist/features/patterns/commandPaint.js +18 -0
- package/dist/features/patterns/commandPaint.js.map +1 -0
- package/dist/features/patterns/index.js +5 -17
- package/dist/features/patterns/index.js.map +1 -1
- package/dist/features/patterns/rasterizeTile.js +17 -0
- package/dist/features/patterns/rasterizeTile.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +52 -44
- package/dist/features/patterns/resolveSpec.js.map +1 -1
- package/dist/features/poseRun/usePoseRun.js +8 -3
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/SelectionContext.js +5 -0
- package/dist/features/selection/SelectionContext.js.map +1 -1
- package/dist/features/selection/overlay.js +18 -18
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/domOffsets.js +82 -0
- package/dist/features/text/domOffsets.js.map +1 -0
- package/dist/features/text/domRuns.js +103 -131
- package/dist/features/text/domRuns.js.map +1 -1
- package/dist/features/text/hitTest.js +5 -2
- package/dist/features/text/hitTest.js.map +1 -1
- package/dist/features/text/isTextData.js +8 -0
- package/dist/features/text/isTextData.js.map +1 -0
- package/dist/features/text/overlayDirection.js +15 -0
- package/dist/features/text/overlayDirection.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +32 -34
- package/dist/features/text/runs/rangeStyle.js.map +1 -1
- package/dist/features/text/textCommand.js +34 -33
- package/dist/features/text/textCommand.js.map +1 -1
- package/dist/features/text/textToPath.js +40 -40
- package/dist/features/text/textToPath.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +76 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/text/useTextEdit.js +184 -160
- package/dist/features/text/useTextEdit.js.map +1 -1
- package/dist/features/tiling/createTiledLayer.js +24 -22
- package/dist/features/tiling/createTiledLayer.js.map +1 -1
- package/dist/index.d.ts +11033 -7749
- package/dist/index.js +316 -309
- package/dist/input/keyState.js +42 -43
- package/dist/input/keyState.js.map +1 -1
- package/dist/input/useKeyModifiers.js +11 -0
- package/dist/input/useKeyModifiers.js.map +1 -0
- package/dist/interactions/actions/align/align.js +8 -8
- package/dist/interactions/actions/clipboard/clipboardOps.js +34 -32
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -1
- package/dist/interactions/actions/defaultCommitAdapter.js +20 -18
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/align.js +9 -10
- package/dist/interactions/actions/defaults/align.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +59 -81
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js +35 -38
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/clipboard.js +26 -10
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -1
- package/dist/interactions/actions/defaults/clone.js +44 -60
- package/dist/interactions/actions/defaults/clone.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +40 -0
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +14 -13
- package/dist/interactions/actions/defaults/distribute.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +17 -57
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/editAnchors.js +18 -18
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/flip.js +52 -46
- package/dist/interactions/actions/defaults/flip.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +43 -48
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +35 -33
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insert.js +50 -51
- package/dist/interactions/actions/defaults/insert.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +7 -7
- package/dist/interactions/actions/defaults/lassoSelect.js +67 -70
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/move.js +267 -249
- package/dist/interactions/actions/defaults/move.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +40 -68
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
- package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +2 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/resize.js +104 -98
- package/dist/interactions/actions/defaults/resize.js.map +1 -1
- package/dist/interactions/actions/defaults/rotate.js +111 -110
- package/dist/interactions/actions/defaults/rotate.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +7 -7
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -4
- package/dist/interactions/actions/defaults/setStroke.js +12 -12
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
- package/dist/interactions/actions/defaults/sliceOps.js +19 -19
- package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/geometry.js +28 -23
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/helpers.js +30 -17
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/hitSelection.js +8 -0
- package/dist/interactions/actions/hitSelection.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +32 -21
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/gestureAdapter.js +32 -15
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +33 -0
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +18 -18
- package/dist/interactions/actions/poseDescriptorDep.js +16 -4
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +11 -6
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/previewOverrides.js +5 -5
- package/dist/interactions/actions/previewOverrides.js.map +1 -1
- package/dist/interactions/actions/selectionSubtree.js +69 -0
- package/dist/interactions/actions/selectionSubtree.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +66 -62
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
- package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +8 -6
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/{math-Drrw4ewZ.d.ts → math-J-ACHyEg.d.ts} +1 -2
- package/dist/math.d.ts +2 -3
- package/dist/move.d.ts +12 -11
- package/dist/{originProjection-DEklpDc_.d.ts → originProjection-gHnOup4e.d.ts} +1 -1
- package/dist/{registerProgram-BMZRDgrh.d.ts → registerProgram-T9S_PfAX.d.ts} +18 -7
- package/dist/renderer/DrawCommand.js.map +1 -1
- package/dist/renderer/WeaselRenderer.js +75 -73
- package/dist/renderer/WeaselRenderer.js.map +1 -1
- package/dist/renderer/cache/GLImageCache.js +15 -5
- package/dist/renderer/cache/GLImageCache.js.map +1 -1
- package/dist/renderer/cache/GLMeshCache.js +23 -23
- package/dist/renderer/cache/GLMeshCache.js.map +1 -1
- package/dist/renderer/cache/GLTextureCache.js +18 -1
- package/dist/renderer/cache/GLTextureCache.js.map +1 -1
- package/dist/renderer/cache/cache.js.map +1 -1
- package/dist/renderer/cache/markerCommandCache.js.map +1 -1
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -1
- package/dist/renderer/cullDrawCommands.js +11 -11
- package/dist/renderer/draw/batch.js +133 -0
- package/dist/renderer/draw/batch.js.map +1 -0
- package/dist/renderer/draw/clip.js +89 -0
- package/dist/renderer/draw/clip.js.map +1 -0
- package/dist/renderer/draw/customShader.js +230 -0
- package/dist/renderer/draw/customShader.js.map +1 -0
- package/dist/renderer/draw/drawTriangles.js +8 -0
- package/dist/renderer/draw/drawTriangles.js.map +1 -0
- package/dist/renderer/draw/effects.js +28 -0
- package/dist/renderer/draw/effects.js.map +1 -0
- package/dist/renderer/draw/flushBatch.js +35 -0
- package/dist/renderer/draw/flushBatch.js.map +1 -0
- package/dist/renderer/draw/gradient.js +90 -0
- package/dist/renderer/draw/gradient.js.map +1 -0
- package/dist/renderer/draw/image.js +38 -0
- package/dist/renderer/draw/image.js.map +1 -0
- package/dist/renderer/draw/mesh.js +16 -0
- package/dist/renderer/draw/mesh.js.map +1 -0
- package/dist/renderer/draw/paintBind.js +70 -0
- package/dist/renderer/draw/paintBind.js.map +1 -0
- package/dist/renderer/draw/pathPaint.js +142 -0
- package/dist/renderer/draw/pathPaint.js.map +1 -0
- package/dist/renderer/draw/scratchPass.js +83 -0
- package/dist/renderer/draw/scratchPass.js.map +1 -0
- package/dist/renderer/draw/stencil.js +28 -0
- package/dist/renderer/draw/stencil.js.map +1 -0
- package/dist/renderer/draw/text.js +167 -0
- package/dist/renderer/draw/text.js.map +1 -0
- package/dist/renderer/draw/uniforms.js +77 -0
- package/dist/renderer/draw/uniforms.js.map +1 -0
- package/dist/renderer/draw.js +60 -1116
- package/dist/renderer/draw.js.map +1 -1
- package/dist/renderer/effects/EffectTargets.js +3 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -1
- package/dist/renderer/effects/composite.js +7 -5
- package/dist/renderer/effects/composite.js.map +1 -1
- package/dist/renderer/index.js +18 -17
- package/dist/renderer/math/color.js +63 -83
- package/dist/renderer/math/color.js.map +1 -1
- package/dist/renderer/math/mat3.js +15 -11
- package/dist/renderer/math/mat3.js.map +1 -1
- package/dist/renderer/math/viewToMat3.js +1 -1
- package/dist/renderer/math/viewToMat3.js.map +1 -1
- package/dist/renderer/shaders/ShaderProgram.js +13 -13
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -1
- package/dist/renderer/shaders/glyphPaint.js +3 -3
- package/dist/renderer/shaders/glyphPaint.js.map +1 -1
- package/dist/renderer/shaders/gradFill.js +2 -1
- package/dist/renderer/shaders/gradFill.js.map +1 -1
- package/dist/renderer/shaders/pathFill.js +2 -1
- package/dist/renderer/shaders/pathFill.js.map +1 -1
- package/dist/renderer/shaders/patternFill.js +2 -1
- package/dist/renderer/shaders/patternFill.js.map +1 -1
- package/dist/renderer/shaders/registerProgram.js.map +1 -1
- package/dist/renderer/strokeLengths.js.map +1 -1
- package/dist/renderer/textures/registerTexture.js +25 -5
- package/dist/renderer/textures/registerTexture.js.map +1 -1
- package/dist/renderer.d.ts +16 -15
- package/dist/renderer.js +17 -16
- package/dist/resize.d.ts +5 -6
- package/dist/resize.js +5 -5
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js +12 -6
- package/dist/test-hook/install.js.map +1 -1
- package/dist/{test-seams-CuIxe0xY.d.ts → test-seams-DM2B87-g.d.ts} +4 -4
- package/dist/test-seams.d.ts +2 -2
- package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js +1 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js +11 -11
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +1 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +153 -103
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +1 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +24 -23
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +51 -48
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js +17 -0
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +49 -54
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +22 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +1 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/useKeybindings.js +14 -30
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-B_9g6hMM.d.ts → types-B4iJRHC3.d.ts} +5 -1
- package/dist/{types-A37hYkeR.d.ts → types-k-5Oqh-U.d.ts} +31 -7
- package/dist/util/color.js +3 -3
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +20 -18
- package/dist/autoPoseDescriptor-vCdt55xm.d.ts +0 -27
- package/dist/builtins-C-VgUlWI.d.ts +0 -4514
- package/dist/core/isPlainObject.js.map +0 -1
- package/dist/debug/flag.js.map +0 -1
- package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
- package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
- package/dist/renderer/shaders/imageFill.js +0 -14
- package/dist/renderer/shaders/imageFill.js.map +0 -1
- package/dist/tools/prefs.js +0 -62
- package/dist/tools/prefs.js.map +0 -1
package/dist/core/scene/scene.js
CHANGED
|
@@ -1,677 +1,194 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { sameDependsOn as e } from "./dependents.js";
|
|
2
|
+
import { rebuildOp as t } from "../ops/registry.js";
|
|
3
|
+
import { dwarn as n } from "../../debug/flag.js";
|
|
3
4
|
import { asNodeId as r } from "./types.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { createArrangeOp as i } from "../ops/arrange.js";
|
|
6
|
+
import { withKitRegistry as a } from "./kitRegistry.js";
|
|
7
|
+
import { createNodeFnFields as o, fnKeysOf as s } from "./nodeFnFields.js";
|
|
8
|
+
import { createPoseOverrides as c } from "./poseOverrides.js";
|
|
9
|
+
import { createRenderOrder as ee } from "./renderOrder.js";
|
|
10
|
+
import { createLockGuard as te } from "./lockGuard.js";
|
|
11
|
+
import { createArrivalWindow as ne } from "./arrivalWindow.js";
|
|
12
|
+
import { createSceneHistory as re } from "./historyFacade.js";
|
|
13
|
+
import { createNodeStore as ie } from "./nodeStore.js";
|
|
14
|
+
import { createAppliedLog as ae } from "./appliedLog.js";
|
|
15
|
+
import { createLayerStack as oe } from "./layerStack.js";
|
|
16
|
+
import { registerKitOps as se } from "./kitOps.js";
|
|
17
|
+
import { layerFromSerialized as ce, serializeScene as le, specsFromSerialized as ue } from "./serialization.js";
|
|
18
|
+
import { resized as de, resolveLayoutFrame as fe, runLayoutPass as pe } from "./layoutPass.js";
|
|
19
|
+
import { createHistory as me } from "@weasel-js/history";
|
|
13
20
|
//#region src/core/scene/scene.ts
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
function ue(e) {
|
|
19
|
-
let t = {
|
|
20
|
-
id: e.id,
|
|
21
|
-
visible: e.visible ?? !0,
|
|
22
|
-
locked: e.locked ?? !1,
|
|
23
|
-
...e.parallax ? { parallax: e.parallax } : {}
|
|
24
|
-
};
|
|
25
|
-
return e.kind === "user" ? {
|
|
26
|
-
...t,
|
|
27
|
-
kind: "user",
|
|
28
|
-
name: e.name ?? e.id
|
|
29
|
-
} : {
|
|
30
|
-
...t,
|
|
31
|
-
kind: "system"
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function d(o) {
|
|
35
|
-
if (!o.systemLayers || o.systemLayers.length === 0) throw Error("useScene: systemLayers must declare at least one layer");
|
|
21
|
+
var l = 0, he = () => r(`n${(l++).toString(36)}-${Math.random().toString(36).slice(2, 8)}`);
|
|
22
|
+
function u(l) {
|
|
23
|
+
if (!l.systemLayers || l.systemLayers.length === 0) throw Error("useScene: systemLayers must declare at least one layer");
|
|
36
24
|
let u = {
|
|
37
25
|
nodes: /* @__PURE__ */ new Map(),
|
|
38
26
|
roots: [],
|
|
39
27
|
layers: [],
|
|
40
28
|
layerIndex: /* @__PURE__ */ new Map()
|
|
41
|
-
}, d = te(
|
|
29
|
+
}, d = ee(u), { isLocked: f, refuse: p, refuseLayer: m, reachable: h, lifted: g } = te(u), _ = d.invalidate, v = a(l.registry ?? {}), y = o(v), b = (e) => y.find((t) => t.spec.field === e), ge = fe(l.layoutFrame), x = !1;
|
|
42
30
|
{
|
|
43
|
-
let e =
|
|
31
|
+
let e = b("layout"), t = e.write;
|
|
44
32
|
e.write = (e, n) => {
|
|
45
|
-
e.kind === "container" && (
|
|
33
|
+
e.kind === "container" && (x = !0), t(e, n);
|
|
46
34
|
};
|
|
47
35
|
}
|
|
48
|
-
function
|
|
36
|
+
function _e(e) {
|
|
49
37
|
let t = u.nodes.get(e);
|
|
50
38
|
return t?.kind === "container" ? t.layout ?? null : null;
|
|
51
39
|
}
|
|
52
|
-
let
|
|
53
|
-
function
|
|
54
|
-
if (_(u.nodes.get(t)?.parent ?? null), m.isEmpty()) return;
|
|
55
|
-
let n = [t];
|
|
56
|
-
q(t, n);
|
|
57
|
-
for (let t of n) for (let n of m.transitiveDependentsOf(t)) {
|
|
58
|
-
let t = u.nodes.get(n);
|
|
59
|
-
t !== void 0 && e(t);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function _(t) {
|
|
63
|
-
if (h.size === 0) return;
|
|
64
|
-
let n = t;
|
|
65
|
-
for (; n !== null;) {
|
|
66
|
-
let t = u.nodes.get(n);
|
|
67
|
-
if (t === void 0) return;
|
|
68
|
-
if (h.has(n)) {
|
|
69
|
-
e(t);
|
|
70
|
-
for (let t of m.transitiveDependentsOf(n)) {
|
|
71
|
-
let n = u.nodes.get(t);
|
|
72
|
-
n !== void 0 && e(n);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
n = t.parent;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function he(e, t) {
|
|
79
|
-
t === "children" ? h.add(e) : h.delete(e);
|
|
80
|
-
}
|
|
81
|
-
function ge(t, n) {
|
|
82
|
-
let r = B(t);
|
|
83
|
-
n === void 0 ? delete r.dependsOn : r.dependsOn = n, m.add(t, n === void 0 || n === "children" ? [] : n), he(t, n), e(B(t)), g(t);
|
|
84
|
-
}
|
|
85
|
-
for (let e = 0; e < o.systemLayers.length; e++) {
|
|
86
|
-
let t = o.systemLayers[e];
|
|
87
|
-
if (u.layerIndex.has(t.id)) throw Error(`useScene: duplicate system layer id "${t.id}"`);
|
|
88
|
-
u.layers.push({
|
|
89
|
-
kind: "system",
|
|
90
|
-
id: t.id,
|
|
91
|
-
visible: t.visible ?? !0,
|
|
92
|
-
locked: t.locked ?? !1,
|
|
93
|
-
...t.parallax ? { parallax: t.parallax } : {}
|
|
94
|
-
}), u.layerIndex.set(t.id, e);
|
|
95
|
-
}
|
|
96
|
-
let _e = o.generateId ?? ce, v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Map(), ve = null;
|
|
97
|
-
function ye(e) {
|
|
40
|
+
let ve = ie(u, _, y), { dependents: ye, childDerived: be, invalidateDependents: xe, requireNode: S, siblingsOf: C, descendants: Se, removalClosure: Ce, patchNodeFunctions: w } = ve, { requireLayerIndex: T, rebuildLayerIndex: we, assertSubtreeLayer: E } = oe(u, _, l.systemLayers), D = l.generateId ?? he, O = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Map(), A = null;
|
|
41
|
+
function j(e) {
|
|
98
42
|
return {
|
|
99
43
|
name: e.name,
|
|
100
44
|
args: e.args,
|
|
101
45
|
label: e.label,
|
|
102
|
-
coalesceKey
|
|
46
|
+
get coalesceKey() {
|
|
47
|
+
return e.coalesceKey;
|
|
48
|
+
},
|
|
49
|
+
elideNoop: e.elideNoop,
|
|
103
50
|
apply: () => {
|
|
104
|
-
let t =
|
|
105
|
-
if (!t) return
|
|
51
|
+
let t = A;
|
|
52
|
+
if (!t) return n("scene", `restored op "${e.name ?? "?"}" has no history adapter — skipping (setHistoryAdapter was not wired)`), "noop";
|
|
106
53
|
try {
|
|
107
54
|
return e.apply(t());
|
|
108
55
|
} catch (t) {
|
|
109
|
-
return
|
|
56
|
+
return n("scene", `restored op "${e.name ?? "?"}" failed against the history adapter — skipping: ${String(t)}`), "noop";
|
|
110
57
|
}
|
|
111
58
|
},
|
|
112
|
-
invert: () =>
|
|
59
|
+
invert: () => j(e.invert())
|
|
113
60
|
};
|
|
114
61
|
}
|
|
115
|
-
let
|
|
62
|
+
let M = [], N = c((e) => u.nodes.get(e), xe), P = me(void 0, {
|
|
116
63
|
selection: {
|
|
117
|
-
get: () =>
|
|
64
|
+
get: () => M,
|
|
118
65
|
set: (e) => {
|
|
119
|
-
|
|
66
|
+
M = h(e), J();
|
|
120
67
|
}
|
|
121
68
|
},
|
|
122
|
-
...
|
|
123
|
-
...
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
function ke(e, t, n) {
|
|
138
|
-
if (k === null || t === null || t === n) return;
|
|
139
|
-
j.add(t);
|
|
140
|
-
let r = k.get(t);
|
|
141
|
-
r === void 0 ? k.set(t, [e]) : r.includes(e) || r.push(e);
|
|
142
|
-
}
|
|
143
|
-
function Ae(e, t, n) {
|
|
144
|
-
if (k === null || t === null || t === n || (j.add(t), k.get(t)?.includes(e))) return;
|
|
145
|
-
let r = A.get(t);
|
|
146
|
-
r === void 0 ? A.set(t, [e]) : r.includes(e) || r.push(e);
|
|
147
|
-
}
|
|
148
|
-
function N(e) {
|
|
149
|
-
k !== null && e !== null && j.add(e);
|
|
150
|
-
}
|
|
151
|
-
function P() {
|
|
152
|
-
return Oe() !== null && k === null && C === 0 && !T;
|
|
153
|
-
}
|
|
154
|
-
function je(e = !1) {
|
|
155
|
-
return k !== null || !e && Oe() === null ? !1 : (k = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set(), M = null, !0);
|
|
156
|
-
}
|
|
157
|
-
function Me() {
|
|
158
|
-
let e = M;
|
|
159
|
-
if (M = null, e !== null && e.length !== 0) for (let t of [...Ee]) t(e);
|
|
160
|
-
}
|
|
161
|
-
function Ne() {
|
|
162
|
-
let e = k;
|
|
163
|
-
k = null;
|
|
164
|
-
let t = Oe();
|
|
165
|
-
if (e === null || t === null) return [];
|
|
166
|
-
let n = /* @__PURE__ */ new Map();
|
|
167
|
-
for (let [t, r] of e) {
|
|
168
|
-
let e = r.filter((e) => u.nodes.get(e)?.parent === t);
|
|
169
|
-
e.length > 0 && u.nodes.has(t) && n.set(t, e);
|
|
170
|
-
}
|
|
171
|
-
let r = /* @__PURE__ */ new Map();
|
|
172
|
-
for (let [e, t] of A) {
|
|
173
|
-
let n = t.filter((t) => u.nodes.get(t)?.parent !== e);
|
|
174
|
-
n.length > 0 && u.nodes.has(e) && r.set(e, n);
|
|
175
|
-
}
|
|
176
|
-
A = /* @__PURE__ */ new Map();
|
|
177
|
-
let a = new Set([...j].filter((e) => u.nodes.get(e)?.kind === "container"));
|
|
178
|
-
if (n.size === 0 && a.size === 0) return [];
|
|
179
|
-
let o = t(n, a, r);
|
|
180
|
-
if (o === null) throw new i(n);
|
|
181
|
-
let s = [];
|
|
182
|
-
for (let [e, t] of o) {
|
|
183
|
-
let n = u.nodes.get(e);
|
|
184
|
-
n && s.push({
|
|
185
|
-
id: e,
|
|
186
|
-
from: n.pose,
|
|
187
|
-
to: t
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
return M = s, s;
|
|
191
|
-
}
|
|
192
|
-
function Pe(e, t) {
|
|
69
|
+
...l.coalesceWindowMs === void 0 ? {} : { coalesceWindowMs: l.coalesceWindowMs },
|
|
70
|
+
...l.historyLimit === void 0 ? {} : { historyLimit: l.historyLimit },
|
|
71
|
+
rebuildOp: (e, n) => {
|
|
72
|
+
if (k.has(e)) return X(e, n);
|
|
73
|
+
if (e === "arrange") return i(n, void 0, Ne);
|
|
74
|
+
let r = t(e, n);
|
|
75
|
+
return r === null ? null : j(r);
|
|
76
|
+
}
|
|
77
|
+
}), F = 0, I = /* @__PURE__ */ new WeakMap(), Te = 1, L = 0, R = null, z = !1, B = 0, V = !1, H = l.getActiveJournal ?? null, U = ne({
|
|
78
|
+
nodes: u.nodes,
|
|
79
|
+
declared: () => x ? Me : null,
|
|
80
|
+
recordsBareEdits: () => L === 0 && !z,
|
|
81
|
+
writePose: Ne
|
|
82
|
+
}), { noteArrival: Ee, noteDeparture: De, noteChange: W, bareLayoutEdit: G, open: Oe, emitReflow: ke, settle: Ae, runEdit: je } = U, Me = (e, t, n) => pe($, _e, e, t, ge, n);
|
|
83
|
+
function Ne(e, t) {
|
|
193
84
|
$.setPose(r(e), t);
|
|
194
85
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
function Ie(e) {
|
|
199
|
-
return je(e.some(Fe)) ? {
|
|
200
|
-
ops: [...e, ne({}, Ne, Pe)],
|
|
201
|
-
owned: !0
|
|
202
|
-
} : {
|
|
203
|
-
ops: e,
|
|
204
|
-
owned: !1
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function F(e, t) {
|
|
208
|
-
let { ops: n, owned: r } = Ie(e);
|
|
209
|
-
try {
|
|
210
|
-
t(n), r && Me();
|
|
211
|
-
} catch (e) {
|
|
212
|
-
if (!(e instanceof i)) throw e;
|
|
213
|
-
} finally {
|
|
214
|
-
r && (k = null, M = null);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function Le(e) {
|
|
218
|
-
if (!u.layers.some((e) => e.locked)) return !1;
|
|
219
|
-
let t = u.nodes.get(e);
|
|
220
|
-
for (; t !== void 0;) {
|
|
221
|
-
if (u.layers[u.layerIndex.get(t.layer) ?? -1]?.locked) return !0;
|
|
222
|
-
t = t.parent === null ? void 0 : u.nodes.get(t.parent);
|
|
223
|
-
}
|
|
224
|
-
return !1;
|
|
225
|
-
}
|
|
226
|
-
function Re(e) {
|
|
227
|
-
if (Ce > 0) throw Error(`Scene: cannot ${e} inside untracked() — it records`);
|
|
228
|
-
}
|
|
229
|
-
function I(e, t) {
|
|
230
|
-
if (!(E > 0 || !Le(e))) throw Error(`Scene: cannot ${t} "${e}" — it is on a locked layer`);
|
|
231
|
-
}
|
|
232
|
-
function ze(e, t) {
|
|
233
|
-
if (!(E > 0 || !u.layers[u.layerIndex.get(e) ?? -1]?.locked)) throw Error(`Scene: cannot ${t} layer "${e}" — it is locked`);
|
|
86
|
+
function Pe(e) {
|
|
87
|
+
if (B > 0) throw Error(`Scene: cannot ${e} inside untracked() — it records`);
|
|
234
88
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return e();
|
|
242
|
-
} finally {
|
|
243
|
-
E--;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function R(e, t) {
|
|
247
|
-
let n = D, r = [], i = b;
|
|
248
|
-
D = r;
|
|
249
|
-
try {
|
|
250
|
-
let i = e();
|
|
251
|
-
return n && !t() && n.push(...r), i;
|
|
252
|
-
} catch (e) {
|
|
253
|
-
throw D = null, L(() => {
|
|
254
|
-
for (let e = r.length - 1; e >= 0; e--) {
|
|
255
|
-
let { kind: t, payload: n } = r[e];
|
|
256
|
-
y.get(t).revert(n);
|
|
257
|
-
}
|
|
258
|
-
}), b = i, r.length > 0 && z(), e;
|
|
259
|
-
} finally {
|
|
260
|
-
D = n;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
function z() {
|
|
264
|
-
if (S++, C > 0) {
|
|
265
|
-
O = !0;
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
for (let e of v) e();
|
|
269
|
-
}
|
|
270
|
-
function Ve(e) {
|
|
271
|
-
if (!f.every((e) => e.pending.size === 0)) for (let t of e) {
|
|
272
|
-
if (t.name !== "kit:add") continue;
|
|
273
|
-
let e = t.args?.id;
|
|
274
|
-
if (e && !u.nodes.has(e)) for (let t of f) t.pending.delete(e);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
function B(e) {
|
|
278
|
-
let t = u.nodes.get(e);
|
|
279
|
-
if (!t) throw Error(`Scene: unknown node id "${e}"`);
|
|
280
|
-
return t;
|
|
281
|
-
}
|
|
282
|
-
function V(e) {
|
|
283
|
-
let t = u.layerIndex.get(e);
|
|
284
|
-
if (t === void 0) throw Error(`Scene: unknown layer "${e}"`);
|
|
285
|
-
return t;
|
|
286
|
-
}
|
|
287
|
-
function H() {
|
|
288
|
-
Q(), u.layerIndex.clear();
|
|
289
|
-
for (let e = 0; e < u.layers.length; e++) u.layerIndex.set(u.layers[e].id, e);
|
|
290
|
-
}
|
|
291
|
-
function U(e, t, n, r, i = "place") {
|
|
292
|
-
if (V(t) < V(r)) {
|
|
293
|
-
let a = i === "place" ? `cannot place node '${e ?? "<new>"}' on layer '${t}' under parent '${n}' on layer '${r}'` : `cannot setLayer('${e ?? "<new>"}', '${t}') — node has parent '${n}' on layer '${r}'`;
|
|
294
|
-
throw Error(`Scene: ${a} — a child may not render below its parent's layer`);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
function W(e) {
|
|
298
|
-
if (e === null) return u.roots;
|
|
299
|
-
let t = B(e);
|
|
300
|
-
if (t.kind !== "container") throw Error(`Scene: parent "${e}" is not a container`);
|
|
301
|
-
return t.children;
|
|
302
|
-
}
|
|
303
|
-
function G(e) {
|
|
304
|
-
let t = B(e), n = W(t.parent), r = n.indexOf(e);
|
|
305
|
-
if (r < 0) throw Error(`Scene: node "${e}" not found in its parent's children`);
|
|
306
|
-
return n.splice(r, 1), Q(), {
|
|
307
|
-
parent: t.parent,
|
|
308
|
-
index: r
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
function K(e, t, n) {
|
|
312
|
-
let r = W(t), i = Math.max(0, Math.min(n, r.length));
|
|
313
|
-
r.splice(i, 0, e);
|
|
314
|
-
let a = B(e);
|
|
315
|
-
a.parent = t, Q();
|
|
316
|
-
}
|
|
317
|
-
function q(e, t) {
|
|
318
|
-
let n = u.nodes.get(e);
|
|
319
|
-
if (n && n.kind === "container") for (let e of n.children) t.push(e), q(e, t);
|
|
320
|
-
}
|
|
321
|
-
function He(e) {
|
|
322
|
-
let t = [], n = /* @__PURE__ */ new Set();
|
|
323
|
-
function r(e) {
|
|
324
|
-
if (n.has(e)) return;
|
|
325
|
-
n.add(e), t.push(e);
|
|
326
|
-
let r = [];
|
|
327
|
-
q(e, r);
|
|
328
|
-
for (let e of r) n.has(e) || (n.add(e), t.push(e));
|
|
329
|
-
}
|
|
330
|
-
for (let t of e) r(t);
|
|
331
|
-
for (let e = 0; e < t.length; e++) for (let n of m.transitiveDependentsOf(t[e])) r(n);
|
|
332
|
-
return {
|
|
333
|
-
ids: t,
|
|
334
|
-
removing: n
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
function Ue(e, t, { cacheForRedo: n }) {
|
|
338
|
-
let r = u.nodes.get(t);
|
|
339
|
-
if (r !== void 0) for (let i of f) {
|
|
340
|
-
let a = e[i.spec.field];
|
|
341
|
-
a !== void 0 && (i.spec.containersOnly && e.kind !== "container" || (i.write(r, a), n && i.pending.set(t, a)));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function We(e, t) {
|
|
345
|
-
if (!t) return;
|
|
346
|
-
let n = e;
|
|
347
|
-
for (let e of f) {
|
|
348
|
-
if (e.read(n) !== void 0) continue;
|
|
349
|
-
let r = t[e.spec.opKey];
|
|
350
|
-
r !== void 0 && ee(e, n, r, "kit:remove", l);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function J(e, t) {
|
|
354
|
-
y.set(e, t);
|
|
355
|
-
}
|
|
356
|
-
J("kit:add", {
|
|
357
|
-
apply: (e) => {
|
|
358
|
-
if (u.nodes.has(e.id)) throw Error(`Scene: id collision on "${e.id}"`);
|
|
359
|
-
let t = e.kind === "container" ? {
|
|
360
|
-
kind: "container",
|
|
361
|
-
id: e.id,
|
|
362
|
-
layer: e.layer,
|
|
363
|
-
pose: e.pose,
|
|
364
|
-
data: e.data,
|
|
365
|
-
parent: e.parent,
|
|
366
|
-
children: []
|
|
367
|
-
} : {
|
|
368
|
-
kind: "leaf",
|
|
369
|
-
id: e.id,
|
|
370
|
-
layer: e.layer,
|
|
371
|
-
pose: e.pose,
|
|
372
|
-
data: e.data,
|
|
373
|
-
parent: e.parent
|
|
374
|
-
};
|
|
375
|
-
u.nodes.set(e.id, t), K(e.id, e.parent, e.index), e.dependsOn !== void 0 && (t.dependsOn = e.dependsOn), e.pickable !== void 0 && (t.pickable = e.pickable), m.add(e.id, e.dependsOn === "children" ? [] : e.dependsOn ?? []), he(e.id, e.dependsOn);
|
|
376
|
-
let n = t;
|
|
377
|
-
for (let t of f) {
|
|
378
|
-
let r = t.pending.get(e.id);
|
|
379
|
-
if (r !== void 0) {
|
|
380
|
-
t.write(n, r);
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
let i = e[t.spec.opKey];
|
|
384
|
-
i !== void 0 && ee(t, n, i, "kit:add", l);
|
|
385
|
-
}
|
|
386
|
-
g(e.id);
|
|
387
|
-
},
|
|
388
|
-
revert: (e) => {
|
|
389
|
-
G(e.id), u.nodes.delete(e.id), m.remove(e.id), h.delete(e.id), _(e.parent), g(e.id);
|
|
390
|
-
}
|
|
391
|
-
}), J("kit:remove", {
|
|
392
|
-
apply: (e) => {
|
|
393
|
-
for (let t of e.detached) G(t.id);
|
|
394
|
-
for (let t of e.nodes) u.nodes.delete(t.id), m.remove(t.id), h.delete(t.id);
|
|
395
|
-
for (let t of e.detached) _(t.parent);
|
|
396
|
-
},
|
|
397
|
-
revert: (e) => {
|
|
398
|
-
let t = new Map((e.fnKeys ?? []).map((e) => [e.id, e]));
|
|
399
|
-
for (let n of e.nodes) {
|
|
400
|
-
let e = n.kind === "container" ? {
|
|
401
|
-
...n,
|
|
402
|
-
children: [...n.children]
|
|
403
|
-
} : { ...n };
|
|
404
|
-
We(e, t.get(n.id)), u.nodes.set(n.id, e), m.add(n.id, e.dependsOn === "children" ? [] : e.dependsOn ?? []), he(n.id, e.dependsOn);
|
|
405
|
-
}
|
|
406
|
-
for (let t of e.detached) K(t.id, t.parent, t.index);
|
|
407
|
-
for (let t of e.detached) _(t.parent);
|
|
408
|
-
}
|
|
409
|
-
}), J("kit:setPose", {
|
|
410
|
-
apply: (e) => {
|
|
411
|
-
B(e.id).pose = e.to, g(e.id);
|
|
412
|
-
},
|
|
413
|
-
revert: (e) => {
|
|
414
|
-
B(e.id).pose = e.from, g(e.id);
|
|
415
|
-
}
|
|
416
|
-
}), J("kit:setData", {
|
|
417
|
-
apply: (e) => {
|
|
418
|
-
B(e.id).data = e.to, g(e.id);
|
|
419
|
-
},
|
|
420
|
-
revert: (e) => {
|
|
421
|
-
B(e.id).data = e.from, g(e.id);
|
|
422
|
-
}
|
|
423
|
-
}), J("kit:setLayer", {
|
|
424
|
-
apply: (e) => {
|
|
425
|
-
V(e.to), B(e.id).layer = e.to, Q(), g(e.id);
|
|
89
|
+
let { atomically: K, logApplied: q } = ae({
|
|
90
|
+
registered: k,
|
|
91
|
+
lifted: g,
|
|
92
|
+
getSelection: () => M,
|
|
93
|
+
setSelection: (e) => {
|
|
94
|
+
M = e;
|
|
426
95
|
},
|
|
427
|
-
|
|
428
|
-
B(e.id).layer = e.from, Q(), g(e.id);
|
|
429
|
-
}
|
|
430
|
-
}), J("kit:setDependsOn", {
|
|
431
|
-
apply: (e) => {
|
|
432
|
-
ge(e.id, e.to);
|
|
433
|
-
},
|
|
434
|
-
revert: (e) => {
|
|
435
|
-
ge(e.id, e.from);
|
|
436
|
-
}
|
|
96
|
+
notify: J
|
|
437
97
|
});
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (i === void 0 && a !== void 0) {
|
|
442
|
-
delete n.layout, ee(r, n, a, "kit:setLayout", l);
|
|
98
|
+
function J() {
|
|
99
|
+
if (F++, L > 0) {
|
|
100
|
+
V = !0;
|
|
443
101
|
return;
|
|
444
102
|
}
|
|
445
|
-
let
|
|
446
|
-
o === null ? delete n.layout : r.write(n, o);
|
|
103
|
+
for (let e of O) e();
|
|
447
104
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
revert: (e) => {
|
|
453
|
-
Ke(e, "from");
|
|
454
|
-
}
|
|
455
|
-
}), J("kit:move", {
|
|
456
|
-
apply: (e) => {
|
|
457
|
-
G(e.id), K(e.id, e.toParent, e.toIndex), _(e.fromParent), g(e.id);
|
|
458
|
-
},
|
|
459
|
-
revert: (e) => {
|
|
460
|
-
G(e.id), K(e.id, e.fromParent, e.fromIndex), _(e.toParent), g(e.id);
|
|
461
|
-
}
|
|
462
|
-
}), J("kit:setLayerVisible", {
|
|
463
|
-
apply: (e) => {
|
|
464
|
-
u.layers[V(e.layer)].visible = e.to;
|
|
465
|
-
},
|
|
466
|
-
revert: (e) => {
|
|
467
|
-
u.layers[V(e.layer)].visible = e.from;
|
|
468
|
-
}
|
|
469
|
-
}), J("kit:setLayerLocked", {
|
|
470
|
-
apply: (e) => {
|
|
471
|
-
u.layers[V(e.layer)].locked = e.to, e.to && (b = Be(b));
|
|
472
|
-
},
|
|
473
|
-
revert: (e) => {
|
|
474
|
-
u.layers[V(e.layer)].locked = e.from;
|
|
475
|
-
}
|
|
476
|
-
}), J("kit:setLayerParallax", {
|
|
477
|
-
apply: (e) => {
|
|
478
|
-
le(u.layers[V(e.layer)], e.to);
|
|
479
|
-
},
|
|
480
|
-
revert: (e) => {
|
|
481
|
-
le(u.layers[V(e.layer)], e.from);
|
|
482
|
-
}
|
|
483
|
-
}), J("kit:addLayer", {
|
|
484
|
-
apply: (e) => {
|
|
485
|
-
u.layers.splice(e.index, 0, { ...e.record }), H();
|
|
486
|
-
},
|
|
487
|
-
revert: (e) => {
|
|
488
|
-
u.layers.splice(e.index, 1), H();
|
|
489
|
-
}
|
|
490
|
-
}), J("kit:removeLayer", {
|
|
491
|
-
apply: (e) => {
|
|
492
|
-
u.layers.splice(e.index, 1), H();
|
|
493
|
-
},
|
|
494
|
-
revert: (e) => {
|
|
495
|
-
u.layers.splice(e.index, 0, { ...e.record }), H();
|
|
496
|
-
}
|
|
497
|
-
}), J("kit:renameLayer", {
|
|
498
|
-
apply: (e) => {
|
|
499
|
-
u.layers[V(e.layer)].name = e.to;
|
|
500
|
-
},
|
|
501
|
-
revert: (e) => {
|
|
502
|
-
u.layers[V(e.layer)].name = e.from;
|
|
503
|
-
}
|
|
504
|
-
}), J("kit:moveLayer", {
|
|
505
|
-
apply: (e) => {
|
|
506
|
-
let [t] = u.layers.splice(e.from, 1);
|
|
507
|
-
u.layers.splice(e.to, 0, t), H();
|
|
105
|
+
let { layoutRefs: Fe } = se({
|
|
106
|
+
state: u,
|
|
107
|
+
register: (e, t) => {
|
|
108
|
+
k.set(e, t);
|
|
508
109
|
},
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
110
|
+
store: ve,
|
|
111
|
+
requireLayerIndex: T,
|
|
112
|
+
rebuildLayerIndex: we,
|
|
113
|
+
invalidateOrder: _,
|
|
114
|
+
fnFields: y,
|
|
115
|
+
narrowSelection: () => {
|
|
116
|
+
M = h(M);
|
|
512
117
|
}
|
|
513
118
|
});
|
|
514
|
-
function
|
|
515
|
-
let n =
|
|
119
|
+
function Y(e, t) {
|
|
120
|
+
let n = k.get(e);
|
|
516
121
|
if (!n) throw Error(`Scene: no registered op for kind "${e}"`);
|
|
517
122
|
n.apply(t);
|
|
518
123
|
}
|
|
519
|
-
function
|
|
520
|
-
if (!
|
|
124
|
+
function X(e, t, n = "fwd") {
|
|
125
|
+
if (!k.has(e)) throw Error(`Scene: no registered op for kind "${e}"`);
|
|
521
126
|
return {
|
|
522
127
|
name: e,
|
|
523
128
|
args: t,
|
|
524
|
-
coalesceKey:
|
|
129
|
+
coalesceKey: Le(e, t),
|
|
525
130
|
apply: () => {
|
|
526
|
-
let r =
|
|
131
|
+
let r = k.get(e);
|
|
527
132
|
if (!r) throw Error(`Scene: no registered op for kind "${e}"`);
|
|
528
|
-
(n === "fwd" ? r.apply : r.revert)(t);
|
|
133
|
+
(n === "fwd" ? r.apply : r.revert)(t), z && q(e, t, n === "rev");
|
|
529
134
|
},
|
|
530
|
-
invert: () =>
|
|
135
|
+
invert: () => X(e, t, n === "fwd" ? "rev" : "fwd")
|
|
531
136
|
};
|
|
532
137
|
}
|
|
533
|
-
function
|
|
138
|
+
function Ie(e, t) {
|
|
534
139
|
return {
|
|
535
140
|
name: e.name,
|
|
536
141
|
args: e.args,
|
|
537
142
|
label: e.label,
|
|
538
|
-
coalesceKey
|
|
143
|
+
get coalesceKey() {
|
|
144
|
+
return e.coalesceKey;
|
|
145
|
+
},
|
|
146
|
+
elideNoop: e.elideNoop,
|
|
539
147
|
apply: () => e.apply(t),
|
|
540
|
-
invert: () =>
|
|
148
|
+
invert: () => Ie(e.invert(), t)
|
|
541
149
|
};
|
|
542
150
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
151
|
+
function Le(e, t) {
|
|
152
|
+
let n;
|
|
153
|
+
if (e.startsWith("kit:")) {
|
|
154
|
+
if (typeof t != "object" || !t) return;
|
|
155
|
+
let e = t;
|
|
156
|
+
n = typeof e.id == "string" ? e.id : typeof e.layer == "string" ? e.layer : void 0;
|
|
157
|
+
} else n = k.get(e)?.coalesceKey?.(t);
|
|
158
|
+
return n === void 0 ? void 0 : `${e}:${n}`;
|
|
547
159
|
}
|
|
548
|
-
function
|
|
549
|
-
let t =
|
|
550
|
-
|
|
551
|
-
let n =
|
|
160
|
+
function Re(e) {
|
|
161
|
+
let t = z;
|
|
162
|
+
z = !0, L++;
|
|
163
|
+
let n = V;
|
|
552
164
|
try {
|
|
553
165
|
return e();
|
|
554
166
|
} finally {
|
|
555
|
-
|
|
167
|
+
L--, z = t, V = n;
|
|
556
168
|
}
|
|
557
169
|
}
|
|
558
|
-
function Z(e
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
170
|
+
function Z(e) {
|
|
171
|
+
K(() => g(() => Re(e)), () => !0);
|
|
172
|
+
}
|
|
173
|
+
function Q(e, t, n) {
|
|
174
|
+
if (z) {
|
|
175
|
+
Y(e, t), q(e, t), J();
|
|
564
176
|
return;
|
|
565
177
|
}
|
|
566
|
-
if (
|
|
567
|
-
|
|
568
|
-
kind: e,
|
|
569
|
-
payload: t
|
|
570
|
-
}), w.ops.push(Y(e, t)), z();
|
|
178
|
+
if (R) {
|
|
179
|
+
Y(e, t), q(e, t), R.ops.push(X(e, t)), J();
|
|
571
180
|
return;
|
|
572
181
|
}
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
if (o.ops) for (let [e, t] of Object.entries(o.ops)) y.set(e, t);
|
|
576
|
-
function Xe() {
|
|
577
|
-
return u.layers.length === 1 ? nt() : it();
|
|
578
|
-
}
|
|
579
|
-
function Ze() {
|
|
580
|
-
return u.layers.length === 1 ? rt() : at();
|
|
581
|
-
}
|
|
582
|
-
let Qe = 0, $e = { gen: 0 };
|
|
583
|
-
function Q() {
|
|
584
|
-
Qe++;
|
|
585
|
-
}
|
|
586
|
-
let et = [];
|
|
587
|
-
function tt() {
|
|
588
|
-
return $e.gen !== Qe && ($e = { gen: Qe }), $e;
|
|
589
|
-
}
|
|
590
|
-
function nt() {
|
|
591
|
-
let e = u.layers[0].id, t = [], n = [...u.roots].reverse();
|
|
592
|
-
for (; n.length > 0;) {
|
|
593
|
-
let r = n.pop(), i = u.nodes.get(r);
|
|
594
|
-
if (i && (i.layer === e && t.push(r), i.kind === "container")) for (let e = i.children.length - 1; e >= 0; e--) n.push(i.children[e]);
|
|
595
|
-
}
|
|
596
|
-
return t;
|
|
597
|
-
}
|
|
598
|
-
function rt() {
|
|
599
|
-
let e = u.layers[0].id, t = [], n = [...u.roots].reverse();
|
|
600
|
-
for (; n.length > 0;) {
|
|
601
|
-
let r = n.pop(), i = u.nodes.get(r);
|
|
602
|
-
if (i && (i.layer === e && t.push(i), i.kind === "container")) for (let e = i.children.length - 1; e >= 0; e--) n.push(i.children[e]);
|
|
603
|
-
}
|
|
604
|
-
return t;
|
|
182
|
+
P.applyOps([X(e, t)], n), J();
|
|
605
183
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
let n = [];
|
|
615
|
-
for (let t of e) for (let e of t) n.push(e);
|
|
616
|
-
return n;
|
|
617
|
-
}
|
|
618
|
-
function at() {
|
|
619
|
-
let e = u.layers.map(() => []), t = [...u.roots].reverse();
|
|
620
|
-
for (; t.length > 0;) {
|
|
621
|
-
let n = t.pop(), r = u.nodes.get(n);
|
|
622
|
-
if (!r) continue;
|
|
623
|
-
let i = e[u.layerIndex.get(r.layer) ?? -1];
|
|
624
|
-
if (i && i.push(r), r.kind === "container") for (let e = r.children.length - 1; e >= 0; e--) t.push(r.children[e]);
|
|
625
|
-
}
|
|
626
|
-
let n = [];
|
|
627
|
-
for (let t of e) for (let e of t) n.push(e);
|
|
628
|
-
return n;
|
|
629
|
-
}
|
|
630
|
-
let ot = /* @__PURE__ */ new WeakMap();
|
|
631
|
-
function st(e) {
|
|
632
|
-
let t = {
|
|
633
|
-
targetId: e.targetId,
|
|
634
|
-
forkedAtEntryId: e.forkedAtEntryId,
|
|
635
|
-
applyBatch(t, n) {
|
|
636
|
-
F(t, (t) => {
|
|
637
|
-
R(() => X(() => e.applyBatch(t, n)), () => !0), z();
|
|
638
|
-
});
|
|
639
|
-
},
|
|
640
|
-
undo() {
|
|
641
|
-
L(() => X(() => e.undo())), z();
|
|
642
|
-
},
|
|
643
|
-
redo() {
|
|
644
|
-
L(() => X(() => e.redo())), z();
|
|
645
|
-
},
|
|
646
|
-
canUndo: () => e.canUndo(),
|
|
647
|
-
canRedo: () => e.canRedo(),
|
|
648
|
-
entries: () => e.entries(),
|
|
649
|
-
seal: () => e.seal(),
|
|
650
|
-
getVersion: () => e.getVersion(),
|
|
651
|
-
subscribe: (t) => e.subscribe(t),
|
|
652
|
-
commit(t) {
|
|
653
|
-
e.commit(t), z();
|
|
654
|
-
},
|
|
655
|
-
cancel() {
|
|
656
|
-
L(() => X(() => e.cancel())), z();
|
|
657
|
-
},
|
|
658
|
-
suspend: () => e.suspend(),
|
|
659
|
-
isActive: () => e.isActive()
|
|
660
|
-
};
|
|
661
|
-
return ot.set(t, e), t;
|
|
662
|
-
}
|
|
663
|
-
let ct = {
|
|
664
|
-
apply(e, t) {
|
|
665
|
-
Re("history.apply"), F([e], (n) => {
|
|
666
|
-
let r = () => n.length === 1 ? x.apply(e, t) : x.applyOps(n, t ?? e.label ?? "");
|
|
667
|
-
R(() => X(r), () => !0), z();
|
|
668
|
-
});
|
|
669
|
-
},
|
|
670
|
-
applyOps(e, t) {
|
|
671
|
-
Re("history.applyOps"), F(e, (e) => {
|
|
672
|
-
R(() => X(() => x.applyOps(e, t)), () => !0), z();
|
|
673
|
-
});
|
|
674
|
-
},
|
|
184
|
+
if (l.ops) for (let [e, t] of Object.entries(l.ops)) k.set(e, t);
|
|
185
|
+
let ze = re({
|
|
186
|
+
engine: P,
|
|
187
|
+
applying: (e) => K(() => Re(e), () => !0),
|
|
188
|
+
replay: Z,
|
|
189
|
+
notify: J,
|
|
190
|
+
refuseUntracked: Pe,
|
|
191
|
+
runArrivalEdit: je,
|
|
675
192
|
undo: () => {
|
|
676
193
|
$.undo();
|
|
677
194
|
},
|
|
@@ -681,49 +198,22 @@ function d(o) {
|
|
|
681
198
|
goto: (e) => {
|
|
682
199
|
$.jumpToHistoryIndex(e);
|
|
683
200
|
},
|
|
684
|
-
clear() {
|
|
685
|
-
x.clear(), z();
|
|
686
|
-
},
|
|
687
|
-
recordEntry(e, t, n) {
|
|
688
|
-
x.recordEntry(e, t, n), z();
|
|
689
|
-
},
|
|
690
|
-
prune(e) {
|
|
691
|
-
x.prune(e), z();
|
|
692
|
-
},
|
|
693
|
-
switchBranch(e) {
|
|
694
|
-
x.switchBranch(e), z();
|
|
695
|
-
},
|
|
696
201
|
restore: (e) => {
|
|
697
202
|
$.restoreHistory(e);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
entries: () => x.entries(),
|
|
704
|
-
timestampAt: (e) => x.timestampAt(e),
|
|
705
|
-
depthAt: (e) => x.depthAt(e),
|
|
706
|
-
branches: () => x.branches(),
|
|
707
|
-
getVersion: () => x.getVersion(),
|
|
708
|
-
subscribe: (e) => x.subscribe(e),
|
|
709
|
-
serialize: () => x.serialize(),
|
|
710
|
-
allForwardOps: () => x.allForwardOps(),
|
|
711
|
-
seal: () => x.seal(),
|
|
712
|
-
currentEntryId: () => x.currentEntryId(),
|
|
713
|
-
beginJournal: (e) => st(x.beginJournal(e)),
|
|
714
|
-
resumeJournal: (e) => x.resumeJournal(ot.get(e) ?? e)
|
|
715
|
-
};
|
|
716
|
-
function lt(e, t, n) {
|
|
717
|
-
let r = (we ?? (() => null))(), i = T, a = O;
|
|
718
|
-
T = !0, C++, O = !1;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
function Be(e, t, n) {
|
|
206
|
+
let r = (H ?? (() => null))(), i = z, a = V;
|
|
207
|
+
z = !0, L++, V = !1;
|
|
719
208
|
try {
|
|
720
|
-
|
|
721
|
-
|
|
209
|
+
K(() => {
|
|
210
|
+
let i = e.map((e) => Ie(e, n));
|
|
211
|
+
r ? r.applyBatch(i, t) : P.applyOps(i, t);
|
|
722
212
|
}, () => !0);
|
|
723
213
|
} finally {
|
|
724
|
-
if (
|
|
725
|
-
|
|
726
|
-
for (let e of
|
|
214
|
+
if (L--, z = i, V ||= a, L === 0 && V) {
|
|
215
|
+
V = !1;
|
|
216
|
+
for (let e of O) e();
|
|
727
217
|
}
|
|
728
218
|
}
|
|
729
219
|
}
|
|
@@ -737,15 +227,15 @@ function d(o) {
|
|
|
737
227
|
get layers() {
|
|
738
228
|
return u.layers;
|
|
739
229
|
},
|
|
740
|
-
registry:
|
|
230
|
+
registry: v,
|
|
741
231
|
get(e) {
|
|
742
232
|
return u.nodes.get(e);
|
|
743
233
|
},
|
|
744
234
|
incarnation(e) {
|
|
745
235
|
let t = u.nodes.get(e);
|
|
746
236
|
if (!t) return;
|
|
747
|
-
let n =
|
|
748
|
-
return n === void 0 && (n =
|
|
237
|
+
let n = I.get(t);
|
|
238
|
+
return n === void 0 && (n = Te++, I.set(t, n)), n;
|
|
749
239
|
},
|
|
750
240
|
childrenOf(e) {
|
|
751
241
|
let t = u.nodes.get(e);
|
|
@@ -756,39 +246,24 @@ function d(o) {
|
|
|
756
246
|
for (; n !== null;) t.push(n), n = u.nodes.get(n)?.parent ?? null;
|
|
757
247
|
return t;
|
|
758
248
|
},
|
|
759
|
-
renderOrder
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
renderOrderNodes() {
|
|
764
|
-
let e = tt();
|
|
765
|
-
return e.nodes ??= Ze();
|
|
766
|
-
},
|
|
767
|
-
nodesOnLayer(e) {
|
|
768
|
-
let t = tt(), n = t.byLayer;
|
|
769
|
-
if (!n) {
|
|
770
|
-
n = /* @__PURE__ */ new Map();
|
|
771
|
-
for (let e of t.nodes ??= Ze()) {
|
|
772
|
-
let t = n.get(e.layer);
|
|
773
|
-
t || n.set(e.layer, t = []), t.push(e);
|
|
774
|
-
}
|
|
775
|
-
t.byLayer = n;
|
|
776
|
-
}
|
|
777
|
-
return n.get(e) ?? et;
|
|
778
|
-
},
|
|
249
|
+
renderOrder: d.ids,
|
|
250
|
+
renderOrderNodes: d.nodes,
|
|
251
|
+
nodesOnLayer: d.nodesOnLayer,
|
|
252
|
+
mintId: D,
|
|
779
253
|
add(e) {
|
|
780
|
-
let t = e.id ??
|
|
254
|
+
let t = e.id ?? D();
|
|
781
255
|
if (u.nodes.has(t)) throw Error(`Scene: id collision on "${t}"`);
|
|
782
|
-
|
|
256
|
+
T(e.layer), m(e.layer, "add to");
|
|
783
257
|
let n = e.parent ?? null;
|
|
784
258
|
if (n !== null) {
|
|
785
|
-
let t =
|
|
259
|
+
let t = S(n);
|
|
786
260
|
if (t.kind !== "container") throw Error(`Scene: parent "${n}" is not a container`);
|
|
787
|
-
|
|
261
|
+
E(e.id, e.layer, n, t.layer), p(n, "add under");
|
|
788
262
|
}
|
|
789
|
-
if (n !== null &&
|
|
790
|
-
let r =
|
|
791
|
-
|
|
263
|
+
if (n !== null && G()) return $.batch(`add ${e.kind}`, () => $.add(e));
|
|
264
|
+
let r = C(n), i = e.index ?? r.length;
|
|
265
|
+
Ee(t, n, null);
|
|
266
|
+
let a = {
|
|
792
267
|
id: t,
|
|
793
268
|
kind: e.kind,
|
|
794
269
|
layer: e.layer,
|
|
@@ -798,25 +273,26 @@ function d(o) {
|
|
|
798
273
|
index: i,
|
|
799
274
|
...e.dependsOn === void 0 ? {} : { dependsOn: e.dependsOn },
|
|
800
275
|
...e.pickable === void 0 ? {} : { pickable: e.pickable },
|
|
801
|
-
...
|
|
276
|
+
...s(y, {
|
|
802
277
|
...e,
|
|
803
278
|
id: t,
|
|
804
279
|
kind: e.kind
|
|
805
280
|
}, "opKey")
|
|
806
|
-
}
|
|
281
|
+
};
|
|
282
|
+
return Q("kit:add", a, `add ${e.kind}`), w(e, t, a), t;
|
|
807
283
|
},
|
|
808
284
|
remove(e) {
|
|
809
285
|
$.removeMany([e]);
|
|
810
286
|
},
|
|
811
287
|
removalClosure(e) {
|
|
812
|
-
return
|
|
288
|
+
return Ce(e).ids;
|
|
813
289
|
},
|
|
814
290
|
removeMany(e) {
|
|
815
291
|
if (e.length === 0) return;
|
|
816
|
-
let { ids: t, removing: n } =
|
|
817
|
-
for (let e of t)
|
|
292
|
+
let { ids: t, removing: n } = Ce(e);
|
|
293
|
+
for (let e of t) p(e, "remove");
|
|
818
294
|
let r = t.map((e) => {
|
|
819
|
-
let t =
|
|
295
|
+
let t = S(e);
|
|
820
296
|
return t.kind === "container" ? {
|
|
821
297
|
...t,
|
|
822
298
|
children: [...t.children]
|
|
@@ -824,11 +300,11 @@ function d(o) {
|
|
|
824
300
|
}), i = r.filter((e) => e.parent === null || !n.has(e.parent)).map((e) => ({
|
|
825
301
|
id: e.id,
|
|
826
302
|
parent: e.parent,
|
|
827
|
-
index:
|
|
303
|
+
index: C(e.parent).indexOf(e.id)
|
|
828
304
|
})).sort((e, t) => e.index - t.index);
|
|
829
|
-
for (let e of t)
|
|
305
|
+
for (let e of t) N.clear(e);
|
|
830
306
|
let a = r.flatMap((e) => {
|
|
831
|
-
let t =
|
|
307
|
+
let t = s(y, e, "opKey");
|
|
832
308
|
return Object.keys(t).length === 0 ? [] : [{
|
|
833
309
|
id: e.id,
|
|
834
310
|
...t
|
|
@@ -838,57 +314,57 @@ function d(o) {
|
|
|
838
314
|
detached: i,
|
|
839
315
|
...a.length > 0 ? { fnKeys: a } : {}
|
|
840
316
|
};
|
|
841
|
-
if (i.some((e) => e.parent !== null) &&
|
|
317
|
+
if (i.some((e) => e.parent !== null) && G()) {
|
|
842
318
|
$.batch("remove", () => $.removeMany(e));
|
|
843
319
|
return;
|
|
844
320
|
}
|
|
845
|
-
for (let e of i)
|
|
846
|
-
|
|
321
|
+
for (let e of i) De(e.id, e.parent, null);
|
|
322
|
+
Q("kit:remove", o, "remove");
|
|
847
323
|
},
|
|
848
324
|
update(e, t) {
|
|
849
|
-
let n =
|
|
850
|
-
|
|
325
|
+
let n = S(e);
|
|
326
|
+
p(e, "update"), Q("kit:setData", {
|
|
851
327
|
id: e,
|
|
852
328
|
from: n.data,
|
|
853
329
|
to: t.data
|
|
854
330
|
}, "update");
|
|
855
331
|
},
|
|
856
332
|
setPose(e, t) {
|
|
857
|
-
let n =
|
|
858
|
-
if (
|
|
859
|
-
if (
|
|
333
|
+
let n = S(e);
|
|
334
|
+
if (p(e, "set the pose of"), n.kind === "container" && de(ge, e, n.pose, t)) {
|
|
335
|
+
if (G()) {
|
|
860
336
|
$.batch("setPose", () => $.setPose(e, t));
|
|
861
337
|
return;
|
|
862
338
|
}
|
|
863
|
-
|
|
339
|
+
W(e);
|
|
864
340
|
}
|
|
865
|
-
|
|
341
|
+
Q("kit:setPose", {
|
|
866
342
|
id: e,
|
|
867
343
|
from: n.pose,
|
|
868
344
|
to: t
|
|
869
345
|
}, "setPose");
|
|
870
346
|
},
|
|
871
347
|
setLayer(e, t) {
|
|
872
|
-
|
|
873
|
-
let n =
|
|
874
|
-
if (
|
|
875
|
-
let r =
|
|
876
|
-
|
|
348
|
+
T(t);
|
|
349
|
+
let n = S(e);
|
|
350
|
+
if (p(e, "relayer"), n.layer !== t && m(t, "move nodes onto"), n.parent !== null) {
|
|
351
|
+
let r = S(n.parent);
|
|
352
|
+
E(e, t, n.parent, r.layer, "relayer");
|
|
877
353
|
}
|
|
878
354
|
if (n.layer === t) return;
|
|
879
355
|
let r = [], i = [e];
|
|
880
356
|
for (; i.length > 0;) {
|
|
881
357
|
let e = i.pop(), t = u.nodes.get(e);
|
|
882
|
-
if (t && (r.push(e),
|
|
358
|
+
if (t && (r.push(e), p(e, "relayer"), t.kind === "container")) for (let e = t.children.length - 1; e >= 0; e--) i.push(t.children[e]);
|
|
883
359
|
}
|
|
884
|
-
r.length === 1 ?
|
|
360
|
+
r.length === 1 ? Q("kit:setLayer", {
|
|
885
361
|
id: e,
|
|
886
362
|
from: n.layer,
|
|
887
363
|
to: t
|
|
888
364
|
}, "setLayer") : $.batch("setLayer", () => {
|
|
889
365
|
for (let e of r) {
|
|
890
|
-
let n =
|
|
891
|
-
n.layer !== t &&
|
|
366
|
+
let n = S(e);
|
|
367
|
+
n.layer !== t && Q("kit:setLayer", {
|
|
892
368
|
id: e,
|
|
893
369
|
from: n.layer,
|
|
894
370
|
to: t
|
|
@@ -896,55 +372,55 @@ function d(o) {
|
|
|
896
372
|
}
|
|
897
373
|
});
|
|
898
374
|
},
|
|
899
|
-
setDependsOn(
|
|
900
|
-
let r =
|
|
901
|
-
|
|
902
|
-
id:
|
|
375
|
+
setDependsOn(t, n) {
|
|
376
|
+
let r = S(t);
|
|
377
|
+
p(t, "retarget"), !e(r.dependsOn, n) && Q("kit:setDependsOn", {
|
|
378
|
+
id: t,
|
|
903
379
|
from: r.dependsOn,
|
|
904
|
-
to:
|
|
380
|
+
to: n
|
|
905
381
|
}, "setDependsOn");
|
|
906
382
|
},
|
|
907
383
|
setLayout(e, t) {
|
|
908
|
-
let n =
|
|
384
|
+
let n = S(e);
|
|
909
385
|
if (n.kind !== "container") throw Error(`Scene: "${e}" is not a container`);
|
|
910
|
-
|
|
911
|
-
let r =
|
|
386
|
+
p(e, "set the layout of");
|
|
387
|
+
let r = b("layout"), i;
|
|
912
388
|
if (typeof t == "string") {
|
|
913
389
|
if (i = r.fnOf(t) ?? null, i === null) throw Error(`Scene: no layout "${t}" in this scene's registry`);
|
|
914
390
|
} else i = t;
|
|
915
391
|
let a = n.layout ?? null;
|
|
916
392
|
if (a === i) return;
|
|
917
|
-
if (i !== null && (
|
|
393
|
+
if (i !== null && (x = !0), G()) {
|
|
918
394
|
$.batch("setLayout", () => $.setLayout(e, i));
|
|
919
395
|
return;
|
|
920
396
|
}
|
|
921
|
-
|
|
397
|
+
W(e);
|
|
922
398
|
let o = a === null ? void 0 : r.keyOf(a), s = i === null ? void 0 : r.keyOf(i), c = {
|
|
923
399
|
id: e,
|
|
924
400
|
...o === void 0 ? {} : { fromKey: o },
|
|
925
401
|
...s === void 0 ? {} : { toKey: s }
|
|
926
402
|
};
|
|
927
|
-
|
|
403
|
+
Fe.set(c, {
|
|
928
404
|
from: a,
|
|
929
405
|
to: i
|
|
930
|
-
}),
|
|
406
|
+
}), Q("kit:setLayout", c, "setLayout");
|
|
931
407
|
},
|
|
932
408
|
move(e, t, n) {
|
|
933
|
-
let r =
|
|
934
|
-
if (
|
|
935
|
-
|
|
936
|
-
let n =
|
|
409
|
+
let r = S(e);
|
|
410
|
+
if (p(e, "move"), t !== null) {
|
|
411
|
+
p(t, "move nodes into");
|
|
412
|
+
let n = S(t);
|
|
937
413
|
if (n.kind !== "container") throw Error(`Scene: parent "${t}" is not a container`);
|
|
938
|
-
if (
|
|
414
|
+
if (E(e, r.layer, t, n.layer), t === e) throw Error("Scene: cannot parent a node to itself");
|
|
939
415
|
let i = [];
|
|
940
|
-
if (
|
|
416
|
+
if (Se(e, i), i.includes(t)) throw Error("Scene: cannot parent a node to its own descendant");
|
|
941
417
|
}
|
|
942
|
-
if ((t !== null || r.parent !== null) &&
|
|
418
|
+
if ((t !== null || r.parent !== null) && G()) {
|
|
943
419
|
$.batch("move", () => $.move(e, t, n));
|
|
944
420
|
return;
|
|
945
421
|
}
|
|
946
|
-
let i =
|
|
947
|
-
|
|
422
|
+
let i = C(r.parent), a = i.indexOf(e), o = t === r.parent ? i : C(t), s = n ?? o.length;
|
|
423
|
+
Ee(e, t, r.parent), De(e, r.parent, t), W(r.parent), Q("kit:move", {
|
|
948
424
|
id: e,
|
|
949
425
|
fromParent: r.parent,
|
|
950
426
|
fromIndex: a,
|
|
@@ -953,14 +429,14 @@ function d(o) {
|
|
|
953
429
|
}, "move");
|
|
954
430
|
},
|
|
955
431
|
reorder(e, t) {
|
|
956
|
-
let n =
|
|
957
|
-
if (
|
|
432
|
+
let n = S(e);
|
|
433
|
+
if (p(e, "reorder"), n.parent !== null && G()) {
|
|
958
434
|
$.batch("reorder", () => $.reorder(e, t));
|
|
959
435
|
return;
|
|
960
436
|
}
|
|
961
|
-
|
|
962
|
-
let r =
|
|
963
|
-
|
|
437
|
+
W(n.parent);
|
|
438
|
+
let r = C(n.parent).indexOf(e);
|
|
439
|
+
Q("kit:move", {
|
|
964
440
|
id: e,
|
|
965
441
|
fromParent: n.parent,
|
|
966
442
|
fromIndex: r,
|
|
@@ -969,35 +445,35 @@ function d(o) {
|
|
|
969
445
|
}, "reorder");
|
|
970
446
|
},
|
|
971
447
|
setLayerVisible(e, t) {
|
|
972
|
-
let n =
|
|
973
|
-
|
|
448
|
+
let n = T(e);
|
|
449
|
+
Q("kit:setLayerVisible", {
|
|
974
450
|
layer: e,
|
|
975
451
|
from: u.layers[n].visible,
|
|
976
452
|
to: t
|
|
977
453
|
}, "setLayerVisible");
|
|
978
454
|
},
|
|
979
455
|
setLayerLocked(e, t) {
|
|
980
|
-
let n =
|
|
981
|
-
|
|
456
|
+
let n = T(e);
|
|
457
|
+
Q("kit:setLayerLocked", {
|
|
982
458
|
layer: e,
|
|
983
459
|
from: u.layers[n].locked,
|
|
984
460
|
to: t
|
|
985
461
|
}, "setLayerLocked");
|
|
986
462
|
},
|
|
987
463
|
setLayerParallax(e, t) {
|
|
988
|
-
let n =
|
|
989
|
-
|
|
464
|
+
let n = T(e);
|
|
465
|
+
Q("kit:setLayerParallax", {
|
|
990
466
|
layer: e,
|
|
991
467
|
from: u.layers[n].parallax,
|
|
992
468
|
to: t
|
|
993
469
|
}, "setLayerParallax");
|
|
994
470
|
},
|
|
995
|
-
isLocked: (e) =>
|
|
996
|
-
unlocked: (e) =>
|
|
471
|
+
isLocked: (e) => f(e),
|
|
472
|
+
unlocked: (e) => g(e),
|
|
997
473
|
addLayer(e) {
|
|
998
474
|
if (u.layerIndex.has(e.id)) throw Error(`Scene: duplicate layer id "${e.id}"`);
|
|
999
475
|
let t = e.index ?? u.layers.length, n = Math.max(0, Math.min(t, u.layers.length));
|
|
1000
|
-
|
|
476
|
+
Q("kit:addLayer", {
|
|
1001
477
|
record: {
|
|
1002
478
|
kind: "user",
|
|
1003
479
|
id: e.id,
|
|
@@ -1010,30 +486,30 @@ function d(o) {
|
|
|
1010
486
|
}, "addLayer");
|
|
1011
487
|
},
|
|
1012
488
|
removeLayer(e) {
|
|
1013
|
-
let t =
|
|
489
|
+
let t = T(e), n = u.layers[t];
|
|
1014
490
|
if (n.kind !== "user") throw Error(`Scene: cannot remove system layer "${e}"`);
|
|
1015
|
-
|
|
491
|
+
g(() => $.batch("removeLayer", () => {
|
|
1016
492
|
let t = [];
|
|
1017
493
|
for (let [n, r] of u.nodes) r.layer === e && t.push(n);
|
|
1018
494
|
$.removeMany(t);
|
|
1019
|
-
let r =
|
|
1020
|
-
|
|
495
|
+
let r = T(e);
|
|
496
|
+
Q("kit:removeLayer", {
|
|
1021
497
|
record: n,
|
|
1022
498
|
index: r
|
|
1023
499
|
}, "removeLayer");
|
|
1024
500
|
}));
|
|
1025
501
|
},
|
|
1026
502
|
renameLayer(e, t) {
|
|
1027
|
-
let n = u.layers[
|
|
503
|
+
let n = u.layers[T(e)];
|
|
1028
504
|
if (n.kind !== "user") throw Error(`Scene: cannot rename system layer "${e}"`);
|
|
1029
|
-
|
|
505
|
+
Q("kit:renameLayer", {
|
|
1030
506
|
layer: e,
|
|
1031
507
|
from: n.name,
|
|
1032
508
|
to: t
|
|
1033
509
|
}, "renameLayer");
|
|
1034
510
|
},
|
|
1035
511
|
moveLayer(e, t) {
|
|
1036
|
-
let n =
|
|
512
|
+
let n = T(e), r = Math.max(0, Math.min(t, u.layers.length - 1));
|
|
1037
513
|
if (n === r) return;
|
|
1038
514
|
let i = [...u.layers], [a] = i.splice(n, 1);
|
|
1039
515
|
i.splice(r, 0, a);
|
|
@@ -1044,7 +520,7 @@ function d(o) {
|
|
|
1044
520
|
let r = u.nodes.get(n.parent);
|
|
1045
521
|
if (r && o.get(n.layer) < o.get(r.layer)) throw Error(`Scene: moveLayer("${e}", ${t}) — a child may not render below its parent's layer`);
|
|
1046
522
|
}
|
|
1047
|
-
|
|
523
|
+
Q("kit:moveLayer", {
|
|
1048
524
|
layer: e,
|
|
1049
525
|
from: n,
|
|
1050
526
|
to: r
|
|
@@ -1052,46 +528,38 @@ function d(o) {
|
|
|
1052
528
|
},
|
|
1053
529
|
registerOp(e, t) {
|
|
1054
530
|
if (e.startsWith("kit:")) throw Error(`Scene: op kind "${e}" is reserved (kit:* prefix)`);
|
|
1055
|
-
|
|
531
|
+
k.set(e, t);
|
|
1056
532
|
},
|
|
1057
533
|
recordOp(e) {
|
|
1058
|
-
|
|
534
|
+
Q(e.kind, e.payload, e.kind);
|
|
1059
535
|
},
|
|
1060
536
|
setActiveJournalAccessor(e) {
|
|
1061
|
-
|
|
537
|
+
H = e;
|
|
1062
538
|
},
|
|
1063
539
|
applyBatch(e, t, n) {
|
|
1064
|
-
|
|
1065
|
-
},
|
|
1066
|
-
setArrivalHandler(e) {
|
|
1067
|
-
return Te = e, () => {
|
|
1068
|
-
Te === e && (Te = null);
|
|
1069
|
-
};
|
|
540
|
+
Pe("applyBatch"), je(e, (e) => Be(e, t, n));
|
|
1070
541
|
},
|
|
542
|
+
setArrivalHandler: U.setHandler,
|
|
1071
543
|
layoutOf(e) {
|
|
1072
|
-
return
|
|
1073
|
-
},
|
|
1074
|
-
onReflow(e) {
|
|
1075
|
-
return Ee.add(e), () => {
|
|
1076
|
-
Ee.delete(e);
|
|
1077
|
-
};
|
|
544
|
+
return _e(e);
|
|
1078
545
|
},
|
|
1079
|
-
|
|
1080
|
-
|
|
546
|
+
onReflow: U.onReflow,
|
|
547
|
+
overrides: N,
|
|
548
|
+
getSelection: () => M,
|
|
1081
549
|
setSelection(e) {
|
|
1082
|
-
|
|
550
|
+
M = h([...e]), J();
|
|
1083
551
|
},
|
|
1084
|
-
history:
|
|
552
|
+
history: ze,
|
|
1085
553
|
undo() {
|
|
1086
|
-
return
|
|
554
|
+
return P.canUndo() ? (Z(() => P.undo()), J(), !0) : !1;
|
|
1087
555
|
},
|
|
1088
556
|
redo() {
|
|
1089
|
-
return
|
|
557
|
+
return P.canRedo() ? (Z(() => P.redo()), J(), !0) : !1;
|
|
1090
558
|
},
|
|
1091
|
-
canUndo: () =>
|
|
1092
|
-
canRedo: () =>
|
|
559
|
+
canUndo: () => P.canUndo(),
|
|
560
|
+
canRedo: () => P.canRedo(),
|
|
1093
561
|
historyEntries() {
|
|
1094
|
-
let { undo: e, redo: t } =
|
|
562
|
+
let { undo: e, redo: t } = P.entries(), n = [];
|
|
1095
563
|
for (let t of e) n.push({
|
|
1096
564
|
id: String(t.id),
|
|
1097
565
|
label: t.label
|
|
@@ -1102,124 +570,101 @@ function d(o) {
|
|
|
1102
570
|
});
|
|
1103
571
|
return n;
|
|
1104
572
|
},
|
|
1105
|
-
historyIndex: () =>
|
|
573
|
+
historyIndex: () => P.undoDepth(),
|
|
1106
574
|
jumpToHistoryIndex(e) {
|
|
1107
|
-
let t =
|
|
1108
|
-
return n !==
|
|
575
|
+
let t = P.undoDepth() + P.redoDepth(), n = Math.max(0, Math.min(t, e));
|
|
576
|
+
return n !== P.undoDepth() && (Z(() => P.goto(n)), J(), !0);
|
|
1109
577
|
},
|
|
1110
|
-
serializeHistory: () =>
|
|
578
|
+
serializeHistory: () => P.serialize(),
|
|
1111
579
|
restoreHistory(e) {
|
|
1112
|
-
|
|
580
|
+
P.restore(e), J();
|
|
1113
581
|
},
|
|
1114
582
|
setHistoryAdapter(e) {
|
|
1115
|
-
|
|
583
|
+
A = e;
|
|
1116
584
|
},
|
|
1117
585
|
batch(e, t) {
|
|
1118
|
-
let n =
|
|
1119
|
-
n && (
|
|
586
|
+
let n = L === 0;
|
|
587
|
+
n && (R = {
|
|
1120
588
|
label: e,
|
|
1121
589
|
ops: [],
|
|
1122
|
-
selectionBefore:
|
|
590
|
+
selectionBefore: M
|
|
1123
591
|
});
|
|
1124
|
-
let i = n &&
|
|
1125
|
-
|
|
592
|
+
let i = n && Oe(!0);
|
|
593
|
+
L++;
|
|
1126
594
|
try {
|
|
1127
595
|
if (!n) return t();
|
|
1128
596
|
try {
|
|
1129
|
-
let e =
|
|
597
|
+
let e = K(() => {
|
|
1130
598
|
let e = t();
|
|
1131
|
-
if (i) for (let e of
|
|
599
|
+
if (i) for (let e of Ae()) $.setPose(r(e.id), e.to);
|
|
1132
600
|
return e;
|
|
1133
|
-
}, () => (
|
|
1134
|
-
return i &&
|
|
601
|
+
}, () => (R?.ops.length ?? 0) > 0);
|
|
602
|
+
return i && ke(), e;
|
|
1135
603
|
} catch (e) {
|
|
1136
|
-
throw
|
|
604
|
+
throw R = null, e;
|
|
1137
605
|
}
|
|
1138
606
|
} finally {
|
|
1139
|
-
if (
|
|
1140
|
-
if (
|
|
1141
|
-
let e =
|
|
1142
|
-
|
|
607
|
+
if (L--, i && U.abandon(), L === 0) {
|
|
608
|
+
if (R) {
|
|
609
|
+
let e = R;
|
|
610
|
+
R = null, e.ops.length > 0 && P.recordEntry(e.ops, e.label, { selectionBefore: e.selectionBefore });
|
|
1143
611
|
}
|
|
1144
|
-
if (
|
|
1145
|
-
|
|
1146
|
-
for (let e of
|
|
612
|
+
if (V) {
|
|
613
|
+
V = !1;
|
|
614
|
+
for (let e of O) e();
|
|
1147
615
|
}
|
|
1148
616
|
}
|
|
1149
617
|
}
|
|
1150
618
|
},
|
|
1151
619
|
untracked(e) {
|
|
1152
|
-
let t =
|
|
1153
|
-
|
|
1154
|
-
let i =
|
|
1155
|
-
|
|
620
|
+
let t = z, n = F;
|
|
621
|
+
z = !0, B++;
|
|
622
|
+
let i = Oe(!0);
|
|
623
|
+
L++;
|
|
1156
624
|
try {
|
|
1157
|
-
let t =
|
|
625
|
+
let t = K(() => {
|
|
1158
626
|
let t = e();
|
|
1159
|
-
if (i) for (let e of
|
|
627
|
+
if (i) for (let e of Ae()) $.setPose(r(e.id), e.to);
|
|
1160
628
|
return t;
|
|
1161
629
|
}, () => !1);
|
|
1162
|
-
return i &&
|
|
630
|
+
return i && ke(), t;
|
|
1163
631
|
} finally {
|
|
1164
|
-
if (
|
|
1165
|
-
|
|
1166
|
-
for (let e of
|
|
632
|
+
if (L--, i && U.abandon(), B--, z = t, F !== n && P.seal(), L === 0 && V) {
|
|
633
|
+
V = !1;
|
|
634
|
+
for (let e of O) e();
|
|
1167
635
|
}
|
|
1168
636
|
}
|
|
1169
637
|
},
|
|
1170
|
-
toJSON()
|
|
1171
|
-
let e = [];
|
|
1172
|
-
for (let t of Ze()) {
|
|
1173
|
-
let n = t.id, r = {
|
|
1174
|
-
id: n,
|
|
1175
|
-
kind: t.kind,
|
|
1176
|
-
layer: t.layer,
|
|
1177
|
-
pose: t.pose,
|
|
1178
|
-
data: t.data
|
|
1179
|
-
};
|
|
1180
|
-
t.parent != null && (r.parent = t.parent), t.dependsOn === "children" ? r.dependsOn = "children" : t.dependsOn && t.dependsOn.length > 0 && (r.dependsOn = t.dependsOn), t.pickable === !1 && (r.pickable = !1), Object.assign(r, c(f, t, "jsonKey", (e) => {
|
|
1181
|
-
throw Error(`Scene.toJSON: node '${n}' has ${e.spec.field} but no matching registry key. The function must be registered via createScene's registry option to round-trip.`);
|
|
1182
|
-
})), e.push(r);
|
|
1183
|
-
}
|
|
1184
|
-
return {
|
|
1185
|
-
version: 1,
|
|
1186
|
-
systemLayers: u.layers.map((e) => {
|
|
1187
|
-
let t = { id: e.id };
|
|
1188
|
-
return e.visible === !1 && (t.visible = !1), e.locked === !0 && (t.locked = !0), e.parallax && (t.parallax = e.parallax), e.kind === "user" && (t.kind = "user", t.name = e.name), t;
|
|
1189
|
-
}),
|
|
1190
|
-
nodes: e
|
|
1191
|
-
};
|
|
1192
|
-
},
|
|
638
|
+
toJSON: () => le(u, y),
|
|
1193
639
|
loadState(e) {
|
|
1194
|
-
let t =
|
|
1195
|
-
|
|
640
|
+
let t = ue(e, v);
|
|
641
|
+
if (L > 0) throw Error("Scene: cannot loadState inside batch() or untracked() — it replaces the state they would revert to");
|
|
642
|
+
N.clearAll(), ye.clear(), be.clear(), u.nodes.clear(), u.roots.length = 0, u.layers.length = 0, u.layerIndex.clear(), _();
|
|
1196
643
|
for (let t = 0; t < e.systemLayers.length; t++) {
|
|
1197
644
|
let n = e.systemLayers[t];
|
|
1198
645
|
if (u.layerIndex.has(n.id)) throw Error(`Scene.loadState: duplicate system layer id "${n.id}"`);
|
|
1199
|
-
u.layers.push(
|
|
646
|
+
u.layers.push(ce(n)), u.layerIndex.set(n.id, t);
|
|
1200
647
|
}
|
|
1201
|
-
|
|
1202
|
-
for (let e of f) e.pending.clear();
|
|
1203
|
-
w = null, C = 0, O = !1, ut(t), z();
|
|
648
|
+
P.clear(), Ve(t), M = M.filter((e) => u.nodes.has(e)), J();
|
|
1204
649
|
},
|
|
1205
650
|
subscribe(e) {
|
|
1206
|
-
return
|
|
651
|
+
return O.add(e), () => O.delete(e);
|
|
1207
652
|
},
|
|
1208
|
-
getVersion: () =>
|
|
653
|
+
getVersion: () => F
|
|
1209
654
|
};
|
|
1210
|
-
function
|
|
655
|
+
function Ve(e) {
|
|
1211
656
|
for (let t of e) {
|
|
1212
|
-
let e = t.id ??
|
|
657
|
+
let e = t.id ?? D();
|
|
1213
658
|
if (u.nodes.has(e)) throw Error(`Scene: id collision on "${e}"`);
|
|
1214
|
-
|
|
659
|
+
T(t.layer);
|
|
1215
660
|
let n = t.parent ?? null;
|
|
1216
661
|
if (n !== null) {
|
|
1217
|
-
let e =
|
|
662
|
+
let e = S(n);
|
|
1218
663
|
if (e.kind !== "container") throw Error(`Scene: parent "${n}" is not a container`);
|
|
1219
|
-
|
|
664
|
+
E(t.id, t.layer, n, e.layer);
|
|
1220
665
|
}
|
|
1221
|
-
let r =
|
|
1222
|
-
|
|
666
|
+
let r = C(n), i = t.index ?? r.length;
|
|
667
|
+
Y("kit:add", {
|
|
1223
668
|
id: e,
|
|
1224
669
|
kind: t.kind,
|
|
1225
670
|
layer: t.layer,
|
|
@@ -1229,41 +674,19 @@ function d(o) {
|
|
|
1229
674
|
index: i,
|
|
1230
675
|
...t.dependsOn === void 0 ? {} : { dependsOn: t.dependsOn },
|
|
1231
676
|
...t.pickable === void 0 ? {} : { pickable: t.pickable }
|
|
1232
|
-
}),
|
|
677
|
+
}), w(t, e, null);
|
|
1233
678
|
}
|
|
1234
679
|
}
|
|
1235
|
-
return
|
|
1236
|
-
}
|
|
1237
|
-
function de(e, t) {
|
|
1238
|
-
if (e.version !== 1) throw Error(`Scene: unsupported version ${e.version}; only v1 supported`);
|
|
1239
|
-
return e.nodes.map((e) => {
|
|
1240
|
-
let n = {
|
|
1241
|
-
id: e.id,
|
|
1242
|
-
kind: e.kind,
|
|
1243
|
-
layer: e.layer,
|
|
1244
|
-
pose: e.pose,
|
|
1245
|
-
data: e.data
|
|
1246
|
-
};
|
|
1247
|
-
e.parent !== void 0 && (n.parent = e.parent), e.pickable !== void 0 && (n.pickable = e.pickable), e.dependsOn !== void 0 && (n.dependsOn = e.dependsOn === "children" ? "children" : e.dependsOn);
|
|
1248
|
-
let r = e;
|
|
1249
|
-
for (let e of o) {
|
|
1250
|
-
let i = r[e.jsonKey];
|
|
1251
|
-
if (i === void 0) continue;
|
|
1252
|
-
let a = t[e.field]?.[i];
|
|
1253
|
-
if (!a) throw Error(`Scene: unknown ${e.field} key '${i}'. Register a function with this key in the registry option.`);
|
|
1254
|
-
n[e.field] = a;
|
|
1255
|
-
}
|
|
1256
|
-
return n;
|
|
1257
|
-
});
|
|
680
|
+
return l.initial && (Ve(l.initial), J()), $;
|
|
1258
681
|
}
|
|
1259
|
-
function
|
|
682
|
+
function d(e) {
|
|
1260
683
|
return {
|
|
1261
684
|
get: () => e.getSelection(),
|
|
1262
685
|
set: (t) => e.setSelection(t)
|
|
1263
686
|
};
|
|
1264
687
|
}
|
|
1265
|
-
function
|
|
1266
|
-
let n = t.registry ?? {}, r =
|
|
688
|
+
function f(e, t = {}) {
|
|
689
|
+
let n = t.registry ?? {}, r = u({
|
|
1267
690
|
systemLayers: e.systemLayers.map((e) => ({ id: e.id })),
|
|
1268
691
|
registry: n,
|
|
1269
692
|
...t.historyLimit === void 0 ? {} : { historyLimit: t.historyLimit },
|
|
@@ -1275,6 +698,6 @@ function p(e, t = {}) {
|
|
|
1275
698
|
return r.loadState(e), r;
|
|
1276
699
|
}
|
|
1277
700
|
//#endregion
|
|
1278
|
-
export {
|
|
701
|
+
export { u as createScene, f as sceneFromJSON, d as sceneSelectionStore };
|
|
1279
702
|
|
|
1280
703
|
//# sourceMappingURL=scene.js.map
|