@wardic/core 1.1.0 → 1.1.2
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/unstable/AnimationControls.d.ts +110 -0
- package/dist/unstable/AnimationControls.d.ts.map +1 -0
- package/dist/unstable/AnimationControls.js +107 -0
- package/dist/unstable/AnimationControls.js.map +1 -0
- package/dist/unstable/AppearHandoff.d.ts +53 -0
- package/dist/unstable/AppearHandoff.d.ts.map +1 -0
- package/dist/unstable/AppearHandoff.js +23 -0
- package/dist/unstable/AppearHandoff.js.map +1 -0
- package/dist/unstable/Config.d.ts +285 -0
- package/dist/unstable/Config.d.ts.map +1 -0
- package/dist/unstable/Config.js +3 -0
- package/dist/unstable/Config.js.map +1 -0
- package/dist/unstable/FlushGate.d.ts +222 -0
- package/dist/unstable/FlushGate.d.ts.map +1 -0
- package/dist/unstable/FlushGate.js +567 -0
- package/dist/unstable/FlushGate.js.map +1 -0
- package/dist/unstable/FrameTime.d.ts +21 -0
- package/dist/unstable/FrameTime.d.ts.map +1 -0
- package/dist/unstable/FrameTime.js +45 -0
- package/dist/unstable/FrameTime.js.map +1 -0
- package/dist/unstable/MeasuredPairs.d.ts +51 -0
- package/dist/unstable/MeasuredPairs.d.ts.map +1 -0
- package/dist/unstable/MeasuredPairs.js +20 -0
- package/dist/unstable/MeasuredPairs.js.map +1 -0
- package/dist/unstable/OwnValues.d.ts +29 -0
- package/dist/unstable/OwnValues.d.ts.map +1 -0
- package/dist/unstable/OwnValues.js +22 -0
- package/dist/unstable/OwnValues.js.map +1 -0
- package/dist/unstable/PresenceRecord.d.ts +176 -0
- package/dist/unstable/PresenceRecord.d.ts.map +1 -0
- package/dist/unstable/PresenceRecord.js +26 -0
- package/dist/unstable/PresenceRecord.js.map +1 -0
- package/dist/unstable/Reactivity.d.ts +29 -0
- package/dist/unstable/Reactivity.d.ts.map +1 -0
- package/dist/unstable/Reactivity.js +15 -0
- package/dist/unstable/Reactivity.js.map +1 -0
- package/dist/unstable/Report.d.ts +30 -0
- package/dist/unstable/Report.d.ts.map +1 -0
- package/dist/unstable/Report.js +66 -0
- package/dist/unstable/Report.js.map +1 -0
- package/dist/unstable/RetargetLegs.d.ts +189 -0
- package/dist/unstable/RetargetLegs.d.ts.map +1 -0
- package/dist/unstable/RetargetLegs.js +834 -0
- package/dist/unstable/RetargetLegs.js.map +1 -0
- package/dist/unstable/Spine.d.ts +696 -0
- package/dist/unstable/Spine.d.ts.map +1 -0
- package/dist/unstable/Spine.js +2617 -0
- package/dist/unstable/Spine.js.map +1 -0
- package/dist/unstable/Stops.d.ts +82 -0
- package/dist/unstable/Stops.d.ts.map +1 -0
- package/dist/unstable/Stops.js +149 -0
- package/dist/unstable/Stops.js.map +1 -0
- package/dist/unstable/Subject.d.ts +11 -0
- package/dist/unstable/Subject.d.ts.map +1 -0
- package/dist/unstable/Subject.js +12 -0
- package/dist/unstable/Subject.js.map +1 -0
- package/dist/unstable/Timelines.d.ts +51 -0
- package/dist/unstable/Timelines.d.ts.map +1 -0
- package/dist/unstable/Timelines.js +10 -0
- package/dist/unstable/Timelines.js.map +1 -0
- package/dist/unstable/VariableValues.d.ts +27 -0
- package/dist/unstable/VariableValues.d.ts.map +1 -0
- package/dist/unstable/VariableValues.js +19 -0
- package/dist/unstable/VariableValues.js.map +1 -0
- package/dist/unstable/VariantTarget.d.ts +106 -0
- package/dist/unstable/VariantTarget.d.ts.map +1 -0
- package/dist/unstable/VariantTarget.js +185 -0
- package/dist/unstable/VariantTarget.js.map +1 -0
- package/dist/unstable/VariantTree.d.ts +351 -0
- package/dist/unstable/VariantTree.d.ts.map +1 -0
- package/dist/unstable/VariantTree.js +362 -0
- package/dist/unstable/VariantTree.js.map +1 -0
- package/dist/unstable/WardicConfigValue.d.ts +89 -0
- package/dist/unstable/WardicConfigValue.d.ts.map +1 -0
- package/dist/unstable/WardicConfigValue.js +106 -0
- package/dist/unstable/WardicConfigValue.js.map +1 -0
- package/dist/unstable/WardicServices.d.ts +46 -0
- package/dist/unstable/WardicServices.d.ts.map +1 -0
- package/dist/unstable/WardicServices.js +72 -0
- package/dist/unstable/WardicServices.js.map +1 -0
- package/package.json +1 -1
- package/src/unstable/AnimationControls.ts +199 -0
- package/src/unstable/AppearHandoff.ts +81 -0
- package/src/unstable/Config.ts +326 -0
- package/src/unstable/FlushGate.ts +730 -0
- package/src/unstable/FrameTime.ts +52 -0
- package/src/unstable/MeasuredPairs.ts +56 -0
- package/src/unstable/OwnValues.ts +32 -0
- package/src/unstable/PresenceRecord.ts +202 -0
- package/src/unstable/Reactivity.ts +35 -0
- package/src/unstable/Report.ts +75 -0
- package/src/unstable/RetargetLegs.ts +1062 -0
- package/src/unstable/Spine.ts +3275 -0
- package/src/unstable/Stops.ts +221 -0
- package/src/unstable/Subject.ts +13 -0
- package/src/unstable/Timelines.ts +58 -0
- package/src/unstable/VariableValues.ts +27 -0
- package/src/unstable/VariantTarget.ts +246 -0
- package/src/unstable/VariantTree.ts +643 -0
- package/src/unstable/WardicConfigValue.ts +154 -0
- package/src/unstable/WardicServices.ts +125 -0
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The motion spine's Retarget (ADR-0005), on every binding: what an element does from its mount on
|
|
3
|
+
* when its target changes. A binding mounts the element, resolves its Override stack reactively
|
|
4
|
+
* ({@link resolutionOf}), and calls {@link ElementSpine.retarget} on each change, read where its
|
|
5
|
+
* reactivity doesn't track; everything a Retarget does is here:
|
|
6
|
+
*
|
|
7
|
+
* end the running legs -> carry the keys no entry sets back to their Base values (ADR-0022) ->
|
|
8
|
+
* start each key from its Snapshot (ADR-0024) -> take over an Appear animation (ADR-0044) ->
|
|
9
|
+
* build the legs (`RetargetLegs`) and run each into the gate -> `gate.write`.
|
|
10
|
+
*
|
|
11
|
+
* With it, the helpers both bindings' Wards share: the Starting values, the Base values' start links,
|
|
12
|
+
* the sink wrappers, and what a server render reads.
|
|
13
|
+
*
|
|
14
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as BaseValue from "../BaseValue.ts";
|
|
19
|
+
import type * as DefaultTransition from "../DefaultTransition.ts";
|
|
20
|
+
import * as Frame from "../Frame.ts";
|
|
21
|
+
import * as InterpolatorRegistry from "../InterpolatorRegistry.ts";
|
|
22
|
+
import * as Machine from "../Machine.ts";
|
|
23
|
+
import type * as ReducedMotion from "../ReducedMotion.ts";
|
|
24
|
+
import * as Values from "../Values.ts";
|
|
25
|
+
import type * as MeasuredPairs from "./MeasuredPairs.ts";
|
|
26
|
+
import type * as OwnValues from "./OwnValues.ts";
|
|
27
|
+
import type * as VariableValues from "./VariableValues.ts";
|
|
28
|
+
import type * as Stops from "./Stops.ts";
|
|
29
|
+
import type * as Subject from "./Subject.ts";
|
|
30
|
+
import type * as FlushGate from "./FlushGate.ts";
|
|
31
|
+
import * as Cause from "effect/Cause";
|
|
32
|
+
import * as Context from "effect/Context";
|
|
33
|
+
import * as Effect from "effect/Effect";
|
|
34
|
+
import * as Exit from "effect/Exit";
|
|
35
|
+
import * as Fiber from "effect/Fiber";
|
|
36
|
+
import * as Option from "effect/Option";
|
|
37
|
+
import type * as Atom from "effect/reactivity/Atom";
|
|
38
|
+
import * as AtomRegistry from "effect/reactivity/AtomRegistry";
|
|
39
|
+
import * as AppearHandoff from "./AppearHandoff.ts";
|
|
40
|
+
import type * as Config from "./Config.ts";
|
|
41
|
+
import * as AnimationControls from "./AnimationControls.ts";
|
|
42
|
+
import * as PresenceRecord from "./PresenceRecord.ts";
|
|
43
|
+
import type * as Reactivity from "./Reactivity.ts";
|
|
44
|
+
import * as RetargetLegs from "./RetargetLegs.ts";
|
|
45
|
+
import type * as WardicServices from "./WardicServices.ts";
|
|
46
|
+
import * as Timelines from "./Timelines.ts";
|
|
47
|
+
import * as VariantTree from "./VariantTree.ts";
|
|
48
|
+
import * as VariantTarget from "./VariantTarget.ts";
|
|
49
|
+
export { NO_VARIANT_STATE, resolveTarget, type Target, transitionOfTarget, type VariantState } from "./VariantTarget.ts";
|
|
50
|
+
/** What an element's exit is resolved from (#277): its last config, kept current while it's alive. */
|
|
51
|
+
export interface ExitConfig {
|
|
52
|
+
readonly exit: Config.WardicVariant | Config.WardicVariantLabels | undefined;
|
|
53
|
+
readonly variants: Config.WardicVariants | undefined;
|
|
54
|
+
readonly custom: unknown;
|
|
55
|
+
/** Its `transition`, or the one it inherits. */
|
|
56
|
+
readonly transition: Config.WardicTransition | undefined;
|
|
57
|
+
}
|
|
58
|
+
/** No exit: an element outside a presence never resolves one. */
|
|
59
|
+
export declare const NO_EXIT_CONFIG: ExitConfig;
|
|
60
|
+
/** A record's place in the variant tree (#290), from its config at setup. */
|
|
61
|
+
export declare const presenceTreeOf: (c: Config.SpineConfig) => PresenceRecord.PresenceTree;
|
|
62
|
+
/**
|
|
63
|
+
* An element'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 element.
|
|
65
|
+
*/
|
|
66
|
+
export declare const madeWith: <E extends Subject.Subject>(presence: PresenceRecord.PresenceContextValue<E> | undefined, set: (el: E) => void, c: Config.SpineConfig) => ((el: E) => void);
|
|
67
|
+
/** An element's {@link ExitConfig} from its config now. */
|
|
68
|
+
export declare const exitConfigOf: (c: Config.SpineConfig, parent: VariantTree.WardicVariantContextValue | undefined) => ExitConfig;
|
|
69
|
+
/** An exit resolved (#277): its values, and the transition it runs on. */
|
|
70
|
+
export type ExitTarget = PresenceRecord.PresenceExit;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve an element's exit as it leaves (#277): with its `<AnimatePresence custom>` when that's
|
|
73
|
+
* given (Motion's: the leaving element's own props can't change any more), else its own `custom`; on
|
|
74
|
+
* its own transition, else the element's.
|
|
75
|
+
*/
|
|
76
|
+
export declare const exitTargetOf: (config: ExitConfig, presenceCustom: unknown, state: VariantTarget.VariantState, inherited: Config.WardicVariantLabels | undefined) => ExitTarget;
|
|
77
|
+
/** 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. */
|
|
78
|
+
export declare const accessorOf: <A extends object>(config: A | Reactivity.Accessor<A>) => Reactivity.Accessor<A>;
|
|
79
|
+
/** A transition's `delay`, 0 without one. */
|
|
80
|
+
export declare const delayOf: (transition: Config.WardicTransition | undefined) => number;
|
|
81
|
+
/** The Override stack resolved: a Retarget's input. */
|
|
82
|
+
export interface Resolution {
|
|
83
|
+
/** Each key's value from the highest active entry. */
|
|
84
|
+
readonly resolved: Values.Values;
|
|
85
|
+
/** The base entry, the first link of a key's Base value (ADR-0022). */
|
|
86
|
+
readonly base: Values.Values;
|
|
87
|
+
/** Whether a drag holds the translate keys (ADR-0004's strip). */
|
|
88
|
+
readonly dragging: boolean;
|
|
89
|
+
/** The variant name (or list, #297) the base entry resolved: its own `animate`'s, else the one it inherits; none for a values map. */
|
|
90
|
+
readonly variant: Config.WardicVariantLabels | undefined;
|
|
91
|
+
/** The entries it was resolved with (#257): a landing's gestures are the ones its Retarget started with. */
|
|
92
|
+
readonly active: Active;
|
|
93
|
+
/** The base target's own transition (#277): the keys the base entry drives animate on it. */
|
|
94
|
+
readonly transition: Config.WardicVariantTransition | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* The Override stack's entries (#291): the base, then each gesture's, lowest first. A Retarget runs
|
|
97
|
+
* each key on the own transition of the highest active entry that sets it.
|
|
98
|
+
*/
|
|
99
|
+
readonly layers: ReadonlyArray<OverrideEntry>;
|
|
100
|
+
/** The names its active gesture layers resolved (#291): its own `while*` names, else those it took. */
|
|
101
|
+
readonly names: VariantTree.GestureNames;
|
|
102
|
+
/**
|
|
103
|
+
* Which gesture layers are on and set values or a Transition end (#470); a named one is in `names`.
|
|
104
|
+
* One turning on or off is a new target, whatever it resolves, as a Motion type turning active
|
|
105
|
+
* animates (`animation-state.ts`).
|
|
106
|
+
*/
|
|
107
|
+
readonly layersOn: VariantTree.GestureStates;
|
|
108
|
+
/** Its entries' **Transition ends** (#428), when any active one has one. */
|
|
109
|
+
readonly ends: Ends | undefined;
|
|
110
|
+
/** Each key's **Keyframes**, as the entry that drives it gives them (#429), when any active entry has some. */
|
|
111
|
+
readonly keyframes: KeyframesNow | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The **Controls change** in effect (#433): its own controls' latest, else the one its provider is
|
|
114
|
+
* in, for a Variant child. A new one is a Retarget, whatever it resolves to.
|
|
115
|
+
*/
|
|
116
|
+
readonly change: AnimationControls.ControlsChange | undefined;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A key's **Keyframes** as a Retarget resolves them (#429): their stops, and the entry that drives the
|
|
120
|
+
* key, by its place in the Override stack and the variant name it resolved. Two are the same when all
|
|
121
|
+
* three are, Motion's rule for when Keyframes play again (`animation-state.ts`): an equal list, stop by
|
|
122
|
+
* stop, that a re-render makes runs on, where new stops, another entry driving the key (a hover over it
|
|
123
|
+
* ending) or a new name for its entry (`variantDidChange`) plays them again from their first stop.
|
|
124
|
+
*/
|
|
125
|
+
export interface KeyframesAt {
|
|
126
|
+
readonly stops: Stops.Stops;
|
|
127
|
+
readonly layer: number;
|
|
128
|
+
readonly name: string | undefined;
|
|
129
|
+
}
|
|
130
|
+
/** Each key's {@link KeyframesAt}. */
|
|
131
|
+
export type KeyframesNow = Readonly<Record<string, KeyframesAt>>;
|
|
132
|
+
/**
|
|
133
|
+
* A resolution's **Transition ends** (#428): each key only an entry's Transition end sets, with the
|
|
134
|
+
* entry that drives it (the highest active one that sets it, as for any key), and each entry's end
|
|
135
|
+
* values for the keys it drives, a key it also animates among them.
|
|
136
|
+
*/
|
|
137
|
+
export interface Ends {
|
|
138
|
+
readonly endOnly: ReadonlyMap<string, number>;
|
|
139
|
+
readonly byLayer: ReadonlyArray<Values.Values | undefined>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* One entry of the Override stack (#291): whether it's on, its values, its target's own transition,
|
|
143
|
+
* and the variant name it resolved (#297), `undefined` for a values map. A list of names is an entry
|
|
144
|
+
* a name, in order.
|
|
145
|
+
*/
|
|
146
|
+
export interface OverrideEntry {
|
|
147
|
+
readonly active: boolean;
|
|
148
|
+
readonly values: Values.Values;
|
|
149
|
+
readonly transition: Config.WardicVariantTransition | undefined;
|
|
150
|
+
readonly name: string | undefined;
|
|
151
|
+
/** Its target's **Transition end** (#428): its keys are the entry's, set once its animated keys land. */
|
|
152
|
+
readonly ends: Values.Values;
|
|
153
|
+
/** Its target's **Keyframes** (#429): each such key's stops, its value in `values` their last. */
|
|
154
|
+
readonly keyframes: VariantTarget.Keyframes | undefined;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Where a Retarget's legs land (#257, #325): what each running leg's frames and end are told to.
|
|
158
|
+
* The last Retarget's, which every running leg counts toward, the ones it carried included.
|
|
159
|
+
*/
|
|
160
|
+
export interface Landing {
|
|
161
|
+
/** A leg drew a frame: its last, when `done`. */
|
|
162
|
+
readonly report: (done: boolean) => void;
|
|
163
|
+
/** A leg settled. */
|
|
164
|
+
readonly settled: () => void;
|
|
165
|
+
/** A leg failed (#257 item 4). */
|
|
166
|
+
readonly failed: (cause: Cause.Cause<unknown>) => void;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A running leg (#325): the keys it draws, each with the target its Retarget resolved, and the
|
|
170
|
+
* landing its frames and end count toward. It's its machines' run options, with its own token
|
|
171
|
+
* (#200): a later Retarget that resolves a key to the same target leaves the leg that key, every
|
|
172
|
+
* other key is given up, and a leg left with none is ended.
|
|
173
|
+
*/
|
|
174
|
+
export interface Running extends Machine.RunOptions {
|
|
175
|
+
/** Each key it animates, with the target its Retarget gave it. */
|
|
176
|
+
readonly targets: Values.Values;
|
|
177
|
+
/** The resolution of the Retarget that started it: a `when` gate holds that change's legs. */
|
|
178
|
+
readonly resolution: Resolution;
|
|
179
|
+
/** How many of its keys it still draws. */
|
|
180
|
+
count: number;
|
|
181
|
+
/** A frame's values for the keys it still draws: the frame's own while it draws all of them. */
|
|
182
|
+
values: (value: Values.Values) => Values.Values;
|
|
183
|
+
/** It drew its last frame: its keys landed. */
|
|
184
|
+
done: boolean;
|
|
185
|
+
/** It gave up a key in this Retarget: what it still draws is worked out at the Retarget's end. */
|
|
186
|
+
losing: boolean;
|
|
187
|
+
fiber: Fiber.Fiber<void> | undefined;
|
|
188
|
+
/** The landing it counts toward: its Retarget's, then the one of each Retarget that carried it. */
|
|
189
|
+
landing: Landing;
|
|
190
|
+
/** A list's names its end is told to (#297), for the Retarget it counts toward. */
|
|
191
|
+
names: ((end: unknown) => void) | undefined;
|
|
192
|
+
/** Its kind (#464): a Blend leg's keys' velocities are its frames', a Snap's none, the rest write their own. */
|
|
193
|
+
readonly kind: RetargetLegs.Leg["_tag"];
|
|
194
|
+
/** The frames it has drawn (#464). */
|
|
195
|
+
frames: number;
|
|
196
|
+
/** When it drew its last frame, on {@link FrameTime.frameNow}'s clock; -Infinity before its first (#464). */
|
|
197
|
+
lastAt: number;
|
|
198
|
+
/** A Blend leg's last frame's values, and the ones before them (the Snapshot's, before its first) and when (#464). */
|
|
199
|
+
last: Values.Values | undefined;
|
|
200
|
+
before: Values.Values | undefined;
|
|
201
|
+
beforeAt: number;
|
|
202
|
+
/**
|
|
203
|
+
* A Numbers leg's last Frame (#663): its keys' velocities are read from it when one is asked for, as
|
|
204
|
+
* a Blend leg's are from its frames, by index from a spring's. None before its first frame.
|
|
205
|
+
*/
|
|
206
|
+
physics: Frame.MultiPhysics | undefined;
|
|
207
|
+
}
|
|
208
|
+
/** No running legs. */
|
|
209
|
+
export declare const NO_RUNNING: ReadonlyArray<Running>;
|
|
210
|
+
/** No values: what a spine's Retarget keys are before its first. */
|
|
211
|
+
export declare const NO_VALUES: Values.Values;
|
|
212
|
+
/**
|
|
213
|
+
* Whether a change's starts, targets or Keyframes stops hold a Variable value (#542): only then can
|
|
214
|
+
* the element's Key rule, its Variable values (#55), take a pair, so only then is a leg's machine
|
|
215
|
+
* built under it. It declines every pair with no `var()` at either end.
|
|
216
|
+
*/
|
|
217
|
+
export declare const holdsVariable: (variables: VariableValues.Shape, from: Values.Values, to: Values.Values, stops: RetargetLegs.StopsByKey | undefined) => boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Each key's Leg (#325): the one that draws it, or the last one that did, landed; `undefined` once
|
|
220
|
+
* none does. A key's entry is cleared in place, never deleted: a Retarget that gives up and restarts
|
|
221
|
+
* every key would otherwise leave the Map a hole a key each time, and rehash it.
|
|
222
|
+
*/
|
|
223
|
+
export type Owners = Map<string, Running | undefined>;
|
|
224
|
+
/** A leg over the keys of `to` (#325), counting toward `landing`: the spine gives it the keys. */
|
|
225
|
+
export declare const runningOf: (to: Values.Values, resolution: Resolution, landing: Landing, kind: RetargetLegs.Leg["_tag"]) => Running;
|
|
226
|
+
/**
|
|
227
|
+
* Where a Path's axes that `target` leaves out rest (#574), read before their legs give them up: a
|
|
228
|
+
* new Path ends them there, so a toss caught mid-air curves back to its line. `undefined` for none:
|
|
229
|
+
* every element's Retarget asks, nearly always with no Path in flight, so guards, nothing built.
|
|
230
|
+
*/
|
|
231
|
+
export declare const restsOf: (owners: Owners, target: Values.Values) => Values.Values | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* Whether two resolutions are the same target (#209, #470): the same values for the same keys, in
|
|
234
|
+
* the base entry and resolved, the same drag, the same variant name, Keyframes and Transition ends,
|
|
235
|
+
* and the same gesture layers on, with the same names. Motion's rule: a config that resolves to the
|
|
236
|
+
* same values doesn't animate (a `transition` change applies from the next change), and a new
|
|
237
|
+
* variant name does, even to the same values, as a gesture turning on or off does. Both bindings'
|
|
238
|
+
* target memos compare with it, so a `style`, `transition` or callback change doesn't Retarget.
|
|
239
|
+
*/
|
|
240
|
+
export declare const sameResolution: (a: Resolution, b: Resolution) => boolean;
|
|
241
|
+
/**
|
|
242
|
+
* A Retarget's Measured pairs (#430): each of `keys` whose start and target are one, asked of the
|
|
243
|
+
* end-of-task batch with the values the element draws now, but a key with Keyframes of more than two
|
|
244
|
+
* stops (`many`, #460). `undefined` with none.
|
|
245
|
+
*/
|
|
246
|
+
export declare const measuredOf: (measured: MeasuredPairs.Shape, element: Subject.Subject, keys: ReadonlyArray<string>, from: Values.Values, to: Values.Values, values: Values.Values, many: RetargetLegs.StopsByKey | undefined) => RetargetLegs.MeasuredPairs | undefined;
|
|
247
|
+
/** Whether a key's Keyframes are the same (#429, {@link KeyframesAt}): its stops, its entry and that entry's name. */
|
|
248
|
+
export declare const sameKeyframesAt: (a: KeyframesAt | undefined, b: KeyframesAt | undefined) => boolean;
|
|
249
|
+
/** Motion's `definition` of an animation (#257): a variant name, or its target values. */
|
|
250
|
+
export type AnimationDefinition = Config.WardicVariantLabels | Values.Values;
|
|
251
|
+
/**
|
|
252
|
+
* A Retarget's `definition`, as Motion's `onAnimationStart` / `onAnimationComplete` hand it over
|
|
253
|
+
* (#257): the variant name its base entry resolved, when that name differs from the last started
|
|
254
|
+
* Retarget's (`previous`), else the target's values. Motion's definition is per animation type: a
|
|
255
|
+
* new `animate` variant animates as its name, and a gesture turning on or off as values (its own,
|
|
256
|
+
* or the keys it leaves falling back), so a variant's name is only told when the variant changed.
|
|
257
|
+
*/
|
|
258
|
+
export declare const definitionOf: (resolution: Resolution, previous: Resolution | undefined) => AnimationDefinition;
|
|
259
|
+
/**
|
|
260
|
+
* What a Retarget tells its binding (#257): that it started, and that its last leg settled. Each is
|
|
261
|
+
* handed the Retarget's resolution, the variant name the last started Retarget resolved before it
|
|
262
|
+
* (for {@link definitionOf}), and the config it read.
|
|
263
|
+
*/
|
|
264
|
+
export interface AnimationHooks {
|
|
265
|
+
/** A Retarget started its legs (the `when` gate let it); with no leg, it settles at once. */
|
|
266
|
+
readonly started: (resolution: Resolution, previous: Resolution | undefined, config: Config.SpineConfig) => void;
|
|
267
|
+
/** That Retarget's last leg settled: not for one the next Retarget superseded, nor one a leg's failure cut off. */
|
|
268
|
+
readonly settled: (resolution: Resolution, previous: Resolution | undefined, config: Config.SpineConfig) => void;
|
|
269
|
+
/**
|
|
270
|
+
* A leg of that Retarget failed (#257 item 4): it can't land. Told once a Retarget, at once (a
|
|
271
|
+
* leg that fails before it writes leaves no flush to wait for), and never before `started`; the
|
|
272
|
+
* failure is logged and reported apart (ADR-0030).
|
|
273
|
+
*/
|
|
274
|
+
readonly failed?: ((resolution: Resolution, error: unknown) => void) | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* Names of a list that settled (#297): a binding told each name's end on its own (Solid 1's
|
|
277
|
+
* callbacks, Motion's `animateVariant` a name) has it, called as the legs of the keys each drives
|
|
278
|
+
* settle; one with none hears the list's end through `settled` alone.
|
|
279
|
+
*/
|
|
280
|
+
readonly namesSettled?: ((names: ReadonlyArray<string>, config: Config.SpineConfig) => void) | undefined;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Solid 1's animation callbacks (#257, Motion's props): each Retarget's start and settle told to the
|
|
284
|
+
* config's `onAnimationStart` / `onAnimationComplete`, with its `definition`, as the Retarget read
|
|
285
|
+
* the config. A callback that throws is reported, and the element animates on. The Solid 2 binding's
|
|
286
|
+
* config has neither: it hands the same facts over as async values.
|
|
287
|
+
*/
|
|
288
|
+
export declare const animationCallbacks: (runtime: WardicServices.Runner<WardicServices.WardicServices>, id: string) => AnimationHooks;
|
|
289
|
+
/** Which entries of the Override stack are active now, as the binding reads them. */
|
|
290
|
+
export interface Active {
|
|
291
|
+
/** In view (#273): `whileInView` applies. */
|
|
292
|
+
readonly inView: boolean;
|
|
293
|
+
/** Focused, as the Environment shows it (`:focus-visible`, #273): `whileFocus` applies. */
|
|
294
|
+
readonly focused: boolean;
|
|
295
|
+
readonly hovered: boolean;
|
|
296
|
+
readonly pressed: boolean;
|
|
297
|
+
/** A drag, or a **Keyboard reorder**'s lift (ADR-0037): `whileDrag` applies. */
|
|
298
|
+
readonly dragged: boolean;
|
|
299
|
+
/** A drag: the translate keys are the drag's (ADR-0004). */
|
|
300
|
+
readonly dragging: boolean;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The Override stack resolved (ascending priority, Motion's `variantPriorityOrder`): base (animate, or
|
|
304
|
+
* initial when no animate) -> whileInView -> whileFocus -> whileHover -> whileTap -> whileDrag (#273
|
|
305
|
+
* added the first two). `Override.resolve` picks the last active entry per key. Pure:
|
|
306
|
+
* a binding computes it in a memo, so a config change, an inherited variant name's
|
|
307
|
+
* (`parent.variant()`, read only when there's no `animate`) or an entry's drives a Retarget.
|
|
308
|
+
*/
|
|
309
|
+
export declare const resolutionOf: (c: Config.SpineConfig, parent: VariantTree.WardicVariantContextValue | undefined, initialLink: Values.Values, active: Active, state: VariantTarget.VariantState, own?: AnimationControls.ControlsChange | undefined) => Resolution;
|
|
310
|
+
/** The values an element starts from, read once at setup (ADR-0003, #134). */
|
|
311
|
+
export interface Start {
|
|
312
|
+
/** Its Starting style's values: its `initial` (own or inherited, #50), or its `animate` when it starts there. */
|
|
313
|
+
readonly initialValues: Values.Values;
|
|
314
|
+
/** Its `initial` link in the Base-value chain and its fallback base entry: none when it started at `animate`. */
|
|
315
|
+
readonly initialLink: Values.Values;
|
|
316
|
+
/** When it started at `animate`, those values, which come after `style` (Motion's `baseTarget`, ADR-0022). */
|
|
317
|
+
readonly startedLink: Values.Values;
|
|
318
|
+
/**
|
|
319
|
+
* Whether its mount tells nothing (#448, Motion's `animation-state.ts`): it starts at its `animate`
|
|
320
|
+
* (`initial={false}`, or an `<AnimatePresence initial={false}>`'s first render), or its `initial` is
|
|
321
|
+
* the same name, list or values map as its `animate`, each its own or inherited. Its first Retarget,
|
|
322
|
+
* landing with nothing to animate, is told to no one.
|
|
323
|
+
*/
|
|
324
|
+
readonly quiet: boolean;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* An element's {@link Start}, from its config read once and the context it inherits from. With
|
|
328
|
+
* `initial={false}` (its own, inherited, or an `<AnimatePresence initial={false}>`'s first render)
|
|
329
|
+
* it starts at its `animate`, and nothing animates at mount (#134).
|
|
330
|
+
*/
|
|
331
|
+
export declare const startOf: (config: Config.SpineConfig, parent: VariantTree.WardicVariantContextValue | undefined, presenceBlocks: boolean, untrack: Reactivity.Reactivity["untrack"]) => Start;
|
|
332
|
+
/**
|
|
333
|
+
* The Snapshot: each key's last emitted value, a number or a string, and the numeric velocities.
|
|
334
|
+
* A Retarget starts each key from where it is, with its velocity carried across the seam (ADR-0005,
|
|
335
|
+
* ADR-0024). Plain, not reactive; a drag writes its `x`/`y` into it too (ADR-0004).
|
|
336
|
+
*/
|
|
337
|
+
export interface Snapshot {
|
|
338
|
+
values: Values.Values;
|
|
339
|
+
/**
|
|
340
|
+
* Each numeric key's velocity (#464, Motion's): a spring's own, a drag's pointer's, or, for a key a
|
|
341
|
+
* leg let go, the one its last two frames gave it. Read through the spine, which takes a running
|
|
342
|
+
* leg's and reads one drawn more than `MAX_VELOCITY_DELTA` ago as 0.
|
|
343
|
+
*/
|
|
344
|
+
velocities: Record<string, number>;
|
|
345
|
+
/**
|
|
346
|
+
* When each key's velocity here was last drawn, on {@link FrameTime.frameNow}'s clock (#464): the last frame of
|
|
347
|
+
* the leg that let it go, or a drag's or a presence seed's setting.
|
|
348
|
+
*/
|
|
349
|
+
drawnAt: Record<string, number>;
|
|
350
|
+
/** The leg drawing each key, its spine's (#464): a running leg's velocity is read from it. None before its spine runs. */
|
|
351
|
+
owners: ReadonlyMap<string, Running | undefined> | undefined;
|
|
352
|
+
/** The time now, its provider's Clock's once its spine runs (#460, Q7), {@link FrameTime.frameNow} before. */
|
|
353
|
+
now: () => number;
|
|
354
|
+
/**
|
|
355
|
+
* Every numeric key's velocity now (#663), given the Snapshot: {@link velocitiesNowOf}, one function
|
|
356
|
+
* every Snapshot shares. A resolver and Animation controls read these: `velocities` doesn't hold a
|
|
357
|
+
* spring leg's. A method, so a Snapshot is a resolver's `VariantState`.
|
|
358
|
+
*/
|
|
359
|
+
velocitiesNow(snapshot: Snapshot): Readonly<Record<string, number>>;
|
|
360
|
+
}
|
|
361
|
+
/** A Snapshot seeded from the Starting values, velocities 0, so frame 1 flows out of the seed (no snap). */
|
|
362
|
+
export declare const snapshotOf: (start: Start) => Snapshot;
|
|
363
|
+
/** A Snapshot of `values`, nothing moving: read as it is until a spine reads it. */
|
|
364
|
+
export declare const emptySnapshotOf: (values: Values.Values) => Snapshot;
|
|
365
|
+
/**
|
|
366
|
+
* `key`'s velocity at `now` (#464, Motion's `getVelocity`): the leg drawing it, once it has drawn a
|
|
367
|
+
* frame, else what the Snapshot holds for it (the last leg to let it go left it, a drag or a seed set
|
|
368
|
+
* it), whichever drew it last; 0 once nothing has moved it for `MAX_VELOCITY_DELTA`. Read only for a
|
|
369
|
+
* key a spring or a follow starts, or one a leg lets go: guards, nothing made.
|
|
370
|
+
*/
|
|
371
|
+
export declare const velocityAt: (snapshot: Snapshot, owner: Running | undefined, key: string, now: number) => number;
|
|
372
|
+
/** Every numeric key's velocity now (#464): a presence's exit and takeover read it (#286). */
|
|
373
|
+
export declare const velocitiesNowOf: (snapshot: Snapshot) => Readonly<Record<string, number>>;
|
|
374
|
+
/**
|
|
375
|
+
* The transition a Retarget runs on (#66): the element's last one when the new one has the same
|
|
376
|
+
* fields, so core's decode cache hits when the object is rebuilt with the same values (a staggered
|
|
377
|
+
* child's, ADR-0007, or one Solid rebuilds as it reads a signal). One per element.
|
|
378
|
+
*/
|
|
379
|
+
export declare const makeReuse: () => ((transition: Config.WardicTransition) => Config.WardicTransition);
|
|
380
|
+
/**
|
|
381
|
+
* A mounted element's Base-value links (ADR-0022), as its binding reads them: its Own value per key,
|
|
382
|
+
* the links for a key's start coerced to the shape of its target (`like`), and that start.
|
|
383
|
+
*/
|
|
384
|
+
export interface StartLinks {
|
|
385
|
+
readonly ownValue: BaseValue.ValueLookup;
|
|
386
|
+
readonly linksFor: (like: number | string) => Pick<BaseValue.BaseSources, "style" | "own">;
|
|
387
|
+
readonly startLinkOf: (key: string, like: number | string) => Option.Option<BaseValue.BaseValue>;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* An element's presence record (ADR-0007 exit): seeded with its Starting values, so an exit that
|
|
391
|
+
* fires before any frame still has a `from`, and its `exit` ref, which the ward keeps current. An exit key with no value starts
|
|
392
|
+
* from its Base value's start links (ADR-0022), read from the Subject kept at the exit.
|
|
393
|
+
*/
|
|
394
|
+
export declare const presenceRecordOf: <E extends Subject.Subject>(element: E, start: Start, exitOf: (custom: unknown, inherited: Config.WardicVariantLabels | undefined) => ExitTarget, links: StartLinks, tree: PresenceRecord.PresenceTree, snapshot: Snapshot, reducedMotion: () => boolean, skipAnimations: () => boolean) => PresenceRecord.PresenceRecord<E>;
|
|
395
|
+
/**
|
|
396
|
+
* Merge an emitted frame's value-map into a presence record's snapshot (nothing without one). It
|
|
397
|
+
* mirrors what the gate accumulates, so an exit departs from the element's actual resting value-map.
|
|
398
|
+
*/
|
|
399
|
+
export declare const recordFrameOf: (presence: PresenceRecord.PresenceRecord | undefined) => ((value: Values.Values) => void);
|
|
400
|
+
/** Tell an element's Live routes the legs a Retarget starts ({@link LiveRoutes.started}): nothing for an element with none. */
|
|
401
|
+
export declare const tellStarted: (live: LiveRoutes | undefined, legs: ReadonlyArray<RetargetLegs.Leg>) => void;
|
|
402
|
+
/** What a Batch member's hold reads of what its element's spine hands over (#746). */
|
|
403
|
+
export type HoldHost = Pick<SpineHost, "element" | "gate" | "id" | "snapshot" | "owners" | "giveUp" | "keepTheRest" | "driven" | "returning">;
|
|
404
|
+
/**
|
|
405
|
+
* A Batch member's element's hold on the groups it takes from its Batch: its transform, or its opacity,
|
|
406
|
+
* taken as a leg on a key of it starts or a drag moves it, and given back as its last leg on it ends, or
|
|
407
|
+
* at its Batch's next change of it.
|
|
408
|
+
*/
|
|
409
|
+
export interface MemberHold {
|
|
410
|
+
/**
|
|
411
|
+
* A Retarget's target `t` against the Batch (Q53): a group a key of it moves (its target other than
|
|
412
|
+
* what's drawn) is taken; a key it'd leave where the Batch draws it stays the Batch's, out of `t`. A
|
|
413
|
+
* drag holding `x`/`y` takes the transform.
|
|
414
|
+
*/
|
|
415
|
+
readonly retarget: (t: Record<string, unknown>, dragged: boolean) => void;
|
|
416
|
+
/** A leg landed: each group no leg runs on any more goes back to the Batch (Q54), from where it is. */
|
|
417
|
+
readonly settle: () => void;
|
|
418
|
+
/** Its drag reads or writes `x`/`y` (`true`): it takes the transform; or hands them back (`false`). */
|
|
419
|
+
readonly drag: (on: boolean) => void;
|
|
420
|
+
/** Its element unmounted: every group back to the Batch. */
|
|
421
|
+
readonly dispose: () => void;
|
|
422
|
+
}
|
|
423
|
+
/** How a spine finds its element a Batch member's, and makes its hold. */
|
|
424
|
+
export interface MemberHolds {
|
|
425
|
+
readonly isMember: (element: Subject.Subject) => boolean;
|
|
426
|
+
readonly make: (host: HoldHost) => MemberHold;
|
|
427
|
+
}
|
|
428
|
+
/** What a spine makes its member hold with: `undefined` while no Batch has been made. */
|
|
429
|
+
export declare const memberHoldsNow: () => MemberHolds | undefined;
|
|
430
|
+
/**
|
|
431
|
+
* Holds made from now on, through `holds` (`createBatch`, as it's called, gives a Batch's): a Batch's
|
|
432
|
+
* members can be Wardic elements. The first one given stays.
|
|
433
|
+
*/
|
|
434
|
+
export declare const provideMemberHolds: (given: MemberHolds) => void;
|
|
435
|
+
/** `element`'s drag hook told `on`, when its spine has one: its binding's drag start and end, and a drag's claim. */
|
|
436
|
+
export declare const tellDrag: (element: Subject.Subject, on: boolean) => void;
|
|
437
|
+
/**
|
|
438
|
+
* What a spine calls of its element's Live values routed through its binding's props (#130, ADR-0043):
|
|
439
|
+
* the routed keys' values now, and each one's change and removal as they come; and the legs each
|
|
440
|
+
* Retarget starts, which its binding's routes may act on (`@wardic/dom`'s readies its element for them, #443).
|
|
441
|
+
*/
|
|
442
|
+
export interface LiveRoutes {
|
|
443
|
+
readonly values: () => Values.Values;
|
|
444
|
+
readonly routes: (key: string) => boolean;
|
|
445
|
+
readonly valueOf: (key: string) => Option.Option<unknown>;
|
|
446
|
+
readonly isLive: (key: string) => boolean;
|
|
447
|
+
readonly atomOf: (key: string) => Atom.Atom<unknown> | undefined;
|
|
448
|
+
readonly started: (legs: ReadonlyArray<RetargetLegs.Leg>) => void;
|
|
449
|
+
readonly whenRouted: (setup: () => LiveFollower) => void;
|
|
450
|
+
readonly stop: () => void;
|
|
451
|
+
}
|
|
452
|
+
/** What a spine follows its routed keys with: each one's change, and its removal. */
|
|
453
|
+
export interface LiveFollower {
|
|
454
|
+
readonly change: (key: string, value: unknown) => void;
|
|
455
|
+
readonly removed: (key: string) => void;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* What a spine calls of its element's drag: a new target for `x` or `y` takes over a free drag's
|
|
459
|
+
* release in flight (#340). Its binding's drag track gives it.
|
|
460
|
+
*/
|
|
461
|
+
export interface SpineDrag {
|
|
462
|
+
readonly takeRelease: (retargeted: {
|
|
463
|
+
readonly x: boolean;
|
|
464
|
+
readonly y: boolean;
|
|
465
|
+
}) => boolean;
|
|
466
|
+
}
|
|
467
|
+
/** What {@link makeElementSpine} reads. */
|
|
468
|
+
export interface ElementSpineOptions {
|
|
469
|
+
/** The provider runtime the legs fork on. */
|
|
470
|
+
readonly runtime: WardicServices.Runner<WardicServices.WardicServices>;
|
|
471
|
+
/** The provider-owned flush gate (ADR-0006). */
|
|
472
|
+
readonly gate: FlushGate.Shape;
|
|
473
|
+
/** The element's gate id. */
|
|
474
|
+
readonly id: string;
|
|
475
|
+
/** The mounted element. */
|
|
476
|
+
readonly element: Subject.Subject;
|
|
477
|
+
/** Its tag, for a Handoff's check (its Environment routes some keys by it): `undefined` when it isn't known. */
|
|
478
|
+
readonly tag: string | undefined;
|
|
479
|
+
/** Its config now, read where the binding doesn't track. */
|
|
480
|
+
readonly config: () => Config.SpineConfig;
|
|
481
|
+
/** The variant context it inherits names and its default transition from (`variant-tree.ts`). */
|
|
482
|
+
readonly parent: VariantTree.WardicVariantContextValue | undefined;
|
|
483
|
+
/** Whether a Retarget may start now (ADR-0007 `when`); omitted, always. */
|
|
484
|
+
readonly canStart: (() => boolean) | undefined;
|
|
485
|
+
/** Its stagger delay in seconds, read at each Retarget (ADR-0007); omitted, none. */
|
|
486
|
+
readonly extraDelay: ((name: string | undefined) => number) | undefined;
|
|
487
|
+
/** Told every frame whether it has settled (ADR-0007 orchestration). */
|
|
488
|
+
readonly onFrame: ((done: boolean) => void) | undefined;
|
|
489
|
+
/** Whether reduced motion applies (ADR-0029), read at each Retarget. */
|
|
490
|
+
readonly reducedMotion: () => boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Whether its animations are skipped (#468, its nearest `WardicConfig`'s `skipAnimations`), read at
|
|
493
|
+
* each Retarget and each Imperative animation: every key lands at its end on the next tick. Omitted, never.
|
|
494
|
+
*/
|
|
495
|
+
readonly skipAnimations?: (() => boolean) | undefined;
|
|
496
|
+
/** Which keys reduced motion Snaps (ADR-0036). */
|
|
497
|
+
readonly positionalKeys: ReducedMotion.PositionalKeys["Service"];
|
|
498
|
+
/** What a key with no transition of its own runs on (ADR-0051). */
|
|
499
|
+
readonly defaultTransition: DefaultTransition.DefaultTransition["Service"];
|
|
500
|
+
/** The Environment's reads of its Subjects' own values (#672), read once by its provider. */
|
|
501
|
+
readonly ownValues: OwnValues.Shape;
|
|
502
|
+
/** The Environment's Measured pairs (#430, #672), read once by its provider. */
|
|
503
|
+
readonly measuredPairs: MeasuredPairs.Shape;
|
|
504
|
+
/** The Environment's Variable values (#55, #672), read once by its provider. */
|
|
505
|
+
readonly variableValues: VariableValues.Shape;
|
|
506
|
+
readonly start: Start;
|
|
507
|
+
readonly snapshot: Snapshot;
|
|
508
|
+
readonly reuse: (transition: Config.WardicTransition) => Config.WardicTransition;
|
|
509
|
+
readonly links: StartLinks;
|
|
510
|
+
/** The user's style now, read untracked: a key's `style` link (ADR-0022). */
|
|
511
|
+
readonly styleNow: (() => object | string | undefined) | undefined;
|
|
512
|
+
/** Its routed `style` keys (#130, ADR-0043). */
|
|
513
|
+
readonly live: LiveRoutes | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Every Feature its provider has built so far, whichever section asked: where its Timeline values
|
|
516
|
+
* are found (#240), once a `createScroll` has brought the `scroll` Feature. Omitted, it has none.
|
|
517
|
+
*/
|
|
518
|
+
readonly builtFeatures?: (() => Context.Context<never>) | undefined;
|
|
519
|
+
/** Its presence record, under an `<AnimatePresence>`. */
|
|
520
|
+
readonly presence: PresenceRecord.PresenceRecord | undefined;
|
|
521
|
+
/**
|
|
522
|
+
* Whether a projection node owns its translate keys (ADR-0016): its drag drives its layout node. A
|
|
523
|
+
* getter while its track waits for `drag` (#551, #582), so it's read where it's used.
|
|
524
|
+
*/
|
|
525
|
+
readonly projected: boolean;
|
|
526
|
+
/** Its drag axis, `undefined` without a drag (ADR-0004). */
|
|
527
|
+
readonly dragAxis: boolean | "x" | "y" | undefined;
|
|
528
|
+
/** Its drag track, whose release a Retarget may take `x`/`y` from (#340); omitted, the drag holds them while `dragging`. */
|
|
529
|
+
readonly drag?: SpineDrag | undefined;
|
|
530
|
+
/** Its Appear animation, while hydrating (#48, ADR-0044 decision 6). */
|
|
531
|
+
readonly handoff: AppearHandoff.Handoff | undefined;
|
|
532
|
+
/** Told each Retarget's start and settle (#257); omitted, nothing is told. */
|
|
533
|
+
readonly animation?: AnimationHooks | undefined;
|
|
534
|
+
/**
|
|
535
|
+
* A list's names orchestrated each on their own (#297's PR 2): a name's keys start once its gate
|
|
536
|
+
* opens, and its starts and settles are told. Omitted for an element that joins nothing and
|
|
537
|
+
* provides nothing.
|
|
538
|
+
*/
|
|
539
|
+
readonly byName?: VariantTree.NameOrchestration | undefined;
|
|
540
|
+
/**
|
|
541
|
+
* Development's diagnostics (#746, ADR-0067 *Amendment (#746)*, decision 6): each binding gives
|
|
542
|
+
* its own under its development flag alone, so a production build ships none of their
|
|
543
|
+
* code. The spine names no flag, as core, where the lift takes it (#672), has none. Omitted, nothing
|
|
544
|
+
* is noted.
|
|
545
|
+
*/
|
|
546
|
+
readonly diagnostics?: SpineDiagnostics | undefined;
|
|
547
|
+
}
|
|
548
|
+
/** What notes, in development, what an app may want to know but that changes nothing it draws (#746). */
|
|
549
|
+
export interface SpineDiagnostics {
|
|
550
|
+
/** Note, once, a Handoff whose Appear animation the server sampled from another mount animation than the client's. */
|
|
551
|
+
readonly checkHandoff: (runtime: WardicServices.Runner<WardicServices.WardicServices>, id: string, handoff: AppearHandoff.Handoff, mount: AppearHandoff.MountAnimation) => void;
|
|
552
|
+
/** The log of a Retarget that started a key from its Base value, or returned one: run by the Retarget at its first leg. */
|
|
553
|
+
readonly baseLog: (id: string, started: Record<string, string>, returns: ReadonlyArray<readonly [string, BaseValue.BaseSource]>) => Effect.Effect<void>;
|
|
554
|
+
}
|
|
555
|
+
/** What the follower reads of the element's Override stack and drag, untracked. */
|
|
556
|
+
export interface FollowNow {
|
|
557
|
+
readonly resolved: () => Values.Values;
|
|
558
|
+
readonly dragging: () => boolean;
|
|
559
|
+
}
|
|
560
|
+
/** What an **Imperative animation** tells of its legs on one element (#433). */
|
|
561
|
+
export interface ImperativeHooks {
|
|
562
|
+
/** Every leg it started on the element landed, told after the gate's flush of their last frames. */
|
|
563
|
+
readonly settled: () => void;
|
|
564
|
+
/** A leg failed, reported already (ADR-0030). */
|
|
565
|
+
readonly failed: (cause: Cause.Cause<unknown>) => void;
|
|
566
|
+
}
|
|
567
|
+
/** An **Imperative animation** on one element (#433): its legs, built at the call, run through its Playhead. */
|
|
568
|
+
export interface ImperativeTrack {
|
|
569
|
+
/** Run every leg from the Playhead's time: those running end first, so a seek starts them again there. */
|
|
570
|
+
readonly run: () => void;
|
|
571
|
+
/** End every leg where it is: its keys stay there, the animation's. */
|
|
572
|
+
readonly stop: () => void;
|
|
573
|
+
/** End every leg, and put its keys back where it started them. */
|
|
574
|
+
readonly cancel: () => void;
|
|
575
|
+
/** How long its longest leg runs, in seconds (`Machine.durationOf`, Motion's `duration`). */
|
|
576
|
+
readonly duration: () => number;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* What an element's spine hands over (#746, ADR-0067 *Amendment (#746)*): its state and its leg
|
|
580
|
+
* machinery, read live, for the two that work on it from outside, `imperative.ts`, which builds an
|
|
581
|
+
* **Imperative animation**'s track, and `member-hold.ts`, a Batch member's hold. An app with neither
|
|
582
|
+
* ships neither's code. Made at the first call, once a spine.
|
|
583
|
+
*/
|
|
584
|
+
export interface SpineHost {
|
|
585
|
+
/** The resolution of the last Retarget, whose targets a taken key is noted with. */
|
|
586
|
+
readonly lastResolution: () => Resolution | undefined;
|
|
587
|
+
/** The element's values, velocities and owners. */
|
|
588
|
+
readonly snapshot: Snapshot;
|
|
589
|
+
/** Each key's running leg. */
|
|
590
|
+
readonly owners: Owners;
|
|
591
|
+
/** Start a take: velocities read from now, and the map the keys an Imperative animation takes go in. */
|
|
592
|
+
readonly taking: () => Map<string, number | string | undefined>;
|
|
593
|
+
/** The keys a Retarget returns, which a take stops returning. */
|
|
594
|
+
readonly returning: () => Map<string, BaseValue.BaseSource>;
|
|
595
|
+
/** The keys a Retarget drove, each with its last target value. */
|
|
596
|
+
readonly driven: Map<string, number | string>;
|
|
597
|
+
/** Its Timeline values, told of each key a take draws (#240). */
|
|
598
|
+
readonly timelineKeys: () => Timelines.TimelineKeys | undefined;
|
|
599
|
+
/** Take `key` from `running`. */
|
|
600
|
+
readonly giveUp: (key: string, running: Running) => void;
|
|
601
|
+
/** Its `initial` values: a key without one is owned when it's first drawn. */
|
|
602
|
+
readonly initialValues: Values.Values;
|
|
603
|
+
/** Own `key` on the element (its style's value gives way). */
|
|
604
|
+
readonly ownValue: (key: string) => void;
|
|
605
|
+
/** Start `key` where it's drawn, noting what it starts from in `started`. */
|
|
606
|
+
readonly startKey: (key: string, like: number | string, started: Record<string, string>) => void;
|
|
607
|
+
/** Keep every key no leg takes where it's drawn. */
|
|
608
|
+
readonly keepTheRest: () => void;
|
|
609
|
+
/** Whether reduced motion applies now. */
|
|
610
|
+
readonly reducedMotion: () => boolean;
|
|
611
|
+
/** Whether its animations are skipped now (#468). */
|
|
612
|
+
readonly skipAnimations: () => boolean;
|
|
613
|
+
readonly element: Subject.Subject;
|
|
614
|
+
readonly positionalKeys: ReducedMotion.PositionalKeys["Service"];
|
|
615
|
+
readonly defaultTransition: DefaultTransition.DefaultTransition["Service"];
|
|
616
|
+
/** Each key's velocity, as of the take. */
|
|
617
|
+
readonly readVelocity: RetargetLegs.Velocities;
|
|
618
|
+
readonly gate: FlushGate.Shape;
|
|
619
|
+
/** A leg's keys drawn by none. */
|
|
620
|
+
readonly forget: (running: Running) => void;
|
|
621
|
+
/** End a leg where it is. */
|
|
622
|
+
readonly endLeg: (running: Running) => void;
|
|
623
|
+
/** Its routed `style` keys (#130), told the legs each Retarget starts. */
|
|
624
|
+
readonly live: LiveRoutes | undefined;
|
|
625
|
+
/** A leg's keys owned by it. */
|
|
626
|
+
readonly own: (running: Running) => void;
|
|
627
|
+
/** A leg's program: its machine's run into the gate. */
|
|
628
|
+
readonly legProgram: (leg: RetargetLegs.Leg, running: Running, variables: boolean) => Effect.Effect<unknown, never, WardicServices.WardicServices>;
|
|
629
|
+
/** What a leg's end is told: it settles its landing, or reports its failure. */
|
|
630
|
+
readonly legEnded: (running: Running) => (exit: Exit.Exit<unknown>) => Effect.Effect<void>;
|
|
631
|
+
/** A Path's turn back to 0 once no leg draws it (#460, ADR-0065 decision 3). */
|
|
632
|
+
readonly turnBack: () => void;
|
|
633
|
+
/** Its gate id. */
|
|
634
|
+
readonly id: string;
|
|
635
|
+
/** Record a value written, for its presence record. */
|
|
636
|
+
readonly recordFrame: (value: Values.Values) => void;
|
|
637
|
+
readonly runtime: WardicServices.Runner<WardicServices.WardicServices>;
|
|
638
|
+
/** Its Variable values' Key rule (#55): a blend's are built with it. */
|
|
639
|
+
readonly elementRules: ReadonlyArray<InterpolatorRegistry.KeyRule>;
|
|
640
|
+
/** The Environment's Measured pairs (#430, #672). */
|
|
641
|
+
readonly measuredPairs: MeasuredPairs.Shape;
|
|
642
|
+
/** The Environment's Variable values (#55, #672). */
|
|
643
|
+
readonly variableValues: VariableValues.Shape;
|
|
644
|
+
}
|
|
645
|
+
/** A mounted element's spine. */
|
|
646
|
+
export interface ElementSpine {
|
|
647
|
+
/** A Retarget toward `resolution`: called by the binding on each change of its target, untracked. */
|
|
648
|
+
readonly retarget: (resolution: Resolution) => void;
|
|
649
|
+
/** Follow the element's Live values in `style` (#130), from its first routed key on. */
|
|
650
|
+
readonly follow: (now: FollowNow) => void;
|
|
651
|
+
/** The element's teardown: following stops, and the legs end. */
|
|
652
|
+
readonly dispose: () => void;
|
|
653
|
+
/**
|
|
654
|
+
* Start where a leaver is drawn (#286, ADR-0048), before the first Retarget: each key's value and
|
|
655
|
+
* velocity, drawn now. A key no entry sets returns to its Base value from there, as one a Retarget
|
|
656
|
+
* drove does.
|
|
657
|
+
*/
|
|
658
|
+
readonly seed: (from: PresenceRecord.PresenceSeed) => void;
|
|
659
|
+
/**
|
|
660
|
+
* What the spine hands over (#746): to an **Imperative animation** of the element (#433), whose track
|
|
661
|
+
* `imperative.ts` builds over it, and to a Batch member's hold (#665). Made at the first call, once.
|
|
662
|
+
*/
|
|
663
|
+
readonly host: () => SpineHost;
|
|
664
|
+
/** End every running leg where it is (#433, **Animation controls**' `stop`): its keys stay there, until the next Retarget. */
|
|
665
|
+
readonly stop: () => void;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* A mounted element's spine: its Retarget, the returns to its Base values, the follower of its
|
|
669
|
+
* Live values, and its legs' lifetime. Every leg is a fiber of its provider's runtime, and joins
|
|
670
|
+
* its Retarget's token: a Retarget ends the token before it starts its own legs, and {@link
|
|
671
|
+
* ElementSpine.dispose} ends every leg's (#542). Both end the legs in the calling task: each leg's
|
|
672
|
+
* run leaves the loop at once, and its fiber ends Superseded, inline (ADR-0027, decision 5,
|
|
673
|
+
* *Amendment (#200)*). A leg the token didn't reach is interrupted (`endLeg`). The runtime's own
|
|
674
|
+
* fiber Scope interrupts what's left when the provider ends.
|
|
675
|
+
*/
|
|
676
|
+
export declare const makeElementSpine: (options: ElementSpineOptions) => ElementSpine;
|
|
677
|
+
/**
|
|
678
|
+
* `sink` with an `onCommit` that calls the config's current `onUpdate` (#233), when the config had
|
|
679
|
+
* one at mount; `sink` as it is otherwise. `config` reads it untracked.
|
|
680
|
+
*/
|
|
681
|
+
export declare const withOnUpdate: (sink: FlushGate.Sink, atMount: Config.SpineConfig["onUpdate"], config: () => Config.SpineConfig) => FlushGate.Sink;
|
|
682
|
+
/**
|
|
683
|
+
* A Retarget's note of the keys it started from their Base value, or returned to it (ADR-0022): run at
|
|
684
|
+
* the head of its first leg, cold path (no fiber of its own: forking one per element cost 10-20 µs each
|
|
685
|
+
* at a 1000-element mount).
|
|
686
|
+
*/
|
|
687
|
+
export declare const baseLog: (id: string, started: Record<string, string>, returns: ReadonlyArray<readonly [string, BaseValue.BaseSource]>) => Effect.Effect<void>;
|
|
688
|
+
/** A provider runtime's `AtomRegistry`, read on first need: an element with no Atom never reads it. */
|
|
689
|
+
export declare const registryOf: (runtime: WardicServices.Runner<WardicServices.WardicServices>) => (() => AtomRegistry.AtomRegistry);
|
|
690
|
+
/** Whether a config makes its element a layout node: `layout` (or a mode), or a `layoutId`. */
|
|
691
|
+
export declare const isLayoutNode: (c: Config.SpineConfig) => boolean;
|
|
692
|
+
/** A mount animation's template field (#443): left out with none, as its key reads it. */
|
|
693
|
+
export declare const templateField: (template: Config.SpineConfig["transformTemplate"]) => {
|
|
694
|
+
readonly template?: Config.SpineConfig["transformTemplate"];
|
|
695
|
+
};
|
|
696
|
+
//# sourceMappingURL=Spine.d.ts.map
|