tailwindcss 0.0.0-insiders.eeec89a → 0.0.0-insiders.eef91c9
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.
- package/README.md +1 -2
- package/lib/cli/build/deps.js +62 -0
- package/lib/cli/build/index.js +0 -3
- package/lib/cli/build/plugin.js +66 -126
- package/lib/cli/build/watching.js +2 -2
- package/lib/cli/help/index.js +2 -2
- package/lib/cli/index.js +3 -4
- package/lib/cli-peer-dependencies.js +36 -0
- package/lib/corePluginList.js +4 -1
- package/lib/corePlugins.js +318 -185
- package/lib/css/preflight.css +20 -9
- package/lib/featureFlags.js +9 -15
- package/lib/lib/content.js +2 -28
- package/lib/lib/defaultExtractor.js +33 -25
- package/lib/lib/evaluateTailwindFunctions.js +4 -4
- package/lib/lib/expandApplyAtRules.js +19 -0
- package/lib/lib/expandTailwindAtRules.js +22 -58
- package/lib/lib/generateRules.js +47 -27
- package/lib/lib/load-config.js +18 -3
- package/lib/lib/normalizeTailwindDirectives.js +15 -0
- package/lib/lib/offsets.js +53 -4
- package/lib/lib/resolveDefaultsAtRules.js +4 -2
- package/lib/lib/setupContextUtils.js +108 -80
- package/lib/lib/setupTrackingContext.js +2 -3
- package/lib/lib/substituteScreenAtRules.js +2 -2
- package/lib/plugin.js +0 -116
- package/lib/postcss-plugins/nesting/index.js +1 -1
- package/lib/postcss-plugins/nesting/plugin.js +2 -2
- package/lib/processTailwindFeatures.js +1 -3
- package/lib/public/colors.js +1 -1
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +4 -4
- package/lib/util/createUtilityPlugin.js +2 -2
- package/lib/util/dataTypes.js +69 -6
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +2 -2
- package/lib/util/formatVariantSelector.js +12 -7
- package/lib/util/getAllConfigs.js +2 -3
- package/lib/util/isPlainObject.js +1 -1
- package/lib/util/log.js +0 -17
- package/lib/util/normalizeConfig.js +28 -59
- package/lib/util/normalizeScreens.js +3 -3
- package/lib/util/pluginUtils.js +22 -7
- package/lib/util/pseudoElements.js +3 -0
- package/lib/util/resolveConfig.js +6 -10
- package/lib/util/validateConfig.js +0 -11
- package/lib/util/withAlphaVariable.js +1 -1
- package/nesting/index.d.ts +4 -0
- package/package.json +39 -34
- package/peers/index.js +96671 -0
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +0 -4
- package/src/cli/build/plugin.js +53 -85
- package/src/cli/build/watching.js +1 -1
- package/src/cli/index.js +0 -1
- package/src/cli-peer-dependencies.js +15 -0
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +157 -44
- package/src/css/preflight.css +20 -9
- package/src/featureFlags.js +3 -9
- package/src/lib/content.js +1 -33
- package/src/lib/defaultExtractor.js +30 -17
- package/src/lib/expandApplyAtRules.js +24 -0
- package/src/lib/expandTailwindAtRules.js +19 -56
- package/src/lib/generateRules.js +43 -22
- package/src/lib/load-config.ts +13 -0
- package/src/lib/normalizeTailwindDirectives.js +27 -0
- package/src/lib/offsets.js +62 -3
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +79 -39
- package/src/plugin.js +0 -86
- package/src/processTailwindFeatures.js +0 -3
- package/src/util/cloneNodes.js +35 -14
- package/src/util/color.js +1 -1
- package/src/util/dataTypes.js +78 -6
- package/src/util/formatVariantSelector.js +7 -0
- package/src/util/isPlainObject.js +1 -1
- package/src/util/log.js +0 -24
- package/src/util/normalizeConfig.js +11 -38
- package/src/util/pluginUtils.js +21 -1
- package/src/util/pseudoElements.js +4 -0
- package/src/util/validateConfig.js +0 -10
- package/stubs/config.full.js +75 -16
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +1 -0
- package/stubs/postcss.config.js +1 -0
- package/types/config.d.ts +12 -5
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +34 -9
- package/types/index.d.ts +7 -3
- package/index.css +0 -5
- package/lib/lib/detectNesting.js +0 -45
- package/lib/lib/handleImportAtRules.js +0 -50
- package/src/lib/detectNesting.js +0 -47
- package/src/lib/handleImportAtRules.js +0 -34
|
@@ -17,7 +17,6 @@ const _resolveDefaultsAtRules = /*#__PURE__*/ _interop_require_default(require("
|
|
|
17
17
|
const _collapseAdjacentRules = /*#__PURE__*/ _interop_require_default(require("./lib/collapseAdjacentRules"));
|
|
18
18
|
const _collapseDuplicateDeclarations = /*#__PURE__*/ _interop_require_default(require("./lib/collapseDuplicateDeclarations"));
|
|
19
19
|
const _partitionApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/partitionApplyAtRules"));
|
|
20
|
-
const _detectNesting = /*#__PURE__*/ _interop_require_default(require("./lib/detectNesting"));
|
|
21
20
|
const _setupContextUtils = require("./lib/setupContextUtils");
|
|
22
21
|
const _featureFlags = require("./featureFlags");
|
|
23
22
|
function _interop_require_default(obj) {
|
|
@@ -27,8 +26,7 @@ function _interop_require_default(obj) {
|
|
|
27
26
|
}
|
|
28
27
|
function processTailwindFeatures(setupContext) {
|
|
29
28
|
return async function(root, result) {
|
|
30
|
-
let { tailwindDirectives, applyDirectives
|
|
31
|
-
(0, _detectNesting.default)()(root, result);
|
|
29
|
+
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
|
|
32
30
|
// Partition apply rules that are found in the css
|
|
33
31
|
// itself.
|
|
34
32
|
(0, _partitionApplyAtRules.default)()(root, result);
|
package/lib/public/colors.js
CHANGED
|
@@ -14,7 +14,7 @@ function _interop_require_default(obj) {
|
|
|
14
14
|
default: obj
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function warn({ version, from, to
|
|
17
|
+
function warn({ version , from , to }) {
|
|
18
18
|
_log.default.warn(`${from}-color-renamed`, [
|
|
19
19
|
`As of Tailwind CSS ${version}, \`${from}\` has been renamed to \`${to}\`.`,
|
|
20
20
|
"Update your configuration file to silence this warning."
|
package/lib/util/cloneNodes.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('postcss').Container[]} nodes
|
|
3
|
+
* @param {any} source
|
|
4
|
+
* @param {any} raws
|
|
5
|
+
* @returns {import('postcss').Container[]}
|
|
6
|
+
*/ "use strict";
|
|
2
7
|
Object.defineProperty(exports, "__esModule", {
|
|
3
8
|
value: true
|
|
4
9
|
});
|
|
@@ -10,25 +15,40 @@ Object.defineProperty(exports, "default", {
|
|
|
10
15
|
});
|
|
11
16
|
function cloneNodes(nodes, source = undefined, raws = undefined) {
|
|
12
17
|
return nodes.map((node)=>{
|
|
13
|
-
var _node_raws_tailwind;
|
|
14
18
|
let cloned = node.clone();
|
|
15
|
-
// We always want override the source map
|
|
16
|
-
// except when explicitly told not to
|
|
17
|
-
let shouldOverwriteSource = ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.preserveSource) !== true || !cloned.source;
|
|
18
|
-
if (source !== undefined && shouldOverwriteSource) {
|
|
19
|
-
cloned.source = source;
|
|
20
|
-
if ("walk" in cloned) {
|
|
21
|
-
cloned.walk((child)=>{
|
|
22
|
-
child.source = source;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
19
|
if (raws !== undefined) {
|
|
27
20
|
cloned.raws.tailwind = {
|
|
28
21
|
...cloned.raws.tailwind,
|
|
29
22
|
...raws
|
|
30
23
|
};
|
|
31
24
|
}
|
|
25
|
+
if (source !== undefined) {
|
|
26
|
+
traverse(cloned, (node)=>{
|
|
27
|
+
var _node_raws_tailwind;
|
|
28
|
+
// Do not traverse nodes that have opted
|
|
29
|
+
// to preserve their original source
|
|
30
|
+
let shouldPreserveSource = ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.preserveSource) === true && node.source;
|
|
31
|
+
if (shouldPreserveSource) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
// Otherwise we can safely replace the source
|
|
35
|
+
// And continue traversing
|
|
36
|
+
node.source = source;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
32
39
|
return cloned;
|
|
33
40
|
});
|
|
34
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Traverse a tree of nodes and don't traverse children if the callback
|
|
44
|
+
* returns false. Ideally we'd use Container#walk instead of this
|
|
45
|
+
* function but it stops traversing siblings too.
|
|
46
|
+
*
|
|
47
|
+
* @param {import('postcss').Container} node
|
|
48
|
+
* @param {(node: import('postcss').Container) => boolean} onNode
|
|
49
|
+
*/ function traverse(node, onNode) {
|
|
50
|
+
if (onNode(node) !== false) {
|
|
51
|
+
var _node_each;
|
|
52
|
+
(_node_each = node.each) === null || _node_each === void 0 ? void 0 : _node_each.call(node, (child)=>traverse(child, onNode));
|
|
53
|
+
}
|
|
54
|
+
}
|
package/lib/util/color.js
CHANGED
|
@@ -27,11 +27,11 @@ let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
|
27
27
|
let VALUE = /(?:\d+|\d*\.\d+)%?/;
|
|
28
28
|
let SEP = /(?:\s*,\s*|\s+)/;
|
|
29
29
|
let ALPHA_SEP = /\s*[,/]\s*/;
|
|
30
|
-
let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/;
|
|
30
|
+
let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)(?:,(?:[^ )]*?|var\(--[^ )]*?\)))?\)/;
|
|
31
31
|
let RGB = new RegExp(`^(rgba?)\\(\\s*(${VALUE.source}|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`);
|
|
32
32
|
let HSL = new RegExp(`^(hsla?)\\(\\s*((?:${VALUE.source})(?:deg|rad|grad|turn)?|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`);
|
|
33
|
-
function parseColor(value, { loose =
|
|
34
|
-
var
|
|
33
|
+
function parseColor(value, { loose =false } = {}) {
|
|
34
|
+
var _match_, _match__toString;
|
|
35
35
|
if (typeof value !== "string") {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
@@ -107,7 +107,7 @@ function parseColor(value, { loose = false } = {}) {
|
|
|
107
107
|
alpha: (_match_ = match[5]) === null || _match_ === void 0 ? void 0 : (_match__toString = _match_.toString) === null || _match__toString === void 0 ? void 0 : _match__toString.call(_match_)
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function formatColor({ mode, color, alpha
|
|
110
|
+
function formatColor({ mode , color , alpha }) {
|
|
111
111
|
let hasAlpha = alpha !== undefined;
|
|
112
112
|
if (mode === "rgba" || mode === "hsla") {
|
|
113
113
|
return `${mode}(${color.join(", ")}${hasAlpha ? `, ${alpha}` : ""})`;
|
|
@@ -21,9 +21,9 @@ function createUtilityPlugin(themeKey, utilityVariations = [
|
|
|
21
21
|
themeKey
|
|
22
22
|
]
|
|
23
23
|
]
|
|
24
|
-
], { filterDefault =
|
|
24
|
+
], { filterDefault =false , ...options } = {}) {
|
|
25
25
|
let transformValue = (0, _transformThemeValue.default)(themeKey);
|
|
26
|
-
return function({ matchUtilities, theme
|
|
26
|
+
return function({ matchUtilities , theme }) {
|
|
27
27
|
for (let utilityVariation of utilityVariations){
|
|
28
28
|
let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [
|
|
29
29
|
utilityVariation
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -68,8 +68,36 @@ let cssFunctions = [
|
|
|
68
68
|
function isCSSFunction(value) {
|
|
69
69
|
return cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.*\\)`).test(value));
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// These properties accept a `<dashed-ident>` as one of the values. This means that you can use them
|
|
72
|
+
// as: `timeline-scope: --tl;`
|
|
73
|
+
//
|
|
74
|
+
// Without the `var(--tl)`, in these cases we don't want to normalize the value, and you should add
|
|
75
|
+
// the `var()` yourself.
|
|
76
|
+
//
|
|
77
|
+
// More info:
|
|
78
|
+
// - https://drafts.csswg.org/scroll-animations/#propdef-timeline-scope
|
|
79
|
+
// - https://developer.mozilla.org/en-US/docs/Web/CSS/timeline-scope#dashed-ident
|
|
80
|
+
// - https://www.w3.org/TR/css-anchor-position-1
|
|
81
|
+
//
|
|
82
|
+
const AUTO_VAR_INJECTION_EXCEPTIONS = new Set([
|
|
83
|
+
// Concrete properties
|
|
84
|
+
"scroll-timeline-name",
|
|
85
|
+
"timeline-scope",
|
|
86
|
+
"view-timeline-name",
|
|
87
|
+
"font-palette",
|
|
88
|
+
"anchor-name",
|
|
89
|
+
"anchor-scope",
|
|
90
|
+
"position-anchor",
|
|
91
|
+
"position-try-options",
|
|
92
|
+
// Shorthand properties
|
|
93
|
+
"scroll-timeline",
|
|
94
|
+
"animation-timeline",
|
|
95
|
+
"view-timeline",
|
|
96
|
+
"position-try"
|
|
97
|
+
]);
|
|
98
|
+
function normalize(value, context = null, isRoot = true) {
|
|
99
|
+
let isVarException = context && AUTO_VAR_INJECTION_EXCEPTIONS.has(context.property);
|
|
100
|
+
if (value.startsWith("--") && !isVarException) {
|
|
73
101
|
return `var(${value})`;
|
|
74
102
|
}
|
|
75
103
|
// Keep raw strings if it starts with `url(`
|
|
@@ -78,7 +106,7 @@ function normalize(value, isRoot = true) {
|
|
|
78
106
|
if (/^url\(.*?\)$/.test(part)) {
|
|
79
107
|
return part;
|
|
80
108
|
}
|
|
81
|
-
return normalize(part, false);
|
|
109
|
+
return normalize(part, context, false);
|
|
82
110
|
}).join("");
|
|
83
111
|
}
|
|
84
112
|
// Convert `_` to ` `, except for escaped underscores `\_`
|
|
@@ -92,7 +120,7 @@ function normalize(value, isRoot = true) {
|
|
|
92
120
|
}
|
|
93
121
|
/**
|
|
94
122
|
* Add spaces around operators inside math functions
|
|
95
|
-
* like calc() that do not follow an operator
|
|
123
|
+
* like calc() that do not follow an operator, '(', or `,`.
|
|
96
124
|
*
|
|
97
125
|
* @param {string} value
|
|
98
126
|
* @returns {string}
|
|
@@ -100,6 +128,32 @@ function normalize(value, isRoot = true) {
|
|
|
100
128
|
let preventFormattingInFunctions = [
|
|
101
129
|
"theme"
|
|
102
130
|
];
|
|
131
|
+
let preventFormattingKeywords = [
|
|
132
|
+
"min-content",
|
|
133
|
+
"max-content",
|
|
134
|
+
"fit-content",
|
|
135
|
+
// Env
|
|
136
|
+
"safe-area-inset-top",
|
|
137
|
+
"safe-area-inset-right",
|
|
138
|
+
"safe-area-inset-bottom",
|
|
139
|
+
"safe-area-inset-left",
|
|
140
|
+
"titlebar-area-x",
|
|
141
|
+
"titlebar-area-y",
|
|
142
|
+
"titlebar-area-width",
|
|
143
|
+
"titlebar-area-height",
|
|
144
|
+
"keyboard-inset-top",
|
|
145
|
+
"keyboard-inset-right",
|
|
146
|
+
"keyboard-inset-bottom",
|
|
147
|
+
"keyboard-inset-left",
|
|
148
|
+
"keyboard-inset-width",
|
|
149
|
+
"keyboard-inset-height",
|
|
150
|
+
"radial-gradient",
|
|
151
|
+
"linear-gradient",
|
|
152
|
+
"conic-gradient",
|
|
153
|
+
"repeating-radial-gradient",
|
|
154
|
+
"repeating-linear-gradient",
|
|
155
|
+
"repeating-conic-gradient"
|
|
156
|
+
];
|
|
103
157
|
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
|
104
158
|
let result = "";
|
|
105
159
|
function lastChar() {
|
|
@@ -136,10 +190,18 @@ function normalize(value, isRoot = true) {
|
|
|
136
190
|
")",
|
|
137
191
|
","
|
|
138
192
|
]);
|
|
193
|
+
} else if (preventFormattingKeywords.some((keyword)=>peek(keyword))) {
|
|
194
|
+
let keyword = preventFormattingKeywords.find((keyword)=>peek(keyword));
|
|
195
|
+
result += keyword;
|
|
196
|
+
i += keyword.length - 1;
|
|
139
197
|
} else if (preventFormattingInFunctions.some((fn)=>peek(fn))) {
|
|
140
198
|
result += consumeUntil([
|
|
141
199
|
")"
|
|
142
200
|
]);
|
|
201
|
+
} else if (peek("[")) {
|
|
202
|
+
result += consumeUntil([
|
|
203
|
+
"]"
|
|
204
|
+
]);
|
|
143
205
|
} else if ([
|
|
144
206
|
"+",
|
|
145
207
|
"-",
|
|
@@ -150,7 +212,8 @@ function normalize(value, isRoot = true) {
|
|
|
150
212
|
"+",
|
|
151
213
|
"-",
|
|
152
214
|
"*",
|
|
153
|
-
"/"
|
|
215
|
+
"/",
|
|
216
|
+
","
|
|
154
217
|
].includes(lastChar())) {
|
|
155
218
|
result += ` ${char} `;
|
|
156
219
|
} else {
|
|
@@ -343,7 +406,7 @@ let absoluteSizes = new Set([
|
|
|
343
406
|
"medium",
|
|
344
407
|
"large",
|
|
345
408
|
"x-large",
|
|
346
|
-
"
|
|
409
|
+
"xx-large",
|
|
347
410
|
"xxx-large"
|
|
348
411
|
]);
|
|
349
412
|
function absoluteSize(value) {
|
package/lib/util/defaults.js
CHANGED
|
@@ -11,14 +11,14 @@ Object.defineProperty(exports, "defaults", {
|
|
|
11
11
|
function defaults(target, ...sources) {
|
|
12
12
|
for (let source of sources){
|
|
13
13
|
for(let k in source){
|
|
14
|
-
var _target_hasOwnProperty
|
|
15
|
-
if (!(
|
|
14
|
+
var _target_hasOwnProperty;
|
|
15
|
+
if (!(target === null || target === void 0 ? void 0 : (_target_hasOwnProperty = target.hasOwnProperty) === null || _target_hasOwnProperty === void 0 ? void 0 : _target_hasOwnProperty.call(target, k))) {
|
|
16
16
|
target[k] = source[k];
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
for (let k of Object.getOwnPropertySymbols(source)){
|
|
20
|
-
var _target_hasOwnProperty1
|
|
21
|
-
if (!(
|
|
20
|
+
var _target_hasOwnProperty1;
|
|
21
|
+
if (!(target === null || target === void 0 ? void 0 : (_target_hasOwnProperty1 = target.hasOwnProperty) === null || _target_hasOwnProperty1 === void 0 ? void 0 : _target_hasOwnProperty1.call(target, k))) {
|
|
22
22
|
target[k] = source[k];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -16,9 +16,9 @@ function _interop_require_default(obj) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
function escapeClassName(className) {
|
|
19
|
-
var _node_raws
|
|
19
|
+
var _node_raws;
|
|
20
20
|
let node = _postcssselectorparser.default.className();
|
|
21
21
|
node.value = className;
|
|
22
22
|
var _node_raws_value;
|
|
23
|
-
return (0, _escapeCommas.default)((_node_raws_value =
|
|
23
|
+
return (0, _escapeCommas.default)((_node_raws_value = node === null || node === void 0 ? void 0 : (_node_raws = node.raws) === null || _node_raws === void 0 ? void 0 : _node_raws.value) !== null && _node_raws_value !== void 0 ? _node_raws_value : node.value);
|
|
24
24
|
}
|
|
@@ -34,10 +34,9 @@ function _interop_require_default(obj) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
/** @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, respectPrefix: boolean}[]} RawFormats */ /** @typedef {import('postcss-selector-parser').Root} ParsedFormats */ /** @typedef {RawFormats | ParsedFormats} AcceptedFormats */ let MERGE = ":merge";
|
|
37
|
-
function formatVariantSelector(formats, { context, candidate
|
|
38
|
-
var _context;
|
|
37
|
+
function formatVariantSelector(formats, { context , candidate }) {
|
|
39
38
|
var _context_tailwindConfig_prefix;
|
|
40
|
-
let prefix = (_context_tailwindConfig_prefix =
|
|
39
|
+
let prefix = (_context_tailwindConfig_prefix = context === null || context === void 0 ? void 0 : context.tailwindConfig.prefix) !== null && _context_tailwindConfig_prefix !== void 0 ? _context_tailwindConfig_prefix : "";
|
|
41
40
|
// Parse the format selector into an AST
|
|
42
41
|
let parsedFormats = formats.map((format)=>{
|
|
43
42
|
let ast = (0, _postcssselectorparser.default)().astSync(format.format);
|
|
@@ -59,7 +58,7 @@ function formatVariantSelector(formats, { context, candidate }) {
|
|
|
59
58
|
]
|
|
60
59
|
});
|
|
61
60
|
// And iteratively merge each format selector into the candidate selector
|
|
62
|
-
for (let { ast
|
|
61
|
+
for (let { ast } of parsedFormats){
|
|
63
62
|
[formatAst, ast] = handleMergePseudo(formatAst, ast);
|
|
64
63
|
// 2. Merge the format selector into the current selector AST
|
|
65
64
|
ast.walkNesting((nesting)=>nesting.replaceWith(...formatAst.nodes[0].nodes));
|
|
@@ -129,10 +128,10 @@ function eliminateIrrelevantSelectors(sel, base) {
|
|
|
129
128
|
// meaning of the selector.
|
|
130
129
|
// TODO: Can we do this for :matches, :is, and :where?
|
|
131
130
|
}
|
|
132
|
-
function finalizeSelector(current, formats, { context, candidate, base
|
|
133
|
-
var _context_tailwindConfig
|
|
131
|
+
function finalizeSelector(current, formats, { context , candidate , base }) {
|
|
132
|
+
var _context_tailwindConfig;
|
|
134
133
|
var _context_tailwindConfig_separator;
|
|
135
|
-
let separator = (_context_tailwindConfig_separator =
|
|
134
|
+
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 : ":";
|
|
136
135
|
// Split by the separator, but ignore the separator inside square brackets:
|
|
137
136
|
//
|
|
138
137
|
// E.g.: dark:lg:hover:[paint-order:markers]
|
|
@@ -161,6 +160,12 @@ function finalizeSelector(current, formats, { context, candidate, base }) {
|
|
|
161
160
|
});
|
|
162
161
|
// Remove extraneous selectors that do not include the base candidate
|
|
163
162
|
selector.each((sel)=>eliminateIrrelevantSelectors(sel, base));
|
|
163
|
+
// If ffter eliminating irrelevant selectors, we end up with nothing
|
|
164
|
+
// Then the whole "rule" this is associated with does not need to exist
|
|
165
|
+
// We use `null` as a marker value for that case
|
|
166
|
+
if (selector.length === 0) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
164
169
|
// If there are no formats that means there were no variants added to the candidate
|
|
165
170
|
// so we can just return the selector as-is
|
|
166
171
|
let formatAst = Array.isArray(formats) ? formatVariantSelector(formats, {
|
|
@@ -16,16 +16,15 @@ function _interop_require_default(obj) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
function getAllConfigs(config) {
|
|
19
|
-
var _config;
|
|
20
19
|
var _config_presets;
|
|
21
|
-
const configs = ((_config_presets =
|
|
20
|
+
const configs = ((_config_presets = config === null || config === void 0 ? void 0 : config.presets) !== null && _config_presets !== void 0 ? _config_presets : [
|
|
22
21
|
_configfull.default
|
|
23
22
|
]).slice().reverse().flatMap((preset)=>getAllConfigs(preset instanceof Function ? preset() : preset));
|
|
24
23
|
const features = {
|
|
25
24
|
// Add experimental configs here...
|
|
26
25
|
respectDefaultRingColorOpacity: {
|
|
27
26
|
theme: {
|
|
28
|
-
ringColor: ({ theme
|
|
27
|
+
ringColor: ({ theme })=>({
|
|
29
28
|
DEFAULT: "#3b82f67f",
|
|
30
29
|
...theme("colors")
|
|
31
30
|
})
|
package/lib/util/log.js
CHANGED
|
@@ -34,23 +34,6 @@ function dim(input) {
|
|
|
34
34
|
return _picocolors.default.dim(input);
|
|
35
35
|
}
|
|
36
36
|
const _default = {
|
|
37
|
-
group (key, cb) {
|
|
38
|
-
if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
|
|
39
|
-
if (key && alreadyShown.has(key)) return;
|
|
40
|
-
if (key) alreadyShown.add(key);
|
|
41
|
-
console.warn("");
|
|
42
|
-
cb({
|
|
43
|
-
info (messages) {
|
|
44
|
-
messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.cyan("info")), "-", message));
|
|
45
|
-
},
|
|
46
|
-
warn (messages) {
|
|
47
|
-
messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.yellow("warn")), "-", message));
|
|
48
|
-
},
|
|
49
|
-
risk (messages) {
|
|
50
|
-
messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.magenta("risk")), "-", message));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
37
|
info (key, messages) {
|
|
55
38
|
log(_picocolors.default.bold(_picocolors.default.cyan("info")), ...Array.isArray(key) ? [
|
|
56
39
|
key
|
|
@@ -65,9 +65,6 @@ function normalizeConfig(config) {
|
|
|
65
65
|
* transform?: TransformerFn | { [extension: string]: TransformerFn }
|
|
66
66
|
* }
|
|
67
67
|
*/ let valid = (()=>{
|
|
68
|
-
if (config.content === "auto") {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
68
|
// `config.purge` should not exist anymore
|
|
72
69
|
if (config.purge) {
|
|
73
70
|
return false;
|
|
@@ -83,14 +80,13 @@ function normalizeConfig(config) {
|
|
|
83
80
|
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
|
84
81
|
if (Array.isArray(config.content)) {
|
|
85
82
|
return config.content.every((path)=>{
|
|
86
|
-
var _path, _path1, _path2;
|
|
87
83
|
// `path` can be a string
|
|
88
84
|
if (typeof path === "string") return true;
|
|
89
85
|
// `path` can be an object { raw: string, extension?: string }
|
|
90
86
|
// `raw` must be a string
|
|
91
|
-
if (typeof (
|
|
87
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
92
88
|
// `extension` (if provided) should also be a string
|
|
93
|
-
if ((
|
|
89
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
94
90
|
return false;
|
|
95
91
|
}
|
|
96
92
|
return true;
|
|
@@ -110,14 +106,13 @@ function normalizeConfig(config) {
|
|
|
110
106
|
// `config.content.files` should exist of FilePaths or RawFiles
|
|
111
107
|
if (Array.isArray(config.content.files)) {
|
|
112
108
|
if (!config.content.files.every((path)=>{
|
|
113
|
-
var _path, _path1, _path2;
|
|
114
109
|
// `path` can be a string
|
|
115
110
|
if (typeof path === "string") return true;
|
|
116
111
|
// `path` can be an object { raw: string, extension?: string }
|
|
117
112
|
// `raw` must be a string
|
|
118
|
-
if (typeof (
|
|
113
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
119
114
|
// `extension` (if provided) should also be a string
|
|
120
|
-
if ((
|
|
115
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
121
116
|
return false;
|
|
122
117
|
}
|
|
123
118
|
return true;
|
|
@@ -162,17 +157,17 @@ function normalizeConfig(config) {
|
|
|
162
157
|
}
|
|
163
158
|
// Normalize the `safelist`
|
|
164
159
|
config.safelist = (()=>{
|
|
165
|
-
var
|
|
166
|
-
let { content, purge, safelist
|
|
160
|
+
var _purge_options;
|
|
161
|
+
let { content , purge , safelist } = config;
|
|
167
162
|
if (Array.isArray(safelist)) return safelist;
|
|
168
|
-
if (Array.isArray(
|
|
169
|
-
if (Array.isArray(
|
|
170
|
-
if (Array.isArray(
|
|
163
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
|
|
164
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
|
|
165
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (_purge_options = purge.options) === null || _purge_options === void 0 ? void 0 : _purge_options.safelist)) return purge.options.safelist;
|
|
171
166
|
return [];
|
|
172
167
|
})();
|
|
173
168
|
// Normalize the `blocklist`
|
|
174
169
|
config.blocklist = (()=>{
|
|
175
|
-
let { blocklist
|
|
170
|
+
let { blocklist } = config;
|
|
176
171
|
if (Array.isArray(blocklist)) {
|
|
177
172
|
if (blocklist.every((item)=>typeof item === "string")) {
|
|
178
173
|
return blocklist;
|
|
@@ -199,34 +194,24 @@ function normalizeConfig(config) {
|
|
|
199
194
|
// Normalize the `content`
|
|
200
195
|
config.content = {
|
|
201
196
|
relative: (()=>{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if ((_content = content) === null || _content === void 0 ? void 0 : _content.relative) {
|
|
197
|
+
let { content } = config;
|
|
198
|
+
if (content === null || content === void 0 ? void 0 : content.relative) {
|
|
205
199
|
return content.relative;
|
|
206
200
|
}
|
|
207
201
|
return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
|
|
208
202
|
})(),
|
|
209
203
|
files: (()=>{
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
if (purge) {
|
|
214
|
-
var _purge;
|
|
215
|
-
if (Array.isArray(purge)) return purge;
|
|
216
|
-
if (Array.isArray((_purge = purge) === null || _purge === void 0 ? void 0 : _purge.content)) return purge.content;
|
|
217
|
-
return [];
|
|
218
|
-
}
|
|
204
|
+
let { content , purge } = config;
|
|
205
|
+
if (Array.isArray(purge)) return purge;
|
|
206
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
|
|
219
207
|
if (Array.isArray(content)) return content;
|
|
220
|
-
if (Array.isArray(
|
|
221
|
-
if (Array.isArray(
|
|
222
|
-
if (content === "auto") return [
|
|
223
|
-
"auto"
|
|
224
|
-
];
|
|
208
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
|
|
209
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
|
|
225
210
|
return [];
|
|
226
211
|
})(),
|
|
227
212
|
extract: (()=>{
|
|
228
213
|
let extract = (()=>{
|
|
229
|
-
var _config_purge, _config_content, _config_purge_extract,
|
|
214
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options;
|
|
230
215
|
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
|
|
231
216
|
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
|
|
232
217
|
if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_extract = _config_purge1.extract) === null || _config_purge_extract === void 0 ? void 0 : _config_purge_extract.DEFAULT) return config.purge.extract.DEFAULT;
|
|
@@ -237,7 +222,7 @@ function normalizeConfig(config) {
|
|
|
237
222
|
})();
|
|
238
223
|
let extractors = {};
|
|
239
224
|
let defaultExtractor = (()=>{
|
|
240
|
-
var _config_purge_options,
|
|
225
|
+
var _config_purge, _config_purge_options, _config_content, _config_content_options;
|
|
241
226
|
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : (_config_purge_options = _config_purge.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.defaultExtractor) {
|
|
242
227
|
return config.purge.options.defaultExtractor;
|
|
243
228
|
}
|
|
@@ -253,7 +238,7 @@ function normalizeConfig(config) {
|
|
|
253
238
|
if (typeof extract === "function") {
|
|
254
239
|
extractors.DEFAULT = extract;
|
|
255
240
|
} else if (Array.isArray(extract)) {
|
|
256
|
-
for (let { extensions, extractor
|
|
241
|
+
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
|
257
242
|
for (let extension of extensions){
|
|
258
243
|
extractors[extension] = extractor;
|
|
259
244
|
}
|
|
@@ -265,7 +250,7 @@ function normalizeConfig(config) {
|
|
|
265
250
|
})(),
|
|
266
251
|
transform: (()=>{
|
|
267
252
|
let transform = (()=>{
|
|
268
|
-
var _config_purge, _config_content, _config_purge_transform,
|
|
253
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
|
|
269
254
|
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
|
|
270
255
|
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
|
|
271
256
|
if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_transform = _config_purge1.transform) === null || _config_purge_transform === void 0 ? void 0 : _config_purge_transform.DEFAULT) return config.purge.transform.DEFAULT;
|
|
@@ -282,31 +267,15 @@ function normalizeConfig(config) {
|
|
|
282
267
|
return transformers;
|
|
283
268
|
})()
|
|
284
269
|
};
|
|
285
|
-
// Force disable the `oxideParser` feature flag when using unsupported features.
|
|
286
|
-
// TODO: Remove once we have prefix or separator support in the oxide parser.
|
|
287
|
-
if (config.prefix !== "" || config.separator !== ":") {
|
|
288
|
-
if (config.experimental === "all") {
|
|
289
|
-
config.experimental = {};
|
|
290
|
-
for (let key of _featureFlags.featureFlags.experimental){
|
|
291
|
-
config.experimental[key] = true;
|
|
292
|
-
}
|
|
293
|
-
} else {
|
|
294
|
-
var _config_experimental;
|
|
295
|
-
config.experimental = (_config_experimental = config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {};
|
|
296
|
-
}
|
|
297
|
-
config.experimental.oxideParser = false;
|
|
298
|
-
}
|
|
299
270
|
// Validate globs to prevent bogus globs.
|
|
300
271
|
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
_log.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
272
|
+
for (let file of config.content.files){
|
|
273
|
+
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
|
274
|
+
_log.default.warn("invalid-glob-braces", [
|
|
275
|
+
`The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
|
|
276
|
+
`Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
|
|
277
|
+
]);
|
|
278
|
+
break;
|
|
310
279
|
}
|
|
311
280
|
}
|
|
312
281
|
return config;
|
|
@@ -132,8 +132,8 @@ function compareScreens(type, a, z) {
|
|
|
132
132
|
throw new Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
|
|
133
133
|
}
|
|
134
134
|
// Let the sorting begin
|
|
135
|
-
let { min: aMin, max: aMax
|
|
136
|
-
let { min: zMin, max: zMax
|
|
135
|
+
let { min: aMin , max: aMax } = aScreen.values[0];
|
|
136
|
+
let { min: zMin , max: zMax } = zScreen.values[0];
|
|
137
137
|
// Negating screens flip their behavior. Basically `not min-width` is `max-width`
|
|
138
138
|
if (a.not) [aMin, aMax] = [
|
|
139
139
|
aMax,
|
|
@@ -169,7 +169,7 @@ function toScreen(value, type) {
|
|
|
169
169
|
]
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
function resolveValue({ "min-width": _minWidth, min =
|
|
172
|
+
function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
|
|
173
173
|
return {
|
|
174
174
|
min,
|
|
175
175
|
max,
|