@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 +2 -2
- package/dist/assertion.mjs +1 -1
- package/dist/{chunk-32BEUAHK.mjs → chunk-ANJGKDOC.mjs} +14 -10
- package/dist/{chunk-IVGIIDMV.mjs → chunk-BU4LEFZY.mjs} +2 -2
- package/dist/{chunk-PF7LRFIA.mjs → chunk-G7Q2EDJF.mjs} +5 -5
- package/dist/color.mjs +3 -3
- package/dist/event.js +5 -5
- package/dist/event.mjs +1 -1
- package/dist/function.mjs +3 -3
- package/dist/index.js +20 -16
- package/dist/index.mjs +3 -3
- package/dist/object.js +14 -10
- package/dist/object.mjs +3 -3
- package/dist/react.mjs +3 -3
- package/package.json +1 -1
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") && !
|
|
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) => !
|
|
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;
|
package/dist/assertion.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isNumber,
|
|
5
5
|
isObject,
|
|
6
6
|
isString
|
|
7
|
-
} from "./chunk-
|
|
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(
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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") && !
|
|
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) => !
|
|
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) => (
|
|
30
|
-
const isMouse = isMouseEvent(
|
|
31
|
-
if (!isMouse || isMouse &&
|
|
32
|
-
cb(
|
|
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 = (
|
|
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-
|
|
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-
|
|
19
|
+
import "./chunk-BU4LEFZY.mjs";
|
|
20
20
|
import "./chunk-R5OUKGQ5.mjs";
|
|
21
21
|
import "./chunk-H5VMEQNO.mjs";
|
|
22
|
-
import "./chunk-
|
|
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) => (
|
|
62
|
-
const isMouse = isMouseEvent(
|
|
63
|
-
if (!isMouse || isMouse &&
|
|
64
|
-
cb(
|
|
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 = (
|
|
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
package/dist/function.mjs
CHANGED
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
handlerAll,
|
|
4
4
|
noop,
|
|
5
5
|
runIfFunc
|
|
6
|
-
} from "./chunk-
|
|
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-
|
|
11
|
+
import "./chunk-BU4LEFZY.mjs";
|
|
12
12
|
import "./chunk-R5OUKGQ5.mjs";
|
|
13
13
|
import "./chunk-H5VMEQNO.mjs";
|
|
14
|
-
import "./chunk-
|
|
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") && !
|
|
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) => !
|
|
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(
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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) => (
|
|
745
|
-
const isMouse = isMouseEvent(
|
|
746
|
-
if (!isMouse || isMouse &&
|
|
747
|
-
cb(
|
|
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 = (
|
|
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-
|
|
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-
|
|
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-
|
|
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") && !
|
|
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(
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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-
|
|
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-
|
|
21
|
+
import "./chunk-BU4LEFZY.mjs";
|
|
22
22
|
import "./chunk-R5OUKGQ5.mjs";
|
|
23
23
|
import "./chunk-H5VMEQNO.mjs";
|
|
24
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
27
|
+
import "./chunk-BU4LEFZY.mjs";
|
|
28
28
|
import "./chunk-R5OUKGQ5.mjs";
|
|
29
29
|
import "./chunk-H5VMEQNO.mjs";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-G7Q2EDJF.mjs";
|
|
31
31
|
export {
|
|
32
32
|
assignRef,
|
|
33
33
|
createContext,
|