@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.
Files changed (108) hide show
  1. package/dist/Children/isFragment.cjs +7 -1
  2. package/dist/Children/isFragment.js +4 -4
  3. package/dist/Children/toArray.cjs +20 -1
  4. package/dist/Children/toArray.js +17 -8
  5. package/dist/Dom/addEventListener.cjs +13 -1
  6. package/dist/Dom/addEventListener.js +7 -5
  7. package/dist/Dom/canUseDom.cjs +6 -1
  8. package/dist/Dom/canUseDom.js +3 -3
  9. package/dist/Dom/class.cjs +29 -1
  10. package/dist/Dom/class.js +23 -13
  11. package/dist/Dom/contains.cjs +16 -1
  12. package/dist/Dom/contains.js +12 -12
  13. package/dist/Dom/css.cjs +96 -1
  14. package/dist/Dom/css.js +69 -48
  15. package/dist/Dom/dynamicCSS.cjs +110 -1
  16. package/dist/Dom/dynamicCSS.js +92 -59
  17. package/dist/Dom/findDOMNode.cjs +16 -1
  18. package/dist/Dom/findDOMNode.js +12 -8
  19. package/dist/Dom/focus.cjs +60 -1
  20. package/dist/Dom/focus.js +48 -28
  21. package/dist/Dom/isVisible.cjs +22 -1
  22. package/dist/Dom/isVisible.js +16 -16
  23. package/dist/Dom/scrollLocker.cjs +89 -1
  24. package/dist/Dom/scrollLocker.js +70 -45
  25. package/dist/Dom/shadow.cjs +13 -1
  26. package/dist/Dom/shadow.js +8 -8
  27. package/dist/Dom/styleChecker.cjs +25 -1
  28. package/dist/Dom/styleChecker.js +19 -14
  29. package/dist/Dom/support.cjs +28 -1
  30. package/dist/Dom/support.js +16 -12
  31. package/dist/KeyCode.cjs +523 -1
  32. package/dist/KeyCode.js +62 -55
  33. package/dist/Portal.cjs +48 -1
  34. package/dist/Portal.js +34 -19
  35. package/dist/PortalWrapper.cjs +169 -1
  36. package/dist/PortalWrapper.js +133 -79
  37. package/dist/classnames.cjs +45 -1
  38. package/dist/classnames.js +38 -25
  39. package/dist/composeProps.cjs +19 -1
  40. package/dist/composeProps.js +15 -9
  41. package/dist/createRef.cjs +24 -1
  42. package/dist/createRef.js +16 -13
  43. package/dist/debug/diff.cjs +50 -1
  44. package/dist/debug/diff.js +39 -30
  45. package/dist/deprecated.cjs +10 -1
  46. package/dist/deprecated.js +7 -5
  47. package/dist/getScrollBarSize.cjs +51 -1
  48. package/dist/getScrollBarSize.js +39 -25
  49. package/dist/guid.cjs +7 -1
  50. package/dist/guid.js +4 -4
  51. package/dist/hooks/useEvent.cjs +6 -1
  52. package/dist/hooks/useEvent.js +3 -3
  53. package/dist/hooks/useId.cjs +18 -1
  54. package/dist/hooks/useId.js +14 -8
  55. package/dist/hooks/useLayoutEffect.cjs +58 -1
  56. package/dist/hooks/useLayoutEffect.js +50 -20
  57. package/dist/hooks/useMemo.cjs +16 -1
  58. package/dist/hooks/useMemo.js +13 -7
  59. package/dist/hooks/useMergedState.cjs +30 -1
  60. package/dist/hooks/useMergedState.js +25 -16
  61. package/dist/hooks/useMobile.cjs +16 -1
  62. package/dist/hooks/useMobile.js +13 -11
  63. package/dist/hooks/useState.cjs +12 -1
  64. package/dist/hooks/useState.js +8 -7
  65. package/dist/index.cjs +11 -1
  66. package/dist/index.js +9 -9
  67. package/dist/isEqual.cjs +36 -1
  68. package/dist/isEqual.js +30 -26
  69. package/dist/isMobile.cjs +13 -1
  70. package/dist/isMobile.js +7 -7
  71. package/dist/isValid.cjs +6 -1
  72. package/dist/isValid.js +3 -3
  73. package/dist/omit.cjs +12 -1
  74. package/dist/omit.js +9 -6
  75. package/dist/pickAttrs.cjs +41 -3
  76. package/dist/pickAttrs.js +37 -22
  77. package/dist/props-util/index.cjs +69 -1
  78. package/dist/props-util/index.js +62 -32
  79. package/dist/raf.cjs +48 -1
  80. package/dist/raf.js +37 -26
  81. package/dist/setStyle.cjs +17 -1
  82. package/dist/setStyle.js +13 -9
  83. package/dist/switchScrollingEffect.cjs +38 -1
  84. package/dist/switchScrollingEffect.js +27 -20
  85. package/dist/test/domHook.cjs +52 -1
  86. package/dist/test/domHook.js +43 -28
  87. package/dist/type.cjs +51 -1
  88. package/dist/type.js +39 -37
  89. package/dist/utils/checkSlotProp.cjs +13 -1
  90. package/dist/utils/checkSlotProp.js +10 -3
  91. package/dist/utils/get.cjs +12 -1
  92. package/dist/utils/get.js +8 -8
  93. package/dist/utils/omit.cjs +10 -1
  94. package/dist/utils/omit.js +7 -6
  95. package/dist/utils/set.cjs +64 -1
  96. package/dist/utils/set.js +54 -32
  97. package/dist/utils/transition.cjs +96 -1
  98. package/dist/utils/transition.d.ts +2 -2
  99. package/dist/utils/transition.js +70 -65
  100. package/dist/utils/watchState.cjs +20 -1
  101. package/dist/utils/watchState.js +15 -10
  102. package/dist/vnode.cjs +56 -1
  103. package/dist/vnode.js +46 -30
  104. package/dist/vueuse/unref-element.cjs +8 -1
  105. package/dist/vueuse/unref-element.js +5 -5
  106. package/dist/warning.cjs +53 -1
  107. package/dist/warning.js +40 -35
  108. package/package.json +1 -1
@@ -1 +1,58 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue");function o(e,n=[]){let t=null;n&&n.length?f.watch(n,async()=>{t&&t?.(),await f.nextTick(),typeof e=="function"&&(t=e())},{immediate:!0,flush:"post"}):(f.onMounted(()=>{t&&t?.(),typeof e=="function"&&(t=e())}),f.onUpdated(()=>{t&&t?.(),typeof e=="function"&&(t=e())})),f.onUnmounted(()=>{t&&t?.()})}function i(e,n){let t=null;f.watch(n,async()=>{t&&t?.(),await f.nextTick(),typeof e=="function"&&(t=e())},{flush:"post"})}exports.useLayoutEffect=o;exports.useLayoutUpdateEffect=i;
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 as o, nextTick as e, onMounted as i, onUpdated as u, onUnmounted as s } from "vue";
2
- function y(f, n = []) {
3
- let t = null;
4
- n && n.length ? o(n, async () => {
5
- t && t?.(), await e(), typeof f == "function" && (t = f());
6
- }, {
7
- immediate: !0,
8
- flush: "post"
9
- }) : (i(() => {
10
- t && t?.(), typeof f == "function" && (t = f());
11
- }), u(() => {
12
- t && t?.(), typeof f == "function" && (t = f());
13
- })), s(() => {
14
- t && t?.();
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 m(f, n) {
18
- let t = null;
19
- o(n, async () => {
20
- t && t?.(), await e(), typeof f == "function" && (t = f());
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
- y as useLayoutEffect,
27
- m as useLayoutUpdateEffect
56
+ useLayoutEffect,
57
+ useLayoutUpdateEffect
28
58
  };
@@ -1 +1,16 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue");function f(e,c,r){const u=t.ref(e());return t.watch(c,(i,o)=>{r?r(i,o)&&(u.value=e()):u.value=e()}),u}exports.default=f;
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;
@@ -1,10 +1,16 @@
1
- import { ref as n, watch as t } from "vue";
2
- function m(e, c, r) {
3
- const f = n(e());
4
- return t(c, (o, i) => {
5
- r ? r(o, i) && (f.value = e()) : f.value = e();
6
- }), f;
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
- m as default
15
+ useMemo as default
10
16
  };
@@ -1 +1,30 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue");function c(v,a){const{defaultValue:l,value:u=t.ref()}=a||{};let n=typeof v=="function"?v():v;u.value!==void 0&&(n=t.unref(u)),l!==void 0&&(n=typeof l=="function"?l():l);const f=t.ref(n),r=t.ref(n);t.watchEffect(()=>{let e=u.value!==void 0?u.value:f.value;a?.postState&&(e=a.postState(e)),r.value=e});function i(e){const o=r.value;f.value=e,t.toRaw(r.value)!==e&&a?.onChange&&a.onChange(e,o)}return t.watch(u,()=>{f.value=u.value}),[r,i]}exports.default=c;
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 as o, unref as c, watchEffect as s, watch as g, toRaw as d } from "vue";
2
- function m(l, t) {
3
- const { defaultValue: u, value: a = o() } = t || {};
4
- let n = typeof l == "function" ? l() : l;
5
- a.value !== void 0 && (n = c(a)), u !== void 0 && (n = typeof u == "function" ? u() : u);
6
- const v = o(n), f = o(n);
7
- s(() => {
8
- let e = a.value !== void 0 ? a.value : v.value;
9
- t?.postState && (e = t.postState(e)), f.value = e;
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 r(e) {
12
- const i = f.value;
13
- v.value = e, d(f.value) !== e && t?.onChange && t.onChange(e, i);
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
- return g(a, () => {
16
- v.value = a.value;
17
- }), [f, r];
23
+ watch(value, () => {
24
+ innerValue.value = value.value;
25
+ });
26
+ return [mergedValue, triggerChange];
18
27
  }
19
28
  export {
20
- m as default
29
+ useMergedState as default
21
30
  };
@@ -1 +1,16 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),l=require("../isMobile.cjs");function o(){const e=u.shallowRef(!1);return u.onMounted(()=>{e.value=l.default()}),u.onUpdated(()=>{e.value=l.default()}),e}exports.default=o;exports.useMobile=o;
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;
@@ -1,14 +1,16 @@
1
- import { shallowRef as l, onMounted as t, onUpdated as a } from "vue";
2
- import e from "../isMobile.js";
3
- function r() {
4
- const o = l(!1);
5
- return t(() => {
6
- o.value = e();
7
- }), a(() => {
8
- o.value = e();
9
- }), o;
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
- r as default,
13
- r as useMobile
14
+ useMobile as default,
15
+ useMobile
14
16
  };
@@ -1 +1,12 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue");function o(e){const t=typeof e=="function"?e():e,n=i.ref(t);function r(u){n.value=u}return[n,r]}exports.default=o;
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;
@@ -1,11 +1,12 @@
1
- import { ref as e } from "vue";
2
- function f(n) {
3
- const r = typeof n == "function" ? n() : n, o = e(r);
4
- function i(t) {
5
- o.value = t;
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 [o, i];
8
+ return [innerValue, triggerChange];
8
9
  }
9
10
  export {
10
- f as default
11
+ useState as default
11
12
  };
package/dist/index.cjs CHANGED
@@ -1 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./classnames.cjs"),t=require("./utils/get.cjs"),s=require("./utils/set.cjs"),r=require("./warning.cjs");exports.classNames=e.default;exports.clsx=e.clsx;exports.get=t.default;exports.set=s.default;exports.warning=r.warningOnce;
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 r, clsx as s } from "./classnames.js";
2
- import { default as o } from "./utils/get.js";
3
- import { default as l } from "./utils/set.js";
4
- import { warningOnce as n } from "./warning.js";
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
- r as classNames,
7
- s as clsx,
8
- o as get,
9
- l as set,
10
- n as warning
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";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("./warning.cjs");function g(c,o,a=!1){const u=new Set;function n(e,r,f=1){const i=u.has(e);if(y.warningOnce(!i,"Warning: There may be circular references"),i)return!1;if(e===r)return!0;if(a&&f>1)return!1;u.add(e);const s=f+1;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!n(e[t],r[t],s))return!1;return!0}if(e&&r&&typeof e=="object"&&typeof r=="object"){const t=Object.keys(e);return t.length!==Object.keys(r).length?!1:t.every(l=>n(e[l],r[l],s))}return!1}return n(c,o)}exports.default=g;
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 as y } from "./warning.js";
2
- function h(c, o, a = !1) {
3
- const f = /* @__PURE__ */ new Set();
4
- function n(e, r, s = 1) {
5
- const i = f.has(e);
6
- if (y(!i, "Warning: There may be circular references"), i)
7
- return !1;
8
- if (e === r)
9
- return !0;
10
- if (a && s > 1)
11
- return !1;
12
- f.add(e);
13
- const u = s + 1;
14
- if (Array.isArray(e)) {
15
- if (!Array.isArray(r) || e.length !== r.length)
16
- return !1;
17
- for (let t = 0; t < e.length; t++)
18
- if (!n(e[t], r[t], u))
19
- return !1;
20
- return !0;
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 (e && r && typeof e == "object" && typeof r == "object") {
23
- const t = Object.keys(e);
24
- return t.length !== Object.keys(r).length ? !1 : t.every((l) => n(e[l], r[l], u));
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 !1;
30
+ return false;
27
31
  }
28
- return n(c, o);
32
+ return deepEqual(obj1, obj2);
29
33
  }
30
34
  export {
31
- h as default
35
+ isEqual as default
32
36
  };
package/dist/isMobile.cjs CHANGED
@@ -1 +1,13 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=()=>{if(typeof navigator>"u"||typeof window>"u")return!1;const e=navigator.userAgent||navigator.vendor||window.opera;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(e)||/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(e?.substr(0,4))};exports.default=i;
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 a = () => {
2
- if (typeof navigator > "u" || typeof window > "u")
3
- return !1;
4
- const i = navigator.userAgent || navigator.vendor || window.opera;
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
- i
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
- i?.substr(0, 4)
8
+ agent?.substr(0, 4)
9
9
  );
10
10
  };
11
11
  export {
12
- a as default
12
+ isMobile as default
13
13
  };
package/dist/isValid.cjs CHANGED
@@ -1 +1,6 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function t(e){return e!=null&&e!==""}exports.default=t;
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
@@ -1,6 +1,6 @@
1
- function n(i) {
2
- return i != null && i !== "";
1
+ function isValid(value) {
2
+ return value !== void 0 && value !== null && value !== "";
3
3
  }
4
4
  export {
5
- n as default
5
+ isValid as default
6
6
  };
package/dist/omit.cjs CHANGED
@@ -1 +1,12 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function u(r,e){const t={...r};return Array.isArray(e)&&e.forEach(o=>{delete t[o]}),t}exports.default=u;
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 a(e, r) {
2
- const t = { ...e };
3
- return Array.isArray(r) && r.forEach((o) => {
4
- delete t[o];
5
- }), t;
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
- a as default
11
+ omit as default
9
12
  };
@@ -1,4 +1,6 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=`accept acceptCharset accessKey action allowFullScreen allowTransparency
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`,i=`onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown
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`,l=`${s} ${i}`.split(/\s+/),d="aria-",c="data-";function r(a,n){return a.indexOf(n)===0}function u(a,n=!1){let e;n===!1?e={aria:!0,data:!0,attr:!0}:n===!0?e={aria:!0}:e={...n};const t={};return Object.keys(a).forEach(o=>{(e.aria&&(o==="role"||r(o,d))||e.data&&r(o,c)||e.attr&&l.includes(o))&&(t[o]=a[o])}),t}exports.default=u;
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;