@wardic/dom 0.0.0-stage → 1.0.0-rc.10

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 (315) 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 +30 -0
  5. package/dist/Appear.d.ts.map +1 -0
  6. package/dist/Appear.js +31 -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/DomBatch.d.ts +20 -0
  17. package/dist/DomBatch.d.ts.map +1 -0
  18. package/dist/DomBatch.js +23 -0
  19. package/dist/DomBatch.js.map +1 -0
  20. package/dist/DomClock.d.ts +11 -0
  21. package/dist/DomClock.d.ts.map +1 -0
  22. package/dist/DomClock.js +12 -0
  23. package/dist/DomClock.js.map +1 -0
  24. package/dist/DomDefaultTransition.d.ts +12 -0
  25. package/dist/DomDefaultTransition.d.ts.map +1 -0
  26. package/dist/DomDefaultTransition.js +13 -0
  27. package/dist/DomDefaultTransition.js.map +1 -0
  28. package/dist/DomInput.d.ts +14 -0
  29. package/dist/DomInput.d.ts.map +1 -0
  30. package/dist/DomInput.js +17 -0
  31. package/dist/DomInput.js.map +1 -0
  32. package/dist/DomInterpolators.d.ts +13 -0
  33. package/dist/DomInterpolators.d.ts.map +1 -0
  34. package/dist/DomInterpolators.js +14 -0
  35. package/dist/DomInterpolators.js.map +1 -0
  36. package/dist/DomKeyRules.d.ts +13 -0
  37. package/dist/DomKeyRules.d.ts.map +1 -0
  38. package/dist/DomKeyRules.js +14 -0
  39. package/dist/DomKeyRules.js.map +1 -0
  40. package/dist/DomPositionalKeys.d.ts +13 -0
  41. package/dist/DomPositionalKeys.d.ts.map +1 -0
  42. package/dist/DomPositionalKeys.js +14 -0
  43. package/dist/DomPositionalKeys.js.map +1 -0
  44. package/dist/DomProbe.d.ts +13 -0
  45. package/dist/DomProbe.d.ts.map +1 -0
  46. package/dist/DomProbe.js +14 -0
  47. package/dist/DomProbe.js.map +1 -0
  48. package/dist/DomProjectionSystem.d.ts +28 -0
  49. package/dist/DomProjectionSystem.d.ts.map +1 -0
  50. package/dist/DomProjectionSystem.js +41 -0
  51. package/dist/DomProjectionSystem.js.map +1 -0
  52. package/dist/DomRenderer.d.ts +13 -0
  53. package/dist/DomRenderer.d.ts.map +1 -0
  54. package/dist/DomRenderer.js +15 -0
  55. package/dist/DomRenderer.js.map +1 -0
  56. package/dist/DomScrollSource.d.ts +14 -0
  57. package/dist/DomScrollSource.d.ts.map +1 -0
  58. package/dist/DomScrollSource.js +15 -0
  59. package/dist/DomScrollSource.js.map +1 -0
  60. package/dist/FlushGate.d.ts +48 -0
  61. package/dist/FlushGate.d.ts.map +1 -0
  62. package/dist/FlushGate.js +62 -0
  63. package/dist/FlushGate.js.map +1 -0
  64. package/dist/KeyboardPress.d.ts +16 -0
  65. package/dist/KeyboardPress.d.ts.map +1 -0
  66. package/dist/KeyboardPress.js +17 -0
  67. package/dist/KeyboardPress.js.map +1 -0
  68. package/dist/MeasuredPair.d.ts +14 -0
  69. package/dist/MeasuredPair.d.ts.map +1 -0
  70. package/dist/MeasuredPair.js +16 -0
  71. package/dist/MeasuredPair.js.map +1 -0
  72. package/dist/OwnValues.d.ts +14 -0
  73. package/dist/OwnValues.d.ts.map +1 -0
  74. package/dist/OwnValues.js +15 -0
  75. package/dist/OwnValues.js.map +1 -0
  76. package/dist/ProjectionSystem.d.ts +34 -0
  77. package/dist/ProjectionSystem.d.ts.map +1 -0
  78. package/dist/ProjectionSystem.js +29 -0
  79. package/dist/ProjectionSystem.js.map +1 -0
  80. package/dist/ReorderController.d.ts +61 -0
  81. package/dist/ReorderController.d.ts.map +1 -0
  82. package/dist/ReorderController.js +78 -0
  83. package/dist/ReorderController.js.map +1 -0
  84. package/dist/Report.d.ts +12 -0
  85. package/dist/Report.d.ts.map +1 -0
  86. package/dist/Report.js +13 -0
  87. package/dist/Report.js.map +1 -0
  88. package/dist/ScrollOffset.d.ts +34 -0
  89. package/dist/ScrollOffset.d.ts.map +1 -0
  90. package/dist/ScrollOffset.js +42 -0
  91. package/dist/ScrollOffset.js.map +1 -0
  92. package/dist/Style.d.ts +15 -0
  93. package/dist/Style.d.ts.map +1 -0
  94. package/dist/Style.js +17 -0
  95. package/dist/Style.js.map +1 -0
  96. package/dist/Svg.d.ts +13 -0
  97. package/dist/Svg.d.ts.map +1 -0
  98. package/dist/Svg.js +14 -0
  99. package/dist/Svg.js.map +1 -0
  100. package/dist/Variables.d.ts +13 -0
  101. package/dist/Variables.d.ts.map +1 -0
  102. package/dist/Variables.js +14 -0
  103. package/dist/Variables.js.map +1 -0
  104. package/dist/index.d.ts +83 -0
  105. package/dist/index.d.ts.map +1 -0
  106. package/dist/index.js +71 -0
  107. package/dist/index.js.map +1 -0
  108. package/dist/internal/announcer.d.ts +50 -0
  109. package/dist/internal/announcer.d.ts.map +1 -0
  110. package/dist/internal/announcer.js +115 -0
  111. package/dist/internal/announcer.js.map +1 -0
  112. package/dist/internal/appear-slot.d.ts +23 -0
  113. package/dist/internal/appear-slot.d.ts.map +1 -0
  114. package/dist/internal/appear-slot.js +29 -0
  115. package/dist/internal/appear-slot.js.map +1 -0
  116. package/dist/internal/appear.d.ts +237 -0
  117. package/dist/internal/appear.d.ts.map +1 -0
  118. package/dist/internal/appear.js +740 -0
  119. package/dist/internal/appear.js.map +1 -0
  120. package/dist/internal/auto-scroll.d.ts +24 -0
  121. package/dist/internal/auto-scroll.d.ts.map +1 -0
  122. package/dist/internal/auto-scroll.js +124 -0
  123. package/dist/internal/auto-scroll.js.map +1 -0
  124. package/dist/internal/batch-writer.d.ts +16 -0
  125. package/dist/internal/batch-writer.d.ts.map +1 -0
  126. package/dist/internal/batch-writer.js +77 -0
  127. package/dist/internal/batch-writer.js.map +1 -0
  128. package/dist/internal/clock.d.ts +19 -0
  129. package/dist/internal/clock.d.ts.map +1 -0
  130. package/dist/internal/clock.js +39 -0
  131. package/dist/internal/clock.js.map +1 -0
  132. package/dist/internal/colors.d.ts +45 -0
  133. package/dist/internal/colors.d.ts.map +1 -0
  134. package/dist/internal/colors.js +193 -0
  135. package/dist/internal/colors.js.map +1 -0
  136. package/dist/internal/complex.d.ts +24 -0
  137. package/dist/internal/complex.d.ts.map +1 -0
  138. package/dist/internal/complex.js +28 -0
  139. package/dist/internal/complex.js.map +1 -0
  140. package/dist/internal/content-watch.d.ts +20 -0
  141. package/dist/internal/content-watch.d.ts.map +1 -0
  142. package/dist/internal/content-watch.js +76 -0
  143. package/dist/internal/content-watch.js.map +1 -0
  144. package/dist/internal/default-transition.d.ts +25 -0
  145. package/dist/internal/default-transition.d.ts.map +1 -0
  146. package/dist/internal/default-transition.js +41 -0
  147. package/dist/internal/default-transition.js.map +1 -0
  148. package/dist/internal/drag-defaults.d.ts +18 -0
  149. package/dist/internal/drag-defaults.d.ts.map +1 -0
  150. package/dist/internal/drag-defaults.js +38 -0
  151. package/dist/internal/drag-defaults.js.map +1 -0
  152. package/dist/internal/gate.d.ts +188 -0
  153. package/dist/internal/gate.d.ts.map +1 -0
  154. package/dist/internal/gate.js +458 -0
  155. package/dist/internal/gate.js.map +1 -0
  156. package/dist/internal/input.d.ts +35 -0
  157. package/dist/internal/input.d.ts.map +1 -0
  158. package/dist/internal/input.js +658 -0
  159. package/dist/internal/input.js.map +1 -0
  160. package/dist/internal/interpolators.d.ts +19 -0
  161. package/dist/internal/interpolators.d.ts.map +1 -0
  162. package/dist/internal/interpolators.js +30 -0
  163. package/dist/internal/interpolators.js.map +1 -0
  164. package/dist/internal/key-rules.d.ts +11 -0
  165. package/dist/internal/key-rules.d.ts.map +1 -0
  166. package/dist/internal/key-rules.js +244 -0
  167. package/dist/internal/key-rules.js.map +1 -0
  168. package/dist/internal/keyboard-press.d.ts +7 -0
  169. package/dist/internal/keyboard-press.d.ts.map +1 -0
  170. package/dist/internal/keyboard-press.js +45 -0
  171. package/dist/internal/keyboard-press.js.map +1 -0
  172. package/dist/internal/measure.d.ts +157 -0
  173. package/dist/internal/measure.d.ts.map +1 -0
  174. package/dist/internal/measure.js +296 -0
  175. package/dist/internal/measure.js.map +1 -0
  176. package/dist/internal/measured-pairs.d.ts +38 -0
  177. package/dist/internal/measured-pairs.d.ts.map +1 -0
  178. package/dist/internal/measured-pairs.js +251 -0
  179. package/dist/internal/measured-pairs.js.map +1 -0
  180. package/dist/internal/own-values.d.ts +35 -0
  181. package/dist/internal/own-values.d.ts.map +1 -0
  182. package/dist/internal/own-values.js +117 -0
  183. package/dist/internal/own-values.js.map +1 -0
  184. package/dist/internal/pass-ends.d.ts +21 -0
  185. package/dist/internal/pass-ends.d.ts.map +1 -0
  186. package/dist/internal/pass-ends.js +14 -0
  187. package/dist/internal/pass-ends.js.map +1 -0
  188. package/dist/internal/positional-keys.d.ts +16 -0
  189. package/dist/internal/positional-keys.d.ts.map +1 -0
  190. package/dist/internal/positional-keys.js +21 -0
  191. package/dist/internal/positional-keys.js.map +1 -0
  192. package/dist/internal/probe.d.ts +10 -0
  193. package/dist/internal/probe.d.ts.map +1 -0
  194. package/dist/internal/probe.js +116 -0
  195. package/dist/internal/probe.js.map +1 -0
  196. package/dist/internal/projection-defaults.d.ts +34 -0
  197. package/dist/internal/projection-defaults.d.ts.map +1 -0
  198. package/dist/internal/projection-defaults.js +21 -0
  199. package/dist/internal/projection-defaults.js.map +1 -0
  200. package/dist/internal/projection.d.ts +537 -0
  201. package/dist/internal/projection.d.ts.map +1 -0
  202. package/dist/internal/projection.js +5228 -0
  203. package/dist/internal/projection.js.map +1 -0
  204. package/dist/internal/renderer.d.ts +104 -0
  205. package/dist/internal/renderer.d.ts.map +1 -0
  206. package/dist/internal/renderer.js +618 -0
  207. package/dist/internal/renderer.js.map +1 -0
  208. package/dist/internal/reorder.d.ts +174 -0
  209. package/dist/internal/reorder.d.ts.map +1 -0
  210. package/dist/internal/reorder.js +466 -0
  211. package/dist/internal/reorder.js.map +1 -0
  212. package/dist/internal/report.d.ts +30 -0
  213. package/dist/internal/report.d.ts.map +1 -0
  214. package/dist/internal/report.js +60 -0
  215. package/dist/internal/report.js.map +1 -0
  216. package/dist/internal/require-global.d.ts +11 -0
  217. package/dist/internal/require-global.d.ts.map +1 -0
  218. package/dist/internal/require-global.js +31 -0
  219. package/dist/internal/require-global.js.map +1 -0
  220. package/dist/internal/reveal.d.ts +20 -0
  221. package/dist/internal/reveal.d.ts.map +1 -0
  222. package/dist/internal/reveal.js +71 -0
  223. package/dist/internal/reveal.js.map +1 -0
  224. package/dist/internal/runner.d.ts +21 -0
  225. package/dist/internal/runner.d.ts.map +1 -0
  226. package/dist/internal/runner.js +48 -0
  227. package/dist/internal/runner.js.map +1 -0
  228. package/dist/internal/scale-correction.d.ts +80 -0
  229. package/dist/internal/scale-correction.d.ts.map +1 -0
  230. package/dist/internal/scale-correction.js +227 -0
  231. package/dist/internal/scale-correction.js.map +1 -0
  232. package/dist/internal/scroll.d.ts +37 -0
  233. package/dist/internal/scroll.d.ts.map +1 -0
  234. package/dist/internal/scroll.js +279 -0
  235. package/dist/internal/scroll.js.map +1 -0
  236. package/dist/internal/scrollers.d.ts +35 -0
  237. package/dist/internal/scrollers.d.ts.map +1 -0
  238. package/dist/internal/scrollers.js +38 -0
  239. package/dist/internal/scrollers.js.map +1 -0
  240. package/dist/internal/starting-style.d.ts +141 -0
  241. package/dist/internal/starting-style.d.ts.map +1 -0
  242. package/dist/internal/starting-style.js +300 -0
  243. package/dist/internal/starting-style.js.map +1 -0
  244. package/dist/internal/svg.d.ts +60 -0
  245. package/dist/internal/svg.d.ts.map +1 -0
  246. package/dist/internal/svg.js +257 -0
  247. package/dist/internal/svg.js.map +1 -0
  248. package/dist/internal/variables.d.ts +45 -0
  249. package/dist/internal/variables.d.ts.map +1 -0
  250. package/dist/internal/variables.js +92 -0
  251. package/dist/internal/variables.js.map +1 -0
  252. package/package.json +65 -4
  253. package/src/Appear.ts +54 -0
  254. package/src/Color.ts +24 -0
  255. package/src/DomAnnouncer.ts +22 -0
  256. package/src/DomBatch.ts +22 -0
  257. package/src/DomClock.ts +13 -0
  258. package/src/DomDefaultTransition.ts +16 -0
  259. package/src/DomInput.ts +23 -0
  260. package/src/DomInterpolators.ts +16 -0
  261. package/src/DomKeyRules.ts +17 -0
  262. package/src/DomPositionalKeys.ts +16 -0
  263. package/src/DomProbe.ts +15 -0
  264. package/src/DomProjectionSystem.ts +44 -0
  265. package/src/DomRenderer.ts +26 -0
  266. package/src/DomScrollSource.ts +14 -0
  267. package/src/FlushGate.ts +81 -0
  268. package/src/KeyboardPress.ts +16 -0
  269. package/src/MeasuredPair.ts +15 -0
  270. package/src/OwnValues.ts +19 -0
  271. package/src/ProjectionSystem.ts +51 -0
  272. package/src/ReorderController.ts +122 -0
  273. package/src/Report.ts +17 -0
  274. package/src/ScrollOffset.ts +54 -0
  275. package/src/Style.ts +37 -0
  276. package/src/Svg.ts +21 -0
  277. package/src/Variables.ts +17 -0
  278. package/src/index.ts +120 -0
  279. package/src/internal/announcer.ts +132 -0
  280. package/src/internal/appear-slot.ts +32 -0
  281. package/src/internal/appear.ts +1134 -0
  282. package/src/internal/auto-scroll.ts +176 -0
  283. package/src/internal/batch-writer.ts +95 -0
  284. package/src/internal/clock.ts +45 -0
  285. package/src/internal/colors.ts +258 -0
  286. package/src/internal/complex.ts +29 -0
  287. package/src/internal/content-watch.ts +84 -0
  288. package/src/internal/culori.d.ts +58 -0
  289. package/src/internal/default-transition.ts +50 -0
  290. package/src/internal/drag-defaults.ts +54 -0
  291. package/src/internal/gate.ts +598 -0
  292. package/src/internal/input.ts +763 -0
  293. package/src/internal/interpolators.ts +33 -0
  294. package/src/internal/key-rules.ts +357 -0
  295. package/src/internal/keyboard-press.ts +45 -0
  296. package/src/internal/measure.ts +373 -0
  297. package/src/internal/measured-pairs.ts +297 -0
  298. package/src/internal/own-values.ts +166 -0
  299. package/src/internal/pass-ends.ts +23 -0
  300. package/src/internal/positional-keys.ts +24 -0
  301. package/src/internal/probe.ts +175 -0
  302. package/src/internal/projection-defaults.ts +45 -0
  303. package/src/internal/projection.ts +6233 -0
  304. package/src/internal/renderer.ts +648 -0
  305. package/src/internal/reorder.ts +650 -0
  306. package/src/internal/report.ts +69 -0
  307. package/src/internal/require-global.ts +46 -0
  308. package/src/internal/reveal.ts +75 -0
  309. package/src/internal/runner.ts +64 -0
  310. package/src/internal/scale-correction.ts +310 -0
  311. package/src/internal/scroll.ts +358 -0
  312. package/src/internal/scrollers.ts +51 -0
  313. package/src/internal/starting-style.ts +396 -0
  314. package/src/internal/svg.ts +300 -0
  315. package/src/internal/variables.ts +145 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Which scrollers move an element on screen (ADR-0012), apart from the Measure pass (#548): the gesture
3
+ * input and the reveals read `scrollersOf` on every page, so it sits in a module of its own, and the
4
+ * Projection system's reads, in `measure.ts`, ship only where an app lays out (ADR-0067,
5
+ * *Amendment (#548)*). Per node in the Measure pass: a `for` up the ancestors (ADR-0025, dom's
6
+ * per-frame files).
7
+ */
8
+ /** The overflow values that never scroll: anything else can (`hidden` too, from code). */
9
+ const UNSCROLLED = new Set(["visible", "clip"]);
10
+ /** {@link ScrollStyle} from an element's computed style. */
11
+ export const scrollStyleFrom = (style) => ({
12
+ scrollable: !UNSCROLLED.has(style.overflowX) || !UNSCROLLED.has(style.overflowY),
13
+ fixed: style.position === "fixed",
14
+ });
15
+ /** {@link ScrollStyle} of `el`, uncached: one `getComputedStyle` per call. */
16
+ export const readScrollStyle = (el) => scrollStyleFrom(getComputedStyle(el));
17
+ /**
18
+ * The scrollers whose scroll moves `el` on screen: its ancestors that can scroll,
19
+ * nearest first, up to the first `position: fixed` one (included if it scrolls), and
20
+ * whether the page's scroll does (no fixed element on the way, `el` included). The
21
+ * walk stops before `body` and `documentElement`: the page's own scroll is the
22
+ * window's.
23
+ */
24
+ export const scrollersOf = (el) => {
25
+ const ancestors = [];
26
+ if (readScrollStyle(el).fixed)
27
+ return { ancestors, page: false };
28
+ const doc = el.ownerDocument;
29
+ for (let cur = el.parentElement; cur !== null && cur !== doc.body && cur !== doc.documentElement; cur = cur.parentElement) {
30
+ const style = readScrollStyle(cur);
31
+ if (style.scrollable)
32
+ ancestors.push(cur);
33
+ if (style.fixed)
34
+ return { ancestors, page: false };
35
+ }
36
+ return { ancestors, page: true };
37
+ };
38
+ //# sourceMappingURL=scrollers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrollers.js","sourceRoot":"","sources":["../../src/internal/scrollers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,0FAA0F;AAC1F,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;AAepE,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA0B,EAAe,EAAE,CAAC,CAAC;IAC3E,UAAU,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;IAChF,KAAK,EAAE,KAAK,CAAC,QAAQ,KAAK,OAAO;CAClC,CAAC,CAAA;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAW,EAAe,EAAE,CAAC,eAAe,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAA;AAElG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAW,EAAkE,EAAE;IACzG,MAAM,SAAS,GAAmB,EAAE,CAAA;IACpC,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IAChE,MAAM,GAAG,GAAG,EAAE,CAAC,aAAa,CAAA;IAC5B,KAAK,IAAI,GAAG,GAAG,EAAE,CAAC,aAAa,EAAE,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,GAAG,CAAC,eAAe,EAAE,GAAG,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;QAC1H,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;QAClC,IAAI,KAAK,CAAC,UAAU;YAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACzC,IAAI,KAAK,CAAC,KAAK;YAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACpD,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AAClC,CAAC,CAAA"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * The Starting style (ADR-0003, ADR-0021): an element's style before its first Frame,
3
+ * `project(resolveInitial(config))`, computed purely with no runtime. It is the server's
4
+ * markup, the style the hydration render keeps, and the animation's `from`. And the style
5
+ * after the first Frame, the fallback: the user's, without the keys Wardic holds (ADR-0034).
6
+ *
7
+ * Framework-free, so every binding renders it the same way on a server and on the client
8
+ * (the thin-bindings rule): a binding reads its config, calls these, and casts the style to
9
+ * its own JSX type. `toValues`, `resolveInitial` and the merge `over` does moved here from
10
+ * @wardic/solid with their behaviour unchanged; `over` and `without` are `dual` (#132's PR 3,
11
+ * ADR-0041 decision 5). Tier 2, for binding authors.
12
+ *
13
+ * Observability: pure and per element, so quiet (no span, no log).
14
+ */
15
+ import type * as Values from "@wardic/core/Values";
16
+ import * as Option from "effect/Option";
17
+ import { type SplitPatch } from "./svg.ts";
18
+ /**
19
+ * A values map with only the keys an animation can take: numbers and strings (custom
20
+ * properties included). `undefined` and anything else drop out, so the engine never sees
21
+ * them.
22
+ */
23
+ export declare const toValues: (v: object | undefined) => Values.Values;
24
+ /** A keyframes value's stops, as Motion's: each a value, or `null`, for where the key is (the first) or the stop before (a later one). */
25
+ export type Stops = ReadonlyArray<number | string | null>;
26
+ /** Where a keyframes value is read: `initial`'s at its first stop, a target's at its last. */
27
+ export type StopAt = "first" | "last";
28
+ /** A values map's own values and its keyframes: `splitValues`' result. */
29
+ export interface SplitValues {
30
+ /** Its numbers and strings, each Keyframes value at one of its stops. */
31
+ readonly values: Values.Values;
32
+ /** Its Keyframes, if it has any. */
33
+ readonly keyframes: Option.Option<Readonly<Record<string, Stops>>>;
34
+ }
35
+ /**
36
+ * A values map's values, each keyframes value read at one of its stops, and its keyframes, in one pass
37
+ * over its keys: a target's resolution reads both, and a target with no keyframes makes nothing
38
+ * `toValues` doesn't.
39
+ */
40
+ export declare const splitValues: (v: object | undefined, at: StopAt) => SplitValues;
41
+ /**
42
+ * A values map with only the keys an animation can take, each keyframes value read at one of its stops:
43
+ * `initial`'s first, a target's last. A keyframes value with no such stop drops out, as does an array
44
+ * `keyframesOf` doesn't take, and anything that isn't a number or a string. One pass over its keys, as
45
+ * `toValues`'.
46
+ *
47
+ * @example
48
+ * Style.valuesAt({ opacity: [0, 0.5, 1], x: 10 }, "first") // { x: 10, opacity: 0 }
49
+ */
50
+ export declare const valuesAt: (v: object | undefined, at: StopAt) => Values.Values;
51
+ /**
52
+ * A values map's keyframes values: each array of stops an animation can take, one with a stop that isn't
53
+ * `null`. None when it has none, so a target without any makes nothing.
54
+ *
55
+ * @example
56
+ * Style.keyframesOf({ opacity: [0, 0.5, 1], x: 10 }) // { opacity: [0, 0.5, 1] }
57
+ */
58
+ export declare const keyframesOf: (v: object | undefined) => Option.Option<Readonly<Record<string, Stops>>>;
59
+ /**
60
+ * What of an element's config its starting style is read from. Its values are typed `object`, so a
61
+ * binding's own value types fit as they are.
62
+ */
63
+ export interface InitialConfig {
64
+ /**
65
+ * Its start: values used as they are, the name of a `variants` entry, a list of names merged in order,
66
+ * a later one's winning, or `false`, to start at `animate`, as Motion's `initial={false}`.
67
+ */
68
+ readonly initial?: object | string | ReadonlyArray<string> | false | undefined;
69
+ /** What `initial: false` starts at: a values map, the name of a `variants` entry, or a list of names. */
70
+ readonly animate?: object | string | ReadonlyArray<string> | undefined;
71
+ /** Its variants: the values each name stands for. */
72
+ readonly variants?: Readonly<Record<string, object | undefined>> | undefined;
73
+ }
74
+ /**
75
+ * The values an element starts from: its `initial` values, or the `variants` entries its `initial` names,
76
+ * an unknown name empty, or nothing. With `initial: false`, its `animate`, resolved the same way, so it
77
+ * starts at its target and nothing animates at mount, as Motion's. A keyframes value starts at its first
78
+ * stop, or, with `initial: false`, at `animate`'s last, where the animation it skips would end. Read once,
79
+ * at setup: the starting style is where it starts, never a live target.
80
+ *
81
+ * @example
82
+ * Style.resolveInitial({ initial: false, animate: { opacity: 1 } }) // { opacity: 1 }
83
+ */
84
+ export declare const resolveInitial: (config: InitialConfig) => Values.Values;
85
+ /**
86
+ * A CSS declaration list (`"color: red; background: url(a;b)"`) as `{ property: value }`.
87
+ * A `;` inside parentheses or quotes doesn't end a declaration. Internal (not in the
88
+ * package index): `own-values.ts`'s style lookup shares it.
89
+ */
90
+ export declare const parseCssText: (text: string) => Record<string, string>;
91
+ /** Where {@link parseCssText} is: the parentheses open, the string's quote, a backslash just read in it, the declaration's start. */
92
+ /**
93
+ * A style as a binding hands it over: a record of CSS properties, CSS text (`"color: red"`, which
94
+ * JSX allows), or none.
95
+ */
96
+ export type StyleInput = object | string | undefined;
97
+ /** A style record: CSS properties to their values. */
98
+ export type StyleRecord = Readonly<Record<string, unknown>>;
99
+ /**
100
+ * `self` laid over `that`: `self`'s keys win, and `that`'s others stay. A chain reads from the top layer
101
+ * down: an element's style is its drag defaults, under its base, under the app's, under what Wardic
102
+ * animates. A side given as CSS text is parsed, so a framework never writes `cssText` over the keys
103
+ * Wardic holds, and a side that's `undefined` leaves the other as it is, the same object. Whatever `self`
104
+ * sets for `user-select` or `-webkit-user-select` it sets for both: one property in Chromium.
105
+ *
106
+ * @example
107
+ * // Before the first commit: the starting style over the app's, over a base and a drag element's defaults.
108
+ * pipe(starting, Style.over(user), Style.over(base), Style.over(Style.dragDefaults("x")))
109
+ */
110
+ export declare const over: {
111
+ (that: StyleInput): (self: StyleInput) => StyleRecord;
112
+ (self: StyleInput, that: StyleInput): StyleRecord;
113
+ };
114
+ /**
115
+ * `self` without the keys the flush gate holds on the element (`held`, by patch key, matched by CSS
116
+ * property): the style once its first frame is committed. Wardic writes those while it drives them, and
117
+ * the app's `style` is their fallback, so a key the gate lets go of comes back.
118
+ *
119
+ * @example
120
+ * pipe(user, Style.over(base), Style.without(held))
121
+ */
122
+ export declare const without: {
123
+ (held: ReadonlyArray<string>): (self: StyleInput) => StyleRecord;
124
+ (self: StyleInput, held: ReadonlyArray<string>): StyleRecord;
125
+ };
126
+ /**
127
+ * Whether the keys the flush gate holds, changing from `prev` to `next`, change `self`'s `without`:
128
+ * whether a key taken or let go of is one `self` sets, by its name or its name dash-cased. Most changes
129
+ * touch none, and a binding then leaves its `style` alone.
130
+ */
131
+ export declare const heldTouches: {
132
+ (prev: ReadonlyArray<string>, next: ReadonlyArray<string>): (self: StyleRecord) => boolean;
133
+ (self: StyleRecord, prev: ReadonlyArray<string>, next: ReadonlyArray<string>): boolean;
134
+ };
135
+ /**
136
+ * The starting style of a `tag` element starting from `values`: projected as the renderer projects a
137
+ * Frame, then split by tag, an SVG element's keys inside an `<svg>` as attributes, and the rest as style.
138
+ * `undefined` is an HTML element, as for a spread that doesn't know its tag.
139
+ */
140
+ export declare const startingStyle: (tag: string | undefined, values: Readonly<Record<string, unknown>>) => SplitPatch;
141
+ //# sourceMappingURL=starting-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starting-style.d.ts","sourceRoot":"","sources":["../../src/internal/starting-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,KA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C,IAAI,EAAE,WAAW,KAAK,OAAO,CAAA;IAC1F,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAA;CAKvF,CAAA;AAED;;;;GAIG;AAEH,eAAO,MAAM,aAAa,QAAS,MAAM,GAAG,SAAS,UAAU,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAG,UAC3D,CAAA"}
@@ -0,0 +1,300 @@
1
+ import * as Arr from "effect/Array";
2
+ import * as Bool from "effect/Boolean";
3
+ import { dual } from "effect/Function";
4
+ import * as Match from "effect/Match";
5
+ import * as Option from "effect/Option";
6
+ import * as Predicate from "effect/Predicate";
7
+ import * as Rec from "effect/Record";
8
+ import * as UndefinedOr from "effect/UndefinedOr";
9
+ import { project } from "./renderer.js";
10
+ import { dashCase, splitPatchForTag } from "./svg.js";
11
+ /**
12
+ * A values map with only the keys an animation can take: numbers and strings (custom
13
+ * properties included). `undefined` and anything else drop out, so the engine never sees
14
+ * them.
15
+ */
16
+ export const toValues = (v) => UndefinedOr.match(v, {
17
+ onUndefined: () => ({}),
18
+ onDefined: (values) => Rec.filter(values, isAnimatable),
19
+ });
20
+ /** Whether a value is one an animation can take: a number or a string. */
21
+ const isAnimatable = Predicate.or(Predicate.isNumber, Predicate.isString);
22
+ /** Whether a stop is one an animation can take, or `null`. */
23
+ const isStop = Predicate.or(isAnimatable, Predicate.isNull);
24
+ /**
25
+ * A Keyframes value's stop (#429): its first, as Motion's `initial` reads it (`use-visual-state.ts`),
26
+ * or its last that isn't `null`, where it rests (Motion's final keyframe, `fill-wildcards.ts`'s).
27
+ * `null` or `undefined` when it has none.
28
+ */
29
+ const stopOf = (stops, at) => Bool.match(at === "first", { onTrue: () => stops[0], onFalse: () => Option.getOrUndefined(Arr.findLast(stops, Predicate.isNotNull)) });
30
+ /** Whether a value is Keyframes an animation can take (#429): an array of stops, one of them not `null`. */
31
+ const isStops = (value) => {
32
+ if (Bool.not(Arr.isArray(value)))
33
+ return false;
34
+ const stops = value;
35
+ return Bool.and(Arr.every(stops, isStop), Arr.some(stops, Predicate.isNotNull));
36
+ };
37
+ /**
38
+ * The Keyframes {@link keepAnimatable} set aside while it filtered a values map (#452): written by it,
39
+ * read and cleared right after, never across a call. A target with none leaves it `undefined`.
40
+ */
41
+ // Module state (#460, Q7): scratch within one synchronous call, never held across one.
42
+ let setAside;
43
+ /**
44
+ * A values map's filter (#452): a value an animation can take stays, and Keyframes go aside, into
45
+ * {@link setAside}, so one pass over the keys finds both. Built once, at module load.
46
+ */
47
+ const keepAnimatable = (value, key) => {
48
+ if (Bool.not(Arr.isArray(value)))
49
+ return isAnimatable(value);
50
+ if (isStops(value)) {
51
+ if (Predicate.isUndefined(setAside))
52
+ setAside = {};
53
+ setAside[key] = value;
54
+ }
55
+ return false;
56
+ };
57
+ /** A values map's numbers and strings, its Keyframes set aside (#452, {@link keepAnimatable}): {@link toValues}' one pass. */
58
+ const filtered = (v) => {
59
+ // Per element at mount (#540): statements and a loop.
60
+ setAside = undefined;
61
+ const out = {};
62
+ if (Predicate.isUndefined(v))
63
+ return out;
64
+ const values = v;
65
+ for (const key of Object.keys(values)) {
66
+ const value = values[key];
67
+ // `keepAnimatable` keeps numbers and strings alone, as `isAnimatable` does.
68
+ if (keepAnimatable(value, key))
69
+ out[key] = value;
70
+ }
71
+ return out;
72
+ };
73
+ /** The Keyframes the last {@link filtered} set aside, taken: `undefined` with none. */
74
+ const takeSetAside = () => {
75
+ const taken = setAside;
76
+ setAside = undefined;
77
+ return taken;
78
+ };
79
+ /** `values` with each of `keyframes` at one of its stops (#429), one with no such stop left out. */
80
+ const withStops = (values, keyframes, at) => ({
81
+ ...values,
82
+ ...toValues(Rec.map(keyframes, (stops) => stopOf(stops, at))),
83
+ });
84
+ /**
85
+ * A values map's values, each keyframes value read at one of its stops, and its keyframes, in one pass
86
+ * over its keys: a target's resolution reads both, and a target with no keyframes makes nothing
87
+ * `toValues` doesn't.
88
+ */
89
+ // **Keyframes** (#429); one pass (#452).
90
+ export const splitValues = (v, at) => {
91
+ const values = filtered(v);
92
+ const keyframes = takeSetAside();
93
+ if (Predicate.isUndefined(keyframes))
94
+ return { values, keyframes: Option.none() };
95
+ return { values: withStops(values, keyframes, at), keyframes: Option.some(keyframes) };
96
+ };
97
+ /**
98
+ * A values map with only the keys an animation can take, each keyframes value read at one of its stops:
99
+ * `initial`'s first, a target's last. A keyframes value with no such stop drops out, as does an array
100
+ * `keyframesOf` doesn't take, and anything that isn't a number or a string. One pass over its keys, as
101
+ * `toValues`'.
102
+ *
103
+ * @example
104
+ * Style.valuesAt({ opacity: [0, 0.5, 1], x: 10 }, "first") // { x: 10, opacity: 0 }
105
+ */
106
+ // **Keyframes** (#429); one pass (#452).
107
+ export const valuesAt = (v, at) => {
108
+ const values = filtered(v);
109
+ const keyframes = takeSetAside();
110
+ if (Predicate.isUndefined(keyframes))
111
+ return values;
112
+ return withStops(values, keyframes, at);
113
+ };
114
+ /**
115
+ * A values map's keyframes values: each array of stops an animation can take, one with a stop that isn't
116
+ * `null`. None when it has none, so a target without any makes nothing.
117
+ *
118
+ * @example
119
+ * Style.keyframesOf({ opacity: [0, 0.5, 1], x: 10 }) // { opacity: [0, 0.5, 1] }
120
+ */
121
+ // **Keyframes** (#429).
122
+ export const keyframesOf = (v) => splitValues(v, "last").keyframes;
123
+ /** Whether an entry is a list of names (#297): an array, which a values map never is. */
124
+ const isList = (entry) => Arr.isArray(entry);
125
+ /**
126
+ * A values map, or the `variants` entry a name names (an unknown name is empty), or nothing.
127
+ * Built once, at module load: every element reads its own at setup (#69).
128
+ */
129
+ const entryOf = Match.type().pipe(Match.when({ entry: Match.undefined }, () => ({})), Match.when({ entry: Match.string }, ({ entry, variants, at }) => valuesAt(UndefinedOr.map(variants, (byName) => byName[entry]), at)),
130
+ // A list's names merged in order, a later one's winning a key both set (#297, Motion's).
131
+ Match.when({ entry: isList }, ({ entry, variants, at }) => Arr.reduce(entry, {}, (merged, name) => ({ ...merged, ...valuesAt(UndefinedOr.map(variants, (byName) => byName[name]), at) }))), Match.orElse(({ entry, at }) => valuesAt(entry, at)));
132
+ /**
133
+ * The values an element starts from: its `initial` values, or the `variants` entries its `initial` names,
134
+ * an unknown name empty, or nothing. With `initial: false`, its `animate`, resolved the same way, so it
135
+ * starts at its target and nothing animates at mount, as Motion's. A keyframes value starts at its first
136
+ * stop, or, with `initial: false`, at `animate`'s last, where the animation it skips would end. Read once,
137
+ * at setup: the starting style is where it starts, never a live target.
138
+ *
139
+ * @example
140
+ * Style.resolveInitial({ initial: false, animate: { opacity: 1 } }) // { opacity: 1 }
141
+ */
142
+ // #134, Motion's `initial={false}`; **Keyframes** (#429, Motion's `use-visual-state.ts`).
143
+ export const resolveInitial = (config) => {
144
+ // Per element at mount (#540): statements.
145
+ if (config.initial === false)
146
+ return entryOf({ entry: config.animate, variants: config.variants, at: "last" });
147
+ return entryOf({ entry: config.initial, variants: config.variants, at: "first" });
148
+ };
149
+ /**
150
+ * A CSS declaration list (`"color: red; background: url(a;b)"`) as `{ property: value }`.
151
+ * A `;` inside parentheses or quotes doesn't end a declaration. Internal (not in the
152
+ * package index): `own-values.ts`'s style lookup shares it.
153
+ */
154
+ export const parseCssText = (text) => {
155
+ const out = {};
156
+ // A counted scan over UTF-16 units, as `slice` counts: a `;` outside parentheses and quotes ends a
157
+ // declaration, and a backslash in a quote escapes the next unit (#618, F6: a reduce built a scan
158
+ // state and a matcher each character, 15-25 times as slow).
159
+ let depth = 0;
160
+ let quote = 0;
161
+ let escaped = false;
162
+ let start = 0;
163
+ for (let i = 0; i < text.length; i++) {
164
+ const c = text.charCodeAt(i);
165
+ if (escaped) {
166
+ escaped = false;
167
+ continue;
168
+ }
169
+ if (quote !== 0) {
170
+ if (c === BACKSLASH)
171
+ escaped = true;
172
+ if (c === quote)
173
+ quote = 0;
174
+ continue;
175
+ }
176
+ if (c === DOUBLE_QUOTE || c === SINGLE_QUOTE)
177
+ quote = c;
178
+ if (c === OPEN)
179
+ depth++;
180
+ if (c === CLOSE)
181
+ depth = Math.max(0, depth - 1);
182
+ if (c === SEMICOLON && depth === 0) {
183
+ takeDeclaration(text, start, i, out);
184
+ start = i + 1;
185
+ }
186
+ }
187
+ takeDeclaration(text, start, text.length, out);
188
+ return out;
189
+ };
190
+ const BACKSLASH = 92;
191
+ const DOUBLE_QUOTE = 34;
192
+ const SINGLE_QUOTE = 39;
193
+ const OPEN = 40;
194
+ const CLOSE = 41;
195
+ const SEMICOLON = 59;
196
+ /** The declaration in `text` from `start` to `end` into `out`: its property and value, trimmed, when it has both. */
197
+ const takeDeclaration = (text, start, end, out) => {
198
+ const declaration = text.slice(start, end);
199
+ const colon = declaration.indexOf(":");
200
+ if (colon <= 0)
201
+ return;
202
+ const key = declaration.slice(0, colon).trim();
203
+ const value = declaration.slice(colon + 1).trim();
204
+ if (key !== "" && value !== "")
205
+ out[key] = value;
206
+ };
207
+ /** A style given as CSS text, parsed; a record as it is. */
208
+ const recordOf = (input) => {
209
+ // Per element at mount (#540): statements.
210
+ if (Predicate.isString(input))
211
+ return parseCssText(input);
212
+ return input;
213
+ };
214
+ /** A style given as CSS text, parsed; a record as it is; none, an empty record. */
215
+ const recordOfInput = (input) => {
216
+ // Per element at mount (#540): statements.
217
+ if (Predicate.isUndefined(input))
218
+ return {};
219
+ return recordOf(input);
220
+ };
221
+ const setsKey = (key) => (style) => Predicate.isNotUndefined(style[key]);
222
+ /**
223
+ * Whether a style sets `user-select` and not `-webkit-user-select`, and the reverse. Chromium has
224
+ * one property under both names, so a value set under one is the value for both.
225
+ */
226
+ const setsOnlyUserSelect = Predicate.and(setsKey("user-select"), Predicate.not(setsKey("-webkit-user-select")));
227
+ const setsOnlyWebkitUserSelect = Predicate.and(setsKey("-webkit-user-select"), Predicate.not(setsKey("user-select")));
228
+ /** `self` laid over `that`: both present. */
229
+ const layered = (self, that) => {
230
+ const merged = { ...that, ...self };
231
+ // `self`'s value for either name is the value for both, or `that`'s left on the other wins.
232
+ if (setsOnlyUserSelect(self))
233
+ merged["-webkit-user-select"] = self["user-select"];
234
+ if (setsOnlyWebkitUserSelect(self))
235
+ merged["user-select"] = self["-webkit-user-select"];
236
+ return merged;
237
+ };
238
+ /**
239
+ * `self` laid over `that`: `self`'s keys win, and `that`'s others stay. A chain reads from the top layer
240
+ * down: an element's style is its drag defaults, under its base, under the app's, under what Wardic
241
+ * animates. A side given as CSS text is parsed, so a framework never writes `cssText` over the keys
242
+ * Wardic holds, and a side that's `undefined` leaves the other as it is, the same object. Whatever `self`
243
+ * sets for `user-select` or `-webkit-user-select` it sets for both: one property in Chromium.
244
+ *
245
+ * @example
246
+ * // Before the first commit: the starting style over the app's, over a base and a drag element's defaults.
247
+ * pipe(starting, Style.over(user), Style.over(base), Style.over(Style.dragDefaults("x")))
248
+ */
249
+ // `dual`, `self` first (ADR-0041, decision 5). The layering: ADR-0019 *Amendment (Reorder)*.
250
+ export const over = dual(2, (self, that) => {
251
+ // Per element at mount (#540): statements.
252
+ if (Predicate.isUndefined(that))
253
+ return recordOfInput(self);
254
+ if (Predicate.isUndefined(self))
255
+ return recordOf(that);
256
+ return layered(recordOf(self), recordOf(that));
257
+ });
258
+ /** Whether `key`, a CSS property, is one of the gate's held patch keys: by its name, or its name dash-cased. */
259
+ const isHeld = (held, key) => {
260
+ // Per element at mount (#540): a loop.
261
+ for (const patchKey of held) {
262
+ if (patchKey === key || dashCase(patchKey) === key)
263
+ return true;
264
+ }
265
+ return false;
266
+ };
267
+ /**
268
+ * `self` without the keys the flush gate holds on the element (`held`, by patch key, matched by CSS
269
+ * property): the style once its first frame is committed. Wardic writes those while it drives them, and
270
+ * the app's `style` is their fallback, so a key the gate lets go of comes back.
271
+ *
272
+ * @example
273
+ * pipe(user, Style.over(base), Style.without(held))
274
+ */
275
+ // ADR-0034.
276
+ export const without = dual(2, (self, held) => {
277
+ // Per element at mount (#540): a loop.
278
+ const record = recordOfInput(self);
279
+ const out = {};
280
+ for (const key of Object.keys(record)) {
281
+ if (!isHeld(held, key))
282
+ out[key] = record[key];
283
+ }
284
+ return out;
285
+ });
286
+ /**
287
+ * Whether the keys the flush gate holds, changing from `prev` to `next`, change `self`'s `without`:
288
+ * whether a key taken or let go of is one `self` sets, by its name or its name dash-cased. Most changes
289
+ * touch none, and a binding then leaves its `style` alone.
290
+ */
291
+ // ADR-0034.
292
+ export const heldTouches = dual(3, (self, prev, next) => Arr.some([...Arr.difference(prev, next), ...Arr.difference(next, prev)], (key) => Arr.some([key, dashCase(key)], (name) => Object.hasOwn(self, name))));
293
+ /**
294
+ * The starting style of a `tag` element starting from `values`: projected as the renderer projects a
295
+ * Frame, then split by tag, an SVG element's keys inside an `<svg>` as attributes, and the rest as style.
296
+ * `undefined` is an HTML element, as for a spread that doesn't know its tag.
297
+ */
298
+ // The Starting style; routed by tag (ADR-0014). The spread: a `createWard` spread.
299
+ export const startingStyle = (tag, values) => splitPatchForTag(tag, project(values));
300
+ //# sourceMappingURL=starting-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starting-style.js","sourceRoot":"","sources":["../../src/internal/starting-style.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAmB,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEtE;;;;GA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MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IAChD,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAC,CAAA;AAEF;;;;GAIG;AACH,YAAY;AACZ,MAAM,CAAC,MAAM,WAAW,GAGpB,IAAI,CAAC,CAAC,EAAE,CAAC,IAAiB,EAAE,IAA2B,EAAE,IAA2B,EAAW,EAAE,CACnG,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAC/E,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACpE,CACF,CAAA;AAED;;;;GAIG;AACH,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAuB,EAAE,MAAyC,EAAc,EAAE,CAC9G,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * SVG realization for the DOM renderer (ADR-0014). The core value pipeline +
3
+ * the pure `project` stay AGNOSTIC and flat: SVG numeric attrs (`cx`/`r`/…)
4
+ * already spring as numbers and `fill`/`stroke` already interpolate as colors.
5
+ * This module is the DOM-API ROUTING layer — the one place that decides whether
6
+ * a resolved value is written as a CSS `style` or an `setAttribute`, plus the
7
+ * SVG-specific shaping (`transform-box`, `pathLength`→dash). It is the seam a
8
+ * non-DOM SVG renderer (e.g. react-native-svg) would replace wholesale; nothing
9
+ * here is shared with `@wardic/core`.
10
+ *
11
+ * Model (Motion's `buildSVGAttrs`): for an svg-INNER element every key is an
12
+ * ATTRIBUTE except `transform`/`transformOrigin`/`transformBox` + the CSS
13
+ * motion-path props, which stay STYLE, and a custom property (`--…`), which is style
14
+ * under its own name on every element (#151). For an HTML element or the `<svg>` ROOT
15
+ * everything is style (the root has a CSS box; only `viewBox` would be an attr —
16
+ * deferred). So the HTML path is unchanged: its attribute map is always empty.
17
+ */
18
+ import type * as Renderer from "@wardic/core/Renderer";
19
+ import * as Option from "effect/Option";
20
+ /**
21
+ * camelCase → dash-case for a CSS/attribute name (`transformBox` → `transform-box`); a
22
+ * custom property keeps its name (`--brandColor`).
23
+ */
24
+ export declare const dashCase: (key: string) => string;
25
+ /** Whether a key collapses into the stroke dash: `pathLength`, `pathSpacing` or `pathOffset`. */
26
+ export declare const isPathKey: (key: string) => boolean;
27
+ /**
28
+ * The attribute an svg-inner element's `key` is written as (the routing below), or
29
+ * `None` for a key that stays style ({@link SVG_STYLE_KEYS}, a custom property) or collapses into the
30
+ * stroke dash (`pathLength` / `pathSpacing` / `pathOffset`). Internal: the Own-value read
31
+ * reads the attribute a key is written as (ADR-0022).
32
+ */
33
+ export declare const svgAttrNameOf: (key: string) => Option.Option<string>;
34
+ /** Whether `el` is an `<svg>` root, which is styled as HTML is: it has a CSS box. */
35
+ export declare const isSvgRoot: (el: unknown) => boolean;
36
+ /** Whether `el` is an SVG element inside an `<svg>`: any SVG element but the root. */
37
+ export declare const isSvgInner: (el: unknown) => boolean;
38
+ /** A style patch, split: the keys written as CSS, and the ones written as attributes. */
39
+ export interface SplitPatch {
40
+ /** The keys written as CSS: the whole patch for HTML and an `<svg>` root, the very object given. */
41
+ readonly style: Readonly<Record<string, unknown>>;
42
+ /** The keys written with `setAttribute`: none for HTML and an `<svg>` root. */
43
+ readonly attrs: Readonly<Record<string, string>>;
44
+ }
45
+ /**
46
+ * A style patch split for `el`: an HTML element's, or an `<svg>` root's, is all style. An SVG element
47
+ * inside one takes every key as an attribute but the keys CSS styles and a custom property; `attrX`,
48
+ * `attrY` and `attrScale` as its `x`, `y` and `scale` attributes; a `transform` with `transform-box:
49
+ * fill-box` and `transform-origin: 50% 50%`, unless the values set them, so it turns about its own centre
50
+ * as an HTML element does; and `pathLength`, `pathSpacing` and `pathOffset` as a normalised
51
+ * `stroke-dasharray` and `stroke-dashoffset`, with `pathLength="1"`.
52
+ */
53
+ export declare const splitPatch: (el: unknown, patch: Renderer.Patch) => SplitPatch;
54
+ /** Whether `tag` names an SVG element inside an `<svg>`, by its name alone. */
55
+ export declare const isSvgInnerTag: (tag: string) => boolean;
56
+ /** `splitPatch` by tag name, for where there's no element yet: a server render, a starting style. `undefined` is an HTML element. */
57
+ export declare const splitPatchForTag: (tag: string | undefined, patch: Renderer.Patch) => SplitPatch;
58
+ /** Writes each attribute onto `el` with `setAttribute`; nothing for an empty map. */
59
+ export declare const setSvgAttrs: (el: Element, attrs: Readonly<Record<string, string>>) => void;
60
+ //# sourceMappingURL=svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../src/internal/svg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAEtD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAwEvC;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAStC,CAAA;AAQD,iGAAiG;AACjG,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,OAAgF,CAAA;AAExH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAO5D,CAAA;AAEJ,qFAAqF;AACrF,eAAO,MAAM,SAAS,OAAQ,OAAO,KAAG,OAIvC,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,UAAU,OAAQ,OAAO,KAAG,OAGxC,CAAA;AAED,yFAAyF;AACzF,MAAM,WAA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