@unocss/core 0.14.0 → 0.14.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.ts +4 -3
- package/dist/index.js +26 -15
- package/dist/index.mjs +25 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,8 +21,6 @@ declare class UnoGenerator {
|
|
|
21
21
|
}
|
|
22
22
|
declare function createGenerator(config?: UserConfig, defaults?: UserConfigDefaults): UnoGenerator;
|
|
23
23
|
declare const hasScopePlaceholder: (css: string) => RegExpMatchArray | null;
|
|
24
|
-
declare function normalizeCSSEntries(obj: CSSEntries | CSSObject): CSSEntries;
|
|
25
|
-
declare function normalizeCSSValues(obj: CSSValues): CSSEntries[];
|
|
26
24
|
|
|
27
25
|
declare type Awaitable<T> = T | Promise<T>;
|
|
28
26
|
declare type ArgumentType<T> = T extends ((...args: infer A) => any) ? A : never;
|
|
@@ -329,6 +327,9 @@ declare function escapeRegExp(string: string): string;
|
|
|
329
327
|
declare function escapeSelector(str: string): string;
|
|
330
328
|
declare const e: typeof escapeSelector;
|
|
331
329
|
|
|
330
|
+
declare function normalizeCSSEntries(obj: CSSEntries | CSSObject): CSSEntries;
|
|
331
|
+
declare function normalizeCSSValues(obj: CSSValues): CSSEntries[];
|
|
332
|
+
declare function clearIdenticalEntries(entry: CSSEntries): CSSEntries;
|
|
332
333
|
declare function entriesToCss(arr?: CSSEntries): string;
|
|
333
334
|
declare function isObject(item: any): item is Record<string, any>;
|
|
334
335
|
declare function mergeDeep<T>(original: T, patch: DeepPartial<T>): T;
|
|
@@ -372,4 +373,4 @@ declare function warnOnce(msg: string): void;
|
|
|
372
373
|
|
|
373
374
|
declare const extractorSplit: Extractor;
|
|
374
375
|
|
|
375
|
-
export { ArgumentType, Awaitable, BetterMap, BlocklistRule, CSSEntries, CSSObject, CSSValues, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedUtil, PartialByKeys, PluginOptions, Preflight, Preset, RawUtil, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, TwoKeyMap, UnoGenerator, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, Variant, VariantFunction, VariantHandler, VariantMatchedResult, VariantObject, attributifyRE, createGenerator, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, hasScopePlaceholder, hex2rgba, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, mergeDeep, mergeSet, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, toArray, uniq, validateFilterRE, warnOnce, withLayer };
|
|
376
|
+
export { ArgumentType, Awaitable, BetterMap, BlocklistRule, CSSEntries, CSSObject, CSSValues, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedUtil, PartialByKeys, PluginOptions, Preflight, Preset, RawUtil, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, TwoKeyMap, UnoGenerator, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, Variant, VariantFunction, VariantHandler, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, createGenerator, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, hasScopePlaceholder, hex2rgba, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, mergeDeep, mergeSet, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, toArray, uniq, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ __export(exports, {
|
|
|
12
12
|
TwoKeyMap: () => TwoKeyMap,
|
|
13
13
|
UnoGenerator: () => UnoGenerator,
|
|
14
14
|
attributifyRE: () => attributifyRE,
|
|
15
|
+
clearIdenticalEntries: () => clearIdenticalEntries,
|
|
15
16
|
createGenerator: () => createGenerator,
|
|
16
17
|
e: () => e,
|
|
17
18
|
entriesToCss: () => entriesToCss,
|
|
@@ -80,10 +81,32 @@ function escapeSelector(str) {
|
|
|
80
81
|
var e = escapeSelector;
|
|
81
82
|
|
|
82
83
|
// src/utils/object.ts
|
|
84
|
+
function normalizeCSSEntries(obj) {
|
|
85
|
+
return (!Array.isArray(obj) ? Object.entries(obj) : obj).filter((i) => i[1] != null);
|
|
86
|
+
}
|
|
87
|
+
function normalizeCSSValues(obj) {
|
|
88
|
+
if (Array.isArray(obj)) {
|
|
89
|
+
if (obj.find((i) => !Array.isArray(i) || Array.isArray(i[0])))
|
|
90
|
+
return obj.map((i) => normalizeCSSEntries(i));
|
|
91
|
+
else
|
|
92
|
+
return [obj];
|
|
93
|
+
} else {
|
|
94
|
+
return [normalizeCSSEntries(obj)];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function clearIdenticalEntries(entry) {
|
|
98
|
+
return entry.filter(([k, v], idx) => {
|
|
99
|
+
for (let i = idx - 1; i >= 0; i--) {
|
|
100
|
+
if (entry[i][0] === k && entry[i][1] === v)
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
83
106
|
function entriesToCss(arr) {
|
|
84
107
|
if (arr == null)
|
|
85
108
|
return "";
|
|
86
|
-
return arr.map(([key, value]) => value != null ? `${key}:${value};` : void 0).filter(Boolean).join("");
|
|
109
|
+
return clearIdenticalEntries(arr).map(([key, value]) => value != null ? `${key}:${value};` : void 0).filter(Boolean).join("");
|
|
87
110
|
}
|
|
88
111
|
function isObject(item) {
|
|
89
112
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
@@ -342,7 +365,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
342
365
|
}
|
|
343
366
|
|
|
344
367
|
// package.json
|
|
345
|
-
var version = "0.14.
|
|
368
|
+
var version = "0.14.1";
|
|
346
369
|
|
|
347
370
|
// src/generator/index.ts
|
|
348
371
|
var UnoGenerator = class {
|
|
@@ -683,25 +706,13 @@ function toEscapedSelector(raw) {
|
|
|
683
706
|
else
|
|
684
707
|
return `.${e(raw)}`;
|
|
685
708
|
}
|
|
686
|
-
function normalizeCSSEntries(obj) {
|
|
687
|
-
return (!Array.isArray(obj) ? Object.entries(obj) : obj).filter((i) => i[1] != null);
|
|
688
|
-
}
|
|
689
|
-
function normalizeCSSValues(obj) {
|
|
690
|
-
if (Array.isArray(obj)) {
|
|
691
|
-
if (obj.find((i) => !Array.isArray(i) || Array.isArray(i[0])))
|
|
692
|
-
return obj.map((i) => normalizeCSSEntries(i));
|
|
693
|
-
else
|
|
694
|
-
return [obj];
|
|
695
|
-
} else {
|
|
696
|
-
return [normalizeCSSEntries(obj)];
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
709
|
// Annotate the CommonJS export names for ESM import in node:
|
|
700
710
|
0 && (module.exports = {
|
|
701
711
|
BetterMap,
|
|
702
712
|
TwoKeyMap,
|
|
703
713
|
UnoGenerator,
|
|
704
714
|
attributifyRE,
|
|
715
|
+
clearIdenticalEntries,
|
|
705
716
|
createGenerator,
|
|
706
717
|
e,
|
|
707
718
|
entriesToCss,
|
package/dist/index.mjs
CHANGED
|
@@ -37,10 +37,32 @@ function escapeSelector(str) {
|
|
|
37
37
|
var e = escapeSelector;
|
|
38
38
|
|
|
39
39
|
// src/utils/object.ts
|
|
40
|
+
function normalizeCSSEntries(obj) {
|
|
41
|
+
return (!Array.isArray(obj) ? Object.entries(obj) : obj).filter((i) => i[1] != null);
|
|
42
|
+
}
|
|
43
|
+
function normalizeCSSValues(obj) {
|
|
44
|
+
if (Array.isArray(obj)) {
|
|
45
|
+
if (obj.find((i) => !Array.isArray(i) || Array.isArray(i[0])))
|
|
46
|
+
return obj.map((i) => normalizeCSSEntries(i));
|
|
47
|
+
else
|
|
48
|
+
return [obj];
|
|
49
|
+
} else {
|
|
50
|
+
return [normalizeCSSEntries(obj)];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function clearIdenticalEntries(entry) {
|
|
54
|
+
return entry.filter(([k, v], idx) => {
|
|
55
|
+
for (let i = idx - 1; i >= 0; i--) {
|
|
56
|
+
if (entry[i][0] === k && entry[i][1] === v)
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
40
62
|
function entriesToCss(arr) {
|
|
41
63
|
if (arr == null)
|
|
42
64
|
return "";
|
|
43
|
-
return arr.map(([key, value]) => value != null ? `${key}:${value};` : void 0).filter(Boolean).join("");
|
|
65
|
+
return clearIdenticalEntries(arr).map(([key, value]) => value != null ? `${key}:${value};` : void 0).filter(Boolean).join("");
|
|
44
66
|
}
|
|
45
67
|
function isObject(item) {
|
|
46
68
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
@@ -299,7 +321,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
299
321
|
}
|
|
300
322
|
|
|
301
323
|
// package.json
|
|
302
|
-
var version = "0.14.
|
|
324
|
+
var version = "0.14.1";
|
|
303
325
|
|
|
304
326
|
// src/generator/index.ts
|
|
305
327
|
var UnoGenerator = class {
|
|
@@ -640,24 +662,12 @@ function toEscapedSelector(raw) {
|
|
|
640
662
|
else
|
|
641
663
|
return `.${e(raw)}`;
|
|
642
664
|
}
|
|
643
|
-
function normalizeCSSEntries(obj) {
|
|
644
|
-
return (!Array.isArray(obj) ? Object.entries(obj) : obj).filter((i) => i[1] != null);
|
|
645
|
-
}
|
|
646
|
-
function normalizeCSSValues(obj) {
|
|
647
|
-
if (Array.isArray(obj)) {
|
|
648
|
-
if (obj.find((i) => !Array.isArray(i) || Array.isArray(i[0])))
|
|
649
|
-
return obj.map((i) => normalizeCSSEntries(i));
|
|
650
|
-
else
|
|
651
|
-
return [obj];
|
|
652
|
-
} else {
|
|
653
|
-
return [normalizeCSSEntries(obj)];
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
665
|
export {
|
|
657
666
|
BetterMap,
|
|
658
667
|
TwoKeyMap,
|
|
659
668
|
UnoGenerator,
|
|
660
669
|
attributifyRE,
|
|
670
|
+
clearIdenticalEntries,
|
|
661
671
|
createGenerator,
|
|
662
672
|
e,
|
|
663
673
|
entriesToCss,
|