tailwindcss 0.0.0-oxide-insiders.dddaded → 0.0.0-oxide-insiders.b2e3cf2

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 (112) hide show
  1. package/lib/cli/build/deps.js +10 -18
  2. package/lib/cli/build/index.js +10 -41
  3. package/lib/cli/build/plugin.js +87 -268
  4. package/lib/cli/build/utils.js +18 -40
  5. package/lib/cli/build/watching.js +35 -151
  6. package/lib/cli/help/index.js +15 -58
  7. package/lib/cli/index.js +61 -120
  8. package/lib/cli/init/index.js +21 -43
  9. package/lib/cli-peer-dependencies.js +13 -15
  10. package/lib/cli.js +1 -5
  11. package/lib/corePluginList.js +3 -4
  12. package/lib/corePlugins.js +394 -857
  13. package/lib/featureFlags.js +14 -34
  14. package/lib/index.js +1 -5
  15. package/lib/lib/cacheInvalidation.js +29 -75
  16. package/lib/lib/collapseAdjacentRules.js +22 -43
  17. package/lib/lib/collapseDuplicateDeclarations.js +27 -68
  18. package/lib/lib/content.js +37 -126
  19. package/lib/lib/defaultExtractor.js +96 -199
  20. package/lib/lib/detectNesting.js +12 -36
  21. package/lib/lib/evaluateTailwindFunctions.js +101 -188
  22. package/lib/lib/expandApplyAtRules.js +177 -482
  23. package/lib/lib/expandTailwindAtRules.js +69 -237
  24. package/lib/lib/findAtConfigPath.js +13 -30
  25. package/lib/lib/generateRules.js +349 -765
  26. package/lib/lib/getModuleDependencies.js +27 -63
  27. package/lib/lib/load-config.js +16 -24
  28. package/lib/lib/normalizeTailwindDirectives.js +26 -70
  29. package/lib/lib/offsets.js +61 -224
  30. package/lib/lib/partitionApplyAtRules.js +29 -51
  31. package/lib/lib/regex.js +22 -30
  32. package/lib/lib/remap-bitfield.js +9 -84
  33. package/lib/lib/resolveDefaultsAtRules.js +50 -116
  34. package/lib/lib/setupContextUtils.js +576 -1099
  35. package/lib/lib/setupTrackingContext.js +54 -143
  36. package/lib/lib/sharedState.js +15 -59
  37. package/lib/lib/substituteScreenAtRules.js +8 -16
  38. package/lib/oxide/cli/build/deps.js +17 -32
  39. package/lib/oxide/cli/build/index.js +10 -40
  40. package/lib/oxide/cli/build/plugin.js +87 -267
  41. package/lib/oxide/cli/build/utils.js +18 -39
  42. package/lib/oxide/cli/build/watching.js +34 -149
  43. package/lib/oxide/cli/help/index.js +15 -57
  44. package/lib/oxide/cli/index.js +66 -127
  45. package/lib/oxide/cli/init/index.js +17 -36
  46. package/lib/oxide/cli.js +2 -3
  47. package/lib/plugin.js +30 -57
  48. package/lib/postcss-plugins/nesting/index.js +6 -10
  49. package/lib/postcss-plugins/nesting/plugin.js +17 -60
  50. package/lib/processTailwindFeatures.js +8 -37
  51. package/lib/public/colors.js +15 -22
  52. package/lib/public/create-plugin.js +5 -8
  53. package/lib/public/default-config.js +5 -9
  54. package/lib/public/default-theme.js +5 -9
  55. package/lib/public/load-config.js +4 -6
  56. package/lib/public/resolve-config.js +4 -6
  57. package/lib/util/applyImportantSelector.js +15 -24
  58. package/lib/util/bigSign.js +6 -7
  59. package/lib/util/buildMediaQuery.js +10 -17
  60. package/lib/util/cloneDeep.js +9 -17
  61. package/lib/util/cloneNodes.js +14 -27
  62. package/lib/util/color.js +45 -81
  63. package/lib/util/configurePlugins.js +9 -16
  64. package/lib/util/createPlugin.js +8 -15
  65. package/lib/util/createUtilityPlugin.js +15 -27
  66. package/lib/util/dataTypes.js +23 -144
  67. package/lib/util/defaults.js +9 -19
  68. package/lib/util/escapeClassName.js +6 -10
  69. package/lib/util/escapeCommas.js +6 -7
  70. package/lib/util/flattenColorPalette.js +6 -8
  71. package/lib/util/formatVariantSelector.js +49 -190
  72. package/lib/util/getAllConfigs.js +35 -42
  73. package/lib/util/hashConfig.js +6 -8
  74. package/lib/util/isKeyframeRule.js +6 -7
  75. package/lib/util/isPlainObject.js +8 -11
  76. package/lib/util/isSyntacticallyValidPropertyValue.js +13 -42
  77. package/lib/util/log.js +7 -14
  78. package/lib/util/nameClass.js +6 -21
  79. package/lib/util/negateValue.js +10 -26
  80. package/lib/util/normalizeConfig.js +63 -240
  81. package/lib/util/normalizeScreens.js +70 -137
  82. package/lib/util/parseAnimationValue.js +13 -61
  83. package/lib/util/parseBoxShadowValue.js +12 -57
  84. package/lib/util/parseDependency.js +13 -37
  85. package/lib/util/parseGlob.js +7 -22
  86. package/lib/util/parseObjectStyles.js +17 -26
  87. package/lib/util/pluginUtils.js +69 -176
  88. package/lib/util/prefixSelector.js +11 -28
  89. package/lib/util/pseudoElements.js +29 -105
  90. package/lib/util/removeAlphaVariables.js +8 -21
  91. package/lib/util/resolveConfig.js +103 -220
  92. package/lib/util/resolveConfigPath.js +12 -38
  93. package/lib/util/responsive.js +4 -6
  94. package/lib/util/splitAtTopLevelOnly.js +10 -44
  95. package/lib/util/tap.js +6 -8
  96. package/lib/util/toColorValue.js +6 -7
  97. package/lib/util/toPath.js +8 -26
  98. package/lib/util/transformThemeValue.js +12 -45
  99. package/lib/util/validateConfig.js +14 -22
  100. package/lib/util/validateFormalSyntax.js +5 -11
  101. package/lib/util/withAlphaVariable.js +28 -48
  102. package/package.json +3 -3
  103. package/peers/index.js +14 -16
  104. package/src/cli/build/plugin.js +1 -1
  105. package/src/cli.js +1 -1
  106. package/src/corePlugins.js +16 -17
  107. package/src/featureFlags.js +2 -3
  108. package/src/index.js +1 -5
  109. package/src/lib/expandTailwindAtRules.js +2 -2
  110. package/src/lib/sharedState.js +0 -15
  111. package/src/oxide/cli/build/plugin.ts +1 -1
  112. package/src/plugin.js +1 -1
@@ -1,150 +1,88 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "defaultExtractor", {
6
- enumerable: true,
3
+ value: !0
4
+ }), Object.defineProperty(exports, "defaultExtractor", {
5
+ enumerable: !0,
7
6
  get: ()=>defaultExtractor
8
7
  });
9
- const _featureFlags = require("../featureFlags");
10
- const _regex = /*#__PURE__*/ _interopRequireWildcard(require("./regex"));
8
+ const _featureFlags = require("../featureFlags"), _regex = function(obj, nodeInterop) {
9
+ if (!nodeInterop && obj && obj.__esModule) return obj;
10
+ if (null === obj || "object" != typeof obj && "function" != typeof obj) return {
11
+ default: obj
12
+ };
13
+ var cache = _getRequireWildcardCache(nodeInterop);
14
+ if (cache && cache.has(obj)) return cache.get(obj);
15
+ var newObj = {}, hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
16
+ for(var key in obj)if ("default" !== key && Object.prototype.hasOwnProperty.call(obj, key)) {
17
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
18
+ desc && (desc.get || desc.set) ? Object.defineProperty(newObj, key, desc) : newObj[key] = obj[key];
19
+ }
20
+ return newObj.default = obj, cache && cache.set(obj, newObj), newObj;
21
+ }(require("./regex"));
11
22
  function _getRequireWildcardCache(nodeInterop) {
12
- if (typeof WeakMap !== "function") return null;
13
- var cacheBabelInterop = new WeakMap();
14
- var cacheNodeInterop = new WeakMap();
23
+ if ("function" != typeof WeakMap) return null;
24
+ var cacheBabelInterop = new WeakMap(), cacheNodeInterop = new WeakMap();
15
25
  return (_getRequireWildcardCache = function(nodeInterop) {
16
26
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
27
  })(nodeInterop);
18
28
  }
19
- function _interopRequireWildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for(var key in obj){
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
50
29
  function defaultExtractor(context) {
51
- let patterns = Array.from(buildRegExps(context));
52
- /**
53
- * @param {string} content
54
- */ return (content)=>{
55
- /** @type {(string|string)[]} */ let results = [];
56
- for (let pattern of patterns){
57
- var _content_match;
58
- results = [
59
- ...results,
60
- ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
61
- ];
62
- }
63
- return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
64
- };
65
- }
66
- function* buildRegExps(context) {
67
- let separator = context.tailwindConfig.separator;
68
- let variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping");
69
- let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
70
- /-?/,
71
- _regex.escape(context.tailwindConfig.prefix)
72
- ])) : "";
73
- let utility = _regex.any([
74
- // Arbitrary properties (without square brackets)
75
- /\[[^\s:'"`]+:[^\s\[\]]+\]/,
76
- // Arbitrary properties with balanced square brackets
77
- // This is a targeted fix to continue to allow theme()
78
- // with square brackets to work in arbitrary properties
79
- // while fixing a problem with the regex matching too much
80
- /\[[^\s:'"`]+:[^\s]+?\[[^\s]+?\][^\s]+?\]/,
81
- // Utilities
82
- _regex.pattern([
83
- // Utility Name / Group Name
84
- /-?(?:\w+)/,
85
- // Normal/Arbitrary values
86
- _regex.optional(_regex.any([
30
+ let patterns = Array.from(function*(context) {
31
+ let separator = context.tailwindConfig.separator, variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping"), prefix = "" !== context.tailwindConfig.prefix ? _regex.optional(_regex.pattern([
32
+ /-?/,
33
+ _regex.escape(context.tailwindConfig.prefix)
34
+ ])) : "", utility = _regex.any([
35
+ /\[[^\s:'"`]+:[^\s\[\]]+\]/,
36
+ /\[[^\s:'"`]+:[^\s]+?\[[^\s]+?\][^\s]+?\]/,
37
+ _regex.pattern([
38
+ /-?(?:\w+)/,
39
+ _regex.optional(_regex.any([
40
+ _regex.pattern([
41
+ /-(?:\w+-)*\[[^\s:]+\]/,
42
+ /(?![{([]])/,
43
+ /(?:\/[^\s'"`\\><$]*)?/
44
+ ]),
45
+ _regex.pattern([
46
+ /-(?:\w+-)*\[[^\s]+\]/,
47
+ /(?![{([]])/,
48
+ /(?:\/[^\s'"`\\$]*)?/
49
+ ]),
50
+ /[-\/][^\s'"`\\$={><]*/
51
+ ]))
52
+ ])
53
+ ]);
54
+ for (let variantPattern of [
55
+ _regex.any([
87
56
  _regex.pattern([
88
- // Arbitrary values
89
- /-(?:\w+-)*\[[^\s:]+\]/,
90
- // Not immediately followed by an `{[(`
91
- /(?![{([]])/,
92
- // optionally followed by an opacity modifier
93
- /(?:\/[^\s'"`\\><$]*)?/
57
+ /@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
58
+ separator
94
59
  ]),
95
60
  _regex.pattern([
96
- // Arbitrary values
97
- /-(?:\w+-)*\[[^\s]+\]/,
98
- // Not immediately followed by an `{[(`
99
- /(?![{([]])/,
100
- // optionally followed by an opacity modifier
101
- /(?:\/[^\s'"`\\$]*)?/
61
+ /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
62
+ separator
102
63
  ]),
103
- // Normal values w/o quotes — may include an opacity modifier
104
- /[-\/][^\s'"`\\$={><]*/
105
- ]))
106
- ])
107
- ]);
108
- let variantPatterns = [
109
- // Without quotes
110
- _regex.any([
111
- // This is here to provide special support for the `@` variant
112
- _regex.pattern([
113
- /@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
114
- separator
115
- ]),
116
- _regex.pattern([
117
- /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
118
- separator
119
- ]),
120
- _regex.pattern([
121
- /[^\s"'`\[\\]+/,
122
- separator
123
- ])
124
- ]),
125
- // With quotes allowed
126
- _regex.any([
127
- _regex.pattern([
128
- /([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
129
- separator
64
+ _regex.pattern([
65
+ /[^\s"'`\[\\]+/,
66
+ separator
67
+ ])
130
68
  ]),
131
- _regex.pattern([
132
- /[^\s`\[\\]+/,
133
- separator
69
+ _regex.any([
70
+ _regex.pattern([
71
+ /([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
72
+ separator
73
+ ]),
74
+ _regex.pattern([
75
+ /[^\s`\[\\]+/,
76
+ separator
77
+ ])
134
78
  ])
135
- ])
136
- ];
137
- for (const variantPattern of variantPatterns){
138
- yield _regex.pattern([
139
- // Variants
79
+ ])yield _regex.pattern([
140
80
  "((?=((",
141
81
  variantPattern,
142
82
  ")+))\\2)?",
143
- // Important (optional)
144
83
  /!?/,
145
84
  prefix,
146
85
  variantGroupingEnabled ? _regex.any([
147
- // Or any of those things but grouped separated by commas
148
86
  _regex.pattern([
149
87
  /\(/,
150
88
  utility,
@@ -154,88 +92,47 @@ function* buildRegExps(context) {
154
92
  ]),
155
93
  /\)/
156
94
  ]),
157
- // Arbitrary properties, constrained utilities, arbitrary values, etc…
158
95
  utility
159
96
  ]) : utility
160
97
  ]);
161
- }
162
- // 5. Inner matches
163
- yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
98
+ yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
99
+ }(context));
100
+ return (content)=>{
101
+ let results = [];
102
+ for (let pattern of patterns){
103
+ var _content_match;
104
+ results = [
105
+ ...results,
106
+ ...null !== (_content_match = content.match(pattern)) && void 0 !== _content_match ? _content_match : []
107
+ ];
108
+ }
109
+ return results.filter((v)=>void 0 !== v).map(clipAtBalancedParens);
110
+ };
164
111
  }
165
- // We want to capture any "special" characters
166
- // AND the characters immediately following them (if there is one)
167
- let SPECIALS = /([\[\]'"`])([^\[\]'"`])?/g;
168
- let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
169
- /**
170
- * Clips a string ensuring that parentheses, quotes, etc… are balanced
171
- * Used for arbitrary values only
172
- *
173
- * We will go past the end of the balanced parens until we find a non-class character
174
- *
175
- * Depth matching behavior:
176
- * w-[calc(100%-theme('spacing[some_key][1.5]'))]']
177
- * ┬ ┬ ┬┬ ┬ ┬┬ ┬┬┬┬┬┬┬
178
- * 1 2 3 4 34 3 210 END
179
- * ╰────┴──────────┴────────┴────────┴┴───┴─┴┴┴
180
- *
181
- * @param {string} input
182
- */ function clipAtBalancedParens(input) {
183
- // We are care about this for arbitrary values
184
- if (!input.includes("-[")) {
185
- return input;
186
- }
187
- let depth = 0;
188
- let openStringTypes = [];
189
- // Find all parens, brackets, quotes, etc
190
- // Stop when we end at a balanced pair
191
- // This is naive and will treat mismatched parens as balanced
192
- // This shouldn't be a problem in practice though
193
- let matches = input.matchAll(SPECIALS);
194
- // We can't use lookbehind assertions because we have to support Safari
195
- // So, instead, we've emulated it using capture groups and we'll re-work the matches to accommodate
196
- matches = Array.from(matches).flatMap((match)=>{
197
- const [, ...groups] = match;
112
+ let SPECIALS = /([\[\]'"`])([^\[\]'"`])?/g, ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
113
+ function clipAtBalancedParens(input) {
114
+ if (!input.includes("-[")) return input;
115
+ let depth = 0, openStringTypes = [], matches = input.matchAll(SPECIALS);
116
+ for (let match of matches = Array.from(matches).flatMap((match)=>{
117
+ let [, ...groups] = match;
198
118
  return groups.map((group, idx)=>Object.assign([], match, {
199
119
  index: match.index + idx,
200
120
  0: group
201
121
  }));
202
- });
203
- for (let match of matches){
204
- let char = match[0];
205
- let inStringType = openStringTypes[openStringTypes.length - 1];
206
- if (char === inStringType) {
207
- openStringTypes.pop();
208
- } else if (char === "'" || char === '"' || char === "`") {
209
- openStringTypes.push(char);
210
- }
211
- if (inStringType) {
212
- continue;
213
- } else if (char === "[") {
214
- depth++;
215
- continue;
216
- } else if (char === "]") {
217
- depth--;
218
- continue;
219
- }
220
- // We've gone one character past the point where we should stop
221
- // This means that there was an extra closing `]`
222
- // We'll clip to just before it
223
- if (depth < 0) {
224
- return input.substring(0, match.index - 1);
225
- }
226
- // We've finished balancing the brackets but there still may be characters that can be included
227
- // For example in the class `text-[#336699]/[.35]`
228
- // The depth goes to `0` at the closing `]` but goes up again at the `[`
229
- // If we're at zero and encounter a non-class character then we clip the class there
230
- if (depth === 0 && !ALLOWED_CLASS_CHARACTERS.test(char)) {
231
- return input.substring(0, match.index);
122
+ })){
123
+ let char = match[0], inStringType = openStringTypes[openStringTypes.length - 1];
124
+ if (char === inStringType ? openStringTypes.pop() : ("'" === char || '"' === char || "`" === char) && openStringTypes.push(char), !inStringType) {
125
+ if ("[" === char) {
126
+ depth++;
127
+ continue;
128
+ }
129
+ if ("]" === char) {
130
+ depth--;
131
+ continue;
132
+ }
133
+ if (depth < 0) return input.substring(0, match.index - 1);
134
+ if (0 === depth && !ALLOWED_CLASS_CHARACTERS.test(char)) return input.substring(0, match.index);
232
135
  }
233
136
  }
234
137
  return input;
235
- } // Regular utilities
236
- // {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
237
- // Arbitrary values
238
- // {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
239
- // arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
240
- // Arbitrary properties
241
- // {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
138
+ }
@@ -1,43 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: ()=>_default
8
- });
9
- function isRoot(node) {
10
- return node.type === "root";
11
- }
12
- function isAtLayer(node) {
13
- return node.type === "atrule" && node.name === "layer";
14
- }
15
2
  function _default(_context) {
16
3
  return (root, result)=>{
17
- let found = false;
4
+ let found = !1;
18
5
  root.walkAtRules("tailwind", (node)=>{
19
- if (found) return false;
20
- if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
21
- found = true;
22
- node.warn(result, [
23
- "Nested @tailwind rules were detected, but are not supported.",
24
- "Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
25
- "Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy"
26
- ].join("\n"));
27
- return false;
28
- }
29
- });
30
- root.walkRules((rule)=>{
31
- if (found) return false;
32
- rule.walkRules((nestedRule)=>{
33
- found = true;
34
- nestedRule.warn(result, [
35
- "Nested CSS was detected, but CSS nesting has not been configured correctly.",
36
- "Please enable a CSS nesting plugin *before* Tailwind in your configuration.",
37
- "See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting"
38
- ].join("\n"));
39
- return false;
40
- });
6
+ var node1;
7
+ return !found && (node.parent && !("root" === node.parent.type || "atrule" === (node1 = node.parent).type && "layer" === node1.name) ? (found = !0, node.warn(result, "Nested @tailwind rules were detected, but are not supported.\nConsider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix\nAlternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy"), !1) : void 0);
8
+ }), root.walkRules((rule)=>{
9
+ if (found) return !1;
10
+ rule.walkRules((nestedRule)=>(found = !0, nestedRule.warn(result, "Nested CSS was detected, but CSS nesting has not been configured correctly.\nPlease enable a CSS nesting plugin *before* Tailwind in your configuration.\nSee how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting"), !1));
41
11
  });
42
12
  };
43
13
  }
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: !0
16
+ }), Object.defineProperty(exports, "default", {
17
+ enumerable: !0,
18
+ get: ()=>_default
19
+ });