@unocss/core 0.62.4 → 0.63.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/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +15 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -240,6 +240,7 @@ declare const SymbolShortcutsNoMerge: unique symbol;
|
|
|
240
240
|
declare const SymbolVariants: unique symbol;
|
|
241
241
|
declare const SymbolParent: unique symbol;
|
|
242
242
|
declare const SymbolSelector: unique symbol;
|
|
243
|
+
declare const SymbolLayer: unique symbol;
|
|
243
244
|
interface ControlSymbols {
|
|
244
245
|
/**
|
|
245
246
|
* Prevent merging in shortcuts
|
|
@@ -257,12 +258,17 @@ interface ControlSymbols {
|
|
|
257
258
|
* Selector modifier
|
|
258
259
|
*/
|
|
259
260
|
selector: typeof SymbolSelector;
|
|
261
|
+
/**
|
|
262
|
+
* Layer modifier
|
|
263
|
+
*/
|
|
264
|
+
layer: typeof SymbolLayer;
|
|
260
265
|
}
|
|
261
266
|
interface ControlSymbolsValue {
|
|
262
267
|
[SymbolShortcutsNoMerge]: true;
|
|
263
268
|
[SymbolVariants]: VariantHandler[];
|
|
264
269
|
[SymbolParent]: string;
|
|
265
270
|
[SymbolSelector]: (selector: string) => string;
|
|
271
|
+
[SymbolLayer]: string;
|
|
266
272
|
}
|
|
267
273
|
type ObjectToEntry<T> = {
|
|
268
274
|
[K in keyof T]: [K, T[K]];
|
|
@@ -686,6 +692,10 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
|
|
|
686
692
|
* Apply layer to all utilities and shortcuts
|
|
687
693
|
*/
|
|
688
694
|
layer?: string;
|
|
695
|
+
/**
|
|
696
|
+
* Custom API endpoint for cross-preset communication
|
|
697
|
+
*/
|
|
698
|
+
api?: any;
|
|
689
699
|
}
|
|
690
700
|
type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
|
|
691
701
|
type PresetOrFactory<Theme extends object = object> = Preset<Theme> | PresetFactory<Theme, any>;
|
|
@@ -918,6 +928,7 @@ interface GenerateResult<T = Set<string>> {
|
|
|
918
928
|
layers: string[];
|
|
919
929
|
getLayer: (name?: string) => string | undefined;
|
|
920
930
|
getLayers: (includes?: string[], excludes?: string[]) => string;
|
|
931
|
+
setLayer: (layer: string, callback: (content: string) => Promise<string>) => Promise<string>;
|
|
921
932
|
matched: T;
|
|
922
933
|
}
|
|
923
934
|
type VariantMatchedResult<Theme extends object = object> = readonly [
|
package/dist/index.d.ts
CHANGED
|
@@ -240,6 +240,7 @@ declare const SymbolShortcutsNoMerge: unique symbol;
|
|
|
240
240
|
declare const SymbolVariants: unique symbol;
|
|
241
241
|
declare const SymbolParent: unique symbol;
|
|
242
242
|
declare const SymbolSelector: unique symbol;
|
|
243
|
+
declare const SymbolLayer: unique symbol;
|
|
243
244
|
interface ControlSymbols {
|
|
244
245
|
/**
|
|
245
246
|
* Prevent merging in shortcuts
|
|
@@ -257,12 +258,17 @@ interface ControlSymbols {
|
|
|
257
258
|
* Selector modifier
|
|
258
259
|
*/
|
|
259
260
|
selector: typeof SymbolSelector;
|
|
261
|
+
/**
|
|
262
|
+
* Layer modifier
|
|
263
|
+
*/
|
|
264
|
+
layer: typeof SymbolLayer;
|
|
260
265
|
}
|
|
261
266
|
interface ControlSymbolsValue {
|
|
262
267
|
[SymbolShortcutsNoMerge]: true;
|
|
263
268
|
[SymbolVariants]: VariantHandler[];
|
|
264
269
|
[SymbolParent]: string;
|
|
265
270
|
[SymbolSelector]: (selector: string) => string;
|
|
271
|
+
[SymbolLayer]: string;
|
|
266
272
|
}
|
|
267
273
|
type ObjectToEntry<T> = {
|
|
268
274
|
[K in keyof T]: [K, T[K]];
|
|
@@ -686,6 +692,10 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
|
|
|
686
692
|
* Apply layer to all utilities and shortcuts
|
|
687
693
|
*/
|
|
688
694
|
layer?: string;
|
|
695
|
+
/**
|
|
696
|
+
* Custom API endpoint for cross-preset communication
|
|
697
|
+
*/
|
|
698
|
+
api?: any;
|
|
689
699
|
}
|
|
690
700
|
type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
|
|
691
701
|
type PresetOrFactory<Theme extends object = object> = Preset<Theme> | PresetFactory<Theme, any>;
|
|
@@ -918,6 +928,7 @@ interface GenerateResult<T = Set<string>> {
|
|
|
918
928
|
layers: string[];
|
|
919
929
|
getLayer: (name?: string) => string | undefined;
|
|
920
930
|
getLayers: (includes?: string[], excludes?: string[]) => string;
|
|
931
|
+
setLayer: (layer: string, callback: (content: string) => Promise<string>) => Promise<string>;
|
|
921
932
|
matched: T;
|
|
922
933
|
}
|
|
923
934
|
type VariantMatchedResult<Theme extends object = object> = readonly [
|
package/dist/index.mjs
CHANGED
|
@@ -626,7 +626,7 @@ function definePreset(preset) {
|
|
|
626
626
|
return preset;
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
-
const version = "0.
|
|
629
|
+
const version = "0.63.1";
|
|
630
630
|
|
|
631
631
|
function createNanoEvents() {
|
|
632
632
|
return {
|
|
@@ -651,7 +651,8 @@ const symbols = {
|
|
|
651
651
|
shortcutsNoMerge: "$$symbol-shortcut-no-merge",
|
|
652
652
|
variants: "$$symbol-variants",
|
|
653
653
|
parent: "$$symbol-parent",
|
|
654
|
-
selector: "$$symbol-selector"
|
|
654
|
+
selector: "$$symbol-selector",
|
|
655
|
+
layer: "$$symbol-layer"
|
|
655
656
|
};
|
|
656
657
|
class UnoGenerator {
|
|
657
658
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -878,6 +879,11 @@ class UnoGenerator {
|
|
|
878
879
|
const getLayers = (includes = layers, excludes) => {
|
|
879
880
|
return includes.filter((i) => !excludes?.includes(i)).map((i) => getLayer(i) || "").filter(Boolean).join(nl);
|
|
880
881
|
};
|
|
882
|
+
const setLayer = async (layer, callback) => {
|
|
883
|
+
const content = await callback(getLayer(layer));
|
|
884
|
+
layerCache[layer] = content;
|
|
885
|
+
return content;
|
|
886
|
+
};
|
|
881
887
|
return {
|
|
882
888
|
get css() {
|
|
883
889
|
return getLayers();
|
|
@@ -885,7 +891,8 @@ class UnoGenerator {
|
|
|
885
891
|
layers,
|
|
886
892
|
matched,
|
|
887
893
|
getLayers,
|
|
888
|
-
getLayer
|
|
894
|
+
getLayer,
|
|
895
|
+
setLayer
|
|
889
896
|
};
|
|
890
897
|
}
|
|
891
898
|
async matchVariants(raw, current) {
|
|
@@ -1055,6 +1062,11 @@ class UnoGenerator {
|
|
|
1055
1062
|
{ selector: entry[1] },
|
|
1056
1063
|
...variants
|
|
1057
1064
|
];
|
|
1065
|
+
} else if (entry[0] === symbols.layer) {
|
|
1066
|
+
variants = [
|
|
1067
|
+
{ layer: entry[1] },
|
|
1068
|
+
...variants
|
|
1069
|
+
];
|
|
1058
1070
|
}
|
|
1059
1071
|
}
|
|
1060
1072
|
return [i, raw, css, meta, variants];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.63.1",
|
|
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.11",
|
|
41
|
-
"unconfig": "^0.
|
|
41
|
+
"unconfig": "^0.6.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild",
|