@yamada-ui/utils 0.1.5 → 0.2.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/assertion.js CHANGED
@@ -40,9 +40,9 @@ var isNumeric = (value) => value != null && parseFloat(value.toString()) - parse
40
40
  var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
41
41
  var isUndefined = (value) => typeof value === "undefined" && value === void 0;
42
42
  var isNull = (value) => value === null;
43
- var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value);
43
+ var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value);
44
44
  var isArray = (value) => Array.isArray(value);
45
- var isEmpty = (value) => !Array.isArray(value) || !value.length || value.every((v) => v == null);
45
+ var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) => v == null);
46
46
  var isFunction = (value) => typeof value === "function";
47
47
  var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value);
48
48
  var cast = (value) => value;
@@ -11,7 +11,7 @@ import {
11
11
  isString,
12
12
  isUndefined,
13
13
  isUnit
14
- } from "./chunk-IVGIIDMV.mjs";
14
+ } from "./chunk-BU4LEFZY.mjs";
15
15
  export {
16
16
  cast,
17
17
  isArray,
@@ -4,7 +4,7 @@ import {
4
4
  isNumber,
5
5
  isObject,
6
6
  isString
7
- } from "./chunk-IVGIIDMV.mjs";
7
+ } from "./chunk-BU4LEFZY.mjs";
8
8
 
9
9
  // src/function.ts
10
10
  var noop = () => {
@@ -195,27 +195,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
195
195
  }
196
196
  };
197
197
  var lightenColor = (color, amount) => (theme, colorMode) => {
198
- const raw = getColor(color)(theme, colorMode);
198
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
199
199
  return toHex(lighten(raw, amount / 100));
200
200
  };
201
201
  var darkenColor = (color, amount) => (theme, colorMode) => {
202
- const raw = getColor(color)(theme, colorMode);
202
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
203
203
  return toHex(darken(raw, amount / 100));
204
204
  };
205
205
  var tintColor = (color, amount) => (theme, colorMode) => {
206
- const raw = getColor(color)(theme, colorMode);
206
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
207
207
  return toHex(mix(raw, "#fff", amount));
208
208
  };
209
209
  var shadeColor = (color, amount) => (theme, colorMode) => {
210
- const raw = getColor(color)(theme, colorMode);
210
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
211
211
  return toHex(mix(raw, "#000", amount / 100));
212
212
  };
213
213
  var transparentizeColor = (color, alpha) => (theme, colorMode) => {
214
- const raw = getColor(color)(theme, colorMode);
214
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
215
215
  return transparentize(raw, 1 - alpha);
216
216
  };
217
217
  var toneColor = (color, l) => (theme, colorMode) => {
218
- const raw = getColor(color)(theme, colorMode);
218
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
219
219
  if (l < 0 || 900 < l)
220
220
  return color;
221
221
  let n = (l - 500) / 10;
@@ -272,7 +272,7 @@ var getBrightness = (color) => {
272
272
  return (r * 299 + g * 587 + b * 114) / 1e3;
273
273
  };
274
274
  var isTone = (color) => (theme, colorMode) => {
275
- const raw = getColor(color)(theme, colorMode);
275
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
276
276
  const brightness = getBrightness(raw);
277
277
  const isDark2 = brightness < 128;
278
278
  return isDark2 ? "dark" : "light";
@@ -322,16 +322,20 @@ var filterObject = (obj, func) => {
322
322
  var filterUndefined = (obj) => filterObject(obj, (_, val) => val !== null && val !== void 0);
323
323
  var merge = (target, source, overrideArray = false) => {
324
324
  let result = Object.assign({}, target);
325
- if (isObject(target) && isObject(source)) {
326
- for (const [sourceKey, sourceValue] of Object.entries(source)) {
327
- const targetValue = target[sourceKey];
328
- if (overrideArray && Array.isArray(sourceValue) && Array.isArray(targetValue)) {
329
- result[sourceKey] = targetValue.concat(...sourceValue);
330
- } else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) {
331
- result[sourceKey] = merge(targetValue, sourceValue, overrideArray);
332
- } else {
333
- Object.assign(result, { [sourceKey]: sourceValue });
325
+ if (isObject(source)) {
326
+ if (isObject(target)) {
327
+ for (const [sourceKey, sourceValue] of Object.entries(source)) {
328
+ const targetValue = target[sourceKey];
329
+ if (overrideArray && isArray(sourceValue) && isArray(targetValue)) {
330
+ result[sourceKey] = targetValue.concat(...sourceValue);
331
+ } else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) {
332
+ result[sourceKey] = merge(targetValue, sourceValue, overrideArray);
333
+ } else {
334
+ Object.assign(result, { [sourceKey]: sourceValue });
335
+ }
334
336
  }
337
+ } else {
338
+ result = source;
335
339
  }
336
340
  }
337
341
  return result;
@@ -5,9 +5,9 @@ var isNumeric = (value) => value != null && parseFloat(value.toString()) - parse
5
5
  var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
6
6
  var isUndefined = (value) => typeof value === "undefined" && value === void 0;
7
7
  var isNull = (value) => value === null;
8
- var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value);
8
+ var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value);
9
9
  var isArray = (value) => Array.isArray(value);
10
- var isEmpty = (value) => !Array.isArray(value) || !value.length || value.every((v) => v == null);
10
+ var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) => v == null);
11
11
  var isFunction = (value) => typeof value === "function";
12
12
  var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value);
13
13
  var cast = (value) => value;
@@ -26,13 +26,13 @@ var addDomEvent = (target, type, cb, options) => {
26
26
  target.removeEventListener(type, cb, options);
27
27
  };
28
28
  };
29
- var filter = (cb) => (event) => {
30
- const isMouse = isMouseEvent(event);
31
- if (!isMouse || isMouse && event.button === 0)
32
- cb(event);
29
+ var filter = (cb) => (ev) => {
30
+ const isMouse = isMouseEvent(ev);
31
+ if (!isMouse || isMouse && ev.button === 0)
32
+ cb(ev);
33
33
  };
34
34
  var wrap = (cb, filterPrimary = false) => {
35
- const listener = (event) => cb(event, { point: getEventPoint(event) });
35
+ const listener = (ev) => cb(ev, { point: getEventPoint(ev) });
36
36
  const fn = filterPrimary ? filter(listener) : listener;
37
37
  return fn;
38
38
  };
package/dist/color.d.mts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { Dict } from './index.types.mjs';
2
2
 
3
3
  declare const isGray: (colorScheme: string) => boolean;
4
- declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
5
- declare const lightenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
6
- declare const darkenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
7
- declare const tintColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
8
- declare const shadeColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
9
- declare const transparentizeColor: (color: string, alpha: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
10
- declare const toneColor: (color: string, l: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
4
+ declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode?: 'light' | 'dark') => string;
5
+ declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
6
+ declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
7
+ declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
8
+ declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
9
+ declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
10
+ declare const toneColor: (color: string, l: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
11
11
  declare const randomColor: ({ string, colors, }?: {
12
12
  string?: string | undefined;
13
13
  colors?: string[] | undefined;
14
14
  }) => string;
15
- declare const isTone: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => "light" | "dark";
16
- declare const isLight: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
17
- declare const isDark: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
15
+ declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => "light" | "dark";
16
+ declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
17
+ declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
18
18
 
19
19
  export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
package/dist/color.d.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { Dict } from './index.types.js';
2
2
 
3
3
  declare const isGray: (colorScheme: string) => boolean;
4
- declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
5
- declare const lightenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
6
- declare const darkenColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
7
- declare const tintColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
8
- declare const shadeColor: (color: string, amount: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
9
- declare const transparentizeColor: (color: string, alpha: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
10
- declare const toneColor: (color: string, l: number) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => string;
4
+ declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode?: 'light' | 'dark') => string;
5
+ declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
6
+ declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
7
+ declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
8
+ declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
9
+ declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
10
+ declare const toneColor: (color: string, l: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
11
11
  declare const randomColor: ({ string, colors, }?: {
12
12
  string?: string | undefined;
13
13
  colors?: string[] | undefined;
14
14
  }) => string;
15
- declare const isTone: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => "light" | "dark";
16
- declare const isLight: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
17
- declare const isDark: (color: string) => (theme: Dict, colorMode: 'light' | 'dark' | undefined) => boolean;
15
+ declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => "light" | "dark";
16
+ declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
17
+ declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
18
18
 
19
19
  export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
package/dist/color.js CHANGED
@@ -84,27 +84,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
84
84
  }
85
85
  };
86
86
  var lightenColor = (color, amount) => (theme, colorMode) => {
87
- const raw = getColor(color)(theme, colorMode);
87
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
88
88
  return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
89
89
  };
90
90
  var darkenColor = (color, amount) => (theme, colorMode) => {
91
- const raw = getColor(color)(theme, colorMode);
91
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
92
92
  return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
93
93
  };
94
94
  var tintColor = (color, amount) => (theme, colorMode) => {
95
- const raw = getColor(color)(theme, colorMode);
95
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
96
96
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
97
97
  };
98
98
  var shadeColor = (color, amount) => (theme, colorMode) => {
99
- const raw = getColor(color)(theme, colorMode);
99
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
100
100
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
101
101
  };
102
102
  var transparentizeColor = (color, alpha) => (theme, colorMode) => {
103
- const raw = getColor(color)(theme, colorMode);
103
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
104
104
  return (0, import_color2k.transparentize)(raw, 1 - alpha);
105
105
  };
106
106
  var toneColor = (color, l) => (theme, colorMode) => {
107
- const raw = getColor(color)(theme, colorMode);
107
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
108
108
  if (l < 0 || 900 < l)
109
109
  return color;
110
110
  let n = (l - 500) / 10;
@@ -161,7 +161,7 @@ var getBrightness = (color) => {
161
161
  return (r * 299 + g * 587 + b * 114) / 1e3;
162
162
  };
163
163
  var isTone = (color) => (theme, colorMode) => {
164
- const raw = getColor(color)(theme, colorMode);
164
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
165
165
  const brightness = getBrightness(raw);
166
166
  const isDark2 = brightness < 128;
167
167
  return isDark2 ? "dark" : "light";
package/dist/color.mjs CHANGED
@@ -11,15 +11,15 @@ import {
11
11
  tintColor,
12
12
  toneColor,
13
13
  transparentizeColor
14
- } from "./chunk-XIDDMDVR.mjs";
14
+ } from "./chunk-ANJGKDOC.mjs";
15
15
  import "./chunk-SLJ4M7XC.mjs";
16
16
  import "./chunk-VYMGBE25.mjs";
17
17
  import "./chunk-BZAW2D6U.mjs";
18
18
  import "./chunk-PURW64JE.mjs";
19
- import "./chunk-IVGIIDMV.mjs";
19
+ import "./chunk-BU4LEFZY.mjs";
20
20
  import "./chunk-R5OUKGQ5.mjs";
21
21
  import "./chunk-H5VMEQNO.mjs";
22
- import "./chunk-PF7LRFIA.mjs";
22
+ import "./chunk-G7Q2EDJF.mjs";
23
23
  export {
24
24
  darkenColor,
25
25
  getColor,
package/dist/event.js CHANGED
@@ -58,13 +58,13 @@ var addDomEvent = (target, type, cb, options) => {
58
58
  target.removeEventListener(type, cb, options);
59
59
  };
60
60
  };
61
- var filter = (cb) => (event) => {
62
- const isMouse = isMouseEvent(event);
63
- if (!isMouse || isMouse && event.button === 0)
64
- cb(event);
61
+ var filter = (cb) => (ev) => {
62
+ const isMouse = isMouseEvent(ev);
63
+ if (!isMouse || isMouse && ev.button === 0)
64
+ cb(ev);
65
65
  };
66
66
  var wrap = (cb, filterPrimary = false) => {
67
- const listener = (event) => cb(event, { point: getEventPoint(event) });
67
+ const listener = (ev) => cb(ev, { point: getEventPoint(ev) });
68
68
  const fn = filterPrimary ? filter(listener) : listener;
69
69
  return fn;
70
70
  };
package/dist/event.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  isTouchEvent,
9
9
  pointFromMouse,
10
10
  pointFromTouch
11
- } from "./chunk-PF7LRFIA.mjs";
11
+ } from "./chunk-G7Q2EDJF.mjs";
12
12
  export {
13
13
  addDomEvent,
14
14
  addPointerEvent,
package/dist/function.mjs CHANGED
@@ -3,15 +3,15 @@ import {
3
3
  handlerAll,
4
4
  noop,
5
5
  runIfFunc
6
- } from "./chunk-XIDDMDVR.mjs";
6
+ } from "./chunk-ANJGKDOC.mjs";
7
7
  import "./chunk-SLJ4M7XC.mjs";
8
8
  import "./chunk-VYMGBE25.mjs";
9
9
  import "./chunk-BZAW2D6U.mjs";
10
10
  import "./chunk-PURW64JE.mjs";
11
- import "./chunk-IVGIIDMV.mjs";
11
+ import "./chunk-BU4LEFZY.mjs";
12
12
  import "./chunk-R5OUKGQ5.mjs";
13
13
  import "./chunk-H5VMEQNO.mjs";
14
- import "./chunk-PF7LRFIA.mjs";
14
+ import "./chunk-G7Q2EDJF.mjs";
15
15
  export {
16
16
  funcAll,
17
17
  handlerAll,
package/dist/index.js CHANGED
@@ -145,9 +145,9 @@ var isNumeric = (value) => value != null && parseFloat(value.toString()) - parse
145
145
  var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
146
146
  var isUndefined = (value) => typeof value === "undefined" && value === void 0;
147
147
  var isNull = (value) => value === null;
148
- var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value);
148
+ var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value);
149
149
  var isArray = (value) => Array.isArray(value);
150
- var isEmpty = (value) => !Array.isArray(value) || !value.length || value.every((v) => v == null);
150
+ var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) => v == null);
151
151
  var isFunction = (value) => typeof value === "function";
152
152
  var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value);
153
153
  var cast = (value) => value;
@@ -194,16 +194,20 @@ var filterObject = (obj, func) => {
194
194
  var filterUndefined = (obj) => filterObject(obj, (_, val) => val !== null && val !== void 0);
195
195
  var merge = (target, source, overrideArray = false) => {
196
196
  let result = Object.assign({}, target);
197
- if (isObject(target) && isObject(source)) {
198
- for (const [sourceKey, sourceValue] of Object.entries(source)) {
199
- const targetValue = target[sourceKey];
200
- if (overrideArray && Array.isArray(sourceValue) && Array.isArray(targetValue)) {
201
- result[sourceKey] = targetValue.concat(...sourceValue);
202
- } else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) {
203
- result[sourceKey] = merge(targetValue, sourceValue, overrideArray);
204
- } else {
205
- Object.assign(result, { [sourceKey]: sourceValue });
197
+ if (isObject(source)) {
198
+ if (isObject(target)) {
199
+ for (const [sourceKey, sourceValue] of Object.entries(source)) {
200
+ const targetValue = target[sourceKey];
201
+ if (overrideArray && isArray(sourceValue) && isArray(targetValue)) {
202
+ result[sourceKey] = targetValue.concat(...sourceValue);
203
+ } else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) {
204
+ result[sourceKey] = merge(targetValue, sourceValue, overrideArray);
205
+ } else {
206
+ Object.assign(result, { [sourceKey]: sourceValue });
207
+ }
206
208
  }
209
+ } else {
210
+ result = source;
207
211
  }
208
212
  }
209
213
  return result;
@@ -594,27 +598,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
594
598
  }
595
599
  };
596
600
  var lightenColor = (color, amount) => (theme, colorMode) => {
597
- const raw = getColor(color)(theme, colorMode);
601
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
598
602
  return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
599
603
  };
600
604
  var darkenColor = (color, amount) => (theme, colorMode) => {
601
- const raw = getColor(color)(theme, colorMode);
605
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
602
606
  return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
603
607
  };
604
608
  var tintColor = (color, amount) => (theme, colorMode) => {
605
- const raw = getColor(color)(theme, colorMode);
609
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
606
610
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
607
611
  };
608
612
  var shadeColor = (color, amount) => (theme, colorMode) => {
609
- const raw = getColor(color)(theme, colorMode);
613
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
610
614
  return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
611
615
  };
612
616
  var transparentizeColor = (color, alpha) => (theme, colorMode) => {
613
- const raw = getColor(color)(theme, colorMode);
617
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
614
618
  return (0, import_color2k.transparentize)(raw, 1 - alpha);
615
619
  };
616
620
  var toneColor = (color, l) => (theme, colorMode) => {
617
- const raw = getColor(color)(theme, colorMode);
621
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
618
622
  if (l < 0 || 900 < l)
619
623
  return color;
620
624
  let n = (l - 500) / 10;
@@ -671,7 +675,7 @@ var getBrightness = (color) => {
671
675
  return (r * 299 + g * 587 + b * 114) / 1e3;
672
676
  };
673
677
  var isTone = (color) => (theme, colorMode) => {
674
- const raw = getColor(color)(theme, colorMode);
678
+ const raw = theme ? getColor(color)(theme, colorMode) : color;
675
679
  const brightness = getBrightness(raw);
676
680
  const isDark2 = brightness < 128;
677
681
  return isDark2 ? "dark" : "light";
@@ -741,13 +745,13 @@ var addDomEvent = (target, type, cb, options) => {
741
745
  target.removeEventListener(type, cb, options);
742
746
  };
743
747
  };
744
- var filter = (cb) => (event) => {
745
- const isMouse = isMouseEvent(event);
746
- if (!isMouse || isMouse && event.button === 0)
747
- cb(event);
748
+ var filter = (cb) => (ev) => {
749
+ const isMouse = isMouseEvent(ev);
750
+ if (!isMouse || isMouse && ev.button === 0)
751
+ cb(ev);
748
752
  };
749
753
  var wrap = (cb, filterPrimary = false) => {
750
- const listener = (event) => cb(event, { point: getEventPoint(event) });
754
+ const listener = (ev) => cb(ev, { point: getEventPoint(ev) });
751
755
  const fn = filterPrimary ? filter(listener) : listener;
752
756
  return fn;
753
757
  };
package/dist/index.mjs CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  useSafeLayoutEffect,
50
50
  useUnmountEffect,
51
51
  useUpdateEffect
52
- } from "./chunk-XIDDMDVR.mjs";
52
+ } from "./chunk-ANJGKDOC.mjs";
53
53
  import "./chunk-SLJ4M7XC.mjs";
54
54
  import {
55
55
  clampNumber,
@@ -78,7 +78,7 @@ import {
78
78
  isString,
79
79
  isUndefined,
80
80
  isUnit
81
- } from "./chunk-IVGIIDMV.mjs";
81
+ } from "./chunk-BU4LEFZY.mjs";
82
82
  import {
83
83
  calc
84
84
  } from "./chunk-R5OUKGQ5.mjs";
@@ -119,7 +119,7 @@ import {
119
119
  isTouchEvent,
120
120
  pointFromMouse,
121
121
  pointFromTouch
122
- } from "./chunk-PF7LRFIA.mjs";
122
+ } from "./chunk-G7Q2EDJF.mjs";
123
123
  export {
124
124
  addDomEvent,
125
125
  addPointerEvent,
package/dist/object.js CHANGED
@@ -38,7 +38,7 @@ __export(object_exports, {
38
38
  module.exports = __toCommonJS(object_exports);
39
39
 
40
40
  // src/assertion.ts
41
- var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value);
41
+ var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value);
42
42
  var isArray = (value) => Array.isArray(value);
43
43
  var isFunction = (value) => typeof value === "function";
44
44
 
@@ -84,16 +84,20 @@ var filterObject = (obj, func) => {
84
84
  var filterUndefined = (obj) => filterObject(obj, (_, val) => val !== null && val !== void 0);
85
85
  var merge = (target, source, overrideArray = false) => {
86
86
  let result = Object.assign({}, target);
87
- if (isObject(target) && isObject(source)) {
88
- for (const [sourceKey, sourceValue] of Object.entries(source)) {
89
- const targetValue = target[sourceKey];
90
- if (overrideArray && Array.isArray(sourceValue) && Array.isArray(targetValue)) {
91
- result[sourceKey] = targetValue.concat(...sourceValue);
92
- } else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) {
93
- result[sourceKey] = merge(targetValue, sourceValue, overrideArray);
94
- } else {
95
- Object.assign(result, { [sourceKey]: sourceValue });
87
+ if (isObject(source)) {
88
+ if (isObject(target)) {
89
+ for (const [sourceKey, sourceValue] of Object.entries(source)) {
90
+ const targetValue = target[sourceKey];
91
+ if (overrideArray && isArray(sourceValue) && isArray(targetValue)) {
92
+ result[sourceKey] = targetValue.concat(...sourceValue);
93
+ } else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) {
94
+ result[sourceKey] = merge(targetValue, sourceValue, overrideArray);
95
+ } else {
96
+ Object.assign(result, { [sourceKey]: sourceValue });
97
+ }
96
98
  }
99
+ } else {
100
+ result = source;
97
101
  }
98
102
  }
99
103
  return result;
package/dist/object.mjs CHANGED
@@ -13,15 +13,15 @@ import {
13
13
  pickObject,
14
14
  replaceObject,
15
15
  splitObject
16
- } from "./chunk-XIDDMDVR.mjs";
16
+ } from "./chunk-ANJGKDOC.mjs";
17
17
  import "./chunk-SLJ4M7XC.mjs";
18
18
  import "./chunk-VYMGBE25.mjs";
19
19
  import "./chunk-BZAW2D6U.mjs";
20
20
  import "./chunk-PURW64JE.mjs";
21
- import "./chunk-IVGIIDMV.mjs";
21
+ import "./chunk-BU4LEFZY.mjs";
22
22
  import "./chunk-R5OUKGQ5.mjs";
23
23
  import "./chunk-H5VMEQNO.mjs";
24
- import "./chunk-PF7LRFIA.mjs";
24
+ import "./chunk-G7Q2EDJF.mjs";
25
25
  export {
26
26
  assignAfter,
27
27
  filterObject,
package/dist/react.mjs CHANGED
@@ -19,15 +19,15 @@ import {
19
19
  useSafeLayoutEffect,
20
20
  useUnmountEffect,
21
21
  useUpdateEffect
22
- } from "./chunk-XIDDMDVR.mjs";
22
+ } from "./chunk-ANJGKDOC.mjs";
23
23
  import "./chunk-SLJ4M7XC.mjs";
24
24
  import "./chunk-VYMGBE25.mjs";
25
25
  import "./chunk-BZAW2D6U.mjs";
26
26
  import "./chunk-PURW64JE.mjs";
27
- import "./chunk-IVGIIDMV.mjs";
27
+ import "./chunk-BU4LEFZY.mjs";
28
28
  import "./chunk-R5OUKGQ5.mjs";
29
29
  import "./chunk-H5VMEQNO.mjs";
30
- import "./chunk-PF7LRFIA.mjs";
30
+ import "./chunk-G7Q2EDJF.mjs";
31
31
  export {
32
32
  assignRef,
33
33
  createContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/utils",
3
- "version": "0.1.5",
3
+ "version": "0.2.1",
4
4
  "description": "Yamada UI utils",
5
5
  "keywords": [
6
6
  "utils",