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

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