@weasel-js/editing 0.0.0-stage → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/actions/align/action.js +102 -0
- package/dist/actions/align/action.js.map +1 -0
- package/dist/actions/align/align.js +114 -0
- package/dist/actions/align/align.js.map +1 -0
- package/dist/actions/clipboard/action.js +130 -0
- package/dist/actions/clipboard/action.js.map +1 -0
- package/dist/actions/distribute/action.js +93 -0
- package/dist/actions/distribute/action.js.map +1 -0
- package/dist/actions/distribute/distribute.js +60 -0
- package/dist/actions/distribute/distribute.js.map +1 -0
- package/dist/actions/distribute/plan.js +55 -0
- package/dist/actions/distribute/plan.js.map +1 -0
- package/dist/actions/edit/createPaintAction.js +109 -0
- package/dist/actions/edit/createPaintAction.js.map +1 -0
- package/dist/actions/edit/duplicate.js +91 -0
- package/dist/actions/edit/duplicate.js.map +1 -0
- package/dist/actions/edit/escape.js +34 -0
- package/dist/actions/edit/escape.js.map +1 -0
- package/dist/actions/edit/group.js +277 -0
- package/dist/actions/edit/group.js.map +1 -0
- package/dist/actions/edit/ingest.js +112 -0
- package/dist/actions/edit/ingest.js.map +1 -0
- package/dist/actions/edit/nudge.js +93 -0
- package/dist/actions/edit/nudge.js.map +1 -0
- package/dist/actions/edit/selectAll.js +48 -0
- package/dist/actions/edit/selectAll.js.map +1 -0
- package/dist/actions/edit/setFill.js +52 -0
- package/dist/actions/edit/setFill.js.map +1 -0
- package/dist/actions/edit/setFillOpacity.js +26 -0
- package/dist/actions/edit/setFillOpacity.js.map +1 -0
- package/dist/actions/edit/setStroke.js +57 -0
- package/dist/actions/edit/setStroke.js.map +1 -0
- package/dist/actions/edit/setStrokeOpacity.js +28 -0
- package/dist/actions/edit/setStrokeOpacity.js.map +1 -0
- package/dist/actions/edit/setStrokeWidth.js +48 -0
- package/dist/actions/edit/setStrokeWidth.js.map +1 -0
- package/dist/actions/edit/setVertexColor.js +38 -0
- package/dist/actions/edit/setVertexColor.js.map +1 -0
- package/dist/actions/flip/action.js +204 -0
- package/dist/actions/flip/action.js.map +1 -0
- package/dist/actions/flip/helpers.js +80 -0
- package/dist/actions/flip/helpers.js.map +1 -0
- package/dist/actions/pathfinder/action.js +107 -0
- package/dist/actions/pathfinder/action.js.map +1 -0
- package/dist/actions/pathfinder/booleanGroupAction.js +111 -0
- package/dist/actions/pathfinder/booleanGroupAction.js.map +1 -0
- package/dist/actions/pathfinder/keymap.js +51 -0
- package/dist/actions/pathfinder/keymap.js.map +1 -0
- package/dist/actions/reorder/reorder.js +243 -0
- package/dist/actions/reorder/reorder.js.map +1 -0
- package/dist/actions/transformAgain/action.js +88 -0
- package/dist/actions/transformAgain/action.js.map +1 -0
- package/dist/actions/transformAgain/transformSelection.js +35 -0
- package/dist/actions/transformAgain/transformSelection.js.map +1 -0
- package/dist/engineStandardActions.js +45 -0
- package/dist/engineStandardActions.js.map +1 -0
- package/dist/index.d.ts +679 -0
- package/dist/index.js +37 -0
- package/dist/namedPresets.js +71 -0
- package/dist/namedPresets.js.map +1 -0
- package/dist/presets/arrange.js +51 -0
- package/dist/presets/arrange.js.map +1 -0
- package/dist/presets/composites.js +43 -0
- package/dist/presets/composites.js.map +1 -0
- package/dist/presets/edit.js +113 -0
- package/dist/presets/edit.js.map +1 -0
- package/dist/presets/ingest.js +13 -0
- package/dist/presets/ingest.js.map +1 -0
- package/dist/presets/pathfinder.js +23 -0
- package/dist/presets/pathfinder.js.map +1 -0
- package/dist/presets/select.js +18 -0
- package/dist/presets/select.js.map +1 -0
- package/dist/presets/tools.js +15 -0
- package/dist/presets/tools.js.map +1 -0
- package/dist/presets/transform.js +39 -0
- package/dist/presets/transform.js.map +1 -0
- package/dist/useStandardActions.js +26 -0
- package/dist/useStandardActions.js.map +1 -0
- package/package.json +59 -4
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { createDeleteOp, createReparentOp, createSetDependsOnOp, finiteThroughout, followerOpsFor, inPaintOrder, requiresContent, selectedContent, selectedRoots, slotAbove } from "@weasel-js/core";
|
|
2
|
+
import { commitOps, createInsertOp, createTransformOp as createTransformOp$1, groupingSite, pageOfNode, poseDescriptorOf as poseDescriptorOf$1, scenePoseFrame as scenePoseFrame$1, translatePoseViaDescriptor as translatePoseViaDescriptor$1, unionBounds, visualBoundsViaDescriptor as visualBoundsViaDescriptor$1 } from "@weasel-js/core/engine";
|
|
3
|
+
import { ActionDisabledReason, BETWEEN_GESTURES } from "@weasel-js/routing";
|
|
4
|
+
|
|
5
|
+
// src/actions/edit/group.ts
|
|
6
|
+
/** Where grouping the selection puts its container and members, or null when it cannot: no content, members on
|
|
7
|
+
* more than one layer, a container too large for the double range, a container that lands in a singular frame
|
|
8
|
+
* or whose own frame is singular, so a member could not keep its place. `enabled` and `run` both read this. */
|
|
9
|
+
function groupPlan(deps) {
|
|
10
|
+
const scene = deps.scene;
|
|
11
|
+
if (!deps.operands || !scene) return null;
|
|
12
|
+
const ids = selectedRoots(scene, deps.operands.get());
|
|
13
|
+
const nodes = inPaintOrder(scene, ids.map((id) => scene.get(id)).filter((n) => n !== void 0));
|
|
14
|
+
if (nodes.length === 0) return null;
|
|
15
|
+
if (new Set(nodes.map((n) => n.layer)).size > 1) return null;
|
|
16
|
+
const d = poseDescriptorOf$1(deps.poseDescriptor);
|
|
17
|
+
const frame = scenePoseFrame$1(scene);
|
|
18
|
+
const worlds = /* @__PURE__ */ new Map();
|
|
19
|
+
for (const node of nodes) worlds.set(node.id, frame.world(node.id));
|
|
20
|
+
const drawn = unionBounds([...worlds.values()].map((p) => visualBoundsViaDescriptor$1(p, d)));
|
|
21
|
+
const { parent, shift } = groupingSite(scene, nodes.map((n) => n.id), drawn);
|
|
22
|
+
if (shift.dx !== 0 || shift.dy !== 0) for (const [id, p] of worlds) worlds.set(id, translatePoseViaDescriptor$1(p, shift.dx, shift.dy, d));
|
|
23
|
+
const union = drawn && {
|
|
24
|
+
...drawn,
|
|
25
|
+
x: drawn.x + shift.dx,
|
|
26
|
+
y: drawn.y + shift.dy
|
|
27
|
+
};
|
|
28
|
+
const containerWorldPose = union === null ? nodes[0].pose : d.fromBounds(union, nodes[0].pose);
|
|
29
|
+
const pose = frame.localUnder(parent, containerWorldPose);
|
|
30
|
+
if (pose === null || !finiteThroughout(pose)) return null;
|
|
31
|
+
const locals = /* @__PURE__ */ new Map();
|
|
32
|
+
for (const [id, world] of worlds) {
|
|
33
|
+
const local = frame.pc.decompose(containerWorldPose, world);
|
|
34
|
+
if (local === null) return null;
|
|
35
|
+
locals.set(id, local);
|
|
36
|
+
}
|
|
37
|
+
const page = parent === null ? null : pageOfNode(scene, parent);
|
|
38
|
+
const followers = followerOpsFor(scene, new Map(nodes.map((n) => [n.id, page])), "Group");
|
|
39
|
+
if (followers === null) return null;
|
|
40
|
+
return {
|
|
41
|
+
scene,
|
|
42
|
+
nodes,
|
|
43
|
+
locals,
|
|
44
|
+
parent,
|
|
45
|
+
pose,
|
|
46
|
+
followers
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a structural `GroupNode` and reparents the current selection
|
|
51
|
+
* under it as a single undoable batch, in the container `groupingSite` names,
|
|
52
|
+
* in the frontmost member's place, the members keeping their stacking.
|
|
53
|
+
*
|
|
54
|
+
* Grouping never moves a member on screen, unless with the pasteboard off
|
|
55
|
+
* the members lie wholly off every page and move onto one. The container takes the world
|
|
56
|
+
* envelope of its members' ink, and each member is re-expressed in that
|
|
57
|
+
* container's frame. The container is a frame, so its pose is authored rather
|
|
58
|
+
* than derived from its members, whose poses are expressed in it. A node
|
|
59
|
+
* following a member that changes page goes where `followerMoves` says.
|
|
60
|
+
*/
|
|
61
|
+
var groupAction = {
|
|
62
|
+
id: "group",
|
|
63
|
+
label: "Group",
|
|
64
|
+
icon: /* @icon */ "core:group",
|
|
65
|
+
group: "structure",
|
|
66
|
+
defaultBinding: [{
|
|
67
|
+
spec: {
|
|
68
|
+
kind: "key",
|
|
69
|
+
key: "g",
|
|
70
|
+
mods: { mod: true },
|
|
71
|
+
phase: BETWEEN_GESTURES
|
|
72
|
+
},
|
|
73
|
+
opts: { id: "group.key" }
|
|
74
|
+
}],
|
|
75
|
+
eligible: { capability: "edits-page" },
|
|
76
|
+
requires: [
|
|
77
|
+
"scene",
|
|
78
|
+
"operands",
|
|
79
|
+
"applyOps",
|
|
80
|
+
"poseDescriptor"
|
|
81
|
+
],
|
|
82
|
+
invoker: {
|
|
83
|
+
timing: "immediate",
|
|
84
|
+
run: (deps) => {
|
|
85
|
+
const plan = groupPlan(deps);
|
|
86
|
+
if (!plan) return;
|
|
87
|
+
const { scene, nodes, locals, parent, pose, followers } = plan;
|
|
88
|
+
const containerId = scene.mintId();
|
|
89
|
+
const index = slotAbove(scene, parent, nodes.at(-1).id);
|
|
90
|
+
const ops = [createInsertOp({
|
|
91
|
+
node: {
|
|
92
|
+
id: containerId,
|
|
93
|
+
kind: "group",
|
|
94
|
+
layer: nodes[0].layer,
|
|
95
|
+
pose,
|
|
96
|
+
data: {},
|
|
97
|
+
parent: parent ?? null
|
|
98
|
+
},
|
|
99
|
+
...index !== void 0 ? { index } : {},
|
|
100
|
+
label: "Group"
|
|
101
|
+
})];
|
|
102
|
+
nodes.forEach((node, i) => {
|
|
103
|
+
ops.push(createReparentOp({
|
|
104
|
+
id: node.id,
|
|
105
|
+
fromParentId: node.parent ?? null,
|
|
106
|
+
toParentId: containerId,
|
|
107
|
+
toIndex: i,
|
|
108
|
+
label: "Group"
|
|
109
|
+
}));
|
|
110
|
+
ops.push(createTransformOp$1({
|
|
111
|
+
id: node.id,
|
|
112
|
+
from: node.pose,
|
|
113
|
+
to: locals.get(node.id),
|
|
114
|
+
label: "Group"
|
|
115
|
+
}));
|
|
116
|
+
});
|
|
117
|
+
ops.push(...followers);
|
|
118
|
+
commitOps(deps, ops, "Group", { select: [containerId] });
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
enabled: (deps) => {
|
|
122
|
+
const given = requiresContent(1)(deps);
|
|
123
|
+
if (given !== true) return given;
|
|
124
|
+
return groupPlan(deps) ? true : ActionDisabledReason.NotApplicable;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/** Whether ungrouping `node` dissolves it: a group, or a boolean group, which releases its operands. */
|
|
128
|
+
var dissolves = (node) => node?.kind === "group" || node?.consumesChildren === true;
|
|
129
|
+
/** What ungrouping `containers` touches besides moving their children: the nodes that derive from one of them,
|
|
130
|
+
* each with the `dependsOn` it keeps. Ungroup removes the containers from every such list, so deleting a container
|
|
131
|
+
* takes nothing with it (ruled 2026-11-09). */
|
|
132
|
+
function releasedDerivations(scene, containers) {
|
|
133
|
+
const dissolving = new Set(containers);
|
|
134
|
+
const out = /* @__PURE__ */ new Map();
|
|
135
|
+
for (const node of scene.nodes.values()) {
|
|
136
|
+
const from = node.dependsOn;
|
|
137
|
+
if (dissolving.has(node.id) || !Array.isArray(from) || !from.some((id) => dissolving.has(id))) continue;
|
|
138
|
+
const kept = from.filter((id) => !dissolving.has(id));
|
|
139
|
+
out.set(node.id, kept.length > 0 ? kept : void 0);
|
|
140
|
+
}
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
/** What ungrouping the selected `ids` does, or null when none dissolves. `enabled` and `run` both read this, so
|
|
144
|
+
* they agree. */
|
|
145
|
+
function ungroupPlan(scene, ids) {
|
|
146
|
+
if (!scene) return null;
|
|
147
|
+
const containers = ids.filter((id) => dissolves(scene.get(id)));
|
|
148
|
+
if (containers.length === 0) return null;
|
|
149
|
+
const dissolving = new Set(containers);
|
|
150
|
+
const depth = (id) => scene.ancestorsOf(id).length;
|
|
151
|
+
const freed = [...containers].sort((x, y) => depth(x) - depth(y)).flatMap((id) => scene.childrenOf(id).filter((kid) => !dissolving.has(kid)));
|
|
152
|
+
const released = releasedDerivations(scene, containers);
|
|
153
|
+
return {
|
|
154
|
+
containers,
|
|
155
|
+
freed,
|
|
156
|
+
released,
|
|
157
|
+
locked: [
|
|
158
|
+
...containers,
|
|
159
|
+
...freed,
|
|
160
|
+
...released.keys()
|
|
161
|
+
].some((id) => scene.isLocked(id))
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** The batch dissolving `plan`'s containers, outermost first: each child moved up and re-expressed in its new
|
|
165
|
+
* frame, every derivation from a container dropped, then the containers removed. `null` when a child would
|
|
166
|
+
* land in a singular frame, where it could not keep its place. */
|
|
167
|
+
function ungroupOps(scene, plan) {
|
|
168
|
+
const { containers } = plan;
|
|
169
|
+
const frame = scenePoseFrame$1(scene);
|
|
170
|
+
const dissolving = new Set(containers);
|
|
171
|
+
const depth = (id) => scene.ancestorsOf(id).length;
|
|
172
|
+
const landing = (id) => {
|
|
173
|
+
let at = scene.get(id).parent ?? null;
|
|
174
|
+
while (at !== null && dissolving.has(at)) at = scene.get(at).parent ?? null;
|
|
175
|
+
return at;
|
|
176
|
+
};
|
|
177
|
+
const moves = [];
|
|
178
|
+
const removals = [];
|
|
179
|
+
for (const containerId of [...containers].sort((x, y) => depth(x) - depth(y))) {
|
|
180
|
+
const container = scene.get(containerId);
|
|
181
|
+
const parent = landing(containerId);
|
|
182
|
+
const index = (parent === null ? scene.roots : scene.childrenOf(parent)).indexOf(containerId);
|
|
183
|
+
for (const childId of scene.childrenOf(containerId)) {
|
|
184
|
+
const to = frame.localUnder(parent, frame.world(childId));
|
|
185
|
+
if (to === null) return null;
|
|
186
|
+
moves.push(createReparentOp({
|
|
187
|
+
id: childId,
|
|
188
|
+
fromParentId: containerId,
|
|
189
|
+
toParentId: parent,
|
|
190
|
+
toSlot: {
|
|
191
|
+
index,
|
|
192
|
+
before: containerId
|
|
193
|
+
},
|
|
194
|
+
label: "Ungroup"
|
|
195
|
+
}));
|
|
196
|
+
moves.push(createTransformOp$1({
|
|
197
|
+
id: childId,
|
|
198
|
+
from: scene.get(childId).pose,
|
|
199
|
+
to,
|
|
200
|
+
label: "Ungroup"
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
removals.push(createDeleteOp({
|
|
204
|
+
node: {
|
|
205
|
+
...container,
|
|
206
|
+
parent
|
|
207
|
+
},
|
|
208
|
+
index,
|
|
209
|
+
label: "Ungroup"
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
const cuts = [...plan.released].map(([id, to]) => createSetDependsOnOp({
|
|
213
|
+
id,
|
|
214
|
+
from: scene.get(id).dependsOn,
|
|
215
|
+
to,
|
|
216
|
+
label: "Ungroup"
|
|
217
|
+
}));
|
|
218
|
+
return [
|
|
219
|
+
...moves,
|
|
220
|
+
...cuts,
|
|
221
|
+
...removals
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Dissolves each selected group, or boolean group, by reparenting its children up to the
|
|
226
|
+
* container's own parent (preserving z-order) and removing the now-empty
|
|
227
|
+
* container, as a single undoable batch. Selected marks, children or not, are
|
|
228
|
+
* ignored. The freed children become the new selection, and nothing moves on
|
|
229
|
+
* screen. Every node deriving from a dissolved container, a freed child or not, drops that container from its
|
|
230
|
+
* `dependsOn`, so the batch removes the containers and nothing else. Disabled while any node it would move,
|
|
231
|
+
* rewrite, or remove is locked, and while a child would land in a singular frame, where it could not stay
|
|
232
|
+
* where it is shown. A child of a singular container keeps the flat place it is shown at.
|
|
233
|
+
*/
|
|
234
|
+
var ungroupAction = {
|
|
235
|
+
id: "ungroup",
|
|
236
|
+
label: "Ungroup",
|
|
237
|
+
icon: /* @icon */ "core:ungroup",
|
|
238
|
+
group: "structure",
|
|
239
|
+
defaultBinding: [{
|
|
240
|
+
spec: {
|
|
241
|
+
kind: "key",
|
|
242
|
+
key: "g",
|
|
243
|
+
mods: {
|
|
244
|
+
mod: true,
|
|
245
|
+
shift: true
|
|
246
|
+
},
|
|
247
|
+
phase: BETWEEN_GESTURES
|
|
248
|
+
},
|
|
249
|
+
opts: { id: "ungroup.key" }
|
|
250
|
+
}],
|
|
251
|
+
eligible: { capability: "edits-page" },
|
|
252
|
+
requires: [
|
|
253
|
+
"scene",
|
|
254
|
+
"operands",
|
|
255
|
+
"applyOps"
|
|
256
|
+
],
|
|
257
|
+
invoker: {
|
|
258
|
+
timing: "immediate",
|
|
259
|
+
run: (deps) => {
|
|
260
|
+
const scene = deps.scene;
|
|
261
|
+
if (!deps.operands || !scene) return;
|
|
262
|
+
const plan = ungroupPlan(scene, selectedContent(deps));
|
|
263
|
+
if (!plan || plan.locked) return;
|
|
264
|
+
const ops = ungroupOps(scene, plan);
|
|
265
|
+
if (ops !== null) commitOps(deps, ops, "Ungroup", { select: plan.freed });
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
enabled: (deps) => {
|
|
269
|
+
const plan = ungroupPlan(deps?.scene, selectedContent(deps));
|
|
270
|
+
if (!plan) return ActionDisabledReason.NotApplicable;
|
|
271
|
+
if (plan.locked) return ActionDisabledReason.Locked;
|
|
272
|
+
return ungroupOps(deps.scene, plan) === null ? ActionDisabledReason.NotApplicable : true;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export { groupAction, ungroupAction };
|
|
277
|
+
//# sourceMappingURL=group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.js","names":["poseDescriptorOf","scenePoseFrame","visualBoundsViaDescriptor","translatePoseViaDescriptor","createTransformOp"],"sources":["../../../src/actions/edit/group.ts"],"sourcesContent":["import type { SceneNode as Node, NodeId, Op } from '@weasel-js/core';\nimport { createInsertOp, groupingSite, pageOfNode, translatePoseViaDescriptor, unionBounds, poseDescriptorOf, visualBoundsViaDescriptor, createTransformOp, scenePoseFrame, commitOps } from '@weasel-js/core/engine';\nimport { createReparentOp, createDeleteOp, createSetDependsOnOp, selectedRoots, followerOpsFor, finiteThroughout, requiresContent, selectedContent, inPaintOrder, slotAbove } from '@weasel-js/core';\nimport { ActionDisabledReason, type Action, type ActionDeps, BETWEEN_GESTURES } from '@weasel-js/routing';\nimport { icon } from '../../icons.gen';\nimport type { AnyScene } from '@weasel-js/core/engine';\n\n/** Where grouping the selection puts its container and members, or null when it cannot: no content, members on\n * more than one layer, a container too large for the double range, a container that lands in a singular frame\n * or whose own frame is singular, so a member could not keep its place. `enabled` and `run` both read this. */\nfunction groupPlan(deps: ActionDeps) {\n const scene = deps.scene;\n if (!deps.operands || !scene) return null;\n const ids = selectedRoots(scene, deps.operands.get() as readonly string[]);\n const nodes = inPaintOrder(scene, ids\n .map((id) => scene.get(id as NodeId))\n .filter((n): n is NonNullable<typeof n> => n !== undefined));\n if (nodes.length === 0) return null;\n\n // Members must share a layer — containers live on a single layer.\n if (new Set(nodes.map((n) => n.layer)).size > 1) return null;\n\n const d = poseDescriptorOf(deps.poseDescriptor);\n const frame = scenePoseFrame(scene);\n const worlds = new Map<NodeId, unknown>();\n for (const node of nodes) worlds.set(node.id, frame.world(node.id));\n // Visual, not stored, bounds: a turned member's ink reaches outside its\n // own box, and the container has to cover what is drawn.\n const drawn = unionBounds([...worlds.values()].map((p) => visualBoundsViaDescriptor(p, d)));\n const { parent, shift } = groupingSite(scene, nodes.map((n) => n.id), drawn);\n if (shift.dx !== 0 || shift.dy !== 0) {\n for (const [id, p] of worlds) worlds.set(id, translatePoseViaDescriptor(p, shift.dx, shift.dy, d));\n }\n const union = drawn && { ...drawn, x: drawn.x + shift.dx, y: drawn.y + shift.dy };\n const containerWorldPose = union === null\n ? nodes[0]!.pose\n : d.fromBounds(union, nodes[0]!.pose);\n const pose = frame.localUnder(parent, containerWorldPose);\n if (pose === null || !finiteThroughout(pose)) return null;\n const locals = new Map<NodeId, unknown>();\n for (const [id, world] of worlds) {\n const local = frame.pc.decompose(containerWorldPose, world);\n if (local === null) return null;\n locals.set(id, local);\n }\n const page = parent === null ? null : pageOfNode(scene, parent);\n const followers = followerOpsFor(scene, new Map(nodes.map((n) => [n.id as string, page])), 'Group');\n if (followers === null) return null;\n return { scene, nodes, locals, parent, pose, followers };\n}\n\n/**\n * Creates a structural `GroupNode` and reparents the current selection\n * under it as a single undoable batch, in the container `groupingSite` names,\n * in the frontmost member's place, the members keeping their stacking.\n *\n * Grouping never moves a member on screen, unless with the pasteboard off\n * the members lie wholly off every page and move onto one. The container takes the world\n * envelope of its members' ink, and each member is re-expressed in that\n * container's frame. The container is a frame, so its pose is authored rather\n * than derived from its members, whose poses are expressed in it. A node\n * following a member that changes page goes where `followerMoves` says.\n */\nexport const groupAction: Action & { requires: string[] } = {\n id: 'group',\n label: 'Group',\n icon: icon('core:group'),\n group: 'structure',\n defaultBinding: [{ spec: { kind: 'key', key: 'g', mods: { mod: true }, phase: BETWEEN_GESTURES }, opts: { id: 'group.key' } }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'operands', 'applyOps', 'poseDescriptor'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const plan = groupPlan(deps);\n if (!plan) return;\n const { scene, nodes, locals, parent, pose, followers } = plan;\n\n // The container must exist before any child reparents into it, so the\n // insert op is emitted first.\n const containerId = scene.mintId();\n const index = slotAbove(scene, parent, nodes.at(-1)!.id);\n const ops: Op[] = [\n createInsertOp<Node<unknown, string, unknown>>({\n node: {\n id: containerId,\n kind: 'group',\n layer: nodes[0]!.layer,\n pose: pose as unknown,\n data: {} as unknown,\n parent: parent ?? null,\n } as Node<unknown, string, unknown>,\n ...(index !== undefined ? { index } : {}),\n label: 'Group',\n }),\n ];\n nodes.forEach((node, i) => {\n ops.push(createReparentOp({\n id: node.id as string,\n fromParentId: (node.parent ?? null) as string | null,\n toParentId: containerId as string,\n toIndex: i,\n label: 'Group',\n }));\n ops.push(createTransformOp<unknown>({ id: node.id as string, from: node.pose, to: locals.get(node.id), label: 'Group' }));\n });\n ops.push(...followers);\n\n commitOps(deps, ops, 'Group', { select: [containerId] });\n },\n },\n enabled: (deps) => {\n const given = requiresContent(1)(deps);\n if (given !== true) return given;\n return groupPlan(deps!) ? true : ActionDisabledReason.NotApplicable;\n },\n};\n\n/** Whether ungrouping `node` dissolves it: a group, or a boolean group, which releases its operands. */\nconst dissolves = (node: { kind: string; consumesChildren?: boolean } | undefined): boolean =>\n node?.kind === 'group' || node?.consumesChildren === true;\n\n/** What ungrouping `containers` touches besides moving their children: the nodes that derive from one of them,\n * each with the `dependsOn` it keeps. Ungroup removes the containers from every such list, so deleting a container\n * takes nothing with it (ruled 2026-11-09). */\nfunction releasedDerivations(scene: AnyScene, containers: readonly NodeId[]): Map<NodeId, readonly NodeId[] | undefined> {\n const dissolving = new Set<NodeId>(containers);\n const out = new Map<NodeId, readonly NodeId[] | undefined>();\n for (const node of scene.nodes.values()) {\n const from = node.dependsOn;\n if (dissolving.has(node.id) || !Array.isArray(from) || !from.some((id) => dissolving.has(id))) continue;\n const kept = (from as readonly NodeId[]).filter((id) => !dissolving.has(id));\n out.set(node.id, kept.length > 0 ? kept : undefined);\n }\n return out;\n}\n\ninterface UngroupPlan {\n containers: NodeId[];\n /** The children ungrouping frees, outermost container first. */\n freed: NodeId[];\n released: Map<NodeId, readonly NodeId[] | undefined>;\n /** A node it would move, rewrite, or remove is locked: then it is disabled (ruled 2026-11-09). */\n locked: boolean;\n}\n\n/** What ungrouping the selected `ids` does, or null when none dissolves. `enabled` and `run` both read this, so\n * they agree. */\nfunction ungroupPlan(scene: AnyScene | undefined, ids: readonly NodeId[]): UngroupPlan | null {\n if (!scene) return null;\n const containers = ids.filter((id) => dissolves(scene.get(id)));\n if (containers.length === 0) return null;\n const dissolving = new Set(containers);\n const depth = (id: NodeId): number => scene.ancestorsOf(id).length;\n const freed = [...containers].sort((x, y) => depth(x) - depth(y))\n .flatMap((id) => scene.childrenOf(id).filter((kid) => !dissolving.has(kid)));\n const released = releasedDerivations(scene, containers);\n const touched = [...containers, ...freed, ...released.keys()];\n return { containers, freed, released, locked: touched.some((id) => scene.isLocked(id)) };\n}\n\n/** The batch dissolving `plan`'s containers, outermost first: each child moved up and re-expressed in its new\n * frame, every derivation from a container dropped, then the containers removed. `null` when a child would\n * land in a singular frame, where it could not keep its place. */\nfunction ungroupOps(scene: AnyScene, plan: UngroupPlan): Op[] | null {\n const { containers } = plan;\n const frame = scenePoseFrame(scene);\n const dissolving = new Set<string>(containers);\n const depth = (id: string): number => scene.ancestorsOf(id as NodeId).length;\n // Where a container's children go: its parent, or past it when that dissolves too, which an\n // outer container, handled first, has by then.\n const landing = (id: string): NodeId | null => {\n let at = scene.get(id as NodeId)!.parent ?? null;\n while (at !== null && dissolving.has(at)) at = scene.get(at)!.parent ?? null;\n return at;\n };\n const moves: Op[] = [];\n const removals: Op[] = [];\n for (const containerId of [...containers].sort((x, y) => depth(x) - depth(y))) {\n const container = scene.get(containerId)!;\n const parent = landing(containerId);\n const index = (parent === null ? scene.roots : scene.childrenOf(parent)).indexOf(containerId);\n // Each child lands just under the container, in order, wherever the container then sits.\n for (const childId of scene.childrenOf(containerId)) {\n const to = frame.localUnder(parent, frame.world(childId));\n if (to === null) return null;\n moves.push(createReparentOp({\n id: childId as string,\n fromParentId: containerId as string,\n toParentId: parent as string | null,\n toSlot: { index, before: containerId as string },\n label: 'Ungroup',\n }));\n moves.push(createTransformOp<unknown>({\n id: childId as string,\n from: scene.get(childId)!.pose,\n to,\n label: 'Ungroup',\n }));\n }\n removals.push(createDeleteOp({ node: { ...container, parent }, index, label: 'Ungroup' }));\n }\n const cuts = [...plan.released].map(([id, to]) =>\n createSetDependsOnOp({ id, from: scene.get(id)!.dependsOn as readonly NodeId[], to, label: 'Ungroup' }));\n return [...moves, ...cuts, ...removals];\n}\n\n/**\n * Dissolves each selected group, or boolean group, by reparenting its children up to the\n * container's own parent (preserving z-order) and removing the now-empty\n * container, as a single undoable batch. Selected marks, children or not, are\n * ignored. The freed children become the new selection, and nothing moves on\n * screen. Every node deriving from a dissolved container, a freed child or not, drops that container from its\n * `dependsOn`, so the batch removes the containers and nothing else. Disabled while any node it would move,\n * rewrite, or remove is locked, and while a child would land in a singular frame, where it could not stay\n * where it is shown. A child of a singular container keeps the flat place it is shown at.\n */\nexport const ungroupAction: Action & { requires: string[] } = {\n id: 'ungroup',\n label: 'Ungroup',\n icon: icon('core:ungroup'),\n group: 'structure',\n defaultBinding: [{ spec: { kind: 'key', key: 'g', mods: { mod: true, shift: true }, phase: BETWEEN_GESTURES }, opts: { id: 'ungroup.key' } }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'operands', 'applyOps'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const scene = deps.scene;\n if (!deps.operands || !scene) return;\n const plan = ungroupPlan(scene, selectedContent(deps));\n if (!plan || plan.locked) return;\n const ops = ungroupOps(scene, plan);\n if (ops !== null) commitOps(deps, ops, 'Ungroup', { select: plan.freed });\n },\n },\n enabled: (deps) => {\n const plan = ungroupPlan(deps?.scene, selectedContent(deps));\n if (!plan) return ActionDisabledReason.NotApplicable;\n if (plan.locked) return ActionDisabledReason.Locked;\n return ungroupOps(deps!.scene!, plan) === null ? ActionDisabledReason.NotApplicable : true;\n },\n};\n"],"mappings":";;;;;;;;AAUA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB;AACnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AACnB,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA;AACrC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAC7C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,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,CAAA,CAAA,CAAgB,CAAA,CAAA,CAAA,CAAA;AACxF,CAAA;AACF,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { MOVE_NODES_REQUIRES, couldClaim, handlersFor, previewIngest, runIngest } from "@weasel-js/core";
|
|
2
|
+
import { defaultCommitAdapter as defaultCommitAdapter$1, operandMethods as operandMethods$1 } from "@weasel-js/core/engine";
|
|
3
|
+
import { ActionDisabledReason, defineAction } from "@weasel-js/routing";
|
|
4
|
+
import { ANY_MODS } from "@weasel-js/gestures";
|
|
5
|
+
|
|
6
|
+
// src/actions/edit/ingest.ts
|
|
7
|
+
/**
|
|
8
|
+
* `ingest` — routes externally-arrived content (OS drop, clipboard paste,
|
|
9
|
+
* file picker / `CanvasExtensionApi.ingest`) through the content-handler
|
|
10
|
+
* registry (`domains/ingestion/contentHandlers`).
|
|
11
|
+
*
|
|
12
|
+
* Registered ambient with both `drop` and `paste` default bindings, so
|
|
13
|
+
* external content works regardless of the active tool. A tool can still
|
|
14
|
+
* bind `{ kind: 'drop', types: [...] }` itself to intercept (active scope
|
|
15
|
+
* beats ambient).
|
|
16
|
+
*
|
|
17
|
+
* This is the `ingest` preset's action. A canvas with `edit` and without
|
|
18
|
+
* `ingest` answers a paste with `clipboard.pasteEvent` instead, which runs
|
|
19
|
+
* the same `ingestFromEvent` limited to the kit's copied-node payload;
|
|
20
|
+
* `useStandardActions` never registers the two together.
|
|
21
|
+
*
|
|
22
|
+
* Every binding declares every modifier `'optional'`: strict matching would
|
|
23
|
+
* otherwise reject Cmd+V paste and macOS Option-drag drops outright.
|
|
24
|
+
*
|
|
25
|
+
* The dispatcher merges event data into `params`: `items` (IngestItem[]),
|
|
26
|
+
* `via` ('drop' | 'paste'), plus `world` for drops. Absent
|
|
27
|
+
* coords → `point: null`; handlers pick their own placement policy.
|
|
28
|
+
*/
|
|
29
|
+
/** The deps {@link ingestFromEvent} reads, and the ones `IngestCtx.deps` carries for a handler
|
|
30
|
+
* that moves what it inserts with `moveNodes`; an action calling it declares these. */
|
|
31
|
+
var INGEST_REQUIRES = [
|
|
32
|
+
"insert",
|
|
33
|
+
"ingestion",
|
|
34
|
+
"snap",
|
|
35
|
+
...MOVE_NODES_REQUIRES
|
|
36
|
+
];
|
|
37
|
+
/** The handlers an arrival on the canvas whose deps these are routes through: the
|
|
38
|
+
* canvas's own and kit ones (the `ingestion` dep's `handlers`), and the registry's. */
|
|
39
|
+
function canvasHandlers(deps) {
|
|
40
|
+
return handlersFor(deps?.ingestion?.handlers);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Route one drop or paste event's dispatcher params through the content
|
|
44
|
+
* handlers: builds the `IngestCtx` from the action's deps and calls
|
|
45
|
+
* `runIngest`. `opts` is `runIngest`'s, so an action accepting only some
|
|
46
|
+
* content passes `handlers`; without them, {@link canvasHandlers}.
|
|
47
|
+
*/
|
|
48
|
+
function ingestFromEvent(deps, params, opts) {
|
|
49
|
+
const items = params?.items;
|
|
50
|
+
if (!items || items.length === 0) return;
|
|
51
|
+
const ingestion = deps.ingestion;
|
|
52
|
+
const insert = deps.insert;
|
|
53
|
+
const scene = deps.scene;
|
|
54
|
+
const operands = deps.operands;
|
|
55
|
+
if (!ingestion || !insert || !scene || !operands) return;
|
|
56
|
+
const applyOps = deps.applyOps;
|
|
57
|
+
const ctx = {
|
|
58
|
+
point: params?.world ?? null,
|
|
59
|
+
items,
|
|
60
|
+
viewportWorldRect: () => ingestion.viewportWorldRect(),
|
|
61
|
+
insert,
|
|
62
|
+
applyOps: (ops, label) => {
|
|
63
|
+
if (applyOps) applyOps(ops, label ?? "Ingest");
|
|
64
|
+
else scene.applyBatch(ops, label ?? "Ingest", defaultCommitAdapter$1(scene, operandMethods$1(operands)));
|
|
65
|
+
},
|
|
66
|
+
scene,
|
|
67
|
+
operands,
|
|
68
|
+
resolveSrc: ingestion.resolveSrc,
|
|
69
|
+
svg: ingestion.svg,
|
|
70
|
+
clipboard: ingestion.clipboard,
|
|
71
|
+
...deps.snap ? { snap: deps.snap } : {},
|
|
72
|
+
deps
|
|
73
|
+
};
|
|
74
|
+
runIngest(items, ctx, opts?.handlers ? opts : {
|
|
75
|
+
...opts,
|
|
76
|
+
handlers: canvasHandlers(deps)
|
|
77
|
+
}).catch((err) => console.warn("weasel ingest:", err));
|
|
78
|
+
}
|
|
79
|
+
/** `Action.enabled` for an action that routes what an event carries through
|
|
80
|
+
* `handlers` (the registry's when omitted): refused when none could claim any
|
|
81
|
+
* of it. An invocation that carries nothing, a trigger, is taken. */
|
|
82
|
+
function claimable(carried, handlers) {
|
|
83
|
+
return !carried || couldClaim(carried.items, handlers) ? true : ActionDisabledReason.NotApplicable;
|
|
84
|
+
}
|
|
85
|
+
/** Ingest: places what a drop or a paste brings, through the canvas's content handlers. */
|
|
86
|
+
var ingestAction = defineAction({
|
|
87
|
+
id: "ingest",
|
|
88
|
+
label: "Insert external content",
|
|
89
|
+
defaultBinding: [{
|
|
90
|
+
spec: {
|
|
91
|
+
kind: "drop",
|
|
92
|
+
mods: ANY_MODS
|
|
93
|
+
},
|
|
94
|
+
opts: { id: "ingest.drop" }
|
|
95
|
+
}, {
|
|
96
|
+
spec: {
|
|
97
|
+
kind: "paste",
|
|
98
|
+
mods: ANY_MODS
|
|
99
|
+
},
|
|
100
|
+
opts: { id: "ingest.paste" }
|
|
101
|
+
}],
|
|
102
|
+
requires: [...INGEST_REQUIRES, "previewPaths"],
|
|
103
|
+
invoker: {
|
|
104
|
+
timing: "immediate",
|
|
105
|
+
run: (deps, params) => ingestFromEvent(deps, params)
|
|
106
|
+
},
|
|
107
|
+
preview: (deps, params) => previewIngest(deps, params, canvasHandlers(deps)),
|
|
108
|
+
enabled: (deps, _at, carried) => claimable(carried, canvasHandlers(deps))
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export { INGEST_REQUIRES, canvasHandlers, claimable, ingestAction, ingestFromEvent };
|
|
112
|
+
//# sourceMappingURL=ingest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest.js","names":["defaultCommitAdapter","operandMethods"],"sources":["../../../src/actions/edit/ingest.ts"],"sourcesContent":["/**\n * `ingest` — routes externally-arrived content (OS drop, clipboard paste,\n * file picker / `CanvasExtensionApi.ingest`) through the content-handler\n * registry (`domains/ingestion/contentHandlers`).\n *\n * Registered ambient with both `drop` and `paste` default bindings, so\n * external content works regardless of the active tool. A tool can still\n * bind `{ kind: 'drop', types: [...] }` itself to intercept (active scope\n * beats ambient).\n *\n * This is the `ingest` preset's action. A canvas with `edit` and without\n * `ingest` answers a paste with `clipboard.pasteEvent` instead, which runs\n * the same `ingestFromEvent` limited to the kit's copied-node payload;\n * `useStandardActions` never registers the two together.\n *\n * Every binding declares every modifier `'optional'`: strict matching would\n * otherwise reject Cmd+V paste and macOS Option-drag drops outright.\n *\n * The dispatcher merges event data into `params`: `items` (IngestItem[]),\n * `via` ('drop' | 'paste'), plus `world` for drops. Absent\n * coords → `point: null`; handlers pick their own placement policy.\n */\nimport { ANY_MODS } from '@weasel-js/gestures';\nimport { ActionDisabledReason, defineAction, type ActionDeps } from '@weasel-js/routing';\nimport {\n couldClaim, handlersFor, runIngest, type ContentHandlerEntry, type IngestCtx, type RunIngestOptions,\n} from '@weasel-js/core';\nimport type { IngestItem } from '@weasel-js/routing';\nimport { previewIngest, MOVE_NODES_REQUIRES } from '@weasel-js/core';\nimport { defaultCommitAdapter, operandMethods } from '@weasel-js/core/engine';\nimport type { IngestParams } from '@weasel-js/core';\n\n/** The deps {@link ingestFromEvent} reads, and the ones `IngestCtx.deps` carries for a handler\n * that moves what it inserts with `moveNodes`; an action calling it declares these. */\nexport const INGEST_REQUIRES = ['insert', 'ingestion', 'snap', ...MOVE_NODES_REQUIRES] as const;\n\n/** The handlers an arrival on the canvas whose deps these are routes through: the\n * canvas's own and kit ones (the `ingestion` dep's `handlers`), and the registry's. */\nexport function canvasHandlers(deps: ActionDeps | undefined): ContentHandlerEntry[] {\n return handlersFor(deps?.ingestion?.handlers);\n}\n\n/**\n * Route one drop or paste event's dispatcher params through the content\n * handlers: builds the `IngestCtx` from the action's deps and calls\n * `runIngest`. `opts` is `runIngest`'s, so an action accepting only some\n * content passes `handlers`; without them, {@link canvasHandlers}.\n */\nexport function ingestFromEvent(\n deps: ActionDeps,\n params: Readonly<Partial<IngestParams>> | undefined,\n opts?: RunIngestOptions,\n): void {\n const items = params?.items;\n if (!items || items.length === 0) return;\n const ingestion = deps.ingestion;\n const insert = deps.insert;\n const scene = deps.scene;\n const operands = deps.operands;\n if (!ingestion || !insert || !scene || !operands) return;\n const applyOps = deps.applyOps;\n\n const point = params?.world ?? null;\n\n const ctx: IngestCtx = {\n point,\n items,\n viewportWorldRect: () => ingestion.viewportWorldRect(),\n insert,\n applyOps: (ops, label) => {\n if (applyOps) applyOps(ops, label ?? 'Ingest');\n else scene.applyBatch(ops, label ?? 'Ingest', defaultCommitAdapter(scene, operandMethods(operands)));\n },\n scene,\n operands,\n // Snapshot per ingest event — intentional. The dep's live getters are\n // fresh at dispatch time, and one consistent resolver per drop/paste\n // beats half a multi-file drop resolving through a swapped-in one.\n resolveSrc: ingestion.resolveSrc,\n svg: ingestion.svg,\n clipboard: ingestion.clipboard,\n ...(deps.snap ? { snap: deps.snap } : {}),\n deps,\n };\n // Fire-and-forget: handler errors are caught inside runIngest, but a\n // malformed item (non-string mime via untyped JS) can still throw in\n // the matching path — keep the rejection out of the event loop.\n runIngest(items, ctx, opts?.handlers ? opts : { ...opts, handlers: canvasHandlers(deps) }).catch((err) => console.warn('weasel ingest:', err));\n}\n\n/** `Action.enabled` for an action that routes what an event carries through\n * `handlers` (the registry's when omitted): refused when none could claim any\n * of it. An invocation that carries nothing, a trigger, is taken. */\nexport function claimable(\n carried: { items: readonly IngestItem[] } | undefined,\n handlers?: readonly ContentHandlerEntry[],\n): true | ActionDisabledReason {\n return !carried || couldClaim(carried.items, handlers) ? true : ActionDisabledReason.NotApplicable;\n}\n\n/** Ingest: places what a drop or a paste brings, through the canvas's content handlers. */\nexport const ingestAction = defineAction({\n id: 'ingest',\n label: 'Insert external content',\n defaultBinding: [\n { spec: { kind: 'drop', mods: ANY_MODS }, opts: { id: 'ingest.drop' } },\n { spec: { kind: 'paste', mods: ANY_MODS }, opts: { id: 'ingest.paste' } },\n ],\n requires: [...INGEST_REQUIRES, 'previewPaths'],\n invoker: {\n timing: 'immediate',\n run: (deps, params) => ingestFromEvent(deps, params),\n },\n // Asked by the dispatcher while an OS drag hovers: a ghost box per thing the drop would insert.\n preview: (deps, params) => previewIngest(deps, params, canvasHandlers(deps)),\n // No `eligible` rule: external-content arrival is mode-agnostic. The\n // listener-level editable-target guard already keeps text-editing pastes\n // away from the scene.\n enabled: (deps, _at, carried) => claimable(carried, canvasHandlers(deps)),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,kBAAkB;CAAC;CAAU;CAAa;CAAQ,GAAG;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Ae;CAAE,CAC1E;CACA,UAAU,CAAC,GAAG,iBAAiB,cAAc;CAC7C,SAAS;EACP,QAAQ;EACR,MAAM,MAAM,WAAW,gBAAgB,MAAM,MAAM;CACrD;CAEA,UAAU,MAAM,WAAW,cAAc,MAAM,QAAQ,eAAe,IAAI,CAAC;CAI3E,UAAU,MAAM,KAAK,YAAY,UAAU,SAAS,eAAe,IAAI,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { NUDGE_LABEL, moveNodesOps, nudgeDelta, nudgeSpec, recordTransform, requiresSelection } from "@weasel-js/core";
|
|
2
|
+
import { defaultCommitAdapter as defaultCommitAdapter$1, operandMethods as operandMethods$1, poseDescriptorOf as poseDescriptorOf$1, transformApplyOps as transformApplyOps$1 } from "@weasel-js/core/engine";
|
|
3
|
+
import { ActionDisabledReason } from "@weasel-js/routing";
|
|
4
|
+
|
|
5
|
+
// src/actions/edit/nudge.ts
|
|
6
|
+
/**
|
|
7
|
+
* Apply a world translation of (dx, dy) to the selected nodes and the
|
|
8
|
+
* descendants that do not ride on one of them, as one undo entry labeled
|
|
9
|
+
* `label` — on screen, the way a drag moves them, whatever frame each is
|
|
10
|
+
* stored in. Translates through the `poseDescriptor` dep, so any pose shape
|
|
11
|
+
* moves. Returns whether anything moved.
|
|
12
|
+
*/
|
|
13
|
+
function translateSelection(selection, scene, dx, dy, applyOps, geometryProjection, d, label = "Nudge") {
|
|
14
|
+
const ops = moveNodesOps(scene, selection.get(), {
|
|
15
|
+
dx,
|
|
16
|
+
dy
|
|
17
|
+
}, {
|
|
18
|
+
poseDescriptor: d,
|
|
19
|
+
geometryProjection
|
|
20
|
+
}, label);
|
|
21
|
+
if (ops.length === 0) return false;
|
|
22
|
+
if (!applyOps) return scene.applyBatch(ops, label, defaultCommitAdapter$1(scene, operandMethods$1(selection)));
|
|
23
|
+
return applyOps(ops, label) !== false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The nudge descriptor for one direction: bare arrow (magnitude='small') and
|
|
27
|
+
* Shift+arrow (magnitude='big').
|
|
28
|
+
*/
|
|
29
|
+
function makeNudgeAction(dir) {
|
|
30
|
+
return {
|
|
31
|
+
id: `nudge.${dir}`,
|
|
32
|
+
label: `Nudge ${NUDGE_LABEL[dir]}`,
|
|
33
|
+
group: "nudge",
|
|
34
|
+
defaultBinding: [{
|
|
35
|
+
spec: nudgeSpec(dir, false),
|
|
36
|
+
opts: {
|
|
37
|
+
id: `nudge.${dir}.small`,
|
|
38
|
+
params: { magnitude: "small" }
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
spec: nudgeSpec(dir, true),
|
|
42
|
+
opts: {
|
|
43
|
+
id: `nudge.${dir}.big`,
|
|
44
|
+
params: { magnitude: "big" }
|
|
45
|
+
}
|
|
46
|
+
}],
|
|
47
|
+
eligible: { capability: "transforms-selection" },
|
|
48
|
+
requires: [
|
|
49
|
+
"operands",
|
|
50
|
+
"scene",
|
|
51
|
+
"applyOps",
|
|
52
|
+
"geometryProjection",
|
|
53
|
+
"poseDescriptor",
|
|
54
|
+
"transformFollowers"
|
|
55
|
+
],
|
|
56
|
+
invoker: {
|
|
57
|
+
timing: "immediate",
|
|
58
|
+
run: (deps, params) => {
|
|
59
|
+
const { dx, dy } = nudgeDelta(dir, params?.magnitude);
|
|
60
|
+
const selection = deps.operands;
|
|
61
|
+
const scene = deps.scene;
|
|
62
|
+
const applyOps = transformApplyOps$1(deps);
|
|
63
|
+
const geometryProjection = deps.geometryProjection;
|
|
64
|
+
if (!selection || !scene) return;
|
|
65
|
+
if (translateSelection(selection, scene, dx, dy, applyOps, geometryProjection, poseDescriptorOf$1(deps.poseDescriptor))) recordTransform(scene, {
|
|
66
|
+
kind: "translate",
|
|
67
|
+
dx,
|
|
68
|
+
dy
|
|
69
|
+
}, selection.get());
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
enabled: (deps, _at, _carried, params) => {
|
|
73
|
+
const given = requiresSelection(deps);
|
|
74
|
+
if (given !== true || !deps?.scene) return given;
|
|
75
|
+
const { dx, dy } = nudgeDelta(dir, params?.magnitude);
|
|
76
|
+
return moveNodesOps(deps.scene, deps.operands.get(), {
|
|
77
|
+
dx,
|
|
78
|
+
dy
|
|
79
|
+
}, deps, "Nudge").length > 0 ? true : ActionDisabledReason.NotApplicable;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Nudge up: the Up arrow, a big step with Shift. */
|
|
84
|
+
var nudgeUpAction = makeNudgeAction("up");
|
|
85
|
+
/** Nudge down: the Down arrow, a big step with Shift. */
|
|
86
|
+
var nudgeDownAction = makeNudgeAction("down");
|
|
87
|
+
/** Nudge left: the Left arrow, a big step with Shift. */
|
|
88
|
+
var nudgeLeftAction = makeNudgeAction("left");
|
|
89
|
+
/** Nudge right: the Right arrow, a big step with Shift. */
|
|
90
|
+
var nudgeRightAction = makeNudgeAction("right");
|
|
91
|
+
|
|
92
|
+
export { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction, translateSelection };
|
|
93
|
+
//# sourceMappingURL=nudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nudge.js","names":["defaultCommitAdapter","operandMethods","transformApplyOps","poseDescriptorOf"],"sources":["../../../src/actions/edit/nudge.ts"],"sourcesContent":["import type { Scene, OperandsDep, PoseDescriptor, GeometryProjection } from '@weasel-js/core/engine';\nimport type { Op } from '@weasel-js/core';\nimport { poseDescriptorOf, defaultCommitAdapter, operandMethods, transformApplyOps } from '@weasel-js/core/engine';\nimport { ActionDisabledReason, type Action } from '@weasel-js/routing';\nimport { requiresSelection, moveNodesOps, nudgeSpec, NUDGE_LABEL, nudgeDelta, type NudgeDirection, recordTransform } from '@weasel-js/core';\n\n/**\n * Apply a world translation of (dx, dy) to the selected nodes and the\n * descendants that do not ride on one of them, as one undo entry labeled\n * `label` — on screen, the way a drag moves them, whatever frame each is\n * stored in. Translates through the `poseDescriptor` dep, so any pose shape\n * moves. Returns whether anything moved.\n */\nexport function translateSelection(\n selection: Pick<OperandsDep, 'get' | 'set'>,\n scene: Scene<unknown, string, unknown>,\n dx: number,\n dy: number,\n applyOps: ((ops: Op[], label: string) => boolean | void) | undefined,\n geometryProjection: GeometryProjection | undefined,\n d: PoseDescriptor<unknown>,\n label = 'Nudge',\n): boolean {\n const ops = moveNodesOps(scene, selection.get() as readonly string[], { dx, dy }, { poseDescriptor: d, geometryProjection }, label);\n if (ops.length === 0) return false;\n\n if (!applyOps) return scene.applyBatch(ops, label, defaultCommitAdapter(scene, operandMethods(selection)));\n return applyOps(ops, label) !== false;\n}\n\n/**\n * The nudge descriptor for one direction: bare arrow (magnitude='small') and\n * Shift+arrow (magnitude='big').\n */\nfunction makeNudgeAction(dir: NudgeDirection): Action & { requires: string[] } {\n return {\n id: `nudge.${dir}`,\n label: `Nudge ${NUDGE_LABEL[dir]}`,\n group: 'nudge',\n defaultBinding: [\n { spec: nudgeSpec(dir, false), opts: { id: `nudge.${dir}.small`, params: { magnitude: 'small' } } },\n { spec: nudgeSpec(dir, true), opts: { id: `nudge.${dir}.big`, params: { magnitude: 'big' } } },\n ],\n eligible: { capability: 'transforms-selection' },\n requires: ['operands', 'scene', 'applyOps', 'geometryProjection', 'poseDescriptor', 'transformFollowers'],\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const { dx, dy } = nudgeDelta(dir, params?.magnitude);\n const selection = deps.operands;\n const scene = deps.scene;\n const applyOps = transformApplyOps(deps);\n const geometryProjection = deps.geometryProjection;\n if (!selection || !scene) return;\n if (translateSelection(selection, scene, dx, dy, applyOps, geometryProjection, poseDescriptorOf(deps.poseDescriptor))) {\n recordTransform(scene, { kind: 'translate', dx, dy }, selection.get());\n }\n },\n },\n // On while some selected node would move: a step rounding absorbs moves nothing (2026-11-10 ruling).\n enabled: (deps, _at, _carried, params) => {\n const given = requiresSelection(deps);\n if (given !== true || !deps?.scene) return given;\n const { dx, dy } = nudgeDelta(dir, params?.magnitude);\n const ops = moveNodesOps(deps.scene, deps.operands!.get() as readonly string[], { dx, dy }, deps, 'Nudge');\n return ops.length > 0 ? true : ActionDisabledReason.NotApplicable;\n },\n };\n}\n\n/** Nudge up: the Up arrow, a big step with Shift. */\nexport const nudgeUpAction = makeNudgeAction('up');\n/** Nudge down: the Down arrow, a big step with Shift. */\nexport const nudgeDownAction = makeNudgeAction('down');\n/** Nudge left: the Left arrow, a big step with Shift. */\nexport const nudgeLeftAction = makeNudgeAction('left');\n/** Nudge right: the Right arrow, a big step with Shift. */\nexport const nudgeRightAction = makeNudgeAction('right');\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,mBACd,WACA,OACA,IACA,IACA,UACA,oBACA,GACA,QAAQ,SACC;CACT,MAAM,MAAM,aAAa,OAAO,UAAU,IAAI,GAAwB;EAAE;EAAI;CAAG,GAAG;EAAE,gBAAgB;EAAG;CAAmB,GAAG,KAAK;CAClI,IAAI,IAAI,WAAW,GAAG,OAAO;CAE7B,IAAI,CAAC,UAAU,OAAO,MAAM,WAAW,KAAK,OAAOA,uBAAqB,OAAOC,iBAAe,SAAS,CAAC,CAAC;CACzG,OAAO,SAAS,KAAK,KAAK,MAAM;AAClC;;;;;AAMA,SAAS,gBAAgB,KAAsD;CAC7E,OAAO;EACL,IAAI,SAAS;EACb,OAAO,SAAS,YAAY;EAC5B,OAAO;EACP,gBAAgB,CACd;GAAE,MAAM,UAAU,KAAK,KAAK;GAAG,MAAM;IAAE,IAAI,SAAS,IAAI;IAAS,QAAQ,EAAE,WAAW,QAAQ;GAAE;EAAE,GAClG;GAAE,MAAM,UAAU,KAAK,IAAI;GAAG,MAAM;IAAE,IAAI,SAAS,IAAI;IAAO,QAAQ,EAAE,WAAW,MAAM;GAAE;EAAE,CAC/F;EACA,UAAU,EAAE,YAAY,uBAAuB;EAC/C,UAAU;GAAC;GAAY;GAAS;GAAY;GAAsB;GAAkB;EAAoB;EACxG,SAAS;GACP,QAAQ;GACR,M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