tailwindcss 3.4.0 → 4.0.0-alpha.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 (285) hide show
  1. package/dist/chunk-GNCUPSHB.mjs +5886 -0
  2. package/dist/cli.d.mts +1 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +6309 -0
  5. package/dist/cli.mjs +432 -0
  6. package/dist/lib.d.mts +324 -0
  7. package/dist/lib.d.ts +324 -0
  8. package/dist/lib.js +5884 -0
  9. package/dist/lib.mjs +1 -0
  10. package/index.css +5 -0
  11. package/package.json +35 -104
  12. package/preflight.css +355 -0
  13. package/theme.css +465 -0
  14. package/CHANGELOG.md +0 -2552
  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 -378
  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 -63
  32. package/lib/cli-peer-dependencies.js +0 -36
  33. package/lib/cli.js +0 -7
  34. package/lib/corePluginList.js +0 -190
  35. package/lib/corePlugins.js +0 -4244
  36. package/lib/css/LICENSE +0 -25
  37. package/lib/css/preflight.css +0 -385
  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 -181
  44. package/lib/lib/defaultExtractor.js +0 -251
  45. package/lib/lib/detectNesting.js +0 -45
  46. package/lib/lib/evaluateTailwindFunctions.js +0 -238
  47. package/lib/lib/expandApplyAtRules.js +0 -540
  48. package/lib/lib/expandTailwindAtRules.js +0 -291
  49. package/lib/lib/findAtConfigPath.js +0 -46
  50. package/lib/lib/generateRules.js +0 -896
  51. package/lib/lib/getModuleDependencies.js +0 -99
  52. package/lib/lib/load-config.js +0 -53
  53. package/lib/lib/normalizeTailwindDirectives.js +0 -89
  54. package/lib/lib/offsets.js +0 -306
  55. package/lib/lib/partitionApplyAtRules.js +0 -58
  56. package/lib/lib/regex.js +0 -74
  57. package/lib/lib/remap-bitfield.js +0 -89
  58. package/lib/lib/resolveDefaultsAtRules.js +0 -165
  59. package/lib/lib/setupContextUtils.js +0 -1278
  60. package/lib/lib/setupTrackingContext.js +0 -166
  61. package/lib/lib/sharedState.js +0 -87
  62. package/lib/lib/substituteScreenAtRules.js +0 -31
  63. package/lib/oxide/cli/build/deps.js +0 -89
  64. package/lib/oxide/cli/build/index.js +0 -53
  65. package/lib/oxide/cli/build/plugin.js +0 -375
  66. package/lib/oxide/cli/build/utils.js +0 -87
  67. package/lib/oxide/cli/build/watching.js +0 -179
  68. package/lib/oxide/cli/help/index.js +0 -72
  69. package/lib/oxide/cli/index.js +0 -214
  70. package/lib/oxide/cli/init/index.js +0 -52
  71. package/lib/oxide/cli.js +0 -5
  72. package/lib/oxide/postcss-plugin.js +0 -2
  73. package/lib/plugin.js +0 -98
  74. package/lib/postcss-plugins/nesting/README.md +0 -42
  75. package/lib/postcss-plugins/nesting/index.js +0 -21
  76. package/lib/postcss-plugins/nesting/plugin.js +0 -89
  77. package/lib/processTailwindFeatures.js +0 -64
  78. package/lib/public/colors.js +0 -355
  79. package/lib/public/create-plugin.js +0 -17
  80. package/lib/public/default-config.js +0 -18
  81. package/lib/public/default-theme.js +0 -18
  82. package/lib/public/load-config.js +0 -12
  83. package/lib/public/resolve-config.js +0 -24
  84. package/lib/util/applyImportantSelector.js +0 -36
  85. package/lib/util/bigSign.js +0 -13
  86. package/lib/util/buildMediaQuery.js +0 -27
  87. package/lib/util/cloneDeep.js +0 -22
  88. package/lib/util/cloneNodes.js +0 -54
  89. package/lib/util/color.js +0 -116
  90. package/lib/util/colorNames.js +0 -752
  91. package/lib/util/configurePlugins.js +0 -23
  92. package/lib/util/createPlugin.js +0 -32
  93. package/lib/util/createUtilityPlugin.js +0 -53
  94. package/lib/util/dataTypes.js +0 -405
  95. package/lib/util/defaults.js +0 -27
  96. package/lib/util/escapeClassName.js +0 -24
  97. package/lib/util/escapeCommas.js +0 -13
  98. package/lib/util/flattenColorPalette.js +0 -18
  99. package/lib/util/formatVariantSelector.js +0 -270
  100. package/lib/util/getAllConfigs.js +0 -50
  101. package/lib/util/hashConfig.js +0 -21
  102. package/lib/util/isKeyframeRule.js +0 -13
  103. package/lib/util/isPlainObject.js +0 -17
  104. package/lib/util/isSyntacticallyValidPropertyValue.js +0 -74
  105. package/lib/util/log.js +0 -61
  106. package/lib/util/nameClass.js +0 -49
  107. package/lib/util/negateValue.js +0 -36
  108. package/lib/util/normalizeConfig.js +0 -282
  109. package/lib/util/normalizeScreens.js +0 -178
  110. package/lib/util/parseAnimationValue.js +0 -93
  111. package/lib/util/parseBoxShadowValue.js +0 -88
  112. package/lib/util/parseDependency.js +0 -47
  113. package/lib/util/parseGlob.js +0 -36
  114. package/lib/util/parseObjectStyles.js +0 -36
  115. package/lib/util/pluginUtils.js +0 -289
  116. package/lib/util/prefixSelector.js +0 -39
  117. package/lib/util/pseudoElements.js +0 -209
  118. package/lib/util/removeAlphaVariables.js +0 -31
  119. package/lib/util/resolveConfig.js +0 -256
  120. package/lib/util/resolveConfigPath.js +0 -70
  121. package/lib/util/responsive.js +0 -24
  122. package/lib/util/splitAtTopLevelOnly.js +0 -51
  123. package/lib/util/tap.js +0 -14
  124. package/lib/util/toColorValue.js +0 -13
  125. package/lib/util/toPath.js +0 -32
  126. package/lib/util/transformThemeValue.js +0 -73
  127. package/lib/util/validateConfig.js +0 -37
  128. package/lib/util/validateFormalSyntax.js +0 -26
  129. package/lib/util/withAlphaVariable.js +0 -79
  130. package/lib/value-parser/LICENSE +0 -22
  131. package/lib/value-parser/README.md +0 -3
  132. package/lib/value-parser/index.d.js +0 -2
  133. package/lib/value-parser/index.js +0 -22
  134. package/lib/value-parser/parse.js +0 -259
  135. package/lib/value-parser/stringify.js +0 -38
  136. package/lib/value-parser/unit.js +0 -86
  137. package/lib/value-parser/walk.js +0 -16
  138. package/loadConfig.d.ts +0 -4
  139. package/loadConfig.js +0 -2
  140. package/nesting/index.d.ts +0 -4
  141. package/nesting/index.js +0 -2
  142. package/peers/index.js +0 -96624
  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 -31
  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 -104
  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 -444
  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 -79
  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 -2904
  167. package/src/css/LICENSE +0 -25
  168. package/src/css/preflight.css +0 -385
  169. package/src/featureFlags.js +0 -66
  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 -208
  175. package/src/lib/defaultExtractor.js +0 -230
  176. package/src/lib/detectNesting.js +0 -47
  177. package/src/lib/evaluateTailwindFunctions.js +0 -272
  178. package/src/lib/expandApplyAtRules.js +0 -620
  179. package/src/lib/expandTailwindAtRules.js +0 -300
  180. package/src/lib/findAtConfigPath.js +0 -48
  181. package/src/lib/generateRules.js +0 -941
  182. package/src/lib/getModuleDependencies.js +0 -79
  183. package/src/lib/load-config.ts +0 -39
  184. package/src/lib/normalizeTailwindDirectives.js +0 -84
  185. package/src/lib/offsets.js +0 -373
  186. package/src/lib/partitionApplyAtRules.js +0 -52
  187. package/src/lib/regex.js +0 -74
  188. package/src/lib/remap-bitfield.js +0 -82
  189. package/src/lib/resolveDefaultsAtRules.js +0 -163
  190. package/src/lib/setupContextUtils.js +0 -1345
  191. package/src/lib/setupTrackingContext.js +0 -169
  192. package/src/lib/sharedState.js +0 -61
  193. package/src/lib/substituteScreenAtRules.js +0 -19
  194. package/src/oxide/cli/build/deps.ts +0 -91
  195. package/src/oxide/cli/build/index.ts +0 -47
  196. package/src/oxide/cli/build/plugin.ts +0 -442
  197. package/src/oxide/cli/build/utils.ts +0 -74
  198. package/src/oxide/cli/build/watching.ts +0 -225
  199. package/src/oxide/cli/help/index.ts +0 -69
  200. package/src/oxide/cli/index.ts +0 -204
  201. package/src/oxide/cli/init/index.ts +0 -59
  202. package/src/oxide/cli.ts +0 -1
  203. package/src/oxide/postcss-plugin.ts +0 -1
  204. package/src/plugin.js +0 -107
  205. package/src/postcss-plugins/nesting/README.md +0 -42
  206. package/src/postcss-plugins/nesting/index.js +0 -13
  207. package/src/postcss-plugins/nesting/plugin.js +0 -80
  208. package/src/processTailwindFeatures.js +0 -59
  209. package/src/public/colors.js +0 -322
  210. package/src/public/create-plugin.js +0 -2
  211. package/src/public/default-config.js +0 -4
  212. package/src/public/default-theme.js +0 -4
  213. package/src/public/load-config.js +0 -2
  214. package/src/public/resolve-config.js +0 -7
  215. package/src/util/applyImportantSelector.js +0 -27
  216. package/src/util/bigSign.js +0 -3
  217. package/src/util/buildMediaQuery.js +0 -22
  218. package/src/util/cloneDeep.js +0 -11
  219. package/src/util/cloneNodes.js +0 -49
  220. package/src/util/color.js +0 -88
  221. package/src/util/colorNames.js +0 -150
  222. package/src/util/configurePlugins.js +0 -23
  223. package/src/util/createPlugin.js +0 -27
  224. package/src/util/createUtilityPlugin.js +0 -37
  225. package/src/util/dataTypes.js +0 -394
  226. package/src/util/defaults.js +0 -17
  227. package/src/util/escapeClassName.js +0 -8
  228. package/src/util/escapeCommas.js +0 -3
  229. package/src/util/flattenColorPalette.js +0 -13
  230. package/src/util/formatVariantSelector.js +0 -324
  231. package/src/util/getAllConfigs.js +0 -38
  232. package/src/util/hashConfig.js +0 -5
  233. package/src/util/isKeyframeRule.js +0 -3
  234. package/src/util/isPlainObject.js +0 -8
  235. package/src/util/isSyntacticallyValidPropertyValue.js +0 -61
  236. package/src/util/log.js +0 -29
  237. package/src/util/nameClass.js +0 -30
  238. package/src/util/negateValue.js +0 -24
  239. package/src/util/normalizeConfig.js +0 -301
  240. package/src/util/normalizeScreens.js +0 -140
  241. package/src/util/parseAnimationValue.js +0 -68
  242. package/src/util/parseBoxShadowValue.js +0 -72
  243. package/src/util/parseDependency.js +0 -44
  244. package/src/util/parseGlob.js +0 -24
  245. package/src/util/parseObjectStyles.js +0 -19
  246. package/src/util/pluginUtils.js +0 -307
  247. package/src/util/prefixSelector.js +0 -33
  248. package/src/util/pseudoElements.js +0 -167
  249. package/src/util/removeAlphaVariables.js +0 -24
  250. package/src/util/resolveConfig.js +0 -277
  251. package/src/util/resolveConfigPath.js +0 -66
  252. package/src/util/responsive.js +0 -10
  253. package/src/util/splitAtTopLevelOnly.js +0 -52
  254. package/src/util/tap.js +0 -4
  255. package/src/util/toColorValue.js +0 -3
  256. package/src/util/toPath.js +0 -26
  257. package/src/util/transformThemeValue.js +0 -62
  258. package/src/util/validateConfig.js +0 -26
  259. package/src/util/validateFormalSyntax.js +0 -34
  260. package/src/util/withAlphaVariable.js +0 -49
  261. package/src/value-parser/LICENSE +0 -22
  262. package/src/value-parser/README.md +0 -3
  263. package/src/value-parser/index.d.ts +0 -177
  264. package/src/value-parser/index.js +0 -28
  265. package/src/value-parser/parse.js +0 -303
  266. package/src/value-parser/stringify.js +0 -41
  267. package/src/value-parser/unit.js +0 -118
  268. package/src/value-parser/walk.js +0 -18
  269. package/stubs/.gitignore +0 -1
  270. package/stubs/.prettierrc.json +0 -6
  271. package/stubs/config.full.js +0 -1062
  272. package/stubs/config.simple.js +0 -7
  273. package/stubs/postcss.config.cjs +0 -6
  274. package/stubs/postcss.config.js +0 -6
  275. package/stubs/tailwind.config.cjs +0 -2
  276. package/stubs/tailwind.config.js +0 -2
  277. package/stubs/tailwind.config.ts +0 -3
  278. package/tailwind.css +0 -5
  279. package/types/config.d.ts +0 -369
  280. package/types/generated/.gitkeep +0 -0
  281. package/types/generated/colors.d.ts +0 -298
  282. package/types/generated/corePluginList.d.ts +0 -1
  283. package/types/generated/default-theme.d.ts +0 -397
  284. package/types/index.d.ts +0 -11
  285. package/variants.css +0 -1
@@ -1,896 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- getClassNameFromSelector: function() {
13
- return getClassNameFromSelector;
14
- },
15
- resolveMatches: function() {
16
- return resolveMatches;
17
- },
18
- generateRules: function() {
19
- return generateRules;
20
- }
21
- });
22
- const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
23
- const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
24
- const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
25
- const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
26
- const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
27
- const _pluginUtils = require("../util/pluginUtils");
28
- const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
29
- const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
30
- const _formatVariantSelector = require("../util/formatVariantSelector");
31
- const _nameClass = require("../util/nameClass");
32
- const _dataTypes = require("../util/dataTypes");
33
- const _setupContextUtils = require("./setupContextUtils");
34
- const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
35
- const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly.js");
36
- const _featureFlags = require("../featureFlags");
37
- const _applyImportantSelector = require("../util/applyImportantSelector");
38
- function _interop_require_default(obj) {
39
- return obj && obj.__esModule ? obj : {
40
- default: obj
41
- };
42
- }
43
- function _getRequireWildcardCache(nodeInterop) {
44
- if (typeof WeakMap !== "function") return null;
45
- var cacheBabelInterop = new WeakMap();
46
- var cacheNodeInterop = new WeakMap();
47
- return (_getRequireWildcardCache = function(nodeInterop) {
48
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
49
- })(nodeInterop);
50
- }
51
- function _interop_require_wildcard(obj, nodeInterop) {
52
- if (!nodeInterop && obj && obj.__esModule) {
53
- return obj;
54
- }
55
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
56
- return {
57
- default: obj
58
- };
59
- }
60
- var cache = _getRequireWildcardCache(nodeInterop);
61
- if (cache && cache.has(obj)) {
62
- return cache.get(obj);
63
- }
64
- var newObj = {};
65
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
66
- for(var key in obj){
67
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
68
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
69
- if (desc && (desc.get || desc.set)) {
70
- Object.defineProperty(newObj, key, desc);
71
- } else {
72
- newObj[key] = obj[key];
73
- }
74
- }
75
- }
76
- newObj.default = obj;
77
- if (cache) {
78
- cache.set(obj, newObj);
79
- }
80
- return newObj;
81
- }
82
- let classNameParser = (0, _postcssselectorparser.default)((selectors)=>{
83
- return selectors.first.filter(({ type })=>type === "class").pop().value;
84
- });
85
- function getClassNameFromSelector(selector) {
86
- return classNameParser.transformSync(selector);
87
- }
88
- // Generate match permutations for a class candidate, like:
89
- // ['ring-offset-blue', '100']
90
- // ['ring-offset', 'blue-100']
91
- // ['ring', 'offset-blue-100']
92
- // Example with dynamic classes:
93
- // ['grid-cols', '[[linename],1fr,auto]']
94
- // ['grid', 'cols-[[linename],1fr,auto]']
95
- function* candidatePermutations(candidate) {
96
- let lastIndex = Infinity;
97
- while(lastIndex >= 0){
98
- let dashIdx;
99
- let wasSlash = false;
100
- if (lastIndex === Infinity && candidate.endsWith("]")) {
101
- let bracketIdx = candidate.indexOf("[");
102
- // If character before `[` isn't a dash or a slash, this isn't a dynamic class
103
- // eg. string[]
104
- if (candidate[bracketIdx - 1] === "-") {
105
- dashIdx = bracketIdx - 1;
106
- } else if (candidate[bracketIdx - 1] === "/") {
107
- dashIdx = bracketIdx - 1;
108
- wasSlash = true;
109
- } else {
110
- dashIdx = -1;
111
- }
112
- } else if (lastIndex === Infinity && candidate.includes("/")) {
113
- dashIdx = candidate.lastIndexOf("/");
114
- wasSlash = true;
115
- } else {
116
- dashIdx = candidate.lastIndexOf("-", lastIndex);
117
- }
118
- if (dashIdx < 0) {
119
- break;
120
- }
121
- let prefix = candidate.slice(0, dashIdx);
122
- let modifier = candidate.slice(wasSlash ? dashIdx : dashIdx + 1);
123
- lastIndex = dashIdx - 1;
124
- // TODO: This feels a bit hacky
125
- if (prefix === "" || modifier === "/") {
126
- continue;
127
- }
128
- yield [
129
- prefix,
130
- modifier
131
- ];
132
- }
133
- }
134
- function applyPrefix(matches, context) {
135
- if (matches.length === 0 || context.tailwindConfig.prefix === "") {
136
- return matches;
137
- }
138
- for (let match of matches){
139
- let [meta] = match;
140
- if (meta.options.respectPrefix) {
141
- let container = _postcss.default.root({
142
- nodes: [
143
- match[1].clone()
144
- ]
145
- });
146
- let classCandidate = match[1].raws.tailwind.classCandidate;
147
- container.walkRules((r)=>{
148
- // If this is a negative utility with a dash *before* the prefix we
149
- // have to ensure that the generated selector matches the candidate
150
- // Not doing this will cause `-tw-top-1` to generate the class `.tw--top-1`
151
- // The disconnect between candidate <-> class can cause @apply to hard crash.
152
- let shouldPrependNegative = classCandidate.startsWith("-");
153
- r.selector = (0, _prefixSelector.default)(context.tailwindConfig.prefix, r.selector, shouldPrependNegative);
154
- });
155
- match[1] = container.nodes[0];
156
- }
157
- }
158
- return matches;
159
- }
160
- function applyImportant(matches, classCandidate) {
161
- if (matches.length === 0) {
162
- return matches;
163
- }
164
- let result = [];
165
- for (let [meta, rule] of matches){
166
- let container = _postcss.default.root({
167
- nodes: [
168
- rule.clone()
169
- ]
170
- });
171
- container.walkRules((r)=>{
172
- let ast = (0, _postcssselectorparser.default)().astSync(r.selector);
173
- // Remove extraneous selectors that do not include the base candidate
174
- ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
175
- // Update all instances of the base candidate to include the important marker
176
- (0, _pluginUtils.updateAllClasses)(ast, (className)=>className === classCandidate ? `!${className}` : className);
177
- r.selector = ast.toString();
178
- r.walkDecls((d)=>d.important = true);
179
- });
180
- result.push([
181
- {
182
- ...meta,
183
- important: true
184
- },
185
- container.nodes[0]
186
- ]);
187
- }
188
- return result;
189
- }
190
- // Takes a list of rule tuples and applies a variant like `hover`, sm`,
191
- // whatever to it. We used to do some extra caching here to avoid generating
192
- // a variant of the same rule more than once, but this was never hit because
193
- // we cache at the entire selector level further up the tree.
194
- //
195
- // Technically you can get a cache hit if you have `hover:focus:text-center`
196
- // and `focus:hover:text-center` in the same project, but it doesn't feel
197
- // worth the complexity for that case.
198
- function applyVariant(variant, matches, context) {
199
- if (matches.length === 0) {
200
- return matches;
201
- }
202
- /** @type {{modifier: string | null, value: string | null}} */ let args = {
203
- modifier: null,
204
- value: _sharedState.NONE
205
- };
206
- // Retrieve "modifier"
207
- {
208
- let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(variant, "/");
209
- // This is a hack to support variants with `/` in them, like `ar-1/10/20:text-red-500`
210
- // In this case 1/10 is a value but /20 is a modifier
211
- if (modifiers.length > 1) {
212
- baseVariant = baseVariant + "/" + modifiers.slice(0, -1).join("/");
213
- modifiers = modifiers.slice(-1);
214
- }
215
- if (modifiers.length && !context.variantMap.has(variant)) {
216
- variant = baseVariant;
217
- args.modifier = modifiers[0];
218
- if (!(0, _featureFlags.flagEnabled)(context.tailwindConfig, "generalizedModifiers")) {
219
- return [];
220
- }
221
- }
222
- }
223
- // Retrieve "arbitrary value"
224
- if (variant.endsWith("]") && !variant.startsWith("[")) {
225
- // We either have:
226
- // @[200px]
227
- // group-[:hover]
228
- //
229
- // But we don't want:
230
- // @-[200px] (`-` is incorrect)
231
- // group[:hover] (`-` is missing)
232
- let match = /(.)(-?)\[(.*)\]/g.exec(variant);
233
- if (match) {
234
- let [, char, separator, value] = match;
235
- // @-[200px] case
236
- if (char === "@" && separator === "-") return [];
237
- // group[:hover] case
238
- if (char !== "@" && separator === "") return [];
239
- variant = variant.replace(`${separator}[${value}]`, "");
240
- args.value = value;
241
- }
242
- }
243
- // Register arbitrary variants
244
- if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
245
- let sort = context.offsets.recordVariant(variant);
246
- let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
247
- let selectors = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(selector, ",");
248
- // We do not support multiple selectors for arbitrary variants
249
- if (selectors.length > 1) {
250
- return [];
251
- }
252
- if (!selectors.every(_setupContextUtils.isValidVariantFormatString)) {
253
- return [];
254
- }
255
- let records = selectors.map((sel, idx)=>[
256
- context.offsets.applyParallelOffset(sort, idx),
257
- (0, _setupContextUtils.parseVariant)(sel.trim())
258
- ]);
259
- context.variantMap.set(variant, records);
260
- }
261
- if (context.variantMap.has(variant)) {
262
- var _context_variantOptions_get;
263
- let isArbitraryVariant = isArbitraryValue(variant);
264
- var _context_variantOptions_get_INTERNAL_FEATURES;
265
- let internalFeatures = (_context_variantOptions_get_INTERNAL_FEATURES = (_context_variantOptions_get = context.variantOptions.get(variant)) === null || _context_variantOptions_get === void 0 ? void 0 : _context_variantOptions_get[_setupContextUtils.INTERNAL_FEATURES]) !== null && _context_variantOptions_get_INTERNAL_FEATURES !== void 0 ? _context_variantOptions_get_INTERNAL_FEATURES : {};
266
- let variantFunctionTuples = context.variantMap.get(variant).slice();
267
- let result = [];
268
- let respectPrefix = (()=>{
269
- if (isArbitraryVariant) return false;
270
- if (internalFeatures.respectPrefix === false) return false;
271
- return true;
272
- })();
273
- for (let [meta, rule] of matches){
274
- // Don't generate variants for user css
275
- if (meta.layer === "user") {
276
- continue;
277
- }
278
- let container = _postcss.default.root({
279
- nodes: [
280
- rule.clone()
281
- ]
282
- });
283
- for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
284
- let clone = (containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container).clone();
285
- let collectedFormats = [];
286
- function prepareBackup() {
287
- // Already prepared, chicken out
288
- if (clone.raws.neededBackup) {
289
- return;
290
- }
291
- clone.raws.neededBackup = true;
292
- clone.walkRules((rule)=>rule.raws.originalSelector = rule.selector);
293
- }
294
- function modifySelectors(modifierFunction) {
295
- prepareBackup();
296
- clone.each((rule)=>{
297
- if (rule.type !== "rule") {
298
- return;
299
- }
300
- rule.selectors = rule.selectors.map((selector)=>{
301
- return modifierFunction({
302
- get className () {
303
- return getClassNameFromSelector(selector);
304
- },
305
- selector
306
- });
307
- });
308
- });
309
- return clone;
310
- }
311
- let ruleWithVariant = variantFunction({
312
- // Public API
313
- get container () {
314
- prepareBackup();
315
- return clone;
316
- },
317
- separator: context.tailwindConfig.separator,
318
- modifySelectors,
319
- // Private API for now
320
- wrap (wrapper) {
321
- let nodes = clone.nodes;
322
- clone.removeAll();
323
- wrapper.append(nodes);
324
- clone.append(wrapper);
325
- },
326
- format (selectorFormat) {
327
- collectedFormats.push({
328
- format: selectorFormat,
329
- respectPrefix
330
- });
331
- },
332
- args
333
- });
334
- // It can happen that a list of format strings is returned from within the function. In that
335
- // case, we have to process them as well. We can use the existing `variantSort`.
336
- if (Array.isArray(ruleWithVariant)) {
337
- for (let [idx, variantFunction] of ruleWithVariant.entries()){
338
- // This is a little bit scary since we are pushing to an array of items that we are
339
- // currently looping over. However, you can also think of it like a processing queue
340
- // where you keep handling jobs until everything is done and each job can queue more
341
- // jobs if needed.
342
- variantFunctionTuples.push([
343
- context.offsets.applyParallelOffset(variantSort, idx),
344
- variantFunction,
345
- // If the clone has been modified we have to pass that back
346
- // though so each rule can use the modified container
347
- clone.clone()
348
- ]);
349
- }
350
- continue;
351
- }
352
- if (typeof ruleWithVariant === "string") {
353
- collectedFormats.push({
354
- format: ruleWithVariant,
355
- respectPrefix
356
- });
357
- }
358
- if (ruleWithVariant === null) {
359
- continue;
360
- }
361
- // We had to backup selectors, therefore we assume that somebody touched
362
- // `container` or `modifySelectors`. Let's see if they did, so that we
363
- // can restore the selectors, and collect the format strings.
364
- if (clone.raws.neededBackup) {
365
- delete clone.raws.neededBackup;
366
- clone.walkRules((rule)=>{
367
- let before = rule.raws.originalSelector;
368
- if (!before) return;
369
- delete rule.raws.originalSelector;
370
- if (before === rule.selector) return; // No mutation happened
371
- let modified = rule.selector;
372
- // Rebuild the base selector, this is what plugin authors would do
373
- // as well. E.g.: `${variant}${separator}${className}`.
374
- // However, plugin authors probably also prepend or append certain
375
- // classes, pseudos, ids, ...
376
- let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
377
- selectors.walkClasses((classNode)=>{
378
- classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
379
- });
380
- }).processSync(before);
381
- // Now that we know the original selector, the new selector, and
382
- // the rebuild part in between, we can replace the part that plugin
383
- // authors need to rebuild with `&`, and eventually store it in the
384
- // collectedFormats. Similar to what `format('...')` would do.
385
- //
386
- // E.g.:
387
- // variant: foo
388
- // selector: .markdown > p
389
- // modified (by plugin): .foo .foo\\:markdown > p
390
- // rebuiltBase (internal): .foo\\:markdown > p
391
- // format: .foo &
392
- collectedFormats.push({
393
- format: modified.replace(rebuiltBase, "&"),
394
- respectPrefix
395
- });
396
- rule.selector = before;
397
- });
398
- }
399
- // This tracks the originating layer for the variant
400
- // For example:
401
- // .sm:underline {} is a variant of something in the utilities layer
402
- // .sm:container {} is a variant of the container component
403
- clone.nodes[0].raws.tailwind = {
404
- ...clone.nodes[0].raws.tailwind,
405
- parentLayer: meta.layer
406
- };
407
- var _meta_collectedFormats;
408
- let withOffset = [
409
- {
410
- ...meta,
411
- sort: context.offsets.applyVariantOffset(meta.sort, variantSort, Object.assign(args, context.variantOptions.get(variant))),
412
- collectedFormats: ((_meta_collectedFormats = meta.collectedFormats) !== null && _meta_collectedFormats !== void 0 ? _meta_collectedFormats : []).concat(collectedFormats)
413
- },
414
- clone.nodes[0]
415
- ];
416
- result.push(withOffset);
417
- }
418
- }
419
- return result;
420
- }
421
- return [];
422
- }
423
- function parseRules(rule, cache, options = {}) {
424
- // PostCSS node
425
- if (!(0, _isPlainObject.default)(rule) && !Array.isArray(rule)) {
426
- return [
427
- [
428
- rule
429
- ],
430
- options
431
- ];
432
- }
433
- // Tuple
434
- if (Array.isArray(rule)) {
435
- return parseRules(rule[0], cache, rule[1]);
436
- }
437
- // Simple object
438
- if (!cache.has(rule)) {
439
- cache.set(rule, (0, _parseObjectStyles.default)(rule));
440
- }
441
- return [
442
- cache.get(rule),
443
- options
444
- ];
445
- }
446
- const IS_VALID_PROPERTY_NAME = /^[a-z_-]/;
447
- function isValidPropName(name) {
448
- return IS_VALID_PROPERTY_NAME.test(name);
449
- }
450
- /**
451
- * @param {string} declaration
452
- * @returns {boolean}
453
- */ function looksLikeUri(declaration) {
454
- // Quick bailout for obvious non-urls
455
- // This doesn't support schemes that don't use a leading // but that's unlikely to be a problem
456
- if (!declaration.includes("://")) {
457
- return false;
458
- }
459
- try {
460
- const url = new URL(declaration);
461
- return url.scheme !== "" && url.host !== "";
462
- } catch (err) {
463
- // Definitely not a valid url
464
- return false;
465
- }
466
- }
467
- function isParsableNode(node) {
468
- let isParsable = true;
469
- node.walkDecls((decl)=>{
470
- if (!isParsableCssValue(decl.prop, decl.value)) {
471
- isParsable = false;
472
- return false;
473
- }
474
- });
475
- return isParsable;
476
- }
477
- function isParsableCssValue(property, value) {
478
- // We don't want to to treat [https://example.com] as a custom property
479
- // Even though, according to the CSS grammar, it's a totally valid CSS declaration
480
- // So we short-circuit here by checking if the custom property looks like a url
481
- if (looksLikeUri(`${property}:${value}`)) {
482
- return false;
483
- }
484
- try {
485
- _postcss.default.parse(`a{${property}:${value}}`).toResult();
486
- return true;
487
- } catch (err) {
488
- return false;
489
- }
490
- }
491
- function extractArbitraryProperty(classCandidate, context) {
492
- var _classCandidate_match;
493
- let [, property, value] = (_classCandidate_match = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && _classCandidate_match !== void 0 ? _classCandidate_match : [];
494
- if (value === undefined) {
495
- return null;
496
- }
497
- if (!isValidPropName(property)) {
498
- return null;
499
- }
500
- if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
501
- return null;
502
- }
503
- let normalized = (0, _dataTypes.normalize)(value, {
504
- property
505
- });
506
- if (!isParsableCssValue(property, normalized)) {
507
- return null;
508
- }
509
- let sort = context.offsets.arbitraryProperty();
510
- return [
511
- [
512
- {
513
- sort,
514
- layer: "utilities"
515
- },
516
- ()=>({
517
- [(0, _nameClass.asClass)(classCandidate)]: {
518
- [property]: normalized
519
- }
520
- })
521
- ]
522
- ];
523
- }
524
- function* resolveMatchedPlugins(classCandidate, context) {
525
- if (context.candidateRuleMap.has(classCandidate)) {
526
- yield [
527
- context.candidateRuleMap.get(classCandidate),
528
- "DEFAULT"
529
- ];
530
- }
531
- yield* function*(arbitraryPropertyRule) {
532
- if (arbitraryPropertyRule !== null) {
533
- yield [
534
- arbitraryPropertyRule,
535
- "DEFAULT"
536
- ];
537
- }
538
- }(extractArbitraryProperty(classCandidate, context));
539
- let candidatePrefix = classCandidate;
540
- let negative = false;
541
- const twConfigPrefix = context.tailwindConfig.prefix;
542
- const twConfigPrefixLen = twConfigPrefix.length;
543
- const hasMatchingPrefix = candidatePrefix.startsWith(twConfigPrefix) || candidatePrefix.startsWith(`-${twConfigPrefix}`);
544
- if (candidatePrefix[twConfigPrefixLen] === "-" && hasMatchingPrefix) {
545
- negative = true;
546
- candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
547
- }
548
- if (negative && context.candidateRuleMap.has(candidatePrefix)) {
549
- yield [
550
- context.candidateRuleMap.get(candidatePrefix),
551
- "-DEFAULT"
552
- ];
553
- }
554
- for (let [prefix, modifier] of candidatePermutations(candidatePrefix)){
555
- if (context.candidateRuleMap.has(prefix)) {
556
- yield [
557
- context.candidateRuleMap.get(prefix),
558
- negative ? `-${modifier}` : modifier
559
- ];
560
- }
561
- }
562
- }
563
- function splitWithSeparator(input, separator) {
564
- if (input === _sharedState.NOT_ON_DEMAND) {
565
- return [
566
- _sharedState.NOT_ON_DEMAND
567
- ];
568
- }
569
- return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, separator);
570
- }
571
- function* recordCandidates(matches, classCandidate) {
572
- for (const match of matches){
573
- var _match__options;
574
- var _match__options_preserveSource;
575
- match[1].raws.tailwind = {
576
- ...match[1].raws.tailwind,
577
- classCandidate,
578
- preserveSource: (_match__options_preserveSource = (_match__options = match[0].options) === null || _match__options === void 0 ? void 0 : _match__options.preserveSource) !== null && _match__options_preserveSource !== void 0 ? _match__options_preserveSource : false
579
- };
580
- yield match;
581
- }
582
- }
583
- function* resolveMatches(candidate, context) {
584
- let separator = context.tailwindConfig.separator;
585
- let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
586
- let important = false;
587
- if (classCandidate.startsWith("!")) {
588
- important = true;
589
- classCandidate = classCandidate.slice(1);
590
- }
591
- // TODO: Reintroduce this in ways that doesn't break on false positives
592
- // function sortAgainst(toSort, against) {
593
- // return toSort.slice().sort((a, z) => {
594
- // return bigSign(against.get(a)[0] - against.get(z)[0])
595
- // })
596
- // }
597
- // let sorted = sortAgainst(variants, context.variantMap)
598
- // if (sorted.toString() !== variants.toString()) {
599
- // let corrected = sorted.reverse().concat(classCandidate).join(':')
600
- // throw new Error(`Class ${candidate} should be written as ${corrected}`)
601
- // }
602
- for (let matchedPlugins of resolveMatchedPlugins(classCandidate, context)){
603
- let matches = [];
604
- let typesByMatches = new Map();
605
- let [plugins, modifier] = matchedPlugins;
606
- let isOnlyPlugin = plugins.length === 1;
607
- for (let [sort, plugin] of plugins){
608
- let matchesPerPlugin = [];
609
- if (typeof plugin === "function") {
610
- for (let ruleSet of [].concat(plugin(modifier, {
611
- isOnlyPlugin
612
- }))){
613
- let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
614
- for (let rule of rules){
615
- matchesPerPlugin.push([
616
- {
617
- ...sort,
618
- options: {
619
- ...sort.options,
620
- ...options
621
- }
622
- },
623
- rule
624
- ]);
625
- }
626
- }
627
- } else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
628
- let ruleSet = plugin;
629
- let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
630
- for (let rule of rules){
631
- matchesPerPlugin.push([
632
- {
633
- ...sort,
634
- options: {
635
- ...sort.options,
636
- ...options
637
- }
638
- },
639
- rule
640
- ]);
641
- }
642
- }
643
- if (matchesPerPlugin.length > 0) {
644
- var _sort_options;
645
- var _sort_options_types, _sort_options1;
646
- let matchingTypes = Array.from((0, _pluginUtils.getMatchingTypes)((_sort_options_types = (_sort_options = sort.options) === null || _sort_options === void 0 ? void 0 : _sort_options.types) !== null && _sort_options_types !== void 0 ? _sort_options_types : [], modifier, (_sort_options1 = sort.options) !== null && _sort_options1 !== void 0 ? _sort_options1 : {}, context.tailwindConfig)).map(([_, type])=>type);
647
- if (matchingTypes.length > 0) {
648
- typesByMatches.set(matchesPerPlugin, matchingTypes);
649
- }
650
- matches.push(matchesPerPlugin);
651
- }
652
- }
653
- if (isArbitraryValue(modifier)) {
654
- if (matches.length > 1) {
655
- // Partition plugins in 2 categories so that we can start searching in the plugins that
656
- // don't have `any` as a type first.
657
- let [withAny, withoutAny] = matches.reduce((group, plugin)=>{
658
- let hasAnyType = plugin.some(([{ options }])=>options.types.some(({ type })=>type === "any"));
659
- if (hasAnyType) {
660
- group[0].push(plugin);
661
- } else {
662
- group[1].push(plugin);
663
- }
664
- return group;
665
- }, [
666
- [],
667
- []
668
- ]);
669
- function findFallback(matches) {
670
- // If only a single plugin matches, let's take that one
671
- if (matches.length === 1) {
672
- return matches[0];
673
- }
674
- // Otherwise, find the plugin that creates a valid rule given the arbitrary value, and
675
- // also has the correct type which preferOnConflicts the plugin in case of clashes.
676
- return matches.find((rules)=>{
677
- let matchingTypes = typesByMatches.get(rules);
678
- return rules.some(([{ options }, rule])=>{
679
- if (!isParsableNode(rule)) {
680
- return false;
681
- }
682
- return options.types.some(({ type , preferOnConflict })=>matchingTypes.includes(type) && preferOnConflict);
683
- });
684
- });
685
- }
686
- var _findFallback;
687
- // Try to find a fallback plugin, because we already know that multiple plugins matched for
688
- // the given arbitrary value.
689
- let fallback = (_findFallback = findFallback(withoutAny)) !== null && _findFallback !== void 0 ? _findFallback : findFallback(withAny);
690
- if (fallback) {
691
- matches = [
692
- fallback
693
- ];
694
- } else {
695
- var _typesByMatches_get;
696
- let typesPerPlugin = matches.map((match)=>new Set([
697
- ...(_typesByMatches_get = typesByMatches.get(match)) !== null && _typesByMatches_get !== void 0 ? _typesByMatches_get : []
698
- ]));
699
- // Remove duplicates, so that we can detect proper unique types for each plugin.
700
- for (let pluginTypes of typesPerPlugin){
701
- for (let type of pluginTypes){
702
- let removeFromOwnGroup = false;
703
- for (let otherGroup of typesPerPlugin){
704
- if (pluginTypes === otherGroup) continue;
705
- if (otherGroup.has(type)) {
706
- otherGroup.delete(type);
707
- removeFromOwnGroup = true;
708
- }
709
- }
710
- if (removeFromOwnGroup) pluginTypes.delete(type);
711
- }
712
- }
713
- let messages = [];
714
- for (let [idx, group] of typesPerPlugin.entries()){
715
- for (let type of group){
716
- let rules = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
717
- .map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
718
- .join("\n")).join("\n\n");
719
- messages.push(` Use \`${candidate.replace("[", `[${type}:`)}\` for \`${rules.trim()}\``);
720
- break;
721
- }
722
- }
723
- _log.default.warn([
724
- `The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
725
- ...messages,
726
- `If this is content and not a class, replace it with \`${candidate.replace("[", "&lsqb;").replace("]", "&rsqb;")}\` to silence this warning.`
727
- ]);
728
- continue;
729
- }
730
- }
731
- matches = matches.map((list)=>list.filter((match)=>isParsableNode(match[1])));
732
- }
733
- matches = matches.flat();
734
- matches = Array.from(recordCandidates(matches, classCandidate));
735
- matches = applyPrefix(matches, context);
736
- if (important) {
737
- matches = applyImportant(matches, classCandidate);
738
- }
739
- for (let variant of variants){
740
- matches = applyVariant(variant, matches, context);
741
- }
742
- for (let match of matches){
743
- match[1].raws.tailwind = {
744
- ...match[1].raws.tailwind,
745
- candidate
746
- };
747
- // Apply final format selector
748
- match = applyFinalFormat(match, {
749
- context,
750
- candidate
751
- });
752
- // Skip rules with invalid selectors
753
- // This will cause the candidate to be added to the "not class"
754
- // cache skipping it entirely for future builds
755
- if (match === null) {
756
- continue;
757
- }
758
- yield match;
759
- }
760
- }
761
- }
762
- function applyFinalFormat(match, { context , candidate }) {
763
- if (!match[0].collectedFormats) {
764
- return match;
765
- }
766
- let isValid = true;
767
- let finalFormat;
768
- try {
769
- finalFormat = (0, _formatVariantSelector.formatVariantSelector)(match[0].collectedFormats, {
770
- context,
771
- candidate
772
- });
773
- } catch {
774
- // The format selector we produced is invalid
775
- // This could be because:
776
- // - A bug exists
777
- // - A plugin introduced an invalid variant selector (ex: `addVariant('foo', '&;foo')`)
778
- // - The user used an invalid arbitrary variant (ex: `[&;foo]:underline`)
779
- // Either way the build will fail because of this
780
- // We would rather that the build pass "silently" given that this could
781
- // happen because of picking up invalid things when scanning content
782
- // So we'll throw out the candidate instead
783
- return null;
784
- }
785
- let container = _postcss.default.root({
786
- nodes: [
787
- match[1].clone()
788
- ]
789
- });
790
- container.walkRules((rule)=>{
791
- if (inKeyframes(rule)) {
792
- return;
793
- }
794
- try {
795
- let selector = (0, _formatVariantSelector.finalizeSelector)(rule.selector, finalFormat, {
796
- candidate,
797
- context
798
- });
799
- // Finalize Selector determined that this candidate is irrelevant
800
- // TODO: This elimination should happen earlier so this never happens
801
- if (selector === null) {
802
- rule.remove();
803
- return;
804
- }
805
- rule.selector = selector;
806
- } catch {
807
- // If this selector is invalid we also want to skip it
808
- // But it's likely that being invalid here means there's a bug in a plugin rather than too loosely matching content
809
- isValid = false;
810
- return false;
811
- }
812
- });
813
- if (!isValid) {
814
- return null;
815
- }
816
- // If all rules have been eliminated we can skip this candidate entirely
817
- if (container.nodes.length === 0) {
818
- return null;
819
- }
820
- match[1] = container.nodes[0];
821
- return match;
822
- }
823
- function inKeyframes(rule) {
824
- return rule.parent && rule.parent.type === "atrule" && rule.parent.name === "keyframes";
825
- }
826
- function getImportantStrategy(important) {
827
- if (important === true) {
828
- return (rule)=>{
829
- if (inKeyframes(rule)) {
830
- return;
831
- }
832
- rule.walkDecls((d)=>{
833
- if (d.parent.type === "rule" && !inKeyframes(d.parent)) {
834
- d.important = true;
835
- }
836
- });
837
- };
838
- }
839
- if (typeof important === "string") {
840
- return (rule)=>{
841
- if (inKeyframes(rule)) {
842
- return;
843
- }
844
- rule.selectors = rule.selectors.map((selector)=>{
845
- return (0, _applyImportantSelector.applyImportantSelector)(selector, important);
846
- });
847
- };
848
- }
849
- }
850
- function generateRules(candidates, context, isSorting = false) {
851
- let allRules = [];
852
- let strategy = getImportantStrategy(context.tailwindConfig.important);
853
- for (let candidate of candidates){
854
- if (context.notClassCache.has(candidate)) {
855
- continue;
856
- }
857
- if (context.candidateRuleCache.has(candidate)) {
858
- allRules = allRules.concat(Array.from(context.candidateRuleCache.get(candidate)));
859
- continue;
860
- }
861
- let matches = Array.from(resolveMatches(candidate, context));
862
- if (matches.length === 0) {
863
- context.notClassCache.add(candidate);
864
- continue;
865
- }
866
- context.classCache.set(candidate, matches);
867
- var _context_candidateRuleCache_get;
868
- let rules = (_context_candidateRuleCache_get = context.candidateRuleCache.get(candidate)) !== null && _context_candidateRuleCache_get !== void 0 ? _context_candidateRuleCache_get : new Set();
869
- context.candidateRuleCache.set(candidate, rules);
870
- for (const match of matches){
871
- let [{ sort , options }, rule] = match;
872
- if (options.respectImportant && strategy) {
873
- let container = _postcss.default.root({
874
- nodes: [
875
- rule.clone()
876
- ]
877
- });
878
- container.walkRules(strategy);
879
- rule = container.nodes[0];
880
- }
881
- // Note: We have to clone rules during sorting
882
- // so we eliminate some shared mutable state
883
- let newEntry = [
884
- sort,
885
- isSorting ? rule.clone() : rule
886
- ];
887
- rules.add(newEntry);
888
- context.ruleCache.add(newEntry);
889
- allRules.push(newEntry);
890
- }
891
- }
892
- return allRules;
893
- }
894
- function isArbitraryValue(input) {
895
- return input.startsWith("[") && input.endsWith("]");
896
- }