tailwindcss 0.0.0-insiders.dddaded → 0.0.0-insiders.de00a62

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 (160) hide show
  1. package/lib/cli/build/deps.js +17 -9
  2. package/lib/cli/build/index.js +10 -8
  3. package/lib/cli/build/plugin.js +31 -29
  4. package/lib/cli/build/utils.js +18 -8
  5. package/lib/cli/build/watching.js +13 -11
  6. package/lib/cli/help/index.js +6 -4
  7. package/lib/cli/index.js +4 -4
  8. package/lib/cli/init/index.js +8 -6
  9. package/lib/cli-peer-dependencies.js +12 -4
  10. package/lib/cli.js +1 -1
  11. package/lib/corePluginList.js +8 -2
  12. package/lib/corePlugins.js +211 -48
  13. package/lib/css/preflight.css +24 -8
  14. package/lib/featureFlags.js +14 -9
  15. package/lib/index.js +1 -5
  16. package/lib/lib/cacheInvalidation.js +7 -5
  17. package/lib/lib/collapseAdjacentRules.js +3 -1
  18. package/lib/lib/collapseDuplicateDeclarations.js +10 -8
  19. package/lib/lib/content.js +51 -14
  20. package/lib/lib/defaultExtractor.js +38 -28
  21. package/lib/lib/detectNesting.js +3 -1
  22. package/lib/lib/evaluateTailwindFunctions.js +20 -16
  23. package/lib/lib/expandApplyAtRules.js +41 -33
  24. package/lib/lib/expandTailwindAtRules.js +38 -19
  25. package/lib/lib/findAtConfigPath.js +6 -4
  26. package/lib/lib/generateRules.js +83 -55
  27. package/lib/lib/getModuleDependencies.js +10 -8
  28. package/lib/lib/load-config.js +18 -5
  29. package/lib/lib/normalizeTailwindDirectives.js +5 -3
  30. package/lib/lib/offsets.js +58 -7
  31. package/lib/lib/partitionApplyAtRules.js +3 -1
  32. package/lib/lib/regex.js +21 -7
  33. package/lib/lib/remap-bitfield.js +3 -1
  34. package/lib/lib/resolveDefaultsAtRules.js +27 -21
  35. package/lib/lib/setupContextUtils.js +143 -94
  36. package/lib/lib/setupTrackingContext.js +27 -24
  37. package/lib/lib/sharedState.js +28 -24
  38. package/lib/lib/substituteScreenAtRules.js +5 -3
  39. package/lib/oxide/cli/build/deps.js +16 -8
  40. package/lib/oxide/cli/build/index.js +6 -4
  41. package/lib/oxide/cli/build/plugin.js +25 -23
  42. package/lib/oxide/cli/build/utils.js +18 -8
  43. package/lib/oxide/cli/build/watching.js +10 -8
  44. package/lib/oxide/cli/help/index.js +6 -4
  45. package/lib/oxide/cli/index.js +4 -4
  46. package/lib/oxide/cli/init/index.js +6 -4
  47. package/lib/plugin.js +9 -9
  48. package/lib/postcss-plugins/nesting/index.js +3 -1
  49. package/lib/postcss-plugins/nesting/plugin.js +8 -6
  50. package/lib/processTailwindFeatures.js +16 -14
  51. package/lib/public/colors.js +5 -3
  52. package/lib/public/create-plugin.js +5 -3
  53. package/lib/public/default-config.js +6 -4
  54. package/lib/public/default-theme.js +6 -4
  55. package/lib/public/load-config.js +5 -3
  56. package/lib/public/resolve-config.js +6 -4
  57. package/lib/util/applyImportantSelector.js +7 -5
  58. package/lib/util/bigSign.js +3 -1
  59. package/lib/util/buildMediaQuery.js +3 -1
  60. package/lib/util/cloneDeep.js +3 -1
  61. package/lib/util/cloneNodes.js +36 -14
  62. package/lib/util/color.js +11 -7
  63. package/lib/util/colorNames.js +752 -0
  64. package/lib/util/configurePlugins.js +3 -1
  65. package/lib/util/createPlugin.js +3 -1
  66. package/lib/util/createUtilityPlugin.js +5 -3
  67. package/lib/util/dataTypes.js +180 -31
  68. package/lib/util/defaults.js +6 -4
  69. package/lib/util/escapeClassName.js +7 -5
  70. package/lib/util/escapeCommas.js +3 -1
  71. package/lib/util/flattenColorPalette.js +3 -1
  72. package/lib/util/formatVariantSelector.js +36 -21
  73. package/lib/util/getAllConfigs.js +6 -4
  74. package/lib/util/hashConfig.js +6 -4
  75. package/lib/util/isKeyframeRule.js +3 -1
  76. package/lib/util/isPlainObject.js +4 -2
  77. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  78. package/lib/util/log.js +8 -4
  79. package/lib/util/nameClass.js +12 -6
  80. package/lib/util/negateValue.js +3 -1
  81. package/lib/util/normalizeConfig.js +7 -5
  82. package/lib/util/normalizeScreens.js +12 -4
  83. package/lib/util/parseAnimationValue.js +3 -1
  84. package/lib/util/parseBoxShadowValue.js +6 -2
  85. package/lib/util/parseDependency.js +3 -1
  86. package/lib/util/parseGlob.js +6 -4
  87. package/lib/util/parseObjectStyles.js +9 -7
  88. package/lib/util/pluginUtils.js +43 -18
  89. package/lib/util/prefixSelector.js +6 -4
  90. package/lib/util/pseudoElements.js +24 -35
  91. package/lib/util/removeAlphaVariables.js +3 -1
  92. package/lib/util/resolveConfig.js +10 -8
  93. package/lib/util/resolveConfigPath.js +9 -5
  94. package/lib/util/responsive.js +6 -4
  95. package/lib/util/splitAtTopLevelOnly.js +3 -1
  96. package/lib/util/tap.js +3 -1
  97. package/lib/util/toColorValue.js +3 -1
  98. package/lib/util/toPath.js +3 -1
  99. package/lib/util/transformThemeValue.js +6 -4
  100. package/lib/util/validateConfig.js +5 -3
  101. package/lib/util/validateFormalSyntax.js +3 -1
  102. package/lib/util/withAlphaVariable.js +6 -2
  103. package/lib/value-parser/LICENSE +22 -0
  104. package/lib/value-parser/README.md +3 -0
  105. package/lib/value-parser/index.d.js +2 -0
  106. package/lib/value-parser/index.js +22 -0
  107. package/lib/value-parser/parse.js +259 -0
  108. package/lib/value-parser/stringify.js +38 -0
  109. package/lib/value-parser/unit.js +86 -0
  110. package/lib/value-parser/walk.js +16 -0
  111. package/nesting/index.d.ts +4 -0
  112. package/package.json +31 -36
  113. package/peers/index.js +65266 -48224
  114. package/resolveConfig.d.ts +22 -3
  115. package/scripts/generate-types.js +1 -2
  116. package/src/cli/build/plugin.js +7 -7
  117. package/src/cli/build/watching.js +1 -1
  118. package/src/cli.js +1 -1
  119. package/src/corePluginList.js +1 -1
  120. package/src/corePlugins.js +165 -29
  121. package/src/css/preflight.css +24 -8
  122. package/src/featureFlags.js +3 -8
  123. package/src/index.js +1 -5
  124. package/src/lib/content.js +42 -1
  125. package/src/lib/defaultExtractor.js +30 -17
  126. package/src/lib/evaluateTailwindFunctions.js +4 -1
  127. package/src/lib/expandApplyAtRules.js +7 -0
  128. package/src/lib/expandTailwindAtRules.js +26 -9
  129. package/src/lib/generateRules.js +50 -26
  130. package/src/lib/load-config.ts +8 -0
  131. package/src/lib/offsets.js +61 -2
  132. package/src/lib/resolveDefaultsAtRules.js +5 -1
  133. package/src/lib/setupContextUtils.js +77 -38
  134. package/src/lib/setupTrackingContext.js +2 -4
  135. package/src/lib/sharedState.js +0 -15
  136. package/src/oxide/cli/build/plugin.ts +7 -7
  137. package/src/plugin.js +4 -4
  138. package/src/processTailwindFeatures.js +3 -2
  139. package/src/util/cloneNodes.js +35 -14
  140. package/src/util/color.js +2 -2
  141. package/src/util/colorNames.js +150 -0
  142. package/src/util/dataTypes.js +143 -18
  143. package/src/util/formatVariantSelector.js +11 -3
  144. package/src/util/isPlainObject.js +1 -1
  145. package/src/util/pluginUtils.js +17 -5
  146. package/src/util/prefixSelector.js +1 -0
  147. package/src/util/pseudoElements.js +18 -17
  148. package/src/value-parser/LICENSE +22 -0
  149. package/src/value-parser/README.md +3 -0
  150. package/src/value-parser/index.d.ts +177 -0
  151. package/src/value-parser/index.js +28 -0
  152. package/src/value-parser/parse.js +303 -0
  153. package/src/value-parser/stringify.js +41 -0
  154. package/src/value-parser/unit.js +118 -0
  155. package/src/value-parser/walk.js +18 -0
  156. package/stubs/config.full.js +86 -14
  157. package/types/config.d.ts +17 -9
  158. package/types/generated/corePluginList.d.ts +1 -1
  159. package/types/generated/default-theme.d.ts +35 -9
  160. package/types/index.d.ts +7 -3
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "Offsets", {
7
7
  enumerable: true,
8
- get: ()=>Offsets
8
+ get: function() {
9
+ return Offsets;
10
+ }
9
11
  });
10
- const _bigSign = /*#__PURE__*/ _interopRequireDefault(require("../util/bigSign"));
11
- const _remapBitfieldJs = require("./remap-bitfield.js");
12
- function _interopRequireDefault(obj) {
12
+ const _bigSign = /*#__PURE__*/ _interop_require_default(require("../util/bigSign"));
13
+ const _remapbitfield = require("./remap-bitfield.js");
14
+ function _interop_require_default(obj) {
13
15
  return obj && obj.__esModule ? obj : {
14
16
  default: obj
15
17
  };
@@ -64,15 +66,19 @@ class Offsets {
64
66
  variants: 0n,
65
67
  parallelIndex: 0n,
66
68
  index: this.offsets[layer]++,
69
+ propertyOffset: 0n,
70
+ property: "",
67
71
  options: []
68
72
  };
69
73
  }
70
74
  /**
75
+ * @param {string} name
71
76
  * @returns {RuleOffset}
72
- */ arbitraryProperty() {
77
+ */ arbitraryProperty(name) {
73
78
  return {
74
79
  ...this.create("utilities"),
75
- arbitrary: 1n
80
+ arbitrary: 1n,
81
+ property: name
76
82
  };
77
83
  }
78
84
  /**
@@ -212,6 +218,10 @@ class Offsets {
212
218
  if (a.arbitrary !== b.arbitrary) {
213
219
  return a.arbitrary - b.arbitrary;
214
220
  }
221
+ // Always sort arbitrary properties alphabetically
222
+ if (a.propertyOffset !== b.propertyOffset) {
223
+ return a.propertyOffset - b.propertyOffset;
224
+ }
215
225
  // Sort utilities, components, etc… in the order they were registered
216
226
  return a.index - b.index;
217
227
  }
@@ -253,7 +263,45 @@ class Offsets {
253
263
  let [offset, rule] = item;
254
264
  offset = {
255
265
  ...offset,
256
- variants: (0, _remapBitfieldJs.remapBitfield)(offset.variants, mapping)
266
+ variants: (0, _remapbitfield.remapBitfield)(offset.variants, mapping)
267
+ };
268
+ return [
269
+ offset,
270
+ rule
271
+ ];
272
+ });
273
+ }
274
+ /**
275
+ * @template T
276
+ * @param {[RuleOffset, T][]} list
277
+ * @returns {[RuleOffset, T][]}
278
+ */ sortArbitraryProperties(list) {
279
+ // Collect all known arbitrary properties
280
+ let known = new Set();
281
+ for (let [offset] of list){
282
+ if (offset.arbitrary === 1n) {
283
+ known.add(offset.property);
284
+ }
285
+ }
286
+ // No arbitrary properties? Nothing to do.
287
+ if (known.size === 0) {
288
+ return list;
289
+ }
290
+ // Sort the properties alphabetically
291
+ let properties = Array.from(known).sort();
292
+ // Create a map from the property name to its offset
293
+ let offsets = new Map();
294
+ let offset = 1n;
295
+ for (let property of properties){
296
+ offsets.set(property, offset++);
297
+ }
298
+ // Apply the sorted offsets to the list
299
+ return list.map((item)=>{
300
+ let [offset, rule] = item;
301
+ var _offsets_get;
302
+ offset = {
303
+ ...offset,
304
+ propertyOffset: (_offsets_get = offsets.get(offset.property)) !== null && _offsets_get !== void 0 ? _offsets_get : 0n
257
305
  };
258
306
  return [
259
307
  offset,
@@ -266,7 +314,10 @@ class Offsets {
266
314
  * @param {[RuleOffset, T][]} list
267
315
  * @returns {[RuleOffset, T][]}
268
316
  */ sort(list) {
317
+ // Sort arbitrary variants so they're in alphabetical order
269
318
  list = this.remapArbitraryVariantOffsets(list);
319
+ // Sort arbitrary properties so they're in alphabetical order
320
+ list = this.sortArbitraryProperties(list);
270
321
  return list.sort(([a], [b])=>(0, _bigSign.default)(this.compare(a, b)));
271
322
  }
272
323
  }
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>expandApplyAtRules
7
+ get: function() {
8
+ return expandApplyAtRules;
9
+ }
8
10
  });
9
11
  function partitionRules(root) {
10
12
  if (!root.walkAtRules) return;
package/lib/lib/regex.js CHANGED
@@ -9,13 +9,27 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- pattern: ()=>pattern,
13
- withoutCapturing: ()=>withoutCapturing,
14
- any: ()=>any,
15
- optional: ()=>optional,
16
- zeroOrMore: ()=>zeroOrMore,
17
- nestedBrackets: ()=>nestedBrackets,
18
- escape: ()=>escape
12
+ pattern: function() {
13
+ return pattern;
14
+ },
15
+ withoutCapturing: function() {
16
+ return withoutCapturing;
17
+ },
18
+ any: function() {
19
+ return any;
20
+ },
21
+ optional: function() {
22
+ return optional;
23
+ },
24
+ zeroOrMore: function() {
25
+ return zeroOrMore;
26
+ },
27
+ nestedBrackets: function() {
28
+ return nestedBrackets;
29
+ },
30
+ escape: function() {
31
+ return escape;
32
+ }
19
33
  });
20
34
  const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;
21
35
  const REGEX_HAS_SPECIAL = RegExp(REGEX_SPECIAL.source);
@@ -69,7 +69,9 @@ Object.defineProperty(exports, "__esModule", {
69
69
  });
70
70
  Object.defineProperty(exports, "remapBitfield", {
71
71
  enumerable: true,
72
- get: ()=>remapBitfield
72
+ get: function() {
73
+ return remapBitfield;
74
+ }
73
75
  });
74
76
  function remapBitfield(num, mapping) {
75
77
  // Create masks for the old and new bits that are set
@@ -9,20 +9,24 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- elementSelectorParser: ()=>elementSelectorParser,
13
- default: ()=>resolveDefaultsAtRules
12
+ elementSelectorParser: function() {
13
+ return elementSelectorParser;
14
+ },
15
+ default: function() {
16
+ return resolveDefaultsAtRules;
17
+ }
14
18
  });
15
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
16
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
19
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
20
+ const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
17
21
  const _featureFlags = require("../featureFlags");
18
- function _interopRequireDefault(obj) {
22
+ function _interop_require_default(obj) {
19
23
  return obj && obj.__esModule ? obj : {
20
24
  default: obj
21
25
  };
22
26
  }
23
27
  let getNode = {
24
28
  id (node) {
25
- return _postcssSelectorParser.default.attribute({
29
+ return _postcssselectorparser.default.attribute({
26
30
  attribute: "id",
27
31
  operator: "=",
28
32
  value: node.value,
@@ -60,14 +64,14 @@ function minimumImpactSelector(nodes) {
60
64
  let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">");
61
65
  if (combinatorIdx !== -1) {
62
66
  rest.splice(0, combinatorIdx);
63
- rest.unshift(_postcssSelectorParser.default.universal());
67
+ rest.unshift(_postcssselectorparser.default.universal());
64
68
  }
65
69
  return [
66
70
  bestNode,
67
71
  ...rest.reverse()
68
72
  ].join("").trim();
69
73
  }
70
- let elementSelectorParser = (0, _postcssSelectorParser.default)((selectors)=>{
74
+ let elementSelectorParser = (0, _postcssselectorparser.default)((selectors)=>{
71
75
  return selectors.map((s)=>{
72
76
  let nodes = s.split((n)=>n.type === "combinator" && n.value === " ").pop();
73
77
  return minimumImpactSelector(nodes);
@@ -107,7 +111,9 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
107
111
  // we consider them separately because merging the declarations into
108
112
  // a single rule will cause browsers that do not understand the
109
113
  // vendor prefix to throw out the whole rule
110
- let selectorGroupName = selector.includes(":-") || selector.includes("::-") ? selector : "__DEFAULT__";
114
+ // Additionally if a selector contains `:has` we also consider
115
+ // it separately because FF only recently gained support for it
116
+ let selectorGroupName = selector.includes(":-") || selector.includes("::-") || selector.includes(":has") ? selector : "__DEFAULT__";
111
117
  var _selectorGroups_get;
112
118
  let selectors = (_selectorGroups_get = selectorGroups.get(selectorGroupName)) !== null && _selectorGroups_get !== void 0 ? _selectorGroups_get : new Set();
113
119
  selectorGroups.set(selectorGroupName, selectors);
@@ -119,12 +125,12 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
119
125
  universal.remove();
120
126
  continue;
121
127
  }
122
- for (let [, selectors1] of selectorGroups){
128
+ for (let [, selectors] of selectorGroups){
123
129
  let universalRule = _postcss.default.rule({
124
130
  source: universal.source
125
131
  });
126
132
  universalRule.selectors = [
127
- ...selectors1
133
+ ...selectors
128
134
  ];
129
135
  universalRule.append(universal.nodes.map((node)=>node.clone()));
130
136
  universal.before(universalRule);
@@ -133,29 +139,29 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
133
139
  universal.remove();
134
140
  }
135
141
  } else if (universals.size) {
136
- let universalRule1 = _postcss.default.rule({
142
+ let universalRule = _postcss.default.rule({
137
143
  selectors: [
138
144
  "*",
139
145
  "::before",
140
146
  "::after"
141
147
  ]
142
148
  });
143
- for (let universal1 of universals){
144
- universalRule1.append(universal1.nodes);
145
- if (!universalRule1.parent) {
146
- universal1.before(universalRule1);
149
+ for (let universal of universals){
150
+ universalRule.append(universal.nodes);
151
+ if (!universalRule.parent) {
152
+ universal.before(universalRule);
147
153
  }
148
- if (!universalRule1.source) {
149
- universalRule1.source = universal1.source;
154
+ if (!universalRule.source) {
155
+ universalRule.source = universal.source;
150
156
  }
151
- universal1.remove();
157
+ universal.remove();
152
158
  }
153
- let backdropRule = universalRule1.clone({
159
+ let backdropRule = universalRule.clone({
154
160
  selectors: [
155
161
  "::backdrop"
156
162
  ]
157
163
  });
158
- universalRule1.after(backdropRule);
164
+ universalRule.after(backdropRule);
159
165
  }
160
166
  };
161
167
  }