@unocss/core 66.1.0-beta.8 → 66.1.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 +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.mjs +20 -8
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -210,7 +210,12 @@ type FlatObjectTuple<T> = {
|
|
|
210
210
|
type PartialByKeys<T, K extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
|
|
211
211
|
type RequiredByKey<T, K extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
|
|
212
212
|
type CSSObject = Record<string, string | number | undefined>;
|
|
213
|
-
|
|
213
|
+
/**
|
|
214
|
+
* [property, value, operators?]
|
|
215
|
+
*
|
|
216
|
+
* - operators: Used to perform specific operations on value or property.
|
|
217
|
+
*/
|
|
218
|
+
type CSSEntry = [string, string | number | undefined, Arrayable<string>?];
|
|
214
219
|
type CSSEntries = CSSEntry[];
|
|
215
220
|
type CSSObjectInput = CSSObject | Partial<ControlSymbolsValue>;
|
|
216
221
|
type CSSEntriesInput = (CSSEntry | ControlSymbolsEntry)[];
|
|
@@ -265,6 +270,7 @@ interface RuleContext<Theme extends object = object> {
|
|
|
265
270
|
variants?: Variant<Theme>[];
|
|
266
271
|
}
|
|
267
272
|
declare const SymbolShortcutsNoMerge: unique symbol;
|
|
273
|
+
declare const SymbolNoMerge: unique symbol;
|
|
268
274
|
declare const SymbolVariants: unique symbol;
|
|
269
275
|
declare const SymbolParent: unique symbol;
|
|
270
276
|
declare const SymbolSelector: unique symbol;
|
|
@@ -275,6 +281,10 @@ interface ControlSymbols {
|
|
|
275
281
|
* Prevent merging in shortcuts
|
|
276
282
|
*/
|
|
277
283
|
shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
|
|
284
|
+
/**
|
|
285
|
+
* Prevent merging in rules
|
|
286
|
+
*/
|
|
287
|
+
noMerge: typeof SymbolNoMerge;
|
|
278
288
|
/**
|
|
279
289
|
* Additional variants applied to this rule
|
|
280
290
|
*/
|
|
@@ -298,7 +308,8 @@ interface ControlSymbols {
|
|
|
298
308
|
}
|
|
299
309
|
interface ControlSymbolsValue {
|
|
300
310
|
[SymbolShortcutsNoMerge]: true;
|
|
301
|
-
[
|
|
311
|
+
[SymbolNoMerge]: true;
|
|
312
|
+
[SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
|
|
302
313
|
[SymbolParent]: string;
|
|
303
314
|
[SymbolSelector]: (selector: string) => string;
|
|
304
315
|
[SymbolLayer]: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -210,7 +210,12 @@ type FlatObjectTuple<T> = {
|
|
|
210
210
|
type PartialByKeys<T, K extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
|
|
211
211
|
type RequiredByKey<T, K extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
|
|
212
212
|
type CSSObject = Record<string, string | number | undefined>;
|
|
213
|
-
|
|
213
|
+
/**
|
|
214
|
+
* [property, value, operators?]
|
|
215
|
+
*
|
|
216
|
+
* - operators: Used to perform specific operations on value or property.
|
|
217
|
+
*/
|
|
218
|
+
type CSSEntry = [string, string | number | undefined, Arrayable<string>?];
|
|
214
219
|
type CSSEntries = CSSEntry[];
|
|
215
220
|
type CSSObjectInput = CSSObject | Partial<ControlSymbolsValue>;
|
|
216
221
|
type CSSEntriesInput = (CSSEntry | ControlSymbolsEntry)[];
|
|
@@ -265,6 +270,7 @@ interface RuleContext<Theme extends object = object> {
|
|
|
265
270
|
variants?: Variant<Theme>[];
|
|
266
271
|
}
|
|
267
272
|
declare const SymbolShortcutsNoMerge: unique symbol;
|
|
273
|
+
declare const SymbolNoMerge: unique symbol;
|
|
268
274
|
declare const SymbolVariants: unique symbol;
|
|
269
275
|
declare const SymbolParent: unique symbol;
|
|
270
276
|
declare const SymbolSelector: unique symbol;
|
|
@@ -275,6 +281,10 @@ interface ControlSymbols {
|
|
|
275
281
|
* Prevent merging in shortcuts
|
|
276
282
|
*/
|
|
277
283
|
shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
|
|
284
|
+
/**
|
|
285
|
+
* Prevent merging in rules
|
|
286
|
+
*/
|
|
287
|
+
noMerge: typeof SymbolNoMerge;
|
|
278
288
|
/**
|
|
279
289
|
* Additional variants applied to this rule
|
|
280
290
|
*/
|
|
@@ -298,7 +308,8 @@ interface ControlSymbols {
|
|
|
298
308
|
}
|
|
299
309
|
interface ControlSymbolsValue {
|
|
300
310
|
[SymbolShortcutsNoMerge]: true;
|
|
301
|
-
[
|
|
311
|
+
[SymbolNoMerge]: true;
|
|
312
|
+
[SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
|
|
302
313
|
[SymbolParent]: string;
|
|
303
314
|
[SymbolSelector]: (selector: string) => string;
|
|
304
315
|
[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
|
|
660
|
+
const version = "66.1.0";
|
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.1.0
|
|
4
|
+
"version": "66.1.0",
|
|
5
5
|
"description": "The instant on-demand Atomic CSS engine.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"magic-string": "^0.30.17",
|
|
41
|
-
"unconfig": "^7.3.
|
|
41
|
+
"unconfig": "^7.3.2"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild",
|