@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
@@ -122,7 +122,7 @@ import {
122
122
  import { DEFAULT_DRAG_TRANSITION, DEFAULT_LAYOUT_TRANSITION, type DragTransition, type LayoutTransition } from "./projection-defaults.ts"
123
123
  import { counted, watchPage, type Watched } from "./content-watch.ts"
124
124
  import { pending as appearRuns } from "./appear-slot.ts"
125
- import { debugOf, reportFailure } from "./report.ts"
125
+ import * as Report from "@wardic/core/unstable/Report"
126
126
  import { blendRadius, borderRadiusCorrector, isUnitScale, SCALE_CORRECTORS, type ScaleCorrector, type ScaleCorrectorEntry, scaleRadius, ZERO_RADIUS } from "./scale-correction.ts"
127
127
  import { dashCase } from "./svg.ts"
128
128
 
@@ -1728,7 +1728,7 @@ export const makeProjectionSystem = (
1728
1728
  const timing = timingOf(Option.getOrElse(node.transition(), () => DEFAULT_LAYOUT_TRANSITION))
1729
1729
  return { position: 0, elapsed: 0, spring: Spring.init({}), timing, started: false, landed: false, curve: curveOf(node) }
1730
1730
  } catch (defect) {
1731
- runtime.runFork(reportFailure("wardic.projection: layout transition rejected", Cause.die(defect)))
1731
+ runtime.runFork(Report.failure("wardic.projection: layout transition rejected", Cause.die(defect)))
1732
1732
  return landedFlight()
1733
1733
  }
1734
1734
  },
@@ -1766,7 +1766,7 @@ export const makeProjectionSystem = (
1766
1766
  try {
1767
1767
  return releaseFrom(offset, velocity, transition)
1768
1768
  } catch (defect) {
1769
- runtime.runFork(reportFailure("wardic.projection: drag transition rejected", Cause.die(defect)))
1769
+ runtime.runFork(Report.failure("wardic.projection: drag transition rejected", Cause.die(defect)))
1770
1770
  return releaseFrom(ZERO_POINT, ZERO_POINT, DEFAULT_DRAG_TRANSITION)
1771
1771
  }
1772
1772
  }
@@ -1902,7 +1902,7 @@ export const makeProjectionSystem = (
1902
1902
  * the logger is at Debug (observability convention: `wardic.*` + annotated debug
1903
1903
  * logs on lifecycle; the per-frame derive/step hot path stays SILENT).
1904
1904
  */
1905
- const debug = debugOf(runtime, "wardic.projection")
1905
+ const debug = Report.debugOf(runtime, "wardic.projection")
1906
1906
 
1907
1907
  /**
1908
1908
  * Run `expire` at the end of the current task — the next microtask checkpoint,
@@ -1926,7 +1926,7 @@ export const makeProjectionSystem = (
1926
1926
  Microtask.next.pipe(
1927
1927
  Effect.map(expire),
1928
1928
  Effect.flatMap((outcome) => Effect.annotateCurrentSpan(outcome)),
1929
- Effect.tapCause((cause) => reportFailure(`wardic.projection: ${span} failed`, cause)),
1929
+ Effect.tapCause((cause) => Report.failure(`wardic.projection: ${span} failed`, cause)),
1930
1930
  // The app's to give, with no call-site stack (#746; ADR-0040, decision 2).
1931
1931
  Spans.withSpan(span, { attributes }),
1932
1932
  ),
@@ -3769,7 +3769,7 @@ export const makeProjectionSystem = (
3769
3769
  try {
3770
3770
  hook()
3771
3771
  } catch (defect) {
3772
- runtime.runFork(reportFailure(`wardic.projection: an ${name} failed`, Cause.die(defect)))
3772
+ runtime.runFork(Report.failure(`wardic.projection: an ${name} failed`, Cause.die(defect)))
3773
3773
  }
3774
3774
  }
3775
3775
 
@@ -4329,7 +4329,7 @@ export const makeProjectionSystem = (
4329
4329
  try {
4330
4330
  listener()
4331
4331
  } catch (defect) {
4332
- runtime.runFork(reportFailure("wardic.projection: pass-end listener failed", Cause.die(defect)))
4332
+ runtime.runFork(Report.failure("wardic.projection: pass-end listener failed", Cause.die(defect)))
4333
4333
  }
4334
4334
  }
4335
4335
  // This task's Declared layout changes settle once the flights this pass started have ended (#191).
@@ -4430,7 +4430,7 @@ export const makeProjectionSystem = (
4430
4430
  runtime.runFork(
4431
4431
  Microtask.next.pipe(
4432
4432
  Effect.andThen(measurePass),
4433
- Effect.tapCause((cause) => reportFailure("wardic.projection: measure pass failed", cause)),
4433
+ Effect.tapCause((cause) => Report.failure("wardic.projection: measure pass failed", cause)),
4434
4434
  ),
4435
4435
  ),
4436
4436
  )
@@ -4441,7 +4441,7 @@ export const makeProjectionSystem = (
4441
4441
  try {
4442
4442
  callback()
4443
4443
  } catch (defect) {
4444
- runtime.runFork(reportFailure(`wardic.projection: ${name} failed`, Cause.die(defect)))
4444
+ runtime.runFork(Report.failure(`wardic.projection: ${name} failed`, Cause.die(defect)))
4445
4445
  }
4446
4446
  }
4447
4447
 
@@ -4541,7 +4541,7 @@ export const makeProjectionSystem = (
4541
4541
  if (resizeBlocked) return
4542
4542
  const measure = Bool.match(passQueued, { onTrue: () => measurePass, onFalse: () => declaredMeasure })
4543
4543
  const due = passQueued
4544
- runtime.runSync(measure.pipe(Effect.catchCause((cause) => reportFailure("wardic.projection: animateLayout's measure failed", cause))))
4544
+ runtime.runSync(measure.pipe(Effect.catchCause((cause) => Report.failure("wardic.projection: animateLayout's measure failed", cause))))
4545
4545
  // The pass that ran was due at the end of the task: its queued fiber runs that pass now, after the callback.
4546
4546
  if (due) passQueued = true
4547
4547
  declared = true
@@ -5028,7 +5028,7 @@ export const makeProjectionSystem = (
5028
5028
  FiberSet.addUnsafe(
5029
5029
  taskFibers,
5030
5030
  runtime.runFork(
5031
- measurePass.pipe(Effect.tapCause((cause) => reportFailure("wardic.projection: blocked pass failed", cause))),
5031
+ measurePass.pipe(Effect.tapCause((cause) => Report.failure("wardic.projection: blocked pass failed", cause))),
5032
5032
  ),
5033
5033
  )
5034
5034
  }
@@ -5157,14 +5157,14 @@ export const makeProjectionSystem = (
5157
5157
  * The coordinator's end, told apart (ADR-0027, decision 7): a settle, or an
5158
5158
  * interruption (a stop outside its step, the system's dispose), is nothing; anything
5159
5159
  * else (a step that threw, the Frame loop's own failure) is logged and reported
5160
- * (`reportFailure`, ADR-0030 decision 4). Its nodes then wait where the last step left
5160
+ * (`Report.failure`, ADR-0030 decision 4). Its nodes then wait where the last step left
5161
5161
  * them, and the next trigger starts a fresh run.
5162
5162
  */
5163
5163
  const coordinatorEnded = (exit: Exit.Exit<unknown>): Effect.Effect<void> =>
5164
5164
  Exit.match(exit, {
5165
5165
  onSuccess: () => Effect.void,
5166
5166
  onFailure: (cause) =>
5167
- reportFailure("wardic.projection: coordinator failed", cause).pipe(Effect.annotateLogs({ active: active.size })),
5167
+ Report.failure("wardic.projection: coordinator failed", cause).pipe(Effect.annotateLogs({ active: active.size })),
5168
5168
  })
5169
5169
 
5170
5170
  /** Whether the coordinator's run is on the Frame loop: its fiber is still in the handle. */
@@ -5765,7 +5765,7 @@ export const makeProjectionSystem = (
5765
5765
  if (Bool.some([disposed, inPass, passQueued, resizeBlocked, nodes.size === 0])) return
5766
5766
  refreshing = true
5767
5767
  refreshResized = resized
5768
- runtime.runSync(measurePass.pipe(Effect.catchCause((cause) => reportFailure("wardic.projection: refresh failed", cause))))
5768
+ runtime.runSync(measurePass.pipe(Effect.catchCause((cause) => Report.failure("wardic.projection: refresh failed", cause))))
5769
5769
  }
5770
5770
 
5771
5771
  /**
@@ -56,9 +56,9 @@ import * as Str from "effect/String"
56
56
  import * as UndefinedOr from "effect/UndefinedOr"
57
57
  import { documentOf, prepareAnnouncer } from "./announcer.ts"
58
58
  import { type AutoScroller, makeAutoScroller } from "./auto-scroll.ts"
59
- import { debugOf } from "./report.ts"
59
+ import * as Report from "@wardic/core/unstable/Report"
60
60
  import { type Rect, revealLayoutOf, revealRectOf } from "./reveal.ts"
61
- import type { Runner } from "./runner.ts"
61
+ import type * as WardicServices from "@wardic/core/unstable/WardicServices"
62
62
 
63
63
  /**
64
64
  * The group element's style: no scroll anchoring, so the browser doesn't shift the
@@ -75,7 +75,7 @@ export const REORDER_GROUP_STYLE = Object.freeze({ "overflow-anchor": "none" } a
75
75
  */
76
76
  export interface ReorderControllerWiring {
77
77
  /** The runner the controller logs through and waits in. */
78
- readonly runtime: Runner<never>
78
+ readonly runtime: WardicServices.Runner<never>
79
79
  /** The app changed `values`: have the items laid out in it, a Measure pass, or nothing for items the binding places itself. */
80
80
  readonly layOut: () => void
81
81
  /** Speak an **Announcement**: the Environment's `Announcer`. Left out, nothing is announced. */
@@ -259,7 +259,7 @@ export interface ReorderController<V> {
259
259
  /** Build a {@link ReorderController}: a **Reorder group** over `wiring.projection`'s nodes. */
260
260
  export const makeReorderController = <V>(wiring: ReorderControllerWiring, options: ReorderControllerOptions<V>): ReorderController<V> => {
261
261
  const { runtime, announce } = wiring
262
- const debug = debugOf(runtime, "wardic.reorder")
262
+ const debug = Report.debugOf(runtime, "wardic.reorder")
263
263
  // Speak an Announcement, or nothing without an `announce`.
264
264
  const speak = UndefinedOr.match(announce, { onUndefined: () => constVoid, onDefined: identity })
265
265
  const keyboardOn = (): boolean => UndefinedOr.match(options.keyboard, { onUndefined: constTrue, onDefined: (on) => on() })
@@ -6,219 +6,20 @@
6
6
  *
7
7
  * Framework-free, so every binding renders it the same way on a server and on the client
8
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.
9
+ * its own JSX type. The merge `over` does moved here from @wardic/solid with its behaviour
10
+ * unchanged; `over` and `without` are `dual` (#132's PR 3, ADR-0041 decision 5). Tier 2, for
11
+ * binding authors.
12
12
  *
13
13
  * Observability: pure and per element, so quiet (no span, no log).
14
14
  */
15
- import type * as Values from "@wardic/core/Values"
15
+ // #672: its pure half (`toValues`, `resolveInitial`, the Keyframes' stops) is core's
16
+ // `unstable/Stops` now, which `Style` re-exports.
16
17
  import * as Arr from "effect/Array"
17
- import * as Bool from "effect/Boolean"
18
18
  import { dual } from "effect/Function"
19
- import * as Match from "effect/Match"
20
- import * as Option from "effect/Option"
21
19
  import * as Predicate from "effect/Predicate"
22
- import * as Rec from "effect/Record"
23
- import * as UndefinedOr from "effect/UndefinedOr"
24
20
  import { project } from "./renderer.ts"
25
21
  import { dashCase, type SplitPatch, splitPatchForTag } from "./svg.ts"
26
22
 
27
- /**
28
- * A values map with only the keys an animation can take: numbers and strings (custom
29
- * properties included). `undefined` and anything else drop out, so the engine never sees
30
- * them.
31
- */
32
- export const toValues = (v: object | undefined): Values.Values =>
33
- UndefinedOr.match(v, {
34
- onUndefined: (): Values.Values => ({}),
35
- onDefined: (values) => Rec.filter(values as Readonly<Record<string, unknown>>, isAnimatable),
36
- })
37
-
38
- /** Whether a value is one an animation can take: a number or a string. */
39
- const isAnimatable = Predicate.or(Predicate.isNumber, Predicate.isString)
40
-
41
- /** 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). */
42
- // **Keyframes** (#429).
43
- export type Stops = ReadonlyArray<number | string | null>
44
-
45
- /** Where a keyframes value is read: `initial`'s at its first stop, a target's at its last. */
46
- // **Keyframes** (#429).
47
- export type StopAt = "first" | "last"
48
-
49
- /** Whether a stop is one an animation can take, or `null`. */
50
- const isStop = Predicate.or(isAnimatable, Predicate.isNull)
51
-
52
- /**
53
- * A Keyframes value's stop (#429): its first, as Motion's `initial` reads it (`use-visual-state.ts`),
54
- * or its last that isn't `null`, where it rests (Motion's final keyframe, `fill-wildcards.ts`'s).
55
- * `null` or `undefined` when it has none.
56
- */
57
- const stopOf = (stops: ReadonlyArray<unknown>, at: StopAt): unknown =>
58
- Bool.match(at === "first", { onTrue: () => stops[0], onFalse: () => Option.getOrUndefined(Arr.findLast(stops, Predicate.isNotNull)) })
59
-
60
- /** Whether a value is Keyframes an animation can take (#429): an array of stops, one of them not `null`. */
61
- const isStops = (value: unknown): value is Stops => {
62
- if (Bool.not(Arr.isArray(value))) return false
63
- const stops = value as ReadonlyArray<unknown>
64
- return Bool.and(Arr.every(stops, isStop), Arr.some(stops, Predicate.isNotNull))
65
- }
66
-
67
- /**
68
- * The Keyframes {@link keepAnimatable} set aside while it filtered a values map (#452): written by it,
69
- * read and cleared right after, never across a call. A target with none leaves it `undefined`.
70
- */
71
- // Module state (#460, Q7): scratch within one synchronous call, never held across one.
72
- let setAside: Record<string, Stops> | undefined
73
-
74
- /**
75
- * A values map's filter (#452): a value an animation can take stays, and Keyframes go aside, into
76
- * {@link setAside}, so one pass over the keys finds both. Built once, at module load.
77
- */
78
- const keepAnimatable = (value: unknown, key: string): boolean => {
79
- if (Bool.not(Arr.isArray(value))) return isAnimatable(value)
80
- if (isStops(value)) {
81
- if (Predicate.isUndefined(setAside)) setAside = {}
82
- setAside[key] = value
83
- }
84
- return false
85
- }
86
-
87
- /** A values map's numbers and strings, its Keyframes set aside (#452, {@link keepAnimatable}): {@link toValues}' one pass. */
88
- const filtered = (v: object | undefined): Values.Values => {
89
- // Per element at mount (#540): statements and a loop.
90
- setAside = undefined
91
- const out: Record<string, number | string> = {}
92
- if (Predicate.isUndefined(v)) return out
93
- const values = v as Readonly<Record<string, unknown>>
94
- for (const key of Object.keys(values)) {
95
- const value = values[key]
96
- // `keepAnimatable` keeps numbers and strings alone, as `isAnimatable` does.
97
- if (keepAnimatable(value, key)) out[key] = value as number | string
98
- }
99
- return out
100
- }
101
-
102
- /** The Keyframes the last {@link filtered} set aside, taken: `undefined` with none. */
103
- const takeSetAside = (): Readonly<Record<string, Stops>> | undefined => {
104
- const taken = setAside
105
- setAside = undefined
106
- return taken
107
- }
108
-
109
- /** `values` with each of `keyframes` at one of its stops (#429), one with no such stop left out. */
110
- const withStops = (values: Values.Values, keyframes: Readonly<Record<string, Stops>>, at: StopAt): Values.Values => ({
111
- ...values,
112
- ...toValues(Rec.map(keyframes, (stops) => stopOf(stops, at))),
113
- })
114
-
115
- /** A values map's own values and its keyframes: `splitValues`' result. */
116
- // #452.
117
- export interface SplitValues {
118
- /** Its numbers and strings, each Keyframes value at one of its stops. */
119
- readonly values: Values.Values
120
- /** Its Keyframes, if it has any. */
121
- // An `Option` (#618, A1): none is Effect's one `None`, so a target with no Keyframes allocates nothing.
122
- readonly keyframes: Option.Option<Readonly<Record<string, Stops>>>
123
- }
124
-
125
- /**
126
- * A values map's values, each keyframes value read at one of its stops, and its keyframes, in one pass
127
- * over its keys: a target's resolution reads both, and a target with no keyframes makes nothing
128
- * `toValues` doesn't.
129
- */
130
- // **Keyframes** (#429); one pass (#452).
131
- export const splitValues = (v: object | undefined, at: StopAt): SplitValues => {
132
- const values = filtered(v)
133
- const keyframes = takeSetAside()
134
- if (Predicate.isUndefined(keyframes)) return { values, keyframes: Option.none() }
135
- return { values: withStops(values, keyframes, at), keyframes: Option.some(keyframes) }
136
- }
137
-
138
- /**
139
- * A values map with only the keys an animation can take, each keyframes value read at one of its stops:
140
- * `initial`'s first, a target's last. A keyframes value with no such stop drops out, as does an array
141
- * `keyframesOf` doesn't take, and anything that isn't a number or a string. One pass over its keys, as
142
- * `toValues`'.
143
- *
144
- * @example
145
- * Style.valuesAt({ opacity: [0, 0.5, 1], x: 10 }, "first") // { x: 10, opacity: 0 }
146
- */
147
- // **Keyframes** (#429); one pass (#452).
148
- export const valuesAt = (v: object | undefined, at: StopAt): Values.Values => {
149
- const values = filtered(v)
150
- const keyframes = takeSetAside()
151
- if (Predicate.isUndefined(keyframes)) return values
152
- return withStops(values, keyframes, at)
153
- }
154
-
155
- /**
156
- * A values map's keyframes values: each array of stops an animation can take, one with a stop that isn't
157
- * `null`. None when it has none, so a target without any makes nothing.
158
- *
159
- * @example
160
- * Style.keyframesOf({ opacity: [0, 0.5, 1], x: 10 }) // { opacity: [0, 0.5, 1] }
161
- */
162
- // **Keyframes** (#429).
163
- export const keyframesOf = (v: object | undefined): Option.Option<Readonly<Record<string, Stops>>> => splitValues(v, "last").keyframes
164
-
165
- /**
166
- * What of an element's config its starting style is read from. Its values are typed `object`, so a
167
- * binding's own value types fit as they are.
168
- */
169
- export interface InitialConfig {
170
- /**
171
- * Its start: values used as they are, the name of a `variants` entry, a list of names merged in order,
172
- * a later one's winning, or `false`, to start at `animate`, as Motion's `initial={false}`.
173
- */
174
- // #297 (lists); #134 (`false`).
175
- readonly initial?: object | string | ReadonlyArray<string> | false | undefined
176
- /** What `initial: false` starts at: a values map, the name of a `variants` entry, or a list of names. */
177
- readonly animate?: object | string | ReadonlyArray<string> | undefined
178
- /** Its variants: the values each name stands for. */
179
- readonly variants?: Readonly<Record<string, object | undefined>> | undefined
180
- }
181
-
182
- /** One values entry, the variants a name in it would name, and the stop its Keyframes values are read at (#429). */
183
- interface Entry {
184
- readonly entry: object | string | ReadonlyArray<string> | undefined
185
- readonly variants: InitialConfig["variants"]
186
- readonly at: StopAt
187
- }
188
-
189
- /** Whether an entry is a list of names (#297): an array, which a values map never is. */
190
- const isList = (entry: unknown): entry is ReadonlyArray<string> => Arr.isArray(entry)
191
-
192
- /**
193
- * A values map, or the `variants` entry a name names (an unknown name is empty), or nothing.
194
- * Built once, at module load: every element reads its own at setup (#69).
195
- */
196
- const entryOf: (entry: Entry) => Values.Values = Match.type<Entry>().pipe(
197
- Match.when({ entry: Match.undefined }, (): Values.Values => ({})),
198
- Match.when({ entry: Match.string }, ({ entry, variants, at }) => valuesAt(UndefinedOr.map(variants, (byName) => byName[entry]), at)),
199
- // A list's names merged in order, a later one's winning a key both set (#297, Motion's).
200
- Match.when({ entry: isList }, ({ entry, variants, at }) =>
201
- Arr.reduce(entry, {} as Values.Values, (merged, name) => ({ ...merged, ...valuesAt(UndefinedOr.map(variants, (byName) => byName[name]), at) }))),
202
- Match.orElse(({ entry, at }) => valuesAt(entry as object, at)),
203
- )
204
-
205
- /**
206
- * The values an element starts from: its `initial` values, or the `variants` entries its `initial` names,
207
- * an unknown name empty, or nothing. With `initial: false`, its `animate`, resolved the same way, so it
208
- * starts at its target and nothing animates at mount, as Motion's. A keyframes value starts at its first
209
- * stop, or, with `initial: false`, at `animate`'s last, where the animation it skips would end. Read once,
210
- * at setup: the starting style is where it starts, never a live target.
211
- *
212
- * @example
213
- * Style.resolveInitial({ initial: false, animate: { opacity: 1 } }) // { opacity: 1 }
214
- */
215
- // #134, Motion's `initial={false}`; **Keyframes** (#429, Motion's `use-visual-state.ts`).
216
- export const resolveInitial = (config: InitialConfig): Values.Values => {
217
- // Per element at mount (#540): statements.
218
- if (config.initial === false) return entryOf({ entry: config.animate, variants: config.variants, at: "last" })
219
- return entryOf({ entry: config.initial as object | string | ReadonlyArray<string> | undefined, variants: config.variants, at: "first" })
220
- }
221
-
222
23
  /**
223
24
  * A CSS declaration list (`"color: red; background: url(a;b)"`) as `{ property: value }`.
224
25
  * A `;` inside parentheses or quotes doesn't end a declaration. Internal (not in the