@weapp-tailwindcss/postcss 1.2.0 → 1.2.1-alpha.0

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.d.mts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-C5X6IWCb.mjs';
2
2
  export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-C5X6IWCb.mjs';
3
3
  import postcss from 'postcss';
4
+ export { PostCssCalcOptions as CssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
5
+ export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
6
+ export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
7
+ export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
4
8
  import '@weapp-tailwindcss/mangle';
5
- import '@weapp-tailwindcss/postcss-calc';
6
9
  import 'postcss-load-config';
7
- import 'postcss-preset-env';
8
- import 'postcss-pxtransform';
9
- import 'postcss-rem-to-responsive-pixel';
10
10
 
11
11
  declare function createStyleHandler(options?: Partial<IStyleHandlerOptions>): (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
12
12
 
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-C5X6IWCb.js';
2
2
  export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-C5X6IWCb.js';
3
3
  import postcss from 'postcss';
4
+ export { PostCssCalcOptions as CssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
5
+ export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
6
+ export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
7
+ export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
4
8
  import '@weapp-tailwindcss/mangle';
5
- import '@weapp-tailwindcss/postcss-calc';
6
9
  import 'postcss-load-config';
7
- import 'postcss-preset-env';
8
- import 'postcss-pxtransform';
9
- import 'postcss-rem-to-responsive-pixel';
10
10
 
11
11
  declare function createStyleHandler(options?: Partial<IStyleHandlerOptions>): (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
12
12
 
package/dist/index.js CHANGED
@@ -293,8 +293,8 @@ function getFallbackRemove(rule, options) {
293
293
  }
294
294
  }
295
295
  } else if (selector.value === ":where") {
296
- for (const n2 of selector.nodes) {
297
- for (const node of n2.nodes) {
296
+ for (const n of selector.nodes) {
297
+ for (const node of n.nodes) {
298
298
  if (node.type === "attribute") {
299
299
  node.remove();
300
300
  }
@@ -899,359 +899,18 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
899
899
  };
900
900
  postcssWeappTailwindcssPrePlugin.postcss = true;
901
901
 
902
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.3_postcss@8.5.6/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
903
-
904
-
905
- // ../../node_modules/.pnpm/@csstools+selector-specificity@5.0.0_postcss-selector-parser@7.1.0/node_modules/@csstools/selector-specificity/dist/index.mjs
906
-
907
- function compare(e3, t) {
908
- return e3.a === t.a ? e3.b === t.b ? e3.c - t.c : e3.b - t.b : e3.a - t.a;
909
- }
910
- function selectorSpecificity(t, s) {
911
- const i = _optionalChain([s, 'optionalAccess', _40 => _40.customSpecificity, 'optionalCall', _41 => _41(t)]);
912
- if (i) return i;
913
- if (!t) return { a: 0, b: 0, c: 0 };
914
- let c = 0, n2 = 0, o2 = 0;
915
- if ("universal" == t.type) return { a: 0, b: 0, c: 0 };
916
- if ("id" === t.type) c += 1;
917
- else if ("tag" === t.type) o2 += 1;
918
- else if ("class" === t.type) n2 += 1;
919
- else if ("attribute" === t.type) n2 += 1;
920
- else if (isPseudoElement(t)) switch (t.value.toLowerCase()) {
921
- case "::slotted":
922
- if (o2 += 1, t.nodes && t.nodes.length > 0) {
923
- const e3 = specificityOfMostSpecificListItem(t.nodes, s);
924
- c += e3.a, n2 += e3.b, o2 += e3.c;
925
- }
926
- break;
927
- case "::view-transition-group":
928
- case "::view-transition-image-pair":
929
- case "::view-transition-old":
930
- case "::view-transition-new":
931
- return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal(t.nodes[0]) ? { a: 0, b: 0, c: 0 } : { a: 0, b: 0, c: 1 };
932
- default:
933
- o2 += 1;
934
- }
935
- else if (_postcssselectorparser2.default.isPseudoClass(t)) switch (t.value.toLowerCase()) {
936
- case ":-webkit-any":
937
- case ":any":
938
- default:
939
- n2 += 1;
940
- break;
941
- case ":-moz-any":
942
- case ":has":
943
- case ":is":
944
- case ":matches":
945
- case ":not":
946
- if (t.nodes && t.nodes.length > 0) {
947
- const e3 = specificityOfMostSpecificListItem(t.nodes, s);
948
- c += e3.a, n2 += e3.b, o2 += e3.c;
949
- }
950
- break;
951
- case ":where":
952
- break;
953
- case ":nth-child":
954
- case ":nth-last-child":
955
- if (n2 += 1, t.nodes && t.nodes.length > 0) {
956
- const i2 = t.nodes[0].nodes.findIndex(((e3) => "tag" === e3.type && "of" === e3.value.toLowerCase()));
957
- if (i2 > -1) {
958
- const a = _postcssselectorparser2.default.selector({ nodes: [], value: "" });
959
- t.nodes[0].nodes.slice(i2 + 1).forEach(((e3) => {
960
- a.append(e3.clone());
961
- }));
962
- const r = [a];
963
- t.nodes.length > 1 && r.push(...t.nodes.slice(1));
964
- const l = specificityOfMostSpecificListItem(r, s);
965
- c += l.a, n2 += l.b, o2 += l.c;
966
- }
967
- }
968
- break;
969
- case ":local":
970
- case ":global":
971
- t.nodes && t.nodes.length > 0 && t.nodes.forEach(((e3) => {
972
- const t2 = selectorSpecificity(e3, s);
973
- c += t2.a, n2 += t2.b, o2 += t2.c;
974
- }));
975
- break;
976
- case ":host":
977
- case ":host-context":
978
- if (n2 += 1, t.nodes && t.nodes.length > 0) {
979
- const e3 = specificityOfMostSpecificListItem(t.nodes, s);
980
- c += e3.a, n2 += e3.b, o2 += e3.c;
981
- }
982
- break;
983
- case ":active-view-transition":
984
- case ":active-view-transition-type":
985
- return { a: 0, b: 1, c: 0 };
986
- }
987
- else _postcssselectorparser2.default.isContainer(t) && _optionalChain([t, 'access', _42 => _42.nodes, 'optionalAccess', _43 => _43.length]) > 0 && t.nodes.forEach(((e3) => {
988
- const t2 = selectorSpecificity(e3, s);
989
- c += t2.a, n2 += t2.b, o2 += t2.c;
990
- }));
991
- return { a: c, b: n2, c: o2 };
992
- }
993
- function specificityOfMostSpecificListItem(e3, t) {
994
- let s = { a: 0, b: 0, c: 0 };
995
- return e3.forEach(((e4) => {
996
- const i = selectorSpecificity(e4, t);
997
- compare(i, s) < 0 || (s = i);
998
- })), s;
999
- }
1000
- function isPseudoElement(t) {
1001
- return _postcssselectorparser2.default.isPseudoElement(t);
1002
- }
1003
- function selectorNodeContainsNothingOrOnlyUniversal(e3) {
1004
- if (!e3) return false;
1005
- if (!e3.nodes) return false;
1006
- const t = e3.nodes.filter(((e4) => "comment" !== e4.type));
1007
- return 0 === t.length || 1 === t.length && "universal" === t[0].type;
1008
- }
1009
-
1010
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.3_postcss@8.5.6/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
1011
- function alwaysValidSelector(s) {
1012
- const o2 = _postcssselectorparser2.default.call(void 0, ).astSync(s);
1013
- let n2 = true;
1014
- return o2.walk(((e3) => {
1015
- if ("class" !== e3.type && "comment" !== e3.type && "id" !== e3.type && "root" !== e3.type && "selector" !== e3.type && "string" !== e3.type && "tag" !== e3.type && "universal" !== e3.type && ("attribute" !== e3.type || e3.insensitive) && ("combinator" !== e3.type || "+" !== e3.value && ">" !== e3.value && "~" !== e3.value && " " !== e3.value) && ("pseudo" !== e3.type || _optionalChain([e3, 'access', _44 => _44.nodes, 'optionalAccess', _45 => _45.length]) || ":hover" !== e3.value.toLowerCase() && ":focus" !== e3.value.toLowerCase())) {
1016
- if ("pseudo" === e3.type && 1 === _optionalChain([e3, 'access', _46 => _46.nodes, 'optionalAccess', _47 => _47.length]) && ":not" === e3.value.toLowerCase()) {
1017
- let s2 = true;
1018
- if (e3.nodes[0].walkCombinators((() => {
1019
- s2 = false;
1020
- })), s2) return;
1021
- }
1022
- return n2 = false, false;
1023
- }
1024
- })), n2;
1025
- }
1026
- function sortCompoundSelectorsInsideComplexSelector(s) {
1027
- if (!s || !s.nodes || 1 === s.nodes.length) return;
1028
- const o2 = [];
1029
- let n2 = [];
1030
- for (let t2 = 0; t2 < s.nodes.length; t2++) "combinator" !== s.nodes[t2].type ? _postcssselectorparser2.default.isPseudoElement(s.nodes[t2]) ? (o2.push(n2), n2 = [s.nodes[t2]]) : n2.push(s.nodes[t2]) : (o2.push(n2), o2.push([s.nodes[t2]]), n2 = []);
1031
- o2.push(n2);
1032
- const t = [];
1033
- for (let e3 = 0; e3 < o2.length; e3++) {
1034
- const s2 = o2[e3];
1035
- s2.sort(((e4, s3) => "selector" === e4.type && "selector" === s3.type && e4.nodes.length && s3.nodes.length ? selectorTypeOrder(e4.nodes[0], e4.nodes[0].type) - selectorTypeOrder(s3.nodes[0], s3.nodes[0].type) : "selector" === e4.type && e4.nodes.length ? selectorTypeOrder(e4.nodes[0], e4.nodes[0].type) - selectorTypeOrder(s3, s3.type) : "selector" === s3.type && s3.nodes.length ? selectorTypeOrder(e4, e4.type) - selectorTypeOrder(s3.nodes[0], s3.nodes[0].type) : selectorTypeOrder(e4, e4.type) - selectorTypeOrder(s3, s3.type)));
1036
- const n3 = new Set(s2.map(((e4) => e4.type))), r = n3.has("universal") && (n3.has("tag") || n3.has("attribute") || n3.has("class") || n3.has("id") || n3.has("pseudo"));
1037
- for (let e4 = 0; e4 < s2.length; e4++) "universal" === s2[e4].type && r ? s2[e4].remove() : t.push(s2[e4]);
1038
- }
1039
- s.removeAll();
1040
- for (let o3 = t.length - 1; o3 >= 0; o3--) {
1041
- const n3 = t[o3 - 1];
1042
- if (t[o3].remove(), n3 && "tag" === n3.type && "tag" === t[o3].type) {
1043
- const n4 = _postcssselectorparser2.default.pseudo({ value: ":is", nodes: [_postcssselectorparser2.default.selector({ value: "", nodes: [t[o3]] })] });
1044
- n4.parent = s, s.nodes.unshift(n4);
1045
- } else t[o3].parent = s, s.nodes.unshift(t[o3]);
1046
- }
1047
- }
1048
- function selectorTypeOrder(s, n2) {
1049
- return _postcssselectorparser2.default.isPseudoElement(s) ? o.pseudoElement : o[n2];
1050
- }
1051
- var o = { universal: 0, tag: 1, pseudoElement: 2, id: 3, class: 4, attribute: 5, pseudo: 6, selector: 7, string: 8, root: 9, comment: 10 };
1052
- function childAdjacentChild(e3) {
1053
- return !(!e3 || !e3.nodes) && ("selector" === e3.type && (3 === e3.nodes.length && (!(!e3.nodes[0] || "pseudo" !== e3.nodes[0].type || ":-csstools-matches" !== e3.nodes[0].value) && (!(!e3.nodes[1] || "combinator" !== e3.nodes[1].type || "+" !== e3.nodes[1].value && "~" !== e3.nodes[1].value) && (!(!e3.nodes[2] || "pseudo" !== e3.nodes[2].type || ":-csstools-matches" !== e3.nodes[2].value) && (!(!e3.nodes[0].nodes || 1 !== e3.nodes[0].nodes.length) && ("selector" === e3.nodes[0].nodes[0].type && (!(!e3.nodes[0].nodes[0].nodes || 3 !== e3.nodes[0].nodes[0].nodes.length) && (!(!e3.nodes[0].nodes[0].nodes || "combinator" !== e3.nodes[0].nodes[0].nodes[1].type || ">" !== e3.nodes[0].nodes[0].nodes[1].value) && (!(!e3.nodes[2].nodes || 1 !== e3.nodes[2].nodes.length) && ("selector" === e3.nodes[2].nodes[0].type && (!(!e3.nodes[2].nodes[0].nodes || 3 !== e3.nodes[2].nodes[0].nodes.length) && (!(!e3.nodes[2].nodes[0].nodes || "combinator" !== e3.nodes[2].nodes[0].nodes[1].type || ">" !== e3.nodes[2].nodes[0].nodes[1].value) && (e3.nodes[0].nodes[0].insertAfter(e3.nodes[0].nodes[0].nodes[0], e3.nodes[2].nodes[0].nodes[0].clone()), e3.nodes[2].nodes[0].nodes[1].remove(), e3.nodes[2].nodes[0].nodes[0].remove(), e3.nodes[0].replaceWith(e3.nodes[0].nodes[0]), e3.nodes[2].replaceWith(e3.nodes[2].nodes[0]), true))))))))))))));
1054
- }
1055
- function isInCompoundWithOneOtherElement(s) {
1056
- if (!s || !s.nodes) return false;
1057
- if (!_postcssselectorparser2.default.isSelector(s)) return false;
1058
- if (2 !== s.nodes.length) return false;
1059
- let o2 = -1, n2 = -1;
1060
- s.nodes[0] && _postcssselectorparser2.default.isPseudoClass(s.nodes[0]) && ":-csstools-matches" === s.nodes[0].value ? (o2 = 0, n2 = 1) : s.nodes[1] && _postcssselectorparser2.default.isPseudoClass(s.nodes[1]) && ":-csstools-matches" === s.nodes[1].value && (o2 = 1, n2 = 0);
1061
- const t = s.nodes[o2];
1062
- if (!t || !_postcssselectorparser2.default.isPseudoClass(t) || 1 !== t.nodes.length) return false;
1063
- const r = s.nodes[n2];
1064
- return !!r && (!_postcssselectorparser2.default.isCombinator(r) && (!_postcssselectorparser2.default.isPseudoElement(r) && (t.nodes[0].append(r.clone()), t.replaceWith(...t.nodes[0].nodes), r.remove(), true)));
1065
- }
1066
- function isPseudoInFirstCompound(s) {
1067
- if (!s || !s.nodes) return false;
1068
- if (!_postcssselectorparser2.default.isSelector(s)) return false;
1069
- let o2 = -1;
1070
- for (let n3 = 0; n3 < s.nodes.length; n3++) {
1071
- const t2 = s.nodes[n3];
1072
- if (_postcssselectorparser2.default.isCombinator(t2)) return false;
1073
- if (_postcssselectorparser2.default.isPseudoElement(t2)) return false;
1074
- if (_postcssselectorparser2.default.isPseudoClass(t2)) {
1075
- const e3 = t2;
1076
- if (":-csstools-matches" === e3.value) {
1077
- if (!e3.nodes || 1 !== e3.nodes.length) return false;
1078
- o2 = n3;
1079
- break;
1080
- }
1081
- }
1082
- }
1083
- if (-1 === o2) return false;
1084
- const n2 = s.nodes[o2];
1085
- if (!n2 || !_postcssselectorparser2.default.isPseudoClass(n2)) return false;
1086
- const t = s.nodes.slice(0, o2), r = s.nodes.slice(o2 + 1);
1087
- return t.forEach(((e3) => {
1088
- n2.nodes[0].append(e3.clone());
1089
- })), r.forEach(((e3) => {
1090
- n2.nodes[0].append(e3.clone());
1091
- })), n2.replaceWith(...n2.nodes), t.forEach(((e3) => {
1092
- e3.remove();
1093
- })), r.forEach(((e3) => {
1094
- e3.remove();
1095
- })), true;
1096
- }
1097
- function samePrecedingElement(s) {
1098
- if (!s || !s.nodes) return false;
1099
- if ("selector" !== s.type) return false;
1100
- let o2 = -1;
1101
- for (let n3 = 0; n3 < s.nodes.length; n3++) {
1102
- const t2 = s.nodes[n3];
1103
- if (_postcssselectorparser2.default.isCombinator(t2)) {
1104
- o2 = n3;
1105
- break;
1106
- }
1107
- if (_postcssselectorparser2.default.isPseudoElement(t2)) return false;
1108
- }
1109
- if (-1 === o2) return false;
1110
- const n2 = o2 + 1;
1111
- if (!s.nodes[o2] || "combinator" !== s.nodes[o2].type || ">" !== s.nodes[o2].value && "+" !== s.nodes[o2].value) return false;
1112
- const t = s.nodes[o2].value;
1113
- if (!s.nodes[n2] || "pseudo" !== s.nodes[n2].type || ":-csstools-matches" !== s.nodes[n2].value) return false;
1114
- if (!s.nodes[n2].nodes || 1 !== s.nodes[n2].nodes.length) return false;
1115
- if ("selector" !== s.nodes[n2].nodes[0].type) return false;
1116
- if (!s.nodes[n2].nodes[0].nodes || 3 !== s.nodes[n2].nodes[0].nodes.length) return false;
1117
- if (!s.nodes[n2].nodes[0].nodes || "combinator" !== s.nodes[n2].nodes[0].nodes[1].type || s.nodes[n2].nodes[0].nodes[1].value !== t) return false;
1118
- const r = s.nodes[n2];
1119
- if (!r || !_postcssselectorparser2.default.isPseudoClass(r)) return false;
1120
- const d = s.nodes.slice(0, o2), l = s.nodes.slice(n2 + 1);
1121
- return s.each(((e3) => {
1122
- e3.remove();
1123
- })), d.forEach(((e3) => {
1124
- s.append(e3);
1125
- })), r.nodes[0].nodes.forEach(((e3) => {
1126
- s.append(e3);
1127
- })), l.forEach(((e3) => {
1128
- s.append(e3);
1129
- })), true;
1130
- }
1131
- function complexSelectors(s, o2, n2, t) {
1132
- return s.flatMap(((s2) => {
1133
- if (-1 === s2.indexOf(":-csstools-matches") && -1 === s2.toLowerCase().indexOf(":is")) return s2;
1134
- const r = _postcssselectorparser2.default.call(void 0, ).astSync(s2);
1135
- return r.walkPseudos(((s3) => {
1136
- if (":is" === s3.value.toLowerCase() && s3.nodes && s3.nodes.length && "selector" === s3.nodes[0].type && 0 === s3.nodes[0].nodes.length) return s3.value = ":not", void s3.nodes[0].append(_postcssselectorparser2.default.universal());
1137
- if (":-csstools-matches" === s3.value) if (!s3.nodes || s3.nodes.length) {
1138
- if (s3.walkPseudos(((s4) => {
1139
- if (_postcssselectorparser2.default.isPseudoElement(s4)) {
1140
- let e3 = s4.value;
1141
- if (e3.startsWith("::-csstools-invalid-")) return;
1142
- for (; e3.startsWith(":"); ) e3 = e3.slice(1);
1143
- s4.value = `::-csstools-invalid-${e3}`, t();
1144
- }
1145
- })), 1 === s3.nodes.length && "selector" === s3.nodes[0].type) {
1146
- if (1 === s3.nodes[0].nodes.length) return void s3.replaceWith(s3.nodes[0].nodes[0]);
1147
- if (!s3.nodes[0].some(((e3) => "combinator" === e3.type))) return void s3.replaceWith(...s3.nodes[0].nodes);
1148
- }
1149
- 1 !== r.nodes.length || "selector" !== r.nodes[0].type || 1 !== r.nodes[0].nodes.length || r.nodes[0].nodes[0] !== s3 ? childAdjacentChild(s3.parent) || isInCompoundWithOneOtherElement(s3.parent) || isPseudoInFirstCompound(s3.parent) || samePrecedingElement(s3.parent) || ("warning" === o2.onComplexSelector && n2(), s3.value = ":is") : s3.replaceWith(...s3.nodes[0].nodes);
1150
- } else s3.remove();
1151
- })), r.walk(((e3) => {
1152
- "selector" === e3.type && "nodes" in e3 && 1 === e3.nodes.length && "selector" === e3.nodes[0].type && e3.replaceWith(e3.nodes[0]);
1153
- })), r.walk(((e3) => {
1154
- "nodes" in e3 && sortCompoundSelectorsInsideComplexSelector(e3);
1155
- })), r.toString();
1156
- })).filter(((e3) => !!e3));
1157
- }
1158
- function splitSelectors(o2, n2, t = 0) {
1159
- const r = ":not(#" + n2.specificityMatchingName + ")", d = ":not(." + n2.specificityMatchingName + ")", l = ":not(" + n2.specificityMatchingName + ")";
1160
- return o2.flatMap(((o3) => {
1161
- if (-1 === o3.toLowerCase().indexOf(":is")) return o3;
1162
- let i = false;
1163
- const a = [];
1164
- if (_postcssselectorparser2.default.call(void 0, ).astSync(o3).walkPseudos(((e3) => {
1165
- if (":is" !== e3.value.toLowerCase() || !e3.nodes || !e3.nodes.length) return;
1166
- if ("selector" === e3.nodes[0].type && 0 === e3.nodes[0].nodes.length) return;
1167
- if ("pseudo" === _optionalChain([e3, 'access', _48 => _48.parent, 'optionalAccess', _49 => _49.parent, 'optionalAccess', _50 => _50.type]) && ":not" === _optionalChain([e3, 'access', _51 => _51.parent, 'optionalAccess', _52 => _52.parent, 'optionalAccess', _53 => _53.value, 'optionalAccess', _54 => _54.toLowerCase, 'call', _55 => _55()])) return void a.push([{ start: e3.parent.parent.sourceIndex, end: e3.parent.parent.sourceIndex + e3.parent.parent.toString().length, option: `:not(${e3.nodes.toString()})` }]);
1168
- if ("pseudo" === _optionalChain([e3, 'access', _56 => _56.parent, 'optionalAccess', _57 => _57.parent, 'optionalAccess', _58 => _58.type]) && ":has" === _optionalChain([e3, 'access', _59 => _59.parent, 'optionalAccess', _60 => _60.parent, 'optionalAccess', _61 => _61.value, 'optionalAccess', _62 => _62.toLowerCase, 'call', _63 => _63()])) return void (e3.value = ":-csstools-matches");
1169
- let o4 = e3.parent;
1170
- for (; o4; ) {
1171
- if (o4.value && ":is" === o4.value.toLowerCase() && "pseudo" === o4.type) return void (i = true);
1172
- o4 = o4.parent;
1173
- }
1174
- const n3 = selectorSpecificity(e3), t2 = e3.sourceIndex, c2 = t2 + e3.toString().length, p = [];
1175
- e3.nodes.forEach(((e4) => {
1176
- const o5 = { start: t2, end: c2, option: "" }, i2 = selectorSpecificity(e4);
1177
- let a2 = e4.toString().trim();
1178
- const u = Math.max(0, n3.a - i2.a), h = Math.max(0, n3.b - i2.b), f = Math.max(0, n3.c - i2.c);
1179
- for (let e5 = 0; e5 < u; e5++) a2 += r;
1180
- for (let e5 = 0; e5 < h; e5++) a2 += d;
1181
- for (let e5 = 0; e5 < f; e5++) a2 += l;
1182
- o5.option = a2, p.push(o5);
1183
- })), a.push(p);
1184
- })), !a.length) return [o3];
1185
- let c = [];
1186
- return cartesianProduct(...a).forEach(((e3) => {
1187
- let s = "";
1188
- for (let n3 = 0; n3 < e3.length; n3++) {
1189
- const t2 = e3[n3];
1190
- s += o3.substring(_optionalChain([e3, 'access', _64 => _64[n3 - 1], 'optionalAccess', _65 => _65.end]) || 0, e3[n3].start), s += ":-csstools-matches(" + t2.option + ")", n3 === e3.length - 1 && (s += o3.substring(e3[n3].end));
1191
- }
1192
- c.push(s);
1193
- })), i && t < 10 && (c = splitSelectors(c, n2, t + 1)), c;
1194
- })).filter(((e3) => !!e3));
1195
- }
1196
- function cartesianProduct(...e3) {
1197
- const s = [], o2 = e3.length - 1;
1198
- return (function helper(n2, t) {
1199
- for (let r = 0, d = e3[t].length; r < d; r++) {
1200
- const d2 = n2.slice(0);
1201
- d2.push(e3[t][r]), t === o2 ? s.push(d2) : helper(d2, t + 1);
1202
- }
1203
- })([], 0), s;
1204
- }
1205
- var n = /:is\(/i;
1206
- var creator = (e3) => {
1207
- const s = { specificityMatchingName: "does-not-exist", ...e3 || {} };
1208
- return { postcssPlugin: "postcss-is-pseudo-class", prepare() {
1209
- const e4 = /* @__PURE__ */ new WeakSet();
1210
- return { postcssPlugin: "postcss-is-pseudo-class", Rule(o2, { result: t }) {
1211
- if (!o2.selector) return;
1212
- if (!n.test(o2.selector)) return;
1213
- if (e4.has(o2)) return;
1214
- let r = false;
1215
- const warnOnComplexSelector = () => {
1216
- "warning" === s.onComplexSelector && (r || (r = true, o2.warn(t, `Complex selectors in '${o2.selector}' can not be transformed to an equivalent selector without ':is()'.`)));
1217
- };
1218
- let d = false;
1219
- const warnOnPseudoElements = () => {
1220
- "warning" === s.onPseudoElement && (d || (d = true, o2.warn(t, `Pseudo elements are not allowed in ':is()', unable to transform '${o2.selector}'`)));
1221
- };
1222
- try {
1223
- let n2 = false;
1224
- const t2 = [], r2 = complexSelectors(splitSelectors(o2.selectors, { specificityMatchingName: s.specificityMatchingName }), { onComplexSelector: s.onComplexSelector }, warnOnComplexSelector, warnOnPseudoElements);
1225
- if (Array.from(new Set(r2)).forEach(((s2) => {
1226
- if (o2.selectors.indexOf(s2) > -1) t2.push(s2);
1227
- else {
1228
- if (alwaysValidSelector(s2)) return t2.push(s2), void (n2 = true);
1229
- e4.add(o2), o2.cloneBefore({ selector: s2 }), n2 = true;
1230
- }
1231
- })), t2.length && n2 && (e4.add(o2), o2.cloneBefore({ selectors: t2 })), !s.preserve) {
1232
- if (!n2) return;
1233
- o2.remove();
1234
- }
1235
- } catch (e5) {
1236
- if (!(e5 instanceof Error)) throw e5;
1237
- if (e5.message.indexOf("call stack size exceeded") > -1) throw e5;
1238
- o2.warn(t, `Failed to parse selector "${o2.selector}" with error: ${e5.message}`);
1239
- }
1240
- } };
1241
- } };
1242
- };
1243
- creator.postcss = true;
1244
-
1245
902
  // src/plugins/index.ts
1246
903
 
1247
904
  function getPlugins(options) {
1248
905
  const ctx = createContext();
1249
906
  options.ctx = ctx;
1250
907
  const plugins = [
1251
- ..._nullishCoalesce(_optionalChain([options, 'access', _66 => _66.postcssOptions, 'optionalAccess', _67 => _67.plugins]), () => ( [])),
908
+ ..._nullishCoalesce(_optionalChain([options, 'access', _40 => _40.postcssOptions, 'optionalAccess', _41 => _41.plugins]), () => ( [])),
1252
909
  postcssWeappTailwindcssPrePlugin(options)
1253
910
  ].filter((x) => Boolean(x));
1254
911
  plugins.push(
912
+ // https://preset-env.cssdb.org/
913
+ // https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env#readme
1255
914
  _postcsspresetenv2.default.call(void 0,
1256
915
  options.cssPresetEnv
1257
916
  )
@@ -1334,7 +993,7 @@ function styleHandler(rawSource, options) {
1334
993
  getPlugins(options)
1335
994
  ).process(
1336
995
  rawSource,
1337
- _shared.defu.call(void 0, _optionalChain([options, 'access', _68 => _68.postcssOptions, 'optionalAccess', _69 => _69.options]), {
996
+ _shared.defu.call(void 0, _optionalChain([options, 'access', _42 => _42.postcssOptions, 'optionalAccess', _43 => _43.options]), {
1338
997
  from: void 0
1339
998
  })
1340
999
  ).async();
package/dist/index.mjs CHANGED
@@ -293,8 +293,8 @@ function getFallbackRemove(rule, options) {
293
293
  }
294
294
  }
295
295
  } else if (selector.value === ":where") {
296
- for (const n2 of selector.nodes) {
297
- for (const node of n2.nodes) {
296
+ for (const n of selector.nodes) {
297
+ for (const node of n.nodes) {
298
298
  if (node.type === "attribute") {
299
299
  node.remove();
300
300
  }
@@ -899,349 +899,6 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
899
899
  };
900
900
  postcssWeappTailwindcssPrePlugin.postcss = true;
901
901
 
902
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.3_postcss@8.5.6/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
903
- import e2 from "postcss-selector-parser";
904
-
905
- // ../../node_modules/.pnpm/@csstools+selector-specificity@5.0.0_postcss-selector-parser@7.1.0/node_modules/@csstools/selector-specificity/dist/index.mjs
906
- import e from "postcss-selector-parser";
907
- function compare(e3, t) {
908
- return e3.a === t.a ? e3.b === t.b ? e3.c - t.c : e3.b - t.b : e3.a - t.a;
909
- }
910
- function selectorSpecificity(t, s) {
911
- const i = s?.customSpecificity?.(t);
912
- if (i) return i;
913
- if (!t) return { a: 0, b: 0, c: 0 };
914
- let c = 0, n2 = 0, o2 = 0;
915
- if ("universal" == t.type) return { a: 0, b: 0, c: 0 };
916
- if ("id" === t.type) c += 1;
917
- else if ("tag" === t.type) o2 += 1;
918
- else if ("class" === t.type) n2 += 1;
919
- else if ("attribute" === t.type) n2 += 1;
920
- else if (isPseudoElement(t)) switch (t.value.toLowerCase()) {
921
- case "::slotted":
922
- if (o2 += 1, t.nodes && t.nodes.length > 0) {
923
- const e3 = specificityOfMostSpecificListItem(t.nodes, s);
924
- c += e3.a, n2 += e3.b, o2 += e3.c;
925
- }
926
- break;
927
- case "::view-transition-group":
928
- case "::view-transition-image-pair":
929
- case "::view-transition-old":
930
- case "::view-transition-new":
931
- return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal(t.nodes[0]) ? { a: 0, b: 0, c: 0 } : { a: 0, b: 0, c: 1 };
932
- default:
933
- o2 += 1;
934
- }
935
- else if (e.isPseudoClass(t)) switch (t.value.toLowerCase()) {
936
- case ":-webkit-any":
937
- case ":any":
938
- default:
939
- n2 += 1;
940
- break;
941
- case ":-moz-any":
942
- case ":has":
943
- case ":is":
944
- case ":matches":
945
- case ":not":
946
- if (t.nodes && t.nodes.length > 0) {
947
- const e3 = specificityOfMostSpecificListItem(t.nodes, s);
948
- c += e3.a, n2 += e3.b, o2 += e3.c;
949
- }
950
- break;
951
- case ":where":
952
- break;
953
- case ":nth-child":
954
- case ":nth-last-child":
955
- if (n2 += 1, t.nodes && t.nodes.length > 0) {
956
- const i2 = t.nodes[0].nodes.findIndex(((e3) => "tag" === e3.type && "of" === e3.value.toLowerCase()));
957
- if (i2 > -1) {
958
- const a = e.selector({ nodes: [], value: "" });
959
- t.nodes[0].nodes.slice(i2 + 1).forEach(((e3) => {
960
- a.append(e3.clone());
961
- }));
962
- const r = [a];
963
- t.nodes.length > 1 && r.push(...t.nodes.slice(1));
964
- const l = specificityOfMostSpecificListItem(r, s);
965
- c += l.a, n2 += l.b, o2 += l.c;
966
- }
967
- }
968
- break;
969
- case ":local":
970
- case ":global":
971
- t.nodes && t.nodes.length > 0 && t.nodes.forEach(((e3) => {
972
- const t2 = selectorSpecificity(e3, s);
973
- c += t2.a, n2 += t2.b, o2 += t2.c;
974
- }));
975
- break;
976
- case ":host":
977
- case ":host-context":
978
- if (n2 += 1, t.nodes && t.nodes.length > 0) {
979
- const e3 = specificityOfMostSpecificListItem(t.nodes, s);
980
- c += e3.a, n2 += e3.b, o2 += e3.c;
981
- }
982
- break;
983
- case ":active-view-transition":
984
- case ":active-view-transition-type":
985
- return { a: 0, b: 1, c: 0 };
986
- }
987
- else e.isContainer(t) && t.nodes?.length > 0 && t.nodes.forEach(((e3) => {
988
- const t2 = selectorSpecificity(e3, s);
989
- c += t2.a, n2 += t2.b, o2 += t2.c;
990
- }));
991
- return { a: c, b: n2, c: o2 };
992
- }
993
- function specificityOfMostSpecificListItem(e3, t) {
994
- let s = { a: 0, b: 0, c: 0 };
995
- return e3.forEach(((e4) => {
996
- const i = selectorSpecificity(e4, t);
997
- compare(i, s) < 0 || (s = i);
998
- })), s;
999
- }
1000
- function isPseudoElement(t) {
1001
- return e.isPseudoElement(t);
1002
- }
1003
- function selectorNodeContainsNothingOrOnlyUniversal(e3) {
1004
- if (!e3) return false;
1005
- if (!e3.nodes) return false;
1006
- const t = e3.nodes.filter(((e4) => "comment" !== e4.type));
1007
- return 0 === t.length || 1 === t.length && "universal" === t[0].type;
1008
- }
1009
-
1010
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.3_postcss@8.5.6/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
1011
- function alwaysValidSelector(s) {
1012
- const o2 = e2().astSync(s);
1013
- let n2 = true;
1014
- return o2.walk(((e3) => {
1015
- if ("class" !== e3.type && "comment" !== e3.type && "id" !== e3.type && "root" !== e3.type && "selector" !== e3.type && "string" !== e3.type && "tag" !== e3.type && "universal" !== e3.type && ("attribute" !== e3.type || e3.insensitive) && ("combinator" !== e3.type || "+" !== e3.value && ">" !== e3.value && "~" !== e3.value && " " !== e3.value) && ("pseudo" !== e3.type || e3.nodes?.length || ":hover" !== e3.value.toLowerCase() && ":focus" !== e3.value.toLowerCase())) {
1016
- if ("pseudo" === e3.type && 1 === e3.nodes?.length && ":not" === e3.value.toLowerCase()) {
1017
- let s2 = true;
1018
- if (e3.nodes[0].walkCombinators((() => {
1019
- s2 = false;
1020
- })), s2) return;
1021
- }
1022
- return n2 = false, false;
1023
- }
1024
- })), n2;
1025
- }
1026
- function sortCompoundSelectorsInsideComplexSelector(s) {
1027
- if (!s || !s.nodes || 1 === s.nodes.length) return;
1028
- const o2 = [];
1029
- let n2 = [];
1030
- for (let t2 = 0; t2 < s.nodes.length; t2++) "combinator" !== s.nodes[t2].type ? e2.isPseudoElement(s.nodes[t2]) ? (o2.push(n2), n2 = [s.nodes[t2]]) : n2.push(s.nodes[t2]) : (o2.push(n2), o2.push([s.nodes[t2]]), n2 = []);
1031
- o2.push(n2);
1032
- const t = [];
1033
- for (let e3 = 0; e3 < o2.length; e3++) {
1034
- const s2 = o2[e3];
1035
- s2.sort(((e4, s3) => "selector" === e4.type && "selector" === s3.type && e4.nodes.length && s3.nodes.length ? selectorTypeOrder(e4.nodes[0], e4.nodes[0].type) - selectorTypeOrder(s3.nodes[0], s3.nodes[0].type) : "selector" === e4.type && e4.nodes.length ? selectorTypeOrder(e4.nodes[0], e4.nodes[0].type) - selectorTypeOrder(s3, s3.type) : "selector" === s3.type && s3.nodes.length ? selectorTypeOrder(e4, e4.type) - selectorTypeOrder(s3.nodes[0], s3.nodes[0].type) : selectorTypeOrder(e4, e4.type) - selectorTypeOrder(s3, s3.type)));
1036
- const n3 = new Set(s2.map(((e4) => e4.type))), r = n3.has("universal") && (n3.has("tag") || n3.has("attribute") || n3.has("class") || n3.has("id") || n3.has("pseudo"));
1037
- for (let e4 = 0; e4 < s2.length; e4++) "universal" === s2[e4].type && r ? s2[e4].remove() : t.push(s2[e4]);
1038
- }
1039
- s.removeAll();
1040
- for (let o3 = t.length - 1; o3 >= 0; o3--) {
1041
- const n3 = t[o3 - 1];
1042
- if (t[o3].remove(), n3 && "tag" === n3.type && "tag" === t[o3].type) {
1043
- const n4 = e2.pseudo({ value: ":is", nodes: [e2.selector({ value: "", nodes: [t[o3]] })] });
1044
- n4.parent = s, s.nodes.unshift(n4);
1045
- } else t[o3].parent = s, s.nodes.unshift(t[o3]);
1046
- }
1047
- }
1048
- function selectorTypeOrder(s, n2) {
1049
- return e2.isPseudoElement(s) ? o.pseudoElement : o[n2];
1050
- }
1051
- var o = { universal: 0, tag: 1, pseudoElement: 2, id: 3, class: 4, attribute: 5, pseudo: 6, selector: 7, string: 8, root: 9, comment: 10 };
1052
- function childAdjacentChild(e3) {
1053
- return !(!e3 || !e3.nodes) && ("selector" === e3.type && (3 === e3.nodes.length && (!(!e3.nodes[0] || "pseudo" !== e3.nodes[0].type || ":-csstools-matches" !== e3.nodes[0].value) && (!(!e3.nodes[1] || "combinator" !== e3.nodes[1].type || "+" !== e3.nodes[1].value && "~" !== e3.nodes[1].value) && (!(!e3.nodes[2] || "pseudo" !== e3.nodes[2].type || ":-csstools-matches" !== e3.nodes[2].value) && (!(!e3.nodes[0].nodes || 1 !== e3.nodes[0].nodes.length) && ("selector" === e3.nodes[0].nodes[0].type && (!(!e3.nodes[0].nodes[0].nodes || 3 !== e3.nodes[0].nodes[0].nodes.length) && (!(!e3.nodes[0].nodes[0].nodes || "combinator" !== e3.nodes[0].nodes[0].nodes[1].type || ">" !== e3.nodes[0].nodes[0].nodes[1].value) && (!(!e3.nodes[2].nodes || 1 !== e3.nodes[2].nodes.length) && ("selector" === e3.nodes[2].nodes[0].type && (!(!e3.nodes[2].nodes[0].nodes || 3 !== e3.nodes[2].nodes[0].nodes.length) && (!(!e3.nodes[2].nodes[0].nodes || "combinator" !== e3.nodes[2].nodes[0].nodes[1].type || ">" !== e3.nodes[2].nodes[0].nodes[1].value) && (e3.nodes[0].nodes[0].insertAfter(e3.nodes[0].nodes[0].nodes[0], e3.nodes[2].nodes[0].nodes[0].clone()), e3.nodes[2].nodes[0].nodes[1].remove(), e3.nodes[2].nodes[0].nodes[0].remove(), e3.nodes[0].replaceWith(e3.nodes[0].nodes[0]), e3.nodes[2].replaceWith(e3.nodes[2].nodes[0]), true))))))))))))));
1054
- }
1055
- function isInCompoundWithOneOtherElement(s) {
1056
- if (!s || !s.nodes) return false;
1057
- if (!e2.isSelector(s)) return false;
1058
- if (2 !== s.nodes.length) return false;
1059
- let o2 = -1, n2 = -1;
1060
- s.nodes[0] && e2.isPseudoClass(s.nodes[0]) && ":-csstools-matches" === s.nodes[0].value ? (o2 = 0, n2 = 1) : s.nodes[1] && e2.isPseudoClass(s.nodes[1]) && ":-csstools-matches" === s.nodes[1].value && (o2 = 1, n2 = 0);
1061
- const t = s.nodes[o2];
1062
- if (!t || !e2.isPseudoClass(t) || 1 !== t.nodes.length) return false;
1063
- const r = s.nodes[n2];
1064
- return !!r && (!e2.isCombinator(r) && (!e2.isPseudoElement(r) && (t.nodes[0].append(r.clone()), t.replaceWith(...t.nodes[0].nodes), r.remove(), true)));
1065
- }
1066
- function isPseudoInFirstCompound(s) {
1067
- if (!s || !s.nodes) return false;
1068
- if (!e2.isSelector(s)) return false;
1069
- let o2 = -1;
1070
- for (let n3 = 0; n3 < s.nodes.length; n3++) {
1071
- const t2 = s.nodes[n3];
1072
- if (e2.isCombinator(t2)) return false;
1073
- if (e2.isPseudoElement(t2)) return false;
1074
- if (e2.isPseudoClass(t2)) {
1075
- const e3 = t2;
1076
- if (":-csstools-matches" === e3.value) {
1077
- if (!e3.nodes || 1 !== e3.nodes.length) return false;
1078
- o2 = n3;
1079
- break;
1080
- }
1081
- }
1082
- }
1083
- if (-1 === o2) return false;
1084
- const n2 = s.nodes[o2];
1085
- if (!n2 || !e2.isPseudoClass(n2)) return false;
1086
- const t = s.nodes.slice(0, o2), r = s.nodes.slice(o2 + 1);
1087
- return t.forEach(((e3) => {
1088
- n2.nodes[0].append(e3.clone());
1089
- })), r.forEach(((e3) => {
1090
- n2.nodes[0].append(e3.clone());
1091
- })), n2.replaceWith(...n2.nodes), t.forEach(((e3) => {
1092
- e3.remove();
1093
- })), r.forEach(((e3) => {
1094
- e3.remove();
1095
- })), true;
1096
- }
1097
- function samePrecedingElement(s) {
1098
- if (!s || !s.nodes) return false;
1099
- if ("selector" !== s.type) return false;
1100
- let o2 = -1;
1101
- for (let n3 = 0; n3 < s.nodes.length; n3++) {
1102
- const t2 = s.nodes[n3];
1103
- if (e2.isCombinator(t2)) {
1104
- o2 = n3;
1105
- break;
1106
- }
1107
- if (e2.isPseudoElement(t2)) return false;
1108
- }
1109
- if (-1 === o2) return false;
1110
- const n2 = o2 + 1;
1111
- if (!s.nodes[o2] || "combinator" !== s.nodes[o2].type || ">" !== s.nodes[o2].value && "+" !== s.nodes[o2].value) return false;
1112
- const t = s.nodes[o2].value;
1113
- if (!s.nodes[n2] || "pseudo" !== s.nodes[n2].type || ":-csstools-matches" !== s.nodes[n2].value) return false;
1114
- if (!s.nodes[n2].nodes || 1 !== s.nodes[n2].nodes.length) return false;
1115
- if ("selector" !== s.nodes[n2].nodes[0].type) return false;
1116
- if (!s.nodes[n2].nodes[0].nodes || 3 !== s.nodes[n2].nodes[0].nodes.length) return false;
1117
- if (!s.nodes[n2].nodes[0].nodes || "combinator" !== s.nodes[n2].nodes[0].nodes[1].type || s.nodes[n2].nodes[0].nodes[1].value !== t) return false;
1118
- const r = s.nodes[n2];
1119
- if (!r || !e2.isPseudoClass(r)) return false;
1120
- const d = s.nodes.slice(0, o2), l = s.nodes.slice(n2 + 1);
1121
- return s.each(((e3) => {
1122
- e3.remove();
1123
- })), d.forEach(((e3) => {
1124
- s.append(e3);
1125
- })), r.nodes[0].nodes.forEach(((e3) => {
1126
- s.append(e3);
1127
- })), l.forEach(((e3) => {
1128
- s.append(e3);
1129
- })), true;
1130
- }
1131
- function complexSelectors(s, o2, n2, t) {
1132
- return s.flatMap(((s2) => {
1133
- if (-1 === s2.indexOf(":-csstools-matches") && -1 === s2.toLowerCase().indexOf(":is")) return s2;
1134
- const r = e2().astSync(s2);
1135
- return r.walkPseudos(((s3) => {
1136
- if (":is" === s3.value.toLowerCase() && s3.nodes && s3.nodes.length && "selector" === s3.nodes[0].type && 0 === s3.nodes[0].nodes.length) return s3.value = ":not", void s3.nodes[0].append(e2.universal());
1137
- if (":-csstools-matches" === s3.value) if (!s3.nodes || s3.nodes.length) {
1138
- if (s3.walkPseudos(((s4) => {
1139
- if (e2.isPseudoElement(s4)) {
1140
- let e3 = s4.value;
1141
- if (e3.startsWith("::-csstools-invalid-")) return;
1142
- for (; e3.startsWith(":"); ) e3 = e3.slice(1);
1143
- s4.value = `::-csstools-invalid-${e3}`, t();
1144
- }
1145
- })), 1 === s3.nodes.length && "selector" === s3.nodes[0].type) {
1146
- if (1 === s3.nodes[0].nodes.length) return void s3.replaceWith(s3.nodes[0].nodes[0]);
1147
- if (!s3.nodes[0].some(((e3) => "combinator" === e3.type))) return void s3.replaceWith(...s3.nodes[0].nodes);
1148
- }
1149
- 1 !== r.nodes.length || "selector" !== r.nodes[0].type || 1 !== r.nodes[0].nodes.length || r.nodes[0].nodes[0] !== s3 ? childAdjacentChild(s3.parent) || isInCompoundWithOneOtherElement(s3.parent) || isPseudoInFirstCompound(s3.parent) || samePrecedingElement(s3.parent) || ("warning" === o2.onComplexSelector && n2(), s3.value = ":is") : s3.replaceWith(...s3.nodes[0].nodes);
1150
- } else s3.remove();
1151
- })), r.walk(((e3) => {
1152
- "selector" === e3.type && "nodes" in e3 && 1 === e3.nodes.length && "selector" === e3.nodes[0].type && e3.replaceWith(e3.nodes[0]);
1153
- })), r.walk(((e3) => {
1154
- "nodes" in e3 && sortCompoundSelectorsInsideComplexSelector(e3);
1155
- })), r.toString();
1156
- })).filter(((e3) => !!e3));
1157
- }
1158
- function splitSelectors(o2, n2, t = 0) {
1159
- const r = ":not(#" + n2.specificityMatchingName + ")", d = ":not(." + n2.specificityMatchingName + ")", l = ":not(" + n2.specificityMatchingName + ")";
1160
- return o2.flatMap(((o3) => {
1161
- if (-1 === o3.toLowerCase().indexOf(":is")) return o3;
1162
- let i = false;
1163
- const a = [];
1164
- if (e2().astSync(o3).walkPseudos(((e3) => {
1165
- if (":is" !== e3.value.toLowerCase() || !e3.nodes || !e3.nodes.length) return;
1166
- if ("selector" === e3.nodes[0].type && 0 === e3.nodes[0].nodes.length) return;
1167
- if ("pseudo" === e3.parent?.parent?.type && ":not" === e3.parent?.parent?.value?.toLowerCase()) return void a.push([{ start: e3.parent.parent.sourceIndex, end: e3.parent.parent.sourceIndex + e3.parent.parent.toString().length, option: `:not(${e3.nodes.toString()})` }]);
1168
- if ("pseudo" === e3.parent?.parent?.type && ":has" === e3.parent?.parent?.value?.toLowerCase()) return void (e3.value = ":-csstools-matches");
1169
- let o4 = e3.parent;
1170
- for (; o4; ) {
1171
- if (o4.value && ":is" === o4.value.toLowerCase() && "pseudo" === o4.type) return void (i = true);
1172
- o4 = o4.parent;
1173
- }
1174
- const n3 = selectorSpecificity(e3), t2 = e3.sourceIndex, c2 = t2 + e3.toString().length, p = [];
1175
- e3.nodes.forEach(((e4) => {
1176
- const o5 = { start: t2, end: c2, option: "" }, i2 = selectorSpecificity(e4);
1177
- let a2 = e4.toString().trim();
1178
- const u = Math.max(0, n3.a - i2.a), h = Math.max(0, n3.b - i2.b), f = Math.max(0, n3.c - i2.c);
1179
- for (let e5 = 0; e5 < u; e5++) a2 += r;
1180
- for (let e5 = 0; e5 < h; e5++) a2 += d;
1181
- for (let e5 = 0; e5 < f; e5++) a2 += l;
1182
- o5.option = a2, p.push(o5);
1183
- })), a.push(p);
1184
- })), !a.length) return [o3];
1185
- let c = [];
1186
- return cartesianProduct(...a).forEach(((e3) => {
1187
- let s = "";
1188
- for (let n3 = 0; n3 < e3.length; n3++) {
1189
- const t2 = e3[n3];
1190
- s += o3.substring(e3[n3 - 1]?.end || 0, e3[n3].start), s += ":-csstools-matches(" + t2.option + ")", n3 === e3.length - 1 && (s += o3.substring(e3[n3].end));
1191
- }
1192
- c.push(s);
1193
- })), i && t < 10 && (c = splitSelectors(c, n2, t + 1)), c;
1194
- })).filter(((e3) => !!e3));
1195
- }
1196
- function cartesianProduct(...e3) {
1197
- const s = [], o2 = e3.length - 1;
1198
- return (function helper(n2, t) {
1199
- for (let r = 0, d = e3[t].length; r < d; r++) {
1200
- const d2 = n2.slice(0);
1201
- d2.push(e3[t][r]), t === o2 ? s.push(d2) : helper(d2, t + 1);
1202
- }
1203
- })([], 0), s;
1204
- }
1205
- var n = /:is\(/i;
1206
- var creator = (e3) => {
1207
- const s = { specificityMatchingName: "does-not-exist", ...e3 || {} };
1208
- return { postcssPlugin: "postcss-is-pseudo-class", prepare() {
1209
- const e4 = /* @__PURE__ */ new WeakSet();
1210
- return { postcssPlugin: "postcss-is-pseudo-class", Rule(o2, { result: t }) {
1211
- if (!o2.selector) return;
1212
- if (!n.test(o2.selector)) return;
1213
- if (e4.has(o2)) return;
1214
- let r = false;
1215
- const warnOnComplexSelector = () => {
1216
- "warning" === s.onComplexSelector && (r || (r = true, o2.warn(t, `Complex selectors in '${o2.selector}' can not be transformed to an equivalent selector without ':is()'.`)));
1217
- };
1218
- let d = false;
1219
- const warnOnPseudoElements = () => {
1220
- "warning" === s.onPseudoElement && (d || (d = true, o2.warn(t, `Pseudo elements are not allowed in ':is()', unable to transform '${o2.selector}'`)));
1221
- };
1222
- try {
1223
- let n2 = false;
1224
- const t2 = [], r2 = complexSelectors(splitSelectors(o2.selectors, { specificityMatchingName: s.specificityMatchingName }), { onComplexSelector: s.onComplexSelector }, warnOnComplexSelector, warnOnPseudoElements);
1225
- if (Array.from(new Set(r2)).forEach(((s2) => {
1226
- if (o2.selectors.indexOf(s2) > -1) t2.push(s2);
1227
- else {
1228
- if (alwaysValidSelector(s2)) return t2.push(s2), void (n2 = true);
1229
- e4.add(o2), o2.cloneBefore({ selector: s2 }), n2 = true;
1230
- }
1231
- })), t2.length && n2 && (e4.add(o2), o2.cloneBefore({ selectors: t2 })), !s.preserve) {
1232
- if (!n2) return;
1233
- o2.remove();
1234
- }
1235
- } catch (e5) {
1236
- if (!(e5 instanceof Error)) throw e5;
1237
- if (e5.message.indexOf("call stack size exceeded") > -1) throw e5;
1238
- o2.warn(t, `Failed to parse selector "${o2.selector}" with error: ${e5.message}`);
1239
- }
1240
- } };
1241
- } };
1242
- };
1243
- creator.postcss = true;
1244
-
1245
902
  // src/plugins/index.ts
1246
903
  import { default as default2 } from "postcss-rem-to-responsive-pixel";
1247
904
  function getPlugins(options) {
@@ -1252,6 +909,8 @@ function getPlugins(options) {
1252
909
  postcssWeappTailwindcssPrePlugin(options)
1253
910
  ].filter((x) => Boolean(x));
1254
911
  plugins.push(
912
+ // https://preset-env.cssdb.org/
913
+ // https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env#readme
1255
914
  postcssPresetEnv(
1256
915
  options.cssPresetEnv
1257
916
  )
package/dist/types.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import '@weapp-tailwindcss/mangle';
2
- import '@weapp-tailwindcss/postcss-calc';
2
+ export { PostCssCalcOptions as CssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
3
3
  import 'postcss';
4
4
  import 'postcss-load-config';
5
- import 'postcss-preset-env';
6
- import 'postcss-pxtransform';
7
- import 'postcss-rem-to-responsive-pixel';
5
+ export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
6
+ export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
7
+ export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
8
8
  export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-C5X6IWCb.mjs';
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import '@weapp-tailwindcss/mangle';
2
- import '@weapp-tailwindcss/postcss-calc';
2
+ export { PostCssCalcOptions as CssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
3
3
  import 'postcss';
4
4
  import 'postcss-load-config';
5
- import 'postcss-preset-env';
6
- import 'postcss-pxtransform';
7
- import 'postcss-rem-to-responsive-pixel';
5
+ export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
6
+ export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
7
+ export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
8
8
  export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-C5X6IWCb.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "1.2.0",
3
+ "version": "1.2.1-alpha.0",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -49,6 +49,7 @@
49
49
  "@weapp-tailwindcss/shared": "1.0.3"
50
50
  },
51
51
  "devDependencies": {
52
+ "@csstools/postcss-is-pseudo-class": "^5.0.3",
52
53
  "postcss-calc": "^10.1.1",
53
54
  "postcss-value-parser": "^4.2.0",
54
55
  "@weapp-tailwindcss/mangle": "1.0.5"