@yamada-ui/utils 0.2.0 → 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 = () => {
@@ -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.mjs CHANGED
@@ -11,15 +11,15 @@ import {
11
11
  tintColor,
12
12
  toneColor,
13
13
  transparentizeColor
14
- } from "./chunk-32BEUAHK.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-32BEUAHK.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;
@@ -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-32BEUAHK.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-32BEUAHK.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-32BEUAHK.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.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Yamada UI utils",
5
5
  "keywords": [
6
6
  "utils",