@wardic/core 1.3.2 → 1.4.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/Arc.d.ts +2 -2
- package/dist/Arc.js +1 -1
- package/dist/BaseValue.d.ts +11 -10
- package/dist/BaseValue.d.ts.map +1 -1
- package/dist/BaseValue.js +12 -15
- package/dist/BaseValue.js.map +1 -1
- package/dist/Batch.d.ts +15 -5
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +218 -20
- package/dist/Batch.js.map +1 -1
- package/dist/Clock.d.ts +7 -7
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +17 -16
- package/dist/Clock.js.map +1 -1
- package/dist/DefaultTransition.d.ts +3 -2
- package/dist/DefaultTransition.d.ts.map +1 -1
- package/dist/DefaultTransition.js +5 -3
- package/dist/DefaultTransition.js.map +1 -1
- package/dist/Drag.d.ts +24 -9
- package/dist/Drag.d.ts.map +1 -1
- package/dist/Drag.js +10 -10
- package/dist/Drag.js.map +1 -1
- package/dist/DragActivity.js +3 -3
- package/dist/DragRecognizer.d.ts +5 -4
- package/dist/DragRecognizer.d.ts.map +1 -1
- package/dist/DragRecognizer.js +37 -14
- package/dist/DragRecognizer.js.map +1 -1
- package/dist/Easing.d.ts +1 -1
- package/dist/Easing.js +1 -1
- package/dist/Frame.d.ts.map +1 -1
- package/dist/Frame.js +5 -3
- package/dist/Frame.js.map +1 -1
- package/dist/InputFeed.d.ts +1 -1
- package/dist/InputFeed.js +2 -2
- package/dist/InputSource.d.ts +3 -3
- package/dist/InputSource.js +2 -2
- package/dist/Interpolator.d.ts +2 -2
- package/dist/Interpolator.js +2 -2
- package/dist/InterpolatorRegistry.d.ts +29 -15
- package/dist/InterpolatorRegistry.d.ts.map +1 -1
- package/dist/InterpolatorRegistry.js +17 -8
- package/dist/InterpolatorRegistry.js.map +1 -1
- package/dist/LiveValue.d.ts +7 -6
- package/dist/LiveValue.d.ts.map +1 -1
- package/dist/LiveValue.js +45 -14
- package/dist/LiveValue.js.map +1 -1
- package/dist/Machine.d.ts +7 -4
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +146 -45
- package/dist/Machine.js.map +1 -1
- package/dist/Playback.d.ts.map +1 -1
- package/dist/Playback.js +6 -1
- package/dist/Playback.js.map +1 -1
- package/dist/Projection.d.ts +9 -9
- package/dist/Projection.js +2 -2
- package/dist/Recognizer.d.ts +1 -1
- package/dist/Recognizer.js +6 -6
- package/dist/Recognizer.js.map +1 -1
- package/dist/ReducedMotion.d.ts +4 -4
- package/dist/ReducedMotion.js +6 -6
- package/dist/Renderer.d.ts +5 -5
- package/dist/Renderer.js +6 -6
- package/dist/Renderer.js.map +1 -1
- package/dist/Reorder.d.ts +1 -1
- package/dist/Reorder.d.ts.map +1 -1
- package/dist/Reorder.js +2 -1
- package/dist/Reorder.js.map +1 -1
- package/dist/ScrollSource.d.ts +1 -1
- package/dist/ScrollSource.d.ts.map +1 -1
- package/dist/Sequence.d.ts +1 -1
- package/dist/SharedSource.d.ts +3 -3
- package/dist/SharedSource.js +5 -5
- package/dist/SharedSource.js.map +1 -1
- package/dist/Spring.d.ts.map +1 -1
- package/dist/Spring.js +2 -1
- package/dist/Spring.js.map +1 -1
- package/dist/Values.d.ts +2 -2
- package/dist/Values.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/carried.d.ts +13 -0
- package/dist/internal/carried.d.ts.map +1 -0
- package/dist/internal/carried.js +23 -0
- package/dist/internal/carried.js.map +1 -0
- package/dist/internal/firstSteps.d.ts +66 -0
- package/dist/internal/firstSteps.d.ts.map +1 -0
- package/dist/internal/firstSteps.js +107 -0
- package/dist/internal/firstSteps.js.map +1 -0
- package/dist/internal/frameLoop.d.ts +1 -1
- package/dist/internal/frameLoop.d.ts.map +1 -1
- package/dist/internal/frameLoop.js +102 -81
- package/dist/internal/frameLoop.js.map +1 -1
- package/dist/internal/lerpsNumbers.d.ts +11 -0
- package/dist/internal/lerpsNumbers.d.ts.map +1 -0
- package/dist/internal/lerpsNumbers.js +38 -0
- package/dist/internal/lerpsNumbers.js.map +1 -0
- package/dist/internal/options.d.ts +7 -7
- package/dist/internal/options.d.ts.map +1 -1
- package/dist/internal/options.js +10 -10
- package/dist/internal/options.js.map +1 -1
- package/dist/internal/stepper.d.ts +13 -2
- package/dist/internal/stepper.d.ts.map +1 -1
- package/dist/internal/stepper.js +16 -1
- package/dist/internal/stepper.js.map +1 -1
- package/dist/internal/tracing.d.ts +1 -1
- package/dist/internal/tracing.js +1 -1
- package/dist/unstable/AnimationControls.d.ts +37 -38
- package/dist/unstable/AnimationControls.d.ts.map +1 -1
- package/dist/unstable/AnimationControls.js +39 -36
- package/dist/unstable/AnimationControls.js.map +1 -1
- package/dist/unstable/AppearHandoff.d.ts +5 -5
- package/dist/unstable/AppearHandoff.d.ts.map +1 -1
- package/dist/unstable/BatchCalls.d.ts +2 -2
- package/dist/unstable/BatchCalls.js +5 -5
- package/dist/unstable/Config.d.ts +19 -19
- package/dist/unstable/Config.d.ts.map +1 -1
- package/dist/unstable/FirstSteps.d.ts +25 -0
- package/dist/unstable/FirstSteps.d.ts.map +1 -0
- package/dist/unstable/FirstSteps.js +2 -0
- package/dist/unstable/FirstSteps.js.map +1 -0
- package/dist/unstable/FlushGate.d.ts +53 -51
- package/dist/unstable/FlushGate.d.ts.map +1 -1
- package/dist/unstable/FlushGate.js +56 -49
- package/dist/unstable/FlushGate.js.map +1 -1
- package/dist/unstable/FrameEffects.d.ts +2 -2
- package/dist/unstable/FrameEffects.js +2 -2
- package/dist/unstable/FrameTime.d.ts +1 -1
- package/dist/unstable/FrameTime.js +1 -1
- package/dist/unstable/Imperative.d.ts +29 -9
- package/dist/unstable/Imperative.d.ts.map +1 -1
- package/dist/unstable/Imperative.js +79 -47
- package/dist/unstable/Imperative.js.map +1 -1
- package/dist/unstable/OwnValues.js +1 -1
- package/dist/unstable/PresenceRecord.d.ts +26 -26
- package/dist/unstable/PresenceRecord.d.ts.map +1 -1
- package/dist/unstable/PresenceRecord.js +8 -8
- package/dist/unstable/PresenceRecord.js.map +1 -1
- package/dist/unstable/Projector.d.ts +34 -0
- package/dist/unstable/Projector.d.ts.map +1 -0
- package/dist/unstable/Projector.js +9 -0
- package/dist/unstable/Projector.js.map +1 -0
- package/dist/unstable/Report.d.ts +1 -1
- package/dist/unstable/Report.js +1 -1
- package/dist/unstable/RetargetLegs.d.ts +1 -1
- package/dist/unstable/RetargetLegs.d.ts.map +1 -1
- package/dist/unstable/RetargetLegs.js +9 -8
- package/dist/unstable/RetargetLegs.js.map +1 -1
- package/dist/unstable/Spine.d.ts +81 -72
- package/dist/unstable/Spine.d.ts.map +1 -1
- package/dist/unstable/Spine.js +152 -150
- package/dist/unstable/Spine.js.map +1 -1
- package/dist/unstable/Stops.d.ts +3 -3
- package/dist/unstable/Stops.js +4 -4
- package/dist/unstable/Subject.d.ts +2 -2
- package/dist/unstable/Subject.js +2 -2
- package/dist/unstable/Timelines.d.ts +11 -11
- package/dist/unstable/Timelines.d.ts.map +1 -1
- package/dist/unstable/Timelines.js +3 -3
- package/dist/unstable/VariantTarget.d.ts +7 -7
- package/dist/unstable/VariantTarget.d.ts.map +1 -1
- package/dist/unstable/VariantTarget.js +11 -11
- package/dist/unstable/VariantTarget.js.map +1 -1
- package/dist/unstable/VariantTree.d.ts +36 -36
- package/dist/unstable/VariantTree.d.ts.map +1 -1
- package/dist/unstable/VariantTree.js +33 -33
- package/dist/unstable/VariantTree.js.map +1 -1
- package/dist/unstable/WardicConfigValue.d.ts +13 -13
- package/dist/unstable/WardicConfigValue.d.ts.map +1 -1
- package/dist/unstable/WardicConfigValue.js +4 -4
- package/dist/unstable/WardicConfigValue.js.map +1 -1
- package/package.json +1 -1
- package/src/Arc.ts +3 -3
- package/src/BaseValue.ts +18 -21
- package/src/Batch.ts +236 -22
- package/src/Clock.ts +18 -17
- package/src/DefaultTransition.ts +5 -3
- package/src/Drag.ts +32 -14
- package/src/DragActivity.ts +3 -3
- package/src/DragRecognizer.ts +41 -16
- package/src/Easing.ts +1 -1
- package/src/Frame.ts +5 -3
- package/src/InputFeed.ts +2 -2
- package/src/InputSource.ts +5 -5
- package/src/Interpolator.ts +3 -3
- package/src/InterpolatorRegistry.ts +22 -13
- package/src/LiveValue.ts +47 -17
- package/src/Machine.ts +199 -61
- package/src/Playback.ts +5 -1
- package/src/Projection.ts +9 -9
- package/src/Recognizer.ts +7 -7
- package/src/ReducedMotion.ts +6 -6
- package/src/Renderer.ts +6 -6
- package/src/Reorder.ts +3 -2
- package/src/ScrollSource.ts +1 -1
- package/src/Sequence.ts +1 -1
- package/src/SharedSource.ts +5 -5
- package/src/Spring.ts +2 -1
- package/src/Values.ts +2 -2
- package/src/index.ts +1 -1
- package/src/internal/carried.ts +22 -0
- package/src/internal/firstSteps.ts +139 -0
- package/src/internal/frameLoop.ts +103 -87
- package/src/internal/lerpsNumbers.ts +53 -0
- package/src/internal/options.ts +10 -10
- package/src/internal/stepper.ts +20 -2
- package/src/internal/tracing.ts +1 -1
- package/src/unstable/AnimationControls.ts +59 -56
- package/src/unstable/AppearHandoff.ts +6 -6
- package/src/unstable/BatchCalls.ts +5 -5
- package/src/unstable/Config.ts +19 -19
- package/src/unstable/FirstSteps.ts +26 -0
- package/src/unstable/FlushGate.ts +92 -82
- package/src/unstable/FrameEffects.ts +2 -2
- package/src/unstable/FrameTime.ts +1 -1
- package/src/unstable/Imperative.ts +126 -56
- package/src/unstable/OwnValues.ts +1 -1
- package/src/unstable/PresenceRecord.ts +29 -29
- package/src/unstable/Projector.ts +45 -0
- package/src/unstable/Report.ts +1 -1
- package/src/unstable/RetargetLegs.ts +10 -9
- package/src/unstable/Spine.ts +190 -188
- package/src/unstable/Stops.ts +6 -6
- package/src/unstable/Subject.ts +2 -2
- package/src/unstable/Timelines.ts +12 -12
- package/src/unstable/VariantTarget.ts +13 -13
- package/src/unstable/VariantTree.ts +42 -42
- package/src/unstable/WardicConfigValue.ts +13 -13
package/dist/unstable/Spine.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The motion spine's Retarget (ADR-0005), on every binding: what
|
|
3
|
-
* when its target changes. A binding mounts the
|
|
4
|
-
* ({@link resolutionOf}), and calls {@link
|
|
2
|
+
* The motion spine's Retarget (ADR-0005), on every binding: what a Subject does from its mount on
|
|
3
|
+
* when its target changes. A binding mounts the Subject, resolves its Override stack reactively
|
|
4
|
+
* ({@link resolutionOf}), and calls {@link SubjectSpine.retarget} on each change, read where its
|
|
5
5
|
* reactivity doesn't track; everything a Retarget does is here:
|
|
6
6
|
*
|
|
7
7
|
* end the running legs -> carry the keys no entry sets back to their Base values (ADR-0022) ->
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @module
|
|
17
17
|
*/
|
|
18
|
-
// Unstable: ADR-0071, decision 5. #672: solid's `spine.ts`, moved for every binding's
|
|
18
|
+
// Unstable: ADR-0071, decision 5. #672: solid's `spine.ts`, moved for every binding's Subjects to run it
|
|
19
19
|
// from core, Foldkit's among them; with it, the Batch hold's slot (Q14).
|
|
20
20
|
import * as BaseValue from "../BaseValue.js";
|
|
21
21
|
import * as Frame from "../Frame.js";
|
|
@@ -51,7 +51,7 @@ import * as Timelines from "./Timelines.js";
|
|
|
51
51
|
import * as VariantTree from "./VariantTree.js";
|
|
52
52
|
import * as VariantTarget from "./VariantTarget.js";
|
|
53
53
|
export { NO_VARIANT_STATE, resolveTarget, transitionOfTarget } from "./VariantTarget.js";
|
|
54
|
-
/** No exit:
|
|
54
|
+
/** No exit: a Subject outside a presence never resolves one. */
|
|
55
55
|
export const NO_EXIT_CONFIG = { exit: undefined, variants: undefined, custom: undefined, transition: undefined };
|
|
56
56
|
/** A record's place in the variant tree (#290), from its config at setup. */
|
|
57
57
|
export const presenceTreeOf = (c) => ({
|
|
@@ -60,20 +60,20 @@ export const presenceTreeOf = (c) => ({
|
|
|
60
60
|
twin: Predicate.isNotUndefined(c.layoutId),
|
|
61
61
|
});
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
* whether it's a twin. With no presence, `set` itself: nothing is made per
|
|
63
|
+
* A Subject's ref that tells its presence it was made (#286, ADR-0048): its `key`, read once, and
|
|
64
|
+
* whether it's a twin. With no presence, `set` itself: nothing is made per Subject.
|
|
65
65
|
*/
|
|
66
66
|
export const madeWith = (presence, set, c) => {
|
|
67
67
|
if (Predicate.isUndefined(presence))
|
|
68
68
|
return set;
|
|
69
69
|
const key = c.key;
|
|
70
70
|
const twin = Predicate.isNotUndefined(c.layoutId);
|
|
71
|
-
return (
|
|
72
|
-
PresenceRecord.presenceMade(presence,
|
|
73
|
-
set(
|
|
71
|
+
return (subject) => {
|
|
72
|
+
PresenceRecord.presenceMade(presence, subject, key, twin);
|
|
73
|
+
set(subject);
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
/**
|
|
76
|
+
/** A Subject's {@link ExitConfig} from its config now. */
|
|
77
77
|
export const exitConfigOf = (c, parent) => ({
|
|
78
78
|
exit: c.exit,
|
|
79
79
|
variants: c.variants,
|
|
@@ -81,9 +81,9 @@ export const exitConfigOf = (c, parent) => ({
|
|
|
81
81
|
transition: VariantTree.ownOrInherited(c.transition, parent),
|
|
82
82
|
});
|
|
83
83
|
/**
|
|
84
|
-
* Resolve
|
|
85
|
-
* given (Motion's: the leaving
|
|
86
|
-
* its own transition, else the
|
|
84
|
+
* Resolve a Subject's exit as it leaves (#277): with its `<AnimatePresence custom>` when that's
|
|
85
|
+
* given (Motion's: the leaving Subject's own props can't change any more), else its own `custom`; on
|
|
86
|
+
* its own transition, else the Subject's.
|
|
87
87
|
*/
|
|
88
88
|
export const exitTargetOf = (config, presenceCustom, state, inherited) => {
|
|
89
89
|
const custom = UndefinedOr.match(presenceCustom, { onUndefined: () => config.custom, onDefined: identity });
|
|
@@ -109,11 +109,11 @@ export const exitTargetOf = (config, presenceCustom, state, inherited) => {
|
|
|
109
109
|
const target = VariantTarget.resolveTarget(entry, config.variants, custom, state);
|
|
110
110
|
return { values: target.values, transition: VariantTarget.transitionOfTarget(target.transition, config.transition), name, keyframes: target.keyframes, failure: target.failure };
|
|
111
111
|
};
|
|
112
|
-
/** A list's exit groups (#297): each name, with the keys it's the last to set, on its own transition else `
|
|
113
|
-
const exitGroupsOf = (targets,
|
|
112
|
+
/** A list's exit groups (#297): each name, with the keys it's the last to set, on its own transition else `wardTransition`. */
|
|
113
|
+
const exitGroupsOf = (targets, wardTransition) => Arr.map(targets, (target, i) => ({
|
|
114
114
|
name: target.name,
|
|
115
115
|
values: Rec.filter(target.values, (_, key) => Bool.not(Arr.some(Arr.drop(targets, i + 1), (later) => Object.hasOwn(later.values, key)))),
|
|
116
|
-
transition: VariantTarget.transitionOfTarget(target.transition,
|
|
116
|
+
transition: VariantTarget.transitionOfTarget(target.transition, wardTransition),
|
|
117
117
|
}));
|
|
118
118
|
/** A config given as a value or as an accessor, as an accessor. A config is always an object, so a function is the accessor. */
|
|
119
119
|
export const accessorOf = (config) => Bool.match(Predicate.isFunction(config), { onTrue: () => config, onFalse: () => () => config });
|
|
@@ -147,10 +147,10 @@ const keysByLayerOf = (t, layers, extraDelay, extra, listed, shut) => {
|
|
|
147
147
|
* The transition `key` animates on in a Retarget: its group's (#277, #297), else the Retarget's one,
|
|
148
148
|
* with no stagger (#448 reads its fields, not its delay).
|
|
149
149
|
*/
|
|
150
|
-
const keyTransitionOf = (resolution, groups, key, transition,
|
|
150
|
+
const keyTransitionOf = (resolution, groups, key, transition, wardTransition) => {
|
|
151
151
|
if (Predicate.isUndefined(groups))
|
|
152
152
|
return transition;
|
|
153
|
-
return groupTransitionOf(resolution, groups, Option.getOrElse(Arr.findFirstIndex(groups, (group) => group.has(key)), () => -1), transition,
|
|
153
|
+
return groupTransitionOf(resolution, groups, Option.getOrElse(Arr.findFirstIndex(groups, (group) => group.has(key)), () => -1), transition, wardTransition, undefined, identity);
|
|
154
154
|
};
|
|
155
155
|
/** A key's velocity in the Snapshot, 0 with none (#448). Per key, per Retarget: a guard. */
|
|
156
156
|
const velocityOf = (snapshot, key) => {
|
|
@@ -170,13 +170,15 @@ const pickKeys = (t, groups, i) => {
|
|
|
170
170
|
};
|
|
171
171
|
/** A transition's `delay`, 0 without one. */
|
|
172
172
|
export const delayOf = (transition) => UndefinedOr.match(transition, { onUndefined: () => 0, onDefined: ({ delay = 0 }) => delay });
|
|
173
|
-
/** No keys: what a drag moves on a projected
|
|
173
|
+
/** No keys: what a drag moves on a projected Subject, or one with no drag. */
|
|
174
174
|
const NO_KEYS = [];
|
|
175
175
|
/** The keys a drag of `axis` moves directly. Built once, at module load. */
|
|
176
176
|
const dragMovesOf = Match.type().pipe(Match.when("x", () => ["x"]), Match.when("y", () => ["y"]), Match.orElse(() => ["x", "y"]));
|
|
177
177
|
/** Whether a start link's value takes its target's shape: both numbers, or both strings. */
|
|
178
178
|
const isSameKind = (value, like) => Predicate.isNumber(value) === Predicate.isNumber(like);
|
|
179
179
|
/** The keys a drag direct-sets (ADR-0004). */
|
|
180
|
+
// `translateX` and `translateY` are the DOM's own keys since #1002 (ADR-0073, *Amendment (#1002)*, Q6): they
|
|
181
|
+
// stay here, plumbing, as the DOM's aliases of `x` and `y` that a drag holds back too.
|
|
180
182
|
const TRANSLATE_KEYS = new Set(["x", "y", "translateX", "translateY"]);
|
|
181
183
|
const TRANSLATE_KEY_LIST = Arr.fromIterable(TRANSLATE_KEYS);
|
|
182
184
|
/** Whether a value map has any key. */
|
|
@@ -248,7 +250,7 @@ const setsValues = (layer) => {
|
|
|
248
250
|
};
|
|
249
251
|
/** A single entry's name: itself, if a name; `undefined` for a values map. */
|
|
250
252
|
const labelOrUndefined = (entry) => Bool.match(Predicate.isString(entry), { onTrue: () => entry, onFalse: constUndefined });
|
|
251
|
-
/** Each gesture on: the
|
|
253
|
+
/** Each gesture on: the Subject's own, or its provider's too when it has one handing any down. */
|
|
252
254
|
const gesturesOnOf = (active, above) => {
|
|
253
255
|
if (above === VariantTree.NO_HAND_DOWN)
|
|
254
256
|
return active;
|
|
@@ -267,7 +269,7 @@ const activeNamesFor = (c, on, labels) => {
|
|
|
267
269
|
const anyOn = (on) => on.inView || on.focused || on.hovered || on.pressed || on.dragged;
|
|
268
270
|
/**
|
|
269
271
|
* Whether an active entry's name delays its keys otherwise than the first entry's (#297): a Variant
|
|
270
|
-
* child's names each take their own stagger slot. Never for
|
|
272
|
+
* child's names each take their own stagger slot. Never for a Subject that joins none, nor for one
|
|
271
273
|
* entry.
|
|
272
274
|
*/
|
|
273
275
|
const delaysDiffer = (layers, extraDelay, extra) => {
|
|
@@ -275,7 +277,7 @@ const delaysDiffer = (layers, extraDelay, extra) => {
|
|
|
275
277
|
return false;
|
|
276
278
|
return Arr.some(layers, (layer) => Bool.and(layer.active, extraOf(extraDelay, layer) !== extra));
|
|
277
279
|
};
|
|
278
|
-
/** An entry's stagger delay (ADR-0007, #297): its name's, for a Variant child; 0 for any other
|
|
280
|
+
/** An entry's stagger delay (ADR-0007, #297): its name's, for a Variant child; 0 for any other Subject. */
|
|
279
281
|
const extraOf = (extraDelay, layer) => {
|
|
280
282
|
if (Predicate.isUndefined(extraDelay))
|
|
281
283
|
return 0;
|
|
@@ -285,27 +287,27 @@ const extraOf = (extraDelay, layer) => {
|
|
|
285
287
|
};
|
|
286
288
|
/**
|
|
287
289
|
* The transition a key group runs on (#291, #297): unsplit, the base's (`transition`, its delay
|
|
288
|
-
* folded in); split, its entry's own, else the
|
|
289
|
-
* group carries its returns too, which run on the
|
|
290
|
+
* folded in); split, its entry's own, else the Subject's, at its name's delay. A list's first
|
|
291
|
+
* group carries its returns too, which run on the Subject's transition, as a list's base has no one
|
|
290
292
|
* transition of its own.
|
|
291
293
|
*/
|
|
292
|
-
const groupTransitionOf = (resolution, groups, i, transition,
|
|
294
|
+
const groupTransitionOf = (resolution, groups, i, transition, wardTransition, extraDelay, reuse) => {
|
|
293
295
|
if (Predicate.isUndefined(groups))
|
|
294
296
|
return transition;
|
|
295
297
|
if (Bool.and(i === 0, Bool.not(Arr.isArray(resolution.variant))))
|
|
296
298
|
return transition;
|
|
297
299
|
const layer = resolution.layers[i];
|
|
298
|
-
// A list's returns: the
|
|
300
|
+
// A list's returns: the Subject's, at its whole orchestration's delay.
|
|
299
301
|
if (Predicate.isUndefined(layer))
|
|
300
|
-
return staggeredOf(
|
|
301
|
-
return staggeredOf(VariantTarget.transitionOfTarget(layer.transition,
|
|
302
|
+
return staggeredOf(wardTransition, extraOf(extraDelay, undefined), reuse);
|
|
303
|
+
return staggeredOf(VariantTarget.transitionOfTarget(layer.transition, wardTransition), extraOf(extraDelay, layer), reuse);
|
|
302
304
|
};
|
|
303
305
|
/** No names. */
|
|
304
306
|
const NO_NAMES = [];
|
|
305
307
|
/** No legs. */
|
|
306
308
|
const NO_LEGS = [];
|
|
307
309
|
/**
|
|
308
|
-
* A gated Retarget's landing (ADR-0007 `when`, #325): the legs it carries report the
|
|
310
|
+
* A gated Retarget's landing (ADR-0007 `when`, #325): the legs it carries report the Subject
|
|
309
311
|
* unsettled, as it still owes an animation, and land nothing; the Retarget once the gate opens
|
|
310
312
|
* counts them.
|
|
311
313
|
*/
|
|
@@ -320,7 +322,7 @@ const gatedLandingOf = (onFrame) => ({
|
|
|
320
322
|
/** No running legs. */
|
|
321
323
|
export const NO_RUNNING = [];
|
|
322
324
|
/**
|
|
323
|
-
* The waiting Transition ends of
|
|
325
|
+
* The waiting Transition ends of Subject `id` (#508): made at its first end, so a Subject with none,
|
|
324
326
|
* nearly every one, pays nothing for them. `owners` holds the leg drawing each key.
|
|
325
327
|
*/
|
|
326
328
|
const waitingEndsOf = (owners, snapshot, gate, id, recordFrame) => {
|
|
@@ -410,7 +412,7 @@ const waitingEndsOf = (owners, snapshot, gate, id, recordFrame) => {
|
|
|
410
412
|
},
|
|
411
413
|
};
|
|
412
414
|
};
|
|
413
|
-
/** A leg's last frame lands the Transition ends waiting on it (#508);
|
|
415
|
+
/** A leg's last frame lands the Transition ends waiting on it (#508); a Subject with none has nothing to ask. */
|
|
414
416
|
const landEndsOf = (waiting) => {
|
|
415
417
|
if (Predicate.isNotUndefined(waiting))
|
|
416
418
|
waiting.land();
|
|
@@ -419,7 +421,7 @@ const landEndsOf = (waiting) => {
|
|
|
419
421
|
export const NO_VALUES = {};
|
|
420
422
|
/**
|
|
421
423
|
* Whether a change's starts, targets or Keyframes stops hold a Variable value (#542): only then can
|
|
422
|
-
* the
|
|
424
|
+
* the Subject's Key rule, its Variable values (#55), take a pair, so only then is a leg's machine
|
|
423
425
|
* built under it. It declines every pair with no `var()` at either end.
|
|
424
426
|
*/
|
|
425
427
|
export const holdsVariable = (variables, from, to, stops) => {
|
|
@@ -445,7 +447,7 @@ const stopsCheckOf = (variables) => {
|
|
|
445
447
|
stopsChecks.set(variables, check);
|
|
446
448
|
return check;
|
|
447
449
|
};
|
|
448
|
-
/** A Path's turn (#438, ADR-0065): the reserved key its Environment's renderer adds onto
|
|
450
|
+
/** A Path's turn (#438, ADR-0065): the reserved key its Environment's renderer adds onto the Subject's turn. */
|
|
449
451
|
const PATH_ROTATION = "pathRotation";
|
|
450
452
|
/** The turn back at 0, written once no leg draws it (#460). */
|
|
451
453
|
const TURNED_BACK = { [PATH_ROTATION]: 0 };
|
|
@@ -570,7 +572,7 @@ const restOf = (owners, target, axis) => {
|
|
|
570
572
|
/**
|
|
571
573
|
* Where a Path's axes that `target` leaves out rest (#574), read before their legs give them up: a
|
|
572
574
|
* new Path ends them there, so a toss caught mid-air curves back to its line. `undefined` for none:
|
|
573
|
-
* every
|
|
575
|
+
* every Subject's Retarget asks, nearly always with no Path in flight, so guards, nothing built.
|
|
574
576
|
*/
|
|
575
577
|
export const restsOf = (owners, target) => {
|
|
576
578
|
const x = restOf(owners, target, "x");
|
|
@@ -613,7 +615,7 @@ const anyShutOf = (shut) => {
|
|
|
613
615
|
* variant does, unless keys it drives stay running. A list's returns' Live values follow with its
|
|
614
616
|
* returns' group, last; any other's with the first group.
|
|
615
617
|
*/
|
|
616
|
-
const splitLegsOf = (t, from, groups, resolution, listed, transition,
|
|
618
|
+
const splitLegsOf = (t, from, groups, resolution, listed, transition, wardTransition, extraDelay, reuse, reduce, skipped, positionalKeys, defaultTransition, velocities, follow, stops, measured, current, rests, unitScale) => {
|
|
617
619
|
let returnsAt = 0;
|
|
618
620
|
if (listed)
|
|
619
621
|
returnsAt = resolution.layers.length;
|
|
@@ -627,7 +629,7 @@ const splitLegsOf = (t, from, groups, resolution, listed, transition, element, e
|
|
|
627
629
|
let followed;
|
|
628
630
|
if (i === returnsAt)
|
|
629
631
|
followed = follow;
|
|
630
|
-
const groupLegs = RetargetLegs.legsOf(from, picked, groupTransitionOf(resolution, groups, i, transition,
|
|
632
|
+
const groupLegs = RetargetLegs.legsOf(from, picked, groupTransitionOf(resolution, groups, i, transition, wardTransition, extraDelay, reuse), reduce, skipped, positionalKeys, defaultTransition, velocities, followed, stops, measured, current, rests, unitScale);
|
|
631
633
|
Arr.forEach(groupLegs, (built) => {
|
|
632
634
|
legs.push(built);
|
|
633
635
|
tags.push(i);
|
|
@@ -639,7 +641,7 @@ const splitLegsOf = (t, from, groups, resolution, listed, transition, element, e
|
|
|
639
641
|
* A list's names at a Retarget (#297): told settled as the legs of the keys each drives settle, to
|
|
640
642
|
* the binding's callbacks (Solid 1's, PR 1) and to its orchestration (PR 2), told moving now; and each
|
|
641
643
|
* shut name's legs waiting on its gate (PR 2), its keys held where they start, so another name's first
|
|
642
|
-
* commit, which hands the
|
|
644
|
+
* commit, which hands the Subject's style back (ADR-0034), doesn't drop them to their own value.
|
|
643
645
|
*/
|
|
644
646
|
const listingOf = (of) => {
|
|
645
647
|
const { listed, told, byName, resolution, groups, legGroups, legCount, carriedGroups, shut, config } = of;
|
|
@@ -700,7 +702,7 @@ const logsDebugOn = (runtime) => {
|
|
|
700
702
|
return on;
|
|
701
703
|
};
|
|
702
704
|
/**
|
|
703
|
-
* No key taken by an Imperative animation (#433): every spine's until its first, shared, so
|
|
705
|
+
* No key taken by an Imperative animation (#433): every spine's until its first, shared, so a Subject
|
|
704
706
|
* none animates holds no map of its own (#460). Never written: a spine sets keys in a map of its own,
|
|
705
707
|
* and deletes only from one that has some.
|
|
706
708
|
*/
|
|
@@ -779,7 +781,7 @@ const hasKeyframes = (layer) => {
|
|
|
779
781
|
};
|
|
780
782
|
/**
|
|
781
783
|
* Each resolved key's Keyframes (#429): the stops of the entry that drives it, when that entry gives
|
|
782
|
-
* it Keyframes. `undefined`, with nothing made, when no active entry has any: every
|
|
784
|
+
* it Keyframes. `undefined`, with nothing made, when no active entry has any: every Subject's common
|
|
783
785
|
* case.
|
|
784
786
|
*/
|
|
785
787
|
const keyframesNowOf = (layers, resolved) => {
|
|
@@ -893,11 +895,11 @@ const keepsStart = (pairs, key, start, target) => {
|
|
|
893
895
|
const measuringOf = (found, keyframes) => Arr.appendAll(UndefinedOr.match(found, { onUndefined: () => [], onDefined: identity }), UndefinedOr.match(keyframes, { onUndefined: () => [], onDefined: Rec.keys }));
|
|
894
896
|
/**
|
|
895
897
|
* A Retarget's Measured pairs (#430): each of `keys` whose start and target are one, asked of the
|
|
896
|
-
* end-of-task batch with the values the
|
|
898
|
+
* end-of-task batch with the values the Subject draws now, but a key with Keyframes of more than two
|
|
897
899
|
* stops (`many`, #460). `undefined` with none. When the batch can't take them, they switch, as pairs
|
|
898
|
-
* it couldn't read do, reported on `runtime` with the
|
|
900
|
+
* it couldn't read do, reported on `runtime` with the Subject's `id`.
|
|
899
901
|
*/
|
|
900
|
-
export const measuredOf = (measured,
|
|
902
|
+
export const measuredOf = (measured, subject, keys, from, to, values, many, runtime, id) => {
|
|
901
903
|
const pairs = {};
|
|
902
904
|
Arr.forEach(keys, (key) => {
|
|
903
905
|
if (RetargetLegs.hasManyStops(many, key))
|
|
@@ -911,8 +913,8 @@ export const measuredOf = (measured, element, keys, from, to, values, many, runt
|
|
|
911
913
|
});
|
|
912
914
|
if (Rec.isEmptyRecord(pairs))
|
|
913
915
|
return undefined;
|
|
914
|
-
// Its report made only for pairs asked, not once
|
|
915
|
-
return measured.measure(
|
|
916
|
+
// Its report made only for pairs asked, not once a Subject (#979, row 8): nearly every Retarget asks none.
|
|
917
|
+
return measured.measure(subject, pairs, values, pairsFailedOn("wardic.spine: a Retarget's Measured pairs failed", runtime, { id }));
|
|
916
918
|
};
|
|
917
919
|
/** How Measured pairs the batch couldn't take are reported under `message`, on `runtime`, each time (#979, row 8). */
|
|
918
920
|
const pairsFailedOn = (message, runtime, annotations) => (defect) => {
|
|
@@ -1056,15 +1058,15 @@ const nameSettlesOf = (names, resolution, groups, legGroups, legCount, carriedGr
|
|
|
1056
1058
|
* Solid 1's animation callbacks (#257, Motion's props): each Retarget's start and settle told to the
|
|
1057
1059
|
* config's `onAnimationStart` / `onAnimationComplete`, with its `definition`, as the Retarget read
|
|
1058
1060
|
* the config. A callback that throws is reported at the first of a run of throws, its next clean call
|
|
1059
|
-
* ending the run, and the
|
|
1061
|
+
* ending the run, and the Subject animates on. The Solid 2 binding's config has neither: it hands the
|
|
1060
1062
|
* same facts over as async values.
|
|
1061
1063
|
*/
|
|
1062
1064
|
export const animationCallbacks = (runtime, id) => {
|
|
1063
1065
|
// #979 group I, row 25 (ADR-0074 decision 3): a run is one callback's throws at its consecutive calls,
|
|
1064
|
-
// each name of a list one call, so a clean name ends it. Two lets, nothing more made per
|
|
1066
|
+
// each name of a list one call, so a clean name ends it. Two lets, nothing more made per Subject.
|
|
1065
1067
|
let startFailing = false;
|
|
1066
1068
|
let completeFailing = false;
|
|
1067
|
-
// Per Retarget, per
|
|
1069
|
+
// Per Retarget, per Subject: the callback looked up first, and nothing made without one. Whether it threw,
|
|
1068
1070
|
// reported at a run's first throw (`failing` says one is on).
|
|
1069
1071
|
const tell = (name, callback, definition, failing) => {
|
|
1070
1072
|
try {
|
|
@@ -1112,7 +1114,7 @@ export const animationCallbacks = (runtime, id) => {
|
|
|
1112
1114
|
},
|
|
1113
1115
|
};
|
|
1114
1116
|
};
|
|
1115
|
-
/** The variant name
|
|
1117
|
+
/** The variant name a Subject animates to: its own `animate`'s, else the one its provider hands down. */
|
|
1116
1118
|
const variantOf = (animate, parent) => {
|
|
1117
1119
|
if (Predicate.isNotUndefined(animate))
|
|
1118
1120
|
return VariantTree.nameOf(animate);
|
|
@@ -1147,7 +1149,7 @@ export const resolutionOf = (c, parent, initialLink, active, state, own) => {
|
|
|
1147
1149
|
// sibling's "open"); read parent.variant() here so a parent flip
|
|
1148
1150
|
// recomputes the memo and retargets;
|
|
1149
1151
|
// (3) else the SSR-seeded `initial`.
|
|
1150
|
-
// Per Retarget, per
|
|
1152
|
+
// Per Retarget, per Subject (#460, compose once): statements.
|
|
1151
1153
|
const variant = variantOf(c.animate, parent);
|
|
1152
1154
|
// A list of names (#297, Motion's `VariantLabels`): a base entry a name, in order, so the last name
|
|
1153
1155
|
// that sets a key drives it. A single name or a values map takes the path below, as before.
|
|
@@ -1157,7 +1159,7 @@ export const resolutionOf = (c, parent, initialLink, active, state, own) => {
|
|
|
1157
1159
|
const listLayers = Arr.map(targets, namedLayerOf);
|
|
1158
1160
|
return withGestures(c, parent, listLayers, merged.values, variant, active, merged.transition, state, change);
|
|
1159
1161
|
}
|
|
1160
|
-
// A dynamic variant resolves with this
|
|
1162
|
+
// A dynamic variant resolves with this Subject's own `custom` (#277), as Motion's each child's.
|
|
1161
1163
|
// Animation controls never reach here: its binding reads them once, each change its entry (#433).
|
|
1162
1164
|
const target = baseTargetOf(c.animate, variant, variants, c.custom, state, initialLink);
|
|
1163
1165
|
const base = target.values;
|
|
@@ -1165,7 +1167,7 @@ export const resolutionOf = (c, parent, initialLink, active, state, own) => {
|
|
|
1165
1167
|
// A Variant child's gestures are on while its provider's are (#291, Motion's `setActive`), each on
|
|
1166
1168
|
// its own `while*`, else the label the provider hands down. With no provider, its own: nothing made.
|
|
1167
1169
|
// The common case: nothing handed down and no gesture on. The base entry alone, and nothing else
|
|
1168
|
-
// made or called, at every
|
|
1170
|
+
// made or called, at every Subject's mount and Retarget.
|
|
1169
1171
|
if (VariantTree.handDownFrom(parent) === VariantTree.NO_HAND_DOWN && !anyOn(active)) {
|
|
1170
1172
|
const alone = [baseLayer];
|
|
1171
1173
|
const { resolved, ends, keyframes } = resolvedOf(alone);
|
|
@@ -1173,7 +1175,7 @@ export const resolutionOf = (c, parent, initialLink, active, state, own) => {
|
|
|
1173
1175
|
}
|
|
1174
1176
|
return withGestures(c, parent, [baseLayer], base, variant, active, target.transition, state, change);
|
|
1175
1177
|
};
|
|
1176
|
-
/** The **Controls change** in effect for
|
|
1178
|
+
/** The **Controls change** in effect for a Subject (#433): its own, else its provider's; per Retarget, a guard. */
|
|
1177
1179
|
const changeIn = (own, parent) => {
|
|
1178
1180
|
if (Predicate.isNotUndefined(own))
|
|
1179
1181
|
return own;
|
|
@@ -1229,14 +1231,14 @@ const withGestures = (c, parent, layers, base, variant, active, transition, stat
|
|
|
1229
1231
|
return { resolved, base, dragging: active.dragging, variant, active, transition, layers, names, layersOn, ends, keyframes, change };
|
|
1230
1232
|
};
|
|
1231
1233
|
/**
|
|
1232
|
-
*
|
|
1234
|
+
* A Subject's {@link Start}, from its config read once and the context it inherits from. With
|
|
1233
1235
|
* `initial={false}` (its own, inherited, or an `<AnimatePresence initial={false}>`'s first render)
|
|
1234
1236
|
* it starts at its `animate`, and nothing animates at mount (#134).
|
|
1235
1237
|
*/
|
|
1236
1238
|
export const startOf = (config, parent, presenceBlocks, untrack) => {
|
|
1237
1239
|
const startedAtAnimate = VariantTree.startsAtAnimate(config, parent, presenceBlocks);
|
|
1238
1240
|
// Its variants resolved once (#277), what a resolver among them threw beside them (#979): one value
|
|
1239
|
-
// for
|
|
1241
|
+
// for a Subject with no variants, so its start makes nothing more (bench:solid's mount).
|
|
1240
1242
|
const variants = VariantTarget.startingVariantsOf(config.variants, config.custom);
|
|
1241
1243
|
const initialValues = VariantTree.startingValuesFrom(config, parent, presenceBlocks, untrack, variants.variants);
|
|
1242
1244
|
return {
|
|
@@ -1251,25 +1253,25 @@ export const startOf = (config, parent, presenceBlocks, untrack) => {
|
|
|
1251
1253
|
const failedOn = (message) => (runtime) => (failure) => {
|
|
1252
1254
|
runtime.runFork(Effect.annotateLogs(Report.failure(message, Cause.die(failure.defect)), { variant: failure.name }));
|
|
1253
1255
|
};
|
|
1254
|
-
/** How
|
|
1256
|
+
/** How a Subject's variant that throws is reported, on its runtime. */
|
|
1255
1257
|
const variantFailedOn = failedOn("wardic.ward: a variant failed");
|
|
1256
|
-
/** How an exit whose resolver throws is reported, on `runtime`, each time
|
|
1258
|
+
/** How an exit whose resolver throws is reported, on `runtime`, each time a Subject leaves: its Subject leaves without it (#979). */
|
|
1257
1259
|
export const exitVariantFailedOn = failedOn("wardic.presence: an exit variant failed");
|
|
1258
|
-
/**
|
|
1260
|
+
/** A Subject's variant failure reported on Effect's default runtime: a server render's, which holds no app reporters (#979). */
|
|
1259
1261
|
export const variantFailedOnServer = /*#__PURE__*/ variantFailedOn(VariantTree.ON_SERVER);
|
|
1260
1262
|
/** The first of a list of entries' failures: built once, as it's asked per Retarget (#460, compose once). */
|
|
1261
1263
|
const firstFailureOf = Arr.findFirst((layer) => layer.failure);
|
|
1262
1264
|
/** The first of a resolution's entries' resolvers that threw, and its variant's name (#979). */
|
|
1263
1265
|
export const failureOf = (resolution) => firstFailureOf(resolution.layers);
|
|
1264
|
-
/**
|
|
1265
|
-
// #979 (bench:solid's mount): one plain object
|
|
1266
|
+
/** A Subject's {@link VariantFailures}, none failing yet, reported on `runtime`. */
|
|
1267
|
+
// #979 (bench:solid's mount): one plain object a Subject, read by the functions below, not closures, and
|
|
1266
1268
|
// holding its runtime: its report is made only at a failure. A report made once a runtime and found in a
|
|
1267
|
-
// WeakMap cost Solid 1's mount 6% (the lookup,
|
|
1269
|
+
// WeakMap cost Solid 1's mount 6% (the lookup, a Subject).
|
|
1268
1270
|
export const variantFailuresOf = (runtime) => ({ last: undefined, failing: undefined, delayFailing: false, runtime });
|
|
1269
|
-
/** Where a variant's failure was seen, until each resolves it again: its
|
|
1271
|
+
/** Where a variant's failure was seen, until each resolves it again: its Subject's resolutions, and its orchestration. */
|
|
1270
1272
|
const RESOLVING = 1;
|
|
1271
1273
|
const ORCHESTRATING = 2;
|
|
1272
|
-
// #979 (ADR-0074; Q6 and its review): a resolver's throw is its
|
|
1274
|
+
// #979 (ADR-0074; Q6 and its review): a resolver's throw is its Subject's alone. Each variant, by name,
|
|
1273
1275
|
// is reported as it starts failing and fails until every place that saw it fail resolves it again, so
|
|
1274
1276
|
// a throw its resolutions and its orchestration both see is reported once. Setup resolves with no
|
|
1275
1277
|
// values, as orchestration does, so a setup failure counts for both: a resolver that throws only with
|
|
@@ -1299,8 +1301,8 @@ const resolvedAt = (failing, name, at) => {
|
|
|
1299
1301
|
}
|
|
1300
1302
|
failing.set(name, after);
|
|
1301
1303
|
};
|
|
1302
|
-
/** `next`, else, while it carries a failure, the
|
|
1303
|
-
// Per Retarget, per
|
|
1304
|
+
/** `next`, else, while it carries a failure, the Subject's last good resolution: it keeps its target. */
|
|
1305
|
+
// Per Retarget, per Subject (#460, compose once): statements; nothing done while nothing fails.
|
|
1304
1306
|
export const keptOf = (failures, next) => {
|
|
1305
1307
|
const failure = failureOf(next);
|
|
1306
1308
|
if (Option.isSome(failure)) {
|
|
@@ -1323,7 +1325,7 @@ export const reportStart = (failures, start) => {
|
|
|
1323
1325
|
if (Option.isSome(start.failure))
|
|
1324
1326
|
failedAt(failures, start.failure.value, RESOLVING | ORCHESTRATING);
|
|
1325
1327
|
};
|
|
1326
|
-
/** What
|
|
1328
|
+
/** What a Subject's orchestration resolves, told to its failures: made by a variant node that orchestrates. */
|
|
1327
1329
|
export const orchestrationOf = (failures) => (entry, failure) => {
|
|
1328
1330
|
if (Option.isSome(failure)) {
|
|
1329
1331
|
failedAt(failures, failure.value, ORCHESTRATING);
|
|
@@ -1413,9 +1415,9 @@ export const velocitiesNowOf = (snapshot) => {
|
|
|
1413
1415
|
return Rec.map(Rec.filter(snapshot.values, Predicate.isNumber), (_, key) => velocityAt(snapshot, UndefinedOr.match(owners, { onUndefined: constUndefined, onDefined: (map) => map.get(key) }), key, now));
|
|
1414
1416
|
};
|
|
1415
1417
|
/**
|
|
1416
|
-
* The transition a Retarget runs on (#66): the
|
|
1418
|
+
* The transition a Retarget runs on (#66): the Subject's last one when the new one has the same
|
|
1417
1419
|
* fields, so core's decode cache hits when the object is rebuilt with the same values (a staggered
|
|
1418
|
-
* child's, ADR-0007, or one Solid rebuilds as it reads a signal). One per
|
|
1420
|
+
* child's, ADR-0007, or one Solid rebuilds as it reads a signal). One per Subject.
|
|
1419
1421
|
*/
|
|
1420
1422
|
export const makeReuse = () => {
|
|
1421
1423
|
let lastTransition;
|
|
@@ -1428,12 +1430,12 @@ export const makeReuse = () => {
|
|
|
1428
1430
|
};
|
|
1429
1431
|
};
|
|
1430
1432
|
/**
|
|
1431
|
-
*
|
|
1433
|
+
* A Subject's presence record (ADR-0007 exit): seeded with its Starting values, so an exit that
|
|
1432
1434
|
* fires before any frame still has a `from`, and its `exit` ref, which the ward keeps current. An exit key with no value starts
|
|
1433
1435
|
* from its Base value's start links (ADR-0022), read from the Subject kept at the exit.
|
|
1434
1436
|
*/
|
|
1435
|
-
export const presenceRecordOf = (
|
|
1436
|
-
|
|
1437
|
+
export const presenceRecordOf = (subject, start, exitOf, links, tree, snapshot, reducedMotion, skipAnimations) => ({
|
|
1438
|
+
subject,
|
|
1437
1439
|
snapshot: { current: { ...start.initialValues } },
|
|
1438
1440
|
exitOf,
|
|
1439
1441
|
tree,
|
|
@@ -1442,18 +1444,18 @@ export const presenceRecordOf = (element, start, exitOf, links, tree, snapshot,
|
|
|
1442
1444
|
velocities: () => velocitiesNowOf(snapshot),
|
|
1443
1445
|
// Its own, under its nearest WardicConfig (#434): its exit honours it, not the presence's.
|
|
1444
1446
|
reducedMotion,
|
|
1445
|
-
// Its nearest WardicConfig's (#468): an exit is skipped as its
|
|
1447
|
+
// Its nearest WardicConfig's (#468): an exit is skipped as its Subject's animations are.
|
|
1446
1448
|
skipAnimations,
|
|
1447
1449
|
});
|
|
1448
1450
|
/**
|
|
1449
1451
|
* Merge an emitted frame's value-map into a presence record's snapshot (nothing without one). It
|
|
1450
|
-
* mirrors what the gate accumulates, so an exit departs from the
|
|
1452
|
+
* mirrors what the gate accumulates, so an exit departs from the Subject's actual resting value-map.
|
|
1451
1453
|
*/
|
|
1452
1454
|
export const recordFrameOf = (presence) => (value) => {
|
|
1453
1455
|
if (Predicate.isNotUndefined(presence))
|
|
1454
1456
|
Object.assign(presence.snapshot.current, value);
|
|
1455
1457
|
};
|
|
1456
|
-
/** Tell
|
|
1458
|
+
/** Tell a Subject's Live routes the legs a Retarget starts ({@link LiveRoutes.started}): nothing for a Subject with none. */
|
|
1457
1459
|
export const tellStarted = (live, legs) => {
|
|
1458
1460
|
if (Predicate.isUndefined(live))
|
|
1459
1461
|
return;
|
|
@@ -1465,7 +1467,7 @@ let holds;
|
|
|
1465
1467
|
export const memberHoldsNow = () => holds;
|
|
1466
1468
|
/**
|
|
1467
1469
|
* Holds made from now on, through `holds` (`createBatch`, as it's called, gives a Batch's): a Batch's
|
|
1468
|
-
* members can be
|
|
1470
|
+
* members can be Wards' Subjects. The first one given stays.
|
|
1469
1471
|
*/
|
|
1470
1472
|
export const provideMemberHolds = (given) => {
|
|
1471
1473
|
if (Predicate.isNotUndefined(holds))
|
|
@@ -1473,29 +1475,20 @@ export const provideMemberHolds = (given) => {
|
|
|
1473
1475
|
holds = given;
|
|
1474
1476
|
};
|
|
1475
1477
|
/**
|
|
1476
|
-
* Each draggable
|
|
1477
|
-
*
|
|
1478
|
+
* Each draggable Subject's spine's drag hook (#665's PR 4): told `true` as its drag reads where the
|
|
1479
|
+
* Subject rests or writes `x`/`y`, and `false` as it hands them back. A Batch member's takes its
|
|
1478
1480
|
* transform from its Batch then, and gives it back.
|
|
1479
1481
|
*/
|
|
1480
|
-
// Module state (#460, Q7): held weakly by the
|
|
1482
|
+
// Module state (#460, Q7): held weakly by the Subject, so it goes with it.
|
|
1481
1483
|
const DRAG_HOOKS = new WeakMap();
|
|
1482
|
-
/** `
|
|
1483
|
-
export const tellDrag = (
|
|
1484
|
-
UndefinedOr.map(DRAG_HOOKS.get(
|
|
1484
|
+
/** `subject`'s drag hook told `on`, when its spine has one: its binding's drag start and end, and a drag's claim. */
|
|
1485
|
+
export const tellDrag = (subject, on) => {
|
|
1486
|
+
UndefinedOr.map(DRAG_HOOKS.get(subject), (tell) => tell(on));
|
|
1485
1487
|
};
|
|
1486
1488
|
/** Tell `timelineKeys` that each of `values`' keys is taken from its Live value (#240). */
|
|
1487
1489
|
const takeEach = (timelineKeys, values) => {
|
|
1488
1490
|
Arr.forEach(Rec.keys(values), (key) => timelineKeys.taken(key));
|
|
1489
1491
|
};
|
|
1490
|
-
/**
|
|
1491
|
-
* A mounted element's spine: its Retarget, the returns to its Base values, the follower of its
|
|
1492
|
-
* Live values, and its legs' lifetime. Every leg is a fiber of its provider's runtime, and joins
|
|
1493
|
-
* its Retarget's token: a Retarget ends the token before it starts its own legs, and {@link
|
|
1494
|
-
* ElementSpine.dispose} ends every leg's (#542). Both end the legs in the calling task: each leg's
|
|
1495
|
-
* run leaves the loop at once, and its fiber ends Superseded, inline (ADR-0027, decision 5,
|
|
1496
|
-
* *Amendment (#200)*). A leg the token didn't reach is interrupted (`endLeg`). The runtime's own
|
|
1497
|
-
* fiber Scope interrupts what's left when the provider ends.
|
|
1498
|
-
*/
|
|
1499
1492
|
/** Each runtime's unit scale, read once: a mount reads a WeakMap, not a run of its own. */
|
|
1500
1493
|
// Module state (#460, Q7): held weakly by the runtime, so it goes with it.
|
|
1501
1494
|
const UNIT_SCALES = new WeakMap();
|
|
@@ -1508,8 +1501,17 @@ export const unitScaleOf = (runtime) => {
|
|
|
1508
1501
|
UNIT_SCALES.set(runtime, read);
|
|
1509
1502
|
return read;
|
|
1510
1503
|
};
|
|
1511
|
-
|
|
1512
|
-
|
|
1504
|
+
/**
|
|
1505
|
+
* A mounted Subject's spine: its Retarget, the returns to its Base values, the follower of its
|
|
1506
|
+
* Live values, and its legs' lifetime. Every leg is a fiber of its provider's runtime, and joins
|
|
1507
|
+
* its Retarget's token: a Retarget ends the token before it starts its own legs, and {@link
|
|
1508
|
+
* SubjectSpine.dispose} ends every leg's (#542). Both end the legs in the calling task: each leg's
|
|
1509
|
+
* run leaves the loop at once, and its fiber ends Superseded, inline (ADR-0027, decision 5,
|
|
1510
|
+
* *Amendment (#200)*). A leg the token didn't reach is interrupted (`endLeg`). The runtime's own
|
|
1511
|
+
* fiber Scope interrupts what's left when the provider ends.
|
|
1512
|
+
*/
|
|
1513
|
+
export const makeSubjectSpine = (options) => {
|
|
1514
|
+
const { animation, byName, canStart, config, defaultTransition, diagnostics, extraDelay, gate, id, links, live, measuredPairs, onFrame, ownValues, parent, positionalKeys, presence, runtime, snapshot, start, styleNow, subject, tag, variableValues } = options;
|
|
1513
1515
|
// The Environment's unit scale (ADR-0069 decision 8, #883): read from the runtime the spine already holds,
|
|
1514
1516
|
// so no binding passes it; 1, Motion's own, unless the Environment's Layers give another.
|
|
1515
1517
|
const unitScale = unitScaleOf(runtime);
|
|
@@ -1518,9 +1520,9 @@ export const makeElementSpine = (options) => {
|
|
|
1518
1520
|
let handoff = options.handoff;
|
|
1519
1521
|
// Its mount tells nothing when it starts at its `animate` (#448): on until its first Retarget.
|
|
1520
1522
|
let quiet = start.quiet;
|
|
1521
|
-
// Its Variable values (#55, ADR-0035 *Amendment (#55)*): the Key rule bound to this
|
|
1523
|
+
// Its Variable values (#55, ADR-0035 *Amendment (#55)*): the Key rule bound to this Subject,
|
|
1522
1524
|
// added to each leg it starts, so a `var()` end blends what it resolves to here.
|
|
1523
|
-
const
|
|
1525
|
+
const subjectRules = [variableValues.values(subject)];
|
|
1524
1526
|
const recordFrame = recordFrameOf(presence);
|
|
1525
1527
|
// Whether its animations are skipped (#468): never, with nothing given.
|
|
1526
1528
|
const skipAnimations = UndefinedOr.match(options.skipAnimations, { onUndefined: () => constFalse, onDefined: identity });
|
|
@@ -1545,16 +1547,16 @@ export const makeElementSpine = (options) => {
|
|
|
1545
1547
|
const timelines = Context.getOrUndefined(services, Timelines.Timelines);
|
|
1546
1548
|
if (Predicate.isUndefined(timelines))
|
|
1547
1549
|
return undefined;
|
|
1548
|
-
timelineKeys = timelines.keysOf({ runtime, gate, id,
|
|
1550
|
+
timelineKeys = timelines.keysOf({ runtime, gate, id, subject, live: routes });
|
|
1549
1551
|
return timelineKeys;
|
|
1550
1552
|
};
|
|
1551
1553
|
// The keys a Retarget drove, each with its last target value (its shape), and the
|
|
1552
1554
|
// ones returning to their Base value until that return settles (ADR-0022). Both are
|
|
1553
1555
|
// the spine's: a Retarget mid-return carries them again, so a return is never
|
|
1554
1556
|
// frozen half-way, and a key that settled has left them, so a Retarget of the same
|
|
1555
|
-
// target (a `when` gate reopening, ADR-0007) leaves it be. On a drag
|
|
1557
|
+
// target (a `when` gate reopening, ADR-0007) leaves it be. On a drag Subject, the keys
|
|
1556
1558
|
// the drag moves leave the return while it runs, so they stay where it dropped them (C9)
|
|
1557
|
-
// until an entry sets them again; a projected
|
|
1559
|
+
// until an entry sets them again; a projected Subject's drag moves none, its projection
|
|
1558
1560
|
// target does (ADR-0016), and its own translate returns as any key does (#363).
|
|
1559
1561
|
const driven = new Map();
|
|
1560
1562
|
let returning = new Map();
|
|
@@ -1566,7 +1568,7 @@ export const makeElementSpine = (options) => {
|
|
|
1566
1568
|
return UndefinedOr.match(options.dragAxis, { onUndefined: () => NO_KEYS, onDefined: dragMovesOf });
|
|
1567
1569
|
};
|
|
1568
1570
|
// A Retarget's returns have settled (ADR-0022, D4). A key back at its `style` value is
|
|
1569
|
-
// handed back to the
|
|
1571
|
+
// handed back to the Subject's style, so a later style change shows at rest and the
|
|
1570
1572
|
// next gesture starts from it; any other key rests at its Base value where the gate drew
|
|
1571
1573
|
// it, and leaves the target. A key a later Retarget took over is left alone. A routed key (#130) stays
|
|
1572
1574
|
// in the gate, handed to the follower, which writes its value from now on.
|
|
@@ -1584,7 +1586,7 @@ export const makeElementSpine = (options) => {
|
|
|
1584
1586
|
const handedBack = Arr.filter(toStyle, Predicate.not(routedNow));
|
|
1585
1587
|
if (Arr.isReadonlyArrayEmpty(handedBack))
|
|
1586
1588
|
return;
|
|
1587
|
-
// The gate writes the user's current value back, as the
|
|
1589
|
+
// The gate writes the user's current value back, as the Subject's `style` would
|
|
1588
1590
|
// (ADR-0034). A key gone from the user's style by now is cleared, not restored stale.
|
|
1589
1591
|
const restore = UndefinedOr.map(styleNow, (now) => {
|
|
1590
1592
|
const style = now();
|
|
@@ -1608,7 +1610,7 @@ export const makeElementSpine = (options) => {
|
|
|
1608
1610
|
// The keys an Imperative animation took (#433), each with the target the Override stack had for it
|
|
1609
1611
|
// then: a Retarget leaves each where the animation leaves it while its target is still that one, and
|
|
1610
1612
|
// takes it back once it isn't, as a newer animation of Motion's value takes it (latest-wins).
|
|
1611
|
-
// Every
|
|
1613
|
+
// Every Subject reads it, nearly none sets it (#460): the shared empty one until the first key taken.
|
|
1612
1614
|
let taken = NONE_TAKEN;
|
|
1613
1615
|
// The legs that gave up a key in this Retarget: what each still draws is worked out at its end.
|
|
1614
1616
|
const losing = [];
|
|
@@ -1649,7 +1651,7 @@ export const makeElementSpine = (options) => {
|
|
|
1649
1651
|
leaveChange();
|
|
1650
1652
|
});
|
|
1651
1653
|
};
|
|
1652
|
-
// The
|
|
1654
|
+
// The Subject's waiting Transition ends (#508), made at its first: most Subjects never have one.
|
|
1653
1655
|
let waiting;
|
|
1654
1656
|
// A leg with no key left ends. Its fiber ends inline (ADR-0027, *Amendment (#200)*); one its token
|
|
1655
1657
|
// didn't reach, none of its runs on the loop, is interrupted. A Transition end it is (#508) is
|
|
@@ -1730,7 +1732,7 @@ export const makeElementSpine = (options) => {
|
|
|
1730
1732
|
giveUp(key, owner);
|
|
1731
1733
|
};
|
|
1732
1734
|
// A Path's turn goes back to 0 once no leg draws it (#460, ADR-0065 decision 3): after a Retarget
|
|
1733
|
-
// whose legs don't turn, a stop, a cancel. Most
|
|
1735
|
+
// whose legs don't turn, a stop, a cancel. Most Subjects never turn: a guard.
|
|
1734
1736
|
const turnBack = () => {
|
|
1735
1737
|
const turn = snapshot.values[PATH_ROTATION];
|
|
1736
1738
|
if (Bool.or(Predicate.isUndefined(turn), turn === 0))
|
|
@@ -1790,7 +1792,7 @@ export const makeElementSpine = (options) => {
|
|
|
1790
1792
|
});
|
|
1791
1793
|
/**
|
|
1792
1794
|
* A leg's run into its sink: one dispatcher, each sink built for the leg that needs it, a
|
|
1793
|
-
* Retarget's and an Imperative animation's (#433). A blend's machine is built under the
|
|
1795
|
+
* Retarget's and an Imperative animation's (#433). A blend's machine is built under the Subject's
|
|
1794
1796
|
* Key rules when its change holds a Variable value (`variables`, #542).
|
|
1795
1797
|
*/
|
|
1796
1798
|
const legProgram = (leg, running, variables) => {
|
|
@@ -1819,7 +1821,7 @@ export const makeElementSpine = (options) => {
|
|
|
1819
1821
|
// rather than replacing it, so the drag's direct-set x/y survive alongside the
|
|
1820
1822
|
// spring's keys (drag owns x/y, spring owns the rest) and the post-drag
|
|
1821
1823
|
// handoff continues from the rested position. Only the keys it still draws (#325).
|
|
1822
|
-
// In place, as the Follow sink writes (#659): a spread made two records per
|
|
1824
|
+
// In place, as the Follow sink writes (#659): a spread made two records per Subject per
|
|
1823
1825
|
// frame. The Snapshot's records are always its own (`snapshotOf`, `emptySnapshotOf`), and
|
|
1824
1826
|
// whatever keeps one copies it or reads it at once.
|
|
1825
1827
|
const value = running.values(frame.value);
|
|
@@ -1841,7 +1843,7 @@ export const makeElementSpine = (options) => {
|
|
|
1841
1843
|
}, running));
|
|
1842
1844
|
}
|
|
1843
1845
|
// A snap's or a blend's frames: merged into the Snapshot (ADR-0004) in place, as the spring's are
|
|
1844
|
-
// (#659; #895: a spread made a record per
|
|
1846
|
+
// (#659; #895: a spread made a record per Subject per frame). A blend's last two are kept for its keys'
|
|
1845
1847
|
// velocities (#464), copied, since its Frame is its run's, rewritten each tick (`keepFrame`).
|
|
1846
1848
|
const sink = (frame, dt) => {
|
|
1847
1849
|
const value = running.values(frame.value);
|
|
@@ -1864,7 +1866,7 @@ export const makeElementSpine = (options) => {
|
|
|
1864
1866
|
// Per leg (#460): a statement, Effect's calls data-first.
|
|
1865
1867
|
let built = Effect.suspend(leg.machine);
|
|
1866
1868
|
if (variables)
|
|
1867
|
-
built = InterpolatorRegistry.withKeyRules(built,
|
|
1869
|
+
built = InterpolatorRegistry.withKeyRules(built, subjectRules);
|
|
1868
1870
|
return Effect.flatMap(built, (machine) => Machine.run(machine, sink, running));
|
|
1869
1871
|
};
|
|
1870
1872
|
// A leg's end, told its landing: a Retarget's legs' and an Imperative animation's (#433).
|
|
@@ -1874,7 +1876,7 @@ export const makeElementSpine = (options) => {
|
|
|
1874
1876
|
// Per leg (#460): statements.
|
|
1875
1877
|
if (Exit.isSuccess(exit)) {
|
|
1876
1878
|
// A Superseded leg (#200) counts toward nothing, nor tells a name: the next Retarget's legs
|
|
1877
|
-
// land. Nothing made for it: a Retarget ends its
|
|
1879
|
+
// land. Nothing made for it: a Retarget ends its Subject's legs inline.
|
|
1878
1880
|
const end = exit.value;
|
|
1879
1881
|
if (Supersede.isSuperseded(end))
|
|
1880
1882
|
return Effect.void;
|
|
@@ -1895,7 +1897,7 @@ export const makeElementSpine = (options) => {
|
|
|
1895
1897
|
})));
|
|
1896
1898
|
};
|
|
1897
1899
|
// A gated Retarget (ADR-0007 `when`, #325): a running key it resolves to its leg's target runs on,
|
|
1898
|
-
// the
|
|
1900
|
+
// the Subject reported unsettled meanwhile, when an earlier change started that leg; every other
|
|
1899
1901
|
// running key freezes where it is. The change the gate holds may have started legs just before
|
|
1900
1902
|
// it shut (a child Retargets before its provider's effect resets its `beforeChildren` wait; an
|
|
1901
1903
|
// `afterChildren` provider starts before its children report): those freeze too, as before.
|
|
@@ -1983,7 +1985,7 @@ export const makeElementSpine = (options) => {
|
|
|
1983
1985
|
keepTheRest,
|
|
1984
1986
|
reducedMotion: options.reducedMotion,
|
|
1985
1987
|
skipAnimations,
|
|
1986
|
-
|
|
1988
|
+
subject,
|
|
1987
1989
|
positionalKeys,
|
|
1988
1990
|
defaultTransition,
|
|
1989
1991
|
unitScale,
|
|
@@ -1999,16 +2001,16 @@ export const makeElementSpine = (options) => {
|
|
|
1999
2001
|
id,
|
|
2000
2002
|
recordFrame,
|
|
2001
2003
|
runtime,
|
|
2002
|
-
|
|
2004
|
+
subjectRules,
|
|
2003
2005
|
measuredPairs,
|
|
2004
2006
|
variableValues,
|
|
2005
2007
|
};
|
|
2006
2008
|
}
|
|
2007
2009
|
return handedOver;
|
|
2008
2010
|
};
|
|
2009
|
-
// --- A Batch member's
|
|
2010
|
-
// Its hold on what it takes from its Batch: made as its
|
|
2011
|
-
// Retarget or a drag. Nearly no
|
|
2011
|
+
// --- A Batch member's Subject (#665's PR 4, ADR-0069 decision 17, Q52–Q54) -----------------------
|
|
2012
|
+
// Its hold on what it takes from its Batch: made as its Subject is first found a member's, at a
|
|
2013
|
+
// Retarget or a drag. Nearly no Subject is one: the rest pay a WeakMap read a Retarget.
|
|
2012
2014
|
let memberHold;
|
|
2013
2015
|
const holdNow = () => {
|
|
2014
2016
|
if (Predicate.isNotUndefined(memberHold))
|
|
@@ -2017,21 +2019,21 @@ export const makeElementSpine = (options) => {
|
|
|
2017
2019
|
const holds = memberHoldsNow();
|
|
2018
2020
|
if (Predicate.isUndefined(holds))
|
|
2019
2021
|
return undefined;
|
|
2020
|
-
if (!holds.isMember(
|
|
2022
|
+
if (!holds.isMember(subject))
|
|
2021
2023
|
return undefined;
|
|
2022
2024
|
memberHold = holds.make(host());
|
|
2023
2025
|
return memberHold;
|
|
2024
2026
|
};
|
|
2025
|
-
// A draggable
|
|
2027
|
+
// A draggable Subject's drag tells it as it holds `x`/`y` and hands them back: a member's hold hears.
|
|
2026
2028
|
if (Predicate.isNotUndefined(options.dragAxis)) {
|
|
2027
|
-
DRAG_HOOKS.set(
|
|
2029
|
+
DRAG_HOOKS.set(subject, (on) => {
|
|
2028
2030
|
const member = holdNow();
|
|
2029
2031
|
if (Predicate.isNotUndefined(member))
|
|
2030
2032
|
member.drag(on);
|
|
2031
2033
|
});
|
|
2032
2034
|
}
|
|
2033
2035
|
const retarget = (given) => {
|
|
2034
|
-
// A Controls change (#433): the
|
|
2036
|
+
// A Controls change (#433): the Subject is in it from the Retarget it makes it run, held or not.
|
|
2035
2037
|
if (given.change !== joined)
|
|
2036
2038
|
joinChange(given.change);
|
|
2037
2039
|
// A key an entry sets isn't its Live value's from this Retarget on, held or not: its Timeline value
|
|
@@ -2039,7 +2041,7 @@ export const makeElementSpine = (options) => {
|
|
|
2039
2041
|
if (Predicate.isNotUndefined(timelineKeys))
|
|
2040
2042
|
takeEach(timelineKeys, given.resolved);
|
|
2041
2043
|
// `when` start-gate (ADR-0007): when canStart() is false, the keys whose target changed freeze
|
|
2042
|
-
// where they are (#325: the rest run on), and the
|
|
2044
|
+
// where they are (#325: the rest run on), and the Subject waits; the binding retargets once
|
|
2043
2045
|
// the gate flips true.
|
|
2044
2046
|
if (Predicate.isNotUndefined(canStart) && !canStart()) {
|
|
2045
2047
|
hold(given);
|
|
@@ -2097,7 +2099,7 @@ export const makeElementSpine = (options) => {
|
|
|
2097
2099
|
Arr.forEach(dragMoves(), (key) => keys.taken(key));
|
|
2098
2100
|
}
|
|
2099
2101
|
returning = new Map();
|
|
2100
|
-
// Over the Map itself: copying it into an array first costs ~20 times the walk, per
|
|
2102
|
+
// Over the Map itself: copying it into an array first costs ~20 times the walk, per Subject
|
|
2101
2103
|
// per Retarget (#69's PR 4). Deleting the entry being visited is safe in a Map's iteration.
|
|
2102
2104
|
Iter.forEach(driven, ([key, like]) => {
|
|
2103
2105
|
// A translate key the strip below holds back returns once the drag lets go.
|
|
@@ -2126,13 +2128,13 @@ export const makeElementSpine = (options) => {
|
|
|
2126
2128
|
Iter.forEach(taken, ([key]) => {
|
|
2127
2129
|
delete t[key];
|
|
2128
2130
|
});
|
|
2129
|
-
// A Batch member's
|
|
2131
|
+
// A Batch member's Subject (#665's PR 4, Q53): a group it moves is taken from its Batch first, and a
|
|
2130
2132
|
// key it'd leave where the Batch draws it stays the Batch's. A drag takes `x` and `y`.
|
|
2131
2133
|
const member = holdNow();
|
|
2132
2134
|
if (Predicate.isNotUndefined(member))
|
|
2133
2135
|
member.retarget(t, held);
|
|
2134
2136
|
// The keys this Retarget returns; once it lands, a key back at its `style` value is
|
|
2135
|
-
// handed back to the
|
|
2137
|
+
// handed back to the Subject's style (D4) and the rest rest where the gate drew them.
|
|
2136
2138
|
const returns = [...returning];
|
|
2137
2139
|
// The transition, read at Retarget time so a change applies to the next Retarget. A child
|
|
2138
2140
|
// with no local transition inherits the parent context's (ADR-0007).
|
|
@@ -2155,7 +2157,7 @@ export const makeElementSpine = (options) => {
|
|
|
2155
2157
|
return;
|
|
2156
2158
|
settleReturns(returns);
|
|
2157
2159
|
// The Retarget settled with its last leg (#257): told once the gate has flushed its last frame,
|
|
2158
|
-
// so the
|
|
2160
|
+
// so the Subject shows where it landed. Its Controls change hears it then too (#433).
|
|
2159
2161
|
if (Predicate.isNotUndefined(animation))
|
|
2160
2162
|
gate.afterFlush(() => animation.settled(resolution, previous, c));
|
|
2161
2163
|
leaveAfterFlush();
|
|
@@ -2184,7 +2186,7 @@ export const makeElementSpine = (options) => {
|
|
|
2184
2186
|
return tellFailed(error);
|
|
2185
2187
|
failedEarly = { error };
|
|
2186
2188
|
};
|
|
2187
|
-
// The
|
|
2189
|
+
// The Subject settles with its last leg (ADR-0024, D5): a string leg can outlast the
|
|
2188
2190
|
// numeric one, so each leg's frames report, and only the last leg's settle reports done.
|
|
2189
2191
|
let reporting = 0;
|
|
2190
2192
|
let settled = 0;
|
|
@@ -2198,9 +2200,9 @@ export const makeElementSpine = (options) => {
|
|
|
2198
2200
|
current = landing;
|
|
2199
2201
|
// The Retarget's transitions, read before its keys: a key already there asks its own for a
|
|
2200
2202
|
// velocity (#448).
|
|
2201
|
-
const
|
|
2203
|
+
const wardTransition = VariantTree.ownOrInherited(c.transition, parent);
|
|
2202
2204
|
// The base target's own transition (#277): the keys its entry drives animate on it.
|
|
2203
|
-
const baseTransition = VariantTarget.transitionOfTarget(resolution.transition,
|
|
2205
|
+
const baseTransition = VariantTarget.transitionOfTarget(resolution.transition, wardTransition);
|
|
2204
2206
|
// Fold the per-child stagger delay (ADR-0007) into the effective
|
|
2205
2207
|
// transition.delay = base.delay + computedDelay. extraDelay() is read
|
|
2206
2208
|
// at Retarget time so a re-snapshot before this start is reflected. Each name's keys take that
|
|
@@ -2209,11 +2211,11 @@ export const makeElementSpine = (options) => {
|
|
|
2209
2211
|
const extra = extraOf(extraDelay, layers[0]);
|
|
2210
2212
|
const transition = staggeredOf(baseTransition, extra, options.reuse);
|
|
2211
2213
|
// With an entry's own transition (#277, #291), each key animates on its entry's: the base's keys
|
|
2212
|
-
// on the base target's, each active gesture's on its target's, else the
|
|
2214
|
+
// on the base target's, each active gesture's on its target's, else the Subject's, as Motion's
|
|
2213
2215
|
// each animation type runs on its own.
|
|
2214
2216
|
// A list's names (#297) split them too, each name's at its own delay; a list's returns run on the
|
|
2215
|
-
//
|
|
2216
|
-
// Guards, not matches: per Retarget, per
|
|
2217
|
+
// Subject's transition, in a group of their own, last.
|
|
2218
|
+
// Guards, not matches: per Retarget, per Subject. A list's work (#297) is done apart, for a list:
|
|
2217
2219
|
// the Retarget's other calls keep their inlining (docs/agents/effect-first.md).
|
|
2218
2220
|
const listed = Arr.isArray(resolution.variant);
|
|
2219
2221
|
// A list's names each wait for their own `when` (#297's PR 2): the entries whose gate is shut now.
|
|
@@ -2231,7 +2233,7 @@ export const makeElementSpine = (options) => {
|
|
|
2231
2233
|
// target (no motion).
|
|
2232
2234
|
//
|
|
2233
2235
|
// Every key's Own value is read first, at its first need, before anything writes it, so a return
|
|
2234
|
-
// later finds the
|
|
2236
|
+
// later finds the Subject's value, not Wardic's (ADR-0022, D3). The read is kept: a later need is
|
|
2235
2237
|
// a lookup. A transform key reads nothing.
|
|
2236
2238
|
let stays;
|
|
2237
2239
|
let carried;
|
|
@@ -2296,7 +2298,7 @@ export const makeElementSpine = (options) => {
|
|
|
2296
2298
|
// Its transition asked last, for a key already there alone: per key, per Retarget. A quiet
|
|
2297
2299
|
// mount's never asks (#475): Motion animates nothing at a first render that starts at its
|
|
2298
2300
|
// `animate`, whatever velocity its transition gives (`animation-state.ts`, `shouldAnimate`).
|
|
2299
|
-
if (still && Predicate.isUndefined(stops) && (quiet || !RetargetLegs.givesVelocity(keyTransitionOf(resolution, groups, key, transition,
|
|
2301
|
+
if (still && Predicate.isUndefined(stops) && (quiet || !RetargetLegs.givesVelocity(keyTransitionOf(resolution, groups, key, transition, wardTransition), key))) {
|
|
2300
2302
|
if (Predicate.isUndefined(stays))
|
|
2301
2303
|
stays = new Set();
|
|
2302
2304
|
stays.add(key);
|
|
@@ -2321,7 +2323,7 @@ export const makeElementSpine = (options) => {
|
|
|
2321
2323
|
owners.forEach(giveUpUnresolved);
|
|
2322
2324
|
keepTheRest();
|
|
2323
2325
|
// A key only `initial` sets stays where it put it (#1022), as Motion keeps it: at the first Retarget, one
|
|
2324
|
-
// the resolved target doesn't name joins the keys already there, written with them as the
|
|
2326
|
+
// the resolved target doesn't name joins the keys already there, written with them as the Subject's first
|
|
2325
2327
|
// commit takes its Starting style off. The gate keeps it after; a later layer that sets it returns it as
|
|
2326
2328
|
// any. A Batch member's are its Batch's, which draws its groups.
|
|
2327
2329
|
if (Predicate.isUndefined(lastResolution)) {
|
|
@@ -2402,7 +2404,7 @@ export const makeElementSpine = (options) => {
|
|
|
2402
2404
|
// The legs (#48, ADR-0044 decision 8): one pure builder, which a server render's Appear
|
|
2403
2405
|
// animation samples too, so the two can't drift. Built here; each leg's machine is built
|
|
2404
2406
|
// in its own fiber, so a transition core rejects (#66, ADR-0025 *Amendment (#66)*) fails
|
|
2405
|
-
// that leg alone, reported as any leg's failure is, while the
|
|
2407
|
+
// that leg alone, reported as any leg's failure is, while the Subject's other legs run on.
|
|
2406
2408
|
// The returns to a moving Live value (#130, ADR-0043 decision 6): a number's follows it,
|
|
2407
2409
|
// in a leg of its own, and lands on it; the rest return to where it is now. Looked for
|
|
2408
2410
|
// only when this Retarget returns a key.
|
|
@@ -2417,7 +2419,7 @@ export const makeElementSpine = (options) => {
|
|
|
2417
2419
|
// animation is skipped (#468): the keys found above, and those Keyframes of two stops start from their first.
|
|
2418
2420
|
let measured;
|
|
2419
2421
|
if (!reduce && !skipped && (Predicate.isNotUndefined(measuring) || Predicate.isNotUndefined(keyframesNow))) {
|
|
2420
|
-
measured = measuredOf(measuredPairs,
|
|
2422
|
+
measured = measuredOf(measuredPairs, subject, measuringOf(measuring, keyframesNow), from, fresh, snapshot.values, manyStops, runtime, id);
|
|
2421
2423
|
}
|
|
2422
2424
|
let told;
|
|
2423
2425
|
if (!silent)
|
|
@@ -2432,7 +2434,7 @@ export const makeElementSpine = (options) => {
|
|
|
2432
2434
|
retargetLegs = RetargetLegs.legsOf(from, fresh, transition, reduce, skipped, positionalKeys, defaultTransition, readVelocity, follow, manyStops, measured, snapshot.values, rests, unitScale);
|
|
2433
2435
|
}
|
|
2434
2436
|
if (Predicate.isNotUndefined(groups)) {
|
|
2435
|
-
const split = splitLegsOf(fresh, from, groups, resolution, listed, transition,
|
|
2437
|
+
const split = splitLegsOf(fresh, from, groups, resolution, listed, transition, wardTransition, extraDelay, options.reuse, reduce, skipped, positionalKeys, defaultTransition, readVelocity, follow, manyStops, measured, snapshot.values, rests, unitScale);
|
|
2436
2438
|
retargetLegs = split.legs;
|
|
2437
2439
|
legGroups = split.tags;
|
|
2438
2440
|
}
|
|
@@ -2484,9 +2486,9 @@ export const makeElementSpine = (options) => {
|
|
|
2484
2486
|
}
|
|
2485
2487
|
// Its Live routes hear the legs it starts (#443, PR4-Q1).
|
|
2486
2488
|
tellStarted(live, retargetLegs);
|
|
2487
|
-
// The
|
|
2489
|
+
// The Subject's Key rules only for a change a Variable value is in (#542).
|
|
2488
2490
|
const variables = holdsVariable(variableValues, from, fresh, manyStops);
|
|
2489
|
-
// Each leg into its sink, in the builder's order (#69's PR 2: a Retarget is per
|
|
2491
|
+
// Each leg into its sink, in the builder's order (#69's PR 2: a Retarget is per Subject). Each
|
|
2490
2492
|
// leg draws the keys it animates (#325) until a later Retarget takes them.
|
|
2491
2493
|
Arr.forEach(retargetLegs, (leg, i) => {
|
|
2492
2494
|
if (Predicate.isNotUndefined(legGates))
|
|
@@ -2554,7 +2556,7 @@ export const makeElementSpine = (options) => {
|
|
|
2554
2556
|
// A turn none of its legs draws now goes back (#460).
|
|
2555
2557
|
turnBack();
|
|
2556
2558
|
// The keys already there (#448), written with each key the Retarget moves at where it starts, as
|
|
2557
|
-
// its leg's first frame writes it: the
|
|
2559
|
+
// its leg's first frame writes it: the Subject's first commit, which takes its Starting style off,
|
|
2558
2560
|
// holds every key, whatever frame the legs first draw in (a gated name's draws later).
|
|
2559
2561
|
if (Predicate.isNotUndefined(there)) {
|
|
2560
2562
|
const written = { ...from, ...there };
|
|
@@ -2562,7 +2564,7 @@ export const makeElementSpine = (options) => {
|
|
|
2562
2564
|
recordFrame(written);
|
|
2563
2565
|
}
|
|
2564
2566
|
// The Retarget started, its legs on their way (#257); with none, its own or carried, it landed
|
|
2565
|
-
// at once (#325): its returns settle, and the
|
|
2567
|
+
// at once (#325): its returns settle, and the Subject reports settled at the gate's next flush,
|
|
2566
2568
|
// after the effects that start its orchestration's wait (ADR-0007).
|
|
2567
2569
|
previous = lastResolution;
|
|
2568
2570
|
lastResolution = resolution;
|
|
@@ -2596,7 +2598,7 @@ export const makeElementSpine = (options) => {
|
|
|
2596
2598
|
};
|
|
2597
2599
|
// --- Live values in `style` (#130, ADR-0043) ------------------------------
|
|
2598
2600
|
// A routed key (a Live value, or a transform key) is its `style` link, live: while no entry of
|
|
2599
|
-
// the Override stack sets it, no return is running to it and no drag moves it, the
|
|
2601
|
+
// the Override stack sets it, no return is running to it and no drag moves it, the Subject
|
|
2600
2602
|
// follows it, written through the gate on every change. A return hands it back here when it
|
|
2601
2603
|
// settles (`settleReturns`). The Starting style showed each one's value at render; from mount
|
|
2602
2604
|
// the gate holds them.
|
|
@@ -2604,7 +2606,7 @@ export const makeElementSpine = (options) => {
|
|
|
2604
2606
|
if (Predicate.isUndefined(live))
|
|
2605
2607
|
return;
|
|
2606
2608
|
const routes = live;
|
|
2607
|
-
// Built at the first routed key, at mount or later:
|
|
2609
|
+
// Built at the first routed key, at mount or later: a Subject whose `style` routes none builds nothing.
|
|
2608
2610
|
routes.whenRouted(() => {
|
|
2609
2611
|
// Read at each ask: `projected` is a getter while the track waits for `drag` (#551, #582).
|
|
2610
2612
|
const dragHolds = () => Bool.and(Bool.not(options.projected), Predicate.isNotUndefined(options.dragAxis));
|
|
@@ -2626,7 +2628,7 @@ export const makeElementSpine = (options) => {
|
|
|
2626
2628
|
gate.write(id, values);
|
|
2627
2629
|
recordFrame(values);
|
|
2628
2630
|
};
|
|
2629
|
-
// The
|
|
2631
|
+
// The Subject shows `key`'s Live value now: its Timeline value runs, when it has one (#240).
|
|
2630
2632
|
const shown = (key) => {
|
|
2631
2633
|
const keys = timelineKeysNow(routes);
|
|
2632
2634
|
if (Predicate.isNotUndefined(keys))
|
|
@@ -2664,7 +2666,7 @@ export const makeElementSpine = (options) => {
|
|
|
2664
2666
|
delete snapshot.velocities[key];
|
|
2665
2667
|
if (Predicate.isNotUndefined(presence))
|
|
2666
2668
|
delete presence.snapshot.current[key];
|
|
2667
|
-
// Gone from `style`: the
|
|
2669
|
+
// Gone from `style`: the Subject's own value comes back, or none, its Environment's default now.
|
|
2668
2670
|
const restore = Option.match(ownValues.styleValueOf(UndefinedOr.match(styleNow, { onUndefined: constUndefined, onDefined: (style) => style() }), key), {
|
|
2669
2671
|
onNone: () => "",
|
|
2670
2672
|
onSome: String,
|
|
@@ -2698,8 +2700,8 @@ export const makeElementSpine = (options) => {
|
|
|
2698
2700
|
memberHold.dispose();
|
|
2699
2701
|
};
|
|
2700
2702
|
// A child back under its key (#286): its values and velocities from where the leaver is drawn, a
|
|
2701
|
-
// projected
|
|
2702
|
-
//
|
|
2703
|
+
// projected Subject's own translate among them (#363). Drawn at the end of the task, so nothing
|
|
2704
|
+
// draws the Subject at its `initial` first: not in the mount effect it's called in, where the
|
|
2703
2705
|
// first commit's Starting-style switch would flush Solid 2 inside an effect.
|
|
2704
2706
|
const seed = (from) => {
|
|
2705
2707
|
const values = from.values;
|
|
@@ -2736,7 +2738,7 @@ export const makeElementSpine = (options) => {
|
|
|
2736
2738
|
* one at mount; `sink` as it is otherwise. `config` reads it untracked.
|
|
2737
2739
|
*/
|
|
2738
2740
|
export const withOnUpdate = (sink, atMount, config) => {
|
|
2739
|
-
// Per
|
|
2741
|
+
// Per Subject at mount: most have none, and pay a check.
|
|
2740
2742
|
if (Predicate.isUndefined(atMount))
|
|
2741
2743
|
return sink;
|
|
2742
2744
|
return {
|
|
@@ -2750,8 +2752,8 @@ export const withOnUpdate = (sink, atMount, config) => {
|
|
|
2750
2752
|
};
|
|
2751
2753
|
/**
|
|
2752
2754
|
* A Retarget's note of the keys it started from their Base value, or returned to it (ADR-0022): run at
|
|
2753
|
-
* the head of its first leg, cold path (no fiber of its own: forking one per
|
|
2754
|
-
* at a 1000-
|
|
2755
|
+
* the head of its first leg, cold path (no fiber of its own: forking one per Subject cost 10-20 µs each
|
|
2756
|
+
* at a 1000-Subject mount).
|
|
2755
2757
|
*/
|
|
2756
2758
|
export const baseLog = (id, started, returns) => Effect.logDebug("wardic.base: a key with no value started from, or returned to, its Base value (ADR-0022)").pipe(Effect.annotateLogs({ id, started, returned: Object.fromEntries(returns) }));
|
|
2757
2759
|
/** The keys a Retarget returns to a Live value that's a number: each one's return follows it (#130). */
|
|
@@ -2766,9 +2768,9 @@ const liveTargetOf = (ownValues, routes, key, start) => {
|
|
|
2766
2768
|
return last;
|
|
2767
2769
|
};
|
|
2768
2770
|
};
|
|
2769
|
-
/** Whether a value is one
|
|
2771
|
+
/** Whether a value is one a Subject can take: a number or a string. */
|
|
2770
2772
|
const isValue = (value) => Bool.or(Predicate.isNumber(value), Predicate.isString(value));
|
|
2771
|
-
/** A provider runtime's `AtomRegistry`, read on first need:
|
|
2773
|
+
/** A provider runtime's `AtomRegistry`, read on first need: a Subject with no Atom never reads it. */
|
|
2772
2774
|
export const registryOf = (runtime) => {
|
|
2773
2775
|
let registry;
|
|
2774
2776
|
return () => {
|
|
@@ -2777,7 +2779,7 @@ export const registryOf = (runtime) => {
|
|
|
2777
2779
|
return registry;
|
|
2778
2780
|
};
|
|
2779
2781
|
};
|
|
2780
|
-
/** Whether a config makes its
|
|
2782
|
+
/** Whether a config makes its Subject a layout node: `layout` (or a mode), or a `layoutId`. */
|
|
2781
2783
|
export const isLayoutNode = (c) => Bool.or(Bool.and(Predicate.isNotUndefined(c.layout), c.layout !== false), Predicate.isNotUndefined(c.layoutId));
|
|
2782
2784
|
/** A mount animation's template field (#443): left out with none, as its key reads it. */
|
|
2783
2785
|
export const templateField = (template) => UndefinedOr.match(template, { onUndefined: () => ({}), onDefined: (t) => ({ template: t }) });
|