@unocss/core 0.46.0 → 0.46.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 +18 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +18 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -282,7 +282,7 @@ function createValueHandler(handlers) {
|
|
|
282
282
|
return handler;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
const splitCode = (code) => [...new Set(code.split(/\\?[\s'"
|
|
285
|
+
const splitCode = (code) => [...new Set(code.split(/\\?[\s'"`;{}]+/g))].filter(isValidSelector);
|
|
286
286
|
const extractorSplit = {
|
|
287
287
|
name: "split",
|
|
288
288
|
order: 0,
|
|
@@ -416,7 +416,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
const version = "0.46.
|
|
419
|
+
const version = "0.46.2";
|
|
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)
|
|
@@ -779,7 +784,12 @@ class UnoGenerator {
|
|
|
779
784
|
let meta;
|
|
780
785
|
let result;
|
|
781
786
|
for (const s of this.config.shortcuts) {
|
|
782
|
-
|
|
787
|
+
let unprefixed = input;
|
|
788
|
+
if (s[2]?.prefix) {
|
|
789
|
+
if (!input.startsWith(s[2].prefix))
|
|
790
|
+
continue;
|
|
791
|
+
unprefixed = input.slice(s[2].prefix.length);
|
|
792
|
+
}
|
|
783
793
|
if (isStaticShortcut(s)) {
|
|
784
794
|
if (s[0] === unprefixed) {
|
|
785
795
|
meta = meta || s[2];
|
|
@@ -818,7 +828,7 @@ class UnoGenerator {
|
|
|
818
828
|
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
819
829
|
const selectorMap = new TwoKeyMap();
|
|
820
830
|
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, []]];
|
|
831
|
+
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Infinity, "{inline}", normalizeCSSEntries(i), void 0, []]];
|
|
822
832
|
if (!result)
|
|
823
833
|
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
824
834
|
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
|
@@ -278,7 +278,7 @@ function createValueHandler(handlers) {
|
|
|
278
278
|
return handler;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
const splitCode = (code) => [...new Set(code.split(/\\?[\s'"
|
|
281
|
+
const splitCode = (code) => [...new Set(code.split(/\\?[\s'"`;{}]+/g))].filter(isValidSelector);
|
|
282
282
|
const extractorSplit = {
|
|
283
283
|
name: "split",
|
|
284
284
|
order: 0,
|
|
@@ -412,7 +412,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
const version = "0.46.
|
|
415
|
+
const version = "0.46.2";
|
|
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)
|
|
@@ -775,7 +780,12 @@ class UnoGenerator {
|
|
|
775
780
|
let meta;
|
|
776
781
|
let result;
|
|
777
782
|
for (const s of this.config.shortcuts) {
|
|
778
|
-
|
|
783
|
+
let unprefixed = input;
|
|
784
|
+
if (s[2]?.prefix) {
|
|
785
|
+
if (!input.startsWith(s[2].prefix))
|
|
786
|
+
continue;
|
|
787
|
+
unprefixed = input.slice(s[2].prefix.length);
|
|
788
|
+
}
|
|
779
789
|
if (isStaticShortcut(s)) {
|
|
780
790
|
if (s[0] === unprefixed) {
|
|
781
791
|
meta = meta || s[2];
|
|
@@ -814,7 +824,7 @@ class UnoGenerator {
|
|
|
814
824
|
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
815
825
|
const selectorMap = new TwoKeyMap();
|
|
816
826
|
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, []]];
|
|
827
|
+
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Infinity, "{inline}", normalizeCSSEntries(i), void 0, []]];
|
|
818
828
|
if (!result)
|
|
819
829
|
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
820
830
|
return result || [];
|