@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,313 @@
1
+ // REQ-VALUETYPE-013/014 — positional length measure-resolve (R13 value-breadth).
2
+ // Pure recognition + arithmetic against a host-supplied layout context. No DOM, no RN.
3
+ // Pin: motion-dom DOMKeyframesResolver measure path; catalog Animation-between-value-types,
4
+ // height-auto*, Shared-layout-continuity* calc(100vw - 100px).
5
+ //
6
+ // Law: calc is first-class — never silent complex tokenization of interior numbers.
7
+ import { parseNumeric, parseNumericVerdict } from "./numeric.js";
8
+ const POSITIONAL_LENGTH_AXIS_SET = new Set([
9
+ 'width',
10
+ 'height',
11
+ 'top',
12
+ 'right',
13
+ 'bottom',
14
+ 'left',
15
+ 'x',
16
+ 'y',
17
+ ]);
18
+ /** The positional keys whose length STRINGS any engine may measure-resolve (REQ-VALUETYPE-013). */
19
+ export const POSITIONAL_LENGTH_AXES = Object.freeze([
20
+ 'width',
21
+ 'height',
22
+ 'top',
23
+ 'right',
24
+ 'bottom',
25
+ 'left',
26
+ 'x',
27
+ 'y',
28
+ ]);
29
+ /** Runtime membership of the positional length axis set (cross-engine, one authority). */
30
+ export function isPositionalLengthAxis(key) {
31
+ return POSITIONAL_LENGTH_AXIS_SET.has(key);
32
+ }
33
+ /**
34
+ * The ONE key-aware executable value matrix (review fe5d455ffde7 / 91d41675d511): a
35
+ * measure-resolved length string (scalar, or any keyframe element — a null FIRST element is the
36
+ * legal from-current marker) executes only on the positional keys, and `auto` only for
37
+ * width/height (the intrinsic content measure; the positional-auto remainder stays loud).
38
+ * Returns the named refusal, or null when the value rides another lane (number, non-string) or
39
+ * is executable. Used by every supplying boundary: core target validation (web + native), the
40
+ * variants dictionary gate, the gesture-state gate, and the style-base gate.
41
+ */
42
+ export function executableLengthValueRefusal(key, value) {
43
+ if (typeof value === 'number')
44
+ return null;
45
+ if (Array.isArray(value)) {
46
+ for (let index = 0; index < value.length; index++) {
47
+ const element = value[index];
48
+ if (element === null && index === 0)
49
+ continue;
50
+ const refusal = executableLengthValueRefusal(key, element);
51
+ if (refusal !== null)
52
+ return refusal;
53
+ }
54
+ return null;
55
+ }
56
+ if (typeof value !== 'string')
57
+ return null;
58
+ if (!isLengthTarget(value))
59
+ return null; // not a length string — the value-type lane owns it
60
+ if (!isPositionalLengthAxis(key)) {
61
+ return (`measure-resolved length strings (%/auto/simple calc/px) execute only on the positional ` +
62
+ `keys (${POSITIONAL_LENGTH_AXES.join(', ')}); '${key}' drives explicit numbers ` +
63
+ `(REQ-VALUETYPE-013)`);
64
+ }
65
+ if (isAuto(value) && key !== 'width' && key !== 'height') {
66
+ return (`not yet supported — positional 'auto' on '${key}' cannot measure-resolve ` +
67
+ '(REQ-VALUETYPE-013; auto resolves for width/height only, the intrinsic content measure)');
68
+ }
69
+ return null;
70
+ }
71
+ const CALC_OUTER_RE = /^calc\(\s*(.+)\s*\)$/i;
72
+ // Pin-exercised simple binary forms only: term (op) term, each term a number/unit or nested not allowed.
73
+ const SIMPLE_CALC_BODY_RE = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(?:px|%|vw|vh)?)\s*([+-])\s*([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(?:px|%|vw|vh)?)$/i;
74
+ export function isAuto(raw) {
75
+ return raw.trim().toLowerCase() === 'auto';
76
+ }
77
+ /**
78
+ * Calc prefix detection (REQ-VALUETYPE-013): match `calc(` regardless of trailing `)`.
79
+ * Malformed/unclosed calc must NOT fall through to complex partial tokenization — parse
80
+ * routes it to a named refusal.
81
+ */
82
+ export function isCalc(raw) {
83
+ return /^calc\s*\(/i.test(raw.trim());
84
+ }
85
+ export class MeasureResolveContextError extends Error {
86
+ reason;
87
+ axis;
88
+ constructor(message, reason, axis) {
89
+ super(message);
90
+ this.name = 'MeasureResolveContextError';
91
+ this.reason = reason;
92
+ this.axis = axis;
93
+ }
94
+ }
95
+ /** Layout/inset axes: % of parent. Transform x/y: % of the element box (pin unit-conversion). */
96
+ function percentReferenceSize(axis, ctx) {
97
+ if (axis === 'x')
98
+ return { size: ctx.autoWidth, label: 'element width (transform %)' };
99
+ if (axis === 'y')
100
+ return { size: ctx.autoHeight, label: 'element height (transform %)' };
101
+ if (axis === 'width' || axis === 'left' || axis === 'right') {
102
+ return { size: ctx.parentWidth, label: 'parent width' };
103
+ }
104
+ return { size: ctx.parentHeight, label: 'parent height' };
105
+ }
106
+ // The supported auto matrix is DIMENSIONS only (review e2b1b9c7013b): width/height auto is the
107
+ // intrinsic content measure (the shipped height-auto capability). Positional auto
108
+ // (left/right/top/bottom/x/y) is NOT Motion-faithful as an element-box size — motion-dom reads
109
+ // computed left/top, bounding-box right/bottom, and the current transform translation — so it
110
+ // stays loud with the named "not yet supported" format, never a silently unrelated endpoint.
111
+ // The reason is typed ('unsupported-axis-auto'): it must never read as a deferrable
112
+ // missing-element-measure (hosts would park the key behind onLayout instead of refusing it).
113
+ function autoRefusal(axis) {
114
+ if (axis === 'width' || axis === 'height')
115
+ return null;
116
+ return new MeasureResolveContextError(`not yet supported — positional 'auto' on '${axis}' cannot measure-resolve ` +
117
+ '(REQ-VALUETYPE-013; auto resolves for width/height only, the intrinsic content measure; ' +
118
+ 'positional left/right/top/bottom/x/y auto is the unsupported remainder)', 'unsupported-axis-auto', axis);
119
+ }
120
+ function autoSize(axis, ctx) {
121
+ return axis === 'width' ? ctx.autoWidth : ctx.autoHeight;
122
+ }
123
+ // Inputs and context components are validated finite, but the ARITHMETIC can still overflow
124
+ // (review 46e1c8fd339a): calc(1e308px + 1e308px), 1e308% of a large parent, or a cancellation
125
+ // to NaN (Infinity − Infinity) would otherwise reach driver invariants as a raw Infinity/NaN.
126
+ // The resolved result is boundary-checked through the same typed channel — never deferred.
127
+ function assertFiniteResolved(value, axis) {
128
+ if (!Number.isFinite(value)) {
129
+ throw new MeasureResolveContextError(`measure-resolve on '${axis}' produced a non-finite result (${value}); finite inputs ` +
130
+ 'overflowed the driver lane, which requires finite px (REQ-VALUETYPE-013)', 'non-finite-result', axis);
131
+ }
132
+ return value;
133
+ }
134
+ export function parseLengthTargetVerdict(raw) {
135
+ if (typeof raw === 'number') {
136
+ if (!Number.isFinite(raw)) {
137
+ return { parsed: null, refusal: `Cannot parse non-finite length target: ${raw}` };
138
+ }
139
+ return { parsed: { kind: 'px', value: raw }, refusal: null };
140
+ }
141
+ const s = raw.trim();
142
+ if (s.length === 0)
143
+ return { parsed: null, refusal: `Cannot parse empty length target` };
144
+ if (isAuto(s))
145
+ return { parsed: { kind: 'auto' }, refusal: null };
146
+ if (isCalc(s))
147
+ return parseSimpleCalcVerdict(s);
148
+ const verdict = parseNumericVerdict(s);
149
+ if (verdict.refusal !== null) {
150
+ return { parsed: null, refusal: verdict.refusal };
151
+ }
152
+ const { value, unit } = verdict.parsed;
153
+ if (unit === '' || unit === 'px')
154
+ return { parsed: { kind: 'px', value }, refusal: null };
155
+ if (unit === '%')
156
+ return { parsed: { kind: 'percent', value }, refusal: null };
157
+ if (unit === 'vw')
158
+ return { parsed: { kind: 'vw', value }, refusal: null };
159
+ if (unit === 'vh')
160
+ return { parsed: { kind: 'vh', value }, refusal: null };
161
+ return {
162
+ parsed: null,
163
+ refusal: `not yet supported — length unit "${unit}" in ${JSON.stringify(raw)} cannot measure-resolve ` +
164
+ `(REQ-VALUETYPE-013; supported: number/px/%/vw/vh/auto/simple calc)`,
165
+ };
166
+ }
167
+ /** Parse a single length term used inside simple calc or as a standalone target. */
168
+ export function parseLengthTarget(raw) {
169
+ const verdict = parseLengthTargetVerdict(raw);
170
+ if (verdict.refusal !== null)
171
+ throw new Error(verdict.refusal);
172
+ return verdict.parsed;
173
+ }
174
+ /**
175
+ * Total predicate: whether `raw` is a measure-resolved length form (no throw).
176
+ * Drivers use this at recognition boundaries — never bare try/catch over parseLengthTarget
177
+ * (unexpected faults must not be classified as “not a length”).
178
+ */
179
+ export function isLengthTarget(raw) {
180
+ return parseLengthTargetVerdict(raw).refusal === null;
181
+ }
182
+ /** Verdict-shaped simple calc — no catch: unexpected faults from RegExp/String propagate. */
183
+ function parseSimpleCalcVerdict(raw) {
184
+ const s = raw.trim();
185
+ const outer = CALC_OUTER_RE.exec(s);
186
+ if (outer === null) {
187
+ return {
188
+ parsed: null,
189
+ refusal: `not yet supported — malformed calc ${JSON.stringify(raw)} (REQ-VALUETYPE-013)`,
190
+ };
191
+ }
192
+ const body = outer[1].trim();
193
+ // Nested parens / var() / multi-ops → loud incomplete (never partial complex).
194
+ if (body.includes('(') || /var\s*\(/i.test(body) || body.includes('*') || body.includes('/')) {
195
+ return {
196
+ parsed: null,
197
+ refusal: `not yet supported — calc form ${JSON.stringify(raw)} is outside the pin simple binary set ` +
198
+ `(REQ-VALUETYPE-013(d))`,
199
+ };
200
+ }
201
+ const m = SIMPLE_CALC_BODY_RE.exec(body);
202
+ if (m === null) {
203
+ return {
204
+ parsed: null,
205
+ refusal: `not yet supported — calc form ${JSON.stringify(raw)} is outside the pin simple binary set ` +
206
+ `(REQ-VALUETYPE-013(d))`,
207
+ };
208
+ }
209
+ const leftVerdict = parseLengthTargetVerdict(m[1]);
210
+ if (leftVerdict.refusal !== null)
211
+ return leftVerdict;
212
+ const rightVerdict = parseLengthTargetVerdict(m[3]);
213
+ if (rightVerdict.refusal !== null)
214
+ return rightVerdict;
215
+ const left = leftVerdict.parsed;
216
+ const right = rightVerdict.parsed;
217
+ const op = m[2];
218
+ if (left.kind === 'calc' ||
219
+ right.kind === 'calc' ||
220
+ left.kind === 'auto' ||
221
+ right.kind === 'auto') {
222
+ return {
223
+ parsed: null,
224
+ refusal: `not yet supported — nested/auto inside calc ${JSON.stringify(raw)} (REQ-VALUETYPE-013(d))`,
225
+ };
226
+ }
227
+ return { parsed: { kind: 'calc', raw: s, left, op, right }, refusal: null };
228
+ }
229
+ function resolveParsed(parsed, axis, ctx) {
230
+ switch (parsed.kind) {
231
+ case 'px':
232
+ return parsed.value;
233
+ case 'percent': {
234
+ const { size, label } = percentReferenceSize(axis, ctx);
235
+ if (size === undefined || !Number.isFinite(size)) {
236
+ const reason = axis === 'x' || axis === 'y' ? 'missing-element-measure' : 'missing-parent';
237
+ throw new MeasureResolveContextError(`Cannot measure-resolve percent length on ${axis}: ${label} missing from layout context ` +
238
+ `(REQ-VALUETYPE-013)`, reason, axis);
239
+ }
240
+ return assertFiniteResolved((parsed.value / 100) * size, axis);
241
+ }
242
+ case 'vw': {
243
+ if (ctx.viewportWidth === undefined || !Number.isFinite(ctx.viewportWidth)) {
244
+ throw new MeasureResolveContextError(`Cannot measure-resolve vw length: viewportWidth missing from layout context (REQ-VALUETYPE-013)`, 'missing-viewport', axis);
245
+ }
246
+ return assertFiniteResolved((parsed.value / 100) * ctx.viewportWidth, axis);
247
+ }
248
+ case 'vh': {
249
+ if (ctx.viewportHeight === undefined || !Number.isFinite(ctx.viewportHeight)) {
250
+ throw new MeasureResolveContextError(`Cannot measure-resolve vh length: viewportHeight missing from layout context (REQ-VALUETYPE-013)`, 'missing-viewport', axis);
251
+ }
252
+ return assertFiniteResolved((parsed.value / 100) * ctx.viewportHeight, axis);
253
+ }
254
+ case 'auto': {
255
+ const refusal = autoRefusal(axis);
256
+ if (refusal !== null)
257
+ throw refusal;
258
+ const size = autoSize(axis, ctx);
259
+ if (size === undefined || !Number.isFinite(size)) {
260
+ throw new MeasureResolveContextError(`Cannot measure-resolve auto on ${axis}: auto measure missing from layout context (REQ-VALUETYPE-013)`, 'missing-element-measure', axis);
261
+ }
262
+ return size;
263
+ }
264
+ case 'calc': {
265
+ const l = resolveParsed(parsed.left, axis, ctx);
266
+ const r = resolveParsed(parsed.right, axis, ctx);
267
+ return assertFiniteResolved(parsed.op === '+' ? l + r : l - r, axis);
268
+ }
269
+ }
270
+ }
271
+ /**
272
+ * Resolve a length target to px using host layout context (Motion measure-then-mix law).
273
+ * Pure: all geometry arrives in `ctx`.
274
+ */
275
+ export function resolveLengthToPx(raw, axis, ctx) {
276
+ return resolveParsed(parseLengthTarget(raw), axis, ctx);
277
+ }
278
+ function familyOf(parsed) {
279
+ if (parsed.kind === 'px')
280
+ return 'px';
281
+ if (parsed.kind === 'calc')
282
+ return 'calc';
283
+ return parsed.kind;
284
+ }
285
+ /**
286
+ * Motion needsMeasurement — the pin's family decision (review ae0a42832d85): the SAME relative
287
+ * unit family returns WITHOUT a measure (%→%, vw→vw, vh→vh interpolate on the unit lane — on
288
+ * native, measured-endpoint animation per the recorded divergence, never a unit-string
289
+ * generator). auto and calc always measure; mixed families measure.
290
+ */
291
+ export function needsLengthMeasureResolve(from, to) {
292
+ const a = parseLengthTarget(from);
293
+ const b = parseLengthTarget(to);
294
+ if (a.kind === 'auto' || b.kind === 'auto')
295
+ return true;
296
+ if (a.kind === 'calc' || b.kind === 'calc')
297
+ return true;
298
+ // Same relative unit family → the pin returns immediately (no measure).
299
+ if (a.kind === 'percent' && b.kind === 'percent')
300
+ return false;
301
+ if (a.kind === 'vw' && b.kind === 'vw')
302
+ return false;
303
+ if (a.kind === 'vh' && b.kind === 'vh')
304
+ return false;
305
+ if (a.kind === 'percent' || b.kind === 'percent')
306
+ return true;
307
+ if (a.kind === 'vw' || b.kind === 'vw' || a.kind === 'vh' || b.kind === 'vh')
308
+ return true;
309
+ // both px-family
310
+ return familyOf(a) !== familyOf(b);
311
+ }
312
+ // Re-export parseNumeric for callers that only need the numeric path after resolve.
313
+ export { parseNumeric };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // The unified mix() seam (SPEC-VALUE-TYPES §3, REQ-VALUETYPE-003/009/012). One family dispatcher over the
3
+ // numeric/color/complex value types: `parseValue` decomposes a raw string into a tagged TYPED value,
4
+ // `mix` interpolates two typed values of the same family, `transformValue` projects a typed value back to
5
+ // its committed string/number. Host-agnostic (REQ-VALUETYPE-011).
6
+ //
7
+ // The typed value — NOT a string — is the canonical carrier (REQ-VALUETYPE-012): the native driver writes
8
+ // it to shared values directly; string recomposition is one deterministic projection for the web commit
9
+ // path / conformance. Holding the DECOMPOSED typed value across retargets is lossless where a
10
+ // string round-trip would drift (REQ-VALUETYPE-009 keep-current). `progress` is always a normalized [0,1]
11
+ // fraction here; SPRING divides its internal [0,100] progress by 100 before this seam — the sole handoff
12
+ // (REQ-VALUETYPE-003).
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.parseValue = parseValue;
15
+ exports.mix = mix;
16
+ exports.transformValue = transformValue;
17
+ const color_1 = require("./color.cjs");
18
+ const complex_1 = require("./complex.cjs");
19
+ const discrete_1 = require("./discrete.cjs");
20
+ const measure_resolve_1 = require("./measure-resolve.cjs");
21
+ const numeric_1 = require("./numeric.cjs");
22
+ // Decompose a raw string into a tagged typed value. Detection order:
23
+ // auto → calc → numeric → single-color → discrete keyword → complex.
24
+ // auto/calc BEFORE complex is load-bearing (REQ-VALUETYPE-013): calc(50% + 100px) must never
25
+ // partial-tokenizeize as complex slots. Discrete AFTER color so named colors keep their family,
26
+ // BEFORE complex so single keywords (display/visibility values) parse instead of throwing the
27
+ // zero-token complex refusal (T23 B — parseComplex keeps that throw for every other shape).
28
+ // An implicit base and an explicit target both flow through
29
+ // this identical parser (REQ-VALUETYPE-009).
30
+ function parseValue(raw) {
31
+ if ((0, measure_resolve_1.isAuto)(raw))
32
+ return { kind: 'auto' };
33
+ if ((0, measure_resolve_1.isCalc)(raw)) {
34
+ // parseLengthTarget enforces pin simple-binary set; unsupported remainder throws loud.
35
+ const parsed = (0, measure_resolve_1.parseLengthTarget)(raw);
36
+ if (parsed.kind !== 'calc') {
37
+ throw new Error(`Internal: isCalc but parseLengthTarget kind is ${parsed.kind}`);
38
+ }
39
+ return { kind: 'calc', value: parsed };
40
+ }
41
+ if ((0, numeric_1.isNumeric)(raw))
42
+ return { kind: 'numeric', value: (0, numeric_1.parseNumeric)(raw) };
43
+ if ((0, color_1.isColor)(raw))
44
+ return { kind: 'color', value: (0, color_1.parseColor)(raw) };
45
+ if ((0, discrete_1.isDiscreteKeyword)(raw))
46
+ return { kind: 'discrete', value: raw };
47
+ return { kind: 'complex', value: (0, complex_1.parseComplex)(raw) };
48
+ }
49
+ // Interpolate two typed values of the SAME family. A cross-family pair is a loud failure (REQ-VALUETYPE-008
50
+ // — no silent coercion). Output is a typed value (REQ-VALUETYPE-012).
51
+ // auto/calc never mix here — resolve to px first (REQ-VALUETYPE-013(b)).
52
+ function mix(from, to, progress) {
53
+ if (from.kind === 'auto' || to.kind === 'auto' || from.kind === 'calc' || to.kind === 'calc') {
54
+ throw new Error(`Cannot mix unresolved ${from.kind === 'auto' || from.kind === 'calc' ? from.kind : to.kind} ` +
55
+ `length — measure-resolve to px before mix (REQ-VALUETYPE-013)`);
56
+ }
57
+ if (from.kind === 'numeric' && to.kind === 'numeric') {
58
+ return { kind: 'numeric', value: (0, numeric_1.mixNumeric)(from.value, to.value, progress) };
59
+ }
60
+ if (from.kind === 'color' && to.kind === 'color') {
61
+ return { kind: 'color', value: (0, color_1.mixColor)(from.value, to.value, progress) };
62
+ }
63
+ if (from.kind === 'complex' && to.kind === 'complex') {
64
+ return { kind: 'complex', value: (0, complex_1.mixComplex)(from.value, to.value, progress) };
65
+ }
66
+ if (from.kind === 'discrete' && to.kind === 'discrete') {
67
+ // The pin's TWO discrete paths (REQ-VALUETYPE-015): the mixVisibility step when an endpoint
68
+ // is invisible and its counterpart has zero values, else the zero-slot TARGET constant.
69
+ return { kind: 'discrete', value: (0, discrete_1.mixDiscrete)(from.value, to.value, progress) };
70
+ }
71
+ throw new Error(`Cannot mix value families: origin is "${from.kind}", target is "${to.kind}"`);
72
+ }
73
+ // Project a typed value to its committed form (REQ-VALUETYPE-012). A plain number stays a number
74
+ // (identity); everything else is a string. This is the ONLY place a typed value becomes a string.
75
+ function transformValue(v) {
76
+ switch (v.kind) {
77
+ case 'numeric':
78
+ return (0, numeric_1.transformNumeric)(v.value);
79
+ case 'color':
80
+ return (0, color_1.transformColor)(v.value);
81
+ case 'complex':
82
+ return (0, complex_1.transformComplex)(v.value);
83
+ case 'auto':
84
+ return 'auto';
85
+ case 'calc':
86
+ return v.value.raw;
87
+ case 'discrete':
88
+ return (0, discrete_1.transformDiscrete)(v.value);
89
+ }
90
+ }
@@ -0,0 +1,27 @@
1
+ import { type RGBA } from "./color.cjs";
2
+ import { type ComplexValue } from "./complex.cjs";
3
+ import { type ParsedLengthTarget } from "./measure-resolve.cjs";
4
+ import { type NumericValue } from "./numeric.cjs";
5
+ export type TypedValue = {
6
+ readonly kind: 'numeric';
7
+ readonly value: NumericValue;
8
+ } | {
9
+ readonly kind: 'color';
10
+ readonly value: RGBA;
11
+ } | {
12
+ readonly kind: 'complex';
13
+ readonly value: ComplexValue;
14
+ } | {
15
+ readonly kind: 'auto';
16
+ } | {
17
+ readonly kind: 'calc';
18
+ readonly value: Extract<ParsedLengthTarget, {
19
+ kind: 'calc';
20
+ }>;
21
+ } | {
22
+ readonly kind: 'discrete';
23
+ readonly value: string;
24
+ };
25
+ export declare function parseValue(raw: string): TypedValue;
26
+ export declare function mix(from: TypedValue, to: TypedValue, progress: number): TypedValue;
27
+ export declare function transformValue(v: TypedValue): string | number;
@@ -0,0 +1,27 @@
1
+ import { type RGBA } from "./color.js";
2
+ import { type ComplexValue } from "./complex.js";
3
+ import { type ParsedLengthTarget } from "./measure-resolve.js";
4
+ import { type NumericValue } from "./numeric.js";
5
+ export type TypedValue = {
6
+ readonly kind: 'numeric';
7
+ readonly value: NumericValue;
8
+ } | {
9
+ readonly kind: 'color';
10
+ readonly value: RGBA;
11
+ } | {
12
+ readonly kind: 'complex';
13
+ readonly value: ComplexValue;
14
+ } | {
15
+ readonly kind: 'auto';
16
+ } | {
17
+ readonly kind: 'calc';
18
+ readonly value: Extract<ParsedLengthTarget, {
19
+ kind: 'calc';
20
+ }>;
21
+ } | {
22
+ readonly kind: 'discrete';
23
+ readonly value: string;
24
+ };
25
+ export declare function parseValue(raw: string): TypedValue;
26
+ export declare function mix(from: TypedValue, to: TypedValue, progress: number): TypedValue;
27
+ export declare function transformValue(v: TypedValue): string | number;
@@ -0,0 +1,85 @@
1
+ // The unified mix() seam (SPEC-VALUE-TYPES §3, REQ-VALUETYPE-003/009/012). One family dispatcher over the
2
+ // numeric/color/complex value types: `parseValue` decomposes a raw string into a tagged TYPED value,
3
+ // `mix` interpolates two typed values of the same family, `transformValue` projects a typed value back to
4
+ // its committed string/number. Host-agnostic (REQ-VALUETYPE-011).
5
+ //
6
+ // The typed value — NOT a string — is the canonical carrier (REQ-VALUETYPE-012): the native driver writes
7
+ // it to shared values directly; string recomposition is one deterministic projection for the web commit
8
+ // path / conformance. Holding the DECOMPOSED typed value across retargets is lossless where a
9
+ // string round-trip would drift (REQ-VALUETYPE-009 keep-current). `progress` is always a normalized [0,1]
10
+ // fraction here; SPRING divides its internal [0,100] progress by 100 before this seam — the sole handoff
11
+ // (REQ-VALUETYPE-003).
12
+ import { isColor, mixColor, parseColor, transformColor } from "./color.js";
13
+ import { mixComplex, parseComplex, transformComplex } from "./complex.js";
14
+ import { isDiscreteKeyword, mixDiscrete, transformDiscrete } from "./discrete.js";
15
+ import { isAuto, isCalc, parseLengthTarget } from "./measure-resolve.js";
16
+ import { isNumeric, mixNumeric, parseNumeric, transformNumeric } from "./numeric.js";
17
+ // Decompose a raw string into a tagged typed value. Detection order:
18
+ // auto → calc → numeric → single-color → discrete keyword → complex.
19
+ // auto/calc BEFORE complex is load-bearing (REQ-VALUETYPE-013): calc(50% + 100px) must never
20
+ // partial-tokenizeize as complex slots. Discrete AFTER color so named colors keep their family,
21
+ // BEFORE complex so single keywords (display/visibility values) parse instead of throwing the
22
+ // zero-token complex refusal (T23 B — parseComplex keeps that throw for every other shape).
23
+ // An implicit base and an explicit target both flow through
24
+ // this identical parser (REQ-VALUETYPE-009).
25
+ export function parseValue(raw) {
26
+ if (isAuto(raw))
27
+ return { kind: 'auto' };
28
+ if (isCalc(raw)) {
29
+ // parseLengthTarget enforces pin simple-binary set; unsupported remainder throws loud.
30
+ const parsed = parseLengthTarget(raw);
31
+ if (parsed.kind !== 'calc') {
32
+ throw new Error(`Internal: isCalc but parseLengthTarget kind is ${parsed.kind}`);
33
+ }
34
+ return { kind: 'calc', value: parsed };
35
+ }
36
+ if (isNumeric(raw))
37
+ return { kind: 'numeric', value: parseNumeric(raw) };
38
+ if (isColor(raw))
39
+ return { kind: 'color', value: parseColor(raw) };
40
+ if (isDiscreteKeyword(raw))
41
+ return { kind: 'discrete', value: raw };
42
+ return { kind: 'complex', value: parseComplex(raw) };
43
+ }
44
+ // Interpolate two typed values of the SAME family. A cross-family pair is a loud failure (REQ-VALUETYPE-008
45
+ // — no silent coercion). Output is a typed value (REQ-VALUETYPE-012).
46
+ // auto/calc never mix here — resolve to px first (REQ-VALUETYPE-013(b)).
47
+ export function mix(from, to, progress) {
48
+ if (from.kind === 'auto' || to.kind === 'auto' || from.kind === 'calc' || to.kind === 'calc') {
49
+ throw new Error(`Cannot mix unresolved ${from.kind === 'auto' || from.kind === 'calc' ? from.kind : to.kind} ` +
50
+ `length — measure-resolve to px before mix (REQ-VALUETYPE-013)`);
51
+ }
52
+ if (from.kind === 'numeric' && to.kind === 'numeric') {
53
+ return { kind: 'numeric', value: mixNumeric(from.value, to.value, progress) };
54
+ }
55
+ if (from.kind === 'color' && to.kind === 'color') {
56
+ return { kind: 'color', value: mixColor(from.value, to.value, progress) };
57
+ }
58
+ if (from.kind === 'complex' && to.kind === 'complex') {
59
+ return { kind: 'complex', value: mixComplex(from.value, to.value, progress) };
60
+ }
61
+ if (from.kind === 'discrete' && to.kind === 'discrete') {
62
+ // The pin's TWO discrete paths (REQ-VALUETYPE-015): the mixVisibility step when an endpoint
63
+ // is invisible and its counterpart has zero values, else the zero-slot TARGET constant.
64
+ return { kind: 'discrete', value: mixDiscrete(from.value, to.value, progress) };
65
+ }
66
+ throw new Error(`Cannot mix value families: origin is "${from.kind}", target is "${to.kind}"`);
67
+ }
68
+ // Project a typed value to its committed form (REQ-VALUETYPE-012). A plain number stays a number
69
+ // (identity); everything else is a string. This is the ONLY place a typed value becomes a string.
70
+ export function transformValue(v) {
71
+ switch (v.kind) {
72
+ case 'numeric':
73
+ return transformNumeric(v.value);
74
+ case 'color':
75
+ return transformColor(v.value);
76
+ case 'complex':
77
+ return transformComplex(v.value);
78
+ case 'auto':
79
+ return 'auto';
80
+ case 'calc':
81
+ return v.value.raw;
82
+ case 'discrete':
83
+ return transformDiscrete(v.value);
84
+ }
85
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ // CSS Color Module Level 4 named colors → canonical RGBA (REQ-VALUETYPE-005). Authored from the CSS
3
+ // spec, NOT motion-dom (which has no named-color table — `color.parse("red")` returns garbage; on web it
4
+ // delegates named colors to the DOM) and NOT the DOM/react-native, so the SAME raw string resolves to the
5
+ // SAME RGBA on both engines with no host in the loop. `transparent` is the CSS keyword for rgba(0,0,0,0).
6
+ // This is a curated common subset (the 16 CSS Level-2 keywords + `transparent` + frequent extended
7
+ // keywords); full-L4 completeness is the vetoable open decision (SPEC-VALUE-TYPES §8). Keys are lowercase;
8
+ // the lookup lowercases its input.
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NAMED_COLORS = void 0;
11
+ const opaque = (red, green, blue) => ({ red, green, blue, alpha: 1 });
12
+ exports.NAMED_COLORS = {
13
+ transparent: { red: 0, green: 0, blue: 0, alpha: 0 },
14
+ // CSS Level 2 (basic) keywords
15
+ black: opaque(0, 0, 0),
16
+ silver: opaque(192, 192, 192),
17
+ gray: opaque(128, 128, 128),
18
+ white: opaque(255, 255, 255),
19
+ maroon: opaque(128, 0, 0),
20
+ red: opaque(255, 0, 0),
21
+ purple: opaque(128, 0, 128),
22
+ fuchsia: opaque(255, 0, 255),
23
+ green: opaque(0, 128, 0),
24
+ lime: opaque(0, 255, 0),
25
+ olive: opaque(128, 128, 0),
26
+ yellow: opaque(255, 255, 0),
27
+ navy: opaque(0, 0, 128),
28
+ blue: opaque(0, 0, 255),
29
+ teal: opaque(0, 128, 128),
30
+ aqua: opaque(0, 255, 255),
31
+ // Frequent extended keywords + spelling aliases
32
+ cyan: opaque(0, 255, 255), // alias of aqua
33
+ magenta: opaque(255, 0, 255), // alias of fuchsia
34
+ grey: opaque(128, 128, 128), // alias of gray
35
+ orange: opaque(255, 165, 0),
36
+ pink: opaque(255, 192, 203),
37
+ brown: opaque(165, 42, 42),
38
+ gold: opaque(255, 215, 0),
39
+ indigo: opaque(75, 0, 130),
40
+ violet: opaque(238, 130, 238),
41
+ darkgray: opaque(169, 169, 169),
42
+ darkgrey: opaque(169, 169, 169),
43
+ lightgray: opaque(211, 211, 211),
44
+ lightgrey: opaque(211, 211, 211),
45
+ dimgray: opaque(105, 105, 105),
46
+ slategray: opaque(112, 128, 144),
47
+ whitesmoke: opaque(245, 245, 245),
48
+ lightblue: opaque(173, 216, 230),
49
+ darkblue: opaque(0, 0, 139),
50
+ lightgreen: opaque(144, 238, 144),
51
+ darkgreen: opaque(0, 100, 0),
52
+ coral: opaque(255, 127, 80),
53
+ salmon: opaque(250, 128, 114),
54
+ tomato: opaque(255, 99, 71),
55
+ crimson: opaque(220, 20, 60),
56
+ skyblue: opaque(135, 206, 235),
57
+ steelblue: opaque(70, 130, 180),
58
+ turquoise: opaque(64, 224, 208),
59
+ beige: opaque(245, 245, 220),
60
+ ivory: opaque(255, 255, 240),
61
+ };
@@ -0,0 +1,2 @@
1
+ import type { RGBA } from "./color.cjs";
2
+ export declare const NAMED_COLORS: Readonly<Record<string, RGBA>>;
@@ -0,0 +1,2 @@
1
+ import type { RGBA } from "./color.js";
2
+ export declare const NAMED_COLORS: Readonly<Record<string, RGBA>>;