@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,115 @@
1
+ /**
2
+ * The DOM's **Announcement** channel (ADR-0037): `AnnouncerDomLive`, core's `Announcer.Announcer` as
3
+ * one visually hidden live region per document, `aria-live="assertive"` and `aria-atomic`, shared by
4
+ * every Reorder group on the page. Assertive, because each announcement answers a key just pressed;
5
+ * the caller thins a held arrow's repeats to the last. Each announcement replaces the last, and one
6
+ * that repeats the last (an arrow at an end re-announcing the position) gets a trailing no-break
7
+ * space, so a screen reader sees a change and speaks it again.
8
+ *
9
+ * A screen reader watches a live region from when it's in the page, so the region has to be there
10
+ * before the first announcement: {@link prepareAnnouncer} adds it (a Reorder group's controller calls
11
+ * it when its element attaches), and an announcement adds it too if nothing did.
12
+ *
13
+ * {@link instructionsId} gives the id of a hidden element holding a group's instructions, one per
14
+ * distinct text per document, for its items' `aria-describedby`. {@link instructionsIdOf} gives the
15
+ * id alone, and {@link showInstructions} adds its element.
16
+ *
17
+ * Client-only (ADR-0021, decision 7): building the layer on a server fails with the client-only error.
18
+ *
19
+ * Tier 2 (ADR-0008): for DOM binding authors.
20
+ */
21
+ import * as Announcer from "@wardic/core/Announcer";
22
+ import * as Bool from "effect/Boolean";
23
+ import * as Effect from "effect/Effect";
24
+ import * as Layer from "effect/Layer";
25
+ import * as Option from "effect/Option";
26
+ import * as Predicate from "effect/Predicate";
27
+ import { requireGlobal } from "./require-global.js";
28
+ /** The attribute that marks the live region, for a test or a stylesheet to find it. */
29
+ export const ANNOUNCER_ATTRIBUTE = "data-wardic-announcer";
30
+ /** Hidden from sight, not from assistive technology: the usual visually hidden rule. */
31
+ const VISUALLY_HIDDEN = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap";
32
+ /** Each document's live region, once added. */
33
+ // Module state (#460, Q7): each document's live region, held weakly by the document.
34
+ const regions = new WeakMap();
35
+ /** `doc`'s live region, added to its body when it has none. */
36
+ const regionOf = (doc) => Option.getOrElse(Option.filter(Option.fromUndefinedOr(regions.get(doc)), (region) => region.isConnected), () => addRegion(doc));
37
+ /** Add `doc`'s live region to its body. */
38
+ const addRegion = (doc) => {
39
+ const region = doc.createElement("div");
40
+ region.setAttribute(ANNOUNCER_ATTRIBUTE, "");
41
+ region.setAttribute("aria-live", "assertive");
42
+ region.setAttribute("aria-atomic", "true");
43
+ region.setAttribute("style", VISUALLY_HIDDEN);
44
+ doc.body.appendChild(region);
45
+ regions.set(doc, region);
46
+ return region;
47
+ };
48
+ /**
49
+ * The live document `node` is in: its own when that has a window, else the page's. A Solid ref
50
+ * runs while a new element still belongs to its template's inert document (no window, no body),
51
+ * before it's inserted.
52
+ */
53
+ export const documentOf = (node) => {
54
+ const doc = node.ownerDocument;
55
+ if (doc === null || doc.defaultView === null)
56
+ return document;
57
+ return doc;
58
+ };
59
+ /** Adds `doc`'s live region now, before its first announcement, so a screen reader is already watching it. */
60
+ export const prepareAnnouncer = (doc) => {
61
+ regionOf(doc);
62
+ };
63
+ /**
64
+ * Speaks `message` in `doc`'s live region, replacing the last. A repeat of the last gets a trailing
65
+ * no-break space, so it's read out again.
66
+ */
67
+ export const announceIn = (doc, message) => {
68
+ const region = regionOf(doc);
69
+ region.textContent = Bool.match(region.textContent === message, { onTrue: () => `${message}\u00A0`, onFalse: () => message });
70
+ };
71
+ /** Each document's instructions ids, by text. */
72
+ // Module state (#460, Q7): each document's instructions, held weakly by the document.
73
+ const instructions = new WeakMap();
74
+ // Module state (#460, Q7): an id counter; an id need only be unique in its document.
75
+ let nextInstructions = 1;
76
+ /**
77
+ * The id of `doc`'s hidden element holding `text`, one per distinct text, for the `aria-describedby` of
78
+ * every item that shows it. Given here, with no element added: a binding works it out as it renders, and
79
+ * adds the element with `showInstructions` in an effect.
80
+ */
81
+ // #320.
82
+ export const instructionsIdOf = (doc, text) => {
83
+ const byText = Option.getOrElse(Option.fromUndefinedOr(instructions.get(doc)), () => {
84
+ const added = new Map();
85
+ instructions.set(doc, added);
86
+ return added;
87
+ });
88
+ return Option.getOrElse(Option.fromUndefinedOr(byText.get(text)), () => {
89
+ const id = `wardic-instructions-${nextInstructions++}`;
90
+ byText.set(text, id);
91
+ return id;
92
+ });
93
+ };
94
+ /** Adds `doc`'s hidden element holding `text`, under `instructionsIdOf`'s id, unless it's there already. */
95
+ export const showInstructions = (doc, text) => {
96
+ const id = instructionsIdOf(doc, text);
97
+ if (Predicate.isNotNull(doc.getElementById(id)))
98
+ return;
99
+ const el = doc.createElement("div");
100
+ el.id = id;
101
+ el.hidden = true;
102
+ el.textContent = text;
103
+ doc.body.appendChild(el);
104
+ };
105
+ /** `instructionsIdOf`, with its element added now: added again if it was removed. */
106
+ export const instructionsId = (doc, text) => {
107
+ showInstructions(doc, text);
108
+ return instructionsIdOf(doc, text);
109
+ };
110
+ /** Core's `Announcer`, speaking in the page's `document`'s live region. */
111
+ export const AnnouncerDomLive = Layer.effect(Announcer.Announcer)(Effect.gen(function* () {
112
+ yield* requireGlobal("DomAnnouncer.layer", "document");
113
+ return Announcer.Announcer.of({ announce: (message) => announceIn(document, message) });
114
+ }));
115
+ //# sourceMappingURL=announcer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcer.js","sourceRoot":"","sources":["../../src/internal/announcer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,uFAAuF;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAA;AAE1D,wFAAwF;AACxF,MAAM,eAAe,GACnB,kJAAkJ,CAAA;AAEpJ,+CAA+C;AAC/C,qFAAqF;AACrF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAyB,CAAA;AAEpD,+DAA+D;AAC/D,MAAM,QAAQ,GAAG,CAAC,GAAa,EAAe,EAAE,CAC9C,MAAM,CAAC,SAAS,CACd,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EACvF,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CACrB,CAAA;AAEH,2CAA2C;AAC3C,MAAM,SAAS,GAAG,CAAC,GAAa,EAAe,EAAE;IAC/C,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,CAAC,YAAY,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAA;IAC5C,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,C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,IAAY,EAAU,EAAE;IACpE,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC3B,OAAO,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC,CAAA;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAqC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CACjG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,KAAK,CAAC,CAAC,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAA;IACtD,OAAO,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;AACzF,CAAC,CAAC,CACH,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * An Appear animation's slot on its element (#48, ADR-0044), as a page's code reads it before any Handoff:
3
+ * whether the element's animation still runs, and the Handoff's last step, its removal. Kept apart from the
4
+ * sampler and the Handoff's reads (`appear.ts`), so code that only asks, or lets one go, ships neither: a
5
+ * Batch's, whose reads load at its first Handoff (#706, Q11).
6
+ *
7
+ * @module
8
+ */
9
+ /** The prefix every Appear rule's name starts with. */
10
+ export declare const PREFIX = "wardic-";
11
+ /**
12
+ * Whether `element`'s Appear animation is running, not yet handed over: its inline style still names its
13
+ * slot, which `release` removes. A layout measure asks it of each node, so a running animation's
14
+ * transform, which beats the inline one, stays out of the box it reads.
15
+ */
16
+ export declare const pending: (element: ElementCSSInlineStyle) => boolean;
17
+ /**
18
+ * The handover's last step: the element's inline `animation` removed, in the task that writes the
19
+ * engine's first frame, so no paint falls between. While it ran, its value beat the inline style the
20
+ * engine writes; removing it ends the CSS animation at that task's style update.
21
+ */
22
+ export declare const release: (element: ElementCSSInlineStyle) => void;
23
+ //# sourceMappingURL=appear-slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appear-slot.d.ts","sourceRoot":"","sources":["../../src/internal/appear-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uDAAuD;AACvD,eAAO,MAAM,MAAM,YAAY,CAAA;AAK/B;;;;GAIG;AAEH,eAAO,MAAM,OAAO,YAAa,qBAAqB,KAAG,OAA8E,CAAA;AAEvI;;;;GAIG;AAEH,eAAO,MAAM,OAAO,YAAa,qBAAqB,KAAG,IAExD,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * An Appear animation's slot on its element (#48, ADR-0044), as a page's code reads it before any Handoff:
3
+ * whether the element's animation still runs, and the Handoff's last step, its removal. Kept apart from the
4
+ * sampler and the Handoff's reads (`appear.ts`), so code that only asks, or lets one go, ships neither: a
5
+ * Batch's, whose reads load at its first Handoff (#706, Q11).
6
+ *
7
+ * @module
8
+ */
9
+ /** The prefix every Appear rule's name starts with. */
10
+ export const PREFIX = "wardic-";
11
+ /** What a slot's inline `animation` starts with: `var(--wardic-a`. */
12
+ const SLOT_PREFIX = `var(--${PREFIX}a`;
13
+ /**
14
+ * Whether `element`'s Appear animation is running, not yet handed over: its inline style still names its
15
+ * slot, which `release` removes. A layout measure asks it of each node, so a running animation's
16
+ * transform, which beats the inline one, stays out of the box it reads.
17
+ */
18
+ // #245: a Measure pass; a string read, no style resolved.
19
+ export const pending = (element) => element.style.getPropertyValue("animation").startsWith(SLOT_PREFIX);
20
+ /**
21
+ * The handover's last step: the element's inline `animation` removed, in the task that writes the
22
+ * engine's first frame, so no paint falls between. While it ran, its value beat the inline style the
23
+ * engine writes; removing it ends the CSS animation at that task's style update.
24
+ */
25
+ // The **Handoff** (ADR-0044, decision 6). A `cancel()` too changed nothing (a mutation, #48's PR 1).
26
+ export const release = (element) => {
27
+ element.style.removeProperty("animation");
28
+ };
29
+ //# sourceMappingURL=appear-slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appear-slot.js","sourceRoot":"","sources":["../../src/internal/appear-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAA;AAE/B,sEAAsE;AACtE,MAAM,WAAW,GAAG,SAAS,MAAM,GAAG,CAAA;AAEtC;;;;GAIG;AACH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAA8B,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAEvI;;;;GAIG;AACH,qGAAqG;AACrG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAA8B,EAAQ,EAAE;IAC9D,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAC3C,CAAC,CAAA"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Appear animations (#48, ADR-0044): a server-rendered mount animation played in CSS from first
3
+ * paint, which the client takes over at mount (the **Handoff**). The DOM's half, framework-free:
4
+ *
5
+ * - **The sampler** steps a binding's mount animation through core's machines, as a 60 Hz client
6
+ * would (`Machine.CATCH_UP_DT`), projects each Frame with the DOM's `project`, and writes it as one
7
+ * `@keyframes` rule, thinned to the stops a straight line can't stand in for, within a tolerance
8
+ * per key below what a screen shows (decision 9). One rule a spec, cached across requests by it.
9
+ * - **A sheet** collects one render's rules. An element's inline style names only a custom
10
+ * property, `animation: var(--wardic-aN)`, which the sheet defines in `:root` once the render
11
+ * knows its timing (decision 5); undefined, it leaves the element at its Starting style.
12
+ * - **The Handoff's reads:** the element's `wardic-…` animation and how far it has got. Its removal,
13
+ * written in the same task as the engine's first frame (decision 6), is `appear-slot.ts`'s, with
14
+ * `pending`: what a page's code asks before any Handoff, kept out of this module.
15
+ *
16
+ * @module
17
+ */
18
+ import * as Batch from "@wardic/core/Batch";
19
+ import type * as Frame from "@wardic/core/Frame";
20
+ import * as Machine from "@wardic/core/Machine";
21
+ import type * as Values from "@wardic/core/Values";
22
+ import { type LazyArg } from "effect/Function";
23
+ import * as Option from "effect/Option";
24
+ import * as Result from "effect/Result";
25
+ import { type TransformTemplate } from "./renderer.ts";
26
+ /** An element's mount animation, as its binding describes it. */
27
+ export interface Spec {
28
+ /**
29
+ * What built the animation, as one string the binding writes the same on the server and the
30
+ * client: its starting values, its targets, its transition, whether motion is reduced. The rule's
31
+ * name is its hash, so a client tells a Handoff it can continue from one it can't (decision 6).
32
+ */
33
+ readonly key: string;
34
+ /** The element's tag, so an SVG element's keys go to its attributes; `undefined` for an HTML element. */
35
+ readonly tag: string | undefined;
36
+ /**
37
+ * The animation's values from its start (for an `infinite` one, one cycle of it), built only when
38
+ * the rule isn't cached: a server render calls it once per spec per process.
39
+ */
40
+ readonly machine: LazyArg<Machine.Machine<Frame.Frame<Values.Values>>>;
41
+ /** Played over and over: an infinite repeat, `machine` one cycle of it. */
42
+ readonly infinite?: boolean | undefined;
43
+ /** A layout node: drawn through its projection at rest, as the client draws it, its own move on top. */
44
+ readonly projected?: boolean | undefined;
45
+ /**
46
+ * The element's transform template: each stop's transform drawn through it, as the client draws it. A
47
+ * function's text can't name a rule, so a templated spec's rule is named by its stops, and sampled for
48
+ * each element that has one, never cached.
49
+ */
50
+ readonly template?: TransformTemplate | undefined;
51
+ }
52
+ /** A spec's `@keyframes` rule. */
53
+ export interface Keyframes {
54
+ /** The rule's name: `wardic-` and the spec's hash. */
55
+ readonly name: string;
56
+ /**
57
+ * Seconds the rule plays, a multiple of 1/60 s: to the first Frame from which every one is within
58
+ * tolerance of the settled one.
59
+ */
60
+ readonly duration: number;
61
+ /** Seconds to the Frame the spec settles at, which a client waits for: at or past `duration`. */
62
+ readonly settled: number;
63
+ /** Whether it plays over and over. */
64
+ readonly infinite: boolean;
65
+ /** The time of each stop kept, in seconds from the start. */
66
+ readonly times: ReadonlyArray<number>;
67
+ /** The rule, `@keyframes <name>{…}`. */
68
+ readonly css: string;
69
+ /**
70
+ * The SVG geometry properties its stops write (`cx`, `r`…), which some browsers don't draw from CSS: an
71
+ * element playing it is defined under `@supports` for each, so a browser without them keeps it at its
72
+ * starting style. Empty for most rules.
73
+ */
74
+ readonly supports: ReadonlyArray<string>;
75
+ }
76
+ /** Where an element's timing is decided: a spec, and the delay it starts after. */
77
+ export interface Play {
78
+ /** The element's mount animation. */
79
+ readonly spec: Spec;
80
+ /** Seconds before it starts: its orchestration's, and any delay on the whole element. */
81
+ readonly delay: number;
82
+ }
83
+ /** The longest mount animation sampled, in seconds; a longer one keeps its Starting style. */
84
+ export declare const MAX_SECONDS = 60;
85
+ /** The rule's name for a spec: its key, tag, repeat and projection, hashed. */
86
+ export declare const nameOf: (spec: Pick<Spec, "key" | "tag" | "infinite" | "projected">) => string;
87
+ /**
88
+ * The stops kept (decision 9), as indices into `frames`, and where the rule ends.
89
+ *
90
+ * - **It ends** at the first Frame from which every one is within tolerance of the settled Frame,
91
+ * drawn as the settled Frame: a tween stepped in 1/60 s settles a frame after it arrives, when
92
+ * its steps' sum crosses its duration.
93
+ * - **The stops kept** are the first, the end, and each one a straight line from the last kept can't
94
+ * reach past, within every key's tolerances.
95
+ * - **A jump** (`jumps`, kept stops): a Frame the one before it can't be drawn into, as `jumpAt`
96
+ * tells. The rule holds the Frame before it to halfway between them, then steps, so a display
97
+ * frame near either draws that Frame, not a value on a line through values the engine never draws.
98
+ */
99
+ export declare const thin: (frames: ReadonlyArray<Values.Values>, tag?: string | undefined) => {
100
+ readonly kept: ReadonlyArray<number>;
101
+ readonly end: number;
102
+ readonly jumps: ReadonlyArray<number>;
103
+ };
104
+ /**
105
+ * A spec's rule, or why it has none, for a debug log. Sampled once a spec and cached across requests by
106
+ * its name, since a spec's rule changes only once the page registers every colour space
107
+ * (`Color.registerSpaces`): a wide-gamut colour blends as written before, in sRGB after. Its name stays,
108
+ * so a client matches it whatever it had registered. A templated spec's is sampled each time: its name
109
+ * comes from its stops.
110
+ */
111
+ export declare const keyframes: (spec: Spec) => Result.Result<Keyframes, string>;
112
+ /**
113
+ * An element's `animation` value for a play of `rule`: its name, length, delay and repeat, filling
114
+ * forwards. Not backwards: through its delay the element shows its inline starting style, which is the
115
+ * rule's first stop for a rule that moves from it.
116
+ */
117
+ export declare const animationOf: (rule: Keyframes, delay: number) => string;
118
+ /**
119
+ * A Batch's entrance, as its binding describes it: its members on one set of transitions, each with its
120
+ * own start and target. One rule plays them all, each member's own values read from custom properties
121
+ * on its element (#706).
122
+ */
123
+ export interface BatchSpec {
124
+ /**
125
+ * Its transitions, key by key, and whether motion is reduced, as one string the binding writes the
126
+ * same on the server and the client: the rule's name starts with its hash, which a client checks
127
+ * ({@link matchesBatch}) before it takes a member over.
128
+ */
129
+ readonly key: string;
130
+ /** The Batch's keys, in its order: the DOM's transform keys and `opacity`. */
131
+ readonly keys: ReadonlyArray<string>;
132
+ /** How its keys move, as `Batch.make` takes it. */
133
+ readonly transition: Batch.Transitions;
134
+ /** Each member's start, a number a key, in `keys`' order. */
135
+ readonly starts: ReadonlyArray<ReadonlyArray<number>>;
136
+ /** Each member's target, as `starts`. */
137
+ readonly targets: ReadonlyArray<ReadonlyArray<number>>;
138
+ }
139
+ /** A Batch's rule, and each member's own values for it. */
140
+ export interface BatchKeyframes extends Keyframes {
141
+ /**
142
+ * A member's own values as the custom properties the rule reads (`--wardic-x1: 120px`), by its index
143
+ * in the spec; `undefined` for a member none of whose keys moves, which plays nothing.
144
+ */
145
+ readonly memberStyle: (member: number) => Readonly<Record<string, string>> | undefined;
146
+ }
147
+ /**
148
+ * A Batch's rule for its members' entrance, or why it has none: one `@keyframes` for every member, each
149
+ * key's stops sampled from the Batch's own spring or tween at 60 Hz and thinned within its tolerance at
150
+ * its longest move. A key whose start and target every member that moves shares is written as it is;
151
+ * one whose values differ, as each member's custom properties and its progress between them.
152
+ */
153
+ export declare const batchKeyframes: (spec: BatchSpec) => Result.Result<BatchKeyframes, string>;
154
+ /** One element's place in a sheet. */
155
+ export interface Slot {
156
+ /** The element's inline `animation`: `var(--wardic-aN)`, which the sheet defines once `define` is called. */
157
+ readonly animation: string;
158
+ /**
159
+ * The element's timing: `play`, and under `prefers-reduced-motion: reduce` `reduced` when given
160
+ * (a provider's `"user"`). Undefined until called, and left so when either spec has no rule: the
161
+ * element keeps its Starting style. The reason comes back for the debug log.
162
+ *
163
+ * Defined under `@supports` for the geometry properties its rules write and `supports`: a binding
164
+ * passes the ones every element it orchestrates with writes, so a browser without them keeps the whole
165
+ * group at its starting style, not half of it.
166
+ */
167
+ readonly define: (play: Play, reduced?: Play | undefined, supports?: ReadonlyArray<string>) => Result.Result<void, string>;
168
+ }
169
+ /** A Batch's members' place in a sheet: one slot for every member on one rule (#706). */
170
+ export interface BatchSlot {
171
+ /**
172
+ * A member's inline style, by its index in the rule's spec: its own values, and its `animation`, the slot
173
+ * and, when it waits (its stagger), its delay after it. `undefined` for a member that doesn't move.
174
+ */
175
+ readonly styleOf: (member: number, delay: number) => Readonly<Record<string, string>> | undefined;
176
+ }
177
+ /** One render's Appear rules: a slot per element, and the `<style>` text for the head and each late chunk. */
178
+ export interface Sheet {
179
+ /** A slot for the next element. */
180
+ readonly slot: () => Slot;
181
+ /**
182
+ * A slot for a Batch's members on `play`'s rule, and under `prefers-reduced-motion: reduce` `reduced`'s
183
+ * when given (a provider's `"user"`): both rules, and the slot's `:root` lines naming each with no delay,
184
+ * since each member gives its own.
185
+ */
186
+ readonly batch: (play: BatchKeyframes, reduced?: BatchKeyframes | undefined) => BatchSlot;
187
+ /**
188
+ * The CSS since the last call: each rule this render hasn't written yet, and the custom property of
189
+ * each slot defined since, the reduced ones under the media query. Called once for the head, and again
190
+ * for each chunk a stream sends after its shell, with only what that chunk adds.
191
+ */
192
+ readonly css: () => string;
193
+ }
194
+ /** A sheet for one render: a slot per element, and the CSS for the head. */
195
+ export declare const sheet: () => Sheet;
196
+ /**
197
+ * The attribute a late chunk's `<style>` carries: a chunk a stream sends after its shell brings its own
198
+ * rules, in a node its client doesn't render.
199
+ */
200
+ export declare const CHUNK_ATTRIBUTE = "data-wardic-appear-chunk";
201
+ /**
202
+ * A late chunk's `<style>` for `css`, as server text; "" for none. With a `nonce`, the one the page's
203
+ * Content Security Policy gives inline styles, it carries it.
204
+ */
205
+ export declare const chunkStyle: (css: string, nonce?: string) => string;
206
+ /**
207
+ * Moves each late chunk's Appear rules into the head: its `<style data-wardic-appear-chunk>`'s text into a
208
+ * head `<style>`, then the node out, before the chunk hydrates, since a hydrating client expects no node it
209
+ * doesn't render. The text goes first, so the rule a running animation plays is never missing. Chunks
210
+ * already in the document move at once; while it's still loading, a stream still coming, a
211
+ * `MutationObserver` moves each as it lands, until `DOMContentLoaded`. Every call moves what's there; one
212
+ * observer a document.
213
+ */
214
+ export declare const adoptChunks: (doc: Document) => void;
215
+ /**
216
+ * The element's Appear animation: its `wardic-…` CSS animation, running, or finished and filling. A
217
+ * Batch's rule on a member's element isn't one (#706): its Batch takes it over, not a Wardic element there.
218
+ */
219
+ export declare const find: (element: Element) => Option.Option<Animation>;
220
+ /**
221
+ * A document's Appear animations by element, running or finished and filling: one `getAnimations()` for
222
+ * the page, for a Handoff of many elements at once, a Batch's members (#706). Each element's first: a
223
+ * member's Batch rule, or the one `find` gets.
224
+ */
225
+ export declare const findAll: (doc: Document) => ReadonlyMap<Element, Animation>;
226
+ /** Whether `animation` is `spec`'s: the rule the server sampled from the same spec. */
227
+ export declare const matches: (animation: Animation, spec: Pick<Spec, "key" | "tag" | "infinite" | "projected">) => boolean;
228
+ /**
229
+ * Whether `animation` is a Batch rule for a spec's `key`: its name starts with the key's prefix, so the
230
+ * server's transitions and reduced motion are the client's. Its members' values aren't checked (#706, Q9).
231
+ */
232
+ export declare const matchesBatch: (animation: Animation, key: string) => boolean;
233
+ /** How far `animation` has got, in seconds since it started (its delay included): 0 before it has. */
234
+ export declare const elapsedOf: (animation: Animation) => number;
235
+ /** The delay `animation` started after, in seconds: what its element's `animation-delay` holds. */
236
+ export declare const delayOf: (animation: Animation) => number;
237
+ //# sourceMappingURL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