@weapp-tailwindcss/postcss 2.0.2 → 2.0.3
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/index.js +32 -13
- package/dist/index.mjs +32 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postc
|
|
|
7
7
|
// src/defaults.ts
|
|
8
8
|
function getDefaultOptions(options) {
|
|
9
9
|
return {
|
|
10
|
-
// https://github.com/postcss/postcss-calc
|
|
10
|
+
// 参考:https://github.com/postcss/postcss-calc
|
|
11
11
|
cssPresetEnv: {
|
|
12
12
|
features: {
|
|
13
13
|
"cascade-layers": true,
|
|
@@ -844,17 +844,17 @@ function createRootSpecificityCleaner(options) {
|
|
|
844
844
|
}
|
|
845
845
|
var OklabSuffix = "in oklab";
|
|
846
846
|
var logicalPropMap = /* @__PURE__ */ new Map([
|
|
847
|
-
// margin
|
|
847
|
+
// margin 方向映射
|
|
848
848
|
["margin-inline-start", "margin-left"],
|
|
849
849
|
["margin-inline-end", "margin-right"],
|
|
850
850
|
["margin-block-start", "margin-top"],
|
|
851
851
|
["margin-block-end", "margin-bottom"],
|
|
852
|
-
// padding
|
|
852
|
+
// padding 方向映射
|
|
853
853
|
["padding-inline-start", "padding-left"],
|
|
854
854
|
["padding-inline-end", "padding-right"],
|
|
855
855
|
["padding-block-start", "padding-top"],
|
|
856
856
|
["padding-block-end", "padding-bottom"],
|
|
857
|
-
// border
|
|
857
|
+
// border 方向映射
|
|
858
858
|
["border-inline-start", "border-left"],
|
|
859
859
|
["border-inline-end", "border-right"],
|
|
860
860
|
["border-block-start", "border-top"],
|
|
@@ -1026,6 +1026,25 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
1026
1026
|
decl.value = decl.value.slice(0, decl.value.length - OklabSuffix.length);
|
|
1027
1027
|
} else if (/calc\(\s*infinity\s*\*\s*(?:\d+(?:\.\d*)?|\.\d+)r?px/.test(decl.value)) {
|
|
1028
1028
|
decl.value = "9999px";
|
|
1029
|
+
} else if (decl.prop.includes("radius")) {
|
|
1030
|
+
const CLAMP_PX = 9999;
|
|
1031
|
+
const THRESHOLD = 1e5;
|
|
1032
|
+
const next = decl.value.replace(
|
|
1033
|
+
/\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi,
|
|
1034
|
+
(m, num) => {
|
|
1035
|
+
const n = Number(num);
|
|
1036
|
+
if (!Number.isFinite(n)) {
|
|
1037
|
+
return `${CLAMP_PX}px`;
|
|
1038
|
+
}
|
|
1039
|
+
if (/e/i.test(String(num)) || n > THRESHOLD) {
|
|
1040
|
+
return `${CLAMP_PX}px`;
|
|
1041
|
+
}
|
|
1042
|
+
return m;
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
if (next !== decl.value) {
|
|
1046
|
+
decl.value = next;
|
|
1047
|
+
}
|
|
1029
1048
|
}
|
|
1030
1049
|
};
|
|
1031
1050
|
p.AtRuleExit = (atRule) => {
|
|
@@ -1262,33 +1281,33 @@ function property(ident, initialValue, _syntax) {
|
|
|
1262
1281
|
}
|
|
1263
1282
|
var nullShadow = "0 0 #0000";
|
|
1264
1283
|
var nodes = [
|
|
1265
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1137
|
|
1284
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1137
|
|
1266
1285
|
property("--tw-border-spacing-x", "0", "<length>"),
|
|
1267
1286
|
property("--tw-border-spacing-y", "0", "<length>"),
|
|
1268
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1205
|
|
1287
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1205
|
|
1269
1288
|
property("--tw-translate-x", "0"),
|
|
1270
1289
|
property("--tw-translate-y", "0"),
|
|
1271
1290
|
property("--tw-translate-z", "0"),
|
|
1272
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1285
|
|
1291
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1285
|
|
1273
1292
|
property("--tw-scale-x", "1"),
|
|
1274
1293
|
property("--tw-scale-y", "1"),
|
|
1275
1294
|
property("--tw-scale-z", "1"),
|
|
1276
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1424
|
|
1295
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1424
|
|
1277
1296
|
property("--tw-rotate-x"),
|
|
1278
1297
|
property("--tw-rotate-y"),
|
|
1279
1298
|
property("--tw-rotate-z"),
|
|
1280
1299
|
property("--tw-skew-x"),
|
|
1281
1300
|
property("--tw-skew-y"),
|
|
1282
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1641C13-L1641C88
|
|
1301
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1641C13-L1641C88
|
|
1283
1302
|
property("--tw-pan-x"),
|
|
1284
1303
|
property("--tw-pan-y"),
|
|
1285
1304
|
property("--tw-pinch-zoom"),
|
|
1286
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1305
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1287
1306
|
property("--tw-scroll-snap-strictness", "proximity", "*"),
|
|
1288
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1307
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1289
1308
|
property("--tw-space-x-reverse", "0"),
|
|
1290
1309
|
property("--tw-space-y-reverse", "0"),
|
|
1291
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L2169C22-L2169C60
|
|
1310
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L2169C22-L2169C60
|
|
1292
1311
|
property("--tw-border-style", "solid"),
|
|
1293
1312
|
property("--tw-divide-x-reverse", "0"),
|
|
1294
1313
|
property("--tw-divide-y-reverse", "0"),
|
|
@@ -1375,7 +1394,7 @@ var nodes = [
|
|
|
1375
1394
|
property("--tw-ring-shadow", nullShadow),
|
|
1376
1395
|
property("--tw-inset-ring-color"),
|
|
1377
1396
|
property("--tw-inset-ring-shadow", nullShadow),
|
|
1378
|
-
// Legacy
|
|
1397
|
+
// Legacy 旧版变量兼容
|
|
1379
1398
|
property("--tw-ring-inset"),
|
|
1380
1399
|
property("--tw-ring-offset-width", "0px", "<length>"),
|
|
1381
1400
|
property("--tw-ring-offset-color", "#fff"),
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import postcss from "postcss";
|
|
|
7
7
|
// src/defaults.ts
|
|
8
8
|
function getDefaultOptions(options) {
|
|
9
9
|
return {
|
|
10
|
-
// https://github.com/postcss/postcss-calc
|
|
10
|
+
// 参考:https://github.com/postcss/postcss-calc
|
|
11
11
|
cssPresetEnv: {
|
|
12
12
|
features: {
|
|
13
13
|
"cascade-layers": true,
|
|
@@ -844,17 +844,17 @@ function createRootSpecificityCleaner(options) {
|
|
|
844
844
|
}
|
|
845
845
|
var OklabSuffix = "in oklab";
|
|
846
846
|
var logicalPropMap = /* @__PURE__ */ new Map([
|
|
847
|
-
// margin
|
|
847
|
+
// margin 方向映射
|
|
848
848
|
["margin-inline-start", "margin-left"],
|
|
849
849
|
["margin-inline-end", "margin-right"],
|
|
850
850
|
["margin-block-start", "margin-top"],
|
|
851
851
|
["margin-block-end", "margin-bottom"],
|
|
852
|
-
// padding
|
|
852
|
+
// padding 方向映射
|
|
853
853
|
["padding-inline-start", "padding-left"],
|
|
854
854
|
["padding-inline-end", "padding-right"],
|
|
855
855
|
["padding-block-start", "padding-top"],
|
|
856
856
|
["padding-block-end", "padding-bottom"],
|
|
857
|
-
// border
|
|
857
|
+
// border 方向映射
|
|
858
858
|
["border-inline-start", "border-left"],
|
|
859
859
|
["border-inline-end", "border-right"],
|
|
860
860
|
["border-block-start", "border-top"],
|
|
@@ -1026,6 +1026,25 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
1026
1026
|
decl.value = decl.value.slice(0, decl.value.length - OklabSuffix.length);
|
|
1027
1027
|
} else if (/calc\(\s*infinity\s*\*\s*(?:\d+(?:\.\d*)?|\.\d+)r?px/.test(decl.value)) {
|
|
1028
1028
|
decl.value = "9999px";
|
|
1029
|
+
} else if (decl.prop.includes("radius")) {
|
|
1030
|
+
const CLAMP_PX = 9999;
|
|
1031
|
+
const THRESHOLD = 1e5;
|
|
1032
|
+
const next = decl.value.replace(
|
|
1033
|
+
/\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi,
|
|
1034
|
+
(m, num) => {
|
|
1035
|
+
const n = Number(num);
|
|
1036
|
+
if (!Number.isFinite(n)) {
|
|
1037
|
+
return `${CLAMP_PX}px`;
|
|
1038
|
+
}
|
|
1039
|
+
if (/e/i.test(String(num)) || n > THRESHOLD) {
|
|
1040
|
+
return `${CLAMP_PX}px`;
|
|
1041
|
+
}
|
|
1042
|
+
return m;
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
if (next !== decl.value) {
|
|
1046
|
+
decl.value = next;
|
|
1047
|
+
}
|
|
1029
1048
|
}
|
|
1030
1049
|
};
|
|
1031
1050
|
p.AtRuleExit = (atRule) => {
|
|
@@ -1262,33 +1281,33 @@ function property(ident, initialValue, _syntax) {
|
|
|
1262
1281
|
}
|
|
1263
1282
|
var nullShadow = "0 0 #0000";
|
|
1264
1283
|
var nodes = [
|
|
1265
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1137
|
|
1284
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1137
|
|
1266
1285
|
property("--tw-border-spacing-x", "0", "<length>"),
|
|
1267
1286
|
property("--tw-border-spacing-y", "0", "<length>"),
|
|
1268
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1205
|
|
1287
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1205
|
|
1269
1288
|
property("--tw-translate-x", "0"),
|
|
1270
1289
|
property("--tw-translate-y", "0"),
|
|
1271
1290
|
property("--tw-translate-z", "0"),
|
|
1272
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1285
|
|
1291
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1285
|
|
1273
1292
|
property("--tw-scale-x", "1"),
|
|
1274
1293
|
property("--tw-scale-y", "1"),
|
|
1275
1294
|
property("--tw-scale-z", "1"),
|
|
1276
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1424
|
|
1295
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1424
|
|
1277
1296
|
property("--tw-rotate-x"),
|
|
1278
1297
|
property("--tw-rotate-y"),
|
|
1279
1298
|
property("--tw-rotate-z"),
|
|
1280
1299
|
property("--tw-skew-x"),
|
|
1281
1300
|
property("--tw-skew-y"),
|
|
1282
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1641C13-L1641C88
|
|
1301
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1641C13-L1641C88
|
|
1283
1302
|
property("--tw-pan-x"),
|
|
1284
1303
|
property("--tw-pan-y"),
|
|
1285
1304
|
property("--tw-pinch-zoom"),
|
|
1286
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1305
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1287
1306
|
property("--tw-scroll-snap-strictness", "proximity", "*"),
|
|
1288
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1307
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L1688C38-L1688C95
|
|
1289
1308
|
property("--tw-space-x-reverse", "0"),
|
|
1290
1309
|
property("--tw-space-y-reverse", "0"),
|
|
1291
|
-
// https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L2169C22-L2169C60
|
|
1310
|
+
// 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/src/utilities.ts#L2169C22-L2169C60
|
|
1292
1311
|
property("--tw-border-style", "solid"),
|
|
1293
1312
|
property("--tw-divide-x-reverse", "0"),
|
|
1294
1313
|
property("--tw-divide-y-reverse", "0"),
|
|
@@ -1375,7 +1394,7 @@ var nodes = [
|
|
|
1375
1394
|
property("--tw-ring-shadow", nullShadow),
|
|
1376
1395
|
property("--tw-inset-ring-color"),
|
|
1377
1396
|
property("--tw-inset-ring-shadow", nullShadow),
|
|
1378
|
-
// Legacy
|
|
1397
|
+
// Legacy 旧版变量兼容
|
|
1379
1398
|
property("--tw-ring-inset"),
|
|
1380
1399
|
property("--tw-ring-offset-width", "0px", "<length>"),
|
|
1381
1400
|
property("--tw-ring-offset-color", "#fff"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "@weapp-tailwindcss/postcss",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@weapp-tailwindcss/postcss-calc": "^1.0.0",
|
|
44
44
|
"postcss": "~8.5.6",
|
|
45
45
|
"postcss-preset-env": "^10.4.0",
|
|
46
|
-
"postcss-pxtransform": "^4.1.
|
|
46
|
+
"postcss-pxtransform": "^4.1.8",
|
|
47
47
|
"postcss-rem-to-responsive-pixel": "^6.1.0",
|
|
48
48
|
"postcss-selector-parser": "~7.1.0",
|
|
49
49
|
"postcss-value-parser": "^4.2.0",
|