@unocss/core 0.44.3 → 0.44.4

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 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
  });
@@ -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.3";
417
+ const version = "0.44.4";
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>): 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
  });
@@ -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.3";
413
+ const version = "0.44.4";
414
414
 
415
415
  class UnoGenerator {
416
416
  constructor(userConfig = {}, defaults = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
- "version": "0.44.3",
3
+ "version": "0.44.4",
4
4
  "description": "The instant on-demand Atomic CSS engine.",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",