@wardic/dom 0.0.0-stage → 1.0.0-rc.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 (285) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -2
  3. package/THIRD_PARTY_NOTICES.md +145 -0
  4. package/dist/Appear.d.ts +24 -0
  5. package/dist/Appear.d.ts.map +1 -0
  6. package/dist/Appear.js +25 -0
  7. package/dist/Appear.js.map +1 -0
  8. package/dist/Color.d.ts +14 -0
  9. package/dist/Color.d.ts.map +1 -0
  10. package/dist/Color.js +16 -0
  11. package/dist/Color.js.map +1 -0
  12. package/dist/DomAnnouncer.d.ts +13 -0
  13. package/dist/DomAnnouncer.d.ts.map +1 -0
  14. package/dist/DomAnnouncer.js +14 -0
  15. package/dist/DomAnnouncer.js.map +1 -0
  16. package/dist/DomClock.d.ts +11 -0
  17. package/dist/DomClock.d.ts.map +1 -0
  18. package/dist/DomClock.js +12 -0
  19. package/dist/DomClock.js.map +1 -0
  20. package/dist/DomDefaultTransition.d.ts +12 -0
  21. package/dist/DomDefaultTransition.d.ts.map +1 -0
  22. package/dist/DomDefaultTransition.js +13 -0
  23. package/dist/DomDefaultTransition.js.map +1 -0
  24. package/dist/DomInput.d.ts +13 -0
  25. package/dist/DomInput.d.ts.map +1 -0
  26. package/dist/DomInput.js +15 -0
  27. package/dist/DomInput.js.map +1 -0
  28. package/dist/DomInterpolators.d.ts +13 -0
  29. package/dist/DomInterpolators.d.ts.map +1 -0
  30. package/dist/DomInterpolators.js +14 -0
  31. package/dist/DomInterpolators.js.map +1 -0
  32. package/dist/DomKeyRules.d.ts +13 -0
  33. package/dist/DomKeyRules.d.ts.map +1 -0
  34. package/dist/DomKeyRules.js +14 -0
  35. package/dist/DomKeyRules.js.map +1 -0
  36. package/dist/DomPositionalKeys.d.ts +13 -0
  37. package/dist/DomPositionalKeys.d.ts.map +1 -0
  38. package/dist/DomPositionalKeys.js +14 -0
  39. package/dist/DomPositionalKeys.js.map +1 -0
  40. package/dist/DomProbe.d.ts +13 -0
  41. package/dist/DomProbe.d.ts.map +1 -0
  42. package/dist/DomProbe.js +14 -0
  43. package/dist/DomProbe.js.map +1 -0
  44. package/dist/DomProjectionSystem.d.ts +28 -0
  45. package/dist/DomProjectionSystem.d.ts.map +1 -0
  46. package/dist/DomProjectionSystem.js +41 -0
  47. package/dist/DomProjectionSystem.js.map +1 -0
  48. package/dist/DomRenderer.d.ts +13 -0
  49. package/dist/DomRenderer.d.ts.map +1 -0
  50. package/dist/DomRenderer.js +15 -0
  51. package/dist/DomRenderer.js.map +1 -0
  52. package/dist/FlushGate.d.ts +48 -0
  53. package/dist/FlushGate.d.ts.map +1 -0
  54. package/dist/FlushGate.js +62 -0
  55. package/dist/FlushGate.js.map +1 -0
  56. package/dist/MeasuredPair.d.ts +14 -0
  57. package/dist/MeasuredPair.d.ts.map +1 -0
  58. package/dist/MeasuredPair.js +16 -0
  59. package/dist/MeasuredPair.js.map +1 -0
  60. package/dist/OwnValues.d.ts +14 -0
  61. package/dist/OwnValues.d.ts.map +1 -0
  62. package/dist/OwnValues.js +15 -0
  63. package/dist/OwnValues.js.map +1 -0
  64. package/dist/ProjectionSystem.d.ts +34 -0
  65. package/dist/ProjectionSystem.d.ts.map +1 -0
  66. package/dist/ProjectionSystem.js +29 -0
  67. package/dist/ProjectionSystem.js.map +1 -0
  68. package/dist/ReorderController.d.ts +41 -0
  69. package/dist/ReorderController.d.ts.map +1 -0
  70. package/dist/ReorderController.js +44 -0
  71. package/dist/ReorderController.js.map +1 -0
  72. package/dist/Report.d.ts +12 -0
  73. package/dist/Report.d.ts.map +1 -0
  74. package/dist/Report.js +13 -0
  75. package/dist/Report.js.map +1 -0
  76. package/dist/ScrollOffset.d.ts +34 -0
  77. package/dist/ScrollOffset.d.ts.map +1 -0
  78. package/dist/ScrollOffset.js +42 -0
  79. package/dist/ScrollOffset.js.map +1 -0
  80. package/dist/Style.d.ts +15 -0
  81. package/dist/Style.d.ts.map +1 -0
  82. package/dist/Style.js +17 -0
  83. package/dist/Style.js.map +1 -0
  84. package/dist/Svg.d.ts +13 -0
  85. package/dist/Svg.d.ts.map +1 -0
  86. package/dist/Svg.js +14 -0
  87. package/dist/Svg.js.map +1 -0
  88. package/dist/Variables.d.ts +13 -0
  89. package/dist/Variables.d.ts.map +1 -0
  90. package/dist/Variables.js +14 -0
  91. package/dist/Variables.js.map +1 -0
  92. package/dist/index.d.ts +72 -0
  93. package/dist/index.d.ts.map +1 -0
  94. package/dist/index.js +60 -0
  95. package/dist/index.js.map +1 -0
  96. package/dist/internal/announcer.d.ts +50 -0
  97. package/dist/internal/announcer.d.ts.map +1 -0
  98. package/dist/internal/announcer.js +115 -0
  99. package/dist/internal/announcer.js.map +1 -0
  100. package/dist/internal/appear.d.ts +169 -0
  101. package/dist/internal/appear.d.ts.map +1 -0
  102. package/dist/internal/appear.js +499 -0
  103. package/dist/internal/appear.js.map +1 -0
  104. package/dist/internal/auto-scroll.d.ts +24 -0
  105. package/dist/internal/auto-scroll.d.ts.map +1 -0
  106. package/dist/internal/auto-scroll.js +124 -0
  107. package/dist/internal/auto-scroll.js.map +1 -0
  108. package/dist/internal/clock.d.ts +19 -0
  109. package/dist/internal/clock.d.ts.map +1 -0
  110. package/dist/internal/clock.js +39 -0
  111. package/dist/internal/clock.js.map +1 -0
  112. package/dist/internal/colors.d.ts +45 -0
  113. package/dist/internal/colors.d.ts.map +1 -0
  114. package/dist/internal/colors.js +193 -0
  115. package/dist/internal/colors.js.map +1 -0
  116. package/dist/internal/complex.d.ts +24 -0
  117. package/dist/internal/complex.d.ts.map +1 -0
  118. package/dist/internal/complex.js +28 -0
  119. package/dist/internal/complex.js.map +1 -0
  120. package/dist/internal/content-watch.d.ts +20 -0
  121. package/dist/internal/content-watch.d.ts.map +1 -0
  122. package/dist/internal/content-watch.js +76 -0
  123. package/dist/internal/content-watch.js.map +1 -0
  124. package/dist/internal/default-transition.d.ts +25 -0
  125. package/dist/internal/default-transition.d.ts.map +1 -0
  126. package/dist/internal/default-transition.js +41 -0
  127. package/dist/internal/default-transition.js.map +1 -0
  128. package/dist/internal/drag-defaults.d.ts +18 -0
  129. package/dist/internal/drag-defaults.d.ts.map +1 -0
  130. package/dist/internal/drag-defaults.js +38 -0
  131. package/dist/internal/drag-defaults.js.map +1 -0
  132. package/dist/internal/gate.d.ts +186 -0
  133. package/dist/internal/gate.d.ts.map +1 -0
  134. package/dist/internal/gate.js +453 -0
  135. package/dist/internal/gate.js.map +1 -0
  136. package/dist/internal/input.d.ts +41 -0
  137. package/dist/internal/input.d.ts.map +1 -0
  138. package/dist/internal/input.js +476 -0
  139. package/dist/internal/input.js.map +1 -0
  140. package/dist/internal/interpolators.d.ts +19 -0
  141. package/dist/internal/interpolators.d.ts.map +1 -0
  142. package/dist/internal/interpolators.js +30 -0
  143. package/dist/internal/interpolators.js.map +1 -0
  144. package/dist/internal/key-rules.d.ts +11 -0
  145. package/dist/internal/key-rules.d.ts.map +1 -0
  146. package/dist/internal/key-rules.js +244 -0
  147. package/dist/internal/key-rules.js.map +1 -0
  148. package/dist/internal/measure.d.ts +150 -0
  149. package/dist/internal/measure.d.ts.map +1 -0
  150. package/dist/internal/measure.js +278 -0
  151. package/dist/internal/measure.js.map +1 -0
  152. package/dist/internal/measured-pairs.d.ts +38 -0
  153. package/dist/internal/measured-pairs.d.ts.map +1 -0
  154. package/dist/internal/measured-pairs.js +251 -0
  155. package/dist/internal/measured-pairs.js.map +1 -0
  156. package/dist/internal/own-values.d.ts +35 -0
  157. package/dist/internal/own-values.d.ts.map +1 -0
  158. package/dist/internal/own-values.js +117 -0
  159. package/dist/internal/own-values.js.map +1 -0
  160. package/dist/internal/pass-ends.d.ts +21 -0
  161. package/dist/internal/pass-ends.d.ts.map +1 -0
  162. package/dist/internal/pass-ends.js +14 -0
  163. package/dist/internal/pass-ends.js.map +1 -0
  164. package/dist/internal/positional-keys.d.ts +16 -0
  165. package/dist/internal/positional-keys.d.ts.map +1 -0
  166. package/dist/internal/positional-keys.js +21 -0
  167. package/dist/internal/positional-keys.js.map +1 -0
  168. package/dist/internal/probe.d.ts +10 -0
  169. package/dist/internal/probe.d.ts.map +1 -0
  170. package/dist/internal/probe.js +117 -0
  171. package/dist/internal/probe.js.map +1 -0
  172. package/dist/internal/projection-defaults.d.ts +34 -0
  173. package/dist/internal/projection-defaults.d.ts.map +1 -0
  174. package/dist/internal/projection-defaults.js +21 -0
  175. package/dist/internal/projection-defaults.js.map +1 -0
  176. package/dist/internal/projection.d.ts +529 -0
  177. package/dist/internal/projection.d.ts.map +1 -0
  178. package/dist/internal/projection.js +4990 -0
  179. package/dist/internal/projection.js.map +1 -0
  180. package/dist/internal/renderer.d.ts +86 -0
  181. package/dist/internal/renderer.d.ts.map +1 -0
  182. package/dist/internal/renderer.js +616 -0
  183. package/dist/internal/renderer.js.map +1 -0
  184. package/dist/internal/reorder.d.ts +159 -0
  185. package/dist/internal/reorder.d.ts.map +1 -0
  186. package/dist/internal/reorder.js +437 -0
  187. package/dist/internal/reorder.js.map +1 -0
  188. package/dist/internal/report.d.ts +30 -0
  189. package/dist/internal/report.d.ts.map +1 -0
  190. package/dist/internal/report.js +60 -0
  191. package/dist/internal/report.js.map +1 -0
  192. package/dist/internal/require-global.d.ts +11 -0
  193. package/dist/internal/require-global.d.ts.map +1 -0
  194. package/dist/internal/require-global.js +31 -0
  195. package/dist/internal/require-global.js.map +1 -0
  196. package/dist/internal/reveal.d.ts +16 -0
  197. package/dist/internal/reveal.d.ts.map +1 -0
  198. package/dist/internal/reveal.js +66 -0
  199. package/dist/internal/reveal.js.map +1 -0
  200. package/dist/internal/runner.d.ts +21 -0
  201. package/dist/internal/runner.d.ts.map +1 -0
  202. package/dist/internal/runner.js +48 -0
  203. package/dist/internal/runner.js.map +1 -0
  204. package/dist/internal/scale-correction.d.ts +80 -0
  205. package/dist/internal/scale-correction.d.ts.map +1 -0
  206. package/dist/internal/scale-correction.js +227 -0
  207. package/dist/internal/scale-correction.js.map +1 -0
  208. package/dist/internal/scroll.d.ts +35 -0
  209. package/dist/internal/scroll.d.ts.map +1 -0
  210. package/dist/internal/scroll.js +244 -0
  211. package/dist/internal/scroll.js.map +1 -0
  212. package/dist/internal/scrollers.d.ts +35 -0
  213. package/dist/internal/scrollers.d.ts.map +1 -0
  214. package/dist/internal/scrollers.js +38 -0
  215. package/dist/internal/scrollers.js.map +1 -0
  216. package/dist/internal/starting-style.d.ts +141 -0
  217. package/dist/internal/starting-style.d.ts.map +1 -0
  218. package/dist/internal/starting-style.js +300 -0
  219. package/dist/internal/starting-style.js.map +1 -0
  220. package/dist/internal/svg.d.ts +60 -0
  221. package/dist/internal/svg.d.ts.map +1 -0
  222. package/dist/internal/svg.js +257 -0
  223. package/dist/internal/svg.js.map +1 -0
  224. package/dist/internal/variables.d.ts +45 -0
  225. package/dist/internal/variables.d.ts.map +1 -0
  226. package/dist/internal/variables.js +92 -0
  227. package/dist/internal/variables.js.map +1 -0
  228. package/package.json +65 -4
  229. package/src/Appear.ts +45 -0
  230. package/src/Color.ts +24 -0
  231. package/src/DomAnnouncer.ts +22 -0
  232. package/src/DomClock.ts +13 -0
  233. package/src/DomDefaultTransition.ts +16 -0
  234. package/src/DomInput.ts +22 -0
  235. package/src/DomInterpolators.ts +16 -0
  236. package/src/DomKeyRules.ts +17 -0
  237. package/src/DomPositionalKeys.ts +16 -0
  238. package/src/DomProbe.ts +15 -0
  239. package/src/DomProjectionSystem.ts +44 -0
  240. package/src/DomRenderer.ts +26 -0
  241. package/src/FlushGate.ts +81 -0
  242. package/src/MeasuredPair.ts +15 -0
  243. package/src/OwnValues.ts +19 -0
  244. package/src/ProjectionSystem.ts +51 -0
  245. package/src/ReorderController.ts +72 -0
  246. package/src/Report.ts +17 -0
  247. package/src/ScrollOffset.ts +54 -0
  248. package/src/Style.ts +37 -0
  249. package/src/Svg.ts +21 -0
  250. package/src/Variables.ts +17 -0
  251. package/src/index.ts +106 -0
  252. package/src/internal/announcer.ts +132 -0
  253. package/src/internal/appear.ts +739 -0
  254. package/src/internal/auto-scroll.ts +176 -0
  255. package/src/internal/clock.ts +45 -0
  256. package/src/internal/colors.ts +258 -0
  257. package/src/internal/complex.ts +29 -0
  258. package/src/internal/content-watch.ts +84 -0
  259. package/src/internal/culori.d.ts +58 -0
  260. package/src/internal/default-transition.ts +50 -0
  261. package/src/internal/drag-defaults.ts +54 -0
  262. package/src/internal/gate.ts +593 -0
  263. package/src/internal/input.ts +579 -0
  264. package/src/internal/interpolators.ts +33 -0
  265. package/src/internal/key-rules.ts +357 -0
  266. package/src/internal/measure.ts +357 -0
  267. package/src/internal/measured-pairs.ts +297 -0
  268. package/src/internal/own-values.ts +166 -0
  269. package/src/internal/pass-ends.ts +23 -0
  270. package/src/internal/positional-keys.ts +24 -0
  271. package/src/internal/probe.ts +176 -0
  272. package/src/internal/projection-defaults.ts +45 -0
  273. package/src/internal/projection.ts +5999 -0
  274. package/src/internal/renderer.ts +646 -0
  275. package/src/internal/reorder.ts +604 -0
  276. package/src/internal/report.ts +69 -0
  277. package/src/internal/require-global.ts +46 -0
  278. package/src/internal/reveal.ts +69 -0
  279. package/src/internal/runner.ts +64 -0
  280. package/src/internal/scale-correction.ts +310 -0
  281. package/src/internal/scroll.ts +356 -0
  282. package/src/internal/scrollers.ts +51 -0
  283. package/src/internal/starting-style.ts +396 -0
  284. package/src/internal/svg.ts +300 -0
  285. package/src/internal/variables.ts +145 -0
@@ -0,0 +1,278 @@
1
+ /**
2
+ * The DOM reads the Projection system takes at measure time (ADR-0005 / ADR-0009 /
3
+ * ADR-0012). Two box readers: {@link readLayoutBox} is the raw rect the projection
4
+ * pass uses (it owns the transform reset at pass level), {@link measureLayoutBox}
5
+ * a self-resetting single-element read for a lone caller. No framework or Effect dependency — pure DOM — so
6
+ * this lives in `@wardic/dom` alongside the Projection system that consumes it (a
7
+ * binding imports it from here).
8
+ *
9
+ * It's the surface of the port the engine would move into `@wardic/core` behind (#16, parked
10
+ * until a non-DOM Environment exists): a DOM read the engine newly needs is added here, named,
11
+ * rather than written inline in `projection.ts`, measure-time or not: the tree's `contains` too
12
+ * (#618). #16 maps the reads that file made inline before this rule.
13
+ */
14
+ import * as Drag from "@wardic/core/Drag";
15
+ import * as Arr from "effect/Array";
16
+ import * as Bool from "effect/Boolean";
17
+ import { constVoid } from "effect/Function";
18
+ import * as Option from "effect/Option";
19
+ import * as Predicate from "effect/Predicate";
20
+ import * as Str from "effect/String";
21
+ import { pending as appearRuns } from "./appear.js";
22
+ /**
23
+ * Read `el`'s box AS IT CURRENTLY RENDERS — a raw `getBoundingClientRect`, no
24
+ * transform reset. The projection measure pass uses this because it resets the
25
+ * whole tree's transforms in its own WRITE phase first, so by the time it reads,
26
+ * nothing is transformed (see `runMeasurePass`). A lone caller wants
27
+ * {@link measureLayoutBox} instead.
28
+ */
29
+ export const readLayoutBox = (el) => {
30
+ const r = el.getBoundingClientRect();
31
+ return {
32
+ x: r.x,
33
+ y: r.y,
34
+ width: r.width,
35
+ height: r.height,
36
+ top: r.top,
37
+ right: r.right,
38
+ bottom: r.bottom,
39
+ left: r.left,
40
+ };
41
+ };
42
+ /**
43
+ * Measures `el`'s box where the layout puts it: its own `transform` is cleared for the read and put
44
+ * back, so an animation running on it doesn't move the reading. Its ancestors' transforms still
45
+ * count. The box is in the viewport: `x`, `y`, `width`, `height`, and its edges.
46
+ *
47
+ * @example
48
+ * const box = measureLayoutBox(card)
49
+ * @see https://wardic.dev/reference/solid/layout/measure-layout-box
50
+ */
51
+ // The inline transform is blanked, the rect read, and the exact prior value restored in a `finally`, so
52
+ // a throwing getBoundingClientRect can't leave the element reset. For one element only: inside a tree
53
+ // pass an ancestor's transform pollutes the reading too, and the `finally` restores before the next
54
+ // element is read, which is why the projection pass hoists the reset out to pass level instead.
55
+ export const measureLayoutBox = (el) => {
56
+ const saved = el.style.transform;
57
+ el.style.transform = "";
58
+ // An Appear animation not yet handed off (#245): its CSS transform beats an inline one, not an important one.
59
+ if (appearRuns(el))
60
+ el.style.setProperty("transform", "none", "important");
61
+ try {
62
+ return readLayoutBox(el);
63
+ }
64
+ finally {
65
+ el.style.transform = saved;
66
+ }
67
+ };
68
+ /**
69
+ * The bounds on `element`'s x/y that keep it inside `container` (Motion's element `dragConstraints`):
70
+ * `element` measured without its own transform (its layout box, as Motion's projection measures it),
71
+ * `container` as it renders. With `mapPoint` (Motion's `transformPagePoint`), each box's corners are
72
+ * mapped through it first, as Motion's `measurePageBox` maps them: a container inside a zoomed parent
73
+ * bounds the element in its own pixels.
74
+ */
75
+ // #273, ADR-0047; #443.
76
+ export const dragBoundsWithin = (element, container, mapPoint) => Drag.boundsWithin(mappedEdges(measureLayoutBox(element), mapPoint), mappedEdges(container.getBoundingClientRect(), mapPoint));
77
+ /** A box's edges, its top-left and bottom-right corners mapped through `mapPoint` when given (#443, Motion's `transformBoxPoints`). */
78
+ const mappedEdges = (box, mapPoint) => {
79
+ if (Predicate.isUndefined(mapPoint))
80
+ return box;
81
+ const topLeft = mapPoint({ x: box.left, y: box.top });
82
+ const bottomRight = mapPoint({ x: box.right, y: box.bottom });
83
+ return { left: topLeft.x, top: topLeft.y, right: bottomRight.x, bottom: bottomRight.y };
84
+ };
85
+ /**
86
+ * A page box's size as it renders (#261, ADR-0018 *Amendment (#261)*): a raw `getBoundingClientRect`,
87
+ * so a transformed one reads as painted, which the observer's border box doesn't (its echo then reads
88
+ * as a change, and costs one refresh).
89
+ */
90
+ export const readBoxSize = (el) => {
91
+ const r = el.getBoundingClientRect();
92
+ return { width: r.width, height: r.height };
93
+ };
94
+ /** The positions that take a box out of its parent's flow, where its size moves nothing else. */
95
+ const OUT_OF_FLOW = ["absolute", "fixed"];
96
+ /** Whether `el` takes space in its parent's flow (#261): it isn't absolutely or fixed positioned. */
97
+ export const takesFlowSpace = (el) => Bool.not(Arr.contains(OUT_OF_FLOW, getComputedStyle(el).position));
98
+ /** An element's scroll offset (ADR-0012, Motion's `measureScroll`). */
99
+ export const measureScroll = (el) => ({ x: el.scrollLeft, y: el.scrollTop });
100
+ /**
101
+ * Whether `el` is a scroll ROOT (ADR-0012, Motion's `checkIsScrollRoot`): a
102
+ * `position: fixed` element establishes a viewport-relative frame, so its subtree
103
+ * doesn't fold in page (or outer-container) scroll.
104
+ */
105
+ export const isScrollRoot = (el) => getComputedStyle(el).position === "fixed";
106
+ /** The properties that move an element on screen without moving its layout (ADR-0012, *Amendment (#136)*). */
107
+ const TRANSFORM_PROPERTIES = ["transform", "translate", "scale", "rotate"];
108
+ /**
109
+ * Each property's identity that isn't `none`. An element held at it keeps the containing
110
+ * block and stacking context its transform gives it, so nothing inside lays out
111
+ * differently while it's held.
112
+ */
113
+ const IDENTITY = {
114
+ transform: "translate(0px)",
115
+ translate: "0px",
116
+ scale: "1",
117
+ rotate: "0deg",
118
+ };
119
+ const isTransformProperty = (property) => Arr.contains(TRANSFORM_PROPERTIES, property);
120
+ /** A transition on a transform property: `all`, or one of them by name. */
121
+ const transitionsTransform = (property) => Bool.or(property === "all", isTransformProperty(property));
122
+ /** A CSS time (`0.3s`, `200ms`) in seconds. */
123
+ const seconds = (time) => Bool.match(Str.endsWith("ms")(time), { onTrue: () => Number.parseFloat(time) / 1000, onFalse: () => Number.parseFloat(time) });
124
+ /** The list a computed `transition-*` value holds, one entry per transition. */
125
+ const entries = (value) => Arr.map(value.split(","), Str.trim);
126
+ /**
127
+ * Whether `style` declares a transition that would run on one of the transform
128
+ * properties: its name or `all`, with a combined duration (`max(duration, 0) + delay`)
129
+ * above 0. The durations and delays repeat to the properties' length, as CSS does.
130
+ */
131
+ const declaresTransformTransition = (style) => {
132
+ const durations = entries(style.transitionDuration);
133
+ const delays = entries(style.transitionDelay);
134
+ return Arr.some(entries(style.transitionProperty), (property, i) => Bool.and(transitionsTransform(property), Math.max(seconds(durations[i % durations.length]), 0) + seconds(delays[i % delays.length]) > 0));
135
+ };
136
+ /** A computed transform property that moves its element: set, and not `none` (`""` is unsupported, or no style). */
137
+ const isMoving = (value) => Bool.and(Str.isNonEmpty(value), value !== "none");
138
+ /**
139
+ * Whether one of `style`'s transform properties moves its element. Read through the
140
+ * properties' accessors, which cost less than `getPropertyValue` (0.57 against 0.70 µs for
141
+ * the four in Chromium 147), and nothing is allocated.
142
+ */
143
+ const movesAny = (style) => Bool.or(Bool.or(isMoving(style.transform), isMoving(style.translate)), Bool.or(isMoving(style.scale), isMoving(style.rotate)));
144
+ /**
145
+ * {@link TransformStyle} from an element's computed style. `getComputedStyle` returns a
146
+ * live declaration, so a caller that keeps one per element reads the current values each
147
+ * time without calling it again.
148
+ */
149
+ export const transformStyleFrom = (style) => {
150
+ // Most elements carry none: they cost the four reads, and nothing else.
151
+ if (Bool.not(movesAny(style)))
152
+ return UNMOVED;
153
+ return {
154
+ moved: Arr.filter(TRANSFORM_PROPERTIES, (property) => isMoving(style[property])),
155
+ transitioned: declaresTransformTransition(style),
156
+ };
157
+ };
158
+ /** The answer for an element no transform moves, shared. */
159
+ const UNMOVED = { moved: [], transitioned: false };
160
+ /**
161
+ * Whether a CSS transition is running on one of `el`'s transform properties. Holding it
162
+ * would cancel or restart that transition, so the pass leaves it as it is: its offset
163
+ * stays in the box (the documented limit).
164
+ */
165
+ export const transitionRunning = (el) => Arr.some(el.getAnimations(), (animation) => Bool.and(animation instanceof CSSTransition, isTransformProperty(animation.transitionProperty)));
166
+ /** Whether `el` has an inline style the pass can hold its transform through. */
167
+ export const isHoldable = (el) => Predicate.hasProperty(el, "style");
168
+ /** Put an inline property back as it was: removed when it had no inline value. */
169
+ const restoreProperty = (inline, property, value, priority) => Bool.match(Str.isEmpty(value), {
170
+ onTrue: () => {
171
+ inline.removeProperty(property);
172
+ },
173
+ onFalse: () => inline.setProperty(property, value, priority),
174
+ });
175
+ /**
176
+ * Hold `el`'s transform properties at their identity (ADR-0012, *Amendment (#136)*):
177
+ * inline and `!important`, so a stylesheet rule, a CSS animation and a Web Animation
178
+ * all give way. An element with a transition declared on one of them also gets
179
+ * `transition-property: none` for the hold, so it starts none.
180
+ */
181
+ export const holdTransform = (el, style) => {
182
+ const inline = el.style;
183
+ const saved = Arr.map(style.moved, (property) => [property, inline.getPropertyValue(property), inline.getPropertyPriority(property)]);
184
+ const transition = Bool.match(style.transitioned, {
185
+ onFalse: () => Option.none(),
186
+ onTrue: () => Option.some([inline.getPropertyValue("transition-property"), inline.getPropertyPriority("transition-property")]),
187
+ });
188
+ if (Option.isSome(transition))
189
+ inline.setProperty("transition-property", "none", "important");
190
+ Arr.forEach(style.moved, (property) => inline.setProperty(property, IDENTITY[property], "important"));
191
+ return { element: el, saved, transition };
192
+ };
193
+ /**
194
+ * Put back what {@link holdTransform} replaced. The elements whose transitions it turned
195
+ * off get their transform back first, then a style read, then their transition, so the
196
+ * return from identity starts no transition either.
197
+ */
198
+ export const releaseTransforms = (holds) => {
199
+ Arr.forEach(holds, (hold) => Arr.forEach(hold.saved, ([property, value, priority]) => restoreProperty(hold.element.style, property, value, priority)));
200
+ const transitioned = Arr.filter(holds, (hold) => Option.isSome(hold.transition));
201
+ Arr.forEach(transitioned, (hold) => getComputedStyle(hold.element).getPropertyValue("transform"));
202
+ Arr.forEach(transitioned, (hold) => Option.match(hold.transition, {
203
+ onNone: constVoid,
204
+ onSome: ([value, priority]) => restoreProperty(hold.element.style, "transition-property", value, priority),
205
+ }));
206
+ };
207
+ /** The inline properties a sticky element is held unstuck through (#578). */
208
+ const UNSTUCK = [
209
+ ["position", "relative"],
210
+ ["top", "auto"],
211
+ ["right", "auto"],
212
+ ["bottom", "auto"],
213
+ ["left", "auto"],
214
+ ];
215
+ /**
216
+ * Hold a `position: sticky` element at its static place (ADR-0012, *Amendment (#578)*):
217
+ * `position: relative` with every inset `auto`, inline and `!important`, so it's offset by
218
+ * nothing and still positioned, the containing block of what's absolute inside it. Neither
219
+ * the flow around it nor the scroll moves: a sticky element's offset takes no space.
220
+ */
221
+ export const holdUnstuck = (el) => {
222
+ const inline = el.style;
223
+ const saved = Arr.map(UNSTUCK, ([property]) => [property, inline.getPropertyValue(property), inline.getPropertyPriority(property)]);
224
+ Arr.forEach(UNSTUCK, ([property, value]) => inline.setProperty(property, value, "important"));
225
+ return { element: el, saved };
226
+ };
227
+ /** Put back what {@link holdUnstuck} replaced. */
228
+ export const releaseUnstuck = (holds) => Arr.forEach(holds, (hold) => Arr.forEach(hold.saved, ([property, value, priority]) => restoreProperty(hold.element.style, property, value, priority)));
229
+ /**
230
+ * The document's scroll offset (the page/window scroll, ADR-0012, Motion's
231
+ * `DocumentProjectionNode` root). Folded into every box unless it sits in a scroll
232
+ * root. SSR-safe (returns origin when there is no document).
233
+ */
234
+ export const measureDocumentScroll = () => {
235
+ const page = globalThis.document;
236
+ if (Predicate.isUndefined(page))
237
+ return { x: 0, y: 0 };
238
+ const doc = page.documentElement;
239
+ // In quirks mode the body scrolls, and `documentElement` reads 0. Per pass: plain reads.
240
+ const body = page.body;
241
+ if (Predicate.isNull(body))
242
+ return { x: doc.scrollLeft, y: doc.scrollTop };
243
+ return { x: doc.scrollLeft || body.scrollLeft, y: doc.scrollTop || body.scrollTop };
244
+ };
245
+ export { readScrollStyle, scrollersOf, scrollStyleFrom } from "./scrollers.js";
246
+ /** Whether `inner` is `outer` or inside it, in the DOM's tree: the engine's one question of the tree (#618). */
247
+ export const contains = (outer, inner) => outer.contains(inner);
248
+ /** `el`'s computed opacity, as a number: a Crossfade's fade from where its leaver is drawn (#618). */
249
+ export const readOpacity = (el) => Number(getComputedStyle(el).opacity);
250
+ /** The computed values of `keys` on `el` (#443), by key: an empty one, or `none`, left out. One style read. */
251
+ export const readCustomBases = (el, keys) => {
252
+ const style = getComputedStyle(el);
253
+ const out = {};
254
+ for (const corrected of keys) {
255
+ const value = style.getPropertyValue(corrected.cssKey).trim();
256
+ if (value !== "" && value !== "none")
257
+ out[corrected.key] = value;
258
+ }
259
+ return out;
260
+ };
261
+ /**
262
+ * Each of `els`' offsets from its static place (#578): its box as it's drawn, less its box held
263
+ * unstuck. All held at once, so it costs one layout for them all, then one more after the release.
264
+ */
265
+ export const readStickyShifts = (els) => {
266
+ const list = Arr.fromIterable(els);
267
+ const stuck = Arr.map(list, (el) => el.getBoundingClientRect());
268
+ const holds = Arr.map(list, holdUnstuck);
269
+ let unstuck = [];
270
+ try {
271
+ unstuck = Arr.map(list, (el) => el.getBoundingClientRect());
272
+ }
273
+ finally {
274
+ releaseUnstuck(holds);
275
+ }
276
+ return new Map(Arr.map(list, (el, i) => [el, { x: stuck[i].left - unstuck[i].left, y: stuck[i].top - unstuck[i].top }]));
277
+ };
278
+ //# sourceMappingURL=measure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../src/internal/measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAA;AAGzC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAe,EAAgB,EAAE;IAC7D,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAA;IACpC,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,CAAC;QACN,CAAC,EAAE,CAAC,CAAC,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,IAAI,E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,EAAE,EAAE,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,CAAA;IAC7D,CAAC;YAAS,CAAC;QACT,cAAc,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAU,CAAC,CAAC,CAAA;AACnI,CAAC,CAAA"}
@@ -0,0 +1,38 @@
1
+ import type * as Values from "@wardic/core/Values";
2
+ import * as Option from "effect/Option";
3
+ /**
4
+ * Whether `key` from `from` to `to` needs measuring, a Measured pair: a key that can be measured, whose
5
+ * two ends are lengths, `auto` or a `calc()`, of different types. Two of one type blend as ever.
6
+ */
7
+ export declare const needs: (key: string, from: number | string, to: number | string) => boolean;
8
+ /** One Measured pair as asked for: its key, and its ends as given. */
9
+ export interface Requested {
10
+ /** The key. */
11
+ readonly key: string;
12
+ /** Its start, as given. */
13
+ readonly from: number | string;
14
+ /** Its target, as given. */
15
+ readonly to: number | string;
16
+ }
17
+ /** One Measured pair its batch has read: as asked, with each end in px. */
18
+ export interface Measured extends Requested {
19
+ /** Its start in px. */
20
+ readonly fromPx: number;
21
+ /** Its target in px. */
22
+ readonly toPx: number;
23
+ }
24
+ /**
25
+ * `pair` with its px, once its end-of-task batch has read both its ends: none before that batch, and
26
+ * none if it couldn't read one, which the animation takes as a switch.
27
+ */
28
+ export declare const measured: (pair: Requested) => Option.Option<Measured>;
29
+ /**
30
+ * Measures `pairs` on `element` at the end of this task, with every other element's in the same batch:
31
+ * each pair, as asked, {@link measured} before the next tick. `values` are what the element draws now,
32
+ * its other transforms among them.
33
+ */
34
+ export declare const measure: (element: HTMLElement, pairs: Readonly<Record<string, {
35
+ readonly from: number | string;
36
+ readonly to: number | string;
37
+ }>>, values: Values.Values) => Readonly<Record<string, Requested>>;
38
+ //# sourceMappingURL=measured-pairs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measured-pairs.d.ts","sourceRoot":"","sources":["../../src/internal/measured-pairs.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,KAAK,MAAM,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AA8BvC;;;GAGG;AAEH,eAAO,MAAM,KAAK,QAAS,MAAM,QAAQ,MAAM,GAAG,MAAM,MAAM,MAAM,GAAG,MAAM,KAAG,OAO/E,CAAA;AAED,sEAAsE;AAEtE,MAAM,WAAW,SAAS;IACxB,eAAe;IACf,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAC7B;AAED,2EAA2E;AAC3E,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,uBAAuB;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,wBAAwB;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAoBD;;;GAGG;AAEH,eAAO,MAAM,QAAQ,SAAU,SAAS,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAA2C,CAAA;AAQ5G;;;;GAIG;AAEH,eAAO,MAAM,OAAO,YACT,WAAW,SACb,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC,UACzF,MAAM,CAAC,MAAM,KACpB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAQpC,CAAA"}
@@ -0,0 +1,251 @@
1
+ /**
2
+ * **Measured pairs** (#430, CONTEXT.md; Motion's `DOMKeyframesResolver`, `.reference/motion` at
3
+ * `16c6122`): a positional key whose start and target differ in type (`"auto"`, `"50%"` against a
4
+ * length in px, a `calc()` on one side) is measured in px at both ends, its leg runs between them,
5
+ * and it lands on its target as given.
6
+ *
7
+ * - **Which keys:** `width`, `height`, `top`, `left`, `right`, `bottom`, and the translates `x`, `y`,
8
+ * `translateX`, `translateY`: Motion's `positionalKeys` with a measurement (`positionalValues`).
9
+ * - **When** (#430's Q2): every pair a task asks for is measured in one batch, in a microtask at the
10
+ * end of that task, before its paint (ADR-0018's timing): each start read, each target written
11
+ * inline, the page laid out once, each target read, every style restored. Motion's
12
+ * `measureAllKeyframes`. Nothing paints the target, and a `ResizeObserver` never reports it.
13
+ * - **An end already in px** (a number, a px length) is taken as given: only `auto`, a percentage, a
14
+ * `calc()` or another unit is read from the layout.
15
+ * - **The reads:** a size from the computed style, which a transform doesn't change, else from the
16
+ * box (an element with none of its own, inline: Motion's `measureDimension`); an inset from the
17
+ * computed style, else, for `right` and `bottom`, Motion's sum from `top` or `left` and the box,
18
+ * read with the element's transform off; a translate from the computed transform's matrix.
19
+ *
20
+ * A binding asks with {@link measure} at a Retarget, which returns each pair as asked
21
+ * ({@link Requested}), and its leg reads each one {@link measured} at its first step, a tick after the
22
+ * batch: a new record with its px, none if the batch couldn't read it.
23
+ */
24
+ import * as Interpolator from "@wardic/core/Interpolator";
25
+ import * as Arr from "effect/Array";
26
+ import * as Bool from "effect/Boolean";
27
+ import * as Option from "effect/Option";
28
+ import * as Predicate from "effect/Predicate";
29
+ import * as Rec from "effect/Record";
30
+ import * as UndefinedOr from "effect/UndefinedOr";
31
+ import { project } from "./renderer.js";
32
+ /** The keys a Measured pair can be on (Motion's positional keys with a measurement). */
33
+ const SIZES = new Set(["width", "height"]);
34
+ const INSETS = new Set(["top", "left", "right", "bottom"]);
35
+ const TRANSLATES = new Set(["x", "y", "translateX", "translateY"]);
36
+ /** Every key a Measured pair can be on: one lookup per key, per Retarget (#460). */
37
+ const MEASURABLE = new Set([...SIZES, ...INSETS, ...TRANSLATES]);
38
+ /** Whether `key` can be a Measured pair. */
39
+ const isMeasurable = (key) => MEASURABLE.has(key);
40
+ /**
41
+ * A value's type, as a Measured pair compares them: a number or a px length is `px`; `auto`; a
42
+ * `calc()` or `var()`; any other unit; `undefined` for what isn't a length. Per key, per Retarget: a
43
+ * number, nearly every translate's, makes nothing.
44
+ */
45
+ const kindOf = (value) => {
46
+ if (Predicate.isNumber(value))
47
+ return "px";
48
+ const text = value.trim();
49
+ if (text === "auto")
50
+ return "auto";
51
+ if (/^(calc|var|min|max|clamp)\(/.test(text))
52
+ return "calc";
53
+ return Option.getOrUndefined(Option.map(Interpolator.unitOf(text), (unit) => Bool.match(Bool.or(unit === "", unit === "px"), { onTrue: () => "px", onFalse: () => unit })));
54
+ };
55
+ /**
56
+ * Whether `key` from `from` to `to` needs measuring, a Measured pair: a key that can be measured, whose
57
+ * two ends are lengths, `auto` or a `calc()`, of different types. Two of one type blend as ever.
58
+ */
59
+ // #430; `needs`, not a type guard's `is…` name (#618, A3).
60
+ export const needs = (key, from, to) => {
61
+ if (Bool.not(isMeasurable(key)))
62
+ return false;
63
+ const a = kindOf(from);
64
+ if (Predicate.isUndefined(a))
65
+ return false;
66
+ const b = kindOf(to);
67
+ if (Predicate.isUndefined(b))
68
+ return false;
69
+ return a !== b;
70
+ };
71
+ // Module state (#460, Q7): each pair its batch has read, by the pair as asked, kept as long as its asker
72
+ // keeps that pair.
73
+ const read = new WeakMap();
74
+ /**
75
+ * `pair` with its px, once its end-of-task batch has read both its ends: none before that batch, and
76
+ * none if it couldn't read one, which the animation takes as a switch.
77
+ */
78
+ // #618 (A1).
79
+ export const measured = (pair) => Option.fromUndefinedOr(read.get(pair));
80
+ /** The pairs this task asked for, measured at its end. */
81
+ // Module state (#460, Q7): the page's one batch, so every provider's pairs share one read pass a task.
82
+ let queued = [];
83
+ // Module state (#460, Q7): the page's one end-of-task batch across providers.
84
+ let scheduled = false;
85
+ /**
86
+ * Measures `pairs` on `element` at the end of this task, with every other element's in the same batch:
87
+ * each pair, as asked, {@link measured} before the next tick. `values` are what the element draws now,
88
+ * its other transforms among them.
89
+ */
90
+ // #430's Q2.
91
+ export const measure = (element, pairs, values) => {
92
+ const made = Rec.map(pairs, ({ from, to }, key) => ({ key, from, to }));
93
+ queued.push({ element, slots: Arr.map(Rec.values(made), (pair) => ({ pair, fromPx: undefined, toPx: undefined })), values });
94
+ if (Bool.not(scheduled)) {
95
+ scheduled = true;
96
+ queueMicrotask(flush);
97
+ }
98
+ return made;
99
+ };
100
+ /** A length's CSS text, as a style property takes it: a number in px. */
101
+ const cssOf = (value) => Bool.match(Predicate.isNumber(value), { onTrue: () => `${value}px`, onFalse: () => value });
102
+ /**
103
+ * An end already in px (#430): a number, or a px length, taken as given, not read from the layout.
104
+ * So an explicit first stop (`[0, "auto"]`) starts at it, where Motion's `measureInitialState` reads
105
+ * the element over it, and a target in px is never written to be read.
106
+ */
107
+ const givenPx = (value) => {
108
+ if (kindOf(value) !== "px")
109
+ return undefined;
110
+ if (Predicate.isNumber(value))
111
+ return value;
112
+ return Option.getOrUndefined(pxOf(value));
113
+ };
114
+ /** A number read from CSS text, `None` when it isn't one (`auto`). */
115
+ const pxOf = (text) => Option.liftPredicate(Number.parseFloat(text), Number.isFinite);
116
+ /** A size read from the box, as Motion's `measureDimension`: the border box, less the padding for a content box. */
117
+ const sizeFromBox = (element, style, key) => {
118
+ const box = element.getBoundingClientRect();
119
+ const size = Bool.match(key === "width", { onTrue: () => box.width, onFalse: () => box.height });
120
+ if (style.boxSizing === "border-box")
121
+ return size;
122
+ const [start, end] = Bool.match(key === "width", {
123
+ onTrue: () => [style.paddingLeft, style.paddingRight],
124
+ onFalse: () => [style.paddingTop, style.paddingBottom],
125
+ });
126
+ return size - Option.getOrElse(pxOf(start), () => 0) - Option.getOrElse(pxOf(end), () => 0);
127
+ };
128
+ /** An inset Motion reads from the box (`right`, `bottom`): its opposite inset and the box's size, the element's transform off. */
129
+ const insetFromBox = (element, style, key) => {
130
+ const transform = element.style.transform;
131
+ element.style.transform = "none";
132
+ const box = element.getBoundingClientRect();
133
+ element.style.transform = transform;
134
+ const [opposite, size] = Bool.match(key === "right", { onTrue: () => [style.left, box.width], onFalse: () => [style.top, box.height] });
135
+ return Option.getOrElse(pxOf(opposite), () => 0) + size;
136
+ };
137
+ /** A translate read from the computed transform's matrix. */
138
+ const translateOf = (style, key) => {
139
+ const matrix = new DOMMatrix(Bool.match(style.transform === "none", { onTrue: () => "matrix(1, 0, 0, 1, 0, 0)", onFalse: () => style.transform }));
140
+ return Bool.match(Bool.or(key === "x", key === "translateX"), { onTrue: () => matrix.m41, onFalse: () => matrix.m42 });
141
+ };
142
+ /** `key`'s value in px as `element` lays out now. */
143
+ const readPx = (element, style, key) => {
144
+ if (TRANSLATES.has(key))
145
+ return translateOf(style, key);
146
+ const read = pxOf(style.getPropertyValue(key));
147
+ if (Option.isSome(read))
148
+ return read.value;
149
+ if (SIZES.has(key))
150
+ return sizeFromBox(element, style, key);
151
+ if (Bool.or(key === "right", key === "bottom"))
152
+ return insetFromBox(element, style, key);
153
+ return 0;
154
+ };
155
+ /** An inline property as it is now, to put back. */
156
+ const savedOf = (element, property) => ({ element, property, value: element.style.getPropertyValue(property), priority: element.style.getPropertyPriority(property) });
157
+ /**
158
+ * Write `pairs`' translates at their `end` through the element's whole transform, keeping what was
159
+ * there: the browser lays out any unit, `-100%` included (#594).
160
+ */
161
+ const writeTranslates = (request, slots, end) => {
162
+ if (slots.length === 0)
163
+ return [];
164
+ const { element, values } = request;
165
+ const saved = savedOf(element, "transform");
166
+ const transform = project({ ...values, ...Rec.fromEntries(Arr.map(slots, ({ pair }) => [pair.key, pair[end]])) })["transform"];
167
+ element.style.setProperty("transform", UndefinedOr.match(transform, { onUndefined: () => "none", onDefined: String }));
168
+ return [saved];
169
+ };
170
+ /** Write each pair's target inline on its element, keeping what was there; a translate through the element's whole transform. */
171
+ const writeTargets = (request) => {
172
+ const unread = Arr.filter(request.slots, (slot) => Predicate.isUndefined(slot.toPx));
173
+ const saved = [...writeTranslates(request, Arr.filter(unread, (slot) => TRANSLATES.has(slot.pair.key)), "to")];
174
+ Arr.forEach(unread, ({ pair }) => {
175
+ if (TRANSLATES.has(pair.key))
176
+ return;
177
+ saved.push(savedOf(request.element, pair.key));
178
+ request.element.style.setProperty(pair.key, cssOf(pair.to));
179
+ });
180
+ return saved;
181
+ };
182
+ /**
183
+ * Write each translate pair's start not in px, as a target is (#594): a layout element's transform at
184
+ * this moment is its projection's, or held off for its Measure pass, so reading it as it is gave 0.
185
+ */
186
+ const writeTranslateStarts = (request) => writeTranslates(request, Arr.filter(request.slots, (slot) => Bool.and(TRANSLATES.has(slot.pair.key), Predicate.isUndefined(slot.fromPx))), "from");
187
+ /** Put back what {@link writeTargets} replaced. */
188
+ const restore = (saved) => Arr.forEach(saved, ({ element, property, value, priority }) => Bool.match(value === "", {
189
+ onTrue: () => void element.style.removeProperty(property),
190
+ onFalse: () => element.style.setProperty(property, value, priority),
191
+ }));
192
+ /**
193
+ * The batch (#430's Q2): every start read, every target written, every target read, every style
194
+ * restored, so the page is laid out once for all of them and paints none. A page scrolled by a target
195
+ * (a height growing above the view) is scrolled back, as Motion's `suspendedScrollY`.
196
+ */
197
+ const flush = () => {
198
+ const batch = queued;
199
+ queued = [];
200
+ scheduled = false;
201
+ const styles = Arr.map(batch, ({ element }) => getComputedStyle(element));
202
+ // Each end in px as given.
203
+ Arr.forEach(batch, (request) => Arr.forEach(request.slots, (slot) => {
204
+ slot.toPx = givenPx(slot.pair.to);
205
+ slot.fromPx = givenPx(slot.pair.from);
206
+ }));
207
+ // WRITE, READ, WRITE: each translate's start not in px, written alone and read (#594).
208
+ const starts = Arr.flatMap(batch, writeTranslateStarts);
209
+ if (Arr.isArrayNonEmpty(starts)) {
210
+ try {
211
+ Arr.forEach(batch, (request, i) => Arr.forEach(request.slots, (slot) => {
212
+ if (Bool.and(TRANSLATES.has(slot.pair.key), Predicate.isUndefined(slot.fromPx)))
213
+ slot.fromPx = readPx(request.element, UndefinedOr.getOrThrow(styles[i]), slot.pair.key);
214
+ }));
215
+ }
216
+ finally {
217
+ restore(starts);
218
+ }
219
+ }
220
+ // READ: each other start not already in px, as the element lays out now.
221
+ Arr.forEach(batch, (request, i) => Arr.forEach(request.slots, (slot) => {
222
+ if (Predicate.isUndefined(slot.fromPx))
223
+ slot.fromPx = readPx(request.element, UndefinedOr.getOrThrow(styles[i]), slot.pair.key);
224
+ }));
225
+ const scrollY = globalThis.scrollY;
226
+ // WRITE: each target, inline.
227
+ const saved = Arr.flatMap(batch, writeTargets);
228
+ try {
229
+ // READ: each target not already in px, laid out once.
230
+ Arr.forEach(batch, (request, i) => Arr.forEach(request.slots, (slot) => {
231
+ if (Predicate.isUndefined(slot.toPx))
232
+ slot.toPx = readPx(request.element, UndefinedOr.getOrThrow(styles[i]), slot.pair.key);
233
+ }));
234
+ }
235
+ finally {
236
+ // WRITE: every style as it was.
237
+ restore(saved);
238
+ if (globalThis.scrollY !== scrollY)
239
+ globalThis.scrollTo(globalThis.scrollX, scrollY);
240
+ }
241
+ // Each pair read at both ends, as a record of its own.
242
+ Arr.forEach(batch, (request) => Arr.forEach(request.slots, ({ pair, fromPx, toPx }) => {
243
+ if (Predicate.isUndefined(fromPx))
244
+ return;
245
+ if (Predicate.isUndefined(toPx))
246
+ return;
247
+ if (Bool.and(Number.isFinite(fromPx), Number.isFinite(toPx)))
248
+ read.set(pair, { ...pair, fromPx, toPx });
249
+ }));
250
+ };
251
+ //# sourceMappingURL=measured-pairs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measured-pairs.js","sourceRoot":"","sources":["../../src/internal/measured-pairs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