@unocss/core 0.56.1 → 0.56.2
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.cjs +26 -37
- package/dist/index.mjs +26 -37
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -220,11 +220,9 @@ class TwoKeyMap {
|
|
|
220
220
|
return this._map.delete(key1);
|
|
221
221
|
}
|
|
222
222
|
map(fn) {
|
|
223
|
-
return Array.from(this._map.entries()).flatMap(
|
|
224
|
-
(
|
|
225
|
-
|
|
226
|
-
})
|
|
227
|
-
);
|
|
223
|
+
return Array.from(this._map.entries()).flatMap(([k1, m2]) => Array.from(m2.entries()).map(([k2, v]) => {
|
|
224
|
+
return fn(v, k1, k2);
|
|
225
|
+
}));
|
|
228
226
|
}
|
|
229
227
|
}
|
|
230
228
|
class BetterMap extends Map {
|
|
@@ -573,29 +571,26 @@ function mergeThemes(themes) {
|
|
|
573
571
|
return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
|
|
574
572
|
}
|
|
575
573
|
function mergeAutocompleteShorthands(shorthands) {
|
|
576
|
-
return shorthands.reduce(
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
},
|
|
591
|
-
{}
|
|
592
|
-
);
|
|
574
|
+
return shorthands.reduce((a, b) => {
|
|
575
|
+
const rs = {};
|
|
576
|
+
for (const key in b) {
|
|
577
|
+
const value = b[key];
|
|
578
|
+
if (Array.isArray(value))
|
|
579
|
+
rs[key] = `(${value.join("|")})`;
|
|
580
|
+
else
|
|
581
|
+
rs[key] = value;
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
...a,
|
|
585
|
+
...rs
|
|
586
|
+
};
|
|
587
|
+
}, {});
|
|
593
588
|
}
|
|
594
589
|
function definePreset(preset) {
|
|
595
590
|
return preset;
|
|
596
591
|
}
|
|
597
592
|
|
|
598
|
-
const version = "0.56.
|
|
593
|
+
const version = "0.56.2";
|
|
599
594
|
|
|
600
595
|
var __defProp = Object.defineProperty;
|
|
601
596
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -767,18 +762,16 @@ class UnoGenerator {
|
|
|
767
762
|
))
|
|
768
763
|
);
|
|
769
764
|
})();
|
|
770
|
-
const layers = this.config.sortLayers(
|
|
771
|
-
Array.from(layerSet).sort((a, b) => (this.config.layers[a] ?? 0) - (this.config.layers[b] ?? 0) || a.localeCompare(b))
|
|
772
|
-
);
|
|
765
|
+
const layers = this.config.sortLayers(Array.from(layerSet).sort((a, b) => (this.config.layers[a] ?? 0) - (this.config.layers[b] ?? 0) || a.localeCompare(b)));
|
|
773
766
|
const layerCache = {};
|
|
774
767
|
const getLayer = (layer) => {
|
|
775
768
|
if (layerCache[layer])
|
|
776
769
|
return layerCache[layer];
|
|
777
770
|
let css = Array.from(sheet).sort((a, b) => (this.parentOrders.get(a[0]) ?? 0) - (this.parentOrders.get(b[0]) ?? 0) || a[0]?.localeCompare(b[0] || "") || 0).map(([parent, items]) => {
|
|
778
771
|
const size = items.length;
|
|
779
|
-
const sorted = items.filter((i) => (i[4]?.layer || LAYER_DEFAULT) === layer).sort(
|
|
780
|
-
|
|
781
|
-
).map(([, selector, body, , meta, , variantNoMerge]) => {
|
|
772
|
+
const sorted = items.filter((i) => (i[4]?.layer || LAYER_DEFAULT) === layer).sort((a, b) => {
|
|
773
|
+
return a[0] - b[0] || (a[4]?.sort || 0) - (b[4]?.sort || 0) || a[5]?.currentSelector?.localeCompare(b[5]?.currentSelector ?? "") || a[1]?.localeCompare(b[1] || "") || a[2]?.localeCompare(b[2] || "") || 0;
|
|
774
|
+
}).map(([, selector, body, , meta, , variantNoMerge]) => {
|
|
782
775
|
const scopedSelector = selector ? applyScope(selector, scope) : selector;
|
|
783
776
|
return [
|
|
784
777
|
[[scopedSelector ?? "", meta?.sort ?? 0]],
|
|
@@ -799,9 +792,7 @@ class UnoGenerator {
|
|
|
799
792
|
}
|
|
800
793
|
}
|
|
801
794
|
}
|
|
802
|
-
const selectors = selectorSortPair ? uniq(
|
|
803
|
-
selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)
|
|
804
|
-
) : [];
|
|
795
|
+
const selectors = selectorSortPair ? uniq(selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)) : [];
|
|
805
796
|
return selectors.length ? `${selectors.join(`,${nl}`)}{${body}}` : body;
|
|
806
797
|
}).filter(Boolean).reverse().join(nl);
|
|
807
798
|
if (!parent)
|
|
@@ -832,13 +823,13 @@ class UnoGenerator {
|
|
|
832
823
|
const variants = /* @__PURE__ */ new Set();
|
|
833
824
|
const handlers = [];
|
|
834
825
|
let processed = current || raw;
|
|
835
|
-
let applied =
|
|
826
|
+
let applied = true;
|
|
836
827
|
const context = {
|
|
837
828
|
rawSelector: raw,
|
|
838
829
|
theme: this.config.theme,
|
|
839
830
|
generator: this
|
|
840
831
|
};
|
|
841
|
-
while (
|
|
832
|
+
while (applied) {
|
|
842
833
|
applied = false;
|
|
843
834
|
for (const v of this.config.variants) {
|
|
844
835
|
if (!v.multiPass && variants.has(v))
|
|
@@ -1038,9 +1029,7 @@ class UnoGenerator {
|
|
|
1038
1029
|
if (!result)
|
|
1039
1030
|
return;
|
|
1040
1031
|
return [
|
|
1041
|
-
(await Promise.all(result.map(
|
|
1042
|
-
async (r) => (isString(r) ? (await this.expandShortcut(r, context, depth - 1))?.[0] : void 0) || [r]
|
|
1043
|
-
))).flat(1).filter(Boolean),
|
|
1032
|
+
(await Promise.all(result.map(async (r) => (isString(r) ? (await this.expandShortcut(r, context, depth - 1))?.[0] : void 0) || [r]))).flat(1).filter(Boolean),
|
|
1044
1033
|
meta
|
|
1045
1034
|
];
|
|
1046
1035
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -218,11 +218,9 @@ class TwoKeyMap {
|
|
|
218
218
|
return this._map.delete(key1);
|
|
219
219
|
}
|
|
220
220
|
map(fn) {
|
|
221
|
-
return Array.from(this._map.entries()).flatMap(
|
|
222
|
-
(
|
|
223
|
-
|
|
224
|
-
})
|
|
225
|
-
);
|
|
221
|
+
return Array.from(this._map.entries()).flatMap(([k1, m2]) => Array.from(m2.entries()).map(([k2, v]) => {
|
|
222
|
+
return fn(v, k1, k2);
|
|
223
|
+
}));
|
|
226
224
|
}
|
|
227
225
|
}
|
|
228
226
|
class BetterMap extends Map {
|
|
@@ -571,29 +569,26 @@ function mergeThemes(themes) {
|
|
|
571
569
|
return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
|
|
572
570
|
}
|
|
573
571
|
function mergeAutocompleteShorthands(shorthands) {
|
|
574
|
-
return shorthands.reduce(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
{}
|
|
590
|
-
);
|
|
572
|
+
return shorthands.reduce((a, b) => {
|
|
573
|
+
const rs = {};
|
|
574
|
+
for (const key in b) {
|
|
575
|
+
const value = b[key];
|
|
576
|
+
if (Array.isArray(value))
|
|
577
|
+
rs[key] = `(${value.join("|")})`;
|
|
578
|
+
else
|
|
579
|
+
rs[key] = value;
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
...a,
|
|
583
|
+
...rs
|
|
584
|
+
};
|
|
585
|
+
}, {});
|
|
591
586
|
}
|
|
592
587
|
function definePreset(preset) {
|
|
593
588
|
return preset;
|
|
594
589
|
}
|
|
595
590
|
|
|
596
|
-
const version = "0.56.
|
|
591
|
+
const version = "0.56.2";
|
|
597
592
|
|
|
598
593
|
var __defProp = Object.defineProperty;
|
|
599
594
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -765,18 +760,16 @@ class UnoGenerator {
|
|
|
765
760
|
))
|
|
766
761
|
);
|
|
767
762
|
})();
|
|
768
|
-
const layers = this.config.sortLayers(
|
|
769
|
-
Array.from(layerSet).sort((a, b) => (this.config.layers[a] ?? 0) - (this.config.layers[b] ?? 0) || a.localeCompare(b))
|
|
770
|
-
);
|
|
763
|
+
const layers = this.config.sortLayers(Array.from(layerSet).sort((a, b) => (this.config.layers[a] ?? 0) - (this.config.layers[b] ?? 0) || a.localeCompare(b)));
|
|
771
764
|
const layerCache = {};
|
|
772
765
|
const getLayer = (layer) => {
|
|
773
766
|
if (layerCache[layer])
|
|
774
767
|
return layerCache[layer];
|
|
775
768
|
let css = Array.from(sheet).sort((a, b) => (this.parentOrders.get(a[0]) ?? 0) - (this.parentOrders.get(b[0]) ?? 0) || a[0]?.localeCompare(b[0] || "") || 0).map(([parent, items]) => {
|
|
776
769
|
const size = items.length;
|
|
777
|
-
const sorted = items.filter((i) => (i[4]?.layer || LAYER_DEFAULT) === layer).sort(
|
|
778
|
-
|
|
779
|
-
).map(([, selector, body, , meta, , variantNoMerge]) => {
|
|
770
|
+
const sorted = items.filter((i) => (i[4]?.layer || LAYER_DEFAULT) === layer).sort((a, b) => {
|
|
771
|
+
return a[0] - b[0] || (a[4]?.sort || 0) - (b[4]?.sort || 0) || a[5]?.currentSelector?.localeCompare(b[5]?.currentSelector ?? "") || a[1]?.localeCompare(b[1] || "") || a[2]?.localeCompare(b[2] || "") || 0;
|
|
772
|
+
}).map(([, selector, body, , meta, , variantNoMerge]) => {
|
|
780
773
|
const scopedSelector = selector ? applyScope(selector, scope) : selector;
|
|
781
774
|
return [
|
|
782
775
|
[[scopedSelector ?? "", meta?.sort ?? 0]],
|
|
@@ -797,9 +790,7 @@ class UnoGenerator {
|
|
|
797
790
|
}
|
|
798
791
|
}
|
|
799
792
|
}
|
|
800
|
-
const selectors = selectorSortPair ? uniq(
|
|
801
|
-
selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)
|
|
802
|
-
) : [];
|
|
793
|
+
const selectors = selectorSortPair ? uniq(selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)) : [];
|
|
803
794
|
return selectors.length ? `${selectors.join(`,${nl}`)}{${body}}` : body;
|
|
804
795
|
}).filter(Boolean).reverse().join(nl);
|
|
805
796
|
if (!parent)
|
|
@@ -830,13 +821,13 @@ class UnoGenerator {
|
|
|
830
821
|
const variants = /* @__PURE__ */ new Set();
|
|
831
822
|
const handlers = [];
|
|
832
823
|
let processed = current || raw;
|
|
833
|
-
let applied =
|
|
824
|
+
let applied = true;
|
|
834
825
|
const context = {
|
|
835
826
|
rawSelector: raw,
|
|
836
827
|
theme: this.config.theme,
|
|
837
828
|
generator: this
|
|
838
829
|
};
|
|
839
|
-
while (
|
|
830
|
+
while (applied) {
|
|
840
831
|
applied = false;
|
|
841
832
|
for (const v of this.config.variants) {
|
|
842
833
|
if (!v.multiPass && variants.has(v))
|
|
@@ -1036,9 +1027,7 @@ class UnoGenerator {
|
|
|
1036
1027
|
if (!result)
|
|
1037
1028
|
return;
|
|
1038
1029
|
return [
|
|
1039
|
-
(await Promise.all(result.map(
|
|
1040
|
-
async (r) => (isString(r) ? (await this.expandShortcut(r, context, depth - 1))?.[0] : void 0) || [r]
|
|
1041
|
-
))).flat(1).filter(Boolean),
|
|
1030
|
+
(await Promise.all(result.map(async (r) => (isString(r) ? (await this.expandShortcut(r, context, depth - 1))?.[0] : void 0) || [r]))).flat(1).filter(Boolean),
|
|
1042
1031
|
meta
|
|
1043
1032
|
];
|
|
1044
1033
|
}
|