tailwindcss 0.0.0-insiders.ddec022 → 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.
- package/lib/cli/build/plugin.js +6 -6
- package/lib/cli/build/watching.js +1 -1
- package/lib/corePluginList.js +5 -1
- package/lib/corePlugins.js +170 -13
- package/lib/css/preflight.css +24 -8
- package/lib/lib/content.js +36 -3
- package/lib/lib/defaultExtractor.js +33 -25
- package/lib/lib/evaluateTailwindFunctions.js +5 -3
- package/lib/lib/expandApplyAtRules.js +6 -0
- package/lib/lib/expandTailwindAtRules.js +23 -6
- package/lib/lib/generateRules.js +47 -25
- package/lib/lib/load-config.js +14 -3
- package/lib/lib/offsets.js +51 -2
- package/lib/lib/resolveDefaultsAtRules.js +3 -1
- package/lib/lib/setupContextUtils.js +76 -37
- package/lib/lib/setupTrackingContext.js +2 -1
- package/lib/oxide/cli/build/plugin.js +6 -6
- package/lib/plugin.js +3 -3
- package/lib/processTailwindFeatures.js +2 -2
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +1 -1
- package/lib/util/dataTypes.js +135 -16
- package/lib/util/formatVariantSelector.js +10 -3
- package/lib/util/isPlainObject.js +1 -1
- package/lib/util/pluginUtils.js +13 -0
- package/lib/util/prefixSelector.js +1 -1
- package/lib/util/pseudoElements.js +21 -34
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/nesting/index.d.ts +4 -0
- package/package.json +5 -6
- package/peers/index.js +701 -617
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/src/cli/build/plugin.js +6 -6
- package/src/cli/build/watching.js +1 -1
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +149 -12
- package/src/css/preflight.css +24 -8
- package/src/featureFlags.js +1 -5
- package/src/lib/content.js +42 -1
- package/src/lib/defaultExtractor.js +30 -17
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandApplyAtRules.js +7 -0
- package/src/lib/expandTailwindAtRules.js +23 -6
- package/src/lib/generateRules.js +50 -26
- package/src/lib/load-config.ts +8 -0
- package/src/lib/offsets.js +61 -2
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +77 -38
- package/src/lib/setupTrackingContext.js +1 -3
- package/src/oxide/cli/build/plugin.ts +6 -6
- package/src/plugin.js +3 -3
- package/src/processTailwindFeatures.js +3 -2
- package/src/util/cloneNodes.js +35 -14
- package/src/util/color.js +1 -1
- package/src/util/dataTypes.js +143 -18
- package/src/util/formatVariantSelector.js +11 -3
- package/src/util/isPlainObject.js +1 -1
- package/src/util/pluginUtils.js +16 -0
- package/src/util/prefixSelector.js +1 -0
- package/src/util/pseudoElements.js +18 -17
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/config.full.js +86 -14
- package/types/config.d.ts +17 -9
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +35 -9
- package/types/index.d.ts +7 -3
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,7 +27,7 @@ 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
33
|
function parseColor(value, { loose =false } = {}) {
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -68,10 +68,30 @@ let cssFunctions = [
|
|
|
68
68
|
function isCSSFunction(value) {
|
|
69
69
|
return cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.*\\)`).test(value));
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
//
|
|
81
|
+
const AUTO_VAR_INJECTION_EXCEPTIONS = new Set([
|
|
82
|
+
// Concrete properties
|
|
83
|
+
"scroll-timeline-name",
|
|
84
|
+
"timeline-scope",
|
|
85
|
+
"view-timeline-name",
|
|
86
|
+
"font-palette",
|
|
87
|
+
// Shorthand properties
|
|
88
|
+
"scroll-timeline",
|
|
89
|
+
"animation-timeline",
|
|
90
|
+
"view-timeline"
|
|
91
|
+
]);
|
|
92
|
+
function normalize(value, context = null, isRoot = true) {
|
|
93
|
+
let isVarException = context && AUTO_VAR_INJECTION_EXCEPTIONS.has(context.property);
|
|
94
|
+
if (value.startsWith("--") && !isVarException) {
|
|
75
95
|
return `var(${value})`;
|
|
76
96
|
}
|
|
77
97
|
// Keep raw strings if it starts with `url(`
|
|
@@ -80,7 +100,7 @@ function normalize(value, isRoot = true) {
|
|
|
80
100
|
if (/^url\(.*?\)$/.test(part)) {
|
|
81
101
|
return part;
|
|
82
102
|
}
|
|
83
|
-
return normalize(part, false);
|
|
103
|
+
return normalize(part, context, false);
|
|
84
104
|
}).join("");
|
|
85
105
|
}
|
|
86
106
|
// Convert `_` to ` `, except for escaped underscores `\_`
|
|
@@ -89,17 +109,115 @@ function normalize(value, isRoot = true) {
|
|
|
89
109
|
if (isRoot) {
|
|
90
110
|
value = value.trim();
|
|
91
111
|
}
|
|
92
|
-
|
|
93
|
-
// or '('.
|
|
94
|
-
value = value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
|
95
|
-
let vars = [];
|
|
96
|
-
return match.replace(/var\((--.+?)[,)]/g, (match, g1)=>{
|
|
97
|
-
vars.push(g1);
|
|
98
|
-
return match.replace(g1, placeholder);
|
|
99
|
-
}).replace(/(-?\d*\.?\d(?!\b-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(placeholderRe, ()=>vars.shift());
|
|
100
|
-
});
|
|
112
|
+
value = normalizeMathOperatorSpacing(value);
|
|
101
113
|
return value;
|
|
102
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Add spaces around operators inside math functions
|
|
117
|
+
* like calc() that do not follow an operator, '(', or `,`.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} value
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/ function normalizeMathOperatorSpacing(value) {
|
|
122
|
+
let preventFormattingInFunctions = [
|
|
123
|
+
"theme"
|
|
124
|
+
];
|
|
125
|
+
let preventFormattingKeywords = [
|
|
126
|
+
"min-content",
|
|
127
|
+
"max-content",
|
|
128
|
+
"fit-content",
|
|
129
|
+
// Env
|
|
130
|
+
"safe-area-inset-top",
|
|
131
|
+
"safe-area-inset-right",
|
|
132
|
+
"safe-area-inset-bottom",
|
|
133
|
+
"safe-area-inset-left",
|
|
134
|
+
"titlebar-area-x",
|
|
135
|
+
"titlebar-area-y",
|
|
136
|
+
"titlebar-area-width",
|
|
137
|
+
"titlebar-area-height",
|
|
138
|
+
"keyboard-inset-top",
|
|
139
|
+
"keyboard-inset-right",
|
|
140
|
+
"keyboard-inset-bottom",
|
|
141
|
+
"keyboard-inset-left",
|
|
142
|
+
"keyboard-inset-width",
|
|
143
|
+
"keyboard-inset-height",
|
|
144
|
+
"radial-gradient",
|
|
145
|
+
"linear-gradient",
|
|
146
|
+
"conic-gradient",
|
|
147
|
+
"repeating-radial-gradient",
|
|
148
|
+
"repeating-linear-gradient",
|
|
149
|
+
"repeating-conic-gradient"
|
|
150
|
+
];
|
|
151
|
+
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
|
152
|
+
let result = "";
|
|
153
|
+
function lastChar() {
|
|
154
|
+
let char = result.trimEnd();
|
|
155
|
+
return char[char.length - 1];
|
|
156
|
+
}
|
|
157
|
+
for(let i = 0; i < match.length; i++){
|
|
158
|
+
function peek(word) {
|
|
159
|
+
return word.split("").every((char, j)=>match[i + j] === char);
|
|
160
|
+
}
|
|
161
|
+
function consumeUntil(chars) {
|
|
162
|
+
let minIndex = Infinity;
|
|
163
|
+
for (let char of chars){
|
|
164
|
+
let index = match.indexOf(char, i);
|
|
165
|
+
if (index !== -1 && index < minIndex) {
|
|
166
|
+
minIndex = index;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
let result = match.slice(i, minIndex);
|
|
170
|
+
i += result.length - 1;
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
let char = match[i];
|
|
174
|
+
// Handle `var(--variable)`
|
|
175
|
+
if (peek("var")) {
|
|
176
|
+
// When we consume until `)`, then we are dealing with this scenario:
|
|
177
|
+
// `var(--example)`
|
|
178
|
+
//
|
|
179
|
+
// When we consume until `,`, then we are dealing with this scenario:
|
|
180
|
+
// `var(--example, 1rem)`
|
|
181
|
+
//
|
|
182
|
+
// In this case we do want to "format", the default value as well
|
|
183
|
+
result += consumeUntil([
|
|
184
|
+
")",
|
|
185
|
+
","
|
|
186
|
+
]);
|
|
187
|
+
} else if (preventFormattingKeywords.some((keyword)=>peek(keyword))) {
|
|
188
|
+
let keyword = preventFormattingKeywords.find((keyword)=>peek(keyword));
|
|
189
|
+
result += keyword;
|
|
190
|
+
i += keyword.length - 1;
|
|
191
|
+
} else if (preventFormattingInFunctions.some((fn)=>peek(fn))) {
|
|
192
|
+
result += consumeUntil([
|
|
193
|
+
")"
|
|
194
|
+
]);
|
|
195
|
+
} else if (peek("[")) {
|
|
196
|
+
result += consumeUntil([
|
|
197
|
+
"]"
|
|
198
|
+
]);
|
|
199
|
+
} else if ([
|
|
200
|
+
"+",
|
|
201
|
+
"-",
|
|
202
|
+
"*",
|
|
203
|
+
"/"
|
|
204
|
+
].includes(char) && ![
|
|
205
|
+
"(",
|
|
206
|
+
"+",
|
|
207
|
+
"-",
|
|
208
|
+
"*",
|
|
209
|
+
"/",
|
|
210
|
+
","
|
|
211
|
+
].includes(lastChar())) {
|
|
212
|
+
result += ` ${char} `;
|
|
213
|
+
} else {
|
|
214
|
+
result += char;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Simplify multiple spaces
|
|
218
|
+
return result.replace(/\s+/g, " ");
|
|
219
|
+
});
|
|
220
|
+
}
|
|
103
221
|
function url(value) {
|
|
104
222
|
return value.startsWith("url(");
|
|
105
223
|
}
|
|
@@ -199,11 +317,12 @@ function image(value) {
|
|
|
199
317
|
return images > 0;
|
|
200
318
|
}
|
|
201
319
|
let gradientTypes = new Set([
|
|
320
|
+
"conic-gradient",
|
|
202
321
|
"linear-gradient",
|
|
203
322
|
"radial-gradient",
|
|
323
|
+
"repeating-conic-gradient",
|
|
204
324
|
"repeating-linear-gradient",
|
|
205
|
-
"repeating-radial-gradient"
|
|
206
|
-
"conic-gradient"
|
|
325
|
+
"repeating-radial-gradient"
|
|
207
326
|
]);
|
|
208
327
|
function gradient(value) {
|
|
209
328
|
value = normalize(value);
|
|
@@ -27,12 +27,13 @@ const _unesc = /*#__PURE__*/ _interop_require_default(require("postcss-selector-
|
|
|
27
27
|
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
|
|
28
28
|
const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
|
|
29
29
|
const _pseudoElements = require("./pseudoElements");
|
|
30
|
+
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
|
30
31
|
function _interop_require_default(obj) {
|
|
31
32
|
return obj && obj.__esModule ? obj : {
|
|
32
33
|
default: obj
|
|
33
34
|
};
|
|
34
35
|
}
|
|
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,
|
|
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";
|
|
36
37
|
function formatVariantSelector(formats, { context , candidate }) {
|
|
37
38
|
var _context_tailwindConfig_prefix;
|
|
38
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,7 +42,7 @@ function formatVariantSelector(formats, { context , candidate }) {
|
|
|
41
42
|
let ast = (0, _postcssselectorparser.default)().astSync(format.format);
|
|
42
43
|
return {
|
|
43
44
|
...format,
|
|
44
|
-
ast: format.
|
|
45
|
+
ast: format.respectPrefix ? (0, _prefixSelector.default)(prefix, ast) : ast
|
|
45
46
|
};
|
|
46
47
|
});
|
|
47
48
|
// We start with the candidate selector
|
|
@@ -138,7 +139,7 @@ function finalizeSelector(current, formats, { context , candidate , base }) {
|
|
|
138
139
|
// │ │ │ ╰── We will not split here
|
|
139
140
|
// ╰──┴─────┴─────────────── We will split here
|
|
140
141
|
//
|
|
141
|
-
base = base !== null && base !== void 0 ? base :
|
|
142
|
+
base = base !== null && base !== void 0 ? base : (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(candidate, separator).pop();
|
|
142
143
|
// Parse the selector into an AST
|
|
143
144
|
let selector = (0, _postcssselectorparser.default)().astSync(current);
|
|
144
145
|
// Normalize escaped classes, e.g.:
|
|
@@ -159,6 +160,12 @@ function finalizeSelector(current, formats, { context , candidate , base }) {
|
|
|
159
160
|
});
|
|
160
161
|
// Remove extraneous selectors that do not include the base candidate
|
|
161
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
|
+
}
|
|
162
169
|
// If there are no formats that means there were no variants added to the candidate
|
|
163
170
|
// so we can just return the selector as-is
|
|
164
171
|
let formatAst = Array.isArray(formats) ? formatVariantSelector(formats, {
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -92,6 +92,19 @@ function isArbitraryValue(input) {
|
|
|
92
92
|
}
|
|
93
93
|
function splitUtilityModifier(modifier) {
|
|
94
94
|
let slashIdx = modifier.lastIndexOf("/");
|
|
95
|
+
// If the `/` is inside an arbitrary, we want to find the previous one if any
|
|
96
|
+
// This logic probably isn't perfect but it should work for most cases
|
|
97
|
+
let arbitraryStartIdx = modifier.lastIndexOf("[", slashIdx);
|
|
98
|
+
let arbitraryEndIdx = modifier.indexOf("]", slashIdx);
|
|
99
|
+
let isNextToArbitrary = modifier[slashIdx - 1] === "]" || modifier[slashIdx + 1] === "[";
|
|
100
|
+
// Backtrack to the previous `/` if the one we found was inside an arbitrary
|
|
101
|
+
if (!isNextToArbitrary) {
|
|
102
|
+
if (arbitraryStartIdx !== -1 && arbitraryEndIdx !== -1) {
|
|
103
|
+
if (arbitraryStartIdx < slashIdx && slashIdx < arbitraryEndIdx) {
|
|
104
|
+
slashIdx = modifier.lastIndexOf("/", arbitraryStartIdx);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
95
108
|
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
|
96
109
|
return [
|
|
97
110
|
modifier,
|
|
@@ -29,7 +29,7 @@ function _default(prefix, selector, prependNegative = false) {
|
|
|
29
29
|
if (prefix === "") {
|
|
30
30
|
return selector;
|
|
31
31
|
}
|
|
32
|
-
let ast = typeof selector === "string" ? (0, _postcssselectorparser.default)().astSync(selector) : selector;
|
|
32
|
+
/** @type {import('postcss-selector-parser').Root} */ let ast = typeof selector === "string" ? (0, _postcssselectorparser.default)().astSync(selector) : selector;
|
|
33
33
|
ast.walkClasses((classSelector)=>{
|
|
34
34
|
let baseClass = classSelector.value;
|
|
35
35
|
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// **Jumpable**
|
|
12
12
|
// Any terminal element may "jump" over combinators when moving to the end of the selector
|
|
13
13
|
//
|
|
14
|
-
// This is a backwards-compat quirk of
|
|
14
|
+
// This is a backwards-compat quirk of pseudo element variants from earlier versions of Tailwind CSS.
|
|
15
15
|
/** @typedef {'terminal' | 'actionable' | 'jumpable'} PseudoProperty */ /** @type {Record<string, PseudoProperty[]>} */ "use strict";
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
17
17
|
value: true
|
|
@@ -23,12 +23,14 @@ Object.defineProperty(exports, "movePseudos", {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
let elementProperties = {
|
|
26
|
+
// Pseudo elements from the spec
|
|
26
27
|
"::after": [
|
|
27
28
|
"terminal",
|
|
28
29
|
"jumpable"
|
|
29
30
|
],
|
|
30
31
|
"::backdrop": [
|
|
31
|
-
"terminal"
|
|
32
|
+
"terminal",
|
|
33
|
+
"jumpable"
|
|
32
34
|
],
|
|
33
35
|
"::before": [
|
|
34
36
|
"terminal",
|
|
@@ -52,17 +54,20 @@ let elementProperties = {
|
|
|
52
54
|
"terminal"
|
|
53
55
|
],
|
|
54
56
|
"::marker": [
|
|
55
|
-
"terminal"
|
|
57
|
+
"terminal",
|
|
58
|
+
"jumpable"
|
|
56
59
|
],
|
|
57
60
|
"::part": [
|
|
58
61
|
"terminal",
|
|
59
62
|
"actionable"
|
|
60
63
|
],
|
|
61
64
|
"::placeholder": [
|
|
62
|
-
"terminal"
|
|
65
|
+
"terminal",
|
|
66
|
+
"jumpable"
|
|
63
67
|
],
|
|
64
68
|
"::selection": [
|
|
65
|
-
"terminal"
|
|
69
|
+
"terminal",
|
|
70
|
+
"jumpable"
|
|
66
71
|
],
|
|
67
72
|
"::slotted": [
|
|
68
73
|
"terminal"
|
|
@@ -73,42 +78,20 @@ let elementProperties = {
|
|
|
73
78
|
"::target-text": [
|
|
74
79
|
"terminal"
|
|
75
80
|
],
|
|
76
|
-
//
|
|
81
|
+
// Pseudo elements from the spec with special rules
|
|
77
82
|
"::file-selector-button": [
|
|
78
83
|
"terminal",
|
|
79
84
|
"actionable"
|
|
80
85
|
],
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
// Library-specific pseudo elements used by component libraries
|
|
87
|
+
// These are Shadow DOM-like
|
|
88
|
+
"::deep": [
|
|
83
89
|
"actionable"
|
|
84
90
|
],
|
|
85
|
-
|
|
86
|
-
"::-webkit-scrollbar": [
|
|
87
|
-
"terminal",
|
|
91
|
+
"::v-deep": [
|
|
88
92
|
"actionable"
|
|
89
93
|
],
|
|
90
|
-
"
|
|
91
|
-
"terminal",
|
|
92
|
-
"actionable"
|
|
93
|
-
],
|
|
94
|
-
"::-webkit-scrollbar-thumb": [
|
|
95
|
-
"terminal",
|
|
96
|
-
"actionable"
|
|
97
|
-
],
|
|
98
|
-
"::-webkit-scrollbar-track": [
|
|
99
|
-
"terminal",
|
|
100
|
-
"actionable"
|
|
101
|
-
],
|
|
102
|
-
"::-webkit-scrollbar-track-piece": [
|
|
103
|
-
"terminal",
|
|
104
|
-
"actionable"
|
|
105
|
-
],
|
|
106
|
-
"::-webkit-scrollbar-corner": [
|
|
107
|
-
"terminal",
|
|
108
|
-
"actionable"
|
|
109
|
-
],
|
|
110
|
-
"::-webkit-resizer": [
|
|
111
|
-
"terminal",
|
|
94
|
+
"::ng-deep": [
|
|
112
95
|
"actionable"
|
|
113
96
|
],
|
|
114
97
|
// Note: As a rule, double colons (::) should be used instead of a single colon
|
|
@@ -131,10 +114,14 @@ let elementProperties = {
|
|
|
131
114
|
"terminal",
|
|
132
115
|
"jumpable"
|
|
133
116
|
],
|
|
117
|
+
":where": [],
|
|
118
|
+
":is": [],
|
|
119
|
+
":has": [],
|
|
134
120
|
// The default value is used when the pseudo-element is not recognized
|
|
135
121
|
// Because it's not recognized, we don't know if it's terminal or not
|
|
136
|
-
// So we assume it can
|
|
122
|
+
// So we assume it can be moved AND can have user-action pseudo classes attached to it
|
|
137
123
|
__default__: [
|
|
124
|
+
"terminal",
|
|
138
125
|
"actionable"
|
|
139
126
|
]
|
|
140
127
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) Bogdan Chadkin <trysound@yandex.ru>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var parse = require("./parse");
|
|
3
|
+
var walk = require("./walk");
|
|
4
|
+
var stringify = require("./stringify");
|
|
5
|
+
function ValueParser(value) {
|
|
6
|
+
if (this instanceof ValueParser) {
|
|
7
|
+
this.nodes = parse(value);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
return new ValueParser(value);
|
|
11
|
+
}
|
|
12
|
+
ValueParser.prototype.toString = function() {
|
|
13
|
+
return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
|
|
14
|
+
};
|
|
15
|
+
ValueParser.prototype.walk = function(cb, bubble) {
|
|
16
|
+
walk(this.nodes, cb, bubble);
|
|
17
|
+
return this;
|
|
18
|
+
};
|
|
19
|
+
ValueParser.unit = require("./unit");
|
|
20
|
+
ValueParser.walk = walk;
|
|
21
|
+
ValueParser.stringify = stringify;
|
|
22
|
+
module.exports = ValueParser;
|