@unocss/core 0.44.2 → 0.44.5
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 +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,7 +87,7 @@ function entriesToCss(arr) {
|
|
|
87
87
|
function isObject(item) {
|
|
88
88
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
89
89
|
}
|
|
90
|
-
function mergeDeep(original, patch) {
|
|
90
|
+
function mergeDeep(original, patch, level = Infinity) {
|
|
91
91
|
const o = original;
|
|
92
92
|
const p = patch;
|
|
93
93
|
if (Array.isArray(o) && Array.isArray(p))
|
|
@@ -97,8 +97,8 @@ function mergeDeep(original, patch) {
|
|
|
97
97
|
const output = { ...o };
|
|
98
98
|
if (isObject(o) && isObject(p)) {
|
|
99
99
|
Object.keys(p).forEach((key) => {
|
|
100
|
-
if (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key]))
|
|
101
|
-
output[key] = mergeDeep(o[key], p[key]);
|
|
100
|
+
if (level > 0 && (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key])))
|
|
101
|
+
output[key] = mergeDeep(o[key], p[key], level - 1);
|
|
102
102
|
else
|
|
103
103
|
Object.assign(output, { [key]: p[key] });
|
|
104
104
|
});
|
|
@@ -233,7 +233,7 @@ function expandVariantGroup(str, seperators = ["-", ":"]) {
|
|
|
233
233
|
content = content.replace(regexClassGroup, (from, pre, sep, body) => {
|
|
234
234
|
if (!seperators.includes(sep))
|
|
235
235
|
return from;
|
|
236
|
-
return body.split(/\s/g).map((i) => i === "~" ? pre : i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
|
|
236
|
+
return body.split(/\s/g).filter(Boolean).map((i) => i === "~" ? pre : i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
|
|
237
237
|
});
|
|
238
238
|
hasChanged = content !== before;
|
|
239
239
|
} while (hasChanged);
|
|
@@ -383,7 +383,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
383
383
|
const theme = clone([
|
|
384
384
|
...sortedPresets.map((p) => p.theme || {}),
|
|
385
385
|
config.theme || {}
|
|
386
|
-
].reduce((a, p) => mergeDeep(a, p), {}));
|
|
386
|
+
].reduce((a, p) => mergeDeep(a, p, 1), {}));
|
|
387
387
|
mergePresets("extendTheme").forEach((extendTheme) => extendTheme(theme));
|
|
388
388
|
const autocomplete = {
|
|
389
389
|
templates: uniq(sortedPresets.map((p) => toArray(p.autocomplete?.templates)).flat()),
|
|
@@ -414,7 +414,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
const version = "0.44.
|
|
417
|
+
const version = "0.44.5";
|
|
418
418
|
|
|
419
419
|
class UnoGenerator {
|
|
420
420
|
constructor(userConfig = {}, defaults = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ declare function normalizeCSSValues(obj: CSSValue | string | (CSSValue | string)
|
|
|
95
95
|
declare function clearIdenticalEntries(entry: CSSEntries): CSSEntries;
|
|
96
96
|
declare function entriesToCss(arr?: CSSEntries): string;
|
|
97
97
|
declare function isObject(item: any): item is Record<string, any>;
|
|
98
|
-
declare function mergeDeep<T>(original: T, patch: DeepPartial<T
|
|
98
|
+
declare function mergeDeep<T>(original: T, patch: DeepPartial<T>, level?: number): T;
|
|
99
99
|
declare function clone<T>(val: T): T;
|
|
100
100
|
declare function isStaticRule(rule: Rule): rule is StaticRule;
|
|
101
101
|
declare function isStaticShortcut(sc: Shortcut): sc is StaticShortcut;
|
package/dist/index.mjs
CHANGED
|
@@ -83,7 +83,7 @@ function entriesToCss(arr) {
|
|
|
83
83
|
function isObject(item) {
|
|
84
84
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
85
85
|
}
|
|
86
|
-
function mergeDeep(original, patch) {
|
|
86
|
+
function mergeDeep(original, patch, level = Infinity) {
|
|
87
87
|
const o = original;
|
|
88
88
|
const p = patch;
|
|
89
89
|
if (Array.isArray(o) && Array.isArray(p))
|
|
@@ -93,8 +93,8 @@ function mergeDeep(original, patch) {
|
|
|
93
93
|
const output = { ...o };
|
|
94
94
|
if (isObject(o) && isObject(p)) {
|
|
95
95
|
Object.keys(p).forEach((key) => {
|
|
96
|
-
if (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key]))
|
|
97
|
-
output[key] = mergeDeep(o[key], p[key]);
|
|
96
|
+
if (level > 0 && (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key])))
|
|
97
|
+
output[key] = mergeDeep(o[key], p[key], level - 1);
|
|
98
98
|
else
|
|
99
99
|
Object.assign(output, { [key]: p[key] });
|
|
100
100
|
});
|
|
@@ -229,7 +229,7 @@ function expandVariantGroup(str, seperators = ["-", ":"]) {
|
|
|
229
229
|
content = content.replace(regexClassGroup, (from, pre, sep, body) => {
|
|
230
230
|
if (!seperators.includes(sep))
|
|
231
231
|
return from;
|
|
232
|
-
return body.split(/\s/g).map((i) => i === "~" ? pre : i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
|
|
232
|
+
return body.split(/\s/g).filter(Boolean).map((i) => i === "~" ? pre : i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
|
|
233
233
|
});
|
|
234
234
|
hasChanged = content !== before;
|
|
235
235
|
} while (hasChanged);
|
|
@@ -379,7 +379,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
379
379
|
const theme = clone([
|
|
380
380
|
...sortedPresets.map((p) => p.theme || {}),
|
|
381
381
|
config.theme || {}
|
|
382
|
-
].reduce((a, p) => mergeDeep(a, p), {}));
|
|
382
|
+
].reduce((a, p) => mergeDeep(a, p, 1), {}));
|
|
383
383
|
mergePresets("extendTheme").forEach((extendTheme) => extendTheme(theme));
|
|
384
384
|
const autocomplete = {
|
|
385
385
|
templates: uniq(sortedPresets.map((p) => toArray(p.autocomplete?.templates)).flat()),
|
|
@@ -410,7 +410,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
const version = "0.44.
|
|
413
|
+
const version = "0.44.5";
|
|
414
414
|
|
|
415
415
|
class UnoGenerator {
|
|
416
416
|
constructor(userConfig = {}, defaults = {}) {
|