@motionscript/core 0.1.0-alpha.5 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
- package/dist/browser/chunks/{chunk-QG6C23IJ.js.map → chunk-2RIYH36X.js.map} +4 -4
- package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +2 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component/api.d.ts +508 -0
- package/dist/component/api.d.ts.map +1 -0
- package/dist/component/api.js +4 -0
- package/dist/component/api.js.map +1 -0
- package/dist/component/builtins/audio.d.ts +26 -0
- package/dist/component/builtins/audio.d.ts.map +1 -0
- package/dist/component/builtins/audio.js +41 -0
- package/dist/component/builtins/audio.js.map +1 -0
- package/dist/component/builtins/canvas3d.d.ts +98 -0
- package/dist/component/builtins/canvas3d.d.ts.map +1 -0
- package/dist/component/builtins/canvas3d.js +21 -0
- package/dist/component/builtins/canvas3d.js.map +1 -0
- package/dist/component/builtins/composite.d.ts +56 -0
- package/dist/component/builtins/composite.d.ts.map +1 -0
- package/dist/component/builtins/composite.js +25 -0
- package/dist/component/builtins/composite.js.map +1 -0
- package/dist/component/builtins/geometry.d.ts +505 -0
- package/dist/component/builtins/geometry.d.ts.map +1 -0
- package/dist/component/builtins/geometry.js +107 -0
- package/dist/component/builtins/geometry.js.map +1 -0
- package/dist/component/builtins/layout.d.ts +88 -0
- package/dist/component/builtins/layout.d.ts.map +1 -0
- package/dist/component/builtins/layout.js +84 -0
- package/dist/component/builtins/layout.js.map +1 -0
- package/dist/component/builtins/media.d.ts +95 -0
- package/dist/component/builtins/media.d.ts.map +1 -0
- package/dist/component/builtins/media.js +149 -0
- package/dist/component/builtins/media.js.map +1 -0
- package/dist/component/builtins/providers.d.ts +23 -0
- package/dist/component/builtins/providers.d.ts.map +1 -0
- package/dist/component/builtins/providers.js +30 -0
- package/dist/component/builtins/providers.js.map +1 -0
- package/dist/component/builtins/text.d.ts +193 -0
- package/dist/component/builtins/text.d.ts.map +1 -0
- package/dist/component/builtins/text.js +113 -0
- package/dist/component/builtins/text.js.map +1 -0
- package/dist/component/builtins/three.d.ts +1085 -0
- package/dist/component/builtins/three.d.ts.map +1 -0
- package/dist/component/builtins/three.js +265 -0
- package/dist/component/builtins/three.js.map +1 -0
- package/dist/component/clip-of.d.ts +5 -0
- package/dist/component/clip-of.d.ts.map +1 -0
- package/dist/component/clip-of.js +33 -0
- package/dist/component/clip-of.js.map +1 -0
- package/dist/component/commands-for.d.ts +19 -0
- package/dist/component/commands-for.d.ts.map +1 -0
- package/dist/component/commands-for.js +5 -0
- package/dist/component/commands-for.js.map +1 -0
- package/dist/component/component-audio.d.ts +9 -0
- package/dist/component/component-audio.d.ts.map +1 -0
- package/dist/component/component-audio.js +18 -0
- package/dist/component/component-audio.js.map +1 -0
- package/dist/component/component2d.d.ts +9 -0
- package/dist/component/component2d.d.ts.map +1 -0
- package/dist/component/component2d.js +239 -0
- package/dist/component/component2d.js.map +1 -0
- package/dist/component/component3d.d.ts +9 -0
- package/dist/component/component3d.d.ts.map +1 -0
- package/dist/component/component3d.js +99 -0
- package/dist/component/component3d.js.map +1 -0
- package/dist/component/factory.d.ts +63 -0
- package/dist/component/factory.d.ts.map +1 -0
- package/dist/component/factory.js +313 -0
- package/dist/component/factory.js.map +1 -0
- package/dist/component/modules/aim.d.ts +30 -0
- package/dist/component/modules/aim.d.ts.map +1 -0
- package/dist/component/modules/aim.js +39 -0
- package/dist/component/modules/aim.js.map +1 -0
- package/dist/component/modules/corners.d.ts +13 -0
- package/dist/component/modules/corners.d.ts.map +1 -0
- package/dist/component/modules/corners.js +12 -0
- package/dist/component/modules/corners.js.map +1 -0
- package/dist/component/modules/flow.d.ts +26 -0
- package/dist/component/modules/flow.d.ts.map +1 -0
- package/dist/component/modules/flow.js +55 -0
- package/dist/component/modules/flow.js.map +1 -0
- package/dist/component/modules/material.d.ts +40 -0
- package/dist/component/modules/material.d.ts.map +1 -0
- package/dist/component/modules/material.js +75 -0
- package/dist/component/modules/material.js.map +1 -0
- package/dist/component/modules/paint.d.ts +71 -0
- package/dist/component/modules/paint.d.ts.map +1 -0
- package/dist/component/modules/paint.js +106 -0
- package/dist/component/modules/paint.js.map +1 -0
- package/dist/component/modules/shapes.d.ts +31 -0
- package/dist/component/modules/shapes.d.ts.map +1 -0
- package/dist/component/modules/shapes.js +43 -0
- package/dist/component/modules/shapes.js.map +1 -0
- package/dist/component/modules/text-layout.d.ts +26 -0
- package/dist/component/modules/text-layout.d.ts.map +1 -0
- package/dist/component/modules/text-layout.js +57 -0
- package/dist/component/modules/text-layout.js.map +1 -0
- package/dist/component/modules/text-style.d.ts +48 -0
- package/dist/component/modules/text-style.d.ts.map +1 -0
- package/dist/component/modules/text-style.js +63 -0
- package/dist/component/modules/text-style.js.map +1 -0
- package/dist/component/modules/three-entries.d.ts +23 -0
- package/dist/component/modules/three-entries.d.ts.map +1 -0
- package/dist/component/modules/three-entries.js +41 -0
- package/dist/component/modules/three-entries.js.map +1 -0
- package/dist/component/modules/view3d.d.ts +55 -0
- package/dist/component/modules/view3d.d.ts.map +1 -0
- package/dist/component/modules/view3d.js +160 -0
- package/dist/component/modules/view3d.js.map +1 -0
- package/dist/component/timeline.d.ts +22 -0
- package/dist/component/timeline.d.ts.map +1 -0
- package/dist/component/timeline.js +128 -0
- package/dist/component/timeline.js.map +1 -0
- package/dist/component/type-def.d.ts +26 -0
- package/dist/component/type-def.d.ts.map +1 -0
- package/dist/component/type-def.js +16 -0
- package/dist/component/type-def.js.map +1 -0
- package/dist/component/types.d.ts +91 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +88 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/views.d.ts +121 -0
- package/dist/component/views.d.ts.map +1 -0
- package/dist/component/views.js +413 -0
- package/dist/component/views.js.map +1 -0
- package/dist/component.d.ts +4 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -5
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +9 -1
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +41 -0
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +9 -27
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.js +3 -0
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +6 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.js +2 -2
- package/dist/document/placement.js.map +1 -1
- package/dist/document/registry.d.ts +6 -11
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +17 -17
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +49 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +247 -0
- package/dist/document/settled-index.js.map +1 -0
- package/dist/document/timeline.d.ts +27 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +98 -2
- package/dist/document/timeline.js.map +1 -1
- package/dist/experimental.d.ts +22 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +20 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/nodes/audio/index.d.ts +2 -2
- package/dist/nodes/audio/index.d.ts.map +1 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +2 -1
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +3 -0
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/index.d.ts +39 -27
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +16 -30
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/node/node.d.ts +7 -1
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +23 -8
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/root/canvas2d-node.d.ts +2 -1
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -1
- package/dist/nodes/root/canvas2d-node.js +3 -0
- package/dist/nodes/root/canvas2d-node.js.map +1 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -5
- package/dist/nodes/text/richtext-node.d.ts.map +1 -1
- package/dist/nodes/text/richtext-node.js +5 -71
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts +5 -22
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +12 -363
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-layout.d.ts +87 -0
- package/dist/nodes/text/text-layout.d.ts.map +1 -0
- package/dist/nodes/text/text-layout.js +368 -0
- package/dist/nodes/text/text-layout.js.map +1 -0
- package/dist/nodes/three/canvas3d-node.d.ts +3 -1
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +6 -0
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +4 -1
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +17 -3
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +9 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +78 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +6 -7
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +11 -4
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +5 -0
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +7 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +35 -14
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +47 -42
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command.d.ts +12 -0
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/package.json +6 -1
- package/dist/browser/chunks/chunk-FUZVFT3W.js +0 -18
- package/dist/browser/chunks/chunk-FUZVFT3W.js.map +0 -7
- package/dist/browser/chunks/chunk-QG6C23IJ.js +0 -3
|
@@ -2,6 +2,7 @@ import type { Node } from "../nodes/node/node.js";
|
|
|
2
2
|
import type { Canvas2D } from "../nodes/root/canvas2d-node.js";
|
|
3
3
|
import { PropSlot } from "../props/slot.js";
|
|
4
4
|
import type { Registry } from "./registry.js";
|
|
5
|
+
import type { SoundOptions } from "../component/api.js";
|
|
5
6
|
import { type TimelinePatch } from "./timeline-patch.js";
|
|
6
7
|
import type { CommandSpec, VisualDocument, VariableSpec } from "./types.js";
|
|
7
8
|
/**
|
|
@@ -29,7 +30,8 @@ import type { CommandSpec, VisualDocument, VariableSpec } from "./types.js";
|
|
|
29
30
|
* restoring the baseline.
|
|
30
31
|
*
|
|
31
32
|
* Building is O(commands) and happens once. Evaluating is what happens per
|
|
32
|
-
* frame, and is O(commands) with no allocation
|
|
33
|
+
* frame, and is O(commands) with no allocation, except that a command marked
|
|
34
|
+
* settling is held at its end values once finished — see `settled-index.ts`.
|
|
33
35
|
*
|
|
34
36
|
* ### Variables and expressions
|
|
35
37
|
*
|
|
@@ -48,6 +50,14 @@ import type { CommandSpec, VisualDocument, VariableSpec } from "./types.js";
|
|
|
48
50
|
* instead, through the same machinery — see `ClipTimeline._resolveVariable`
|
|
49
51
|
* for why that one resolves at read time rather than at compile time.
|
|
50
52
|
*/
|
|
53
|
+
/** A sound a placed command plays: from `at` to `until` in clip seconds, or to its own end. */
|
|
54
|
+
export interface PlacedSound {
|
|
55
|
+
readonly node: Node;
|
|
56
|
+
readonly at: number;
|
|
57
|
+
readonly until: number | undefined;
|
|
58
|
+
readonly src: string;
|
|
59
|
+
readonly options: SoundOptions;
|
|
60
|
+
}
|
|
51
61
|
/** A placed command as the runtime outside the timeline sees it. */
|
|
52
62
|
export interface PlacedCommandInfo {
|
|
53
63
|
readonly spec: CommandSpec;
|
|
@@ -86,6 +96,10 @@ export declare class ClipTimeline {
|
|
|
86
96
|
variableValue(id: string): unknown;
|
|
87
97
|
/** Every variable this document declares, in declaration order. */
|
|
88
98
|
variables(): readonly VariableSpec[];
|
|
99
|
+
/** The time the tree's presence was last synced to. */
|
|
100
|
+
get presenceTime(): number;
|
|
101
|
+
/** Every sound a placed command plays, in clip seconds, with the node that plays it. */
|
|
102
|
+
commandSounds(): PlacedSound[];
|
|
89
103
|
/** Every compiled command, in timeline order — the indices {@link evaluateAt} reports writes under. */
|
|
90
104
|
placedCommands(): readonly PlacedCommandInfo[];
|
|
91
105
|
/**
|
|
@@ -153,6 +167,12 @@ export declare class ClipTimeline {
|
|
|
153
167
|
/** Node ids by {@link NodeSpec.key}. Read off the document, so it needs no build. */
|
|
154
168
|
private readonly _keyed;
|
|
155
169
|
private _placed;
|
|
170
|
+
/** Built after every compile and update, when any placed command is marked settling (`tween/command`). */
|
|
171
|
+
private _settled;
|
|
172
|
+
/** With {@link _settled}: the animated nodes an unmarked command writes, put back whole… */
|
|
173
|
+
private _wholeRestore;
|
|
174
|
+
/** …and, on every other animated node, the baseline of each slot a marked command writes. */
|
|
175
|
+
private _slotRestore;
|
|
156
176
|
/** The scene root (`targetId: null`), plus its baseline. */
|
|
157
177
|
private _root;
|
|
158
178
|
/**
|
|
@@ -259,6 +279,12 @@ export declare class ClipTimeline {
|
|
|
259
279
|
* {@link _settleWindows}.
|
|
260
280
|
*/
|
|
261
281
|
private _compileCommands;
|
|
282
|
+
/**
|
|
283
|
+
* Building runs every marked command to its end, which the restore then undoes.
|
|
284
|
+
* A node only marked commands write keeps every other slot at its baseline from
|
|
285
|
+
* here on, so an evaluation puts back only the slots they write.
|
|
286
|
+
*/
|
|
287
|
+
private _indexSettled;
|
|
262
288
|
/** The present rows whose node is no longer under the parent its row names. */
|
|
263
289
|
private _collectDisplaced;
|
|
264
290
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/document/timeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAa,QAAQ,EAAqB,MAAM,cAAc,CAAC;AAYtE,OAAO,KAAK,EAAE,QAA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CAAC,cAAc;IAWtB,oFAAoF;IACpF,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,iBAAiB;IAazB;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,YAAY;IAOpB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IASjB,uDAAuD;IACvD,OAAO,CAAC,cAAc;IAItB,kEAAkE;IAClE,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,gBAAgB;IAyBxB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAmFxB;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAuDrB"}
|
|
@@ -10,6 +10,8 @@ import { commandNodeRefs, commandTraits, hasNodeRef, isContextProvider, isLayout
|
|
|
10
10
|
import { diffClip } from "./diff.js";
|
|
11
11
|
import { indexDocument } from "./doc-index.js";
|
|
12
12
|
import { expressionOps } from "./expression/ops.js";
|
|
13
|
+
import { SettledIndex } from "./settled-index.js";
|
|
14
|
+
import { commandSoundsOf } from "../component/timeline.js";
|
|
13
15
|
import { planTimelinePatch } from "./timeline-patch.js";
|
|
14
16
|
import { documentDuration, isStillDocument, nodeSpan, ROOT_NODE_ID } from "./types.js";
|
|
15
17
|
/** Resolve an {@link EaseSpec} to the function the tween actually calls. */
|
|
@@ -181,11 +183,13 @@ export class ClipTimeline {
|
|
|
181
183
|
* own `at` — see {@link _compileCommands}.
|
|
182
184
|
*/
|
|
183
185
|
compile(settle = () => { }) {
|
|
186
|
+
this._settled = null;
|
|
184
187
|
this._compileCommands(settle);
|
|
185
188
|
this._restoreBaselines();
|
|
186
189
|
const moved = this.syncPresence(0);
|
|
187
190
|
if (this._restoreDisplaced(this._collectDisplaced()) || moved)
|
|
188
191
|
settle();
|
|
192
|
+
this._indexSettled();
|
|
189
193
|
}
|
|
190
194
|
/** What a variable holds at the last evaluated time. For a host's inspector. */
|
|
191
195
|
variableValue(id) {
|
|
@@ -195,6 +199,29 @@ export class ClipTimeline {
|
|
|
195
199
|
variables() {
|
|
196
200
|
return this._varSpecs;
|
|
197
201
|
}
|
|
202
|
+
/** The time the tree's presence was last synced to. */
|
|
203
|
+
get presenceTime() {
|
|
204
|
+
return this._presenceIndex().time;
|
|
205
|
+
}
|
|
206
|
+
/** Every sound a placed command plays, in clip seconds, with the node that plays it. */
|
|
207
|
+
commandSounds() {
|
|
208
|
+
const out = [];
|
|
209
|
+
for (const placed of this._placed) {
|
|
210
|
+
const played = commandSoundsOf(placed.command);
|
|
211
|
+
if (!played)
|
|
212
|
+
continue;
|
|
213
|
+
for (const sound of played.sounds) {
|
|
214
|
+
out.push({
|
|
215
|
+
node: played.host,
|
|
216
|
+
at: placed.start + sound.at,
|
|
217
|
+
until: sound.until === undefined ? undefined : placed.start + sound.until,
|
|
218
|
+
src: sound.src,
|
|
219
|
+
options: sound.options,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return out;
|
|
224
|
+
}
|
|
198
225
|
/** Every compiled command, in timeline order — the indices {@link evaluateAt} reports writes under. */
|
|
199
226
|
placedCommands() {
|
|
200
227
|
return this._placed;
|
|
@@ -219,6 +246,13 @@ export class ClipTimeline {
|
|
|
219
246
|
this._evaluateObserved(seconds, onWrite);
|
|
220
247
|
return;
|
|
221
248
|
}
|
|
249
|
+
if (this._settled) {
|
|
250
|
+
this._restoreBaselines(this._wholeRestore);
|
|
251
|
+
for (const { slot, baseline } of this._slotRestore)
|
|
252
|
+
slot.restoreFrom(baseline);
|
|
253
|
+
this._settled.evaluate(this._placed, seconds);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
222
256
|
this._restoreBaselines();
|
|
223
257
|
for (const placed of this._placed) {
|
|
224
258
|
if (seconds < placed.start)
|
|
@@ -343,6 +377,7 @@ export class ClipTimeline {
|
|
|
343
377
|
if (patch.prev !== this._docIndex) {
|
|
344
378
|
throw new Error("This patch was planned against a different version of the document.");
|
|
345
379
|
}
|
|
380
|
+
this._settled = null;
|
|
346
381
|
this._restoreBaselines();
|
|
347
382
|
this.syncPresence(0);
|
|
348
383
|
this._updateVariables(patch);
|
|
@@ -402,6 +437,7 @@ export class ClipTimeline {
|
|
|
402
437
|
const moved = this.syncPresence(0);
|
|
403
438
|
if (this._restoreDisplaced(this._collectDisplaced()) || moved)
|
|
404
439
|
settle();
|
|
440
|
+
this._indexSettled();
|
|
405
441
|
}
|
|
406
442
|
_doc;
|
|
407
443
|
/** The vocabulary this document is compiled against — see `document/registry.ts`. */
|
|
@@ -423,6 +459,12 @@ export class ClipTimeline {
|
|
|
423
459
|
/** Node ids by {@link NodeSpec.key}. Read off the document, so it needs no build. */
|
|
424
460
|
_keyed;
|
|
425
461
|
_placed = [];
|
|
462
|
+
/** Built after every compile and update, when any placed command is marked settling (`tween/command`). */
|
|
463
|
+
_settled = null;
|
|
464
|
+
/** With {@link _settled}: the animated nodes an unmarked command writes, put back whole… */
|
|
465
|
+
_wholeRestore = [];
|
|
466
|
+
/** …and, on every other animated node, the baseline of each slot a marked command writes. */
|
|
467
|
+
_slotRestore = [];
|
|
426
468
|
/** The scene root (`targetId: null`), plus its baseline. */
|
|
427
469
|
_root = null;
|
|
428
470
|
/**
|
|
@@ -570,7 +612,7 @@ export class ClipTimeline {
|
|
|
570
612
|
* Truncating is what keeps the pair a function of the chain rather than of
|
|
571
613
|
* how the playhead got here.
|
|
572
614
|
*/
|
|
573
|
-
_restoreBaselines() {
|
|
615
|
+
_restoreBaselines(nodes = this._animated) {
|
|
574
616
|
// Structure before props: a node put back is attached, and the baseline is
|
|
575
617
|
// what it holds once attached.
|
|
576
618
|
this._restoreDisplaced(this._displaced);
|
|
@@ -578,7 +620,7 @@ export class ClipTimeline {
|
|
|
578
620
|
// value rather than a stale one.
|
|
579
621
|
for (const entry of this._animatedVars)
|
|
580
622
|
entry.cell.set(entry.baseline);
|
|
581
|
-
for (const entry of
|
|
623
|
+
for (const entry of nodes) {
|
|
582
624
|
const host = entry.node;
|
|
583
625
|
applySnapshotLayer(host, entry.baseline);
|
|
584
626
|
if (host._stateStack.length > entry.baseStackDepth) {
|
|
@@ -625,6 +667,45 @@ export class ClipTimeline {
|
|
|
625
667
|
this._touch(placed, touched);
|
|
626
668
|
}
|
|
627
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Building runs every marked command to its end, which the restore then undoes.
|
|
672
|
+
* A node only marked commands write keeps every other slot at its baseline from
|
|
673
|
+
* here on, so an evaluation puts back only the slots they write.
|
|
674
|
+
*/
|
|
675
|
+
_indexSettled() {
|
|
676
|
+
const index = (this._settled = SettledIndex.build(this._placed));
|
|
677
|
+
if (!index)
|
|
678
|
+
return;
|
|
679
|
+
this._restoreBaselines();
|
|
680
|
+
const whole = new Set();
|
|
681
|
+
const written = new Map();
|
|
682
|
+
this._placed.forEach((placed, i) => {
|
|
683
|
+
const held = index.holds(i);
|
|
684
|
+
if (!held)
|
|
685
|
+
whole.add(placed.owner);
|
|
686
|
+
for (const slot of placed.writes) {
|
|
687
|
+
const host = slot._host;
|
|
688
|
+
const entry = host === null ? undefined : host.id === ROOT_NODE_ID ? this._root : this._live.get(host.id);
|
|
689
|
+
if (!entry)
|
|
690
|
+
continue;
|
|
691
|
+
if (!held)
|
|
692
|
+
whole.add(entry);
|
|
693
|
+
else if (written.has(entry))
|
|
694
|
+
written.get(entry).add(slot);
|
|
695
|
+
else
|
|
696
|
+
written.set(entry, new Set([slot]));
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
this._wholeRestore = [];
|
|
700
|
+
this._slotRestore = [];
|
|
701
|
+
for (const entry of this._animated) {
|
|
702
|
+
const slots = whole.has(entry) ? null : slotBaselines(entry, written.get(entry));
|
|
703
|
+
if (slots)
|
|
704
|
+
this._slotRestore.push(...slots);
|
|
705
|
+
else
|
|
706
|
+
this._wholeRestore.push(entry);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
628
709
|
/** The present rows whose node is no longer under the parent its row names. */
|
|
629
710
|
_collectDisplaced() {
|
|
630
711
|
const out = [];
|
|
@@ -1185,6 +1266,21 @@ function captureBaseline(entry) {
|
|
|
1185
1266
|
entry.baseline = captureLayer(host);
|
|
1186
1267
|
entry.baseStackDepth = host._stateStack.length;
|
|
1187
1268
|
}
|
|
1269
|
+
/** The baseline of each of `slots`, or `null` when one isn't among the node's props. */
|
|
1270
|
+
function slotBaselines(entry, slots) {
|
|
1271
|
+
if (!slots)
|
|
1272
|
+
return [];
|
|
1273
|
+
const cells = entry.node.__cells?.slots;
|
|
1274
|
+
if (!cells)
|
|
1275
|
+
return null;
|
|
1276
|
+
const out = [];
|
|
1277
|
+
for (const [key, slot] of cells) {
|
|
1278
|
+
const baseline = slots.has(slot) ? entry.baseline.get(key) : undefined;
|
|
1279
|
+
if (baseline)
|
|
1280
|
+
out.push({ slot, baseline });
|
|
1281
|
+
}
|
|
1282
|
+
return out.length === slots.size ? out : null;
|
|
1283
|
+
}
|
|
1188
1284
|
function captureInitial(entry) {
|
|
1189
1285
|
captureBaseline(entry);
|
|
1190
1286
|
entry.initial = entry.baseline;
|