@vef-framework-react/hooks 2.12.0 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/use-code-set-query/index.cjs +1 -0
- package/dist/cjs/use-push-message/index.cjs +1 -0
- package/dist/es/index.js +21 -20
- package/dist/es/lib.js +1 -1
- package/dist/es/use-authorized-items/index.js +1 -1
- package/dist/es/use-breakpoints/index.js +1 -1
- package/dist/es/use-check-permission/index.js +1 -1
- package/dist/es/{use-dictionary-query → use-code-set-query}/index.js +5 -5
- package/dist/es/use-data-options/index.js +1 -1
- package/dist/es/use-deep-callback/index.js +1 -1
- package/dist/es/use-deep-compare/index.js +1 -1
- package/dist/es/use-deep-effect/index.js +1 -1
- package/dist/es/use-deep-isomorphic-effect/index.js +1 -1
- package/dist/es/use-deep-layout-effect/index.js +1 -1
- package/dist/es/use-deep-memo/index.js +1 -1
- package/dist/es/use-document-event/index.js +1 -1
- package/dist/es/use-emitter-event/index.js +1 -1
- package/dist/es/use-has-fetching/index.js +1 -1
- package/dist/es/use-has-mutating/index.js +1 -1
- package/dist/es/use-is-authorized/index.js +1 -1
- package/dist/es/use-latest/index.js +1 -1
- package/dist/es/use-push-message/index.js +12 -0
- package/dist/es/use-raf-state/index.js +1 -1
- package/dist/es/use-shallow-callback/index.js +1 -1
- package/dist/es/use-shallow-compare/index.js +1 -1
- package/dist/es/use-shallow-effect/index.js +1 -1
- package/dist/es/use-shallow-isomorphic-effect/index.js +1 -1
- package/dist/es/use-shallow-layout-effect/index.js +1 -1
- package/dist/es/use-shallow-memo/index.js +1 -1
- package/dist/es/use-singleton/index.js +1 -1
- package/dist/es/use-upload/index.js +1 -1
- package/dist/es/use-viewport-size/index.js +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/{use-dictionary-query → use-code-set-query}/index.d.ts +22 -22
- package/dist/types/use-push-message/index.d.ts +18 -0
- package/package.json +3 -3
- package/dist/cjs/use-dictionary-query/index.cjs +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib.cjs"),t=require("./use-authorized-items/index.cjs"),n=require("./use-breakpoints/index.cjs"),r=require("./use-check-permission/index.cjs"),i=require("./use-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib.cjs"),t=require("./use-authorized-items/index.cjs"),n=require("./use-breakpoints/index.cjs"),r=require("./use-check-permission/index.cjs"),i=require("./use-code-set-query/index.cjs"),a=require("./use-data-options/index.cjs"),o=require("./use-deep-compare/index.cjs"),s=require("./use-deep-callback/index.cjs"),c=require("./use-deep-effect/index.cjs"),l=require("./use-deep-isomorphic-effect/index.cjs"),u=require("./use-deep-layout-effect/index.cjs"),d=require("./use-deep-memo/index.cjs"),f=require("./use-latest/index.cjs"),p=require("./use-document-event/index.cjs"),m=require("./use-emitter-event/index.cjs"),h=require("./use-has-fetching/index.cjs"),g=require("./use-has-mutating/index.cjs"),_=require("./use-is-authorized/index.cjs"),v=require("./use-push-message/index.cjs"),y=require("./use-raf-state/index.cjs"),b=require("./use-shallow-compare/index.cjs"),x=require("./use-shallow-callback/index.cjs"),S=require("./use-shallow-effect/index.cjs"),C=require("./use-shallow-isomorphic-effect/index.cjs"),w=require("./use-shallow-layout-effect/index.cjs"),T=require("./use-shallow-memo/index.cjs"),E=require("./use-singleton/index.cjs"),D=require("./use-upload/index.cjs"),O=require("./use-viewport-size/index.cjs");let k=require("react-hotkeys-hook"),A=require("@mantine/hooks");Object.defineProperty(exports,"HotkeysProvider",{enumerable:!0,get:function(){return k.HotkeysProvider}}),Object.defineProperty(exports,"assignRef",{enumerable:!0,get:function(){return A.assignRef}}),Object.defineProperty(exports,"getHotkeyHandler",{enumerable:!0,get:function(){return A.getHotkeyHandler}}),Object.defineProperty(exports,"mergeRefs",{enumerable:!0,get:function(){return A.mergeRefs}}),exports.resolveCodeSetKey=i.resolveCodeSetKey,exports.useAuthorizedItems=t.useAuthorizedItems,exports.useBreakpoints=n.useBreakpoints,exports.useCheckPermission=r.useCheckPermission,exports.useCodeSetQuery=i.useCodeSetQuery,exports.useColorScheme=e.useColorScheme,exports.useDataOptionsQuery=a.useDataOptionsQuery,Object.defineProperty(exports,"useDebouncedCallback",{enumerable:!0,get:function(){return A.useDebouncedCallback}}),Object.defineProperty(exports,"useDebouncedState",{enumerable:!0,get:function(){return A.useDebouncedState}}),Object.defineProperty(exports,"useDebouncedValue",{enumerable:!0,get:function(){return A.useDebouncedValue}}),exports.useDeepCallback=s.useDeepCallback,exports.useDeepCompare=o.useDeepCompare,exports.useDeepEffect=c.useDeepEffect,exports.useDeepIsomorphicEffect=l.useDeepIsomorphicEffect,exports.useDeepLayoutEffect=u.useDeepLayoutEffect,exports.useDeepMemo=d.useDeepMemo,Object.defineProperty(exports,"useDidUpdate",{enumerable:!0,get:function(){return A.useDidUpdate}}),exports.useDocumentEvent=p.useDocumentEvent,Object.defineProperty(exports,"useDocumentTitle",{enumerable:!0,get:function(){return A.useDocumentTitle}}),exports.useElementSize=e.useElementSize,exports.useEmitterEvent=m.useEmitterEvent,Object.defineProperty(exports,"useEventListener",{enumerable:!0,get:function(){return A.useEventListener}}),Object.defineProperty(exports,"useFocusTrap",{enumerable:!0,get:function(){return A.useFocusTrap}}),Object.defineProperty(exports,"useFullscreenDocument",{enumerable:!0,get:function(){return A.useFullscreenDocument}}),exports.useHasFetching=h.useHasFetching,exports.useHasMutating=g.useHasMutating,Object.defineProperty(exports,"useHotkeys",{enumerable:!0,get:function(){return k.useHotkeys}}),Object.defineProperty(exports,"useHotkeysContext",{enumerable:!0,get:function(){return k.useHotkeysContext}}),Object.defineProperty(exports,"useIntersection",{enumerable:!0,get:function(){return A.useIntersection}}),Object.defineProperty(exports,"useInterval",{enumerable:!0,get:function(){return A.useInterval}}),exports.useIsAuthorized=_.useIsAuthorized,Object.defineProperty(exports,"useIsFirstRender",{enumerable:!0,get:function(){return A.useIsFirstRender}}),Object.defineProperty(exports,"useIsomorphicEffect",{enumerable:!0,get:function(){return A.useIsomorphicEffect}}),exports.useLatest=f.useLatest,exports.useMediaQuery=e.useMediaQuery,Object.defineProperty(exports,"useMergedRef",{enumerable:!0,get:function(){return A.useMergedRef}}),Object.defineProperty(exports,"useMounted",{enumerable:!0,get:function(){return A.useMounted}}),Object.defineProperty(exports,"useMutationObserverTarget",{enumerable:!0,get:function(){return A.useMutationObserverTarget}}),Object.defineProperty(exports,"usePrevious",{enumerable:!0,get:function(){return A.usePrevious}}),exports.usePushMessage=v.usePushMessage,exports.useRafState=y.useRafState,Object.defineProperty(exports,"useRecordHotkeys",{enumerable:!0,get:function(){return k.useRecordHotkeys}}),exports.useReducedMotion=e.useReducedMotion,Object.defineProperty(exports,"useResizeObserver",{enumerable:!0,get:function(){return A.useResizeObserver}}),exports.useShallowCallback=x.useShallowCallback,exports.useShallowCompare=b.useShallowCompare,exports.useShallowEffect=S.useShallowEffect,exports.useShallowIsomorphicEffect=C.useShallowIsomorphicEffect,exports.useShallowLayoutEffect=w.useShallowLayoutEffect,exports.useShallowMemo=T.useShallowMemo,exports.useSingleton=E.useSingleton,Object.defineProperty(exports,"useTimeout",{enumerable:!0,get:function(){return A.useTimeout}}),exports.useUpload=D.useUpload,exports.useViewportSize=O.useViewportSize,Object.defineProperty(exports,"useWindowEvent",{enumerable:!0,get:function(){return A.useWindowEvent}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@vef-framework-react/core"),t=require("@vef-framework-react/shared"),n=require("react");function r(e){return(0,t.isString)(e)?e:e.key}function i(i,a){let{codeSetQueryFn:o}=(0,e.useAppContext)();if(!(0,t.isFunction)(o))throw Error(`Code set query function is not provided in the app context.`);let{enabled:s,select:c}=a??{},l=(0,n.useMemo)(()=>[...new Set(Object.values(i).map(e=>r(e)))].toSorted(),[i]),u=(0,n.useCallback)(e=>{let t=Object.fromEntries(Object.entries(i).map(([t,n])=>[t,e[r(n)]??[]]));return c?c(t):t},[i,c]);return(0,e.useQuery)({queryFn:l.length===0?e.skipQueryToken:o,queryKey:[o.key,l],enabled:s,select:u,staleTime:1/0})}exports.resolveCodeSetKey=r,exports.useCodeSetQuery=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react");function t(t,n,r){(0,e.useEffect)(()=>t.subscribe(n,r),[t,n,r])}exports.usePushMessage=t;
|
package/dist/es/index.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { HotkeysProvider as e, assignRef as t, getHotkeyHandler as n, mergeRefs as r, useColorScheme as i, useDebouncedCallback as a, useDebouncedState as o, useDebouncedValue as s, useDidUpdate as c, useDocumentTitle as l, useElementSize as u, useEventListener as d, useFocusTrap as f, useFullscreenDocument as p, useHotkeys as m, useHotkeysContext as h, useIntersection as g, useInterval as _, useIsFirstRender as v, useIsomorphicEffect as y, useMediaQuery as b, useMergedRef as x, useMounted as S, useMutationObserverTarget as C, usePrevious as w, useRecordHotkeys as T, useReducedMotion as E, useResizeObserver as D, useTimeout as O, useWindowEvent as k } from "./lib.js";
|
|
3
3
|
import { useAuthorizedItems as A } from "./use-authorized-items/index.js";
|
|
4
4
|
import { useBreakpoints as j } from "./use-breakpoints/index.js";
|
|
5
5
|
import { useCheckPermission as M } from "./use-check-permission/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { resolveCodeSetKey as N, useCodeSetQuery as P } from "./use-code-set-query/index.js";
|
|
7
|
+
import { useDataOptionsQuery as F } from "./use-data-options/index.js";
|
|
8
|
+
import { useDeepCompare as I } from "./use-deep-compare/index.js";
|
|
9
|
+
import { useDeepCallback as L } from "./use-deep-callback/index.js";
|
|
10
|
+
import { useDeepEffect as R } from "./use-deep-effect/index.js";
|
|
11
|
+
import { useDeepIsomorphicEffect as z } from "./use-deep-isomorphic-effect/index.js";
|
|
12
|
+
import { useDeepLayoutEffect as B } from "./use-deep-layout-effect/index.js";
|
|
13
|
+
import { useDeepMemo as V } from "./use-deep-memo/index.js";
|
|
14
14
|
import { useLatest as H } from "./use-latest/index.js";
|
|
15
15
|
import { useDocumentEvent as U } from "./use-document-event/index.js";
|
|
16
16
|
import { useEmitterEvent as W } from "./use-emitter-event/index.js";
|
|
17
17
|
import { useHasFetching as G } from "./use-has-fetching/index.js";
|
|
18
18
|
import { useHasMutating as K } from "./use-has-mutating/index.js";
|
|
19
19
|
import { useIsAuthorized as q } from "./use-is-authorized/index.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
20
|
+
import { usePushMessage as J } from "./use-push-message/index.js";
|
|
21
|
+
import { useRafState as Y } from "./use-raf-state/index.js";
|
|
22
|
+
import { useShallowCompare as X } from "./use-shallow-compare/index.js";
|
|
23
|
+
import { useShallowCallback as Z } from "./use-shallow-callback/index.js";
|
|
24
|
+
import { useShallowEffect as Q } from "./use-shallow-effect/index.js";
|
|
25
|
+
import { useShallowIsomorphicEffect as $ } from "./use-shallow-isomorphic-effect/index.js";
|
|
26
|
+
import { useShallowLayoutEffect as ee } from "./use-shallow-layout-effect/index.js";
|
|
27
|
+
import { useShallowMemo as te } from "./use-shallow-memo/index.js";
|
|
28
|
+
import { useSingleton as ne } from "./use-singleton/index.js";
|
|
29
|
+
import { useUpload as re } from "./use-upload/index.js";
|
|
30
|
+
import { useViewportSize as ie } from "./use-viewport-size/index.js";
|
|
31
|
+
export { e as HotkeysProvider, t as assignRef, n as getHotkeyHandler, r as mergeRefs, N as resolveCodeSetKey, A as useAuthorizedItems, j as useBreakpoints, M as useCheckPermission, P as useCodeSetQuery, i as useColorScheme, F as useDataOptionsQuery, a as useDebouncedCallback, o as useDebouncedState, s as useDebouncedValue, L as useDeepCallback, I as useDeepCompare, R as useDeepEffect, z as useDeepIsomorphicEffect, B as useDeepLayoutEffect, V as useDeepMemo, c as useDidUpdate, U as useDocumentEvent, l as useDocumentTitle, u as useElementSize, W as useEmitterEvent, d as useEventListener, f as useFocusTrap, p as useFullscreenDocument, G as useHasFetching, K as useHasMutating, m as useHotkeys, h as useHotkeysContext, g as useIntersection, _ as useInterval, q as useIsAuthorized, v as useIsFirstRender, y as useIsomorphicEffect, H as useLatest, b as useMediaQuery, x as useMergedRef, S as useMounted, C as useMutationObserverTarget, w as usePrevious, J as usePushMessage, Y as useRafState, T as useRecordHotkeys, E as useReducedMotion, D as useResizeObserver, Z as useShallowCallback, X as useShallowCompare, Q as useShallowEffect, $ as useShallowIsomorphicEffect, ee as useShallowLayoutEffect, te as useShallowMemo, ne as useSingleton, O as useTimeout, re as useUpload, ie as useViewportSize, k as useWindowEvent };
|
package/dist/es/lib.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { assignRef as e, getHotkeyHandler as t, mergeRefs as n, useColorScheme as r, useDebouncedCallback as i, useDebouncedState as a, useDebouncedValue as o, useDidUpdate as s, useDocumentTitle as c, useElementSize as l, useEventListener as u, useFocusTrap as d, useFullscreenDocument as f, useIntersection as p, useInterval as m, useIsFirstRender as h, useIsomorphicEffect as g, useMediaQuery as _, useMergedRef as v, useMounted as y, useMutationObserverTarget as b, usePrevious as x, useReducedMotion as S, useResizeObserver as C, useTimeout as w, useWindowEvent as T } from "@mantine/hooks";
|
|
3
3
|
import { HotkeysProvider as E, useHotkeys as D, useHotkeysContext as O, useRecordHotkeys as k } from "react-hotkeys-hook";
|
|
4
4
|
//#region src/lib.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { checkPermission as e, useAppContext as t } from "@vef-framework-react/core";
|
|
3
3
|
//#region src/use-authorized-items/index.ts
|
|
4
4
|
function n(n) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { isNumber as e } from "@vef-framework-react/shared";
|
|
3
3
|
import { useEffect as t, useMemo as n, useState as r } from "react";
|
|
4
4
|
//#region src/use-breakpoints/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { checkPermission as e, useAppContext as t } from "@vef-framework-react/core";
|
|
3
3
|
//#region src/use-check-permission/index.ts
|
|
4
4
|
function n() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { skipQueryToken as e, useAppContext as t, useQuery as n } from "@vef-framework-react/core";
|
|
3
3
|
import { isFunction as r, isString as i } from "@vef-framework-react/shared";
|
|
4
4
|
import { useCallback as a, useMemo as o } from "react";
|
|
5
|
-
//#region src/use-
|
|
5
|
+
//#region src/use-code-set-query/index.ts
|
|
6
6
|
function s(e) {
|
|
7
7
|
return i(e) ? e : e.key;
|
|
8
8
|
}
|
|
9
9
|
function c(i, c) {
|
|
10
|
-
let {
|
|
11
|
-
if (!r(l)) throw Error("
|
|
10
|
+
let { codeSetQueryFn: l } = t();
|
|
11
|
+
if (!r(l)) throw Error("Code set query function is not provided in the app context.");
|
|
12
12
|
let { enabled: u, select: d } = c ?? {}, f = o(() => [...new Set(Object.values(i).map((e) => s(e)))].toSorted(), [i]), p = a((e) => {
|
|
13
13
|
let t = Object.fromEntries(Object.entries(i).map(([t, n]) => [t, e[s(n)] ?? []]));
|
|
14
14
|
return d ? d(t) : t;
|
|
@@ -22,4 +22,4 @@ function c(i, c) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
|
-
export { s as
|
|
25
|
+
export { s as resolveCodeSetKey, c as useCodeSetQuery };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useQuery as e } from "@vef-framework-react/core";
|
|
3
3
|
import { get as t, isEmpty as n, isFunction as r, isNullish as i, withPinyin as a } from "@vef-framework-react/shared";
|
|
4
4
|
import { useMemo as o } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useDeepCompare as e } from "../use-deep-compare/index.js";
|
|
3
3
|
import { useCallback as t } from "react";
|
|
4
4
|
//#region src/use-deep-callback/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { isDeepEqual as e } from "@vef-framework-react/shared";
|
|
3
3
|
import { useRef as t } from "react";
|
|
4
4
|
//#region src/use-deep-compare/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useDeepCompare as e } from "../use-deep-compare/index.js";
|
|
3
3
|
import { useEffect as t } from "react";
|
|
4
4
|
//#region src/use-deep-effect/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useIsomorphicEffect as e } from "../lib.js";
|
|
3
3
|
import { useDeepCompare as t } from "../use-deep-compare/index.js";
|
|
4
4
|
//#region src/use-deep-isomorphic-effect/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useDeepCompare as e } from "../use-deep-compare/index.js";
|
|
3
3
|
import { useLayoutEffect as t } from "react";
|
|
4
4
|
//#region src/use-deep-layout-effect/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useDeepCompare as e } from "../use-deep-compare/index.js";
|
|
3
3
|
import { useMemo as t } from "react";
|
|
4
4
|
//#region src/use-deep-memo/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useLatest as e } from "../use-latest/index.js";
|
|
3
3
|
import { useEffect as t } from "react";
|
|
4
4
|
//#region src/use-document-event/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useEffect as e } from "react";
|
|
3
3
|
//#region src/use-emitter-event/index.ts
|
|
4
4
|
function t(t, n, r) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useIsFetching as e } from "@vef-framework-react/core";
|
|
3
3
|
//#region src/use-has-fetching/index.ts
|
|
4
4
|
function t(t, n) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useIsMutating as e } from "@vef-framework-react/core";
|
|
3
3
|
//#region src/use-has-mutating/index.ts
|
|
4
4
|
function t(t) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { checkPermission as e, useAppContext as t } from "@vef-framework-react/core";
|
|
3
3
|
//#region src/use-is-authorized/index.ts
|
|
4
4
|
function n(n, r) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
|
+
import { useEffect as e } from "react";
|
|
3
|
+
//#region src/use-push-message/index.ts
|
|
4
|
+
function t(t, n, r) {
|
|
5
|
+
e(() => t.subscribe(n, r), [
|
|
6
|
+
t,
|
|
7
|
+
n,
|
|
8
|
+
r
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as usePushMessage };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
3
3
|
//#region src/use-raf-state/index.ts
|
|
4
4
|
function i(i) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useShallowCompare as e } from "../use-shallow-compare/index.js";
|
|
3
3
|
import { useCallback as t } from "react";
|
|
4
4
|
//#region src/use-shallow-callback/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { isShallowEqual as e } from "@vef-framework-react/shared";
|
|
3
3
|
import { useRef as t } from "react";
|
|
4
4
|
//#region src/use-shallow-compare/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useShallowCompare as e } from "../use-shallow-compare/index.js";
|
|
3
3
|
import { useEffect as t } from "react";
|
|
4
4
|
//#region src/use-shallow-effect/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useIsomorphicEffect as e } from "../lib.js";
|
|
3
3
|
import { useShallowCompare as t } from "../use-shallow-compare/index.js";
|
|
4
4
|
//#region src/use-shallow-isomorphic-effect/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useShallowCompare as e } from "../use-shallow-compare/index.js";
|
|
3
3
|
import { useLayoutEffect as t } from "react";
|
|
4
4
|
//#region src/use-shallow-layout-effect/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useShallowCompare as e } from "../use-shallow-compare/index.js";
|
|
3
3
|
import { useMemo as t } from "react";
|
|
4
4
|
//#region src/use-shallow-memo/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useLatest as e } from "../use-latest/index.js";
|
|
3
3
|
import { HTTP_CLIENT as t, LocalStoragePersistence as n, PrefixFingerprinter as r, STORAGE_API_PATH as i, STORAGE_RESOURCE as a, STORAGE_VERSION as o, UploadAbortedError as s, Uploader as c, WeakFingerprinter as l, resolveResumePlan as u, useApiClient as d } from "@vef-framework-react/core";
|
|
4
4
|
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useSyncExternalStore as g } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.13.1 made by Venus | 2026-07-28T11:21:16.074Z */
|
|
2
2
|
import { useWindowEvent as e } from "../lib.js";
|
|
3
3
|
import { useRafState as t } from "../use-raf-state/index.js";
|
|
4
4
|
import { isUndefined as n } from "@vef-framework-react/shared";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './lib';
|
|
|
2
2
|
export { useAuthorizedItems, type PermissionAware } from './use-authorized-items';
|
|
3
3
|
export { useBreakpoints, type Breakpoints, type UseBreakpointsOptions, type UseBreakpointsResult } from './use-breakpoints';
|
|
4
4
|
export { useCheckPermission } from './use-check-permission';
|
|
5
|
+
export { resolveCodeSetKey, useCodeSetQuery, type CodeSetAliasMap, type CodeSetKey, type CodeSetKeyConfig, type CodeSetKeyValue, type CodeSetQueryData, type Register, type UseCodeSetQueryOptions } from './use-code-set-query';
|
|
5
6
|
export { useDataOptionsQuery, type FieldExtractor, type UseDataOptionsQueryOptions, type UseDataOptionsQueryResult } from './use-data-options';
|
|
6
7
|
export { useDeepCallback } from './use-deep-callback';
|
|
7
8
|
export { useDeepCompare } from './use-deep-compare';
|
|
@@ -9,13 +10,13 @@ export { useDeepEffect } from './use-deep-effect';
|
|
|
9
10
|
export { useDeepIsomorphicEffect } from './use-deep-isomorphic-effect';
|
|
10
11
|
export { useDeepLayoutEffect } from './use-deep-layout-effect';
|
|
11
12
|
export { useDeepMemo } from './use-deep-memo';
|
|
12
|
-
export { resolveDictKey, useDictionaryQuery, type DictionaryAliasMap, type DictionaryKey, type DictionaryKeyConfig, type DictionaryKeyValue, type DictionaryQueryData, type Register, type UseDictionaryQueryOptions } from './use-dictionary-query';
|
|
13
13
|
export { useDocumentEvent } from './use-document-event';
|
|
14
14
|
export { useEmitterEvent } from './use-emitter-event';
|
|
15
15
|
export { useHasFetching } from './use-has-fetching';
|
|
16
16
|
export { useHasMutating } from './use-has-mutating';
|
|
17
17
|
export { useIsAuthorized } from './use-is-authorized';
|
|
18
18
|
export { useLatest } from './use-latest';
|
|
19
|
+
export { usePushMessage } from './use-push-message';
|
|
19
20
|
export { useRafState } from './use-raf-state';
|
|
20
21
|
export { useShallowCallback } from './use-shallow-callback';
|
|
21
22
|
export { useShallowCompare } from './use-shallow-compare';
|
|
@@ -3,52 +3,52 @@ import { DataOption, UseQueryResult } from '@vef-framework-react/core';
|
|
|
3
3
|
* Extension registry for hooks package types.
|
|
4
4
|
*
|
|
5
5
|
* Augment via `declare module "@vef-framework-react/hooks"` to constrain
|
|
6
|
-
*
|
|
6
|
+
* code set keys to a known union; future hook-level extensions should be
|
|
7
7
|
* added as members of this registry.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* declare module "@vef-framework-react/hooks" {
|
|
11
11
|
* interface Register {
|
|
12
|
-
*
|
|
12
|
+
* codeSetKeys: "sys.menu.type" | "sys.user.gender";
|
|
13
13
|
* }
|
|
14
14
|
* }
|
|
15
15
|
*/
|
|
16
16
|
export interface Register {
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Valid
|
|
19
|
+
* Valid code set keys for this project. Resolves to the `codeSetKeys`
|
|
20
20
|
* member augmented onto `Register`, or `string` when not augmented.
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
23
|
-
|
|
22
|
+
export type CodeSetKey = Register extends {
|
|
23
|
+
codeSetKeys: infer K extends string;
|
|
24
24
|
} ? K : string;
|
|
25
25
|
/**
|
|
26
|
-
* Per-key configuration with
|
|
26
|
+
* Per-key configuration with code set key and optional overrides.
|
|
27
27
|
*/
|
|
28
|
-
export interface
|
|
29
|
-
key:
|
|
28
|
+
export interface CodeSetKeyConfig {
|
|
29
|
+
key: CodeSetKey;
|
|
30
30
|
filterable?: boolean;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Value can be a plain
|
|
33
|
+
* Value can be a plain code set key string or a config object.
|
|
34
34
|
*/
|
|
35
|
-
export type
|
|
35
|
+
export type CodeSetKeyValue = CodeSetKey | CodeSetKeyConfig;
|
|
36
36
|
/**
|
|
37
37
|
* Alias map that rejects array inputs.
|
|
38
38
|
*/
|
|
39
|
-
export interface
|
|
40
|
-
readonly [alias: string]:
|
|
39
|
+
export interface CodeSetAliasMap {
|
|
40
|
+
readonly [alias: string]: CodeSetKeyValue;
|
|
41
41
|
readonly [index: number]: never;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Extract the actual
|
|
44
|
+
* Extract the actual code set key from a string or config value.
|
|
45
45
|
*/
|
|
46
|
-
export declare function
|
|
47
|
-
export type
|
|
46
|
+
export declare function resolveCodeSetKey(value: CodeSetKeyValue): string;
|
|
47
|
+
export type CodeSetQueryData<T extends CodeSetAliasMap> = Record<Extract<keyof T, string>, DataOption[]>;
|
|
48
48
|
/**
|
|
49
|
-
* Options for `
|
|
49
|
+
* Options for `useCodeSetQuery`.
|
|
50
50
|
*/
|
|
51
|
-
export interface
|
|
51
|
+
export interface UseCodeSetQueryOptions<T extends CodeSetAliasMap, TData = CodeSetQueryData<T>> {
|
|
52
52
|
/**
|
|
53
53
|
* Whether the query is enabled. Pass `false` to defer fetching, e.g.,
|
|
54
54
|
* while upstream parameters are not yet ready.
|
|
@@ -57,18 +57,18 @@ export interface UseDictionaryQueryOptions<T extends DictionaryAliasMap, TData =
|
|
|
57
57
|
*/
|
|
58
58
|
enabled?: boolean;
|
|
59
59
|
/**
|
|
60
|
-
* Transform the resolved
|
|
60
|
+
* Transform the resolved code set map into a custom shape.
|
|
61
61
|
* Runs after alias resolution; its return value becomes `data`.
|
|
62
62
|
*
|
|
63
63
|
* The function is passed through to React Query's `select`, so its identity
|
|
64
64
|
* affects memoization: stabilize it with `useCallback` in the caller when
|
|
65
65
|
* the enclosing component re-renders frequently.
|
|
66
66
|
*/
|
|
67
|
-
select?: (data:
|
|
67
|
+
select?: (data: CodeSetQueryData<T>) => TData;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Query
|
|
71
|
-
* Uses the `
|
|
70
|
+
* Query host code sets and map them back to alias keys.
|
|
71
|
+
* Uses the `codeSetQueryFn` from app context.
|
|
72
72
|
*
|
|
73
73
|
* `data` follows React Query's native semantics: it is `undefined` until the
|
|
74
74
|
* query resolves successfully, so callers must guard against `undefined`.
|
|
@@ -77,4 +77,4 @@ export interface UseDictionaryQueryOptions<T extends DictionaryAliasMap, TData =
|
|
|
77
77
|
* them in module scope, `as const`, `useMemo`, or `useCallback` as needed to
|
|
78
78
|
* avoid invalidating React Query's `select` memoization on every render.
|
|
79
79
|
*/
|
|
80
|
-
export declare function
|
|
80
|
+
export declare function useCodeSetQuery<const T extends CodeSetAliasMap, TData = CodeSetQueryData<T>>(keys: T, options?: UseCodeSetQueryOptions<NoInfer<T>, TData>): UseQueryResult<TData>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PushClient, PushMessageHandler } from '@vef-framework-react/core';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to server push messages of one envelope type with automatic
|
|
4
|
+
* cleanup. Pass `"*"` to receive every message.
|
|
5
|
+
*
|
|
6
|
+
* @param client - Push client instance (typically an app-level singleton).
|
|
7
|
+
* @param type - Envelope type to listen for.
|
|
8
|
+
* @param handler - Message handler.
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* function OrderBadge({ pushClient }) {
|
|
12
|
+
* usePushMessage(pushClient, "order.status_changed", (message) => {
|
|
13
|
+
* console.log("Order updated:", message.payload);
|
|
14
|
+
* });
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function usePushMessage<TPayload = unknown>(client: PushClient, type: string, handler: PushMessageHandler<TPayload>): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/hooks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Hooks for VEF framework",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@mantine/hooks": "^9.4.1",
|
|
43
43
|
"react-hotkeys-hook": "^5.3.3",
|
|
44
|
-
"@vef-framework-react/core": "2.
|
|
45
|
-
"@vef-framework-react/shared": "2.
|
|
44
|
+
"@vef-framework-react/core": "2.13.1",
|
|
45
|
+
"@vef-framework-react/shared": "2.13.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"react": "^19.2.7"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("@vef-framework-react/core"),t=require("@vef-framework-react/shared"),n=require("react");function r(e){return(0,t.isString)(e)?e:e.key}function i(i,a){let{dictionaryQueryFn:o}=(0,e.useAppContext)();if(!(0,t.isFunction)(o))throw Error(`Dictionary query function is not provided in the app context.`);let{enabled:s,select:c}=a??{},l=(0,n.useMemo)(()=>[...new Set(Object.values(i).map(e=>r(e)))].toSorted(),[i]),u=(0,n.useCallback)(e=>{let t=Object.fromEntries(Object.entries(i).map(([t,n])=>[t,e[r(n)]??[]]));return c?c(t):t},[i,c]);return(0,e.useQuery)({queryFn:l.length===0?e.skipQueryToken:o,queryKey:[o.key,l],enabled:s,select:u,staleTime:1/0})}exports.resolveDictKey=r,exports.useDictionaryQuery=i;
|