@weasel-js/editing 1.19.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -11
- package/dist/actionGroups.js +27 -0
- package/dist/actionGroups.js.map +1 -0
- package/dist/actions/align/action.js +12 -9
- package/dist/actions/align/action.js.map +1 -1
- package/dist/actions/align/align.js +5 -4
- package/dist/actions/align/align.js.map +1 -1
- package/dist/actions/clipboard/action.js +10 -7
- package/dist/actions/clipboard/action.js.map +1 -1
- package/dist/actions/clone/action.js +217 -0
- package/dist/actions/clone/action.js.map +1 -0
- package/dist/actions/clone/behaviors.js +65 -0
- package/dist/actions/clone/behaviors.js.map +1 -0
- package/dist/actions/delete/delete.js +123 -0
- package/dist/actions/delete/delete.js.map +1 -0
- package/dist/actions/derivedBox.js +16 -0
- package/dist/actions/derivedBox.js.map +1 -0
- package/dist/actions/distribute/action.js +6 -3
- package/dist/actions/distribute/action.js.map +1 -1
- package/dist/actions/distribute/distribute.js +3 -2
- package/dist/actions/distribute/distribute.js.map +1 -1
- package/dist/actions/distribute/plan.js.map +1 -1
- package/dist/actions/edit/createPaintAction.js +42 -13
- package/dist/actions/edit/createPaintAction.js.map +1 -1
- package/dist/actions/edit/{escape.js → deselect.js} +8 -8
- package/dist/actions/edit/deselect.js.map +1 -0
- package/dist/actions/edit/duplicate.js +9 -7
- package/dist/actions/edit/duplicate.js.map +1 -1
- package/dist/actions/edit/group.js +24 -20
- package/dist/actions/edit/group.js.map +1 -1
- package/dist/actions/edit/ingest.js +4 -2
- package/dist/actions/edit/ingest.js.map +1 -1
- package/dist/actions/edit/nudge.js +14 -10
- package/dist/actions/edit/nudge.js.map +1 -1
- package/dist/actions/edit/selectAll.js +1 -1
- package/dist/actions/edit/setFill.js +1 -1
- package/dist/actions/edit/setFill.js.map +1 -1
- package/dist/actions/edit/setFillOpacity.js +5 -5
- package/dist/actions/edit/setFillOpacity.js.map +1 -1
- package/dist/actions/edit/setStroke.js +1 -1
- package/dist/actions/edit/setStroke.js.map +1 -1
- package/dist/actions/edit/setStrokeOpacity.js +6 -6
- package/dist/actions/edit/setStrokeOpacity.js.map +1 -1
- package/dist/actions/edit/setStrokeWidth.js +13 -8
- package/dist/actions/edit/setStrokeWidth.js.map +1 -1
- package/dist/actions/edit/setVertexColor.js +13 -6
- package/dist/actions/edit/setVertexColor.js.map +1 -1
- package/dist/actions/flip/action.js +19 -14
- package/dist/actions/flip/action.js.map +1 -1
- package/dist/actions/flip/helpers.js.map +1 -1
- package/dist/actions/group/enterGroup.js +81 -0
- package/dist/actions/group/enterGroup.js.map +1 -0
- package/dist/actions/insert/action.js +152 -0
- package/dist/actions/insert/action.js.map +1 -0
- package/dist/actions/insert/commit.js +52 -0
- package/dist/actions/insert/commit.js.map +1 -0
- package/dist/actions/insert/extras.js +88 -0
- package/dist/actions/insert/extras.js.map +1 -0
- package/dist/actions/insert/frame.js +96 -0
- package/dist/actions/insert/frame.js.map +1 -0
- package/dist/actions/insert/geometry.js +35 -0
- package/dist/actions/insert/geometry.js.map +1 -0
- package/dist/actions/insert/lands.js +41 -0
- package/dist/actions/insert/lands.js.map +1 -0
- package/dist/actions/insert/params.js +42 -0
- package/dist/actions/insert/params.js.map +1 -0
- package/dist/actions/insert/placeAction.js +137 -0
- package/dist/actions/insert/placeAction.js.map +1 -0
- package/dist/actions/insert/repositionAction.js +47 -0
- package/dist/actions/insert/repositionAction.js.map +1 -0
- package/dist/actions/insert/rotateAction.js +34 -0
- package/dist/actions/insert/rotateAction.js.map +1 -0
- package/dist/actions/insert/session.js +99 -0
- package/dist/actions/insert/session.js.map +1 -0
- package/dist/actions/insert/shape.js +117 -0
- package/dist/actions/insert/shape.js.map +1 -0
- package/dist/actions/insert/style.js +23 -0
- package/dist/actions/insert/style.js.map +1 -0
- package/dist/actions/lassoSelect/action.js +201 -0
- package/dist/actions/lassoSelect/action.js.map +1 -0
- package/dist/actions/lassoSelect/behaviors/selectFromLasso.js +61 -0
- package/dist/actions/lassoSelect/behaviors/selectFromLasso.js.map +1 -0
- package/dist/actions/lockedWrites.js +20 -0
- package/dist/actions/lockedWrites.js.map +1 -0
- package/dist/actions/move/action.js +138 -0
- package/dist/actions/move/action.js.map +1 -0
- package/dist/actions/move/behaviors/clampMove.js +42 -0
- package/dist/actions/move/behaviors/clampMove.js.map +1 -0
- package/dist/actions/move/behaviors/layoutDrop.js +84 -0
- package/dist/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/actions/move/behaviors/pageDrop.js +30 -0
- package/dist/actions/move/behaviors/pageDrop.js.map +1 -0
- package/dist/actions/move/behaviors/reparentOnDrop.js +44 -0
- package/dist/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/actions/move/behaviors/snapBackOrDelete.js +52 -0
- package/dist/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
- package/dist/actions/move/behaviors/snapToContainer.js +214 -0
- package/dist/actions/move/behaviors/snapToContainer.js.map +1 -0
- package/dist/actions/move/behaviors/swapOnDrop.js +180 -0
- package/dist/actions/move/behaviors/swapOnDrop.js.map +1 -0
- package/dist/actions/move/capture.js +116 -0
- package/dist/actions/move/capture.js.map +1 -0
- package/dist/actions/move/commit/index.js +47 -0
- package/dist/actions/move/commit/index.js.map +1 -0
- package/dist/actions/move/commit/layoutDrop.js +68 -0
- package/dist/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/actions/move/commit/layoutRelease.js +146 -0
- package/dist/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/actions/move/commit/pageDrop.js +162 -0
- package/dist/actions/move/commit/pageDrop.js.map +1 -0
- package/dist/actions/move/commit/rebase.js +24 -0
- package/dist/actions/move/commit/rebase.js.map +1 -0
- package/dist/actions/move/commit/reparent.js +157 -0
- package/dist/actions/move/commit/reparent.js.map +1 -0
- package/dist/actions/move/delta.js +127 -0
- package/dist/actions/move/delta.js.map +1 -0
- package/dist/actions/move/dragSnap.js +55 -0
- package/dist/actions/move/dragSnap.js.map +1 -0
- package/dist/actions/move/frame.js +67 -0
- package/dist/actions/move/frame.js.map +1 -0
- package/dist/actions/move/gestureAdapter.js +36 -0
- package/dist/actions/move/gestureAdapter.js.map +1 -0
- package/dist/actions/move/landedDescendants.js +50 -0
- package/dist/actions/move/landedDescendants.js.map +1 -0
- package/dist/actions/move/layout/container.js +119 -0
- package/dist/actions/move/layout/container.js.map +1 -0
- package/dist/actions/move/layout/dragged.js +75 -0
- package/dist/actions/move/layout/dragged.js.map +1 -0
- package/dist/actions/move/layout/dropPass.js +205 -0
- package/dist/actions/move/layout/dropPass.js.map +1 -0
- package/dist/actions/move/layout/exits.js +62 -0
- package/dist/actions/move/layout/exits.js.map +1 -0
- package/dist/actions/move/layout/glide.js +70 -0
- package/dist/actions/move/layout/glide.js.map +1 -0
- package/dist/actions/move/layout/view.js +60 -0
- package/dist/actions/move/layout/view.js.map +1 -0
- package/dist/actions/move/refusal.js +49 -0
- package/dist/actions/move/refusal.js.map +1 -0
- package/dist/actions/move/session.js +105 -0
- package/dist/actions/move/session.js.map +1 -0
- package/dist/actions/move/sessionOf.js +27 -0
- package/dist/actions/move/sessionOf.js.map +1 -0
- package/dist/actions/move/translate.js +49 -0
- package/dist/actions/move/translate.js.map +1 -0
- package/dist/actions/pathfinder/action.js +8 -6
- package/dist/actions/pathfinder/action.js.map +1 -1
- package/dist/actions/pathfinder/booleanGroupAction.js +16 -10
- package/dist/actions/pathfinder/booleanGroupAction.js.map +1 -1
- package/dist/actions/pathfinder/keymap.js +2 -2
- package/dist/actions/pathfinder/keymap.js.map +1 -1
- package/dist/actions/reorder/reorder.js +13 -11
- package/dist/actions/reorder/reorder.js.map +1 -1
- package/dist/actions/resize/action.js +105 -0
- package/dist/actions/resize/action.js.map +1 -0
- package/dist/actions/resize/aspect.js +42 -0
- package/dist/actions/resize/aspect.js.map +1 -0
- package/dist/actions/resize/behaviors/clampMinSize.js +100 -0
- package/dist/actions/resize/behaviors/clampMinSize.js.map +1 -0
- package/dist/actions/resize/boxFrame.js +19 -0
- package/dist/actions/resize/boxFrame.js.map +1 -0
- package/dist/actions/resize/capture.js +121 -0
- package/dist/actions/resize/capture.js.map +1 -0
- package/dist/actions/resize/commit.js +104 -0
- package/dist/actions/resize/commit.js.map +1 -0
- package/dist/actions/resize/frame.js +171 -0
- package/dist/actions/resize/frame.js.map +1 -0
- package/dist/actions/resize/held.js +44 -0
- package/dist/actions/resize/held.js.map +1 -0
- package/dist/actions/resize/minimum.js +34 -0
- package/dist/actions/resize/minimum.js.map +1 -0
- package/dist/actions/resize/replay.js +58 -0
- package/dist/actions/resize/replay.js.map +1 -0
- package/dist/actions/resize/ruleBounds.js +11 -0
- package/dist/actions/resize/ruleBounds.js.map +1 -0
- package/dist/actions/resize/session.js +118 -0
- package/dist/actions/resize/session.js.map +1 -0
- package/dist/actions/rotate/action.js +99 -0
- package/dist/actions/rotate/action.js.map +1 -0
- package/dist/actions/rotate/commit.js +48 -0
- package/dist/actions/rotate/commit.js.map +1 -0
- package/dist/actions/rotate/frame.js +96 -0
- package/dist/actions/rotate/frame.js.map +1 -0
- package/dist/actions/rotate/replay.js +25 -0
- package/dist/actions/rotate/replay.js.map +1 -0
- package/dist/actions/rotate/session.js +135 -0
- package/dist/actions/rotate/session.js.map +1 -0
- package/dist/actions/select/areaSelect.js +83 -0
- package/dist/actions/select/areaSelect.js.map +1 -0
- package/dist/actions/select/clearSelection.js +33 -0
- package/dist/actions/select/clearSelection.js.map +1 -0
- package/dist/actions/swap/action.js +63 -0
- package/dist/actions/swap/action.js.map +1 -0
- package/dist/actions/swap/swapOps.js +160 -0
- package/dist/actions/swap/swapOps.js.map +1 -0
- package/dist/actions/transformAgain/action.js +16 -14
- package/dist/actions/transformAgain/action.js.map +1 -1
- package/dist/actions/transformAgain/transformSelection.js +19 -5
- package/dist/actions/transformAgain/transformSelection.js.map +1 -1
- package/dist/booleans/booleans.js +130 -0
- package/dist/booleans/booleans.js.map +1 -0
- package/dist/booleans/commit.js +45 -0
- package/dist/booleans/commit.js.map +1 -0
- package/dist/booleans/custom.js +48 -0
- package/dist/booleans/custom.js.map +1 -0
- package/dist/booleans/operands.js +50 -0
- package/dist/booleans/operands.js.map +1 -0
- package/dist/booleans/pieces.js +43 -0
- package/dist/booleans/pieces.js.map +1 -0
- package/dist/booleans/placement.js +37 -0
- package/dist/booleans/placement.js.map +1 -0
- package/dist/booleans/useBooleans.js +34 -0
- package/dist/booleans/useBooleans.js.map +1 -0
- package/dist/booleans/useBooleansAdapter.js +11 -0
- package/dist/booleans/useBooleansAdapter.js.map +1 -0
- package/dist/chrome/affordances/cornerResize.js +123 -0
- package/dist/chrome/affordances/cornerResize.js.map +1 -0
- package/dist/chrome/affordances/rotateCursor.js +17 -0
- package/dist/chrome/affordances/rotateCursor.js.map +1 -0
- package/dist/chrome/affordances/rotationHandle.js +117 -0
- package/dist/chrome/affordances/rotationHandle.js.map +1 -0
- package/dist/chrome/handleCommands.js +110 -0
- package/dist/chrome/handleCommands.js.map +1 -0
- package/dist/chrome/overlay.js +271 -0
- package/dist/chrome/overlay.js.map +1 -0
- package/dist/chrome/rotationBadge.js +132 -0
- package/dist/chrome/rotationBadge.js.map +1 -0
- package/dist/chrome/rotationHandleGeometry.js +49 -0
- package/dist/chrome/rotationHandleGeometry.js.map +1 -0
- package/dist/chrome/selectionChrome.js +25 -0
- package/dist/chrome/selectionChrome.js.map +1 -0
- package/dist/chrome/selectionPose.js +112 -0
- package/dist/chrome/selectionPose.js.map +1 -0
- package/dist/chrome/shapeOutline.js +137 -0
- package/dist/chrome/shapeOutline.js.map +1 -0
- package/dist/clipboard/clipboardOps.js +48 -0
- package/dist/clipboard/clipboardOps.js.map +1 -0
- package/dist/clipboard/materializePaste.js +34 -0
- package/dist/clipboard/materializePaste.js.map +1 -0
- package/dist/clipboard/osClipboard.js +67 -0
- package/dist/clipboard/osClipboard.js.map +1 -0
- package/dist/clipboard/useClipboard.js +64 -0
- package/dist/clipboard/useClipboard.js.map +1 -0
- package/dist/clipboard/wireFormat.js +108 -0
- package/dist/clipboard/wireFormat.js.map +1 -0
- package/dist/deps/areaSelect.js +42 -0
- package/dist/deps/areaSelect.js.map +1 -0
- package/dist/deps/booleans.js +99 -0
- package/dist/deps/booleans.js.map +1 -0
- package/dist/deps/insert.js +260 -0
- package/dist/deps/insert.js.map +1 -0
- package/dist/deps/lassoSelect.js +37 -0
- package/dist/deps/lassoSelect.js.map +1 -0
- package/dist/deps/presetDeps.js +40 -0
- package/dist/deps/presetDeps.js.map +1 -0
- package/dist/deps/resizePolicy.js +41 -0
- package/dist/deps/resizePolicy.js.map +1 -0
- package/dist/engine-BV9RDHOL.d.ts +339 -0
- package/dist/engine.d.ts +6 -0
- package/dist/engine.js +10 -0
- package/dist/engineStandardActions.js +16 -7
- package/dist/engineStandardActions.js.map +1 -1
- package/dist/groups.d.ts +27 -0
- package/dist/groups.js +4 -0
- package/dist/icons.gen.js +8 -0
- package/dist/icons.gen.js.map +1 -0
- package/dist/icons.table.d.ts +6 -0
- package/dist/icons.table.js +8 -0
- package/dist/icons.table.js.map +1 -0
- package/dist/icons.table.json +156 -0
- package/dist/icons2.table.js +163 -0
- package/dist/icons2.table.js.map +1 -0
- package/dist/index.d.ts +1293 -105
- package/dist/index.js +61 -12
- package/dist/ingest/ghost.js +58 -0
- package/dist/ingest/ghost.js.map +1 -0
- package/dist/ingest/imageHandler.js +80 -0
- package/dist/ingest/imageHandler.js.map +1 -0
- package/dist/ingest/kitHandlers.js +15 -0
- package/dist/ingest/kitHandlers.js.map +1 -0
- package/dist/ingest/svgHandler.js +97 -0
- package/dist/ingest/svgHandler.js.map +1 -0
- package/dist/ingest/weaselJsonHandler.js +68 -0
- package/dist/ingest/weaselJsonHandler.js.map +1 -0
- package/dist/namedPresets.js +23 -11
- package/dist/namedPresets.js.map +1 -1
- package/dist/presets/arrange.js +21 -7
- package/dist/presets/arrange.js.map +1 -1
- package/dist/presets/booleans.js +13 -0
- package/dist/presets/booleans.js.map +1 -0
- package/dist/presets/composites.js +8 -5
- package/dist/presets/composites.js.map +1 -1
- package/dist/presets/edit.js +25 -13
- package/dist/presets/edit.js.map +1 -1
- package/dist/presets/ingest.js +7 -3
- package/dist/presets/ingest.js.map +1 -1
- package/dist/presets/insert.js +28 -0
- package/dist/presets/insert.js.map +1 -0
- package/dist/presets/pathfinder.js +5 -2
- package/dist/presets/pathfinder.js.map +1 -1
- package/dist/presets/select.js +16 -3
- package/dist/presets/select.js.map +1 -1
- package/dist/presets/selection.js +13 -0
- package/dist/presets/selection.js.map +1 -0
- package/dist/presets/selectionChrome.js +15 -0
- package/dist/presets/selectionChrome.js.map +1 -0
- package/dist/presets/tools.js +78 -9
- package/dist/presets/tools.js.map +1 -1
- package/dist/presets/transform.js +20 -7
- package/dist/presets/transform.js.map +1 -1
- package/dist/presets.d.ts +104 -0
- package/dist/presets.js +15 -0
- package/dist/selection/useSelection.js +127 -0
- package/dist/selection/useSelection.js.map +1 -0
- package/dist/test-seams.d.ts +50 -0
- package/dist/test-seams.js +4 -0
- package/dist/tools/ellipse/useEllipseTool.js +72 -0
- package/dist/tools/ellipse/useEllipseTool.js.map +1 -0
- package/dist/tools/eyedropper/useEyedropperTool.js +100 -0
- package/dist/tools/eyedropper/useEyedropperTool.js.map +1 -0
- package/dist/tools/image/useImageTool.js +57 -0
- package/dist/tools/image/useImageTool.js.map +1 -0
- package/dist/tools/lasso/useLassoTool.js +96 -0
- package/dist/tools/lasso/useLassoTool.js.map +1 -0
- package/dist/tools/line/useLineTool.js +67 -0
- package/dist/tools/line/useLineTool.js.map +1 -0
- package/dist/tools/polygon/usePolygonTool.js +149 -0
- package/dist/tools/polygon/usePolygonTool.js.map +1 -0
- package/dist/tools/rect/useRectTool.js +74 -0
- package/dist/tools/rect/useRectTool.js.map +1 -0
- package/dist/tools/select/adapterPointQuery.js +56 -0
- package/dist/tools/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/select/collapseDeferred.js +35 -0
- package/dist/tools/select/collapseDeferred.js.map +1 -0
- package/dist/tools/select/extendPressLocked.js +17 -0
- package/dist/tools/select/extendPressLocked.js.map +1 -0
- package/dist/tools/select/groupEntry.js +73 -0
- package/dist/tools/select/groupEntry.js.map +1 -0
- package/dist/tools/select/pressDecision.js +39 -0
- package/dist/tools/select/pressDecision.js.map +1 -0
- package/dist/tools/select/selectDeep.js +39 -0
- package/dist/tools/select/selectDeep.js.map +1 -0
- package/dist/tools/select/selectPick.js +60 -0
- package/dist/tools/select/selectPick.js.map +1 -0
- package/dist/tools/select/selectionContributions.js +191 -0
- package/dist/tools/select/selectionContributions.js.map +1 -0
- package/dist/tools/select/usePickerSelectTool.js +145 -0
- package/dist/tools/select/usePickerSelectTool.js.map +1 -0
- package/dist/tools/select/useSelectTool.js +54 -0
- package/dist/tools/select/useSelectTool.js.map +1 -0
- package/dist/tools/shared/countOption.js +24 -0
- package/dist/tools/shared/countOption.js.map +1 -0
- package/dist/tools/shared/insertToolOptions.js +8 -0
- package/dist/tools/shared/insertToolOptions.js.map +1 -0
- package/dist/tools/shared/pointerFollower.js +23 -0
- package/dist/tools/shared/pointerFollower.js.map +1 -0
- package/dist/tools/shared/styleOptions.js +76 -0
- package/dist/tools/shared/styleOptions.js.map +1 -0
- package/dist/tools/star/useStarTool.js +149 -0
- package/dist/tools/star/useStarTool.js.map +1 -0
- package/dist/tools/toolSets.js +26 -0
- package/dist/tools/toolSets.js.map +1 -0
- package/package.json +39 -11
- package/dist/actions/edit/escape.js.map +0 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { startCloneBehaviors } from "./behaviors.js";
|
|
2
|
+
import { beginDragSnap, snappedDelta } from "../move/dragSnap.js";
|
|
3
|
+
import { carryPose, copyOps, finiteFrame, inPlane, invertPlane, planeOf, quantizedPreview, recordTransform, rootsAmong, runBehaviorCancel, runBehaviorSettled, selectionLayer, translateTargets } from "@weasel-js/core";
|
|
4
|
+
import { SNAP_ROLES, defaultCommitAdapter as defaultCommitAdapter$1, nodeDescriptors as nodeDescriptors$1, operandMethods as operandMethods$1, poseDescriptorOf as poseDescriptorOf$1, scenePoseFrame as scenePoseFrame$1, translatePoseViaDescriptor as translatePoseViaDescriptor$1 } from "@weasel-js/core/engine";
|
|
5
|
+
import * as coreOps from "@weasel-js/core/ops";
|
|
6
|
+
import { createEmitter } from "@weasel-js/registry";
|
|
7
|
+
|
|
8
|
+
// src/actions/clone/action.ts
|
|
9
|
+
/** Where the copy of `id` lands for a drag of `(dx, dy)`, in world. */
|
|
10
|
+
function landedWorld(scratch, id, dx, dy) {
|
|
11
|
+
const origin = scratch.originPoses.get(id);
|
|
12
|
+
const node = scratch.scene.get(id);
|
|
13
|
+
if (origin === void 0 || !node) return void 0;
|
|
14
|
+
const d = scratch.descriptorOf(id);
|
|
15
|
+
const moved = translatePoseViaDescriptor$1(origin, dx, dy, d);
|
|
16
|
+
return carryPose(d, moved, planeOf(scratch.view, node.layer));
|
|
17
|
+
}
|
|
18
|
+
/** Where the copy of `id` lands for a drag of `(dx, dy)`, as stored: `null` in a singular frame. */
|
|
19
|
+
function landed(scratch, id, dx, dy) {
|
|
20
|
+
const world = landedWorld(scratch, id, dx, dy);
|
|
21
|
+
return world === void 0 ? void 0 : scratch.frame.local(id, world);
|
|
22
|
+
}
|
|
23
|
+
/** The copied root `id` is under, or holds. */
|
|
24
|
+
function rootOf(scratch, id) {
|
|
25
|
+
const roots = new Set(scratch.ids);
|
|
26
|
+
let at = id;
|
|
27
|
+
while (at !== null && !roots.has(at)) at = scratch.scene.get(at)?.parent ?? null;
|
|
28
|
+
return at ?? id;
|
|
29
|
+
}
|
|
30
|
+
/** How far a placement moves the copy of `root` from where the drag alone leaves it, in world. */
|
|
31
|
+
function placementShift(scratch, root, placement, dx, dy) {
|
|
32
|
+
const placed = placement.poses.get(root);
|
|
33
|
+
if (placed === void 0) return {
|
|
34
|
+
dx: 0,
|
|
35
|
+
dy: 0
|
|
36
|
+
};
|
|
37
|
+
const d = scratch.descriptorOf(root);
|
|
38
|
+
const dragged = landedWorld(scratch, root, dx, dy) ?? translatePoseViaDescriptor$1(scratch.frame.world(root), dx, dy, d);
|
|
39
|
+
const to = d.getBounds(placed);
|
|
40
|
+
const from = d.getBounds(dragged);
|
|
41
|
+
return {
|
|
42
|
+
dx: to.x - from.x,
|
|
43
|
+
dy: to.y - from.y
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** The ops making the copies where the drag left them and selecting them;
|
|
47
|
+
* with a `placement`, each copied root goes under its parent instead, at its
|
|
48
|
+
* pose there when it has one. `null` when a copy would land in a singular
|
|
49
|
+
* frame, so the clone refuses whole. */
|
|
50
|
+
function placedCopyOps(scratch, selection, placement) {
|
|
51
|
+
const { dx, dy } = scratch.currentDelta;
|
|
52
|
+
const parent = placement?.parentId;
|
|
53
|
+
let refused = false;
|
|
54
|
+
const kept = (pose, fallback) => {
|
|
55
|
+
if (pose !== null) return pose;
|
|
56
|
+
refused = true;
|
|
57
|
+
return fallback;
|
|
58
|
+
};
|
|
59
|
+
const { ops, copies } = copyOps(scratch.scene, scratch.ids, (id, node, isRoot) => {
|
|
60
|
+
if (placement === void 0) return scratch.originPoses.has(id) ? kept(landed(scratch, id, dx, dy), node.pose) : node.pose;
|
|
61
|
+
if (isRoot) {
|
|
62
|
+
const world = placement.poses.get(id) ?? landedWorld(scratch, id, dx, dy) ?? node.pose;
|
|
63
|
+
return kept(scratch.frame.localUnder(parent ?? null, world), node.pose);
|
|
64
|
+
}
|
|
65
|
+
if (!scratch.originPoses.has(id)) return node.pose;
|
|
66
|
+
const world = landedWorld(scratch, id, dx, dy);
|
|
67
|
+
if (world === void 0) return node.pose;
|
|
68
|
+
const shift = placementShift(scratch, rootOf(scratch, id), placement, dx, dy);
|
|
69
|
+
return kept(scratch.frame.localUnder(parent ?? null, translatePoseViaDescriptor$1(world, shift.dx, shift.dy, scratch.descriptorOf(id))), node.pose);
|
|
70
|
+
}, "Clone", parent);
|
|
71
|
+
if (refused) return null;
|
|
72
|
+
if (ops.length === 0) return [];
|
|
73
|
+
return [...ops, coreOps.setSelection({
|
|
74
|
+
from: selection.get(),
|
|
75
|
+
to: copies,
|
|
76
|
+
label: "Clone"
|
|
77
|
+
})];
|
|
78
|
+
}
|
|
79
|
+
/** Commit the drag: a behavior's ops when one claims it, else the copies,
|
|
80
|
+
* which become the selection. Returns whether anything was committed. */
|
|
81
|
+
function commitClone(scratch, behaviors, selection) {
|
|
82
|
+
const apply = (ops) => {
|
|
83
|
+
if (!scratch.applyOps) return scratch.scene.applyBatch(ops, "Clone", defaultCommitAdapter$1(scratch.scene, operandMethods$1(selection)));
|
|
84
|
+
scratch.applyOps(ops, "Clone");
|
|
85
|
+
return true;
|
|
86
|
+
};
|
|
87
|
+
const answer = behaviors.end(scratch.currentDelta, (placement) => placedCopyOps(scratch, selection, placement));
|
|
88
|
+
if (answer === null) return false;
|
|
89
|
+
if (answer !== void 0) return answer.length === 0 || apply(answer);
|
|
90
|
+
const ops = placedCopyOps(scratch, selection);
|
|
91
|
+
return ops !== null && ops.length > 0 && apply(ops);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Static descriptor for the `clone` Action. Copies each selected node, with
|
|
95
|
+
* its subtree, to where the drag left it. One undo entry.
|
|
96
|
+
*/
|
|
97
|
+
var cloneAction = inPlane({
|
|
98
|
+
id: "clone",
|
|
99
|
+
label: "Clone",
|
|
100
|
+
cursor: "copy",
|
|
101
|
+
activeCursor: "copy",
|
|
102
|
+
eligible: { capability: ["edits-page", "creates-selection"] },
|
|
103
|
+
modifierRoles: SNAP_ROLES,
|
|
104
|
+
requires: [
|
|
105
|
+
"operands",
|
|
106
|
+
"scene",
|
|
107
|
+
"applyOps",
|
|
108
|
+
"poseDescriptor",
|
|
109
|
+
"boundsIncludeStroke",
|
|
110
|
+
"drawnBoxes",
|
|
111
|
+
"kitSettings",
|
|
112
|
+
"snap"
|
|
113
|
+
],
|
|
114
|
+
invoker: {
|
|
115
|
+
timing: "ongoing",
|
|
116
|
+
start(ctx, opts) {
|
|
117
|
+
const selection = ctx.deps.operands;
|
|
118
|
+
const scene = ctx.deps.scene;
|
|
119
|
+
const applyOps = ctx.deps.applyOps;
|
|
120
|
+
if (!selection || !scene) return {};
|
|
121
|
+
const ids = selection.get();
|
|
122
|
+
if (ids.length === 0) return {};
|
|
123
|
+
const frame = scenePoseFrame$1(scene);
|
|
124
|
+
const originPoses = /* @__PURE__ */ new Map();
|
|
125
|
+
const descriptorOf = nodeDescriptors$1(scene, poseDescriptorOf$1(ctx.deps.poseDescriptor));
|
|
126
|
+
for (const id of translateTargets(scene, frame, ids)) {
|
|
127
|
+
const node = scene.get(id);
|
|
128
|
+
if (node === void 0) continue;
|
|
129
|
+
const toEdited = invertPlane(planeOf(ctx.deps.view, node.layer));
|
|
130
|
+
originPoses.set(id, carryPose(descriptorOf(id), frame.world(id), toEdited));
|
|
131
|
+
}
|
|
132
|
+
if (originPoses.size === 0) return {};
|
|
133
|
+
const scratch = {
|
|
134
|
+
ids: rootsAmong(scene, ids),
|
|
135
|
+
scene,
|
|
136
|
+
descriptorOf,
|
|
137
|
+
frame,
|
|
138
|
+
originPoses,
|
|
139
|
+
view: ctx.deps.view,
|
|
140
|
+
currentDelta: {
|
|
141
|
+
dx: 0,
|
|
142
|
+
dy: 0
|
|
143
|
+
},
|
|
144
|
+
previews: /* @__PURE__ */ new Map(),
|
|
145
|
+
applyOps
|
|
146
|
+
};
|
|
147
|
+
const behaviors = startCloneBehaviors(ctx, opts, scene, scratch.ids, originPoses, descriptorOf);
|
|
148
|
+
const snap = beginDragSnap(ctx, scratch.ids, []);
|
|
149
|
+
const show = (moveCtx) => {
|
|
150
|
+
const next = finiteFrame({
|
|
151
|
+
delta: scratch.currentDelta,
|
|
152
|
+
previews: scratch.previews
|
|
153
|
+
}, moveCtx, () => {
|
|
154
|
+
const delta = behaviors.shape(moveCtx, snappedDelta(snap, moveCtx));
|
|
155
|
+
const previews = /* @__PURE__ */ new Map();
|
|
156
|
+
if (delta.dx === 0 && delta.dy === 0) return {
|
|
157
|
+
delta,
|
|
158
|
+
previews
|
|
159
|
+
};
|
|
160
|
+
for (const id of scratch.originPoses.keys()) {
|
|
161
|
+
const stored = landed(scratch, id, delta.dx, delta.dy);
|
|
162
|
+
if (stored === null || stored === void 0) continue;
|
|
163
|
+
previews.set(id, quantizedPreview(scene, id, stored));
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
delta,
|
|
167
|
+
previews
|
|
168
|
+
};
|
|
169
|
+
}, (f) => f.previews);
|
|
170
|
+
scratch.currentDelta = next.delta;
|
|
171
|
+
scratch.previews = next.previews;
|
|
172
|
+
};
|
|
173
|
+
let lastMove = null;
|
|
174
|
+
const shown = createEmitter();
|
|
175
|
+
behaviors.gctx.refresh = () => {
|
|
176
|
+
if (!lastMove) return;
|
|
177
|
+
show(lastMove);
|
|
178
|
+
shown.emit();
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
kind: "clone",
|
|
182
|
+
autoPan: true,
|
|
183
|
+
previewHidesSource: false,
|
|
184
|
+
onMove(moveCtx) {
|
|
185
|
+
if (!moveCtx.drag) return;
|
|
186
|
+
lastMove = moveCtx;
|
|
187
|
+
show(moveCtx);
|
|
188
|
+
},
|
|
189
|
+
subscribe: (changed) => shown.subscribe(changed),
|
|
190
|
+
onEnd(_endCtx, reason) {
|
|
191
|
+
let committed = false;
|
|
192
|
+
try {
|
|
193
|
+
const { dx, dy } = scratch.currentDelta;
|
|
194
|
+
if (reason === "commit" && (dx !== 0 || dy !== 0)) {
|
|
195
|
+
committed = commitClone(scratch, behaviors, selection);
|
|
196
|
+
if (committed) recordTransform(scene, {
|
|
197
|
+
kind: "duplicate",
|
|
198
|
+
dx,
|
|
199
|
+
dy
|
|
200
|
+
}, selection.get());
|
|
201
|
+
} else runBehaviorCancel(behaviors.list, behaviors.gctx);
|
|
202
|
+
} finally {
|
|
203
|
+
snap.snap?.end();
|
|
204
|
+
scratch.previews.clear();
|
|
205
|
+
runBehaviorSettled(behaviors.list, behaviors.gctx, committed);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
previewIds: () => scratch.previews.keys(),
|
|
209
|
+
previewPose: (id) => scratch.previews.get(id) ?? null
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
enabled: () => true
|
|
214
|
+
}, selectionLayer);
|
|
215
|
+
|
|
216
|
+
export { cloneAction };
|
|
217
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","names":["translatePoseViaDescriptor","defaultCommitAdapter","operandMethods","scenePoseFrame","nodeDescriptors","poseDescriptorOf"],"sources":["../../../src/actions/clone/action.ts"],"sourcesContent":["/**\n * `cloneAction` — ongoing Action descriptor for alt-drag clone. Nothing is\n * written before the commit, so a cancel only clears the preview.\n *\n * The action does not gate on a modifier: it runs whenever the dispatcher\n * routes to it, and the binding that names it carries the `alt` requirement.\n */\n\nimport type { Action, BindingOptions, InvocationCtx, OngoingHandle } from '@weasel-js/routing';\nimport type { OperandsDep, CloneEnd } from '@weasel-js/core/engine';\nimport type { Scene, NodeId, Op } from '@weasel-js/core';\nimport { defaultCommitAdapter, operandMethods, nodeDescriptors, poseDescriptorOf, translatePoseViaDescriptor, type PoseDescriptor, scenePoseFrame, type PoseFrame, SNAP_ROLES } from '@weasel-js/core/engine';\nimport { runBehaviorCancel, runBehaviorSettled, copyOps, rootsAmong, translateTargets, carryPose, invertPlane, inPlane, planeOf, selectionLayer, recordTransform, finiteFrame, quantizedPreview } from '@weasel-js/core';\nimport { startCloneBehaviors, type CloneBehaviors } from './behaviors';\nimport { beginDragSnap, snappedDelta } from '../move/dragSnap';\nimport { createEmitter } from '@weasel-js/registry';\nimport * as coreOps from '@weasel-js/core/ops';\n\ninterface CloneScratch {\n /** The selected ids a copy starts from; each brings its subtree. */\n ids: NodeId[];\n scene: Scene<unknown, string, unknown>;\n descriptorOf: (id: NodeId) => PoseDescriptor<unknown>;\n /** World reads and local writes over the scene's composition strategy. */\n frame: PoseFrame<unknown>;\n /** Origin poses captured at drag start, in world — the frame the drag\n * delta is expressed in, and the plane the edit is measured in. The copy\n * keeps its source's parent and layer, so each translated result is\n * carried back to that layer's plane and stored in that same frame.\n * Holds every node the copy moves itself: a node stored in a copied frame\n * is absent, because the copy of that frame carries it. */\n originPoses: Map<NodeId, unknown>;\n /** The view the invocation started with, read for `planeOf`. */\n view: unknown;\n /** Running drag delta — updated each onMove, applied once at commit. */\n currentDelta: { dx: number; dy: number };\n /** Preview poses keyed by the original's id: the copies have no ids yet. */\n previews: Map<NodeId, unknown>;\n /** Optional consumer commit hook captured at gesture start. When present,\n * the insert ops route through it instead of `scene.applyBatch`. */\n applyOps?: (ops: Op[], label: string) => void;\n}\n\n/** Where the copy of `id` lands for a drag of `(dx, dy)`, in world. */\nfunction landedWorld(scratch: CloneScratch, id: NodeId, dx: number, dy: number): unknown {\n const origin = scratch.originPoses.get(id);\n const node = scratch.scene.get(id);\n if (origin === undefined || !node) return undefined;\n const d = scratch.descriptorOf(id);\n const moved = translatePoseViaDescriptor(origin, dx, dy, d);\n return carryPose(d, moved, planeOf(scratch.view, node.layer));\n}\n\n/** Where the copy of `id` lands for a drag of `(dx, dy)`, as stored: `null` in a singular frame. */\nfunction landed(scratch: CloneScratch, id: NodeId, dx: number, dy: number): unknown {\n const world = landedWorld(scratch, id, dx, dy);\n return world === undefined ? undefined : scratch.frame.local(id, world);\n}\n\n/** The copied root `id` is under, or holds. */\nfunction rootOf(scratch: CloneScratch, id: NodeId): NodeId {\n const roots = new Set(scratch.ids);\n let at: NodeId | null = id;\n while (at !== null && !roots.has(at)) at = scratch.scene.get(at)?.parent ?? null;\n return at ?? id;\n}\n\n/** How far a placement moves the copy of `root` from where the drag alone leaves it, in world. */\nfunction placementShift(\n scratch: CloneScratch, root: NodeId, placement: Parameters<CloneEnd['copyOps']>[0], dx: number, dy: number,\n): { dx: number; dy: number } {\n const placed = placement.poses.get(root);\n if (placed === undefined) return { dx: 0, dy: 0 };\n const d = scratch.descriptorOf(root);\n const dragged = landedWorld(scratch, root, dx, dy) ?? translatePoseViaDescriptor(scratch.frame.world(root), dx, dy, d);\n const to = d.getBounds(placed);\n const from = d.getBounds(dragged);\n return { dx: to.x - from.x, dy: to.y - from.y };\n}\n\n/** The ops making the copies where the drag left them and selecting them;\n * with a `placement`, each copied root goes under its parent instead, at its\n * pose there when it has one. `null` when a copy would land in a singular\n * frame, so the clone refuses whole. */\nfunction placedCopyOps(scratch: CloneScratch, selection: OperandsDep, placement?: Parameters<CloneEnd['copyOps']>[0]): Op[] | null {\n const { dx, dy } = scratch.currentDelta;\n const parent = placement?.parentId as NodeId | null | undefined;\n let refused = false;\n const kept = (pose: unknown, fallback: unknown): unknown => {\n if (pose !== null) return pose;\n refused = true;\n return fallback;\n };\n const { ops, copies } = copyOps(\n scratch.scene,\n scratch.ids,\n (id, node, isRoot) => {\n if (placement === undefined) {\n return scratch.originPoses.has(id) ? kept(landed(scratch, id, dx, dy), node.pose) : node.pose;\n }\n if (isRoot) {\n const world = placement.poses.get(id) ?? landedWorld(scratch, id, dx, dy) ?? node.pose;\n return kept(scratch.frame.localUnder(parent ?? null, world), node.pose);\n }\n // An envelope's child is stored in the frame the envelope sits in, which is now `parent`'s, and lands\n // where the envelope's placement moves it.\n if (!scratch.originPoses.has(id)) return node.pose;\n const world = landedWorld(scratch, id, dx, dy);\n if (world === undefined) return node.pose;\n const shift = placementShift(scratch, rootOf(scratch, id), placement, dx, dy);\n return kept(scratch.frame.localUnder(parent ?? null, translatePoseViaDescriptor(world, shift.dx, shift.dy, scratch.descriptorOf(id))), node.pose);\n },\n 'Clone',\n parent,\n );\n if (refused) return null;\n if (ops.length === 0) return [];\n return [...ops, coreOps.setSelection({ from: selection.get(), to: copies, label: 'Clone' })];\n}\n\n/** Commit the drag: a behavior's ops when one claims it, else the copies,\n * which become the selection. Returns whether anything was committed. */\nfunction commitClone(scratch: CloneScratch, behaviors: CloneBehaviors, selection: OperandsDep): boolean {\n // False when a container refused the copies: the scene reverted them.\n const apply = (ops: Op[]): boolean => {\n if (!scratch.applyOps) return scratch.scene.applyBatch(ops, 'Clone', defaultCommitAdapter(scratch.scene, operandMethods(selection)));\n scratch.applyOps(ops, 'Clone');\n return true;\n };\n const answer = behaviors.end(scratch.currentDelta, (placement) => placedCopyOps(scratch, selection, placement));\n if (answer === null) return false;\n if (answer !== undefined) return answer.length === 0 || apply(answer);\n const ops = placedCopyOps(scratch, selection);\n return ops !== null && ops.length > 0 && apply(ops);\n}\n\n/**\n * Static descriptor for the `clone` Action. Copies each selected node, with\n * its subtree, to where the drag left it. One undo entry.\n */\nexport const cloneAction: Action & { requires: string[] } = inPlane({\n id: 'clone',\n label: 'Clone',\n // No default binding: a bare `{ kind: 'drag' }` would clone a non-empty\n // selection on any drag no tool claimed. Alt-drag on a body binds it\n // (`selectionMoveBindings`, the `move` preset).\n // The platform's duplicate cursor. The select tool binds clone behind\n // `mods: { alt: true }`, so the pump shows this only while Alt is down.\n cursor: 'copy',\n activeCursor: 'copy',\n eligible: { capability: ['edits-page', 'creates-selection'] },\n modifierRoles: SNAP_ROLES,\n requires: ['operands', 'scene', 'applyOps', 'poseDescriptor', 'boundsIncludeStroke', 'drawnBoxes', 'kitSettings', 'snap'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOptions): OngoingHandle {\n const selection = ctx.deps.operands;\n const scene = ctx.deps.scene;\n const applyOps = ctx.deps.applyOps;\n\n if (!selection || !scene) return {};\n\n const ids = selection.get() as NodeId[];\n if (ids.length === 0) return {};\n\n // Capture origin poses once at drag start.\n const frame = scenePoseFrame(scene);\n const originPoses = new Map<NodeId, unknown>();\n const descriptorOf = nodeDescriptors(scene, poseDescriptorOf(ctx.deps.poseDescriptor));\n for (const id of translateTargets(scene, frame, ids)) {\n const node = scene.get(id);\n if (node === undefined) continue;\n const toEdited = invertPlane(planeOf(ctx.deps.view, node.layer));\n originPoses.set(id, carryPose(descriptorOf(id), frame.world(id), toEdited));\n }\n\n if (originPoses.size === 0) return {};\n\n const scratch: CloneScratch = {\n ids: rootsAmong(scene, ids),\n scene,\n descriptorOf,\n frame,\n originPoses,\n view: ctx.deps.view,\n currentDelta: { dx: 0, dy: 0 },\n previews: new Map<NodeId, unknown>(),\n applyOps,\n };\n const behaviors = startCloneBehaviors(ctx, opts, scene, scratch.ids, originPoses, descriptorOf);\n // The source stays put, so it is something the copy can line up with.\n const snap = beginDragSnap(ctx, scratch.ids, []);\n\n const show = (moveCtx: InvocationCtx): void => {\n const next = finiteFrame({ delta: scratch.currentDelta, previews: scratch.previews }, moveCtx, () => {\n const delta = behaviors.shape(moveCtx, snappedDelta(snap, moveCtx));\n const previews = new Map<NodeId, unknown>();\n if (delta.dx === 0 && delta.dy === 0) return { delta, previews };\n // As the scene's quantize rule will store the copy, which shares its source's data.\n for (const id of scratch.originPoses.keys()) {\n const stored = landed(scratch, id, delta.dx, delta.dy);\n // A copy in a singular frame has no stored pose, and the commit refuses it.\n if (stored === null || stored === undefined) continue;\n previews.set(id, quantizedPreview(scene, id, stored));\n }\n return { delta, previews };\n }, (f) => f.previews);\n scratch.currentDelta = next.delta;\n scratch.previews = next.previews;\n };\n let lastMove: InvocationCtx | null = null;\n const shown = createEmitter();\n behaviors.gctx.refresh = () => {\n if (!lastMove) return;\n show(lastMove);\n shown.emit();\n };\n\n return {\n kind: 'clone',\n autoPan: true,\n // The source stays visible at its committed pose; the ghost appears\n // at the drag target.\n previewHidesSource: false,\n onMove(moveCtx: InvocationCtx): void {\n if (!moveCtx.drag) return;\n lastMove = moveCtx;\n show(moveCtx);\n },\n subscribe: (changed) => shown.subscribe(changed),\n onEnd(_endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n let committed = false;\n try {\n const { dx, dy } = scratch.currentDelta;\n // A zero-delta drag makes no clone, so its behaviors are canceled.\n if (reason === 'commit' && (dx !== 0 || dy !== 0)) {\n committed = commitClone(scratch, behaviors, selection);\n if (committed) recordTransform(scene, { kind: 'duplicate', dx, dy }, selection.get());\n } else runBehaviorCancel(behaviors.list, behaviors.gctx);\n } finally {\n snap.snap?.end();\n scratch.previews.clear();\n runBehaviorSettled(behaviors.list, behaviors.gctx, committed);\n }\n },\n previewIds: () => scratch.previews.keys(),\n previewPose: (id: string) => scratch.previews.get(id as NodeId) ?? null,\n };\n },\n },\n enabled: () => true,\n}, selectionLayer);\n"],"mappings":";;;;;;;;;AA4CA,SAAS,YAAY,SAAuB,IAAY,IAAY,IAAqB;CACvF,MAAM,SAAS,QAAQ,YAAY,IAAI,EAAE;CACzC,MAAM,OAAO,QAAQ,MAAM,IAAI,EAAE;CACjC,IAAI,WAAW,UAAa,CAAC,MAAM,OAAO;CAC1C,MAAM,IAAI,QAAQ,aAAa,EAAE;CACjC,MAAM,QAAQA,6BAA2B,QAAQ,IAAI,IAAI,CAAC;CAC1D,OAAO,UAAU,GAAG,OAAO,QAAQ,QAAQ,MAAM,KAAK,KAAK,CAAC;AAC9D;;AAGA,SAAS,OAAO,SAAuB,IAAY,IAAY,IAAqB;CAClF,MAAM,QAAQ,YAAY,SAAS,IAAI,IAAI,EAAE;CAC7C,OAAO,UAAU,SAAY,SAAY,QAAQ,MAAM,MAAM,IAAI,KAAK;AACxE;;AAGA,SAAS,OAAO,SAAuB,IAAoB;CACzD,MAAM,QAAQ,IAAI,IAAI,QAAQ,GAAG;CACjC,IAAI,KAAoB;CACxB,OAAO,OAAO,QAAQ,CAAC,MAAM,IAAI,EAAE,GAAG,KAAK,QAAQ,MAAM,IAAI,EAAE,CAAC,EAAE,UAAU;CAC5E,OAAO,MAAM;AACf;;AAGA,SAAS,eACP,SAAuB,MAAc,WAA+C,IAAY,IACpE;CAC5B,MAAM,SAAS,UAAU,MAAM,IAAI,IAAI;CACvC,IAAI,WAAW,QAAW,OAAO;EAAE,IAAI;EAAG,IAAI;CAAE;CAChD,MAAM,IAAI,QAAQ,aAAa,IAAI;CACnC,MAAM,UAAU,YAAY,SAAS,MAAM,IAAI,EA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ACpB,QAAQ,eAAe,KAAK;IAC5B,QAAQ,WAAW,KAAK;GAC1B;GACA,IAAI,WAAiC;GACrC,MAAM,QAAQ,cAAc;GAC5B,UAAU,KAAK,gBAAgB;IAC7B,IAAI,CAAC,UAAU;IACf,KAAK,QAAQ;IACb,MAAM,KAAK;GACb;GAEA,OAAO;IACL,MAAM;IACN,SAAS;IAGT,oBAAoB;IACpB,OAAO,SAA8B;KACnC,IAAI,CAAC,QAAQ,MAAM;KACnB,WAAW;KACX,KAAK,OAAO;IACd;IACA,YAAY,YAAY,MAAM,UAAU,OAAO;IAC/C,MAAM,SAAwB,QAAmC;KAC/D,IAAI,YAAY;KAChB,IAAI;MACF,MAAM,EAAE,IAAI,OAAO,QAAQ;MAE3B,IAAI,WAAW,aAAa,OAAO,KAAK,OAAO,IAAI;OACjD,YAAY,YAAY,SAAS,WAAW,SAAS;OACrD,IAAI,WAAW,gBAAgB,OAAO;QAAE,MAAM;QAAa;QAAI;OAAG,GAAG,UAAU,IAAI,CAAC;MACtF,OAAO,kBAAkB,UAAU,MAAM,UAAU,IAAI;KACzD,UAAU;MACR,KAAK,MAAM,IAAI;MACf,QAAQ,SAAS,MAAM;MACvB,mBAAmB,UAAU,MAAM,UAAU,MAAM,SAAS;KAC9D;IACF;IACA,kBAAkB,QAAQ,SAAS,KAAK;IACxC,cAAc,OAAe,QAAQ,SAAS,IAAI,EAAY,KAAK;GACrE;EACF;CACF;CACA,eAAe;AACjB,GAAG,cAAc"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { boundsOffset, gestureReaders, pointerStateOf, poseDescriptorOf, reduceBehaviorEnd, sceneGestureFrames } from "@weasel-js/core";
|
|
2
|
+
import { defaultCommitAdapter as defaultCommitAdapter$1, operandMethods as operandMethods$1, translatePoseViaDescriptor as translatePoseViaDescriptor$1 } from "@weasel-js/core/engine";
|
|
3
|
+
|
|
4
|
+
// src/actions/clone/behaviors.ts
|
|
5
|
+
/**
|
|
6
|
+
* Start the binding's behaviors over the poses the copies are measured from:
|
|
7
|
+
* `origins`, in world, keyed by the original's id.
|
|
8
|
+
*/
|
|
9
|
+
function startCloneBehaviors(ctx, opts, scene, roots, origins, descriptorOf) {
|
|
10
|
+
const list = opts?.behaviors ?? [];
|
|
11
|
+
const readers = gestureReaders(ctx.deps);
|
|
12
|
+
const origin = new Map(origins);
|
|
13
|
+
const gctx = {
|
|
14
|
+
draggedIds: roots,
|
|
15
|
+
origin,
|
|
16
|
+
current: new Map(origin),
|
|
17
|
+
snap: null,
|
|
18
|
+
modifiers: { ...ctx.modifiers },
|
|
19
|
+
pointer: pointerStateOf(ctx.world, ctx),
|
|
20
|
+
view: readers.view(),
|
|
21
|
+
plane: readers.plane(),
|
|
22
|
+
kitSettings: readers.kitSettings,
|
|
23
|
+
frames: sceneGestureFrames(scene, ctx.deps),
|
|
24
|
+
offset: boundsOffset(poseDescriptorOf(ctx.deps.poseDescriptor)),
|
|
25
|
+
adapter: defaultCommitAdapter$1(scene, operandMethods$1(ctx.deps.operands)),
|
|
26
|
+
scratch: {}
|
|
27
|
+
};
|
|
28
|
+
const place = ({ dx, dy }) => {
|
|
29
|
+
for (const [id, pose] of origins) gctx.current.set(id, translatePoseViaDescriptor$1(pose, dx, dy, descriptorOf(id)));
|
|
30
|
+
};
|
|
31
|
+
for (const b of list) b.onStart?.(gctx);
|
|
32
|
+
return {
|
|
33
|
+
list,
|
|
34
|
+
gctx,
|
|
35
|
+
shape(moveCtx, raw) {
|
|
36
|
+
if (list.length === 0) return raw;
|
|
37
|
+
gctx.modifiers = { ...moveCtx.modifiers };
|
|
38
|
+
gctx.pointer = pointerStateOf(moveCtx.world, moveCtx);
|
|
39
|
+
gctx.view = readers.view();
|
|
40
|
+
gctx.plane = readers.plane();
|
|
41
|
+
place(raw);
|
|
42
|
+
let transform = {
|
|
43
|
+
kind: "translate",
|
|
44
|
+
...raw
|
|
45
|
+
};
|
|
46
|
+
for (const b of list) {
|
|
47
|
+
const r = b.onMove?.(gctx, transform);
|
|
48
|
+
if (!r) continue;
|
|
49
|
+
if (r.transform) transform = r.transform;
|
|
50
|
+
if (r.snap !== void 0) gctx.snap = r.snap;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
dx: transform.dx,
|
|
54
|
+
dy: transform.dy
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
end(delta, copyOps) {
|
|
58
|
+
place(delta);
|
|
59
|
+
return reduceBehaviorEnd(list, gctx, { copyOps });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { startCloneBehaviors };
|
|
65
|
+
//# sourceMappingURL=behaviors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behaviors.js","names":["defaultCommitAdapter","operandMethods","translatePoseViaDescriptor"],"sources":["../../../src/actions/clone/behaviors.ts"],"sourcesContent":["import type { ActionDeps, BindingOptions, InvocationCtx } from '@weasel-js/routing';\nimport type { Op, NodeId, Scene } from '@weasel-js/core';\nimport { gestureReaders, type GestureReaders, sceneGestureFrames, reduceBehaviorEnd, pointerStateOf, boundsOffset, poseDescriptorOf } from '@weasel-js/core';\nimport type { CloneBehavior, CloneBehaviorResult, CloneEnd, GestureContext, GroupTransform } from '@weasel-js/core/engine';\nimport { defaultCommitAdapter, operandMethods, translatePoseViaDescriptor, type PoseDescriptor } from '@weasel-js/core/engine';\n\ntype Delta = { dx: number; dy: number };\n\n/** A clone drag's behaviors and the context they are told. */\nexport interface CloneBehaviors {\n readonly list: readonly CloneBehavior<unknown>[];\n readonly gctx: GestureContext<unknown>;\n /** The drag's delta as the behaviors reshape it, each seeing the one before. */\n shape(moveCtx: InvocationCtx, raw: Delta): Delta;\n /** What the behaviors answer for the commit; see `reduceBehaviorEnd`. */\n end(delta: Delta, copyOps: CloneEnd['copyOps']): Op[] | null | undefined;\n}\n\n/**\n * Start the binding's behaviors over the poses the copies are measured from:\n * `origins`, in world, keyed by the original's id.\n */\nexport function startCloneBehaviors(\n ctx: InvocationCtx,\n opts: BindingOptions | undefined,\n scene: Scene<unknown, string, unknown>,\n roots: readonly NodeId[],\n origins: ReadonlyMap<NodeId, unknown>,\n descriptorOf: (id: NodeId) => PoseDescriptor<unknown>,\n): CloneBehaviors {\n const list = (opts?.behaviors ?? []) as CloneBehavior<unknown>[];\n const readers: GestureReaders = gestureReaders(ctx.deps as Pick<ActionDeps, 'view' | 'kitSettings'>);\n const origin = new Map<string, unknown>(origins as ReadonlyMap<string, unknown>);\n const gctx: GestureContext<unknown> = {\n draggedIds: roots as unknown as string[],\n origin,\n current: new Map(origin),\n snap: null,\n modifiers: { ...ctx.modifiers },\n pointer: pointerStateOf(ctx.world, ctx),\n view: readers.view(),\n plane: readers.plane(),\n kitSettings: readers.kitSettings,\n frames: sceneGestureFrames(scene, ctx.deps),\n offset: boundsOffset(poseDescriptorOf(ctx.deps.poseDescriptor)),\n adapter: defaultCommitAdapter(scene, operandMethods(ctx.deps.operands)) as unknown as GestureContext<unknown>['adapter'],\n scratch: {},\n };\n const place = ({ dx, dy }: Delta): void => {\n for (const [id, pose] of origins) {\n gctx.current.set(id as string, translatePoseViaDescriptor(pose, dx, dy, descriptorOf(id)));\n }\n };\n for (const b of list) b.onStart?.(gctx);\n return {\n list,\n gctx,\n shape(moveCtx, raw) {\n if (list.length === 0) return raw;\n gctx.modifiers = { ...moveCtx.modifiers };\n gctx.pointer = pointerStateOf(moveCtx.world, moveCtx);\n gctx.view = readers.view();\n gctx.plane = readers.plane();\n place(raw);\n let transform: GroupTransform = { kind: 'translate', ...raw };\n for (const b of list) {\n const r: CloneBehaviorResult<unknown> | void = b.onMove?.(gctx, transform);\n if (!r) continue;\n if (r.transform) transform = r.transform;\n if (r.snap !== undefined) gctx.snap = r.snap;\n }\n return { dx: transform.dx, dy: transform.dy };\n },\n end(delta, copyOps) {\n place(delta);\n return reduceBehaviorEnd<GestureContext<unknown>, CloneEnd>(list, gctx, { copyOps });\n },\n };\n}\n"],"mappings":";;;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SAAS,QAAW,KAAK,OAAO,EAAE;GAC1C;GACA,OAAO;IAAE,IAAI,UAAU;IAAI,IAAI,UAAU;GAAG;EAC9C;EACA,IAAI,OAAO,SAAS;GAClB,MAAM,KAAK;GACX,OAAO,kBAAqD,MAAM,MAAM,EAAE,QAAQ,CAAC;EACrF;CACF;AACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { EDIT_GROUP } from "../../actionGroups.js";
|
|
2
|
+
import { hiddenSourcesTakenWith, reachesLocked, requiresContent } from "@weasel-js/core";
|
|
3
|
+
import { ActionDisabledReason, BETWEEN_GESTURES } from "@weasel-js/routing";
|
|
4
|
+
import { commitOps, withoutPageStructure as withoutPageStructure$1 } from "@weasel-js/core/engine";
|
|
5
|
+
import * as coreOps from "@weasel-js/core/ops";
|
|
6
|
+
|
|
7
|
+
// src/actions/delete/delete.ts
|
|
8
|
+
/** `id`'s slot among the scene roots or its parent's children, or `-1`. */
|
|
9
|
+
function hostIndex(scene, id) {
|
|
10
|
+
const node = scene.get(id);
|
|
11
|
+
return (node?.parent == null ? scene.roots : scene.childrenOf(node.parent)).indexOf(id);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Delete ops for the sources a removal of `ids` takes with it (see
|
|
15
|
+
* `hiddenSourcesTakenWith`), for an action whose own ops remove `ids` some
|
|
16
|
+
* other way. Append them after those ops: a delete finds its slot as it runs.
|
|
17
|
+
* Sources in `keep` stay.
|
|
18
|
+
*/
|
|
19
|
+
function hiddenSourceDeleteOps(scene, ids, label, keep) {
|
|
20
|
+
return buildDeleteOps(scene, hiddenSourcesTakenWith(scene, ids, keep), label);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Delete ops for `ids`, in the order given. Each op captures the node and its
|
|
24
|
+
* host-array index BEFORE any removal, so `invert()` re-inserts at the right
|
|
25
|
+
* slot and undo restores paint order. Ids with no live node are skipped.
|
|
26
|
+
*
|
|
27
|
+
* A page or the page run is skipped: pages are removed through the page API.
|
|
28
|
+
*
|
|
29
|
+
* Ids an already-emitted op will take are skipped: `removeNode` cascades both
|
|
30
|
+
* the subtree and the dependents, so a second op for a node the first has taken
|
|
31
|
+
* would throw `unknown node id` mid-batch — escaping the batch with the scene
|
|
32
|
+
* already mutated. Selecting a container and its members does this.
|
|
33
|
+
*
|
|
34
|
+
* The covered set grows from the ops already emitted, not from the whole
|
|
35
|
+
* selection, which is what settles a cycle: two ids that reach each other each
|
|
36
|
+
* cover the other, and filtering both would delete nothing. So which ids
|
|
37
|
+
* survive depends on their order, and the ops are a cover of the selection
|
|
38
|
+
* rather than its minimal set of roots.
|
|
39
|
+
*/
|
|
40
|
+
function buildDeleteOps(scene, ids, label, opts = {}) {
|
|
41
|
+
const all = deleteTargets(scene, ids, opts);
|
|
42
|
+
const covered = /* @__PURE__ */ new Set();
|
|
43
|
+
const ops = [];
|
|
44
|
+
for (const id of all) {
|
|
45
|
+
const node = scene.get(id);
|
|
46
|
+
if (!node) continue;
|
|
47
|
+
if (covered.has(id)) continue;
|
|
48
|
+
for (const taken of scene.removalClosure([id])) covered.add(taken);
|
|
49
|
+
ops.push(coreOps.delete({
|
|
50
|
+
node,
|
|
51
|
+
index: hostIndex(scene, id),
|
|
52
|
+
label
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
return ops;
|
|
56
|
+
}
|
|
57
|
+
/** What {@link buildDeleteOps} deletes for `ids`: less page structure, plus the hidden sources when asked. */
|
|
58
|
+
function deleteTargets(scene, ids, opts) {
|
|
59
|
+
const own = withoutPageStructure$1(scene, ids);
|
|
60
|
+
return opts.takeHiddenSources ? [...own, ...hiddenSourcesTakenWith(scene, own)] : own;
|
|
61
|
+
}
|
|
62
|
+
/** Whether deleting `ids` as Delete does would remove a locked node, which disables it (ruled 2026-11-09): a
|
|
63
|
+
* selected group holding a locked child, or a node a locked one derives from. */
|
|
64
|
+
function deleteReachesLocked(deps, ids) {
|
|
65
|
+
const scene = deps.scene;
|
|
66
|
+
return scene ? reachesLocked(scene, deleteTargets(scene, ids, { takeHiddenSources: true })) : false;
|
|
67
|
+
}
|
|
68
|
+
/** Delete's `enabled`, and Cut's: a selection holding more than page structure, none of whose removal would take a locked node. */
|
|
69
|
+
function deleteEnabled(deps) {
|
|
70
|
+
const needs = requiresContent(1)(deps);
|
|
71
|
+
if (needs !== true) return needs;
|
|
72
|
+
return deleteReachesLocked(deps, deps.operands.get()) ? ActionDisabledReason.Locked : true;
|
|
73
|
+
}
|
|
74
|
+
/** The default commit: removes `ids`, their dependents, and the sources a
|
|
75
|
+
* path effect among them hid, as one undo entry, then empties the operands. */
|
|
76
|
+
function commitDeleteToScene(ids, deps, label = "Delete") {
|
|
77
|
+
const { operands, scene } = deps;
|
|
78
|
+
if (!operands || !scene) return;
|
|
79
|
+
commitOps(deps, buildDeleteOps(scene, ids, label, { takeHiddenSources: true }), label, { select: [] });
|
|
80
|
+
}
|
|
81
|
+
/** Delete on Delete and Backspace: hands the operands to `commit`. */
|
|
82
|
+
function createDeleteAction(opts = {}) {
|
|
83
|
+
const commit = opts.commit ?? commitDeleteToScene;
|
|
84
|
+
return {
|
|
85
|
+
id: "delete",
|
|
86
|
+
label: "Delete",
|
|
87
|
+
icon: /* @icon */ "core:delete",
|
|
88
|
+
group: EDIT_GROUP,
|
|
89
|
+
defaultBinding: [{
|
|
90
|
+
spec: {
|
|
91
|
+
kind: "key",
|
|
92
|
+
key: ["Delete", "Backspace"],
|
|
93
|
+
phase: BETWEEN_GESTURES
|
|
94
|
+
},
|
|
95
|
+
opts: { id: "delete.key" }
|
|
96
|
+
}],
|
|
97
|
+
eligible: { capability: "edits-page" },
|
|
98
|
+
requires: [
|
|
99
|
+
"scene",
|
|
100
|
+
"operands",
|
|
101
|
+
"applyOps"
|
|
102
|
+
],
|
|
103
|
+
invoker: {
|
|
104
|
+
timing: "immediate",
|
|
105
|
+
run: (deps) => {
|
|
106
|
+
if (!deps.operands || !deps.scene) return;
|
|
107
|
+
const ids = deps.operands.get();
|
|
108
|
+
if (ids.length === 0 || deleteEnabled(deps) !== true) return;
|
|
109
|
+
commit(ids, deps);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
enabled: deleteEnabled
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Removes every selected node from the scene as one undo entry. Undo restores
|
|
117
|
+
* everything the removal cascaded — a container's children and a deleted
|
|
118
|
+
* node's dependents come back with it, at their own slots.
|
|
119
|
+
*/
|
|
120
|
+
var deleteAction = createDeleteAction();
|
|
121
|
+
|
|
122
|
+
export { buildDeleteOps, commitDeleteToScene, createDeleteAction, deleteAction, deleteEnabled, hiddenSourceDeleteOps };
|
|
123
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","names":["withoutPageStructure"],"sources":["../../../src/actions/delete/delete.ts"],"sourcesContent":["import type { SceneNode as Node, NodeId, Scene } from '@weasel-js/core';\nimport type { Op } from '@weasel-js/core';\nimport { commitOps } from '@weasel-js/core/engine';\nimport { ActionDisabledReason, type Action, type ActionDeps } from '@weasel-js/routing';\nimport { requiresContent } from '@weasel-js/core';\nimport { reachesLocked } from '@weasel-js/core';\nimport { icon } from '../../icons.gen';\nimport { hiddenSourcesTakenWith } from '@weasel-js/core';\nimport { withoutPageStructure } from '@weasel-js/core/engine';\nimport { BETWEEN_GESTURES } from '@weasel-js/routing';\nimport { EDIT_GROUP } from '../../actionGroups';\nimport * as coreOps from '@weasel-js/core/ops';\n\n/** `id`'s slot among the scene roots or its parent's children, or `-1`. */\nfunction hostIndex(scene: Scene<unknown, string, unknown>, id: NodeId): number {\n const node = scene.get(id);\n const siblings = node?.parent == null ? scene.roots : scene.childrenOf(node.parent);\n return siblings.indexOf(id);\n}\n\n/** Options for {@link buildDeleteOps}. */\nexport interface BuildDeleteOptions {\n /** Also delete the sources a path effect with `hideSources` among `ids` hid,\n * where nothing staying reads them — what Delete and Cut do. */\n takeHiddenSources?: boolean;\n}\n\n/**\n * Delete ops for the sources a removal of `ids` takes with it (see\n * `hiddenSourcesTakenWith`), for an action whose own ops remove `ids` some\n * other way. Append them after those ops: a delete finds its slot as it runs.\n * Sources in `keep` stay.\n */\nexport function hiddenSourceDeleteOps(\n scene: Scene<unknown, string, unknown>,\n ids: readonly NodeId[],\n label: string,\n keep?: ReadonlySet<NodeId>,\n): Op[] {\n return buildDeleteOps(scene, hiddenSourcesTakenWith(scene, ids, keep), label);\n}\n\n/**\n * Delete ops for `ids`, in the order given. Each op captures the node and its\n * host-array index BEFORE any removal, so `invert()` re-inserts at the right\n * slot and undo restores paint order. Ids with no live node are skipped.\n *\n * A page or the page run is skipped: pages are removed through the page API.\n *\n * Ids an already-emitted op will take are skipped: `removeNode` cascades both\n * the subtree and the dependents, so a second op for a node the first has taken\n * would throw `unknown node id` mid-batch — escaping the batch with the scene\n * already mutated. Selecting a container and its members does this.\n *\n * The covered set grows from the ops already emitted, not from the whole\n * selection, which is what settles a cycle: two ids that reach each other each\n * cover the other, and filtering both would delete nothing. So which ids\n * survive depends on their order, and the ops are a cover of the selection\n * rather than its minimal set of roots.\n */\nexport function buildDeleteOps(\n scene: Scene<unknown, string, unknown>,\n ids: readonly string[],\n label: string,\n opts: BuildDeleteOptions = {},\n): Op[] {\n const all = deleteTargets(scene, ids, opts);\n const covered = new Set<string>();\n const ops: Op[] = [];\n for (const id of all) {\n const node = scene.get(id as NodeId);\n if (!node) continue;\n if (covered.has(id)) continue;\n for (const taken of scene.removalClosure([id as NodeId])) covered.add(taken);\n ops.push(coreOps.delete<Node<unknown, string, unknown>>({\n node,\n index: hostIndex(scene, id as NodeId),\n label,\n }));\n }\n return ops;\n}\n\n/** What {@link buildDeleteOps} deletes for `ids`: less page structure, plus the hidden sources when asked. */\nfunction deleteTargets(scene: Scene<unknown, string, unknown>, ids: readonly string[], opts: BuildDeleteOptions): readonly string[] {\n const own = withoutPageStructure(scene, ids);\n return opts.takeHiddenSources ? [...own, ...hiddenSourcesTakenWith(scene, own as readonly NodeId[])] : own;\n}\n\n/** Whether deleting `ids` as Delete does would remove a locked node, which disables it (ruled 2026-11-09): a\n * selected group holding a locked child, or a node a locked one derives from. */\nfunction deleteReachesLocked(deps: ActionDeps, ids: readonly NodeId[]): boolean {\n const scene = deps.scene;\n return scene ? reachesLocked(scene, deleteTargets(scene, ids, { takeHiddenSources: true }) as readonly NodeId[]) : false;\n}\n\n/** Delete's `enabled`, and Cut's: a selection holding more than page structure, none of whose removal would take a locked node. */\nexport function deleteEnabled(deps?: ActionDeps): true | ActionDisabledReason {\n const needs = requiresContent(1)(deps);\n if (needs !== true) return needs;\n return deleteReachesLocked(deps!, deps!.operands!.get()) ? ActionDisabledReason.Locked : true;\n}\n\n/** Options for {@link createDeleteAction}. */\nexport interface DeleteActionOptions {\n /** Runs in place of the default, {@link commitDeleteToScene}. */\n commit?: (ids: readonly NodeId[], deps: ActionDeps) => void;\n}\n\n/** The default commit: removes `ids`, their dependents, and the sources a\n * path effect among them hid, as one undo entry, then empties the operands. */\nexport function commitDeleteToScene(ids: readonly NodeId[], deps: ActionDeps, label = 'Delete'): void {\n const { operands, scene } = deps;\n if (!operands || !scene) return;\n commitOps(deps, buildDeleteOps(scene, ids, label, { takeHiddenSources: true }), label, { select: [] });\n}\n\n/** Delete on Delete and Backspace: hands the operands to `commit`. */\nexport function createDeleteAction(opts: DeleteActionOptions = {}): Action & { requires: string[] } {\n const commit = opts.commit ?? commitDeleteToScene;\n return {\n id: 'delete',\n label: 'Delete',\n icon: icon('core:delete'),\n group: EDIT_GROUP,\n // Suppressed while any tool is mid-gesture — accidentally hitting\n // Delete during a drag shouldn't wipe the selection out from under\n // the in-flight handle.\n defaultBinding: [{\n spec: {\n kind: 'key',\n key: ['Delete', 'Backspace'],\n phase: BETWEEN_GESTURES,\n },\n opts: { id: 'delete.key' },\n }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'operands', 'applyOps'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n if (!deps.operands || !deps.scene) return;\n const ids = deps.operands.get();\n if (ids.length === 0 || deleteEnabled(deps) !== true) return;\n commit(ids, deps);\n },\n },\n enabled: deleteEnabled,\n };\n}\n\n/**\n * Removes every selected node from the scene as one undo entry. Undo restores\n * everything the removal cascaded — a container's children and a deleted\n * node's dependents come back with it, at their own slots.\n */\nexport const deleteAction = createDeleteAction();\n"],"mappings":";;;;;;;;AAcA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwC,CAAA,CAAA,CAAA,CAAoB;AAC7E,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,CAAA;AAEzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CADiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAC3E,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAE,CAAA;AAC5B;;;;;;;AAeA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAA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CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/actions/derivedBox.ts
|
|
2
|
+
/**
|
|
3
|
+
* The node whose own box a whole-node transform of `ids` is measured from, when
|
|
4
|
+
* that is not the box of the nodes it writes: a lone selected node whose pose
|
|
5
|
+
* derives from the nodes it names, as a path effect's does. Its chrome sits on
|
|
6
|
+
* its own box, which need not be the union of its sources. Null otherwise; a
|
|
7
|
+
* container's derived pose is already its children's union.
|
|
8
|
+
*/
|
|
9
|
+
function derivedBoxOwner(scene, ids) {
|
|
10
|
+
if (ids.length !== 1) return null;
|
|
11
|
+
const node = scene.get(ids[0]);
|
|
12
|
+
return node?.derivePose !== void 0 && Array.isArray(node.dependsOn) && node.dependsOn.length > 0 ? node.id : null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { derivedBoxOwner };
|
|
16
|
+
//# sourceMappingURL=derivedBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivedBox.js","names":[],"sources":["../../src/actions/derivedBox.ts"],"sourcesContent":["import type { NodeId, Scene } from '@weasel-js/core';\n\n/**\n * The node whose own box a whole-node transform of `ids` is measured from, when\n * that is not the box of the nodes it writes: a lone selected node whose pose\n * derives from the nodes it names, as a path effect's does. Its chrome sits on\n * its own box, which need not be the union of its sources. Null otherwise; a\n * container's derived pose is already its children's union.\n */\nexport function derivedBoxOwner(scene: Scene<unknown, string, unknown>, ids: readonly string[]): NodeId | null {\n if (ids.length !== 1) return null;\n const node = scene.get(ids[0] as NodeId);\n return node?.derivePose !== undefined && Array.isArray(node.dependsOn) && node.dependsOn.length > 0 ? node.id : null;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,gBAAgB,OAAwC,KAAuC;CAC7G,IAAI,IAAI,WAAW,GAAG,OAAO;CAC7B,MAAM,OAAO,MAAM,IAAI,IAAI,EAAY;CACvC,OAAO,MAAM,eAAe,UAAa,MAAM,QAAQ,KAAK,SAAS,KAAK,KAAK,UAAU,SAAS,IAAI,KAAK,KAAK;AAClH"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { planDistribute } from "./plan.js";
|
|
2
|
+
import { DISTRIBUTE_GROUP } from "../../actionGroups.js";
|
|
3
|
+
import { opsAnswer, writesLocked } from "../lockedWrites.js";
|
|
2
4
|
import { commitTransformOps, drawnBoxes, moveEachOps, scenePoseFrame, uncarried, withoutPageStructure } from "@weasel-js/core";
|
|
3
5
|
import { ActionDisabledReason, defineAction } from "@weasel-js/routing";
|
|
4
6
|
|
|
@@ -54,7 +56,7 @@ function makeDistributeAction(axis) {
|
|
|
54
56
|
id: ID_FOR[axis],
|
|
55
57
|
label: LABEL_FOR[axis],
|
|
56
58
|
icon: ICON_FOR[axis],
|
|
57
|
-
group:
|
|
59
|
+
group: DISTRIBUTE_GROUP,
|
|
58
60
|
eligible: { capability: "transforms-selection" },
|
|
59
61
|
requires: [
|
|
60
62
|
"operands",
|
|
@@ -73,14 +75,15 @@ function makeDistributeAction(axis) {
|
|
|
73
75
|
const selection = deps.operands;
|
|
74
76
|
const scene = deps.scene;
|
|
75
77
|
if (!selection || !scene) return;
|
|
76
|
-
|
|
78
|
+
const ops = distributeOps(deps, selection, scene, axis, modeOf(params));
|
|
79
|
+
if (!writesLocked(scene, ops)) commitTransformOps(deps, ops, "Distribute");
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
enabled: (deps, _at, _carried, params) => {
|
|
80
83
|
const selection = deps?.operands;
|
|
81
84
|
const scene = deps?.scene;
|
|
82
85
|
if (!selection || !scene || selection.get().length < 3) return ActionDisabledReason.SelectionRequired;
|
|
83
|
-
return distributeOps(deps, selection, scene, axis, modeOf(params))
|
|
86
|
+
return opsAnswer(scene, distributeOps(deps, selection, scene, axis, modeOf(params)));
|
|
84
87
|
}
|
|
85
88
|
});
|
|
86
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","names":[],"sources":["../../../src/actions/distribute/action.tsx"],"sourcesContent":["import type { IconRef } from '@weasel-js/icons';\nimport type { OperandsDep, Scene, Op } from '@weasel-js/core';\nimport { drawnBoxes, scenePoseFrame, moveEachOps, uncarried, withoutPageStructure, commitTransformOps } from '@weasel-js/core';\nimport type { DistributeAxis, DistributeMode } from './distribute';\nimport { planDistribute } from './plan';\nimport type { Action, ActionDeps } from '@weasel-js/routing';\nimport { ActionDisabledReason, defineAction } from '@weasel-js/routing';\nimport type { DistributeParams } from '../../actionParamSchema';\nimport { icon } from '../../icons.gen';\n\nconst ID_FOR = { x: 'distribute.horizontal', y: 'distribute.vertical' } as const satisfies Record<DistributeAxis, string>;\nconst LABEL_FOR: Record<DistributeAxis, string> = { x: 'Distribute Horizontally', y: 'Distribute Vertically' };\nconst ICON_FOR: Record<DistributeAxis, IconRef> = {\n x: icon('core:distributeHorizontal'),\n y: icon('core:distributeVertical'),\n};\n\n// ---------------------------------------------------------------------------\n// Shared helper for descriptor invokers\n// ---------------------------------------------------------------------------\n\n/**\n * The ops a distribute of the current selection commits, read through the\n * `poseDescriptor` dep. Empty with fewer than three members, or when they\n * are spaced already.\n *\n * The span being divided is a world span, so the bounds are read and\n * translated in world and each result is stored back in its own parent's\n * frame.\n */\nfunction distributeOps(\n deps: ActionDeps,\n selection: Pick<OperandsDep, 'get'>,\n scene: Scene<unknown, string, unknown>,\n axis: DistributeAxis,\n mode: DistributeMode,\n): Op[] {\n const frame = scenePoseFrame(scene);\n const ids = uncarried(frame, withoutPageStructure(scene, selection.get()));\n if (ids.length < 3) return [];\n const boxes = drawnBoxes(deps, frame);\n\n const items = ids.map((id) => {\n const pose = frame.world(id);\n return { id, pose, b: boxes.aabb(id, pose) };\n });\n const targets = planDistribute(items.map((it) => it.b), axis, mode);\n\n const moves = items.map((it, i) => {\n const delta = targets[i] - (axis === 'x' ? it.b.x : it.b.y);\n return { ids: [it.id], dx: axis === 'x' ? delta : 0, dy: axis === 'y' ? delta : 0 };\n });\n return moveEachOps(scene, moves, deps, 'Distribute');\n}\n\nconst modeOf = (params: Readonly<Partial<DistributeParams>> | undefined): DistributeMode => params?.mode ?? 'centers';\n\n// ---------------------------------------------------------------------------\n// Static descriptors\n// ---------------------------------------------------------------------------\n\nfunction makeDistributeAction(axis: DistributeAxis): Action {\n return defineAction({\n id: ID_FOR[axis],\n label: LABEL_FOR[axis],\n icon: ICON_FOR[axis],\n group: 'distribute',\n eligible: { capability: 'transforms-selection' },\n requires: ['operands', 'scene', 'applyOps', 'geometryProjection', 'poseDescriptor', 'view', 'boundsIncludeStroke', 'drawnBoxes', 'transformFollowers'],\n // No default keybindings. Wire bindings explicitly via the actions registry.\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const selection = deps.operands;\n const scene = deps.scene;\n if (!selection || !scene) return;\n commitTransformOps(deps, distributeOps(deps, selection, scene, axis, modeOf(params)), 'Distribute');\n },\n },\n enabled: (deps, _at, _carried, params) => {\n const selection = deps?.operands;\n const scene = deps?.scene;\n if (!selection || !scene || selection.get().length < 3) return ActionDisabledReason.SelectionRequired;\n return distributeOps(deps, selection, scene, axis, modeOf(params)).length > 0 ? true : ActionDisabledReason.NotApplicable;\n },\n });\n}\n\n/** Static descriptor for distribute-horizontal. */\nexport const distributeHorizontalAction = makeDistributeAction('x');\n/** Static descriptor for distribute-vertical. */\nexport const distributeVerticalAction = makeDistributeAction('y');\n\n"],"mappings":";;;;;AAUA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AAAE,CAAA,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAyB,CAAA,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAA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AA,CAAA,CAAA,CAAM,CAAC,CAAC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAC9G,CAAA,CAAA;AACF,CAAA,CAAC,CAAA;AACH;;AAGA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA,CAAG,CAAA;;AAElE,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA,CAAG,CAAA"}
|
|
1
|
+
{"version":3,"file":"action.js","names":[],"sources":["../../../src/actions/distribute/action.tsx"],"sourcesContent":["import type { IconRef } from '@weasel-js/icons';\nimport type { OperandsDep, Scene, Op } from '@weasel-js/core';\nimport { drawnBoxes, scenePoseFrame, moveEachOps, uncarried, withoutPageStructure, commitTransformOps } from '@weasel-js/core';\nimport type { DistributeAxis, DistributeMode } from './distribute';\nimport { planDistribute } from './plan';\nimport type { Action, ActionDeps } from '@weasel-js/routing';\nimport { ActionDisabledReason, defineAction } from '@weasel-js/routing';\nimport type { DistributeParams } from '../../actionParamSchema';\nimport { icon } from '../../icons.gen';\nimport { DISTRIBUTE_GROUP } from '../../actionGroups';\nimport { opsAnswer, writesLocked } from '../lockedWrites';\n\nconst ID_FOR = { x: 'distribute.horizontal', y: 'distribute.vertical' } as const satisfies Record<DistributeAxis, string>;\nconst LABEL_FOR: Record<DistributeAxis, string> = { x: 'Distribute Horizontally', y: 'Distribute Vertically' };\nconst ICON_FOR: Record<DistributeAxis, IconRef> = {\n x: icon('core:distributeHorizontal'),\n y: icon('core:distributeVertical'),\n};\n\n// ---------------------------------------------------------------------------\n// Shared helper for descriptor invokers\n// ---------------------------------------------------------------------------\n\n/**\n * The ops a distribute of the current selection commits, read through the\n * `poseDescriptor` dep. Empty with fewer than three members, or when they\n * are spaced already.\n *\n * The span being divided is a world span, so the bounds are read and\n * translated in world and each result is stored back in its own parent's\n * frame.\n */\nfunction distributeOps(\n deps: ActionDeps,\n selection: Pick<OperandsDep, 'get'>,\n scene: Scene<unknown, string, unknown>,\n axis: DistributeAxis,\n mode: DistributeMode,\n): Op[] {\n const frame = scenePoseFrame(scene);\n const ids = uncarried(frame, withoutPageStructure(scene, selection.get()));\n if (ids.length < 3) return [];\n const boxes = drawnBoxes(deps, frame);\n\n const items = ids.map((id) => {\n const pose = frame.world(id);\n return { id, pose, b: boxes.aabb(id, pose) };\n });\n const targets = planDistribute(items.map((it) => it.b), axis, mode);\n\n const moves = items.map((it, i) => {\n const delta = targets[i] - (axis === 'x' ? it.b.x : it.b.y);\n return { ids: [it.id], dx: axis === 'x' ? delta : 0, dy: axis === 'y' ? delta : 0 };\n });\n return moveEachOps(scene, moves, deps, 'Distribute');\n}\n\nconst modeOf = (params: Readonly<Partial<DistributeParams>> | undefined): DistributeMode => params?.mode ?? 'centers';\n\n// ---------------------------------------------------------------------------\n// Static descriptors\n// ---------------------------------------------------------------------------\n\nfunction makeDistributeAction(axis: DistributeAxis): Action {\n return defineAction({\n id: ID_FOR[axis],\n label: LABEL_FOR[axis],\n icon: ICON_FOR[axis],\n group: DISTRIBUTE_GROUP,\n eligible: { capability: 'transforms-selection' },\n requires: ['operands', 'scene', 'applyOps', 'geometryProjection', 'poseDescriptor', 'view', 'boundsIncludeStroke', 'drawnBoxes', 'transformFollowers'],\n // No default keybindings. Wire bindings explicitly via the actions registry.\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const selection = deps.operands;\n const scene = deps.scene;\n if (!selection || !scene) return;\n const ops = distributeOps(deps, selection, scene, axis, modeOf(params));\n if (!writesLocked(scene, ops)) commitTransformOps(deps, ops, 'Distribute');\n },\n },\n enabled: (deps, _at, _carried, params) => {\n const selection = deps?.operands;\n const scene = deps?.scene;\n if (!selection || !scene || selection.get().length < 3) return ActionDisabledReason.SelectionRequired;\n return opsAnswer(scene, distributeOps(deps, selection, scene, axis, modeOf(params)));\n },\n });\n}\n\n/** Static descriptor for distribute-horizontal. */\nexport const distributeHorizontalAction = makeDistributeAction('x');\n/** Static descriptor for distribute-vertical. */\nexport const distributeVerticalAction = makeDistributeAction('y');\n\n"],"mappings":";;;;;;;AAYA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AAAE,CAAA,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAyB,CAAA,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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