@unocss/core 0.46.0 → 0.46.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.cjs +11 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +11 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -416,7 +416,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
const version = "0.46.
|
|
419
|
+
const version = "0.46.1";
|
|
420
420
|
|
|
421
421
|
class UnoGenerator {
|
|
422
422
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -704,7 +704,7 @@ class UnoGenerator {
|
|
|
704
704
|
return `${parent}{${cssBody}}`;
|
|
705
705
|
return cssBody;
|
|
706
706
|
}
|
|
707
|
-
async parseUtil(input, context, internal = false) {
|
|
707
|
+
async parseUtil(input, context, internal = false, shortcutPrefix = void 0) {
|
|
708
708
|
const [raw, processed, variantHandlers] = isString(input) ? this.matchVariants(input) : input;
|
|
709
709
|
if (this.config.details)
|
|
710
710
|
context.rules = context.rules ?? [];
|
|
@@ -729,9 +729,14 @@ class UnoGenerator {
|
|
|
729
729
|
continue;
|
|
730
730
|
let unprefixed = processed;
|
|
731
731
|
if (meta?.prefix) {
|
|
732
|
-
if (
|
|
733
|
-
|
|
734
|
-
|
|
732
|
+
if (shortcutPrefix) {
|
|
733
|
+
if (shortcutPrefix !== meta.prefix)
|
|
734
|
+
continue;
|
|
735
|
+
} else {
|
|
736
|
+
if (!processed.startsWith(meta.prefix))
|
|
737
|
+
continue;
|
|
738
|
+
unprefixed = processed.slice(meta.prefix.length);
|
|
739
|
+
}
|
|
735
740
|
}
|
|
736
741
|
const match = unprefixed.match(matcher);
|
|
737
742
|
if (!match)
|
|
@@ -818,7 +823,7 @@ class UnoGenerator {
|
|
|
818
823
|
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
819
824
|
const selectorMap = new TwoKeyMap();
|
|
820
825
|
const parsed = (await Promise.all(uniq(expanded).map(async (i) => {
|
|
821
|
-
const result = isString(i) ? await this.parseUtil(i, context, true) : [[Infinity, "{inline}", normalizeCSSEntries(i), void 0, []]];
|
|
826
|
+
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Infinity, "{inline}", normalizeCSSEntries(i), void 0, []]];
|
|
822
827
|
if (!result)
|
|
823
828
|
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
824
829
|
return result || [];
|
package/dist/index.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ declare class UnoGenerator {
|
|
|
71
71
|
matchVariants(raw: string, current?: string): VariantMatchedResult;
|
|
72
72
|
private applyVariants;
|
|
73
73
|
constructCustomCSS(context: Readonly<RuleContext>, body: CSSObject | CSSEntries, overrideSelector?: string): string;
|
|
74
|
-
parseUtil(input: string | VariantMatchedResult, context: RuleContext, internal?: boolean): Promise<(ParsedUtil | RawUtil)[] | undefined>;
|
|
74
|
+
parseUtil(input: string | VariantMatchedResult, context: RuleContext, internal?: boolean, shortcutPrefix?: string | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
|
|
75
75
|
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext): StringifiedUtil | undefined;
|
|
76
76
|
expandShortcut(input: string, context: RuleContext, depth?: number): [ShortcutValue[], RuleMeta | undefined] | undefined;
|
|
77
77
|
stringifyShortcuts(parent: VariantMatchedResult, context: RuleContext, expanded: ShortcutValue[], meta?: RuleMeta): Promise<StringifiedUtil[] | undefined>;
|
package/dist/index.mjs
CHANGED
|
@@ -412,7 +412,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
const version = "0.46.
|
|
415
|
+
const version = "0.46.1";
|
|
416
416
|
|
|
417
417
|
class UnoGenerator {
|
|
418
418
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -700,7 +700,7 @@ class UnoGenerator {
|
|
|
700
700
|
return `${parent}{${cssBody}}`;
|
|
701
701
|
return cssBody;
|
|
702
702
|
}
|
|
703
|
-
async parseUtil(input, context, internal = false) {
|
|
703
|
+
async parseUtil(input, context, internal = false, shortcutPrefix = void 0) {
|
|
704
704
|
const [raw, processed, variantHandlers] = isString(input) ? this.matchVariants(input) : input;
|
|
705
705
|
if (this.config.details)
|
|
706
706
|
context.rules = context.rules ?? [];
|
|
@@ -725,9 +725,14 @@ class UnoGenerator {
|
|
|
725
725
|
continue;
|
|
726
726
|
let unprefixed = processed;
|
|
727
727
|
if (meta?.prefix) {
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
|
|
728
|
+
if (shortcutPrefix) {
|
|
729
|
+
if (shortcutPrefix !== meta.prefix)
|
|
730
|
+
continue;
|
|
731
|
+
} else {
|
|
732
|
+
if (!processed.startsWith(meta.prefix))
|
|
733
|
+
continue;
|
|
734
|
+
unprefixed = processed.slice(meta.prefix.length);
|
|
735
|
+
}
|
|
731
736
|
}
|
|
732
737
|
const match = unprefixed.match(matcher);
|
|
733
738
|
if (!match)
|
|
@@ -814,7 +819,7 @@ class UnoGenerator {
|
|
|
814
819
|
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
815
820
|
const selectorMap = new TwoKeyMap();
|
|
816
821
|
const parsed = (await Promise.all(uniq(expanded).map(async (i) => {
|
|
817
|
-
const result = isString(i) ? await this.parseUtil(i, context, true) : [[Infinity, "{inline}", normalizeCSSEntries(i), void 0, []]];
|
|
822
|
+
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Infinity, "{inline}", normalizeCSSEntries(i), void 0, []]];
|
|
818
823
|
if (!result)
|
|
819
824
|
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
820
825
|
return result || [];
|