@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
@@ -1,21 +1,21 @@
1
1
  import { namedCssColors } from "../runtime/namedCssColors.native.js";
2
- import { fontWeightNames, grammarEntries, insetAxisProps, prefixToEntries, radiusCornerProps, sizeUtilityProps, standaloneValueProps, textAlignKeywords, wholeClassConveniences, wholeClassUtilities } from "./registry.native.js";
2
+ import { propTokenGroupFallbacks } from "./config.native.js";
3
+ import { fontWeightNames, grammarEntries, insetAxisProps, prefixToEntries, propToGrammarEntry, radiusCornerProps, sizeUtilityProps, standaloneValueProps, textAlignKeywords, wholeClassConveniences, wholeClassUtilities } from "./registry.native.js";
3
4
  import { canonicalClauseModifier, containerModifierSizeEnd, parseGroupModifier } from "../runtime/clauseIdentity.native.js";
4
5
  import { compileModifierVocabulary, modifierKindMedia } from "../runtime/modifierVocabulary.native.js";
5
6
  import { splitColorOpacitySuffix } from "../runtime/colorOpacity.native.js";
6
7
  import { getSafeAreaEdge } from "../runtime/safeAreaVariables.native.js";
7
8
 
8
- function _instanceof(left, right) {
9
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
10
- return !!right[Symbol.hasInstance](left);
11
- } else {
12
- return left instanceof right;
13
- }
14
- }
15
9
  var sizingConveniences = /* @__PURE__ */ new Set([
16
10
  "full",
17
11
  "auto",
18
12
  "screen",
13
+ "dvh",
14
+ "lvh",
15
+ "svh",
16
+ "dvw",
17
+ "lvw",
18
+ "svw",
19
19
  "min",
20
20
  "max",
21
21
  "fit"
@@ -26,6 +26,22 @@ var fontGenerics = /* @__PURE__ */ new Set([
26
26
  "mono"
27
27
  ]);
28
28
  var numericPattern = /^\d+(?:\.\d+)?$/;
29
+ var tailwindLeadingRatios = {
30
+ none: 1,
31
+ tight: 1.25,
32
+ snug: 1.375,
33
+ normal: 1.5,
34
+ relaxed: 1.625,
35
+ loose: 2
36
+ };
37
+ var tailwindTrackingEms = {
38
+ tighter: -.05,
39
+ tight: -.025,
40
+ normal: 0,
41
+ wide: .025,
42
+ wider: .05,
43
+ widest: .1
44
+ };
29
45
  var extraPrefixes = [
30
46
  "border-x",
31
47
  "border-y",
@@ -33,9 +49,12 @@ var extraPrefixes = [
33
49
  "rounded-r",
34
50
  "rounded-b",
35
51
  "rounded-l",
52
+ "rounded-s",
53
+ "rounded-e",
36
54
  "inset-x",
37
55
  "inset-y",
38
- "size"
56
+ "size",
57
+ "translate"
39
58
  ];
40
59
  var negativeTokenProps = /* @__PURE__ */ new Set([
41
60
  "margin",
@@ -43,6 +62,10 @@ var negativeTokenProps = /* @__PURE__ */ new Set([
43
62
  "marginRight",
44
63
  "marginBottom",
45
64
  "marginLeft",
65
+ "marginInlineStart",
66
+ "marginInlineEnd",
67
+ "marginBlockStart",
68
+ "marginBlockEnd",
46
69
  "marginHorizontal",
47
70
  "marginVertical",
48
71
  "top",
@@ -50,9 +73,53 @@ var negativeTokenProps = /* @__PURE__ */ new Set([
50
73
  "bottom",
51
74
  "left",
52
75
  "inset",
76
+ "insetInlineStart",
77
+ "insetInlineEnd",
78
+ "insetBlockStart",
79
+ "insetBlockEnd",
80
+ "start",
81
+ "end",
82
+ "zIndex",
53
83
  "x",
54
84
  "y",
55
- "letterSpacing"
85
+ "rotate",
86
+ "rotateX",
87
+ "rotateY",
88
+ "rotateZ",
89
+ "skewX",
90
+ "skewY",
91
+ "order",
92
+ "scale",
93
+ "scaleX",
94
+ "scaleY",
95
+ "letterSpacing",
96
+ "outlineOffset"
97
+ ]);
98
+ var positionSpaceProps = /* @__PURE__ */ new Set([
99
+ "top",
100
+ "right",
101
+ "bottom",
102
+ "left",
103
+ "inset",
104
+ "insetInlineStart",
105
+ "insetInlineEnd",
106
+ "insetBlockStart",
107
+ "insetBlockEnd",
108
+ "start",
109
+ "end"
110
+ ]);
111
+ var marginSpaceProps = /* @__PURE__ */ new Set([
112
+ "margin",
113
+ "marginTop",
114
+ "marginRight",
115
+ "marginBottom",
116
+ "marginLeft",
117
+ "marginInlineStart",
118
+ "marginInlineEnd",
119
+ "marginBlockStart",
120
+ "marginBlockEnd",
121
+ "marginHorizontal",
122
+ "marginVertical"
56
123
  ]);
57
124
  var borderWidthKeywords = /* @__PURE__ */ new Set([
58
125
  "thin",
@@ -82,7 +149,7 @@ var cssLengthPattern = new RegExp(`^-?(?:\\d+|\\d*\\.\\d+)${cssLengthUnits}$`, "
82
149
  function hasName(names, name) {
83
150
  if (!names) return false;
84
151
  if (Array.isArray(names)) return names.includes(name);
85
- if (_instanceof(names, Set)) return names.has(name);
152
+ if (names instanceof Set) return names.has(name);
86
153
  return name in names;
87
154
  }
88
155
  function splitCandidate(candidate) {
@@ -183,13 +250,26 @@ function normalizeModifiers(modifiers, config) {
183
250
  }
184
251
  return normalized;
185
252
  }
253
+ function tokenDomain(config, category) {
254
+ var _config_tokenNames, _config_tokenNames1;
255
+ var fallback = propTokenGroupFallbacks[category];
256
+ return ((_config_tokenNames = config.tokenNames) === null || _config_tokenNames === void 0 ? void 0 : _config_tokenNames[category]) || (fallback ? (_config_tokenNames1 = config.tokenNames) === null || _config_tokenNames1 === void 0 ? void 0 : _config_tokenNames1[fallback] : void 0);
257
+ }
186
258
  function hasTokenDomain(config, category) {
187
- var _config_tokenNames;
188
- return ((_config_tokenNames = config.tokenNames) === null || _config_tokenNames === void 0 ? void 0 : _config_tokenNames[category]) !== void 0;
259
+ return tokenDomain(config, category) !== void 0;
189
260
  }
190
261
  function hasTokenName(config, category, name) {
191
- var _config_tokenNames;
192
- return hasName((_config_tokenNames = config.tokenNames) === null || _config_tokenNames === void 0 ? void 0 : _config_tokenNames[category], name);
262
+ return resolveTokenName(config, category, name) !== null;
263
+ }
264
+ function decimalHalfTokenAlias(name) {
265
+ var match = /^(-?\d+)\.5$/.exec(name);
266
+ return match ? `${match[1]}-5` : null;
267
+ }
268
+ function resolveTokenName(config, category, name) {
269
+ var names = tokenDomain(config, category);
270
+ if (hasName(names, name)) return name;
271
+ var alias = decimalHalfTokenAlias(name);
272
+ return alias !== null && hasName(names, alias) ? alias : null;
193
273
  }
194
274
  function entriesForProps(props) {
195
275
  var byProp = new Map(grammarEntries.map(function(entry2) {
@@ -237,11 +317,19 @@ function resolveEntries(prefix, config) {
237
317
  }));
238
318
  }
239
319
  if (prefix === "size") {
240
- return entriesForProps(sizeUtilityProps);
320
+ return entriesForProps(sizeUtilityProps).map(function(entry) {
321
+ return {
322
+ ...entry,
323
+ tokenCategory: "size"
324
+ };
325
+ });
241
326
  }
242
327
  if (prefix === "inset-x" || prefix === "inset-y") {
243
328
  return entriesForProps(insetAxisProps[prefix.slice("inset-".length)]);
244
329
  }
330
+ if (prefix === "translate") {
331
+ return entriesForProps(["x", "y"]);
332
+ }
245
333
  if (prefix.startsWith("rounded-")) {
246
334
  var props = radiusCornerProps[prefix.slice("rounded-".length)];
247
335
  return props ? entriesForProps(props) : [];
@@ -380,6 +468,9 @@ function arbitraryTextKind(value) {
380
468
  if (/^[a-zA-Z][a-zA-Z0-9-]*$/.test(value)) return "fontSize";
381
469
  return null;
382
470
  }
471
+ function isWidthColorPrefix(prefix) {
472
+ return prefix.startsWith("border") || prefix === "outline";
473
+ }
383
474
  function arbitraryBorderKind(value) {
384
475
  if (/^-?(?:\d+|\d*\.\d+)$/.test(value)) return "width";
385
476
  if (cssLengthPattern.test(value) || borderWidthKeywords.has(value)) return "width";
@@ -412,12 +503,12 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
412
503
  var arbitrary = arbitraryInner(rawValue);
413
504
  if (arbitrary !== null) {
414
505
  if (!arbitrary) return null;
415
- if (prefix.startsWith("border")) {
416
- var width = entries.find(function(entry2) {
417
- return entry2.prop.endsWith("Width");
506
+ if (isWidthColorPrefix(prefix)) {
507
+ var width = entries.find(function(entry3) {
508
+ return entry3.prop.endsWith("Width");
418
509
  });
419
- var color = entries.find(function(entry2) {
420
- return entry2.prop.endsWith("Color");
510
+ var color = entries.find(function(entry3) {
511
+ return entry3.prop.endsWith("Color");
421
512
  });
422
513
  var kind = arbitraryBorderKind(decodeArbitrary(arbitrary));
423
514
  if (!kind || !width || !color) return null;
@@ -428,11 +519,11 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
428
519
  }
429
520
  if (prefix === "text") {
430
521
  var kind1 = arbitraryTextKind(decodeArbitrary(arbitrary));
431
- var fontSize = entries.find(function(entry2) {
432
- return entry2.prop === "fontSize";
522
+ var fontSize = entries.find(function(entry3) {
523
+ return entry3.prop === "fontSize";
433
524
  });
434
- var color1 = entries.find(function(entry2) {
435
- return entry2.prop === "color";
525
+ var color1 = entries.find(function(entry3) {
526
+ return entry3.prop === "color";
436
527
  });
437
528
  if (kind1 === "fontSize" && fontSize) {
438
529
  return {
@@ -450,8 +541,8 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
450
541
  }
451
542
  if (prefix === "font") {
452
543
  return {
453
- entry: entries.find(function(entry2) {
454
- return entry2.prop === "fontFamily";
544
+ entry: entries.find(function(entry3) {
545
+ return entry3.prop === "fontFamily";
455
546
  }),
456
547
  valueKind: "arbitrary"
457
548
  };
@@ -462,8 +553,8 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
462
553
  };
463
554
  }
464
555
  if (prefix === "text") {
465
- var fontSize1 = entries.find(function(entry2) {
466
- return entry2.prop === "fontSize";
556
+ var fontSize1 = entries.find(function(entry3) {
557
+ return entry3.prop === "fontSize";
467
558
  });
468
559
  if (fontSize1 && hasTokenName(config, "fontSize", rawValue)) {
469
560
  return {
@@ -473,15 +564,21 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
473
564
  }
474
565
  if (textAlignKeywords.has(rawValue)) {
475
566
  return {
476
- entry: entries.find(function(entry2) {
477
- return entry2.prop === "textAlign";
567
+ entry: entries.find(function(entry3) {
568
+ return entry3.prop === "textAlign";
478
569
  }),
479
570
  valueKind: "enum"
480
571
  };
481
572
  }
482
- var color2 = entries.find(function(entry2) {
483
- return entry2.prop === "color";
573
+ var color2 = entries.find(function(entry3) {
574
+ return entry3.prop === "color";
484
575
  });
576
+ if (color2 && rawValue === "transparent") {
577
+ return {
578
+ entry: color2,
579
+ valueKind: "enum"
580
+ };
581
+ }
485
582
  var colorName = tokenLookupName("color", rawValue);
486
583
  if (color2 && hasTokenName(config, "color", colorName)) {
487
584
  return {
@@ -492,11 +589,11 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
492
589
  return null;
493
590
  }
494
591
  if (prefix === "font") {
495
- var fontFamily = entries.find(function(entry2) {
496
- return entry2.prop === "fontFamily";
592
+ var fontFamily = entries.find(function(entry3) {
593
+ return entry3.prop === "fontFamily";
497
594
  });
498
- var fontWeight = entries.find(function(entry2) {
499
- return entry2.prop === "fontWeight";
595
+ var fontWeight = entries.find(function(entry3) {
596
+ return entry3.prop === "fontWeight";
500
597
  });
501
598
  if (!fontFamily) return null;
502
599
  var matchesFamily = hasTokenName(config, "fontFamily", rawValue);
@@ -520,15 +617,16 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
520
617
  convenience: "font-generic"
521
618
  } : null;
522
619
  }
523
- if (prefix.startsWith("border")) {
524
- var width1 = entries.find(function(entry2) {
525
- return entry2.prop.endsWith("Width");
620
+ if (isWidthColorPrefix(prefix)) {
621
+ var width1 = entries.find(function(entry3) {
622
+ return entry3.prop.endsWith("Width");
526
623
  });
527
- var color3 = entries.find(function(entry2) {
528
- return entry2.prop.endsWith("Color");
624
+ var color3 = entries.find(function(entry3) {
625
+ return entry3.prop.endsWith("Color");
529
626
  });
530
627
  var token = negative ? `-${rawValue}` : rawValue;
531
- var matchesWidth = width1 && hasTokenName(config, "space", token);
628
+ var widthCategory = (width1 === null || width1 === void 0 ? void 0 : width1.tokenCategory) || "space";
629
+ var matchesWidth = width1 && hasTokenName(config, widthCategory, token);
532
630
  var colorName1 = tokenLookupName("color", rawValue);
533
631
  var matchesColor = color3 && hasTokenName(config, "color", colorName1);
534
632
  if (matchesWidth && matchesColor) return null;
@@ -544,50 +642,201 @@ function chooseEntry(entries, prefix, rawValue, negative, config) {
544
642
  valueKind: "token"
545
643
  };
546
644
  }
645
+ if (color3 && rawValue === "transparent") {
646
+ return {
647
+ entry: color3,
648
+ valueKind: "enum"
649
+ };
650
+ }
547
651
  return null;
548
652
  }
653
+ if (prefix === "flex" && fractionIsValid(rawValue)) {
654
+ var flex = entries.find(function(entry3) {
655
+ return entry3.prop === "flex";
656
+ });
657
+ if (flex) {
658
+ return {
659
+ entry: flex,
660
+ valueKind: "convenience",
661
+ convenience: "flex-bundle"
662
+ };
663
+ }
664
+ }
665
+ if (prefix === "tracking" && Object.hasOwn(tailwindTrackingEms, rawValue)) {
666
+ var letterSpacing = entries.find(function(entry3) {
667
+ return entry3.prop === "letterSpacing";
668
+ });
669
+ if (letterSpacing) {
670
+ return {
671
+ entry: letterSpacing,
672
+ valueKind: "convenience",
673
+ convenience: "tracking-keyword"
674
+ };
675
+ }
676
+ }
677
+ if (prefix === "leading" && Object.hasOwn(tailwindLeadingRatios, rawValue)) {
678
+ var lineHeight = entries.find(function(entry3) {
679
+ return entry3.prop === "lineHeight";
680
+ });
681
+ if (lineHeight) {
682
+ return {
683
+ entry: lineHeight,
684
+ valueKind: "convenience",
685
+ convenience: "leading-keyword"
686
+ };
687
+ }
688
+ }
689
+ if (numericPattern.test(rawValue)) {
690
+ var angle = entries.find(function(entry3) {
691
+ var _entry_conveniences2;
692
+ return (_entry_conveniences2 = entry3.conveniences) === null || _entry_conveniences2 === void 0 ? void 0 : _entry_conveniences2.includes("angle");
693
+ });
694
+ if (angle) {
695
+ return {
696
+ entry: angle,
697
+ valueKind: "convenience",
698
+ convenience: "angle"
699
+ };
700
+ }
701
+ if (prefix === "flex") {
702
+ var flex1 = entries.find(function(entry3) {
703
+ return entry3.prop === "flex";
704
+ });
705
+ if (flex1) return {
706
+ entry: flex1,
707
+ valueKind: "convenience",
708
+ convenience: "flex-bundle"
709
+ };
710
+ }
711
+ if (prefix === "grow") {
712
+ var grow = entries.find(function(entry3) {
713
+ return entry3.prop === "flexGrow";
714
+ });
715
+ if (grow) return {
716
+ entry: grow,
717
+ valueKind: "convenience",
718
+ convenience: "integer"
719
+ };
720
+ }
721
+ if (prefix === "shrink") {
722
+ var shrink = entries.find(function(entry3) {
723
+ return entry3.prop === "flexShrink";
724
+ });
725
+ if (shrink) return {
726
+ entry: shrink,
727
+ valueKind: "convenience",
728
+ convenience: "integer"
729
+ };
730
+ }
731
+ if (prefix === "line-clamp") {
732
+ var clamp = entries.find(function(entry3) {
733
+ return entry3.prop === "numberOfLines";
734
+ });
735
+ if (clamp) return {
736
+ entry: clamp,
737
+ valueKind: "convenience",
738
+ convenience: "integer"
739
+ };
740
+ }
741
+ if (prefix === "leading") {
742
+ var lineHeight1 = entries.find(function(entry3) {
743
+ return entry3.prop === "lineHeight";
744
+ });
745
+ if (lineHeight1 && (!lineHeight1.tokenCategory || !hasTokenName(config, lineHeight1.tokenCategory, rawValue))) {
746
+ return {
747
+ entry: lineHeight1,
748
+ valueKind: "convenience",
749
+ convenience: "integer"
750
+ };
751
+ }
752
+ }
753
+ if (prefix === "grid-cols" || prefix === "col-span" || prefix === "col-start" || prefix === "col-end" || prefix === "row-span" || prefix === "row-start" || prefix === "row-end") {
754
+ var entry1 = entries[0];
755
+ if (entry1) return {
756
+ entry: entry1,
757
+ valueKind: "convenience",
758
+ convenience: "integer"
759
+ };
760
+ }
761
+ }
549
762
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
550
763
  try {
551
764
  for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
552
- var entry1 = _step.value;
553
- if (entry1.tokenCategory) {
554
- var name = negative ? `-${rawValue}` : rawValue;
555
- var tokenName = tokenLookupName(entry1.tokenCategory, name);
556
- if (hasTokenName(config, entry1.tokenCategory, tokenName)) {
765
+ var entry2 = _step.value;
766
+ var _entry_conveniences;
767
+ if (entry2.tokenCategory) {
768
+ var _entry_conveniences1;
769
+ if (entry2.tokenCategory === "color" && rawValue === "transparent") {
557
770
  return {
558
- entry: entry1,
771
+ entry: entry2,
772
+ valueKind: "enum"
773
+ };
774
+ }
775
+ if (entry2.tokenCategory === "radius" && rawValue === "none") {
776
+ return {
777
+ entry: entry2,
778
+ valueKind: "convenience",
779
+ convenience: "zero"
780
+ };
781
+ }
782
+ var name = negative && rawValue !== "0" ? `-${rawValue}` : rawValue;
783
+ var tokenName = tokenLookupName(entry2.tokenCategory, name);
784
+ if (hasTokenName(config, entry2.tokenCategory, tokenName)) {
785
+ return {
786
+ entry: entry2,
559
787
  valueKind: "token"
560
788
  };
561
789
  }
562
- if (entry1.tokenCategory === "size" && (sizingConveniences.has(rawValue) || fractionIsValid(rawValue))) {
790
+ if (((_entry_conveniences1 = entry2.conveniences) === null || _entry_conveniences1 === void 0 ? void 0 : _entry_conveniences1.includes("sizing-keyword")) && (sizingConveniences.has(rawValue) || fractionIsValid(rawValue))) {
791
+ return {
792
+ entry: entry2,
793
+ valueKind: "convenience",
794
+ convenience: "sizing-keyword"
795
+ };
796
+ }
797
+ if (positionSpaceProps.has(entry2.prop) && (rawValue === "full" || rawValue === "auto" || fractionIsValid(rawValue))) {
798
+ return {
799
+ entry: entry2,
800
+ valueKind: "convenience",
801
+ convenience: "sizing-keyword"
802
+ };
803
+ }
804
+ if (marginSpaceProps.has(entry2.prop) && rawValue === "auto") {
563
805
  return {
564
- entry: entry1,
806
+ entry: entry2,
565
807
  valueKind: "convenience",
566
808
  convenience: "sizing-keyword"
567
809
  };
568
810
  }
569
- if (entry1.tokenCategory === "zIndex" && numericPattern.test(rawValue)) {
811
+ if (entry2.tokenCategory === "zIndex" && numericPattern.test(rawValue)) {
570
812
  return {
571
- entry: entry1,
813
+ entry: entry2,
572
814
  valueKind: "convenience",
573
815
  convenience: "integer"
574
816
  };
575
817
  }
576
818
  continue;
577
819
  }
578
- if (prefix === "opacity" || prefix === "scale") {
820
+ if (prefix === "opacity" || prefix === "scale" || prefix === "scale-x" || prefix === "scale-y") {
579
821
  if (numericPattern.test(rawValue)) {
580
822
  return {
581
- entry: entry1,
823
+ entry: entry2,
582
824
  valueKind: "convenience",
583
825
  convenience: "percentage"
584
826
  };
585
827
  }
586
828
  continue;
587
829
  }
588
- if (entry1.prop === "zIndex" && numericPattern.test(rawValue)) {
830
+ if (entry2.prop === "zIndex" && numericPattern.test(rawValue)) {
589
831
  return {
590
- entry: entry1,
832
+ entry: entry2,
833
+ valueKind: "convenience",
834
+ convenience: "integer"
835
+ };
836
+ }
837
+ if (((_entry_conveniences = entry2.conveniences) === null || _entry_conveniences === void 0 ? void 0 : _entry_conveniences.includes("integer")) && numericPattern.test(rawValue)) {
838
+ return {
839
+ entry: entry2,
591
840
  valueKind: "convenience",
592
841
  convenience: "integer"
593
842
  };
@@ -623,7 +872,7 @@ function parseCandidate(candidate, config) {
623
872
  if (rawValue) {
624
873
  var entries = resolveEntries(prefix, config);
625
874
  var selected = chooseEntry(entries, prefix, rawValue, negative, config);
626
- if (selected && (!negative || selected.valueKind === "token" && negativeTokenProps.has(selected.entry.prop))) {
875
+ if (selected && (!negative || selected.convenience === "tracking-keyword" || negativeTokenProps.has(selected.entry.prop) && (selected.valueKind === "token" || selected.valueKind === "arbitrary" && selected.entry.prop === "order" || selected.convenience === "angle" || selected.convenience === "percentage" || selected.convenience === "sizing-keyword" || selected.convenience === "integer"))) {
627
876
  dynamic = {
628
877
  prefix,
629
878
  rawValue,
@@ -648,7 +897,7 @@ function parseCandidate(candidate, config) {
648
897
  }
649
898
  }
650
899
  var direct = wholeClassUtilities[split.base];
651
- if (!negative && direct) {
900
+ if (!negative && direct && (split.base !== "shadow" || hasTokenName(config, "boxShadow", "sm"))) {
652
901
  var convenience = wholeClassConveniences[split.base];
653
902
  return {
654
903
  candidate,
@@ -724,9 +973,7 @@ function tokenValidationConfig(entry, value, config) {
724
973
  function formatCandidate(param, config) {
725
974
  var { prop, value, valueKind, modifiers = [] } = param;
726
975
  var _parsed_entry;
727
- var entry = grammarEntries.find(function(candidate3) {
728
- return candidate3.prop === prop;
729
- });
976
+ var entry = propToGrammarEntry[prop];
730
977
  if (!entry) return null;
731
978
  if (valueKind === "arbitrary" && value === "") return null;
732
979
  var normalizedModifiers = normalizeModifiers(modifiers, config || {});
@@ -871,5 +1118,5 @@ function decodeArbitrary(value) {
871
1118
  return decoded;
872
1119
  }
873
1120
 
874
- export { classifyCandidate, decodeArbitrary, encodeArbitrary, formatCandidate, hasTokenName, parseCandidate };
1121
+ export { classifyCandidate, decimalHalfTokenAlias, decodeArbitrary, encodeArbitrary, formatCandidate, hasTokenName, parseCandidate, resolveTokenName, splitCandidate, tailwindLeadingRatios, tailwindTrackingEms };
875
1122
  //# sourceMappingURL=candidate.native.js.map