@wardic/core 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/Arc.d.ts +2 -2
  2. package/dist/Arc.js +1 -1
  3. package/dist/BaseValue.d.ts +11 -10
  4. package/dist/BaseValue.d.ts.map +1 -1
  5. package/dist/BaseValue.js +12 -15
  6. package/dist/BaseValue.js.map +1 -1
  7. package/dist/Batch.d.ts +12 -6
  8. package/dist/Batch.d.ts.map +1 -1
  9. package/dist/Batch.js +374 -30
  10. package/dist/Batch.js.map +1 -1
  11. package/dist/Clock.d.ts +16 -0
  12. package/dist/Clock.d.ts.map +1 -1
  13. package/dist/Clock.js +22 -8
  14. package/dist/Clock.js.map +1 -1
  15. package/dist/DefaultTransition.d.ts +3 -2
  16. package/dist/DefaultTransition.d.ts.map +1 -1
  17. package/dist/DefaultTransition.js +5 -3
  18. package/dist/DefaultTransition.js.map +1 -1
  19. package/dist/Drag.d.ts +24 -9
  20. package/dist/Drag.d.ts.map +1 -1
  21. package/dist/Drag.js +10 -10
  22. package/dist/Drag.js.map +1 -1
  23. package/dist/DragActivity.js +3 -3
  24. package/dist/DragRecognizer.d.ts +14 -8
  25. package/dist/DragRecognizer.d.ts.map +1 -1
  26. package/dist/DragRecognizer.js +93 -34
  27. package/dist/DragRecognizer.js.map +1 -1
  28. package/dist/Easing.d.ts +1 -1
  29. package/dist/Easing.js +1 -1
  30. package/dist/Frame.d.ts.map +1 -1
  31. package/dist/Frame.js +5 -3
  32. package/dist/Frame.js.map +1 -1
  33. package/dist/InputFeed.d.ts +11 -8
  34. package/dist/InputFeed.d.ts.map +1 -1
  35. package/dist/InputFeed.js +18 -37
  36. package/dist/InputFeed.js.map +1 -1
  37. package/dist/InputSource.d.ts +3 -3
  38. package/dist/InputSource.js +2 -2
  39. package/dist/Interpolator.d.ts +2 -2
  40. package/dist/Interpolator.js +2 -2
  41. package/dist/InterpolatorRegistry.d.ts +29 -15
  42. package/dist/InterpolatorRegistry.d.ts.map +1 -1
  43. package/dist/InterpolatorRegistry.js +17 -8
  44. package/dist/InterpolatorRegistry.js.map +1 -1
  45. package/dist/LiveValue.d.ts +16 -9
  46. package/dist/LiveValue.d.ts.map +1 -1
  47. package/dist/LiveValue.js +204 -27
  48. package/dist/LiveValue.js.map +1 -1
  49. package/dist/Machine.d.ts +21 -8
  50. package/dist/Machine.d.ts.map +1 -1
  51. package/dist/Machine.js +184 -60
  52. package/dist/Machine.js.map +1 -1
  53. package/dist/Playback.d.ts.map +1 -1
  54. package/dist/Playback.js +16 -9
  55. package/dist/Playback.js.map +1 -1
  56. package/dist/Projection.d.ts +9 -9
  57. package/dist/Projection.js +2 -2
  58. package/dist/Recognizer.d.ts +2 -2
  59. package/dist/Recognizer.d.ts.map +1 -1
  60. package/dist/Recognizer.js +15 -10
  61. package/dist/Recognizer.js.map +1 -1
  62. package/dist/ReducedMotion.d.ts +4 -4
  63. package/dist/ReducedMotion.js +6 -6
  64. package/dist/Renderer.d.ts +5 -5
  65. package/dist/Renderer.js +6 -6
  66. package/dist/Renderer.js.map +1 -1
  67. package/dist/Reorder.d.ts +1 -1
  68. package/dist/Reorder.d.ts.map +1 -1
  69. package/dist/Reorder.js +2 -1
  70. package/dist/Reorder.js.map +1 -1
  71. package/dist/ScrollSource.d.ts +1 -1
  72. package/dist/ScrollSource.d.ts.map +1 -1
  73. package/dist/Sequence.d.ts +1 -1
  74. package/dist/SharedSource.d.ts +3 -3
  75. package/dist/SharedSource.js +5 -5
  76. package/dist/SharedSource.js.map +1 -1
  77. package/dist/Spring.d.ts.map +1 -1
  78. package/dist/Spring.js +2 -1
  79. package/dist/Spring.js.map +1 -1
  80. package/dist/Values.d.ts +2 -2
  81. package/dist/Values.js +1 -1
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/internal/carried.d.ts +13 -0
  85. package/dist/internal/carried.d.ts.map +1 -0
  86. package/dist/internal/carried.js +23 -0
  87. package/dist/internal/carried.js.map +1 -0
  88. package/dist/internal/firstSteps.d.ts +66 -0
  89. package/dist/internal/firstSteps.d.ts.map +1 -0
  90. package/dist/internal/firstSteps.js +107 -0
  91. package/dist/internal/firstSteps.js.map +1 -0
  92. package/dist/internal/frameLoop.d.ts +11 -3
  93. package/dist/internal/frameLoop.d.ts.map +1 -1
  94. package/dist/internal/frameLoop.js +190 -39
  95. package/dist/internal/frameLoop.js.map +1 -1
  96. package/dist/internal/guarded.d.ts +16 -0
  97. package/dist/internal/guarded.d.ts.map +1 -0
  98. package/dist/internal/guarded.js +68 -0
  99. package/dist/internal/guarded.js.map +1 -0
  100. package/dist/internal/lerpsNumbers.d.ts +11 -0
  101. package/dist/internal/lerpsNumbers.d.ts.map +1 -0
  102. package/dist/internal/lerpsNumbers.js +38 -0
  103. package/dist/internal/lerpsNumbers.js.map +1 -0
  104. package/dist/internal/options.d.ts +7 -7
  105. package/dist/internal/options.d.ts.map +1 -1
  106. package/dist/internal/options.js +10 -10
  107. package/dist/internal/options.js.map +1 -1
  108. package/dist/internal/stepper.d.ts +21 -4
  109. package/dist/internal/stepper.d.ts.map +1 -1
  110. package/dist/internal/stepper.js +21 -5
  111. package/dist/internal/stepper.js.map +1 -1
  112. package/dist/internal/tracing.d.ts +1 -1
  113. package/dist/internal/tracing.js +1 -1
  114. package/dist/unstable/AnimationControls.d.ts +45 -39
  115. package/dist/unstable/AnimationControls.d.ts.map +1 -1
  116. package/dist/unstable/AnimationControls.js +59 -35
  117. package/dist/unstable/AnimationControls.js.map +1 -1
  118. package/dist/unstable/AppearHandoff.d.ts +11 -5
  119. package/dist/unstable/AppearHandoff.d.ts.map +1 -1
  120. package/dist/unstable/AppearHandoff.js.map +1 -1
  121. package/dist/unstable/BatchCalls.d.ts +2 -2
  122. package/dist/unstable/BatchCalls.js +5 -5
  123. package/dist/unstable/Config.d.ts +21 -17
  124. package/dist/unstable/Config.d.ts.map +1 -1
  125. package/dist/unstable/Config.js.map +1 -1
  126. package/dist/unstable/FirstSteps.d.ts +25 -0
  127. package/dist/unstable/FirstSteps.d.ts.map +1 -0
  128. package/dist/unstable/FirstSteps.js +2 -0
  129. package/dist/unstable/FirstSteps.js.map +1 -0
  130. package/dist/unstable/FlushGate.d.ts +54 -50
  131. package/dist/unstable/FlushGate.d.ts.map +1 -1
  132. package/dist/unstable/FlushGate.js +201 -77
  133. package/dist/unstable/FlushGate.js.map +1 -1
  134. package/dist/unstable/FrameEffects.d.ts +6 -3
  135. package/dist/unstable/FrameEffects.d.ts.map +1 -1
  136. package/dist/unstable/FrameEffects.js +14 -3
  137. package/dist/unstable/FrameEffects.js.map +1 -1
  138. package/dist/unstable/FrameTime.d.ts +1 -1
  139. package/dist/unstable/FrameTime.js +1 -1
  140. package/dist/unstable/Imperative.d.ts +42 -13
  141. package/dist/unstable/Imperative.d.ts.map +1 -1
  142. package/dist/unstable/Imperative.js +279 -88
  143. package/dist/unstable/Imperative.js.map +1 -1
  144. package/dist/unstable/MeasuredPairs.d.ts +6 -2
  145. package/dist/unstable/MeasuredPairs.d.ts.map +1 -1
  146. package/dist/unstable/MeasuredPairs.js.map +1 -1
  147. package/dist/unstable/OwnValues.js +1 -1
  148. package/dist/unstable/PresenceRecord.d.ts +30 -26
  149. package/dist/unstable/PresenceRecord.d.ts.map +1 -1
  150. package/dist/unstable/PresenceRecord.js +8 -8
  151. package/dist/unstable/PresenceRecord.js.map +1 -1
  152. package/dist/unstable/Projector.d.ts +34 -0
  153. package/dist/unstable/Projector.d.ts.map +1 -0
  154. package/dist/unstable/Projector.js +9 -0
  155. package/dist/unstable/Projector.js.map +1 -0
  156. package/dist/unstable/Report.d.ts +8 -1
  157. package/dist/unstable/Report.d.ts.map +1 -1
  158. package/dist/unstable/Report.js +18 -2
  159. package/dist/unstable/Report.js.map +1 -1
  160. package/dist/unstable/RetargetLegs.d.ts +7 -1
  161. package/dist/unstable/RetargetLegs.d.ts.map +1 -1
  162. package/dist/unstable/RetargetLegs.js +24 -8
  163. package/dist/unstable/RetargetLegs.js.map +1 -1
  164. package/dist/unstable/Spine.d.ts +123 -68
  165. package/dist/unstable/Spine.d.ts.map +1 -1
  166. package/dist/unstable/Spine.js +319 -167
  167. package/dist/unstable/Spine.js.map +1 -1
  168. package/dist/unstable/Stops.d.ts +3 -3
  169. package/dist/unstable/Stops.js +4 -4
  170. package/dist/unstable/Subject.d.ts +2 -2
  171. package/dist/unstable/Subject.js +2 -2
  172. package/dist/unstable/Timelines.d.ts +11 -11
  173. package/dist/unstable/Timelines.d.ts.map +1 -1
  174. package/dist/unstable/Timelines.js +3 -3
  175. package/dist/unstable/VariantTarget.d.ts +32 -10
  176. package/dist/unstable/VariantTarget.d.ts.map +1 -1
  177. package/dist/unstable/VariantTarget.js +73 -20
  178. package/dist/unstable/VariantTarget.js.map +1 -1
  179. package/dist/unstable/VariantTree.d.ts +68 -34
  180. package/dist/unstable/VariantTree.d.ts.map +1 -1
  181. package/dist/unstable/VariantTree.js +83 -36
  182. package/dist/unstable/VariantTree.js.map +1 -1
  183. package/dist/unstable/WardicConfigValue.d.ts +13 -13
  184. package/dist/unstable/WardicConfigValue.d.ts.map +1 -1
  185. package/dist/unstable/WardicConfigValue.js +4 -4
  186. package/dist/unstable/WardicConfigValue.js.map +1 -1
  187. package/package.json +1 -1
  188. package/src/Arc.ts +3 -3
  189. package/src/BaseValue.ts +18 -21
  190. package/src/Batch.ts +391 -27
  191. package/src/Clock.ts +29 -8
  192. package/src/DefaultTransition.ts +5 -3
  193. package/src/Drag.ts +32 -14
  194. package/src/DragActivity.ts +3 -3
  195. package/src/DragRecognizer.ts +118 -41
  196. package/src/Easing.ts +1 -1
  197. package/src/Frame.ts +5 -3
  198. package/src/InputFeed.ts +39 -42
  199. package/src/InputSource.ts +5 -5
  200. package/src/Interpolator.ts +3 -3
  201. package/src/InterpolatorRegistry.ts +22 -13
  202. package/src/LiveValue.ts +186 -30
  203. package/src/Machine.ts +252 -81
  204. package/src/Playback.ts +15 -9
  205. package/src/Projection.ts +9 -9
  206. package/src/Recognizer.ts +16 -10
  207. package/src/ReducedMotion.ts +6 -6
  208. package/src/Renderer.ts +6 -6
  209. package/src/Reorder.ts +3 -2
  210. package/src/ScrollSource.ts +1 -1
  211. package/src/Sequence.ts +1 -1
  212. package/src/SharedSource.ts +5 -5
  213. package/src/Spring.ts +2 -1
  214. package/src/Values.ts +2 -2
  215. package/src/index.ts +1 -1
  216. package/src/internal/carried.ts +22 -0
  217. package/src/internal/firstSteps.ts +139 -0
  218. package/src/internal/frameLoop.ts +203 -41
  219. package/src/internal/guarded.ts +69 -0
  220. package/src/internal/lerpsNumbers.ts +53 -0
  221. package/src/internal/options.ts +10 -10
  222. package/src/internal/stepper.ts +33 -6
  223. package/src/internal/tracing.ts +1 -1
  224. package/src/unstable/AnimationControls.ts +88 -57
  225. package/src/unstable/AppearHandoff.ts +13 -6
  226. package/src/unstable/BatchCalls.ts +5 -5
  227. package/src/unstable/Config.ts +23 -17
  228. package/src/unstable/FirstSteps.ts +26 -0
  229. package/src/unstable/FlushGate.ts +250 -108
  230. package/src/unstable/FrameEffects.ts +17 -4
  231. package/src/unstable/FrameTime.ts +1 -1
  232. package/src/unstable/Imperative.ts +342 -101
  233. package/src/unstable/MeasuredPairs.ts +7 -1
  234. package/src/unstable/OwnValues.ts +1 -1
  235. package/src/unstable/PresenceRecord.ts +33 -29
  236. package/src/unstable/Projector.ts +45 -0
  237. package/src/unstable/Report.ts +20 -2
  238. package/src/unstable/RetargetLegs.ts +24 -9
  239. package/src/unstable/Spine.ts +399 -202
  240. package/src/unstable/Stops.ts +6 -6
  241. package/src/unstable/Subject.ts +2 -2
  242. package/src/unstable/Timelines.ts +12 -12
  243. package/src/unstable/VariantTarget.ts +102 -23
  244. package/src/unstable/VariantTree.ts +123 -42
  245. package/src/unstable/WardicConfigValue.ts +13 -13
@@ -1,19 +1,19 @@
1
1
  /**
2
- * The rules of an element's place in variant orchestration (ADR-0007, #50), on every binding: the
3
- * names an element hands its children and inherits from its parent, the values it starts from, and
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
- * - An element that names its own variants, a name on any variant prop (`initial`, `animate`, the
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
- * - An element 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 element passes its
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,13 +22,18 @@
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
- // element's place in variant orchestration in core.
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
+ import * as Report from "./Report.ts"
28
29
  import * as Stops from "./Stops.ts"
30
+ import type * as WardicServices from "./WardicServices.ts"
29
31
  import * as Arr from "effect/Array"
30
32
  import * as Bool from "effect/Boolean"
33
+ import * as Cause from "effect/Cause"
34
+ import * as Effect from "effect/Effect"
31
35
  import { constTrue, constUndefined, identity } from "effect/Function"
36
+ import type * as Option from "effect/Option"
32
37
  import * as Predicate from "effect/Predicate"
33
38
  import * as UndefinedOr from "effect/UndefinedOr"
34
39
  import * as AnimationControls from "./AnimationControls.ts"
@@ -93,7 +98,7 @@ export interface WardicStaggerConfig {
93
98
  * inherit).
94
99
  * - `initial` — the parent's `initial` NAME, or `false`, read once (#50, #134).
95
100
  *
96
- * Every Wardic element provides one (#50): its own if it has variants of its own, else its
101
+ * Every Ward's Subject provides one (#50): its own if it has variants of its own, else its
97
102
  * parent's, passed through (`variant-node.ts`).
98
103
  * - `transition` — the parent's transition, inherited as the DEFAULT for
99
104
  * children that supply no local `transition`.
@@ -107,10 +112,10 @@ export type GestureLayer = "inView" | "focused" | "hovered" | "pressed" | "dragg
107
112
  /** The gesture layers in Motion's priority, lowest first. */
108
113
  export const GESTURE_LAYERS: ReadonlyArray<GestureLayer> = ["inView", "focused", "hovered", "pressed", "dragged"]
109
114
 
110
- /** The variant names an element hands its Variant children for its active gestures (#291): a name or a list each (#297). */
115
+ /** The variant names a Subject hands its Variant children for its active gestures (#291): a name or a list each (#297). */
111
116
  export type GestureNames = Readonly<Partial<Record<GestureLayer, Config.WardicVariantLabels | undefined>>>
112
117
 
113
- /** No gesture on: what an element with none active hands down. */
118
+ /** No gesture on: what a Subject with none active hands down. */
114
119
  export const NO_GESTURE_NAMES: GestureNames = {}
115
120
 
116
121
  /** Two {@link GestureNames} the same: the same names for each gesture, a list name by name (#297). */
@@ -124,7 +129,7 @@ export type GestureStates = Readonly<Record<GestureLayer, boolean>>
124
129
  export const NO_GESTURE_STATES: GestureStates = { inView: false, focused: false, hovered: false, pressed: false, dragged: false }
125
130
 
126
131
  /**
127
- * What an element hands its Variant children for its gestures (#291, Motion's `setActive` and variant
132
+ * What a Subject hands its Variant children for its gestures (#291, Motion's `setActive` and variant
128
133
  * context): whether each is on (its own, or its own provider's), and each one's label (its own
129
134
  * `while*`, if a name, else the one it took). A Variant child's gesture is on while its provider's is.
130
135
  */
@@ -133,7 +138,7 @@ export interface GestureHandDown {
133
138
  readonly names: GestureNames
134
139
  }
135
140
 
136
- /** Nothing on, no labels: what an element hands down with no provider and no gesture. */
141
+ /** Nothing on, no labels: what a Subject hands down with no provider and no gesture. */
137
142
  export const NO_HAND_DOWN: GestureHandDown = { on: NO_GESTURE_STATES, names: NO_GESTURE_NAMES }
138
143
 
139
144
  /** Two hand-downs the same: each gesture on alike, with the same label. */
@@ -142,7 +147,7 @@ export const sameHandDown = (a: GestureHandDown, b: GestureHandDown): boolean =>
142
147
 
143
148
  /** What a context hands down, nothing without a context or its gestures. */
144
149
  export const handDownFrom = (context: WardicVariantContextValue | undefined): GestureHandDown => {
145
- // Per Retarget, per element: guards, nothing made (most elements have no provider).
150
+ // Per Retarget, per Subject: guards, nothing made (most Subjects have no provider).
146
151
  if (Predicate.isUndefined(context)) return NO_HAND_DOWN
147
152
  const gestures = context.gestures
148
153
  if (Predicate.isUndefined(gestures)) return NO_HAND_DOWN
@@ -173,7 +178,7 @@ const labelOf = (own: object | Config.WardicVariantLabels | undefined, inherited
173
178
  return inherited
174
179
  }
175
180
 
176
- /** What an element hands down (#291), from its config, its own states, and what it takes. */
181
+ /** What a Subject hands down (#291), from its config, its own states, and what it takes. */
177
182
  export const handDownOf = (config: GestureConfig, own: GestureStates, above: GestureHandDown): GestureHandDown => ({
178
183
  on: gesturesOn(own, above.on),
179
184
  names: {
@@ -313,7 +318,7 @@ export interface WardicVariantContextValue {
313
318
  readonly staggerFor?: (name: string | undefined) => WardicStaggerConfig
314
319
  /**
315
320
  * For a list: whether a Variant child's keys of `name` may start, that name's own
316
- * `beforeChildren`: true unless it has one and this element's keys of that name haven't settled
321
+ * `beforeChildren`: true unless it has one and this Subject's keys of that name haven't settled
317
322
  * since its list last changed. Optional: left out, always.
318
323
  */
319
324
  readonly mayStartFor?: (name: string) => boolean
@@ -341,7 +346,7 @@ export interface WardicVariantContextValue {
341
346
  readonly appearGroup?: unknown
342
347
  }
343
348
 
344
- /** The part of an element's config its place in variant orchestration reads. */
349
+ /** The part of a Subject's config its place in variant orchestration reads. */
345
350
  export interface VariantConfig extends GestureConfig {
346
351
  readonly initial?: object | Config.WardicVariantLabels | false | undefined
347
352
  readonly animate?: object | Config.WardicVariantLabels | undefined
@@ -358,7 +363,7 @@ export interface VariantConfig extends GestureConfig {
358
363
  readonly controlled?: boolean | undefined
359
364
  }
360
365
 
361
- /** An `initial` an element hands its children: a variant name or list (#297), `false` (#134), or `undefined` for a values map or nothing. */
366
+ /** An `initial` a Subject hands its children: a variant name or list (#297), `false` (#134), or `undefined` for a values map or nothing. */
362
367
  export const initialNameOf = (entry: object | Config.WardicVariantLabels | false | undefined): Config.WardicVariantLabels | false | undefined =>
363
368
  Bool.match(entry === false, { onTrue: () => false as const, onFalse: () => nameOf(entry as object | Config.WardicVariantLabels | undefined) })
364
369
 
@@ -385,21 +390,21 @@ export const namesOwnVariants = (config: VariantConfig): boolean =>
385
390
  VariantTarget.isLabels(config.whileDrag) ||
386
391
  VariantTarget.isLabels(config.exit)
387
392
 
388
- /** Whether an element has variants of its own, so Variant children join it (Motion's `isVariantNode`). */
393
+ /** Whether a Subject has variants of its own, so Variant children join it (Motion's `isVariantNode`). */
389
394
  export const hasOwnVariants = (config: VariantConfig): boolean =>
390
395
  Predicate.isNotUndefined(config.variants) || namesOwnVariants(config)
391
396
 
392
397
  /**
393
- * Whether an element changes what its children read, so it renders its variant context's
394
- * Provider (#50): it has variants of its own, or it sets `inherit={false}`. Any other element hands
398
+ * Whether a Subject changes what its children read, so it renders its variant context's
399
+ * Provider (#50): it has variants of its own, or it sets `inherit={false}`. Any other Subject hands
395
400
  * its children its parent's context as it is, so it renders none. Decided once, at setup, from the
396
401
  * same props on a server and on the client, so the nesting never changes after mount.
397
402
  */
398
403
  export const changesContext = (config: VariantConfig): boolean => hasOwnVariants(config) || config.inherit === false
399
404
 
400
405
  /**
401
- * The **Controls change** in effect for an element (#433): its own controls', else the one the context
402
- * it inherits from is in, else none. Per mount, for every element (#460): guards, nothing built.
406
+ * The **Controls change** in effect for a Subject (#433): its own controls', else the one the context
407
+ * it inherits from is in, else none. Per mount, for every Subject (#460): guards, nothing built.
403
408
  */
404
409
  export const controlsChangeOf = (
405
410
  controls: Reactivity.Accessor<AnimationControls.ControlsChange | undefined> | undefined,
@@ -412,22 +417,22 @@ export const controlsChangeOf = (
412
417
  return change
413
418
  }
414
419
 
415
- /** Whether an element is a **Variant child** (CONTEXT.md). */
420
+ /** Whether a Subject is a **Variant child** (CONTEXT.md). */
416
421
  export const isVariantChild = (config: VariantConfig): boolean =>
417
422
  Predicate.isNotUndefined(config.variants) && !namesOwnVariants(config) && config.inherit !== false
418
423
 
419
- /** The context an element inherits names and its default transition from: its parent's, for a Variant child. */
424
+ /** The context a Subject inherits names and its default transition from: its parent's, for a Variant child. */
420
425
  export const inheritedContext = (
421
426
  config: VariantConfig,
422
427
  parent: WardicVariantContextValue | undefined,
423
428
  ): WardicVariantContextValue | undefined => {
424
- // Per element at mount (#540): statements.
429
+ // Per Subject at mount (#540): statements.
425
430
  if (isVariantChild(config)) return parent
426
431
  return undefined
427
432
  }
428
433
 
429
434
  /**
430
- * The `initial` an element's Starting style resolves: its own, else the `initial` name (or `false`) of
435
+ * The `initial` a Subject's Starting style resolves: its own, else the `initial` name (or `false`) of
431
436
  * the context it inherits from (#50, #134). Read once, as every `initial` is.
432
437
  */
433
438
  export const initialOf = (
@@ -439,7 +444,7 @@ export const initialOf = (
439
444
  onUndefined: () => UndefinedOr.match(inherited, { onUndefined: constUndefined, onDefined: (context) => context.initial }),
440
445
  })
441
446
 
442
- /** The `animate` an element starts at with `initial={false}`: its own, else the name its context hands down (#134). Read once, untracked. */
447
+ /** The `animate` a Subject starts at with `initial={false}`: its own, else the name its context hands down (#134). Read once, untracked. */
443
448
  const animateOf = (
444
449
  config: VariantConfig,
445
450
  inherited: WardicVariantContextValue | undefined,
@@ -451,7 +456,7 @@ const animateOf = (
451
456
  })
452
457
 
453
458
  /**
454
- * Whether an element starts at its `animate`, with nothing animating at mount (#134, Motion's
459
+ * Whether a Subject starts at its `animate`, with nothing animating at mount (#134, Motion's
455
460
  * `isInitialAnimationBlocked`): its `initial` (own or inherited) is `false`, or it renders with an
456
461
  * `<AnimatePresence initial={false}>`'s first render (`presenceBlocks`).
457
462
  */
@@ -462,7 +467,7 @@ export const startsAtAnimate = (
462
467
  ): boolean => presenceBlocks || initialOf(config, inherited) === false
463
468
 
464
469
  /**
465
- * Whether an element's mount tells nothing (#448, Motion's `animation-state.ts`): it
470
+ * Whether a Subject's mount tells nothing (#448, Motion's `animation-state.ts`): it
466
471
  * {@link startsAtAnimate}, or its `initial` (own, else inherited) is the same name, list or values map
467
472
  * as its `animate` (own, else inherited). Its first Retarget, landing with nothing to animate, is told
468
473
  * to no one. Read once, untracked.
@@ -480,8 +485,14 @@ export const startsQuiet = (
480
485
  return VariantTarget.sameLabels(initial as Config.WardicVariantLabels, animateOf(config, inherited, untrack) as Config.WardicVariantLabels)
481
486
  }
482
487
 
488
+ /** What a Subject starts from, and the first of its variants whose resolver threw (#979). */
489
+ export interface Starting {
490
+ readonly values: Values.Values
491
+ readonly failure: Option.Option<VariantTarget.VariantFailure>
492
+ }
493
+
483
494
  /**
484
- * The values an element starts from, its Starting style's input (ADR-0003): its `initial` (own, else
495
+ * The values a Subject starts from, its Starting style's input (ADR-0003): its `initial` (own, else
485
496
  * inherited, #50), or, when it {@link startsAtAnimate}, its `animate` (own, else inherited), as
486
497
  * Motion's `initial={false}` (#134). Read once: an inherited name is read through `untrack`.
487
498
  */
@@ -490,11 +501,37 @@ export const startingValuesOf = (
490
501
  inherited: WardicVariantContextValue | undefined,
491
502
  presenceBlocks: boolean,
492
503
  untrack: Reactivity.Reactivity["untrack"],
504
+ ): Values.Values => startingValuesFrom(config, inherited, presenceBlocks, untrack, VariantTarget.startingVariantsOf(config.variants, config.custom).variants)
505
+
506
+ /**
507
+ * {@link startingValuesOf}, with what a resolver among the Subject's variants threw: its entry gives no
508
+ * values, and the Subject starts at the rest (#979).
509
+ */
510
+ export const startingOf = (
511
+ config: VariantConfig,
512
+ inherited: WardicVariantContextValue | undefined,
513
+ presenceBlocks: boolean,
514
+ untrack: Reactivity.Reactivity["untrack"],
515
+ ): Starting => {
516
+ const variants = VariantTarget.startingVariantsOf(config.variants, config.custom)
517
+ return { values: startingValuesFrom(config, inherited, presenceBlocks, untrack, variants.variants), failure: variants.failure }
518
+ }
519
+
520
+ /**
521
+ * {@link startingValuesOf} from its variants already resolved to values (`VariantTarget.startingVariantsOf`):
522
+ * what a Subject's start reads, which reads their failure too.
523
+ */
524
+ export const startingValuesFrom = (
525
+ config: VariantConfig,
526
+ inherited: WardicVariantContextValue | undefined,
527
+ presenceBlocks: boolean,
528
+ untrack: Reactivity.Reactivity["untrack"],
529
+ variants: object | undefined,
493
530
  ): Values.Values => {
494
531
  const atAnimate = startsAtAnimate(config, inherited, presenceBlocks)
495
532
  const animate = animateOf(config, inherited, untrack)
496
533
  const initial = initialOf(config, inherited)
497
- // Per element at mount (#540): statements. Starting at `animate` resolves as `initial={false}`,
534
+ // Per Subject at mount (#540): statements. Starting at `animate` resolves as `initial={false}`,
498
535
  // and its first target is `animate`.
499
536
  let from = initial
500
537
  let first = initial
@@ -502,11 +539,11 @@ export const startingValuesOf = (
502
539
  from = false
503
540
  first = animate
504
541
  }
542
+ // Dynamic variants resolved first (#277): `@wardic/dom`'s Starting style reads values maps only.
505
543
  const values = Stops.resolveInitial({
506
544
  initial: from,
507
545
  animate,
508
- // Dynamic variants resolved first (#277): `@wardic/dom`'s Starting style reads values maps only.
509
- variants: VariantTarget.startingVariantsOf(config.variants, config.custom) as Readonly<Record<string, object | undefined>> | undefined,
546
+ variants: variants as Readonly<Record<string, object | undefined>> | undefined,
510
547
  })
511
548
  // The first target's Transition end (#428, Motion's `makeLatestValues`): set at once, so a server
512
549
  // renders it, and a hydration finds it.
@@ -517,7 +554,7 @@ export const startingValuesOf = (
517
554
  }
518
555
 
519
556
  /**
520
- * A name an element hands its children (Motion's `getCurrentTreeVariants`): `own` if it names its own
557
+ * A name a Subject hands its children (Motion's `getCurrentTreeVariants`): `own` if it names its own
521
558
  * variants, else `fromParent` unless it sets `inherit={false}`.
522
559
  */
523
560
  export const handedDown = <A extends Config.WardicVariantLabels | false>(config: VariantConfig, own: () => A | undefined, fromParent: () => A | undefined): A | undefined =>
@@ -526,11 +563,11 @@ export const handedDown = <A extends Config.WardicVariantLabels | false>(config:
526
563
  onFalse: () => Bool.match(config.inherit === false, { onTrue: constUndefined, onFalse: fromParent }),
527
564
  })
528
565
 
529
- /** An element's own transition, else the one it inherits. */
566
+ /** A Subject's own transition, else the one it inherits. */
530
567
  export const ownOrInherited = (own: Config.WardicTransition | undefined, inherited: WardicVariantContextValue | undefined): Config.WardicTransition | undefined =>
531
568
  UndefinedOr.match(own, { onUndefined: () => UndefinedOr.map(inherited, (context) => context.transition()), onDefined: identity })
532
569
 
533
- /** The stagger config an element's `transition` gives its Variant children. */
570
+ /** The stagger config a Subject's `transition` gives its Variant children. */
534
571
  export const staggerOf = (transition: Config.WardicTransition | undefined): WardicStaggerConfig =>
535
572
  UndefinedOr.match(transition, { onUndefined: () => staggerWith({}), onDefined: staggerWith })
536
573
 
@@ -554,18 +591,62 @@ export const directed = (index: number, total: number, direction: 1 | -1): numbe
554
591
  return index
555
592
  }
556
593
 
594
+ /**
595
+ * 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 Subject's, for its life, its
597
+ * run ended by its next clean call. A presence's exit and a server's Appear timing make one for the event,
598
+ * `event`, whose first throw is reported whatever its other calls do.
599
+ */
600
+ export interface DelayFailures {
601
+ delayFailing: boolean
602
+ readonly runtime: Pick<WardicServices.Runner<never>, "runFork">
603
+ readonly event?: true
604
+ }
605
+
606
+ /** The runtime a server render reports on: Effect's default, as a server holds no app reporters. */
607
+ export const ON_SERVER: Pick<WardicServices.Runner<never>, "runFork"> = { runFork: (effect) => Effect.runFork(effect) }
608
+
609
+ /** One exit's or one render's {@link DelayFailures}, reported on `runtime` at its first throw. */
610
+ export const eventDelayFailuresOf = (runtime: Pick<WardicServices.Runner<never>, "runFork">): DelayFailures => ({ delayFailing: false, runtime, event: true })
611
+
557
612
  /**
558
613
  * A child's delay in a stagger (ADR-0007): its `delayChildren` plus its place from the origin, turned
559
614
  * by its `staggerDirection`. A function `delayChildren` (#436, Motion's `calcChildStagger`) decides it
560
- * whole, from the child's index and the count. Every stagger, a Variant child's, a presence's exit's
561
- * and a server's Appear timing, is placed by it.
615
+ * whole, from the child's index and the count; one that throws gives the child no delay, reported on
616
+ * `failures` (on Effect's default runtime with none) at the first throw of a run of them. Every stagger,
617
+ * a Variant child's, a presence's exit's and a server's Appear timing, is placed by it.
562
618
  */
563
- export const childDelayOf = (s: WardicStaggerConfig, index: number, total: number): number => {
564
- if (Predicate.isFunction(s.delayChildren)) return s.delayChildren(index, total)
619
+ export const childDelayOf = (s: WardicStaggerConfig, index: number, total: number, failures: DelayFailures | undefined): number => {
620
+ if (Predicate.isFunction(s.delayChildren)) return calledDelayOf(s.delayChildren, index, total, failures)
565
621
  return s.delayChildren + Stagger.make(s.amount, { from: s.from })(directed(index, total, s.direction), total)
566
622
  }
567
623
 
568
- /** A name's orchestration (#297): its stagger config, and its own `when`, from its own transition, else the element's. */
624
+ // #979 (ADR-0074, row 43, found by group H's probe): a `delayChildren` function is the app's, called at each
625
+ // child's Retarget, exit and Appear timing with no try. A throw halted Solid 2, came out of Solid 1's
626
+ // setter, and skipped Foldkit's later watches at a patch.
627
+ const DELAY_FAILED = "wardic.stagger: a delayChildren function failed"
628
+
629
+ /** `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 Subject's, whatever name it's staggered under: a parent's own transition staggers
631
+ // every name with one function, so a run kept by name would report it again for each. (The review's: a
632
+ // child staggered under two names at once, one function throwing and one not, is reported at each change.)
633
+ const calledDelayOf = (delayChildren: Config.WardicStagger, index: number, total: number, failures: DelayFailures | undefined): number => {
634
+ try {
635
+ const delay = delayChildren(index, total)
636
+ if (Predicate.isNotUndefined(failures) && failures.delayFailing && failures.event !== true) failures.delayFailing = false
637
+ return delay
638
+ } catch (defect) {
639
+ if (Predicate.isUndefined(failures)) {
640
+ Report.failureOn(undefined, DELAY_FAILED, Cause.die(defect), { index })
641
+ return 0
642
+ }
643
+ if (!failures.delayFailing) failures.runtime.runFork(Report.failure(DELAY_FAILED, Cause.die(defect)).pipe(Effect.annotateLogs({ index })))
644
+ failures.delayFailing = true
645
+ return 0
646
+ }
647
+ }
648
+
649
+ /** A name's orchestration (#297): its stagger config, and its own `when`, from its own transition, else the Subject's. */
569
650
  export interface NameConfig {
570
651
  readonly stagger: WardicStaggerConfig
571
652
  readonly when: "beforeChildren" | "afterChildren" | undefined
@@ -593,7 +674,7 @@ export const staggerWith = ({ staggerChildren = 0, delayChildren = 0, from = "fi
593
674
  export const sameStagger = (a: WardicStaggerConfig, b: WardicStaggerConfig): boolean =>
594
675
  a.amount === b.amount && a.delayChildren === b.delayChildren && a.from === b.from && a.direction === b.direction
595
676
 
596
- /** What an element provides when it has no variants of its own: its parent's context, unless `inherit={false}`. */
677
+ /** What a Subject provides when it has no variants of its own: its parent's context, unless `inherit={false}`. */
597
678
  export const passedThrough = (
598
679
  config: VariantConfig,
599
680
  parent: WardicVariantContextValue | undefined,
@@ -607,7 +688,7 @@ export const INERT_REGISTRATION: WardicChildRegistration = Object.freeze({
607
688
  dispose: () => {},
608
689
  })
609
690
 
610
- /** An element's place in variant orchestration during a server render (ADR-0021). */
691
+ /** A Subject's place in variant orchestration during a server render (ADR-0021). */
611
692
  export interface ServerVariantNode {
612
693
  /** What its children read: the same context the client builds, with inert orchestration. */
613
694
  readonly provided: WardicVariantContextValue | undefined
@@ -1,14 +1,14 @@
1
1
  /**
2
- * What a `WardicConfig` gives the Wardic elements below it (#434, Motion's `MotionConfig`), on
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 an element's own when it gives none,** as Motion's
7
- * `{ ...config, ...props }`: whatever reads the element's `transition` reads it, a Variant child's in
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 element's, over the `WardicProvider`'s (Q2), as Motion
10
- * reads its `MotionConfig`'s per element.
11
- * - **`skipAnimations`** (#468) makes every animation of the elements below a **Skipped animation**,
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 an element's transition is, so a change starts nothing by itself. */
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 an element'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 element is made.
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 element's), else its parent's when it gives none.
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 an element is made: `undefined` for none. */
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 an element's animations are skipped (#468), read when each starts: its nearest config's
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 an element's nearest config sets (#434), now: `undefined` for none, the provider's. */
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()