@wardic/core 1.3.2 → 1.5.0-next.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 +8 -6
- package/dist/DragRecognizer.d.ts.map +1 -1
- package/dist/DragRecognizer.js +51 -16
- 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 +9 -3
- package/dist/InputSource.d.ts.map +1 -1
- package/dist/InputSource.js +2 -2
- package/dist/InputSource.js.map +1 -1
- 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 +8 -19
- package/dist/Projection.d.ts.map +1 -1
- package/dist/Projection.js +3 -19
- package/dist/Projection.js.map +1 -1
- package/dist/Recognizer.d.ts +1 -1
- package/dist/Recognizer.d.ts.map +1 -1
- package/dist/Recognizer.js +22 -7
- 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 +12 -2
- package/dist/Reorder.d.ts.map +1 -1
- package/dist/Reorder.js +65 -37
- 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/projectionRest.d.ts +22 -0
- package/dist/internal/projectionRest.d.ts.map +1 -0
- package/dist/internal/projectionRest.js +20 -0
- package/dist/internal/projectionRest.js.map +1 -0
- 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 +31 -27
- 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 +171 -164
- 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 +43 -36
- package/dist/unstable/VariantTree.d.ts.map +1 -1
- package/dist/unstable/VariantTree.js +34 -34
- 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 +65 -23
- package/src/Easing.ts +1 -1
- package/src/Frame.ts +5 -3
- package/src/InputFeed.ts +2 -2
- package/src/InputSource.ts +12 -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 +10 -28
- package/src/Recognizer.ts +24 -8
- package/src/ReducedMotion.ts +6 -6
- package/src/Renderer.ts +6 -6
- package/src/Reorder.ts +84 -38
- 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/projectionRest.ts +31 -0
- 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 +34 -30
- 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 +210 -201
- 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 +50 -43
- package/src/unstable/WardicConfigValue.ts +13 -13
package/src/unstable/Stops.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Unstable, for Wardic's own packages: public, with no semver promise. `@wardic/dom/Style` re-exports
|
|
8
8
|
* it for binding authors.
|
|
9
9
|
*
|
|
10
|
-
* Observability: pure and per
|
|
10
|
+
* Observability: pure and per Subject, so quiet (no span, no log).
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
@@ -87,7 +87,7 @@ const keepAnimatable = (value: unknown, key: string): boolean => {
|
|
|
87
87
|
|
|
88
88
|
/** A values map's numbers and strings, its Keyframes set aside (#452, {@link keepAnimatable}): {@link toValues}' one pass. */
|
|
89
89
|
const filtered = (v: object | undefined): Values.Values => {
|
|
90
|
-
// Per
|
|
90
|
+
// Per Subject at mount (#540): statements and a loop.
|
|
91
91
|
setAside = undefined
|
|
92
92
|
const out: Record<string, number | string> = {}
|
|
93
93
|
if (Predicate.isUndefined(v)) return out
|
|
@@ -164,7 +164,7 @@ export const valuesAt = (v: object | undefined, at: StopAt): Values.Values => {
|
|
|
164
164
|
export const keyframesOf = (v: object | undefined): Option.Option<Readonly<Record<string, Stops>>> => splitValues(v, "last").keyframes
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
|
-
* What of
|
|
167
|
+
* What of a Subject's config its starting style is read from. Its values are typed `object`, so a
|
|
168
168
|
* binding's own value types fit as they are.
|
|
169
169
|
*/
|
|
170
170
|
export interface InitialConfig {
|
|
@@ -192,7 +192,7 @@ const isList = (entry: unknown): entry is ReadonlyArray<string> => Arr.isArray(e
|
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* A values map, or the `variants` entry a name names (an unknown name is empty), or nothing.
|
|
195
|
-
* Built once, at module load: every
|
|
195
|
+
* Built once, at module load: every Subject reads its own at setup (#69).
|
|
196
196
|
*/
|
|
197
197
|
const entryOf: (entry: Entry) => Values.Values = Match.type<Entry>().pipe(
|
|
198
198
|
Match.when({ entry: Match.undefined }, (): Values.Values => ({})),
|
|
@@ -204,7 +204,7 @@ const entryOf: (entry: Entry) => Values.Values = Match.type<Entry>().pipe(
|
|
|
204
204
|
)
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* The values
|
|
207
|
+
* The values a Subject starts from: its `initial` values, or the `variants` entries its `initial` names,
|
|
208
208
|
* an unknown name empty, or nothing. With `initial: false`, its `animate`, resolved the same way, so it
|
|
209
209
|
* starts at its target and nothing animates at mount, as Motion's. A keyframes value starts at its first
|
|
210
210
|
* stop, or, with `initial: false`, at `animate`'s last, where the animation it skips would end. Read once,
|
|
@@ -215,7 +215,7 @@ const entryOf: (entry: Entry) => Values.Values = Match.type<Entry>().pipe(
|
|
|
215
215
|
*/
|
|
216
216
|
// #134, Motion's `initial={false}`; **Keyframes** (#429, Motion's `use-visual-state.ts`).
|
|
217
217
|
export const resolveInitial = (config: InitialConfig): Values.Values => {
|
|
218
|
-
// Per
|
|
218
|
+
// Per Subject at mount (#540): statements.
|
|
219
219
|
if (config.initial === false) return entryOf({ entry: config.animate, variants: config.variants, at: "last" })
|
|
220
220
|
return entryOf({ entry: config.initial as object | string | ReadonlyArray<string> | undefined, variants: config.variants, at: "first" })
|
|
221
221
|
}
|
package/src/unstable/Subject.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What an Environment draws and a Ward binds (**Subject**): opaque to core.
|
|
3
|
-
*
|
|
2
|
+
* What an Environment draws and a Ward binds (**Subject**): opaque to core. `@wardic/dom`'s are its own kind,
|
|
3
|
+
* a scene's its objects; an Environment decides what its Subjects are.
|
|
4
4
|
*
|
|
5
5
|
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **Timeline values** (#240, ADR-0043 *Amendment (#240)*): what
|
|
2
|
+
* **Timeline values** (#240, ADR-0043 *Amendment (#240)*): what a Subject's spine tells of its keys,
|
|
3
3
|
* and the service that runs their Timeline values, which a binding's `scroll` Feature gives. Only the
|
|
4
|
-
* type and the key are here, on every
|
|
4
|
+
* type and the key are here, on every Subject's path: the code is the Feature's, so an app that reads
|
|
5
5
|
* no scroll ships none of it.
|
|
6
6
|
*
|
|
7
7
|
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
@@ -9,34 +9,34 @@
|
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
11
|
// Unstable: ADR-0071, decision 5. #672 (Q15): solid's `timelines.ts`, moved for the spine to tell its keys'
|
|
12
|
-
// Timeline values in core; its options'
|
|
12
|
+
// Timeline values in core; its options' `subject` a Subject, its runtime a Runner.
|
|
13
13
|
import type * as FlushGate from "./FlushGate.ts"
|
|
14
14
|
import * as Context from "effect/Context"
|
|
15
15
|
import type * as Atom from "effect/reactivity/Atom"
|
|
16
16
|
import type * as Subject from "./Subject.ts"
|
|
17
17
|
import type * as WardicServices from "./WardicServices.ts"
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/** A Subject's keys' Timeline values, as its spine tells of them. */
|
|
20
20
|
export interface TimelineKeys {
|
|
21
|
-
/** The
|
|
21
|
+
/** The Subject shows `key`'s Live value: its Timeline value runs, when it has one. */
|
|
22
22
|
readonly shown: (key: string) => void
|
|
23
23
|
/** Something else draws `key` now (an entry, a drag, an Imperative animation), or it left the `style`: its Timeline value stops. */
|
|
24
24
|
readonly taken: (key: string) => void
|
|
25
|
-
/** The
|
|
25
|
+
/** The Subject's unmounted: it's no longer told of a value described. */
|
|
26
26
|
readonly dispose: () => void
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/** What
|
|
29
|
+
/** What a Subject's {@link TimelineKeys} are made with. */
|
|
30
30
|
export interface TimelineKeysOptions {
|
|
31
31
|
readonly runtime: WardicServices.Runner<WardicServices.WardicServices>
|
|
32
32
|
readonly gate: FlushGate.Shape
|
|
33
33
|
readonly id: string
|
|
34
|
-
readonly
|
|
34
|
+
readonly subject: Subject.Subject
|
|
35
35
|
/** Its routed `style` keys: each key's Atom, which describes its derivation. */
|
|
36
36
|
readonly live: LiveAtoms
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/** What
|
|
39
|
+
/** What a Subject's Timeline values read of its Live values: a routed key's Atom, `undefined` for one not routed. */
|
|
40
40
|
// #672: the one member the Timelines' keys call of the spine's LiveRoutes, which meets it; named here, so
|
|
41
41
|
// this module, which the spine imports, imports nothing of the spine's.
|
|
42
42
|
export interface LiveAtoms {
|
|
@@ -44,10 +44,10 @@ export interface LiveAtoms {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* The `scroll` Feature's Timeline values (#240), one per provider:
|
|
47
|
+
* The `scroll` Feature's Timeline values (#240), one per provider: a Subject's {@link TimelineKeys},
|
|
48
48
|
* made at its first write of a Live value; and `described`, told by a `createScroll` that has described
|
|
49
|
-
* its values (`LiveValue.derivesAs`), after the
|
|
50
|
-
* key
|
|
49
|
+
* its values (`LiveValue.derivesAs`), after the Subjects following them may have shown them, so each
|
|
50
|
+
* key a Subject shows finds its Timeline value then, its value unchanged.
|
|
51
51
|
*/
|
|
52
52
|
export class Timelines extends /*#__PURE__*/ Context.Service<
|
|
53
53
|
Timelines,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A target resolved (#277, ADR-0048): a values map, or a variant name against
|
|
2
|
+
* A target resolved (#277, ADR-0048): a values map, or a variant name against a Subject's
|
|
3
3
|
* `variants`, each a target with its own transition or a dynamic variant, a function of `custom`.
|
|
4
4
|
* Motion's `resolveVariantFromProps` and `resolveTransition`. Shared by every binding's spine, its
|
|
5
5
|
* variant nodes and its Starting style.
|
|
@@ -22,7 +22,7 @@ import type * as Config from "./Config.ts"
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* What a dynamic variant reads besides `custom` (#277, Motion's `current` and `velocity`): the
|
|
25
|
-
*
|
|
25
|
+
* Subject's values now and their velocities, its Snapshot's. Copied only when a resolver is called.
|
|
26
26
|
*/
|
|
27
27
|
export interface VariantState {
|
|
28
28
|
readonly values: Readonly<Record<string, number | string>>
|
|
@@ -140,7 +140,7 @@ const namedOf = (definition: Definition | Failed, variants: Config.WardicVariant
|
|
|
140
140
|
/**
|
|
141
141
|
* Resolve a target (#277): a values map, or a variant name, against `variants`, Motion's
|
|
142
142
|
* `resolveVariantFromProps`. A name's entry is looked up, a resolver is called with `custom` and the
|
|
143
|
-
*
|
|
143
|
+
* Subject's `state`, and a resolver that returns a name is followed once more. Its values go through
|
|
144
144
|
* `Stops.valuesAt`, so `Override.resolve` and `Values.split` never see an `undefined` value, nor an
|
|
145
145
|
* array: a key's Keyframes (#429) are split off, its value their last stop; its `transition` is split
|
|
146
146
|
* off too.
|
|
@@ -163,7 +163,7 @@ export const resolveTargets = (entry: Entry, variants: Config.WardicVariants | u
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/** An entry's name: the entry itself, when it's one. */
|
|
166
|
-
// Per Retarget, per
|
|
166
|
+
// Per Retarget, per Subject (#460, compose once): statements.
|
|
167
167
|
const nameOfEntry = (entry: Config.WardicVariant | string | undefined): string | undefined => {
|
|
168
168
|
if (Predicate.isString(entry)) return entry
|
|
169
169
|
return undefined
|
|
@@ -251,16 +251,16 @@ const transitionEndOf = (given: unknown): Values.Values | undefined => {
|
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* The transition an animation to a target runs on (#277, Motion's `resolveTransition`): the target's
|
|
254
|
-
* own in place of the
|
|
255
|
-
* winning); the
|
|
254
|
+
* own in place of the Subject's, or laid over it with `inherit: true` (a shallow merge, its own keys
|
|
255
|
+
* winning); the Subject's when it has none. An own transition with no `inherit` is handed back as it
|
|
256
256
|
* is, the same object each call, so a memo of it holds (#460: a copy per call made Solid 2's variant
|
|
257
257
|
* node re-run its orchestration's readers at every gesture, `UNSTABLE_MEMO_OUTPUT`).
|
|
258
258
|
*/
|
|
259
|
-
export const transitionOfTarget = (own: Config.WardicVariantTransition | undefined,
|
|
260
|
-
if (Predicate.isUndefined(own)) return
|
|
259
|
+
export const transitionOfTarget = (own: Config.WardicVariantTransition | undefined, wardTransition: Config.WardicTransition | undefined): Config.WardicTransition | undefined => {
|
|
260
|
+
if (Predicate.isUndefined(own)) return wardTransition
|
|
261
261
|
if (!("inherit" in own)) return own as Config.WardicTransition
|
|
262
262
|
const { inherit, ...rest } = own
|
|
263
|
-
if (inherit === true) return { ...
|
|
263
|
+
if (inherit === true) return { ...wardTransition, ...rest } as Config.WardicTransition
|
|
264
264
|
return rest as Config.WardicTransition
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -280,7 +280,7 @@ export interface StartingVariants {
|
|
|
280
280
|
readonly failure: Option.Option<VariantFailure>
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
/** No variants: one value, as most
|
|
283
|
+
/** No variants: one value, as most Subjects have none (#979, bench:solid's mount). */
|
|
284
284
|
const NO_STARTING_VARIANTS: StartingVariants = { variants: undefined, failure: NO_FAILURE }
|
|
285
285
|
|
|
286
286
|
/**
|
|
@@ -292,7 +292,7 @@ export const startingVariantsOf = (variants: object | undefined, custom: unknown
|
|
|
292
292
|
if (Predicate.isUndefined(variants)) return NO_STARTING_VARIANTS
|
|
293
293
|
const entries = variants as Config.WardicVariants
|
|
294
294
|
if (Bool.not(Arr.some(Rec.values(entries), Predicate.isFunction))) return { variants, failure: NO_FAILURE }
|
|
295
|
-
// Once
|
|
295
|
+
// Once a Subject's setup (#979): each entry resolved, a throwing resolver's left with no values.
|
|
296
296
|
const targets = Rec.map(entries, (_, name) => resolveTarget(name, entries, custom, NO_VARIANT_STATE))
|
|
297
297
|
return { variants: Rec.map(targets, valuesOfTarget), failure: Option.firstSomeOf(Arr.map(Rec.values(targets), failureOfTarget)) }
|
|
298
298
|
}
|
|
@@ -301,7 +301,7 @@ export const startingVariantsOf = (variants: object | undefined, custom: unknown
|
|
|
301
301
|
export type Orchestrated = (entry: Config.WardicVariantLabels, failure: Option.Option<VariantFailure>) => void
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
|
-
* The own transition of
|
|
304
|
+
* The own transition of a Subject's target now (#277): its `animate` map's, else the variant it
|
|
305
305
|
* names or inherits (`name`), resolved with `custom` and no values. What its orchestration reads.
|
|
306
306
|
* `orchestrated` is told what a name's resolution came to: a resolver that throws gives no own
|
|
307
307
|
* transition.
|
|
@@ -319,7 +319,7 @@ export const ownTransitionOf = (
|
|
|
319
319
|
}
|
|
320
320
|
if (Predicate.isUndefined(name)) return undefined
|
|
321
321
|
const target = resolveTarget(name, byName, custom, NO_VARIANT_STATE)
|
|
322
|
-
// #979 (Q6): a throw here is reported through the
|
|
322
|
+
// #979 (Q6): a throw here is reported through the Subject's own once, its resolution's apart.
|
|
323
323
|
if (Predicate.isNotUndefined(orchestrated)) orchestrated(name, target.failure)
|
|
324
324
|
return target.transition
|
|
325
325
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The rules of
|
|
3
|
-
* names
|
|
2
|
+
* The rules of a Subject's place in variant orchestration (ADR-0007, #50), on every binding: the
|
|
3
|
+
* names a Subject hands its children and inherits from its parent, the values it starts from, and
|
|
4
4
|
* what a server render builds. Each binding's variant node runs the orchestration over them, with its
|
|
5
5
|
* own reactivity.
|
|
6
6
|
*
|
|
7
7
|
* Motion's rule (CONTEXT.md, **Variant child**):
|
|
8
|
-
* -
|
|
8
|
+
* - A Subject that names its own variants, a name on any variant prop (`initial`, `animate`, the
|
|
9
9
|
* `while*` gestures, `exit`; #618), hands its children its `initial` and `animate` names, and an
|
|
10
10
|
* `initial={false}` with them (#134). Any other passes its parent's through, unless it sets
|
|
11
11
|
* `inherit={false}`, which passes none.
|
|
12
12
|
* - A **Variant child** (`variants`, no names of its own, `inherit` not `false`) inherits its
|
|
13
13
|
* ancestor's names and default transition, takes a stagger slot among the ancestor's variant
|
|
14
14
|
* children, and counts for the ancestor's `when`.
|
|
15
|
-
* -
|
|
16
|
-
* join: it owns their registry, their stagger and their `when`. Any other
|
|
15
|
+
* - A Subject with variants of its own (`variants`, or a name) is what its Variant children
|
|
16
|
+
* join: it owns their registry, their stagger and their `when`. Any other Subject passes its
|
|
17
17
|
* parent's context through, so a Variant child joins its nearest such ancestor; it renders no
|
|
18
18
|
* Provider unless it sets `inherit={false}` ({@link changesContext}).
|
|
19
19
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
// Unstable: ADR-0071, decision 5. #672: solid's `variant-tree.ts`, moved for the spine to read an
|
|
25
|
-
//
|
|
25
|
+
// Subject's place in variant orchestration in core.
|
|
26
26
|
import * as Stagger from "../Stagger.ts"
|
|
27
27
|
import type * as Values from "../Values.ts"
|
|
28
28
|
import * as Report from "./Report.ts"
|
|
@@ -98,7 +98,7 @@ export interface WardicStaggerConfig {
|
|
|
98
98
|
* inherit).
|
|
99
99
|
* - `initial` — the parent's `initial` NAME, or `false`, read once (#50, #134).
|
|
100
100
|
*
|
|
101
|
-
* Every
|
|
101
|
+
* Every Ward's Subject provides one (#50): its own if it has variants of its own, else its
|
|
102
102
|
* parent's, passed through (`variant-node.ts`).
|
|
103
103
|
* - `transition` — the parent's transition, inherited as the DEFAULT for
|
|
104
104
|
* children that supply no local `transition`.
|
|
@@ -112,10 +112,10 @@ export type GestureLayer = "inView" | "focused" | "hovered" | "pressed" | "dragg
|
|
|
112
112
|
/** The gesture layers in Motion's priority, lowest first. */
|
|
113
113
|
export const GESTURE_LAYERS: ReadonlyArray<GestureLayer> = ["inView", "focused", "hovered", "pressed", "dragged"]
|
|
114
114
|
|
|
115
|
-
/** The variant names
|
|
115
|
+
/** The variant names a Subject hands its Variant children for its active gestures (#291): a name or a list each (#297). */
|
|
116
116
|
export type GestureNames = Readonly<Partial<Record<GestureLayer, Config.WardicVariantLabels | undefined>>>
|
|
117
117
|
|
|
118
|
-
/** No gesture on: what
|
|
118
|
+
/** No gesture on: what a Subject with none active hands down. */
|
|
119
119
|
export const NO_GESTURE_NAMES: GestureNames = {}
|
|
120
120
|
|
|
121
121
|
/** Two {@link GestureNames} the same: the same names for each gesture, a list name by name (#297). */
|
|
@@ -129,7 +129,7 @@ export type GestureStates = Readonly<Record<GestureLayer, boolean>>
|
|
|
129
129
|
export const NO_GESTURE_STATES: GestureStates = { inView: false, focused: false, hovered: false, pressed: false, dragged: false }
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* What
|
|
132
|
+
* What a Subject hands its Variant children for its gestures (#291, Motion's `setActive` and variant
|
|
133
133
|
* context): whether each is on (its own, or its own provider's), and each one's label (its own
|
|
134
134
|
* `while*`, if a name, else the one it took). A Variant child's gesture is on while its provider's is.
|
|
135
135
|
*/
|
|
@@ -138,7 +138,7 @@ export interface GestureHandDown {
|
|
|
138
138
|
readonly names: GestureNames
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
/** Nothing on, no labels: what
|
|
141
|
+
/** Nothing on, no labels: what a Subject hands down with no provider and no gesture. */
|
|
142
142
|
export const NO_HAND_DOWN: GestureHandDown = { on: NO_GESTURE_STATES, names: NO_GESTURE_NAMES }
|
|
143
143
|
|
|
144
144
|
/** Two hand-downs the same: each gesture on alike, with the same label. */
|
|
@@ -147,7 +147,7 @@ export const sameHandDown = (a: GestureHandDown, b: GestureHandDown): boolean =>
|
|
|
147
147
|
|
|
148
148
|
/** What a context hands down, nothing without a context or its gestures. */
|
|
149
149
|
export const handDownFrom = (context: WardicVariantContextValue | undefined): GestureHandDown => {
|
|
150
|
-
// Per Retarget, per
|
|
150
|
+
// Per Retarget, per Subject: guards, nothing made (most Subjects have no provider).
|
|
151
151
|
if (Predicate.isUndefined(context)) return NO_HAND_DOWN
|
|
152
152
|
const gestures = context.gestures
|
|
153
153
|
if (Predicate.isUndefined(gestures)) return NO_HAND_DOWN
|
|
@@ -178,7 +178,7 @@ const labelOf = (own: object | Config.WardicVariantLabels | undefined, inherited
|
|
|
178
178
|
return inherited
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
/** What
|
|
181
|
+
/** What a Subject hands down (#291), from its config, its own states, and what it takes. */
|
|
182
182
|
export const handDownOf = (config: GestureConfig, own: GestureStates, above: GestureHandDown): GestureHandDown => ({
|
|
183
183
|
on: gesturesOn(own, above.on),
|
|
184
184
|
names: {
|
|
@@ -318,7 +318,7 @@ export interface WardicVariantContextValue {
|
|
|
318
318
|
readonly staggerFor?: (name: string | undefined) => WardicStaggerConfig
|
|
319
319
|
/**
|
|
320
320
|
* For a list: whether a Variant child's keys of `name` may start, that name's own
|
|
321
|
-
* `beforeChildren`: true unless it has one and this
|
|
321
|
+
* `beforeChildren`: true unless it has one and this Subject's keys of that name haven't settled
|
|
322
322
|
* since its list last changed. Optional: left out, always.
|
|
323
323
|
*/
|
|
324
324
|
readonly mayStartFor?: (name: string) => boolean
|
|
@@ -346,7 +346,7 @@ export interface WardicVariantContextValue {
|
|
|
346
346
|
readonly appearGroup?: unknown
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
/** The part of
|
|
349
|
+
/** The part of a Subject's config its place in variant orchestration reads. */
|
|
350
350
|
export interface VariantConfig extends GestureConfig {
|
|
351
351
|
readonly initial?: object | Config.WardicVariantLabels | false | undefined
|
|
352
352
|
readonly animate?: object | Config.WardicVariantLabels | undefined
|
|
@@ -361,9 +361,16 @@ export interface VariantConfig extends GestureConfig {
|
|
|
361
361
|
* entry is, as Motion's `isControllingVariants`, so it hands down the names its controls set.
|
|
362
362
|
*/
|
|
363
363
|
readonly controlled?: boolean | undefined
|
|
364
|
+
/**
|
|
365
|
+
* Whether it's a **Variant child** by its own word (probe: hooks-first, the gap grill's Q26): one
|
|
366
|
+
* that names gesture variants of its own is one all the same, joining its nearest ancestor with
|
|
367
|
+
* variants and handing its own gesture names down with the ones it takes. Left out, Motion's rule
|
|
368
|
+
* alone decides, as today.
|
|
369
|
+
*/
|
|
370
|
+
readonly variantChild?: boolean | undefined
|
|
364
371
|
}
|
|
365
372
|
|
|
366
|
-
/** An `initial`
|
|
373
|
+
/** An `initial` a Subject hands its children: a variant name or list (#297), `false` (#134), or `undefined` for a values map or nothing. */
|
|
367
374
|
export const initialNameOf = (entry: object | Config.WardicVariantLabels | false | undefined): Config.WardicVariantLabels | false | undefined =>
|
|
368
375
|
Bool.match(entry === false, { onTrue: () => false as const, onFalse: () => nameOf(entry as object | Config.WardicVariantLabels | undefined) })
|
|
369
376
|
|
|
@@ -390,21 +397,21 @@ export const namesOwnVariants = (config: VariantConfig): boolean =>
|
|
|
390
397
|
VariantTarget.isLabels(config.whileDrag) ||
|
|
391
398
|
VariantTarget.isLabels(config.exit)
|
|
392
399
|
|
|
393
|
-
/** Whether
|
|
400
|
+
/** Whether a Subject has variants of its own, so Variant children join it (Motion's `isVariantNode`). */
|
|
394
401
|
export const hasOwnVariants = (config: VariantConfig): boolean =>
|
|
395
402
|
Predicate.isNotUndefined(config.variants) || namesOwnVariants(config)
|
|
396
403
|
|
|
397
404
|
/**
|
|
398
|
-
* Whether
|
|
399
|
-
* Provider (#50): it has variants of its own, or it sets `inherit={false}`. Any other
|
|
405
|
+
* Whether a Subject changes what its children read, so it renders its variant context's
|
|
406
|
+
* Provider (#50): it has variants of its own, or it sets `inherit={false}`. Any other Subject hands
|
|
400
407
|
* its children its parent's context as it is, so it renders none. Decided once, at setup, from the
|
|
401
408
|
* same props on a server and on the client, so the nesting never changes after mount.
|
|
402
409
|
*/
|
|
403
410
|
export const changesContext = (config: VariantConfig): boolean => hasOwnVariants(config) || config.inherit === false
|
|
404
411
|
|
|
405
412
|
/**
|
|
406
|
-
* The **Controls change** in effect for
|
|
407
|
-
* it inherits from is in, else none. Per mount, for every
|
|
413
|
+
* The **Controls change** in effect for a Subject (#433): its own controls', else the one the context
|
|
414
|
+
* it inherits from is in, else none. Per mount, for every Subject (#460): guards, nothing built.
|
|
408
415
|
*/
|
|
409
416
|
export const controlsChangeOf = (
|
|
410
417
|
controls: Reactivity.Accessor<AnimationControls.ControlsChange | undefined> | undefined,
|
|
@@ -417,22 +424,22 @@ export const controlsChangeOf = (
|
|
|
417
424
|
return change
|
|
418
425
|
}
|
|
419
426
|
|
|
420
|
-
/** Whether
|
|
427
|
+
/** Whether a Subject is a **Variant child** (CONTEXT.md): by Motion's rule, or by its own word ({@link VariantConfig.variantChild}). */
|
|
421
428
|
export const isVariantChild = (config: VariantConfig): boolean =>
|
|
422
|
-
Predicate.isNotUndefined(config.variants) && !namesOwnVariants(config) && config.inherit !== false
|
|
429
|
+
Predicate.isNotUndefined(config.variants) && (config.variantChild === true || !namesOwnVariants(config)) && config.inherit !== false
|
|
423
430
|
|
|
424
|
-
/** The context
|
|
431
|
+
/** The context a Subject inherits names and its default transition from: its parent's, for a Variant child. */
|
|
425
432
|
export const inheritedContext = (
|
|
426
433
|
config: VariantConfig,
|
|
427
434
|
parent: WardicVariantContextValue | undefined,
|
|
428
435
|
): WardicVariantContextValue | undefined => {
|
|
429
|
-
// Per
|
|
436
|
+
// Per Subject at mount (#540): statements.
|
|
430
437
|
if (isVariantChild(config)) return parent
|
|
431
438
|
return undefined
|
|
432
439
|
}
|
|
433
440
|
|
|
434
441
|
/**
|
|
435
|
-
* The `initial`
|
|
442
|
+
* The `initial` a Subject's Starting style resolves: its own, else the `initial` name (or `false`) of
|
|
436
443
|
* the context it inherits from (#50, #134). Read once, as every `initial` is.
|
|
437
444
|
*/
|
|
438
445
|
export const initialOf = (
|
|
@@ -444,7 +451,7 @@ export const initialOf = (
|
|
|
444
451
|
onUndefined: () => UndefinedOr.match(inherited, { onUndefined: constUndefined, onDefined: (context) => context.initial }),
|
|
445
452
|
})
|
|
446
453
|
|
|
447
|
-
/** The `animate`
|
|
454
|
+
/** The `animate` a Subject starts at with `initial={false}`: its own, else the name its context hands down (#134). Read once, untracked. */
|
|
448
455
|
const animateOf = (
|
|
449
456
|
config: VariantConfig,
|
|
450
457
|
inherited: WardicVariantContextValue | undefined,
|
|
@@ -456,7 +463,7 @@ const animateOf = (
|
|
|
456
463
|
})
|
|
457
464
|
|
|
458
465
|
/**
|
|
459
|
-
* Whether
|
|
466
|
+
* Whether a Subject starts at its `animate`, with nothing animating at mount (#134, Motion's
|
|
460
467
|
* `isInitialAnimationBlocked`): its `initial` (own or inherited) is `false`, or it renders with an
|
|
461
468
|
* `<AnimatePresence initial={false}>`'s first render (`presenceBlocks`).
|
|
462
469
|
*/
|
|
@@ -467,7 +474,7 @@ export const startsAtAnimate = (
|
|
|
467
474
|
): boolean => presenceBlocks || initialOf(config, inherited) === false
|
|
468
475
|
|
|
469
476
|
/**
|
|
470
|
-
* Whether
|
|
477
|
+
* Whether a Subject's mount tells nothing (#448, Motion's `animation-state.ts`): it
|
|
471
478
|
* {@link startsAtAnimate}, or its `initial` (own, else inherited) is the same name, list or values map
|
|
472
479
|
* as its `animate` (own, else inherited). Its first Retarget, landing with nothing to animate, is told
|
|
473
480
|
* to no one. Read once, untracked.
|
|
@@ -485,14 +492,14 @@ export const startsQuiet = (
|
|
|
485
492
|
return VariantTarget.sameLabels(initial as Config.WardicVariantLabels, animateOf(config, inherited, untrack) as Config.WardicVariantLabels)
|
|
486
493
|
}
|
|
487
494
|
|
|
488
|
-
/** What
|
|
495
|
+
/** What a Subject starts from, and the first of its variants whose resolver threw (#979). */
|
|
489
496
|
export interface Starting {
|
|
490
497
|
readonly values: Values.Values
|
|
491
498
|
readonly failure: Option.Option<VariantTarget.VariantFailure>
|
|
492
499
|
}
|
|
493
500
|
|
|
494
501
|
/**
|
|
495
|
-
* The values
|
|
502
|
+
* The values a Subject starts from, its Starting style's input (ADR-0003): its `initial` (own, else
|
|
496
503
|
* inherited, #50), or, when it {@link startsAtAnimate}, its `animate` (own, else inherited), as
|
|
497
504
|
* Motion's `initial={false}` (#134). Read once: an inherited name is read through `untrack`.
|
|
498
505
|
*/
|
|
@@ -504,8 +511,8 @@ export const startingValuesOf = (
|
|
|
504
511
|
): Values.Values => startingValuesFrom(config, inherited, presenceBlocks, untrack, VariantTarget.startingVariantsOf(config.variants, config.custom).variants)
|
|
505
512
|
|
|
506
513
|
/**
|
|
507
|
-
* {@link startingValuesOf}, with what a resolver among the
|
|
508
|
-
* values, and the
|
|
514
|
+
* {@link startingValuesOf}, with what a resolver among the Subject's variants threw: its entry gives no
|
|
515
|
+
* values, and the Subject starts at the rest (#979).
|
|
509
516
|
*/
|
|
510
517
|
export const startingOf = (
|
|
511
518
|
config: VariantConfig,
|
|
@@ -519,7 +526,7 @@ export const startingOf = (
|
|
|
519
526
|
|
|
520
527
|
/**
|
|
521
528
|
* {@link startingValuesOf} from its variants already resolved to values (`VariantTarget.startingVariantsOf`):
|
|
522
|
-
* what
|
|
529
|
+
* what a Subject's start reads, which reads their failure too.
|
|
523
530
|
*/
|
|
524
531
|
export const startingValuesFrom = (
|
|
525
532
|
config: VariantConfig,
|
|
@@ -531,7 +538,7 @@ export const startingValuesFrom = (
|
|
|
531
538
|
const atAnimate = startsAtAnimate(config, inherited, presenceBlocks)
|
|
532
539
|
const animate = animateOf(config, inherited, untrack)
|
|
533
540
|
const initial = initialOf(config, inherited)
|
|
534
|
-
// Per
|
|
541
|
+
// Per Subject at mount (#540): statements. Starting at `animate` resolves as `initial={false}`,
|
|
535
542
|
// and its first target is `animate`.
|
|
536
543
|
let from = initial
|
|
537
544
|
let first = initial
|
|
@@ -554,7 +561,7 @@ export const startingValuesFrom = (
|
|
|
554
561
|
}
|
|
555
562
|
|
|
556
563
|
/**
|
|
557
|
-
* A name
|
|
564
|
+
* A name a Subject hands its children (Motion's `getCurrentTreeVariants`): `own` if it names its own
|
|
558
565
|
* variants, else `fromParent` unless it sets `inherit={false}`.
|
|
559
566
|
*/
|
|
560
567
|
export const handedDown = <A extends Config.WardicVariantLabels | false>(config: VariantConfig, own: () => A | undefined, fromParent: () => A | undefined): A | undefined =>
|
|
@@ -563,11 +570,11 @@ export const handedDown = <A extends Config.WardicVariantLabels | false>(config:
|
|
|
563
570
|
onFalse: () => Bool.match(config.inherit === false, { onTrue: constUndefined, onFalse: fromParent }),
|
|
564
571
|
})
|
|
565
572
|
|
|
566
|
-
/**
|
|
573
|
+
/** A Subject's own transition, else the one it inherits. */
|
|
567
574
|
export const ownOrInherited = (own: Config.WardicTransition | undefined, inherited: WardicVariantContextValue | undefined): Config.WardicTransition | undefined =>
|
|
568
575
|
UndefinedOr.match(own, { onUndefined: () => UndefinedOr.map(inherited, (context) => context.transition()), onDefined: identity })
|
|
569
576
|
|
|
570
|
-
/** The stagger config
|
|
577
|
+
/** The stagger config a Subject's `transition` gives its Variant children. */
|
|
571
578
|
export const staggerOf = (transition: Config.WardicTransition | undefined): WardicStaggerConfig =>
|
|
572
579
|
UndefinedOr.match(transition, { onUndefined: () => staggerWith({}), onDefined: staggerWith })
|
|
573
580
|
|
|
@@ -593,7 +600,7 @@ export const directed = (index: number, total: number, direction: 1 | -1): numbe
|
|
|
593
600
|
|
|
594
601
|
/**
|
|
595
602
|
* Where a stagger reports a `delayChildren` function that throws: the runtime it's reported on, and whether
|
|
596
|
-
* it's failing, so a run of throws is reported once. A Variant child's is its
|
|
603
|
+
* it's failing, so a run of throws is reported once. A Variant child's is its Subject's, for its life, its
|
|
597
604
|
* run ended by its next clean call. A presence's exit and a server's Appear timing make one for the event,
|
|
598
605
|
* `event`, whose first throw is reported whatever its other calls do.
|
|
599
606
|
*/
|
|
@@ -627,7 +634,7 @@ export const childDelayOf = (s: WardicStaggerConfig, index: number, total: numbe
|
|
|
627
634
|
const DELAY_FAILED = "wardic.stagger: a delayChildren function failed"
|
|
628
635
|
|
|
629
636
|
/** `delayChildren` called for a child, a throw its child's: no delay, reported once a run on `failures`. */
|
|
630
|
-
// A child's run is its
|
|
637
|
+
// A child's run is its Subject's, whatever name it's staggered under: a parent's own transition staggers
|
|
631
638
|
// every name with one function, so a run kept by name would report it again for each. (The review's: a
|
|
632
639
|
// child staggered under two names at once, one function throwing and one not, is reported at each change.)
|
|
633
640
|
const calledDelayOf = (delayChildren: Config.WardicStagger, index: number, total: number, failures: DelayFailures | undefined): number => {
|
|
@@ -646,7 +653,7 @@ const calledDelayOf = (delayChildren: Config.WardicStagger, index: number, total
|
|
|
646
653
|
}
|
|
647
654
|
}
|
|
648
655
|
|
|
649
|
-
/** A name's orchestration (#297): its stagger config, and its own `when`, from its own transition, else the
|
|
656
|
+
/** A name's orchestration (#297): its stagger config, and its own `when`, from its own transition, else the Subject's. */
|
|
650
657
|
export interface NameConfig {
|
|
651
658
|
readonly stagger: WardicStaggerConfig
|
|
652
659
|
readonly when: "beforeChildren" | "afterChildren" | undefined
|
|
@@ -674,7 +681,7 @@ export const staggerWith = ({ staggerChildren = 0, delayChildren = 0, from = "fi
|
|
|
674
681
|
export const sameStagger = (a: WardicStaggerConfig, b: WardicStaggerConfig): boolean =>
|
|
675
682
|
a.amount === b.amount && a.delayChildren === b.delayChildren && a.from === b.from && a.direction === b.direction
|
|
676
683
|
|
|
677
|
-
/** What
|
|
684
|
+
/** What a Subject provides when it has no variants of its own: its parent's context, unless `inherit={false}`. */
|
|
678
685
|
export const passedThrough = (
|
|
679
686
|
config: VariantConfig,
|
|
680
687
|
parent: WardicVariantContextValue | undefined,
|
|
@@ -688,7 +695,7 @@ export const INERT_REGISTRATION: WardicChildRegistration = Object.freeze({
|
|
|
688
695
|
dispose: () => {},
|
|
689
696
|
})
|
|
690
697
|
|
|
691
|
-
/**
|
|
698
|
+
/** A Subject's place in variant orchestration during a server render (ADR-0021). */
|
|
692
699
|
export interface ServerVariantNode {
|
|
693
700
|
/** What its children read: the same context the client builds, with inert orchestration. */
|
|
694
701
|
readonly provided: WardicVariantContextValue | undefined
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a `WardicConfig` gives the
|
|
2
|
+
* What a `WardicConfig` gives the Wards' Subjects below it (#434, Motion's `MotionConfig`), on
|
|
3
3
|
* every binding: its **Config transition**, its reduced motion and whether its
|
|
4
4
|
* animations are skipped (#468).
|
|
5
5
|
*
|
|
6
|
-
* - **The Config transition is
|
|
7
|
-
* `{ ...config, ...props }`: whatever reads the
|
|
6
|
+
* - **The Config transition is a Subject's own when it gives none,** as Motion's
|
|
7
|
+
* `{ ...config, ...props }`: whatever reads the Subject's `transition` reads it, a Variant child's in
|
|
8
8
|
* place of its parent's (Q3).
|
|
9
|
-
* - **Its reduced motion** (ADR-0029) is the
|
|
10
|
-
* reads its `MotionConfig`'s per
|
|
11
|
-
* - **`skipAnimations`** (#468) makes every animation of the
|
|
9
|
+
* - **Its reduced motion** (ADR-0029) is the Subject's, over the `WardicProvider`'s (Q2), as Motion
|
|
10
|
+
* reads its `MotionConfig`'s per Subject.
|
|
11
|
+
* - **`skipAnimations`** (#468) makes every animation of the Subjects below a **Skipped animation**,
|
|
12
12
|
* Motion's `MotionConfig` `skipAnimations`, whatever their reduced motion.
|
|
13
13
|
* - **`isValidProp`** (#443) keeps the props it says aren't valid from being passed on, Motion's
|
|
14
14
|
* `MotionConfig` `isValidProp`.
|
|
@@ -33,7 +33,7 @@ import * as VariantTarget from "./VariantTarget.ts"
|
|
|
33
33
|
|
|
34
34
|
/** What a `WardicConfig` gives below it (#434): one value per config, read where a binding reads it. */
|
|
35
35
|
export interface WardicConfigValue {
|
|
36
|
-
/** Its **Config transition**: read when
|
|
36
|
+
/** Its **Config transition**: read when a Subject's transition is, so a change starts nothing by itself. */
|
|
37
37
|
readonly transition: () => Config.WardicTransition | undefined
|
|
38
38
|
/**
|
|
39
39
|
* Its reduced motion (ADR-0029): its own, else an enclosing config's, else `undefined` for the
|
|
@@ -46,8 +46,8 @@ export interface WardicConfigValue {
|
|
|
46
46
|
*/
|
|
47
47
|
readonly skipAnimations: () => boolean | undefined
|
|
48
48
|
/**
|
|
49
|
-
* Which of
|
|
50
|
-
* own, else an enclosing config's, else `undefined`, every one. Read as each
|
|
49
|
+
* Which of a Ward's own props it passes on (#443, Motion's `MotionConfig` `isValidProp`): its
|
|
50
|
+
* own, else an enclosing config's, else `undefined`, every one. Read as each Subject is made.
|
|
51
51
|
*/
|
|
52
52
|
readonly isValidProp: () => ((key: string) => boolean) | undefined
|
|
53
53
|
/**
|
|
@@ -59,7 +59,7 @@ export interface WardicConfigValue {
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* A `WardicConfig`'s transition (#434): its own, laid over its parent's with `inherit: true` (as a
|
|
62
|
-
* variant's own is over the
|
|
62
|
+
* variant's own is over the Subject's), else its parent's when it gives none.
|
|
63
63
|
*/
|
|
64
64
|
export const configTransitionOf = (own: Config.WardicVariantTransition | undefined, parent: WardicConfigValue | undefined): Config.WardicTransition | undefined =>
|
|
65
65
|
VariantTarget.transitionOfTarget(own, parentTransitionOf(parent))
|
|
@@ -120,14 +120,14 @@ export const pointMapOptionOf = (read: () => Config.WardicTransformPoint | undef
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
/** The nearest config's `isValidProp` (#443), as
|
|
123
|
+
/** The nearest config's `isValidProp` (#443), as a Subject is made: `undefined` for none. */
|
|
124
124
|
export const isValidPropOf = (config: WardicConfigValue | undefined): ((key: string) => boolean) | undefined => {
|
|
125
125
|
if (Predicate.isUndefined(config)) return undefined
|
|
126
126
|
return config.isValidProp()
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* Whether
|
|
130
|
+
* Whether a Subject's animations are skipped (#468), read when each starts: its nearest config's
|
|
131
131
|
* `skipAnimations`. With no config above, never, and nothing made.
|
|
132
132
|
*/
|
|
133
133
|
export const skipAnimationsOf = (config: WardicConfigValue | undefined): (() => boolean) => {
|
|
@@ -135,7 +135,7 @@ export const skipAnimationsOf = (config: WardicConfigValue | undefined): (() =>
|
|
|
135
135
|
return () => config.skipAnimations() === true
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
/** The reduced motion
|
|
138
|
+
/** The reduced motion a Subject's nearest config sets (#434), now: `undefined` for none, the provider's. */
|
|
139
139
|
export const settingOf = (config: WardicConfigValue | undefined): ReducedMotion.Config | undefined => {
|
|
140
140
|
if (Predicate.isUndefined(config)) return undefined
|
|
141
141
|
return config.reducedMotion()
|