@unrulysystems/native-motion-core 0.1.0-alpha.0

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 (326) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +48 -0
  4. package/dist/clock.cjs +71 -0
  5. package/dist/clock.d.cts +23 -0
  6. package/dist/clock.d.ts +23 -0
  7. package/dist/clock.js +66 -0
  8. package/dist/collect-reads.cjs +68 -0
  9. package/dist/collect-reads.d.cts +23 -0
  10. package/dist/collect-reads.d.ts +23 -0
  11. package/dist/collect-reads.js +62 -0
  12. package/dist/component/boundedArray.cjs +74 -0
  13. package/dist/component/boundedArray.d.cts +25 -0
  14. package/dist/component/boundedArray.d.ts +25 -0
  15. package/dist/component/boundedArray.js +68 -0
  16. package/dist/component/index.cjs +57 -0
  17. package/dist/component/index.d.cts +12 -0
  18. package/dist/component/index.d.ts +12 -0
  19. package/dist/component/index.js +22 -0
  20. package/dist/component/orchestration.cjs +129 -0
  21. package/dist/component/orchestration.d.cts +66 -0
  22. package/dist/component/orchestration.d.ts +66 -0
  23. package/dist/component/orchestration.js +124 -0
  24. package/dist/component/resolve.cjs +104 -0
  25. package/dist/component/resolve.d.cts +11 -0
  26. package/dist/component/resolve.d.ts +11 -0
  27. package/dist/component/resolve.js +97 -0
  28. package/dist/component/transition.cjs +352 -0
  29. package/dist/component/transition.d.cts +33 -0
  30. package/dist/component/transition.d.ts +33 -0
  31. package/dist/component/transition.js +339 -0
  32. package/dist/component/types.cjs +114 -0
  33. package/dist/component/types.d.cts +60 -0
  34. package/dist/component/types.d.ts +60 -0
  35. package/dist/component/types.js +111 -0
  36. package/dist/component/validate.cjs +1015 -0
  37. package/dist/component/validate.d.cts +37 -0
  38. package/dist/component/validate.d.ts +37 -0
  39. package/dist/component/validate.js +1002 -0
  40. package/dist/component/variants.cjs +333 -0
  41. package/dist/component/variants.d.cts +106 -0
  42. package/dist/component/variants.d.ts +106 -0
  43. package/dist/component/variants.js +321 -0
  44. package/dist/config/constants.cjs +41 -0
  45. package/dist/config/constants.d.cts +29 -0
  46. package/dist/config/constants.d.ts +29 -0
  47. package/dist/config/constants.js +38 -0
  48. package/dist/delay.cjs +72 -0
  49. package/dist/delay.d.cts +26 -0
  50. package/dist/delay.d.ts +26 -0
  51. package/dist/delay.js +70 -0
  52. package/dist/derived.cjs +143 -0
  53. package/dist/derived.d.cts +41 -0
  54. package/dist/derived.d.ts +41 -0
  55. package/dist/derived.js +139 -0
  56. package/dist/driver/index.cjs +22 -0
  57. package/dist/driver/index.d.cts +7 -0
  58. package/dist/driver/index.d.ts +7 -0
  59. package/dist/driver/index.js +14 -0
  60. package/dist/driver/keyframeTiming.cjs +130 -0
  61. package/dist/driver/keyframeTiming.d.cts +18 -0
  62. package/dist/driver/keyframeTiming.d.ts +18 -0
  63. package/dist/driver/keyframeTiming.js +124 -0
  64. package/dist/driver/keyframeTimingConfig.cjs +24 -0
  65. package/dist/driver/keyframeTimingConfig.d.cts +5 -0
  66. package/dist/driver/keyframeTimingConfig.d.ts +5 -0
  67. package/dist/driver/keyframeTimingConfig.js +22 -0
  68. package/dist/driver/prepare.cjs +459 -0
  69. package/dist/driver/prepare.d.cts +4 -0
  70. package/dist/driver/prepare.d.ts +4 -0
  71. package/dist/driver/prepare.js +454 -0
  72. package/dist/driver/reference.cjs +762 -0
  73. package/dist/driver/reference.d.cts +53 -0
  74. package/dist/driver/reference.d.ts +53 -0
  75. package/dist/driver/reference.js +757 -0
  76. package/dist/driver/step.cjs +55 -0
  77. package/dist/driver/step.d.cts +9 -0
  78. package/dist/driver/step.d.ts +9 -0
  79. package/dist/driver/step.js +52 -0
  80. package/dist/driver/tiers.cjs +40 -0
  81. package/dist/driver/tiers.d.cts +2 -0
  82. package/dist/driver/tiers.d.ts +2 -0
  83. package/dist/driver/tiers.js +37 -0
  84. package/dist/driver/types.cjs +9 -0
  85. package/dist/driver/types.d.cts +68 -0
  86. package/dist/driver/types.d.ts +68 -0
  87. package/dist/driver/types.js +8 -0
  88. package/dist/external-animation-ledger.cjs +1250 -0
  89. package/dist/external-animation-ledger.d.cts +416 -0
  90. package/dist/external-animation-ledger.d.ts +416 -0
  91. package/dist/external-animation-ledger.js +1243 -0
  92. package/dist/gesture/directionLock.cjs +25 -0
  93. package/dist/gesture/directionLock.d.cts +8 -0
  94. package/dist/gesture/directionLock.d.ts +8 -0
  95. package/dist/gesture/directionLock.js +21 -0
  96. package/dist/gesture/dragConfig.cjs +634 -0
  97. package/dist/gesture/dragConfig.d.cts +298 -0
  98. package/dist/gesture/dragConfig.d.ts +298 -0
  99. package/dist/gesture/dragConfig.js +624 -0
  100. package/dist/gesture/elastic.cjs +44 -0
  101. package/dist/gesture/elastic.d.cts +4 -0
  102. package/dist/gesture/elastic.d.ts +4 -0
  103. package/dist/gesture/elastic.js +39 -0
  104. package/dist/gesture/handoffSession.cjs +161 -0
  105. package/dist/gesture/handoffSession.d.cts +35 -0
  106. package/dist/gesture/handoffSession.d.ts +35 -0
  107. package/dist/gesture/handoffSession.js +158 -0
  108. package/dist/gesture/index.cjs +37 -0
  109. package/dist/gesture/index.d.cts +12 -0
  110. package/dist/gesture/index.d.ts +12 -0
  111. package/dist/gesture/index.js +11 -0
  112. package/dist/gesture/projection.cjs +95 -0
  113. package/dist/gesture/projection.d.cts +7 -0
  114. package/dist/gesture/projection.d.ts +7 -0
  115. package/dist/gesture/projection.js +87 -0
  116. package/dist/gesture/session.cjs +162 -0
  117. package/dist/gesture/session.d.cts +29 -0
  118. package/dist/gesture/session.d.ts +29 -0
  119. package/dist/gesture/session.js +158 -0
  120. package/dist/gesture/types.cjs +5 -0
  121. package/dist/gesture/types.d.cts +13 -0
  122. package/dist/gesture/types.d.ts +13 -0
  123. package/dist/gesture/types.js +4 -0
  124. package/dist/gesture/viewportConstraints.cjs +38 -0
  125. package/dist/gesture/viewportConstraints.d.cts +6 -0
  126. package/dist/gesture/viewportConstraints.d.ts +6 -0
  127. package/dist/gesture/viewportConstraints.js +34 -0
  128. package/dist/graph.cjs +226 -0
  129. package/dist/graph.d.cts +2 -0
  130. package/dist/graph.d.ts +2 -0
  131. package/dist/graph.js +223 -0
  132. package/dist/index.cjs +140 -0
  133. package/dist/index.d.cts +33 -0
  134. package/dist/index.d.ts +33 -0
  135. package/dist/index.js +70 -0
  136. package/dist/inertia.cjs +214 -0
  137. package/dist/inertia.d.cts +53 -0
  138. package/dist/inertia.d.ts +53 -0
  139. package/dist/inertia.js +212 -0
  140. package/dist/instant.cjs +66 -0
  141. package/dist/instant.d.cts +16 -0
  142. package/dist/instant.d.ts +16 -0
  143. package/dist/instant.js +63 -0
  144. package/dist/internal-driver.cjs +81 -0
  145. package/dist/internal-driver.d.cts +19 -0
  146. package/dist/internal-driver.d.ts +19 -0
  147. package/dist/internal-driver.js +35 -0
  148. package/dist/keyframes.cjs +191 -0
  149. package/dist/keyframes.d.cts +13 -0
  150. package/dist/keyframes.d.ts +13 -0
  151. package/dist/keyframes.js +188 -0
  152. package/dist/layout/commitDetector.cjs +67 -0
  153. package/dist/layout/commitDetector.d.cts +21 -0
  154. package/dist/layout/commitDetector.d.ts +21 -0
  155. package/dist/layout/commitDetector.js +64 -0
  156. package/dist/layout/compose.cjs +67 -0
  157. package/dist/layout/compose.d.cts +30 -0
  158. package/dist/layout/compose.d.ts +30 -0
  159. package/dist/layout/compose.js +65 -0
  160. package/dist/layout/constants.cjs +13 -0
  161. package/dist/layout/constants.d.cts +6 -0
  162. package/dist/layout/constants.d.ts +6 -0
  163. package/dist/layout/constants.js +10 -0
  164. package/dist/layout/identity.cjs +700 -0
  165. package/dist/layout/identity.d.cts +67 -0
  166. package/dist/layout/identity.d.ts +67 -0
  167. package/dist/layout/identity.js +698 -0
  168. package/dist/layout/index.cjs +36 -0
  169. package/dist/layout/index.d.cts +18 -0
  170. package/dist/layout/index.d.ts +18 -0
  171. package/dist/layout/index.js +13 -0
  172. package/dist/layout/measure.cjs +81 -0
  173. package/dist/layout/measure.d.cts +43 -0
  174. package/dist/layout/measure.d.ts +43 -0
  175. package/dist/layout/measure.js +78 -0
  176. package/dist/layout/projection.cjs +99 -0
  177. package/dist/layout/projection.d.cts +23 -0
  178. package/dist/layout/projection.d.ts +23 -0
  179. package/dist/layout/projection.js +97 -0
  180. package/dist/layout/scroll.cjs +27 -0
  181. package/dist/layout/scroll.d.cts +13 -0
  182. package/dist/layout/scroll.d.ts +13 -0
  183. package/dist/layout/scroll.js +24 -0
  184. package/dist/layout/session.cjs +207 -0
  185. package/dist/layout/session.d.cts +73 -0
  186. package/dist/layout/session.d.ts +73 -0
  187. package/dist/layout/session.js +205 -0
  188. package/dist/layout/tree.cjs +826 -0
  189. package/dist/layout/tree.d.cts +70 -0
  190. package/dist/layout/tree.d.ts +70 -0
  191. package/dist/layout/tree.js +823 -0
  192. package/dist/layout/types.cjs +36 -0
  193. package/dist/layout/types.d.cts +31 -0
  194. package/dist/layout/types.d.ts +31 -0
  195. package/dist/layout/types.js +35 -0
  196. package/dist/motion-arc.cjs +184 -0
  197. package/dist/motion-arc.d.cts +78 -0
  198. package/dist/motion-arc.d.ts +78 -0
  199. package/dist/motion-arc.js +183 -0
  200. package/dist/motion-mix.cjs +205 -0
  201. package/dist/motion-mix.d.cts +3 -0
  202. package/dist/motion-mix.d.ts +3 -0
  203. package/dist/motion-mix.js +202 -0
  204. package/dist/motion-value-driver-port.cjs +636 -0
  205. package/dist/motion-value-driver-port.d.cts +406 -0
  206. package/dist/motion-value-driver-port.d.ts +406 -0
  207. package/dist/motion-value-driver-port.js +627 -0
  208. package/dist/motion-value.cjs +189 -0
  209. package/dist/motion-value.d.cts +51 -0
  210. package/dist/motion-value.d.ts +51 -0
  211. package/dist/motion-value.js +185 -0
  212. package/dist/presence/controller.cjs +657 -0
  213. package/dist/presence/controller.d.cts +6 -0
  214. package/dist/presence/controller.d.ts +6 -0
  215. package/dist/presence/controller.js +652 -0
  216. package/dist/presence/index.cjs +19 -0
  217. package/dist/presence/index.d.cts +4 -0
  218. package/dist/presence/index.d.ts +4 -0
  219. package/dist/presence/index.js +12 -0
  220. package/dist/presence/machine.cjs +50 -0
  221. package/dist/presence/machine.d.cts +10 -0
  222. package/dist/presence/machine.d.ts +10 -0
  223. package/dist/presence/machine.js +46 -0
  224. package/dist/presence/types.cjs +6 -0
  225. package/dist/presence/types.d.cts +32 -0
  226. package/dist/presence/types.d.ts +32 -0
  227. package/dist/presence/types.js +5 -0
  228. package/dist/repeat.cjs +311 -0
  229. package/dist/repeat.d.cts +174 -0
  230. package/dist/repeat.d.ts +174 -0
  231. package/dist/repeat.js +300 -0
  232. package/dist/spring.cjs +128 -0
  233. package/dist/spring.d.cts +18 -0
  234. package/dist/spring.d.ts +18 -0
  235. package/dist/spring.js +125 -0
  236. package/dist/subscriptions.cjs +74 -0
  237. package/dist/subscriptions.d.cts +19 -0
  238. package/dist/subscriptions.d.ts +19 -0
  239. package/dist/subscriptions.js +69 -0
  240. package/dist/subset/index.cjs +23 -0
  241. package/dist/subset/index.d.cts +6 -0
  242. package/dist/subset/index.d.ts +6 -0
  243. package/dist/subset/index.js +13 -0
  244. package/dist/subset/normalize.cjs +90 -0
  245. package/dist/subset/normalize.d.cts +10 -0
  246. package/dist/subset/normalize.d.ts +10 -0
  247. package/dist/subset/normalize.js +85 -0
  248. package/dist/subset/registry.cjs +259 -0
  249. package/dist/subset/registry.d.cts +25 -0
  250. package/dist/subset/registry.d.ts +25 -0
  251. package/dist/subset/registry.js +256 -0
  252. package/dist/subset/resolve.cjs +98 -0
  253. package/dist/subset/resolve.d.cts +24 -0
  254. package/dist/subset/resolve.d.ts +24 -0
  255. package/dist/subset/resolve.js +90 -0
  256. package/dist/timing.cjs +206 -0
  257. package/dist/timing.d.cts +17 -0
  258. package/dist/timing.d.ts +17 -0
  259. package/dist/timing.js +201 -0
  260. package/dist/transformTemplate.cjs +219 -0
  261. package/dist/transformTemplate.d.cts +29 -0
  262. package/dist/transformTemplate.d.ts +29 -0
  263. package/dist/transformTemplate.js +215 -0
  264. package/dist/transition.cjs +231 -0
  265. package/dist/transition.d.cts +89 -0
  266. package/dist/transition.d.ts +89 -0
  267. package/dist/transition.js +223 -0
  268. package/dist/types.cjs +4 -0
  269. package/dist/types.d.cts +175 -0
  270. package/dist/types.d.ts +175 -0
  271. package/dist/types.js +3 -0
  272. package/dist/value-types/color.cjs +220 -0
  273. package/dist/value-types/color.d.cts +19 -0
  274. package/dist/value-types/color.d.ts +19 -0
  275. package/dist/value-types/color.js +218 -0
  276. package/dist/value-types/complex.cjs +160 -0
  277. package/dist/value-types/complex.d.cts +19 -0
  278. package/dist/value-types/complex.d.ts +19 -0
  279. package/dist/value-types/complex.js +155 -0
  280. package/dist/value-types/constants.cjs +15 -0
  281. package/dist/value-types/constants.d.cts +6 -0
  282. package/dist/value-types/constants.d.ts +6 -0
  283. package/dist/value-types/constants.js +12 -0
  284. package/dist/value-types/discrete.cjs +62 -0
  285. package/dist/value-types/discrete.d.cts +4 -0
  286. package/dist/value-types/discrete.d.ts +4 -0
  287. package/dist/value-types/discrete.js +56 -0
  288. package/dist/value-types/index.cjs +59 -0
  289. package/dist/value-types/index.d.cts +14 -0
  290. package/dist/value-types/index.d.ts +14 -0
  291. package/dist/value-types/index.js +24 -0
  292. package/dist/value-types/measure-resolve.cjs +325 -0
  293. package/dist/value-types/measure-resolve.d.cts +91 -0
  294. package/dist/value-types/measure-resolve.d.ts +91 -0
  295. package/dist/value-types/measure-resolve.js +313 -0
  296. package/dist/value-types/mix.cjs +90 -0
  297. package/dist/value-types/mix.d.cts +27 -0
  298. package/dist/value-types/mix.d.ts +27 -0
  299. package/dist/value-types/mix.js +85 -0
  300. package/dist/value-types/named-colors.cjs +61 -0
  301. package/dist/value-types/named-colors.d.cts +2 -0
  302. package/dist/value-types/named-colors.d.ts +2 -0
  303. package/dist/value-types/named-colors.js +58 -0
  304. package/dist/value-types/numeric.cjs +86 -0
  305. package/dist/value-types/numeric.d.cts +16 -0
  306. package/dist/value-types/numeric.d.ts +16 -0
  307. package/dist/value-types/numeric.js +79 -0
  308. package/dist/worklet-layout/config/constants.js +39 -0
  309. package/dist/worklet-layout/layout/constants.js +11 -0
  310. package/dist/worklet-layout/layout/identity.js +699 -0
  311. package/dist/worklet-layout/layout/projection.js +98 -0
  312. package/dist/worklet-layout/layout/session.js +206 -0
  313. package/dist/worklet-layout/layout/tree.js +824 -0
  314. package/dist/worklet-layout/layout/types.js +36 -0
  315. package/dist/worklet-layout/spring.js +125 -0
  316. package/dist/worklet-layout/timing.js +201 -0
  317. package/dist/worklet-layout/transition.js +223 -0
  318. package/dist/worklet-layout.cjs +47 -0
  319. package/dist/worklet-layout.d.cts +15 -0
  320. package/dist/worklet-layout.d.ts +15 -0
  321. package/dist/worklet-layout.js +28 -0
  322. package/dist/wrap.cjs +7 -0
  323. package/dist/wrap.d.cts +1 -0
  324. package/dist/wrap.d.ts +1 -0
  325. package/dist/wrap.js +4 -0
  326. package/package.json +45 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ // Public surface of the SPEC-COMPONENT subsystem: the declarative Motion.View API contract. Host-agnostic
3
+ // (REQ-CORE-003) — the native runtime, the web shim, and the conformance runner all consume this one
4
+ // module. Re-exported additively from the core index. The end-state types land first (Milestone 1); the
5
+ // loud-fail `validateTarget` (Milestone 2) and the partial-overlay `resolveTarget` (Milestone 3) join this
6
+ // surface as they land.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.resolveTarget = exports.resolveStartValue = exports.hostBaseValue = exports.DiscreteHostBaseError = exports.variantsShapeRefusal = exports.validateVariantEntrySnapshot = exports.validateVariantEntry = exports.resolveVariantDefinition = exports.resolveInitialOverlay = exports.InvalidVariantError = exports.flattenVariantApplications = exports.assertVariantsShape = exports.validateTransitionRefusal = exports.validateTransition = exports.validateTargetSnapshot = exports.validateTargetRefusal = exports.validateTarget = exports.targetShapeRefusal = exports.InvalidTransitionError = exports.InvalidTargetError = exports.assertTargetShape = exports.toRepeatFoldOptions = exports.toKeyframesConfig = exports.toTimingConfig = exports.toSpringConfig = exports.toDelayMs = exports.stagger = exports.resolveOrchestrationEpisode = exports.resolveChildOrchestrationDelay = exports.TRANSITION_OPTION_KEYS = exports.TARGET_PROPERTY_KEYS = exports.ORCHESTRATION_OPTION_KEYS = void 0;
9
+ var types_1 = require("./types.cjs");
10
+ Object.defineProperty(exports, "ORCHESTRATION_OPTION_KEYS", { enumerable: true, get: function () { return types_1.ORCHESTRATION_OPTION_KEYS; } });
11
+ Object.defineProperty(exports, "TARGET_PROPERTY_KEYS", { enumerable: true, get: function () { return types_1.TARGET_PROPERTY_KEYS; } });
12
+ Object.defineProperty(exports, "TRANSITION_OPTION_KEYS", { enumerable: true, get: function () { return types_1.TRANSITION_OPTION_KEYS; } });
13
+ // T21 (REQ-API-053): variant orchestration — the public stagger() helper the catalog imports,
14
+ // plus the tree-lane per-child delay resolver the native controller and web shim consume.
15
+ var orchestration_1 = require("./orchestration.cjs");
16
+ Object.defineProperty(exports, "resolveChildOrchestrationDelay", { enumerable: true, get: function () { return orchestration_1.resolveChildOrchestrationDelay; } });
17
+ Object.defineProperty(exports, "resolveOrchestrationEpisode", { enumerable: true, get: function () { return orchestration_1.resolveOrchestrationEpisode; } });
18
+ Object.defineProperty(exports, "stagger", { enumerable: true, get: function () { return orchestration_1.stagger; } });
19
+ // Transition unit boundary (REQ-API-001): convert the public seconds-based Transition to the internal
20
+ // millisecond SPRING/TIMING resolver configs. The single seconds↔ms crossing — no internal unit leaks.
21
+ // Family-2 host helpers (effectiveTransitionEase / normalizeTransitionEaseAlias) are NOT public —
22
+ // they ride `internal-driver` (implementation seam; 00i0nt public-surface).
23
+ var transition_1 = require("./transition.cjs");
24
+ Object.defineProperty(exports, "toDelayMs", { enumerable: true, get: function () { return transition_1.toDelayMs; } });
25
+ Object.defineProperty(exports, "toSpringConfig", { enumerable: true, get: function () { return transition_1.toSpringConfig; } });
26
+ Object.defineProperty(exports, "toTimingConfig", { enumerable: true, get: function () { return transition_1.toTimingConfig; } });
27
+ Object.defineProperty(exports, "toKeyframesConfig", { enumerable: true, get: function () { return transition_1.toKeyframesConfig; } });
28
+ Object.defineProperty(exports, "toRepeatFoldOptions", { enumerable: true, get: function () { return transition_1.toRepeatFoldOptions; } });
29
+ // Loud-fail runtime validator (REQ-API-013/014/016): the fail-closed backstop for what the Target type
30
+ // cannot catch (units, ranges, untyped callers), with descriptive component-scoped errors.
31
+ var validate_1 = require("./validate.cjs");
32
+ Object.defineProperty(exports, "assertTargetShape", { enumerable: true, get: function () { return validate_1.assertTargetShape; } });
33
+ Object.defineProperty(exports, "InvalidTargetError", { enumerable: true, get: function () { return validate_1.InvalidTargetError; } });
34
+ Object.defineProperty(exports, "InvalidTransitionError", { enumerable: true, get: function () { return validate_1.InvalidTransitionError; } });
35
+ Object.defineProperty(exports, "targetShapeRefusal", { enumerable: true, get: function () { return validate_1.targetShapeRefusal; } });
36
+ Object.defineProperty(exports, "validateTarget", { enumerable: true, get: function () { return validate_1.validateTarget; } });
37
+ Object.defineProperty(exports, "validateTargetRefusal", { enumerable: true, get: function () { return validate_1.validateTargetRefusal; } });
38
+ Object.defineProperty(exports, "validateTargetSnapshot", { enumerable: true, get: function () { return validate_1.validateTargetSnapshot; } });
39
+ Object.defineProperty(exports, "validateTransition", { enumerable: true, get: function () { return validate_1.validateTransition; } });
40
+ Object.defineProperty(exports, "validateTransitionRefusal", { enumerable: true, get: function () { return validate_1.validateTransitionRefusal; } });
41
+ var variants_1 = require("./variants.cjs");
42
+ Object.defineProperty(exports, "assertVariantsShape", { enumerable: true, get: function () { return variants_1.assertVariantsShape; } });
43
+ Object.defineProperty(exports, "flattenVariantApplications", { enumerable: true, get: function () { return variants_1.flattenVariantApplications; } });
44
+ Object.defineProperty(exports, "InvalidVariantError", { enumerable: true, get: function () { return variants_1.InvalidVariantError; } });
45
+ Object.defineProperty(exports, "resolveInitialOverlay", { enumerable: true, get: function () { return variants_1.resolveInitialOverlay; } });
46
+ Object.defineProperty(exports, "resolveVariantDefinition", { enumerable: true, get: function () { return variants_1.resolveVariantDefinition; } });
47
+ Object.defineProperty(exports, "validateVariantEntry", { enumerable: true, get: function () { return variants_1.validateVariantEntry; } });
48
+ Object.defineProperty(exports, "validateVariantEntrySnapshot", { enumerable: true, get: function () { return variants_1.validateVariantEntrySnapshot; } });
49
+ Object.defineProperty(exports, "variantsShapeRefusal", { enumerable: true, get: function () { return variants_1.variantsShapeRefusal; } });
50
+ // Pure target-merge + base-resolution (REQ-API-002/010/011/012/017): resolveTarget overlays a partial
51
+ // target onto the live value set (hold, never reset); resolveStartValue/hostBaseValue resolve a first-seen
52
+ // property's starting value from the resolved style, else the documented host base. Deterministic seam.
53
+ var resolve_1 = require("./resolve.cjs");
54
+ Object.defineProperty(exports, "DiscreteHostBaseError", { enumerable: true, get: function () { return resolve_1.DiscreteHostBaseError; } });
55
+ Object.defineProperty(exports, "hostBaseValue", { enumerable: true, get: function () { return resolve_1.hostBaseValue; } });
56
+ Object.defineProperty(exports, "resolveStartValue", { enumerable: true, get: function () { return resolve_1.resolveStartValue; } });
57
+ Object.defineProperty(exports, "resolveTarget", { enumerable: true, get: function () { return resolve_1.resolveTarget; } });
@@ -0,0 +1,12 @@
1
+ export type { MotionTargetProps, Target, TargetPropertyKey, Transition, TransitionMapKey, TransitionOptionBag, TransitionType, VariantLabels, } from "./types.cjs";
2
+ export { ORCHESTRATION_OPTION_KEYS, TARGET_PROPERTY_KEYS, TRANSITION_OPTION_KEYS } from "./types.cjs";
3
+ export { resolveChildOrchestrationDelay, resolveOrchestrationEpisode, stagger, } from "./orchestration.cjs";
4
+ export type { ChildOrchestrationInput, DynamicDelay, OrchestrationEpisode, OrchestrationEpisodeInput, StaggerEase, StaggerOptions, StaggerOrigin, } from "./orchestration.cjs";
5
+ export { toDelayMs, toSpringConfig, toTimingConfig, toKeyframesConfig, toRepeatFoldOptions, } from "./transition.cjs";
6
+ export type { RepeatFoldOptions } from "./transition.cjs";
7
+ export { assertTargetShape, InvalidTargetError, InvalidTransitionError, targetShapeRefusal, validateTarget, validateTargetRefusal, validateTargetSnapshot, validateTransition, validateTransitionRefusal, } from "./validate.cjs";
8
+ export { assertVariantsShape, flattenVariantApplications, InvalidVariantError, resolveInitialOverlay, resolveVariantDefinition, validateVariantEntry, validateVariantEntrySnapshot, variantsShapeRefusal, } from "./variants.cjs";
9
+ export type { FlattenedVariantApplications, VariantApplication, VariantEntry, VariantResolutionContext, VariantResolver, VariantsDictionary, } from "./variants.cjs";
10
+ export type { ValidateTargetOptions } from "./validate.cjs";
11
+ export { DiscreteHostBaseError, hostBaseValue, resolveStartValue, resolveTarget } from "./resolve.cjs";
12
+ export type { ResolvedTargetValue, ResolvedValue, StartResolution } from "./resolve.cjs";
@@ -0,0 +1,12 @@
1
+ export type { MotionTargetProps, Target, TargetPropertyKey, Transition, TransitionMapKey, TransitionOptionBag, TransitionType, VariantLabels, } from "./types.js";
2
+ export { ORCHESTRATION_OPTION_KEYS, TARGET_PROPERTY_KEYS, TRANSITION_OPTION_KEYS } from "./types.js";
3
+ export { resolveChildOrchestrationDelay, resolveOrchestrationEpisode, stagger, } from "./orchestration.js";
4
+ export type { ChildOrchestrationInput, DynamicDelay, OrchestrationEpisode, OrchestrationEpisodeInput, StaggerEase, StaggerOptions, StaggerOrigin, } from "./orchestration.js";
5
+ export { toDelayMs, toSpringConfig, toTimingConfig, toKeyframesConfig, toRepeatFoldOptions, } from "./transition.js";
6
+ export type { RepeatFoldOptions } from "./transition.js";
7
+ export { assertTargetShape, InvalidTargetError, InvalidTransitionError, targetShapeRefusal, validateTarget, validateTargetRefusal, validateTargetSnapshot, validateTransition, validateTransitionRefusal, } from "./validate.js";
8
+ export { assertVariantsShape, flattenVariantApplications, InvalidVariantError, resolveInitialOverlay, resolveVariantDefinition, validateVariantEntry, validateVariantEntrySnapshot, variantsShapeRefusal, } from "./variants.js";
9
+ export type { FlattenedVariantApplications, VariantApplication, VariantEntry, VariantResolutionContext, VariantResolver, VariantsDictionary, } from "./variants.js";
10
+ export type { ValidateTargetOptions } from "./validate.js";
11
+ export { DiscreteHostBaseError, hostBaseValue, resolveStartValue, resolveTarget } from "./resolve.js";
12
+ export type { ResolvedTargetValue, ResolvedValue, StartResolution } from "./resolve.js";
@@ -0,0 +1,22 @@
1
+ // Public surface of the SPEC-COMPONENT subsystem: the declarative Motion.View API contract. Host-agnostic
2
+ // (REQ-CORE-003) — the native runtime, the web shim, and the conformance runner all consume this one
3
+ // module. Re-exported additively from the core index. The end-state types land first (Milestone 1); the
4
+ // loud-fail `validateTarget` (Milestone 2) and the partial-overlay `resolveTarget` (Milestone 3) join this
5
+ // surface as they land.
6
+ export { ORCHESTRATION_OPTION_KEYS, TARGET_PROPERTY_KEYS, TRANSITION_OPTION_KEYS } from "./types.js";
7
+ // T21 (REQ-API-053): variant orchestration — the public stagger() helper the catalog imports,
8
+ // plus the tree-lane per-child delay resolver the native controller and web shim consume.
9
+ export { resolveChildOrchestrationDelay, resolveOrchestrationEpisode, stagger, } from "./orchestration.js";
10
+ // Transition unit boundary (REQ-API-001): convert the public seconds-based Transition to the internal
11
+ // millisecond SPRING/TIMING resolver configs. The single seconds↔ms crossing — no internal unit leaks.
12
+ // Family-2 host helpers (effectiveTransitionEase / normalizeTransitionEaseAlias) are NOT public —
13
+ // they ride `internal-driver` (implementation seam; 00i0nt public-surface).
14
+ export { toDelayMs, toSpringConfig, toTimingConfig, toKeyframesConfig, toRepeatFoldOptions, } from "./transition.js";
15
+ // Loud-fail runtime validator (REQ-API-013/014/016): the fail-closed backstop for what the Target type
16
+ // cannot catch (units, ranges, untyped callers), with descriptive component-scoped errors.
17
+ export { assertTargetShape, InvalidTargetError, InvalidTransitionError, targetShapeRefusal, validateTarget, validateTargetRefusal, validateTargetSnapshot, validateTransition, validateTransitionRefusal, } from "./validate.js";
18
+ export { assertVariantsShape, flattenVariantApplications, InvalidVariantError, resolveInitialOverlay, resolveVariantDefinition, validateVariantEntry, validateVariantEntrySnapshot, variantsShapeRefusal, } from "./variants.js";
19
+ // Pure target-merge + base-resolution (REQ-API-002/010/011/012/017): resolveTarget overlays a partial
20
+ // target onto the live value set (hold, never reset); resolveStartValue/hostBaseValue resolve a first-seen
21
+ // property's starting value from the resolved style, else the documented host base. Deterministic seam.
22
+ export { DiscreteHostBaseError, hostBaseValue, resolveStartValue, resolveTarget } from "./resolve.js";
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ // SPEC-COMPONENT §2 — variant orchestration math (REQ-API-053, T21). The pure tree-lane layer
3
+ // under `delayChildren` / `staggerChildren` / `staggerDirection`: `stagger()` (the public
4
+ // authoring helper the catalog imports from the package root) and the per-child delay resolver
5
+ // replicating the pinned composition (motion-dom@12.42.2 `visual-element-variant.ts:92-103` +
6
+ // `calc-child-stagger.ts` + `utils/stagger.ts`), golden-pinned per sample in
7
+ // `orchestration.test.ts`. Host-agnostic (REQ-CORE-003) — relative imports only. Orchestration
8
+ // never crosses to the UI runtime: this runs on the JS thread at start-scheduling time, so plain
9
+ // function values (a `stagger()` result) are legal here — and ONLY here (the transition
10
+ // converters strip the family, so no function ever reaches a driver or a worklet crossing).
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.stagger = stagger;
13
+ exports.resolveChildOrchestrationDelay = resolveChildOrchestrationDelay;
14
+ exports.resolveOrchestrationEpisode = resolveOrchestrationEpisode;
15
+ const timing_1 = require("../timing.cjs");
16
+ const validate_1 = require("./validate.cjs");
17
+ // The pin's getOriginIndex (utils/stagger.ts): 'first' → 0, 'last' → total − 1,
18
+ // 'center' → (total − 1) / 2. A numeric origin is used as-is by the caller.
19
+ function staggerOriginIndex(from, total) {
20
+ if (from === 'first')
21
+ return 0;
22
+ const lastIndex = total - 1;
23
+ return from === 'last' ? lastIndex : lastIndex / 2;
24
+ }
25
+ /**
26
+ * The public stagger() helper (REQ-API-053) — pin-verbatim math: delay = duration × |origin − i|,
27
+ * optionally warped by `ease` over maxDelay = total × duration, plus `startDelay`. Seconds, like
28
+ * every public time. Malformed inputs fail loud at FACTORY time (G-INV-8) — the pin silently
29
+ * emits NaN delays instead, a misauthoring this engine refuses.
30
+ */
31
+ function stagger(duration = 0.1, options = {}) {
32
+ if (typeof duration !== 'number' || !Number.isFinite(duration)) {
33
+ throw new Error(`stagger: duration must be a finite number of seconds, got ${String(duration)} (REQ-API-053)`);
34
+ }
35
+ const { startDelay = 0, from = 0, ease } = options;
36
+ if (typeof startDelay !== 'number' || !Number.isFinite(startDelay)) {
37
+ throw new Error(`stagger: startDelay must be a finite number of seconds, got ${String(startDelay)} (REQ-API-053)`);
38
+ }
39
+ const validOrigin = from === 'first' ||
40
+ from === 'last' ||
41
+ from === 'center' ||
42
+ (typeof from === 'number' && Number.isFinite(from));
43
+ if (!validOrigin) {
44
+ throw new Error(`stagger: from must be 'first', 'last', 'center', or a finite index, got ${String(from)} (REQ-API-053)`);
45
+ }
46
+ // Resolve the easing EAGERLY so an unknown named curve or malformed bezier throws at the
47
+ // authoring site, not on the first child start. resolveEasing owns that refusal.
48
+ const easingFunction = ease === undefined ? undefined : typeof ease === 'function' ? ease : (0, timing_1.resolveEasing)(ease);
49
+ return (index, total) => {
50
+ const fromIndex = typeof from === 'number' ? from : staggerOriginIndex(from, total);
51
+ const distance = Math.abs(fromIndex - index);
52
+ let delay = duration * distance;
53
+ if (easingFunction !== undefined) {
54
+ const maxDelay = total * duration;
55
+ delay = easingFunction(delay / maxDelay) * maxDelay;
56
+ }
57
+ return startDelay + delay;
58
+ };
59
+ }
60
+ /**
61
+ * Per-child start delay, exactly the pinned composition (visual-element-variant.ts:92-103):
62
+ * forwarded + (function delayChildren ? 0 : numeric delayChildren) + stagger term, where a
63
+ * FUNCTION delayChildren displaces staggerChildren/staggerDirection entirely and the numeric
64
+ * term is index × staggerChildren (direction 1) or (total − 1) × staggerChildren − index ×
65
+ * staggerChildren (direction −1). Operation order is preserved for float-exact golden parity.
66
+ */
67
+ function resolveChildOrchestrationDelay(input) {
68
+ const { forwardedDelay, delayChildren, staggerChildren = 0, staggerDirection = 1, index, total, } = input;
69
+ if (!Number.isInteger(index) ||
70
+ !Number.isInteger(total) ||
71
+ total < 1 ||
72
+ index < 0 ||
73
+ index >= total) {
74
+ // Callers derive (index, total) from the live child registry; an out-of-range pair is the
75
+ // registry's bookkeeping broken — fail loud, never emit a silently-wrong delay.
76
+ throw new Error(`resolveChildOrchestrationDelay: index ${String(index)} outside [0, ${String(total)}) — ` +
77
+ 'the variant child registry is inconsistent (internal invariant, REQ-API-053)');
78
+ }
79
+ const delayIsFunction = typeof delayChildren === 'function';
80
+ const staggerTerm = delayIsFunction
81
+ ? executeDynamicDelay(delayChildren, index, total)
82
+ : staggerDirection === 1
83
+ ? index * staggerChildren
84
+ : (total - 1) * staggerChildren - index * staggerChildren;
85
+ return forwardedDelay + (delayIsFunction ? 0 : (delayChildren ?? 0)) + staggerTerm;
86
+ }
87
+ // The DynamicDelay EXECUTION boundary (review r1 major 6): validate admits arbitrary functions,
88
+ // so the call itself is where user input can misbehave. Both failure shapes surface as the same
89
+ // typed class the validation boundary throws, so the host severity seam catches them under the
90
+ // one policy (development throws; production reports and refuses the property). The pin emits
91
+ // NaN delays here; this engine refuses (G-INV-8).
92
+ function executeDynamicDelay(delayChildren, index, total) {
93
+ let result;
94
+ try {
95
+ result = delayChildren(index, total);
96
+ }
97
+ catch (error) {
98
+ throw new validate_1.InvalidTransitionError(undefined, 'delayChildren', delayChildren, `the dynamic delay callback threw at (index ${String(index)}, total ${String(total)}): ` +
99
+ `${String(error)} (REQ-API-053)`);
100
+ }
101
+ if (typeof result !== 'number' || !Number.isFinite(result)) {
102
+ throw new validate_1.InvalidTransitionError(undefined, 'delayChildren', result, `the dynamic delay callback must return finite seconds, got ${String(result)} at ` +
103
+ `(index ${String(index)}, total ${String(total)}) (REQ-API-053)`);
104
+ }
105
+ return result;
106
+ }
107
+ /**
108
+ * Resolve a parent's tree-level transition bag into the episode its direct children compose
109
+ * against (pin: visual-element-variant.ts:71-103). Two laws beyond extraction: what forwards
110
+ * to children is `nodeStartDelay` — the delay THIS node's own start was computed with (its
111
+ * orchestration-computed delay from its own parent; 0 at a controlling root) — never the
112
+ * bag's authored `delay`, which rides only the node's own values (F4); and a truthy `when`
113
+ * SEQUENCES own-values vs children with the sequenced branch passing `delay: 0` to
114
+ * `animateChildren` (the no-arg call), while `delayChildren`/stagger apply in both branches.
115
+ */
116
+ function resolveOrchestrationEpisode(bag, nodeStartDelay = 0) {
117
+ if (!Number.isFinite(nodeStartDelay)) {
118
+ throw new Error(`resolveOrchestrationEpisode: nodeStartDelay must be finite seconds, got ${String(nodeStartDelay)} ` +
119
+ '— the caller cascades its own computed start delay (internal invariant, REQ-API-053)');
120
+ }
121
+ const when = bag.when ?? false;
122
+ return {
123
+ forwardedDelay: when === false ? nodeStartDelay : 0,
124
+ delayChildren: bag.delayChildren,
125
+ staggerChildren: bag.staggerChildren,
126
+ staggerDirection: bag.staggerDirection,
127
+ when,
128
+ };
129
+ }
@@ -0,0 +1,66 @@
1
+ import { type Easing } from "../timing.cjs";
2
+ export type StaggerOrigin = 'first' | 'last' | 'center' | number;
3
+ /** (index, total) → seconds. The public `delayChildren` function form — what `stagger()` returns. */
4
+ export type DynamicDelay = (index: number, total: number) => number;
5
+ export type StaggerEase = Easing | ((progress: number) => number);
6
+ export interface StaggerOptions {
7
+ readonly startDelay?: number;
8
+ readonly from?: StaggerOrigin;
9
+ readonly ease?: StaggerEase;
10
+ }
11
+ /**
12
+ * The public stagger() helper (REQ-API-053) — pin-verbatim math: delay = duration × |origin − i|,
13
+ * optionally warped by `ease` over maxDelay = total × duration, plus `startDelay`. Seconds, like
14
+ * every public time. Malformed inputs fail loud at FACTORY time (G-INV-8) — the pin silently
15
+ * emits NaN delays instead, a misauthoring this engine refuses.
16
+ */
17
+ export declare function stagger(duration?: number, options?: StaggerOptions): DynamicDelay;
18
+ export interface ChildOrchestrationInput {
19
+ /** The pin's `animateChildren` forwarded delay: `options.delay` on the parallel branch, 0 on a `when`-sequenced branch. */
20
+ readonly forwardedDelay: number;
21
+ readonly delayChildren?: number | DynamicDelay | undefined;
22
+ readonly staggerChildren?: number | undefined;
23
+ readonly staggerDirection?: number | undefined;
24
+ /** Position among the parent's DIRECT variant children in tree order (native authority: mount registration order — packet L3). */
25
+ readonly index: number;
26
+ readonly total: number;
27
+ }
28
+ /**
29
+ * Per-child start delay, exactly the pinned composition (visual-element-variant.ts:92-103):
30
+ * forwarded + (function delayChildren ? 0 : numeric delayChildren) + stagger term, where a
31
+ * FUNCTION delayChildren displaces staggerChildren/staggerDirection entirely and the numeric
32
+ * term is index × staggerChildren (direction 1) or (total − 1) × staggerChildren − index ×
33
+ * staggerChildren (direction −1). Operation order is preserved for float-exact golden parity.
34
+ */
35
+ export declare function resolveChildOrchestrationDelay(input: ChildOrchestrationInput): number;
36
+ /**
37
+ * One orchestration EPISODE as the parent's direct children consume it (T21, REQ-API-053): the
38
+ * four tree-lane options plus the delay the parent forwards. Built per label edge from the
39
+ * parent's RESOLVED variant transition by `resolveOrchestrationEpisode`.
40
+ */
41
+ export interface OrchestrationEpisode {
42
+ /** What `animateChildren` receives as `delay`: the node's CASCADED start delay in the
43
+ * parallel branch (the pin forwards `options.delay` — the delay this node's own start was
44
+ * computed with, NOT its authored transition `delay`), 0 when `when` sequences (the pin's
45
+ * no-arg `getChildAnimations()` call — packet law 3; corrected by F4). */
46
+ readonly forwardedDelay: number;
47
+ readonly delayChildren?: number | DynamicDelay | undefined;
48
+ readonly staggerChildren?: number | undefined;
49
+ readonly staggerDirection?: number | undefined;
50
+ /** Normalized: absent authoring reads as `false` (parallel). */
51
+ readonly when: false | 'beforeChildren' | 'afterChildren';
52
+ }
53
+ /** The orchestration-relevant slice of a resolved tree-level transition bag. The authored
54
+ * `delay` is deliberately NOT here — it rides the node's OWN values only (the pin's
55
+ * getValueTransition), never the children (F4). */
56
+ export type OrchestrationEpisodeInput = Pick<import('./types').TransitionOptionBag, 'when' | 'delayChildren' | 'staggerChildren' | 'staggerDirection'>;
57
+ /**
58
+ * Resolve a parent's tree-level transition bag into the episode its direct children compose
59
+ * against (pin: visual-element-variant.ts:71-103). Two laws beyond extraction: what forwards
60
+ * to children is `nodeStartDelay` — the delay THIS node's own start was computed with (its
61
+ * orchestration-computed delay from its own parent; 0 at a controlling root) — never the
62
+ * bag's authored `delay`, which rides only the node's own values (F4); and a truthy `when`
63
+ * SEQUENCES own-values vs children with the sequenced branch passing `delay: 0` to
64
+ * `animateChildren` (the no-arg call), while `delayChildren`/stagger apply in both branches.
65
+ */
66
+ export declare function resolveOrchestrationEpisode(bag: OrchestrationEpisodeInput, nodeStartDelay?: number): OrchestrationEpisode;
@@ -0,0 +1,66 @@
1
+ import { type Easing } from "../timing.js";
2
+ export type StaggerOrigin = 'first' | 'last' | 'center' | number;
3
+ /** (index, total) → seconds. The public `delayChildren` function form — what `stagger()` returns. */
4
+ export type DynamicDelay = (index: number, total: number) => number;
5
+ export type StaggerEase = Easing | ((progress: number) => number);
6
+ export interface StaggerOptions {
7
+ readonly startDelay?: number;
8
+ readonly from?: StaggerOrigin;
9
+ readonly ease?: StaggerEase;
10
+ }
11
+ /**
12
+ * The public stagger() helper (REQ-API-053) — pin-verbatim math: delay = duration × |origin − i|,
13
+ * optionally warped by `ease` over maxDelay = total × duration, plus `startDelay`. Seconds, like
14
+ * every public time. Malformed inputs fail loud at FACTORY time (G-INV-8) — the pin silently
15
+ * emits NaN delays instead, a misauthoring this engine refuses.
16
+ */
17
+ export declare function stagger(duration?: number, options?: StaggerOptions): DynamicDelay;
18
+ export interface ChildOrchestrationInput {
19
+ /** The pin's `animateChildren` forwarded delay: `options.delay` on the parallel branch, 0 on a `when`-sequenced branch. */
20
+ readonly forwardedDelay: number;
21
+ readonly delayChildren?: number | DynamicDelay | undefined;
22
+ readonly staggerChildren?: number | undefined;
23
+ readonly staggerDirection?: number | undefined;
24
+ /** Position among the parent's DIRECT variant children in tree order (native authority: mount registration order — packet L3). */
25
+ readonly index: number;
26
+ readonly total: number;
27
+ }
28
+ /**
29
+ * Per-child start delay, exactly the pinned composition (visual-element-variant.ts:92-103):
30
+ * forwarded + (function delayChildren ? 0 : numeric delayChildren) + stagger term, where a
31
+ * FUNCTION delayChildren displaces staggerChildren/staggerDirection entirely and the numeric
32
+ * term is index × staggerChildren (direction 1) or (total − 1) × staggerChildren − index ×
33
+ * staggerChildren (direction −1). Operation order is preserved for float-exact golden parity.
34
+ */
35
+ export declare function resolveChildOrchestrationDelay(input: ChildOrchestrationInput): number;
36
+ /**
37
+ * One orchestration EPISODE as the parent's direct children consume it (T21, REQ-API-053): the
38
+ * four tree-lane options plus the delay the parent forwards. Built per label edge from the
39
+ * parent's RESOLVED variant transition by `resolveOrchestrationEpisode`.
40
+ */
41
+ export interface OrchestrationEpisode {
42
+ /** What `animateChildren` receives as `delay`: the node's CASCADED start delay in the
43
+ * parallel branch (the pin forwards `options.delay` — the delay this node's own start was
44
+ * computed with, NOT its authored transition `delay`), 0 when `when` sequences (the pin's
45
+ * no-arg `getChildAnimations()` call — packet law 3; corrected by F4). */
46
+ readonly forwardedDelay: number;
47
+ readonly delayChildren?: number | DynamicDelay | undefined;
48
+ readonly staggerChildren?: number | undefined;
49
+ readonly staggerDirection?: number | undefined;
50
+ /** Normalized: absent authoring reads as `false` (parallel). */
51
+ readonly when: false | 'beforeChildren' | 'afterChildren';
52
+ }
53
+ /** The orchestration-relevant slice of a resolved tree-level transition bag. The authored
54
+ * `delay` is deliberately NOT here — it rides the node's OWN values only (the pin's
55
+ * getValueTransition), never the children (F4). */
56
+ export type OrchestrationEpisodeInput = Pick<import('./types').TransitionOptionBag, 'when' | 'delayChildren' | 'staggerChildren' | 'staggerDirection'>;
57
+ /**
58
+ * Resolve a parent's tree-level transition bag into the episode its direct children compose
59
+ * against (pin: visual-element-variant.ts:71-103). Two laws beyond extraction: what forwards
60
+ * to children is `nodeStartDelay` — the delay THIS node's own start was computed with (its
61
+ * orchestration-computed delay from its own parent; 0 at a controlling root) — never the
62
+ * bag's authored `delay`, which rides only the node's own values (F4); and a truthy `when`
63
+ * SEQUENCES own-values vs children with the sequenced branch passing `delay: 0` to
64
+ * `animateChildren` (the no-arg call), while `delayChildren`/stagger apply in both branches.
65
+ */
66
+ export declare function resolveOrchestrationEpisode(bag: OrchestrationEpisodeInput, nodeStartDelay?: number): OrchestrationEpisode;
@@ -0,0 +1,124 @@
1
+ // SPEC-COMPONENT §2 — variant orchestration math (REQ-API-053, T21). The pure tree-lane layer
2
+ // under `delayChildren` / `staggerChildren` / `staggerDirection`: `stagger()` (the public
3
+ // authoring helper the catalog imports from the package root) and the per-child delay resolver
4
+ // replicating the pinned composition (motion-dom@12.42.2 `visual-element-variant.ts:92-103` +
5
+ // `calc-child-stagger.ts` + `utils/stagger.ts`), golden-pinned per sample in
6
+ // `orchestration.test.ts`. Host-agnostic (REQ-CORE-003) — relative imports only. Orchestration
7
+ // never crosses to the UI runtime: this runs on the JS thread at start-scheduling time, so plain
8
+ // function values (a `stagger()` result) are legal here — and ONLY here (the transition
9
+ // converters strip the family, so no function ever reaches a driver or a worklet crossing).
10
+ import { resolveEasing } from "../timing.js";
11
+ import { InvalidTransitionError } from "./validate.js";
12
+ // The pin's getOriginIndex (utils/stagger.ts): 'first' → 0, 'last' → total − 1,
13
+ // 'center' → (total − 1) / 2. A numeric origin is used as-is by the caller.
14
+ function staggerOriginIndex(from, total) {
15
+ if (from === 'first')
16
+ return 0;
17
+ const lastIndex = total - 1;
18
+ return from === 'last' ? lastIndex : lastIndex / 2;
19
+ }
20
+ /**
21
+ * The public stagger() helper (REQ-API-053) — pin-verbatim math: delay = duration × |origin − i|,
22
+ * optionally warped by `ease` over maxDelay = total × duration, plus `startDelay`. Seconds, like
23
+ * every public time. Malformed inputs fail loud at FACTORY time (G-INV-8) — the pin silently
24
+ * emits NaN delays instead, a misauthoring this engine refuses.
25
+ */
26
+ export function stagger(duration = 0.1, options = {}) {
27
+ if (typeof duration !== 'number' || !Number.isFinite(duration)) {
28
+ throw new Error(`stagger: duration must be a finite number of seconds, got ${String(duration)} (REQ-API-053)`);
29
+ }
30
+ const { startDelay = 0, from = 0, ease } = options;
31
+ if (typeof startDelay !== 'number' || !Number.isFinite(startDelay)) {
32
+ throw new Error(`stagger: startDelay must be a finite number of seconds, got ${String(startDelay)} (REQ-API-053)`);
33
+ }
34
+ const validOrigin = from === 'first' ||
35
+ from === 'last' ||
36
+ from === 'center' ||
37
+ (typeof from === 'number' && Number.isFinite(from));
38
+ if (!validOrigin) {
39
+ throw new Error(`stagger: from must be 'first', 'last', 'center', or a finite index, got ${String(from)} (REQ-API-053)`);
40
+ }
41
+ // Resolve the easing EAGERLY so an unknown named curve or malformed bezier throws at the
42
+ // authoring site, not on the first child start. resolveEasing owns that refusal.
43
+ const easingFunction = ease === undefined ? undefined : typeof ease === 'function' ? ease : resolveEasing(ease);
44
+ return (index, total) => {
45
+ const fromIndex = typeof from === 'number' ? from : staggerOriginIndex(from, total);
46
+ const distance = Math.abs(fromIndex - index);
47
+ let delay = duration * distance;
48
+ if (easingFunction !== undefined) {
49
+ const maxDelay = total * duration;
50
+ delay = easingFunction(delay / maxDelay) * maxDelay;
51
+ }
52
+ return startDelay + delay;
53
+ };
54
+ }
55
+ /**
56
+ * Per-child start delay, exactly the pinned composition (visual-element-variant.ts:92-103):
57
+ * forwarded + (function delayChildren ? 0 : numeric delayChildren) + stagger term, where a
58
+ * FUNCTION delayChildren displaces staggerChildren/staggerDirection entirely and the numeric
59
+ * term is index × staggerChildren (direction 1) or (total − 1) × staggerChildren − index ×
60
+ * staggerChildren (direction −1). Operation order is preserved for float-exact golden parity.
61
+ */
62
+ export function resolveChildOrchestrationDelay(input) {
63
+ const { forwardedDelay, delayChildren, staggerChildren = 0, staggerDirection = 1, index, total, } = input;
64
+ if (!Number.isInteger(index) ||
65
+ !Number.isInteger(total) ||
66
+ total < 1 ||
67
+ index < 0 ||
68
+ index >= total) {
69
+ // Callers derive (index, total) from the live child registry; an out-of-range pair is the
70
+ // registry's bookkeeping broken — fail loud, never emit a silently-wrong delay.
71
+ throw new Error(`resolveChildOrchestrationDelay: index ${String(index)} outside [0, ${String(total)}) — ` +
72
+ 'the variant child registry is inconsistent (internal invariant, REQ-API-053)');
73
+ }
74
+ const delayIsFunction = typeof delayChildren === 'function';
75
+ const staggerTerm = delayIsFunction
76
+ ? executeDynamicDelay(delayChildren, index, total)
77
+ : staggerDirection === 1
78
+ ? index * staggerChildren
79
+ : (total - 1) * staggerChildren - index * staggerChildren;
80
+ return forwardedDelay + (delayIsFunction ? 0 : (delayChildren ?? 0)) + staggerTerm;
81
+ }
82
+ // The DynamicDelay EXECUTION boundary (review r1 major 6): validate admits arbitrary functions,
83
+ // so the call itself is where user input can misbehave. Both failure shapes surface as the same
84
+ // typed class the validation boundary throws, so the host severity seam catches them under the
85
+ // one policy (development throws; production reports and refuses the property). The pin emits
86
+ // NaN delays here; this engine refuses (G-INV-8).
87
+ function executeDynamicDelay(delayChildren, index, total) {
88
+ let result;
89
+ try {
90
+ result = delayChildren(index, total);
91
+ }
92
+ catch (error) {
93
+ throw new InvalidTransitionError(undefined, 'delayChildren', delayChildren, `the dynamic delay callback threw at (index ${String(index)}, total ${String(total)}): ` +
94
+ `${String(error)} (REQ-API-053)`);
95
+ }
96
+ if (typeof result !== 'number' || !Number.isFinite(result)) {
97
+ throw new InvalidTransitionError(undefined, 'delayChildren', result, `the dynamic delay callback must return finite seconds, got ${String(result)} at ` +
98
+ `(index ${String(index)}, total ${String(total)}) (REQ-API-053)`);
99
+ }
100
+ return result;
101
+ }
102
+ /**
103
+ * Resolve a parent's tree-level transition bag into the episode its direct children compose
104
+ * against (pin: visual-element-variant.ts:71-103). Two laws beyond extraction: what forwards
105
+ * to children is `nodeStartDelay` — the delay THIS node's own start was computed with (its
106
+ * orchestration-computed delay from its own parent; 0 at a controlling root) — never the
107
+ * bag's authored `delay`, which rides only the node's own values (F4); and a truthy `when`
108
+ * SEQUENCES own-values vs children with the sequenced branch passing `delay: 0` to
109
+ * `animateChildren` (the no-arg call), while `delayChildren`/stagger apply in both branches.
110
+ */
111
+ export function resolveOrchestrationEpisode(bag, nodeStartDelay = 0) {
112
+ if (!Number.isFinite(nodeStartDelay)) {
113
+ throw new Error(`resolveOrchestrationEpisode: nodeStartDelay must be finite seconds, got ${String(nodeStartDelay)} ` +
114
+ '— the caller cascades its own computed start delay (internal invariant, REQ-API-053)');
115
+ }
116
+ const when = bag.when ?? false;
117
+ return {
118
+ forwardedDelay: when === false ? nodeStartDelay : 0,
119
+ delayChildren: bag.delayChildren,
120
+ staggerChildren: bag.staggerChildren,
121
+ staggerDirection: bag.staggerDirection,
122
+ when,
123
+ };
124
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ // SPEC-COMPONENT §2 — the pure target-merge + base-resolution functions (REQ-API-002/010/011/012/017).
3
+ // Two responsibilities, two pure functions on the verifier seam:
4
+ // • resolveTarget(base, target) — REQ-API-012 overlay: apply a partial target onto the live value set.
5
+ // Keys in the target retarget; keys absent from the target retain their live value; a target NEVER
6
+ // resets an unlisted property. There is no "full visual state" the author must restate.
7
+ // • resolveStartValue / hostBaseValue — REQ-API-011 base resolution: the STARTING value of a property
8
+ // appearing in a target with no prior live value — the resolved `style` value if present, else the
9
+ // documented host base. Identical across engines (the base derives from the registry value type, not
10
+ // from any host), so no engine supplies a divergent implicit default.
11
+ // Both are pure and deterministic: same inputs → same result, independent of clock or host (REQ-API-017).
12
+ // Host-agnostic (REQ-CORE-003) — reads only the SUBSET registry (relative import).
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.DiscreteHostBaseError = void 0;
15
+ exports.resolveTarget = resolveTarget;
16
+ exports.resolveStartValue = resolveStartValue;
17
+ exports.hostBaseValue = hostBaseValue;
18
+ const subset_1 = require("../subset/index.cjs");
19
+ const boundedArray_1 = require("./boundedArray.cjs");
20
+ const validate_1 = require("./validate.cjs");
21
+ // Overlay `target` onto the live `base` value set (REQ-API-012). Returns a fresh, complete value set: every
22
+ // key present in either input appears once; a key in `target` takes the target value (retarget), a key only
23
+ // in `base` retains its live value (hold). Never mutates its inputs; never resets a property the target did
24
+ // not mention. A target value may be a keyframe array (ResolvedTargetValue), so the merge is typed to carry it.
25
+ function resolveTarget(base, target) {
26
+ // Hold every unlisted base key, then overlay the target. A keyframe ARRAY value is CLONED (and frozen)
27
+ // as it is captured — a resolved snapshot (a presence exit target, a retarget origin) is resolved-once
28
+ // and held-immutable, so it must not alias a caller-owned array whose later mutation would change it in
29
+ // place (REQ-API-017; review major c8d4e61a705b). Keyframe elements are scalars, so a shallow clone is a
30
+ // full copy. A fresh object each call — the inputs stay immutable.
31
+ const merged = {};
32
+ for (const key of Object.keys(base))
33
+ merged[key] = captureValue(key, base[key]);
34
+ for (const key of Object.keys(target))
35
+ merged[key] = captureValue(key, target[key]);
36
+ return merged;
37
+ }
38
+ // Capture a resolved value independently of its caller: a keyframe array is cloned + frozen (so a later
39
+ // source mutation cannot reach the snapshot, and the snapshot itself cannot be mutated downstream); a
40
+ // scalar is already immutable and passes through.
41
+ function captureValue(key, value) {
42
+ if (!Array.isArray(value))
43
+ return value;
44
+ const capture = (0, boundedArray_1.captureBoundedArray)(value);
45
+ if (capture.kind !== 'captured') {
46
+ throw new validate_1.InvalidTargetError(undefined, key, (0, boundedArray_1.capturedArrayDescription)(capture), 'keyframe arrays must have a safe bounded length (REQ-API-033)');
47
+ }
48
+ if (capture.values.length < 2) {
49
+ throw new validate_1.InvalidTargetError(undefined, key, capture.values, 'a keyframe array must have at least two keyframes (REQ-API-033)');
50
+ }
51
+ for (let index = 0; index < capture.values.length; index++) {
52
+ if (!Object.hasOwn(capture.values, index)) {
53
+ throw new validate_1.InvalidTargetError(undefined, key, capture.values, `keyframe array is missing index ${index} (REQ-API-033)`);
54
+ }
55
+ }
56
+ return capture.values;
57
+ }
58
+ // REQ-API-011: the STARTING (from) value of a property that appears in a target with no prior live value.
59
+ // The resolved `style` value if the style prop specifies it, else the documented host base. Pure.
60
+ function resolveStartValue(key, resolution) {
61
+ const styled = resolution?.style?.[key];
62
+ return styled !== undefined ? styled : hostBaseValue(key);
63
+ }
64
+ // T23 B2a2: the discrete-start refusal is TYPED so the component boundary can apply the
65
+ // severity law to exactly this case (production report + refuse the key) without message
66
+ // sniffing; unknown/complex host-base refusals stay plain loud errors on every severity.
67
+ class DiscreteHostBaseError extends Error {
68
+ constructor(key) {
69
+ super(`no documented host base value for discrete '${key}': the host default diverges across ` +
70
+ 'engines — provide the starting keyword via initial/style/variants.');
71
+ this.name = 'DiscreteHostBaseError';
72
+ }
73
+ }
74
+ exports.DiscreteHostBaseError = DiscreteHostBaseError;
75
+ // The documented host base value for a universal property (REQ-API-011) — the value it animates FROM when
76
+ // neither a live value nor a `style` value exists. Derived from the registry value type so it is a SINGLE
77
+ // source of truth and identical across engines (no host parameter, no engine-divergent default): scale and
78
+ // opacity rest at 1; translations, dimensions, spacing, radii, border widths, and angles rest at 0; colors
79
+ // rest at fully-transparent black. complex/gesture capabilities have no scalar base and fail loud, as does
80
+ // an unknown property.
81
+ function hostBaseValue(key) {
82
+ const entry = subset_1.UNIVERSAL_SUBSET.get(key);
83
+ if (entry === undefined) {
84
+ throw new Error(`no documented host base value for unknown property '${key}': it is not a universal-subset property.`);
85
+ }
86
+ switch (entry.valueType) {
87
+ case 'unitless':
88
+ // opacity and scale/scaleX/scaleY are the only unitless universal properties; all rest at 1.
89
+ return 1;
90
+ case 'length':
91
+ case 'angle':
92
+ return 0;
93
+ case 'rgba':
94
+ return 'rgba(0, 0, 0, 0)';
95
+ case 'discrete':
96
+ // T23 B: the host default for a discrete keyword DIVERGES across engines (web block vs RN
97
+ // flex for display) — there is no engine-identical documented base, so the start value must
98
+ // come from `initial`/`style`/a variant, never a silent host default.
99
+ throw new DiscreteHostBaseError(key);
100
+ case 'complex':
101
+ case 'gesture':
102
+ throw new Error(`no documented host base value for '${key}' (valueType '${entry.valueType}'): it is not an animatable scalar/color property.`);
103
+ }
104
+ }
@@ -0,0 +1,11 @@
1
+ export type ResolvedValue = number | string;
2
+ export type ResolvedTargetValue = ResolvedValue | readonly (number | string | null)[];
3
+ export declare function resolveTarget(base: Readonly<Record<string, ResolvedTargetValue>>, target: Readonly<Record<string, ResolvedTargetValue>>): Record<string, ResolvedTargetValue>;
4
+ export interface StartResolution {
5
+ readonly style?: Readonly<Record<string, ResolvedValue>>;
6
+ }
7
+ export declare function resolveStartValue(key: string, resolution?: StartResolution): ResolvedValue;
8
+ export declare class DiscreteHostBaseError extends Error {
9
+ constructor(key: string);
10
+ }
11
+ export declare function hostBaseValue(key: string): ResolvedValue;
@@ -0,0 +1,11 @@
1
+ export type ResolvedValue = number | string;
2
+ export type ResolvedTargetValue = ResolvedValue | readonly (number | string | null)[];
3
+ export declare function resolveTarget(base: Readonly<Record<string, ResolvedTargetValue>>, target: Readonly<Record<string, ResolvedTargetValue>>): Record<string, ResolvedTargetValue>;
4
+ export interface StartResolution {
5
+ readonly style?: Readonly<Record<string, ResolvedValue>>;
6
+ }
7
+ export declare function resolveStartValue(key: string, resolution?: StartResolution): ResolvedValue;
8
+ export declare class DiscreteHostBaseError extends Error {
9
+ constructor(key: string);
10
+ }
11
+ export declare function hostBaseValue(key: string): ResolvedValue;