@vef-framework-react/hooks 2.1.11 → 2.2.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-upload/index.cjs +1 -0
- package/dist/es/index.js +30 -29
- package/dist/es/lib.js +9 -10
- 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-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-dictionary-query/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-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 +138 -0
- package/dist/es/use-viewport-size/index.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib.d.ts +0 -1
- package/dist/types/use-upload/index.d.ts +98 -0
- package/package.json +6 -7
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-data-options/index.cjs`),a=require(`./use-deep-compare/index.cjs`),o=require(`./use-deep-callback/index.cjs`),s=require(`./use-deep-effect/index.cjs`),c=require(`./use-deep-isomorphic-effect/index.cjs`),l=require(`./use-deep-layout-effect/index.cjs`),u=require(`./use-deep-memo/index.cjs`),d=require(`./use-dictionary-query/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-raf-state/index.cjs`),y=require(`./use-shallow-compare/index.cjs`),b=require(`./use-shallow-callback/index.cjs`),x=require(`./use-shallow-effect/index.cjs`),S=require(`./use-shallow-isomorphic-effect/index.cjs`),C=require(`./use-shallow-layout-effect/index.cjs`),w=require(`./use-shallow-memo/index.cjs`),T=require(`./use-singleton/index.cjs`),E=require(`./use-viewport-size/index.cjs`);let
|
|
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-data-options/index.cjs`),a=require(`./use-deep-compare/index.cjs`),o=require(`./use-deep-callback/index.cjs`),s=require(`./use-deep-effect/index.cjs`),c=require(`./use-deep-isomorphic-effect/index.cjs`),l=require(`./use-deep-layout-effect/index.cjs`),u=require(`./use-deep-memo/index.cjs`),d=require(`./use-dictionary-query/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-raf-state/index.cjs`),y=require(`./use-shallow-compare/index.cjs`),b=require(`./use-shallow-callback/index.cjs`),x=require(`./use-shallow-effect/index.cjs`),S=require(`./use-shallow-isomorphic-effect/index.cjs`),C=require(`./use-shallow-layout-effect/index.cjs`),w=require(`./use-shallow-memo/index.cjs`),T=require(`./use-singleton/index.cjs`),E=require(`./use-upload/index.cjs`),D=require(`./use-viewport-size/index.cjs`);let O=require(`react-hotkeys-hook`),k=require(`@mantine/hooks`);Object.defineProperty(exports,`HotkeysProvider`,{enumerable:!0,get:function(){return O.HotkeysProvider}}),Object.defineProperty(exports,`assignRef`,{enumerable:!0,get:function(){return k.assignRef}}),Object.defineProperty(exports,`getHotkeyHandler`,{enumerable:!0,get:function(){return k.getHotkeyHandler}}),Object.defineProperty(exports,`mergeRefs`,{enumerable:!0,get:function(){return k.mergeRefs}}),exports.resolveDictKey=d.resolveDictKey,exports.useAuthorizedItems=t.useAuthorizedItems,exports.useBreakpoints=n.useBreakpoints,exports.useCheckPermission=r.useCheckPermission,exports.useColorScheme=e.useColorScheme,exports.useDataOptionsQuery=i.useDataOptionsQuery,Object.defineProperty(exports,`useDebouncedCallback`,{enumerable:!0,get:function(){return k.useDebouncedCallback}}),Object.defineProperty(exports,`useDebouncedState`,{enumerable:!0,get:function(){return k.useDebouncedState}}),Object.defineProperty(exports,`useDebouncedValue`,{enumerable:!0,get:function(){return k.useDebouncedValue}}),exports.useDeepCallback=o.useDeepCallback,exports.useDeepCompare=a.useDeepCompare,exports.useDeepEffect=s.useDeepEffect,exports.useDeepIsomorphicEffect=c.useDeepIsomorphicEffect,exports.useDeepLayoutEffect=l.useDeepLayoutEffect,exports.useDeepMemo=u.useDeepMemo,exports.useDictionaryQuery=d.useDictionaryQuery,Object.defineProperty(exports,`useDidUpdate`,{enumerable:!0,get:function(){return k.useDidUpdate}}),exports.useDocumentEvent=p.useDocumentEvent,Object.defineProperty(exports,`useDocumentTitle`,{enumerable:!0,get:function(){return k.useDocumentTitle}}),exports.useElementSize=e.useElementSize,exports.useEmitterEvent=m.useEmitterEvent,Object.defineProperty(exports,`useEventListener`,{enumerable:!0,get:function(){return k.useEventListener}}),Object.defineProperty(exports,`useFocusTrap`,{enumerable:!0,get:function(){return k.useFocusTrap}}),Object.defineProperty(exports,`useFullscreenDocument`,{enumerable:!0,get:function(){return k.useFullscreenDocument}}),exports.useHasFetching=h.useHasFetching,exports.useHasMutating=g.useHasMutating,Object.defineProperty(exports,`useHotkeys`,{enumerable:!0,get:function(){return O.useHotkeys}}),Object.defineProperty(exports,`useHotkeysContext`,{enumerable:!0,get:function(){return O.useHotkeysContext}}),Object.defineProperty(exports,`useIntersection`,{enumerable:!0,get:function(){return k.useIntersection}}),Object.defineProperty(exports,`useInterval`,{enumerable:!0,get:function(){return k.useInterval}}),exports.useIsAuthorized=_.useIsAuthorized,Object.defineProperty(exports,`useIsFirstRender`,{enumerable:!0,get:function(){return k.useIsFirstRender}}),Object.defineProperty(exports,`useIsomorphicEffect`,{enumerable:!0,get:function(){return k.useIsomorphicEffect}}),exports.useLatest=f.useLatest,exports.useMediaQuery=e.useMediaQuery,Object.defineProperty(exports,`useMergedRef`,{enumerable:!0,get:function(){return k.useMergedRef}}),Object.defineProperty(exports,`useMounted`,{enumerable:!0,get:function(){return k.useMounted}}),Object.defineProperty(exports,`useMutationObserverTarget`,{enumerable:!0,get:function(){return k.useMutationObserverTarget}}),Object.defineProperty(exports,`usePrevious`,{enumerable:!0,get:function(){return k.usePrevious}}),exports.useRafState=v.useRafState,Object.defineProperty(exports,`useRecordHotkeys`,{enumerable:!0,get:function(){return O.useRecordHotkeys}}),exports.useReducedMotion=e.useReducedMotion,Object.defineProperty(exports,`useResizeObserver`,{enumerable:!0,get:function(){return k.useResizeObserver}}),exports.useShallowCallback=b.useShallowCallback,exports.useShallowCompare=y.useShallowCompare,exports.useShallowEffect=x.useShallowEffect,exports.useShallowIsomorphicEffect=S.useShallowIsomorphicEffect,exports.useShallowLayoutEffect=C.useShallowLayoutEffect,exports.useShallowMemo=w.useShallowMemo,exports.useSingleton=T.useSingleton,Object.defineProperty(exports,`useTimeout`,{enumerable:!0,get:function(){return k.useTimeout}}),exports.useUpload=E.useUpload,exports.useViewportSize=D.useViewportSize,Object.defineProperty(exports,`useWindowEvent`,{enumerable:!0,get:function(){return k.useWindowEvent}});
|
package/dist/cjs/lib.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require(`@mantine/hooks`);require(
|
|
1
|
+
let e=require(`@mantine/hooks`);require(`react-hotkeys-hook`);var t={getInitialValueInEffect:!1};function n(n,r,i=t){return(0,e.useMediaQuery)(n,r,{getInitialValueInEffect:i.getInitialValueInEffect})}function r(n,r=t){return(0,e.useColorScheme)(n,{getInitialValueInEffect:r.getInitialValueInEffect})}function i(n,r=t){return(0,e.useReducedMotion)(n,{getInitialValueInEffect:r.getInitialValueInEffect})}var a={box:`border-box`};function o(t=a){return(0,e.useElementSize)(t)}exports.useColorScheme=r,exports.useElementSize=o,exports.useMediaQuery=n,exports.useReducedMotion=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../use-latest/index.cjs`);let t=require(`@vef-framework-react/core`),n=require(`react`);var r=new Set([`initializing`,`uploading`,`completing`,`aborting`]);function i(){return typeof crypto<`u`&&crypto.subtle!==void 0?new t.PrefixFingerprinter:new t.WeakFingerprinter}function a(){return{status:`idle`,progress:{loaded:0,total:0,partsCompleted:0,partsTotal:0,percent:0},error:null,result:null}}function o(o={}){let s=(0,t.useApiClient)()[t.HTTP_CLIENT],c=e.useLatest(o),l=(0,n.useRef)(a()),u=(0,n.useRef)(new Set),d=(0,n.useRef)(null),f=(0,n.useRef)(0),p=(0,n.useRef)(null),m=(0,n.useCallback)(e=>(u.current.add(e),()=>{u.current.delete(e)}),[]),h=(0,n.useCallback)(()=>l.current,[]),g=(0,n.useCallback)(e=>{l.current={...l.current,...e};for(let e of u.current)e()},[]),_=(0,n.useCallback)(async(e,n)=>{let a=c.current,o=++f.current,l=()=>f.current!==o;p.current?.abort();let u=new AbortController;p.current=u;let m=e instanceof File&&a.persistence!==null,h=m?a.persistence??new t.LocalStoragePersistence:null,_=m?a.fingerprinter??i():null,v={http:s,apiPath:a.apiPath??t.STORAGE_API_PATH,resource:a.resource??t.STORAGE_RESOURCE,version:a.version??t.STORAGE_VERSION},y=m&&e instanceof File&&_?await _.fingerprint(e):null;if(l())throw new t.UploadAbortedError;let b=m&&h&&y?await(0,t.resolveResumePlan)({fingerprint:y,persistence:h,ctx:v,onResumeDetected:a.onResumeDetected,signal:u.signal}):void 0;if(l())throw new t.UploadAbortedError;let x=new t.Uploader(s,e,{...a,init:{...a.init,...n},onStatusChange:e=>{d.current===x&&(h&&y&&(e===`succeeded`||e===`aborted`)&&h.remove(y),g({status:e}),a.onStatusChange?.(e))},onProgress:e=>{d.current===x&&(g({progress:e}),a.onProgress?.(e))},onSessionOpened:e=>{d.current===x&&h&&y&&h.save({fingerprint:y,claimId:e.claimId,key:e.key,partSize:e.partSize,partCount:e.partCount,expiresAt:e.expiresAt,savedAt:Date.now()})}}),S=d.current;if(d.current=x,S&&r.has(S.status)&&await S.abort(),l())throw d.current===x&&(d.current=S),new t.UploadAbortedError;g({status:`idle`,progress:{loaded:0,total:e.size,partsCompleted:0,partsTotal:0,percent:0},error:null,result:null});try{let e=await x.start(b);return g({result:e}),a.onSuccess?.(e),e}catch(e){let t=e;throw b?.kind===`resume`&&h&&y&&d.current===x&&h.remove(y),d.current===x&&(g({error:t}),a.onError?.(t)),t}},[s,g,c]),v=(0,n.useCallback)(()=>{p.current?.abort();let{current:e}=d;e&&r.has(e.status)&&e.abort()},[]),y=(0,n.useCallback)(()=>{f.current++,p.current?.abort();let{current:e}=d;e&&r.has(e.status)&&e.abort(),d.current=null,g(a())},[g]);(0,n.useEffect)(()=>()=>{p.current?.abort();let{current:e}=d;e&&r.has(e.status)&&e.abort()},[]);let b=(0,n.useSyncExternalStore)(m,h,h);return(0,n.useMemo)(()=>({upload:_,abort:v,reset:y,status:b.status,progress:b.progress,error:b.error,result:b.result,isUploading:r.has(b.status)}),[_,v,y,b])}exports.useUpload=o;
|
package/dist/es/index.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
2
|
-
import { HotkeysProvider as e, assignRef as t, getHotkeyHandler as n, mergeRefs as r,
|
|
3
|
-
import { useAuthorizedItems as
|
|
4
|
-
import { useBreakpoints as
|
|
5
|
-
import { useCheckPermission as
|
|
6
|
-
import { useDataOptionsQuery as
|
|
7
|
-
import { useDeepCompare as
|
|
8
|
-
import { useDeepCallback as
|
|
9
|
-
import { useDeepEffect as
|
|
10
|
-
import { useDeepIsomorphicEffect as
|
|
11
|
-
import { useDeepLayoutEffect as
|
|
12
|
-
import { useDeepMemo as
|
|
13
|
-
import { resolveDictKey as
|
|
14
|
-
import { useLatest as
|
|
15
|
-
import { useDocumentEvent as
|
|
16
|
-
import { useEmitterEvent as
|
|
17
|
-
import { useHasFetching as
|
|
18
|
-
import { useHasMutating as
|
|
19
|
-
import { useIsAuthorized as
|
|
20
|
-
import { useRafState as
|
|
21
|
-
import { useShallowCompare as
|
|
22
|
-
import { useShallowCallback as
|
|
23
|
-
import { useShallowEffect as
|
|
24
|
-
import { useShallowIsomorphicEffect as
|
|
25
|
-
import { useShallowLayoutEffect as
|
|
26
|
-
import { useShallowMemo as
|
|
27
|
-
import { useSingleton as
|
|
28
|
-
import {
|
|
29
|
-
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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
|
+
import { useAuthorizedItems as A } from "./use-authorized-items/index.js";
|
|
4
|
+
import { useBreakpoints as j } from "./use-breakpoints/index.js";
|
|
5
|
+
import { useCheckPermission as M } from "./use-check-permission/index.js";
|
|
6
|
+
import { useDataOptionsQuery as N } from "./use-data-options/index.js";
|
|
7
|
+
import { useDeepCompare as P } from "./use-deep-compare/index.js";
|
|
8
|
+
import { useDeepCallback as F } from "./use-deep-callback/index.js";
|
|
9
|
+
import { useDeepEffect as I } from "./use-deep-effect/index.js";
|
|
10
|
+
import { useDeepIsomorphicEffect as L } from "./use-deep-isomorphic-effect/index.js";
|
|
11
|
+
import { useDeepLayoutEffect as R } from "./use-deep-layout-effect/index.js";
|
|
12
|
+
import { useDeepMemo as z } from "./use-deep-memo/index.js";
|
|
13
|
+
import { resolveDictKey as B, useDictionaryQuery as V } from "./use-dictionary-query/index.js";
|
|
14
|
+
import { useLatest as H } from "./use-latest/index.js";
|
|
15
|
+
import { useDocumentEvent as U } from "./use-document-event/index.js";
|
|
16
|
+
import { useEmitterEvent as W } from "./use-emitter-event/index.js";
|
|
17
|
+
import { useHasFetching as G } from "./use-has-fetching/index.js";
|
|
18
|
+
import { useHasMutating as K } from "./use-has-mutating/index.js";
|
|
19
|
+
import { useIsAuthorized as q } from "./use-is-authorized/index.js";
|
|
20
|
+
import { useRafState as J } from "./use-raf-state/index.js";
|
|
21
|
+
import { useShallowCompare as Y } from "./use-shallow-compare/index.js";
|
|
22
|
+
import { useShallowCallback as X } from "./use-shallow-callback/index.js";
|
|
23
|
+
import { useShallowEffect as Z } from "./use-shallow-effect/index.js";
|
|
24
|
+
import { useShallowIsomorphicEffect as Q } from "./use-shallow-isomorphic-effect/index.js";
|
|
25
|
+
import { useShallowLayoutEffect as $ } from "./use-shallow-layout-effect/index.js";
|
|
26
|
+
import { useShallowMemo as ee } from "./use-shallow-memo/index.js";
|
|
27
|
+
import { useSingleton as te } from "./use-singleton/index.js";
|
|
28
|
+
import { useUpload as ne } from "./use-upload/index.js";
|
|
29
|
+
import { useViewportSize as re } from "./use-viewport-size/index.js";
|
|
30
|
+
export { e as HotkeysProvider, t as assignRef, n as getHotkeyHandler, r as mergeRefs, B as resolveDictKey, A as useAuthorizedItems, j as useBreakpoints, M as useCheckPermission, i as useColorScheme, N as useDataOptionsQuery, a as useDebouncedCallback, o as useDebouncedState, s as useDebouncedValue, F as useDeepCallback, P as useDeepCompare, I as useDeepEffect, L as useDeepIsomorphicEffect, R as useDeepLayoutEffect, z as useDeepMemo, V as useDictionaryQuery, 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 useRafState, T as useRecordHotkeys, E as useReducedMotion, D as useResizeObserver, X as useShallowCallback, Y as useShallowCompare, Z as useShallowEffect, Q as useShallowIsomorphicEffect, $ as useShallowLayoutEffect, ee as useShallowMemo, te as useSingleton, O as useTimeout, ne as useUpload, re as useViewportSize, k as useWindowEvent };
|
package/dist/es/lib.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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
|
-
import {
|
|
4
|
-
import { HotkeysProvider as k, useHotkeys as A, useHotkeysContext as j, useRecordHotkeys as M } from "react-hotkeys-hook";
|
|
3
|
+
import { HotkeysProvider as E, useHotkeys as D, useHotkeysContext as O, useRecordHotkeys as k } from "react-hotkeys-hook";
|
|
5
4
|
//#region src/lib.ts
|
|
6
|
-
var
|
|
7
|
-
function
|
|
5
|
+
var A = { getInitialValueInEffect: !1 };
|
|
6
|
+
function j(e, t, n = A) {
|
|
8
7
|
return _(e, t, { getInitialValueInEffect: n.getInitialValueInEffect });
|
|
9
8
|
}
|
|
10
|
-
function
|
|
9
|
+
function M(e, t = A) {
|
|
11
10
|
return r(e, { getInitialValueInEffect: t.getInitialValueInEffect });
|
|
12
11
|
}
|
|
13
|
-
function
|
|
12
|
+
function N(e, t = A) {
|
|
14
13
|
return S(e, { getInitialValueInEffect: t.getInitialValueInEffect });
|
|
15
14
|
}
|
|
16
|
-
var
|
|
17
|
-
function
|
|
15
|
+
var P = { box: "border-box" };
|
|
16
|
+
function F(e = P) {
|
|
18
17
|
return l(e);
|
|
19
18
|
}
|
|
20
19
|
//#endregion
|
|
21
|
-
export {
|
|
20
|
+
export { E as HotkeysProvider, e as assignRef, t as getHotkeyHandler, n as mergeRefs, M as useColorScheme, i as useDebouncedCallback, a as useDebouncedState, o as useDebouncedValue, s as useDidUpdate, c as useDocumentTitle, F as useElementSize, u as useEventListener, d as useFocusTrap, f as useFullscreenDocument, D as useHotkeys, O as useHotkeysContext, p as useIntersection, m as useInterval, h as useIsFirstRender, g as useIsomorphicEffect, j as useMediaQuery, v as useMergedRef, y as useMounted, b as useMutationObserverTarget, x as usePrevious, k as useRecordHotkeys, N as useReducedMotion, C as useResizeObserver, w as useTimeout, T as useWindowEvent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
2
2
|
import "@vef-framework-react/shared";
|
|
3
3
|
import { useEffect as e } from "react";
|
|
4
4
|
//#region src/use-emitter-event/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
2
|
+
import { useLatest as e } from "../use-latest/index.js";
|
|
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
|
+
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useSyncExternalStore as g } from "react";
|
|
5
|
+
//#region src/use-upload/index.ts
|
|
6
|
+
var _ = new Set([
|
|
7
|
+
"initializing",
|
|
8
|
+
"uploading",
|
|
9
|
+
"completing",
|
|
10
|
+
"aborting"
|
|
11
|
+
]);
|
|
12
|
+
function v() {
|
|
13
|
+
return typeof crypto < "u" && crypto.subtle !== void 0 ? new r() : new l();
|
|
14
|
+
}
|
|
15
|
+
function y() {
|
|
16
|
+
return {
|
|
17
|
+
status: "idle",
|
|
18
|
+
progress: {
|
|
19
|
+
loaded: 0,
|
|
20
|
+
total: 0,
|
|
21
|
+
partsCompleted: 0,
|
|
22
|
+
partsTotal: 0,
|
|
23
|
+
percent: 0
|
|
24
|
+
},
|
|
25
|
+
error: null,
|
|
26
|
+
result: null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function b(r = {}) {
|
|
30
|
+
let l = d()[t], b = e(r), x = h(y()), S = h(/* @__PURE__ */ new Set()), C = h(null), w = h(0), T = h(null), E = f((e) => (S.current.add(e), () => {
|
|
31
|
+
S.current.delete(e);
|
|
32
|
+
}), []), D = f(() => x.current, []), O = f((e) => {
|
|
33
|
+
x.current = {
|
|
34
|
+
...x.current,
|
|
35
|
+
...e
|
|
36
|
+
};
|
|
37
|
+
for (let e of S.current) e();
|
|
38
|
+
}, []), k = f(async (e, t) => {
|
|
39
|
+
let r = b.current, d = ++w.current, f = () => w.current !== d;
|
|
40
|
+
T.current?.abort();
|
|
41
|
+
let p = new AbortController();
|
|
42
|
+
T.current = p;
|
|
43
|
+
let m = e instanceof File && r.persistence !== null, h = m ? r.persistence ?? new n() : null, g = m ? r.fingerprinter ?? v() : null, y = {
|
|
44
|
+
http: l,
|
|
45
|
+
apiPath: r.apiPath ?? i,
|
|
46
|
+
resource: r.resource ?? a,
|
|
47
|
+
version: r.version ?? o
|
|
48
|
+
}, x = m && e instanceof File && g ? await g.fingerprint(e) : null;
|
|
49
|
+
if (f()) throw new s();
|
|
50
|
+
let S = m && h && x ? await u({
|
|
51
|
+
fingerprint: x,
|
|
52
|
+
persistence: h,
|
|
53
|
+
ctx: y,
|
|
54
|
+
onResumeDetected: r.onResumeDetected,
|
|
55
|
+
signal: p.signal
|
|
56
|
+
}) : void 0;
|
|
57
|
+
if (f()) throw new s();
|
|
58
|
+
let E = new c(l, e, {
|
|
59
|
+
...r,
|
|
60
|
+
init: {
|
|
61
|
+
...r.init,
|
|
62
|
+
...t
|
|
63
|
+
},
|
|
64
|
+
onStatusChange: (e) => {
|
|
65
|
+
C.current === E && (h && x && (e === "succeeded" || e === "aborted") && h.remove(x), O({ status: e }), r.onStatusChange?.(e));
|
|
66
|
+
},
|
|
67
|
+
onProgress: (e) => {
|
|
68
|
+
C.current === E && (O({ progress: e }), r.onProgress?.(e));
|
|
69
|
+
},
|
|
70
|
+
onSessionOpened: (e) => {
|
|
71
|
+
C.current === E && h && x && h.save({
|
|
72
|
+
fingerprint: x,
|
|
73
|
+
claimId: e.claimId,
|
|
74
|
+
key: e.key,
|
|
75
|
+
partSize: e.partSize,
|
|
76
|
+
partCount: e.partCount,
|
|
77
|
+
expiresAt: e.expiresAt,
|
|
78
|
+
savedAt: Date.now()
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}), D = C.current;
|
|
82
|
+
if (C.current = E, D && _.has(D.status) && await D.abort(), f()) throw C.current === E && (C.current = D), new s();
|
|
83
|
+
O({
|
|
84
|
+
status: "idle",
|
|
85
|
+
progress: {
|
|
86
|
+
loaded: 0,
|
|
87
|
+
total: e.size,
|
|
88
|
+
partsCompleted: 0,
|
|
89
|
+
partsTotal: 0,
|
|
90
|
+
percent: 0
|
|
91
|
+
},
|
|
92
|
+
error: null,
|
|
93
|
+
result: null
|
|
94
|
+
});
|
|
95
|
+
try {
|
|
96
|
+
let e = await E.start(S);
|
|
97
|
+
return O({ result: e }), r.onSuccess?.(e), e;
|
|
98
|
+
} catch (e) {
|
|
99
|
+
let t = e;
|
|
100
|
+
throw S?.kind === "resume" && h && x && C.current === E && h.remove(x), C.current === E && (O({ error: t }), r.onError?.(t)), t;
|
|
101
|
+
}
|
|
102
|
+
}, [
|
|
103
|
+
l,
|
|
104
|
+
O,
|
|
105
|
+
b
|
|
106
|
+
]), A = f(() => {
|
|
107
|
+
T.current?.abort();
|
|
108
|
+
let { current: e } = C;
|
|
109
|
+
e && _.has(e.status) && e.abort();
|
|
110
|
+
}, []), j = f(() => {
|
|
111
|
+
w.current++, T.current?.abort();
|
|
112
|
+
let { current: e } = C;
|
|
113
|
+
e && _.has(e.status) && e.abort(), C.current = null, O(y());
|
|
114
|
+
}, [O]);
|
|
115
|
+
p(() => () => {
|
|
116
|
+
T.current?.abort();
|
|
117
|
+
let { current: e } = C;
|
|
118
|
+
e && _.has(e.status) && e.abort();
|
|
119
|
+
}, []);
|
|
120
|
+
let M = g(E, D, D);
|
|
121
|
+
return m(() => ({
|
|
122
|
+
upload: k,
|
|
123
|
+
abort: A,
|
|
124
|
+
reset: j,
|
|
125
|
+
status: M.status,
|
|
126
|
+
progress: M.progress,
|
|
127
|
+
error: M.error,
|
|
128
|
+
result: M.result,
|
|
129
|
+
isUploading: _.has(M.status)
|
|
130
|
+
}), [
|
|
131
|
+
k,
|
|
132
|
+
A,
|
|
133
|
+
j,
|
|
134
|
+
M
|
|
135
|
+
]);
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { b as useUpload };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/hooks v2.
|
|
1
|
+
/*! @vef-framework-react/hooks v2.2.0 made by Venus | 2026-05-18T05:49:14.786Z */
|
|
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
|
@@ -24,4 +24,5 @@ export { useShallowIsomorphicEffect } from './use-shallow-isomorphic-effect';
|
|
|
24
24
|
export { useShallowLayoutEffect } from './use-shallow-layout-effect';
|
|
25
25
|
export { useShallowMemo } from './use-shallow-memo';
|
|
26
26
|
export { useSingleton } from './use-singleton';
|
|
27
|
+
export { useUpload, type UseUploadOptions, type UseUploadResult } from './use-upload';
|
|
27
28
|
export { useViewportSize } from './use-viewport-size';
|
package/dist/types/lib.d.ts
CHANGED
|
@@ -8,6 +8,5 @@ export declare function useElementSize<T extends HTMLElement = any>(options?: Re
|
|
|
8
8
|
width: number;
|
|
9
9
|
height: number;
|
|
10
10
|
};
|
|
11
|
-
export { useChat, useCompletion, experimental_useObject as useObject, type Chat, type CreateUIMessage, type UIMessage, type UseChatHelpers, type UseChatOptions, type UseCompletionHelpers, type UseCompletionOptions, type Experimental_UseObjectHelpers as UseObjectHelpers, type Experimental_UseObjectOptions as UseObjectOptions } from '@ai-sdk/react';
|
|
12
11
|
export { assignRef, getHotkeyHandler, mergeRefs, useDebouncedCallback, useDebouncedState, useDebouncedValue, useDidUpdate, useDocumentTitle, useEventListener, useFocusTrap, useFullscreenDocument, useIntersection, useInterval, useIsFirstRender, useIsomorphicEffect, useMergedRef, useMounted, useMutationObserverTarget, usePrevious, useResizeObserver, useTimeout, useWindowEvent } from '@mantine/hooks';
|
|
13
12
|
export { HotkeysProvider, useHotkeys, useHotkeysContext, useRecordHotkeys, type HotkeyCallback, type Options as HotkeysOptions } from 'react-hotkeys-hook';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { FileFingerprinter, ResumablePersistence, ResumeDecisionHandler, UploaderOptions, UploadError, UploadInit, UploadProgress, UploadResult, UploadStatus } from '@vef-framework-react/core';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration accepted by `useUpload`. Mirrors the headless
|
|
4
|
+
* `UploaderOptions` minus the fields that React owns (`signal` is managed
|
|
5
|
+
* internally, `onProgress` / `onStatusChange` are forwarded). Adds the
|
|
6
|
+
* familiar `onSuccess` / `onError` lifecycle callbacks consumers expect.
|
|
7
|
+
*/
|
|
8
|
+
export interface UseUploadOptions extends Omit<UploaderOptions, "signal" | "onProgress" | "onStatusChange" | "onSessionOpened"> {
|
|
9
|
+
/**
|
|
10
|
+
* Fires on every aggregated progress tick.
|
|
11
|
+
*/
|
|
12
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Fires on every Uploader status transition.
|
|
15
|
+
*/
|
|
16
|
+
onStatusChange?: (status: UploadStatus) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Fires once when the upload completes successfully.
|
|
19
|
+
*/
|
|
20
|
+
onSuccess?: (result: UploadResult) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Fires once on any terminal failure (including aborts).
|
|
23
|
+
*/
|
|
24
|
+
onError?: (error: UploadError) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Persistence layer for resumable-upload records. When omitted, a
|
|
27
|
+
* `LocalStoragePersistence` is used. Pass a custom implementation to
|
|
28
|
+
* route records into IndexedDB, a tenant-namespaced backend, or a
|
|
29
|
+
* server-side session store. Pass `null` to disable resume entirely.
|
|
30
|
+
*/
|
|
31
|
+
persistence?: ResumablePersistence | null;
|
|
32
|
+
/**
|
|
33
|
+
* Fingerprinting strategy used to identify a file across sessions.
|
|
34
|
+
* Defaults to `PrefixFingerprinter` (SHA-256 of name + size +
|
|
35
|
+
* lastModified + first 4 MiB) when `crypto.subtle` is available, with
|
|
36
|
+
* `WeakFingerprinter` (name + size + lastModified only) as the
|
|
37
|
+
* fallback. Override to plug in a different policy (e.g. full-file
|
|
38
|
+
* SHA-256 inside a Web Worker).
|
|
39
|
+
*/
|
|
40
|
+
fingerprinter?: FileFingerprinter;
|
|
41
|
+
/**
|
|
42
|
+
* Decision handler invoked when a resume candidate is found. Receives
|
|
43
|
+
* the persisted record and the live `list_parts` result so the UI can
|
|
44
|
+
* present a meaningful confirmation. The default — when omitted — is
|
|
45
|
+
* `"discard"`: resuming the wrong file is worse than re-uploading.
|
|
46
|
+
*/
|
|
47
|
+
onResumeDetected?: ResumeDecisionHandler;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reactive snapshot the hook exposes to its caller. The `error` and
|
|
51
|
+
* `result` fields are mutually exclusive: at most one is non-null in any
|
|
52
|
+
* terminal state.
|
|
53
|
+
*/
|
|
54
|
+
export interface UseUploadResult {
|
|
55
|
+
/**
|
|
56
|
+
* Start a new upload. Cancels any upload still in flight.
|
|
57
|
+
*/
|
|
58
|
+
upload: (file: File | Blob, init?: UploadInit) => Promise<UploadResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Cancel the in-flight upload, if any. No-op when idle / terminal.
|
|
61
|
+
*/
|
|
62
|
+
abort: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Clear state and detach the current Uploader.
|
|
65
|
+
*/
|
|
66
|
+
reset: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Current Uploader status. `"idle"` between resets.
|
|
69
|
+
*/
|
|
70
|
+
status: UploadStatus;
|
|
71
|
+
/**
|
|
72
|
+
* Latest aggregated progress; zeroed between resets.
|
|
73
|
+
*/
|
|
74
|
+
progress: UploadProgress;
|
|
75
|
+
/**
|
|
76
|
+
* Terminal error, when status is `"failed"`.
|
|
77
|
+
*/
|
|
78
|
+
error: UploadError | null;
|
|
79
|
+
/**
|
|
80
|
+
* Terminal result, when status is `"succeeded"`.
|
|
81
|
+
*/
|
|
82
|
+
result: UploadResult | null;
|
|
83
|
+
/**
|
|
84
|
+
* Convenience: status is one of initializing/uploading/completing/aborting.
|
|
85
|
+
*/
|
|
86
|
+
isUploading: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Drive a single chunked upload through `vef-framework-go`'s `sys/storage`
|
|
90
|
+
* RPC. Returns a snapshot of upload state plus imperative `upload` / `abort`
|
|
91
|
+
* / `reset` handles. One in-flight upload at a time; calling `upload` again
|
|
92
|
+
* cancels the previous run.
|
|
93
|
+
*
|
|
94
|
+
* For batch uploads (multiple files in parallel) reach for the headless
|
|
95
|
+
* `Uploader` class from `@vef-framework-react/core` directly — this hook is
|
|
96
|
+
* a thin React adapter intentionally scoped to a single upload per consumer.
|
|
97
|
+
*/
|
|
98
|
+
export declare function useUpload(options?: UseUploadOptions): UseUploadResult;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/hooks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Hooks for VEF framework",
|
|
7
7
|
"author": {
|
|
@@ -48,14 +48,13 @@
|
|
|
48
48
|
"react": ">=19"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"@vef-framework-react/core": "2.
|
|
55
|
-
"@vef-framework-react/shared": "2.1.11"
|
|
51
|
+
"@mantine/hooks": "^9.2.1",
|
|
52
|
+
"react-hotkeys-hook": "^5.3.2",
|
|
53
|
+
"@vef-framework-react/shared": "2.2.0",
|
|
54
|
+
"@vef-framework-react/core": "2.2.0"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"react": "^19.2.
|
|
57
|
+
"react": "^19.2.6"
|
|
59
58
|
},
|
|
60
59
|
"scripts": {
|
|
61
60
|
"clean": "rimraf dist",
|