@weapp-tailwindcss/postcss 3.2.8 → 3.2.10
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/dist/compat/lynx-css.d.ts +2 -0
- package/dist/css-macro/auto.d.ts +2 -4
- package/dist/css-macro/conditions.d.ts +6 -0
- package/dist/html-transform.cjs +5 -3
- package/dist/html-transform.js +4 -2
- package/dist/index.cjs +366 -113
- package/dist/index.d.ts +2 -0
- package/dist/index.js +364 -113
- package/dist/{rolldown-runtime-D6vf50IK.cjs → rolldown-runtime-VH7oDXx4.cjs} +1 -1
- package/dist/selectorParser/pseudo.d.ts +1 -0
- package/dist/selectorParser/rule-transformer/types.d.ts +1 -0
- package/dist/selectorParser/rule-transformer/unsupported-pseudos.d.ts +5 -0
- package/dist/selectorParser.d.ts +1 -0
- package/dist/types.d.ts +13 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
3
|
const require_postcss = require("./postcss-CfbYRXJi.cjs");
|
|
4
4
|
const require_html_transform = require("./html-transform.cjs");
|
|
5
5
|
require("./types.cjs");
|
|
@@ -231,7 +231,8 @@ function trimNodes$1(nodes) {
|
|
|
231
231
|
}
|
|
232
232
|
function getParsedColorData(colorSource) {
|
|
233
233
|
try {
|
|
234
|
-
|
|
234
|
+
const parsed = (0, _csstools_css_parser_algorithms.parseComponentValue)((0, _csstools_css_tokenizer.tokenize)({ css: colorSource }));
|
|
235
|
+
return (0, _csstools_css_color_parser.color)(parsed);
|
|
235
236
|
} catch {
|
|
236
237
|
return false;
|
|
237
238
|
}
|
|
@@ -1778,8 +1779,8 @@ function resolveNodes(nodes, variables, resolving) {
|
|
|
1778
1779
|
const fallback = commaIndex >= 0 ? postcss_value_parser.default.stringify(node.nodes.slice(commaIndex + 1)).trim() : "";
|
|
1779
1780
|
const configured = variables.get(variable.value);
|
|
1780
1781
|
let replacement;
|
|
1781
|
-
if (configured !== void 0 && !resolving.has(variable.value)) replacement = resolveThemeValue(configured, variables, /* @__PURE__ */ new Set([...resolving, variable.value]));
|
|
1782
|
-
else if (fallback && isTailwindcssV4ThemeVariable(variable.value)) replacement = resolveThemeValue(fallback, variables, resolving);
|
|
1782
|
+
if (configured !== void 0 && !resolving.has(variable.value)) replacement = resolveThemeValue$1(configured, variables, /* @__PURE__ */ new Set([...resolving, variable.value]));
|
|
1783
|
+
else if (fallback && isTailwindcssV4ThemeVariable(variable.value)) replacement = resolveThemeValue$1(fallback, variables, resolving);
|
|
1783
1784
|
if (replacement === void 0) {
|
|
1784
1785
|
resolveNodes(node.nodes, variables, resolving);
|
|
1785
1786
|
continue;
|
|
@@ -1789,7 +1790,7 @@ function resolveNodes(nodes, variables, resolving) {
|
|
|
1789
1790
|
index += replacementNodes.length - 1;
|
|
1790
1791
|
}
|
|
1791
1792
|
}
|
|
1792
|
-
function resolveThemeValue(value, variables, resolving = /* @__PURE__ */ new Set()) {
|
|
1793
|
+
function resolveThemeValue$1(value, variables, resolving = /* @__PURE__ */ new Set()) {
|
|
1793
1794
|
if (!value.includes("var(")) return value;
|
|
1794
1795
|
const parsed = (0, postcss_value_parser.default)(value);
|
|
1795
1796
|
resolveNodes(parsed.nodes, variables, resolving);
|
|
@@ -1843,7 +1844,7 @@ function consumeUniAppXSystemRootTheme(root, customPropertyValues) {
|
|
|
1843
1844
|
const carriers = new Set(carrierRules);
|
|
1844
1845
|
root.walkDecls((decl) => {
|
|
1845
1846
|
if (decl.parent?.type === "rule" && carriers.has(decl.parent)) return;
|
|
1846
|
-
decl.value = resolveThemeValue(decl.value, variables);
|
|
1847
|
+
decl.value = resolveThemeValue$1(decl.value, variables);
|
|
1847
1848
|
});
|
|
1848
1849
|
}
|
|
1849
1850
|
splitUnresolvedAuthorVariableFallbacks(root, variables);
|
|
@@ -2117,6 +2118,92 @@ function resolvePostcssStyleBranchProfile(options) {
|
|
|
2117
2118
|
return resolvePostcssFrameworkProfile(options);
|
|
2118
2119
|
}
|
|
2119
2120
|
//#endregion
|
|
2121
|
+
//#region src/compat/lynx-css.ts
|
|
2122
|
+
const tailwindThemePropertyPatterns = [
|
|
2123
|
+
/^--aspect-/,
|
|
2124
|
+
/^--animate-/,
|
|
2125
|
+
/^--blur-/,
|
|
2126
|
+
/^--breakpoint-/,
|
|
2127
|
+
/^--color-/,
|
|
2128
|
+
/^--container-/,
|
|
2129
|
+
/^--drop-shadow-/,
|
|
2130
|
+
/^--ease-/,
|
|
2131
|
+
/^--default-font-/,
|
|
2132
|
+
/^--font-/,
|
|
2133
|
+
/^--font-weight-/,
|
|
2134
|
+
/^--inset-shadow-/,
|
|
2135
|
+
/^--leading-/,
|
|
2136
|
+
/^--perspective-/,
|
|
2137
|
+
/^--radius-/,
|
|
2138
|
+
/^--shadow-/,
|
|
2139
|
+
/^--text-/,
|
|
2140
|
+
/^--tracking-/,
|
|
2141
|
+
/^--spacing$/
|
|
2142
|
+
];
|
|
2143
|
+
function isTailwindThemeProperty(property) {
|
|
2144
|
+
return tailwindThemePropertyPatterns.some((pattern) => pattern.test(property));
|
|
2145
|
+
}
|
|
2146
|
+
function isThemeScopeSelector(selector) {
|
|
2147
|
+
return selector.split(",").some((part) => {
|
|
2148
|
+
const normalized = part.trim();
|
|
2149
|
+
return normalized === ":root" || normalized === ":host";
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function collectTailwindThemeProperties(root) {
|
|
2153
|
+
const values = /* @__PURE__ */ new Map();
|
|
2154
|
+
root.walkRules((rule) => {
|
|
2155
|
+
if (!isThemeScopeSelector(rule.selector)) return;
|
|
2156
|
+
rule.walkDecls((decl) => {
|
|
2157
|
+
if (isTailwindThemeProperty(decl.prop)) values.set(decl.prop, decl.value.trim());
|
|
2158
|
+
});
|
|
2159
|
+
});
|
|
2160
|
+
return values;
|
|
2161
|
+
}
|
|
2162
|
+
function resolveThemeValue(value, properties, resolving = /* @__PURE__ */ new Set()) {
|
|
2163
|
+
if (!value.includes("var(")) return value;
|
|
2164
|
+
const parsed = (0, postcss_value_parser.default)(value);
|
|
2165
|
+
parsed.walk((node) => {
|
|
2166
|
+
if (node.type !== "function" || node.value.toLowerCase() !== "var") return;
|
|
2167
|
+
const property = node.nodes.find((child) => child.type === "word" && child.value.startsWith("--"))?.value;
|
|
2168
|
+
if (!property || resolving.has(property)) return;
|
|
2169
|
+
const propertyValue = properties.get(property);
|
|
2170
|
+
if (!propertyValue) return;
|
|
2171
|
+
const nextResolving = new Set(resolving);
|
|
2172
|
+
nextResolving.add(property);
|
|
2173
|
+
const resolved = resolveThemeValue(propertyValue, properties, nextResolving);
|
|
2174
|
+
const mutableNode = node;
|
|
2175
|
+
mutableNode.type = "word";
|
|
2176
|
+
mutableNode.value = resolved;
|
|
2177
|
+
delete mutableNode.nodes;
|
|
2178
|
+
});
|
|
2179
|
+
return parsed.toString();
|
|
2180
|
+
}
|
|
2181
|
+
function removeConsumedThemeProperties(root) {
|
|
2182
|
+
root.walkRules((rule) => {
|
|
2183
|
+
if (!isThemeScopeSelector(rule.selector)) return;
|
|
2184
|
+
rule.walkDecls((decl) => {
|
|
2185
|
+
if (isTailwindThemeProperty(decl.prop)) decl.remove();
|
|
2186
|
+
});
|
|
2187
|
+
if (rule.nodes.length === 0) rule.remove();
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
/** 将 Lynx 原生无法继承的 Tailwind theme 变量静态化。 */
|
|
2191
|
+
function transformLynxCssCompat(css) {
|
|
2192
|
+
try {
|
|
2193
|
+
const root = postcss.default.parse(css);
|
|
2194
|
+
const properties = collectTailwindThemeProperties(root);
|
|
2195
|
+
if (properties.size === 0) return css;
|
|
2196
|
+
root.walkDecls((decl) => {
|
|
2197
|
+
decl.value = resolveThemeValue(decl.value, properties);
|
|
2198
|
+
});
|
|
2199
|
+
removeConsumedThemeProperties(root);
|
|
2200
|
+
(0, postcss.default)([(0, _weapp_tailwindcss_postcss_calc.default)()]).process(root, { from: void 0 }).sync();
|
|
2201
|
+
return root.toString();
|
|
2202
|
+
} catch {
|
|
2203
|
+
return css;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
//#endregion
|
|
2120
2207
|
//#region src/compat/mini-program-css/cascade-layers.ts
|
|
2121
2208
|
const LAYER_PATH_SEPARATOR = "";
|
|
2122
2209
|
const LAYER_INSERTION_ANCHOR = "__weapp_tailwindcss_layer_anchor__";
|
|
@@ -3263,8 +3350,7 @@ function transformWebCssSafeSelectors(css, options) {
|
|
|
3263
3350
|
}
|
|
3264
3351
|
}
|
|
3265
3352
|
//#endregion
|
|
3266
|
-
//#region src/css-macro/
|
|
3267
|
-
const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
3353
|
+
//#region src/css-macro/conditions.ts
|
|
3268
3354
|
const PLATFORM_ENV_KEYS$1 = [
|
|
3269
3355
|
"WEAPP_TW_TARGET",
|
|
3270
3356
|
"WEAPP_TAILWINDCSS_TARGET",
|
|
@@ -3276,9 +3362,6 @@ const PLATFORM_ENV_KEYS$1 = [
|
|
|
3276
3362
|
];
|
|
3277
3363
|
const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
|
|
3278
3364
|
const CUSTOM_VARIANT_CONDITIONAL_FALLBACK_RE = /@custom-variant\b[\s\S]*?\/\*\s*#ifn?def\s[^*]*\*\/[\s\S]*?@slot\b[\s\S]*?\/\*\s*#endif\s*\*\//;
|
|
3279
|
-
function readEnvValue$1(key) {
|
|
3280
|
-
return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
|
|
3281
|
-
}
|
|
3282
3365
|
function normalizePlatformToken(value) {
|
|
3283
3366
|
return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
|
|
3284
3367
|
}
|
|
@@ -3286,7 +3369,7 @@ function resolveCssMacroPlatform(options) {
|
|
|
3286
3369
|
const explicit = normalizePlatformToken(options?.platform);
|
|
3287
3370
|
if (explicit) return explicit;
|
|
3288
3371
|
for (const key of PLATFORM_ENV_KEYS$1) {
|
|
3289
|
-
const value = normalizePlatformToken(
|
|
3372
|
+
const value = normalizePlatformToken(node_process.default.env[key]);
|
|
3290
3373
|
if (value) return value;
|
|
3291
3374
|
}
|
|
3292
3375
|
}
|
|
@@ -3356,45 +3439,84 @@ function quoteAtRuleParam(value) {
|
|
|
3356
3439
|
function hasSlotNode(nodes) {
|
|
3357
3440
|
return nodes.some((node) => node.type === "atrule" && node.name === "slot");
|
|
3358
3441
|
}
|
|
3442
|
+
function createConditionalAtRule(start, nodes) {
|
|
3443
|
+
const rule = postcss.default.atRule({
|
|
3444
|
+
name: start.directive === "ifndef" ? require_postcss.ifndefAtRule : require_postcss.ifdefAtRule,
|
|
3445
|
+
params: quoteAtRuleParam(start.expression)
|
|
3446
|
+
});
|
|
3447
|
+
rule.append(...nodes.map((node) => node.clone()));
|
|
3448
|
+
return rule;
|
|
3449
|
+
}
|
|
3450
|
+
function findConditionalEnd(nodes, index) {
|
|
3451
|
+
let depth = 1;
|
|
3452
|
+
for (let searchIndex = index + 1; searchIndex < nodes.length; searchIndex += 1) {
|
|
3453
|
+
const current = nodes[searchIndex];
|
|
3454
|
+
if (current?.type !== "comment") continue;
|
|
3455
|
+
if (parseConditionalStart(current.text)) depth += 1;
|
|
3456
|
+
else if (CONDITIONAL_END_RE.test(current.text) && --depth === 0) return searchIndex;
|
|
3457
|
+
}
|
|
3458
|
+
return -1;
|
|
3459
|
+
}
|
|
3359
3460
|
function rewriteCustomVariantConditionalComments(root) {
|
|
3360
3461
|
let changed = false;
|
|
3361
|
-
|
|
3362
|
-
const nodes = [...
|
|
3462
|
+
const transformContainer = (container, variant) => {
|
|
3463
|
+
const nodes = [...container.nodes ?? []];
|
|
3363
3464
|
for (let index = 0; index < nodes.length; index += 1) {
|
|
3364
3465
|
const node = nodes[index];
|
|
3365
|
-
|
|
3366
|
-
const start = parseConditionalStart(node.text);
|
|
3466
|
+
const start = node?.type === "comment" ? parseConditionalStart(node.text) : void 0;
|
|
3367
3467
|
if (!start) continue;
|
|
3368
|
-
|
|
3369
|
-
let endIndex = -1;
|
|
3370
|
-
for (let searchIndex = index + 1; searchIndex < nodes.length; searchIndex += 1) {
|
|
3371
|
-
const current = nodes[searchIndex];
|
|
3372
|
-
if (current?.type !== "comment") continue;
|
|
3373
|
-
if (parseConditionalStart(current.text)) {
|
|
3374
|
-
depth += 1;
|
|
3375
|
-
continue;
|
|
3376
|
-
}
|
|
3377
|
-
if (CONDITIONAL_END_RE.test(current.text)) {
|
|
3378
|
-
depth -= 1;
|
|
3379
|
-
if (depth === 0) {
|
|
3380
|
-
endIndex = searchIndex;
|
|
3381
|
-
break;
|
|
3382
|
-
}
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3468
|
+
const endIndex = findConditionalEnd(nodes, index);
|
|
3385
3469
|
if (endIndex < 0) continue;
|
|
3386
3470
|
const conditionalNodes = nodes.slice(index + 1, endIndex);
|
|
3387
3471
|
if (!hasSlotNode(conditionalNodes)) continue;
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3472
|
+
if (container !== variant) {
|
|
3473
|
+
node.remove();
|
|
3474
|
+
nodes[endIndex]?.remove();
|
|
3475
|
+
const variantNodes = [...variant.nodes ?? []];
|
|
3476
|
+
variant.removeAll();
|
|
3477
|
+
variant.append(createConditionalAtRule(start, variantNodes));
|
|
3478
|
+
changed = true;
|
|
3479
|
+
return true;
|
|
3480
|
+
}
|
|
3481
|
+
node.replaceWith(createConditionalAtRule(start, conditionalNodes));
|
|
3394
3482
|
for (const removedNode of nodes.slice(index + 1, endIndex + 1)) removedNode.remove();
|
|
3395
3483
|
changed = true;
|
|
3396
3484
|
}
|
|
3397
|
-
|
|
3485
|
+
for (const node of [...container.nodes ?? []]) if ("nodes" in node && node.nodes && transformContainer(node, variant)) return true;
|
|
3486
|
+
return false;
|
|
3487
|
+
};
|
|
3488
|
+
const variants = [];
|
|
3489
|
+
root.walkAtRules("custom-variant", (rule) => variants.push(rule));
|
|
3490
|
+
for (const variant of variants) transformContainer(variant, variant);
|
|
3491
|
+
return changed;
|
|
3492
|
+
}
|
|
3493
|
+
function rewriteOuterCustomVariantConditionalComments(root) {
|
|
3494
|
+
let changed = false;
|
|
3495
|
+
const transformContainer = (container) => {
|
|
3496
|
+
const nodes = [...container.nodes ?? []];
|
|
3497
|
+
for (let index = 0; index < nodes.length; index += 1) {
|
|
3498
|
+
const node = nodes[index];
|
|
3499
|
+
const start = node?.type === "comment" ? parseConditionalStart(node.text) : void 0;
|
|
3500
|
+
if (!start) continue;
|
|
3501
|
+
const endIndex = findConditionalEnd(nodes, index);
|
|
3502
|
+
if (endIndex < 0) continue;
|
|
3503
|
+
const conditionalNodes = nodes.slice(index + 1, endIndex);
|
|
3504
|
+
const customVariants = conditionalNodes.filter((current) => current.type === "atrule" && current.name === "custom-variant");
|
|
3505
|
+
if (customVariants.length === 0 || customVariants.some((variant) => !variant.nodes?.length)) continue;
|
|
3506
|
+
for (const variant of customVariants) {
|
|
3507
|
+
const variantNodes = [...variant.nodes ?? []];
|
|
3508
|
+
variant.removeAll();
|
|
3509
|
+
variant.append(createConditionalAtRule(start, variantNodes));
|
|
3510
|
+
}
|
|
3511
|
+
if (conditionalNodes.every((current) => current.type === "comment" || current.type === "atrule" && current.name === "custom-variant")) {
|
|
3512
|
+
node.remove();
|
|
3513
|
+
for (const removedNode of nodes.slice(index + 1, endIndex + 1)) if (removedNode.type === "comment") removedNode.remove();
|
|
3514
|
+
}
|
|
3515
|
+
changed = true;
|
|
3516
|
+
}
|
|
3517
|
+
for (const node of [...container.nodes ?? []]) if ("nodes" in node && node.nodes) transformContainer(node);
|
|
3518
|
+
};
|
|
3519
|
+
transformContainer(root);
|
|
3398
3520
|
return changed;
|
|
3399
3521
|
}
|
|
3400
3522
|
function compileCssMacroConditionalComments(css, options) {
|
|
@@ -3420,11 +3542,8 @@ function compileCssMacroConditionalComments(css, options) {
|
|
|
3420
3542
|
continue;
|
|
3421
3543
|
}
|
|
3422
3544
|
}
|
|
3423
|
-
if (getActiveConditionalValue(stack) === false)
|
|
3424
|
-
|
|
3425
|
-
continue;
|
|
3426
|
-
}
|
|
3427
|
-
if ("nodes" in node && node.nodes) transformContainer(node);
|
|
3545
|
+
if (getActiveConditionalValue(stack) === false) node.remove();
|
|
3546
|
+
else if ("nodes" in node && node.nodes) transformContainer(node);
|
|
3428
3547
|
}
|
|
3429
3548
|
};
|
|
3430
3549
|
transformContainer(root);
|
|
@@ -3433,28 +3552,15 @@ function compileCssMacroConditionalComments(css, options) {
|
|
|
3433
3552
|
return css;
|
|
3434
3553
|
}
|
|
3435
3554
|
}
|
|
3436
|
-
function
|
|
3437
|
-
|
|
3438
|
-
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
3439
|
-
if (quoted) return quoted[2];
|
|
3440
|
-
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
3441
|
-
return url?.[2] ?? url?.[3];
|
|
3442
|
-
}
|
|
3443
|
-
function isCssMacroPluginRequest(request) {
|
|
3444
|
-
if (request === "weapp-tailwindcss/css-macro") return true;
|
|
3445
|
-
if (!request?.includes("css-macro")) return false;
|
|
3446
|
-
return node_path.default.basename(request).startsWith("css-macro");
|
|
3447
|
-
}
|
|
3448
|
-
function hasCssMacroTailwindV4Directive(css) {
|
|
3449
|
-
if (!css?.includes("css-macro")) return false;
|
|
3555
|
+
function transformCssMacroTailwindV4Source(css) {
|
|
3556
|
+
if (!hasCssMacroTailwindV4CustomVariantConditionalComments(css)) return css;
|
|
3450
3557
|
try {
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
return found;
|
|
3558
|
+
const root = postcss.default.parse(css);
|
|
3559
|
+
const outerChanged = rewriteOuterCustomVariantConditionalComments(root);
|
|
3560
|
+
const innerChanged = rewriteCustomVariantConditionalComments(root);
|
|
3561
|
+
return outerChanged || innerChanged ? root.toString() : css;
|
|
3456
3562
|
} catch {
|
|
3457
|
-
return
|
|
3563
|
+
return css;
|
|
3458
3564
|
}
|
|
3459
3565
|
}
|
|
3460
3566
|
function hasCssMacroTailwindV4CustomVariantConditionalComments(css) {
|
|
@@ -3462,18 +3568,31 @@ function hasCssMacroTailwindV4CustomVariantConditionalComments(css) {
|
|
|
3462
3568
|
try {
|
|
3463
3569
|
const root = postcss.default.parse(css);
|
|
3464
3570
|
let found = false;
|
|
3465
|
-
|
|
3466
|
-
const nodes = [...
|
|
3571
|
+
const hasConditionalSlot = (container) => {
|
|
3572
|
+
const nodes = [...container.nodes ?? []];
|
|
3467
3573
|
for (let index = 0; index < nodes.length; index += 1) {
|
|
3468
3574
|
const node = nodes[index];
|
|
3469
3575
|
if (node?.type !== "comment" || !parseConditionalStart(node.text)) continue;
|
|
3470
3576
|
const tail = nodes.slice(index + 1);
|
|
3471
|
-
if (tail.some((current) => current.type === "comment" && CONDITIONAL_END_RE.test(current.text)) && hasSlotNode(tail))
|
|
3472
|
-
found = true;
|
|
3473
|
-
return false;
|
|
3474
|
-
}
|
|
3577
|
+
if (tail.some((current) => current.type === "comment" && CONDITIONAL_END_RE.test(current.text)) && hasSlotNode(tail)) return true;
|
|
3475
3578
|
}
|
|
3579
|
+
return nodes.some((node) => "nodes" in node && node.nodes && hasConditionalSlot(node));
|
|
3580
|
+
};
|
|
3581
|
+
root.walkAtRules("custom-variant", (rule) => {
|
|
3582
|
+
if (hasConditionalSlot(rule)) found = true;
|
|
3476
3583
|
});
|
|
3584
|
+
const scanOuterConditional = (container) => {
|
|
3585
|
+
const nodes = [...container.nodes ?? []];
|
|
3586
|
+
for (let index = 0; index < nodes.length; index += 1) {
|
|
3587
|
+
const node = nodes[index];
|
|
3588
|
+
if (node?.type !== "comment" || !parseConditionalStart(node.text)) continue;
|
|
3589
|
+
const endIndex = findConditionalEnd(nodes, index);
|
|
3590
|
+
if (endIndex < 0) continue;
|
|
3591
|
+
if (nodes.slice(index + 1, endIndex).some((current) => current.type === "atrule" && current.name === "custom-variant")) return true;
|
|
3592
|
+
}
|
|
3593
|
+
return nodes.some((node) => "nodes" in node && node.nodes && scanOuterConditional(node));
|
|
3594
|
+
};
|
|
3595
|
+
found ||= scanOuterConditional(root);
|
|
3477
3596
|
return found;
|
|
3478
3597
|
} catch {
|
|
3479
3598
|
return CUSTOM_VARIANT_CONDITIONAL_FALLBACK_RE.test(css);
|
|
@@ -3484,28 +3603,42 @@ function hasCssMacroTailwindV4InternalAtRules(css) {
|
|
|
3484
3603
|
try {
|
|
3485
3604
|
let found = false;
|
|
3486
3605
|
postcss.default.parse(css).walkAtRules((rule) => {
|
|
3487
|
-
if (rule.name === "weapp-tw-ifdef" || rule.name === "weapp-tw-ifndef")
|
|
3488
|
-
found = true;
|
|
3489
|
-
return false;
|
|
3490
|
-
}
|
|
3606
|
+
if (rule.name === "weapp-tw-ifdef" || rule.name === "weapp-tw-ifndef") found = true;
|
|
3491
3607
|
});
|
|
3492
3608
|
return found;
|
|
3493
3609
|
} catch {
|
|
3494
3610
|
return /@weapp-tw-ifn?def\b/.test(css);
|
|
3495
3611
|
}
|
|
3496
3612
|
}
|
|
3497
|
-
|
|
3498
|
-
|
|
3613
|
+
//#endregion
|
|
3614
|
+
//#region src/css-macro/auto.ts
|
|
3615
|
+
const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
3616
|
+
function parseCssPluginRequest(params) {
|
|
3617
|
+
const value = params.trim();
|
|
3618
|
+
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
3619
|
+
if (quoted) return quoted[2];
|
|
3620
|
+
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
3621
|
+
return url?.[2] ?? url?.[3];
|
|
3499
3622
|
}
|
|
3500
|
-
function
|
|
3501
|
-
if (
|
|
3623
|
+
function isCssMacroPluginRequest(request) {
|
|
3624
|
+
if (request === "weapp-tailwindcss/css-macro") return true;
|
|
3625
|
+
return Boolean(request?.includes("css-macro") && node_path.default.basename(request).startsWith("css-macro"));
|
|
3626
|
+
}
|
|
3627
|
+
function hasCssMacroTailwindV4Directive(css) {
|
|
3628
|
+
if (!css?.includes("css-macro")) return false;
|
|
3502
3629
|
try {
|
|
3503
|
-
|
|
3504
|
-
|
|
3630
|
+
let found = false;
|
|
3631
|
+
postcss.default.parse(css).walkAtRules("plugin", (rule) => {
|
|
3632
|
+
if (isCssMacroPluginRequest(parseCssPluginRequest(rule.params))) found = true;
|
|
3633
|
+
});
|
|
3634
|
+
return found;
|
|
3505
3635
|
} catch {
|
|
3506
|
-
return css;
|
|
3636
|
+
return /@plugin\s+(?:url\(\s*)?["']weapp-tailwindcss\/css-macro["']/.test(css);
|
|
3507
3637
|
}
|
|
3508
3638
|
}
|
|
3639
|
+
function hasCssMacroTailwindV4Source(css) {
|
|
3640
|
+
return hasCssMacroTailwindV4Directive(css) || hasCssMacroTailwindV4CustomVariantConditionalComments(css) || hasCssMacroTailwindV4InternalAtRules(css);
|
|
3641
|
+
}
|
|
3509
3642
|
function isCssMacroPostcssPlugin(plugin) {
|
|
3510
3643
|
if (plugin === require_postcss.creator) return true;
|
|
3511
3644
|
return Boolean(plugin && (typeof plugin === "function" || typeof plugin === "object") && plugin.postcssPlugin === "postcss-weapp-tw-css-macro-plugin");
|
|
@@ -3516,8 +3649,7 @@ function withCssMacroPostcssPlugins(plugins) {
|
|
|
3516
3649
|
if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
|
|
3517
3650
|
if (typeof plugins === "object") {
|
|
3518
3651
|
const values = Object.values(plugins).filter(Boolean);
|
|
3519
|
-
|
|
3520
|
-
return [...values, macroPlugin];
|
|
3652
|
+
return values.some(isCssMacroPostcssPlugin) ? values : [...values, macroPlugin];
|
|
3521
3653
|
}
|
|
3522
3654
|
return [macroPlugin];
|
|
3523
3655
|
}
|
|
@@ -4183,7 +4315,10 @@ function isMiniProgramGeneratorTarget(target) {
|
|
|
4183
4315
|
return target !== "web";
|
|
4184
4316
|
}
|
|
4185
4317
|
function finalizeGeneratedCss(css, target, styleOptions, webCompat) {
|
|
4186
|
-
if (target === "web")
|
|
4318
|
+
if (target === "web") {
|
|
4319
|
+
const webCss = transformWebCssCompat(css, webCompat);
|
|
4320
|
+
return (styleOptions?.cssOptions?.platform ?? styleOptions?.platform) === "lynx" ? transformLynxCssCompat(webCss) : webCss;
|
|
4321
|
+
}
|
|
4187
4322
|
if (!isMiniProgramGeneratorTarget(target)) return css;
|
|
4188
4323
|
return finalizeMiniProgramCss(css, {
|
|
4189
4324
|
cssSelectorReplacement: styleOptions?.cssOptions?.cssSelectorReplacement ?? styleOptions?.cssSelectorReplacement,
|
|
@@ -4626,6 +4761,7 @@ function getDefaultOptions(options) {
|
|
|
4626
4761
|
autoprefixer: { add: false }
|
|
4627
4762
|
},
|
|
4628
4763
|
cssRemoveProperty: true,
|
|
4764
|
+
cssRemoveFocusPseudoClass: true,
|
|
4629
4765
|
uniAppXUnsupported: "warn",
|
|
4630
4766
|
cssSelectorReplacement: {
|
|
4631
4767
|
root: [
|
|
@@ -4673,7 +4809,9 @@ const CSS_OPTION_KEYS = [
|
|
|
4673
4809
|
"unitsToPx",
|
|
4674
4810
|
"unitConversion",
|
|
4675
4811
|
"platform",
|
|
4812
|
+
"cssRemoveActivePseudoClass",
|
|
4676
4813
|
"cssRemoveHoverPseudoClass",
|
|
4814
|
+
"cssRemoveFocusPseudoClass",
|
|
4677
4815
|
"cssRemoveProperty",
|
|
4678
4816
|
"cssCalc",
|
|
4679
4817
|
"atRules",
|
|
@@ -4683,7 +4821,9 @@ function getSimpleOverrideCacheKey(options) {
|
|
|
4683
4821
|
let isMainChunk = SIMPLE_OVERRIDE_UNSET;
|
|
4684
4822
|
let majorVersion = SIMPLE_OVERRIDE_UNSET;
|
|
4685
4823
|
let cssRemoveProperty = SIMPLE_OVERRIDE_UNSET;
|
|
4824
|
+
let cssRemoveActivePseudoClass = SIMPLE_OVERRIDE_UNSET;
|
|
4686
4825
|
let cssRemoveHoverPseudoClass = SIMPLE_OVERRIDE_UNSET;
|
|
4826
|
+
let cssRemoveFocusPseudoClass = SIMPLE_OVERRIDE_UNSET;
|
|
4687
4827
|
let uniAppX = SIMPLE_OVERRIDE_UNSET;
|
|
4688
4828
|
let cssPreflightRange = SIMPLE_OVERRIDE_UNSET;
|
|
4689
4829
|
let injectAdditionalCssVarScope = SIMPLE_OVERRIDE_UNSET;
|
|
@@ -4715,6 +4855,14 @@ function getSimpleOverrideCacheKey(options) {
|
|
|
4715
4855
|
if (typeof value !== "boolean") return;
|
|
4716
4856
|
cssRemoveHoverPseudoClass = value ? "1" : "0";
|
|
4717
4857
|
break;
|
|
4858
|
+
case "cssRemoveActivePseudoClass":
|
|
4859
|
+
if (typeof value !== "boolean") return;
|
|
4860
|
+
cssRemoveActivePseudoClass = value ? "1" : "0";
|
|
4861
|
+
break;
|
|
4862
|
+
case "cssRemoveFocusPseudoClass":
|
|
4863
|
+
if (typeof value !== "boolean") return;
|
|
4864
|
+
cssRemoveFocusPseudoClass = value ? "1" : "0";
|
|
4865
|
+
break;
|
|
4718
4866
|
case "uniAppX":
|
|
4719
4867
|
if (typeof value !== "boolean") return;
|
|
4720
4868
|
uniAppX = value ? "1" : "0";
|
|
@@ -4771,7 +4919,9 @@ function getSimpleOverrideCacheKey(options) {
|
|
|
4771
4919
|
isMainChunk,
|
|
4772
4920
|
majorVersion,
|
|
4773
4921
|
cssRemoveProperty,
|
|
4922
|
+
cssRemoveActivePseudoClass,
|
|
4774
4923
|
cssRemoveHoverPseudoClass,
|
|
4924
|
+
cssRemoveFocusPseudoClass,
|
|
4775
4925
|
uniAppX,
|
|
4776
4926
|
cssPreflightRange,
|
|
4777
4927
|
injectAdditionalCssVarScope,
|
|
@@ -5105,7 +5255,8 @@ const defaultRemTransformOptions = {
|
|
|
5105
5255
|
function getRemTransformPlugin(options) {
|
|
5106
5256
|
if (!options.rem2rpx) return null;
|
|
5107
5257
|
if (options.rem2rpx === true) return (0, postcss_rem_to_responsive_pixel.default)(defaultRemTransformOptions);
|
|
5108
|
-
|
|
5258
|
+
const merged = (0, _weapp_tailwindcss_shared.defuOverrideArray)(options.rem2rpx, defaultStage);
|
|
5259
|
+
return (0, postcss_rem_to_responsive_pixel.default)(merged);
|
|
5109
5260
|
}
|
|
5110
5261
|
//#endregion
|
|
5111
5262
|
//#region src/plugins/getUnitConversionPlugin.ts
|
|
@@ -5345,9 +5496,10 @@ function getFallbackRemove(_rule, options) {
|
|
|
5345
5496
|
if (idx === 0 && (selector.type === "id" || selector.type === "class" || selector.type === "attribute")) maybeImportantId = true;
|
|
5346
5497
|
if (selector.type === "universal") selector.parent?.remove();
|
|
5347
5498
|
else if (selector.type === "pseudo") {
|
|
5348
|
-
if (selector.value === ":is")
|
|
5349
|
-
|
|
5350
|
-
|
|
5499
|
+
if (selector.value === ":is") {
|
|
5500
|
+
if (maybeImportantId && selector.nodes[0]?.type === "selector") selector.replaceWith(selector.nodes[0]);
|
|
5501
|
+
else selector.parent?.remove();
|
|
5502
|
+
} else if (selector.value === ":not") {
|
|
5351
5503
|
for (const x of selector.nodes) if (x.nodes.length === 1 && x.nodes[0].type === "id" && x.nodes[0].value === "#") x.nodes = [postcss_selector_parser.default.tag({ value: "#n" })];
|
|
5352
5504
|
}
|
|
5353
5505
|
} else if (selector.type === "attribute") {
|
|
@@ -5387,14 +5539,16 @@ function getFallbackRemove(_rule, options) {
|
|
|
5387
5539
|
} finally {
|
|
5388
5540
|
currentRule = void 0;
|
|
5389
5541
|
}
|
|
5390
|
-
if (transformOptions === FALLBACK_TRANSFORM_OPTIONS)
|
|
5391
|
-
targetRule.
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5542
|
+
if (transformOptions === FALLBACK_TRANSFORM_OPTIONS) {
|
|
5543
|
+
if (targetRule.parent == null) {
|
|
5544
|
+
targetRule.selector = "";
|
|
5545
|
+
writeSelectorCache(sourceSelector, { action: "remove" });
|
|
5546
|
+
} else if (targetRule.selector === sourceSelector) writeSelectorCache(sourceSelector, { action: "keep" });
|
|
5547
|
+
else writeSelectorCache(sourceSelector, {
|
|
5548
|
+
action: "update",
|
|
5549
|
+
selector: targetRule.selector
|
|
5550
|
+
});
|
|
5551
|
+
}
|
|
5398
5552
|
};
|
|
5399
5553
|
parser.transformSync = ((input, opts) => {
|
|
5400
5554
|
const transformOptions = opts ? normalizeTransformOptions(opts) : FALLBACK_TRANSFORM_OPTIONS;
|
|
@@ -5412,6 +5566,47 @@ function getFallbackRemove(_rule, options) {
|
|
|
5412
5566
|
return entry.parser;
|
|
5413
5567
|
}
|
|
5414
5568
|
//#endregion
|
|
5569
|
+
//#region src/selectorParser/pseudo.ts
|
|
5570
|
+
function selectorContainsPseudoClass(selector, pseudoClasses) {
|
|
5571
|
+
if (pseudoClasses.length === 0) return false;
|
|
5572
|
+
let attributeDepth = 0;
|
|
5573
|
+
let quote;
|
|
5574
|
+
let escaped = false;
|
|
5575
|
+
for (let index = 0; index < selector.length; index += 1) {
|
|
5576
|
+
const character = selector[index];
|
|
5577
|
+
if (escaped) {
|
|
5578
|
+
escaped = false;
|
|
5579
|
+
continue;
|
|
5580
|
+
}
|
|
5581
|
+
if (character === "\\") {
|
|
5582
|
+
escaped = true;
|
|
5583
|
+
continue;
|
|
5584
|
+
}
|
|
5585
|
+
if (quote) {
|
|
5586
|
+
if (character === quote) quote = void 0;
|
|
5587
|
+
continue;
|
|
5588
|
+
}
|
|
5589
|
+
if (character === "\"" || character === "'") {
|
|
5590
|
+
quote = character;
|
|
5591
|
+
continue;
|
|
5592
|
+
}
|
|
5593
|
+
if (character === "[") {
|
|
5594
|
+
attributeDepth += 1;
|
|
5595
|
+
continue;
|
|
5596
|
+
}
|
|
5597
|
+
if (character === "]") {
|
|
5598
|
+
attributeDepth = Math.max(0, attributeDepth - 1);
|
|
5599
|
+
continue;
|
|
5600
|
+
}
|
|
5601
|
+
if (attributeDepth > 0 || character !== ":") continue;
|
|
5602
|
+
let end = index + 1;
|
|
5603
|
+
while (end < selector.length && /[\w-]/.test(selector[end] ?? "")) end += 1;
|
|
5604
|
+
if (pseudoClasses.includes(selector.slice(index, end))) return true;
|
|
5605
|
+
index = end - 1;
|
|
5606
|
+
}
|
|
5607
|
+
return false;
|
|
5608
|
+
}
|
|
5609
|
+
//#endregion
|
|
5415
5610
|
//#region src/utils/decl-order.ts
|
|
5416
5611
|
/**
|
|
5417
5612
|
* 将同一规则内的声明重排,使字面量优先,带变量的声明靠后,保持各自相对顺序。
|
|
@@ -5521,6 +5716,53 @@ function normalizeSpacingDeclarations(rule) {
|
|
|
5521
5716
|
for (const declarations of grouped.values()) dedupeSpacingGroup(rule, declarations);
|
|
5522
5717
|
}
|
|
5523
5718
|
//#endregion
|
|
5719
|
+
//#region src/selectorParser/rule-transformer/unsupported-pseudos.ts
|
|
5720
|
+
const UNSUPPORTED_MINI_PROGRAM_PSEUDO_CLASS_SET = /* @__PURE__ */ new Set([
|
|
5721
|
+
":autofill",
|
|
5722
|
+
":checked",
|
|
5723
|
+
":default",
|
|
5724
|
+
":disabled",
|
|
5725
|
+
":enabled",
|
|
5726
|
+
":focus-visible",
|
|
5727
|
+
":focus-within",
|
|
5728
|
+
":fullscreen",
|
|
5729
|
+
":indeterminate",
|
|
5730
|
+
":in-range",
|
|
5731
|
+
":invalid",
|
|
5732
|
+
":modal",
|
|
5733
|
+
":open",
|
|
5734
|
+
":optional",
|
|
5735
|
+
":out-of-range",
|
|
5736
|
+
":placeholder-shown",
|
|
5737
|
+
":read-only",
|
|
5738
|
+
":read-write",
|
|
5739
|
+
":required",
|
|
5740
|
+
":target",
|
|
5741
|
+
":valid",
|
|
5742
|
+
":visited"
|
|
5743
|
+
]);
|
|
5744
|
+
const unsupportedPseudoClassSetCache = /* @__PURE__ */ new WeakMap();
|
|
5745
|
+
function getUnsupportedPseudoClassSet(options) {
|
|
5746
|
+
const cached = unsupportedPseudoClassSetCache.get(options);
|
|
5747
|
+
if (cached) return cached;
|
|
5748
|
+
const pseudoClasses = new Set(UNSUPPORTED_MINI_PROGRAM_PSEUDO_CLASS_SET);
|
|
5749
|
+
if (options.cssRemoveHoverPseudoClass) pseudoClasses.add(":hover");
|
|
5750
|
+
if (options.cssRemoveActivePseudoClass) pseudoClasses.add(":active");
|
|
5751
|
+
if (options.cssRemoveFocusPseudoClass) pseudoClasses.add(":focus");
|
|
5752
|
+
unsupportedPseudoClassSetCache.set(options, pseudoClasses);
|
|
5753
|
+
return pseudoClasses;
|
|
5754
|
+
}
|
|
5755
|
+
function findRootSelector(node) {
|
|
5756
|
+
let current = node;
|
|
5757
|
+
while (current.parent && current.parent.type !== "root") current = current.parent;
|
|
5758
|
+
return current.type === "selector" ? current : void 0;
|
|
5759
|
+
}
|
|
5760
|
+
function removeUnsupportedPseudoSelector(node, options, unsupportedPseudoClasses = getUnsupportedPseudoClassSet(options)) {
|
|
5761
|
+
if (node.type !== "pseudo" || !unsupportedPseudoClasses.has(node.value)) return false;
|
|
5762
|
+
findRootSelector(node)?.remove();
|
|
5763
|
+
return true;
|
|
5764
|
+
}
|
|
5765
|
+
//#endregion
|
|
5524
5766
|
//#region src/selectorParser/rule-transformer/pseudos.ts
|
|
5525
5767
|
const RTL_LANGUAGE_ANY_PSEUDO_SET = /* @__PURE__ */ new Set([
|
|
5526
5768
|
":-moz-any",
|
|
@@ -5654,6 +5896,12 @@ function transformExpandedSelectorNodes(selector, context) {
|
|
|
5654
5896
|
else if (node.type === "universal" && context.universalReplacement) node.value = context.universalReplacement;
|
|
5655
5897
|
});
|
|
5656
5898
|
}
|
|
5899
|
+
function transformExpandedUniversalNodes(selector, context) {
|
|
5900
|
+
if (!context.universalReplacement) return;
|
|
5901
|
+
selector.walk((node) => {
|
|
5902
|
+
if (node.type === "universal") node.value = context.universalReplacement;
|
|
5903
|
+
});
|
|
5904
|
+
}
|
|
5657
5905
|
function appendExpandedWhereSelectors(parent, index, branches, context) {
|
|
5658
5906
|
const root = parent.parent;
|
|
5659
5907
|
if (!root) return false;
|
|
@@ -5674,7 +5922,10 @@ function flattenWherePseudo(node, context, index, parent) {
|
|
|
5674
5922
|
for (const branch of branches) if (transformSpacingSelector(branch.nodes, context.options)) context.requiresSpacingNormalization = true;
|
|
5675
5923
|
if (branches.length > 1 && appendExpandedWhereSelectors(parent, index, branches, context)) return;
|
|
5676
5924
|
const targetSelector = branches[0];
|
|
5677
|
-
if (targetSelector)
|
|
5925
|
+
if (targetSelector) {
|
|
5926
|
+
transformExpandedUniversalNodes(targetSelector, context);
|
|
5927
|
+
node.replaceWith(...targetSelector.nodes.map((item) => item.clone()));
|
|
5928
|
+
}
|
|
5678
5929
|
if (parent.type === "selector" && parent.length === 0) parent.remove();
|
|
5679
5930
|
}
|
|
5680
5931
|
function shouldRemoveUnsupportedPseudoElementSelector(selector, options) {
|
|
@@ -5683,6 +5934,7 @@ function shouldRemoveUnsupportedPseudoElementSelector(selector, options) {
|
|
|
5683
5934
|
}
|
|
5684
5935
|
function handlePseudoNode(node, index, context, parent) {
|
|
5685
5936
|
if (node.type !== "pseudo") return;
|
|
5937
|
+
if (removeUnsupportedPseudoSelector(node, context.options, context.unsupportedPseudoClasses ?? getUnsupportedPseudoClassSet(context.options))) return;
|
|
5686
5938
|
if (isRtlLanguageAnyPseudo(node)) {
|
|
5687
5939
|
stripUnsupportedRtlLanguagePseudo(node);
|
|
5688
5940
|
return;
|
|
@@ -5708,10 +5960,6 @@ function handleUniversalNode(node, context) {
|
|
|
5708
5960
|
if (node.type !== "universal") return;
|
|
5709
5961
|
if (context.universalReplacement) node.value = context.universalReplacement;
|
|
5710
5962
|
}
|
|
5711
|
-
function shouldRemoveHoverSelector(selector, options) {
|
|
5712
|
-
if (!options.cssRemoveHoverPseudoClass) return false;
|
|
5713
|
-
return selector.nodes.some((node) => node.type === "pseudo" && node.value === ":hover");
|
|
5714
|
-
}
|
|
5715
5963
|
function isHiddenOrTemplateNotPseudo(node) {
|
|
5716
5964
|
if (!node || node.type !== "pseudo" || node.value !== ":not") return false;
|
|
5717
5965
|
const selector = node.first;
|
|
@@ -5742,8 +5990,10 @@ function handleSelectorNode(selector, context) {
|
|
|
5742
5990
|
selector.remove();
|
|
5743
5991
|
return;
|
|
5744
5992
|
}
|
|
5745
|
-
|
|
5746
|
-
|
|
5993
|
+
const unsupportedPseudoClasses = context.unsupportedPseudoClasses ?? getUnsupportedPseudoClassSet(context.options);
|
|
5994
|
+
const unsupportedPseudo = selector.nodes.find((node) => node.type === "pseudo" && unsupportedPseudoClasses.has(node.value));
|
|
5995
|
+
if (unsupportedPseudo) {
|
|
5996
|
+
removeUnsupportedPseudoSelector(unsupportedPseudo, context.options, unsupportedPseudoClasses);
|
|
5747
5997
|
return;
|
|
5748
5998
|
}
|
|
5749
5999
|
if (transformSpacingSelector(selector.nodes, context.options)) context.requiresSpacingNormalization = true;
|
|
@@ -5778,10 +6028,7 @@ function transformSelectors(selectors, context) {
|
|
|
5778
6028
|
handleCombinatorNode(node, index, context);
|
|
5779
6029
|
break;
|
|
5780
6030
|
case "tag":
|
|
5781
|
-
case "attribute":
|
|
5782
|
-
handleTagOrAttribute(node, context);
|
|
5783
|
-
break;
|
|
5784
|
-
default: break;
|
|
6031
|
+
case "attribute": handleTagOrAttribute(node, context);
|
|
5785
6032
|
}
|
|
5786
6033
|
});
|
|
5787
6034
|
if (context.requiresSpacingNormalization) normalizeSpacingDeclarations(context.rule);
|
|
@@ -5801,6 +6048,7 @@ function createRuleTransformer(options) {
|
|
|
5801
6048
|
const rootReplacement = options.cssSelectorReplacement?.root ? composeIsPseudo(options.cssSelectorReplacement.root) : void 0;
|
|
5802
6049
|
const universalReplacement = options.cssSelectorReplacement?.universal ? composeIsPseudo(options.cssSelectorReplacement.universal) : void 0;
|
|
5803
6050
|
const selectorReplacerOptions = options.escapeMap ? { escapeMap: options.escapeMap } : void 0;
|
|
6051
|
+
const unsupportedPseudoClasses = getUnsupportedPseudoClassSet(options);
|
|
5804
6052
|
function writeSelectorResultCache(selector, result) {
|
|
5805
6053
|
if (selectorResultCache.size >= selectorResultCacheLimit) selectorResultCache.clear();
|
|
5806
6054
|
selectorResultCache.set(selector, result);
|
|
@@ -5829,7 +6077,8 @@ function createRuleTransformer(options) {
|
|
|
5829
6077
|
rule,
|
|
5830
6078
|
rootReplacement,
|
|
5831
6079
|
universalReplacement,
|
|
5832
|
-
selectorReplacerOptions
|
|
6080
|
+
selectorReplacerOptions,
|
|
6081
|
+
unsupportedPseudoClasses
|
|
5833
6082
|
};
|
|
5834
6083
|
let wasRemoved = false;
|
|
5835
6084
|
let requiresSpacingNormalization = false;
|
|
@@ -6474,9 +6723,10 @@ const postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
6474
6723
|
ruleTransformSync(rule, opts);
|
|
6475
6724
|
},
|
|
6476
6725
|
AtRule(atRule) {
|
|
6477
|
-
if (isAtMediaHover(atRule))
|
|
6478
|
-
|
|
6479
|
-
|
|
6726
|
+
if (isAtMediaHover(atRule)) {
|
|
6727
|
+
if (atRule.nodes) atRule.replaceWith(atRule.nodes);
|
|
6728
|
+
else atRule.remove();
|
|
6729
|
+
} else if (atRule.name === "supports") {
|
|
6480
6730
|
if (COLOR_MIX_RE.test(atRule.params)) removeAtRuleAndEmptyAncestors(atRule);
|
|
6481
6731
|
else if (isTailwindcssV4LinearGradientSupports(atRule)) removeAtRuleAndEmptyAncestors(atRule);
|
|
6482
6732
|
else if (isTailwindcssV4DisplayP3Supports(atRule)) removeAtRuleAndEmptyAncestors(atRule);
|
|
@@ -6744,7 +6994,8 @@ var StyleProcessorCache = class {
|
|
|
6744
6994
|
const compositeKey = this.createCompositeCacheKey(optionsKey, signal);
|
|
6745
6995
|
let processor = this.processorCacheByKey.get(compositeKey);
|
|
6746
6996
|
if (!processor) {
|
|
6747
|
-
|
|
6997
|
+
const pipeline = this.getPipeline(options, signal);
|
|
6998
|
+
processor = (0, postcss.default)(pipeline.plugins);
|
|
6748
6999
|
this.processorCacheByKey.set(compositeKey, processor);
|
|
6749
7000
|
}
|
|
6750
7001
|
return processor;
|
|
@@ -7465,12 +7716,14 @@ exports.resolveTailwindSourceEntry = resolveTailwindSourceEntry;
|
|
|
7465
7716
|
exports.restoreLocalCssImports = restoreLocalCssImports;
|
|
7466
7717
|
exports.rewriteLocalCssImportRequestsForOutput = rewriteLocalCssImportRequestsForOutput;
|
|
7467
7718
|
exports.rewriteLocalCssImportRequestsForOutputRoot = rewriteLocalCssImportRequestsForOutputRoot;
|
|
7719
|
+
exports.selectorContainsPseudoClass = selectorContainsPseudoClass;
|
|
7468
7720
|
exports.splitLocalCssImports = splitLocalCssImports;
|
|
7469
7721
|
exports.splitLocalCssImportsRoot = splitLocalCssImportsRoot;
|
|
7470
7722
|
exports.stripMiniProgramCssSpecificityPlaceholders = stripMiniProgramCssSpecificityPlaceholders;
|
|
7471
7723
|
exports.toPosixPath = toPosixPath;
|
|
7472
7724
|
exports.transformCssMacroCss = transformCssMacroCss;
|
|
7473
7725
|
exports.transformCssMacroTailwindV4Source = transformCssMacroTailwindV4Source;
|
|
7726
|
+
exports.transformLynxCssCompat = transformLynxCssCompat;
|
|
7474
7727
|
exports.transformWebCssCompat = transformWebCssCompat;
|
|
7475
7728
|
exports.transformWebCssSafeSelectors = transformWebCssSafeSelectors;
|
|
7476
7729
|
Object.defineProperty(exports, "unitConversionComposeRules", {
|