tailwindcss 0.0.0-oxide-insiders.a7fe2fe → 0.0.0-oxide-insiders.759a8c2

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 (108) hide show
  1. package/lib/cli/build/deps.js +34 -18
  2. package/lib/cli/build/index.js +45 -12
  3. package/lib/cli/build/plugin.js +273 -90
  4. package/lib/cli/build/utils.js +56 -24
  5. package/lib/cli/build/watching.js +156 -38
  6. package/lib/cli/help/index.js +61 -16
  7. package/lib/cli/index.js +121 -62
  8. package/lib/cli/init/index.js +47 -23
  9. package/lib/cli-peer-dependencies.js +23 -13
  10. package/lib/cli.js +5 -1
  11. package/lib/corePluginList.js +7 -4
  12. package/lib/corePlugins.js +855 -386
  13. package/lib/featureFlags.js +43 -18
  14. package/lib/lib/cacheInvalidation.js +78 -30
  15. package/lib/lib/collapseAdjacentRules.js +46 -23
  16. package/lib/lib/collapseDuplicateDeclarations.js +70 -27
  17. package/lib/lib/content.js +134 -41
  18. package/lib/lib/defaultExtractor.js +201 -96
  19. package/lib/lib/detectNesting.js +38 -12
  20. package/lib/lib/evaluateTailwindFunctions.js +192 -103
  21. package/lib/lib/expandApplyAtRules.js +488 -181
  22. package/lib/lib/expandTailwindAtRules.js +240 -70
  23. package/lib/lib/findAtConfigPath.js +34 -15
  24. package/lib/lib/generateRules.js +775 -353
  25. package/lib/lib/getModuleDependencies.js +67 -29
  26. package/lib/lib/load-config.js +27 -17
  27. package/lib/lib/normalizeTailwindDirectives.js +73 -27
  28. package/lib/lib/offsets.js +227 -62
  29. package/lib/lib/partitionApplyAtRules.js +53 -29
  30. package/lib/lib/regex.js +50 -28
  31. package/lib/lib/remap-bitfield.js +86 -9
  32. package/lib/lib/resolveDefaultsAtRules.js +123 -53
  33. package/lib/lib/setupContextUtils.js +1117 -584
  34. package/lib/lib/setupTrackingContext.js +149 -58
  35. package/lib/lib/sharedState.js +71 -23
  36. package/lib/lib/substituteScreenAtRules.js +19 -9
  37. package/lib/oxide/cli/build/deps.js +46 -23
  38. package/lib/oxide/cli/build/index.js +44 -12
  39. package/lib/oxide/cli/build/plugin.js +271 -89
  40. package/lib/oxide/cli/build/utils.js +55 -24
  41. package/lib/oxide/cli/build/watching.js +153 -36
  42. package/lib/oxide/cli/help/index.js +60 -16
  43. package/lib/oxide/cli/index.js +128 -67
  44. package/lib/oxide/cli/init/index.js +40 -19
  45. package/lib/oxide/cli.js +3 -2
  46. package/lib/plugin.js +58 -31
  47. package/lib/postcss-plugins/nesting/index.js +13 -7
  48. package/lib/postcss-plugins/nesting/plugin.js +65 -20
  49. package/lib/processTailwindFeatures.js +41 -10
  50. package/lib/public/colors.js +25 -16
  51. package/lib/public/create-plugin.js +11 -6
  52. package/lib/public/default-config.js +12 -6
  53. package/lib/public/default-theme.js +12 -6
  54. package/lib/public/load-config.js +9 -5
  55. package/lib/public/resolve-config.js +10 -6
  56. package/lib/util/applyImportantSelector.js +28 -17
  57. package/lib/util/bigSign.js +9 -6
  58. package/lib/util/buildMediaQuery.js +19 -10
  59. package/lib/util/cloneDeep.js +19 -9
  60. package/lib/util/cloneNodes.js +29 -14
  61. package/lib/util/color.js +87 -47
  62. package/lib/util/colorNames.js +752 -0
  63. package/lib/util/configurePlugins.js +18 -9
  64. package/lib/util/createPlugin.js +17 -8
  65. package/lib/util/createUtilityPlugin.js +30 -16
  66. package/lib/util/dataTypes.js +189 -38
  67. package/lib/util/defaults.js +21 -9
  68. package/lib/util/escapeClassName.js +15 -9
  69. package/lib/util/escapeCommas.js +9 -6
  70. package/lib/util/flattenColorPalette.js +11 -7
  71. package/lib/util/formatVariantSelector.js +209 -60
  72. package/lib/util/getAllConfigs.js +44 -35
  73. package/lib/util/hashConfig.js +12 -8
  74. package/lib/util/isKeyframeRule.js +10 -7
  75. package/lib/util/isPlainObject.js +14 -9
  76. package/lib/util/isSyntacticallyValidPropertyValue.js +45 -14
  77. package/lib/util/log.js +20 -9
  78. package/lib/util/nameClass.js +31 -10
  79. package/lib/util/negateValue.js +28 -10
  80. package/lib/util/normalizeConfig.js +242 -63
  81. package/lib/util/normalizeScreens.js +145 -70
  82. package/lib/util/parseAnimationValue.js +64 -14
  83. package/lib/util/parseBoxShadowValue.js +63 -14
  84. package/lib/util/parseDependency.js +39 -13
  85. package/lib/util/parseGlob.js +25 -8
  86. package/lib/util/parseObjectStyles.js +29 -18
  87. package/lib/util/pluginUtils.js +196 -77
  88. package/lib/util/prefixSelector.js +31 -12
  89. package/lib/util/pseudoElements.js +116 -34
  90. package/lib/util/removeAlphaVariables.js +23 -8
  91. package/lib/util/resolveConfig.js +224 -105
  92. package/lib/util/resolveConfigPath.js +45 -15
  93. package/lib/util/responsive.js +10 -6
  94. package/lib/util/splitAtTopLevelOnly.js +46 -10
  95. package/lib/util/tap.js +11 -7
  96. package/lib/util/toColorValue.js +10 -7
  97. package/lib/util/toPath.js +28 -8
  98. package/lib/util/transformThemeValue.js +49 -14
  99. package/lib/util/validateConfig.js +25 -15
  100. package/lib/util/validateFormalSyntax.js +14 -6
  101. package/lib/util/withAlphaVariable.js +54 -30
  102. package/package.json +18 -22
  103. package/peers/index.js +57849 -43101
  104. package/src/lib/expandTailwindAtRules.js +1 -1
  105. package/src/lib/setupTrackingContext.js +1 -1
  106. package/src/util/color.js +1 -1
  107. package/src/util/colorNames.js +150 -0
  108. package/src/util/pseudoElements.js +4 -4
@@ -1,113 +1,262 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), function(target, all) {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
5
6
  for(var name in all)Object.defineProperty(target, name, {
6
- enumerable: !0,
7
+ enumerable: true,
7
8
  get: all[name]
8
9
  });
9
- }(exports, {
10
- formatVariantSelector: ()=>formatVariantSelector,
11
- eliminateIrrelevantSelectors: ()=>eliminateIrrelevantSelectors,
12
- finalizeSelector: ()=>finalizeSelector,
13
- handleMergePseudo: ()=>handleMergePseudo
10
+ }
11
+ _export(exports, {
12
+ formatVariantSelector: function() {
13
+ return formatVariantSelector;
14
+ },
15
+ eliminateIrrelevantSelectors: function() {
16
+ return eliminateIrrelevantSelectors;
17
+ },
18
+ finalizeSelector: function() {
19
+ return finalizeSelector;
20
+ },
21
+ handleMergePseudo: function() {
22
+ return handleMergePseudo;
23
+ }
14
24
  });
15
- const _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser")), _unesc = _interopRequireDefault(require("postcss-selector-parser/dist/util/unesc")), _escapeClassName = _interopRequireDefault(require("../util/escapeClassName")), _prefixSelector = _interopRequireDefault(require("../util/prefixSelector")), _pseudoElements = require("./pseudoElements");
16
- function _interopRequireDefault(obj) {
25
+ const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
26
+ const _unesc = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser/dist/util/unesc"));
27
+ const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
28
+ const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
29
+ const _pseudoElements = require("./pseudoElements");
30
+ function _interop_require_default(obj) {
17
31
  return obj && obj.__esModule ? obj : {
18
32
  default: obj
19
33
  };
20
34
  }
21
- let MERGE = ":merge";
35
+ /** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ /** @typedef {{format: string, isArbitraryVariant: boolean}[]} RawFormats */ /** @typedef {import('postcss-selector-parser').Root} ParsedFormats */ /** @typedef {RawFormats | ParsedFormats} AcceptedFormats */ let MERGE = ":merge";
22
36
  function formatVariantSelector(formats, { context , candidate }) {
23
37
  var _context_tailwindConfig_prefix;
24
- let prefix = null !== (_context_tailwindConfig_prefix = null == context ? void 0 : context.tailwindConfig.prefix) && void 0 !== _context_tailwindConfig_prefix ? _context_tailwindConfig_prefix : "", parsedFormats = formats.map((format)=>{
25
- let ast = (0, _postcssSelectorParser.default)().astSync(format.format);
38
+ let prefix = (_context_tailwindConfig_prefix = context === null || context === void 0 ? void 0 : context.tailwindConfig.prefix) !== null && _context_tailwindConfig_prefix !== void 0 ? _context_tailwindConfig_prefix : "";
39
+ // Parse the format selector into an AST
40
+ let parsedFormats = formats.map((format)=>{
41
+ let ast = (0, _postcssselectorparser.default)().astSync(format.format);
26
42
  return {
27
43
  ...format,
28
44
  ast: format.isArbitraryVariant ? ast : (0, _prefixSelector.default)(prefix, ast)
29
45
  };
30
- }), formatAst = _postcssSelectorParser.default.root({
46
+ });
47
+ // We start with the candidate selector
48
+ let formatAst = _postcssselectorparser.default.root({
31
49
  nodes: [
32
- _postcssSelectorParser.default.selector({
50
+ _postcssselectorparser.default.selector({
33
51
  nodes: [
34
- _postcssSelectorParser.default.className({
52
+ _postcssselectorparser.default.className({
35
53
  value: (0, _escapeClassName.default)(candidate)
36
54
  })
37
55
  ]
38
56
  })
39
57
  ]
40
58
  });
41
- for (let { ast } of parsedFormats)[formatAst, ast] = handleMergePseudo(formatAst, ast), ast.walkNesting((nesting)=>nesting.replaceWith(...formatAst.nodes[0].nodes)), formatAst = ast;
59
+ // And iteratively merge each format selector into the candidate selector
60
+ for (let { ast } of parsedFormats){
61
+ [formatAst, ast] = handleMergePseudo(formatAst, ast);
62
+ // 2. Merge the format selector into the current selector AST
63
+ ast.walkNesting((nesting)=>nesting.replaceWith(...formatAst.nodes[0].nodes));
64
+ // 3. Keep going!
65
+ formatAst = ast;
66
+ }
42
67
  return formatAst;
43
68
  }
44
- function simpleSelectorForNode(node) {
45
- let nodes = [];
46
- for(; node.prev() && "combinator" !== node.prev().type;)node = node.prev();
47
- for(; node && "combinator" !== node.type;)nodes.push(node), node = node.next();
69
+ /**
70
+ * Given any node in a selector this gets the "simple" selector it's a part of
71
+ * A simple selector is just a list of nodes without any combinators
72
+ * Technically :is(), :not(), :has(), etc… can have combinators but those are nested
73
+ * inside the relevant node and won't be picked up so they're fine to ignore
74
+ *
75
+ * @param {Node} node
76
+ * @returns {Node[]}
77
+ **/ function simpleSelectorForNode(node) {
78
+ /** @type {Node[]} */ let nodes = [];
79
+ // Walk backwards until we hit a combinator node (or the start)
80
+ while(node.prev() && node.prev().type !== "combinator"){
81
+ node = node.prev();
82
+ }
83
+ // Now record all non-combinator nodes until we hit one (or the end)
84
+ while(node && node.type !== "combinator"){
85
+ nodes.push(node);
86
+ node = node.next();
87
+ }
48
88
  return nodes;
49
89
  }
90
+ /**
91
+ * Resorts the nodes in a selector to ensure they're in the correct order
92
+ * Tags go before classes, and pseudo classes go after classes
93
+ *
94
+ * @param {Selector} sel
95
+ * @returns {Selector}
96
+ **/ function resortSelector(sel) {
97
+ sel.sort((a, b)=>{
98
+ if (a.type === "tag" && b.type === "class") {
99
+ return -1;
100
+ } else if (a.type === "class" && b.type === "tag") {
101
+ return 1;
102
+ } else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
103
+ return -1;
104
+ } else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
105
+ return 1;
106
+ }
107
+ return sel.index(a) - sel.index(b);
108
+ });
109
+ return sel;
110
+ }
50
111
  function eliminateIrrelevantSelectors(sel, base) {
51
- let hasClassesMatchingCandidate = !1;
112
+ let hasClassesMatchingCandidate = false;
52
113
  sel.walk((child)=>{
53
- if ("class" === child.type && child.value === base) return hasClassesMatchingCandidate = !0, !1;
54
- }), hasClassesMatchingCandidate || sel.remove();
114
+ if (child.type === "class" && child.value === base) {
115
+ hasClassesMatchingCandidate = true;
116
+ return false // Stop walking
117
+ ;
118
+ }
119
+ });
120
+ if (!hasClassesMatchingCandidate) {
121
+ sel.remove();
122
+ }
123
+ // We do NOT recursively eliminate sub selectors that don't have the base class
124
+ // as this is NOT a safe operation. For example, if we have:
125
+ // `.space-x-2 > :not([hidden]) ~ :not([hidden])`
126
+ // We cannot remove the [hidden] from the :not() because it would change the
127
+ // meaning of the selector.
128
+ // TODO: Can we do this for :matches, :is, and :where?
55
129
  }
56
130
  function finalizeSelector(current, formats, { context , candidate , base }) {
57
- var _context_tailwindConfig, _context_tailwindConfig_separator;
58
- let separator = null !== (_context_tailwindConfig_separator = null == context ? void 0 : null === (_context_tailwindConfig = context.tailwindConfig) || void 0 === _context_tailwindConfig ? void 0 : _context_tailwindConfig.separator) && void 0 !== _context_tailwindConfig_separator ? _context_tailwindConfig_separator : ":";
59
- base = null != base ? base : candidate.split(RegExp(`\\${separator}(?![^[]*\\])`)).pop();
60
- let selector = (0, _postcssSelectorParser.default)().astSync(current);
131
+ var _context_tailwindConfig;
132
+ var _context_tailwindConfig_separator;
133
+ let separator = (_context_tailwindConfig_separator = context === null || context === void 0 ? void 0 : (_context_tailwindConfig = context.tailwindConfig) === null || _context_tailwindConfig === void 0 ? void 0 : _context_tailwindConfig.separator) !== null && _context_tailwindConfig_separator !== void 0 ? _context_tailwindConfig_separator : ":";
134
+ // Split by the separator, but ignore the separator inside square brackets:
135
+ //
136
+ // E.g.: dark:lg:hover:[paint-order:markers]
137
+ // ┬ ┬ ┬ ┬
138
+ // │ │ │ ╰── We will not split here
139
+ // ╰──┴─────┴─────────────── We will split here
140
+ //
141
+ base = base !== null && base !== void 0 ? base : candidate.split(new RegExp(`\\${separator}(?![^[]*\\])`)).pop();
142
+ // Parse the selector into an AST
143
+ let selector = (0, _postcssselectorparser.default)().astSync(current);
144
+ // Normalize escaped classes, e.g.:
145
+ //
146
+ // The idea would be to replace the escaped `base` in the selector with the
147
+ // `format`. However, in css you can escape the same selector in a few
148
+ // different ways. This would result in different strings and therefore we
149
+ // can't replace it properly.
150
+ //
151
+ // base: bg-[rgb(255,0,0)]
152
+ // base in selector: bg-\\[rgb\\(255\\,0\\,0\\)\\]
153
+ // escaped base: bg-\\[rgb\\(255\\2c 0\\2c 0\\)\\]
154
+ //
61
155
  selector.walkClasses((node)=>{
62
- node.raws && node.value.includes(base) && (node.raws.value = (0, _escapeClassName.default)((0, _unesc.default)(node.raws.value)));
63
- }), selector.each((sel)=>eliminateIrrelevantSelectors(sel, base));
156
+ if (node.raws && node.value.includes(base)) {
157
+ node.raws.value = (0, _escapeClassName.default)((0, _unesc.default)(node.raws.value));
158
+ }
159
+ });
160
+ // Remove extraneous selectors that do not include the base candidate
161
+ selector.each((sel)=>eliminateIrrelevantSelectors(sel, base));
162
+ // If there are no formats that means there were no variants added to the candidate
163
+ // so we can just return the selector as-is
64
164
  let formatAst = Array.isArray(formats) ? formatVariantSelector(formats, {
65
165
  context,
66
166
  candidate
67
167
  }) : formats;
68
- if (null === formatAst) return selector.toString();
69
- let simpleStart = _postcssSelectorParser.default.comment({
168
+ if (formatAst === null) {
169
+ return selector.toString();
170
+ }
171
+ let simpleStart = _postcssselectorparser.default.comment({
70
172
  value: "/*__simple__*/"
71
- }), simpleEnd = _postcssSelectorParser.default.comment({
173
+ });
174
+ let simpleEnd = _postcssselectorparser.default.comment({
72
175
  value: "/*__simple__*/"
73
176
  });
74
- return selector.walkClasses((node)=>{
75
- var sel;
76
- if (node.value !== base) return;
77
- let parent = node.parent, formatNodes = formatAst.nodes[0].nodes;
78
- if (1 === parent.nodes.length) {
177
+ // We can safely replace the escaped base now, since the `base` section is
178
+ // now in a normalized escaped value.
179
+ selector.walkClasses((node)=>{
180
+ if (node.value !== base) {
181
+ return;
182
+ }
183
+ let parent = node.parent;
184
+ let formatNodes = formatAst.nodes[0].nodes;
185
+ // Perf optimization: if the parent is a single class we can just replace it and be done
186
+ if (parent.nodes.length === 1) {
79
187
  node.replaceWith(...formatNodes);
80
188
  return;
81
189
  }
82
190
  let simpleSelector = simpleSelectorForNode(node);
83
- for (let child of (parent.insertBefore(simpleSelector[0], simpleStart), parent.insertAfter(simpleSelector[simpleSelector.length - 1], simpleEnd), formatNodes))parent.insertBefore(simpleSelector[0], child.clone());
84
- node.remove(), simpleSelector = simpleSelectorForNode(simpleStart);
191
+ parent.insertBefore(simpleSelector[0], simpleStart);
192
+ parent.insertAfter(simpleSelector[simpleSelector.length - 1], simpleEnd);
193
+ for (let child of formatNodes){
194
+ parent.insertBefore(simpleSelector[0], child.clone());
195
+ }
196
+ node.remove();
197
+ // Re-sort the simple selector to ensure it's in the correct order
198
+ simpleSelector = simpleSelectorForNode(simpleStart);
85
199
  let firstNode = parent.index(simpleStart);
86
- parent.nodes.splice(firstNode, simpleSelector.length, ...((sel = _postcssSelectorParser.default.selector({
200
+ parent.nodes.splice(firstNode, simpleSelector.length, ...resortSelector(_postcssselectorparser.default.selector({
87
201
  nodes: simpleSelector
88
- })).sort((a, b)=>"tag" === a.type && "class" === b.type ? -1 : "class" === a.type && "tag" === b.type ? 1 : "class" === a.type && "pseudo" === b.type && b.value.startsWith("::") ? -1 : "pseudo" === a.type && a.value.startsWith("::") && "class" === b.type ? 1 : sel.index(a) - sel.index(b)), sel).nodes), simpleStart.remove(), simpleEnd.remove();
89
- }), selector.walkPseudos((p)=>{
90
- p.value === MERGE && p.replaceWith(p.nodes);
91
- }), selector.each((sel)=>(0, _pseudoElements.movePseudos)(sel)), selector.toString();
202
+ })).nodes);
203
+ simpleStart.remove();
204
+ simpleEnd.remove();
205
+ });
206
+ // Remove unnecessary pseudo selectors that we used as placeholders
207
+ selector.walkPseudos((p)=>{
208
+ if (p.value === MERGE) {
209
+ p.replaceWith(p.nodes);
210
+ }
211
+ });
212
+ // Move pseudo elements to the end of the selector (if necessary)
213
+ selector.each((sel)=>(0, _pseudoElements.movePseudos)(sel));
214
+ return selector.toString();
92
215
  }
93
216
  function handleMergePseudo(selector, format) {
94
- let merges = [];
95
- return selector.walkPseudos((pseudo)=>{
96
- pseudo.value === MERGE && merges.push({
97
- pseudo,
98
- value: pseudo.nodes[0].toString()
99
- });
100
- }), format.walkPseudos((pseudo)=>{
101
- if (pseudo.value !== MERGE) return;
102
- let value = pseudo.nodes[0].toString(), existing = merges.find((merge)=>merge.value === value);
103
- if (!existing) return;
104
- let attachments = [], next = pseudo.next();
105
- for(; next && "combinator" !== next.type;)attachments.push(next), next = next.next();
217
+ /** @type {{pseudo: Pseudo, value: string}[]} */ let merges = [];
218
+ // Find all :merge() pseudo-classes in `selector`
219
+ selector.walkPseudos((pseudo)=>{
220
+ if (pseudo.value === MERGE) {
221
+ merges.push({
222
+ pseudo,
223
+ value: pseudo.nodes[0].toString()
224
+ });
225
+ }
226
+ });
227
+ // Find all :merge() "attachments" in `format` and attach them to the matching selector in `selector`
228
+ format.walkPseudos((pseudo)=>{
229
+ if (pseudo.value !== MERGE) {
230
+ return;
231
+ }
232
+ let value = pseudo.nodes[0].toString();
233
+ // Does `selector` contain a :merge() pseudo-class with the same value?
234
+ let existing = merges.find((merge)=>merge.value === value);
235
+ // Nope so there's nothing to do
236
+ if (!existing) {
237
+ return;
238
+ }
239
+ // Everything after `:merge()` up to the next combinator is what is attached to the merged selector
240
+ let attachments = [];
241
+ let next = pseudo.next();
242
+ while(next && next.type !== "combinator"){
243
+ attachments.push(next);
244
+ next = next.next();
245
+ }
106
246
  let combinator = next;
107
- existing.pseudo.parent.insertAfter(existing.pseudo, _postcssSelectorParser.default.selector({
247
+ existing.pseudo.parent.insertAfter(existing.pseudo, _postcssselectorparser.default.selector({
108
248
  nodes: attachments.map((node)=>node.clone())
109
- })), pseudo.remove(), attachments.forEach((node)=>node.remove()), combinator && "combinator" === combinator.type && combinator.remove();
110
- }), [
249
+ }));
250
+ pseudo.remove();
251
+ attachments.forEach((node)=>node.remove());
252
+ // What about this case:
253
+ // :merge(.group):focus > &
254
+ // :merge(.group):hover &
255
+ if (combinator && combinator.type === "combinator") {
256
+ combinator.remove();
257
+ }
258
+ });
259
+ return [
111
260
  selector,
112
261
  format
113
262
  ];
@@ -1,41 +1,50 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>function getAllConfigs(config) {
7
- var _config_presets;
8
- let configs = (null !== (_config_presets = null == config ? void 0 : config.presets) && void 0 !== _config_presets ? _config_presets : [
9
- _configFullJs.default
10
- ]).slice().reverse().flatMap((preset)=>getAllConfigs(preset instanceof Function ? preset() : preset)), features = {
11
- respectDefaultRingColorOpacity: {
12
- theme: {
13
- ringColor: ({ theme })=>({
14
- DEFAULT: "#3b82f67f",
15
- ...theme("colors")
16
- })
17
- }
18
- },
19
- disableColorOpacityUtilitiesByDefault: {
20
- corePlugins: {
21
- backgroundOpacity: !1,
22
- borderOpacity: !1,
23
- divideOpacity: !1,
24
- placeholderOpacity: !1,
25
- ringOpacity: !1,
26
- textOpacity: !1
27
- }
28
- }
29
- }, experimentals = Object.keys(features).filter((feature)=>(0, _featureFlags.flagEnabled)(config, feature)).map((feature)=>features[feature]);
30
- return [
31
- config,
32
- ...experimentals,
33
- ...configs
34
- ];
35
- }
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getAllConfigs;
9
+ }
36
10
  });
37
- const _configFullJs = function(obj) {
11
+ const _configfull = /*#__PURE__*/ _interop_require_default(require("../../stubs/config.full.js"));
12
+ const _featureFlags = require("../featureFlags");
13
+ function _interop_require_default(obj) {
38
14
  return obj && obj.__esModule ? obj : {
39
15
  default: obj
40
16
  };
41
- }(require("../../stubs/config.full.js")), _featureFlags = require("../featureFlags");
17
+ }
18
+ function getAllConfigs(config) {
19
+ var _config_presets;
20
+ const configs = ((_config_presets = config === null || config === void 0 ? void 0 : config.presets) !== null && _config_presets !== void 0 ? _config_presets : [
21
+ _configfull.default
22
+ ]).slice().reverse().flatMap((preset)=>getAllConfigs(preset instanceof Function ? preset() : preset));
23
+ const features = {
24
+ // Add experimental configs here...
25
+ respectDefaultRingColorOpacity: {
26
+ theme: {
27
+ ringColor: ({ theme })=>({
28
+ DEFAULT: "#3b82f67f",
29
+ ...theme("colors")
30
+ })
31
+ }
32
+ },
33
+ disableColorOpacityUtilitiesByDefault: {
34
+ corePlugins: {
35
+ backgroundOpacity: false,
36
+ borderOpacity: false,
37
+ divideOpacity: false,
38
+ placeholderOpacity: false,
39
+ ringOpacity: false,
40
+ textOpacity: false
41
+ }
42
+ }
43
+ };
44
+ const experimentals = Object.keys(features).filter((feature)=>(0, _featureFlags.flagEnabled)(config, feature)).map((feature)=>features[feature]);
45
+ return [
46
+ config,
47
+ ...experimentals,
48
+ ...configs
49
+ ];
50
+ }
@@ -1,17 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>hashConfig
3
+ value: true
7
4
  });
8
- const _objectHash = function(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return hashConfig;
9
+ }
10
+ });
11
+ const _objecthash = /*#__PURE__*/ _interop_require_default(require("object-hash"));
12
+ function _interop_require_default(obj) {
9
13
  return obj && obj.__esModule ? obj : {
10
14
  default: obj
11
15
  };
12
- }(require("object-hash"));
16
+ }
13
17
  function hashConfig(config) {
14
- return (0, _objectHash.default)(config, {
15
- ignoreUnknown: !0
18
+ return (0, _objecthash.default)(config, {
19
+ ignoreUnknown: true
16
20
  });
17
21
  }
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
- function isKeyframeRule(rule) {
3
- return rule.parent && "atrule" === rule.parent.type && /keyframes$/.test(rule.parent.name);
4
- }
5
2
  Object.defineProperty(exports, "__esModule", {
6
- value: !0
7
- }), Object.defineProperty(exports, "default", {
8
- enumerable: !0,
9
- get: ()=>isKeyframeRule
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return isKeyframeRule;
9
+ }
10
10
  });
11
+ function isKeyframeRule(rule) {
12
+ return rule.parent && rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name);
13
+ }
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
- function isPlainObject(value) {
3
- if ("[object Object]" !== Object.prototype.toString.call(value)) return !1;
4
- let prototype = Object.getPrototypeOf(value);
5
- return null === prototype || prototype === Object.prototype;
6
- }
7
2
  Object.defineProperty(exports, "__esModule", {
8
- value: !0
9
- }), Object.defineProperty(exports, "default", {
10
- enumerable: !0,
11
- get: ()=>isPlainObject
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return isPlainObject;
9
+ }
12
10
  });
11
+ function isPlainObject(value) {
12
+ if (Object.prototype.toString.call(value) !== "[object Object]") {
13
+ return false;
14
+ }
15
+ const prototype = Object.getPrototypeOf(value);
16
+ return prototype === null || prototype === Object.prototype;
17
+ }
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>isSyntacticallyValidPropertyValue
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, // Arbitrary values must contain balanced brackets (), [] and {}. Escaped
6
+ // values don't count, and brackets inside quotes also don't count.
7
+ //
8
+ // E.g.: w-[this-is]w-[weird-and-invalid]
9
+ // E.g.: w-[this-is\\]w-\\[weird-but-valid]
10
+ // E.g.: content-['this-is-also-valid]-weirdly-enough']
11
+ "default", {
12
+ enumerable: true,
13
+ get: function() {
14
+ return isSyntacticallyValidPropertyValue;
15
+ }
7
16
  });
8
17
  let matchingBrackets = new Map([
9
18
  [
@@ -18,26 +27,48 @@ let matchingBrackets = new Map([
18
27
  "(",
19
28
  ")"
20
29
  ]
21
- ]), inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
30
+ ]);
31
+ let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
22
32
  v,
23
33
  k
24
- ])), quotes = new Set([
34
+ ]));
35
+ let quotes = new Set([
25
36
  '"',
26
37
  "'",
27
38
  "`"
28
39
  ]);
29
40
  function isSyntacticallyValidPropertyValue(value) {
30
- let stack = [], inQuotes = !1;
41
+ let stack = [];
42
+ let inQuotes = false;
31
43
  for(let i = 0; i < value.length; i++){
32
44
  let char = value[i];
33
- if (":" === char && !inQuotes && 0 === stack.length) return !1;
34
- if (quotes.has(char) && "\\" !== value[i - 1] && (inQuotes = !inQuotes), !inQuotes && "\\" !== value[i - 1]) {
35
- if (matchingBrackets.has(char)) stack.push(char);
36
- else if (inverseMatchingBrackets.has(char)) {
37
- let inverse = inverseMatchingBrackets.get(char);
38
- if (stack.length <= 0 || stack.pop() !== inverse) return !1;
45
+ if (char === ":" && !inQuotes && stack.length === 0) {
46
+ return false;
47
+ }
48
+ // Non-escaped quotes allow us to "allow" anything in between
49
+ if (quotes.has(char) && value[i - 1] !== "\\") {
50
+ inQuotes = !inQuotes;
51
+ }
52
+ if (inQuotes) continue;
53
+ if (value[i - 1] === "\\") continue; // Escaped
54
+ if (matchingBrackets.has(char)) {
55
+ stack.push(char);
56
+ } else if (inverseMatchingBrackets.has(char)) {
57
+ let inverse = inverseMatchingBrackets.get(char);
58
+ // Nothing to pop from, therefore it is unbalanced
59
+ if (stack.length <= 0) {
60
+ return false;
61
+ }
62
+ // Popped value must match the inverse value, otherwise it is unbalanced
63
+ if (stack.pop() !== inverse) {
64
+ return false;
39
65
  }
40
66
  }
41
67
  }
42
- return !(stack.length > 0);
68
+ // If there is still something on the stack, it is also unbalanced
69
+ if (stack.length > 0) {
70
+ return false;
71
+ }
72
+ // All good, totally balanced!
73
+ return true;
43
74
  }
package/lib/util/log.js CHANGED
@@ -1,23 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), function(target, all) {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
5
6
  for(var name in all)Object.defineProperty(target, name, {
6
- enumerable: !0,
7
+ enumerable: true,
7
8
  get: all[name]
8
9
  });
9
- }(exports, {
10
- dim: ()=>dim,
11
- default: ()=>_default
10
+ }
11
+ _export(exports, {
12
+ dim: function() {
13
+ return dim;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
12
18
  });
13
- const _picocolors = function(obj) {
19
+ const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
20
+ function _interop_require_default(obj) {
14
21
  return obj && obj.__esModule ? obj : {
15
22
  default: obj
16
23
  };
17
- }(require("picocolors"));
24
+ }
18
25
  let alreadyShown = new Set();
19
26
  function log(type, messages, key) {
20
- ("undefined" == typeof process || !process.env.JEST_WORKER_ID) && (key && alreadyShown.has(key) || (key && alreadyShown.add(key), console.warn(""), messages.forEach((message)=>console.warn(type, "-", message))));
27
+ if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
28
+ if (key && alreadyShown.has(key)) return;
29
+ if (key) alreadyShown.add(key);
30
+ console.warn("");
31
+ messages.forEach((message)=>console.warn(type, "-", message));
21
32
  }
22
33
  function dim(input) {
23
34
  return _picocolors.default.dim(input);