@vef-framework/hooks 2.0.11 → 2.1.0

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 (111) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/lib.cjs +1 -1
  3. package/dist/cjs/use-authorized-items/index.cjs +1 -1
  4. package/dist/cjs/use-breakpoints/index.cjs +1 -1
  5. package/dist/cjs/use-check-permission/index.cjs +1 -1
  6. package/dist/cjs/use-data-dict-query/index.cjs +1 -1
  7. package/dist/cjs/use-data-options/index.cjs +1 -1
  8. package/dist/cjs/use-deep-callback/index.cjs +1 -1
  9. package/dist/cjs/use-deep-compare/index.cjs +1 -1
  10. package/dist/cjs/use-deep-effect/index.cjs +1 -1
  11. package/dist/cjs/use-deep-isomorphic-effect/index.cjs +1 -1
  12. package/dist/cjs/use-deep-layout-effect/index.cjs +1 -1
  13. package/dist/cjs/use-deep-memo/index.cjs +1 -1
  14. package/dist/cjs/use-document-event/index.cjs +1 -1
  15. package/dist/cjs/use-emitter-event/index.cjs +1 -1
  16. package/dist/cjs/use-has-fetching/index.cjs +1 -1
  17. package/dist/cjs/use-has-mutating/index.cjs +1 -1
  18. package/dist/cjs/use-is-authorized/index.cjs +1 -1
  19. package/dist/cjs/use-latest/index.cjs +1 -1
  20. package/dist/cjs/use-raf-state/index.cjs +1 -1
  21. package/dist/cjs/use-shallow-callback/index.cjs +1 -1
  22. package/dist/cjs/use-shallow-compare/index.cjs +1 -1
  23. package/dist/cjs/use-shallow-effect/index.cjs +1 -1
  24. package/dist/cjs/use-shallow-isomorphic-effect/index.cjs +1 -1
  25. package/dist/cjs/use-shallow-layout-effect/index.cjs +1 -1
  26. package/dist/cjs/use-shallow-memo/index.cjs +1 -1
  27. package/dist/cjs/use-singleton/index.cjs +1 -1
  28. package/dist/cjs/use-viewport-size/index.cjs +1 -0
  29. package/dist/es/index.js +29 -85
  30. package/dist/es/lib.js +14 -60
  31. package/dist/es/use-authorized-items/index.js +11 -14
  32. package/dist/es/use-breakpoints/index.js +47 -53
  33. package/dist/es/use-check-permission/index.js +8 -11
  34. package/dist/es/use-data-dict-query/index.js +21 -25
  35. package/dist/es/use-data-options/index.js +46 -78
  36. package/dist/es/use-deep-callback/index.js +8 -7
  37. package/dist/es/use-deep-compare/index.js +15 -19
  38. package/dist/es/use-deep-effect/index.js +8 -7
  39. package/dist/es/use-deep-isomorphic-effect/index.js +8 -8
  40. package/dist/es/use-deep-layout-effect/index.js +7 -6
  41. package/dist/es/use-deep-memo/index.js +8 -7
  42. package/dist/es/use-document-event/index.js +20 -15
  43. package/dist/es/use-emitter-event/index.js +11 -15
  44. package/dist/es/use-has-fetching/index.js +11 -10
  45. package/dist/es/use-has-mutating/index.js +10 -9
  46. package/dist/es/use-is-authorized/index.js +8 -11
  47. package/dist/es/use-latest/index.js +7 -6
  48. package/dist/es/use-raf-state/index.js +14 -13
  49. package/dist/es/use-shallow-callback/index.js +8 -7
  50. package/dist/es/use-shallow-compare/index.js +15 -19
  51. package/dist/es/use-shallow-effect/index.js +8 -7
  52. package/dist/es/use-shallow-isomorphic-effect/index.js +8 -8
  53. package/dist/es/use-shallow-layout-effect/index.js +8 -7
  54. package/dist/es/use-shallow-memo/index.js +8 -7
  55. package/dist/es/use-singleton/index.js +7 -6
  56. package/dist/es/use-viewport-size/index.js +34 -0
  57. package/dist/types/index.d.ts +3 -2
  58. package/dist/types/lib.d.ts +1 -0
  59. package/dist/types/src/index.d.ts +27 -0
  60. package/dist/types/src/lib.d.ts +7 -0
  61. package/dist/types/src/use-authorized-items/index.d.ts +22 -0
  62. package/dist/types/src/use-breakpoints/index.d.ts +55 -0
  63. package/dist/types/src/use-check-permission/index.d.ts +8 -0
  64. package/dist/types/src/use-data-dict-query/index.d.ts +15 -0
  65. package/dist/types/src/use-data-options/index.d.ts +86 -0
  66. package/dist/types/src/use-deep-callback/index.d.ts +11 -0
  67. package/dist/types/src/use-deep-compare/index.d.ts +9 -0
  68. package/dist/types/src/use-deep-effect/index.d.ts +10 -0
  69. package/dist/types/src/use-deep-isomorphic-effect/index.d.ts +11 -0
  70. package/dist/types/src/use-deep-layout-effect/index.d.ts +10 -0
  71. package/dist/types/src/use-deep-memo/index.d.ts +11 -0
  72. package/dist/types/src/use-document-event/index.d.ts +19 -0
  73. package/dist/types/src/use-emitter-event/index.d.ts +17 -0
  74. package/dist/types/src/use-has-fetching/index.d.ts +8 -0
  75. package/dist/types/src/use-has-mutating/index.d.ts +7 -0
  76. package/dist/types/src/use-is-authorized/index.d.ts +10 -0
  77. package/dist/types/src/use-latest/index.d.ts +21 -0
  78. package/dist/types/src/use-raf-state/index.d.ts +23 -0
  79. package/dist/types/src/use-shallow-callback/index.d.ts +14 -0
  80. package/dist/types/src/use-shallow-compare/index.d.ts +13 -0
  81. package/dist/types/src/use-shallow-effect/index.d.ts +13 -0
  82. package/dist/types/src/use-shallow-isomorphic-effect/index.d.ts +13 -0
  83. package/dist/types/src/use-shallow-layout-effect/index.d.ts +13 -0
  84. package/dist/types/src/use-shallow-memo/index.d.ts +14 -0
  85. package/dist/types/src/use-singleton/index.d.ts +18 -0
  86. package/dist/types/src/use-viewport-size/index.d.ts +20 -0
  87. package/dist/types/use-authorized-items/index.d.ts +5 -5
  88. package/dist/types/use-breakpoints/index.d.ts +15 -7
  89. package/dist/types/use-check-permission/index.d.ts +2 -2
  90. package/dist/types/use-data-dict-query/index.d.ts +1 -1
  91. package/dist/types/use-data-options/index.d.ts +8 -2
  92. package/dist/types/use-deep-callback/index.d.ts +7 -5
  93. package/dist/types/use-deep-compare/index.d.ts +4 -3
  94. package/dist/types/use-deep-effect/index.d.ts +5 -4
  95. package/dist/types/use-deep-isomorphic-effect/index.d.ts +6 -4
  96. package/dist/types/use-deep-layout-effect/index.d.ts +5 -4
  97. package/dist/types/use-deep-memo/index.d.ts +6 -4
  98. package/dist/types/use-document-event/index.d.ts +15 -4
  99. package/dist/types/use-emitter-event/index.d.ts +13 -5
  100. package/dist/types/use-is-authorized/index.d.ts +2 -2
  101. package/dist/types/use-latest/index.d.ts +18 -5
  102. package/dist/types/use-raf-state/index.d.ts +18 -3
  103. package/dist/types/use-shallow-callback/index.d.ts +10 -5
  104. package/dist/types/use-shallow-compare/index.d.ts +8 -3
  105. package/dist/types/use-shallow-effect/index.d.ts +8 -4
  106. package/dist/types/use-shallow-isomorphic-effect/index.d.ts +8 -4
  107. package/dist/types/use-shallow-layout-effect/index.d.ts +8 -4
  108. package/dist/types/use-shallow-memo/index.d.ts +8 -3
  109. package/dist/types/use-singleton/index.d.ts +14 -7
  110. package/dist/types/use-viewport-size/index.d.ts +20 -0
  111. package/package.json +8 -7
@@ -1,26 +1,22 @@
1
- import { useAppContext as s, useQuery as c, skipQueryToken as p } from "@vef-framework/core";
2
- import { isFunction as f, isEmpty as m } from "@vef-framework/shared";
3
- import { useEffectEvent as y, useEffect as a } from "react";
4
- function Q({
5
- dataDictKey: r,
6
- onFetch: o,
7
- ...n
8
- }) {
9
- const { dataDictQueryFn: e } = s();
10
- if (!f(e))
11
- throw new Error("Data dictionary query function is not provided in the app context.");
12
- const t = c({
13
- ...n,
14
- queryFn: m(r) ? p : e,
15
- queryKey: [e.key, r],
16
- staleTime: n?.staleTime ?? 1 / 0
17
- }), i = y((u) => {
18
- o?.(u);
19
- });
20
- return a(() => {
21
- t.promise.then(i);
22
- }, [t.promise]), t;
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { skipQueryToken as e, useAppContext as t, useQuery as n } from "@vef-framework/core";
3
+ import { isEmpty as r, isFunction as i } from "@vef-framework/shared";
4
+ import { useEffect as a, useRef as o } from "react";
5
+ //#region src/use-data-dict-query/index.ts
6
+ function s({ dataDictKey: s, onFetch: c, ...l }) {
7
+ let { dataDictQueryFn: u } = t();
8
+ if (!i(u)) throw Error("Data dictionary query function is not provided in the app context.");
9
+ let d = o(c);
10
+ d.current = c;
11
+ let f = n({
12
+ ...l,
13
+ queryFn: r(s) ? e : u,
14
+ queryKey: [u.key, s],
15
+ staleTime: l?.staleTime ?? Infinity
16
+ });
17
+ return a(() => {
18
+ d.current && f.promise.then(d.current);
19
+ }, [f.promise]), f;
23
20
  }
24
- export {
25
- Q as useDataDictQuery
26
- };
21
+ //#endregion
22
+ export { s as useDataDictQuery };
@@ -1,82 +1,50 @@
1
- import { useQuery as F, skipQueryToken as b } from "@vef-framework/core";
2
- import { isFunction as R, get as k, isNullish as h, withPinyin as q, isEmpty as A, isString as v } from "@vef-framework/shared";
3
- import { useMemo as E } from "react";
4
- import { useDataDictQuery as I } from "../use-data-dict-query/index.js";
5
- function c(r, n, t) {
6
- return n ? R(n) ? n(r) : k(r, n) : r[t];
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useDataDictQuery as e } from "../use-data-dict-query/index.js";
3
+ import { skipQueryToken as t, useQuery as n } from "@vef-framework/core";
4
+ import { get as r, isEmpty as i, isFunction as a, isNullish as o, isString as s, withPinyin as c } from "@vef-framework/shared";
5
+ import { useMemo as l } from "react";
6
+ //#region src/use-data-options/index.ts
7
+ function u(e, t, n) {
8
+ return t ? a(t) ? t(e) : r(e, t) : e[n];
7
9
  }
8
- function g(r, n, t) {
9
- const {
10
- labelKey: s,
11
- valueKey: u,
12
- disabledKey: e,
13
- descriptionKey: i,
14
- childrenKey: l
15
- } = n, f = c(r, s, "label"), Q = c(r, u, "value"), a = c(r, e, "disabled"), p = c(r, i, "description"), o = c(r, l, "children"), m = {
16
- ...r,
17
- label: f,
18
- value: Q,
19
- ...!h(a) && { disabled: a },
20
- ...!h(p) && { description: p }
21
- }, d = t ? q(
22
- m,
23
- "label",
24
- "description"
25
- ) : m;
26
- return Array.isArray(o) && o.length > 0 && (d.children = o.map((y) => g(y, n, t))), d;
10
+ function d(e, t, n) {
11
+ let { labelKey: r, valueKey: i, disabledKey: a, descriptionKey: s, childrenKey: l } = t, f = u(e, r, "label"), p = u(e, i, "value"), m = u(e, a, "disabled"), h = u(e, s, "description"), g = u(e, l, "children"), _ = {
12
+ ...e,
13
+ label: f,
14
+ value: p,
15
+ ...!o(m) && { disabled: m },
16
+ ...!o(h) && { description: h }
17
+ }, v = n ? c(_, "label", "description") : _;
18
+ return Array.isArray(g) && g.length > 0 && (v.children = g.map((e) => d(e, t, n))), v;
27
19
  }
28
- function D(r, n, t) {
29
- return !r || A(r) ? [] : t ? r.map((s) => g(s, n, !0)) : r.map((s) => g(s, n, !1));
20
+ function f(e, t, n) {
21
+ return !e || i(e) ? [] : e.map((e) => d(e, t, n));
30
22
  }
31
- function W({
32
- queryOptions: r,
33
- dataDictKey: n,
34
- labelKey: t,
35
- valueKey: s,
36
- disabledKey: u,
37
- descriptionKey: e,
38
- childrenKey: i,
39
- withPinyin: l = !1
40
- }) {
41
- const f = v(n) && n.length > 0, Q = F({
42
- ...r,
43
- queryFn: f ? b : r?.queryFn
44
- }), a = I({
45
- dataDictKey: n
46
- }), p = f ? a : Q, { data: o, ...m } = p;
47
- return { options: E(
48
- () => l ? D(
49
- o,
50
- {
51
- labelKey: t,
52
- valueKey: s,
53
- disabledKey: u,
54
- descriptionKey: e,
55
- childrenKey: i
56
- },
57
- !0
58
- ) : D(
59
- o,
60
- {
61
- labelKey: t,
62
- valueKey: s,
63
- disabledKey: u,
64
- descriptionKey: e,
65
- childrenKey: i
66
- },
67
- !1
68
- ),
69
- [
70
- o,
71
- t,
72
- s,
73
- u,
74
- e,
75
- i,
76
- l
77
- ]
78
- ), ...m };
23
+ function p({ queryOptions: r, dataDictKey: i, labelKey: a, valueKey: o, disabledKey: c, descriptionKey: u, childrenKey: d, withPinyin: p = !1 }) {
24
+ let m = s(i) && i.length > 0, h = n({
25
+ ...r,
26
+ queryFn: m ? t : r?.queryFn
27
+ }), g = e({ dataDictKey: i }), { data: _, ...v } = m ? g : h, y = l(() => ({
28
+ labelKey: a,
29
+ valueKey: o,
30
+ disabledKey: c,
31
+ descriptionKey: u,
32
+ childrenKey: d
33
+ }), [
34
+ a,
35
+ o,
36
+ c,
37
+ u,
38
+ d
39
+ ]);
40
+ return {
41
+ options: l(() => f(_, y, p), [
42
+ _,
43
+ y,
44
+ p
45
+ ]),
46
+ ...v
47
+ };
79
48
  }
80
- export {
81
- W as useDataOptionsQuery
82
- };
49
+ //#endregion
50
+ export { p as useDataOptionsQuery };
@@ -1,8 +1,9 @@
1
- import { useCallback as o } from "react";
2
- import { useDeepCompare as p } from "../use-deep-compare/index.js";
3
- function t(e, r) {
4
- return o(e, p(r));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useDeepCompare as e } from "../use-deep-compare/index.js";
3
+ import { useCallback as t } from "react";
4
+ //#region src/use-deep-callback/index.ts
5
+ function n(n, r) {
6
+ return t(n, e(r));
5
7
  }
6
- export {
7
- t as useDeepCallback
8
- };
8
+ //#endregion
9
+ export { n as useDeepCallback };
@@ -1,21 +1,17 @@
1
- import { isDeepEqual as o } from "@vef-framework/shared";
2
- import { useRef as n } from "react";
3
- function s(e) {
4
- const r = n(void 0), t = n(0);
5
- return i(r.current, e) || (r.current = e, t.current += 1), [t.current];
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { isDeepEqual as e } from "@vef-framework/shared";
3
+ import { useRef as t } from "react";
4
+ //#region src/use-deep-compare/index.ts
5
+ function n(e) {
6
+ let n = t(void 0), i = t(0);
7
+ return r(n.current, e) || (n.current = e, i.current += 1), [i.current];
6
8
  }
7
- function i(e, r) {
8
- if (!e || !r)
9
- return !1;
10
- if (Object.is(e, r))
11
- return !0;
12
- if (e.length !== r.length)
13
- return !1;
14
- for (const [t, f] of e.entries())
15
- if (!o(f, r[t]))
16
- return !1;
17
- return !0;
9
+ function r(t, n) {
10
+ if (t === void 0 || n === void 0) return !1;
11
+ if (Object.is(t, n)) return !0;
12
+ if (t.length !== n.length) return !1;
13
+ for (let [r, i] of t.entries()) if (!e(i, n[r])) return !1;
14
+ return !0;
18
15
  }
19
- export {
20
- s as useDeepCompare
21
- };
16
+ //#endregion
17
+ export { n as useDeepCompare };
@@ -1,8 +1,9 @@
1
- import { useEffect as f } from "react";
2
- import { useDeepCompare as o } from "../use-deep-compare/index.js";
3
- function m(e, r) {
4
- return f(e, o(r));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useDeepCompare as e } from "../use-deep-compare/index.js";
3
+ import { useEffect as t } from "react";
4
+ //#region src/use-deep-effect/index.ts
5
+ function n(n, r) {
6
+ t(n, e(r));
5
7
  }
6
- export {
7
- m as useDeepEffect
8
- };
8
+ //#endregion
9
+ export { n as useDeepEffect };
@@ -1,9 +1,9 @@
1
- import "../lib.js";
2
- import { useDeepCompare as r } from "../use-deep-compare/index.js";
3
- import { useIsomorphicEffect as p } from "@mantine/hooks";
4
- function i(e, o) {
5
- return p(e, r(o));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useIsomorphicEffect as e } from "../lib.js";
3
+ import { useDeepCompare as t } from "../use-deep-compare/index.js";
4
+ //#region src/use-deep-isomorphic-effect/index.ts
5
+ function n(n, r) {
6
+ e(n, t(r));
6
7
  }
7
- export {
8
- i as useDeepIsomorphicEffect
9
- };
8
+ //#endregion
9
+ export { n as useDeepIsomorphicEffect };
@@ -1,8 +1,9 @@
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useDeepCompare as e } from "../use-deep-compare/index.js";
1
3
  import { useLayoutEffect as t } from "react";
2
- import { useDeepCompare as r } from "../use-deep-compare/index.js";
3
- function p(e, o) {
4
- return t(e, r(o));
4
+ //#region src/use-deep-layout-effect/index.ts
5
+ function n(n, r) {
6
+ t(n, e(r));
5
7
  }
6
- export {
7
- p as useDeepLayoutEffect
8
- };
8
+ //#endregion
9
+ export { n as useDeepLayoutEffect };
@@ -1,8 +1,9 @@
1
- import { useMemo as r } from "react";
2
- import { useDeepCompare as m } from "../use-deep-compare/index.js";
3
- function u(e, o) {
4
- return r(e, m(o));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useDeepCompare as e } from "../use-deep-compare/index.js";
3
+ import { useMemo as t } from "react";
4
+ //#region src/use-deep-memo/index.ts
5
+ function n(n, r) {
6
+ return t(n, e(r));
5
7
  }
6
- export {
7
- u as useDeepMemo
8
- };
8
+ //#endregion
9
+ export { n as useDeepMemo };
@@ -1,16 +1,21 @@
1
- import { useLatest as o } from "../use-latest/index.js";
2
- import { useShallowEffect as m } from "../use-shallow-effect/index.js";
3
- function i(e, u, t) {
4
- const n = o(u);
5
- m(() => {
6
- function r(c) {
7
- n.current.call(this, c);
8
- }
9
- return document.addEventListener(e, r, t), () => {
10
- document.removeEventListener(e, r, t);
11
- };
12
- }, [e, t, n]);
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useLatest as e } from "../use-latest/index.js";
3
+ import { useEffect as t } from "react";
4
+ //#region src/use-document-event/index.ts
5
+ function n(n, r, i) {
6
+ let a = e(r);
7
+ t(() => {
8
+ function e(e) {
9
+ a.current.call(this, e);
10
+ }
11
+ return document.addEventListener(n, e, i), () => {
12
+ document.removeEventListener(n, e, i);
13
+ };
14
+ }, [
15
+ n,
16
+ i,
17
+ a
18
+ ]);
13
19
  }
14
- export {
15
- i as useDocumentEvent
16
- };
20
+ //#endregion
21
+ export { n as useDocumentEvent };
@@ -1,17 +1,13 @@
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
1
2
  import "@vef-framework/shared";
2
- import { useEffectEvent as s, useEffect as c } from "react";
3
- function i(t, n, e) {
4
- const o = s(e);
5
- c(
6
- () => {
7
- const r = (...f) => {
8
- o(...f);
9
- };
10
- return t.on(n, r);
11
- },
12
- [t, n]
13
- );
3
+ import { useEffect as e } from "react";
4
+ //#region src/use-emitter-event/index.ts
5
+ function t(t, n, r) {
6
+ e(() => t.on(n, r), [
7
+ t,
8
+ n,
9
+ r
10
+ ]);
14
11
  }
15
- export {
16
- i as useEmitterEvent
17
- };
12
+ //#endregion
13
+ export { t as useEmitterEvent };
@@ -1,11 +1,12 @@
1
- import { useIsFetching as c } from "@vef-framework/core";
2
- function u(t, e) {
3
- return c({
4
- queryKey: e ? [t, e] : [t],
5
- exact: !1,
6
- type: "active"
7
- }) > 0;
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useIsFetching as e } from "@vef-framework/core";
3
+ //#region src/use-has-fetching/index.ts
4
+ function t(t, n) {
5
+ return e({
6
+ queryKey: n ? [t, n] : [t],
7
+ exact: !1,
8
+ type: "active"
9
+ }) > 0;
8
10
  }
9
- export {
10
- u as useHasFetching
11
- };
11
+ //#endregion
12
+ export { t as useHasFetching };
@@ -1,10 +1,11 @@
1
- import { useIsMutating as n } from "@vef-framework/core";
2
- function e(t) {
3
- return n({
4
- mutationKey: [t],
5
- exact: !1
6
- }) > 0;
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useIsMutating as e } from "@vef-framework/core";
3
+ //#region src/use-has-mutating/index.ts
4
+ function t(t) {
5
+ return e({
6
+ mutationKey: [t],
7
+ exact: !1
8
+ }) > 0;
7
9
  }
8
- export {
9
- e as useHasMutating
10
- };
10
+ //#endregion
11
+ export { t as useHasMutating };
@@ -1,12 +1,9 @@
1
- import { useAppContext as r, checkPermission as s } from "@vef-framework/core";
2
- import { useMemo as e } from "react";
3
- function h(o, t) {
4
- const { hasPermission: i = () => !0 } = r();
5
- return e(
6
- () => s(i, o, t),
7
- [o, t, i]
8
- );
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { checkPermission as e, useAppContext as t } from "@vef-framework/core";
3
+ //#region src/use-is-authorized/index.ts
4
+ function n(n, r) {
5
+ let { hasPermission: i = () => !0 } = t();
6
+ return e(i, n, r);
9
7
  }
10
- export {
11
- h as useIsAuthorized
12
- };
8
+ //#endregion
9
+ export { n as useIsAuthorized };
@@ -1,8 +1,9 @@
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
1
2
  import { useRef as e } from "react";
2
- function o(r) {
3
- const t = e(r);
4
- return t.current = r, t;
3
+ //#region src/use-latest/index.ts
4
+ function t(t) {
5
+ let n = e(t);
6
+ return n.current = t, n;
5
7
  }
6
- export {
7
- o as useLatest
8
- };
8
+ //#endregion
9
+ export { t as useLatest };
@@ -1,14 +1,15 @@
1
- import { useRef as s, useState as u, useCallback as o, useEffect as m } from "react";
2
- function i(t) {
3
- const e = s(0), [a, n] = u(t), r = o((c) => {
4
- cancelAnimationFrame(e.current), e.current = requestAnimationFrame(() => {
5
- n(c);
6
- });
7
- }, []);
8
- return m(() => () => {
9
- cancelAnimationFrame(e.current);
10
- }, []), [a, r];
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
3
+ //#region src/use-raf-state/index.ts
4
+ function i(i) {
5
+ let a = n(0), [o, s] = r(i), c = e((e) => {
6
+ cancelAnimationFrame(a.current), a.current = requestAnimationFrame(() => {
7
+ s(e);
8
+ });
9
+ }, []);
10
+ return t(() => () => {
11
+ cancelAnimationFrame(a.current);
12
+ }, []), [o, c];
11
13
  }
12
- export {
13
- i as useRafState
14
- };
14
+ //#endregion
15
+ export { i as useRafState };
@@ -1,8 +1,9 @@
1
- import { useCallback as r } from "react";
2
- import { useShallowCompare as a } from "../use-shallow-compare/index.js";
3
- function t(o, l) {
4
- return r(o, a(l));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useShallowCompare as e } from "../use-shallow-compare/index.js";
3
+ import { useCallback as t } from "react";
4
+ //#region src/use-shallow-callback/index.ts
5
+ function n(n, r) {
6
+ return t(n, e(r));
5
7
  }
6
- export {
7
- t as useShallowCallback
8
- };
8
+ //#endregion
9
+ export { n as useShallowCallback };
@@ -1,21 +1,17 @@
1
- import { isShallowEqual as o } from "@vef-framework/shared";
2
- import { useRef as n } from "react";
3
- function a(r) {
4
- const e = n(void 0), t = n(0);
5
- return l(e.current, r) || (e.current = r, t.current += 1), [t.current];
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { isShallowEqual as e } from "@vef-framework/shared";
3
+ import { useRef as t } from "react";
4
+ //#region src/use-shallow-compare/index.ts
5
+ function n(e) {
6
+ let n = t(void 0), i = t(0);
7
+ return r(n.current, e) || (n.current = e, i.current += 1), [i.current];
6
8
  }
7
- function l(r, e) {
8
- if (!r || !e)
9
- return !1;
10
- if (Object.is(r, e))
11
- return !0;
12
- if (r.length !== e.length)
13
- return !1;
14
- for (const [t, f] of r.entries())
15
- if (!o(f, e[t]))
16
- return !1;
17
- return !0;
9
+ function r(t, n) {
10
+ if (t === void 0 || n === void 0) return !1;
11
+ if (t === n) return !0;
12
+ if (t.length !== n.length) return !1;
13
+ for (let [r, i] of t.entries()) if (!e(i, n[r])) return !1;
14
+ return !0;
18
15
  }
19
- export {
20
- a as useShallowCompare
21
- };
16
+ //#endregion
17
+ export { n as useShallowCompare };
@@ -1,8 +1,9 @@
1
- import { useEffect as r } from "react";
2
- import { useShallowCompare as f } from "../use-shallow-compare/index.js";
3
- function u(o, e) {
4
- return r(o, f(e));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useShallowCompare as e } from "../use-shallow-compare/index.js";
3
+ import { useEffect as t } from "react";
4
+ //#region src/use-shallow-effect/index.ts
5
+ function n(n, r) {
6
+ t(n, e(r));
5
7
  }
6
- export {
7
- u as useShallowEffect
8
- };
8
+ //#endregion
9
+ export { n as useShallowEffect };
@@ -1,9 +1,9 @@
1
- import "../lib.js";
2
- import { useShallowCompare as e } from "../use-shallow-compare/index.js";
3
- import { useIsomorphicEffect as m } from "@mantine/hooks";
4
- function i(o, r) {
5
- return m(o, e(r));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useIsomorphicEffect as e } from "../lib.js";
3
+ import { useShallowCompare as t } from "../use-shallow-compare/index.js";
4
+ //#region src/use-shallow-isomorphic-effect/index.ts
5
+ function n(n, r) {
6
+ e(n, t(r));
6
7
  }
7
- export {
8
- i as useShallowIsomorphicEffect
9
- };
8
+ //#endregion
9
+ export { n as useShallowIsomorphicEffect };
@@ -1,8 +1,9 @@
1
- import { useLayoutEffect as e } from "react";
2
- import { useShallowCompare as r } from "../use-shallow-compare/index.js";
3
- function a(o, t) {
4
- return e(o, r(t));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useShallowCompare as e } from "../use-shallow-compare/index.js";
3
+ import { useLayoutEffect as t } from "react";
4
+ //#region src/use-shallow-layout-effect/index.ts
5
+ function n(n, r) {
6
+ t(n, e(r));
5
7
  }
6
- export {
7
- a as useShallowLayoutEffect
8
- };
8
+ //#endregion
9
+ export { n as useShallowLayoutEffect };
@@ -1,8 +1,9 @@
1
- import { useMemo as r } from "react";
2
- import { useShallowCompare as m } from "../use-shallow-compare/index.js";
3
- function l(o, e) {
4
- return r(o, m(e));
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
2
+ import { useShallowCompare as e } from "../use-shallow-compare/index.js";
3
+ import { useMemo as t } from "react";
4
+ //#region src/use-shallow-memo/index.ts
5
+ function n(n, r) {
6
+ return t(n, e(r));
5
7
  }
6
- export {
7
- l as useShallowMemo
8
- };
8
+ //#endregion
9
+ export { n as useShallowMemo };
@@ -1,8 +1,9 @@
1
+ /*! @vef-framework/hooks v2.1.0 made by Venus | 2026-03-27T07:13:03.756Z */
1
2
  import { useRef as e } from "react";
2
- function u(r) {
3
- const n = e(null);
4
- return n.current === null && (n.current = r()), n;
3
+ //#region src/use-singleton/index.ts
4
+ function t(t) {
5
+ let n = e(void 0);
6
+ return n.current === void 0 && (n.current = t()), n;
5
7
  }
6
- export {
7
- u as useSingleton
8
- };
8
+ //#endregion
9
+ export { t as useSingleton };