@tamagui/tailwind 3.0.0-beta.922.1 → 3.0.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 (56) hide show
  1. package/dist/cjs/candidate.cjs +312 -137
  2. package/dist/cjs/candidate.native.cjs +342 -153
  3. package/dist/cjs/candidate.native.js +342 -153
  4. package/dist/cjs/candidate.native.js.map +1 -1
  5. package/dist/cjs/compose.cjs +383 -0
  6. package/dist/cjs/compose.native.cjs +389 -0
  7. package/dist/cjs/compose.native.js +391 -0
  8. package/dist/cjs/compose.native.js.map +1 -0
  9. package/dist/cjs/composedResolver.cjs +226 -0
  10. package/dist/cjs/composedResolver.native.cjs +255 -0
  11. package/dist/cjs/composedResolver.native.js +257 -0
  12. package/dist/cjs/composedResolver.native.js.map +1 -0
  13. package/dist/cjs/frontend.cjs +4 -11
  14. package/dist/cjs/frontend.native.cjs +5 -16
  15. package/dist/cjs/frontend.native.js +5 -16
  16. package/dist/cjs/frontend.native.js.map +1 -1
  17. package/dist/cjs/index.cjs +2 -0
  18. package/dist/cjs/index.native.cjs +2 -0
  19. package/dist/cjs/index.native.js +2 -0
  20. package/dist/cjs/index.native.js.map +1 -1
  21. package/dist/esm/candidate.mjs +314 -140
  22. package/dist/esm/candidate.mjs.map +1 -1
  23. package/dist/esm/candidate.native.js +344 -156
  24. package/dist/esm/candidate.native.js.map +1 -1
  25. package/dist/esm/compose.mjs +359 -0
  26. package/dist/esm/compose.mjs.map +1 -0
  27. package/dist/esm/compose.native.js +363 -0
  28. package/dist/esm/compose.native.js.map +1 -0
  29. package/dist/esm/composedResolver.mjs +206 -0
  30. package/dist/esm/composedResolver.mjs.map +1 -0
  31. package/dist/esm/composedResolver.native.js +233 -0
  32. package/dist/esm/composedResolver.native.js.map +1 -0
  33. package/dist/esm/frontend.mjs +4 -11
  34. package/dist/esm/frontend.mjs.map +1 -1
  35. package/dist/esm/frontend.native.js +5 -16
  36. package/dist/esm/frontend.native.js.map +1 -1
  37. package/dist/esm/index.mjs +3 -2
  38. package/dist/esm/index.mjs.map +1 -1
  39. package/dist/esm/index.native.js +3 -2
  40. package/dist/esm/index.native.js.map +1 -1
  41. package/package.json +18 -15
  42. package/src/candidate.ts +396 -60
  43. package/src/frontend.ts +3 -16
  44. package/src/index.tsx +14 -2
  45. package/src/types.ts +32 -4
  46. package/types/candidate.d.ts +2 -1
  47. package/types/candidate.d.ts.map +1 -1
  48. package/types/compose.d.ts +19 -0
  49. package/types/compose.d.ts.map +1 -0
  50. package/types/composedResolver.d.ts +19 -0
  51. package/types/composedResolver.d.ts.map +1 -0
  52. package/types/frontend.d.ts.map +1 -1
  53. package/types/index.d.ts +11 -1
  54. package/types/index.d.ts.map +1 -1
  55. package/types/types.d.ts +18 -3
  56. package/types/types.d.ts.map +1 -1
@@ -25,18 +25,18 @@ __export(candidate_exports, {
25
25
  getStyleGrammarConfig: () => getStyleGrammarConfig,
26
26
  getTailwindClassPlan: () => getTailwindClassPlan,
27
27
  isTokenValueProp: () => isTokenValueProp,
28
+ resolveTailwindCandidate: () => resolveTailwindCandidate,
28
29
  resolveTailwindClassName: () => resolveTailwindClassName,
29
30
  setInAuthoredOrder: () => setInAuthoredOrder
30
31
  });
31
32
  module.exports = __toCommonJS(candidate_exports);
32
33
  var import_constants = require("@tamagui/constants");
34
+ var import_helpers = require("@tamagui/helpers");
33
35
  var import_internal_runtime = require("@tamagui/core/internal-runtime");
36
+ var import_compose = require("./compose.native.js");
37
+ var import_composedResolver = require("./composedResolver.native.js");
34
38
  var import_runtime = require("@tamagui/style-grammar/runtime");
35
39
  var import_candidate = require("@tamagui/style-grammar/tooling/candidate");
36
- function _type_of(obj) {
37
- "@swc/helpers - typeof";
38
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
39
- }
40
40
  var styleGrammarConfigCache = /* @__PURE__ */ new WeakMap();
41
41
  function getStyleGrammarConfig(config) {
42
42
  var _config_configRevisionSymbol;
@@ -53,45 +53,37 @@ function getStyleGrammarConfig(config) {
53
53
  function isTokenValueProp(prop) {
54
54
  return (0, import_runtime.getTokenCategory)(prop) !== null;
55
55
  }
56
- function arbitraryValue(inner) {
56
+ function arbitraryValue(inner, prop) {
57
57
  var px = /^(-?\d*\.?\d+)px$/.exec(inner);
58
- if (px) return Number(px[1]);
58
+ if (px) return prop && import_helpers.stylePropsUnitless[prop] ? inner : Number(px[1]);
59
59
  if (/^-?\d*\.?\d+$/.test(inner)) return Number(inner);
60
60
  return inner;
61
61
  }
62
+ function unwrapArbitraryValue(raw) {
63
+ return arbitraryValue(raw.length > 1 && raw[0] === "[" && raw[raw.length - 1] === "]" ? (0, import_candidate.decodeArbitrary)(raw.slice(1, -1)) : raw);
64
+ }
62
65
  function tailwindSizingValue(prop, value) {
63
66
  if (value === "full") return "100%";
64
67
  if (value === "auto") return "auto";
65
- if (value === "screen") return /[Hh]eight/.test(prop) ? "100vh" : "100vw";
68
+ if (value === "screen") return /[Hh]eight|[Bb]lock/.test(prop) ? "100vh" : "100vw";
69
+ if (/^[dls]v[hw]$/.test(value)) return `100${value}`;
66
70
  if (value === "min") return "min-content";
67
71
  if (value === "max") return "max-content";
68
72
  if (value === "fit") return "fit-content";
69
73
  var frac = /^(\d+)\/(\d+)$/.exec(value);
70
- if (frac && Number(frac[2]) !== 0) {
71
- return `${Number(frac[1]) / Number(frac[2]) * 100}%`;
72
- }
74
+ if (frac && Number(frac[2]) !== 0) return `${Number(frac[1]) / Number(frac[2]) * 100}%`;
73
75
  return null;
74
76
  }
75
- function borderDimValue(raw) {
76
- var inner = raw;
77
- if (raw.length > 1 && raw[0] === "[" && raw[raw.length - 1] === "]") {
78
- inner = (0, import_candidate.decodeArbitrary)(raw.slice(1, -1));
79
- }
80
- var px = /^(-?\d*\.?\d+)px$/.exec(inner);
81
- if (px) return Number.parseFloat(px[1]);
82
- if (/^-?\d*\.?\d+$/.test(inner)) return Number(inner);
83
- return inner;
84
- }
85
77
  function expansionProps(parsed) {
86
78
  var _parsed_entry;
87
79
  var prefix = parsed.prefix;
88
80
  if (!prefix) return null;
89
81
  if (prefix === "size") return import_runtime.sizeUtilityProps;
90
- if (prefix === "inset-x" || prefix === "inset-y") {
91
- return import_runtime.insetAxisProps[prefix.slice("inset-".length)];
92
- }
82
+ if (prefix === "translate") return ["x", "y"];
83
+ if (prefix === "skew") return ["skewX", "skewY"];
84
+ if (prefix === "inset-x" || prefix === "inset-y") return import_runtime.insetAxisProps[prefix.slice(6)];
93
85
  if (prefix.startsWith("rounded-")) {
94
- var props = import_runtime.radiusCornerProps[prefix.slice("rounded-".length)];
86
+ var props = import_runtime.radiusCornerProps[prefix.slice(8)];
95
87
  if (!props || props.length === 1) return null;
96
88
  return props;
97
89
  }
@@ -103,22 +95,69 @@ function expansionProps(parsed) {
103
95
  return `border${side}${suffix}`;
104
96
  });
105
97
  }
106
- function tailwindClassToFlatProp(parsed) {
98
+ function tailwindClassToFlatProp(parsed, grammarConfig) {
107
99
  var _parsed_prefix;
108
- if (parsed.kind !== "dynamic" || !parsed.entry || parsed.rawValue === void 0) {
109
- return null;
110
- }
100
+ if (parsed.kind !== "dynamic" || !parsed.entry || parsed.rawValue === void 0) return null;
111
101
  var prop = parsed.entry.prop;
112
102
  var category = parsed.entry.tokenCategory;
113
103
  var value = parsed.rawValue;
104
+ if (parsed.negative && value === "0" && parsed.convenience !== "angle") return {
105
+ key: prop,
106
+ value: 0
107
+ };
108
+ if (parsed.convenience === "zero") return {
109
+ key: prop,
110
+ value: 0
111
+ };
112
+ if (parsed.convenience === "angle") return {
113
+ key: prop,
114
+ value: `${parsed.negative ? "-" : ""}${value}deg`
115
+ };
116
+ if ((prop === "x" || prop === "y") && parsed.valueKind !== "token") {
117
+ var sized = tailwindSizingValue(prop, value);
118
+ if (sized != null) return {
119
+ key: prop,
120
+ value: parsed.negative && sized[0] !== "-" ? `-${sized}` : sized
121
+ };
122
+ }
123
+ if (parsed.convenience === "leading-keyword") return {
124
+ key: prop,
125
+ value: import_candidate.tailwindLeadingRatios[value]
126
+ };
127
+ if (parsed.convenience === "tracking-keyword") return {
128
+ key: prop,
129
+ value: `${import_candidate.tailwindTrackingEms[value] * (parsed.negative ? -1 : 1)}em`
130
+ };
131
+ if (prop === "lineHeight" && /^\d+(?:\.\d+)?$/.test(value)) return {
132
+ key: prop,
133
+ value: `${Number(value) * 4}px`
134
+ };
135
+ if (prop === "gridTemplateColumns" && /^\d+$/.test(value)) return {
136
+ key: prop,
137
+ value: `repeat(${value}, minmax(0, 1fr))`
138
+ };
139
+ if (prop === "gridColumn" && /^\d+$/.test(value)) return {
140
+ key: prop,
141
+ value: `span ${value} / span ${value}`
142
+ };
143
+ if (prop === "gridRow" && /^\d+$/.test(value)) return {
144
+ key: prop,
145
+ value: `span ${value} / span ${value}`
146
+ };
147
+ if ((prop === "gridColumnStart" || prop === "gridColumnEnd" || prop === "gridRowStart" || prop === "gridRowEnd") && /^\d+$/.test(value)) return {
148
+ key: prop,
149
+ value: Number(value)
150
+ };
114
151
  if (prop.endsWith("Width") && ((_parsed_prefix = parsed.prefix) === null || _parsed_prefix === void 0 ? void 0 : _parsed_prefix.startsWith("border"))) {
115
152
  if (parsed.valueKind === "token") {
153
+ var _parsed_entry;
116
154
  value = `${parsed.negative ? "-" : ""}${value}`;
117
- } else if (parsed.valueKind === "arbitrary") {
118
- value = borderDimValue(value);
119
- } else {
120
- return null;
121
- }
155
+ if (grammarConfig && ((_parsed_entry = parsed.entry) === null || _parsed_entry === void 0 ? void 0 : _parsed_entry.tokenCategory)) {
156
+ var _resolveTokenName;
157
+ value = (_resolveTokenName = (0, import_candidate.resolveTokenName)(grammarConfig, parsed.entry.tokenCategory, value)) !== null && _resolveTokenName !== void 0 ? _resolveTokenName : value;
158
+ }
159
+ } else if (parsed.valueKind === "arbitrary") value = unwrapArbitraryValue(value);
160
+ else return null;
122
161
  return {
123
162
  key: prop,
124
163
  value
@@ -126,16 +165,12 @@ function tailwindClassToFlatProp(parsed) {
126
165
  }
127
166
  if (prop === "fontFamily") {
128
167
  var famValue;
129
- if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") {
130
- famValue = (0, import_candidate.decodeArbitrary)(value.slice(1, -1));
131
- } else {
132
- var generic = {
133
- sans: "sans-serif",
134
- serif: "serif",
135
- mono: "monospace"
136
- };
137
- famValue = parsed.valueKind === "token" ? value : generic[value] || value;
138
- }
168
+ if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") famValue = (0, import_candidate.decodeArbitrary)(value.slice(1, -1));
169
+ else famValue = parsed.valueKind === "token" ? value : {
170
+ sans: "sans-serif",
171
+ serif: "serif",
172
+ mono: "monospace"
173
+ }[value] || value;
139
174
  return {
140
175
  key: "fontFamily",
141
176
  value: famValue
@@ -143,11 +178,8 @@ function tailwindClassToFlatProp(parsed) {
143
178
  }
144
179
  if (prop === "fontSize") {
145
180
  var fsValue;
146
- if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") {
147
- fsValue = arbitraryValue((0, import_candidate.decodeArbitrary)(value.slice(1, -1)));
148
- } else {
149
- fsValue = value;
150
- }
181
+ if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") fsValue = arbitraryValue((0, import_candidate.decodeArbitrary)(value.slice(1, -1)));
182
+ else fsValue = value;
151
183
  return {
152
184
  key: "fontSize",
153
185
  value: fsValue
@@ -155,12 +187,8 @@ function tailwindClassToFlatProp(parsed) {
155
187
  }
156
188
  if (prop === "lineHeight") {
157
189
  var lhValue;
158
- if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") {
159
- var inner = (0, import_candidate.decodeArbitrary)(value.slice(1, -1));
160
- lhValue = /^-?\d*\.?\d+px$/.test(inner) ? Number.parseFloat(inner) : inner;
161
- } else {
162
- lhValue = value;
163
- }
190
+ if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") lhValue = (0, import_candidate.decodeArbitrary)(value.slice(1, -1));
191
+ else lhValue = value;
164
192
  return {
165
193
  key: "lineHeight",
166
194
  value: lhValue
@@ -168,71 +196,63 @@ function tailwindClassToFlatProp(parsed) {
168
196
  }
169
197
  if (prop === "letterSpacing") {
170
198
  var lsValue;
171
- if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") {
172
- lsValue = arbitraryValue((0, import_candidate.decodeArbitrary)(value.slice(1, -1)));
173
- } else {
174
- lsValue = value;
175
- }
199
+ if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") lsValue = arbitraryValue((0, import_candidate.decodeArbitrary)(value.slice(1, -1)));
200
+ else lsValue = value;
176
201
  return {
177
202
  key: "letterSpacing",
178
203
  value: lsValue
179
204
  };
180
205
  }
181
- if (prop === "boxShadow" && value[0] === "[" && value[value.length - 1] === "]") {
182
- return {
183
- key: "boxShadow",
184
- value: (0, import_candidate.decodeArbitrary)(value.slice(1, -1))
185
- };
186
- }
206
+ if (prop === "boxShadow" && value[0] === "[" && value[value.length - 1] === "]") return {
207
+ key: "boxShadow",
208
+ value: (0, import_candidate.decodeArbitrary)(value.slice(1, -1))
209
+ };
187
210
  if (value.length > 2 && value[0] === "[" && value[value.length - 1] === "]") {
188
211
  var inner1 = (0, import_candidate.decodeArbitrary)(value.slice(1, -1));
189
212
  if (inner1 === "") return null;
213
+ var resolved = arbitraryValue(inner1, prop);
214
+ if ((prop === "rotate" || prop === "rotateX" || prop === "rotateY" || prop === "rotateZ" || prop === "skewX" || prop === "skewY") && typeof resolved === "number") resolved = `${resolved}deg`;
215
+ if (parsed.negative) {
216
+ if (typeof resolved === "number") resolved = -resolved;
217
+ else if (resolved[0] !== "-") resolved = `-${resolved}`;
218
+ }
190
219
  return {
191
220
  key: prop,
192
- value: arbitraryValue(inner1)
221
+ value: resolved
193
222
  };
194
223
  }
195
- if (category === "size" && parsed.valueKind !== "token") {
196
- var sized = tailwindSizingValue(prop, value);
197
- if (sized != null) {
198
- return {
199
- key: prop,
200
- value: sized
201
- };
202
- }
224
+ if (parsed.valueKind !== "token" && (category === "size" || parsed.convenience === "sizing-keyword")) {
225
+ var sized1 = tailwindSizingValue(prop, value);
226
+ if (sized1 != null) return {
227
+ key: prop,
228
+ value: parsed.negative && sized1[0] !== "-" ? `-${sized1}` : sized1
229
+ };
203
230
  }
204
231
  var opacitySuffix = "";
205
232
  if (category === "color" && typeof value === "string") {
206
233
  var suffix = (0, import_runtime.splitColorOpacitySuffix)(value);
207
- if (suffix.kind === "invalid") {
208
- return {
209
- key: prop,
210
- value
211
- };
212
- }
234
+ if (suffix.kind === "invalid") return {
235
+ key: prop,
236
+ value
237
+ };
213
238
  if (suffix.kind === "valid") {
214
239
  opacitySuffix = value.slice(suffix.name.length);
215
240
  value = suffix.name;
216
241
  }
217
242
  }
218
- if (import_runtime.percentUtilityProps.has(prop) && /^\d+$/.test(value)) {
219
- value = Number(value) / 100;
220
- } else if (/^\d+(\.\d+)?$/.test(value)) {
221
- if (category === "zIndex" && parsed.valueKind === "convenience") {
222
- value = Number(value);
223
- } else if (category) {
224
- value = `${parsed.negative ? "-" : ""}${value}`;
225
- } else {
226
- value = Number(value);
243
+ if (import_runtime.percentUtilityProps.has(prop) && /^\d+$/.test(value)) value = Number(value) / 100;
244
+ else if (/^\d+(\.\d+)?$/.test(value)) if (category === "zIndex" && parsed.valueKind === "convenience") value = Number(value) * (parsed.negative ? -1 : 1);
245
+ else if (category) {
246
+ value = `${parsed.negative ? "-" : ""}${value}`;
247
+ if (grammarConfig) {
248
+ var _resolveTokenName1;
249
+ value = (_resolveTokenName1 = (0, import_candidate.resolveTokenName)(grammarConfig, category, value)) !== null && _resolveTokenName1 !== void 0 ? _resolveTokenName1 : value;
227
250
  }
228
- } else if (typeof value === "string") {
229
- if (category && !((category === "space" || category === "size" || category === "radius") && (0, import_runtime.getSafeAreaEdge)(value))) {
230
- value = `${parsed.negative ? "-" : ""}${value}`;
231
- }
232
- }
233
- if (opacitySuffix && typeof value === "string") {
234
- value = `${value}${opacitySuffix}`;
251
+ } else value = Number(value);
252
+ else if (typeof value === "string") {
253
+ if (category && !((category === "space" || category === "size" || category === "radius") && (0, import_runtime.getSafeAreaEdge)(value))) value = `${parsed.negative ? "-" : ""}${value}`;
235
254
  }
255
+ if (opacitySuffix && typeof value === "string") value = `${value}${opacitySuffix}`;
236
256
  if (parsed.negative && !category) {
237
257
  if (typeof value === "number") value = -value;
238
258
  else if (typeof value === "string" && value[0] !== "-") value = `-${value}`;
@@ -243,6 +263,56 @@ function tailwindClassToFlatProp(parsed) {
243
263
  };
244
264
  }
245
265
  var classPlanCache = /* @__PURE__ */ new WeakMap();
266
+ var nativeTarget = !import_constants.isWeb || true;
267
+ var cssGridProps = /* @__PURE__ */ new Set([
268
+ "gridTemplateColumns",
269
+ "gridColumn",
270
+ "gridColumnStart",
271
+ "gridColumnEnd",
272
+ "gridRow",
273
+ "gridRowStart",
274
+ "gridRowEnd"
275
+ ]);
276
+ var nativeUnsupportedProps = /* @__PURE__ */ new Set([
277
+ "objectFit",
278
+ "order",
279
+ "overflowX",
280
+ "overflowY",
281
+ "textOverflow",
282
+ "whiteSpace",
283
+ "visibility"
284
+ ]);
285
+ var nativeUnsupportedSizingValues = /* @__PURE__ */ new Set([
286
+ "min",
287
+ "max",
288
+ "fit"
289
+ ]);
290
+ var nativeUnsupportedValues = {
291
+ display: /* @__PURE__ */ new Set([
292
+ "block",
293
+ "inline",
294
+ "inline-flex"
295
+ ]),
296
+ position: /* @__PURE__ */ new Set(["fixed", "sticky"])
297
+ };
298
+ function shouldGateNative(parsed) {
299
+ var _parsed_entry, _nativeUnsupportedValues_entryProp;
300
+ if (!nativeTarget) return false;
301
+ var properties = parsed.properties || {};
302
+ if (process.env.TAMAGUI_CSS_GRID !== "1" && (parsed.entry && cssGridProps.has(parsed.entry.prop) || properties.display === "grid" || Object.keys(properties).some(function(prop) {
303
+ return cssGridProps.has(prop);
304
+ }))) return true;
305
+ if (parsed.entry && nativeUnsupportedProps.has(parsed.entry.prop) || Object.keys(properties).some(function(prop) {
306
+ return nativeUnsupportedProps.has(prop);
307
+ })) return true;
308
+ if (parsed.convenience === "sizing-keyword" && nativeUnsupportedSizingValues.has(parsed.rawValue || "")) return true;
309
+ var entryProp = (_parsed_entry = parsed.entry) === null || _parsed_entry === void 0 ? void 0 : _parsed_entry.prop;
310
+ if (entryProp && ((_nativeUnsupportedValues_entryProp = nativeUnsupportedValues[entryProp]) === null || _nativeUnsupportedValues_entryProp === void 0 ? void 0 : _nativeUnsupportedValues_entryProp.has(parsed.rawValue || "")) || Object.keys(properties).some(function(prop) {
311
+ var _nativeUnsupportedValues_prop;
312
+ return (_nativeUnsupportedValues_prop = nativeUnsupportedValues[prop]) === null || _nativeUnsupportedValues_prop === void 0 ? void 0 : _nativeUnsupportedValues_prop.has(String(properties[prop]));
313
+ })) return true;
314
+ return properties.overflow === "auto" || properties.cursor !== void 0 && properties.cursor !== "auto" && properties.cursor !== "pointer";
315
+ }
246
316
  function getClassPlanCache(grammarConfig) {
247
317
  var cache = classPlanCache.get(grammarConfig);
248
318
  if (!cache) {
@@ -267,46 +337,132 @@ function createPlanEntry(property, value, modifiers) {
267
337
  modifiers
268
338
  ];
269
339
  }
340
+ var shorthandResets = {
341
+ padding: [
342
+ "paddingTop",
343
+ "paddingRight",
344
+ "paddingBottom",
345
+ "paddingLeft",
346
+ "paddingStart",
347
+ "paddingEnd",
348
+ "paddingInlineStart",
349
+ "paddingInlineEnd",
350
+ "paddingBlockStart",
351
+ "paddingBlockEnd",
352
+ "paddingHorizontal",
353
+ "paddingVertical",
354
+ "paddingInline",
355
+ "paddingBlock"
356
+ ],
357
+ margin: [
358
+ "marginTop",
359
+ "marginRight",
360
+ "marginBottom",
361
+ "marginLeft",
362
+ "marginStart",
363
+ "marginEnd",
364
+ "marginInlineStart",
365
+ "marginInlineEnd",
366
+ "marginBlockStart",
367
+ "marginBlockEnd",
368
+ "marginHorizontal",
369
+ "marginVertical",
370
+ "marginInline",
371
+ "marginBlock"
372
+ ],
373
+ gap: ["rowGap", "columnGap"],
374
+ borderRadius: [
375
+ "borderTopLeftRadius",
376
+ "borderTopRightRadius",
377
+ "borderBottomLeftRadius",
378
+ "borderBottomRightRadius",
379
+ "borderTopStartRadius",
380
+ "borderTopEndRadius",
381
+ "borderBottomStartRadius",
382
+ "borderBottomEndRadius",
383
+ "borderStartStartRadius",
384
+ "borderStartEndRadius",
385
+ "borderEndStartRadius",
386
+ "borderEndEndRadius"
387
+ ],
388
+ borderWidth: [
389
+ "borderTopWidth",
390
+ "borderRightWidth",
391
+ "borderBottomWidth",
392
+ "borderLeftWidth",
393
+ "borderStartWidth",
394
+ "borderEndWidth",
395
+ "borderInlineStartWidth",
396
+ "borderInlineEndWidth",
397
+ "borderBlockStartWidth",
398
+ "borderBlockEndWidth",
399
+ "borderInlineWidth",
400
+ "borderBlockWidth"
401
+ ],
402
+ borderColor: [
403
+ "borderTopColor",
404
+ "borderRightColor",
405
+ "borderBottomColor",
406
+ "borderLeftColor",
407
+ "borderStartColor",
408
+ "borderEndColor",
409
+ "borderInlineStartColor",
410
+ "borderInlineEndColor",
411
+ "borderBlockStartColor",
412
+ "borderBlockEndColor",
413
+ "borderInlineColor",
414
+ "borderBlockColor"
415
+ ]
416
+ };
270
417
  function computeClassPlan(cls, grammarConfig) {
418
+ var _parsed_entry, _parsed_entry1;
271
419
  var groupMarker = /^group(?:\/([A-Za-z0-9_-]+))?$/.exec(cls);
272
- if (groupMarker) {
273
- return {
274
- entries: [["group", groupMarker[1] || true]],
275
- preserveRawClass: import_constants.isWeb
276
- };
277
- }
420
+ if (groupMarker) return {
421
+ entries: [["group", groupMarker[1] || true]],
422
+ preserveRawClass: import_constants.isWeb
423
+ };
278
424
  var containerMarker = /^@container(-size)?(?:\/([A-Za-z0-9_-]+))?$/.exec(cls);
279
425
  if (containerMarker) {
280
426
  var isSize = containerMarker[1] !== void 0;
281
427
  var name = containerMarker[2];
282
428
  var entries = [];
283
429
  entries.push(["container", name || true]);
284
- if (isSize) {
285
- entries.push(["containerType", "size"]);
286
- }
430
+ if (isSize) entries.push(["containerType", "size"]);
287
431
  return {
288
432
  entries,
289
433
  preserveRawClass: import_constants.isWeb
290
434
  };
291
435
  }
292
436
  var classification = (0, import_candidate.classifyCandidate)(cls, grammarConfig);
293
- if (classification.kind === "passthrough") {
294
- return import_constants.isWeb ? "raw" : null;
295
- }
437
+ if (classification.kind === "passthrough") return import_constants.isWeb ? "raw" : null;
296
438
  var parsed = classification.parsed;
439
+ if (!nativeTarget && ((_parsed_entry = parsed.entry) === null || _parsed_entry === void 0 ? void 0 : _parsed_entry.prop) === "perspective") return "raw";
440
+ if (shouldGateNative(parsed)) return null;
441
+ if (((_parsed_entry1 = parsed.entry) === null || _parsed_entry1 === void 0 ? void 0 : _parsed_entry1.prop) === "flex" && parsed.rawValue) {
442
+ var fraction = /^(\d+)\/(\d+)$/.exec(parsed.rawValue);
443
+ if (fraction && Number(fraction[2]) !== 0) {
444
+ var basis = `${Number(fraction[1]) / Number(fraction[2]) * 100}%`;
445
+ var entries1 = [
446
+ createPlanEntry("flexGrow", 1, parsed.modifiers),
447
+ createPlanEntry("flexShrink", 1, parsed.modifiers),
448
+ createPlanEntry("flexBasis", basis, parsed.modifiers)
449
+ ];
450
+ return entries1.every(Boolean) ? entries1 : "raw";
451
+ }
452
+ }
297
453
  var util = parsed.kind === "utility" ? parsed.properties : null;
298
454
  if (util) {
299
- var entries1 = [];
455
+ var entries2 = [];
300
456
  for (var p in util) {
301
- var entry = createPlanEntry(p, util[p], parsed.modifiers);
457
+ var entry = createPlanEntry(p, nativeTarget && p === "transform" && util[p] === "none" ? [] : util[p], parsed.modifiers);
302
458
  if (!entry) return "raw";
303
- entries1.push(entry);
459
+ entries2.push(entry);
304
460
  }
305
- return entries1;
461
+ return entries2;
306
462
  }
307
463
  var expandedProps = expansionProps(parsed);
308
464
  if (expandedProps) {
309
- var entries2 = [];
465
+ var entries3 = [];
310
466
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
311
467
  try {
312
468
  for (var _iterator = expandedProps[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
@@ -317,29 +473,25 @@ function computeClassPlan(cls, grammarConfig) {
317
473
  ...parsed.entry,
318
474
  prop
319
475
  } : parsed.entry
320
- });
476
+ }, grammarConfig);
321
477
  if (!flatProp) return "raw";
322
478
  var entry1 = createPlanEntry(flatProp.key, flatProp.value, parsed.modifiers);
323
479
  if (!entry1) return "raw";
324
- entries2.push(entry1);
480
+ entries3.push(entry1);
325
481
  }
326
482
  } catch (err) {
327
483
  _didIteratorError = true;
328
484
  _iteratorError = err;
329
485
  } finally {
330
486
  try {
331
- if (!_iteratorNormalCompletion && _iterator.return != null) {
332
- _iterator.return();
333
- }
487
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
334
488
  } finally {
335
- if (_didIteratorError) {
336
- throw _iteratorError;
337
- }
489
+ if (_didIteratorError) throw _iteratorError;
338
490
  }
339
491
  }
340
- return entries2;
492
+ return entries3;
341
493
  }
342
- var flatProp1 = tailwindClassToFlatProp(parsed);
494
+ var flatProp1 = tailwindClassToFlatProp(parsed, grammarConfig);
343
495
  if (flatProp1) {
344
496
  var entry2 = createPlanEntry(flatProp1.key, flatProp1.value, parsed.modifiers);
345
497
  return entry2 ? [entry2] : "raw";
@@ -356,9 +508,67 @@ function getTailwindClassPlan(candidate, config) {
356
508
  }
357
509
  return plan;
358
510
  }
511
+ function resolveTailwindCandidate(candidate, config, sink) {
512
+ var composed = (0, import_compose.tryCompose)(candidate, getStyleGrammarConfig(config), sink);
513
+ if (composed !== void 0) return composed;
514
+ var plan = getTailwindClassPlan(candidate, config);
515
+ if (plan === "raw") return true;
516
+ if (plan === null) return null;
517
+ var parent = Array.isArray(plan) ? null : plan;
518
+ var entries = parent ? parent.entries : plan;
519
+ for (var index = 0; index < entries.length; index++) {
520
+ var _config_tokensParsed_transformTokenCategory_entry_, _config_tokensParsed_transformTokenCategory, _config_tokensParsed;
521
+ var entry = entries[index];
522
+ var transformTokenCategory = entry[0] === "x" || entry[0] === "y" ? "space" : entry[0] === "perspective" ? "perspective" : null;
523
+ var _config_tokensParsed_transformTokenCategory_entry__val;
524
+ var transformValue = transformTokenCategory && typeof entry[1] === "string" ? (_config_tokensParsed_transformTokenCategory_entry__val = (_config_tokensParsed = config.tokensParsed) === null || _config_tokensParsed === void 0 ? void 0 : (_config_tokensParsed_transformTokenCategory = _config_tokensParsed[transformTokenCategory]) === null || _config_tokensParsed_transformTokenCategory === void 0 ? void 0 : (_config_tokensParsed_transformTokenCategory_entry_ = _config_tokensParsed_transformTokenCategory[entry[1]]) === null || _config_tokensParsed_transformTokenCategory_entry_ === void 0 ? void 0 : _config_tokensParsed_transformTokenCategory_entry_.val) !== null && _config_tokensParsed_transformTokenCategory_entry__val !== void 0 ? _config_tokensParsed_transformTokenCategory_entry__val : entry[1] : entry[1];
525
+ if ((0, import_compose.noteTailwindTransform)(sink, [
526
+ entry[0],
527
+ transformValue,
528
+ entry[2],
529
+ entry[3]
530
+ ])) continue;
531
+ if (entry[0] === "lineHeight") {
532
+ sink([
533
+ "__leading",
534
+ entry[1],
535
+ entry[2],
536
+ entry[3]
537
+ ]);
538
+ continue;
539
+ }
540
+ if (entry[0] === "fontSize" && typeof entry[1] === "string" && (0, import_candidate.hasTokenName)(getStyleGrammarConfig(config), "lineHeight", entry[1])) sink([
541
+ "__textLeading",
542
+ entry[1],
543
+ entry[2],
544
+ entry[3]
545
+ ]);
546
+ if (entry[0] === "boxShadow" && typeof entry[1] === "string") {
547
+ var _config_tokensParsed_boxShadow_entry_, _config_tokensParsed_boxShadow, _config_tokensParsed1;
548
+ var _config_tokensParsed_boxShadow_entry__val;
549
+ (0, import_compose.noteBoxShadow)(sink, (_config_tokensParsed_boxShadow_entry__val = (_config_tokensParsed1 = config.tokensParsed) === null || _config_tokensParsed1 === void 0 ? void 0 : (_config_tokensParsed_boxShadow = _config_tokensParsed1.boxShadow) === null || _config_tokensParsed_boxShadow === void 0 ? void 0 : (_config_tokensParsed_boxShadow_entry_ = _config_tokensParsed_boxShadow[entry[1]]) === null || _config_tokensParsed_boxShadow_entry_ === void 0 ? void 0 : _config_tokensParsed_boxShadow_entry_.val) !== null && _config_tokensParsed_boxShadow_entry__val !== void 0 ? _config_tokensParsed_boxShadow_entry__val : entry[1], entry[3] || []);
550
+ }
551
+ sink(entry);
552
+ }
553
+ return (parent === null || parent === void 0 ? void 0 : parent.preserveRawClass) || false;
554
+ }
359
555
  function resolveTailwindClassName(className, config) {
360
556
  var result = {};
557
+ var composedProps = null;
361
558
  var rawClassName = "";
559
+ var sink = function(entry) {
560
+ var [key2, value, condition] = entry;
561
+ if (key2.charCodeAt(0) === 95 && key2.charCodeAt(1) === 95) {
562
+ composedProps || (composedProps = {});
563
+ composedProps[key2] = (0, import_internal_runtime.mergeFrontendCondition)(composedProps[key2], value, condition);
564
+ return;
565
+ }
566
+ if (condition === void 0) {
567
+ var resets = shorthandResets[key2];
568
+ if (resets) for (var i = 0; i < resets.length; i++) delete result[resets[i]];
569
+ }
570
+ setInAuthoredOrder(result, key2, (0, import_internal_runtime.mergeFrontendCondition)(result[key2], value, condition));
571
+ };
362
572
  var start = 0;
363
573
  for (var index = 0; index <= className.length; index++) {
364
574
  if (index !== className.length && className.charCodeAt(index) > 32) continue;
@@ -367,42 +577,21 @@ function resolveTailwindClassName(className, config) {
367
577
  continue;
368
578
  }
369
579
  var candidate = className.slice(start, index);
370
- var plan = getTailwindClassPlan(candidate, config);
371
- if (plan === "raw") {
372
- rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
373
- } else if (plan) {
374
- var parentPlan = plan;
375
- if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
376
- rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
377
- }
378
- var entries = Array.isArray(plan) ? plan : parentPlan.entries;
379
- for (var entryIndex = 0; entryIndex < entries.length; entryIndex++) {
380
- var [key, value, condition] = entries[entryIndex];
381
- var previous = result[key];
382
- var next = value;
383
- if (condition !== void 0) {
384
- next = previous && (typeof previous === "undefined" ? "undefined" : _type_of(previous)) === "object" && !Array.isArray(previous) ? {
385
- ...previous,
386
- [condition]: value
387
- } : previous === void 0 ? { [condition]: value } : {
388
- default: previous,
389
- [condition]: value
390
- };
391
- } else if (previous && (typeof previous === "undefined" ? "undefined" : _type_of(previous)) === "object" && !Array.isArray(previous)) {
392
- next = {
393
- ...previous,
394
- default: value
395
- };
396
- }
397
- setInAuthoredOrder(result, key, next);
398
- }
399
- }
580
+ if (resolveTailwindCandidate(candidate, config, sink)) rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
400
581
  start = index + 1;
401
582
  }
583
+ if (composedProps) {
584
+ var composed = (0, import_composedResolver.composedResolver)(composedProps);
585
+ for (var key in composed) setInAuthoredOrder(result, key, composed[key]);
586
+ }
402
587
  if (rawClassName) result.className = rawClassName;
403
588
  return result;
404
589
  }
405
590
  function setInAuthoredOrder(target, key, value) {
591
+ if (value === "unset") {
592
+ delete target[key];
593
+ return;
594
+ }
406
595
  if (key in target) delete target[key];
407
596
  target[key] = value;
408
597
  }