@unocss/core 66.1.0-beta.8 → 66.1.0-beta.9
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 +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +20 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -265,6 +265,7 @@ interface RuleContext<Theme extends object = object> {
|
|
|
265
265
|
variants?: Variant<Theme>[];
|
|
266
266
|
}
|
|
267
267
|
declare const SymbolShortcutsNoMerge: unique symbol;
|
|
268
|
+
declare const SymbolNoMerge: unique symbol;
|
|
268
269
|
declare const SymbolVariants: unique symbol;
|
|
269
270
|
declare const SymbolParent: unique symbol;
|
|
270
271
|
declare const SymbolSelector: unique symbol;
|
|
@@ -275,6 +276,10 @@ interface ControlSymbols {
|
|
|
275
276
|
* Prevent merging in shortcuts
|
|
276
277
|
*/
|
|
277
278
|
shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
|
|
279
|
+
/**
|
|
280
|
+
* Prevent merging in rules
|
|
281
|
+
*/
|
|
282
|
+
noMerge: typeof SymbolNoMerge;
|
|
278
283
|
/**
|
|
279
284
|
* Additional variants applied to this rule
|
|
280
285
|
*/
|
|
@@ -298,7 +303,8 @@ interface ControlSymbols {
|
|
|
298
303
|
}
|
|
299
304
|
interface ControlSymbolsValue {
|
|
300
305
|
[SymbolShortcutsNoMerge]: true;
|
|
301
|
-
[
|
|
306
|
+
[SymbolNoMerge]: true;
|
|
307
|
+
[SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
|
|
302
308
|
[SymbolParent]: string;
|
|
303
309
|
[SymbolSelector]: (selector: string) => string;
|
|
304
310
|
[SymbolLayer]: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ interface RuleContext<Theme extends object = object> {
|
|
|
265
265
|
variants?: Variant<Theme>[];
|
|
266
266
|
}
|
|
267
267
|
declare const SymbolShortcutsNoMerge: unique symbol;
|
|
268
|
+
declare const SymbolNoMerge: unique symbol;
|
|
268
269
|
declare const SymbolVariants: unique symbol;
|
|
269
270
|
declare const SymbolParent: unique symbol;
|
|
270
271
|
declare const SymbolSelector: unique symbol;
|
|
@@ -275,6 +276,10 @@ interface ControlSymbols {
|
|
|
275
276
|
* Prevent merging in shortcuts
|
|
276
277
|
*/
|
|
277
278
|
shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
|
|
279
|
+
/**
|
|
280
|
+
* Prevent merging in rules
|
|
281
|
+
*/
|
|
282
|
+
noMerge: typeof SymbolNoMerge;
|
|
278
283
|
/**
|
|
279
284
|
* Additional variants applied to this rule
|
|
280
285
|
*/
|
|
@@ -298,7 +303,8 @@ interface ControlSymbols {
|
|
|
298
303
|
}
|
|
299
304
|
interface ControlSymbolsValue {
|
|
300
305
|
[SymbolShortcutsNoMerge]: true;
|
|
301
|
-
[
|
|
306
|
+
[SymbolNoMerge]: true;
|
|
307
|
+
[SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
|
|
302
308
|
[SymbolParent]: string;
|
|
303
309
|
[SymbolSelector]: (selector: string) => string;
|
|
304
310
|
[SymbolLayer]: string;
|
package/dist/index.mjs
CHANGED
|
@@ -657,10 +657,11 @@ function definePreset(preset) {
|
|
|
657
657
|
return preset;
|
|
658
658
|
}
|
|
659
659
|
|
|
660
|
-
const version = "66.1.0-beta.
|
|
660
|
+
const version = "66.1.0-beta.9";
|
|
661
661
|
|
|
662
662
|
const symbols = {
|
|
663
663
|
shortcutsNoMerge: "$$symbol-shortcut-no-merge",
|
|
664
|
+
noMerge: "$$symbol-no-merge",
|
|
664
665
|
variants: "$$symbol-variants",
|
|
665
666
|
parent: "$$symbol-parent",
|
|
666
667
|
selector: "$$symbol-selector",
|
|
@@ -874,7 +875,7 @@ class UnoGeneratorInternal {
|
|
|
874
875
|
});
|
|
875
876
|
if (!sorted.length)
|
|
876
877
|
return void 0;
|
|
877
|
-
const
|
|
878
|
+
const ruleLines = sorted.reverse().map(([selectorSortPair, body, noMerge], idx) => {
|
|
878
879
|
if (!noMerge && this.config.mergeSelectors) {
|
|
879
880
|
for (let i = idx + 1; i < size; i++) {
|
|
880
881
|
const current = sorted[i];
|
|
@@ -887,7 +888,8 @@ class UnoGeneratorInternal {
|
|
|
887
888
|
}
|
|
888
889
|
const selectors = selectorSortPair ? uniq(selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)) : [];
|
|
889
890
|
return selectors.length ? `${selectors.join(`,${nl}`)}{${body}}` : body;
|
|
890
|
-
}).filter(Boolean)
|
|
891
|
+
}).filter(Boolean);
|
|
892
|
+
const rules = Array.from(new Set(ruleLines)).reverse().join(nl);
|
|
891
893
|
if (!parent)
|
|
892
894
|
return rules;
|
|
893
895
|
const parents = parent.split(" $$ ");
|
|
@@ -995,10 +997,11 @@ class UnoGeneratorInternal {
|
|
|
995
997
|
(previous, v) => (input) => {
|
|
996
998
|
const entries = v.body?.(input.entries) || input.entries;
|
|
997
999
|
const parents = Array.isArray(v.parent) ? v.parent : [v.parent, void 0];
|
|
1000
|
+
const selector = v.selector?.(input.selector, entries);
|
|
998
1001
|
return (v.handle ?? defaultVariantHandler)({
|
|
999
1002
|
...input,
|
|
1000
1003
|
entries,
|
|
1001
|
-
selector:
|
|
1004
|
+
selector: selector || input.selector,
|
|
1002
1005
|
parent: parents[0] || input.parent,
|
|
1003
1006
|
parentOrder: parents[1] || input.parentOrder,
|
|
1004
1007
|
layer: v.layer || input.layer,
|
|
@@ -1116,10 +1119,14 @@ class UnoGeneratorInternal {
|
|
|
1116
1119
|
let entryMeta = meta;
|
|
1117
1120
|
for (const entry of css) {
|
|
1118
1121
|
if (entry[0] === symbols.variants) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1122
|
+
if (typeof entry[1] === "function") {
|
|
1123
|
+
variants = entry[1](variants) || variants;
|
|
1124
|
+
} else {
|
|
1125
|
+
variants = [
|
|
1126
|
+
...toArray(entry[1]),
|
|
1127
|
+
...variants
|
|
1128
|
+
];
|
|
1129
|
+
}
|
|
1123
1130
|
} else if (entry[0] === symbols.parent) {
|
|
1124
1131
|
variants = [
|
|
1125
1132
|
{ parent: entry[1] },
|
|
@@ -1140,6 +1147,11 @@ class UnoGeneratorInternal {
|
|
|
1140
1147
|
...entryMeta,
|
|
1141
1148
|
sort: entry[1]
|
|
1142
1149
|
};
|
|
1150
|
+
} else if (entry[0] === symbols.noMerge) {
|
|
1151
|
+
entryMeta = {
|
|
1152
|
+
...entryMeta,
|
|
1153
|
+
noMerge: entry[1]
|
|
1154
|
+
};
|
|
1143
1155
|
}
|
|
1144
1156
|
}
|
|
1145
1157
|
return [index, raw, css, entryMeta, variants];
|
package/package.json
CHANGED