@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,35 @@
1
+ import * as Option from "effect/Option";
2
+ /** An element's own value for a key: the raw value read, a string, a transform key's identity, or `None`. */
3
+ export type OwnValue = (key: string) => Option.Option<number | string>;
4
+ /**
5
+ * A reader of `element`'s own values, each read once, the first time it's needed, and kept, a miss too,
6
+ * so a later CSS change doesn't move it, as Motion's. For each key:
7
+ * 1. a transform key: its identity, with no read;
8
+ * 2. on an SVG element inside an `<svg>`, a key it takes as an attribute: that attribute, if it has one;
9
+ * 3. else its computed style, a custom property by its own name.
10
+ *
11
+ * Making a reader reads nothing, and a read from an element not in the document isn't kept. Values read
12
+ * are raw strings: `valueLike` reads one in a target's shape.
13
+ */
14
+ export declare const ownValues: (element: Element) => OwnValue;
15
+ /**
16
+ * The app's `style` value for `key`: from an object style by the key, then by the key dash-cased; from a
17
+ * CSS-text style, parsed as `Style.over` parses it. `undefined`, `null` and an empty string are `None`. A
18
+ * transform key, `x`, `scale`, `rotate`, is Wardic's, as Motion's is: a binding draws it into `transform`.
19
+ * The value is as given, so a binding reads a live value, an Atom or an accessor, itself.
20
+ *
21
+ * @example
22
+ * OwnValues.styleValueOf({ opacity: 0.5 }, "opacity") // Some(0.5)
23
+ */
24
+ export declare const styleValueOf: (style: object | string | undefined, key: string) => Option.Option<unknown>;
25
+ /**
26
+ * `raw` in the shape of a key's target `like`, or `None` when it can't be:
27
+ * - **A number target** takes a finite number, or a plain number or a `px` string, parsed (`"0.5"` is
28
+ * 0.5, `"120px"` 120). Anything else misses, `auto`, `50%`, `1em`, a colour, so the key starts at its
29
+ * target. On a key that places or sizes the box, a miss of another type, `auto` or `50%`, is a Measured
30
+ * pair instead: both ends are measured in px, as Motion's are.
31
+ * - **A string target** takes a string as it is, or a finite number as a string, but not a length in a
32
+ * unit other than the target's (`"120px"` for `"0%"`), which can't blend with it.
33
+ */
34
+ export declare const valueLike: (raw: unknown, like: number | string) => Option.Option<number | string>;
35
+ //# sourceMappingURL=own-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"own-values.d.ts","sourceRoot":"","sources":["../../src/internal/own-values.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAMvC,6GAA6G;AAC7G,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAEtE;;;;;;;;;GASG;AAGH,eAAO,MAAM,SAAS,YAAa,OAAO,KAAG,QA4B5C,CAAA;AAKD;;;;;;;;GAQG;AAEH,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,MAAM,GAAG,SAAS,OAAO,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAgBjG,CAAA;AAuBH;;;;;;;;GAQG;AAGH,eAAO,MAAM,SAAS,QAAS,OAAO,QAAQ,MAAM,GAAG,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAA+B,CAAA"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Base values in the DOM (ADR-0022): an element's Own value for a key, and the `style` link's
3
+ * lookup. A binding calls these and hands them to core's `BaseValue.of` / `BaseValue.start`, so a
4
+ * new binding writes no DOM code for them (the thin-bindings rule). Tier 2, for binding
5
+ * authors.
6
+ *
7
+ * Client-only: the read runs after mount, never during a server render (ADR-0021, "Nothing
8
+ * reads the DOM on a server"). `styleValueOf` and `valueLike` are pure.
9
+ *
10
+ * Observability: per element and cold (once per key), so quiet; the spine logs what it
11
+ * started from and returned to.
12
+ */
13
+ import * as BaseValue from "@wardic/core/BaseValue";
14
+ import * as Interpolator from "@wardic/core/Interpolator";
15
+ import * as Bool from "effect/Boolean";
16
+ import * as Match from "effect/Match";
17
+ import * as MutableRef from "effect/MutableRef";
18
+ import * as Option from "effect/Option";
19
+ import * as Predicate from "effect/Predicate";
20
+ import * as Str from "effect/String";
21
+ import { parseCssText } from "./starting-style.js";
22
+ import { dashCase, isSvgInner, svgAttrNameOf } from "./svg.js";
23
+ /**
24
+ * A reader of `element`'s own values, each read once, the first time it's needed, and kept, a miss too,
25
+ * so a later CSS change doesn't move it, as Motion's. For each key:
26
+ * 1. a transform key: its identity, with no read;
27
+ * 2. on an SVG element inside an `<svg>`, a key it takes as an attribute: that attribute, if it has one;
28
+ * 3. else its computed style, a custom property by its own name.
29
+ *
30
+ * Making a reader reads nothing, and a read from an element not in the document isn't kept. Values read
31
+ * are raw strings: `valueLike` reads one in a target's shape.
32
+ */
33
+ // Motion's C12. A transform key: Motion's projected branch, HTMLVisualElement.ts:51 at
34
+ // 16c61222c4166bbef5ff6ab0051192faa79fa8c8. An attribute: ADR-0014's routing.
35
+ export const ownValues = (element) => {
36
+ const cache = new Map();
37
+ // The element's computed style, read once, at the first key that needs it.
38
+ const computed = MutableRef.make(Option.none());
39
+ const computedStyle = () => Option.getOrElse(MutableRef.get(computed), () => {
40
+ const style = getComputedStyle(element);
41
+ MutableRef.set(computed, Option.some(style));
42
+ return style;
43
+ });
44
+ // On an svg-inner element, the attribute the key is written as, if it has one.
45
+ const attributeOf = (key) => Bool.match(isSvgInner(element), {
46
+ onTrue: () => Option.flatMap(svgAttrNameOf(key), (name) => nonEmpty(element.getAttribute(name))),
47
+ onFalse: () => Option.none(),
48
+ });
49
+ const read = (key) => Option.orElse(BaseValue.transformIdentity(key), () => Option.orElse(attributeOf(key), () => nonEmpty(computedStyle().getPropertyValue(dashCase(key)).trim())));
50
+ return (key) => Option.getOrElse(Option.fromUndefinedOr(cache.get(key)), () => {
51
+ const value = read(key);
52
+ // An element not in the document has an empty computed style: that miss isn't the
53
+ // element's, so it isn't kept, and the key is read again once the element is in.
54
+ if (element.isConnected)
55
+ cache.set(key, value);
56
+ return value;
57
+ });
58
+ };
59
+ /** A read string, `None` when there's none or it's empty. */
60
+ const nonEmpty = (value) => Option.filter(Option.fromNullOr(value), Str.isNonEmpty);
61
+ /**
62
+ * The app's `style` value for `key`: from an object style by the key, then by the key dash-cased; from a
63
+ * CSS-text style, parsed as `Style.over` parses it. `undefined`, `null` and an empty string are `None`. A
64
+ * transform key, `x`, `scale`, `rotate`, is Wardic's, as Motion's is: a binding draws it into `transform`.
65
+ * The value is as given, so a binding reads a live value, an Atom or an accessor, itself.
66
+ *
67
+ * @example
68
+ * OwnValues.styleValueOf({ opacity: 0.5 }, "opacity") // Some(0.5)
69
+ */
70
+ // The `style` link of a Base value. #130, ADR-0043 decision 4: through the flush gate.
71
+ export const styleValueOf = (style, key) => Option.flatMap(Option.fromNullishOr(style), (given) => {
72
+ const map = recordOf(given);
73
+ // A value at `k`: `undefined`, `null` and an empty string are misses.
74
+ const at = (k) => Option.filter(Option.flatMap(Option.liftPredicate(k, (name) => Object.hasOwn(map, name)), (name) => Option.fromNullishOr(map[name])), (value) => value !== "");
75
+ // A custom property by its own name only; any other key then dash-cased.
76
+ return Option.orElse(at(key), () => Option.flatMap(Option.liftPredicate(dashCase(key), (dashed) => Bool.not(key.startsWith("--")) && dashed !== key), at));
77
+ });
78
+ /** The last CSS text parsed, and its record. */
79
+ // Module state (#460, Q7): a one-entry cache keyed by the text it parsed, read only: a Retarget asks
80
+ // for each of a style's keys in a row, and parsed the whole text again for each (#618, F6).
81
+ let last = { text: "", record: {} };
82
+ /** `text` parsed, once for as long as it's the text asked for. */
83
+ const parsedOnce = (text) => {
84
+ if (text === last.text)
85
+ return last.record;
86
+ last = { text, record: parseCssText(text) };
87
+ return last.record;
88
+ };
89
+ /** A style given as CSS text, parsed; a record as it is. */
90
+ const recordOf = Match.type().pipe(Match.when(Predicate.isString, parsedOnce), Match.orElse((record) => record));
91
+ /** A plain number, or a number in `px`. */
92
+ const NUMERIC = /^\s*-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?(px)?\s*$/i;
93
+ /**
94
+ * `raw` in the shape of a key's target `like`, or `None` when it can't be:
95
+ * - **A number target** takes a finite number, or a plain number or a `px` string, parsed (`"0.5"` is
96
+ * 0.5, `"120px"` 120). Anything else misses, `auto`, `50%`, `1em`, a colour, so the key starts at its
97
+ * target. On a key that places or sizes the box, a miss of another type, `auto` or `50%`, is a Measured
98
+ * pair instead: both ends are measured in px, as Motion's are.
99
+ * - **A string target** takes a string as it is, or a finite number as a string, but not a length in a
100
+ * unit other than the target's (`"120px"` for `"0%"`), which can't blend with it.
101
+ */
102
+ // A **Measured pair** (#430, `measured-pairs.ts`): its binding keeps the start. The unit interpolator dies
103
+ // on a pair of two units, so it misses, as a numeric target misses `50%`.
104
+ export const valueLike = (raw, like) => valueLikeOf({ raw, like });
105
+ // The matchers are built once, at module load, not per call: a start reads every key's (#69).
106
+ /** A plain number, or a number in `px`, as a numeric target takes it. */
107
+ const isNumericString = (raw) => Predicate.isString(raw) && NUMERIC.test(raw);
108
+ /** `raw` for a numeric target: a finite number, or a plain-number or `px` string, parsed. */
109
+ const numericLike = Match.type().pipe(Match.when(Match.number, (n) => Option.liftPredicate(n, Number.isFinite)), Match.when(isNumericString, (s) => Option.some(Number.parseFloat(s))), Match.orElse(() => Option.none()));
110
+ /** `raw` for a string target `like`: a string as is unless its unit clashes with the target's, or a finite number as a string. */
111
+ const stringLike = Match.type().pipe(Match.when({ raw: Match.string }, ({ raw, like }) => Option.liftPredicate(raw, (given) => Bool.not(unitsClash(like, given)))), Match.when({ raw: Match.number }, ({ raw }) => Option.map(Option.liftPredicate(raw, Number.isFinite), String)), Match.orElse(() => Option.none()));
112
+ const valueLikeOf = Match.type().pipe(Match.when({ like: Match.number }, ({ raw }) => numericLike(raw)),
113
+ // The rest have a string target.
114
+ Match.orElse((pair) => stringLike(pair)));
115
+ /** Whether `raw` is a length in another unit than `like`'s (both have a unit, and they differ). */
116
+ const unitsClash = (like, raw) => Option.exists(Interpolator.unitOf(like), (want) => want !== "" && Option.exists(Interpolator.unitOf(raw), (got) => got !== "" && got !== want));
117
+ //# sourceMappingURL=own-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"own-values.js","sourceRoot":"","sources":["../../src/internal/own-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7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,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC,EAC9G,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAClC,CAAA;AAED,MAAM,WAAW,GAAwG,KAAK,CAAC,IAAI,EAG/H,CAAC,IAAI,CACP,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAkC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AACjG,iCAAiC;AACjC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkC,EAAE,CAAC,UAAU,CAAC,IAAwD,CAAC,CAAC,CAC7H,CAAA;AAED,mGAAmG;AACnG,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,EAAW,EAAE,CACxD,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * One Projection system's Measure-pass ends, for the Reorder controller (ADR-0020): the engine's Layer
3
+ * provides it beside the engine, and `ReorderController.make` requires it. Not exported from
4
+ * `@wardic/dom`, so there's no public push hook (ADR-0020 decision 2).
5
+ *
6
+ * @internal
7
+ */
8
+ import * as Context from "effect/Context";
9
+ declare const PassEnds_base: Context.ServiceClass<PassEnds, "@wardic/dom/PassEnds", {
10
+ /**
11
+ * Run `listener` at the end of every Measure pass: once per pass, after every round's boxes are
12
+ * stored (a blocked pass and one whose flush triggered more rounds included). A listener that
13
+ * throws is logged and doesn't stop the pass or the others.
14
+ */
15
+ readonly onPassEnd: (listener: () => void) => () => void;
16
+ }>;
17
+ /** `onPassEnd(listener)` runs `listener` at the end of every Measure pass, and returns the unsubscribe. */
18
+ export declare class PassEnds extends PassEnds_base {
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=pass-ends.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pass-ends.d.ts","sourceRoot":"","sources":["../../src/internal/pass-ends.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;;IAMrC;;;;OAIG;wBACiB,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI;;AAT5D,2GAA2G;AAC3G,qBAAa,QAAS,SAAQ,aAUH;CAAG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * One Projection system's Measure-pass ends, for the Reorder controller (ADR-0020): the engine's Layer
3
+ * provides it beside the engine, and `ReorderController.make` requires it. Not exported from
4
+ * `@wardic/dom`, so there's no public push hook (ADR-0020 decision 2).
5
+ *
6
+ * @internal
7
+ */
8
+ // #618 (decision 12): the controller found the engine's listeners in a WeakMap keyed by the engine
9
+ // object, so a wrapped or replaced ProjectionSystem in the context silently heard no pass end.
10
+ import * as Context from "effect/Context";
11
+ /** `onPassEnd(listener)` runs `listener` at the end of every Measure pass, and returns the unsubscribe. */
12
+ export class PassEnds extends Context.Service()("@wardic/dom/PassEnds") {
13
+ }
14
+ //# sourceMappingURL=pass-ends.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pass-ends.js","sourceRoot":"","sources":["../../src/internal/pass-ends.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mGAAmG;AACnG,+FAA+F;AAC/F,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,2GAA2G;AAC3G,MAAM,OAAO,QAAS,SAAQ,OAAO,CAAC,OAAO,EAU1C,CAAC,sBAAsB,CAAC;CAAG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The DOM Environment's Positional keys (CONTEXT.md; ADR-0029, ADR-0036): the transforms, and the
3
+ * box's position and size as CSS names them, `width`, `height`, `top`, `left`, `right` and `bottom`
4
+ * (Motion's `positionalKeys`). Reduced motion Snaps these. Core names only the transforms; these
5
+ * box keys are CSS's, so they're the DOM's. `DomLive` provides the Layer.
6
+ *
7
+ * @module
8
+ */
9
+ import * as ReducedMotion from "@wardic/core/ReducedMotion";
10
+ import * as Layer from "effect/Layer";
11
+ import * as Predicate from "effect/Predicate";
12
+ /** Whether reduced motion lands `key` at once: a transform, or a key that places or sizes the box. */
13
+ export declare const isPositional: Predicate.Predicate<string>;
14
+ /** The DOM Environment's `ReducedMotion.PositionalKeys`. */
15
+ export declare const PositionalKeysDomLive: Layer.Layer<ReducedMotion.PositionalKeys>;
16
+ //# sourceMappingURL=positional-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positional-keys.d.ts","sourceRoot":"","sources":["../../src/internal/positional-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAS7C,sGAAsG;AACtG,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,CAAqD,CAAA;AAE1G,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,CAAiE,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The DOM Environment's Positional keys (CONTEXT.md; ADR-0029, ADR-0036): the transforms, and the
3
+ * box's position and size as CSS names them, `width`, `height`, `top`, `left`, `right` and `bottom`
4
+ * (Motion's `positionalKeys`). Reduced motion Snaps these. Core names only the transforms; these
5
+ * box keys are CSS's, so they're the DOM's. `DomLive` provides the Layer.
6
+ *
7
+ * @module
8
+ */
9
+ import * as ReducedMotion from "@wardic/core/ReducedMotion";
10
+ import * as Layer from "effect/Layer";
11
+ import * as Predicate from "effect/Predicate";
12
+ import { dashCase } from "./svg.js";
13
+ /** The box's position and size, as CSS properties. */
14
+ const BOX_KEYS = new Set(["width", "height", "top", "left", "right", "bottom"]);
15
+ /** A key of the box's position or size, written as a CSS name or in camelCase. */
16
+ const isBoxKey = (key) => BOX_KEYS.has(dashCase(key));
17
+ /** Whether reduced motion lands `key` at once: a transform, or a key that places or sizes the box. */
18
+ export const isPositional = Predicate.or(ReducedMotion.isTransform, isBoxKey);
19
+ /** The DOM Environment's `ReducedMotion.PositionalKeys`. */
20
+ export const PositionalKeysDomLive = Layer.succeed(ReducedMotion.PositionalKeys, { isPositional });
21
+ //# sourceMappingURL=positional-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positional-keys.js","sourceRoot":"","sources":["../../src/internal/positional-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,sDAAsD;AACtD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;AAEpG,kFAAkF;AAClF,MAAM,QAAQ,GAAgC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;AAElF,sGAAsG;AACtG,MAAM,CAAC,MAAM,YAAY,GAAgC,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;AAE1G,4DAA4D;AAC5D,MAAM,CAAC,MAAM,qBAAqB,GAA8C,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import * as Probe from "@wardic/core/Probe";
2
+ import * as Layer from "effect/Layer";
3
+ import { AtomRegistry } from "effect/reactivity";
4
+ /**
5
+ * Core's `Probe` on the DOM. It needs the Environment's `AtomRegistry`, which it writes the viewport's
6
+ * size, the reduced-motion preference and whether the page is shown through, and readers read them from;
7
+ * `DomLive` provides it. Building it on a server fails, with an error that says it's client-only.
8
+ */
9
+ export declare const ProbeDomLive: Layer.Layer<Probe.Probe, never, AtomRegistry.AtomRegistry>;
10
+ //# sourceMappingURL=probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../src/internal/probe.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAK3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAMrC,OAAO,EAAQ,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAgItD;;;;GAIG;AAIH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,YAAY,CAE7E,CAAA"}
@@ -0,0 +1,117 @@
1
+ import * as Probe from "@wardic/core/Probe";
2
+ import * as SharedSource from "@wardic/core/SharedSource";
3
+ import * as Arr from "effect/Array";
4
+ import * as Bool from "effect/Boolean";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Layer from "effect/Layer";
7
+ import * as Option from "effect/Option";
8
+ import * as Predicate from "effect/Predicate";
9
+ import * as Queue from "effect/Queue";
10
+ import * as Stream from "effect/Stream";
11
+ import * as UndefinedOr from "effect/UndefinedOr";
12
+ import { Atom, AtomRegistry } from "effect/reactivity";
13
+ import { requireGlobal } from "./require-global.js";
14
+ import { makeScroll } from "./scroll.js";
15
+ /** Map a `DOMRect`-like value onto the engine's portable {@link Bounds}. */
16
+ /** An `IntersectionObserver`'s init from the Probe's options: each left out when not given. */
17
+ const observerInit = (options) => ({
18
+ ...UndefinedOr.match(options.root, { onUndefined: () => ({}), onDefined: (root) => ({ root }) }),
19
+ ...UndefinedOr.match(options.margin, { onUndefined: () => ({}), onDefined: (rootMargin) => ({ rootMargin }) }),
20
+ ...UndefinedOr.match(options.amount, { onUndefined: () => ({}), onDefined: (threshold) => ({ threshold }) }),
21
+ });
22
+ const toBounds = (r) => ({
23
+ x: r.x,
24
+ y: r.y,
25
+ width: r.width,
26
+ height: r.height,
27
+ top: r.top,
28
+ right: r.right,
29
+ bottom: r.bottom,
30
+ left: r.left,
31
+ });
32
+ /**
33
+ * Captures the Environment's {@link AtomRegistry} and adds the window's `resize` listener and
34
+ * the media query's `change` listener in the layer scope; each is the sole writer of its Atom.
35
+ * The `resize` listener writes `viewport` inside the event (ADR-0018, *Amendment (#45)*).
36
+ * `Layer.effect` runs `make` in the layer's own scope (it `Exclude`s `Scope`),
37
+ * which the shared helpers' `RcMap`s and the forked listeners need.
38
+ */
39
+ const make = Effect.gen(function* () {
40
+ // Client-only (ADR-0021, decision 7): the viewport below reads `window`.
41
+ yield* requireGlobal("DomProbe.layer", "window");
42
+ // The shared Environment registry — the one consumers read these atoms from.
43
+ const registry = yield* AtomRegistry.AtomRegistry;
44
+ // --- viewport -----------------------------------------------------------
45
+ // `keepAlive` pins the node so the value the resize listener writes survives
46
+ // between reads (an idle node with no subscriber would be GC'd and re-init).
47
+ const viewport = Atom.keepAlive(Atom.make({ width: window.innerWidth, height: window.innerHeight }));
48
+ // The window's "resize" listener is the only writer of `viewport`, and it writes inside the
49
+ // event (ADR-0018, *Amendment (#45)*): a reader, the projection system's Resize block among
50
+ // them, sees the new size within the dispatch, not a scheduler hop later, before the frame's
51
+ // Measure pass. A forked Stream consumer would land a task after the event.
52
+ const writeViewport = () => registry.set(viewport, { width: window.innerWidth, height: window.innerHeight });
53
+ yield* Effect.acquireRelease(Effect.sync(() => window.addEventListener("resize", writeViewport)), () => Effect.sync(() => window.removeEventListener("resize", writeViewport)));
54
+ // --- prefersReducedMotion ----------------------------------------------
55
+ // Guard `matchMedia` (absent in some headless environments): default false.
56
+ const mql = Bool.match(Predicate.isFunction(window.matchMedia), {
57
+ onTrue: () => Option.some(window.matchMedia("(prefers-reduced-motion: reduce)")),
58
+ onFalse: () => Option.none(),
59
+ });
60
+ const prefersReducedMotion = Atom.keepAlive(Atom.make(Option.exists(mql, (query) => query.matches)));
61
+ if (Option.isSome(mql)) {
62
+ // The MediaQueryList's `change` listener is the Atom's only writer, and it writes inside the
63
+ // event, as `viewport`'s and `pageVisible`'s do: a reader sees the new preference before the next
64
+ // frame (#618, M8: a fiber over `Stream.fromEventListener` set it a task later).
65
+ const query = mql.value;
66
+ const writeReduced = (event) => registry.set(prefersReducedMotion, event.matches);
67
+ yield* Effect.acquireRelease(Effect.sync(() => query.addEventListener("change", writeReduced)), () => Effect.sync(() => query.removeEventListener("change", writeReduced)));
68
+ }
69
+ // --- pageVisible (#443) ---------------------------------------------------
70
+ // The document's `visibilitychange` listener is its only writer, and it writes inside the event,
71
+ // as `viewport`'s does: a reader sees the page hidden before the next frame.
72
+ const pageVisible = Atom.keepAlive(Atom.make(document.visibilityState !== "hidden"));
73
+ const writePageVisible = () => registry.set(pageVisible, document.visibilityState !== "hidden");
74
+ yield* Effect.acquireRelease(Effect.sync(() => document.addEventListener("visibilitychange", writePageVisible)), () => Effect.sync(() => document.removeEventListener("visibilitychange", writePageVisible)));
75
+ // --- observeResize ------------------------------------------------------
76
+ // One ResizeObserver per target, ref-counted via `SharedSource.byTarget`. The
77
+ // observer is constructed on the first subscriber; `Effect.addFinalizer`
78
+ // disconnects it when the last subscriber's scope closes.
79
+ const observeResize = yield* SharedSource.byTarget((target) => Effect.succeed(Stream.callback((queue) => Effect.gen(function* () {
80
+ const el = target;
81
+ const ro = new ResizeObserver(() => {
82
+ Queue.offerUnsafe(queue, toBounds(el.getBoundingClientRect()));
83
+ });
84
+ ro.observe(el);
85
+ yield* Effect.addFinalizer(() => Effect.sync(() => ro.disconnect()));
86
+ }))));
87
+ // --- observeIntersection ------------------------------------------------
88
+ // An Input feed (#318) with one IntersectionObserver per subscriber, against its options (#273,
89
+ // Motion's `viewport`): the root (the viewport when none), the margin (`rootMargin`) and the amount
90
+ // (`threshold`). Each report carries the entry.
91
+ const observeIntersection = (target, options = {}) => (emit) => {
92
+ const io = new IntersectionObserver((entries) => Arr.forEach(entries, (entry) => emit({ intersecting: entry.isIntersecting, raw: entry })), observerInit(options));
93
+ io.observe(target);
94
+ return () => io.disconnect();
95
+ };
96
+ return Probe.Probe.of({
97
+ // Hot path — intentionally unlogged/un-spanned.
98
+ measure: (target) => Effect.sync(() => toBounds(target.getBoundingClientRect())),
99
+ viewport,
100
+ prefersReducedMotion,
101
+ pageVisible,
102
+ // A container's scroll, set within its events (#234): `scroll.ts`.
103
+ scroll: yield* makeScroll(registry),
104
+ observeResize,
105
+ observeIntersection,
106
+ });
107
+ });
108
+ /**
109
+ * Core's `Probe` on the DOM. It needs the Environment's `AtomRegistry`, which it writes the viewport's
110
+ * size, the reduced-motion preference and whether the page is shown through, and readers read them from;
111
+ * `DomLive` provides it. Building it on a server fails, with an error that says it's client-only.
112
+ */
113
+ // Built with `Layer.effect`, so `make` runs in the layer's scope: the shared helpers' `RcMap`s and the
114
+ // forked listeners live for the layer's lifetime; `testLayer` provides the registry the same way.
115
+ // ADR-0021, decision 7.
116
+ export const ProbeDomLive = Layer.effect(Probe.Probe)(make);
117
+ //# sourceMappingURL=probe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src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AAM,CAAC,MAAM,YAAY,GAA+D,KAAK,CAAC,MAAM,CAClG,KAAK,CAAC,KAAK,CACZ,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Motion's default layout and drag transitions, apart from the Projection system: a binding's layout
3
+ * element code reads them on every page, and the engine, `projection.ts`, ships only where an app lays
4
+ * out.
5
+ */
6
+ import type * as Machine from "@wardic/core/Machine";
7
+ /**
8
+ * A layout animation's transition: a spring, its fields and its `delay`; or a tween, its `duration`,
9
+ * `ease` and `delay`. A repeat means nothing for a flight that lands once. A tween with no `duration` or
10
+ * `ease` takes the tween's own defaults, 0.3 s and linear (a binding fills Motion's `easeOut` first).
11
+ */
12
+ export type LayoutTransition = ({
13
+ readonly type: "spring";
14
+ } & Machine.SpringOptions) | ({
15
+ readonly type: "tween";
16
+ } & Machine.TweenOptions);
17
+ /**
18
+ * Motion's default layout transition (motion-dom 13.3.0, `defaultLayoutTransition`): a 0.45 s tween,
19
+ * eased `cubic-bezier(0.4, 0, 0.1, 1)`, so a layout animation lands on time.
20
+ */
21
+ export declare const DEFAULT_LAYOUT_TRANSITION: LayoutTransition;
22
+ /**
23
+ * A drag's release (Motion's `dragTransition`): the inertia a node's Release offset runs on, with both
24
+ * edges at its slot, so it springs back there on the bounce. Times in seconds. Its edges are the slot's,
25
+ * never its own.
26
+ */
27
+ export type DragTransition = Omit<Machine.InertiaOptions, "min" | "max">;
28
+ /**
29
+ * Motion's drag transition (framer-motion 13.4.0, `VisualElementDragControls.startAnimation`), with its
30
+ * default `dragElastic`: a 0.75 s time constant, power 0.8, the bounce 200 / 40, at rest within 1 px and
31
+ * 10 px/s. A node's Release offset runs on it when it's given none.
32
+ */
33
+ export declare const DEFAULT_DRAG_TRANSITION: DragTransition;
34
+ //# sourceMappingURL=projection-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection-defaults.d.ts","sourceRoot":"","sources":["../../src/internal/projection-defaults.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAEpD;;;;GAIG;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAE1I;;;GAGG;AAEH,eAAO,MAAM,yBAAyB,EAAE,gBAA4E,CAAA;AAEpH;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,GAAG,KAAK,CAAC,CAAA;AAExE;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,EAAE,cAOrC,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Motion's default layout transition (motion-dom 13.3.0, `defaultLayoutTransition`): a 0.45 s tween,
3
+ * eased `cubic-bezier(0.4, 0, 0.1, 1)`, so a layout animation lands on time.
4
+ */
5
+ // ADR-0009 *Amendment (#171)*.
6
+ export const DEFAULT_LAYOUT_TRANSITION = { type: "tween", duration: 0.45, ease: [0.4, 0, 0.1, 1] };
7
+ /**
8
+ * Motion's drag transition (framer-motion 13.4.0, `VisualElementDragControls.startAnimation`), with its
9
+ * default `dragElastic`: a 0.75 s time constant, power 0.8, the bounce 200 / 40, at rest within 1 px and
10
+ * 10 px/s. A node's Release offset runs on it when it's given none.
11
+ */
12
+ // ADR-0016, *Amendment (#140)*.
13
+ export const DEFAULT_DRAG_TRANSITION = {
14
+ power: 0.8,
15
+ timeConstant: 0.75,
16
+ bounceStiffness: 200,
17
+ bounceDamping: 40,
18
+ restDelta: 1,
19
+ restSpeed: 10,
20
+ };
21
+ //# sourceMappingURL=projection-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection-defaults.js","sourceRoot":"","sources":["../../src/internal/projection-defaults.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,+BAA+B;AAC/B,MAAM,CAAC,MAAM,yBAAyB,GAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAA;AAUpH;;;;GAIG;AACH,gCAAgC;AAChC,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,KAAK,EAAE,GAAG;IACV,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,GAAG;IACpB,aAAa,EAAE,EAAE;IACjB,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;CACd,CAAA"}