@alpha2-sh/editor 0.4.6 → 0.5.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/dist/browser/bridge.d.ts +15 -16
- package/dist/browser/bridge.js +396 -312
- package/dist/browser/extensions-worker.d.ts +12 -16
- package/dist/browser/extensions-worker.js +17 -24
- package/dist/browser/hash-worker.d.ts +4 -5
- package/dist/browser/hash-worker.js +7 -8
- package/dist/browser/jobs.d.ts +17 -19
- package/dist/browser/jobs.js +41 -28
- package/dist/browser/resources.d.ts +6 -11
- package/dist/browser/resources.js +5 -9
- package/dist/browser/runtime/assets.d.ts +47 -28
- package/dist/browser/runtime/assets.js +129 -45
- package/dist/browser/runtime/audio.d.ts +16 -11
- package/dist/browser/runtime/audio.js +58 -31
- package/dist/browser/runtime/budget.d.ts +4 -5
- package/dist/browser/runtime/budget.js +4 -5
- package/dist/browser/runtime/caption-fonts.d.ts +3 -7
- package/dist/browser/runtime/caption-fonts.js +4 -8
- package/dist/browser/runtime/engine.d.ts +39 -44
- package/dist/browser/runtime/engine.js +78 -64
- package/dist/browser/runtime/export-audio.d.ts +6 -6
- package/dist/browser/runtime/export-audio.js +8 -9
- package/dist/browser/runtime/exporter.d.ts +33 -66
- package/dist/browser/runtime/exporter.js +111 -137
- package/dist/browser/runtime/extension-import.d.ts +28 -35
- package/dist/browser/runtime/extension-import.js +36 -46
- package/dist/browser/runtime/fingerprint.d.ts +11 -14
- package/dist/browser/runtime/fingerprint.js +20 -24
- package/dist/browser/runtime/generators.d.ts +2 -3
- package/dist/browser/runtime/generators.js +5 -7
- package/dist/browser/runtime/locks.d.ts +5 -7
- package/dist/browser/runtime/locks.js +5 -7
- package/dist/browser/runtime/output.d.ts +7 -9
- package/dist/browser/runtime/output.js +17 -21
- package/dist/browser/runtime/preview-utils.js +10 -6
- package/dist/browser/runtime/proxies.d.ts +10 -17
- package/dist/browser/runtime/proxies.js +33 -45
- package/dist/browser/runtime/proxy-storage.d.ts +15 -19
- package/dist/browser/runtime/proxy-storage.js +20 -24
- package/dist/browser/runtime/sources.d.ts +23 -31
- package/dist/browser/runtime/sources.js +85 -103
- package/dist/browser/runtime/staging.d.ts +2 -6
- package/dist/browser/runtime/staging.js +7 -11
- package/dist/browser/runtime/still.d.ts +2 -6
- package/dist/browser/runtime/still.js +6 -12
- package/dist/browser/runtime/text.d.ts +14 -0
- package/dist/browser/runtime/text.js +27 -0
- package/dist/browser/runtime/wasm.d.ts +4 -5
- package/dist/browser/runtime/wasm.js +4 -5
- package/dist/browser/types.d.ts +233 -238
- package/dist/browser/worker.d.ts +8 -9
- package/dist/browser/worker.js +50 -21
- package/dist/core/captions.d.ts +8 -10
- package/dist/core/captions.js +10 -18
- package/dist/core/clip-time.d.ts +8 -10
- package/dist/core/clip-time.js +12 -15
- package/dist/core/commands.d.ts +46 -46
- package/dist/core/commands.js +38 -36
- package/dist/core/compositions.d.ts +78 -112
- package/dist/core/compositions.js +66 -94
- package/dist/core/document.d.ts +59 -92
- package/dist/core/document.js +64 -90
- package/dist/core/keyframes.d.ts +11 -12
- package/dist/core/keyframes.js +11 -13
- package/dist/core/presets.d.ts +14 -20
- package/dist/core/presets.js +12 -18
- package/dist/core/session.d.ts +26 -38
- package/dist/core/session.js +38 -53
- package/dist/core/text.d.ts +2 -3
- package/dist/core/text.js +2 -3
- package/dist/core/timeline-index.d.ts +2 -3
- package/dist/core/timeline-index.js +11 -7
- package/dist/core/transitions.js +4 -5
- package/dist/core/validated.d.ts +6 -7
- package/dist/core/validated.js +8 -11
- package/dist/native-client/index.d.ts +31 -32
- package/dist/native-client/index.js +40 -41
- package/dist/ports/index.d.ts +19 -20
- package/dist/react/index.d.ts +5 -6
- package/dist/react/index.js +5 -6
- package/package.json +4 -4
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { MAX_COMPOSITION_DEPTH } from "alpha2/project";
|
|
2
2
|
import { copyComposition } from "alpha2/edit";
|
|
3
3
|
import { EditorError } from "./document.js";
|
|
4
|
-
/** Where each composition of a compositions array is, by id, for {@link findComposition}. */
|
|
5
4
|
const compositionIndexes = new WeakMap();
|
|
6
5
|
/**
|
|
7
|
-
* The composition `id` names in `project`.
|
|
8
|
-
*
|
|
9
|
-
* array no longer matches is made again, and an id it lacks is looked for in the array itself.
|
|
6
|
+
* The composition `id` names in `project`. Uses an index cached per compositions array so walks
|
|
7
|
+
* that find many compositions stay linear; a stale index is rebuilt.
|
|
10
8
|
*/
|
|
11
9
|
export function findComposition(project, id) {
|
|
12
10
|
const compositions = project.compositions ?? [];
|
|
@@ -23,10 +21,10 @@ export function findComposition(project, id) {
|
|
|
23
21
|
return compositions.find((c) => c.id === id);
|
|
24
22
|
}
|
|
25
23
|
/**
|
|
26
|
-
* A clip's effects as a stack
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
24
|
+
* A clip's effects as a stack, bottom first, when its composition is just a chain of effect nodes
|
|
25
|
+
* over the clip's picture. A clip without a composition has an empty stack. `undefined` when the
|
|
26
|
+
* composition is a graph a stack cannot show (it branches, merges, reads other sources, or has
|
|
27
|
+
* loose nodes).
|
|
30
28
|
*/
|
|
31
29
|
export function effectStack(project, clip) {
|
|
32
30
|
if (clip.composition == null)
|
|
@@ -44,7 +42,7 @@ export function effectStack(project, clip) {
|
|
|
44
42
|
if (node.op.type === "clip") {
|
|
45
43
|
return stack.length + 1 === nodes.size ? stack.reverse() : undefined;
|
|
46
44
|
}
|
|
47
|
-
//
|
|
45
|
+
// Named inputs read another branch, which a stack cannot show.
|
|
48
46
|
if (node.op.type !== "effect" ||
|
|
49
47
|
node.op.input == null ||
|
|
50
48
|
Object.keys(node.op.inputs ?? {}).length > 0)
|
|
@@ -63,10 +61,10 @@ export function freeCompositionId(project, base) {
|
|
|
63
61
|
return id;
|
|
64
62
|
}
|
|
65
63
|
/**
|
|
66
|
-
* `project` with clip `clipId` showing its picture through `stack`, bottom first
|
|
67
|
-
* rewritten as that chain, or removed with the reference when the stack is empty.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
64
|
+
* `project` with clip `clipId` showing its picture through `stack`, bottom first. Its composition
|
|
65
|
+
* is rewritten as that chain, or removed with the reference when the stack is empty. It keeps its
|
|
66
|
+
* id and the clip its time mapping; a clip without one gets `<clip id>-fx`. Throws when `clipId`
|
|
67
|
+
* names no clip.
|
|
70
68
|
*/
|
|
71
69
|
export function withEffectStack(project, clipId, stack) {
|
|
72
70
|
const clip = project.timeline.tracks
|
|
@@ -74,7 +72,7 @@ export function withEffectStack(project, clipId, stack) {
|
|
|
74
72
|
.find((c) => c.id === clipId);
|
|
75
73
|
if (!clip)
|
|
76
74
|
throw new Error(`Unknown clip ${clipId}`);
|
|
77
|
-
// The composition
|
|
75
|
+
// The orphaned composition is removed when the command ends (`executeCommand`).
|
|
78
76
|
if (stack.length === 0) {
|
|
79
77
|
if (clip.composition == null)
|
|
80
78
|
return project;
|
|
@@ -129,10 +127,7 @@ function setClipComposition(project, clipId, reference) {
|
|
|
129
127
|
},
|
|
130
128
|
};
|
|
131
129
|
}
|
|
132
|
-
/**
|
|
133
|
-
* The compositions `id` draws: itself and, through group nodes, the group definitions it uses, each
|
|
134
|
-
* once.
|
|
135
|
-
*/
|
|
130
|
+
/** The compositions `id` draws: itself and the group definitions it uses, each once. */
|
|
136
131
|
export function compositionTree(project, id) {
|
|
137
132
|
const tree = [];
|
|
138
133
|
const seen = new Set();
|
|
@@ -153,8 +148,8 @@ export function compositionTree(project, id) {
|
|
|
153
148
|
return tree;
|
|
154
149
|
}
|
|
155
150
|
/**
|
|
156
|
-
* Ids of the compositions `project` draws: those clips
|
|
157
|
-
*
|
|
151
|
+
* Ids of the compositions `project` draws: those clips and composition sources (Library items)
|
|
152
|
+
* show, and transitively those they use through group nodes and composition sources.
|
|
158
153
|
*/
|
|
159
154
|
export function drawnCompositions(project) {
|
|
160
155
|
const sources = new Map(project.sources.map((s) => [s.id, s]));
|
|
@@ -182,11 +177,10 @@ export function drawnCompositions(project) {
|
|
|
182
177
|
return drawn;
|
|
183
178
|
}
|
|
184
179
|
/**
|
|
185
|
-
* `after` without the compositions `before` drew and `after` no longer does
|
|
186
|
-
* composition it shows, so the edit that stops
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* added for a later edit (a macro's definition) waits for it. Returns the ids it removed.
|
|
180
|
+
* `after` without the compositions `before` drew and `after` no longer does, plus group definitions
|
|
181
|
+
* only they drew. A clip owns the composition it shows, so the edit that stops its last use removes
|
|
182
|
+
* it. Compositions `before` did not draw stay, so one added for a later edit (a macro's definition)
|
|
183
|
+
* survives. Returns the removed ids.
|
|
190
184
|
*/
|
|
191
185
|
export function withoutUndrawn(before, after) {
|
|
192
186
|
const compositions = after.compositions ?? [];
|
|
@@ -205,11 +199,10 @@ export function withoutUndrawn(before, after) {
|
|
|
205
199
|
}
|
|
206
200
|
/**
|
|
207
201
|
* `project` with `clip` given compositions no other clip draws, for a clip a command puts down (a
|
|
208
|
-
* paste, a duplicate). With `compositions
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* edited independently of its original. Returns the copies' ids by their originals'.
|
|
202
|
+
* paste, a duplicate). With `compositions` (those the clip drew when copied) it shows copies of
|
|
203
|
+
* them. Otherwise it shows a copy of its composition when anything else draws it or a group
|
|
204
|
+
* definition in it, and the composition itself when nothing does. Copies take free ids based on
|
|
205
|
+
* `<root>~<clip id>` ({@link copyComposition}). Returns the copies' ids by their originals'.
|
|
213
206
|
*/
|
|
214
207
|
export function ownComposition(project, clip, compositions) {
|
|
215
208
|
const reference = clip.composition;
|
|
@@ -234,9 +227,9 @@ export function ownComposition(project, clip, compositions) {
|
|
|
234
227
|
};
|
|
235
228
|
}
|
|
236
229
|
/**
|
|
237
|
-
* The compositions `copy` draws for those `original` draws, by id: the two
|
|
238
|
-
* definitions of
|
|
239
|
-
*
|
|
230
|
+
* The compositions `copy` draws for those `original` draws, by id: the two roots and, recursively,
|
|
231
|
+
* the definitions of same-id group nodes. Compositions copied for a split or paste correspond this
|
|
232
|
+
* way.
|
|
240
233
|
*/
|
|
241
234
|
export function correspondingCompositions(project, original, copy) {
|
|
242
235
|
const pairs = new Map();
|
|
@@ -257,8 +250,8 @@ export function correspondingCompositions(project, original, copy) {
|
|
|
257
250
|
}
|
|
258
251
|
/**
|
|
259
252
|
* Composition time at timeline time `tick` for `clip`: `offset + (tick - start) * scale`, rounded
|
|
260
|
-
* down
|
|
261
|
-
*
|
|
253
|
+
* down as the engine does. Timeline time without a composition. A fractional tick reads as the tick
|
|
254
|
+
* it falls in.
|
|
262
255
|
*/
|
|
263
256
|
export function compositionTime(clip, tick) {
|
|
264
257
|
tick = Math.floor(finiteTime(tick));
|
|
@@ -271,8 +264,7 @@ export function compositionTime(clip, tick) {
|
|
|
271
264
|
}
|
|
272
265
|
/**
|
|
273
266
|
* The first timeline time at which `clip` shows composition time `time`: the inverse of
|
|
274
|
-
* {@link compositionTime}, rounded up
|
|
275
|
-
* next whole tick.
|
|
267
|
+
* {@link compositionTime}, rounded up. A fractional `time` is rounded up first.
|
|
276
268
|
*/
|
|
277
269
|
export function timelineTime(clip, time) {
|
|
278
270
|
time = Math.ceil(finiteTime(time));
|
|
@@ -327,21 +319,18 @@ function inputsOf(op) {
|
|
|
327
319
|
}
|
|
328
320
|
}
|
|
329
321
|
/**
|
|
330
|
-
* Ids of the sources `tracks`' clips draw: each clip's own, and those
|
|
331
|
-
* compositions' outputs need
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
* engine's `Project::used_sources` is the same set; `tests/cases/used-sources-corpus.json` holds both to
|
|
335
|
-
* it.
|
|
322
|
+
* Ids of the sources `tracks`' clips draw: each clip's own, and those read by media nodes their
|
|
323
|
+
* compositions' outputs need ({@link CompositionReads.neededInputs}), through group nodes and
|
|
324
|
+
* composition sources. A clip's own source counts only where its composition draws the clip.
|
|
325
|
+
* Matches the engine's `Project::used_sources`; `tests/cases/used-sources-corpus.json` checks both.
|
|
336
326
|
*/
|
|
337
327
|
export function shownSources(project, tracks = project.timeline.tracks) {
|
|
338
328
|
return drawn(project, tracks).sources;
|
|
339
329
|
}
|
|
340
330
|
/**
|
|
341
|
-
* Ids of the effect resources
|
|
342
|
-
* transition nodes
|
|
343
|
-
*
|
|
344
|
-
* resource when a node it evaluates needs one.
|
|
331
|
+
* Ids of the effect resources read by what `tracks` draw: those named by evaluated (not bypassed)
|
|
332
|
+
* effect and transition nodes and by the tracks' transitions. Only these must be registered for a
|
|
333
|
+
* render.
|
|
345
334
|
*/
|
|
346
335
|
export function drawnEffectResources(project, tracks = project.timeline.tracks) {
|
|
347
336
|
return drawn(project, tracks).resources;
|
|
@@ -391,8 +380,7 @@ function drawn(project, tracks) {
|
|
|
391
380
|
named(transition.effect);
|
|
392
381
|
for (const clip of track.clips ?? []) {
|
|
393
382
|
used.add(clip.source_id);
|
|
394
|
-
// A composition source is
|
|
395
|
-
// draws the clip.
|
|
383
|
+
// A composition source is drawn only where the clip's own composition draws the clip.
|
|
396
384
|
if (clip.composition == null || reads.drawsClip(clip.composition.id))
|
|
397
385
|
walk(sources.get(clip.source_id)?.composition);
|
|
398
386
|
walk(clip.composition?.id);
|
|
@@ -435,21 +423,16 @@ export function inputKeys(op) {
|
|
|
435
423
|
return [];
|
|
436
424
|
}
|
|
437
425
|
}
|
|
438
|
-
/**
|
|
439
|
-
* The inputs drawing `node` reads: only its pass-through input (the first) when it is bypassed, and
|
|
440
|
-
* every input otherwise.
|
|
441
|
-
*/
|
|
426
|
+
/** The inputs drawing `node` reads: only its pass-through input (the first) when bypassed. */
|
|
442
427
|
export function neededInputs(node) {
|
|
443
428
|
const keys = inputKeys(node.op);
|
|
444
429
|
return node.bypass ? keys.slice(0, 1) : keys;
|
|
445
430
|
}
|
|
446
431
|
/**
|
|
447
|
-
* What each
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* drawn. A composition that uses itself (which validation refuses) reads every port and draws the
|
|
452
|
-
* clip.
|
|
432
|
+
* What each composition's output reaches along needed inputs, into the compositions its group nodes
|
|
433
|
+
* draw. A group draws what its nodes would inline, so a group node needs only the ports its
|
|
434
|
+
* composition reads; an unread port may stay unconnected and what a connected one reads is not
|
|
435
|
+
* drawn. A self-referencing composition (refused by validation) reads all ports and draws the clip.
|
|
453
436
|
*/
|
|
454
437
|
export function compositionReads(compositions) {
|
|
455
438
|
const byId = new Map(compositions.map((c) => [c.id, c]));
|
|
@@ -494,8 +477,7 @@ export function compositionReads(compositions) {
|
|
|
494
477
|
}
|
|
495
478
|
return read;
|
|
496
479
|
};
|
|
497
|
-
//
|
|
498
|
-
// draw are known.
|
|
480
|
+
// Iterative, in dependency order: a composition is walked once its group nodes' are known.
|
|
499
481
|
const walking = new Set();
|
|
500
482
|
for (const root of compositions) {
|
|
501
483
|
const stack = [[root, false]];
|
|
@@ -541,10 +523,7 @@ export function inputOf(op, key) {
|
|
|
541
523
|
const value = op[key];
|
|
542
524
|
return typeof value === "string" ? value : undefined;
|
|
543
525
|
}
|
|
544
|
-
/**
|
|
545
|
-
* Whether `op` has input `key`, or can take it: an effect node takes any well-named
|
|
546
|
-
* `inputs.<name>`, whether or not its definition declares it.
|
|
547
|
-
*/
|
|
526
|
+
/** Whether `op` has or can take input `key`; effect nodes take any well-formed `inputs.<name>`. */
|
|
548
527
|
export function acceptsInput(op, key) {
|
|
549
528
|
const name = effectInputName(key);
|
|
550
529
|
if (name !== undefined)
|
|
@@ -552,9 +531,8 @@ export function acceptsInput(op, key) {
|
|
|
552
531
|
return inputKeys(op).includes(key);
|
|
553
532
|
}
|
|
554
533
|
/**
|
|
555
|
-
* `op` with input `key` reading `node` (`null` disconnects it, keeping an effect's named input
|
|
556
|
-
*
|
|
557
|
-
* input `key`.
|
|
534
|
+
* `op` with input `key` reading `node` (`null` disconnects it, keeping an effect's named input,
|
|
535
|
+
* which is added if absent). Throws when `op` cannot take input `key`.
|
|
558
536
|
*/
|
|
559
537
|
export function withInput(op, key, node) {
|
|
560
538
|
return opWithInput(op, key, node);
|
|
@@ -578,8 +556,8 @@ function opWithInput(op, key, node) {
|
|
|
578
556
|
return { ...op, [key]: node };
|
|
579
557
|
}
|
|
580
558
|
/**
|
|
581
|
-
* `op` without its effect input `name
|
|
582
|
-
*
|
|
559
|
+
* `op` without its effect input `name`, dropping `inputs` when none remain. Other operations are
|
|
560
|
+
* returned unchanged.
|
|
583
561
|
*/
|
|
584
562
|
export function withoutEffectInput(op, name) {
|
|
585
563
|
if (op.type !== "effect" || !Object.hasOwn(op.inputs ?? {}, name))
|
|
@@ -589,14 +567,12 @@ export function withoutEffectInput(op, name) {
|
|
|
589
567
|
return (Object.keys(rest).length > 0 ? { ...without, inputs: rest } : without);
|
|
590
568
|
}
|
|
591
569
|
/**
|
|
592
|
-
* What stops `composition`'s output from rendering when
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* node where there is no clip. The engine refuses the same frames with `INCOMPLETE_COMPOSITION`;
|
|
596
|
-
* this lets an editor mark the nodes before it asks.
|
|
570
|
+
* What stops `composition`'s output from rendering when drawn as `use`: no output, an unconnected
|
|
571
|
+
* needed input, a group input nothing feeds, or a clip node without a clip. The engine refuses the
|
|
572
|
+
* same frames with `INCOMPLETE_COMPOSITION`; this lets an editor mark the nodes first.
|
|
597
573
|
*
|
|
598
|
-
* With `project`,
|
|
599
|
-
*
|
|
574
|
+
* With `project`, issues of compositions drawn by group and media nodes are included, as the engine
|
|
575
|
+
* plans them inline; without it those nodes count as drawn.
|
|
600
576
|
*/
|
|
601
577
|
export function graphIssues(composition, use, project) {
|
|
602
578
|
const issues = [];
|
|
@@ -637,8 +613,7 @@ export function graphIssues(composition, use, project) {
|
|
|
637
613
|
if (node.bypass)
|
|
638
614
|
continue;
|
|
639
615
|
const within = [...scope.within, drawn.id];
|
|
640
|
-
// Validation bounds
|
|
641
|
-
// than recursing forever.
|
|
616
|
+
// Validation bounds nesting and forbids cycles; stop here for an unvalidated draft.
|
|
642
617
|
const nest = (id) => {
|
|
643
618
|
const inner = id === undefined ? undefined : compositions.get(id);
|
|
644
619
|
return inner &&
|
|
@@ -700,8 +675,8 @@ export function freeNodeId(composition, base) {
|
|
|
700
675
|
return id;
|
|
701
676
|
}
|
|
702
677
|
/**
|
|
703
|
-
* `composition` without
|
|
704
|
-
*
|
|
678
|
+
* `composition` without nodes `ids`, disconnecting inputs that read them and dropping the output
|
|
679
|
+
* and controls that refer to them.
|
|
705
680
|
*/
|
|
706
681
|
export function withoutNodes(composition, ids) {
|
|
707
682
|
const drop = new Set(ids);
|
|
@@ -730,15 +705,14 @@ export function withoutNodes(composition, ids) {
|
|
|
730
705
|
};
|
|
731
706
|
}
|
|
732
707
|
/**
|
|
733
|
-
* `composition` with nodes `ids` folded into a group node `groupId`
|
|
734
|
-
* `definitionId
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* input, which a node inside the group reads through a port like any node outside. The picture does
|
|
708
|
+
* `composition` with nodes `ids` folded into a group node `groupId` drawing a new composition
|
|
709
|
+
* `definitionId`. Outside nodes that selected nodes read become group inputs in first-read order,
|
|
710
|
+
* and the one selected node read from outside (or the output) becomes its output. Selected group
|
|
711
|
+
* inputs stay in `composition` and are read through a port like any outside node. The picture does
|
|
738
712
|
* not change.
|
|
739
713
|
*
|
|
740
714
|
* @throws When the selection is empty or only group inputs, names an absent node, `groupId` names
|
|
741
|
-
* an unselected node, or
|
|
715
|
+
* an unselected node, or not exactly one selected node's picture leaves the selection.
|
|
742
716
|
*/
|
|
743
717
|
export function groupNodes(composition, ids, groupId, definitionId) {
|
|
744
718
|
const nodes = composition.nodes ?? [];
|
|
@@ -765,8 +739,7 @@ export function groupNodes(composition, ids, groupId, definitionId) {
|
|
|
765
739
|
? "Nothing outside the group reads its picture"
|
|
766
740
|
: "A group has one output: only one of its nodes may be read from outside it");
|
|
767
741
|
const [output] = [...leaving];
|
|
768
|
-
//
|
|
769
|
-
// group cannot be one.
|
|
742
|
+
// Controls expose nodes of this composition to the group nodes drawing it, never nested nodes.
|
|
770
743
|
const exposed = composition.controls?.find((c) => selected.has(c.node));
|
|
771
744
|
if (exposed)
|
|
772
745
|
throw new Error(`Node ${exposed.node} is exposed as control ${exposed.name}: remove the control before grouping it`);
|
|
@@ -831,11 +804,10 @@ export function groupNodes(composition, ids, groupId, definitionId) {
|
|
|
831
804
|
return { parent: parent, definition: definition };
|
|
832
805
|
}
|
|
833
806
|
/**
|
|
834
|
-
* `composition` with group node `groupId` replaced by
|
|
835
|
-
*
|
|
836
|
-
*
|
|
837
|
-
*
|
|
838
|
-
* Throws when `groupId` is not a group node of `composition`.
|
|
807
|
+
* `composition` with group node `groupId` replaced by its definition's nodes, under ids based on
|
|
808
|
+
* `<group>-<node>`. Group inputs read what the group node's inputs read, controls keep the group
|
|
809
|
+
* node's values, and readers of the group read its output. Returns new ids by inner id. The picture
|
|
810
|
+
* does not change. Throws when `groupId` is not a group node of `composition`.
|
|
839
811
|
*/
|
|
840
812
|
export function ungroupNode(composition, groupId, definition) {
|
|
841
813
|
const nodes = composition.nodes ?? [];
|