@wardic/dom 1.3.0 → 1.3.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.
Files changed (136) hide show
  1. package/dist/MeasuredPair.d.ts +14 -1
  2. package/dist/MeasuredPair.d.ts.map +1 -1
  3. package/dist/MeasuredPair.js +11 -13
  4. package/dist/MeasuredPair.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal/appear.d.ts +6 -0
  10. package/dist/internal/appear.d.ts.map +1 -1
  11. package/dist/internal/appear.js +20 -2
  12. package/dist/internal/appear.js.map +1 -1
  13. package/dist/internal/batch-handoff.d.ts.map +1 -1
  14. package/dist/internal/batch-handoff.js +25 -15
  15. package/dist/internal/batch-handoff.js.map +1 -1
  16. package/dist/internal/batch-writer.d.ts +1 -1
  17. package/dist/internal/batch-writer.d.ts.map +1 -1
  18. package/dist/internal/batch-writer.js +26 -6
  19. package/dist/internal/batch-writer.js.map +1 -1
  20. package/dist/internal/clock.d.ts +6 -0
  21. package/dist/internal/clock.d.ts.map +1 -1
  22. package/dist/internal/clock.js +9 -0
  23. package/dist/internal/clock.js.map +1 -1
  24. package/dist/internal/default-transition.d.ts +3 -2
  25. package/dist/internal/default-transition.d.ts.map +1 -1
  26. package/dist/internal/default-transition.js +14 -3
  27. package/dist/internal/default-transition.js.map +1 -1
  28. package/dist/internal/failing.d.ts +9 -0
  29. package/dist/internal/failing.d.ts.map +1 -0
  30. package/dist/internal/failing.js +33 -0
  31. package/dist/internal/failing.js.map +1 -0
  32. package/dist/internal/length-keys.d.ts +19 -0
  33. package/dist/internal/length-keys.d.ts.map +1 -0
  34. package/dist/internal/length-keys.js +77 -0
  35. package/dist/internal/length-keys.js.map +1 -0
  36. package/dist/internal/measured-pairs.d.ts +3 -2
  37. package/dist/internal/measured-pairs.d.ts.map +1 -1
  38. package/dist/internal/measured-pairs.js +60 -23
  39. package/dist/internal/measured-pairs.js.map +1 -1
  40. package/dist/internal/own-values.d.ts.map +1 -1
  41. package/dist/internal/own-values.js +2 -2
  42. package/dist/internal/own-values.js.map +1 -1
  43. package/dist/internal/positional-keys.d.ts +1 -1
  44. package/dist/internal/positional-keys.d.ts.map +1 -1
  45. package/dist/internal/positional-keys.js +4 -2
  46. package/dist/internal/positional-keys.js.map +1 -1
  47. package/dist/internal/projection.d.ts.map +1 -1
  48. package/dist/internal/projection.js +138 -39
  49. package/dist/internal/projection.js.map +1 -1
  50. package/dist/internal/renderer.d.ts +26 -16
  51. package/dist/internal/renderer.d.ts.map +1 -1
  52. package/dist/internal/renderer.js +45 -106
  53. package/dist/internal/renderer.js.map +1 -1
  54. package/dist/internal/scroll.d.ts.map +1 -1
  55. package/dist/internal/scroll.js +26 -2
  56. package/dist/internal/scroll.js.map +1 -1
  57. package/dist/internal/transform-keys.d.ts +22 -0
  58. package/dist/internal/transform-keys.d.ts.map +1 -0
  59. package/dist/internal/transform-keys.js +43 -0
  60. package/dist/internal/transform-keys.js.map +1 -0
  61. package/dist/unstable/AppearAnimations.d.ts +2 -1
  62. package/dist/unstable/AppearAnimations.d.ts.map +1 -1
  63. package/dist/unstable/AppearAnimations.js +73 -22
  64. package/dist/unstable/AppearAnimations.js.map +1 -1
  65. package/dist/unstable/BatchMembers.d.ts +6 -2
  66. package/dist/unstable/BatchMembers.d.ts.map +1 -1
  67. package/dist/unstable/BatchMembers.js +30 -7
  68. package/dist/unstable/BatchMembers.js.map +1 -1
  69. package/dist/unstable/DomValues.js +1 -1
  70. package/dist/unstable/DomValues.js.map +1 -1
  71. package/dist/unstable/DragTrack.d.ts +2 -2
  72. package/dist/unstable/DragTrack.d.ts.map +1 -1
  73. package/dist/unstable/DragTrack.js +34 -8
  74. package/dist/unstable/DragTrack.js.map +1 -1
  75. package/dist/unstable/ElementSetup.d.ts.map +1 -1
  76. package/dist/unstable/ElementSetup.js +2 -1
  77. package/dist/unstable/ElementSetup.js.map +1 -1
  78. package/dist/unstable/GestureFeatures.d.ts +2 -1
  79. package/dist/unstable/GestureFeatures.d.ts.map +1 -1
  80. package/dist/unstable/GestureFeatures.js +18 -37
  81. package/dist/unstable/GestureFeatures.js.map +1 -1
  82. package/dist/unstable/Imperative.d.ts +2 -1
  83. package/dist/unstable/Imperative.d.ts.map +1 -1
  84. package/dist/unstable/Imperative.js.map +1 -1
  85. package/dist/unstable/LiveStyle.d.ts +28 -2
  86. package/dist/unstable/LiveStyle.d.ts.map +1 -1
  87. package/dist/unstable/LiveStyle.js +8 -32
  88. package/dist/unstable/LiveStyle.js.map +1 -1
  89. package/dist/unstable/MemberHold.js +2 -2
  90. package/dist/unstable/MemberHold.js.map +1 -1
  91. package/dist/unstable/PointerValues.d.ts.map +1 -1
  92. package/dist/unstable/PointerValues.js +82 -8
  93. package/dist/unstable/PointerValues.js.map +1 -1
  94. package/dist/unstable/PresenceController.d.ts +5 -2
  95. package/dist/unstable/PresenceController.d.ts.map +1 -1
  96. package/dist/unstable/PresenceController.js +68 -41
  97. package/dist/unstable/PresenceController.js.map +1 -1
  98. package/dist/unstable/ReorderInput.d.ts +2 -2
  99. package/dist/unstable/ReorderInput.js +2 -2
  100. package/dist/unstable/WardConfig.d.ts +13 -4
  101. package/dist/unstable/WardConfig.d.ts.map +1 -1
  102. package/dist/unstable/WardConfig.js.map +1 -1
  103. package/dist/unstable/features/TimelineKeys.d.ts.map +1 -1
  104. package/dist/unstable/features/TimelineKeys.js +18 -2
  105. package/dist/unstable/features/TimelineKeys.js.map +1 -1
  106. package/package.json +3 -3
  107. package/src/MeasuredPair.ts +21 -1
  108. package/src/index.ts +4 -1
  109. package/src/internal/appear.ts +20 -2
  110. package/src/internal/batch-handoff.ts +19 -11
  111. package/src/internal/batch-writer.ts +27 -6
  112. package/src/internal/clock.ts +10 -0
  113. package/src/internal/default-transition.ts +14 -4
  114. package/src/internal/failing.ts +37 -0
  115. package/src/internal/length-keys.ts +80 -0
  116. package/src/internal/measured-pairs.ts +58 -22
  117. package/src/internal/own-values.ts +2 -2
  118. package/src/internal/positional-keys.ts +4 -2
  119. package/src/internal/projection.ts +141 -37
  120. package/src/internal/renderer.ts +45 -92
  121. package/src/internal/scroll.ts +24 -2
  122. package/src/internal/transform-keys.ts +47 -0
  123. package/src/unstable/AppearAnimations.ts +73 -24
  124. package/src/unstable/BatchMembers.ts +38 -10
  125. package/src/unstable/DomValues.ts +1 -1
  126. package/src/unstable/DragTrack.ts +46 -12
  127. package/src/unstable/ElementSetup.ts +2 -1
  128. package/src/unstable/GestureFeatures.ts +23 -44
  129. package/src/unstable/Imperative.ts +2 -1
  130. package/src/unstable/LiveStyle.ts +12 -8
  131. package/src/unstable/MemberHold.ts +2 -2
  132. package/src/unstable/PointerValues.ts +73 -8
  133. package/src/unstable/PresenceController.ts +66 -40
  134. package/src/unstable/ReorderInput.ts +2 -2
  135. package/src/unstable/WardConfig.ts +17 -5
  136. package/src/unstable/features/TimelineKeys.ts +19 -2
@@ -57,6 +57,7 @@ import type * as WardConfig from "./WardConfig.ts"
57
57
  import type * as CorePresenceRecord from "@wardic/core/unstable/PresenceRecord"
58
58
  import * as RetargetLegs from "@wardic/core/unstable/RetargetLegs"
59
59
  import type * as WardicServices from "@wardic/core/unstable/WardicServices"
60
+ import * as Spine from "@wardic/core/unstable/Spine"
60
61
  import * as VariantTree from "@wardic/core/unstable/VariantTree"
61
62
 
62
63
  // #672 (PR5-Q3): the DOM's presence types, core's protocol over Element, here with the DOM's presence:
@@ -236,12 +237,13 @@ interface PreparedExit {
236
237
  /**
237
238
  * An exit's Measured pairs (#430): each key whose start and target differ in type, asked of the
238
239
  * end-of-task batch, but a key with Keyframes of more than two stops (`stops`, #460). `undefined` with
239
- * none, nearly every exit.
240
+ * none, nearly every exit. `failed` is told when the batch can't take them (a Transform template
241
+ * that throws): they switch, as pairs it couldn't read do.
240
242
  */
241
- const exitMeasuredOf = (element: Element, from: Values.Values, to: Values.Values, stops: RetargetLegs.StopsByKey | undefined): RetargetLegs.MeasuredPairs | undefined => {
243
+ const exitMeasuredOf = (element: Element, from: Values.Values, to: Values.Values, stops: RetargetLegs.StopsByKey | undefined, failed: (defect: unknown) => void): RetargetLegs.MeasuredPairs | undefined => {
242
244
  const pairs = Rec.filter(to, (target, key) => Bool.and(Bool.and(Object.hasOwn(from, key), Bool.not(RetargetLegs.hasManyStops(stops, key))), keepsMeasured(key, from[key], target)))
243
245
  if (Rec.isEmptyRecord(pairs)) return undefined
244
- return DomValues.measuredPairs.measure(castForDom(element), Rec.map(pairs, (target, key) => ({ from: UndefinedOr.getOrThrow(from[key]), to: target })), from)
246
+ return DomValues.measuredPairs.measure(castForDom(element), Rec.map(pairs, (target, key) => ({ from: UndefinedOr.getOrThrow(from[key]), to: target })), from, failed)
245
247
  }
246
248
 
247
249
  /** Whether a start and a target make a Measured pair (#430). */
@@ -618,8 +620,11 @@ export interface PresenceOptions {
618
620
  readonly presenceAffectsLayout?: (() => boolean | undefined) | undefined
619
621
  /**
620
622
  * The children `mode="wait"` held may go on the page now: the binding renders its children again,
621
- * through {@link PresenceController.shown}. Left out, a held child stays held.
623
+ * through {@link PresenceController.shown}. Left out, a held child stays held. It can be called inside
624
+ * {@link PresenceController.present}: a leaver with nothing to play goes at once there, so a binding
625
+ * that can't render again inside its own update defers it.
622
626
  */
627
+ // #987 (ADR-0048, *Amendment (#987)*): Solid 2's binding defers a release made there a microtask; Foldkit's defers every one.
623
628
  readonly release?: (() => void) | undefined
624
629
  }
625
630
 
@@ -682,21 +687,29 @@ export interface PresenceController {
682
687
 
683
688
  /**
684
689
  * {@link PresenceEvents} as Motion's (#257, Solid 1's): only its `onExitComplete`, read when it's called. One
685
- * that throws is reported (`wardic.presence: onExitComplete failed`), and the presence goes on.
690
+ * that throws is reported (`wardic.presence: onExitComplete failed`) at the first of a run of throws, its
691
+ * next clean call ending the run, and the presence goes on.
686
692
  */
687
- export const exitCompleteEvents = (runtime: WardicServices.Runner<WardicServices.WardicServices>, onExitComplete: () => (() => void) | undefined): PresenceEvents => ({
688
- exitStart: constVoid,
689
- exiting: constVoid,
690
- exitComplete: () => {
691
- const callback = onExitComplete()
692
- if (Predicate.isUndefined(callback)) return
693
- try {
694
- callback()
695
- } catch (defect) {
696
- runtime.runFork(Report.failure("wardic.presence: onExitComplete failed", Cause.die(defect)))
697
- }
698
- },
699
- })
693
+ export const exitCompleteEvents = (runtime: WardicServices.Runner<WardicServices.WardicServices>, onExitComplete: () => (() => void) | undefined): PresenceEvents => {
694
+ // #979 group I, row 29 (ADR-0074 decision 3): called at each exit's end, so a run is its throws there.
695
+ let failing = false
696
+ return {
697
+ exitStart: constVoid,
698
+ exiting: constVoid,
699
+ exitComplete: () => {
700
+ const callback = onExitComplete()
701
+ if (Predicate.isUndefined(callback)) return
702
+ try {
703
+ callback()
704
+ if (failing) failing = false
705
+ } catch (defect) {
706
+ if (failing) return
707
+ failing = true
708
+ runtime.runFork(Report.failure("wardic.presence: onExitComplete failed", Cause.die(defect)))
709
+ }
710
+ },
711
+ }
712
+ }
700
713
 
701
714
  /** A projection method that takes an HTML element first, taking any element. */
702
715
  type TakingAnyElement<F> = F extends (...args: infer P) => infer A ? P extends [HTMLElement, ...infer R] ? (el: Element, ...rest: R) => A : F : F
@@ -743,6 +756,9 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
743
756
  * the wrong one — is diagnosable. The per-frame commit stays silent.
744
757
  */
745
758
  const debug = Report.debugOf(runtime, "wardic.presence")
759
+ const exitFailed = Spine.exitVariantFailedOn(runtime)
760
+ // An exit's Measured pairs the batch couldn't take (its Transform template threw), reported each time (#979, row 8).
761
+ const exitMeasuredFailed = Spine.exitMeasuredFailedOn(runtime)
746
762
 
747
763
  // The registry of live child records, keyed by their DOM element. Filled by
748
764
  // register() (called from the child's spine on mount), drained as children
@@ -830,7 +846,9 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
830
846
 
831
847
  /**
832
848
  * A child's exit ended: with the last, `exiting` turns off, a completion is told, and the children
833
- * `mode="wait"` held go on the page (#277), as Motion renders them after its `onExitComplete`.
849
+ * `mode="wait"` held go on the page (#277), as Motion renders them after its `onExitComplete`. A
850
+ * release that throws (a held child's start, on a binding that starts it at once) is reported, and the
851
+ * presence goes on.
834
852
  */
835
853
  const leaveEnds = (el: Element, completed: boolean): void => {
836
854
  if (Bool.not(leaving.delete(el))) return
@@ -841,7 +859,13 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
841
859
  })
842
860
  // `propagate` (#277's PR 5c): the last child that left lets the parent's child go.
843
861
  allLeft()
844
- if (held.length > 0) UndefinedOr.map(options.release, (release) => release())
862
+ if (held.length === 0) return
863
+ // Its own: a throw here came out of the exit's fiber unlogged, and on Solid 1 out of the release (#983).
864
+ try {
865
+ UndefinedOr.map(options.release, (release) => release())
866
+ } catch (defect) {
867
+ runtime.runFork(Report.failure(`wardic.presence: mode="wait"'s release failed`, Cause.die(defect)))
868
+ }
845
869
  }
846
870
 
847
871
  // What `leaveAll` calls once none is left (#277's PR 5c), and where its children last were.
@@ -1072,6 +1096,8 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
1072
1096
  const joinersOf = (provider: PresenceRecord): ReadonlyArray<PresenceRecord> => Arr.filter(parts, (part) => joinsTo.get(part) === provider)
1073
1097
  const nodeOf = (node: PresenceRecord, inherited: WardConfig.WardicVariantLabels | undefined): ExitNode => {
1074
1098
  const exit = node.exitOf(custom, inherited)
1099
+ // An exit whose resolver threw has no values: it leaves without it, reported each time (#979).
1100
+ if (Option.isSome(exit.failure)) exitFailed(exit.failure.value)
1075
1101
  return { rec: node, exit, kids: Arr.map(joinersOf(node), (kid) => nodeOf(kid, exit.name)) }
1076
1102
  }
1077
1103
  // The child's own tree, if it's a Wardic element, and each element inside it that joins nothing
@@ -1088,7 +1114,8 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
1088
1114
  // One `wardic.presence.exit` span spans the whole exit, from the leave to the last part's end.
1089
1115
  // A failed run is logged and reported (ADR-0030, decision 4); the node is removed either way.
1090
1116
  const fiber = runtime.runFork(
1091
- Effect.all(Arr.map(roots, (root) => runOf(root, NO_DELAY)), { concurrency: "unbounded", discard: true }).pipe(
1117
+ // Its stagger's `delayChildren` function that throws, reported once this exit (#979).
1118
+ Effect.all(Arr.map(roots, (root) => runOf(root, NO_DELAY, VariantTree.eventDelayFailuresOf(runtime))), { concurrency: "unbounded", discard: true }).pipe(
1092
1119
  Effect.tapCause((cause) => Report.failure("wardic.presence: an exit failed", cause)),
1093
1120
  Effect.ensuring(Effect.sync(() => partDone(el))),
1094
1121
  // The app's to give, with no call-site stack (#746; ADR-0040, decision 2).
@@ -1102,25 +1129,21 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
1102
1129
  * A node's exit and its Variant children's (#290), Motion's `animateVariant`: with `when`, one after
1103
1130
  * the other, the children's delays from 0; else together, the children's from `delay`.
1104
1131
  */
1105
- const runOf = (node: ExitNode, delay: DelayOf): Effect.Effect<unknown, never, WardicServices.WardicServices> => {
1132
+ const runOf = (node: ExitNode, delay: DelayOf, delays: VariantTree.DelayFailures): Effect.Effect<unknown, never, WardicServices.WardicServices> => {
1106
1133
  // A list's names each run on their own (#297's PR 2): each name's keys and its children's, in that
1107
1134
  // name's own `when`.
1108
1135
  const groups = node.exit.groups
1109
1136
  if (Predicate.isNotUndefined(groups)) {
1110
1137
  const first = UndefinedOr.match(groups[0], { onUndefined: constUndefined, onDefined: (group) => group.name })
1111
- return Effect.all(Arr.map(groups, (group) => runName(node, group.name, delay, group.name === first)), { concurrency: "unbounded", discard: true })
1138
+ return Effect.all(Arr.map(groups, (group) => runName(node, group.name, delay, group.name === first, delays)), { concurrency: "unbounded", discard: true })
1112
1139
  }
1113
1140
  const own = exitOf(node.rec, node.exit, delay)
1114
1141
  if (node.kids.length === 0) return own
1115
- const n = node.kids.length
1116
1142
  // Each name orchestrates the children's keys of that name (#297, Motion's `animateVariant` a name):
1117
1143
  // its own transition's delay and stagger, else the exit's.
1118
- const slot = (i: number) => (name: string | undefined): number => {
1119
- const s = VariantTree.staggerOf(transitionOfName(node.exit, name))
1120
- return VariantTree.childDelayOf(s, i, n)
1121
- }
1144
+ const slot = slotsOf(node, delays)
1122
1145
  const kidsFrom = (from: DelayOf): Effect.Effect<unknown, never, WardicServices.WardicServices> =>
1123
- Effect.all(Arr.map(node.kids, (kid, i) => runOf(kid, (name) => from(name) + slot(i)(name))), { concurrency: "unbounded", discard: true })
1146
+ Effect.all(Arr.map(node.kids, (kid, i) => runOf(kid, (name) => from(name) + slot(i)(name), delays)), { concurrency: "unbounded", discard: true })
1124
1147
  // `when` for a list as a whole, meanwhile (#297's PR 1): the exit's, its last name's that sets it.
1125
1148
  const when = UndefinedOr.map(node.exit.transition, (t) => t.when)
1126
1149
  if (when === "beforeChildren") return Effect.andThen(own, kidsFrom(NO_DELAY))
@@ -1128,25 +1151,27 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
1128
1151
  return Effect.all([own, kidsFrom(delay)], { concurrency: "unbounded", discard: true })
1129
1152
  }
1130
1153
 
1154
+ /** Each of `node`'s children's place in its exit's stagger, by the name it exits under: its delay. */
1155
+ const slotsOf = (node: ExitNode, delays: VariantTree.DelayFailures) => {
1156
+ const n = node.kids.length
1157
+ return (i: number) => (name: string | undefined): number => VariantTree.childDelayOf(VariantTree.staggerOf(transitionOfName(node.exit, name)), i, n, delays)
1158
+ }
1159
+
1131
1160
  /**
1132
1161
  * One name of a list's exit (#297's PR 2, Motion's `animateVariant` a name): the element's keys of that
1133
1162
  * name, and its Variant children's, one after the other with that name's `when`, else together. A
1134
1163
  * child whose exit isn't the list runs it whole, under the list's first name.
1135
1164
  */
1136
- const runName = (node: ExitNode, name: string, delay: DelayOf, first: boolean): Effect.Effect<unknown, never, WardicServices.WardicServices> => {
1165
+ const runName = (node: ExitNode, name: string, delay: DelayOf, first: boolean, delays: VariantTree.DelayFailures): Effect.Effect<unknown, never, WardicServices.WardicServices> => {
1137
1166
  const own = exitOf(node.rec, node.exit, delay, name)
1138
- const n = node.kids.length
1139
- if (n === 0) return own
1140
- const slot = (i: number) => (of: string | undefined): number => {
1141
- const s = VariantTree.staggerOf(transitionOfName(node.exit, of))
1142
- return VariantTree.childDelayOf(s, i, n)
1143
- }
1167
+ if (node.kids.length === 0) return own
1168
+ const slot = slotsOf(node, delays)
1144
1169
  const kidsFrom = (from: DelayOf): Effect.Effect<unknown, never, WardicServices.WardicServices> =>
1145
1170
  Effect.all(
1146
1171
  Arr.map(node.kids, (kid, i) => {
1147
1172
  const at: DelayOf = (of) => from(of) + slot(i)(of)
1148
- if (Predicate.isNotUndefined(kid.exit.groups)) return runName(kid, name, at, first)
1149
- if (first) return runOf(kid, at)
1173
+ if (Predicate.isNotUndefined(kid.exit.groups)) return runName(kid, name, at, first, delays)
1174
+ if (first) return runOf(kid, at, delays)
1150
1175
  return Effect.void
1151
1176
  }),
1152
1177
  { concurrency: "unbounded", discard: true },
@@ -1176,7 +1201,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
1176
1201
  const skipped = UndefinedOr.match(rec.skipAnimations, { onUndefined: constFalse, onDefined: (own) => own() })
1177
1202
  // Measured pairs (#430): an exit from `auto` to 0 measures both ends, as a Retarget does, unless
1178
1203
  // reduced motion snaps them or the exit is skipped.
1179
- const measured = Bool.match(Bool.or(reduce, skipped), { onTrue: constUndefined, onFalse: () => exitMeasuredOf(el, from, to, stops) })
1204
+ const measured = Bool.match(Bool.or(reduce, skipped), { onTrue: constUndefined, onFalse: () => exitMeasuredOf(el, from, to, stops, exitMeasuredFailed) })
1180
1205
  const legs = UndefinedOr.match(exit.groups, {
1181
1206
  onUndefined: () => RetargetLegs.legsOf(from, to, RetargetLegs.delayedBy(exit.transition, delay(singleNameOf(exit.name))), reduce, skipped, positionalKeys, defaultTransition, moving, undefined, stops, measured),
1182
1207
  onDefined: (groups) =>
@@ -1759,9 +1784,10 @@ export const propagateTo = (parent: PresenceContextValue | undefined, propagate:
1759
1784
  holds: true,
1760
1785
  leave: (_custom, release) => {
1761
1786
  leaving = true
1787
+ // Its own teardown first, then the parent's child let go, whose chain can reach the app's code (#983).
1762
1788
  presence.leaveAll(() => {
1763
- release()
1764
1789
  tear()
1790
+ release()
1765
1791
  })
1766
1792
  },
1767
1793
  gone: () => {
@@ -29,8 +29,8 @@ const isPress = (event: InputSource.PointerLikeEvent): boolean => Bool.and(event
29
29
  * keys inside their dispatch, so the reorder's `handle()` (the page's `preventDefault`) counts. A blur
30
30
  * is judged after this task's own work, one scheduler hop on (#318): a reorder can blur the node it
31
31
  * moves and puts focus back after (the driver's `keepFocus`). So `fork` runs that hop on the provider
32
- * runtime, only when a blur happens, and a blur whose judging fails is reported. A throw from the
33
- * driver inside an event goes to `onDefect`.
32
+ * runtime, only when a blur happens, and a blur whose judging fails is reported. A run of throws from
33
+ * the driver inside an event goes to `onDefect` at its first.
34
34
  */
35
35
  export const watchItemInput = (
36
36
  el: HTMLElement,
@@ -49,6 +49,11 @@ export interface CSSProperties extends CSS.PropertiesHyphen {
49
49
  * is used verbatim).
50
50
  */
51
51
  export interface WardicTransformShorthands {
52
+ /**
53
+ * The element's own depth, Motion's `transformPerspective`: a `perspective()` at the head of its
54
+ * transform, a bare number in px. Its children's depth is the `perspective` property's.
55
+ */
56
+ readonly transformPerspective?: number | string
52
57
  readonly x?: number | string
53
58
  readonly y?: number | string
54
59
  readonly z?: number | string
@@ -58,6 +63,9 @@ export interface WardicTransformShorthands {
58
63
  readonly scale?: number | string
59
64
  readonly scaleX?: number | string
60
65
  readonly scaleY?: number | string
66
+ /** The scale along the element's depth, CSS's `scaleZ()`: seen only beside a turn out of its plane. */
67
+ // #883 drew it, #887 typed it.
68
+ readonly scaleZ?: number | string
61
69
  readonly rotate?: number | string
62
70
  readonly rotateX?: number | string
63
71
  readonly rotateY?: number | string
@@ -116,9 +124,10 @@ export type WardicValues =
116
124
  /**
117
125
  * The CSS lengths a value takes a bare number on, drawn in `px` (#522, Motion's `animate={{ height: 200 }}`):
118
126
  * the DOM renderer's `LENGTH_KEYS`, so a number typechecks only where it's drawn as a length. Every
119
- * other length takes `csstype`'s value, `0` or a string. `style` keeps Solid's own types: Solid writes a
120
- * number there as it is.
127
+ * other length takes `csstype`'s value, `0` or a string. In an element's `style`, a number on one of these
128
+ * is drawn by Wardic too, in px, so `style={{ width: 200 }}` is 200px.
121
129
  */
130
+ // #887: the style's number routed to the renderer (`LiveStyle`), where before a binding wrote it as it is.
122
131
  export type WardicLengths = { readonly [K in DomRenderer.LengthKey]?: number | CSSProperties[K] }
123
132
 
124
133
  /** The DOM's keys and their values fill core's {@link Config.ValueKeys}, typing every config type built on it. */
@@ -301,7 +310,7 @@ export interface WardBaseConfig {
301
310
  // Dynamic variants: #277. Orchestration: ADR-0007.
302
311
  readonly variants?: Config.WardicVariants
303
312
  /**
304
- * The value passed to this element's function variants. When it changes, they're resolved again,
313
+ * The value passed to this element's dynamic variants. When it changes, they're resolved again,
305
314
  * and the element animates to what they give. A leaving element uses `<AnimatePresence custom>`
306
315
  * instead, if given.
307
316
  */
@@ -335,13 +344,16 @@ export interface WardBaseConfig {
335
344
  readonly transition?: WardicTransition
336
345
  /**
337
346
  * Where the element animates as it leaves an `<AnimatePresence>`: values or a `variants` name. The
338
- * element stays on the page until it has played.
347
+ * element stays on the page until it has played. A dynamic variant that throws as the element
348
+ * leaves, alone or in a list, is reported, and the element leaves at once, without its exit; the
349
+ * others leaving beside it exit.
339
350
  *
340
351
  * @example <w.div exit={{ opacity: 0, scale: 0.9 }} />
341
352
  */
342
353
  // ADR-0007: the child doesn't drive it (it's disposed); its spine publishes the exit into the
343
354
  // presence registration, and the presence runs it on the retained node. A dynamic variant resolves
344
- // as it leaves (#277); its own transition, else the element's.
355
+ // as it leaves (#277); its own transition, else the element's. One that throws: #979, reported by the
356
+ // presence's `nodeOf` each time.
345
357
  readonly exit?: WardicVariant | Config.WardicVariantLabels
346
358
  /**
347
359
  * Called when an animation of the element starts, with what it animates to: the variant name, or
@@ -12,8 +12,11 @@
12
12
  // Unstable: ADR-0071, decision 5. #672 (PR6-Q1): solid's `features/timeline-keys.ts`, moved to dom with the Features, for
13
13
  // every DOM binding.
14
14
  import * as LiveValue from "@wardic/core/LiveValue"
15
+ import * as Report from "@wardic/core/unstable/Report"
15
16
  import * as TimelineValue from "../../TimelineValue.ts"
16
17
  import * as Bool from "effect/Boolean"
18
+ import * as Effect from "effect/Effect"
19
+ import * as Exit from "effect/Exit"
17
20
  import * as Option from "effect/Option"
18
21
  import * as Predicate from "effect/Predicate"
19
22
  import type * as Atom from "effect/reactivity/Atom"
@@ -49,6 +52,10 @@ export const makeTimelines = (): Timelines.Timelines["Service"] => {
49
52
  }
50
53
  }
51
54
 
55
+ // #979 (ADR-0074, row 7): a make calls the app's code, an `ease` or an interpolator, at each point its
56
+ // keyframes sample, some the frame path never reads. Its throw came out of the binding, a Solid 2 halt.
57
+ const TIMELINE_FAILED = "wardic.timeline: a Timeline value failed"
58
+
52
59
  /**
53
60
  * An element's keys. `shown` runs at each write of a key's Live value, so per frame while it moves: a key
54
61
  * shown already from the same source is left as it is, with nothing read but its source, statements and
@@ -65,7 +72,11 @@ const elementKeysOf = (options: Timelines.TimelineKeysOptions, unmounted: () =>
65
72
  // The keys whose Timeline value the gate has, each with it.
66
73
  const running = new Map<string, TimelineValue.TimelineValue>()
67
74
 
68
- /** `key`'s Timeline value now, made again when its derivation changed; `undefined` for none. */
75
+ /**
76
+ * `key`'s Timeline value now, made again when its derivation changed; `undefined` for none. A make that
77
+ * throws is reported and makes none, so the gate draws the key, and it's kept as made: tried again only
78
+ * for a new derivation.
79
+ */
69
80
  const timelineOf = (key: string): TimelineValue.TimelineValue | undefined => {
70
81
  const atom = live.atomOf(key)
71
82
  if (Predicate.isUndefined(atom)) return undefined
@@ -75,7 +86,13 @@ const elementKeysOf = (options: Timelines.TimelineKeysOptions, unmounted: () =>
75
86
  if (Predicate.isNotUndefined(last)) {
76
87
  if (last.derivation === derivation) return last.timeline
77
88
  }
78
- const timeline = Option.getOrUndefined(runtime.runSync(TimelineValue.make(derivation, element, key)))
89
+ const timeline = Exit.match(runtime.runSyncExit(TimelineValue.make(derivation, element, key)), {
90
+ onSuccess: Option.getOrUndefined,
91
+ onFailure: (cause) => {
92
+ runtime.runFork(Report.failure(TIMELINE_FAILED, cause).pipe(Effect.annotateLogs({ key })))
93
+ return undefined
94
+ },
95
+ })
79
96
  made.set(key, { derivation, timeline })
80
97
  return timeline
81
98
  }