@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.
- package/dist/cjs/ast/payloadShape.cjs +45 -17
- package/dist/cjs/ast/payloadShape.native.cjs +45 -17
- package/dist/cjs/ast/payloadShape.native.js +45 -17
- package/dist/cjs/ast/payloadShape.native.js.map +1 -1
- package/dist/cjs/ast/resolvePayload.cjs +16 -9
- package/dist/cjs/ast/resolvePayload.native.cjs +16 -9
- package/dist/cjs/ast/resolvePayload.native.js +16 -9
- package/dist/cjs/ast/resolvePayload.native.js.map +1 -1
- package/dist/cjs/programs/lowerProgram.cjs +2 -2
- package/dist/cjs/programs/lowerProgram.native.cjs +2 -2
- package/dist/cjs/programs/lowerProgram.native.js +2 -2
- package/dist/cjs/programs/lowerProgram.native.js.map +1 -1
- package/dist/cjs/runtime/clauseIdentity.cjs +9 -28
- package/dist/cjs/runtime/clauseIdentity.native.cjs +9 -28
- package/dist/cjs/runtime/clauseIdentity.native.js +9 -28
- package/dist/cjs/runtime/clauseIdentity.native.js.map +1 -1
- package/dist/cjs/runtime/clausePrecedence.cjs +2 -2
- package/dist/cjs/runtime/clausePrecedence.native.cjs +3 -10
- package/dist/cjs/runtime/clausePrecedence.native.js +3 -10
- package/dist/cjs/runtime/clausePrecedence.native.js.map +1 -1
- package/dist/cjs/runtime/modifierVocabulary.native.cjs +1 -8
- package/dist/cjs/runtime/modifierVocabulary.native.js +1 -8
- package/dist/cjs/runtime/modifierVocabulary.native.js.map +1 -1
- package/dist/cjs/runtime/scanFlatValue.cjs +58 -7
- package/dist/cjs/runtime/scanFlatValue.native.cjs +58 -7
- package/dist/cjs/runtime/scanFlatValue.native.js +58 -7
- package/dist/cjs/runtime/scanFlatValue.native.js.map +1 -1
- package/dist/cjs/runtime/spring.cjs +123 -0
- package/dist/cjs/runtime/spring.native.cjs +131 -0
- package/dist/cjs/runtime/spring.native.js +133 -0
- package/dist/cjs/runtime/spring.native.js.map +1 -0
- package/dist/cjs/runtime/stateModifiers.cjs +23 -1
- package/dist/cjs/runtime/stateModifiers.native.cjs +23 -1
- package/dist/cjs/runtime/stateModifiers.native.js +23 -1
- package/dist/cjs/runtime/stateModifiers.native.js.map +1 -1
- package/dist/cjs/runtime/tokenCategories.cjs +3 -0
- package/dist/cjs/runtime/tokenCategories.native.cjs +3 -0
- package/dist/cjs/runtime/tokenCategories.native.js +3 -0
- package/dist/cjs/runtime/tokenCategories.native.js.map +1 -1
- package/dist/cjs/runtime/unitlessNumbers.cjs +0 -5
- package/dist/cjs/runtime/unitlessNumbers.native.cjs +0 -5
- package/dist/cjs/runtime/unitlessNumbers.native.js +0 -5
- package/dist/cjs/runtime/unitlessNumbers.native.js.map +1 -1
- package/dist/cjs/runtime.cjs +11 -0
- package/dist/cjs/runtime.native.cjs +11 -0
- package/dist/cjs/runtime.native.js +11 -0
- package/dist/cjs/runtime.native.js.map +1 -1
- package/dist/cjs/shorthands/transition.cjs +111 -36
- package/dist/cjs/shorthands/transition.native.cjs +113 -36
- package/dist/cjs/shorthands/transition.native.js +113 -36
- package/dist/cjs/shorthands/transition.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionAlign.cjs +13 -10
- package/dist/cjs/shorthands/transitionAlign.native.cjs +14 -11
- package/dist/cjs/shorthands/transitionAlign.native.js +14 -11
- package/dist/cjs/shorthands/transitionAlign.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionLegacy.cjs +263 -126
- package/dist/cjs/shorthands/transitionLegacy.native.cjs +333 -155
- package/dist/cjs/shorthands/transitionLegacy.native.js +333 -155
- package/dist/cjs/shorthands/transitionLegacy.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionNative.cjs +5 -5
- package/dist/cjs/shorthands/transitionNative.native.cjs +8 -7
- package/dist/cjs/shorthands/transitionNative.native.js +8 -7
- package/dist/cjs/shorthands/transitionNative.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionObject.cjs +302 -0
- package/dist/cjs/shorthands/transitionObject.native.cjs +347 -0
- package/dist/cjs/shorthands/transitionObject.native.js +349 -0
- package/dist/cjs/shorthands/transitionObject.native.js.map +1 -0
- package/dist/cjs/tooling/candidate.cjs +254 -15
- package/dist/cjs/tooling/candidate.native.cjs +314 -62
- package/dist/cjs/tooling/candidate.native.js +314 -62
- package/dist/cjs/tooling/candidate.native.js.map +1 -1
- package/dist/cjs/tooling/config.cjs +19 -9
- package/dist/cjs/tooling/config.native.cjs +25 -26
- package/dist/cjs/tooling/config.native.js +25 -26
- package/dist/cjs/tooling/config.native.js.map +1 -1
- package/dist/cjs/tooling/registry.cjs +579 -11
- package/dist/cjs/tooling/registry.native.cjs +579 -11
- package/dist/cjs/tooling/registry.native.js +579 -11
- package/dist/cjs/tooling/registry.native.js.map +1 -1
- package/dist/cjs/tooling/toolingDiagnostics.cjs +306 -10
- package/dist/cjs/tooling/toolingDiagnostics.native.cjs +408 -48
- package/dist/cjs/tooling/toolingDiagnostics.native.js +408 -48
- package/dist/cjs/tooling/toolingDiagnostics.native.js.map +1 -1
- package/dist/cjs/tooling/toolingRegistry.cjs +6 -1
- package/dist/cjs/tooling/toolingRegistry.native.cjs +9 -1
- package/dist/cjs/tooling/toolingRegistry.native.js +9 -1
- package/dist/cjs/tooling/toolingRegistry.native.js.map +1 -1
- package/dist/cjs/tooling.cjs +1 -0
- package/dist/cjs/tooling.native.cjs +1 -0
- package/dist/cjs/tooling.native.js +1 -0
- package/dist/cjs/tooling.native.js.map +1 -1
- package/dist/cjs/transitions.cjs +38 -0
- package/dist/cjs/transitions.native.cjs +40 -0
- package/dist/cjs/transitions.native.js +42 -0
- package/dist/cjs/transitions.native.js.map +1 -0
- package/dist/esm/ast/payloadShape.mjs +45 -17
- package/dist/esm/ast/payloadShape.mjs.map +1 -1
- package/dist/esm/ast/payloadShape.native.js +45 -17
- package/dist/esm/ast/payloadShape.native.js.map +1 -1
- package/dist/esm/ast/resolvePayload.mjs +16 -9
- package/dist/esm/ast/resolvePayload.mjs.map +1 -1
- package/dist/esm/ast/resolvePayload.native.js +16 -9
- package/dist/esm/ast/resolvePayload.native.js.map +1 -1
- package/dist/esm/programs/lowerProgram.mjs +2 -2
- package/dist/esm/programs/lowerProgram.mjs.map +1 -1
- package/dist/esm/programs/lowerProgram.native.js +2 -2
- package/dist/esm/programs/lowerProgram.native.js.map +1 -1
- package/dist/esm/runtime/clauseIdentity.mjs +2 -22
- package/dist/esm/runtime/clauseIdentity.mjs.map +1 -1
- package/dist/esm/runtime/clauseIdentity.native.js +2 -22
- package/dist/esm/runtime/clauseIdentity.native.js.map +1 -1
- package/dist/esm/runtime/clausePrecedence.mjs +2 -2
- package/dist/esm/runtime/clausePrecedence.mjs.map +1 -1
- package/dist/esm/runtime/clausePrecedence.native.js +3 -10
- package/dist/esm/runtime/clausePrecedence.native.js.map +1 -1
- package/dist/esm/runtime/modifierVocabulary.native.js +1 -8
- package/dist/esm/runtime/modifierVocabulary.native.js.map +1 -1
- package/dist/esm/runtime/scanFlatValue.mjs +59 -7
- package/dist/esm/runtime/scanFlatValue.mjs.map +1 -1
- package/dist/esm/runtime/scanFlatValue.native.js +59 -7
- package/dist/esm/runtime/scanFlatValue.native.js.map +1 -1
- package/dist/esm/runtime/spring.mjs +93 -0
- package/dist/esm/runtime/spring.mjs.map +1 -0
- package/dist/esm/runtime/spring.native.js +99 -0
- package/dist/esm/runtime/spring.native.js.map +1 -0
- package/dist/esm/runtime/stateModifiers.mjs +22 -2
- package/dist/esm/runtime/stateModifiers.mjs.map +1 -1
- package/dist/esm/runtime/stateModifiers.native.js +22 -2
- package/dist/esm/runtime/stateModifiers.native.js.map +1 -1
- package/dist/esm/runtime/tokenCategories.mjs +3 -0
- package/dist/esm/runtime/tokenCategories.mjs.map +1 -1
- package/dist/esm/runtime/tokenCategories.native.js +3 -0
- package/dist/esm/runtime/tokenCategories.native.js.map +1 -1
- package/dist/esm/runtime/unitlessNumbers.mjs +0 -5
- package/dist/esm/runtime/unitlessNumbers.mjs.map +1 -1
- package/dist/esm/runtime/unitlessNumbers.native.js +0 -5
- package/dist/esm/runtime/unitlessNumbers.native.js.map +1 -1
- package/dist/esm/runtime.mjs +4 -2
- package/dist/esm/runtime.native.js +4 -2
- package/dist/esm/shorthands/transition.mjs +111 -36
- package/dist/esm/shorthands/transition.mjs.map +1 -1
- package/dist/esm/shorthands/transition.native.js +113 -36
- package/dist/esm/shorthands/transition.native.js.map +1 -1
- package/dist/esm/shorthands/transitionAlign.mjs +13 -10
- package/dist/esm/shorthands/transitionAlign.mjs.map +1 -1
- package/dist/esm/shorthands/transitionAlign.native.js +14 -11
- package/dist/esm/shorthands/transitionAlign.native.js.map +1 -1
- package/dist/esm/shorthands/transitionLegacy.mjs +260 -126
- package/dist/esm/shorthands/transitionLegacy.mjs.map +1 -1
- package/dist/esm/shorthands/transitionLegacy.native.js +330 -155
- package/dist/esm/shorthands/transitionLegacy.native.js.map +1 -1
- package/dist/esm/shorthands/transitionNative.mjs +5 -5
- package/dist/esm/shorthands/transitionNative.mjs.map +1 -1
- package/dist/esm/shorthands/transitionNative.native.js +8 -7
- package/dist/esm/shorthands/transitionNative.native.js.map +1 -1
- package/dist/esm/shorthands/transitionObject.mjs +280 -0
- package/dist/esm/shorthands/transitionObject.mjs.map +1 -0
- package/dist/esm/shorthands/transitionObject.native.js +323 -0
- package/dist/esm/shorthands/transitionObject.native.js.map +1 -0
- package/dist/esm/tooling/candidate.mjs +250 -16
- package/dist/esm/tooling/candidate.mjs.map +1 -1
- package/dist/esm/tooling/candidate.native.js +310 -63
- package/dist/esm/tooling/candidate.native.js.map +1 -1
- package/dist/esm/tooling/config.mjs +18 -9
- package/dist/esm/tooling/config.mjs.map +1 -1
- package/dist/esm/tooling/config.native.js +24 -26
- package/dist/esm/tooling/config.native.js.map +1 -1
- package/dist/esm/tooling/registry.mjs +579 -11
- package/dist/esm/tooling/registry.mjs.map +1 -1
- package/dist/esm/tooling/registry.native.js +579 -11
- package/dist/esm/tooling/registry.native.js.map +1 -1
- package/dist/esm/tooling/toolingDiagnostics.mjs +306 -11
- package/dist/esm/tooling/toolingDiagnostics.mjs.map +1 -1
- package/dist/esm/tooling/toolingDiagnostics.native.js +408 -49
- package/dist/esm/tooling/toolingDiagnostics.native.js.map +1 -1
- package/dist/esm/tooling/toolingRegistry.mjs +6 -1
- package/dist/esm/tooling/toolingRegistry.mjs.map +1 -1
- package/dist/esm/tooling/toolingRegistry.native.js +9 -1
- package/dist/esm/tooling/toolingRegistry.native.js.map +1 -1
- package/dist/esm/tooling.mjs +2 -0
- package/dist/esm/tooling.native.js +2 -0
- package/dist/esm/transitions.mjs +5 -0
- package/dist/esm/transitions.native.js +5 -0
- package/package.json +21 -3
- package/src/ast/payloadShape.ts +44 -16
- package/src/ast/resolvePayload.ts +28 -13
- package/src/programs/lowerProgram.ts +9 -4
- package/src/runtime/clauseIdentity.ts +8 -31
- package/src/runtime/clausePrecedence.ts +2 -10
- package/src/runtime/scanFlatValue.ts +81 -9
- package/src/runtime/spring.ts +208 -0
- package/src/runtime/stateModifiers.ts +31 -1
- package/src/runtime/tokenCategories.ts +3 -0
- package/src/runtime/unitlessNumbers.ts +0 -5
- package/src/runtime.ts +13 -0
- package/src/shorthands/transition.ts +159 -44
- package/src/shorthands/transitionAlign.ts +22 -12
- package/src/shorthands/transitionLegacy.ts +376 -156
- package/src/shorthands/transitionNative.ts +8 -11
- package/src/shorthands/transitionObject.ts +369 -0
- package/src/tooling/candidate.ts +269 -14
- package/src/tooling/config.ts +25 -9
- package/src/tooling/registry.ts +339 -12
- package/src/tooling/toolingDiagnostics.ts +474 -9
- package/src/tooling/toolingRegistry.ts +6 -1
- package/src/tooling.ts +1 -0
- package/src/transitions.ts +42 -0
- package/types/ast/payloadShape.d.ts.map +2 -2
- package/types/ast/resolvePayload.d.ts +5 -4
- package/types/ast/resolvePayload.d.ts.map +2 -2
- package/types/programs/lowerProgram.d.ts +4 -2
- package/types/programs/lowerProgram.d.ts.map +2 -2
- package/types/runtime/clauseIdentity.d.ts +1 -4
- package/types/runtime/clauseIdentity.d.ts.map +2 -2
- package/types/runtime/clausePrecedence.d.ts.map +2 -2
- package/types/runtime/scanFlatValue.d.ts +1 -1
- package/types/runtime/scanFlatValue.d.ts.map +2 -2
- package/types/runtime/spring.d.ts +61 -0
- package/types/runtime/spring.d.ts.map +11 -0
- package/types/runtime/stateModifiers.d.ts +4 -0
- package/types/runtime/stateModifiers.d.ts.map +2 -2
- package/types/runtime/tokenCategories.d.ts.map +2 -2
- package/types/runtime/unitlessNumbers.d.ts.map +2 -2
- package/types/runtime.d.ts +3 -1
- package/types/runtime.d.ts.map +2 -2
- package/types/shorthands/transition.d.ts +26 -5
- package/types/shorthands/transition.d.ts.map +2 -2
- package/types/shorthands/transitionAlign.d.ts.map +2 -2
- package/types/shorthands/transitionLegacy.d.ts +19 -4
- package/types/shorthands/transitionLegacy.d.ts.map +2 -2
- package/types/shorthands/transitionNative.d.ts.map +1 -1
- package/types/shorthands/transitionObject.d.ts +49 -0
- package/types/shorthands/transitionObject.d.ts.map +11 -0
- package/types/tooling/candidate.d.ts +13 -0
- package/types/tooling/candidate.d.ts.map +2 -2
- package/types/tooling/config.d.ts +8 -1
- package/types/tooling/config.d.ts.map +2 -2
- package/types/tooling/registry.d.ts +4 -2
- package/types/tooling/registry.d.ts.map +2 -2
- package/types/tooling/toolingDiagnostics.d.ts +3 -1
- package/types/tooling/toolingDiagnostics.d.ts.map +2 -2
- package/types/tooling/toolingRegistry.d.ts.map +2 -2
- package/types/tooling.d.ts +1 -0
- package/types/tooling.d.ts.map +2 -2
- package/types/transitions.d.ts +5 -0
- package/types/transitions.d.ts.map +11 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { namedCssColors } from "../runtime/namedCssColors.native.js";
|
|
2
|
-
import {
|
|
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
|
-
"
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
192
|
-
|
|
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
|
|
416
|
-
var width = entries.find(function(
|
|
417
|
-
return
|
|
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(
|
|
420
|
-
return
|
|
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(
|
|
432
|
-
return
|
|
522
|
+
var fontSize = entries.find(function(entry3) {
|
|
523
|
+
return entry3.prop === "fontSize";
|
|
433
524
|
});
|
|
434
|
-
var color1 = entries.find(function(
|
|
435
|
-
return
|
|
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(
|
|
454
|
-
return
|
|
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(
|
|
466
|
-
return
|
|
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(
|
|
477
|
-
return
|
|
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(
|
|
483
|
-
return
|
|
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(
|
|
496
|
-
return
|
|
592
|
+
var fontFamily = entries.find(function(entry3) {
|
|
593
|
+
return entry3.prop === "fontFamily";
|
|
497
594
|
});
|
|
498
|
-
var fontWeight = entries.find(function(
|
|
499
|
-
return
|
|
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
|
|
524
|
-
var width1 = entries.find(function(
|
|
525
|
-
return
|
|
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(
|
|
528
|
-
return
|
|
624
|
+
var color3 = entries.find(function(entry3) {
|
|
625
|
+
return entry3.prop.endsWith("Color");
|
|
529
626
|
});
|
|
530
627
|
var token = negative ? `-${rawValue}` : rawValue;
|
|
531
|
-
var
|
|
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
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
var
|
|
556
|
-
if (
|
|
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:
|
|
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 (
|
|
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:
|
|
806
|
+
entry: entry2,
|
|
565
807
|
valueKind: "convenience",
|
|
566
808
|
convenience: "sizing-keyword"
|
|
567
809
|
};
|
|
568
810
|
}
|
|
569
|
-
if (
|
|
811
|
+
if (entry2.tokenCategory === "zIndex" && numericPattern.test(rawValue)) {
|
|
570
812
|
return {
|
|
571
|
-
entry:
|
|
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:
|
|
823
|
+
entry: entry2,
|
|
582
824
|
valueKind: "convenience",
|
|
583
825
|
convenience: "percentage"
|
|
584
826
|
};
|
|
585
827
|
}
|
|
586
828
|
continue;
|
|
587
829
|
}
|
|
588
|
-
if (
|
|
830
|
+
if (entry2.prop === "zIndex" && numericPattern.test(rawValue)) {
|
|
589
831
|
return {
|
|
590
|
-
entry:
|
|
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.
|
|
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 =
|
|
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
|