@vef-framework/hooks 2.0.10 → 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.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/lib.cjs +1 -1
- package/dist/cjs/use-authorized-items/index.cjs +1 -1
- package/dist/cjs/use-breakpoints/index.cjs +1 -1
- package/dist/cjs/use-check-permission/index.cjs +1 -1
- package/dist/cjs/use-data-dict-query/index.cjs +1 -1
- package/dist/cjs/use-data-options/index.cjs +1 -1
- package/dist/cjs/use-deep-callback/index.cjs +1 -1
- package/dist/cjs/use-deep-compare/index.cjs +1 -1
- package/dist/cjs/use-deep-effect/index.cjs +1 -1
- package/dist/cjs/use-deep-isomorphic-effect/index.cjs +1 -1
- package/dist/cjs/use-deep-layout-effect/index.cjs +1 -1
- package/dist/cjs/use-deep-memo/index.cjs +1 -1
- package/dist/cjs/use-document-event/index.cjs +1 -1
- package/dist/cjs/use-emitter-event/index.cjs +1 -1
- package/dist/cjs/use-has-fetching/index.cjs +1 -1
- package/dist/cjs/use-has-mutating/index.cjs +1 -1
- package/dist/cjs/use-is-authorized/index.cjs +1 -1
- package/dist/cjs/use-latest/index.cjs +1 -1
- package/dist/cjs/use-raf-state/index.cjs +1 -1
- package/dist/cjs/use-shallow-callback/index.cjs +1 -1
- package/dist/cjs/use-shallow-compare/index.cjs +1 -1
- package/dist/cjs/use-shallow-effect/index.cjs +1 -1
- package/dist/cjs/use-shallow-isomorphic-effect/index.cjs +1 -1
- package/dist/cjs/use-shallow-layout-effect/index.cjs +1 -1
- package/dist/cjs/use-shallow-memo/index.cjs +1 -1
- package/dist/cjs/use-singleton/index.cjs +1 -1
- package/dist/cjs/use-viewport-size/index.cjs +1 -0
- package/dist/es/index.js +29 -85
- package/dist/es/lib.js +14 -60
- package/dist/es/use-authorized-items/index.js +11 -14
- package/dist/es/use-breakpoints/index.js +47 -53
- package/dist/es/use-check-permission/index.js +8 -11
- package/dist/es/use-data-dict-query/index.js +21 -25
- package/dist/es/use-data-options/index.js +46 -78
- package/dist/es/use-deep-callback/index.js +8 -7
- package/dist/es/use-deep-compare/index.js +15 -19
- package/dist/es/use-deep-effect/index.js +8 -7
- package/dist/es/use-deep-isomorphic-effect/index.js +8 -8
- package/dist/es/use-deep-layout-effect/index.js +7 -6
- package/dist/es/use-deep-memo/index.js +8 -7
- package/dist/es/use-document-event/index.js +20 -15
- package/dist/es/use-emitter-event/index.js +11 -15
- package/dist/es/use-has-fetching/index.js +11 -10
- package/dist/es/use-has-mutating/index.js +10 -9
- package/dist/es/use-is-authorized/index.js +8 -11
- package/dist/es/use-latest/index.js +7 -6
- package/dist/es/use-raf-state/index.js +14 -13
- package/dist/es/use-shallow-callback/index.js +8 -7
- package/dist/es/use-shallow-compare/index.js +15 -19
- package/dist/es/use-shallow-effect/index.js +8 -7
- package/dist/es/use-shallow-isomorphic-effect/index.js +8 -8
- package/dist/es/use-shallow-layout-effect/index.js +8 -7
- package/dist/es/use-shallow-memo/index.js +8 -7
- package/dist/es/use-singleton/index.js +7 -6
- package/dist/es/use-viewport-size/index.js +34 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/lib.d.ts +1 -0
- package/dist/types/src/index.d.ts +27 -0
- package/dist/types/src/lib.d.ts +7 -0
- package/dist/types/src/use-authorized-items/index.d.ts +22 -0
- package/dist/types/src/use-breakpoints/index.d.ts +55 -0
- package/dist/types/src/use-check-permission/index.d.ts +8 -0
- package/dist/types/src/use-data-dict-query/index.d.ts +15 -0
- package/dist/types/src/use-data-options/index.d.ts +86 -0
- package/dist/types/src/use-deep-callback/index.d.ts +11 -0
- package/dist/types/src/use-deep-compare/index.d.ts +9 -0
- package/dist/types/src/use-deep-effect/index.d.ts +10 -0
- package/dist/types/src/use-deep-isomorphic-effect/index.d.ts +11 -0
- package/dist/types/src/use-deep-layout-effect/index.d.ts +10 -0
- package/dist/types/src/use-deep-memo/index.d.ts +11 -0
- package/dist/types/src/use-document-event/index.d.ts +19 -0
- package/dist/types/src/use-emitter-event/index.d.ts +17 -0
- package/dist/types/src/use-has-fetching/index.d.ts +8 -0
- package/dist/types/src/use-has-mutating/index.d.ts +7 -0
- package/dist/types/src/use-is-authorized/index.d.ts +10 -0
- package/dist/types/src/use-latest/index.d.ts +21 -0
- package/dist/types/src/use-raf-state/index.d.ts +23 -0
- package/dist/types/src/use-shallow-callback/index.d.ts +14 -0
- package/dist/types/src/use-shallow-compare/index.d.ts +13 -0
- package/dist/types/src/use-shallow-effect/index.d.ts +13 -0
- package/dist/types/src/use-shallow-isomorphic-effect/index.d.ts +13 -0
- package/dist/types/src/use-shallow-layout-effect/index.d.ts +13 -0
- package/dist/types/src/use-shallow-memo/index.d.ts +14 -0
- package/dist/types/src/use-singleton/index.d.ts +18 -0
- package/dist/types/src/use-viewport-size/index.d.ts +20 -0
- package/dist/types/use-authorized-items/index.d.ts +5 -5
- package/dist/types/use-breakpoints/index.d.ts +15 -7
- package/dist/types/use-check-permission/index.d.ts +2 -2
- package/dist/types/use-data-dict-query/index.d.ts +1 -1
- package/dist/types/use-data-options/index.d.ts +8 -2
- package/dist/types/use-deep-callback/index.d.ts +7 -5
- package/dist/types/use-deep-compare/index.d.ts +4 -3
- package/dist/types/use-deep-effect/index.d.ts +5 -4
- package/dist/types/use-deep-isomorphic-effect/index.d.ts +6 -4
- package/dist/types/use-deep-layout-effect/index.d.ts +5 -4
- package/dist/types/use-deep-memo/index.d.ts +6 -4
- package/dist/types/use-document-event/index.d.ts +15 -4
- package/dist/types/use-emitter-event/index.d.ts +13 -5
- package/dist/types/use-is-authorized/index.d.ts +2 -2
- package/dist/types/use-latest/index.d.ts +18 -5
- package/dist/types/use-raf-state/index.d.ts +18 -3
- package/dist/types/use-shallow-callback/index.d.ts +10 -5
- package/dist/types/use-shallow-compare/index.d.ts +8 -3
- package/dist/types/use-shallow-effect/index.d.ts +8 -4
- package/dist/types/use-shallow-isomorphic-effect/index.d.ts +8 -4
- package/dist/types/use-shallow-layout-effect/index.d.ts +8 -4
- package/dist/types/use-shallow-memo/index.d.ts +8 -3
- package/dist/types/use-singleton/index.d.ts +14 -7
- package/dist/types/use-viewport-size/index.d.ts +20 -0
- package/package.json +8 -7
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { s as useDataDictQuery };
|
|
@@ -1,82 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
29
|
-
|
|
20
|
+
function f(e, t, n) {
|
|
21
|
+
return !e || i(e) ? [] : e.map((e) => d(e, t, n));
|
|
30
22
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { p as useDataOptionsQuery };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useDeepCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useDeepCallback };
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as useDeepCompare };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useDeepCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useDeepEffect };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
4
|
+
//#region src/use-deep-layout-effect/index.ts
|
|
5
|
+
function n(n, r) {
|
|
6
|
+
t(n, e(r));
|
|
5
7
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useDeepLayoutEffect };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useDeepCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useDeepMemo };
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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 {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as useEmitterEvent };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as useHasFetching };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as useHasMutating };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as useLatest };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { i as useRafState };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useShallowCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useShallowCallback };
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as useShallowCompare };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useShallowCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useShallowEffect };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useShallowIsomorphicEffect };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useShallowCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as useShallowLayoutEffect };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { useShallowCompare as
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as useSingleton };
|