@tamagui/style-grammar 3.0.0-beta.924.1 → 3.0.1

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 (246) hide show
  1. package/dist/cjs/ast/payloadShape.cjs +45 -17
  2. package/dist/cjs/ast/payloadShape.native.cjs +45 -17
  3. package/dist/cjs/ast/payloadShape.native.js +45 -17
  4. package/dist/cjs/ast/payloadShape.native.js.map +1 -1
  5. package/dist/cjs/ast/resolvePayload.cjs +16 -9
  6. package/dist/cjs/ast/resolvePayload.native.cjs +16 -9
  7. package/dist/cjs/ast/resolvePayload.native.js +16 -9
  8. package/dist/cjs/ast/resolvePayload.native.js.map +1 -1
  9. package/dist/cjs/programs/lowerProgram.cjs +2 -2
  10. package/dist/cjs/programs/lowerProgram.native.cjs +2 -2
  11. package/dist/cjs/programs/lowerProgram.native.js +2 -2
  12. package/dist/cjs/programs/lowerProgram.native.js.map +1 -1
  13. package/dist/cjs/runtime/clauseIdentity.cjs +9 -28
  14. package/dist/cjs/runtime/clauseIdentity.native.cjs +9 -28
  15. package/dist/cjs/runtime/clauseIdentity.native.js +9 -28
  16. package/dist/cjs/runtime/clauseIdentity.native.js.map +1 -1
  17. package/dist/cjs/runtime/clausePrecedence.cjs +2 -2
  18. package/dist/cjs/runtime/clausePrecedence.native.cjs +3 -10
  19. package/dist/cjs/runtime/clausePrecedence.native.js +3 -10
  20. package/dist/cjs/runtime/clausePrecedence.native.js.map +1 -1
  21. package/dist/cjs/runtime/modifierVocabulary.native.cjs +1 -8
  22. package/dist/cjs/runtime/modifierVocabulary.native.js +1 -8
  23. package/dist/cjs/runtime/modifierVocabulary.native.js.map +1 -1
  24. package/dist/cjs/runtime/scanFlatValue.cjs +58 -7
  25. package/dist/cjs/runtime/scanFlatValue.native.cjs +58 -7
  26. package/dist/cjs/runtime/scanFlatValue.native.js +58 -7
  27. package/dist/cjs/runtime/scanFlatValue.native.js.map +1 -1
  28. package/dist/cjs/runtime/spring.cjs +123 -0
  29. package/dist/cjs/runtime/spring.native.cjs +131 -0
  30. package/dist/cjs/runtime/spring.native.js +133 -0
  31. package/dist/cjs/runtime/spring.native.js.map +1 -0
  32. package/dist/cjs/runtime/stateModifiers.cjs +23 -1
  33. package/dist/cjs/runtime/stateModifiers.native.cjs +23 -1
  34. package/dist/cjs/runtime/stateModifiers.native.js +23 -1
  35. package/dist/cjs/runtime/stateModifiers.native.js.map +1 -1
  36. package/dist/cjs/runtime/tokenCategories.cjs +3 -0
  37. package/dist/cjs/runtime/tokenCategories.native.cjs +3 -0
  38. package/dist/cjs/runtime/tokenCategories.native.js +3 -0
  39. package/dist/cjs/runtime/tokenCategories.native.js.map +1 -1
  40. package/dist/cjs/runtime/unitlessNumbers.cjs +0 -5
  41. package/dist/cjs/runtime/unitlessNumbers.native.cjs +0 -5
  42. package/dist/cjs/runtime/unitlessNumbers.native.js +0 -5
  43. package/dist/cjs/runtime/unitlessNumbers.native.js.map +1 -1
  44. package/dist/cjs/runtime.cjs +11 -0
  45. package/dist/cjs/runtime.native.cjs +11 -0
  46. package/dist/cjs/runtime.native.js +11 -0
  47. package/dist/cjs/runtime.native.js.map +1 -1
  48. package/dist/cjs/shorthands/transition.cjs +111 -36
  49. package/dist/cjs/shorthands/transition.native.cjs +113 -36
  50. package/dist/cjs/shorthands/transition.native.js +113 -36
  51. package/dist/cjs/shorthands/transition.native.js.map +1 -1
  52. package/dist/cjs/shorthands/transitionAlign.cjs +13 -10
  53. package/dist/cjs/shorthands/transitionAlign.native.cjs +14 -11
  54. package/dist/cjs/shorthands/transitionAlign.native.js +14 -11
  55. package/dist/cjs/shorthands/transitionAlign.native.js.map +1 -1
  56. package/dist/cjs/shorthands/transitionLegacy.cjs +263 -126
  57. package/dist/cjs/shorthands/transitionLegacy.native.cjs +333 -155
  58. package/dist/cjs/shorthands/transitionLegacy.native.js +333 -155
  59. package/dist/cjs/shorthands/transitionLegacy.native.js.map +1 -1
  60. package/dist/cjs/shorthands/transitionNative.cjs +5 -5
  61. package/dist/cjs/shorthands/transitionNative.native.cjs +8 -7
  62. package/dist/cjs/shorthands/transitionNative.native.js +8 -7
  63. package/dist/cjs/shorthands/transitionNative.native.js.map +1 -1
  64. package/dist/cjs/shorthands/transitionObject.cjs +302 -0
  65. package/dist/cjs/shorthands/transitionObject.native.cjs +347 -0
  66. package/dist/cjs/shorthands/transitionObject.native.js +349 -0
  67. package/dist/cjs/shorthands/transitionObject.native.js.map +1 -0
  68. package/dist/cjs/tooling/candidate.cjs +254 -15
  69. package/dist/cjs/tooling/candidate.native.cjs +314 -62
  70. package/dist/cjs/tooling/candidate.native.js +314 -62
  71. package/dist/cjs/tooling/candidate.native.js.map +1 -1
  72. package/dist/cjs/tooling/config.cjs +19 -9
  73. package/dist/cjs/tooling/config.native.cjs +25 -26
  74. package/dist/cjs/tooling/config.native.js +25 -26
  75. package/dist/cjs/tooling/config.native.js.map +1 -1
  76. package/dist/cjs/tooling/registry.cjs +579 -11
  77. package/dist/cjs/tooling/registry.native.cjs +579 -11
  78. package/dist/cjs/tooling/registry.native.js +579 -11
  79. package/dist/cjs/tooling/registry.native.js.map +1 -1
  80. package/dist/cjs/tooling/toolingDiagnostics.cjs +306 -10
  81. package/dist/cjs/tooling/toolingDiagnostics.native.cjs +408 -48
  82. package/dist/cjs/tooling/toolingDiagnostics.native.js +408 -48
  83. package/dist/cjs/tooling/toolingDiagnostics.native.js.map +1 -1
  84. package/dist/cjs/tooling/toolingRegistry.cjs +6 -1
  85. package/dist/cjs/tooling/toolingRegistry.native.cjs +9 -1
  86. package/dist/cjs/tooling/toolingRegistry.native.js +9 -1
  87. package/dist/cjs/tooling/toolingRegistry.native.js.map +1 -1
  88. package/dist/cjs/tooling.cjs +1 -0
  89. package/dist/cjs/tooling.native.cjs +1 -0
  90. package/dist/cjs/tooling.native.js +1 -0
  91. package/dist/cjs/tooling.native.js.map +1 -1
  92. package/dist/cjs/transitions.cjs +38 -0
  93. package/dist/cjs/transitions.native.cjs +40 -0
  94. package/dist/cjs/transitions.native.js +42 -0
  95. package/dist/cjs/transitions.native.js.map +1 -0
  96. package/dist/esm/ast/payloadShape.mjs +45 -17
  97. package/dist/esm/ast/payloadShape.mjs.map +1 -1
  98. package/dist/esm/ast/payloadShape.native.js +45 -17
  99. package/dist/esm/ast/payloadShape.native.js.map +1 -1
  100. package/dist/esm/ast/resolvePayload.mjs +16 -9
  101. package/dist/esm/ast/resolvePayload.mjs.map +1 -1
  102. package/dist/esm/ast/resolvePayload.native.js +16 -9
  103. package/dist/esm/ast/resolvePayload.native.js.map +1 -1
  104. package/dist/esm/programs/lowerProgram.mjs +2 -2
  105. package/dist/esm/programs/lowerProgram.mjs.map +1 -1
  106. package/dist/esm/programs/lowerProgram.native.js +2 -2
  107. package/dist/esm/programs/lowerProgram.native.js.map +1 -1
  108. package/dist/esm/runtime/clauseIdentity.mjs +2 -22
  109. package/dist/esm/runtime/clauseIdentity.mjs.map +1 -1
  110. package/dist/esm/runtime/clauseIdentity.native.js +2 -22
  111. package/dist/esm/runtime/clauseIdentity.native.js.map +1 -1
  112. package/dist/esm/runtime/clausePrecedence.mjs +2 -2
  113. package/dist/esm/runtime/clausePrecedence.mjs.map +1 -1
  114. package/dist/esm/runtime/clausePrecedence.native.js +3 -10
  115. package/dist/esm/runtime/clausePrecedence.native.js.map +1 -1
  116. package/dist/esm/runtime/modifierVocabulary.native.js +1 -8
  117. package/dist/esm/runtime/modifierVocabulary.native.js.map +1 -1
  118. package/dist/esm/runtime/scanFlatValue.mjs +59 -7
  119. package/dist/esm/runtime/scanFlatValue.mjs.map +1 -1
  120. package/dist/esm/runtime/scanFlatValue.native.js +59 -7
  121. package/dist/esm/runtime/scanFlatValue.native.js.map +1 -1
  122. package/dist/esm/runtime/spring.mjs +93 -0
  123. package/dist/esm/runtime/spring.mjs.map +1 -0
  124. package/dist/esm/runtime/spring.native.js +99 -0
  125. package/dist/esm/runtime/spring.native.js.map +1 -0
  126. package/dist/esm/runtime/stateModifiers.mjs +22 -2
  127. package/dist/esm/runtime/stateModifiers.mjs.map +1 -1
  128. package/dist/esm/runtime/stateModifiers.native.js +22 -2
  129. package/dist/esm/runtime/stateModifiers.native.js.map +1 -1
  130. package/dist/esm/runtime/tokenCategories.mjs +3 -0
  131. package/dist/esm/runtime/tokenCategories.mjs.map +1 -1
  132. package/dist/esm/runtime/tokenCategories.native.js +3 -0
  133. package/dist/esm/runtime/tokenCategories.native.js.map +1 -1
  134. package/dist/esm/runtime/unitlessNumbers.mjs +0 -5
  135. package/dist/esm/runtime/unitlessNumbers.mjs.map +1 -1
  136. package/dist/esm/runtime/unitlessNumbers.native.js +0 -5
  137. package/dist/esm/runtime/unitlessNumbers.native.js.map +1 -1
  138. package/dist/esm/runtime.mjs +4 -2
  139. package/dist/esm/runtime.native.js +4 -2
  140. package/dist/esm/shorthands/transition.mjs +111 -36
  141. package/dist/esm/shorthands/transition.mjs.map +1 -1
  142. package/dist/esm/shorthands/transition.native.js +113 -36
  143. package/dist/esm/shorthands/transition.native.js.map +1 -1
  144. package/dist/esm/shorthands/transitionAlign.mjs +13 -10
  145. package/dist/esm/shorthands/transitionAlign.mjs.map +1 -1
  146. package/dist/esm/shorthands/transitionAlign.native.js +14 -11
  147. package/dist/esm/shorthands/transitionAlign.native.js.map +1 -1
  148. package/dist/esm/shorthands/transitionLegacy.mjs +260 -126
  149. package/dist/esm/shorthands/transitionLegacy.mjs.map +1 -1
  150. package/dist/esm/shorthands/transitionLegacy.native.js +330 -155
  151. package/dist/esm/shorthands/transitionLegacy.native.js.map +1 -1
  152. package/dist/esm/shorthands/transitionNative.mjs +5 -5
  153. package/dist/esm/shorthands/transitionNative.mjs.map +1 -1
  154. package/dist/esm/shorthands/transitionNative.native.js +8 -7
  155. package/dist/esm/shorthands/transitionNative.native.js.map +1 -1
  156. package/dist/esm/shorthands/transitionObject.mjs +280 -0
  157. package/dist/esm/shorthands/transitionObject.mjs.map +1 -0
  158. package/dist/esm/shorthands/transitionObject.native.js +323 -0
  159. package/dist/esm/shorthands/transitionObject.native.js.map +1 -0
  160. package/dist/esm/tooling/candidate.mjs +250 -16
  161. package/dist/esm/tooling/candidate.mjs.map +1 -1
  162. package/dist/esm/tooling/candidate.native.js +310 -63
  163. package/dist/esm/tooling/candidate.native.js.map +1 -1
  164. package/dist/esm/tooling/config.mjs +18 -9
  165. package/dist/esm/tooling/config.mjs.map +1 -1
  166. package/dist/esm/tooling/config.native.js +24 -26
  167. package/dist/esm/tooling/config.native.js.map +1 -1
  168. package/dist/esm/tooling/registry.mjs +579 -11
  169. package/dist/esm/tooling/registry.mjs.map +1 -1
  170. package/dist/esm/tooling/registry.native.js +579 -11
  171. package/dist/esm/tooling/registry.native.js.map +1 -1
  172. package/dist/esm/tooling/toolingDiagnostics.mjs +306 -11
  173. package/dist/esm/tooling/toolingDiagnostics.mjs.map +1 -1
  174. package/dist/esm/tooling/toolingDiagnostics.native.js +408 -49
  175. package/dist/esm/tooling/toolingDiagnostics.native.js.map +1 -1
  176. package/dist/esm/tooling/toolingRegistry.mjs +6 -1
  177. package/dist/esm/tooling/toolingRegistry.mjs.map +1 -1
  178. package/dist/esm/tooling/toolingRegistry.native.js +9 -1
  179. package/dist/esm/tooling/toolingRegistry.native.js.map +1 -1
  180. package/dist/esm/tooling.mjs +2 -0
  181. package/dist/esm/tooling.native.js +2 -0
  182. package/dist/esm/transitions.mjs +5 -0
  183. package/dist/esm/transitions.native.js +5 -0
  184. package/package.json +21 -3
  185. package/src/ast/payloadShape.ts +44 -16
  186. package/src/ast/resolvePayload.ts +28 -13
  187. package/src/programs/lowerProgram.ts +9 -4
  188. package/src/runtime/clauseIdentity.ts +8 -31
  189. package/src/runtime/clausePrecedence.ts +2 -10
  190. package/src/runtime/scanFlatValue.ts +81 -9
  191. package/src/runtime/spring.ts +208 -0
  192. package/src/runtime/stateModifiers.ts +31 -1
  193. package/src/runtime/tokenCategories.ts +3 -0
  194. package/src/runtime/unitlessNumbers.ts +0 -5
  195. package/src/runtime.ts +13 -0
  196. package/src/shorthands/transition.ts +159 -44
  197. package/src/shorthands/transitionAlign.ts +22 -12
  198. package/src/shorthands/transitionLegacy.ts +376 -156
  199. package/src/shorthands/transitionNative.ts +8 -11
  200. package/src/shorthands/transitionObject.ts +369 -0
  201. package/src/tooling/candidate.ts +269 -14
  202. package/src/tooling/config.ts +25 -9
  203. package/src/tooling/registry.ts +339 -12
  204. package/src/tooling/toolingDiagnostics.ts +474 -9
  205. package/src/tooling/toolingRegistry.ts +6 -1
  206. package/src/tooling.ts +1 -0
  207. package/src/transitions.ts +42 -0
  208. package/types/ast/payloadShape.d.ts.map +2 -2
  209. package/types/ast/resolvePayload.d.ts +5 -4
  210. package/types/ast/resolvePayload.d.ts.map +2 -2
  211. package/types/programs/lowerProgram.d.ts +4 -2
  212. package/types/programs/lowerProgram.d.ts.map +2 -2
  213. package/types/runtime/clauseIdentity.d.ts +1 -4
  214. package/types/runtime/clauseIdentity.d.ts.map +2 -2
  215. package/types/runtime/clausePrecedence.d.ts.map +2 -2
  216. package/types/runtime/scanFlatValue.d.ts +1 -1
  217. package/types/runtime/scanFlatValue.d.ts.map +2 -2
  218. package/types/runtime/spring.d.ts +61 -0
  219. package/types/runtime/spring.d.ts.map +11 -0
  220. package/types/runtime/stateModifiers.d.ts +4 -0
  221. package/types/runtime/stateModifiers.d.ts.map +2 -2
  222. package/types/runtime/tokenCategories.d.ts.map +2 -2
  223. package/types/runtime/unitlessNumbers.d.ts.map +2 -2
  224. package/types/runtime.d.ts +3 -1
  225. package/types/runtime.d.ts.map +2 -2
  226. package/types/shorthands/transition.d.ts +26 -5
  227. package/types/shorthands/transition.d.ts.map +2 -2
  228. package/types/shorthands/transitionAlign.d.ts.map +2 -2
  229. package/types/shorthands/transitionLegacy.d.ts +19 -4
  230. package/types/shorthands/transitionLegacy.d.ts.map +2 -2
  231. package/types/shorthands/transitionNative.d.ts.map +1 -1
  232. package/types/shorthands/transitionObject.d.ts +49 -0
  233. package/types/shorthands/transitionObject.d.ts.map +11 -0
  234. package/types/tooling/candidate.d.ts +13 -0
  235. package/types/tooling/candidate.d.ts.map +2 -2
  236. package/types/tooling/config.d.ts +8 -1
  237. package/types/tooling/config.d.ts.map +2 -2
  238. package/types/tooling/registry.d.ts +4 -2
  239. package/types/tooling/registry.d.ts.map +2 -2
  240. package/types/tooling/toolingDiagnostics.d.ts +3 -1
  241. package/types/tooling/toolingDiagnostics.d.ts.map +2 -2
  242. package/types/tooling/toolingRegistry.d.ts.map +2 -2
  243. package/types/tooling.d.ts +1 -0
  244. package/types/tooling.d.ts.map +2 -2
  245. package/types/transitions.d.ts +5 -0
  246. package/types/transitions.d.ts.map +11 -0
@@ -24,6 +24,9 @@ var transitionAlign_exports = {};
24
24
  __export(transitionAlign_exports, { alignTransitionContributions: () => alignTransitionContributions });
25
25
  module.exports = __toCommonJS(transitionAlign_exports);
26
26
  var import_transition = require("./transition.native.js");
27
+ function fusedLabel(fused) {
28
+ return fused.type === "preset" ? `"${fused.name}" preset` : `spring(${fused.duration}, ${fused.bounce})`;
29
+ }
27
30
  var timingLonghands = /* @__PURE__ */ new Set(["transitionDuration", "transitionTimingFunction"]);
28
31
  function listText(values) {
29
32
  return values.join(", ");
@@ -31,7 +34,7 @@ function listText(values) {
31
34
  function alignTransitionContributions(contributions, presetNames) {
32
35
  var state = {
33
36
  global: null,
34
- preset: null,
37
+ fused: null,
35
38
  lists: {}
36
39
  };
37
40
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
@@ -42,18 +45,18 @@ function alignTransitionContributions(contributions, presetNames) {
42
45
  var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);
43
46
  if (!parsed.ok) return parsed;
44
47
  state.global = null;
45
- state.preset = null;
48
+ state.fused = null;
46
49
  state.lists = {};
47
50
  if (parsed.value.kind === "global") {
48
51
  state.global = parsed.value.value;
49
52
  continue;
50
53
  }
51
54
  var entries = parsed.value.entries;
52
- var presetEntry = entries.find(function(entry) {
53
- return entry.timing.type === "preset";
55
+ var fusedEntry = entries.find(function(entry) {
56
+ return entry.timing.type !== "css";
54
57
  });
55
- if (presetEntry) {
56
- state.preset = presetEntry.timing;
58
+ if (fusedEntry) {
59
+ state.fused = fusedEntry.timing;
57
60
  state.lists.transitionProperty = listText(entries.map(function(entry) {
58
61
  return entry.property;
59
62
  }));
@@ -92,13 +95,13 @@ function alignTransitionContributions(contributions, presetNames) {
92
95
  }]
93
96
  };
94
97
  }
95
- if (state.preset && timingLonghands.has(contribution.prop)) {
98
+ if (state.fused && timingLonghands.has(contribution.prop)) {
96
99
  return {
97
100
  ok: false,
98
101
  diagnostics: [{
99
102
  code: "transition-invalid-list",
100
103
  token: contribution.prop,
101
- message: `"${contribution.prop}" cannot partially override the "${state.preset.name}" preset \u2014 a preset's timing is not decomposable into CSS components; restate \`transition\` with CSS timing or change the preset`
104
+ message: `"${contribution.prop}" cannot partially override ${fusedLabel(state.fused)}: its timing is not decomposable into CSS components. restate \`transition\` with CSS timing, or change the ${state.fused.type}`
102
105
  }]
103
106
  };
104
107
  }
@@ -127,18 +130,18 @@ function alignTransitionContributions(contributions, presetNames) {
127
130
  }
128
131
  };
129
132
  }
130
- if (state.preset) {
133
+ if (state.fused) {
131
134
  var zipped = (0, import_transition.parseTransitionLonghands)({
132
135
  transitionProperty: state.lists.transitionProperty,
133
136
  transitionDelay: state.lists.transitionDelay,
134
137
  transitionBehavior: state.lists.transitionBehavior
135
138
  });
136
139
  if (!zipped.ok || zipped.value.kind !== "transition") return zipped;
137
- var preset = state.preset;
140
+ var fused = state.fused;
138
141
  var entries1 = zipped.value.entries.map(function(entry) {
139
142
  return {
140
143
  ...entry,
141
- timing: preset
144
+ timing: fused
142
145
  };
143
146
  });
144
147
  return {
@@ -24,6 +24,9 @@ var transitionAlign_exports = {};
24
24
  __export(transitionAlign_exports, { alignTransitionContributions: () => alignTransitionContributions });
25
25
  module.exports = __toCommonJS(transitionAlign_exports);
26
26
  var import_transition = require("./transition.native.js");
27
+ function fusedLabel(fused) {
28
+ return fused.type === "preset" ? `"${fused.name}" preset` : `spring(${fused.duration}, ${fused.bounce})`;
29
+ }
27
30
  var timingLonghands = /* @__PURE__ */ new Set(["transitionDuration", "transitionTimingFunction"]);
28
31
  function listText(values) {
29
32
  return values.join(", ");
@@ -31,7 +34,7 @@ function listText(values) {
31
34
  function alignTransitionContributions(contributions, presetNames) {
32
35
  var state = {
33
36
  global: null,
34
- preset: null,
37
+ fused: null,
35
38
  lists: {}
36
39
  };
37
40
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
@@ -42,18 +45,18 @@ function alignTransitionContributions(contributions, presetNames) {
42
45
  var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);
43
46
  if (!parsed.ok) return parsed;
44
47
  state.global = null;
45
- state.preset = null;
48
+ state.fused = null;
46
49
  state.lists = {};
47
50
  if (parsed.value.kind === "global") {
48
51
  state.global = parsed.value.value;
49
52
  continue;
50
53
  }
51
54
  var entries = parsed.value.entries;
52
- var presetEntry = entries.find(function(entry) {
53
- return entry.timing.type === "preset";
55
+ var fusedEntry = entries.find(function(entry) {
56
+ return entry.timing.type !== "css";
54
57
  });
55
- if (presetEntry) {
56
- state.preset = presetEntry.timing;
58
+ if (fusedEntry) {
59
+ state.fused = fusedEntry.timing;
57
60
  state.lists.transitionProperty = listText(entries.map(function(entry) {
58
61
  return entry.property;
59
62
  }));
@@ -92,13 +95,13 @@ function alignTransitionContributions(contributions, presetNames) {
92
95
  }]
93
96
  };
94
97
  }
95
- if (state.preset && timingLonghands.has(contribution.prop)) {
98
+ if (state.fused && timingLonghands.has(contribution.prop)) {
96
99
  return {
97
100
  ok: false,
98
101
  diagnostics: [{
99
102
  code: "transition-invalid-list",
100
103
  token: contribution.prop,
101
- message: `"${contribution.prop}" cannot partially override the "${state.preset.name}" preset \u2014 a preset's timing is not decomposable into CSS components; restate \`transition\` with CSS timing or change the preset`
104
+ message: `"${contribution.prop}" cannot partially override ${fusedLabel(state.fused)}: its timing is not decomposable into CSS components. restate \`transition\` with CSS timing, or change the ${state.fused.type}`
102
105
  }]
103
106
  };
104
107
  }
@@ -127,18 +130,18 @@ function alignTransitionContributions(contributions, presetNames) {
127
130
  }
128
131
  };
129
132
  }
130
- if (state.preset) {
133
+ if (state.fused) {
131
134
  var zipped = (0, import_transition.parseTransitionLonghands)({
132
135
  transitionProperty: state.lists.transitionProperty,
133
136
  transitionDelay: state.lists.transitionDelay,
134
137
  transitionBehavior: state.lists.transitionBehavior
135
138
  });
136
139
  if (!zipped.ok || zipped.value.kind !== "transition") return zipped;
137
- var preset = state.preset;
140
+ var fused = state.fused;
138
141
  var entries1 = zipped.value.entries.map(function(entry) {
139
142
  return {
140
143
  ...entry,
141
- timing: preset
144
+ timing: fused
142
145
  };
143
146
  });
144
147
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"transitionAlign.native.js","names":[],"sources":["cjs/shorthands/transitionAlign.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar transitionAlign_exports = {};\n__export(transitionAlign_exports, {\n alignTransitionContributions: () => alignTransitionContributions\n});\nmodule.exports = __toCommonJS(transitionAlign_exports);\nvar import_transition = require(\"./transition\");\nvar timingLonghands = /* @__PURE__ */ new Set([\n \"transitionDuration\",\n \"transitionTimingFunction\"\n]);\nfunction listText(values) {\n return values.join(\", \");\n}\nfunction alignTransitionContributions(contributions, presetNames) {\n var state = {\n global: null,\n preset: null,\n lists: {}\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = contributions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var contribution = _step.value;\n if (contribution.prop === \"transition\") {\n var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);\n if (!parsed.ok) return parsed;\n state.global = null;\n state.preset = null;\n state.lists = {};\n if (parsed.value.kind === \"global\") {\n state.global = parsed.value.value;\n continue;\n }\n var entries = parsed.value.entries;\n var presetEntry = entries.find(function(entry) {\n return entry.timing.type === \"preset\";\n });\n if (presetEntry) {\n state.preset = presetEntry.timing;\n state.lists.transitionProperty = listText(entries.map(function(entry) {\n return entry.property;\n }));\n state.lists.transitionDelay = listText(entries.map(function(entry) {\n return entry.delay;\n }));\n state.lists.transitionBehavior = listText(entries.map(function(entry) {\n return entry.behavior;\n }));\n continue;\n }\n state.lists.transitionProperty = listText(entries.map(function(entry) {\n return entry.property;\n }));\n state.lists.transitionDuration = listText(entries.map(function(entry) {\n return entry.timing.duration;\n }));\n state.lists.transitionTimingFunction = listText(entries.map(function(entry) {\n return entry.timing.timingFunction;\n }));\n state.lists.transitionDelay = listText(entries.map(function(entry) {\n return entry.delay;\n }));\n state.lists.transitionBehavior = listText(entries.map(function(entry) {\n return entry.behavior;\n }));\n continue;\n }\n if (state.global) {\n return {\n ok: false,\n diagnostics: [\n {\n code: \"transition-invalid-list\",\n token: contribution.prop,\n message: `\"${contribution.prop}\" cannot override the CSS-wide transition \"${state.global}\" per longhand; restate the whole transition`\n }\n ]\n };\n }\n if (state.preset && timingLonghands.has(contribution.prop)) {\n return {\n ok: false,\n diagnostics: [\n {\n code: \"transition-invalid-list\",\n token: contribution.prop,\n message: `\"${contribution.prop}\" cannot partially override the \"${state.preset.name}\" preset \\u2014 a preset's timing is not decomposable into CSS components; restate \\`transition\\` with CSS timing or change the preset`\n }\n ]\n };\n }\n state.lists[contribution.prop] = contribution.value;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (state.global) {\n return {\n ok: true,\n value: {\n kind: \"global\",\n value: state.global\n }\n };\n }\n if (state.preset) {\n var zipped = (0, import_transition.parseTransitionLonghands)({\n transitionProperty: state.lists.transitionProperty,\n transitionDelay: state.lists.transitionDelay,\n transitionBehavior: state.lists.transitionBehavior\n });\n if (!zipped.ok || zipped.value.kind !== \"transition\") return zipped;\n var preset = state.preset;\n var entries1 = zipped.value.entries.map(function(entry) {\n return {\n ...entry,\n timing: preset\n };\n });\n return {\n ok: true,\n value: {\n kind: \"transition\",\n entries: entries1\n }\n };\n }\n return (0, import_transition.parseTransitionLonghands)(state.lists);\n}\n//# sourceMappingURL=transitionAlign.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,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,QAAQ;EAChB,OAAO;GACL,IAAI;GACJ,OAAO;IACL,MAAM;IACN,OAAO,MAAM;GACf;EACF;CACF;CACA,IAAI,MAAM,QAAQ;EAChB,IAAI,UAAU,GAAG,kBAAkB,yBAAwB,CAAE;GAC3D,oBAAoB,MAAM,MAAM;GAChC,iBAAiB,MAAM,MAAM;GAC7B,oBAAoB,MAAM,MAAM;EAClC,CAAC;EACD,IAAI,CAAC,OAAO,MAAM,OAAO,MAAM,SAAS,cAAc,OAAO;EAC7D,IAAI,SAAS,MAAM;EACnB,IAAI,WAAW,OAAO,MAAM,QAAQ,IAAI,SAAS,OAAO;GACtD,OAAO;IACL,GAAG;IACH,QAAQ;GACV;EACF,CAAC;EACD,OAAO;GACL,IAAI;GACJ,OAAO;IACL,MAAM;IACN,SAAS;GACX;EACF;CACF;CACA,QAAQ,GAAG,kBAAkB,yBAAwB,CAAE,MAAM,KAAK;AACpE"}
1
+ {"version":3,"file":"transitionAlign.native.js","names":[],"sources":["cjs/shorthands/transitionAlign.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar transitionAlign_exports = {};\n__export(transitionAlign_exports, {\n alignTransitionContributions: () => alignTransitionContributions\n});\nmodule.exports = __toCommonJS(transitionAlign_exports);\nvar import_transition = require(\"./transition\");\nfunction fusedLabel(fused) {\n return fused.type === \"preset\" ? `\"${fused.name}\" preset` : `spring(${fused.duration}, ${fused.bounce})`;\n}\nvar timingLonghands = /* @__PURE__ */ new Set([\n \"transitionDuration\",\n \"transitionTimingFunction\"\n]);\nfunction listText(values) {\n return values.join(\", \");\n}\nfunction alignTransitionContributions(contributions, presetNames) {\n var state = {\n global: null,\n fused: null,\n lists: {}\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = contributions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var contribution = _step.value;\n if (contribution.prop === \"transition\") {\n var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);\n if (!parsed.ok) return parsed;\n state.global = null;\n state.fused = null;\n state.lists = {};\n if (parsed.value.kind === \"global\") {\n state.global = parsed.value.value;\n continue;\n }\n var entries = parsed.value.entries;\n var fusedEntry = entries.find(function(entry) {\n return entry.timing.type !== \"css\";\n });\n if (fusedEntry) {\n state.fused = fusedEntry.timing;\n state.lists.transitionProperty = listText(entries.map(function(entry) {\n return entry.property;\n }));\n state.lists.transitionDelay = listText(entries.map(function(entry) {\n return entry.delay;\n }));\n state.lists.transitionBehavior = listText(entries.map(function(entry) {\n return entry.behavior;\n }));\n continue;\n }\n state.lists.transitionProperty = listText(entries.map(function(entry) {\n return entry.property;\n }));\n state.lists.transitionDuration = listText(entries.map(function(entry) {\n return entry.timing.duration;\n }));\n state.lists.transitionTimingFunction = listText(entries.map(function(entry) {\n return entry.timing.timingFunction;\n }));\n state.lists.transitionDelay = listText(entries.map(function(entry) {\n return entry.delay;\n }));\n state.lists.transitionBehavior = listText(entries.map(function(entry) {\n return entry.behavior;\n }));\n continue;\n }\n if (state.global) {\n return {\n ok: false,\n diagnostics: [\n {\n code: \"transition-invalid-list\",\n token: contribution.prop,\n message: `\"${contribution.prop}\" cannot override the CSS-wide transition \"${state.global}\" per longhand; restate the whole transition`\n }\n ]\n };\n }\n if (state.fused && timingLonghands.has(contribution.prop)) {\n return {\n ok: false,\n diagnostics: [\n {\n code: \"transition-invalid-list\",\n token: contribution.prop,\n message: `\"${contribution.prop}\" cannot partially override ${fusedLabel(state.fused)}: its timing is not decomposable into CSS components. restate \\`transition\\` with CSS timing, or change the ${state.fused.type}`\n }\n ]\n };\n }\n state.lists[contribution.prop] = contribution.value;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (state.global) {\n return {\n ok: true,\n value: {\n kind: \"global\",\n value: state.global\n }\n };\n }\n if (state.fused) {\n var zipped = (0, import_transition.parseTransitionLonghands)({\n transitionProperty: state.lists.transitionProperty,\n transitionDelay: state.lists.transitionDelay,\n transitionBehavior: state.lists.transitionBehavior\n });\n if (!zipped.ok || zipped.value.kind !== \"transition\") return zipped;\n var fused = state.fused;\n var entries1 = zipped.value.entries.map(function(entry) {\n return {\n ...entry,\n timing: fused\n };\n });\n return {\n ok: true,\n value: {\n kind: \"transition\",\n entries: entries1\n }\n };\n }\n return (0, import_transition.parseTransitionLonghands)(state.lists);\n}\n//# sourceMappingURL=transitionAlign.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI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AM,KAAK,EAAE,8GAA8G,MAAM,MAAM;KACjN,CACF;IACF;GACF;GACA,MAAM,MAAM,aAAa,QAAQ,aAAa;EAChD;CACF,SAAS,KAAK;EACZ,oBAAoB;EACpB,iBAAiB;CACnB,UAAU;EACR,IAAI;GACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;IAC1D,UAAU,OAAO;GACnB;EACF,UAAU;GACR,IAAI,mBAAmB;IACrB,MAAM;GACR;EACF;CACF;CACA,IAAI,MAAM,QAAQ;EAChB,OAAO;GACL,IAAI;GACJ,OAAO;IACL,MAAM;IACN,OAAO,MAAM;GACf;EACF;CACF;CACA,IAAI,MAAM,OAAO;EACf,IAAI,UAAU,GAAG,kBAAkB,yBAAwB,CAAE;GAC3D,oBAAoB,MAAM,MAAM;GAChC,iBAAiB,MAAM,MAAM;GAC7B,oBAAoB,MAAM,MAAM;EAClC,CAAC;EACD,IAAI,CAAC,OAAO,MAAM,OAAO,MAAM,SAAS,cAAc,OAAO;EAC7D,IAAI,QAAQ,MAAM;EAClB,IAAI,WAAW,OAAO,MAAM,QAAQ,IAAI,SAAS,OAAO;GACtD,OAAO;IACL,GAAG;IACH,QAAQ;GACV;EACF,CAAC;EACD,OAAO;GACL,IAAI;GACJ,OAAO;IACL,MAAM;IACN,SAAS;GACX;EACF;CACF;CACA,QAAQ,GAAG,kBAAkB,yBAAwB,CAAE,MAAM,KAAK;AACpE"}
@@ -19,7 +19,10 @@ var __copyProps = (to, from, except, desc) => {
19
19
  };
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var transitionLegacy_exports = {};
22
- __export(transitionLegacy_exports, { migrateLegacyTransition: () => migrateLegacyTransition });
22
+ __export(transitionLegacy_exports, {
23
+ migrateLegacyTransition: () => migrateLegacyTransition,
24
+ printMigratedTransition: () => printMigratedTransition
25
+ });
23
26
  module.exports = __toCommonJS(transitionLegacy_exports);
24
27
  var import_transition = require("./transition.cjs");
25
28
  const legacyControlKeys = /* @__PURE__ */ new Set([
@@ -27,190 +30,324 @@ const legacyControlKeys = /* @__PURE__ */ new Set([
27
30
  "enter",
28
31
  "exit",
29
32
  "delay",
33
+ "duration",
30
34
  "stiffness",
31
35
  "damping",
32
36
  "mass",
33
- "tension",
34
- "friction",
35
37
  "velocity",
36
38
  "overshootClamping",
37
- "duration",
39
+ "restDisplacementThreshold",
40
+ "restSpeedThreshold",
41
+ "tension",
42
+ "friction",
38
43
  "bounciness",
39
44
  "speed"
40
45
  ]);
41
- const springConfigKeys = /* @__PURE__ */ new Set([
46
+ const springKeys = [
42
47
  "stiffness",
43
48
  "damping",
44
49
  "mass",
45
- "tension",
46
- "friction",
47
50
  "velocity",
48
51
  "overshootClamping",
49
- "duration",
50
- "bounciness",
51
- "speed"
52
- ]);
53
- function migrateLegacyTransition(input, presetNames) {
54
- if (typeof input === "string") return (0, import_transition.parseTransition)(input, presetNames);
55
- const inputIsTuple = Array.isArray(input);
56
- const options = inputIsTuple ? input[1] : input;
57
- const defaultValue = inputIsTuple ? input[0] : options.default;
58
- const diagnostics = [];
59
- const delay = options.delay === void 0 ? void 0 : typeof options.delay === "number" && Number.isFinite(options.delay) ? `${options.delay}ms` : null;
60
- if (delay === null) {
52
+ "restDisplacementThreshold",
53
+ "restSpeedThreshold"
54
+ ];
55
+ function stiffnessFromOrigami(value) {
56
+ return (value - 30) * 3.62 + 194;
57
+ }
58
+ function dampingFromOrigami(value) {
59
+ return (value - 8) * 3 + 25;
60
+ }
61
+ function fromBouncinessAndSpeed(bounciness, speed) {
62
+ const normalize = (value, start, end) => (value - start) / (end - start);
63
+ const projectNormal = (n, start, end) => start + n * (end - start);
64
+ const linear = (t, start, end) => t * end + (1 - t) * start;
65
+ const quadraticOut = (t, start, end) => linear(2 * t - t * t, start, end);
66
+ const b3Nobounce = (tension) => {
67
+ if (tension <= 18) {
68
+ return 7e-4 * tension ** 3 - .031 * tension ** 2 + .64 * tension + 1.28;
69
+ }
70
+ if (tension <= 44) {
71
+ return 44e-6 * tension ** 3 - .006 * tension ** 2 + .36 * tension + 2;
72
+ }
73
+ return 45e-8 * tension ** 3 - 332e-6 * tension ** 2 + .1078 * tension + 5.84;
74
+ };
75
+ const b = projectNormal(normalize(bounciness / 1.7, 0, 20), 0, .8);
76
+ const s = normalize(speed / 1.7, 0, 20);
77
+ const bouncyTension = projectNormal(s, .5, 200);
78
+ const bouncyFriction = quadraticOut(b, b3Nobounce(bouncyTension), .01);
79
+ return {
80
+ stiffness: stiffnessFromOrigami(bouncyTension),
81
+ damping: dampingFromOrigami(bouncyFriction)
82
+ };
83
+ }
84
+ function round(value) {
85
+ return Math.round(value * 1e3) / 1e3;
86
+ }
87
+ function migrateSpring(options, label, diagnostics) {
88
+ const spring = {};
89
+ for (const key of springKeys) {
90
+ if (options[key] !== void 0) spring[key] = options[key];
91
+ }
92
+ const { tension, friction, bounciness, speed } = options;
93
+ if (tension !== void 0 || friction !== void 0) {
94
+ const converted = {
95
+ stiffness: stiffnessFromOrigami(tension ?? 40),
96
+ damping: dampingFromOrigami(friction ?? 7)
97
+ };
98
+ spring.stiffness = round(converted.stiffness);
99
+ spring.damping = round(converted.damping);
100
+ } else if (bounciness !== void 0 || speed !== void 0) {
101
+ const converted = fromBouncinessAndSpeed(bounciness ?? 8, speed ?? 12);
102
+ spring.stiffness = round(converted.stiffness);
103
+ spring.damping = round(converted.damping);
104
+ }
105
+ if (spring.damping !== void 0 && spring.stiffness === void 0) {
106
+ diagnostics.push({
107
+ code: "transition-invalid-spring",
108
+ token: label,
109
+ message: `${label}: damping without stiffness has no v3 spelling, give it a stiffness or a duration and bounce`
110
+ });
111
+ }
112
+ return Object.keys(spring).length ? spring : void 0;
113
+ }
114
+ function migrateDelay(value, diagnostics) {
115
+ if (value === void 0) return;
116
+ if (typeof value === "number" && Number.isFinite(value)) return value;
117
+ diagnostics.push({
118
+ code: "transition-invalid-token",
119
+ token: String(value),
120
+ message: "legacy transition delay must be a finite number of milliseconds"
121
+ });
122
+ return;
123
+ }
124
+ function stringToObject(value, label, presetNames, diagnostics) {
125
+ const parsed = (0, import_transition.parseTransition)(value, presetNames);
126
+ if (!parsed.ok) {
127
+ for (const diagnostic of parsed.diagnostics) {
128
+ diagnostics.push({
129
+ ...diagnostic,
130
+ message: `${label}: ${diagnostic.message}`
131
+ });
132
+ }
133
+ return;
134
+ }
135
+ if (parsed.value.kind !== "transition" || parsed.value.entries.length !== 1) {
61
136
  diagnostics.push({
62
137
  code: "transition-invalid-token",
63
- token: String(options.delay),
64
- message: "legacy transition delay must be a finite number of milliseconds"
138
+ token: value,
139
+ message: `${label} must be a single preset or css timing value`
65
140
  });
141
+ return;
66
142
  }
67
- const resolveTiming = (rawValue, field) => {
68
- const parsed = (0, import_transition.parseTransition)(rawValue, presetNames);
69
- if (!parsed.ok) {
70
- for (let index = 0; index < parsed.diagnostics.length; index++) {
71
- const diagnostic = parsed.diagnostics[index];
72
- diagnostics.push({
73
- ...diagnostic,
74
- message: `legacy transition ${field}: ${diagnostic.message}`
75
- });
76
- }
77
- return;
143
+ const entry = parsed.value.entries[0];
144
+ if (entry.timing.type === "preset") return { preset: entry.timing.name };
145
+ if (entry.timing.type === "css") {
146
+ return entry.timing.timingFunction === "ease" ? { duration: entry.timing.duration } : {
147
+ duration: entry.timing.duration,
148
+ easing: entry.timing.timingFunction
149
+ };
150
+ }
151
+ diagnostics.push({
152
+ code: "transition-invalid-token",
153
+ token: value,
154
+ message: `${label} must be a single preset or css timing value`
155
+ });
156
+ return;
157
+ }
158
+ const baseTimingKeys = [
159
+ "preset",
160
+ "duration",
161
+ "bounce",
162
+ "easing",
163
+ "spring"
164
+ ];
165
+ function applyAnimateOnly(value, animateOnly, presetNames, diagnostics) {
166
+ for (const state of ["enter", "exit"]) {
167
+ const nested = value[state];
168
+ if (typeof nested === "string") {
169
+ const asObject = stringToObject(nested, state, presetNames, diagnostics);
170
+ if (!asObject) continue;
171
+ applyAnimateOnly(asObject, animateOnly, presetNames, diagnostics);
172
+ value[state] = asObject;
173
+ } else if (nested && typeof nested === "object") {
174
+ applyAnimateOnly(nested, animateOnly, presetNames, diagnostics);
78
175
  }
79
- if (parsed.value.kind !== "transition" || parsed.value.entries.length !== 1 || parsed.value.entries[0].property !== "all") {
176
+ }
177
+ const allowed = new Set(animateOnly);
178
+ for (const key in value) {
179
+ if (TRANSITION_MIGRATION_RESERVED.has(key)) continue;
180
+ if (!allowed.has(key)) delete value[key];
181
+ }
182
+ if (baseTimingKeys.some((key) => value[key] !== void 0)) {
183
+ value.properties = animateOnly.join(", ");
184
+ }
185
+ }
186
+ const TRANSITION_MIGRATION_RESERVED = /* @__PURE__ */ new Set([
187
+ "preset",
188
+ "duration",
189
+ "bounce",
190
+ "easing",
191
+ "delay",
192
+ "behavior",
193
+ "properties",
194
+ "spring",
195
+ "enter",
196
+ "exit"
197
+ ]);
198
+ function migrateLegacyTransition(input, presetNames, animateOnly) {
199
+ if (animateOnly?.length === 0) return {
200
+ ok: true,
201
+ value: "none"
202
+ };
203
+ if (typeof input === "string") {
204
+ if (!animateOnly) return {
205
+ ok: true,
206
+ value: input
207
+ };
208
+ const diagnostics2 = [];
209
+ const asObject = stringToObject(input, "transition", presetNames, diagnostics2);
210
+ if (!asObject) return {
211
+ ok: false,
212
+ diagnostics: diagnostics2
213
+ };
214
+ applyAnimateOnly(asObject, animateOnly, presetNames, diagnostics2);
215
+ if (diagnostics2.length) return {
216
+ ok: false,
217
+ diagnostics: diagnostics2
218
+ };
219
+ return {
220
+ ok: true,
221
+ value: asObject
222
+ };
223
+ }
224
+ const isTuple = Array.isArray(input);
225
+ const tuple = input;
226
+ const options = isTuple ? tuple[1] ?? {} : input;
227
+ const diagnostics = [];
228
+ const presetValue = isTuple ? tuple[0] : options.default;
229
+ let preset;
230
+ if (presetValue !== void 0) {
231
+ if (typeof presetValue === "string") preset = presetValue;
232
+ else {
80
233
  diagnostics.push({
81
234
  code: "transition-invalid-token",
82
- token: rawValue,
83
- message: `legacy transition ${field} must be a preset or CSS timing value`
235
+ token: String(presetValue),
236
+ message: "legacy transition default must be a preset or css timing value"
84
237
  });
85
- return;
86
238
  }
87
- return parsed.value.entries[0];
88
- };
89
- let defaultTransition;
90
- if (defaultValue !== void 0) {
91
- if (typeof defaultValue === "string") {
92
- defaultTransition = resolveTiming(defaultValue, "default");
93
- } else {
239
+ }
240
+ const delay = migrateDelay(options.delay, diagnostics);
241
+ const spring = migrateSpring(options, "transition", diagnostics);
242
+ const value = {};
243
+ if (preset !== void 0) {
244
+ const asObject = presetNames.has(preset) ? { preset } : stringToObject(preset, "transition default", presetNames, diagnostics);
245
+ if (asObject) Object.assign(value, asObject);
246
+ }
247
+ if (options.duration !== void 0) {
248
+ if (value.duration !== void 0 && value.duration !== options.duration) {
94
249
  diagnostics.push({
95
- code: "transition-invalid-token",
96
- token: String(defaultValue),
97
- message: "legacy transition default must be a preset or CSS timing value"
250
+ code: "transition-invalid-duration",
251
+ token: String(options.duration),
252
+ message: `transition sets both a "${value.duration}" timing and duration ${options.duration}; keep the one you meant`
98
253
  });
99
254
  }
255
+ value.duration = options.duration;
100
256
  }
101
- const resolveLifecycle = (field) => {
102
- const rawValue = options[field];
103
- if (rawValue === void 0) return;
104
- if (typeof rawValue === "string") return resolveTiming(rawValue, field);
105
- diagnostics.push({
106
- code: "transition-invalid-token",
107
- token: String(rawValue),
108
- message: `legacy transition ${field} must be a preset or CSS timing value`
109
- });
110
- return;
111
- };
112
- const enter = resolveLifecycle("enter");
113
- const exit = resolveLifecycle("exit");
114
- const config = {};
115
- for (const key of springConfigKeys) {
116
- if (options[key] !== void 0) config[key] = options[key];
117
- }
118
- const hasConfig = Object.keys(config).length > 0;
119
- const entries = [];
120
- if (defaultTransition) {
121
- if (defaultTransition.timing.type === "css" && hasConfig) {
257
+ if (delay !== void 0) value.delay = delay;
258
+ if (spring) value.spring = spring;
259
+ for (const state of ["enter", "exit"]) {
260
+ const raw = options[state];
261
+ if (raw === void 0) continue;
262
+ if (typeof raw !== "string") {
122
263
  diagnostics.push({
123
264
  code: "transition-invalid-token",
124
- token: String(defaultValue),
125
- message: "spring overrides cannot be applied to CSS transition timing"
265
+ token: String(raw),
266
+ message: `legacy transition ${state} must be a preset or css timing value`
126
267
  });
268
+ continue;
127
269
  }
128
- entries.push({
129
- ...defaultTransition,
130
- delay: delay ?? defaultTransition.delay,
131
- timing: defaultTransition.timing.type === "preset" && hasConfig ? {
132
- ...defaultTransition.timing,
133
- config
134
- } : defaultTransition.timing
135
- });
270
+ if (delay === void 0) {
271
+ value[state] = raw;
272
+ continue;
273
+ }
274
+ const asObject = stringToObject(raw, `legacy transition ${state}`, presetNames, diagnostics);
275
+ if (asObject) value[state] = {
276
+ ...asObject,
277
+ delay
278
+ };
136
279
  }
137
- for (const [property, rawValue] of Object.entries(options)) {
280
+ for (const [property, raw] of Object.entries(options)) {
138
281
  if (legacyControlKeys.has(property)) continue;
139
- let transition;
140
- let propertyConfig;
141
- if (typeof rawValue === "string") {
142
- transition = resolveTiming(rawValue, property);
143
- if (!transition) continue;
144
- } else if (rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
145
- propertyConfig = rawValue;
146
- if (propertyConfig.type === void 0) {
147
- transition = defaultTransition;
148
- } else if (typeof propertyConfig.type === "string") {
149
- transition = resolveTiming(propertyConfig.type, property);
150
- if (!transition) continue;
151
- } else {
152
- diagnostics.push({
153
- code: "transition-invalid-token",
154
- token: property,
155
- message: `legacy transition property "${property}" has a non-string type`
156
- });
282
+ if (typeof raw === "string") {
283
+ if (delay === void 0) {
284
+ value[property] = raw;
157
285
  continue;
158
286
  }
159
- } else {
287
+ const asObject2 = stringToObject(raw, `transition ${property}`, presetNames, diagnostics);
288
+ if (asObject2) value[property] = {
289
+ ...asObject2,
290
+ delay
291
+ };
292
+ continue;
293
+ }
294
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
160
295
  diagnostics.push({
161
296
  code: "transition-invalid-token",
162
297
  token: property,
163
- message: `legacy transition property "${property}" needs a preset, CSS timing value, or default`
298
+ message: `legacy transition property "${property}" needs a preset, css timing value, or default`
164
299
  });
165
300
  continue;
166
301
  }
167
- if (!transition) {
302
+ const config = raw;
303
+ const entry = {};
304
+ const propertyPreset = config.type === void 0 ? preset : config.type;
305
+ if (propertyPreset === void 0) {
168
306
  diagnostics.push({
169
307
  code: "transition-invalid-token",
170
308
  token: property,
171
- message: `legacy transition property "${property}" needs a preset, CSS timing value, or default`
309
+ message: `legacy transition property "${property}" needs a preset, css timing value, or default`
172
310
  });
173
311
  continue;
174
312
  }
175
- const propertyOverrides = propertyConfig ? Object.fromEntries(Object.entries(propertyConfig).filter(([key]) => key !== "type")) : void 0;
176
- const hasPropertyOverrides = propertyOverrides !== void 0 && Object.keys(propertyOverrides).length > 0;
177
- if (hasPropertyOverrides && transition.timing.type === "css") {
313
+ if (typeof propertyPreset !== "string") {
178
314
  diagnostics.push({
179
315
  code: "transition-invalid-token",
180
316
  token: property,
181
- message: `legacy transition property "${property}" cannot apply spring overrides to CSS timing`
317
+ message: `legacy transition property "${property}" has a non-string type`
182
318
  });
183
319
  continue;
184
320
  }
185
- entries.push({
186
- ...transition,
187
- property,
188
- timing: transition.timing.type === "preset" && propertyOverrides && hasPropertyOverrides ? {
189
- ...transition.timing,
190
- config: propertyOverrides
191
- } : transition.timing,
192
- delay: delay ?? transition.delay
193
- });
321
+ const asObject = presetNames.has(propertyPreset) ? { preset: propertyPreset } : stringToObject(propertyPreset, `transition ${property}`, presetNames, diagnostics);
322
+ if (!asObject) continue;
323
+ Object.assign(entry, asObject);
324
+ if (config.duration !== void 0) entry.duration = config.duration;
325
+ const propertyDelay = migrateDelay(config.delay, diagnostics) ?? delay;
326
+ if (propertyDelay !== void 0) entry.delay = propertyDelay;
327
+ const propertySpring = migrateSpring(config, `transition ${property}`, diagnostics);
328
+ if (propertySpring) entry.spring = propertySpring;
329
+ value[property] = entry;
194
330
  }
331
+ if (animateOnly) applyAnimateOnly(value, animateOnly, presetNames, diagnostics);
195
332
  if (diagnostics.length) return {
196
333
  ok: false,
197
334
  diagnostics
198
335
  };
199
- const value = {
200
- kind: "transition",
201
- entries,
202
- ...enter ? { enter: {
203
- ...enter,
204
- delay: delay ?? enter.delay
205
- } } : {},
206
- ...exit ? { exit: {
207
- ...exit,
208
- delay: delay ?? exit.delay
209
- } } : {},
210
- ...hasConfig ? { config } : {}
211
- };
212
336
  return {
213
337
  ok: true,
214
338
  value
215
339
  };
216
340
  }
341
+ const identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
342
+ function quote(value) {
343
+ return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
344
+ }
345
+ function printMigratedTransition(value) {
346
+ if (typeof value === "string") return quote(value);
347
+ const parts = [];
348
+ for (const [key, entry] of Object.entries(value)) {
349
+ const name = identifierPattern.test(key) ? key : quote(key);
350
+ parts.push(`${name}: ${typeof entry === "string" ? quote(entry) : entry !== null && typeof entry === "object" ? printMigratedTransition(entry) : String(entry)}`);
351
+ }
352
+ return `{ ${parts.join(", ")} }`;
353
+ }