tailwindcss 0.0.0-oxide-insiders.9ebaaac → 0.0.0-oxide.2

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 (286) hide show
  1. package/dist/chunk-VA4PAOBV.mjs +5017 -0
  2. package/dist/cli.d.mts +2 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +5446 -0
  5. package/dist/cli.mjs +438 -0
  6. package/dist/lib.d.mts +244 -0
  7. package/dist/lib.d.ts +244 -0
  8. package/dist/lib.js +4947 -0
  9. package/dist/lib.mjs +1 -0
  10. package/index.css +4 -4
  11. package/package.json +36 -106
  12. package/preflight.css +404 -0
  13. package/theme.css +468 -0
  14. package/LICENSE +0 -21
  15. package/README.md +0 -41
  16. package/base.css +0 -1
  17. package/colors.d.ts +0 -3
  18. package/colors.js +0 -2
  19. package/components.css +0 -1
  20. package/defaultConfig.d.ts +0 -3
  21. package/defaultConfig.js +0 -2
  22. package/defaultTheme.d.ts +0 -4
  23. package/defaultTheme.js +0 -2
  24. package/lib/cli/build/deps.js +0 -62
  25. package/lib/cli/build/index.js +0 -54
  26. package/lib/cli/build/plugin.js +0 -383
  27. package/lib/cli/build/utils.js +0 -88
  28. package/lib/cli/build/watching.js +0 -182
  29. package/lib/cli/help/index.js +0 -73
  30. package/lib/cli/index.js +0 -230
  31. package/lib/cli/init/index.js +0 -67
  32. package/lib/cli-peer-dependencies.js +0 -36
  33. package/lib/cli.js +0 -7
  34. package/lib/corePluginList.js +0 -187
  35. package/lib/corePlugins.js +0 -4173
  36. package/lib/css/LICENSE +0 -25
  37. package/lib/css/preflight.css +0 -375
  38. package/lib/featureFlags.js +0 -83
  39. package/lib/index.js +0 -2
  40. package/lib/lib/cacheInvalidation.js +0 -92
  41. package/lib/lib/collapseAdjacentRules.js +0 -61
  42. package/lib/lib/collapseDuplicateDeclarations.js +0 -85
  43. package/lib/lib/content.js +0 -202
  44. package/lib/lib/defaultExtractor.js +0 -243
  45. package/lib/lib/detectNesting.js +0 -45
  46. package/lib/lib/evaluateTailwindFunctions.js +0 -238
  47. package/lib/lib/expandApplyAtRules.js +0 -534
  48. package/lib/lib/expandTailwindAtRules.js +0 -274
  49. package/lib/lib/findAtConfigPath.js +0 -46
  50. package/lib/lib/generateRules.js +0 -882
  51. package/lib/lib/getModuleDependencies.js +0 -99
  52. package/lib/lib/handleImportAtRules.js +0 -49
  53. package/lib/lib/load-config.js +0 -42
  54. package/lib/lib/normalizeTailwindDirectives.js +0 -91
  55. package/lib/lib/offsets.js +0 -306
  56. package/lib/lib/partitionApplyAtRules.js +0 -58
  57. package/lib/lib/regex.js +0 -74
  58. package/lib/lib/remap-bitfield.js +0 -89
  59. package/lib/lib/resolveDefaultsAtRules.js +0 -165
  60. package/lib/lib/setupContextUtils.js +0 -1255
  61. package/lib/lib/setupTrackingContext.js +0 -165
  62. package/lib/lib/sharedState.js +0 -87
  63. package/lib/lib/substituteScreenAtRules.js +0 -31
  64. package/lib/oxide/cli/build/deps.js +0 -89
  65. package/lib/oxide/cli/build/index.js +0 -53
  66. package/lib/oxide/cli/build/plugin.js +0 -354
  67. package/lib/oxide/cli/build/utils.js +0 -87
  68. package/lib/oxide/cli/build/watching.js +0 -179
  69. package/lib/oxide/cli/help/index.js +0 -72
  70. package/lib/oxide/cli/index.js +0 -214
  71. package/lib/oxide/cli/init/index.js +0 -56
  72. package/lib/oxide/cli.js +0 -5
  73. package/lib/oxide/postcss-plugin.js +0 -2
  74. package/lib/plugin.js +0 -100
  75. package/lib/postcss-plugins/nesting/README.md +0 -42
  76. package/lib/postcss-plugins/nesting/index.js +0 -21
  77. package/lib/postcss-plugins/nesting/plugin.js +0 -89
  78. package/lib/processTailwindFeatures.js +0 -64
  79. package/lib/public/colors.js +0 -355
  80. package/lib/public/create-plugin.js +0 -17
  81. package/lib/public/default-config.js +0 -18
  82. package/lib/public/default-theme.js +0 -18
  83. package/lib/public/load-config.js +0 -12
  84. package/lib/public/resolve-config.js +0 -24
  85. package/lib/util/applyImportantSelector.js +0 -36
  86. package/lib/util/bigSign.js +0 -13
  87. package/lib/util/buildMediaQuery.js +0 -27
  88. package/lib/util/cloneDeep.js +0 -22
  89. package/lib/util/cloneNodes.js +0 -34
  90. package/lib/util/color.js +0 -116
  91. package/lib/util/colorNames.js +0 -752
  92. package/lib/util/configurePlugins.js +0 -23
  93. package/lib/util/createPlugin.js +0 -32
  94. package/lib/util/createUtilityPlugin.js +0 -53
  95. package/lib/util/dataTypes.js +0 -304
  96. package/lib/util/defaults.js +0 -27
  97. package/lib/util/escapeClassName.js +0 -24
  98. package/lib/util/escapeCommas.js +0 -13
  99. package/lib/util/flattenColorPalette.js +0 -18
  100. package/lib/util/formatVariantSelector.js +0 -263
  101. package/lib/util/getAllConfigs.js +0 -52
  102. package/lib/util/hashConfig.js +0 -21
  103. package/lib/util/isKeyframeRule.js +0 -13
  104. package/lib/util/isPlainObject.js +0 -17
  105. package/lib/util/isSyntacticallyValidPropertyValue.js +0 -74
  106. package/lib/util/log.js +0 -61
  107. package/lib/util/nameClass.js +0 -49
  108. package/lib/util/negateValue.js +0 -36
  109. package/lib/util/normalizeConfig.js +0 -304
  110. package/lib/util/normalizeScreens.js +0 -178
  111. package/lib/util/parseAnimationValue.js +0 -93
  112. package/lib/util/parseBoxShadowValue.js +0 -88
  113. package/lib/util/parseDependency.js +0 -47
  114. package/lib/util/parseGlob.js +0 -36
  115. package/lib/util/parseObjectStyles.js +0 -36
  116. package/lib/util/pluginUtils.js +0 -276
  117. package/lib/util/prefixSelector.js +0 -39
  118. package/lib/util/pseudoElements.js +0 -229
  119. package/lib/util/removeAlphaVariables.js +0 -31
  120. package/lib/util/resolveConfig.js +0 -256
  121. package/lib/util/resolveConfigPath.js +0 -70
  122. package/lib/util/responsive.js +0 -24
  123. package/lib/util/splitAtTopLevelOnly.js +0 -51
  124. package/lib/util/tap.js +0 -14
  125. package/lib/util/toColorValue.js +0 -13
  126. package/lib/util/toPath.js +0 -32
  127. package/lib/util/transformThemeValue.js +0 -73
  128. package/lib/util/validateConfig.js +0 -43
  129. package/lib/util/validateFormalSyntax.js +0 -26
  130. package/lib/util/withAlphaVariable.js +0 -79
  131. package/lib/value-parser/LICENSE +0 -22
  132. package/lib/value-parser/README.md +0 -3
  133. package/lib/value-parser/index.d.js +0 -2
  134. package/lib/value-parser/index.js +0 -22
  135. package/lib/value-parser/parse.js +0 -259
  136. package/lib/value-parser/stringify.js +0 -38
  137. package/lib/value-parser/unit.js +0 -86
  138. package/lib/value-parser/walk.js +0 -16
  139. package/loadConfig.d.ts +0 -4
  140. package/loadConfig.js +0 -2
  141. package/nesting/index.js +0 -2
  142. package/peers/index.js +0 -96294
  143. package/plugin.d.ts +0 -11
  144. package/plugin.js +0 -2
  145. package/prettier.config.js +0 -19
  146. package/resolveConfig.d.ts +0 -12
  147. package/resolveConfig.js +0 -2
  148. package/screens.css +0 -1
  149. package/scripts/create-plugin-list.js +0 -10
  150. package/scripts/generate-types.js +0 -105
  151. package/scripts/release-channel.js +0 -18
  152. package/scripts/release-notes.js +0 -21
  153. package/scripts/swap-engines.js +0 -40
  154. package/scripts/type-utils.js +0 -27
  155. package/src/cli/build/deps.js +0 -56
  156. package/src/cli/build/index.js +0 -49
  157. package/src/cli/build/plugin.js +0 -451
  158. package/src/cli/build/utils.js +0 -76
  159. package/src/cli/build/watching.js +0 -229
  160. package/src/cli/help/index.js +0 -70
  161. package/src/cli/index.js +0 -216
  162. package/src/cli/init/index.js +0 -84
  163. package/src/cli-peer-dependencies.js +0 -15
  164. package/src/cli.js +0 -7
  165. package/src/corePluginList.js +0 -1
  166. package/src/corePlugins.js +0 -2849
  167. package/src/css/LICENSE +0 -25
  168. package/src/css/preflight.css +0 -375
  169. package/src/featureFlags.js +0 -70
  170. package/src/index.js +0 -1
  171. package/src/lib/cacheInvalidation.js +0 -52
  172. package/src/lib/collapseAdjacentRules.js +0 -58
  173. package/src/lib/collapseDuplicateDeclarations.js +0 -93
  174. package/src/lib/content.js +0 -235
  175. package/src/lib/defaultExtractor.js +0 -217
  176. package/src/lib/detectNesting.js +0 -47
  177. package/src/lib/evaluateTailwindFunctions.js +0 -272
  178. package/src/lib/expandApplyAtRules.js +0 -613
  179. package/src/lib/expandTailwindAtRules.js +0 -283
  180. package/src/lib/findAtConfigPath.js +0 -48
  181. package/src/lib/generateRules.js +0 -927
  182. package/src/lib/getModuleDependencies.js +0 -79
  183. package/src/lib/handleImportAtRules.js +0 -33
  184. package/src/lib/load-config.ts +0 -31
  185. package/src/lib/normalizeTailwindDirectives.js +0 -86
  186. package/src/lib/offsets.js +0 -373
  187. package/src/lib/partitionApplyAtRules.js +0 -52
  188. package/src/lib/regex.js +0 -74
  189. package/src/lib/remap-bitfield.js +0 -82
  190. package/src/lib/resolveDefaultsAtRules.js +0 -163
  191. package/src/lib/setupContextUtils.js +0 -1327
  192. package/src/lib/setupTrackingContext.js +0 -171
  193. package/src/lib/sharedState.js +0 -61
  194. package/src/lib/substituteScreenAtRules.js +0 -19
  195. package/src/oxide/cli/build/deps.ts +0 -91
  196. package/src/oxide/cli/build/index.ts +0 -47
  197. package/src/oxide/cli/build/plugin.ts +0 -419
  198. package/src/oxide/cli/build/utils.ts +0 -74
  199. package/src/oxide/cli/build/watching.ts +0 -225
  200. package/src/oxide/cli/help/index.ts +0 -69
  201. package/src/oxide/cli/index.ts +0 -204
  202. package/src/oxide/cli/init/index.ts +0 -64
  203. package/src/oxide/cli.ts +0 -1
  204. package/src/oxide/postcss-plugin.ts +0 -1
  205. package/src/plugin.js +0 -109
  206. package/src/postcss-plugins/nesting/README.md +0 -42
  207. package/src/postcss-plugins/nesting/index.js +0 -13
  208. package/src/postcss-plugins/nesting/plugin.js +0 -80
  209. package/src/processTailwindFeatures.js +0 -58
  210. package/src/public/colors.js +0 -322
  211. package/src/public/create-plugin.js +0 -2
  212. package/src/public/default-config.js +0 -4
  213. package/src/public/default-theme.js +0 -4
  214. package/src/public/load-config.js +0 -2
  215. package/src/public/resolve-config.js +0 -7
  216. package/src/util/applyImportantSelector.js +0 -27
  217. package/src/util/bigSign.js +0 -3
  218. package/src/util/buildMediaQuery.js +0 -22
  219. package/src/util/cloneDeep.js +0 -11
  220. package/src/util/cloneNodes.js +0 -28
  221. package/src/util/color.js +0 -88
  222. package/src/util/colorNames.js +0 -150
  223. package/src/util/configurePlugins.js +0 -23
  224. package/src/util/createPlugin.js +0 -27
  225. package/src/util/createUtilityPlugin.js +0 -37
  226. package/src/util/dataTypes.js +0 -292
  227. package/src/util/defaults.js +0 -17
  228. package/src/util/escapeClassName.js +0 -8
  229. package/src/util/escapeCommas.js +0 -3
  230. package/src/util/flattenColorPalette.js +0 -13
  231. package/src/util/formatVariantSelector.js +0 -316
  232. package/src/util/getAllConfigs.js +0 -45
  233. package/src/util/hashConfig.js +0 -5
  234. package/src/util/isKeyframeRule.js +0 -3
  235. package/src/util/isPlainObject.js +0 -8
  236. package/src/util/isSyntacticallyValidPropertyValue.js +0 -61
  237. package/src/util/log.js +0 -29
  238. package/src/util/nameClass.js +0 -30
  239. package/src/util/negateValue.js +0 -24
  240. package/src/util/normalizeConfig.js +0 -335
  241. package/src/util/normalizeScreens.js +0 -140
  242. package/src/util/parseAnimationValue.js +0 -68
  243. package/src/util/parseBoxShadowValue.js +0 -72
  244. package/src/util/parseDependency.js +0 -44
  245. package/src/util/parseGlob.js +0 -24
  246. package/src/util/parseObjectStyles.js +0 -19
  247. package/src/util/pluginUtils.js +0 -291
  248. package/src/util/prefixSelector.js +0 -32
  249. package/src/util/pseudoElements.js +0 -170
  250. package/src/util/removeAlphaVariables.js +0 -24
  251. package/src/util/resolveConfig.js +0 -277
  252. package/src/util/resolveConfigPath.js +0 -66
  253. package/src/util/responsive.js +0 -10
  254. package/src/util/splitAtTopLevelOnly.js +0 -52
  255. package/src/util/tap.js +0 -4
  256. package/src/util/toColorValue.js +0 -3
  257. package/src/util/toPath.js +0 -26
  258. package/src/util/transformThemeValue.js +0 -62
  259. package/src/util/validateConfig.js +0 -33
  260. package/src/util/validateFormalSyntax.js +0 -34
  261. package/src/util/withAlphaVariable.js +0 -49
  262. package/src/value-parser/LICENSE +0 -22
  263. package/src/value-parser/README.md +0 -3
  264. package/src/value-parser/index.d.ts +0 -177
  265. package/src/value-parser/index.js +0 -28
  266. package/src/value-parser/parse.js +0 -303
  267. package/src/value-parser/stringify.js +0 -41
  268. package/src/value-parser/unit.js +0 -118
  269. package/src/value-parser/walk.js +0 -18
  270. package/stubs/.gitignore +0 -1
  271. package/stubs/.prettierrc.json +0 -6
  272. package/stubs/config.full.js +0 -991
  273. package/stubs/config.simple.js +0 -7
  274. package/stubs/postcss.config.cjs +0 -6
  275. package/stubs/postcss.config.js +0 -6
  276. package/stubs/tailwind.config.cjs +0 -2
  277. package/stubs/tailwind.config.js +0 -2
  278. package/stubs/tailwind.config.ts +0 -3
  279. package/tailwind.css +0 -5
  280. package/types/config.d.ts +0 -368
  281. package/types/generated/.gitkeep +0 -0
  282. package/types/generated/colors.d.ts +0 -298
  283. package/types/generated/corePluginList.d.ts +0 -1
  284. package/types/generated/default-theme.d.ts +0 -372
  285. package/types/index.d.ts +0 -7
  286. package/variants.css +0 -1
package/dist/lib.js ADDED
@@ -0,0 +1,4947 @@
1
+ 'use strict';
2
+
3
+ var lightningcss = require('lightningcss');
4
+
5
+ // src/index.ts
6
+
7
+ // package.json
8
+ var version = "0.0.0-oxide.2";
9
+
10
+ // src/ast.ts
11
+ function rule(selector, nodes) {
12
+ return {
13
+ kind: "rule",
14
+ selector,
15
+ nodes
16
+ };
17
+ }
18
+ function decl(property2, value) {
19
+ return {
20
+ kind: "declaration",
21
+ property: property2,
22
+ value,
23
+ important: false
24
+ };
25
+ }
26
+ function comment(value) {
27
+ return {
28
+ kind: "comment",
29
+ value
30
+ };
31
+ }
32
+ function walk(ast, visit) {
33
+ for (let i = 0; i < ast.length; i++) {
34
+ let node = ast[i];
35
+ let shouldContinue = visit(node, {
36
+ replaceWith(newNode) {
37
+ ast.splice(i, 1, ...Array.isArray(newNode) ? newNode : [newNode]);
38
+ i--;
39
+ }
40
+ });
41
+ if (shouldContinue === false)
42
+ return;
43
+ if (node.kind === "rule") {
44
+ walk(node.nodes, visit);
45
+ }
46
+ }
47
+ }
48
+
49
+ // src/utils/math-operators.ts
50
+ var mathFunctions = [
51
+ "calc",
52
+ "min",
53
+ "max",
54
+ "clamp",
55
+ "mod",
56
+ "rem",
57
+ "sin",
58
+ "cos",
59
+ "tan",
60
+ "asin",
61
+ "acos",
62
+ "atan",
63
+ "atan2",
64
+ "pow",
65
+ "sqrt",
66
+ "hypot",
67
+ "log",
68
+ "exp",
69
+ "round"
70
+ ];
71
+ function hasMathFn(input) {
72
+ return input.indexOf("(") !== -1 && mathFunctions.some((fn) => input.includes(`${fn}(`));
73
+ }
74
+ function addWhitespaceAroundMathOperators(input) {
75
+ if (input.indexOf("(") === -1) {
76
+ return input;
77
+ }
78
+ if (!mathFunctions.some((fn) => input.includes(fn))) {
79
+ return input;
80
+ }
81
+ let result = "";
82
+ let formattable = [];
83
+ for (let i = 0; i < input.length; i++) {
84
+ let char = input[i];
85
+ if (char === "(") {
86
+ result += char;
87
+ let start = i;
88
+ for (let j = i - 1; j >= 0; j--) {
89
+ let inner = input.charCodeAt(j);
90
+ if (inner >= 48 && inner <= 57) {
91
+ start = j;
92
+ } else if (inner >= 97 && inner <= 122) {
93
+ start = j;
94
+ } else {
95
+ break;
96
+ }
97
+ }
98
+ let fn = input.slice(start, i);
99
+ if (mathFunctions.includes(fn)) {
100
+ formattable.unshift(true);
101
+ continue;
102
+ } else if (formattable[0] && fn === "") {
103
+ formattable.unshift(true);
104
+ continue;
105
+ }
106
+ formattable.unshift(false);
107
+ continue;
108
+ } else if (char === ")") {
109
+ result += char;
110
+ formattable.shift();
111
+ } else if (char === "," && formattable[0]) {
112
+ result += `, `;
113
+ continue;
114
+ } else if (char === " " && formattable[0] && result[result.length - 1] === " ") {
115
+ continue;
116
+ } else if ((char === "+" || char === "*" || char === "/" || char === "-") && formattable[0]) {
117
+ let trimmed = result.trimEnd();
118
+ let prev = trimmed[trimmed.length - 1];
119
+ if (prev === "+" || prev === "*" || prev === "/" || prev === "-") {
120
+ result += char;
121
+ continue;
122
+ } else if (prev === "(" || prev === ",") {
123
+ result += char;
124
+ continue;
125
+ } else if (input[i - 1] === " ") {
126
+ result += `${char} `;
127
+ } else {
128
+ result += ` ${char} `;
129
+ }
130
+ } else if (formattable[0] && input.startsWith("to-zero", i)) {
131
+ let start = i;
132
+ i += 7;
133
+ result += input.slice(start, i + 1);
134
+ } else {
135
+ result += char;
136
+ }
137
+ }
138
+ return result;
139
+ }
140
+
141
+ // src/utils/decode-arbitrary-value.ts
142
+ function decodeArbitraryValue(input) {
143
+ if (input.startsWith("url(")) {
144
+ return input;
145
+ }
146
+ input = convertUnderscoresToWhitespace(input);
147
+ input = addWhitespaceAroundMathOperators(input);
148
+ return input;
149
+ }
150
+ function convertUnderscoresToWhitespace(input) {
151
+ let output = "";
152
+ for (let i = 0; i < input.length; i++) {
153
+ let char = input[i];
154
+ if (char === "\\" && input[i + 1] === "_") {
155
+ output += "_";
156
+ i += 1;
157
+ } else if (char === "_") {
158
+ output += " ";
159
+ } else {
160
+ output += char;
161
+ }
162
+ }
163
+ return output;
164
+ }
165
+
166
+ // src/utils/segment.ts
167
+ function segment(input, separator) {
168
+ let closingBracketStack = "";
169
+ let parts = [];
170
+ let lastPos = 0;
171
+ for (let idx = 0; idx < input.length; idx++) {
172
+ let char = input[idx];
173
+ if (closingBracketStack.length === 0 && char === separator) {
174
+ parts.push(input.slice(lastPos, idx));
175
+ lastPos = idx + 1;
176
+ continue;
177
+ }
178
+ switch (char) {
179
+ case "\\":
180
+ idx += 1;
181
+ break;
182
+ case "(":
183
+ closingBracketStack += ")";
184
+ break;
185
+ case "[":
186
+ closingBracketStack += "]";
187
+ break;
188
+ case "{":
189
+ closingBracketStack += "}";
190
+ break;
191
+ case ")":
192
+ case "]":
193
+ case "}":
194
+ if (closingBracketStack.length > 0 && char === closingBracketStack[closingBracketStack.length - 1]) {
195
+ closingBracketStack = closingBracketStack.slice(0, closingBracketStack.length - 1);
196
+ }
197
+ break;
198
+ }
199
+ }
200
+ parts.push(input.slice(lastPos));
201
+ return parts;
202
+ }
203
+
204
+ // src/candidate.ts
205
+ function findRoot(input, lookup) {
206
+ let root = null;
207
+ let value = null;
208
+ {
209
+ if (lookup.has(input)) {
210
+ root = input;
211
+ value = null;
212
+ } else {
213
+ let idx = input.lastIndexOf("-");
214
+ if (idx === -1)
215
+ return [null, null];
216
+ do {
217
+ let maybeRoot = input.slice(0, idx);
218
+ if (lookup.has(maybeRoot)) {
219
+ root = maybeRoot;
220
+ value = input.slice(idx + 1);
221
+ break;
222
+ }
223
+ idx = input.lastIndexOf("-", idx - 1);
224
+ } while (idx > 0);
225
+ }
226
+ }
227
+ return [root, value];
228
+ }
229
+ function parseVariant(variant, variants, parsedVariants) {
230
+ if (variant[0] === "[" && variant[variant.length - 1] === "]") {
231
+ if (variant[1] === "@" && variant.includes("&"))
232
+ return null;
233
+ let selector = decodeArbitraryValue(variant.slice(1, -1));
234
+ if (selector[0] !== "@") {
235
+ if (!selector.includes("&")) {
236
+ selector = `&:is(${selector})`;
237
+ }
238
+ }
239
+ return {
240
+ kind: "arbitrary",
241
+ selector,
242
+ compounds: true
243
+ };
244
+ }
245
+ {
246
+ let [variantWithoutModifier, modifier = null, additionalModifier] = segment(variant, "/");
247
+ if (additionalModifier)
248
+ return null;
249
+ let [root, value] = findRoot(variantWithoutModifier, variants);
250
+ if (root === null)
251
+ return null;
252
+ switch (variants.kind(root)) {
253
+ case "static": {
254
+ if (value !== null)
255
+ return null;
256
+ return {
257
+ kind: "static",
258
+ root,
259
+ compounds: variants.compounds(root)
260
+ };
261
+ }
262
+ case "functional": {
263
+ if (value === null)
264
+ return null;
265
+ if (value[0] === "[" && value[value.length - 1] === "]") {
266
+ return {
267
+ kind: "functional",
268
+ root,
269
+ value: {
270
+ kind: "arbitrary",
271
+ value: decodeArbitraryValue(value.slice(1, -1))
272
+ },
273
+ compounds: variants.compounds(root)
274
+ };
275
+ } else {
276
+ return {
277
+ kind: "functional",
278
+ root,
279
+ value: { kind: "named", value },
280
+ compounds: variants.compounds(root)
281
+ };
282
+ }
283
+ }
284
+ case "compound": {
285
+ if (value === null)
286
+ return null;
287
+ let subVariant = parsedVariants.get(value);
288
+ if (subVariant === null)
289
+ return null;
290
+ if (subVariant.compounds === false)
291
+ return null;
292
+ return {
293
+ kind: "compound",
294
+ root,
295
+ modifier: modifier === null ? null : { kind: "named", value: modifier },
296
+ variant: subVariant,
297
+ compounds: variants.compounds(root)
298
+ };
299
+ }
300
+ }
301
+ }
302
+ return null;
303
+ }
304
+ function parseCandidate(input, utilities, parsedVariants) {
305
+ let rawVariants = segment(input, ":");
306
+ let base = rawVariants.pop();
307
+ let parsedCandidateVariants = [];
308
+ for (let variant of rawVariants) {
309
+ let parsedVariant = parsedVariants.get(variant);
310
+ if (parsedVariant === null)
311
+ return null;
312
+ switch (variant) {
313
+ case "after":
314
+ case "backdrop":
315
+ case "before":
316
+ case "first-letter":
317
+ case "first-line":
318
+ case "marker":
319
+ case "placeholder":
320
+ case "selection":
321
+ parsedCandidateVariants.unshift(parsedVariant);
322
+ break;
323
+ default:
324
+ parsedCandidateVariants.push(parsedVariant);
325
+ }
326
+ }
327
+ let state = {
328
+ important: false,
329
+ negative: false
330
+ };
331
+ if (base[base.length - 1] === "!") {
332
+ state.important = true;
333
+ base = base.slice(0, -1);
334
+ }
335
+ if (base[0] === "[" && base[base.length - 1] === "]") {
336
+ let charCode = base.charCodeAt(1);
337
+ if (charCode !== 45 && !(charCode >= 97 && charCode <= 122))
338
+ return null;
339
+ base = base.slice(1, -1);
340
+ let idx = base.indexOf(":");
341
+ if (idx === -1 || idx === 0 || idx === base.length - 1)
342
+ return null;
343
+ let property2 = base.slice(0, idx);
344
+ let value2 = decodeArbitraryValue(base.slice(idx + 1));
345
+ return {
346
+ kind: "arbitrary",
347
+ property: property2,
348
+ value: value2,
349
+ variants: parsedCandidateVariants,
350
+ important: state.important
351
+ };
352
+ }
353
+ if (base[0] === "-") {
354
+ state.negative = true;
355
+ base = base.slice(1);
356
+ }
357
+ let [root, value] = findRoot(base, utilities);
358
+ if (root === null)
359
+ return null;
360
+ let kind = utilities.kind(root);
361
+ if (kind === "static") {
362
+ if (value !== null)
363
+ return null;
364
+ return {
365
+ kind: "static",
366
+ root,
367
+ variants: parsedCandidateVariants,
368
+ negative: state.negative,
369
+ important: state.important
370
+ };
371
+ }
372
+ let candidate = {
373
+ kind: "functional",
374
+ root,
375
+ modifier: null,
376
+ value: null,
377
+ variants: parsedCandidateVariants,
378
+ negative: state.negative,
379
+ important: state.important
380
+ };
381
+ if (value === null) {
382
+ return candidate;
383
+ }
384
+ let [valueWithoutModifier, modifierSegment = null] = segment(value, "/");
385
+ let startArbitraryIdx = valueWithoutModifier.indexOf("[");
386
+ let valueIsArbitrary = startArbitraryIdx !== -1;
387
+ let modifierIsArbitrary = modifierSegment && modifierSegment[0] === "[" && modifierSegment[modifierSegment.length - 1] === "]";
388
+ if (modifierSegment) {
389
+ if (modifierIsArbitrary) {
390
+ let arbitraryValue = modifierSegment.slice(1, -1);
391
+ let dashedIdent = null;
392
+ if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
393
+ dashedIdent = arbitraryValue;
394
+ arbitraryValue = `var(${arbitraryValue})`;
395
+ } else {
396
+ arbitraryValue = decodeArbitraryValue(arbitraryValue);
397
+ }
398
+ candidate.modifier = {
399
+ kind: "arbitrary",
400
+ value: arbitraryValue,
401
+ dashedIdent
402
+ };
403
+ } else {
404
+ candidate.modifier = {
405
+ kind: "named",
406
+ value: modifierSegment
407
+ };
408
+ }
409
+ }
410
+ if (valueIsArbitrary) {
411
+ let arbitraryValue = valueWithoutModifier.slice(startArbitraryIdx + 1, -1);
412
+ let typehint = "";
413
+ for (let i = 0; i < arbitraryValue.length; i++) {
414
+ let code = arbitraryValue.charCodeAt(i);
415
+ if (code === 58) {
416
+ typehint = arbitraryValue.slice(0, i);
417
+ arbitraryValue = arbitraryValue.slice(i + 1);
418
+ break;
419
+ }
420
+ if (code === 45 || code >= 97 && code <= 122) {
421
+ continue;
422
+ }
423
+ break;
424
+ }
425
+ let dashedIdent = null;
426
+ if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
427
+ dashedIdent = arbitraryValue;
428
+ arbitraryValue = `var(${arbitraryValue})`;
429
+ } else {
430
+ arbitraryValue = decodeArbitraryValue(arbitraryValue);
431
+ }
432
+ candidate.value = {
433
+ kind: "arbitrary",
434
+ dataType: typehint || null,
435
+ value: arbitraryValue,
436
+ dashedIdent
437
+ };
438
+ } else {
439
+ let fraction = modifierSegment === null || modifierIsArbitrary ? null : value.slice(valueWithoutModifier.lastIndexOf("-") + 1);
440
+ candidate.value = {
441
+ kind: "named",
442
+ value: valueWithoutModifier,
443
+ fraction
444
+ };
445
+ }
446
+ return candidate;
447
+ }
448
+
449
+ // src/sort.ts
450
+ function getClassOrder(design, classes) {
451
+ let { astNodes, nodeSorting } = compileCandidates(Array.from(classes), design, {
452
+ throwOnInvalidCandidate: false
453
+ });
454
+ let sorted = new Map(classes.map((className) => [className, null]));
455
+ let idx = 0n;
456
+ for (let node of astNodes) {
457
+ let candidate = nodeSorting.get(node)?.candidate;
458
+ if (!candidate)
459
+ continue;
460
+ sorted.set(candidate, sorted.get(candidate) ?? idx++);
461
+ }
462
+ return classes.map((className) => [
463
+ //
464
+ className,
465
+ sorted.get(className) ?? null
466
+ ]);
467
+ }
468
+
469
+ // src/utils/is-color.ts
470
+ var NAMED_COLORS = [
471
+ // CSS Level 1 colors
472
+ "black",
473
+ "silver",
474
+ "gray",
475
+ "white",
476
+ "maroon",
477
+ "red",
478
+ "purple",
479
+ "fuchsia",
480
+ "green",
481
+ "lime",
482
+ "olive",
483
+ "yellow",
484
+ "navy",
485
+ "blue",
486
+ "teal",
487
+ "aqua",
488
+ // CSS Level 2/3 colors
489
+ "aliceblue",
490
+ "antiquewhite",
491
+ "aqua",
492
+ "aquamarine",
493
+ "azure",
494
+ "beige",
495
+ "bisque",
496
+ "black",
497
+ "blanchedalmond",
498
+ "blue",
499
+ "blueviolet",
500
+ "brown",
501
+ "burlywood",
502
+ "cadetblue",
503
+ "chartreuse",
504
+ "chocolate",
505
+ "coral",
506
+ "cornflowerblue",
507
+ "cornsilk",
508
+ "crimson",
509
+ "cyan",
510
+ "darkblue",
511
+ "darkcyan",
512
+ "darkgoldenrod",
513
+ "darkgray",
514
+ "darkgreen",
515
+ "darkgrey",
516
+ "darkkhaki",
517
+ "darkmagenta",
518
+ "darkolivegreen",
519
+ "darkorange",
520
+ "darkorchid",
521
+ "darkred",
522
+ "darksalmon",
523
+ "darkseagreen",
524
+ "darkslateblue",
525
+ "darkslategray",
526
+ "darkslategrey",
527
+ "darkturquoise",
528
+ "darkviolet",
529
+ "deeppink",
530
+ "deepskyblue",
531
+ "dimgray",
532
+ "dimgrey",
533
+ "dodgerblue",
534
+ "firebrick",
535
+ "floralwhite",
536
+ "forestgreen",
537
+ "fuchsia",
538
+ "gainsboro",
539
+ "ghostwhite",
540
+ "gold",
541
+ "goldenrod",
542
+ "gray",
543
+ "green",
544
+ "greenyellow",
545
+ "grey",
546
+ "honeydew",
547
+ "hotpink",
548
+ "indianred",
549
+ "indigo",
550
+ "ivory",
551
+ "khaki",
552
+ "lavender",
553
+ "lavenderblush",
554
+ "lawngreen",
555
+ "lemonchiffon",
556
+ "lightblue",
557
+ "lightcoral",
558
+ "lightcyan",
559
+ "lightgoldenrodyellow",
560
+ "lightgray",
561
+ "lightgreen",
562
+ "lightgrey",
563
+ "lightpink",
564
+ "lightsalmon",
565
+ "lightseagreen",
566
+ "lightskyblue",
567
+ "lightslategray",
568
+ "lightslategrey",
569
+ "lightsteelblue",
570
+ "lightyellow",
571
+ "lime",
572
+ "limegreen",
573
+ "linen",
574
+ "magenta",
575
+ "maroon",
576
+ "mediumaquamarine",
577
+ "mediumblue",
578
+ "mediumorchid",
579
+ "mediumpurple",
580
+ "mediumseagreen",
581
+ "mediumslateblue",
582
+ "mediumspringgreen",
583
+ "mediumturquoise",
584
+ "mediumvioletred",
585
+ "midnightblue",
586
+ "mintcream",
587
+ "mistyrose",
588
+ "moccasin",
589
+ "navajowhite",
590
+ "navy",
591
+ "oldlace",
592
+ "olive",
593
+ "olivedrab",
594
+ "orange",
595
+ "orangered",
596
+ "orchid",
597
+ "palegoldenrod",
598
+ "palegreen",
599
+ "paleturquoise",
600
+ "palevioletred",
601
+ "papayawhip",
602
+ "peachpuff",
603
+ "peru",
604
+ "pink",
605
+ "plum",
606
+ "powderblue",
607
+ "purple",
608
+ "rebeccapurple",
609
+ "red",
610
+ "rosybrown",
611
+ "royalblue",
612
+ "saddlebrown",
613
+ "salmon",
614
+ "sandybrown",
615
+ "seagreen",
616
+ "seashell",
617
+ "sienna",
618
+ "silver",
619
+ "skyblue",
620
+ "slateblue",
621
+ "slategray",
622
+ "slategrey",
623
+ "snow",
624
+ "springgreen",
625
+ "steelblue",
626
+ "tan",
627
+ "teal",
628
+ "thistle",
629
+ "tomato",
630
+ "turquoise",
631
+ "violet",
632
+ "wheat",
633
+ "white",
634
+ "whitesmoke",
635
+ "yellow",
636
+ "yellowgreen",
637
+ // Keywords
638
+ "transparent",
639
+ "currentcolor",
640
+ // System colors
641
+ "canvas",
642
+ "canvastext",
643
+ "linktext",
644
+ "visitedtext",
645
+ "activetext",
646
+ "buttonface",
647
+ "buttontext",
648
+ "buttonborder",
649
+ "field",
650
+ "fieldtext",
651
+ "highlight",
652
+ "highlighttext",
653
+ "selecteditem",
654
+ "selecteditemtext",
655
+ "mark",
656
+ "marktext",
657
+ "graytext",
658
+ "accentcolor",
659
+ "accentcolortext"
660
+ ];
661
+ var IS_COLOR_FN = /^(rgba?|hsla?|hwb|color|(ok)?(lab|lch)|light-dark|color-mix)\(/i;
662
+ function isColor(value) {
663
+ return value.charCodeAt(0) === 35 || IS_COLOR_FN.test(value) || NAMED_COLORS.includes(value.toLowerCase());
664
+ }
665
+
666
+ // src/utils/infer-data-type.ts
667
+ var checks = {
668
+ color: isColor,
669
+ length: isLength,
670
+ percentage: isPercentage,
671
+ number: isNumber,
672
+ url: isUrl,
673
+ position: isBackgroundPosition,
674
+ "bg-size": isBackgroundSize,
675
+ "line-width": isLineWidth,
676
+ image: isImage,
677
+ "family-name": isFamilyName,
678
+ "generic-name": isGenericName,
679
+ "absolute-size": isAbsoluteSize,
680
+ "relative-size": isRelativeSize
681
+ };
682
+ function inferDataType(value, types) {
683
+ if (value.startsWith("var("))
684
+ return null;
685
+ for (let type of types) {
686
+ if (checks[type]?.(value)) {
687
+ return type;
688
+ }
689
+ }
690
+ return null;
691
+ }
692
+ var IS_URL = /^url\(.*\)$/;
693
+ function isUrl(value) {
694
+ return IS_URL.test(value);
695
+ }
696
+ function isLineWidth(value) {
697
+ return value === "thin" || value === "medium" || value === "thick";
698
+ }
699
+ var IS_IMAGE_FN = /^(?:element|image|cross-fade|image-set)\(/;
700
+ var IS_GRADIENT_FN = /^(repeating-)?(conic|linear|radial)-gradient\(/;
701
+ function isImage(value) {
702
+ let count = 0;
703
+ for (let part of segment(value, ",")) {
704
+ if (part.startsWith("var("))
705
+ continue;
706
+ if (isUrl(part)) {
707
+ count += 1;
708
+ continue;
709
+ }
710
+ if (IS_GRADIENT_FN.test(part)) {
711
+ count += 1;
712
+ continue;
713
+ }
714
+ if (IS_IMAGE_FN.test(part)) {
715
+ count += 1;
716
+ continue;
717
+ }
718
+ return false;
719
+ }
720
+ return count > 0;
721
+ }
722
+ function isGenericName(value) {
723
+ return value === "serif" || value === "sans-serif" || value === "monospace" || value === "cursive" || value === "fantasy" || value === "system-ui" || value === "ui-serif" || value === "ui-sans-serif" || value === "ui-monospace" || value === "ui-rounded" || value === "math" || value === "emoji" || value === "fangsong";
724
+ }
725
+ function isFamilyName(value) {
726
+ let count = 0;
727
+ for (let part of segment(value, ",")) {
728
+ let char = part.charCodeAt(0);
729
+ if (char >= 48 && char <= 57)
730
+ return false;
731
+ if (part.startsWith("var("))
732
+ continue;
733
+ count += 1;
734
+ }
735
+ return count > 0;
736
+ }
737
+ function isAbsoluteSize(value) {
738
+ return value === "xx-small" || value === "x-small" || value === "small" || value === "medium" || value === "large" || value === "x-large" || value === "xx-large" || value === "xxx-large";
739
+ }
740
+ function isRelativeSize(value) {
741
+ return value === "larger" || value === "smaller";
742
+ }
743
+ var HAS_NUMBER = /[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/;
744
+ var IS_NUMBER = new RegExp(`^${HAS_NUMBER.source}$`);
745
+ function isNumber(value) {
746
+ return IS_NUMBER.test(value) || hasMathFn(value);
747
+ }
748
+ var IS_PERCENTAGE = new RegExp(`^${HAS_NUMBER.source}%$`);
749
+ function isPercentage(value) {
750
+ return IS_PERCENTAGE.test(value) || hasMathFn(value);
751
+ }
752
+ var LENGTH_UNITS = [
753
+ "cm",
754
+ "mm",
755
+ "Q",
756
+ "in",
757
+ "pc",
758
+ "pt",
759
+ "px",
760
+ "em",
761
+ "ex",
762
+ "ch",
763
+ "rem",
764
+ "lh",
765
+ "rlh",
766
+ "vw",
767
+ "vh",
768
+ "vmin",
769
+ "vmax",
770
+ "vb",
771
+ "vi",
772
+ "svw",
773
+ "svh",
774
+ "lvw",
775
+ "lvh",
776
+ "dvw",
777
+ "dvh",
778
+ "cqw",
779
+ "cqh",
780
+ "cqi",
781
+ "cqb",
782
+ "cqmin",
783
+ "cqmax"
784
+ ];
785
+ var IS_LENGTH = new RegExp(`^${HAS_NUMBER.source}(${LENGTH_UNITS.join("|")})$`);
786
+ function isLength(value) {
787
+ return IS_LENGTH.test(value) || hasMathFn(value);
788
+ }
789
+ function isBackgroundPosition(value) {
790
+ let count = 0;
791
+ for (let part of segment(value, " ")) {
792
+ if (part === "center" || part === "top" || part === "right" || part === "bottom" || part === "left") {
793
+ count += 1;
794
+ continue;
795
+ }
796
+ if (part.startsWith("var("))
797
+ continue;
798
+ if (isLength(part) || isPercentage(part)) {
799
+ count += 1;
800
+ continue;
801
+ }
802
+ return false;
803
+ }
804
+ return count > 0;
805
+ }
806
+ function isBackgroundSize(value) {
807
+ let count = 0;
808
+ for (let size of segment(value, ",")) {
809
+ if (size === "cover" || size === "contain") {
810
+ count += 1;
811
+ continue;
812
+ }
813
+ let values = segment(size, " ");
814
+ if (values.length !== 1 && values.length !== 2) {
815
+ return false;
816
+ }
817
+ if (values.every((value2) => value2 === "auto" || isLength(value2) || isPercentage(value2))) {
818
+ count += 1;
819
+ continue;
820
+ }
821
+ }
822
+ return count > 0;
823
+ }
824
+
825
+ // src/utils/replace-shadow-colors.ts
826
+ var KEYWORDS = /* @__PURE__ */ new Set(["inset", "inherit", "initial", "revert", "unset"]);
827
+ var LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
828
+ function replaceShadowColors(input, replacement) {
829
+ for (let shadow of segment(input, ",")) {
830
+ let parts = segment(shadow, " ").filter((part) => part.trim() !== "");
831
+ let color = null;
832
+ let offsetX = null;
833
+ let offsetY = null;
834
+ for (let part of parts) {
835
+ if (KEYWORDS.has(part)) {
836
+ continue;
837
+ } else if (LENGTH.test(part)) {
838
+ if (offsetX === null) {
839
+ offsetX = part;
840
+ } else if (offsetY === null) {
841
+ offsetY = part;
842
+ }
843
+ LENGTH.lastIndex = 0;
844
+ } else if (color === null) {
845
+ color = part;
846
+ }
847
+ }
848
+ if (offsetX !== null && offsetY !== null && color !== null) {
849
+ input = input.replace(color, replacement);
850
+ }
851
+ }
852
+ return input;
853
+ }
854
+
855
+ // src/utilities.ts
856
+ var Utilities = class {
857
+ utilities = /* @__PURE__ */ new Map();
858
+ static(name, compileFn) {
859
+ this.set(name, { kind: "static", compileFn });
860
+ }
861
+ functional(name, compileFn) {
862
+ this.set(name, { kind: "functional", compileFn });
863
+ }
864
+ has(name) {
865
+ return this.utilities.has(name);
866
+ }
867
+ get(name) {
868
+ return this.utilities.get(name);
869
+ }
870
+ kind(name) {
871
+ return this.utilities.get(name).kind;
872
+ }
873
+ keys() {
874
+ return this.utilities.keys();
875
+ }
876
+ set(name, { kind, compileFn }) {
877
+ this.utilities.set(name, {
878
+ kind,
879
+ compileFn
880
+ });
881
+ }
882
+ };
883
+ function atRoot(rules) {
884
+ return rule("@at-root", rules);
885
+ }
886
+ function property(ident, initialValue, syntax) {
887
+ return rule(`@property ${ident}`, [
888
+ decl("syntax", syntax ? `"${syntax}"` : `"*"`),
889
+ decl("inherits", "false"),
890
+ // If there's no initial value, it's important that we omit it rather than
891
+ // use an empty value. Safari currently doesn't support an empty
892
+ // `initial-value` properly, so we have to design how we use things around
893
+ // the guaranteed invalid value instead, which is how `initial-value`
894
+ // behaves when omitted.
895
+ ...initialValue ? [decl("initial-value", initialValue)] : []
896
+ ]);
897
+ }
898
+ function withAlpha(value, alpha) {
899
+ if (alpha === null) {
900
+ return value;
901
+ }
902
+ let alphaAsNumber = Number(alpha);
903
+ if (!isNaN(alphaAsNumber)) {
904
+ alpha = `${alphaAsNumber * 100}%`;
905
+ }
906
+ return `color-mix(in srgb, ${value} ${alpha}, transparent)`;
907
+ }
908
+ function asColor(value, modifier, theme) {
909
+ if (!modifier) {
910
+ return value;
911
+ }
912
+ if (modifier.kind === "arbitrary") {
913
+ return withAlpha(value, modifier.value);
914
+ }
915
+ let alpha = theme.resolve(modifier.value, ["--opacity"]);
916
+ if (alpha) {
917
+ return withAlpha(value, alpha);
918
+ }
919
+ return withAlpha(value, `${modifier.value}%`);
920
+ }
921
+ function withNegative(value, candidate) {
922
+ return candidate.negative ? `calc(${value} * -1)` : value;
923
+ }
924
+ function resolveThemeColor(candidate, theme, themeKeys) {
925
+ let value = null;
926
+ switch (candidate.value.value) {
927
+ case "transparent": {
928
+ value = "transparent";
929
+ break;
930
+ }
931
+ case "current": {
932
+ value = "currentColor";
933
+ break;
934
+ }
935
+ default: {
936
+ value = theme.resolve(candidate.value.value, themeKeys);
937
+ break;
938
+ }
939
+ }
940
+ return value ? asColor(value, candidate.modifier, theme) : null;
941
+ }
942
+ function createUtilities(theme) {
943
+ let utilities = new Utilities();
944
+ function staticUtility(className, declarations) {
945
+ utilities.static(className, (candidate) => {
946
+ if (candidate.negative) {
947
+ return;
948
+ }
949
+ return declarations.map((node) => {
950
+ return typeof node === "function" ? node() : decl(node[0], node[1]);
951
+ });
952
+ });
953
+ }
954
+ function functionalUtility(classRoot, desc) {
955
+ utilities.functional(classRoot, (candidate) => {
956
+ if (candidate.negative && !desc.supportsNegative)
957
+ return;
958
+ let value = null;
959
+ if (!candidate.value) {
960
+ value = desc.defaultValue ?? theme.get(desc.themeKeys);
961
+ } else if (candidate.value.kind === "arbitrary") {
962
+ value = candidate.value.value;
963
+ } else {
964
+ value = theme.resolve(candidate.value.fraction ?? candidate.value.value, desc.themeKeys);
965
+ if (!value && desc.supportsFractions && candidate.value.fraction) {
966
+ value = `calc(${candidate.value.fraction} * 100%)`;
967
+ }
968
+ if (!value && desc.handleBareValue) {
969
+ value = desc.handleBareValue(candidate.value);
970
+ }
971
+ }
972
+ if (!value)
973
+ return;
974
+ return desc.handle(withNegative(value, candidate));
975
+ });
976
+ }
977
+ function colorUtility(classRoot, desc) {
978
+ utilities.functional(classRoot, (candidate) => {
979
+ if (!candidate.value)
980
+ return;
981
+ if (candidate.negative)
982
+ return;
983
+ let value = null;
984
+ if (candidate.value.kind === "arbitrary") {
985
+ value = candidate.value.value;
986
+ value = asColor(value, candidate.modifier, theme);
987
+ } else {
988
+ value = resolveThemeColor(candidate, theme, desc.themeKeys);
989
+ if (!value)
990
+ return;
991
+ }
992
+ return desc.handle(value);
993
+ });
994
+ }
995
+ staticUtility("sr-only", [
996
+ ["position", "absolute"],
997
+ ["width", "1px"],
998
+ ["height", "1px"],
999
+ ["padding", "0"],
1000
+ ["margin", "-1px"],
1001
+ ["overflow", "hidden"],
1002
+ ["clip", "rect(0, 0, 0, 0)"],
1003
+ ["white-space", "nowrap"],
1004
+ ["border-width", "0"]
1005
+ ]);
1006
+ staticUtility("not-sr-only", [
1007
+ ["position", "static"],
1008
+ ["width", "auto"],
1009
+ ["height", "auto"],
1010
+ ["padding", "0"],
1011
+ ["margin", "0"],
1012
+ ["overflow", "visible"],
1013
+ ["clip", "auto"],
1014
+ ["white-space", "normal"]
1015
+ ]);
1016
+ staticUtility("pointer-events-none", [["pointer-events", "none"]]);
1017
+ staticUtility("pointer-events-auto", [["pointer-events", "auto"]]);
1018
+ staticUtility("visible", [["visibility", "visible"]]);
1019
+ staticUtility("invisible", [["visibility", "hidden"]]);
1020
+ staticUtility("collapse", [["visibility", "collapse"]]);
1021
+ staticUtility("static", [["position", "static"]]);
1022
+ staticUtility("fixed", [["position", "fixed"]]);
1023
+ staticUtility("absolute", [["position", "absolute"]]);
1024
+ staticUtility("relative", [["position", "relative"]]);
1025
+ staticUtility("sticky", [["position", "sticky"]]);
1026
+ staticUtility("inset-auto", [["inset", "auto"]]);
1027
+ utilities.static("inset-full", (candidate) => {
1028
+ let value = candidate.negative ? "-100%" : "100%";
1029
+ return [decl("inset", value)];
1030
+ });
1031
+ functionalUtility("inset", {
1032
+ supportsNegative: true,
1033
+ supportsFractions: true,
1034
+ themeKeys: ["--inset", "--spacing"],
1035
+ handle: (value) => [decl("inset", value)]
1036
+ });
1037
+ staticUtility("inset-x-auto", [
1038
+ ["--tw-sort", "inset-inline"],
1039
+ ["right", "auto"],
1040
+ ["left", "auto"]
1041
+ ]);
1042
+ utilities.static("inset-x-full", (candidate) => {
1043
+ let value = candidate.negative ? "-100%" : "100%";
1044
+ return [decl("--tw-sort", "inset-inline"), decl("right", value), decl("left", value)];
1045
+ });
1046
+ functionalUtility("inset-x", {
1047
+ supportsNegative: true,
1048
+ supportsFractions: true,
1049
+ themeKeys: ["--inset", "--spacing"],
1050
+ handle: (value) => [
1051
+ decl("--tw-sort", "inset-inline"),
1052
+ decl("right", value),
1053
+ decl("left", value)
1054
+ ]
1055
+ });
1056
+ staticUtility("inset-y-auto", [
1057
+ ["--tw-sort", "inset-block"],
1058
+ ["top", "auto"],
1059
+ ["bottom", "auto"]
1060
+ ]);
1061
+ utilities.static("inset-y-full", (candidate) => {
1062
+ let value = candidate.negative ? "-100%" : "100%";
1063
+ return [decl("--tw-sort", "inset-block"), decl("top", value), decl("bottom", value)];
1064
+ });
1065
+ functionalUtility("inset-y", {
1066
+ supportsNegative: true,
1067
+ supportsFractions: true,
1068
+ themeKeys: ["--inset", "--spacing"],
1069
+ handle: (value) => [
1070
+ decl("--tw-sort", "inset-block"),
1071
+ decl("top", value),
1072
+ decl("bottom", value)
1073
+ ]
1074
+ });
1075
+ staticUtility("start-auto", [["inset-inline-start", "auto"]]);
1076
+ utilities.static("start-full", (candidate) => {
1077
+ let value = candidate.negative ? "-100%" : "100%";
1078
+ return [decl("inset-inline-start", value)];
1079
+ });
1080
+ functionalUtility("start", {
1081
+ supportsNegative: true,
1082
+ supportsFractions: true,
1083
+ themeKeys: ["--inset", "--spacing"],
1084
+ handle: (value) => [decl("inset-inline-start", value)]
1085
+ });
1086
+ staticUtility("end-auto", [["inset-inline-end", "auto"]]);
1087
+ utilities.static("end-full", (candidate) => {
1088
+ let value = candidate.negative ? "-100%" : "100%";
1089
+ return [decl("inset-inline-end", value)];
1090
+ });
1091
+ functionalUtility("end", {
1092
+ supportsNegative: true,
1093
+ supportsFractions: true,
1094
+ themeKeys: ["--inset", "--spacing"],
1095
+ handle: (value) => [decl("inset-inline-end", value)]
1096
+ });
1097
+ staticUtility("top-auto", [["top", "auto"]]);
1098
+ utilities.static("top-full", (candidate) => {
1099
+ let value = candidate.negative ? "-100%" : "100%";
1100
+ return [decl("top", value)];
1101
+ });
1102
+ functionalUtility("top", {
1103
+ supportsNegative: true,
1104
+ supportsFractions: true,
1105
+ themeKeys: ["--inset", "--spacing"],
1106
+ handle: (value) => [decl("top", value)]
1107
+ });
1108
+ staticUtility("right-auto", [["right", "auto"]]);
1109
+ utilities.static("right-full", (candidate) => {
1110
+ let value = candidate.negative ? "-100%" : "100%";
1111
+ return [decl("right", value)];
1112
+ });
1113
+ functionalUtility("right", {
1114
+ supportsNegative: true,
1115
+ supportsFractions: true,
1116
+ themeKeys: ["--inset", "--spacing"],
1117
+ handle: (value) => [decl("right", value)]
1118
+ });
1119
+ staticUtility("bottom-auto", [["bottom", "auto"]]);
1120
+ utilities.static("bottom-full", (candidate) => {
1121
+ let value = candidate.negative ? "-100%" : "100%";
1122
+ return [decl("bottom", value)];
1123
+ });
1124
+ functionalUtility("bottom", {
1125
+ supportsNegative: true,
1126
+ supportsFractions: true,
1127
+ themeKeys: ["--inset", "--spacing"],
1128
+ handle: (value) => [decl("bottom", value)]
1129
+ });
1130
+ staticUtility("left-auto", [["left", "auto"]]);
1131
+ utilities.static("left-full", (candidate) => {
1132
+ let value = candidate.negative ? "-100%" : "100%";
1133
+ return [decl("left", value)];
1134
+ });
1135
+ functionalUtility("left", {
1136
+ supportsNegative: true,
1137
+ supportsFractions: true,
1138
+ themeKeys: ["--inset", "--spacing"],
1139
+ handle: (value) => [decl("left", value)]
1140
+ });
1141
+ staticUtility("isolate", [["isolation", "isolate"]]);
1142
+ staticUtility("isolation-auto", [["isolation", "auto"]]);
1143
+ staticUtility("z-auto", [["z-index", "auto"]]);
1144
+ functionalUtility("z", {
1145
+ supportsNegative: true,
1146
+ handleBareValue: ({ value }) => value,
1147
+ themeKeys: ["--z-index"],
1148
+ handle: (value) => [decl("z-index", value)]
1149
+ });
1150
+ staticUtility("order-first", [["order", "calc(-infinity)"]]);
1151
+ staticUtility("order-last", [["order", "calc(infinity)"]]);
1152
+ staticUtility("order-none", [["order", "0"]]);
1153
+ functionalUtility("order", {
1154
+ supportsNegative: true,
1155
+ handleBareValue: ({ value }) => value,
1156
+ themeKeys: ["--order"],
1157
+ handle: (value) => [decl("order", value)]
1158
+ });
1159
+ staticUtility("col-auto", [["grid-column", "auto"]]);
1160
+ functionalUtility("col", {
1161
+ themeKeys: ["--grid-column"],
1162
+ handle: (value) => [decl("grid-column", value)]
1163
+ });
1164
+ staticUtility("col-span-full", [["grid-column", "1 / -1"]]);
1165
+ functionalUtility("col-span", {
1166
+ themeKeys: [],
1167
+ handleBareValue: ({ value }) => value,
1168
+ handle: (value) => [decl("grid-column", `span ${value} / span ${value}`)]
1169
+ });
1170
+ staticUtility("col-start-auto", [["grid-column-start", "auto"]]);
1171
+ functionalUtility("col-start", {
1172
+ handleBareValue: ({ value }) => value,
1173
+ themeKeys: ["--grid-column-start"],
1174
+ handle: (value) => [decl("grid-column-start", value)]
1175
+ });
1176
+ staticUtility("col-end-auto", [["grid-column-end", "auto"]]);
1177
+ functionalUtility("col-end", {
1178
+ handleBareValue: ({ value }) => value,
1179
+ themeKeys: ["--grid-column-end"],
1180
+ handle: (value) => [decl("grid-column-end", value)]
1181
+ });
1182
+ staticUtility("row-auto", [["grid-row", "auto"]]);
1183
+ functionalUtility("row", {
1184
+ themeKeys: ["--grid-row"],
1185
+ handle: (value) => [decl("grid-row", value)]
1186
+ });
1187
+ staticUtility("row-span-full", [["grid-row", "1 / -1"]]);
1188
+ functionalUtility("row-span", {
1189
+ themeKeys: [],
1190
+ handleBareValue: ({ value }) => value,
1191
+ handle: (value) => [decl("grid-row", `span ${value} / span ${value}`)]
1192
+ });
1193
+ staticUtility("row-start-auto", [["grid-row-start", "auto"]]);
1194
+ functionalUtility("row-start", {
1195
+ handleBareValue: ({ value }) => value,
1196
+ themeKeys: ["--grid-row-start"],
1197
+ handle: (value) => [decl("grid-row-start", value)]
1198
+ });
1199
+ staticUtility("row-end-auto", [["grid-row-end", "auto"]]);
1200
+ functionalUtility("row-end", {
1201
+ handleBareValue: ({ value }) => value,
1202
+ themeKeys: ["--grid-row-end"],
1203
+ handle: (value) => [decl("grid-row-end", value)]
1204
+ });
1205
+ staticUtility("float-start", [["float", "start"]]);
1206
+ staticUtility("float-end", [["float", "end"]]);
1207
+ staticUtility("float-right", [["float", "right"]]);
1208
+ staticUtility("float-left", [["float", "left"]]);
1209
+ staticUtility("float-none", [["float", "none"]]);
1210
+ staticUtility("clear-start", [["clear", "start"]]);
1211
+ staticUtility("clear-end", [["clear", "end"]]);
1212
+ staticUtility("clear-right", [["clear", "right"]]);
1213
+ staticUtility("clear-left", [["clear", "left"]]);
1214
+ staticUtility("clear-both", [["clear", "both"]]);
1215
+ staticUtility("clear-none", [["clear", "none"]]);
1216
+ for (let [namespace, properties, sort] of [
1217
+ ["m", ["margin"]],
1218
+ ["mx", ["margin-left", "margin-right"], "margin-inline"],
1219
+ ["my", ["margin-top", "margin-bottom"], "margin-block"],
1220
+ ["ms", ["margin-inline-start"]],
1221
+ ["me", ["margin-inline-end"]],
1222
+ ["mt", ["margin-top"]],
1223
+ ["mr", ["margin-right"]],
1224
+ ["mb", ["margin-bottom"]],
1225
+ ["ml", ["margin-left"]]
1226
+ ]) {
1227
+ staticUtility(
1228
+ `${namespace}-auto`,
1229
+ properties.map((property2) => [property2, "auto"])
1230
+ );
1231
+ functionalUtility(namespace, {
1232
+ supportsNegative: true,
1233
+ themeKeys: ["--margin", "--spacing"],
1234
+ handle: (value) => [
1235
+ ...sort ? [decl("--tw-sort", sort)] : [],
1236
+ ...properties.map((property2) => decl(property2, value))
1237
+ ]
1238
+ });
1239
+ }
1240
+ staticUtility("box-border", [["box-sizing", "border-box"]]);
1241
+ staticUtility("box-content", [["box-sizing", "content-box"]]);
1242
+ staticUtility("line-clamp-none", [
1243
+ ["overlow", "visible"],
1244
+ ["display", "block"],
1245
+ ["-webkit-box-orient", "horizonal"],
1246
+ ["-webkit-line-clamp", "none"]
1247
+ ]);
1248
+ functionalUtility("line-clamp", {
1249
+ themeKeys: ["--line-clamp"],
1250
+ handleBareValue: ({ value }) => value,
1251
+ handle: (value) => [
1252
+ decl("overlow", "hidden"),
1253
+ decl("display", "-webkit-box"),
1254
+ decl("-webkit-box-orient", "vertical"),
1255
+ decl("-webkit-line-clamp", value)
1256
+ ]
1257
+ });
1258
+ staticUtility("block", [["display", "block"]]);
1259
+ staticUtility("inline-block", [["display", "inline-block"]]);
1260
+ staticUtility("inline", [["display", "inline"]]);
1261
+ staticUtility("hidden", [["display", "none"]]);
1262
+ staticUtility("inline-flex", [["display", "inline-flex"]]);
1263
+ staticUtility("table", [["display", "table"]]);
1264
+ staticUtility("inline-table", [["display", "inline-table"]]);
1265
+ staticUtility("table-caption", [["display", "table-caption"]]);
1266
+ staticUtility("table-cell", [["display", "table-cell"]]);
1267
+ staticUtility("table-column", [["display", "table-column"]]);
1268
+ staticUtility("table-column-group", [["display", "table-column-group"]]);
1269
+ staticUtility("table-footer-group", [["display", "table-footer-group"]]);
1270
+ staticUtility("table-header-group", [["display", "table-header-group"]]);
1271
+ staticUtility("table-row-group", [["display", "table-row-group"]]);
1272
+ staticUtility("table-row", [["display", "table-row"]]);
1273
+ staticUtility("flow-root", [["display", "flow-root"]]);
1274
+ staticUtility("grid", [["display", "grid"]]);
1275
+ staticUtility("inline-grid", [["display", "inline-grid"]]);
1276
+ staticUtility("contents", [["display", "contents"]]);
1277
+ staticUtility("list-item", [["display", "list-item"]]);
1278
+ staticUtility("aspect-auto", [["aspect-ratio", "auto"]]);
1279
+ staticUtility("aspect-square", [["aspect-ratio", "1 / 1"]]);
1280
+ staticUtility("aspect-video", [["aspect-ratio", "16 / 9"]]);
1281
+ functionalUtility("aspect", {
1282
+ themeKeys: ["--aspect-ratio"],
1283
+ handleBareValue: ({ fraction }) => fraction,
1284
+ handle: (value) => [decl("aspect-ratio", value)]
1285
+ });
1286
+ for (let [key, value] of [
1287
+ ["auto", "auto"],
1288
+ ["full", "100%"],
1289
+ ["min", "min-content"],
1290
+ ["max", "max-content"],
1291
+ ["fit", "fit-content"]
1292
+ ]) {
1293
+ staticUtility(`size-${key}`, [
1294
+ ["--tw-sort", "size"],
1295
+ ["width", value],
1296
+ ["height", value]
1297
+ ]);
1298
+ }
1299
+ functionalUtility("size", {
1300
+ supportsFractions: true,
1301
+ themeKeys: ["--size", "--spacing"],
1302
+ handle: (value) => [decl("--tw-sort", "size"), decl("width", value), decl("height", value)]
1303
+ });
1304
+ for (let [key, value] of [
1305
+ ["auto", "auto"],
1306
+ ["full", "100%"],
1307
+ ["screen", "100vw"],
1308
+ ["svw", "100svw"],
1309
+ ["lvw", "100lvw"],
1310
+ ["dvw", "100dvw"],
1311
+ ["min", "min-content"],
1312
+ ["max", "max-content"],
1313
+ ["fit", "fit-content"]
1314
+ ]) {
1315
+ staticUtility(`w-${key}`, [["width", value]]);
1316
+ }
1317
+ functionalUtility("w", {
1318
+ supportsFractions: true,
1319
+ themeKeys: ["--width", "--spacing"],
1320
+ handle: (value) => [decl("width", value)]
1321
+ });
1322
+ for (let [key, value] of [
1323
+ ["auto", "auto"],
1324
+ ["full", "100%"],
1325
+ ["min", "min-content"],
1326
+ ["max", "max-content"],
1327
+ ["fit", "fit-content"]
1328
+ ]) {
1329
+ staticUtility(`min-w-${key}`, [["min-width", value]]);
1330
+ }
1331
+ functionalUtility("min-w", {
1332
+ themeKeys: ["--min-width", "--width", "--spacing"],
1333
+ handle: (value) => [decl("min-width", value)]
1334
+ });
1335
+ for (let [key, value] of [
1336
+ ["none", "none"],
1337
+ ["full", "100%"],
1338
+ ["min", "min-content"],
1339
+ ["max", "max-content"],
1340
+ ["fit", "fit-content"]
1341
+ ]) {
1342
+ staticUtility(`max-w-${key}`, [["max-width", value]]);
1343
+ }
1344
+ functionalUtility("max-w", {
1345
+ themeKeys: ["--max-width", "--width", "--spacing"],
1346
+ handle: (value) => [decl("max-width", value)]
1347
+ });
1348
+ for (let [key, value] of [
1349
+ ["auto", "auto"],
1350
+ ["full", "100%"],
1351
+ ["screen", "100vh"],
1352
+ ["svh", "100svh"],
1353
+ ["lvh", "100lvh"],
1354
+ ["dvh", "100dvh"],
1355
+ ["min", "min-content"],
1356
+ ["max", "max-content"],
1357
+ ["fit", "fit-content"]
1358
+ ]) {
1359
+ staticUtility(`h-${key}`, [["height", value]]);
1360
+ }
1361
+ functionalUtility("h", {
1362
+ supportsFractions: true,
1363
+ themeKeys: ["--height", "--spacing"],
1364
+ handle: (value) => [decl("height", value)]
1365
+ });
1366
+ for (let [key, value] of [
1367
+ ["auto", "auto"],
1368
+ ["full", "100%"],
1369
+ ["screen", "100vh"],
1370
+ ["svh", "100svh"],
1371
+ ["lvh", "100lvh"],
1372
+ ["dvh", "100dvh"],
1373
+ ["min", "min-content"],
1374
+ ["max", "max-content"],
1375
+ ["fit", "fit-content"]
1376
+ ]) {
1377
+ staticUtility(`min-h-${key}`, [["min-height", value]]);
1378
+ }
1379
+ functionalUtility("min-h", {
1380
+ themeKeys: ["--min-height", "--spacing"],
1381
+ handle: (value) => [decl("min-height", value)]
1382
+ });
1383
+ for (let [key, value] of [
1384
+ ["none", "none"],
1385
+ ["full", "100%"],
1386
+ ["screen", "100vh"],
1387
+ ["svh", "100svh"],
1388
+ ["lvh", "100lvh"],
1389
+ ["dvh", "100dvh"],
1390
+ ["min", "min-content"],
1391
+ ["max", "max-content"],
1392
+ ["fit", "fit-content"]
1393
+ ]) {
1394
+ staticUtility(`max-h-${key}`, [["max-height", value]]);
1395
+ }
1396
+ functionalUtility("max-h", {
1397
+ themeKeys: ["--max-height", "--spacing"],
1398
+ handle: (value) => [decl("max-height", value)]
1399
+ });
1400
+ staticUtility("flex-auto", [["flex", "auto"]]);
1401
+ staticUtility("flex-initial", [["flex", "0 auto"]]);
1402
+ staticUtility("flex-none", [["flex", "none"]]);
1403
+ utilities.functional("flex", (candidate) => {
1404
+ if (candidate.negative)
1405
+ return;
1406
+ if (!candidate.value) {
1407
+ return [decl("display", "flex")];
1408
+ }
1409
+ if (candidate.value.kind === "arbitrary") {
1410
+ return [decl("flex", candidate.value.value)];
1411
+ }
1412
+ if (candidate.value.fraction) {
1413
+ return [decl("flex", `calc(${candidate.value.fraction} * 100%)`)];
1414
+ }
1415
+ return [decl("flex", candidate.value.value)];
1416
+ });
1417
+ functionalUtility("shrink", {
1418
+ defaultValue: "1",
1419
+ themeKeys: [],
1420
+ handleBareValue: ({ value }) => value,
1421
+ handle: (value) => [decl("flex-shrink", value)]
1422
+ });
1423
+ functionalUtility("grow", {
1424
+ defaultValue: "1",
1425
+ themeKeys: [],
1426
+ handleBareValue: ({ value }) => value,
1427
+ handle: (value) => [decl("flex-grow", value)]
1428
+ });
1429
+ staticUtility("basis-auto", [["flex-basis", "auto"]]);
1430
+ staticUtility("basis-full", [["flex-basis", "100%"]]);
1431
+ functionalUtility("basis", {
1432
+ supportsFractions: true,
1433
+ themeKeys: ["--flex-basis", "--width", "--spacing"],
1434
+ handle: (value) => [decl("flex-basis", value)]
1435
+ });
1436
+ staticUtility("table-auto", [["table-layout", "auto"]]);
1437
+ staticUtility("table-fixed", [["table-layout", "fixed"]]);
1438
+ staticUtility("caption-top", [["caption-side", "top"]]);
1439
+ staticUtility("caption-bottom", [["caption-side", "bottom"]]);
1440
+ staticUtility("border-collapse", [["border-collapse", "collapse"]]);
1441
+ staticUtility("border-separate", [["border-collapse", "separate"]]);
1442
+ let borderSpacingProperties = () => atRoot([
1443
+ property("--tw-border-spacing-x", "0", "<length>"),
1444
+ property("--tw-border-spacing-y", "0", "<length>")
1445
+ ]);
1446
+ functionalUtility("border-spacing", {
1447
+ themeKeys: ["--border-spacing", "--spacing"],
1448
+ handle: (value) => [
1449
+ borderSpacingProperties(),
1450
+ decl("--tw-border-spacing-x", value),
1451
+ decl("--tw-border-spacing-y", value),
1452
+ decl("border-spacing", "var(--tw-border-spacing-x) var(--tw-border-spacing-y)")
1453
+ ]
1454
+ });
1455
+ functionalUtility("border-spacing-x", {
1456
+ themeKeys: ["--border-spacing", "--spacing"],
1457
+ handle: (value) => [
1458
+ borderSpacingProperties(),
1459
+ decl("--tw-border-spacing-x", value),
1460
+ decl("border-spacing", "var(--tw-border-spacing-x) var(--tw-border-spacing-y)")
1461
+ ]
1462
+ });
1463
+ functionalUtility("border-spacing-y", {
1464
+ themeKeys: ["--border-spacing", "--spacing"],
1465
+ handle: (value) => [
1466
+ borderSpacingProperties(),
1467
+ decl("--tw-border-spacing-y", value),
1468
+ decl("border-spacing", "var(--tw-border-spacing-x) var(--tw-border-spacing-y)")
1469
+ ]
1470
+ });
1471
+ staticUtility("origin-center", [["transform-origin", "center"]]);
1472
+ staticUtility("origin-top", [["transform-origin", "top"]]);
1473
+ staticUtility("origin-top-right", [["transform-origin", "top right"]]);
1474
+ staticUtility("origin-right", [["transform-origin", "right"]]);
1475
+ staticUtility("origin-bottom-right", [["transform-origin", "bottom right"]]);
1476
+ staticUtility("origin-bottom", [["transform-origin", "bottom"]]);
1477
+ staticUtility("origin-bottom-left", [["transform-origin", "bottom left"]]);
1478
+ staticUtility("origin-left", [["transform-origin", "left"]]);
1479
+ staticUtility("origin-top-left", [["transform-origin", "top left"]]);
1480
+ functionalUtility("origin", {
1481
+ themeKeys: ["--transform-origin"],
1482
+ handle: (value) => [decl("transform-origin", value)]
1483
+ });
1484
+ let translateProperties = () => atRoot([
1485
+ property("--tw-translate-x", "0", "<length-percentage>"),
1486
+ property("--tw-translate-y", "0", "<length-percentage>")
1487
+ ]);
1488
+ utilities.static("translate-full", (candidate) => {
1489
+ let value = candidate.negative ? "-100%" : "100%";
1490
+ return [
1491
+ translateProperties(),
1492
+ decl("--tw-translate-x", value),
1493
+ decl("--tw-translate-y", value),
1494
+ decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
1495
+ ];
1496
+ });
1497
+ functionalUtility("translate", {
1498
+ supportsNegative: true,
1499
+ supportsFractions: true,
1500
+ themeKeys: ["--translate", "--spacing"],
1501
+ handle: (value) => [
1502
+ translateProperties(),
1503
+ decl("--tw-translate-x", value),
1504
+ decl("--tw-translate-y", value),
1505
+ decl("translate", `var(--tw-translate-x) var(--tw-translate-y)`)
1506
+ ]
1507
+ });
1508
+ utilities.static("translate-x-full", (candidate) => {
1509
+ let value = candidate.negative ? "-100%" : "100%";
1510
+ return [
1511
+ translateProperties(),
1512
+ decl("--tw-translate-x", value),
1513
+ decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
1514
+ ];
1515
+ });
1516
+ functionalUtility("translate-x", {
1517
+ supportsNegative: true,
1518
+ supportsFractions: true,
1519
+ themeKeys: ["--translate", "--spacing"],
1520
+ handle: (value) => [
1521
+ translateProperties(),
1522
+ decl("--tw-translate-x", value),
1523
+ decl("translate", `var(--tw-translate-x) var(--tw-translate-y)`)
1524
+ ]
1525
+ });
1526
+ utilities.static("translate-y-full", (candidate) => {
1527
+ let value = candidate.negative ? "-100%" : "100%";
1528
+ return [
1529
+ translateProperties(),
1530
+ decl("--tw-translate-y", value),
1531
+ decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
1532
+ ];
1533
+ });
1534
+ functionalUtility("translate-y", {
1535
+ supportsNegative: true,
1536
+ supportsFractions: true,
1537
+ themeKeys: ["--translate", "--spacing"],
1538
+ handle: (value) => [
1539
+ translateProperties(),
1540
+ decl("--tw-translate-y", value),
1541
+ decl("translate", `var(--tw-translate-x) var(--tw-translate-y)`)
1542
+ ]
1543
+ });
1544
+ functionalUtility("rotate", {
1545
+ supportsNegative: true,
1546
+ themeKeys: ["--rotate"],
1547
+ handleBareValue: ({ value }) => `${value}deg`,
1548
+ handle: (value) => [decl("rotate", value)]
1549
+ });
1550
+ let skewProperties = () => atRoot([property("--tw-skew-x", "0deg", "<angle>"), property("--tw-skew-y", "0deg", "<angle>")]);
1551
+ functionalUtility("skew", {
1552
+ supportsNegative: true,
1553
+ themeKeys: ["--skew"],
1554
+ handleBareValue: ({ value }) => `${value}deg`,
1555
+ handle: (value) => [
1556
+ skewProperties(),
1557
+ decl("--tw-skew-x", value),
1558
+ decl("--tw-skew-y", value),
1559
+ decl("transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))")
1560
+ ]
1561
+ });
1562
+ functionalUtility("skew-x", {
1563
+ supportsNegative: true,
1564
+ themeKeys: ["--skew"],
1565
+ handleBareValue: ({ value }) => `${value}deg`,
1566
+ handle: (value) => [
1567
+ skewProperties(),
1568
+ decl("--tw-skew-x", value),
1569
+ decl("transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))")
1570
+ ]
1571
+ });
1572
+ functionalUtility("skew-y", {
1573
+ supportsNegative: true,
1574
+ themeKeys: ["--skew"],
1575
+ handleBareValue: ({ value }) => `${value}deg`,
1576
+ handle: (value) => [
1577
+ skewProperties(),
1578
+ decl("--tw-skew-y", value),
1579
+ decl("transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))")
1580
+ ]
1581
+ });
1582
+ let scaleProperties = () => atRoot([property("--tw-scale-x", "1", "<number>"), property("--tw-scale-y", "1", "<number>")]);
1583
+ functionalUtility("scale", {
1584
+ supportsNegative: true,
1585
+ themeKeys: ["--scale"],
1586
+ handleBareValue: ({ value }) => `${value}%`,
1587
+ handle: (value) => [
1588
+ scaleProperties(),
1589
+ decl("--tw-scale-x", value),
1590
+ decl("--tw-scale-y", value),
1591
+ decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
1592
+ ]
1593
+ });
1594
+ functionalUtility("scale-x", {
1595
+ supportsNegative: true,
1596
+ themeKeys: ["--scale"],
1597
+ handleBareValue: ({ value }) => `${value}%`,
1598
+ handle: (value) => [
1599
+ scaleProperties(),
1600
+ decl("--tw-scale-x", value),
1601
+ decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
1602
+ ]
1603
+ });
1604
+ functionalUtility("scale-y", {
1605
+ supportsNegative: true,
1606
+ themeKeys: ["--scale"],
1607
+ handleBareValue: ({ value }) => `${value}%`,
1608
+ handle: (value) => [
1609
+ scaleProperties(),
1610
+ decl("--tw-scale-y", value),
1611
+ decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
1612
+ ]
1613
+ });
1614
+ staticUtility("transform", [
1615
+ skewProperties,
1616
+ ["transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))"]
1617
+ ]);
1618
+ staticUtility("transform-cpu", [["transform", "translate(0,0)"]]);
1619
+ staticUtility("transform-gpu", [["transform", "translate(0,0,0)"]]);
1620
+ staticUtility("transform-none", [
1621
+ ["translate", "none"],
1622
+ ["rotate", "none"],
1623
+ ["scale", "none"],
1624
+ ["transform", "none"]
1625
+ ]);
1626
+ for (let value of [
1627
+ "auto",
1628
+ "default",
1629
+ "pointer",
1630
+ "wait",
1631
+ "text",
1632
+ "move",
1633
+ "help",
1634
+ "not-allowed",
1635
+ "none",
1636
+ "context-menu",
1637
+ "progress",
1638
+ "cell",
1639
+ "crosshair",
1640
+ "vertical-text",
1641
+ "alias",
1642
+ "copy",
1643
+ "no-drop",
1644
+ "grab",
1645
+ "grabbing",
1646
+ "all-scroll",
1647
+ "col-resize",
1648
+ "row-resize",
1649
+ "n-resize",
1650
+ "e-resize",
1651
+ "s-resize",
1652
+ "w-resize",
1653
+ "ne-resize",
1654
+ "nw-resize",
1655
+ "se-resize",
1656
+ "sw-resize",
1657
+ "ew-resize",
1658
+ "ns-resize",
1659
+ "nesw-resize",
1660
+ "nwse-resize",
1661
+ "zoom-in",
1662
+ "zoom-out"
1663
+ ]) {
1664
+ staticUtility(`cursor-${value}`, [["cursor", value]]);
1665
+ }
1666
+ functionalUtility("cursor", {
1667
+ themeKeys: ["--cursor"],
1668
+ handle: (value) => [decl("cursor", value)]
1669
+ });
1670
+ for (let value of ["auto", "none", "manipulation"]) {
1671
+ staticUtility(`touch-${value}`, [["touch-action", value]]);
1672
+ }
1673
+ let touchProperties = () => atRoot([property("--tw-pan-x"), property("--tw-pan-y"), property("--tw-pinch-zoom")]);
1674
+ for (let value of ["x", "left", "right"]) {
1675
+ staticUtility(`touch-pan-${value}`, [
1676
+ touchProperties,
1677
+ ["--tw-pan-x", `pan-${value}`],
1678
+ ["touch-action", "var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)"]
1679
+ ]);
1680
+ }
1681
+ for (let value of ["y", "up", "down"]) {
1682
+ staticUtility(`touch-pan-${value}`, [
1683
+ touchProperties,
1684
+ ["--tw-pan-y", `pan-${value}`],
1685
+ ["touch-action", "var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)"]
1686
+ ]);
1687
+ }
1688
+ staticUtility("touch-pinch-zoom", [
1689
+ touchProperties,
1690
+ ["--tw-pinch-zoom", `pinch-zoom`],
1691
+ ["touch-action", "var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)"]
1692
+ ]);
1693
+ for (let value of ["none", "text", "all", "auto"]) {
1694
+ staticUtility(`select-${value}`, [
1695
+ ["-webkit-user-select", value],
1696
+ ["user-select", value]
1697
+ ]);
1698
+ }
1699
+ staticUtility(`resize-none`, [["resize", "none"]]);
1700
+ staticUtility(`resize-both`, [["resize", "both"]]);
1701
+ staticUtility(`resize-x`, [["resize", "horizontal"]]);
1702
+ staticUtility(`resize-y`, [["resize", "vertical"]]);
1703
+ staticUtility(`snap-none`, [["scroll-snap-type", "none"]]);
1704
+ let snapProperties = () => atRoot([property("--tw-scroll-snap-strictness", "proximity", "*")]);
1705
+ for (let value of ["x", "y", "both"]) {
1706
+ staticUtility(`snap-${value}`, [
1707
+ snapProperties,
1708
+ ["scroll-snap-type", `${value} var(--tw-scroll-snap-strictness)`]
1709
+ ]);
1710
+ }
1711
+ staticUtility(`snap-mandatory`, [snapProperties, ["--tw-scroll-snap-strictness", "mandatory"]]);
1712
+ staticUtility(`snap-proximity`, [snapProperties, ["--tw-scroll-snap-strictness", "proximity"]]);
1713
+ staticUtility("snap-align-none", [["scroll-snap-align", "none"]]);
1714
+ staticUtility("snap-start", [["scroll-snap-align", "start"]]);
1715
+ staticUtility("snap-end", [["scroll-snap-align", "end"]]);
1716
+ staticUtility("snap-center", [["scroll-snap-align", "center"]]);
1717
+ staticUtility("snap-normal", [["scroll-snap-stop", "normal"]]);
1718
+ staticUtility("snap-always", [["scroll-snap-stop", "always"]]);
1719
+ functionalUtility("scroll-m", {
1720
+ supportsNegative: true,
1721
+ themeKeys: ["--scroll-margin", "--spacing"],
1722
+ handle: (value) => [decl("scroll-margin", value)]
1723
+ });
1724
+ functionalUtility("scroll-mx", {
1725
+ supportsNegative: true,
1726
+ themeKeys: ["--scroll-margin", "--spacing"],
1727
+ handle: (value) => [decl("scroll-margin-left", value), decl("scroll-margin-right", value)]
1728
+ });
1729
+ functionalUtility("scroll-my", {
1730
+ supportsNegative: true,
1731
+ themeKeys: ["--scroll-margin", "--spacing"],
1732
+ handle: (value) => [decl("scroll-margin-top", value), decl("scroll-margin-bottom", value)]
1733
+ });
1734
+ functionalUtility("scroll-ms", {
1735
+ supportsNegative: true,
1736
+ themeKeys: ["--scroll-margin", "--spacing"],
1737
+ handle: (value) => [decl("scroll-margin-inline-start", value)]
1738
+ });
1739
+ functionalUtility("scroll-me", {
1740
+ supportsNegative: true,
1741
+ themeKeys: ["--scroll-margin", "--spacing"],
1742
+ handle: (value) => [decl("scroll-margin-inline-end", value)]
1743
+ });
1744
+ functionalUtility("scroll-mt", {
1745
+ supportsNegative: true,
1746
+ themeKeys: ["--scroll-margin", "--spacing"],
1747
+ handle: (value) => [decl("scroll-margin-top", value)]
1748
+ });
1749
+ functionalUtility("scroll-mr", {
1750
+ supportsNegative: true,
1751
+ themeKeys: ["--scroll-margin", "--spacing"],
1752
+ handle: (value) => [decl("scroll-margin-right", value)]
1753
+ });
1754
+ functionalUtility("scroll-mb", {
1755
+ supportsNegative: true,
1756
+ themeKeys: ["--scroll-margin", "--spacing"],
1757
+ handle: (value) => [decl("scroll-margin-bottom", value)]
1758
+ });
1759
+ functionalUtility("scroll-ml", {
1760
+ supportsNegative: true,
1761
+ themeKeys: ["--scroll-margin", "--spacing"],
1762
+ handle: (value) => [decl("scroll-margin-left", value)]
1763
+ });
1764
+ functionalUtility("scroll-p", {
1765
+ supportsNegative: true,
1766
+ themeKeys: ["--scroll-padding", "--spacing"],
1767
+ handle: (value) => [decl("scroll-padding", value)]
1768
+ });
1769
+ functionalUtility("scroll-px", {
1770
+ supportsNegative: true,
1771
+ themeKeys: ["--scroll-padding", "--spacing"],
1772
+ handle: (value) => [decl("scroll-padding-left", value), decl("scroll-padding-right", value)]
1773
+ });
1774
+ functionalUtility("scroll-py", {
1775
+ supportsNegative: true,
1776
+ themeKeys: ["--scroll-padding", "--spacing"],
1777
+ handle: (value) => [decl("scroll-padding-top", value), decl("scroll-padding-bottom", value)]
1778
+ });
1779
+ functionalUtility("scroll-ps", {
1780
+ supportsNegative: true,
1781
+ themeKeys: ["--scroll-padding", "--spacing"],
1782
+ handle: (value) => [decl("scroll-padding-inline-start", value)]
1783
+ });
1784
+ functionalUtility("scroll-pe", {
1785
+ supportsNegative: true,
1786
+ themeKeys: ["--scroll-padding", "--spacing"],
1787
+ handle: (value) => [decl("scroll-padding-inline-end", value)]
1788
+ });
1789
+ functionalUtility("scroll-pt", {
1790
+ supportsNegative: true,
1791
+ themeKeys: ["--scroll-padding", "--spacing"],
1792
+ handle: (value) => [decl("scroll-padding-top", value)]
1793
+ });
1794
+ functionalUtility("scroll-pr", {
1795
+ supportsNegative: true,
1796
+ themeKeys: ["--scroll-padding", "--spacing"],
1797
+ handle: (value) => [decl("scroll-padding-right", value)]
1798
+ });
1799
+ functionalUtility("scroll-pb", {
1800
+ supportsNegative: true,
1801
+ themeKeys: ["--scroll-padding", "--spacing"],
1802
+ handle: (value) => [decl("scroll-padding-bottom", value)]
1803
+ });
1804
+ functionalUtility("scroll-pl", {
1805
+ supportsNegative: true,
1806
+ themeKeys: ["--scroll-padding", "--spacing"],
1807
+ handle: (value) => [decl("scroll-padding-left", value)]
1808
+ });
1809
+ staticUtility("list-inside", [["list-style-position", "inside"]]);
1810
+ staticUtility("list-outside", [["list-style-position", "outside"]]);
1811
+ staticUtility("list-none", [["list-style-type", "none"]]);
1812
+ staticUtility("list-disc", [["list-style-type", "disc"]]);
1813
+ staticUtility("list-decimal", [["list-style-type", "decimal"]]);
1814
+ functionalUtility("list", {
1815
+ themeKeys: ["--list-style-type"],
1816
+ handle: (value) => [decl("list-style-type", value)]
1817
+ });
1818
+ staticUtility("list-image-none", [["list-style-image", "none"]]);
1819
+ functionalUtility("list-image", {
1820
+ themeKeys: ["--list-style-image"],
1821
+ handle: (value) => [decl("list-style-image", value)]
1822
+ });
1823
+ staticUtility("appearance-none", [["appearance", "none"]]);
1824
+ staticUtility("appearance-auto", [["appearance", "auto"]]);
1825
+ staticUtility("columns-auto", [["columns", "auto"]]);
1826
+ functionalUtility("columns", {
1827
+ themeKeys: ["--columns", "--width"],
1828
+ handleBareValue: ({ value }) => value,
1829
+ handle: (value) => [decl("columns", value)]
1830
+ });
1831
+ for (let value of ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"]) {
1832
+ staticUtility(`break-before-${value}`, [["break-before", value]]);
1833
+ }
1834
+ for (let value of ["auto", "avoid", "avoid-page", "avoid-column"]) {
1835
+ staticUtility(`break-inside-${value}`, [["break-inside", value]]);
1836
+ }
1837
+ for (let value of ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"]) {
1838
+ staticUtility(`break-after-${value}`, [["break-after", value]]);
1839
+ }
1840
+ staticUtility("grid-flow-row", [["grid-auto-flow", "row"]]);
1841
+ staticUtility("grid-flow-col", [["grid-auto-flow", "column"]]);
1842
+ staticUtility("grid-flow-dense", [["grid-auto-flow", "dense"]]);
1843
+ staticUtility("grid-flow-row-dense", [["grid-auto-flow", "row dense"]]);
1844
+ staticUtility("grid-flow-col-dense", [["grid-auto-flow", "column dense"]]);
1845
+ staticUtility("auto-cols-auto", [["grid-auto-columns", "auto"]]);
1846
+ staticUtility("auto-cols-min", [["grid-auto-columns", "min-content"]]);
1847
+ staticUtility("auto-cols-max", [["grid-auto-columns", "max-content"]]);
1848
+ staticUtility("auto-cols-fr", [["grid-auto-columns", "minmax(0, 1fr)"]]);
1849
+ functionalUtility("auto-cols", {
1850
+ themeKeys: ["--grid-auto-columns"],
1851
+ handle: (value) => [decl("grid-auto-columns", value)]
1852
+ });
1853
+ staticUtility("auto-rows-auto", [["grid-auto-rows", "auto"]]);
1854
+ staticUtility("auto-rows-min", [["grid-auto-rows", "min-content"]]);
1855
+ staticUtility("auto-rows-max", [["grid-auto-rows", "max-content"]]);
1856
+ staticUtility("auto-rows-fr", [["grid-auto-rows", "minmax(0, 1fr)"]]);
1857
+ functionalUtility("auto-rows", {
1858
+ themeKeys: ["--grid-auto-rows"],
1859
+ handle: (value) => [decl("grid-auto-rows", value)]
1860
+ });
1861
+ staticUtility("grid-cols-none", [["grid-template-columns", "none"]]);
1862
+ staticUtility("grid-cols-subgrid", [["grid-template-columns", "subgrid"]]);
1863
+ functionalUtility("grid-cols", {
1864
+ themeKeys: ["--grid-template-columns"],
1865
+ handleBareValue: ({ value }) => `repeat(${value}, minmax(0, 1fr))`,
1866
+ handle: (value) => [decl("grid-template-columns", value)]
1867
+ });
1868
+ staticUtility("grid-rows-none", [["grid-template-rows", "none"]]);
1869
+ staticUtility("grid-rows-subgrid", [["grid-template-rows", "subgrid"]]);
1870
+ functionalUtility("grid-rows", {
1871
+ themeKeys: ["--grid-template-rows"],
1872
+ handleBareValue: ({ value }) => `repeat(${value}, minmax(0, 1fr))`,
1873
+ handle: (value) => [decl("grid-template-rows", value)]
1874
+ });
1875
+ staticUtility("flex-row", [["flex-direction", "row"]]);
1876
+ staticUtility("flex-row-reverse", [["flex-direction", "row-reverse"]]);
1877
+ staticUtility("flex-col", [["flex-direction", "column"]]);
1878
+ staticUtility("flex-col-reverse", [["flex-direction", "column-reverse"]]);
1879
+ staticUtility("flex-wrap", [["flex-wrap", "wrap"]]);
1880
+ staticUtility("flex-nowrap", [["flex-wrap", "nowrap"]]);
1881
+ staticUtility("flex-wrap-reverse", [["flex-wrap", "wrap-reverse"]]);
1882
+ staticUtility("place-content-center", [["place-content", "center"]]);
1883
+ staticUtility("place-content-start", [["place-content", "start"]]);
1884
+ staticUtility("place-content-end", [["place-content", "end"]]);
1885
+ staticUtility("place-content-between", [["place-content", "between"]]);
1886
+ staticUtility("place-content-around", [["place-content", "around"]]);
1887
+ staticUtility("place-content-evenly", [["place-content", "evenly"]]);
1888
+ staticUtility("place-content-baseline", [["place-content", "baseline"]]);
1889
+ staticUtility("place-content-stretch", [["place-content", "stretch"]]);
1890
+ staticUtility("place-items-center", [["place-items", "center"]]);
1891
+ staticUtility("place-items-start", [["place-items", "start"]]);
1892
+ staticUtility("place-items-end", [["place-items", "end"]]);
1893
+ staticUtility("place-items-baseline", [["place-items", "baseline"]]);
1894
+ staticUtility("place-items-stretch", [["place-items", "stretch"]]);
1895
+ staticUtility("content-normal", [["align-content", "normal"]]);
1896
+ staticUtility("content-center", [["align-content", "center"]]);
1897
+ staticUtility("content-start", [["align-content", "flex-start"]]);
1898
+ staticUtility("content-end", [["align-content", "flex-end"]]);
1899
+ staticUtility("content-between", [["align-content", "space-between"]]);
1900
+ staticUtility("content-around", [["align-content", "space-around"]]);
1901
+ staticUtility("content-evenly", [["align-content", "space-evenly"]]);
1902
+ staticUtility("content-baseline", [["align-content", "baseline"]]);
1903
+ staticUtility("content-stretch", [["align-content", "stretch"]]);
1904
+ staticUtility("items-center", [["align-items", "center"]]);
1905
+ staticUtility("items-start", [["align-items", "flex-start"]]);
1906
+ staticUtility("items-end", [["align-items", "flex-end"]]);
1907
+ staticUtility("items-baseline", [["align-items", "baseline"]]);
1908
+ staticUtility("items-stretch", [["align-items", "stretch"]]);
1909
+ staticUtility("justify-normal", [["justify-content", "normal"]]);
1910
+ staticUtility("justify-center", [["justify-content", "center"]]);
1911
+ staticUtility("justify-start", [["justify-content", "flex-start"]]);
1912
+ staticUtility("justify-end", [["justify-content", "flex-end"]]);
1913
+ staticUtility("justify-between", [["justify-content", "space-between"]]);
1914
+ staticUtility("justify-around", [["justify-content", "space-around"]]);
1915
+ staticUtility("justify-evenly", [["justify-content", "space-evenly"]]);
1916
+ staticUtility("justify-baseline", [["justify-content", "baseline"]]);
1917
+ staticUtility("justify-stretch", [["justify-content", "stretch"]]);
1918
+ staticUtility("justify-items-normal", [["justify-items", "normal"]]);
1919
+ staticUtility("justify-items-center", [["justify-items", "center"]]);
1920
+ staticUtility("justify-items-start", [["justify-items", "start"]]);
1921
+ staticUtility("justify-items-end", [["justify-items", "end"]]);
1922
+ staticUtility("justify-items-stretch", [["justify-items", "stretch"]]);
1923
+ functionalUtility("gap", {
1924
+ themeKeys: ["--gap", "--spacing"],
1925
+ handle: (value) => [decl("gap", value)]
1926
+ });
1927
+ functionalUtility("gap-x", {
1928
+ themeKeys: ["--gap", "--spacing"],
1929
+ handle: (value) => [decl("column-gap", value)]
1930
+ });
1931
+ functionalUtility("gap-y", {
1932
+ themeKeys: ["--gap", "--spacing"],
1933
+ handle: (value) => [decl("row-gap", value)]
1934
+ });
1935
+ functionalUtility("space-x", {
1936
+ supportsNegative: true,
1937
+ themeKeys: ["--space", "--spacing"],
1938
+ handle: (value) => [
1939
+ atRoot([property("--tw-space-x-reverse", "0", "<number>")]),
1940
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
1941
+ decl("--tw-sort", "row-gap"),
1942
+ decl("margin-inline-end", `calc(${value} * var(--tw-space-x-reverse))`),
1943
+ decl("margin-inline-start", `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`)
1944
+ ])
1945
+ ]
1946
+ });
1947
+ functionalUtility("space-y", {
1948
+ supportsNegative: true,
1949
+ themeKeys: ["--space", "--spacing"],
1950
+ handle: (value) => [
1951
+ atRoot([property("--tw-space-y-reverse", "0", "<number>")]),
1952
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
1953
+ decl("--tw-sort", "column-gap"),
1954
+ decl("margin-bottom", `calc(${value} * var(--tw-space-y-reverse))`),
1955
+ decl("margin-top", `calc(${value} * calc(1 - var(--tw-space-y-reverse)))`)
1956
+ ])
1957
+ ]
1958
+ });
1959
+ staticUtility("space-x-reverse", [
1960
+ () => atRoot([property("--tw-space-x-reverse", "0", "<number>")]),
1961
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
1962
+ decl("--tw-sort", "row-gap"),
1963
+ decl("--tw-space-x-reverse", "1")
1964
+ ])
1965
+ ]);
1966
+ staticUtility("space-y-reverse", [
1967
+ () => atRoot([property("--tw-space-y-reverse", "0", "<number>")]),
1968
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
1969
+ decl("--tw-sort", "column-gap"),
1970
+ decl("--tw-space-y-reverse", "1")
1971
+ ])
1972
+ ]);
1973
+ functionalUtility("divide-x", {
1974
+ defaultValue: theme.get(["--default-border-width"]) ?? "1px",
1975
+ themeKeys: ["--divide-width", "--border-width"],
1976
+ handleBareValue: ({ value }) => `${value}px`,
1977
+ handle: (value) => [
1978
+ atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
1979
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
1980
+ decl("--tw-sort", "divide-x-width"),
1981
+ decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
1982
+ decl("border-inline-start-width", `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`)
1983
+ ])
1984
+ ]
1985
+ });
1986
+ functionalUtility("divide-y", {
1987
+ defaultValue: theme.get(["--default-border-width"]) ?? "1px",
1988
+ themeKeys: ["--divide-width", "--border-width"],
1989
+ handleBareValue: ({ value }) => `${value}px`,
1990
+ handle: (value) => [
1991
+ atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
1992
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
1993
+ decl("--tw-sort", "divide-y-width"),
1994
+ decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
1995
+ decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
1996
+ ])
1997
+ ]
1998
+ });
1999
+ staticUtility("divide-x-reverse", [
2000
+ () => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
2001
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
2002
+ ]);
2003
+ staticUtility("divide-y-reverse", [
2004
+ () => atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
2005
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-y-reverse", "1")])
2006
+ ]);
2007
+ for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
2008
+ staticUtility(`divide-${value}`, [
2009
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2010
+ decl("--tw-sort", "divide-style"),
2011
+ decl("border-style", value)
2012
+ ])
2013
+ ]);
2014
+ }
2015
+ colorUtility("accent", {
2016
+ themeKeys: ["--accent-color", "--color"],
2017
+ handle: (value) => [decl("accent-color", value)]
2018
+ });
2019
+ colorUtility("caret", {
2020
+ themeKeys: ["--caret-color", "--color"],
2021
+ handle: (value) => [decl("caret-color", value)]
2022
+ });
2023
+ colorUtility("divide", {
2024
+ themeKeys: ["--divide-color", "--color"],
2025
+ handle: (value) => [
2026
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2027
+ decl("--tw-sort", "divide-color"),
2028
+ decl("border-color", value)
2029
+ ])
2030
+ ]
2031
+ });
2032
+ staticUtility("place-self-auto", [["place-self", "auto"]]);
2033
+ staticUtility("place-self-start", [["place-self", "start"]]);
2034
+ staticUtility("place-self-end", [["place-self", "end"]]);
2035
+ staticUtility("place-self-center", [["place-self", "center"]]);
2036
+ staticUtility("place-self-stretch", [["place-self", "stretch"]]);
2037
+ staticUtility("self-auto", [["align-self", "auto"]]);
2038
+ staticUtility("self-start", [["align-self", "flex-start"]]);
2039
+ staticUtility("self-end", [["align-self", "flex-end"]]);
2040
+ staticUtility("self-center", [["align-self", "center"]]);
2041
+ staticUtility("self-stretch", [["align-self", "stretch"]]);
2042
+ staticUtility("self-baseline", [["align-self", "baseline"]]);
2043
+ staticUtility("justify-self-auto", [["justify-self", "auto"]]);
2044
+ staticUtility("justify-self-start", [["justify-self", "flex-start"]]);
2045
+ staticUtility("justify-self-end", [["justify-self", "flex-end"]]);
2046
+ staticUtility("justify-self-center", [["justify-self", "center"]]);
2047
+ staticUtility("justify-self-stretch", [["justify-self", "stretch"]]);
2048
+ for (let value of ["auto", "hidden", "clip", "visible", "scroll"]) {
2049
+ staticUtility(`overflow-${value}`, [["overflow", value]]);
2050
+ staticUtility(`overflow-x-${value}`, [["overflow-x", value]]);
2051
+ staticUtility(`overflow-y-${value}`, [["overflow-y", value]]);
2052
+ }
2053
+ for (let value of ["auto", "contain", "none"]) {
2054
+ staticUtility(`overscroll-${value}`, [["overscroll-behavior", value]]);
2055
+ staticUtility(`overscroll-x-${value}`, [["overscroll-behavior-x", value]]);
2056
+ staticUtility(`overscroll-y-${value}`, [["overscroll-behavior-y", value]]);
2057
+ }
2058
+ staticUtility(`scroll-auto`, [["scroll-behavior", "auto"]]);
2059
+ staticUtility(`scroll-smooth`, [["scroll-behavior", "smooth"]]);
2060
+ staticUtility(`truncate`, [
2061
+ ["overflow", "hidden"],
2062
+ ["text-overflow", "ellipsis"],
2063
+ ["white-space", "nowrap"]
2064
+ ]);
2065
+ staticUtility(`text-ellipsis`, [["text-overflow", "ellipsis"]]);
2066
+ staticUtility(`text-clip`, [["text-overflow", "clip"]]);
2067
+ staticUtility(`hyphens-none`, [
2068
+ ["-webkit-hyphens", "none"],
2069
+ ["hyphens", "none"]
2070
+ ]);
2071
+ staticUtility(`hyphens-manual`, [
2072
+ ["-webkit-hyphens", "manual"],
2073
+ ["hyphens", "manual"]
2074
+ ]);
2075
+ staticUtility(`hyphens-auto`, [
2076
+ ["-webkit-hyphens", "auto"],
2077
+ ["hyphens", "auto"]
2078
+ ]);
2079
+ staticUtility(`whitespace-normal`, [["white-space", "normal"]]);
2080
+ staticUtility(`whitespace-nowrap`, [["white-space", "nowrap"]]);
2081
+ staticUtility(`whitespace-pre`, [["white-space", "pre"]]);
2082
+ staticUtility(`whitespace-pre-line`, [["white-space", "pre-line"]]);
2083
+ staticUtility(`whitespace-pre-wrap`, [["white-space", "pre-wrap"]]);
2084
+ staticUtility(`whitespace-break-spaces`, [["white-space", "break-spaces"]]);
2085
+ staticUtility("text-wrap", [["text-wrap", "wrap"]]);
2086
+ staticUtility("text-nowrap", [["text-wrap", "nowrap"]]);
2087
+ staticUtility("text-balance", [["text-wrap", "balance"]]);
2088
+ staticUtility("text-pretty", [["text-wrap", "pretty"]]);
2089
+ staticUtility("break-normal", [
2090
+ ["overflow-wrap", "normal"],
2091
+ ["word-break", "normal"]
2092
+ ]);
2093
+ staticUtility("break-words", [["overflow-wrap", "break-word"]]);
2094
+ staticUtility("break-all", [["word-break", "break-all"]]);
2095
+ staticUtility("break-keep", [["word-break", "break-keep"]]);
2096
+ functionalUtility("rounded", {
2097
+ themeKeys: ["--radius"],
2098
+ handle: (value) => [decl("border-radius", value)]
2099
+ });
2100
+ functionalUtility("rounded-s", {
2101
+ themeKeys: ["--radius"],
2102
+ handle: (value) => [
2103
+ decl("border-start-start-radius", value),
2104
+ decl("border-end-start-radius", value)
2105
+ ]
2106
+ });
2107
+ functionalUtility("rounded-e", {
2108
+ themeKeys: ["--radius"],
2109
+ handle: (value) => [
2110
+ decl("border-start-end-radius", value),
2111
+ decl("border-end-end-radius", value)
2112
+ ]
2113
+ });
2114
+ functionalUtility("rounded-t", {
2115
+ themeKeys: ["--radius"],
2116
+ handle: (value) => [
2117
+ decl("border-top-left-radius", value),
2118
+ decl("border-top-right-radius", value)
2119
+ ]
2120
+ });
2121
+ functionalUtility("rounded-r", {
2122
+ themeKeys: ["--radius"],
2123
+ handle: (value) => [
2124
+ decl("border-top-right-radius", value),
2125
+ decl("border-bottom-right-radius", value)
2126
+ ]
2127
+ });
2128
+ functionalUtility("rounded-b", {
2129
+ themeKeys: ["--radius"],
2130
+ handle: (value) => [
2131
+ decl("border-bottom-right-radius", value),
2132
+ decl("border-bottom-left-radius", value)
2133
+ ]
2134
+ });
2135
+ functionalUtility("rounded-l", {
2136
+ themeKeys: ["--radius"],
2137
+ handle: (value) => [
2138
+ decl("border-top-left-radius", value),
2139
+ decl("border-bottom-left-radius", value)
2140
+ ]
2141
+ });
2142
+ functionalUtility("rounded-ss", {
2143
+ themeKeys: ["--radius"],
2144
+ handle: (value) => [decl("border-start-start-radius", value)]
2145
+ });
2146
+ functionalUtility("rounded-se", {
2147
+ themeKeys: ["--radius"],
2148
+ handle: (value) => [decl("border-start-end-radius", value)]
2149
+ });
2150
+ functionalUtility("rounded-ee", {
2151
+ themeKeys: ["--radius"],
2152
+ handle: (value) => [decl("border-end-end-radius", value)]
2153
+ });
2154
+ functionalUtility("rounded-es", {
2155
+ themeKeys: ["--radius"],
2156
+ handle: (value) => [decl("border-end-start-radius", value)]
2157
+ });
2158
+ functionalUtility("rounded-tl", {
2159
+ themeKeys: ["--radius"],
2160
+ handle: (value) => [decl("border-top-left-radius", value)]
2161
+ });
2162
+ functionalUtility("rounded-tr", {
2163
+ themeKeys: ["--radius"],
2164
+ handle: (value) => [decl("border-top-right-radius", value)]
2165
+ });
2166
+ functionalUtility("rounded-br", {
2167
+ themeKeys: ["--radius"],
2168
+ handle: (value) => [decl("border-bottom-right-radius", value)]
2169
+ });
2170
+ functionalUtility("rounded-bl", {
2171
+ themeKeys: ["--radius"],
2172
+ handle: (value) => [decl("border-bottom-left-radius", value)]
2173
+ });
2174
+ staticUtility("border-solid", [["border-style", "solid"]]);
2175
+ staticUtility("border-dashed", [["border-style", "dashed"]]);
2176
+ staticUtility("border-dotted", [["border-style", "dotted"]]);
2177
+ staticUtility("border-double", [["border-style", "double"]]);
2178
+ staticUtility("border-hidden", [["border-style", "hidden"]]);
2179
+ staticUtility("border-none", [["border-style", "none"]]);
2180
+ function borderSideUtility(classRoot, desc) {
2181
+ utilities.functional(classRoot, (candidate) => {
2182
+ if (candidate.negative) {
2183
+ return;
2184
+ }
2185
+ if (!candidate.value) {
2186
+ let value = theme.get(["--default-border-width"]) ?? "1px";
2187
+ return desc.width(value);
2188
+ }
2189
+ if (candidate.value.kind === "arbitrary") {
2190
+ let value = candidate.value.value;
2191
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "line-width", "length"]);
2192
+ switch (type) {
2193
+ case "line-width":
2194
+ case "length": {
2195
+ return desc.width(value);
2196
+ }
2197
+ default: {
2198
+ value = asColor(value, candidate.modifier, theme);
2199
+ return desc.color(value);
2200
+ }
2201
+ }
2202
+ }
2203
+ {
2204
+ let value = resolveThemeColor(candidate, theme, ["--border-color", "--color"]);
2205
+ if (value) {
2206
+ return desc.color(value);
2207
+ }
2208
+ }
2209
+ {
2210
+ let value = theme.resolve(candidate.value.value, ["--border-width"]);
2211
+ if (value) {
2212
+ return desc.width(value);
2213
+ }
2214
+ if (!isNaN(Number(candidate.value.value))) {
2215
+ return desc.width(`${candidate.value.value}px`);
2216
+ }
2217
+ }
2218
+ });
2219
+ }
2220
+ borderSideUtility("border", {
2221
+ width: (value) => [decl("border-width", value)],
2222
+ color: (value) => [decl("border-color", value)]
2223
+ });
2224
+ borderSideUtility("border-x", {
2225
+ width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
2226
+ color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
2227
+ });
2228
+ borderSideUtility("border-y", {
2229
+ width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
2230
+ color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
2231
+ });
2232
+ borderSideUtility("border-s", {
2233
+ width: (value) => [decl("border-inline-start-width", value)],
2234
+ color: (value) => [decl("border-inline-start-color", value)]
2235
+ });
2236
+ borderSideUtility("border-e", {
2237
+ width: (value) => [decl("border-inline-end-width", value)],
2238
+ color: (value) => [decl("border-inline-end-color", value)]
2239
+ });
2240
+ borderSideUtility("border-t", {
2241
+ width: (value) => [decl("border-top-width", value)],
2242
+ color: (value) => [decl("border-top-color", value)]
2243
+ });
2244
+ borderSideUtility("border-r", {
2245
+ width: (value) => [decl("border-right-width", value)],
2246
+ color: (value) => [decl("border-right-color", value)]
2247
+ });
2248
+ borderSideUtility("border-b", {
2249
+ width: (value) => [decl("border-bottom-width", value)],
2250
+ color: (value) => [decl("border-bottom-color", value)]
2251
+ });
2252
+ borderSideUtility("border-l", {
2253
+ width: (value) => [decl("border-left-width", value)],
2254
+ color: (value) => [decl("border-left-color", value)]
2255
+ });
2256
+ staticUtility("bg-inherit", [["background-color", "inherit"]]);
2257
+ staticUtility("bg-transparent", [["background-color", "transparent"]]);
2258
+ staticUtility("bg-auto", [["background-size", "auto"]]);
2259
+ staticUtility("bg-cover", [["background-size", "cover"]]);
2260
+ staticUtility("bg-contain", [["background-size", "contain"]]);
2261
+ staticUtility("bg-fixed", [["background-attachment", "fixed"]]);
2262
+ staticUtility("bg-local", [["background-attachment", "local"]]);
2263
+ staticUtility("bg-scroll", [["background-attachment", "scroll"]]);
2264
+ staticUtility("bg-center", [["background-position", "center"]]);
2265
+ staticUtility("bg-top", [["background-position", "top"]]);
2266
+ staticUtility("bg-right-top", [["background-position", "right-top"]]);
2267
+ staticUtility("bg-right", [["background-position", "right"]]);
2268
+ staticUtility("bg-right-bottom", [["background-position", "right-bottom"]]);
2269
+ staticUtility("bg-bottom", [["background-position", "bottom"]]);
2270
+ staticUtility("bg-left-bottom", [["background-position", "left-bottom"]]);
2271
+ staticUtility("bg-left", [["background-position", "left"]]);
2272
+ staticUtility("bg-left-top", [["background-position", "left-top"]]);
2273
+ staticUtility("bg-repeat", [["background-repeat", "repeat"]]);
2274
+ staticUtility("bg-no-repeat", [["background-repeat", "no-repeat"]]);
2275
+ staticUtility("bg-repeat-x", [["background-repeat", "repeat-x"]]);
2276
+ staticUtility("bg-repeat-y", [["background-repeat", "repeat-y"]]);
2277
+ staticUtility("bg-round", [["background-repeat", "round"]]);
2278
+ staticUtility("bg-space", [["background-repeat", "space"]]);
2279
+ staticUtility("bg-none", [["background-image", "none"]]);
2280
+ for (let [value, direction] of [
2281
+ ["t", "top"],
2282
+ ["tr", "top right"],
2283
+ ["r", "right"],
2284
+ ["br", "bottom right"],
2285
+ ["b", "bottom"],
2286
+ ["bl", "bottom left"],
2287
+ ["l", "left"],
2288
+ ["tl", "top left"]
2289
+ ]) {
2290
+ staticUtility(`bg-gradient-to-${value}`, [
2291
+ ["background-image", `linear-gradient(to ${direction}, var(--tw-gradient-stops,))`]
2292
+ ]);
2293
+ }
2294
+ utilities.functional("bg", (candidate) => {
2295
+ if (candidate.negative || !candidate.value) {
2296
+ return;
2297
+ }
2298
+ if (candidate.value.kind === "arbitrary") {
2299
+ let value = candidate.value.value;
2300
+ let type = candidate.value.dataType ?? inferDataType(value, [
2301
+ "image",
2302
+ "color",
2303
+ "length",
2304
+ "percentage",
2305
+ "position",
2306
+ "bg-size",
2307
+ "url"
2308
+ ]);
2309
+ switch (type) {
2310
+ case "length":
2311
+ case "percentage":
2312
+ case "position": {
2313
+ return [decl("background-position", value)];
2314
+ }
2315
+ case "size":
2316
+ case "bg-size": {
2317
+ return [decl("background-size", value)];
2318
+ }
2319
+ case "image":
2320
+ case "url": {
2321
+ return [decl("background-image", value)];
2322
+ }
2323
+ default: {
2324
+ value = asColor(value, candidate.modifier, theme);
2325
+ return [decl("background-color", value)];
2326
+ }
2327
+ }
2328
+ }
2329
+ {
2330
+ let value = resolveThemeColor(candidate, theme, ["--background-color", "--color"]);
2331
+ if (value) {
2332
+ return [decl("background-color", value)];
2333
+ }
2334
+ }
2335
+ {
2336
+ let value = theme.resolve(candidate.value.value, ["--background-image"]);
2337
+ if (value) {
2338
+ return [decl("background-image", value)];
2339
+ }
2340
+ }
2341
+ });
2342
+ let gradientStopProperties = () => {
2343
+ return atRoot([
2344
+ property("--tw-gradient-from", "#0000", "<color>"),
2345
+ property("--tw-gradient-to", "#0000", "<color>"),
2346
+ property("--tw-gradient-from", "transparent", "<color>"),
2347
+ property("--tw-gradient-via", "transparent", "<color>"),
2348
+ property("--tw-gradient-to", "transparent", "<color>"),
2349
+ property("--tw-gradient-stops"),
2350
+ property("--tw-gradient-via-stops"),
2351
+ property("--tw-gradient-from-position", "0%", "<length-percentage>"),
2352
+ property("--tw-gradient-via-position", "50%", "<length-percentage>"),
2353
+ property("--tw-gradient-to-position", "100%", "<length-percentage>")
2354
+ ]);
2355
+ };
2356
+ function gradientStopUtility(classRoot, desc) {
2357
+ utilities.functional(classRoot, (candidate) => {
2358
+ if (candidate.negative || !candidate.value) {
2359
+ return;
2360
+ }
2361
+ if (candidate.value.kind === "arbitrary") {
2362
+ let value = candidate.value.value;
2363
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
2364
+ switch (type) {
2365
+ case "length":
2366
+ case "percentage": {
2367
+ return desc.position(value);
2368
+ }
2369
+ default: {
2370
+ value = asColor(value, candidate.modifier, theme);
2371
+ return desc.color(value);
2372
+ }
2373
+ }
2374
+ }
2375
+ {
2376
+ let value = resolveThemeColor(candidate, theme, ["--background-color", "--color"]);
2377
+ if (value) {
2378
+ return desc.color(value);
2379
+ }
2380
+ }
2381
+ {
2382
+ let value = theme.resolve(candidate.value.value, ["--gradient-color-stop-positions"]);
2383
+ if (value) {
2384
+ return desc.position(value);
2385
+ } else if (candidate.value.value[candidate.value.value.length - 1] === "%") {
2386
+ return desc.position(candidate.value.value);
2387
+ }
2388
+ }
2389
+ });
2390
+ }
2391
+ gradientStopUtility("from", {
2392
+ color: (value) => [
2393
+ gradientStopProperties(),
2394
+ decl("--tw-sort", "--tw-gradient-from"),
2395
+ decl("--tw-gradient-from", value),
2396
+ decl(
2397
+ "--tw-gradient-stops",
2398
+ "var(--tw-gradient-via-stops, var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))"
2399
+ )
2400
+ ],
2401
+ position: (value) => [gradientStopProperties(), decl("--tw-gradient-from-position", value)]
2402
+ });
2403
+ staticUtility("via-none", [["--tw-gradient-via-stops", "initial"]]);
2404
+ gradientStopUtility("via", {
2405
+ color: (value) => [
2406
+ gradientStopProperties(),
2407
+ decl("--tw-sort", "--tw-gradient-via"),
2408
+ decl("--tw-gradient-via", value),
2409
+ decl(
2410
+ "--tw-gradient-via-stops",
2411
+ `var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position)`
2412
+ ),
2413
+ decl("--tw-gradient-stops", `var(--tw-gradient-via-stops)`)
2414
+ ],
2415
+ position: (value) => [gradientStopProperties(), decl("--tw-gradient-via-position", value)]
2416
+ });
2417
+ gradientStopUtility("to", {
2418
+ color: (value) => [
2419
+ gradientStopProperties(),
2420
+ decl("--tw-sort", "--tw-gradient-to"),
2421
+ decl("--tw-gradient-to", value),
2422
+ decl(
2423
+ "--tw-gradient-stops",
2424
+ "var(--tw-gradient-via-stops, var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))"
2425
+ )
2426
+ ],
2427
+ position: (value) => [gradientStopProperties(), decl("--tw-gradient-to-position", value)]
2428
+ });
2429
+ staticUtility("decoration-slice", [
2430
+ ["-webkit-box-decoration-break", "slice"],
2431
+ ["box-decoration-break", "slice"]
2432
+ ]);
2433
+ staticUtility("decoration-clone", [
2434
+ ["-webkit-box-decoration-break", "clone"],
2435
+ ["box-decoration-break", "clone"]
2436
+ ]);
2437
+ staticUtility("box-decoration-slice", [
2438
+ ["-webkit-box-decoration-break", "slice"],
2439
+ ["box-decoration-break", "slice"]
2440
+ ]);
2441
+ staticUtility("box-decoration-clone", [
2442
+ ["-webkit-box-decoration-break", "clone"],
2443
+ ["box-decoration-break", "clone"]
2444
+ ]);
2445
+ staticUtility("bg-clip-text", [["background-clip", "text"]]);
2446
+ staticUtility("bg-clip-border", [["background-clip", "border-box"]]);
2447
+ staticUtility("bg-clip-padding", [["background-clip", "padding-box"]]);
2448
+ staticUtility("bg-clip-content", [["background-clip", "content-box"]]);
2449
+ staticUtility("bg-origin-border", [["background-origin", "border-box"]]);
2450
+ staticUtility("bg-origin-padding", [["background-origin", "padding-box"]]);
2451
+ staticUtility("bg-origin-content", [["background-origin", "content-box"]]);
2452
+ for (let value of [
2453
+ "normal",
2454
+ "multiply",
2455
+ "screen",
2456
+ "overlay",
2457
+ "darken",
2458
+ "lighten",
2459
+ "color-dodge",
2460
+ "color-burn",
2461
+ "hard-light",
2462
+ "soft-light",
2463
+ "difference",
2464
+ "exclusion",
2465
+ "hue",
2466
+ "saturation",
2467
+ "color",
2468
+ "luminosity"
2469
+ ]) {
2470
+ staticUtility(`bg-blend-${value}`, [["background-blend-mode", value]]);
2471
+ staticUtility(`mix-blend-${value}`, [["mix-blend-mode", value]]);
2472
+ }
2473
+ staticUtility(`mix-blend-plus-darker`, [["mix-blend-mode", "plus-darker"]]);
2474
+ staticUtility(`mix-blend-plus-lighter`, [["mix-blend-mode", "plus-lighter"]]);
2475
+ utilities.functional("fill", (candidate) => {
2476
+ if (candidate.negative || !candidate.value) {
2477
+ return;
2478
+ }
2479
+ if (candidate.value.kind === "arbitrary") {
2480
+ return [decl("fill", asColor(candidate.value.value, candidate.modifier, theme))];
2481
+ }
2482
+ let value = resolveThemeColor(candidate, theme, ["--fill", "--color"]);
2483
+ if (value) {
2484
+ return [decl("fill", value)];
2485
+ }
2486
+ });
2487
+ staticUtility("stroke-none", [["stroke", "none"]]);
2488
+ utilities.functional("stroke", (candidate) => {
2489
+ if (candidate.negative || !candidate.value) {
2490
+ return;
2491
+ }
2492
+ if (candidate.value.kind === "arbitrary") {
2493
+ let value = candidate.value.value;
2494
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "number", "length", "percentage"]);
2495
+ switch (type) {
2496
+ case "number":
2497
+ case "length":
2498
+ case "percentage": {
2499
+ return [decl("stroke-width", value)];
2500
+ }
2501
+ default: {
2502
+ value = asColor(candidate.value.value, candidate.modifier, theme);
2503
+ return [decl("stroke", value)];
2504
+ }
2505
+ }
2506
+ }
2507
+ {
2508
+ let value = resolveThemeColor(candidate, theme, ["--stroke", "--color"]);
2509
+ if (value) {
2510
+ return [decl("stroke", value)];
2511
+ }
2512
+ }
2513
+ {
2514
+ let value = theme.resolve(candidate.value.value, ["--stroke-width"]);
2515
+ if (value) {
2516
+ return [decl("stroke-width", value)];
2517
+ } else if (!isNaN(Number(candidate.value.value))) {
2518
+ return [decl("stroke-width", candidate.value.value)];
2519
+ }
2520
+ }
2521
+ });
2522
+ staticUtility("object-contain", [["object-fit", "contain"]]);
2523
+ staticUtility("object-cover", [["object-fit", "cover"]]);
2524
+ staticUtility("object-fill", [["object-fit", "fill"]]);
2525
+ staticUtility("object-none", [["object-fit", "none"]]);
2526
+ staticUtility("object-scale-down", [["object-fit", "scale-down"]]);
2527
+ staticUtility("object-bottom", [["object-position", "bottom"]]);
2528
+ staticUtility("object-center", [["object-position", "center"]]);
2529
+ staticUtility("object-left", [["object-position", "left"]]);
2530
+ staticUtility("object-left-bottom", [["object-position", "left bottom"]]);
2531
+ staticUtility("object-left-top", [["object-position", "left top"]]);
2532
+ staticUtility("object-right", [["object-position", "right"]]);
2533
+ staticUtility("object-right-bottom", [["object-position", "right bottom"]]);
2534
+ staticUtility("object-right-top", [["object-position", "right top"]]);
2535
+ staticUtility("object-top", [["object-position", "top"]]);
2536
+ functionalUtility("object", {
2537
+ themeKeys: ["--object-position"],
2538
+ handle: (value) => [decl("object-position", value)]
2539
+ });
2540
+ functionalUtility("p", {
2541
+ themeKeys: ["--padding", "--spacing"],
2542
+ handle: (value) => [decl("padding", value)]
2543
+ });
2544
+ functionalUtility("px", {
2545
+ themeKeys: ["--padding", "--spacing"],
2546
+ handle: (value) => [decl("padding-left", value), decl("padding-right", value)]
2547
+ });
2548
+ functionalUtility("py", {
2549
+ themeKeys: ["--padding", "--spacing"],
2550
+ handle: (value) => [decl("padding-top", value), decl("padding-bottom", value)]
2551
+ });
2552
+ functionalUtility("pt", {
2553
+ themeKeys: ["--padding", "--spacing"],
2554
+ handle: (value) => [decl("padding-top", value)]
2555
+ });
2556
+ functionalUtility("ps", {
2557
+ themeKeys: ["--padding", "--spacing"],
2558
+ handle: (value) => [decl("padding-inline-start", value)]
2559
+ });
2560
+ functionalUtility("pe", {
2561
+ themeKeys: ["--padding", "--spacing"],
2562
+ handle: (value) => [decl("padding-inline-end", value)]
2563
+ });
2564
+ functionalUtility("pr", {
2565
+ themeKeys: ["--padding", "--spacing"],
2566
+ handle: (value) => [decl("padding-right", value)]
2567
+ });
2568
+ functionalUtility("pb", {
2569
+ themeKeys: ["--padding", "--spacing"],
2570
+ handle: (value) => [decl("padding-bottom", value)]
2571
+ });
2572
+ functionalUtility("pl", {
2573
+ themeKeys: ["--padding", "--spacing"],
2574
+ handle: (value) => [decl("padding-left", value)]
2575
+ });
2576
+ staticUtility("text-left", [["text-align", "left"]]);
2577
+ staticUtility("text-center", [["text-align", "center"]]);
2578
+ staticUtility("text-right", [["text-align", "right"]]);
2579
+ staticUtility("text-justify", [["text-align", "justify"]]);
2580
+ staticUtility("text-start", [["text-align", "start"]]);
2581
+ staticUtility("text-end", [["text-align", "end"]]);
2582
+ functionalUtility("indent", {
2583
+ supportsNegative: true,
2584
+ themeKeys: ["--text-indent", "--spacing"],
2585
+ handle: (value) => [decl("text-indent", value)]
2586
+ });
2587
+ staticUtility("align-baseline", [["vertical-align", "baseline"]]);
2588
+ staticUtility("align-top", [["vertical-align", "top"]]);
2589
+ staticUtility("align-middle", [["vertical-align", "middle"]]);
2590
+ staticUtility("align-bottom", [["vertical-align", "bottom"]]);
2591
+ staticUtility("align-text-top", [["vertical-align", "text-top"]]);
2592
+ staticUtility("align-text-bottom", [["vertical-align", "text-bottom"]]);
2593
+ staticUtility("align-sub", [["vertical-align", "sub"]]);
2594
+ staticUtility("align-super", [["vertical-align", "super"]]);
2595
+ functionalUtility("align", {
2596
+ themeKeys: [],
2597
+ handle: (value) => [decl("vertical-align", value)]
2598
+ });
2599
+ utilities.functional("font", (candidate) => {
2600
+ if (candidate.negative || !candidate.value) {
2601
+ return;
2602
+ }
2603
+ if (candidate.value.kind === "arbitrary") {
2604
+ let value = candidate.value.value;
2605
+ let type = candidate.value.dataType ?? inferDataType(value, ["number", "generic-name", "family-name"]);
2606
+ switch (type) {
2607
+ case "generic-name":
2608
+ case "family-name": {
2609
+ return [decl("font-family", value)];
2610
+ }
2611
+ default: {
2612
+ return [decl("font-weight", value)];
2613
+ }
2614
+ }
2615
+ }
2616
+ {
2617
+ let value = theme.resolveWith(
2618
+ candidate.value.value,
2619
+ ["--font-family"],
2620
+ ["--font-feature-settings", "--font-variation-settings"]
2621
+ );
2622
+ if (value) {
2623
+ let [families, options = {}] = value;
2624
+ return [
2625
+ decl("font-family", families),
2626
+ decl("font-feature-settings", options["--font-feature-settings"]),
2627
+ decl("font-variation-settings", options["--font-variation-settings"])
2628
+ ];
2629
+ }
2630
+ }
2631
+ {
2632
+ let value = theme.resolve(candidate.value.value, ["--font-weight"]);
2633
+ if (value) {
2634
+ return [decl("font-weight", value)];
2635
+ }
2636
+ switch (candidate.value.value) {
2637
+ case "thin":
2638
+ value = "100";
2639
+ break;
2640
+ case "extralight":
2641
+ value = "200";
2642
+ break;
2643
+ case "light":
2644
+ value = "300";
2645
+ break;
2646
+ case "normal":
2647
+ value = "400";
2648
+ break;
2649
+ case "medium":
2650
+ value = "500";
2651
+ break;
2652
+ case "semibold":
2653
+ value = "600";
2654
+ break;
2655
+ case "bold":
2656
+ value = "700";
2657
+ break;
2658
+ case "extrabold":
2659
+ value = "800";
2660
+ break;
2661
+ case "black":
2662
+ value = "900";
2663
+ break;
2664
+ }
2665
+ if (value) {
2666
+ return [decl("font-weight", value)];
2667
+ }
2668
+ }
2669
+ });
2670
+ staticUtility("uppercase", [["text-transform", "uppercase"]]);
2671
+ staticUtility("lowercase", [["text-transform", "lowercase"]]);
2672
+ staticUtility("capitalize", [["text-transform", "capitalize"]]);
2673
+ staticUtility("normal-case", [["text-transform", "none"]]);
2674
+ staticUtility("italic", [["font-style", "italic"]]);
2675
+ staticUtility("not-italic", [["font-style", "normal"]]);
2676
+ staticUtility("underline", [["text-decoration-line", "underline"]]);
2677
+ staticUtility("overline", [["text-decoration-line", "overline"]]);
2678
+ staticUtility("line-through", [["text-decoration-line", "line-through"]]);
2679
+ staticUtility("no-underline", [["text-decoration-line", "none"]]);
2680
+ colorUtility("placeholder", {
2681
+ themeKeys: ["--background-color", "--color"],
2682
+ handle: (value) => [
2683
+ rule("&::placeholder", [decl("--tw-sort", "placeholder-color"), decl("color", value)])
2684
+ ]
2685
+ });
2686
+ staticUtility("decoration-solid", [["text-decoration-style", "solid"]]);
2687
+ staticUtility("decoration-double", [["text-decoration-style", "double"]]);
2688
+ staticUtility("decoration-dotted", [["text-decoration-style", "dotted"]]);
2689
+ staticUtility("decoration-dashed", [["text-decoration-style", "dashed"]]);
2690
+ staticUtility("decoration-wavy", [["text-decoration-style", "wavy"]]);
2691
+ staticUtility("decoration-auto", [["text-decoration-thickness", "auto"]]);
2692
+ staticUtility("decoration-from-font", [["text-decoration-thickness", "from-font"]]);
2693
+ utilities.functional("decoration", (candidate) => {
2694
+ if (candidate.negative || !candidate.value) {
2695
+ return;
2696
+ }
2697
+ if (candidate.value.kind === "arbitrary") {
2698
+ let value = candidate.value.value;
2699
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
2700
+ switch (type) {
2701
+ case "length":
2702
+ case "percentage": {
2703
+ return [decl("text-decoration-thickness", value)];
2704
+ }
2705
+ default: {
2706
+ value = asColor(value, candidate.modifier, theme);
2707
+ return [decl("text-decoration-color", value)];
2708
+ }
2709
+ }
2710
+ }
2711
+ {
2712
+ let value = theme.resolve(candidate.value.value, ["--text-decoration-thickness"]);
2713
+ if (value) {
2714
+ return [decl("text-decoration-thickness", value)];
2715
+ }
2716
+ if (!isNaN(Number(candidate.value.value))) {
2717
+ return [decl("text-decoration-thickness", `${candidate.value.value}px`)];
2718
+ }
2719
+ }
2720
+ {
2721
+ let value = resolveThemeColor(candidate, theme, ["--text-decoration-color", "--color"]);
2722
+ if (value) {
2723
+ return [decl("text-decoration-color", value)];
2724
+ }
2725
+ }
2726
+ });
2727
+ staticUtility("animate-none", [["animation", "none"]]);
2728
+ functionalUtility("animate", {
2729
+ themeKeys: ["--animate"],
2730
+ handle: (value) => [decl("animation", value)]
2731
+ });
2732
+ {
2733
+ let cssFilterValue = [
2734
+ "var(--tw-blur,)",
2735
+ "var(--tw-brightness,)",
2736
+ "var(--tw-contrast,)",
2737
+ "var(--tw-grayscale,)",
2738
+ "var(--tw-hue-rotate,)",
2739
+ "var(--tw-invert,)",
2740
+ "var(--tw-saturate,)",
2741
+ "var(--tw-sepia,)",
2742
+ "var(--tw-drop-shadow,)"
2743
+ ].join(" ");
2744
+ let cssBackdropFilterValue = [
2745
+ "var(--tw-backdrop-blur,)",
2746
+ "var(--tw-backdrop-brightness,)",
2747
+ "var(--tw-backdrop-contrast,)",
2748
+ "var(--tw-backdrop-grayscale,)",
2749
+ "var(--tw-backdrop-hue-rotate,)",
2750
+ "var(--tw-backdrop-invert,)",
2751
+ "var(--tw-backdrop-opacity,)",
2752
+ "var(--tw-backdrop-saturate,)",
2753
+ "var(--tw-backdrop-sepia,)"
2754
+ ].join(" ");
2755
+ let filterProperties = () => {
2756
+ return atRoot([
2757
+ property("--tw-blur"),
2758
+ property("--tw-brightness"),
2759
+ property("--tw-contrast"),
2760
+ property("--tw-grayscale"),
2761
+ property("--tw-hue-rotate"),
2762
+ property("--tw-invert"),
2763
+ property("--tw-opacity"),
2764
+ property("--tw-saturate"),
2765
+ property("--tw-sepia")
2766
+ ]);
2767
+ };
2768
+ let backdropFilterProperties = () => {
2769
+ return atRoot([
2770
+ property("--tw-backdrop-blur"),
2771
+ property("--tw-backdrop-brightness"),
2772
+ property("--tw-backdrop-contrast"),
2773
+ property("--tw-backdrop-grayscale"),
2774
+ property("--tw-backdrop-hue-rotate"),
2775
+ property("--tw-backdrop-invert"),
2776
+ property("--tw-backdrop-opacity"),
2777
+ property("--tw-backdrop-saturate"),
2778
+ property("--tw-backdrop-sepia")
2779
+ ]);
2780
+ };
2781
+ utilities.functional("filter", (candidate) => {
2782
+ if (candidate.negative) {
2783
+ return;
2784
+ }
2785
+ if (candidate.value === null) {
2786
+ return [filterProperties(), decl("filter", cssFilterValue)];
2787
+ }
2788
+ if (candidate.value.kind === "arbitrary") {
2789
+ return;
2790
+ }
2791
+ switch (candidate.value.value) {
2792
+ case "none":
2793
+ return [decl("filter", "none")];
2794
+ }
2795
+ });
2796
+ utilities.functional("backdrop-filter", (candidate) => {
2797
+ if (candidate.negative) {
2798
+ return;
2799
+ }
2800
+ if (candidate.value === null) {
2801
+ return [
2802
+ backdropFilterProperties(),
2803
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2804
+ decl("backdrop-filter", cssBackdropFilterValue)
2805
+ ];
2806
+ }
2807
+ if (candidate.value.kind === "arbitrary") {
2808
+ return;
2809
+ }
2810
+ switch (candidate.value.value) {
2811
+ case "none":
2812
+ return [decl("-webkit-backdrop-filter", "none"), decl("backdrop-filter", "none")];
2813
+ }
2814
+ });
2815
+ functionalUtility("blur", {
2816
+ themeKeys: ["--blur"],
2817
+ handle: (value) => [
2818
+ filterProperties(),
2819
+ decl("--tw-blur", `blur(${value})`),
2820
+ decl("filter", cssFilterValue)
2821
+ ]
2822
+ });
2823
+ functionalUtility("backdrop-blur", {
2824
+ themeKeys: ["--backdrop-blur", "--blur"],
2825
+ handle: (value) => [
2826
+ backdropFilterProperties(),
2827
+ decl("--tw-backdrop-blur", `blur(${value})`),
2828
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2829
+ decl("backdrop-filter", cssBackdropFilterValue)
2830
+ ]
2831
+ });
2832
+ functionalUtility("brightness", {
2833
+ themeKeys: ["--brightness"],
2834
+ handleBareValue: ({ value }) => `${value}%`,
2835
+ handle: (value) => [
2836
+ filterProperties(),
2837
+ decl("--tw-brightness", `brightness(${value})`),
2838
+ decl("filter", cssFilterValue)
2839
+ ]
2840
+ });
2841
+ functionalUtility("backdrop-brightness", {
2842
+ themeKeys: ["--backdrop-brightness", "--brightness"],
2843
+ handleBareValue: ({ value }) => `${value}%`,
2844
+ handle: (value) => [
2845
+ backdropFilterProperties(),
2846
+ decl("--tw-backdrop-brightness", `brightness(${value})`),
2847
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2848
+ decl("backdrop-filter", cssBackdropFilterValue)
2849
+ ]
2850
+ });
2851
+ functionalUtility("contrast", {
2852
+ themeKeys: ["--contrast"],
2853
+ handleBareValue: ({ value }) => `${value}%`,
2854
+ handle: (value) => [
2855
+ filterProperties(),
2856
+ decl("--tw-contrast", `contrast(${value})`),
2857
+ decl("filter", cssFilterValue)
2858
+ ]
2859
+ });
2860
+ functionalUtility("backdrop-contrast", {
2861
+ themeKeys: ["--backdrop-contrast", "--contrast"],
2862
+ handleBareValue: ({ value }) => `${value}%`,
2863
+ handle: (value) => [
2864
+ backdropFilterProperties(),
2865
+ decl("--tw-backdrop-contrast", `contrast(${value})`),
2866
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2867
+ decl("backdrop-filter", cssBackdropFilterValue)
2868
+ ]
2869
+ });
2870
+ functionalUtility("grayscale", {
2871
+ themeKeys: ["--grayscale"],
2872
+ handleBareValue: ({ value }) => `${value}%`,
2873
+ defaultValue: "100%",
2874
+ handle: (value) => [
2875
+ filterProperties(),
2876
+ decl("--tw-grayscale", `grayscale(${value})`),
2877
+ decl("filter", cssFilterValue)
2878
+ ]
2879
+ });
2880
+ functionalUtility("backdrop-grayscale", {
2881
+ themeKeys: ["--backdrop-grayscale", "--grayscale"],
2882
+ handleBareValue: ({ value }) => `${value}%`,
2883
+ defaultValue: "100%",
2884
+ handle: (value) => [
2885
+ backdropFilterProperties(),
2886
+ decl("--tw-backdrop-grayscale", `grayscale(${value})`),
2887
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2888
+ decl("backdrop-filter", cssBackdropFilterValue)
2889
+ ]
2890
+ });
2891
+ functionalUtility("hue-rotate", {
2892
+ themeKeys: ["--hue-rotate"],
2893
+ handleBareValue: ({ value }) => `${value}deg`,
2894
+ handle: (value) => [
2895
+ filterProperties(),
2896
+ decl("--tw-hue-rotate", `hue-rotate(${value})`),
2897
+ decl("filter", cssFilterValue)
2898
+ ]
2899
+ });
2900
+ functionalUtility("backdrop-hue-rotate", {
2901
+ themeKeys: ["--backdrop-hue-rotate", "--hue-rotate"],
2902
+ handleBareValue: ({ value }) => `${value}deg`,
2903
+ handle: (value) => [
2904
+ backdropFilterProperties(),
2905
+ decl("--tw-backdrop-hue-rotate", `hue-rotate(${value})`),
2906
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2907
+ decl("backdrop-filter", cssBackdropFilterValue)
2908
+ ]
2909
+ });
2910
+ functionalUtility("invert", {
2911
+ themeKeys: ["--invert"],
2912
+ handleBareValue: ({ value }) => `${value}%`,
2913
+ defaultValue: "100%",
2914
+ handle: (value) => [
2915
+ filterProperties(),
2916
+ decl("--tw-invert", `invert(${value})`),
2917
+ decl("filter", cssFilterValue)
2918
+ ]
2919
+ });
2920
+ functionalUtility("backdrop-invert", {
2921
+ themeKeys: ["--backdrop-invert", "--invert"],
2922
+ handleBareValue: ({ value }) => `${value}%`,
2923
+ defaultValue: "100%",
2924
+ handle: (value) => [
2925
+ backdropFilterProperties(),
2926
+ decl("--tw-backdrop-invert", `invert(${value})`),
2927
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2928
+ decl("backdrop-filter", cssBackdropFilterValue)
2929
+ ]
2930
+ });
2931
+ functionalUtility("saturate", {
2932
+ themeKeys: ["--saturate"],
2933
+ handleBareValue: ({ value }) => `${value}%`,
2934
+ handle: (value) => [
2935
+ filterProperties(),
2936
+ decl("--tw-saturate", `saturate(${value})`),
2937
+ decl("filter", cssFilterValue)
2938
+ ]
2939
+ });
2940
+ functionalUtility("backdrop-saturate", {
2941
+ themeKeys: ["--backdrop-saturate", "--saturate"],
2942
+ handleBareValue: ({ value }) => `${value}%`,
2943
+ handle: (value) => [
2944
+ backdropFilterProperties(),
2945
+ decl("--tw-backdrop-saturate", `saturate(${value})`),
2946
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2947
+ decl("backdrop-filter", cssBackdropFilterValue)
2948
+ ]
2949
+ });
2950
+ functionalUtility("sepia", {
2951
+ themeKeys: ["--sepia"],
2952
+ handleBareValue: ({ value }) => `${value}%`,
2953
+ defaultValue: "100%",
2954
+ handle: (value) => [
2955
+ filterProperties(),
2956
+ decl("--tw-sepia", `sepia(${value})`),
2957
+ decl("filter", cssFilterValue)
2958
+ ]
2959
+ });
2960
+ functionalUtility("backdrop-sepia", {
2961
+ themeKeys: ["--backdrop-sepia", "--sepia"],
2962
+ handleBareValue: ({ value }) => `${value}%`,
2963
+ defaultValue: "100%",
2964
+ handle: (value) => [
2965
+ backdropFilterProperties(),
2966
+ decl("--tw-backdrop-sepia", `sepia(${value})`),
2967
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2968
+ decl("backdrop-filter", cssBackdropFilterValue)
2969
+ ]
2970
+ });
2971
+ functionalUtility("drop-shadow", {
2972
+ themeKeys: ["--drop-shadow"],
2973
+ handle: (value) => [
2974
+ filterProperties(),
2975
+ decl(
2976
+ "--tw-drop-shadow",
2977
+ segment(value, ",").map((v) => `drop-shadow(${v})`).join(" ")
2978
+ ),
2979
+ decl("filter", cssFilterValue)
2980
+ ]
2981
+ });
2982
+ functionalUtility("backdrop-opacity", {
2983
+ themeKeys: ["--backdrop-opacity", "--opacity"],
2984
+ handleBareValue: ({ value }) => `${value}%`,
2985
+ defaultValue: "100%",
2986
+ handle: (value) => [
2987
+ backdropFilterProperties(),
2988
+ decl("--tw-backdrop-opacity", `opacity(${value})`),
2989
+ decl("-webkit-backdrop-filter", cssBackdropFilterValue),
2990
+ decl("backdrop-filter", cssBackdropFilterValue)
2991
+ ]
2992
+ });
2993
+ }
2994
+ {
2995
+ let defaultTimingFunction = "var(--default-transition-timing-function)";
2996
+ let defaultDuration = "var(--default-transition-duration)";
2997
+ staticUtility("transition-none", [["transition-property", "none"]]);
2998
+ staticUtility("transition-all", [
2999
+ ["transition-property", "all"],
3000
+ ["transition-timing-function", defaultTimingFunction],
3001
+ ["transition-duration", defaultDuration]
3002
+ ]);
3003
+ staticUtility("transition-colors", [
3004
+ [
3005
+ "transition-property",
3006
+ "color, background-color, border-color, text-decoration-color, fill, stroke"
3007
+ ],
3008
+ ["transition-timing-function", defaultTimingFunction],
3009
+ ["transition-duration", defaultDuration]
3010
+ ]);
3011
+ staticUtility("transition-opacity", [
3012
+ ["transition-property", "opacity"],
3013
+ ["transition-timing-function", defaultTimingFunction],
3014
+ ["transition-duration", defaultDuration]
3015
+ ]);
3016
+ staticUtility("transition-shadow", [
3017
+ ["transition-property", "box-shadow"],
3018
+ ["transition-timing-function", defaultTimingFunction],
3019
+ ["transition-duration", defaultDuration]
3020
+ ]);
3021
+ staticUtility("transition-transform", [
3022
+ ["transition-property", "transform, translate, scale, rotate"],
3023
+ ["transition-timing-function", defaultTimingFunction],
3024
+ ["transition-duration", defaultDuration]
3025
+ ]);
3026
+ functionalUtility("transition", {
3027
+ defaultValue: "color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter",
3028
+ themeKeys: ["--transition-property"],
3029
+ handle: (value) => [
3030
+ decl("transition-property", value),
3031
+ decl("transition-timing-function", defaultTimingFunction),
3032
+ decl("transition-duration", defaultDuration)
3033
+ ]
3034
+ });
3035
+ functionalUtility("delay", {
3036
+ handleBareValue: ({ value }) => `${value}ms`,
3037
+ themeKeys: ["--transition-delay"],
3038
+ handle: (value) => [decl("transition-delay", value)]
3039
+ });
3040
+ utilities.functional("duration", (candidate) => {
3041
+ if (candidate.negative)
3042
+ return;
3043
+ if (!candidate.value)
3044
+ return;
3045
+ let value = null;
3046
+ if (candidate.value.kind === "arbitrary") {
3047
+ value = candidate.value.value;
3048
+ } else {
3049
+ value = theme.resolve(candidate.value.fraction ?? candidate.value.value, [
3050
+ "--transition-duration"
3051
+ ]);
3052
+ if (!value && !isNaN(Number(candidate.value.value))) {
3053
+ value = `${candidate.value.value}ms`;
3054
+ }
3055
+ if (!value)
3056
+ return;
3057
+ }
3058
+ return [decl("transition-duration", value)];
3059
+ });
3060
+ }
3061
+ functionalUtility("ease", {
3062
+ themeKeys: ["--transition-timing-function"],
3063
+ handle: (value) => [decl("transition-timing-function", value)]
3064
+ });
3065
+ staticUtility("will-change-auto", [["will-change", "auto"]]);
3066
+ staticUtility("will-change-scroll", [["will-change", "scroll-position"]]);
3067
+ staticUtility("will-change-contents", [["will-change", "contents"]]);
3068
+ staticUtility("will-change-transform", [["will-change", "transform"]]);
3069
+ functionalUtility("will-change", {
3070
+ themeKeys: [],
3071
+ handle: (value) => [decl("will-change", value)]
3072
+ });
3073
+ staticUtility("content-none", [["content", "none"]]);
3074
+ functionalUtility("content", {
3075
+ themeKeys: [],
3076
+ handle: (value) => [
3077
+ atRoot([property("--tw-content", '""')]),
3078
+ decl("--tw-content", value),
3079
+ decl("content", "var(--tw-content)")
3080
+ ]
3081
+ });
3082
+ {
3083
+ let cssContainValue = "var(--tw-contain-size) var(--tw-contain-layout) var(--tw-contain-paint) var(--tw-contain-style)";
3084
+ let cssContainProperties = () => {
3085
+ return atRoot([
3086
+ property("--tw-contain-size"),
3087
+ property("--tw-contain-layout"),
3088
+ property("--tw-contain-paint"),
3089
+ property("--tw-contain-style")
3090
+ ]);
3091
+ };
3092
+ staticUtility("contain-none", [["contain", "none"]]);
3093
+ staticUtility("contain-content", [["contain", "content"]]);
3094
+ staticUtility("contain-strict", [["contain", "strict"]]);
3095
+ staticUtility("contain-size", [
3096
+ cssContainProperties,
3097
+ ["--tw-contain-size", "size"],
3098
+ ["contain", cssContainValue]
3099
+ ]);
3100
+ staticUtility("contain-inline-size", [
3101
+ cssContainProperties,
3102
+ ["--tw-contain-size", "inline-size"],
3103
+ ["contain", cssContainValue]
3104
+ ]);
3105
+ staticUtility("contain-layout", [
3106
+ cssContainProperties,
3107
+ ["--tw-contain-layout", "layout"],
3108
+ ["contain", cssContainValue]
3109
+ ]);
3110
+ staticUtility("contain-paint", [
3111
+ cssContainProperties,
3112
+ ["--tw-contain-paint", "paint"],
3113
+ ["contain", cssContainValue]
3114
+ ]);
3115
+ staticUtility("contain-style", [
3116
+ cssContainProperties,
3117
+ ["--tw-contain-style", "style"],
3118
+ ["contain", cssContainValue]
3119
+ ]);
3120
+ functionalUtility("contain", {
3121
+ themeKeys: [],
3122
+ handle: (value) => [decl("contain", value)]
3123
+ });
3124
+ }
3125
+ staticUtility("forced-color-adjust-none", [["forced-color-adjust", "none"]]);
3126
+ staticUtility("forced-color-adjust-auto", [["forced-color-adjust", "auto"]]);
3127
+ functionalUtility("leading", {
3128
+ themeKeys: ["--line-height"],
3129
+ handle: (value) => [decl("line-height", value)]
3130
+ });
3131
+ functionalUtility("tracking", {
3132
+ supportsNegative: true,
3133
+ themeKeys: ["--letter-spacing"],
3134
+ handle: (value) => [decl("letter-spacing", value)]
3135
+ });
3136
+ staticUtility("antialiased", [
3137
+ ["-webkit-font-smoothing", "antialiased"],
3138
+ ["-moz-osx-font-smoothing", "grayscale"]
3139
+ ]);
3140
+ staticUtility("subpixel-antialiased", [
3141
+ ["-webkit-font-smoothing", "auto"],
3142
+ ["-moz-osx-font-smoothing", "auto"]
3143
+ ]);
3144
+ {
3145
+ let cssFontVariantNumericValue = "var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)";
3146
+ let fontVariantNumericProperties = () => {
3147
+ return atRoot([
3148
+ property("--tw-ordinal"),
3149
+ property("--tw-slashed-zero"),
3150
+ property("--tw-numeric-figure"),
3151
+ property("--tw-numeric-spacing"),
3152
+ property("--tw-numeric-fraction")
3153
+ ]);
3154
+ };
3155
+ staticUtility("normal-nums", [["font-variant-numeric", "normal"]]);
3156
+ staticUtility("ordinal", [
3157
+ fontVariantNumericProperties,
3158
+ ["--tw-ordinal", "ordinal"],
3159
+ ["font-variant-numeric", cssFontVariantNumericValue]
3160
+ ]);
3161
+ staticUtility("slashed-zero", [
3162
+ fontVariantNumericProperties,
3163
+ ["--tw-slashed-zero", "slashed-zero"],
3164
+ ["font-variant-numeric", cssFontVariantNumericValue]
3165
+ ]);
3166
+ staticUtility("lining-nums", [
3167
+ fontVariantNumericProperties,
3168
+ ["--tw-numeric-figure", "lining-nums"],
3169
+ ["font-variant-numeric", cssFontVariantNumericValue]
3170
+ ]);
3171
+ staticUtility("oldstyle-nums", [
3172
+ fontVariantNumericProperties,
3173
+ ["--tw-numeric-figure", "oldstyle-nums"],
3174
+ ["font-variant-numeric", cssFontVariantNumericValue]
3175
+ ]);
3176
+ staticUtility("proportional-nums", [
3177
+ fontVariantNumericProperties,
3178
+ ["--tw-numeric-spacing", "proportional-nums"],
3179
+ ["font-variant-numeric", cssFontVariantNumericValue]
3180
+ ]);
3181
+ staticUtility("tabular-nums", [
3182
+ fontVariantNumericProperties,
3183
+ ["--tw-numeric-spacing", "tabular-nums"],
3184
+ ["font-variant-numeric", cssFontVariantNumericValue]
3185
+ ]);
3186
+ staticUtility("diagonal-fractions", [
3187
+ fontVariantNumericProperties,
3188
+ ["--tw-numeric-fraction", "diagonal-fractions"],
3189
+ ["font-variant-numeric", cssFontVariantNumericValue]
3190
+ ]);
3191
+ staticUtility("stacked-fractions", [
3192
+ fontVariantNumericProperties,
3193
+ ["--tw-numeric-fraction", "stacked-fractions"],
3194
+ ["font-variant-numeric", cssFontVariantNumericValue]
3195
+ ]);
3196
+ }
3197
+ staticUtility("outline-none", [
3198
+ ["outline", "2px solid transparent"],
3199
+ ["outline-offset", "2px"]
3200
+ ]);
3201
+ staticUtility("outline-dashed", [["outline-style", "dashed"]]);
3202
+ staticUtility("outline-dotted", [["outline-style", "dotted"]]);
3203
+ staticUtility("outline-double", [["outline-style", "double"]]);
3204
+ utilities.functional("outline", (candidate) => {
3205
+ if (candidate.negative) {
3206
+ return;
3207
+ }
3208
+ if (candidate.value === null) {
3209
+ return [decl("outline-style", "solid")];
3210
+ }
3211
+ if (candidate.value.kind === "arbitrary") {
3212
+ let value = candidate.value.value;
3213
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "number", "percentage"]);
3214
+ switch (type) {
3215
+ case "length":
3216
+ case "number":
3217
+ case "percentage": {
3218
+ return [decl("outline-width", value)];
3219
+ }
3220
+ default: {
3221
+ value = asColor(value, candidate.modifier, theme);
3222
+ return [decl("outline-color", value)];
3223
+ }
3224
+ }
3225
+ }
3226
+ {
3227
+ let value = resolveThemeColor(candidate, theme, ["--outline-color", "--color"]);
3228
+ if (value) {
3229
+ return [decl("outline-color", value)];
3230
+ }
3231
+ }
3232
+ {
3233
+ let value = theme.resolve(candidate.value.value, ["--outline-width"]);
3234
+ if (value) {
3235
+ return [decl("outline-width", value)];
3236
+ } else if (!isNaN(Number(candidate.value.value))) {
3237
+ return [decl("outline-width", `${candidate.value.value}px`)];
3238
+ }
3239
+ }
3240
+ });
3241
+ functionalUtility("outline-offset", {
3242
+ supportsNegative: true,
3243
+ themeKeys: ["--outline-offset"],
3244
+ handleBareValue: ({ value }) => `${value}px`,
3245
+ handle: (value) => [decl("outline-offset", value)]
3246
+ });
3247
+ functionalUtility("opacity", {
3248
+ themeKeys: ["--opacity"],
3249
+ handleBareValue: ({ value }) => `${value}%`,
3250
+ handle: (value) => [decl("opacity", value)]
3251
+ });
3252
+ staticUtility("underline-offset-auto", [["text-underline-offset", "auto"]]);
3253
+ functionalUtility("underline-offset", {
3254
+ supportsNegative: true,
3255
+ themeKeys: ["--text-underline-offset"],
3256
+ handleBareValue: ({ value }) => `${value}px`,
3257
+ handle: (value) => [decl("text-underline-offset", value)]
3258
+ });
3259
+ utilities.functional("text", (candidate) => {
3260
+ if (candidate.negative || !candidate.value) {
3261
+ return;
3262
+ }
3263
+ if (candidate.value.kind === "arbitrary") {
3264
+ let value = candidate.value.value;
3265
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage", "absolute-size", "relative-size"]);
3266
+ switch (type) {
3267
+ case "size":
3268
+ case "length":
3269
+ case "percentage":
3270
+ case "absolute-size":
3271
+ case "relative-size": {
3272
+ if (candidate.modifier) {
3273
+ let modifier = candidate.modifier.kind === "arbitrary" ? candidate.modifier.value : theme.resolve(candidate.modifier.value, ["--line-height"]);
3274
+ if (modifier) {
3275
+ return [decl("font-size", value), decl("line-height", modifier)];
3276
+ }
3277
+ }
3278
+ return [decl("font-size", value)];
3279
+ }
3280
+ default: {
3281
+ value = asColor(value, candidate.modifier, theme);
3282
+ return [decl("color", value)];
3283
+ }
3284
+ }
3285
+ }
3286
+ {
3287
+ let value = resolveThemeColor(candidate, theme, ["--text-color", "--color"]);
3288
+ if (value) {
3289
+ return [decl("color", value)];
3290
+ }
3291
+ }
3292
+ {
3293
+ let value = theme.resolveWith(
3294
+ candidate.value.value,
3295
+ ["--font-size"],
3296
+ ["--line-height", "--letter-spacing", "--font-weight"]
3297
+ );
3298
+ if (value) {
3299
+ let [fontSize, options = {}] = Array.isArray(value) ? value : [value];
3300
+ if (candidate.modifier) {
3301
+ let modifier = candidate.modifier.kind === "arbitrary" ? candidate.modifier.value : theme.resolve(candidate.modifier.value, ["--line-height"]);
3302
+ let declarations = [decl("font-size", fontSize)];
3303
+ modifier && declarations.push(decl("line-height", modifier));
3304
+ return declarations;
3305
+ }
3306
+ if (typeof options === "string") {
3307
+ return [decl("font-size", fontSize), decl("line-height", options)];
3308
+ }
3309
+ return [
3310
+ decl("font-size", fontSize),
3311
+ decl("line-height", options["--line-height"]),
3312
+ decl("letter-spacing", options["--letter-spacing"]),
3313
+ decl("font-weight", options["--font-weight"])
3314
+ ];
3315
+ }
3316
+ }
3317
+ });
3318
+ {
3319
+ let ringShadowValue2 = function(value) {
3320
+ return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color, var(--default-ring-color))`;
3321
+ }, insetRingShadowValue2 = function(value) {
3322
+ return `inset 0 0 0 ${value} var(--tw-inset-ring-color, currentColor)`;
3323
+ };
3324
+ let cssBoxShadowValue = [
3325
+ `var(--tw-inset-shadow)`,
3326
+ `var(--tw-inset-ring-shadow)`,
3327
+ `var(--tw-ring-offset-shadow)`,
3328
+ `var(--tw-ring-shadow)`,
3329
+ `var(--tw-shadow)`
3330
+ ].join(", ");
3331
+ let nullShadow = "0 0 #0000";
3332
+ let boxShadowProperties = () => {
3333
+ return atRoot([
3334
+ property("--tw-shadow", nullShadow),
3335
+ property("--tw-shadow-colored", nullShadow),
3336
+ property("--tw-inset-shadow", nullShadow),
3337
+ property("--tw-inset-shadow-colored", nullShadow),
3338
+ property("--tw-ring-color"),
3339
+ property("--tw-ring-shadow", nullShadow),
3340
+ property("--tw-inset-ring-color"),
3341
+ property("--tw-inset-ring-shadow", nullShadow),
3342
+ // Legacy
3343
+ property("--tw-ring-inset"),
3344
+ property("--tw-ring-offset-width", "0px", "<length>"),
3345
+ property("--tw-ring-offset-color", "#fff"),
3346
+ property("--tw-ring-offset-shadow", nullShadow)
3347
+ ]);
3348
+ };
3349
+ utilities.functional("shadow", (candidate) => {
3350
+ if (candidate.negative) {
3351
+ return;
3352
+ }
3353
+ if (!candidate.value) {
3354
+ let value = theme.get(["--shadow"]);
3355
+ if (!value)
3356
+ return;
3357
+ return [
3358
+ boxShadowProperties(),
3359
+ decl("--tw-shadow", value),
3360
+ decl("--tw-shadow-colored", replaceShadowColors(value, "var(--tw-shadow-color)")),
3361
+ decl("box-shadow", cssBoxShadowValue)
3362
+ ];
3363
+ }
3364
+ if (candidate.value.kind === "arbitrary") {
3365
+ let value = candidate.value.value;
3366
+ let type = candidate.value.dataType ?? inferDataType(value, ["color"]);
3367
+ switch (type) {
3368
+ case "color": {
3369
+ value = asColor(value, candidate.modifier, theme);
3370
+ return [
3371
+ boxShadowProperties(),
3372
+ decl("--tw-shadow-color", value),
3373
+ decl("--tw-shadow", "var(--tw-shadow-colored)")
3374
+ ];
3375
+ }
3376
+ default: {
3377
+ return [
3378
+ boxShadowProperties(),
3379
+ decl("--tw-shadow", value),
3380
+ decl("--tw-shadow-colored", replaceShadowColors(value, "var(--tw-shadow-color)")),
3381
+ decl("box-shadow", cssBoxShadowValue)
3382
+ ];
3383
+ }
3384
+ }
3385
+ }
3386
+ switch (candidate.value.value) {
3387
+ case "none":
3388
+ return [
3389
+ boxShadowProperties(),
3390
+ decl("--tw-shadow", nullShadow),
3391
+ decl("--tw-shadow-colored", nullShadow),
3392
+ decl("box-shadow", cssBoxShadowValue)
3393
+ ];
3394
+ }
3395
+ {
3396
+ let value = theme.resolve(candidate.value.value, ["--shadow"]);
3397
+ if (value) {
3398
+ return [
3399
+ boxShadowProperties(),
3400
+ decl("--tw-shadow", value),
3401
+ decl("--tw-shadow-colored", replaceShadowColors(value, "var(--tw-shadow-color)")),
3402
+ decl("box-shadow", cssBoxShadowValue)
3403
+ ];
3404
+ }
3405
+ }
3406
+ {
3407
+ let value = resolveThemeColor(candidate, theme, ["--box-shadow-color", "--color"]);
3408
+ if (value) {
3409
+ return [
3410
+ boxShadowProperties(),
3411
+ decl("--tw-shadow-color", value),
3412
+ decl("--tw-shadow", "var(--tw-shadow-colored)")
3413
+ ];
3414
+ }
3415
+ }
3416
+ });
3417
+ utilities.functional("inset-shadow", (candidate) => {
3418
+ if (candidate.negative) {
3419
+ return;
3420
+ }
3421
+ if (!candidate.value) {
3422
+ let value = theme.get(["--inset-shadow"]);
3423
+ if (!value)
3424
+ return;
3425
+ return [
3426
+ boxShadowProperties(),
3427
+ decl("--tw-inset-shadow", value),
3428
+ decl(
3429
+ "--tw-inset-shadow-colored",
3430
+ replaceShadowColors(value, "var(--tw-inset-shadow-color)")
3431
+ ),
3432
+ decl("box-shadow", cssBoxShadowValue)
3433
+ ];
3434
+ }
3435
+ if (candidate.value.kind === "arbitrary") {
3436
+ let value = candidate.value.value;
3437
+ let type = candidate.value.dataType ?? inferDataType(value, ["color"]);
3438
+ switch (type) {
3439
+ case "color": {
3440
+ value = asColor(value, candidate.modifier, theme);
3441
+ return [
3442
+ boxShadowProperties(),
3443
+ decl("--tw-inset-shadow-color", value),
3444
+ decl("--tw-inset-shadow", "var(--tw-inset-shadow-colored)")
3445
+ ];
3446
+ }
3447
+ default: {
3448
+ return [
3449
+ boxShadowProperties(),
3450
+ decl("--tw-inset-shadow", `inset ${value}`),
3451
+ decl(
3452
+ "--tw-inset-shadow-colored",
3453
+ replaceShadowColors(`inset ${value}`, "var(--tw-inset-shadow-color)")
3454
+ ),
3455
+ decl("box-shadow", cssBoxShadowValue)
3456
+ ];
3457
+ }
3458
+ }
3459
+ }
3460
+ switch (candidate.value.value) {
3461
+ case "none":
3462
+ return [
3463
+ boxShadowProperties(),
3464
+ decl("--tw-inset-shadow", nullShadow),
3465
+ decl("--tw-inset-shadow-colored", nullShadow),
3466
+ decl("box-shadow", cssBoxShadowValue)
3467
+ ];
3468
+ }
3469
+ {
3470
+ let value = theme.resolve(candidate.value.value, ["--inset-shadow"]);
3471
+ if (value) {
3472
+ return [
3473
+ boxShadowProperties(),
3474
+ decl("--tw-inset-shadow", value),
3475
+ decl(
3476
+ "--tw-inset-shadow-colored",
3477
+ replaceShadowColors(value, "var(--tw-inset-shadow-color)")
3478
+ ),
3479
+ decl("box-shadow", cssBoxShadowValue)
3480
+ ];
3481
+ }
3482
+ }
3483
+ {
3484
+ let value = resolveThemeColor(candidate, theme, ["--box-shadow-color", "--color"]);
3485
+ if (value) {
3486
+ return [
3487
+ boxShadowProperties(),
3488
+ decl("--tw-inset-shadow-color", value),
3489
+ decl("--tw-inset-shadow", "var(--tw-inset-shadow-colored)")
3490
+ ];
3491
+ }
3492
+ }
3493
+ });
3494
+ staticUtility("ring-inset", [boxShadowProperties, ["--tw-ring-inset", "inset"]]);
3495
+ utilities.functional("ring", (candidate) => {
3496
+ if (candidate.negative)
3497
+ return;
3498
+ if (!candidate.value) {
3499
+ return [
3500
+ boxShadowProperties(),
3501
+ decl("--tw-ring-shadow", ringShadowValue2("var(--default-ring-width)")),
3502
+ decl("box-shadow", cssBoxShadowValue)
3503
+ ];
3504
+ }
3505
+ if (candidate.value.kind === "arbitrary") {
3506
+ let value = candidate.value.value;
3507
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length"]);
3508
+ switch (type) {
3509
+ case "length": {
3510
+ return [
3511
+ boxShadowProperties(),
3512
+ decl("--tw-ring-shadow", ringShadowValue2(value)),
3513
+ decl("box-shadow", cssBoxShadowValue)
3514
+ ];
3515
+ }
3516
+ default: {
3517
+ value = asColor(value, candidate.modifier, theme);
3518
+ return [decl("--tw-ring-color", value)];
3519
+ }
3520
+ }
3521
+ }
3522
+ {
3523
+ let value = resolveThemeColor(candidate, theme, ["--ring-color", "--color"]);
3524
+ if (value) {
3525
+ return [decl("--tw-ring-color", value)];
3526
+ }
3527
+ }
3528
+ {
3529
+ let value = theme.resolve(candidate.value.value, ["--ring-width"]);
3530
+ if (!value && !isNaN(Number(candidate.value.value))) {
3531
+ value = `${candidate.value.value}px`;
3532
+ }
3533
+ if (value) {
3534
+ return [
3535
+ boxShadowProperties(),
3536
+ decl("--tw-ring-shadow", ringShadowValue2(value)),
3537
+ decl("box-shadow", cssBoxShadowValue)
3538
+ ];
3539
+ }
3540
+ }
3541
+ });
3542
+ utilities.functional("inset-ring", (candidate) => {
3543
+ if (candidate.negative)
3544
+ return;
3545
+ if (!candidate.value) {
3546
+ return [
3547
+ boxShadowProperties(),
3548
+ decl("--tw-inset-ring-shadow", insetRingShadowValue2("1px")),
3549
+ decl("box-shadow", cssBoxShadowValue)
3550
+ ];
3551
+ }
3552
+ if (candidate.value.kind === "arbitrary") {
3553
+ let value = candidate.value.value;
3554
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length"]);
3555
+ switch (type) {
3556
+ case "length": {
3557
+ return [
3558
+ boxShadowProperties(),
3559
+ decl("--tw-inset-ring-shadow", insetRingShadowValue2(value)),
3560
+ decl("box-shadow", cssBoxShadowValue)
3561
+ ];
3562
+ }
3563
+ default: {
3564
+ value = asColor(value, candidate.modifier, theme);
3565
+ return [decl("--tw-inset-ring-color", value)];
3566
+ }
3567
+ }
3568
+ }
3569
+ {
3570
+ let value = resolveThemeColor(candidate, theme, ["--ring-color", "--color"]);
3571
+ if (value) {
3572
+ return [decl("--tw-inset-ring-color", value)];
3573
+ }
3574
+ }
3575
+ {
3576
+ let value = theme.resolve(candidate.value.value, ["--ring-width"]);
3577
+ if (!value && !isNaN(Number(candidate.value.value))) {
3578
+ value = `${candidate.value.value}px`;
3579
+ }
3580
+ if (value) {
3581
+ return [
3582
+ boxShadowProperties(),
3583
+ decl("--tw-inset-ring-shadow", insetRingShadowValue2(value)),
3584
+ decl("box-shadow", cssBoxShadowValue)
3585
+ ];
3586
+ }
3587
+ }
3588
+ });
3589
+ let ringOffsetShadowValue = "var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)";
3590
+ utilities.functional("ring-offset", (candidate) => {
3591
+ if (candidate.negative || !candidate.value) {
3592
+ return;
3593
+ }
3594
+ if (candidate.value.kind === "arbitrary") {
3595
+ let value = candidate.value.value;
3596
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length"]);
3597
+ switch (type) {
3598
+ case "length": {
3599
+ return [
3600
+ decl("--tw-ring-offset-width", value),
3601
+ decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
3602
+ ];
3603
+ }
3604
+ default: {
3605
+ value = asColor(value, candidate.modifier, theme);
3606
+ return [decl("--tw-ring-offset-color", value)];
3607
+ }
3608
+ }
3609
+ }
3610
+ {
3611
+ let value = theme.resolve(candidate.value.value, ["--ring-offset-width"]);
3612
+ if (value) {
3613
+ return [
3614
+ decl("--tw-ring-offset-width", value),
3615
+ decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
3616
+ ];
3617
+ } else if (!isNaN(Number(candidate.value.value))) {
3618
+ return [
3619
+ decl("--tw-ring-offset-width", `${candidate.value.value}px`),
3620
+ decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
3621
+ ];
3622
+ }
3623
+ }
3624
+ {
3625
+ let value = resolveThemeColor(candidate, theme, ["--ring-offset-color", "--color"]);
3626
+ if (value) {
3627
+ return [decl("--tw-ring-offset-color", value)];
3628
+ }
3629
+ }
3630
+ });
3631
+ }
3632
+ return utilities;
3633
+ }
3634
+
3635
+ // src/utils/default-map.ts
3636
+ var DefaultMap = class extends Map {
3637
+ constructor(factory) {
3638
+ super();
3639
+ this.factory = factory;
3640
+ }
3641
+ get(key) {
3642
+ let value = super.get(key);
3643
+ if (value === void 0) {
3644
+ value = this.factory(key, this);
3645
+ this.set(key, value);
3646
+ }
3647
+ return value;
3648
+ }
3649
+ };
3650
+
3651
+ // src/variants.ts
3652
+ var Variants = class {
3653
+ compareFns = /* @__PURE__ */ new Map();
3654
+ variants = /* @__PURE__ */ new Map();
3655
+ /**
3656
+ * Registering a group of variants should result in the same sort number for
3657
+ * all the variants. This is to ensure that the variants are applied in the
3658
+ * correct order.
3659
+ */
3660
+ groupOrder = null;
3661
+ /**
3662
+ * Keep track of the last sort order instead of using the size of the map to
3663
+ * avoid unnecessarily skipping order numbers.
3664
+ */
3665
+ lastOrder = 0;
3666
+ static(name, applyFn, { compounds } = {}) {
3667
+ this.set(name, { kind: "static", applyFn, compounds: compounds ?? true });
3668
+ }
3669
+ functional(name, applyFn, { compounds } = {}) {
3670
+ this.set(name, { kind: "functional", applyFn, compounds: compounds ?? true });
3671
+ }
3672
+ compound(name, applyFn, { compounds } = {}) {
3673
+ this.set(name, { kind: "compound", applyFn, compounds: compounds ?? true });
3674
+ }
3675
+ group(fn, compareFn) {
3676
+ this.groupOrder = this.nextOrder();
3677
+ if (compareFn)
3678
+ this.compareFns.set(this.groupOrder, compareFn);
3679
+ fn();
3680
+ this.groupOrder = null;
3681
+ }
3682
+ has(name) {
3683
+ return this.variants.has(name);
3684
+ }
3685
+ get(name) {
3686
+ return this.variants.get(name)?.applyFn;
3687
+ }
3688
+ kind(name) {
3689
+ return this.variants.get(name)?.kind;
3690
+ }
3691
+ compounds(name) {
3692
+ return this.variants.get(name)?.compounds;
3693
+ }
3694
+ compare(a, z) {
3695
+ if (a === z)
3696
+ return 0;
3697
+ if (a === null)
3698
+ return -1;
3699
+ if (z === null)
3700
+ return 1;
3701
+ if (a.kind === "arbitrary" && z.kind === "arbitrary") {
3702
+ return a.selector.localeCompare(z.selector);
3703
+ } else if (a.kind === "arbitrary") {
3704
+ return 1;
3705
+ } else if (z.kind === "arbitrary") {
3706
+ return -1;
3707
+ }
3708
+ let aOrder = this.variants.get(a.root).order;
3709
+ let zOrder = this.variants.get(z.root).order;
3710
+ let orderedByVariant = aOrder - zOrder;
3711
+ if (orderedByVariant !== 0)
3712
+ return orderedByVariant;
3713
+ if (a.kind === "compound" && z.kind === "compound") {
3714
+ return this.compare(a.variant, z.variant);
3715
+ }
3716
+ let compareFn = this.compareFns.get(aOrder);
3717
+ if (compareFn === void 0)
3718
+ return 0;
3719
+ return compareFn(a, z);
3720
+ }
3721
+ keys() {
3722
+ return this.variants.keys();
3723
+ }
3724
+ set(name, { kind, applyFn, compounds }) {
3725
+ this.lastOrder = this.nextOrder();
3726
+ this.variants.set(name, {
3727
+ kind,
3728
+ applyFn,
3729
+ order: this.lastOrder,
3730
+ compounds
3731
+ });
3732
+ }
3733
+ nextOrder() {
3734
+ return this.groupOrder ?? this.lastOrder + 1;
3735
+ }
3736
+ };
3737
+ function createVariants(theme) {
3738
+ let variants = new Variants();
3739
+ function staticVariant(name, selectors, { compounds } = {}) {
3740
+ variants.static(
3741
+ name,
3742
+ (r) => {
3743
+ r.nodes = selectors.map((selector) => rule(selector, r.nodes));
3744
+ },
3745
+ { compounds }
3746
+ );
3747
+ }
3748
+ variants.static("force", () => {
3749
+ }, { compounds: false });
3750
+ staticVariant("*", ["& > *"], { compounds: false });
3751
+ variants.compound("not", (ruleNode) => {
3752
+ ruleNode.selector = `&:not(${ruleNode.selector.replace("&", "*")})`;
3753
+ });
3754
+ variants.compound("group", (ruleNode, variant) => {
3755
+ let groupSelector = variant.modifier ? `:where(.group\\/${variant.modifier.value})` : ":where(.group)";
3756
+ ruleNode.selector = ruleNode.selector.replace("&", groupSelector);
3757
+ ruleNode.selector = `&:is(${ruleNode.selector} *)`;
3758
+ });
3759
+ variants.compound("peer", (ruleNode, variant) => {
3760
+ let peerSelector = variant.modifier ? `:where(.peer\\/${variant.modifier.value})` : ":where(.peer)";
3761
+ ruleNode.selector = ruleNode.selector.replace("&", peerSelector);
3762
+ ruleNode.selector = `&:is(${ruleNode.selector} ~ *)`;
3763
+ });
3764
+ staticVariant("first-letter", ["&::first-letter"], { compounds: false });
3765
+ staticVariant("first-line", ["&::first-line"], { compounds: false });
3766
+ staticVariant("marker", ["& *::marker", "&::marker"], { compounds: false });
3767
+ staticVariant("selection", ["& *::selection", "&::selection"], { compounds: false });
3768
+ staticVariant("file", ["&::file-selector-button"], { compounds: false });
3769
+ staticVariant("placeholder", ["&::placeholder"], { compounds: false });
3770
+ staticVariant("backdrop", ["&::backdrop"], { compounds: false });
3771
+ {
3772
+ let contentProperties2 = function() {
3773
+ return rule("@at-root", [
3774
+ rule("@property --tw-content", [
3775
+ decl("syntax", '"*"'),
3776
+ decl("initial-value", '""'),
3777
+ decl("inherits", "false")
3778
+ ])
3779
+ ]);
3780
+ };
3781
+ variants.static(
3782
+ "before",
3783
+ (v) => {
3784
+ v.nodes = [
3785
+ rule("&::before", [
3786
+ contentProperties2(),
3787
+ decl("content", "var(--tw-content)"),
3788
+ ...v.nodes
3789
+ ])
3790
+ ];
3791
+ },
3792
+ { compounds: false }
3793
+ );
3794
+ variants.static(
3795
+ "after",
3796
+ (v) => {
3797
+ v.nodes = [
3798
+ rule("&::after", [contentProperties2(), decl("content", "var(--tw-content)"), ...v.nodes])
3799
+ ];
3800
+ },
3801
+ { compounds: false }
3802
+ );
3803
+ }
3804
+ let pseudos = [
3805
+ // Positional
3806
+ ["first", "&:first-child"],
3807
+ ["last", "&:last-child"],
3808
+ ["only", "&:only-child"],
3809
+ ["odd", "&:nth-child(odd)"],
3810
+ ["even", "&:nth-child(even)"],
3811
+ ["first-of-type", "&:first-of-type"],
3812
+ ["last-of-type", "&:last-of-type"],
3813
+ ["only-of-type", "&:only-of-type"],
3814
+ // State
3815
+ // TODO: Remove alpha vars or no?
3816
+ ["visited", "&:visited"],
3817
+ ["target", "&:target"],
3818
+ ["open", "&[open]"],
3819
+ // Forms
3820
+ ["default", "&:default"],
3821
+ ["checked", "&:checked"],
3822
+ ["indeterminate", "&:indeterminate"],
3823
+ ["placeholder-shown", "&:placeholder-shown"],
3824
+ ["autofill", "&:autofill"],
3825
+ ["optional", "&:optional"],
3826
+ ["required", "&:required"],
3827
+ ["valid", "&:valid"],
3828
+ ["invalid", "&:invalid"],
3829
+ ["in-range", "&:in-range"],
3830
+ ["out-of-range", "&:out-of-range"],
3831
+ ["read-only", "&:read-only"],
3832
+ // Content
3833
+ ["empty", "&:empty"],
3834
+ // Interactive
3835
+ ["focus-within", "&:focus-within"],
3836
+ [
3837
+ "hover",
3838
+ "&:hover"
3839
+ // TODO: Update tests for this:
3840
+ // v => {
3841
+ // v.nodes = [
3842
+ // rule('@media (hover: hover) and (pointer: fine)', [
3843
+ // rule('&:hover', v.nodes),
3844
+ // ]),
3845
+ // ]
3846
+ // }
3847
+ ],
3848
+ ["focus", "&:focus"],
3849
+ ["focus-visible", "&:focus-visible"],
3850
+ ["active", "&:active"],
3851
+ ["enabled", "&:enabled"],
3852
+ ["disabled", "&:disabled"]
3853
+ ];
3854
+ for (let [key, value] of pseudos) {
3855
+ staticVariant(key, [value]);
3856
+ }
3857
+ variants.compound("has", (ruleNode) => {
3858
+ ruleNode.selector = `&:has(${ruleNode.selector.replace("&", "*")})`;
3859
+ });
3860
+ variants.functional("aria", (ruleNode, variant) => {
3861
+ if (variant.value === null)
3862
+ return null;
3863
+ if (variant.value.kind == "arbitrary") {
3864
+ ruleNode.nodes = [rule(`&[aria-${variant.value.value}]`, ruleNode.nodes)];
3865
+ } else {
3866
+ ruleNode.nodes = [rule(`&[aria-${variant.value.value}="true"]`, ruleNode.nodes)];
3867
+ }
3868
+ });
3869
+ variants.functional("data", (ruleNode, variant) => {
3870
+ if (variant.value === null)
3871
+ return null;
3872
+ ruleNode.nodes = [rule(`&[data-${variant.value.value}]`, ruleNode.nodes)];
3873
+ });
3874
+ variants.functional(
3875
+ "supports",
3876
+ (ruleNode, variant) => {
3877
+ if (variant.value === null)
3878
+ return null;
3879
+ let value = variant.value.value;
3880
+ if (value === null)
3881
+ return null;
3882
+ if (/^\w*\s*\(/.test(value)) {
3883
+ let query = value.replace(/\b(and|or|not)\b/g, " $1 ");
3884
+ ruleNode.nodes = [rule(`@supports ${query}`, ruleNode.nodes)];
3885
+ return;
3886
+ }
3887
+ if (!value.includes(":")) {
3888
+ value = `${value}: var(--tw)`;
3889
+ }
3890
+ if (value[0] !== "(" || value[value.length - 1] !== ")") {
3891
+ value = `(${value})`;
3892
+ }
3893
+ ruleNode.nodes = [rule(`@supports ${value}`, ruleNode.nodes)];
3894
+ },
3895
+ { compounds: false }
3896
+ );
3897
+ staticVariant("motion-safe", ["@media (prefers-reduced-motion: no-preference)"], {
3898
+ compounds: false
3899
+ });
3900
+ staticVariant("motion-reduce", ["@media (prefers-reduced-motion: reduce)"], { compounds: false });
3901
+ staticVariant("contrast-more", ["@media (prefers-contrast: more)"], { compounds: false });
3902
+ staticVariant("contrast-less", ["@media (prefers-contrast: less)"], { compounds: false });
3903
+ {
3904
+ let compareBreakpoints2 = function(a, z, direction) {
3905
+ if (a === z)
3906
+ return 0;
3907
+ let aValue = resolvedBreakpoints.get(a);
3908
+ if (aValue === null)
3909
+ return direction === "asc" ? -1 : 1;
3910
+ let zValue = resolvedBreakpoints.get(z);
3911
+ if (zValue === null)
3912
+ return direction === "asc" ? 1 : -1;
3913
+ if (aValue === zValue)
3914
+ return 0;
3915
+ let aIsCssFunction = aValue.indexOf("(");
3916
+ let zIsCssFunction = zValue.indexOf("(");
3917
+ let aBucket = aIsCssFunction === -1 ? (
3918
+ // No CSS function found, bucket by unit instead
3919
+ aValue.replace(/[\d.]+/g, "")
3920
+ ) : (
3921
+ // CSS function found, bucket by function name
3922
+ aValue.slice(0, aIsCssFunction)
3923
+ );
3924
+ let zBucket = zIsCssFunction === -1 ? (
3925
+ // No CSS function found, bucket by unit
3926
+ zValue.replace(/[\d.]+/g, "")
3927
+ ) : (
3928
+ // CSS function found, bucket by function name
3929
+ zValue.slice(0, zIsCssFunction)
3930
+ );
3931
+ let order = (
3932
+ // Compare by bucket name
3933
+ aBucket.localeCompare(zBucket) || // If bucket names are the same, compare by value
3934
+ (direction === "asc" ? parseInt(aValue) - parseInt(zValue) : parseInt(zValue) - parseInt(aValue))
3935
+ );
3936
+ if (isNaN(order)) {
3937
+ return aValue.localeCompare(zValue);
3938
+ }
3939
+ return order;
3940
+ };
3941
+ let breakpoints = theme.namespace("--breakpoint");
3942
+ let resolvedBreakpoints = new DefaultMap((variant) => {
3943
+ switch (variant.kind) {
3944
+ case "static": {
3945
+ return breakpoints.get(variant.root) ?? null;
3946
+ }
3947
+ case "functional": {
3948
+ let value = null;
3949
+ if (variant.value.kind === "arbitrary") {
3950
+ value = variant.value.value;
3951
+ } else if (variant.value.kind === "named") {
3952
+ value = theme.resolve(variant.value.value, ["--breakpoint"]);
3953
+ }
3954
+ if (!value) {
3955
+ return null;
3956
+ }
3957
+ if (value.includes("var(")) {
3958
+ return null;
3959
+ }
3960
+ return value;
3961
+ }
3962
+ case "arbitrary":
3963
+ case "compound":
3964
+ return null;
3965
+ }
3966
+ });
3967
+ variants.group(
3968
+ () => {
3969
+ variants.functional(
3970
+ "max",
3971
+ (ruleNode, variant) => {
3972
+ let value = resolvedBreakpoints.get(variant);
3973
+ if (value === null)
3974
+ return null;
3975
+ ruleNode.nodes = [rule(`@media (width < ${value})`, ruleNode.nodes)];
3976
+ },
3977
+ { compounds: false }
3978
+ );
3979
+ },
3980
+ (a, z) => compareBreakpoints2(a, z, "desc")
3981
+ );
3982
+ variants.group(
3983
+ () => {
3984
+ for (let [key, value] of theme.namespace("--breakpoint")) {
3985
+ if (key === null)
3986
+ continue;
3987
+ variants.static(
3988
+ key,
3989
+ (ruleNode) => {
3990
+ ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
3991
+ },
3992
+ { compounds: false }
3993
+ );
3994
+ }
3995
+ variants.functional(
3996
+ "min",
3997
+ (ruleNode, variant) => {
3998
+ let value = resolvedBreakpoints.get(variant);
3999
+ if (value === null)
4000
+ return null;
4001
+ ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
4002
+ },
4003
+ { compounds: false }
4004
+ );
4005
+ },
4006
+ (a, z) => compareBreakpoints2(a, z, "asc")
4007
+ );
4008
+ }
4009
+ staticVariant("portrait", ["@media (orientation: portrait)"], { compounds: false });
4010
+ staticVariant("landscape", ["@media (orientation: landscape)"], { compounds: false });
4011
+ staticVariant("ltr", ['&:where([dir="ltr"], [dir="ltr"] *)']);
4012
+ staticVariant("rtl", ['&:where([dir="rtl"], [dir="rtl"] *)']);
4013
+ staticVariant("dark", ["@media (prefers-color-scheme: dark)"], { compounds: false });
4014
+ staticVariant("print", ["@media print"], { compounds: false });
4015
+ staticVariant("forced-colors", ["@media (forced-colors: active)"], { compounds: false });
4016
+ return variants;
4017
+ }
4018
+
4019
+ // src/design-system.ts
4020
+ function buildDesignSystem(theme) {
4021
+ return {
4022
+ theme,
4023
+ utilities: createUtilities(theme),
4024
+ variants: createVariants(theme),
4025
+ getClassOrder(classes) {
4026
+ return getClassOrder(this, classes);
4027
+ }
4028
+ };
4029
+ }
4030
+
4031
+ // src/property-order.ts
4032
+ var property_order_default = [
4033
+ "pointer-events",
4034
+ "visibility",
4035
+ "position",
4036
+ // How do we make `inset-x-0` come before `top-0`?
4037
+ "inset",
4038
+ "inset-inline",
4039
+ "inset-block",
4040
+ "inset-inline-start",
4041
+ "inset-inline-end",
4042
+ "top",
4043
+ "right",
4044
+ "bottom",
4045
+ "left",
4046
+ "isolation",
4047
+ "z-index",
4048
+ "order",
4049
+ "grid-column",
4050
+ "grid-column-start",
4051
+ "grid-column-end",
4052
+ "grid-row",
4053
+ "grid-row-start",
4054
+ "grid-row-end",
4055
+ "float",
4056
+ "clear",
4057
+ // How do we make `mx-0` come before `mt-0`?
4058
+ // Idea: `margin-x` property that we compile away with a Visitor plugin?
4059
+ "margin",
4060
+ "margin-inline",
4061
+ "margin-block",
4062
+ "margin-inline-start",
4063
+ "margin-inline-end",
4064
+ "margin-top",
4065
+ "margin-right",
4066
+ "margin-bottom",
4067
+ "margin-left",
4068
+ "box-sizing",
4069
+ "display",
4070
+ "aspect-ratio",
4071
+ "height",
4072
+ "max-height",
4073
+ "min-height",
4074
+ "width",
4075
+ "max-width",
4076
+ "min-width",
4077
+ "flex",
4078
+ "flex-shrink",
4079
+ "flex-grow",
4080
+ "flex-basis",
4081
+ "table-layout",
4082
+ "caption-side",
4083
+ "border-collapse",
4084
+ // There's no `border-spacing-x` property, we use variables, how to sort?
4085
+ "border-spacing",
4086
+ // '--tw-border-spacing-x',
4087
+ // '--tw-border-spacing-y',
4088
+ "transform-origin",
4089
+ // '--tw-translate-x',
4090
+ // '--tw-translate-y',
4091
+ "translate",
4092
+ "rotate",
4093
+ // '--tw-rotate',
4094
+ "--tw-skew-x",
4095
+ "--tw-skew-y",
4096
+ "scale",
4097
+ // '--tw-scale-x',
4098
+ // '--tw-scale-y',
4099
+ "transform",
4100
+ "animation",
4101
+ "cursor",
4102
+ "touch-action",
4103
+ "--tw-pan-x",
4104
+ "--tw-pan-y",
4105
+ "--tw-pinch-zoom",
4106
+ "resize",
4107
+ "scroll-snap-type",
4108
+ "--tw-scroll-snap-strictness",
4109
+ "scroll-snap-align",
4110
+ "scroll-snap-stop",
4111
+ "scroll-margin",
4112
+ "scroll-margin-inline-start",
4113
+ "scroll-margin-inline-end",
4114
+ "scroll-margin-top",
4115
+ "scroll-margin-right",
4116
+ "scroll-margin-bottom",
4117
+ "scroll-margin-left",
4118
+ "scroll-padding",
4119
+ "scroll-padding-inline-start",
4120
+ "scroll-padding-inline-end",
4121
+ "scroll-padding-top",
4122
+ "scroll-padding-right",
4123
+ "scroll-padding-bottom",
4124
+ "scroll-padding-left",
4125
+ "list-style-position",
4126
+ "list-style-type",
4127
+ "list-style-image",
4128
+ "appearance",
4129
+ "columns",
4130
+ "break-before",
4131
+ "break-inside",
4132
+ "break-after",
4133
+ "grid-auto-columns",
4134
+ "grid-auto-flow",
4135
+ "grid-auto-rows",
4136
+ "grid-template-columns",
4137
+ "grid-template-rows",
4138
+ "flex-direction",
4139
+ "flex-wrap",
4140
+ "place-content",
4141
+ "place-items",
4142
+ "align-content",
4143
+ "align-items",
4144
+ "justify-content",
4145
+ "justify-items",
4146
+ "gap",
4147
+ "column-gap",
4148
+ "row-gap",
4149
+ "--tw-space-x-reverse",
4150
+ "--tw-space-y-reverse",
4151
+ // Is there a more "real" property we could use for this?
4152
+ "divide-x-width",
4153
+ "divide-y-width",
4154
+ "--tw-divide-y-reverse",
4155
+ "divide-style",
4156
+ "divide-color",
4157
+ "--tw-divide-opacity",
4158
+ "place-self",
4159
+ "align-self",
4160
+ "justify-self",
4161
+ "overflow",
4162
+ "overflow-x",
4163
+ "overflow-y",
4164
+ "overscroll-behavior",
4165
+ "overscroll-behavior-x",
4166
+ "overscroll-behavior-y",
4167
+ "scroll-behavior",
4168
+ "text-overflow",
4169
+ "hyphens",
4170
+ "white-space",
4171
+ "text-wrap",
4172
+ "overflow-wrap",
4173
+ "work-break",
4174
+ "border-radius",
4175
+ "border-start-radius",
4176
+ // Not real
4177
+ "border-end-radius",
4178
+ // Not real
4179
+ "border-top-radius",
4180
+ // Not real
4181
+ "border-right-radius",
4182
+ // Not real
4183
+ "border-bottom-radius",
4184
+ // Not real
4185
+ "border-left-radius",
4186
+ // Not real
4187
+ "border-start-start-radius",
4188
+ "border-start-end-radius",
4189
+ "border-end-end-radius",
4190
+ "border-end-start-radius",
4191
+ "border-top-left-radius",
4192
+ "border-top-right-radius",
4193
+ "border-bottom-right-radius",
4194
+ "border-bottom-left-radius",
4195
+ "border-width",
4196
+ "border-inline-width",
4197
+ // Not real
4198
+ "border-inline-start-width",
4199
+ "border-inline-end-width",
4200
+ "border-top-width",
4201
+ "border-right-width",
4202
+ "border-bottom-width",
4203
+ "border-left-width",
4204
+ "border-style",
4205
+ "border-color",
4206
+ "border-x-color",
4207
+ // Not real
4208
+ "border-y-color",
4209
+ // Not real
4210
+ "border-inline-start-color",
4211
+ "border-inline-end-color",
4212
+ "border-top-color",
4213
+ "border-right-color",
4214
+ "border-bottom-color",
4215
+ "border-left-color",
4216
+ "--tw-border-opacity",
4217
+ "background-color",
4218
+ "--tw-bg-opacity",
4219
+ "background-image",
4220
+ "--tw-gradient-stops",
4221
+ "--tw-gradient-via-stops",
4222
+ "--tw-gradient-from",
4223
+ "--tw-gradient-from-position",
4224
+ "--tw-gradient-via",
4225
+ "--tw-gradient-via-position",
4226
+ "--tw-gradient-to",
4227
+ "--tw-gradient-to-position",
4228
+ "box-decoration-break",
4229
+ "background-size",
4230
+ "background-attachment",
4231
+ "background-clip",
4232
+ "background-position",
4233
+ "background-repeat",
4234
+ "background-origin",
4235
+ "fill",
4236
+ "stroke",
4237
+ "stroke-width",
4238
+ "object-fit",
4239
+ "object-position",
4240
+ "padding",
4241
+ "padding-inline",
4242
+ "padding-block",
4243
+ "padding-inline-start",
4244
+ "padding-inline-end",
4245
+ "padding-top",
4246
+ "padding-right",
4247
+ "padding-bottom",
4248
+ "padding-left",
4249
+ "text-align",
4250
+ "text-indent",
4251
+ "vertical-align",
4252
+ "font-family",
4253
+ "font-size",
4254
+ "font-weight",
4255
+ "text-transform",
4256
+ "font-style",
4257
+ "font-variant-numeric",
4258
+ "line-height",
4259
+ "letter-spacing",
4260
+ "color",
4261
+ "--tw-text-opacity",
4262
+ "text-decoration-line",
4263
+ "text-decoration-color",
4264
+ "text-decoration-style",
4265
+ "text-decoration-thickness",
4266
+ "text-underline-offset",
4267
+ "-webkit-font-smoothing",
4268
+ "placeholder-color",
4269
+ // Not real
4270
+ "--tw-placeholder-opacity",
4271
+ "caret-color",
4272
+ "accent-color",
4273
+ "opacity",
4274
+ "background-blend-mode",
4275
+ "mix-blend-mode",
4276
+ "box-shadow",
4277
+ "--tw-shadow",
4278
+ "--tw-shadow-color",
4279
+ "--tw-ring-shadow",
4280
+ "--tw-ring-color",
4281
+ "--tw-inset-shadow",
4282
+ "--tw-inset-shadow-color",
4283
+ "--tw-inset-ring-shadow",
4284
+ "--tw-inset-ring-color",
4285
+ "--tw-ring-opacity",
4286
+ "--tw-ring-offset-width",
4287
+ "--tw-ring-offset-color",
4288
+ "outline",
4289
+ "outline-width",
4290
+ "outline-offset",
4291
+ "outline-color",
4292
+ "--tw-blur",
4293
+ "--tw-brightness",
4294
+ "--tw-contast",
4295
+ "--tw-drop-shadow",
4296
+ "--tw-grayscale",
4297
+ "--tw-hue-rotate",
4298
+ "--tw-invert",
4299
+ "--tw-saturate",
4300
+ "--tw-sepia",
4301
+ "filter",
4302
+ "--tw-backdrop-blur",
4303
+ "--tw-backdrop-brightness",
4304
+ "--tw-backdrop-contast",
4305
+ "--tw-backdrop-grayscale",
4306
+ "--tw-backdrop-hue-rotate",
4307
+ "--tw-backdrop-invert",
4308
+ "--tw-backdrop-opacity",
4309
+ "--tw-backdrop-saturate",
4310
+ "--tw-backdrop-sepia",
4311
+ "backdrop-filter",
4312
+ "transition-property",
4313
+ "transition-delay",
4314
+ "transition-duration",
4315
+ "transition-timing-function",
4316
+ "will-change",
4317
+ "contain",
4318
+ "content",
4319
+ "forced-color-adjust"
4320
+ ];
4321
+
4322
+ // src/utils/escape.ts
4323
+ function escape(value) {
4324
+ if (arguments.length == 0) {
4325
+ throw new TypeError("`CSS.escape` requires an argument.");
4326
+ }
4327
+ var string = String(value);
4328
+ var length = string.length;
4329
+ var index = -1;
4330
+ var codeUnit;
4331
+ var result = "";
4332
+ var firstCodeUnit = string.charCodeAt(0);
4333
+ if (
4334
+ // If the character is the first character and is a `-` (U+002D), and
4335
+ // there is no second character, […]
4336
+ length == 1 && firstCodeUnit == 45
4337
+ ) {
4338
+ return "\\" + string;
4339
+ }
4340
+ while (++index < length) {
4341
+ codeUnit = string.charCodeAt(index);
4342
+ if (codeUnit == 0) {
4343
+ result += "\uFFFD";
4344
+ continue;
4345
+ }
4346
+ if (
4347
+ // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
4348
+ // U+007F, […]
4349
+ codeUnit >= 1 && codeUnit <= 31 || codeUnit == 127 || // If the character is the first character and is in the range [0-9]
4350
+ // (U+0030 to U+0039), […]
4351
+ index == 0 && codeUnit >= 48 && codeUnit <= 57 || // If the character is the second character and is in the range [0-9]
4352
+ // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
4353
+ index == 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit == 45
4354
+ ) {
4355
+ result += "\\" + codeUnit.toString(16) + " ";
4356
+ continue;
4357
+ }
4358
+ if (codeUnit >= 128 || codeUnit == 45 || codeUnit == 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) {
4359
+ result += string.charAt(index);
4360
+ continue;
4361
+ }
4362
+ result += "\\" + string.charAt(index);
4363
+ }
4364
+ return result;
4365
+ }
4366
+
4367
+ // src/compile.ts
4368
+ function applyImportant(ast) {
4369
+ for (let node of ast) {
4370
+ if (node.kind === "rule" && node.selector === "@at-root") {
4371
+ continue;
4372
+ }
4373
+ if (node.kind === "declaration") {
4374
+ node.important = true;
4375
+ } else if (node.kind === "rule") {
4376
+ applyImportant(node.nodes);
4377
+ }
4378
+ }
4379
+ }
4380
+ function applyVariant(node, variant, variants) {
4381
+ if (variant.kind === "arbitrary") {
4382
+ node.nodes = [rule(variant.selector, node.nodes)];
4383
+ return;
4384
+ }
4385
+ let applyVariantFn = variants.get(variant.root);
4386
+ if (variant.kind === "compound") {
4387
+ let result2 = applyVariant(node, variant.variant, variants);
4388
+ if (result2 === null)
4389
+ return null;
4390
+ for (let child of node.nodes) {
4391
+ let result3 = applyVariantFn(child, variant);
4392
+ if (result3 === null)
4393
+ return null;
4394
+ }
4395
+ return;
4396
+ }
4397
+ let result = applyVariantFn(node, variant);
4398
+ if (result === null)
4399
+ return null;
4400
+ }
4401
+ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidate = false } = {}) {
4402
+ rawCandidates.sort();
4403
+ let nodeSorting = /* @__PURE__ */ new Map();
4404
+ let astNodes = [];
4405
+ let parsedVariants = new DefaultMap((variant, map) => {
4406
+ return parseVariant(variant, designSystem.variants, map);
4407
+ });
4408
+ let candidates = /* @__PURE__ */ new Map();
4409
+ next:
4410
+ for (let rawCandidate of rawCandidates) {
4411
+ let candidate = parseCandidate(rawCandidate, designSystem.utilities, parsedVariants);
4412
+ if (candidate === null) {
4413
+ if (throwOnInvalidCandidate) {
4414
+ throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4415
+ } else {
4416
+ continue next;
4417
+ }
4418
+ }
4419
+ candidates.set(candidate, rawCandidate);
4420
+ }
4421
+ let variants = Array.from(parsedVariants.values()).sort((a, z) => {
4422
+ return designSystem.variants.compare(a, z);
4423
+ });
4424
+ next:
4425
+ for (let [candidate, rawCandidate] of candidates) {
4426
+ let nodes = [];
4427
+ if (candidate.kind === "arbitrary") {
4428
+ nodes = [decl(candidate.property, candidate.value)];
4429
+ } else if (candidate.kind === "static" || candidate.kind === "functional") {
4430
+ let { compileFn } = designSystem.utilities.get(candidate.root);
4431
+ let compiledNodes = compileFn(candidate);
4432
+ if (compiledNodes === void 0) {
4433
+ if (throwOnInvalidCandidate) {
4434
+ throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4435
+ } else {
4436
+ continue next;
4437
+ }
4438
+ }
4439
+ nodes = compiledNodes;
4440
+ }
4441
+ let propertySort = getPropertySort(nodes);
4442
+ if (candidate.important) {
4443
+ applyImportant(nodes);
4444
+ }
4445
+ let node = {
4446
+ kind: "rule",
4447
+ selector: `.${escape(rawCandidate)}`,
4448
+ nodes
4449
+ };
4450
+ let variantOrder = 0n;
4451
+ for (let variant of candidate.variants) {
4452
+ let result = applyVariant(node, variant, designSystem.variants);
4453
+ if (result === null) {
4454
+ if (throwOnInvalidCandidate) {
4455
+ throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4456
+ } else {
4457
+ continue next;
4458
+ }
4459
+ }
4460
+ variantOrder |= 1n << BigInt(variants.indexOf(variant));
4461
+ }
4462
+ nodeSorting.set(node, {
4463
+ properties: propertySort,
4464
+ variants: variantOrder,
4465
+ candidate: rawCandidate
4466
+ });
4467
+ astNodes.push(node);
4468
+ }
4469
+ astNodes.sort((a, z) => {
4470
+ let aSorting = nodeSorting.get(a);
4471
+ let zSorting = nodeSorting.get(z);
4472
+ if (aSorting.variants - zSorting.variants !== 0n) {
4473
+ return Number(aSorting.variants - zSorting.variants);
4474
+ }
4475
+ let offset = 0;
4476
+ while (aSorting.properties.length < offset && zSorting.properties.length < offset && aSorting.properties[offset] === zSorting.properties[offset]) {
4477
+ offset += 1;
4478
+ }
4479
+ return (
4480
+ // Sort by lowest property index first
4481
+ (aSorting.properties[offset] ?? Infinity) - (zSorting.properties[offset] ?? Infinity) || // Sort by most properties first, then by least properties
4482
+ zSorting.properties.length - aSorting.properties.length
4483
+ );
4484
+ });
4485
+ return {
4486
+ astNodes,
4487
+ nodeSorting
4488
+ };
4489
+ }
4490
+ function getPropertySort(nodes) {
4491
+ let propertySort = /* @__PURE__ */ new Set();
4492
+ let q = nodes.slice();
4493
+ next:
4494
+ while (q.length > 0) {
4495
+ let node = q.shift();
4496
+ if (node.kind === "declaration") {
4497
+ if (node.property === "--tw-sort") {
4498
+ let idx2 = property_order_default.indexOf(node.value);
4499
+ if (idx2 !== -1) {
4500
+ propertySort.add(idx2);
4501
+ break next;
4502
+ }
4503
+ }
4504
+ let idx = property_order_default.indexOf(node.property);
4505
+ if (idx !== -1)
4506
+ propertySort.add(idx);
4507
+ } else if (node.kind === "rule") {
4508
+ if (node.selector === "@at-root")
4509
+ continue;
4510
+ for (let child of node.nodes) {
4511
+ q.push(child);
4512
+ }
4513
+ }
4514
+ }
4515
+ return Array.from(propertySort).sort((a, z) => a - z);
4516
+ }
4517
+
4518
+ // src/css-parser.ts
4519
+ function parse(input) {
4520
+ let ast = [];
4521
+ let licenseComments = [];
4522
+ let stack = [];
4523
+ let parent = null;
4524
+ let node = null;
4525
+ let current = "";
4526
+ let closingBracketStack = "";
4527
+ for (let i = 0; i < input.length; i++) {
4528
+ let char = input[i];
4529
+ if (char === "\\") {
4530
+ current += input.slice(i, i + 2);
4531
+ i += 1;
4532
+ } else if (char === "/" && input[i + 1] === "*") {
4533
+ let start = i;
4534
+ for (let j = i + 2; j < input.length; j++) {
4535
+ if (input[j] === "\\") {
4536
+ j += 1;
4537
+ } else if (input[j] === "*" && input[j + 1] === "/") {
4538
+ i = j + 1;
4539
+ break;
4540
+ }
4541
+ }
4542
+ let commentString = input.slice(start, i + 1);
4543
+ if (commentString[2] === "!") {
4544
+ licenseComments.push(comment(commentString.slice(2, -2)));
4545
+ }
4546
+ } else if (char === '"' || char === "'") {
4547
+ let start = i;
4548
+ for (let j = i + 1; j < input.length; j++) {
4549
+ if (input[j] === "\\") {
4550
+ j += 1;
4551
+ } else if (input[j] === char) {
4552
+ i = j;
4553
+ break;
4554
+ } else if (input[j] === ";" && input[j + 1] === "\n") {
4555
+ throw new Error(`Unterminated string: ${input.slice(start, j + 1) + char}`);
4556
+ } else if (input[j] === "\n") {
4557
+ throw new Error(`Unterminated string: ${input.slice(start, j) + char}`);
4558
+ }
4559
+ }
4560
+ current += input.slice(start, i + 1);
4561
+ } else if ((char === " " || char === "\n" || char === " ") && (input[i + 1] === " " || input[i + 1] === "\n" || input[i + 1] === " ")) {
4562
+ continue;
4563
+ } else if (char === "-" && input[i + 1] === "-" && current.length === 0) {
4564
+ let closingBracketStack2 = "";
4565
+ let start = i;
4566
+ let colonIdx = -1;
4567
+ for (let j = i + 2; j < input.length; j++) {
4568
+ if (input[j] === "\\") {
4569
+ j += 1;
4570
+ } else if (input[j] === "/" && input[j + 1] === "*") {
4571
+ for (let k = j + 2; k < input.length; k++) {
4572
+ if (input[k] === "\\") {
4573
+ k += 1;
4574
+ } else if (input[k] === "*" && input[k + 1] === "/") {
4575
+ j = k + 1;
4576
+ break;
4577
+ }
4578
+ }
4579
+ } else if (colonIdx === -1 && input[j] === ":") {
4580
+ colonIdx = current.length + j - start;
4581
+ } else if (input[j] === ";" && closingBracketStack2.length === 0) {
4582
+ current += input.slice(start, j);
4583
+ i = j;
4584
+ break;
4585
+ } else if (input[j] === "(") {
4586
+ closingBracketStack2 += ")";
4587
+ } else if (input[j] === "[") {
4588
+ closingBracketStack2 += "]";
4589
+ } else if (input[j] === "{") {
4590
+ closingBracketStack2 += "}";
4591
+ } else if ((input[j] === "}" || input.length - 1 === j) && closingBracketStack2.length === 0) {
4592
+ i = j - 1;
4593
+ current += input.slice(start, j);
4594
+ break;
4595
+ } else if (input[j] === ")" || input[j] === "]" || input[j] === "}") {
4596
+ if (closingBracketStack2.length > 0 && input[j] === closingBracketStack2[closingBracketStack2.length - 1]) {
4597
+ closingBracketStack2 = closingBracketStack2.slice(0, -1);
4598
+ }
4599
+ }
4600
+ }
4601
+ let declaration = parseDeclaration(current, colonIdx);
4602
+ if (parent) {
4603
+ parent.nodes.push(declaration);
4604
+ } else {
4605
+ ast.push(declaration);
4606
+ }
4607
+ current = "";
4608
+ } else if (char === ";" && current[0] === "@") {
4609
+ node = rule(current, []);
4610
+ if (parent) {
4611
+ parent.nodes.push(node);
4612
+ } else {
4613
+ ast.push(node);
4614
+ }
4615
+ current = "";
4616
+ node = null;
4617
+ } else if (char === ";") {
4618
+ let declaration = parseDeclaration(current);
4619
+ if (parent) {
4620
+ parent.nodes.push(declaration);
4621
+ } else {
4622
+ ast.push(declaration);
4623
+ }
4624
+ current = "";
4625
+ } else if (char === "{") {
4626
+ closingBracketStack += "}";
4627
+ node = rule(current.trim(), []);
4628
+ if (parent) {
4629
+ parent.nodes.push(node);
4630
+ }
4631
+ stack.push(parent);
4632
+ parent = node;
4633
+ current = "";
4634
+ node = null;
4635
+ } else if (char === "}") {
4636
+ if (closingBracketStack === "") {
4637
+ throw new Error(`Missing opening {`);
4638
+ } else {
4639
+ closingBracketStack = closingBracketStack.slice(0, -1);
4640
+ }
4641
+ if (current.length > 0) {
4642
+ if (current[0] === "@") {
4643
+ node = rule(current.trim(), []);
4644
+ if (parent) {
4645
+ parent.nodes.push(node);
4646
+ } else {
4647
+ ast.push(node);
4648
+ }
4649
+ current = "";
4650
+ node = null;
4651
+ } else {
4652
+ let colonIdx = current.indexOf(":");
4653
+ if (parent) {
4654
+ let importantIdx = current.indexOf("!important", colonIdx + 1);
4655
+ parent.nodes.push({
4656
+ kind: "declaration",
4657
+ property: current.slice(0, colonIdx).trim(),
4658
+ value: current.slice(colonIdx + 1, importantIdx === -1 ? current.length : importantIdx).trim(),
4659
+ important: importantIdx !== -1
4660
+ });
4661
+ }
4662
+ }
4663
+ }
4664
+ let grandParent = stack.pop() ?? null;
4665
+ if (grandParent === null && parent) {
4666
+ ast.push(parent);
4667
+ }
4668
+ parent = grandParent;
4669
+ current = "";
4670
+ node = null;
4671
+ } else {
4672
+ if (current.length === 0 && (char === " " || char === "\n" || char === " ")) {
4673
+ continue;
4674
+ }
4675
+ current += char;
4676
+ }
4677
+ }
4678
+ if (closingBracketStack.length > 0 && parent) {
4679
+ throw new Error(`Missing closing } at ${parent.selector}`);
4680
+ }
4681
+ if (licenseComments.length > 0) {
4682
+ return licenseComments.concat(ast);
4683
+ }
4684
+ return ast;
4685
+ }
4686
+ function parseDeclaration(current, colonIdx = current.indexOf(":")) {
4687
+ let importantIdx = current.indexOf("!important", colonIdx + 1);
4688
+ return {
4689
+ kind: "declaration",
4690
+ property: current.slice(0, colonIdx).trim(),
4691
+ value: current.slice(colonIdx + 1, importantIdx === -1 ? current.length : importantIdx).trim(),
4692
+ important: importantIdx !== -1
4693
+ };
4694
+ }
4695
+
4696
+ // src/theme.ts
4697
+ var Theme = class {
4698
+ constructor(values = /* @__PURE__ */ new Map()) {
4699
+ this.values = values;
4700
+ }
4701
+ add(key, value) {
4702
+ if (key.endsWith("-*")) {
4703
+ if (value !== "initial") {
4704
+ throw new Error(`Invalid theme value \`${value}\` for namespace \`${key}\``);
4705
+ }
4706
+ if (key === "--*") {
4707
+ this.values.clear();
4708
+ } else {
4709
+ this.clearNamespace(key.slice(0, -2));
4710
+ }
4711
+ }
4712
+ if (value === "initial") {
4713
+ this.values.delete(key);
4714
+ } else {
4715
+ this.values.set(key, value);
4716
+ }
4717
+ }
4718
+ get(themeKeys) {
4719
+ for (let key of themeKeys) {
4720
+ let value = this.values.get(key);
4721
+ if (value) {
4722
+ return value;
4723
+ }
4724
+ }
4725
+ return null;
4726
+ }
4727
+ entries() {
4728
+ return this.values.entries();
4729
+ }
4730
+ clearNamespace(namespace) {
4731
+ for (let key of this.values.keys()) {
4732
+ if (key.startsWith(namespace)) {
4733
+ this.values.delete(key);
4734
+ }
4735
+ }
4736
+ }
4737
+ resolveKey(candidateValue, themeKeys) {
4738
+ for (let key of themeKeys) {
4739
+ let themeKey = escape(`${key}-${candidateValue.replaceAll(".", "_")}`);
4740
+ if (this.values.has(themeKey)) {
4741
+ return themeKey;
4742
+ }
4743
+ }
4744
+ return null;
4745
+ }
4746
+ resolve(candidateValue, themeKeys) {
4747
+ let themeKey = this.resolveKey(candidateValue, themeKeys);
4748
+ if (!themeKey)
4749
+ return null;
4750
+ return this.values.get(themeKey);
4751
+ }
4752
+ resolveWith(candidateValue, themeKeys, nestedKeys = []) {
4753
+ let themeKey = this.resolveKey(candidateValue, themeKeys);
4754
+ if (!themeKey)
4755
+ return null;
4756
+ let extra = {};
4757
+ for (let name of nestedKeys) {
4758
+ let nestedValue = this.values.get(`${themeKey}${name}`);
4759
+ if (nestedValue) {
4760
+ extra[name] = nestedValue;
4761
+ }
4762
+ }
4763
+ return [this.values.get(themeKey), extra];
4764
+ }
4765
+ namespace(namespace) {
4766
+ let values = /* @__PURE__ */ new Map();
4767
+ let prefix = `${namespace}-`;
4768
+ for (let [key, value] of this.values) {
4769
+ if (key === namespace) {
4770
+ values.set(null, value);
4771
+ } else if (key.startsWith(prefix)) {
4772
+ values.set(key.slice(prefix.length), value);
4773
+ }
4774
+ }
4775
+ return values;
4776
+ }
4777
+ };
4778
+
4779
+ // src/index.ts
4780
+ function toCss(ast) {
4781
+ let atRoots = [];
4782
+ return ast.map(function stringify(node) {
4783
+ let css = "";
4784
+ if (node.kind === "rule") {
4785
+ if (node.selector === "@at-root") {
4786
+ for (let child of node.nodes) {
4787
+ atRoots.push(stringify(child));
4788
+ }
4789
+ return css;
4790
+ }
4791
+ if (node.selector[0] === "@" && node.nodes.length === 0) {
4792
+ return `${node.selector};`;
4793
+ }
4794
+ css += `${node.selector}{`;
4795
+ for (let child of node.nodes) {
4796
+ css += stringify(child);
4797
+ }
4798
+ css += "}";
4799
+ } else if (node.kind === "comment") {
4800
+ css += `/*${node.value}*/
4801
+ `;
4802
+ } else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
4803
+ css += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
4804
+ }
4805
+ return css;
4806
+ }).concat(atRoots).join("\n");
4807
+ }
4808
+ function optimizeCss(input, { file = "input.css", minify = false } = {}) {
4809
+ return lightningcss.transform({
4810
+ filename: file,
4811
+ code: Buffer.from(input),
4812
+ minify,
4813
+ sourceMap: false,
4814
+ drafts: {
4815
+ customMedia: true
4816
+ },
4817
+ nonStandard: {
4818
+ deepSelectorCombinator: true
4819
+ },
4820
+ include: lightningcss.Features.Nesting,
4821
+ exclude: lightningcss.Features.LogicalProperties,
4822
+ targets: {
4823
+ safari: 16 << 16 | 4 << 8
4824
+ }
4825
+ }).code.toString();
4826
+ }
4827
+ function compile(css, rawCandidates) {
4828
+ let ast = parse(css);
4829
+ {
4830
+ ast.unshift(comment(`! tailwindcss v${version} | MIT License | https://tailwindcss.com `));
4831
+ }
4832
+ let theme = new Theme();
4833
+ let firstThemeRule = null;
4834
+ let keyframesRules = [];
4835
+ walk(ast, (node, { replaceWith }) => {
4836
+ if (node.kind !== "rule")
4837
+ return;
4838
+ if (node.selector !== "@theme")
4839
+ return;
4840
+ walk([node], (node2, { replaceWith: replaceWith2 }) => {
4841
+ if (node2.kind === "rule" && node2.selector.startsWith("@keyframes ")) {
4842
+ keyframesRules.push(node2);
4843
+ replaceWith2([]);
4844
+ return;
4845
+ }
4846
+ if (node2.kind !== "declaration")
4847
+ return;
4848
+ if (!node2.property.startsWith("--"))
4849
+ return;
4850
+ theme.add(node2.property, node2.value);
4851
+ });
4852
+ if (!firstThemeRule) {
4853
+ firstThemeRule = node;
4854
+ } else {
4855
+ replaceWith([]);
4856
+ }
4857
+ });
4858
+ if (firstThemeRule) {
4859
+ firstThemeRule = firstThemeRule;
4860
+ firstThemeRule.selector = ":root";
4861
+ let nodes = [];
4862
+ for (let [key, value] of theme.entries()) {
4863
+ nodes.push(decl(key, value));
4864
+ }
4865
+ if (keyframesRules.length > 0) {
4866
+ let animationParts = [...theme.namespace("--animate").values()].flatMap(
4867
+ (animation) => animation.split(" ")
4868
+ );
4869
+ for (let keyframesRule of keyframesRules) {
4870
+ let keyframesName = keyframesRule.selector.slice(11);
4871
+ if (!animationParts.includes(keyframesName)) {
4872
+ continue;
4873
+ }
4874
+ nodes.push(
4875
+ Object.assign(keyframesRule, {
4876
+ selector: "@at-root",
4877
+ nodes: [rule(keyframesRule.selector, keyframesRule.nodes)]
4878
+ })
4879
+ );
4880
+ }
4881
+ }
4882
+ firstThemeRule.nodes = nodes;
4883
+ }
4884
+ let designSystem = buildDesignSystem(theme);
4885
+ walk(ast, (node, { replaceWith }) => {
4886
+ if (node.kind === "rule" && node.selector === "@tailwind utilities") {
4887
+ replaceWith(compileCandidates(rawCandidates, designSystem).astNodes);
4888
+ return false;
4889
+ }
4890
+ });
4891
+ if (css.includes("@apply")) {
4892
+ walk(ast, (node, { replaceWith }) => {
4893
+ if (node.kind === "rule" && node.selector[0] === "@" && node.selector.startsWith("@apply")) {
4894
+ let candidates = node.selector.slice(
4895
+ 7
4896
+ /* Ignore `@apply ` when parsing the selector */
4897
+ ).split(/\s+/g);
4898
+ {
4899
+ let candidateAst = compileCandidates(candidates, designSystem, {
4900
+ throwOnInvalidCandidate: true
4901
+ }).astNodes;
4902
+ let newNodes = [];
4903
+ for (let candidateNode of candidateAst) {
4904
+ if (candidateNode.kind === "rule" && candidateNode.selector[0] !== "@") {
4905
+ for (let child of candidateNode.nodes) {
4906
+ newNodes.push(child);
4907
+ }
4908
+ } else {
4909
+ newNodes.push(candidateNode);
4910
+ }
4911
+ }
4912
+ replaceWith(newNodes);
4913
+ }
4914
+ }
4915
+ });
4916
+ }
4917
+ if (css.includes("@media reference")) {
4918
+ walk(ast, (node, { replaceWith }) => {
4919
+ if (node.kind === "rule" && node.selector === "@media reference") {
4920
+ replaceWith([]);
4921
+ }
4922
+ });
4923
+ }
4924
+ return toCss(ast);
4925
+ }
4926
+ function loadDesignSystem(css) {
4927
+ let theme = new Theme();
4928
+ let ast = parse(css);
4929
+ walk(ast, (node) => {
4930
+ if (node.kind !== "rule")
4931
+ return;
4932
+ if (node.selector !== "@theme")
4933
+ return;
4934
+ walk([node], (node2) => {
4935
+ if (node2.kind !== "declaration")
4936
+ return;
4937
+ if (!node2.property.startsWith("--"))
4938
+ return;
4939
+ theme.add(node2.property, node2.value);
4940
+ });
4941
+ });
4942
+ return buildDesignSystem(theme);
4943
+ }
4944
+
4945
+ exports.compile = compile;
4946
+ exports.loadDesignSystem = loadDesignSystem;
4947
+ exports.optimizeCss = optimizeCss;