@v-c/util 0.0.12 → 0.0.13
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/Children/isFragment.cjs +7 -1
- package/dist/Children/isFragment.js +4 -4
- package/dist/Children/toArray.cjs +20 -1
- package/dist/Children/toArray.js +17 -8
- package/dist/Dom/addEventListener.cjs +13 -1
- package/dist/Dom/addEventListener.js +7 -5
- package/dist/Dom/canUseDom.cjs +6 -1
- package/dist/Dom/canUseDom.js +3 -3
- package/dist/Dom/class.cjs +29 -1
- package/dist/Dom/class.js +23 -13
- package/dist/Dom/contains.cjs +16 -1
- package/dist/Dom/contains.js +12 -12
- package/dist/Dom/css.cjs +96 -1
- package/dist/Dom/css.js +69 -48
- package/dist/Dom/dynamicCSS.cjs +110 -1
- package/dist/Dom/dynamicCSS.js +92 -59
- package/dist/Dom/findDOMNode.cjs +16 -1
- package/dist/Dom/findDOMNode.js +12 -8
- package/dist/Dom/focus.cjs +60 -1
- package/dist/Dom/focus.js +48 -28
- package/dist/Dom/isVisible.cjs +22 -1
- package/dist/Dom/isVisible.js +16 -16
- package/dist/Dom/scrollLocker.cjs +89 -1
- package/dist/Dom/scrollLocker.js +70 -45
- package/dist/Dom/shadow.cjs +13 -1
- package/dist/Dom/shadow.js +8 -8
- package/dist/Dom/styleChecker.cjs +25 -1
- package/dist/Dom/styleChecker.js +19 -14
- package/dist/Dom/support.cjs +28 -1
- package/dist/Dom/support.js +16 -12
- package/dist/KeyCode.cjs +523 -1
- package/dist/KeyCode.js +62 -55
- package/dist/Portal.cjs +48 -1
- package/dist/Portal.js +34 -19
- package/dist/PortalWrapper.cjs +169 -1
- package/dist/PortalWrapper.js +133 -79
- package/dist/classnames.cjs +45 -1
- package/dist/classnames.js +38 -25
- package/dist/composeProps.cjs +19 -1
- package/dist/composeProps.js +15 -9
- package/dist/createRef.cjs +24 -1
- package/dist/createRef.js +16 -13
- package/dist/debug/diff.cjs +50 -1
- package/dist/debug/diff.js +39 -30
- package/dist/deprecated.cjs +10 -1
- package/dist/deprecated.js +7 -5
- package/dist/getScrollBarSize.cjs +51 -1
- package/dist/getScrollBarSize.js +39 -25
- package/dist/guid.cjs +7 -1
- package/dist/guid.js +4 -4
- package/dist/hooks/useEvent.cjs +6 -1
- package/dist/hooks/useEvent.js +3 -3
- package/dist/hooks/useId.cjs +18 -1
- package/dist/hooks/useId.js +14 -8
- package/dist/hooks/useLayoutEffect.cjs +58 -1
- package/dist/hooks/useLayoutEffect.js +50 -20
- package/dist/hooks/useMemo.cjs +16 -1
- package/dist/hooks/useMemo.js +13 -7
- package/dist/hooks/useMergedState.cjs +30 -1
- package/dist/hooks/useMergedState.js +25 -16
- package/dist/hooks/useMobile.cjs +16 -1
- package/dist/hooks/useMobile.js +13 -11
- package/dist/hooks/useState.cjs +12 -1
- package/dist/hooks/useState.js +8 -7
- package/dist/index.cjs +11 -1
- package/dist/index.js +9 -9
- package/dist/isEqual.cjs +36 -1
- package/dist/isEqual.js +30 -26
- package/dist/isMobile.cjs +13 -1
- package/dist/isMobile.js +7 -7
- package/dist/isValid.cjs +6 -1
- package/dist/isValid.js +3 -3
- package/dist/omit.cjs +12 -1
- package/dist/omit.js +9 -6
- package/dist/pickAttrs.cjs +41 -3
- package/dist/pickAttrs.js +37 -22
- package/dist/props-util/index.cjs +69 -1
- package/dist/props-util/index.js +62 -32
- package/dist/raf.cjs +48 -1
- package/dist/raf.js +37 -26
- package/dist/setStyle.cjs +17 -1
- package/dist/setStyle.js +13 -9
- package/dist/switchScrollingEffect.cjs +38 -1
- package/dist/switchScrollingEffect.js +27 -20
- package/dist/test/domHook.cjs +52 -1
- package/dist/test/domHook.js +43 -28
- package/dist/type.cjs +51 -1
- package/dist/type.js +39 -37
- package/dist/utils/checkSlotProp.cjs +13 -1
- package/dist/utils/checkSlotProp.js +10 -3
- package/dist/utils/get.cjs +12 -1
- package/dist/utils/get.js +8 -8
- package/dist/utils/omit.cjs +10 -1
- package/dist/utils/omit.js +7 -6
- package/dist/utils/set.cjs +64 -1
- package/dist/utils/set.js +54 -32
- package/dist/utils/transition.cjs +96 -1
- package/dist/utils/transition.d.ts +2 -2
- package/dist/utils/transition.js +70 -65
- package/dist/utils/watchState.cjs +20 -1
- package/dist/utils/watchState.js +15 -10
- package/dist/vnode.cjs +56 -1
- package/dist/vnode.js +46 -30
- package/dist/vueuse/unref-element.cjs +8 -1
- package/dist/vueuse/unref-element.js +5 -5
- package/dist/warning.cjs +53 -1
- package/dist/warning.js +40 -35
- package/package.json +1 -1
|
@@ -1 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
function useLayoutEffect(callback, deps = []) {
|
|
5
|
+
let close = null;
|
|
6
|
+
if (deps && deps.length) {
|
|
7
|
+
vue.watch(deps, async () => {
|
|
8
|
+
if (close) {
|
|
9
|
+
close?.();
|
|
10
|
+
}
|
|
11
|
+
await vue.nextTick();
|
|
12
|
+
if (typeof callback === "function") {
|
|
13
|
+
close = callback();
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
immediate: true,
|
|
17
|
+
flush: "post"
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
vue.onMounted(() => {
|
|
21
|
+
if (close) {
|
|
22
|
+
close?.();
|
|
23
|
+
}
|
|
24
|
+
if (typeof callback === "function") {
|
|
25
|
+
close = callback();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
vue.onUpdated(() => {
|
|
29
|
+
if (close) {
|
|
30
|
+
close?.();
|
|
31
|
+
}
|
|
32
|
+
if (typeof callback === "function") {
|
|
33
|
+
close = callback();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
vue.onUnmounted(() => {
|
|
38
|
+
if (close) {
|
|
39
|
+
close?.();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function useLayoutUpdateEffect(callback, deps) {
|
|
44
|
+
let close = null;
|
|
45
|
+
vue.watch(deps, async () => {
|
|
46
|
+
if (close) {
|
|
47
|
+
close?.();
|
|
48
|
+
}
|
|
49
|
+
await vue.nextTick();
|
|
50
|
+
if (typeof callback === "function") {
|
|
51
|
+
close = callback();
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
flush: "post"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.useLayoutEffect = useLayoutEffect;
|
|
58
|
+
exports.useLayoutUpdateEffect = useLayoutUpdateEffect;
|
|
@@ -1,28 +1,58 @@
|
|
|
1
|
-
import { watch
|
|
2
|
-
function
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { watch, nextTick, onMounted, onUpdated, onUnmounted } from "vue";
|
|
2
|
+
function useLayoutEffect(callback, deps = []) {
|
|
3
|
+
let close = null;
|
|
4
|
+
if (deps && deps.length) {
|
|
5
|
+
watch(deps, async () => {
|
|
6
|
+
if (close) {
|
|
7
|
+
close?.();
|
|
8
|
+
}
|
|
9
|
+
await nextTick();
|
|
10
|
+
if (typeof callback === "function") {
|
|
11
|
+
close = callback();
|
|
12
|
+
}
|
|
13
|
+
}, {
|
|
14
|
+
immediate: true,
|
|
15
|
+
flush: "post"
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
if (close) {
|
|
20
|
+
close?.();
|
|
21
|
+
}
|
|
22
|
+
if (typeof callback === "function") {
|
|
23
|
+
close = callback();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
onUpdated(() => {
|
|
27
|
+
if (close) {
|
|
28
|
+
close?.();
|
|
29
|
+
}
|
|
30
|
+
if (typeof callback === "function") {
|
|
31
|
+
close = callback();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
onUnmounted(() => {
|
|
36
|
+
if (close) {
|
|
37
|
+
close?.();
|
|
38
|
+
}
|
|
15
39
|
});
|
|
16
40
|
}
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
function useLayoutUpdateEffect(callback, deps) {
|
|
42
|
+
let close = null;
|
|
43
|
+
watch(deps, async () => {
|
|
44
|
+
if (close) {
|
|
45
|
+
close?.();
|
|
46
|
+
}
|
|
47
|
+
await nextTick();
|
|
48
|
+
if (typeof callback === "function") {
|
|
49
|
+
close = callback();
|
|
50
|
+
}
|
|
21
51
|
}, {
|
|
22
52
|
flush: "post"
|
|
23
53
|
});
|
|
24
54
|
}
|
|
25
55
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
56
|
+
useLayoutEffect,
|
|
57
|
+
useLayoutUpdateEffect
|
|
28
58
|
};
|
package/dist/hooks/useMemo.cjs
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
function useMemo(getValue, condition, shouldUpdate) {
|
|
5
|
+
const cacheRef = vue.ref(getValue());
|
|
6
|
+
vue.watch(condition, (next, pre) => {
|
|
7
|
+
if (shouldUpdate) {
|
|
8
|
+
if (shouldUpdate(next, pre))
|
|
9
|
+
cacheRef.value = getValue();
|
|
10
|
+
} else {
|
|
11
|
+
cacheRef.value = getValue();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return cacheRef;
|
|
15
|
+
}
|
|
16
|
+
exports.default = useMemo;
|
package/dist/hooks/useMemo.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
function useMemo(getValue, condition, shouldUpdate) {
|
|
3
|
+
const cacheRef = ref(getValue());
|
|
4
|
+
watch(condition, (next, pre) => {
|
|
5
|
+
if (shouldUpdate) {
|
|
6
|
+
if (shouldUpdate(next, pre))
|
|
7
|
+
cacheRef.value = getValue();
|
|
8
|
+
} else {
|
|
9
|
+
cacheRef.value = getValue();
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return cacheRef;
|
|
7
13
|
}
|
|
8
14
|
export {
|
|
9
|
-
|
|
15
|
+
useMemo as default
|
|
10
16
|
};
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
function useMergedState(defaultStateValue, option) {
|
|
5
|
+
const { defaultValue, value = vue.ref() } = option || {};
|
|
6
|
+
let initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
|
|
7
|
+
if (value.value !== void 0)
|
|
8
|
+
initValue = vue.unref(value);
|
|
9
|
+
if (defaultValue !== void 0)
|
|
10
|
+
initValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
11
|
+
const innerValue = vue.ref(initValue);
|
|
12
|
+
const mergedValue = vue.ref(initValue);
|
|
13
|
+
vue.watchEffect(() => {
|
|
14
|
+
let val = value.value !== void 0 ? value.value : innerValue.value;
|
|
15
|
+
if (option?.postState)
|
|
16
|
+
val = option.postState(val);
|
|
17
|
+
mergedValue.value = val;
|
|
18
|
+
});
|
|
19
|
+
function triggerChange(newValue) {
|
|
20
|
+
const preVal = mergedValue.value;
|
|
21
|
+
innerValue.value = newValue;
|
|
22
|
+
if (vue.toRaw(mergedValue.value) !== newValue && option?.onChange)
|
|
23
|
+
option.onChange(newValue, preVal);
|
|
24
|
+
}
|
|
25
|
+
vue.watch(value, () => {
|
|
26
|
+
innerValue.value = value.value;
|
|
27
|
+
});
|
|
28
|
+
return [mergedValue, triggerChange];
|
|
29
|
+
}
|
|
30
|
+
exports.default = useMergedState;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
function
|
|
3
|
-
const { defaultValue
|
|
4
|
-
let
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { ref, unref, watchEffect, watch, toRaw } from "vue";
|
|
2
|
+
function useMergedState(defaultStateValue, option) {
|
|
3
|
+
const { defaultValue, value = ref() } = option || {};
|
|
4
|
+
let initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
|
|
5
|
+
if (value.value !== void 0)
|
|
6
|
+
initValue = unref(value);
|
|
7
|
+
if (defaultValue !== void 0)
|
|
8
|
+
initValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
9
|
+
const innerValue = ref(initValue);
|
|
10
|
+
const mergedValue = ref(initValue);
|
|
11
|
+
watchEffect(() => {
|
|
12
|
+
let val = value.value !== void 0 ? value.value : innerValue.value;
|
|
13
|
+
if (option?.postState)
|
|
14
|
+
val = option.postState(val);
|
|
15
|
+
mergedValue.value = val;
|
|
10
16
|
});
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
17
|
+
function triggerChange(newValue) {
|
|
18
|
+
const preVal = mergedValue.value;
|
|
19
|
+
innerValue.value = newValue;
|
|
20
|
+
if (toRaw(mergedValue.value) !== newValue && option?.onChange)
|
|
21
|
+
option.onChange(newValue, preVal);
|
|
14
22
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})
|
|
23
|
+
watch(value, () => {
|
|
24
|
+
innerValue.value = value.value;
|
|
25
|
+
});
|
|
26
|
+
return [mergedValue, triggerChange];
|
|
18
27
|
}
|
|
19
28
|
export {
|
|
20
|
-
|
|
29
|
+
useMergedState as default
|
|
21
30
|
};
|
package/dist/hooks/useMobile.cjs
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const isMobile = require("../isMobile.cjs");
|
|
5
|
+
function useMobile() {
|
|
6
|
+
const mobile = vue.shallowRef(false);
|
|
7
|
+
vue.onMounted(() => {
|
|
8
|
+
mobile.value = isMobile.default();
|
|
9
|
+
});
|
|
10
|
+
vue.onUpdated(() => {
|
|
11
|
+
mobile.value = isMobile.default();
|
|
12
|
+
});
|
|
13
|
+
return mobile;
|
|
14
|
+
}
|
|
15
|
+
exports.default = useMobile;
|
|
16
|
+
exports.useMobile = useMobile;
|
package/dist/hooks/useMobile.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { shallowRef
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { shallowRef, onMounted, onUpdated } from "vue";
|
|
2
|
+
import isMobile from "../isMobile.js";
|
|
3
|
+
function useMobile() {
|
|
4
|
+
const mobile = shallowRef(false);
|
|
5
|
+
onMounted(() => {
|
|
6
|
+
mobile.value = isMobile();
|
|
7
|
+
});
|
|
8
|
+
onUpdated(() => {
|
|
9
|
+
mobile.value = isMobile();
|
|
10
|
+
});
|
|
11
|
+
return mobile;
|
|
10
12
|
}
|
|
11
13
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
useMobile as default,
|
|
15
|
+
useMobile
|
|
14
16
|
};
|
package/dist/hooks/useState.cjs
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
function useState(defaultStateValue) {
|
|
5
|
+
const initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
|
|
6
|
+
const innerValue = vue.ref(initValue);
|
|
7
|
+
function triggerChange(newValue) {
|
|
8
|
+
innerValue.value = newValue;
|
|
9
|
+
}
|
|
10
|
+
return [innerValue, triggerChange];
|
|
11
|
+
}
|
|
12
|
+
exports.default = useState;
|
package/dist/hooks/useState.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
function useState(defaultStateValue) {
|
|
3
|
+
const initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
|
|
4
|
+
const innerValue = ref(initValue);
|
|
5
|
+
function triggerChange(newValue) {
|
|
6
|
+
innerValue.value = newValue;
|
|
6
7
|
}
|
|
7
|
-
return [
|
|
8
|
+
return [innerValue, triggerChange];
|
|
8
9
|
}
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
useState as default
|
|
11
12
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const classnames = require("./classnames.cjs");
|
|
4
|
+
const get = require("./utils/get.cjs");
|
|
5
|
+
const set = require("./utils/set.cjs");
|
|
6
|
+
const warning = require("./warning.cjs");
|
|
7
|
+
exports.classNames = classnames.default;
|
|
8
|
+
exports.clsx = classnames.clsx;
|
|
9
|
+
exports.get = get.default;
|
|
10
|
+
exports.set = set.default;
|
|
11
|
+
exports.warning = warning.warningOnce;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
4
|
-
import { warningOnce
|
|
1
|
+
import { default as default2, clsx } from "./classnames.js";
|
|
2
|
+
import { default as default3 } from "./utils/get.js";
|
|
3
|
+
import { default as default4 } from "./utils/set.js";
|
|
4
|
+
import { warningOnce } from "./warning.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
default2 as classNames,
|
|
7
|
+
clsx,
|
|
8
|
+
default3 as get,
|
|
9
|
+
default4 as set,
|
|
10
|
+
warningOnce as warning
|
|
11
11
|
};
|
package/dist/isEqual.cjs
CHANGED
|
@@ -1 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const warning = require("./warning.cjs");
|
|
4
|
+
function isEqual(obj1, obj2, shallow = false) {
|
|
5
|
+
const refSet = /* @__PURE__ */ new Set();
|
|
6
|
+
function deepEqual(a, b, level = 1) {
|
|
7
|
+
const circular = refSet.has(a);
|
|
8
|
+
warning.warningOnce(!circular, "Warning: There may be circular references");
|
|
9
|
+
if (circular)
|
|
10
|
+
return false;
|
|
11
|
+
if (a === b)
|
|
12
|
+
return true;
|
|
13
|
+
if (shallow && level > 1)
|
|
14
|
+
return false;
|
|
15
|
+
refSet.add(a);
|
|
16
|
+
const newLevel = level + 1;
|
|
17
|
+
if (Array.isArray(a)) {
|
|
18
|
+
if (!Array.isArray(b) || a.length !== b.length)
|
|
19
|
+
return false;
|
|
20
|
+
for (let i = 0; i < a.length; i++) {
|
|
21
|
+
if (!deepEqual(a[i], b[i], newLevel))
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
27
|
+
const keys = Object.keys(a);
|
|
28
|
+
if (keys.length !== Object.keys(b).length)
|
|
29
|
+
return false;
|
|
30
|
+
return keys.every((key) => deepEqual(a[key], b[key], newLevel));
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return deepEqual(obj1, obj2);
|
|
35
|
+
}
|
|
36
|
+
exports.default = isEqual;
|
package/dist/isEqual.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import { warningOnce
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { warningOnce } from "./warning.js";
|
|
2
|
+
function isEqual(obj1, obj2, shallow = false) {
|
|
3
|
+
const refSet = /* @__PURE__ */ new Set();
|
|
4
|
+
function deepEqual(a, b, level = 1) {
|
|
5
|
+
const circular = refSet.has(a);
|
|
6
|
+
warningOnce(!circular, "Warning: There may be circular references");
|
|
7
|
+
if (circular)
|
|
8
|
+
return false;
|
|
9
|
+
if (a === b)
|
|
10
|
+
return true;
|
|
11
|
+
if (shallow && level > 1)
|
|
12
|
+
return false;
|
|
13
|
+
refSet.add(a);
|
|
14
|
+
const newLevel = level + 1;
|
|
15
|
+
if (Array.isArray(a)) {
|
|
16
|
+
if (!Array.isArray(b) || a.length !== b.length)
|
|
17
|
+
return false;
|
|
18
|
+
for (let i = 0; i < a.length; i++) {
|
|
19
|
+
if (!deepEqual(a[i], b[i], newLevel))
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
21
23
|
}
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
|
|
24
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
25
|
+
const keys = Object.keys(a);
|
|
26
|
+
if (keys.length !== Object.keys(b).length)
|
|
27
|
+
return false;
|
|
28
|
+
return keys.every((key) => deepEqual(a[key], b[key], newLevel));
|
|
25
29
|
}
|
|
26
|
-
return
|
|
30
|
+
return false;
|
|
27
31
|
}
|
|
28
|
-
return
|
|
32
|
+
return deepEqual(obj1, obj2);
|
|
29
33
|
}
|
|
30
34
|
export {
|
|
31
|
-
|
|
35
|
+
isEqual as default
|
|
32
36
|
};
|
package/dist/isMobile.cjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const isMobile = () => {
|
|
4
|
+
if (typeof navigator === "undefined" || typeof window === "undefined")
|
|
5
|
+
return false;
|
|
6
|
+
const agent = navigator.userAgent || navigator.vendor || window.opera;
|
|
7
|
+
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
8
|
+
agent
|
|
9
|
+
) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([\- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([\- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[23]|n30(0|2)|n50([025])|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8c]))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([\-01])|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
|
|
10
|
+
agent?.substr(0, 4)
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
exports.default = isMobile;
|
package/dist/isMobile.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (typeof navigator
|
|
3
|
-
return
|
|
4
|
-
const
|
|
1
|
+
const isMobile = () => {
|
|
2
|
+
if (typeof navigator === "undefined" || typeof window === "undefined")
|
|
3
|
+
return false;
|
|
4
|
+
const agent = navigator.userAgent || navigator.vendor || window.opera;
|
|
5
5
|
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
6
|
-
|
|
6
|
+
agent
|
|
7
7
|
) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([\- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([\- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[23]|n30(0|2)|n50([025])|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8c]))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([\-01])|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
|
|
8
|
-
|
|
8
|
+
agent?.substr(0, 4)
|
|
9
9
|
);
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
isMobile as default
|
|
13
13
|
};
|
package/dist/isValid.cjs
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
function isValid(value) {
|
|
4
|
+
return value !== void 0 && value !== null && value !== "";
|
|
5
|
+
}
|
|
6
|
+
exports.default = isValid;
|
package/dist/isValid.js
CHANGED
package/dist/omit.cjs
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
function omit(obj, fields) {
|
|
4
|
+
const clone = { ...obj };
|
|
5
|
+
if (Array.isArray(fields)) {
|
|
6
|
+
fields.forEach((key) => {
|
|
7
|
+
delete clone[key];
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return clone;
|
|
11
|
+
}
|
|
12
|
+
exports.default = omit;
|
package/dist/omit.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
function omit(obj, fields) {
|
|
2
|
+
const clone = { ...obj };
|
|
3
|
+
if (Array.isArray(fields)) {
|
|
4
|
+
fields.forEach((key) => {
|
|
5
|
+
delete clone[key];
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return clone;
|
|
6
9
|
}
|
|
7
10
|
export {
|
|
8
|
-
|
|
11
|
+
omit as default
|
|
9
12
|
};
|
package/dist/pickAttrs.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const attributes = `accept acceptCharset accessKey action allowFullScreen allowTransparency
|
|
2
4
|
alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
|
|
3
5
|
charSet checked classID className colSpan cols content contentEditable contextMenu
|
|
4
6
|
controls coords crossOrigin data dateTime default defer dir disabled download draggable
|
|
@@ -9,10 +11,46 @@
|
|
|
9
11
|
optimum pattern placeholder poster preload radioGroup readOnly rel required
|
|
10
12
|
reversed role rowSpan rows sandbox scope scoped scrolling seamless selected
|
|
11
13
|
shape size sizes span spellCheck src srcDoc srcLang srcSet start step style
|
|
12
|
-
summary tabIndex target title type useMap value width wmode wrap
|
|
14
|
+
summary tabIndex target title type useMap value width wmode wrap`;
|
|
15
|
+
const eventsName = `onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown
|
|
13
16
|
onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick
|
|
14
17
|
onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown
|
|
15
18
|
onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
|
|
16
19
|
onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
|
|
17
20
|
onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
|
|
18
|
-
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError
|
|
21
|
+
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`;
|
|
22
|
+
const propList = `${attributes} ${eventsName}`.split(/\s+/);
|
|
23
|
+
const ariaPrefix = "aria-";
|
|
24
|
+
const dataPrefix = "data-";
|
|
25
|
+
function match(key, prefix) {
|
|
26
|
+
return key.indexOf(prefix) === 0;
|
|
27
|
+
}
|
|
28
|
+
function pickAttrs(props, ariaOnly = false) {
|
|
29
|
+
let mergedConfig;
|
|
30
|
+
if (ariaOnly === false) {
|
|
31
|
+
mergedConfig = {
|
|
32
|
+
aria: true,
|
|
33
|
+
data: true,
|
|
34
|
+
attr: true
|
|
35
|
+
};
|
|
36
|
+
} else if (ariaOnly === true) {
|
|
37
|
+
mergedConfig = {
|
|
38
|
+
aria: true
|
|
39
|
+
};
|
|
40
|
+
} else {
|
|
41
|
+
mergedConfig = {
|
|
42
|
+
...ariaOnly
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const attrs = {};
|
|
46
|
+
Object.keys(props).forEach((key) => {
|
|
47
|
+
if (
|
|
48
|
+
// Aria
|
|
49
|
+
mergedConfig.aria && (key === "role" || match(key, ariaPrefix)) || mergedConfig.data && match(key, dataPrefix) || mergedConfig.attr && propList.includes(key)
|
|
50
|
+
) {
|
|
51
|
+
attrs[key] = props[key];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return attrs;
|
|
55
|
+
}
|
|
56
|
+
exports.default = pickAttrs;
|