@wardic/dom 1.1.0 → 1.1.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 (253) hide show
  1. package/dist/DomProjectionSystem.js +3 -3
  2. package/dist/DomProjectionSystem.js.map +1 -1
  3. package/dist/FlushGate.d.ts +6 -6
  4. package/dist/FlushGate.d.ts.map +1 -1
  5. package/dist/FlushGate.js +7 -5
  6. package/dist/FlushGate.js.map +1 -1
  7. package/dist/ReorderController.js +3 -3
  8. package/dist/ReorderController.js.map +1 -1
  9. package/dist/Report.d.ts +1 -1
  10. package/dist/Report.d.ts.map +1 -1
  11. package/dist/Report.js +3 -2
  12. package/dist/Report.js.map +1 -1
  13. package/dist/Style.d.ts +2 -1
  14. package/dist/Style.d.ts.map +1 -1
  15. package/dist/Style.js +3 -1
  16. package/dist/Style.js.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/internal/batch-handoff.d.ts +25 -0
  20. package/dist/internal/batch-handoff.d.ts.map +1 -0
  21. package/dist/internal/batch-handoff.js +64 -0
  22. package/dist/internal/batch-handoff.js.map +1 -0
  23. package/dist/internal/gate-environment.d.ts +4 -0
  24. package/dist/internal/gate-environment.d.ts.map +1 -0
  25. package/dist/internal/gate-environment.js +21 -0
  26. package/dist/internal/gate-environment.js.map +1 -0
  27. package/dist/internal/projection.js +14 -14
  28. package/dist/internal/projection.js.map +1 -1
  29. package/dist/internal/reorder.d.ts +2 -2
  30. package/dist/internal/reorder.d.ts.map +1 -1
  31. package/dist/internal/reorder.js +2 -2
  32. package/dist/internal/reorder.js.map +1 -1
  33. package/dist/internal/starting-style.d.ts +0 -83
  34. package/dist/internal/starting-style.d.ts.map +1 -1
  35. package/dist/internal/starting-style.js +16 -143
  36. package/dist/internal/starting-style.js.map +1 -1
  37. package/dist/unstable/AppearAnimations.d.ts +191 -0
  38. package/dist/unstable/AppearAnimations.d.ts.map +1 -0
  39. package/dist/unstable/AppearAnimations.js +561 -0
  40. package/dist/unstable/AppearAnimations.js.map +1 -0
  41. package/dist/unstable/BatchMembers.d.ts +513 -0
  42. package/dist/unstable/BatchMembers.d.ts.map +1 -0
  43. package/dist/unstable/BatchMembers.js +2490 -0
  44. package/dist/unstable/BatchMembers.js.map +1 -0
  45. package/dist/unstable/DomValues.d.ts +25 -0
  46. package/dist/unstable/DomValues.d.ts.map +1 -0
  47. package/dist/unstable/DomValues.js +45 -0
  48. package/dist/unstable/DomValues.js.map +1 -0
  49. package/dist/unstable/DragConstraints.d.ts +48 -0
  50. package/dist/unstable/DragConstraints.d.ts.map +1 -0
  51. package/dist/unstable/DragConstraints.js +49 -0
  52. package/dist/unstable/DragConstraints.js.map +1 -0
  53. package/dist/unstable/DragControls.d.ts +50 -0
  54. package/dist/unstable/DragControls.d.ts.map +1 -0
  55. package/dist/unstable/DragControls.js +55 -0
  56. package/dist/unstable/DragControls.js.map +1 -0
  57. package/dist/unstable/DragDefaults.d.ts +34 -0
  58. package/dist/unstable/DragDefaults.d.ts.map +1 -0
  59. package/dist/unstable/DragDefaults.js +47 -0
  60. package/dist/unstable/DragDefaults.js.map +1 -0
  61. package/dist/unstable/DragTrack.d.ts +236 -0
  62. package/dist/unstable/DragTrack.d.ts.map +1 -0
  63. package/dist/unstable/DragTrack.js +646 -0
  64. package/dist/unstable/DragTrack.js.map +1 -0
  65. package/dist/unstable/DragTransition.d.ts +22 -0
  66. package/dist/unstable/DragTransition.d.ts.map +1 -0
  67. package/dist/unstable/DragTransition.js +31 -0
  68. package/dist/unstable/DragTransition.js.map +1 -0
  69. package/dist/unstable/ElementSetup.d.ts +144 -0
  70. package/dist/unstable/ElementSetup.d.ts.map +1 -0
  71. package/dist/unstable/ElementSetup.js +297 -0
  72. package/dist/unstable/ElementSetup.js.map +1 -0
  73. package/dist/unstable/Feature.d.ts +221 -0
  74. package/dist/unstable/Feature.d.ts.map +1 -0
  75. package/dist/unstable/Feature.js +281 -0
  76. package/dist/unstable/Feature.js.map +1 -0
  77. package/dist/unstable/GestureFeatures.d.ts +30 -0
  78. package/dist/unstable/GestureFeatures.d.ts.map +1 -0
  79. package/dist/unstable/GestureFeatures.js +32 -0
  80. package/dist/unstable/GestureFeatures.js.map +1 -0
  81. package/dist/unstable/GestureInfo.d.ts +61 -0
  82. package/dist/unstable/GestureInfo.d.ts.map +1 -0
  83. package/dist/unstable/GestureInfo.js +23 -0
  84. package/dist/unstable/GestureInfo.js.map +1 -0
  85. package/dist/unstable/Imperative.d.ts +214 -0
  86. package/dist/unstable/Imperative.d.ts.map +1 -0
  87. package/dist/unstable/Imperative.js +768 -0
  88. package/dist/unstable/Imperative.js.map +1 -0
  89. package/dist/unstable/Instant.d.ts +46 -0
  90. package/dist/unstable/Instant.d.ts.map +1 -0
  91. package/dist/unstable/Instant.js +49 -0
  92. package/dist/unstable/Instant.js.map +1 -0
  93. package/dist/unstable/LayoutGroup.d.ts +14 -0
  94. package/dist/unstable/LayoutGroup.d.ts.map +1 -0
  95. package/dist/unstable/LayoutGroup.js +31 -0
  96. package/dist/unstable/LayoutGroup.js.map +1 -0
  97. package/dist/unstable/LayoutMember.d.ts +127 -0
  98. package/dist/unstable/LayoutMember.d.ts.map +1 -0
  99. package/dist/unstable/LayoutMember.js +176 -0
  100. package/dist/unstable/LayoutMember.js.map +1 -0
  101. package/dist/unstable/LiveStyle.d.ts +171 -0
  102. package/dist/unstable/LiveStyle.d.ts.map +1 -0
  103. package/dist/unstable/LiveStyle.js +329 -0
  104. package/dist/unstable/LiveStyle.js.map +1 -0
  105. package/dist/unstable/MemberHold.d.ts +3 -0
  106. package/dist/unstable/MemberHold.d.ts.map +1 -0
  107. package/dist/unstable/MemberHold.js +223 -0
  108. package/dist/unstable/MemberHold.js.map +1 -0
  109. package/dist/unstable/OwnerScope.d.ts +16 -0
  110. package/dist/unstable/OwnerScope.d.ts.map +1 -0
  111. package/dist/unstable/OwnerScope.js +35 -0
  112. package/dist/unstable/OwnerScope.js.map +1 -0
  113. package/dist/unstable/PresenceController.d.ts +128 -0
  114. package/dist/unstable/PresenceController.d.ts.map +1 -0
  115. package/dist/unstable/PresenceController.js +1427 -0
  116. package/dist/unstable/PresenceController.js.map +1 -0
  117. package/dist/unstable/Press.d.ts +26 -0
  118. package/dist/unstable/Press.d.ts.map +1 -0
  119. package/dist/unstable/Press.js +19 -0
  120. package/dist/unstable/Press.js.map +1 -0
  121. package/dist/unstable/ServerInterpolators.d.ts +17 -0
  122. package/dist/unstable/ServerInterpolators.d.ts.map +1 -0
  123. package/dist/unstable/ServerInterpolators.js +20 -0
  124. package/dist/unstable/ServerInterpolators.js.map +1 -0
  125. package/dist/unstable/WardConfig.d.ts +567 -0
  126. package/dist/unstable/WardConfig.d.ts.map +1 -0
  127. package/dist/unstable/WardConfig.js +2 -0
  128. package/dist/unstable/WardConfig.js.map +1 -0
  129. package/dist/unstable/features/All.d.ts +24 -0
  130. package/dist/unstable/features/All.d.ts.map +1 -0
  131. package/dist/unstable/features/All.js +20 -0
  132. package/dist/unstable/features/All.js.map +1 -0
  133. package/dist/unstable/features/Colors.d.ts +12 -0
  134. package/dist/unstable/features/Colors.d.ts.map +1 -0
  135. package/dist/unstable/features/Colors.js +38 -0
  136. package/dist/unstable/features/Colors.js.map +1 -0
  137. package/dist/unstable/features/DomAnimation.d.ts +16 -0
  138. package/dist/unstable/features/DomAnimation.d.ts.map +1 -0
  139. package/dist/unstable/features/DomAnimation.js +19 -0
  140. package/dist/unstable/features/DomAnimation.js.map +1 -0
  141. package/dist/unstable/features/DomMax.d.ts +12 -0
  142. package/dist/unstable/features/DomMax.d.ts.map +1 -0
  143. package/dist/unstable/features/DomMax.js +14 -0
  144. package/dist/unstable/features/DomMax.js.map +1 -0
  145. package/dist/unstable/features/Drag.d.ts +5 -0
  146. package/dist/unstable/features/Drag.d.ts.map +1 -0
  147. package/dist/unstable/features/Drag.js +32 -0
  148. package/dist/unstable/features/Drag.js.map +1 -0
  149. package/dist/unstable/features/Focus.d.ts +5 -0
  150. package/dist/unstable/features/Focus.d.ts.map +1 -0
  151. package/dist/unstable/features/Focus.js +20 -0
  152. package/dist/unstable/features/Focus.js.map +1 -0
  153. package/dist/unstable/features/Hover.d.ts +5 -0
  154. package/dist/unstable/features/Hover.d.ts.map +1 -0
  155. package/dist/unstable/features/Hover.js +20 -0
  156. package/dist/unstable/features/Hover.js.map +1 -0
  157. package/dist/unstable/features/InView.d.ts +5 -0
  158. package/dist/unstable/features/InView.d.ts.map +1 -0
  159. package/dist/unstable/features/InView.js +20 -0
  160. package/dist/unstable/features/InView.js.map +1 -0
  161. package/dist/unstable/features/Input.d.ts +28 -0
  162. package/dist/unstable/features/Input.d.ts.map +1 -0
  163. package/dist/unstable/features/Input.js +31 -0
  164. package/dist/unstable/features/Input.js.map +1 -0
  165. package/dist/unstable/features/Keys.d.ts +95 -0
  166. package/dist/unstable/features/Keys.d.ts.map +1 -0
  167. package/dist/unstable/features/Keys.js +44 -0
  168. package/dist/unstable/features/Keys.js.map +1 -0
  169. package/dist/unstable/features/Layout.d.ts +43 -0
  170. package/dist/unstable/features/Layout.d.ts.map +1 -0
  171. package/dist/unstable/features/Layout.js +44 -0
  172. package/dist/unstable/features/Layout.js.map +1 -0
  173. package/dist/unstable/features/Pan.d.ts +5 -0
  174. package/dist/unstable/features/Pan.d.ts.map +1 -0
  175. package/dist/unstable/features/Pan.js +20 -0
  176. package/dist/unstable/features/Pan.js.map +1 -0
  177. package/dist/unstable/features/Press.d.ts +13 -0
  178. package/dist/unstable/features/Press.d.ts.map +1 -0
  179. package/dist/unstable/features/Press.js +10 -0
  180. package/dist/unstable/features/Press.js.map +1 -0
  181. package/dist/unstable/features/Scroll.d.ts +20 -0
  182. package/dist/unstable/features/Scroll.d.ts.map +1 -0
  183. package/dist/unstable/features/Scroll.js +34 -0
  184. package/dist/unstable/features/Scroll.js.map +1 -0
  185. package/dist/unstable/features/TimelineKeys.d.ts +7 -0
  186. package/dist/unstable/features/TimelineKeys.d.ts.map +1 -0
  187. package/dist/unstable/features/TimelineKeys.js +103 -0
  188. package/dist/unstable/features/TimelineKeys.js.map +1 -0
  189. package/package.json +4 -3
  190. package/src/DomProjectionSystem.ts +3 -3
  191. package/src/FlushGate.ts +11 -9
  192. package/src/ReorderController.ts +3 -3
  193. package/src/Report.ts +3 -7
  194. package/src/Style.ts +4 -1
  195. package/src/index.ts +1 -1
  196. package/src/internal/batch-handoff.ts +75 -0
  197. package/src/internal/gate-environment.ts +21 -0
  198. package/src/internal/projection.ts +14 -14
  199. package/src/internal/reorder.ts +4 -4
  200. package/src/internal/starting-style.ts +5 -204
  201. package/src/unstable/AppearAnimations.ts +837 -0
  202. package/src/unstable/BatchMembers.ts +3085 -0
  203. package/src/unstable/DomValues.ts +53 -0
  204. package/src/unstable/DragConstraints.ts +107 -0
  205. package/src/unstable/DragControls.ts +98 -0
  206. package/src/unstable/DragDefaults.ts +57 -0
  207. package/src/unstable/DragTrack.ts +959 -0
  208. package/src/unstable/DragTransition.ts +46 -0
  209. package/src/unstable/ElementSetup.ts +411 -0
  210. package/src/unstable/Feature.ts +494 -0
  211. package/src/unstable/GestureFeatures.ts +38 -0
  212. package/src/unstable/GestureInfo.ts +85 -0
  213. package/src/unstable/Imperative.ts +1037 -0
  214. package/src/unstable/Instant.ts +93 -0
  215. package/src/unstable/LayoutGroup.ts +36 -0
  216. package/src/unstable/LayoutMember.ts +319 -0
  217. package/src/unstable/LiveStyle.ts +497 -0
  218. package/src/unstable/MemberHold.ts +211 -0
  219. package/src/unstable/OwnerScope.ts +35 -0
  220. package/src/unstable/PresenceController.ts +1747 -0
  221. package/src/unstable/Press.ts +43 -0
  222. package/src/unstable/ServerInterpolators.ts +39 -0
  223. package/src/unstable/WardConfig.ts +704 -0
  224. package/src/unstable/features/All.ts +39 -0
  225. package/src/unstable/features/Colors.ts +40 -0
  226. package/src/unstable/features/DomAnimation.ts +19 -0
  227. package/src/unstable/features/DomMax.ts +14 -0
  228. package/src/unstable/features/Drag.ts +34 -0
  229. package/src/unstable/features/Focus.ts +21 -0
  230. package/src/unstable/features/Hover.ts +21 -0
  231. package/src/unstable/features/InView.ts +21 -0
  232. package/src/unstable/features/Input.ts +37 -0
  233. package/src/unstable/features/Keys.ts +124 -0
  234. package/src/unstable/features/Layout.ts +75 -0
  235. package/src/unstable/features/Pan.ts +21 -0
  236. package/src/unstable/features/Press.ts +21 -0
  237. package/src/unstable/features/Scroll.ts +35 -0
  238. package/src/unstable/features/TimelineKeys.ts +115 -0
  239. package/dist/internal/gate.d.ts +0 -199
  240. package/dist/internal/gate.d.ts.map +0 -1
  241. package/dist/internal/gate.js +0 -570
  242. package/dist/internal/gate.js.map +0 -1
  243. package/dist/internal/report.d.ts +0 -30
  244. package/dist/internal/report.d.ts.map +0 -1
  245. package/dist/internal/report.js +0 -60
  246. package/dist/internal/report.js.map +0 -1
  247. package/dist/internal/runner.d.ts +0 -22
  248. package/dist/internal/runner.d.ts.map +0 -1
  249. package/dist/internal/runner.js +0 -62
  250. package/dist/internal/runner.js.map +0 -1
  251. package/src/internal/gate.ts +0 -706
  252. package/src/internal/report.ts +0 -69
  253. package/src/internal/runner.ts +0 -78
@@ -1,199 +0,0 @@
1
- /**
2
- * `makeFlushGate` — the deferred **Flush gate** (ADR-0006), framework-free here in `@wardic/dom`
3
- * so every binding shares one (ADR-0031, decision 3). The binding hands in its `batch` and its
4
- * sinks; the gate imports nothing from a framework.
5
- *
6
- * Per ADR-0006, per-frame writes never reach their element directly. Each source
7
- * `write(id, partialValues)`s into a provider-owned gate that:
8
- *
9
- * 1. Accumulates *value-maps* (NOT already-projected Patches) per element,
10
- * merging partials by key — so multiple sources can feed one element
11
- * (e.g. a drag setting `x`/`y` while a spring drives `scale`, all
12
- * collapsing into one grouped `transform`). Projecting per source would
13
- * clobber the grouped transform.
14
- * 2. Resolves the Renderer's PURE `project` ONCE at creation and uses it to
15
- * turn each dirty element's merged value-map into a `Patch` exactly once
16
- * per element per frame.
17
- * 3. Commits each resulting Patch onto its element with the Renderer's `commit`, a plain
18
- * call (ADR-0034) — one DOM pass per frame, shared by every element: at the end of the
19
- * Frame loop's tick, in the Refresh frame that computed the values (ADR-0033). No
20
- * framework runs per frame: a binding's JSX carries an element's style only until its
21
- * first commit (ADR-0021, decision 6), and after it only the keys the gate doesn't hold.
22
- *
23
- * Three locked design decisions (this session's grills):
24
- * - FLUSHED at the end of the Frame loop's tick (ADR-0033): the gate registers a hook on
25
- * the Environment's loop (`afterTick`), so everything a tick writes is applied at the end
26
- * of that tick, inside the Clock's callback, and paints in that Refresh frame. A write
27
- * made outside a tick (a drag's move, a `release` from a task, an effect a sink's hook ran,
28
- * a Tier 2 `Stream` on `Clock.ticks` subscribed after the loop) still requests a
29
- * Refresh frame, only if one is not already pending, and the hook withdraws that request
30
- * when it flushes first. `flush` does NOT auto-reschedule, so an idle accumulator
31
- * requests no frames — the next `write` does. The frames come from the Environment's
32
- * `RefreshFrameSource` (ADR-0031): on the web, `requestAnimationFrame` itself. No binding
33
- * calls the browser's frame functions itself. A Tier 2 `Stream` that writes here paints in
34
- * the loop's frame or the next one, by its subscription order (ADR-0033): run it on the
35
- * loop (`Machine.run`) to paint with it.
36
- * - ONE flush per frame: all dirty elements flush together. The one exception
37
- * is `flushPass` (ADR-0018): a projection Measure pass's own writes are applied
38
- * at the end of its task, so a new layout never paints without its projection.
39
- * - ONE sink shape (ADR-0034): a sink is the element its patch is committed onto. The gate
40
- * also removes a key its last patch had and this one doesn't (a dragged node's `z-index`
41
- * once its raise is dropped, ADR-0016 *Amendment (Reorder)*), restoring the element's own
42
- * inline value, saved before the gate first wrote the key. Two hooks reach the binding,
43
- * outside the commits, each in the binding's `batch` (ADR-0034, *Amendment (#209)*): the
44
- * Starting-style switch before an element's first commit (`beforeFirstCommit`), and the keys
45
- * the gate holds on the element whenever they change (`onHeld`), so the binding's `style`
46
- * leaves them to Wardic.
47
- *
48
- * Observability (CONTEXT.md convention): the hot path (`write`/`flush`) is the
49
- * per-frame work, so — exactly like core's per-frame writes and the Clock's
50
- * `tick` — it stays quiet (no span, no per-call log, no metric). A flush that throws (a
51
- * binding's hook, a commit) is reported (`reportFailure`) and the gate
52
- * goes on, so it can't fail the Frame loop's tick it runs in (ADR-0033).
53
- */
54
- import * as FrameLoop from "@wardic/core/FrameLoop";
55
- import * as RefreshFrameSource from "@wardic/core/RefreshFrameSource";
56
- import * as Renderer from "@wardic/core/Renderer";
57
- import * as Atom from "effect/reactivity/Atom";
58
- import * as AtomRegistry from "effect/reactivity/AtomRegistry";
59
- import * as Effect from "effect/Effect";
60
- import type * as Fiber from "effect/Fiber";
61
- import * as Scope from "effect/Scope";
62
- import type { TimelineValue } from "./timeline.ts";
63
- /**
64
- * Where a flushed `Patch` is delivered: committed onto `target` with the Renderer's `commit`,
65
- * at flush time.
66
- */
67
- export interface FlushSink {
68
- /** The element the patch is committed onto. */
69
- readonly target: unknown;
70
- /**
71
- * Called once, just before the element's first commit in a frame flush (not a Measure
72
- * pass's `flushPass`), inside the binding's `batch` with every other element's switch that
73
- * flush: a binding drops its Starting style from its `style` prop here,
74
- * so its framework removes those keys and the commit writes the first frame in the same
75
- * Refresh frame, with no paint in between.
76
- */
77
- readonly beforeFirstCommit?: (() => void) | undefined;
78
- /**
79
- * Called with every key the gate now holds on the element, each time that set changes: after the
80
- * gate restores a key it dropped, and before the commit that first
81
- * writes a key. A binding whose `style` prop reaches the element leaves these keys out of it,
82
- * so its framework never writes over Wardic's value (`style` is a key's fallback). Called in
83
- * the binding's `batch`, with every other element's whose keys changed that flush, so what the
84
- * binding changes reaches the element before the commit, a framework that applies an update later
85
- * (Solid 2) included.
86
- */
87
- readonly onHeld?: ((keys: ReadonlyArray<string>) => void) | undefined;
88
- /**
89
- * Called once per frame in which the element's values were committed, after every commit of that
90
- * frame (Motion's `onUpdate`), with its values before
91
- * projection (`x` as a number). The object is the element's own, reused each call: valid during
92
- * the call, copied to keep. A Measure pass's commits are told at the frame flush after them, so
93
- * a frame tells each element once. A write it makes is the next frame's. A throw is reported,
94
- * and the others are still told.
95
- */
96
- readonly onCommit?: ((values: Readonly<Record<string, unknown>>) => void) | undefined;
97
- }
98
- /** A Flush gate: what a binding registers its elements with and writes their values into, one per provider. */
99
- export interface FlushGate {
100
- /**
101
- * Register an element under `id` with its `sink`. Returns an unregister fn
102
- * that removes the element from the accumulator (a subsequent `write` is a
103
- * no-op). `values` start its value-map, unflushed: drawn with its first `write`, so they never
104
- * commit alone.
105
- */
106
- readonly register: (id: string, sink: FlushSink, values?: Readonly<Record<string, unknown>>) => () => void;
107
- /**
108
- * Merge `partial` into the element's value-map by key, mark it dirty, and
109
- * schedule a flush: the end of the Frame loop's tick, for a write made in one, or else the
110
- * next Refresh frame. A `write` for an unregistered (or unregistered-since) id
111
- * is a no-op.
112
- */
113
- readonly write: (id: string, partial: Record<string, unknown>) => void;
114
- /**
115
- * Run a projection **Measure pass** now and apply exactly what it wrote before
116
- * returning. Only `write()`s made while
117
- * `pass()` runs are recorded; each recorded entry is `project`ed and committed once, and
118
- * marked clean. Everything else stays dirty for its flush. A write made by an effect a sink's
119
- * hook runs (a Solid effect) takes the ordinary path. The Projection system calls it at the
120
- * end of a task, so a new layout never paints without its projection.
121
- */
122
- readonly flushPass: (pass: () => void) => void;
123
- /**
124
- * Hand `keys` back to the element's own style: drop each from the element's
125
- * value-map and schedule a flush, which writes `restore[key]` (CSS text) for a key it had
126
- * written, or else the inline value it overwrote, and tells the sink (`onHeld`). A key the
127
- * entry doesn't hold, or an unknown id, is a no-op. A binding releases a key back at its `style`
128
- * value, so a later `style` change shows at rest. A later `write` brings the key back. A property in
129
- * `keep` (`transform` for its keys) is left as it's drawn when it drops out: another writer draws it next.
130
- */
131
- readonly release: (id: string, keys: ReadonlyArray<string>, restore?: Readonly<Record<string, string>>, keep?: ReadonlyArray<string>) => void;
132
- /**
133
- * The element's value for `id`'s `key`, live: an `Atom` set as each write that
134
- * changes it lands, so it's the value the next commit draws, before the Renderer projects it
135
- * (`x` as a number, not a `transform`). Set at the write, not the commit, so a value derived
136
- * from it (another key following it through a binding) is written in the same frame and
137
- * commits with it. `undefined` before the key's first write, and once it's released or the
138
- * element unregisters. One Atom for an id and a key, made on first ask, so per frame only the
139
- * keys asked for cost anything.
140
- */
141
- readonly valueOf: (id: string, key: string) => Atom.Atom<unknown>;
142
- /**
143
- * Run `key`'s Timeline value on `id`'s element (#240), or stop it (`undefined`): a binding sets one
144
- * while the key shows its Live value, and clears it when an entry of the Override stack takes the
145
- * key. The gate goes on writing the key: at each flush that commits the element, before the commit,
146
- * it starts the value's animation over it, or cancels it while something else adds to its property
147
- * (a projection, a Transform template, another transform key off its identity), so a frame shows one
148
- * or the other. A cleared or replaced one is cancelled at the next flush; a released key's, an
149
- * unregistered element's and a disposed gate's, at once. Setting one schedules a flush.
150
- */
151
- readonly timeline: (id: string, key: string, timeline: TimelineValue | undefined) => void;
152
- /**
153
- * Call `fn` once, after the gate's next flush: the end of the Frame loop's tick, for a call
154
- * made in one, else the next Refresh frame's, so what was written before it is on the elements.
155
- * It schedules that flush if none is pending. A binding tells an animation's end here, as Motion's
156
- * `onAnimationComplete` comes with the final value set. One that throws is reported, and the rest
157
- * still run.
158
- */
159
- readonly afterFlush: (fn: () => void) => void;
160
- /** Takes the gate off the Frame loop, cancels a pending frame and clears what it held. The Layer's Scope calls it. */
161
- readonly dispose: () => void;
162
- }
163
- /** What a flush gate needs from its Environment: the `Renderer`, the Frame loop it flushes at the end of each tick of, and the `RefreshFrameSource`. */
164
- export type FlushGateServices = Renderer.Renderer | RefreshFrameSource.RefreshFrameSource | FrameLoop.FrameLoop | AtomRegistry.AtomRegistry;
165
- /**
166
- * How the gate runs its Effects: synchronously, and forked. `FlushGate.make` builds one from its
167
- * Layer's context, forking into its Scope (#132, ADR-0041); a test's `ManagedRuntime` is one too.
168
- */
169
- export interface FlushGateRuntime {
170
- readonly runSync: <A, E>(effect: Effect.Effect<A, E, FlushGateServices>) => A;
171
- readonly runFork: <A, E>(effect: Effect.Effect<A, E, FlushGateServices>) => Fiber.Fiber<A, E>;
172
- /** The Scope it was built in: its own fibers live there, ended as it closes (#618). */
173
- readonly scope: Scope.Scope;
174
- }
175
- /** What a binding hands its flush gate. */
176
- export interface FlushGateOptions {
177
- /**
178
- * Runs a flush's hooks together: calls `apply`, and returns once every update inside it has reached
179
- * the elements, before the gate commits. Solid 1 passes its `batch`, Solid 2 runs `apply` then
180
- * `flush()`, and React would pass `flushSync`, untried; a binding with nothing to batch passes
181
- * `(apply) => apply()`. Called at most twice a flush: once for the starting-style switches
182
- * (`beforeFirstCommit`) of the elements committing for the first time, before anything is read off the
183
- * elements; and once for the held keys (`onHeld`) of the elements whose held keys changed.
184
- */
185
- readonly batch: (apply: () => void) => void;
186
- }
187
- /**
188
- * Build a flush gate against the provider's `runtime`, running each frame flush's Starting-style
189
- * switches through the binding's `batch`.
190
- *
191
- * Resolves both ONCE here: `project` is pure and `commit` a plain call (both called directly at
192
- * flush, ADR-0034), `requestFrame` /
193
- * `cancelFrame` schedule and cancel the flush of a write made outside a tick, and the Frame
194
- * loop's `afterTick` takes the gate's hook for its lifetime. All come from whichever env the
195
- * provider was given (`DomLive` / `TestLive`), so the gate inherits that environment's
196
- * grouping/unit logic, its Refresh frames and its loop with zero duplication.
197
- */
198
- export declare const makeFlushGate: (runtime: FlushGateRuntime, options: FlushGateOptions) => FlushGate;
199
- //# sourceMappingURL=gate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/internal/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,kBAAkB,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,YAAY,MAAM,gCAA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