@csszyx/compiler 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/color-var.cjs +1 -0
- package/dist/color-var.mjs +1 -0
- package/dist/index.cjs +1109 -44
- package/dist/index.d.cts +184 -38
- package/dist/index.d.mts +184 -38
- package/dist/index.mjs +1107 -47
- package/dist/shared/{compiler.BIUVmI0H.mjs → compiler.CIBwOKUt.mjs} +70 -15
- package/dist/shared/{compiler.C6jT0mcT.cjs → compiler.DItEsgH4.cjs} +70 -15
- package/dist/transform-core.cjs +1 -1
- package/dist/transform-core.mjs +1 -1
- package/package.json +2 -2
|
@@ -115,6 +115,11 @@ const PROPERTY_CATEGORY_MAP = {
|
|
|
115
115
|
via: 1 /* COLOR */,
|
|
116
116
|
to: 1 /* COLOR */,
|
|
117
117
|
dropShadowColor: 1 /* COLOR */,
|
|
118
|
+
scrollbarThumb: 1 /* COLOR */,
|
|
119
|
+
scrollbarTrack: 1 /* COLOR */,
|
|
120
|
+
maskFrom: 1 /* COLOR */,
|
|
121
|
+
maskVia: 1 /* COLOR */,
|
|
122
|
+
maskTo: 1 /* COLOR */,
|
|
118
123
|
// ---- UNITLESS ----
|
|
119
124
|
opacity: 3 /* UNITLESS */,
|
|
120
125
|
z: 3 /* UNITLESS */,
|
|
@@ -161,6 +166,8 @@ const PROPERTY_CATEGORY_MAP = {
|
|
|
161
166
|
outline: 3 /* UNITLESS */,
|
|
162
167
|
leading: 3 /* UNITLESS */,
|
|
163
168
|
decorationThickness: 3 /* UNITLESS */,
|
|
169
|
+
zoom: 3 /* UNITLESS */,
|
|
170
|
+
tabSize: 3 /* UNITLESS */,
|
|
164
171
|
// ---- ANGLE ----
|
|
165
172
|
rotate: 4 /* ANGLE */,
|
|
166
173
|
skewX: 4 /* ANGLE */,
|
|
@@ -208,10 +215,10 @@ function isValidColorString(value) {
|
|
|
208
215
|
if (/^(rgb|hsl|oklch|color|hwb|lab|lch|oklab)\(/.test(value)) {
|
|
209
216
|
return true;
|
|
210
217
|
}
|
|
211
|
-
if (/^[a-
|
|
218
|
+
if (/^[a-z][a-z0-9]*(-[a-z0-9]+)*-\d+$/i.test(value)) {
|
|
212
219
|
return true;
|
|
213
220
|
}
|
|
214
|
-
if (/^[a-
|
|
221
|
+
if (/^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$/i.test(value)) {
|
|
215
222
|
return true;
|
|
216
223
|
}
|
|
217
224
|
return false;
|
|
@@ -575,7 +582,20 @@ const PROPERTY_MAP = {
|
|
|
575
582
|
tableLayout: "table",
|
|
576
583
|
caption: "caption",
|
|
577
584
|
// Overflow
|
|
578
|
-
overflow: "overflow"
|
|
585
|
+
overflow: "overflow",
|
|
586
|
+
// Scrollbar (v4.3)
|
|
587
|
+
scrollbar: "scrollbar",
|
|
588
|
+
scrollbarThumb: "scrollbar-thumb",
|
|
589
|
+
scrollbarTrack: "scrollbar-track",
|
|
590
|
+
scrollbarGutter: "scrollbar-gutter",
|
|
591
|
+
// Zoom (v4.3)
|
|
592
|
+
zoom: "zoom",
|
|
593
|
+
// Tab Size (v4.3)
|
|
594
|
+
tabSize: "tab",
|
|
595
|
+
// Mask gradient color stops (v4.1)
|
|
596
|
+
maskFrom: "mask-from",
|
|
597
|
+
maskVia: "mask-via",
|
|
598
|
+
maskTo: "mask-to"
|
|
579
599
|
};
|
|
580
600
|
const CSS_VAR_TYPE_HINTS = {
|
|
581
601
|
fontFamily: "family-name",
|
|
@@ -688,6 +708,9 @@ const SUGGESTION_MAP = {
|
|
|
688
708
|
touchAction: "touch",
|
|
689
709
|
userSelect: "select",
|
|
690
710
|
captionSide: "caption",
|
|
711
|
+
// Scrollbar (v4.3)
|
|
712
|
+
scrollbarColor: "scrollbarThumb (thumb color) or scrollbarTrack (track color)",
|
|
713
|
+
scrollbarWidth: "scrollbar",
|
|
691
714
|
// Boolean remaps
|
|
692
715
|
flexWrapReverse: "flexWrap: 'wrap-reverse'",
|
|
693
716
|
flexNowrap: "flexWrap: 'nowrap'"
|
|
@@ -721,6 +744,16 @@ const VARIANT_MAP = {
|
|
|
721
744
|
pointerFine: "pointer-fine",
|
|
722
745
|
pointerCoarse: "pointer-coarse",
|
|
723
746
|
pointerNone: "pointer-none",
|
|
747
|
+
// Any-pointer variants (v4.1)
|
|
748
|
+
anyPointerFine: "any-pointer-fine",
|
|
749
|
+
anyPointerCoarse: "any-pointer-coarse",
|
|
750
|
+
anyPointerNone: "any-pointer-none",
|
|
751
|
+
// Form validation variants (v4.1)
|
|
752
|
+
userValid: "user-valid",
|
|
753
|
+
userInvalid: "user-invalid",
|
|
754
|
+
// Details / inverted-colors variants (v4.1)
|
|
755
|
+
detailsContent: "details-content",
|
|
756
|
+
invertedColors: "inverted-colors",
|
|
724
757
|
// Screen orientation
|
|
725
758
|
screenPortrait: "portrait",
|
|
726
759
|
screenLandscape: "landscape",
|
|
@@ -826,6 +859,25 @@ const KNOWN_VARIANTS = /* @__PURE__ */ new Set([
|
|
|
826
859
|
"pointerFine",
|
|
827
860
|
"pointerCoarse",
|
|
828
861
|
"pointerNone",
|
|
862
|
+
// Any-pointer (v4.1)
|
|
863
|
+
"any-pointer-fine",
|
|
864
|
+
"any-pointer-coarse",
|
|
865
|
+
"any-pointer-none",
|
|
866
|
+
"anyPointerFine",
|
|
867
|
+
"anyPointerCoarse",
|
|
868
|
+
"anyPointerNone",
|
|
869
|
+
// Form validation (v4.1)
|
|
870
|
+
"user-valid",
|
|
871
|
+
"user-invalid",
|
|
872
|
+
"userValid",
|
|
873
|
+
"userInvalid",
|
|
874
|
+
// Details / inverted-colors (v4.1)
|
|
875
|
+
"details-content",
|
|
876
|
+
"detailsContent",
|
|
877
|
+
"inverted-colors",
|
|
878
|
+
"invertedColors",
|
|
879
|
+
// Noscript (v4.1)
|
|
880
|
+
"noscript",
|
|
829
881
|
// Open
|
|
830
882
|
"open",
|
|
831
883
|
// RTL/LTR
|
|
@@ -1223,7 +1275,7 @@ function handleGroupPeer(type, nestedObj, prefix) {
|
|
|
1223
1275
|
if (result.className) {
|
|
1224
1276
|
classes.push(result.className);
|
|
1225
1277
|
}
|
|
1226
|
-
} else if (typeof nestedValue === "object"
|
|
1278
|
+
} else if (typeof nestedValue === "object") {
|
|
1227
1279
|
for (const [state, stateValue] of Object.entries(nestedValue)) {
|
|
1228
1280
|
if (stateValue === null || stateValue === void 0 || stateValue === false) {
|
|
1229
1281
|
continue;
|
|
@@ -1393,7 +1445,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1393
1445
|
classes.push(`${prefix}${mappedKey}/${value}`);
|
|
1394
1446
|
continue;
|
|
1395
1447
|
}
|
|
1396
|
-
if (rawKey === "bgImg" && typeof value === "object" &&
|
|
1448
|
+
if (rawKey === "bgImg" && value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
1397
1449
|
const grad = value;
|
|
1398
1450
|
const gradType = grad.gradient;
|
|
1399
1451
|
if (!gradType) {
|
|
@@ -1458,7 +1510,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1458
1510
|
classes.push(`${prefix}${rawKey}/${value}`);
|
|
1459
1511
|
continue;
|
|
1460
1512
|
}
|
|
1461
|
-
if (typeof value === "object" &&
|
|
1513
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value) && rawKey in PROPERTY_MAP && "color" in value) {
|
|
1462
1514
|
const colorObj = value;
|
|
1463
1515
|
const twPrefix = PROPERTY_MAP[rawKey] || rawKey.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1464
1516
|
const rawColorBase = String(colorObj.color);
|
|
@@ -1568,7 +1620,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1568
1620
|
if (result.className) {
|
|
1569
1621
|
classes.push(result.className);
|
|
1570
1622
|
}
|
|
1571
|
-
} else if ((mappedKey === "@min" || mappedKey === "@max") && typeof nestedValue === "object" &&
|
|
1623
|
+
} else if ((mappedKey === "@min" || mappedKey === "@max") && nestedValue !== null && typeof nestedValue === "object" && !KNOWN_BP.has(nestedKey) && !PROPERTY_MAP[nestedKey] && !BOOLEAN_SHORTHANDS.has(nestedKey)) {
|
|
1572
1624
|
const nestedPrefix2 = `${prefix}${mappedKey}-[${nestedKey}]:`;
|
|
1573
1625
|
const result = transform(nestedValue, nestedPrefix2);
|
|
1574
1626
|
if (result.className) {
|
|
@@ -1583,7 +1635,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1583
1635
|
if (result.className) {
|
|
1584
1636
|
classes.push(result.className);
|
|
1585
1637
|
}
|
|
1586
|
-
} else if (typeof nestedValue === "object"
|
|
1638
|
+
} else if (typeof nestedValue === "object") {
|
|
1587
1639
|
const nestedPrefix2 = `${prefix}${mappedKey}/${nestedKey}:`;
|
|
1588
1640
|
const result = transform(nestedValue, nestedPrefix2);
|
|
1589
1641
|
if (result.className) {
|
|
@@ -2197,7 +2249,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
2197
2249
|
if (!FRACTION_SUPPORTED_PROPS.has(rawKey)) {
|
|
2198
2250
|
finalValue = `[${finalValue}]`;
|
|
2199
2251
|
}
|
|
2200
|
-
} else if (key === "aspect" &&
|
|
2252
|
+
} else if (key === "aspect" && /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/.test(finalValue)) {
|
|
2201
2253
|
if (finalValue === "auto" || finalValue === "square" || finalValue === "video" || /^\d+\/\d+$/.test(finalValue)) ; else {
|
|
2202
2254
|
finalValue = `[${finalValue}]`;
|
|
2203
2255
|
}
|
|
@@ -2216,19 +2268,22 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
2216
2268
|
}
|
|
2217
2269
|
}
|
|
2218
2270
|
let mergedClasses = classes;
|
|
2219
|
-
const
|
|
2220
|
-
const
|
|
2271
|
+
const textSizeBaseRe = /^text-(xs|sm|base|lg|[2-9]?xl|\[[^\]]+\]|\([^)]+\))$/;
|
|
2272
|
+
const leadingBaseRe = /^leading-(.+)$/;
|
|
2221
2273
|
const textEntries = [];
|
|
2222
2274
|
const leadingEntries = [];
|
|
2223
2275
|
for (let i = 0; i < classes.length; i++) {
|
|
2224
2276
|
const cls = classes[i];
|
|
2225
|
-
const
|
|
2277
|
+
const lastColon = cls.lastIndexOf(":");
|
|
2278
|
+
const prefix2 = lastColon === -1 ? "" : cls.slice(0, lastColon + 1);
|
|
2279
|
+
const base = lastColon === -1 ? cls : cls.slice(lastColon + 1);
|
|
2280
|
+
const tm = textSizeBaseRe.exec(base);
|
|
2226
2281
|
if (tm) {
|
|
2227
|
-
textEntries.push({ index: i, prefix:
|
|
2282
|
+
textEntries.push({ index: i, prefix: prefix2, size: tm[1] });
|
|
2228
2283
|
}
|
|
2229
|
-
const lm =
|
|
2284
|
+
const lm = leadingBaseRe.exec(base);
|
|
2230
2285
|
if (lm) {
|
|
2231
|
-
leadingEntries.push({ index: i, prefix:
|
|
2286
|
+
leadingEntries.push({ index: i, prefix: prefix2, value: lm[1] });
|
|
2232
2287
|
}
|
|
2233
2288
|
}
|
|
2234
2289
|
if (textEntries.length > 0 && leadingEntries.length > 0) {
|
|
@@ -117,6 +117,11 @@ const PROPERTY_CATEGORY_MAP = {
|
|
|
117
117
|
via: 1 /* COLOR */,
|
|
118
118
|
to: 1 /* COLOR */,
|
|
119
119
|
dropShadowColor: 1 /* COLOR */,
|
|
120
|
+
scrollbarThumb: 1 /* COLOR */,
|
|
121
|
+
scrollbarTrack: 1 /* COLOR */,
|
|
122
|
+
maskFrom: 1 /* COLOR */,
|
|
123
|
+
maskVia: 1 /* COLOR */,
|
|
124
|
+
maskTo: 1 /* COLOR */,
|
|
120
125
|
// ---- UNITLESS ----
|
|
121
126
|
opacity: 3 /* UNITLESS */,
|
|
122
127
|
z: 3 /* UNITLESS */,
|
|
@@ -163,6 +168,8 @@ const PROPERTY_CATEGORY_MAP = {
|
|
|
163
168
|
outline: 3 /* UNITLESS */,
|
|
164
169
|
leading: 3 /* UNITLESS */,
|
|
165
170
|
decorationThickness: 3 /* UNITLESS */,
|
|
171
|
+
zoom: 3 /* UNITLESS */,
|
|
172
|
+
tabSize: 3 /* UNITLESS */,
|
|
166
173
|
// ---- ANGLE ----
|
|
167
174
|
rotate: 4 /* ANGLE */,
|
|
168
175
|
skewX: 4 /* ANGLE */,
|
|
@@ -210,10 +217,10 @@ function isValidColorString(value) {
|
|
|
210
217
|
if (/^(rgb|hsl|oklch|color|hwb|lab|lch|oklab)\(/.test(value)) {
|
|
211
218
|
return true;
|
|
212
219
|
}
|
|
213
|
-
if (/^[a-
|
|
220
|
+
if (/^[a-z][a-z0-9]*(-[a-z0-9]+)*-\d+$/i.test(value)) {
|
|
214
221
|
return true;
|
|
215
222
|
}
|
|
216
|
-
if (/^[a-
|
|
223
|
+
if (/^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$/i.test(value)) {
|
|
217
224
|
return true;
|
|
218
225
|
}
|
|
219
226
|
return false;
|
|
@@ -577,7 +584,20 @@ const PROPERTY_MAP = {
|
|
|
577
584
|
tableLayout: "table",
|
|
578
585
|
caption: "caption",
|
|
579
586
|
// Overflow
|
|
580
|
-
overflow: "overflow"
|
|
587
|
+
overflow: "overflow",
|
|
588
|
+
// Scrollbar (v4.3)
|
|
589
|
+
scrollbar: "scrollbar",
|
|
590
|
+
scrollbarThumb: "scrollbar-thumb",
|
|
591
|
+
scrollbarTrack: "scrollbar-track",
|
|
592
|
+
scrollbarGutter: "scrollbar-gutter",
|
|
593
|
+
// Zoom (v4.3)
|
|
594
|
+
zoom: "zoom",
|
|
595
|
+
// Tab Size (v4.3)
|
|
596
|
+
tabSize: "tab",
|
|
597
|
+
// Mask gradient color stops (v4.1)
|
|
598
|
+
maskFrom: "mask-from",
|
|
599
|
+
maskVia: "mask-via",
|
|
600
|
+
maskTo: "mask-to"
|
|
581
601
|
};
|
|
582
602
|
const CSS_VAR_TYPE_HINTS = {
|
|
583
603
|
fontFamily: "family-name",
|
|
@@ -690,6 +710,9 @@ const SUGGESTION_MAP = {
|
|
|
690
710
|
touchAction: "touch",
|
|
691
711
|
userSelect: "select",
|
|
692
712
|
captionSide: "caption",
|
|
713
|
+
// Scrollbar (v4.3)
|
|
714
|
+
scrollbarColor: "scrollbarThumb (thumb color) or scrollbarTrack (track color)",
|
|
715
|
+
scrollbarWidth: "scrollbar",
|
|
693
716
|
// Boolean remaps
|
|
694
717
|
flexWrapReverse: "flexWrap: 'wrap-reverse'",
|
|
695
718
|
flexNowrap: "flexWrap: 'nowrap'"
|
|
@@ -723,6 +746,16 @@ const VARIANT_MAP = {
|
|
|
723
746
|
pointerFine: "pointer-fine",
|
|
724
747
|
pointerCoarse: "pointer-coarse",
|
|
725
748
|
pointerNone: "pointer-none",
|
|
749
|
+
// Any-pointer variants (v4.1)
|
|
750
|
+
anyPointerFine: "any-pointer-fine",
|
|
751
|
+
anyPointerCoarse: "any-pointer-coarse",
|
|
752
|
+
anyPointerNone: "any-pointer-none",
|
|
753
|
+
// Form validation variants (v4.1)
|
|
754
|
+
userValid: "user-valid",
|
|
755
|
+
userInvalid: "user-invalid",
|
|
756
|
+
// Details / inverted-colors variants (v4.1)
|
|
757
|
+
detailsContent: "details-content",
|
|
758
|
+
invertedColors: "inverted-colors",
|
|
726
759
|
// Screen orientation
|
|
727
760
|
screenPortrait: "portrait",
|
|
728
761
|
screenLandscape: "landscape",
|
|
@@ -828,6 +861,25 @@ const KNOWN_VARIANTS = /* @__PURE__ */ new Set([
|
|
|
828
861
|
"pointerFine",
|
|
829
862
|
"pointerCoarse",
|
|
830
863
|
"pointerNone",
|
|
864
|
+
// Any-pointer (v4.1)
|
|
865
|
+
"any-pointer-fine",
|
|
866
|
+
"any-pointer-coarse",
|
|
867
|
+
"any-pointer-none",
|
|
868
|
+
"anyPointerFine",
|
|
869
|
+
"anyPointerCoarse",
|
|
870
|
+
"anyPointerNone",
|
|
871
|
+
// Form validation (v4.1)
|
|
872
|
+
"user-valid",
|
|
873
|
+
"user-invalid",
|
|
874
|
+
"userValid",
|
|
875
|
+
"userInvalid",
|
|
876
|
+
// Details / inverted-colors (v4.1)
|
|
877
|
+
"details-content",
|
|
878
|
+
"detailsContent",
|
|
879
|
+
"inverted-colors",
|
|
880
|
+
"invertedColors",
|
|
881
|
+
// Noscript (v4.1)
|
|
882
|
+
"noscript",
|
|
831
883
|
// Open
|
|
832
884
|
"open",
|
|
833
885
|
// RTL/LTR
|
|
@@ -1225,7 +1277,7 @@ function handleGroupPeer(type, nestedObj, prefix) {
|
|
|
1225
1277
|
if (result.className) {
|
|
1226
1278
|
classes.push(result.className);
|
|
1227
1279
|
}
|
|
1228
|
-
} else if (typeof nestedValue === "object"
|
|
1280
|
+
} else if (typeof nestedValue === "object") {
|
|
1229
1281
|
for (const [state, stateValue] of Object.entries(nestedValue)) {
|
|
1230
1282
|
if (stateValue === null || stateValue === void 0 || stateValue === false) {
|
|
1231
1283
|
continue;
|
|
@@ -1395,7 +1447,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1395
1447
|
classes.push(`${prefix}${mappedKey}/${value}`);
|
|
1396
1448
|
continue;
|
|
1397
1449
|
}
|
|
1398
|
-
if (rawKey === "bgImg" && typeof value === "object" &&
|
|
1450
|
+
if (rawKey === "bgImg" && value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
1399
1451
|
const grad = value;
|
|
1400
1452
|
const gradType = grad.gradient;
|
|
1401
1453
|
if (!gradType) {
|
|
@@ -1460,7 +1512,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1460
1512
|
classes.push(`${prefix}${rawKey}/${value}`);
|
|
1461
1513
|
continue;
|
|
1462
1514
|
}
|
|
1463
|
-
if (typeof value === "object" &&
|
|
1515
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value) && rawKey in PROPERTY_MAP && "color" in value) {
|
|
1464
1516
|
const colorObj = value;
|
|
1465
1517
|
const twPrefix = PROPERTY_MAP[rawKey] || rawKey.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1466
1518
|
const rawColorBase = String(colorObj.color);
|
|
@@ -1570,7 +1622,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1570
1622
|
if (result.className) {
|
|
1571
1623
|
classes.push(result.className);
|
|
1572
1624
|
}
|
|
1573
|
-
} else if ((mappedKey === "@min" || mappedKey === "@max") && typeof nestedValue === "object" &&
|
|
1625
|
+
} else if ((mappedKey === "@min" || mappedKey === "@max") && nestedValue !== null && typeof nestedValue === "object" && !KNOWN_BP.has(nestedKey) && !PROPERTY_MAP[nestedKey] && !BOOLEAN_SHORTHANDS.has(nestedKey)) {
|
|
1574
1626
|
const nestedPrefix2 = `${prefix}${mappedKey}-[${nestedKey}]:`;
|
|
1575
1627
|
const result = transform(nestedValue, nestedPrefix2);
|
|
1576
1628
|
if (result.className) {
|
|
@@ -1585,7 +1637,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
1585
1637
|
if (result.className) {
|
|
1586
1638
|
classes.push(result.className);
|
|
1587
1639
|
}
|
|
1588
|
-
} else if (typeof nestedValue === "object"
|
|
1640
|
+
} else if (typeof nestedValue === "object") {
|
|
1589
1641
|
const nestedPrefix2 = `${prefix}${mappedKey}/${nestedKey}:`;
|
|
1590
1642
|
const result = transform(nestedValue, nestedPrefix2);
|
|
1591
1643
|
if (result.className) {
|
|
@@ -2199,7 +2251,7 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
2199
2251
|
if (!FRACTION_SUPPORTED_PROPS.has(rawKey)) {
|
|
2200
2252
|
finalValue = `[${finalValue}]`;
|
|
2201
2253
|
}
|
|
2202
|
-
} else if (key === "aspect" &&
|
|
2254
|
+
} else if (key === "aspect" && /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/.test(finalValue)) {
|
|
2203
2255
|
if (finalValue === "auto" || finalValue === "square" || finalValue === "video" || /^\d+\/\d+$/.test(finalValue)) ; else {
|
|
2204
2256
|
finalValue = `[${finalValue}]`;
|
|
2205
2257
|
}
|
|
@@ -2218,19 +2270,22 @@ function transform(szProp, prefix = "", mangleMap) {
|
|
|
2218
2270
|
}
|
|
2219
2271
|
}
|
|
2220
2272
|
let mergedClasses = classes;
|
|
2221
|
-
const
|
|
2222
|
-
const
|
|
2273
|
+
const textSizeBaseRe = /^text-(xs|sm|base|lg|[2-9]?xl|\[[^\]]+\]|\([^)]+\))$/;
|
|
2274
|
+
const leadingBaseRe = /^leading-(.+)$/;
|
|
2223
2275
|
const textEntries = [];
|
|
2224
2276
|
const leadingEntries = [];
|
|
2225
2277
|
for (let i = 0; i < classes.length; i++) {
|
|
2226
2278
|
const cls = classes[i];
|
|
2227
|
-
const
|
|
2279
|
+
const lastColon = cls.lastIndexOf(":");
|
|
2280
|
+
const prefix2 = lastColon === -1 ? "" : cls.slice(0, lastColon + 1);
|
|
2281
|
+
const base = lastColon === -1 ? cls : cls.slice(lastColon + 1);
|
|
2282
|
+
const tm = textSizeBaseRe.exec(base);
|
|
2228
2283
|
if (tm) {
|
|
2229
|
-
textEntries.push({ index: i, prefix:
|
|
2284
|
+
textEntries.push({ index: i, prefix: prefix2, size: tm[1] });
|
|
2230
2285
|
}
|
|
2231
|
-
const lm =
|
|
2286
|
+
const lm = leadingBaseRe.exec(base);
|
|
2232
2287
|
if (lm) {
|
|
2233
|
-
leadingEntries.push({ index: i, prefix:
|
|
2288
|
+
leadingEntries.push({ index: i, prefix: prefix2, value: lm[1] });
|
|
2234
2289
|
}
|
|
2235
2290
|
}
|
|
2236
2291
|
if (textEntries.length > 0 && leadingEntries.length > 0) {
|
package/dist/transform-core.cjs
CHANGED
package/dist/transform-core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BOOLEAN_SHORTHANDS, K as KNOWN_VARIANTS, P as PROPERTY_MAP, S as SUGGESTION_MAP, V as VARIANT_MAP, b as getVariantPrefix, i as isValidSzProp, e as normalizeArbitraryValue, f as normalizeArbitraryVariant, n as normalizeClassName, t as transform } from './shared/compiler.
|
|
1
|
+
export { B as BOOLEAN_SHORTHANDS, K as KNOWN_VARIANTS, P as PROPERTY_MAP, S as SUGGESTION_MAP, V as VARIANT_MAP, b as getVariantPrefix, i as isValidSzProp, e as normalizeArbitraryValue, f as normalizeArbitraryVariant, n as normalizeClassName, t as transform } from './shared/compiler.CIBwOKUt.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Core compiler and transformation logic for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@babel/types": "^7.23.6",
|
|
66
66
|
"magic-string": "0.30.21",
|
|
67
67
|
"oxc-parser": "0.131.0",
|
|
68
|
-
"@csszyx/core": "0.
|
|
68
|
+
"@csszyx/core": "0.9.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/babel__core": "^7.20.5",
|