@wardic/dom 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 (143) 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 +32 -16
  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 +27 -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 +28 -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 +180 -46
  49. package/dist/internal/projection.js.map +1 -1
  50. package/dist/internal/renderer.d.ts +59 -27
  51. package/dist/internal/renderer.d.ts.map +1 -1
  52. package/dist/internal/renderer.js +241 -207
  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/starting-style.js +5 -5
  58. package/dist/internal/transform-keys.d.ts +23 -0
  59. package/dist/internal/transform-keys.d.ts.map +1 -0
  60. package/dist/internal/transform-keys.js +55 -0
  61. package/dist/internal/transform-keys.js.map +1 -0
  62. package/dist/unstable/AppearAnimations.d.ts +2 -1
  63. package/dist/unstable/AppearAnimations.d.ts.map +1 -1
  64. package/dist/unstable/AppearAnimations.js +73 -22
  65. package/dist/unstable/AppearAnimations.js.map +1 -1
  66. package/dist/unstable/BatchMembers.d.ts +2 -2
  67. package/dist/unstable/BatchMembers.d.ts.map +1 -1
  68. package/dist/unstable/BatchMembers.js +30 -7
  69. package/dist/unstable/BatchMembers.js.map +1 -1
  70. package/dist/unstable/DomValues.js +1 -1
  71. package/dist/unstable/DomValues.js.map +1 -1
  72. package/dist/unstable/DragTrack.d.ts +2 -2
  73. package/dist/unstable/DragTrack.d.ts.map +1 -1
  74. package/dist/unstable/DragTrack.js +37 -10
  75. package/dist/unstable/DragTrack.js.map +1 -1
  76. package/dist/unstable/ElementSetup.d.ts.map +1 -1
  77. package/dist/unstable/ElementSetup.js +3 -2
  78. package/dist/unstable/ElementSetup.js.map +1 -1
  79. package/dist/unstable/GestureFeatures.d.ts +8 -2
  80. package/dist/unstable/GestureFeatures.d.ts.map +1 -1
  81. package/dist/unstable/GestureFeatures.js +26 -40
  82. package/dist/unstable/GestureFeatures.js.map +1 -1
  83. package/dist/unstable/GestureInfo.d.ts +11 -0
  84. package/dist/unstable/GestureInfo.d.ts.map +1 -1
  85. package/dist/unstable/GestureInfo.js +8 -0
  86. package/dist/unstable/GestureInfo.js.map +1 -1
  87. package/dist/unstable/Imperative.d.ts +1 -1
  88. package/dist/unstable/Imperative.d.ts.map +1 -1
  89. package/dist/unstable/Imperative.js.map +1 -1
  90. package/dist/unstable/LiveStyle.d.ts +28 -2
  91. package/dist/unstable/LiveStyle.d.ts.map +1 -1
  92. package/dist/unstable/LiveStyle.js +8 -32
  93. package/dist/unstable/LiveStyle.js.map +1 -1
  94. package/dist/unstable/MemberHold.js +3 -3
  95. package/dist/unstable/MemberHold.js.map +1 -1
  96. package/dist/unstable/PointerValues.d.ts.map +1 -1
  97. package/dist/unstable/PointerValues.js +82 -8
  98. package/dist/unstable/PointerValues.js.map +1 -1
  99. package/dist/unstable/PresenceController.d.ts +5 -2
  100. package/dist/unstable/PresenceController.d.ts.map +1 -1
  101. package/dist/unstable/PresenceController.js +82 -55
  102. package/dist/unstable/PresenceController.js.map +1 -1
  103. package/dist/unstable/ReorderInput.d.ts +2 -2
  104. package/dist/unstable/ReorderInput.js +2 -2
  105. package/dist/unstable/WardConfig.d.ts +18 -9
  106. package/dist/unstable/WardConfig.d.ts.map +1 -1
  107. package/dist/unstable/WardConfig.js.map +1 -1
  108. package/dist/unstable/features/TimelineKeys.d.ts.map +1 -1
  109. package/dist/unstable/features/TimelineKeys.js +19 -3
  110. package/dist/unstable/features/TimelineKeys.js.map +1 -1
  111. package/package.json +3 -3
  112. package/src/MeasuredPair.ts +21 -1
  113. package/src/index.ts +4 -1
  114. package/src/internal/appear.ts +20 -2
  115. package/src/internal/batch-handoff.ts +19 -11
  116. package/src/internal/batch-writer.ts +32 -16
  117. package/src/internal/clock.ts +28 -0
  118. package/src/internal/default-transition.ts +28 -4
  119. package/src/internal/failing.ts +37 -0
  120. package/src/internal/length-keys.ts +80 -0
  121. package/src/internal/measured-pairs.ts +58 -22
  122. package/src/internal/own-values.ts +2 -2
  123. package/src/internal/positional-keys.ts +4 -2
  124. package/src/internal/projection.ts +190 -44
  125. package/src/internal/renderer.ts +272 -198
  126. package/src/internal/scroll.ts +24 -2
  127. package/src/internal/starting-style.ts +5 -5
  128. package/src/internal/transform-keys.ts +59 -0
  129. package/src/unstable/AppearAnimations.ts +73 -24
  130. package/src/unstable/BatchMembers.ts +33 -9
  131. package/src/unstable/DomValues.ts +1 -1
  132. package/src/unstable/DragTrack.ts +49 -14
  133. package/src/unstable/ElementSetup.ts +3 -2
  134. package/src/unstable/GestureFeatures.ts +38 -47
  135. package/src/unstable/GestureInfo.ts +24 -0
  136. package/src/unstable/Imperative.ts +1 -0
  137. package/src/unstable/LiveStyle.ts +12 -8
  138. package/src/unstable/MemberHold.ts +3 -3
  139. package/src/unstable/PointerValues.ts +73 -8
  140. package/src/unstable/PresenceController.ts +80 -54
  141. package/src/unstable/ReorderInput.ts +2 -2
  142. package/src/unstable/WardConfig.ts +22 -10
  143. package/src/unstable/features/TimelineKeys.ts +20 -3
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Which of a Subject's callbacks are in a run of throws, by name: a callback's run starts at its first
3
+ * throw and ends at its next call that returns. The set of names is made at the first throw, as most
4
+ * Subjects never see one.
5
+ *
6
+ * @module
7
+ */
8
+ // #979 group I (ADR-0074 decision 3): an element's gesture callbacks, a layout node's callbacks and a drag
9
+ // track's failures, each reported at its run's first throw.
10
+ import { identity } from "effect/Function"
11
+ import * as Predicate from "effect/Predicate"
12
+ import * as UndefinedOr from "effect/UndefinedOr"
13
+
14
+ /** What holds a Subject's failing names: `undefined` until its first throw. */
15
+ export interface Failing<N extends string> {
16
+ failing: Set<N> | undefined
17
+ }
18
+
19
+ /** Whether a throw of `name`'s is its run's first: the run is on from now. */
20
+ export const firstThrowOf = <N extends string>(holder: Failing<N>, name: N): boolean => {
21
+ const failing = UndefinedOr.match(holder.failing, {
22
+ onUndefined: () => {
23
+ const made = new Set<N>()
24
+ holder.failing = made
25
+ return made
26
+ },
27
+ onDefined: identity,
28
+ })
29
+ if (failing.has(name)) return false
30
+ failing.add(name)
31
+ return true
32
+ }
33
+
34
+ /** A clean call of `name`'s: its run, if one is on, ended. */
35
+ export const endRunOf = <N extends string>(holder: Failing<N>, name: N): void => {
36
+ if (Predicate.isNotUndefined(holder.failing)) holder.failing.delete(name)
37
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The CSS lengths a bare number on is drawn in `px`, spelled as Wardic's keys are (`margin-top`). The DOM
3
+ * renderer draws them, and `LiveStyle` hands such a number in an element's `style` to it.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * The CSS properties a bare number on is a length, drawn in `px`, spelled as Wardic's keys are
9
+ * (`margin-top`): Motion's, and `min-width`, `min-height`, the gaps and `letter-spacing`. The Solid
10
+ * bindings' value types take a number on these and on no other length, so a number never draws CSS a
11
+ * browser drops. `line-height` isn't one: CSS reads its bare number as a multiple. A number on any other
12
+ * key, `opacity`, `z-index`, a custom property, is drawn as it is; a string always is.
13
+ */
14
+ // #522: Motion's `numberValueTypes`' `px` keys; the bindings' `WardicValues`.
15
+ export const LENGTH_KEYS = [
16
+ "border-width",
17
+ "border-top-width",
18
+ "border-right-width",
19
+ "border-bottom-width",
20
+ "border-left-width",
21
+ "border-radius",
22
+ "border-top-left-radius",
23
+ "border-top-right-radius",
24
+ "border-bottom-right-radius",
25
+ "border-bottom-left-radius",
26
+ "width",
27
+ "min-width",
28
+ "max-width",
29
+ "height",
30
+ "min-height",
31
+ "max-height",
32
+ "top",
33
+ "right",
34
+ "bottom",
35
+ "left",
36
+ "inset",
37
+ "inset-block",
38
+ "inset-block-start",
39
+ "inset-block-end",
40
+ "inset-inline",
41
+ "inset-inline-start",
42
+ "inset-inline-end",
43
+ "padding",
44
+ "padding-top",
45
+ "padding-right",
46
+ "padding-bottom",
47
+ "padding-left",
48
+ "padding-block",
49
+ "padding-block-start",
50
+ "padding-block-end",
51
+ "padding-inline",
52
+ "padding-inline-start",
53
+ "padding-inline-end",
54
+ "margin",
55
+ "margin-top",
56
+ "margin-right",
57
+ "margin-bottom",
58
+ "margin-left",
59
+ "margin-block",
60
+ "margin-block-start",
61
+ "margin-block-end",
62
+ "margin-inline",
63
+ "margin-inline-start",
64
+ "margin-inline-end",
65
+ "gap",
66
+ "row-gap",
67
+ "column-gap",
68
+ "font-size",
69
+ "letter-spacing",
70
+ "background-position-x",
71
+ "background-position-y",
72
+ // An element's children's depth (#887), Motion's: the property beside the element's own `transformPerspective`.
73
+ "perspective",
74
+ ] as const
75
+
76
+ /** One of `LENGTH_KEYS`: a CSS property a bare number on is drawn in `px`. */
77
+ export type LengthKey = (typeof LENGTH_KEYS)[number]
78
+
79
+ /** {@link LENGTH_KEYS}, for a membership test a frame can make. */
80
+ export const LENGTH_KEY_SET: ReadonlySet<string> = new Set(LENGTH_KEYS)
@@ -100,6 +100,10 @@ interface Request {
100
100
  readonly element: HTMLElement
101
101
  readonly slots: ReadonlyArray<Slot>
102
102
  readonly values: Values.Values
103
+ /** Its asker's, told what its write threw (#979, row 8). */
104
+ readonly failed: (defect: unknown) => void
105
+ /** Whether its write threw: its pairs are left unread. */
106
+ threw: boolean
103
107
  }
104
108
 
105
109
  // Module state (#460, Q7): each pair its batch has read, by the pair as asked, kept as long as its asker
@@ -122,16 +126,18 @@ let scheduled = false
122
126
  /**
123
127
  * Measures `pairs` on `element` at the end of this task, with every other element's in the same batch:
124
128
  * each pair, as asked, {@link measured} before the next tick. `values` are what the element draws now,
125
- * its other transforms among them.
129
+ * its other transforms among them. Writing them can throw (a Transform template among `values`): then
130
+ * its pairs are never measured, `failed` is told, and the rest of the batch goes on.
126
131
  */
127
- // #430's Q2.
132
+ // #430's Q2. #979, row 8 (ADR-0074): `failed`, its asker's, which reports through its own runtime.
128
133
  export const measure = (
129
134
  element: HTMLElement,
130
135
  pairs: Readonly<Record<string, { readonly from: number | string; readonly to: number | string }>>,
131
136
  values: Values.Values,
137
+ failed: (defect: unknown) => void,
132
138
  ): Readonly<Record<string, Requested>> => {
133
139
  const made = Rec.map(pairs, ({ from, to }, key): Requested => ({ key, from, to }))
134
- queued.push({ element, slots: Arr.map(Rec.values(made), (pair): Slot => ({ pair, fromPx: undefined, toPx: undefined })), values })
140
+ queued.push({ element, slots: Arr.map(Rec.values(made), (pair): Slot => ({ pair, fromPx: undefined, toPx: undefined })), values, failed, threw: false })
135
141
  if (Bool.not(scheduled)) {
136
142
  scheduled = true
137
143
  queueMicrotask(flush)
@@ -207,35 +213,42 @@ const savedOf = (element: HTMLElement, property: string): Saved => ({ element, p
207
213
 
208
214
  /**
209
215
  * Write `pairs`' translates at their `end` through the element's whole transform, keeping what was
210
- * there: the browser lays out any unit, `-100%` included (#594).
216
+ * there in `saved` before it's written: the browser lays out any unit, `-100%` included (#594).
211
217
  */
212
- const writeTranslates = (request: Request, slots: ReadonlyArray<Slot>, end: "from" | "to"): ReadonlyArray<Saved> => {
213
- if (slots.length === 0) return []
218
+ const writeTranslates = (request: Request, slots: ReadonlyArray<Slot>, end: "from" | "to", saved: Array<Saved>): void => {
219
+ if (slots.length === 0) return
214
220
  const { element, values } = request
215
- const saved = savedOf(element, "transform")
216
221
  const transform = project({ ...values, ...Rec.fromEntries(Arr.map(slots, ({ pair }) => [pair.key, pair[end]] as const)) })["transform"]
222
+ saved.push(savedOf(element, "transform"))
217
223
  element.style.setProperty("transform", UndefinedOr.match(transform as string | undefined, { onUndefined: () => "none", onDefined: String }))
218
- return [saved]
219
224
  }
220
225
 
221
- /** Write each pair's target inline on its element, keeping what was there; a translate through the element's whole transform. */
222
- const writeTargets = (request: Request): ReadonlyArray<Saved> => {
226
+ /**
227
+ * Write each pair's target inline on its element, keeping what was there in `saved` before each is
228
+ * written; a translate through the element's whole transform.
229
+ */
230
+ const writeTargets = (request: Request, saved: Array<Saved>): void => {
223
231
  const unread = Arr.filter(request.slots, (slot) => Predicate.isUndefined(slot.toPx))
224
- const saved: Array<Saved> = [...writeTranslates(request, Arr.filter(unread, (slot) => TRANSLATES.has(slot.pair.key)), "to")]
232
+ writeTranslates(request, Arr.filter(unread, (slot) => TRANSLATES.has(slot.pair.key)), "to", saved)
225
233
  Arr.forEach(unread, ({ pair }) => {
226
234
  if (TRANSLATES.has(pair.key)) return
227
235
  saved.push(savedOf(request.element, pair.key))
228
236
  request.element.style.setProperty(pair.key, cssOf(pair.to))
229
237
  })
230
- return saved
231
238
  }
232
239
 
233
240
  /**
234
241
  * Write each translate pair's start not in px, as a target is (#594): a layout element's transform at
235
242
  * this moment is its projection's, or held off for its Measure pass, so reading it as it is gave 0.
236
243
  */
237
- const writeTranslateStarts = (request: Request): ReadonlyArray<Saved> =>
238
- writeTranslates(request, Arr.filter(request.slots, (slot) => Bool.and(TRANSLATES.has(slot.pair.key), Predicate.isUndefined(slot.fromPx))), "from")
244
+ const writeTranslateStarts = (request: Request, saved: Array<Saved>): void =>
245
+ writeTranslates(request, Arr.filter(request.slots, (slot) => Bool.and(TRANSLATES.has(slot.pair.key), Predicate.isUndefined(slot.fromPx))), "from", saved)
246
+
247
+ /** `request`'s write threw: its pairs are left unread, so its animation switches, and its asker is told. */
248
+ const requestThrew = (request: Request, defect: unknown): void => {
249
+ request.threw = true
250
+ request.failed(defect)
251
+ }
239
252
 
240
253
  /** Put back what {@link writeTargets} replaced. */
241
254
  const restore = (saved: ReadonlyArray<Saved>): void =>
@@ -260,27 +273,49 @@ const flush = (): void => {
260
273
  slot.toPx = givenPx(slot.pair.to)
261
274
  slot.fromPx = givenPx(slot.pair.from)
262
275
  }))
276
+ // #979, row 8 (ADR-0074): each request's write is its own, in a `try` of its own in each write's loop.
277
+ // One that throws (an exit's Transform template, say) is left unread, its asker told, and the rest of
278
+ // the batch goes on, every style written so far put back: before, its throw ended the batch
279
+ // uncaught, every pair in it voided and the targets written before it left inline.
263
280
  // WRITE, READ, WRITE: each translate's start not in px, written alone and read (#594).
264
- const starts = Arr.flatMap(batch, writeTranslateStarts)
265
- if (Arr.isArrayNonEmpty(starts)) {
266
- try {
281
+ const starts: Array<Saved> = []
282
+ try {
283
+ Arr.forEach(batch, (request) => {
284
+ try {
285
+ writeTranslateStarts(request, starts)
286
+ } catch (defect) {
287
+ requestThrew(request, defect)
288
+ }
289
+ })
290
+ if (Arr.isArrayNonEmpty(starts)) {
267
291
  Arr.forEach(batch, (request, i) => Arr.forEach(request.slots, (slot) => {
292
+ if (request.threw) return
268
293
  if (Bool.and(TRANSLATES.has(slot.pair.key), Predicate.isUndefined(slot.fromPx))) slot.fromPx = readPx(request.element, UndefinedOr.getOrThrow(styles[i]), slot.pair.key)
269
294
  }))
270
- } finally {
271
- restore(starts)
272
295
  }
296
+ } finally {
297
+ restore(starts)
273
298
  }
274
299
  // READ: each other start not already in px, as the element lays out now.
275
300
  Arr.forEach(batch, (request, i) => Arr.forEach(request.slots, (slot) => {
301
+ if (request.threw) return
276
302
  if (Predicate.isUndefined(slot.fromPx)) slot.fromPx = readPx(request.element, UndefinedOr.getOrThrow(styles[i]), slot.pair.key)
277
303
  }))
278
304
  const scrollY = globalThis.scrollY
279
- // WRITE: each target, inline.
280
- const saved = Arr.flatMap(batch, writeTargets)
305
+ const saved: Array<Saved> = []
281
306
  try {
307
+ // WRITE: each target, inline.
308
+ Arr.forEach(batch, (request) => {
309
+ if (request.threw) return
310
+ try {
311
+ writeTargets(request, saved)
312
+ } catch (defect) {
313
+ requestThrew(request, defect)
314
+ }
315
+ })
282
316
  // READ: each target not already in px, laid out once.
283
317
  Arr.forEach(batch, (request, i) => Arr.forEach(request.slots, (slot) => {
318
+ if (request.threw) return
284
319
  if (Predicate.isUndefined(slot.toPx)) slot.toPx = readPx(request.element, UndefinedOr.getOrThrow(styles[i]), slot.pair.key)
285
320
  }))
286
321
  } finally {
@@ -288,8 +323,9 @@ const flush = (): void => {
288
323
  restore(saved)
289
324
  if (globalThis.scrollY !== scrollY) globalThis.scrollTo(globalThis.scrollX, scrollY)
290
325
  }
291
- // Each pair read at both ends, as a record of its own.
326
+ // Each pair read at both ends, as a record of its own: none of a request whose write threw.
292
327
  Arr.forEach(batch, (request) => Arr.forEach(request.slots, ({ pair, fromPx, toPx }) => {
328
+ if (request.threw) return
293
329
  if (Predicate.isUndefined(fromPx)) return
294
330
  if (Predicate.isUndefined(toPx)) return
295
331
  if (Bool.and(Number.isFinite(fromPx), Number.isFinite(toPx))) read.set(pair, { ...pair, fromPx, toPx })
@@ -10,7 +10,6 @@
10
10
  * Observability: per element and cold (once per key), so quiet; the spine logs what it
11
11
  * started from and returned to.
12
12
  */
13
- import * as BaseValue from "@wardic/core/BaseValue"
14
13
  import * as Interpolator from "@wardic/core/Interpolator"
15
14
  import * as Bool from "effect/Boolean"
16
15
  import * as Match from "effect/Match"
@@ -20,6 +19,7 @@ import * as Predicate from "effect/Predicate"
20
19
  import * as Str from "effect/String"
21
20
  import { parseCssText } from "./starting-style.ts"
22
21
  import { dashCase, isSvgInner, svgAttrNameOf } from "./svg.ts"
22
+ import * as TransformKeys from "./transform-keys.ts"
23
23
 
24
24
  /** An element's own value for a key: the raw value read, a string, a transform key's identity, or `None`. */
25
25
  export type OwnValue = (key: string) => Option.Option<number | string>
@@ -53,7 +53,7 @@ export const ownValues = (element: Element): OwnValue => {
53
53
  onFalse: () => Option.none(),
54
54
  })
55
55
  const read = (key: string): Option.Option<number | string> =>
56
- Option.orElse(BaseValue.transformIdentity(key), () =>
56
+ Option.orElse(TransformKeys.transformIdentity(key), () =>
57
57
  Option.orElse(attributeOf(key), () => nonEmpty(computedStyle().getPropertyValue(dashCase(key)).trim()))
58
58
  )
59
59
  return (key) =>
@@ -10,6 +10,7 @@ import * as ReducedMotion from "@wardic/core/ReducedMotion"
10
10
  import * as Layer from "effect/Layer"
11
11
  import * as Predicate from "effect/Predicate"
12
12
  import { dashCase } from "./svg.ts"
13
+ import * as TransformKeys from "./transform-keys.ts"
13
14
 
14
15
  /** The box's position and size, as CSS properties. */
15
16
  const BOX_KEYS: ReadonlySet<string> = new Set(["width", "height", "top", "left", "right", "bottom"])
@@ -17,8 +18,9 @@ const BOX_KEYS: ReadonlySet<string> = new Set(["width", "height", "top", "left",
17
18
  /** A key of the box's position or size, written as a CSS name or in camelCase. */
18
19
  const isBoxKey: Predicate.Predicate<string> = (key) => BOX_KEYS.has(dashCase(key))
19
20
 
20
- /** Whether reduced motion lands `key` at once: a transform, or a key that places or sizes the box. */
21
- export const isPositional: Predicate.Predicate<string> = Predicate.or(ReducedMotion.isTransform, isBoxKey)
21
+ /** Whether reduced motion lands `key` at once: one of the DOM's transforms, or a key that places or sizes the box. */
22
+ // #887 (Q11): the DOM's transforms, core's and its own, so its depth lands at once, as Motion's does.
23
+ export const isPositional: Predicate.Predicate<string> = Predicate.or(TransformKeys.isTransformKey, isBoxKey)
22
24
 
23
25
  /** The DOM Environment's `ReducedMotion.PositionalKeys`. */
24
26
  export const PositionalKeysDomLive: Layer.Layer<ReducedMotion.PositionalKeys> = Layer.succeed(ReducedMotion.PositionalKeys, { isPositional })