@machinerd/js-module 0.8.0 → 0.9.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/README.md +6 -0
- package/dist/api-client-C0sbSOQf.mjs +1 -0
- package/dist/api-client-C3o2pO0q.cjs +1 -0
- package/dist/button-CQZuaIU7.mjs +1 -0
- package/dist/button-ChX3XGbR.cjs +1 -0
- package/dist/button-DHvx-GAg.d.cts +50 -0
- package/dist/button-DRIyBtEB.d.mts +50 -0
- package/dist/common-B8HXyhZa.cjs +1 -0
- package/dist/common-CWHkXe0F.mjs +1 -0
- package/dist/{common-Bn0Ko6B7.cjs → common-D4sUwkFd.cjs} +1 -1
- package/dist/{common-Df03Ovdm.mjs → common-ZUMpASnc.mjs} +1 -1
- package/dist/editor/index.cjs +1 -0
- package/dist/editor/index.d.cts +80 -0
- package/dist/editor/index.d.mts +80 -0
- package/dist/editor/index.mjs +1 -0
- package/dist/format-1_RTNUQv.mjs +1 -0
- package/dist/format-DEuImTYJ.cjs +1 -0
- package/dist/hooks/common/index.cjs +1 -0
- package/dist/hooks/common/index.d.cts +72 -0
- package/dist/hooks/common/index.d.mts +72 -0
- package/dist/hooks/common/index.mjs +1 -0
- package/dist/hooks/use-snackbar.cjs +1 -0
- package/dist/hooks/use-snackbar.d.cts +10 -0
- package/dist/hooks/use-snackbar.d.mts +10 -0
- package/dist/hooks/use-snackbar.mjs +1 -0
- package/dist/{index-B3fFA21M.d.mts → index-B1YNV_Vm.d.cts} +4 -0
- package/dist/{index-CeiAF-WU.d.cts → index-C8chDULk.d.mts} +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/providers/api-client/index.cjs +1 -0
- package/dist/providers/{index.d.cts → api-client/index.d.cts} +3 -3
- package/dist/providers/{index.d.mts → api-client/index.d.mts} +3 -3
- package/dist/providers/api-client/index.mjs +1 -0
- package/dist/providers/noti-stack/index.cjs +1 -0
- package/dist/providers/noti-stack/index.d.cts +11 -0
- package/dist/providers/noti-stack/index.d.mts +11 -0
- package/dist/providers/noti-stack/index.mjs +1 -0
- package/dist/{skeleton-DtV9S1QK.cjs → skeleton-B5ZccRFX.cjs} +1 -1
- package/dist/{skeleton-B6_oBhkl.mjs → skeleton-Y22bmaaB.mjs} +1 -1
- package/dist/src-6KfzqI9Z.cjs +1 -0
- package/dist/src-CIMlbgv1.mjs +1 -0
- package/dist/styles/editor.css +255 -0
- package/dist/styles/index.css +371 -0
- package/dist/ui/carousel/index.cjs +1 -1
- package/dist/ui/carousel/index.d.cts +9 -9
- package/dist/ui/carousel/index.d.mts +9 -9
- package/dist/ui/carousel/index.mjs +1 -1
- package/dist/ui/dialog/index.cjs +1 -1
- package/dist/ui/dialog/index.d.cts +1 -1
- package/dist/ui/dialog/index.d.mts +2 -2
- package/dist/ui/dialog/index.mjs +1 -1
- package/dist/ui/dnd/index.cjs +1 -0
- package/dist/ui/dnd/index.d.cts +17 -0
- package/dist/ui/dnd/index.d.mts +17 -0
- package/dist/ui/dnd/index.mjs +1 -0
- package/dist/ui/dropdown/index.cjs +1 -0
- package/dist/ui/dropdown/index.d.cts +72 -0
- package/dist/ui/dropdown/index.d.mts +72 -0
- package/dist/ui/dropdown/index.mjs +1 -0
- package/dist/ui/image/index.cjs +1 -1
- package/dist/ui/image/index.d.cts +8 -8
- package/dist/ui/image/index.d.mts +8 -8
- package/dist/ui/image/index.mjs +1 -1
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.d.cts +12 -55
- package/dist/ui/index.d.mts +12 -55
- package/dist/ui/index.mjs +1 -1
- package/dist/ui/motion-dialog/index.cjs +1 -0
- package/dist/ui/motion-dialog/index.d.cts +34 -0
- package/dist/ui/motion-dialog/index.d.mts +34 -0
- package/dist/ui/motion-dialog/index.mjs +1 -0
- package/dist/ui/preserve-focus-button/index.cjs +1 -0
- package/dist/ui/preserve-focus-button/index.d.cts +12 -0
- package/dist/ui/preserve-focus-button/index.d.mts +12 -0
- package/dist/ui/preserve-focus-button/index.mjs +1 -0
- package/dist/ui/sheet/index.cjs +1 -1
- package/dist/ui/sheet/index.d.mts +2 -2
- package/dist/ui/sheet/index.mjs +1 -1
- package/dist/ui/switch/index.cjs +1 -0
- package/dist/ui/switch/index.d.cts +16 -0
- package/dist/ui/switch/index.d.mts +16 -0
- package/dist/ui/switch/index.mjs +1 -0
- package/dist/ui/tooltip/index.cjs +1 -1
- package/dist/ui/tooltip/index.d.cts +2 -2
- package/dist/ui/tooltip/index.mjs +1 -1
- package/dist/ui-Bs9PP9eC.cjs +1 -0
- package/dist/ui-D2DoC_0E.mjs +1 -0
- package/dist/use-dialog-stack-Crj8YWJl.mjs +1 -0
- package/dist/use-dialog-stack-YiLs-sNf.cjs +1 -0
- package/dist/use-drag-resize-BdeLdulk.mjs +1 -0
- package/dist/use-drag-resize-DEgcua2U.d.cts +48 -0
- package/dist/use-drag-resize-DRHPv5RK.d.mts +48 -0
- package/dist/use-drag-resize-DeDqPC4h.cjs +1 -0
- package/dist/use-subset-image-Df2fCrtH.mjs +1 -0
- package/dist/use-subset-image-Dygkyw-W.d.mts +601 -0
- package/dist/use-subset-image-bDB5TSd4.d.cts +601 -0
- package/dist/use-subset-image-o_gmC1HL.cjs +1 -0
- package/dist/util/common.cjs +1 -1
- package/dist/util/common.d.cts +9 -2
- package/dist/util/common.d.mts +9 -2
- package/dist/util/common.mjs +1 -1
- package/dist/util/editor.cjs +1 -0
- package/dist/util/editor.d.cts +21 -0
- package/dist/util/editor.d.mts +21 -0
- package/dist/util/editor.mjs +1 -0
- package/dist/util/fetcher.cjs +1 -0
- package/dist/util/fetcher.d.cts +15 -0
- package/dist/util/fetcher.d.mts +15 -0
- package/dist/util/fetcher.mjs +1 -0
- package/dist/util/file.mjs +1 -1
- package/dist/util/format.cjs +1 -1
- package/dist/util/format.d.cts +29 -1
- package/dist/util/format.d.mts +29 -1
- package/dist/util/format.mjs +1 -1
- package/package.json +104 -33
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.d.cts +0 -2
- package/dist/hooks/index.d.mts +0 -2
- package/dist/hooks/index.mjs +0 -1
- package/dist/hooks--O5RcEJq.cjs +0 -1
- package/dist/hooks-C9rXWkfW.mjs +0 -1
- package/dist/index-B11XDBo5.d.cts +0 -655
- package/dist/index-dbBlRf5k.d.mts +0 -655
- package/dist/providers/index.cjs +0 -1
- package/dist/providers/index.mjs +0 -1
- package/dist/providers-CkXkdYcB.cjs +0 -1
- package/dist/providers-zftmvT1z.mjs +0 -1
- package/dist/src-CjpmdVyv.cjs +0 -1
- package/dist/src-CukOR3K2.mjs +0 -1
- package/dist/use-subset-image-D8ssrZhj.mjs +0 -1
- package/dist/use-subset-image-DC86cg6O.cjs +0 -1
- /package/dist/{file-DShNxIW4.mjs → file-B-UJkabO.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";const i={DEFAULT_WIDTH:200,DEFAULT_HEIGHT:100},a={width:i.DEFAULT_WIDTH,height:i.DEFAULT_HEIGHT},o={width:!0,height:!0};function s(e,t,n){let r=e;return t!==void 0&&(r=Math.max(r,t)),n!==void 0&&(r=Math.min(r,n)),r}function c(e,t,n,r){let i={...t};return e.includes(`left`)&&(i.width=t.width-n),e.includes(`right`)&&(i.width=t.width+n),e.includes(`top`)&&(i.height=t.height-r),e.includes(`bottom`)&&(i.height=t.height+r),i}function l(e,t,n){let r=[],i=[];return n?.width!==void 0&&r.push(n.width),n?.height!==void 0&&i.push(n.height),e&&(t.width&&r.push(e.width),t.height&&i.push(e.height)),{width:r.length?Math.min(...r):void 0,height:i.length?Math.min(...i):void 0}}function u(e,t,n){let{width:r,height:i}=e;if(t===`left`||t===`right`)return{width:r,height:r/n};if(t===`top`||t===`bottom`)return{width:i*n,height:i};let a={width:r,height:r/n},o={width:i*n,height:i};return Math.abs(a.height-i)<=Math.abs(o.width-r)?a:o}function d(e,t,n,r){if(!r)return{width:Math.ceil(s(e.width,t.width,n.width)),height:Math.ceil(s(e.height,t.height,n.height))};let{width:i,height:a}=e;(i<=0||a<=0)&&(i=t.width,a=t.width/r);let o=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/a,1);i*=o,a*=o;let c=Math.max(i<t.width?t.width/i:1,a<t.height?t.height/a:1,1);i*=c,a*=c;let l=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/a,1);return i*=l,a*=l,{width:Math.ceil(i),height:Math.ceil(a)}}function f(e,t,n){let r=c(t.direction,t.startSize,e.clientX-t.startX,e.clientY-t.startY),i=n.keepAspectRatio&&t.startSize.height>0?t.startSize.width/t.startSize.height:null,a=i?u(r,t.direction,i):r,o=l(n.boundaryRef?.current?.getBoundingClientRect(),n.limitSize,n.maxSize);return d(a,n.minSize,o,i)}function p({boundaryRef:i,size:s,keepAspectRatio:c=!0,minSize:l=a,maxSize:u,limitSize:d=o,onResize:p,onResizeEnd:m}){let[h,g]=r(!1),_=n(null),v=n({boundaryRef:i,size:s,keepAspectRatio:c,limitSize:d,minSize:l,maxSize:u,onResize:p,onResizeEnd:m});t(()=>{v.current={boundaryRef:i,size:s,keepAspectRatio:c,limitSize:d,minSize:l,maxSize:u,onResize:p,onResizeEnd:m}});let y=e(e=>{let t=_.current;!t||e.pointerId!==t.pointerId||(_.current=null,g(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),v.current.onResizeEnd?.(t.lastSize))},[]),b=e(e=>{let t=_.current;if(!t||e.pointerId!==t.pointerId)return;let n=f(e,t,v.current);t.lastSize=n,v.current.onResize?.(n)},[]);return t(()=>()=>{_.current=null},[]),{isResizing:h,getHandleProps:e(e=>({onPointerDown:t=>{if(t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=v.current.size,r={width:n.width,height:n.height};_.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startSize:r,direction:e,lastSize:r},g(!0)},onPointerMove:b,onPointerUp:y,onPointerCancel:y,style:{touchAction:`none`}}),[b,y])}}export{p as n,i as t};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/hooks/use-drag-resize.d.ts
|
|
2
|
+
declare const RESIZE_CONSTANTS: {
|
|
3
|
+
DEFAULT_WIDTH: number;
|
|
4
|
+
DEFAULT_HEIGHT: number;
|
|
5
|
+
};
|
|
6
|
+
type ResizeDirection = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
7
|
+
interface Size {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
interface LimitSize {
|
|
12
|
+
width: boolean;
|
|
13
|
+
height: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface ResizeHandleProps {
|
|
16
|
+
onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
|
|
17
|
+
onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;
|
|
18
|
+
onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;
|
|
19
|
+
onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;
|
|
20
|
+
style: {
|
|
21
|
+
touchAction: 'none';
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface UseDragResizeProps {
|
|
25
|
+
boundaryRef?: React.RefObject<HTMLElement | null>;
|
|
26
|
+
size: Size;
|
|
27
|
+
keepAspectRatio?: boolean;
|
|
28
|
+
limitSize?: LimitSize;
|
|
29
|
+
minSize?: Size;
|
|
30
|
+
maxSize?: Size;
|
|
31
|
+
onResize?: (size: Size) => void;
|
|
32
|
+
onResizeEnd?: (size: Size) => void;
|
|
33
|
+
}
|
|
34
|
+
declare function useDragResize({
|
|
35
|
+
boundaryRef,
|
|
36
|
+
size,
|
|
37
|
+
keepAspectRatio,
|
|
38
|
+
minSize,
|
|
39
|
+
maxSize,
|
|
40
|
+
limitSize,
|
|
41
|
+
onResize,
|
|
42
|
+
onResizeEnd
|
|
43
|
+
}: UseDragResizeProps): {
|
|
44
|
+
isResizing: boolean;
|
|
45
|
+
getHandleProps: (direction: ResizeDirection) => ResizeHandleProps;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { Size as a, ResizeHandleProps as i, RESIZE_CONSTANTS as n, UseDragResizeProps as o, ResizeDirection as r, useDragResize as s, LimitSize as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/hooks/use-drag-resize.d.ts
|
|
2
|
+
declare const RESIZE_CONSTANTS: {
|
|
3
|
+
DEFAULT_WIDTH: number;
|
|
4
|
+
DEFAULT_HEIGHT: number;
|
|
5
|
+
};
|
|
6
|
+
type ResizeDirection = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
7
|
+
interface Size {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
interface LimitSize {
|
|
12
|
+
width: boolean;
|
|
13
|
+
height: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface ResizeHandleProps {
|
|
16
|
+
onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
|
|
17
|
+
onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;
|
|
18
|
+
onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;
|
|
19
|
+
onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;
|
|
20
|
+
style: {
|
|
21
|
+
touchAction: 'none';
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface UseDragResizeProps {
|
|
25
|
+
boundaryRef?: React.RefObject<HTMLElement | null>;
|
|
26
|
+
size: Size;
|
|
27
|
+
keepAspectRatio?: boolean;
|
|
28
|
+
limitSize?: LimitSize;
|
|
29
|
+
minSize?: Size;
|
|
30
|
+
maxSize?: Size;
|
|
31
|
+
onResize?: (size: Size) => void;
|
|
32
|
+
onResizeEnd?: (size: Size) => void;
|
|
33
|
+
}
|
|
34
|
+
declare function useDragResize({
|
|
35
|
+
boundaryRef,
|
|
36
|
+
size,
|
|
37
|
+
keepAspectRatio,
|
|
38
|
+
minSize,
|
|
39
|
+
maxSize,
|
|
40
|
+
limitSize,
|
|
41
|
+
onResize,
|
|
42
|
+
onResizeEnd
|
|
43
|
+
}: UseDragResizeProps): {
|
|
44
|
+
isResizing: boolean;
|
|
45
|
+
getHandleProps: (direction: ResizeDirection) => ResizeHandleProps;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { Size as a, ResizeHandleProps as i, RESIZE_CONSTANTS as n, UseDragResizeProps as o, ResizeDirection as r, useDragResize as s, LimitSize as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`react`);const n={DEFAULT_WIDTH:200,DEFAULT_HEIGHT:100},r={width:n.DEFAULT_WIDTH,height:n.DEFAULT_HEIGHT},i={width:!0,height:!0};function a(e,t,n){let r=e;return t!==void 0&&(r=Math.max(r,t)),n!==void 0&&(r=Math.min(r,n)),r}function o(e,t,n,r){let i={...t};return e.includes(`left`)&&(i.width=t.width-n),e.includes(`right`)&&(i.width=t.width+n),e.includes(`top`)&&(i.height=t.height-r),e.includes(`bottom`)&&(i.height=t.height+r),i}function s(e,t,n){let r=[],i=[];return n?.width!==void 0&&r.push(n.width),n?.height!==void 0&&i.push(n.height),e&&(t.width&&r.push(e.width),t.height&&i.push(e.height)),{width:r.length?Math.min(...r):void 0,height:i.length?Math.min(...i):void 0}}function c(e,t,n){let{width:r,height:i}=e;if(t===`left`||t===`right`)return{width:r,height:r/n};if(t===`top`||t===`bottom`)return{width:i*n,height:i};let a={width:r,height:r/n},o={width:i*n,height:i};return Math.abs(a.height-i)<=Math.abs(o.width-r)?a:o}function l(e,t,n,r){if(!r)return{width:Math.ceil(a(e.width,t.width,n.width)),height:Math.ceil(a(e.height,t.height,n.height))};let{width:i,height:o}=e;(i<=0||o<=0)&&(i=t.width,o=t.width/r);let s=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/o,1);i*=s,o*=s;let c=Math.max(i<t.width?t.width/i:1,o<t.height?t.height/o:1,1);i*=c,o*=c;let l=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/o,1);return i*=l,o*=l,{width:Math.ceil(i),height:Math.ceil(o)}}function u(e,t,n){let r=o(t.direction,t.startSize,e.clientX-t.startX,e.clientY-t.startY),i=n.keepAspectRatio&&t.startSize.height>0?t.startSize.width/t.startSize.height:null,a=i?c(r,t.direction,i):r,u=s(n.boundaryRef?.current?.getBoundingClientRect(),n.limitSize,n.maxSize);return l(a,n.minSize,u,i)}function d({boundaryRef:e,size:n,keepAspectRatio:a=!0,minSize:o=r,maxSize:s,limitSize:c=i,onResize:l,onResizeEnd:d}){let[f,p]=(0,t.useState)(!1),m=(0,t.useRef)(null),h=(0,t.useRef)({boundaryRef:e,size:n,keepAspectRatio:a,limitSize:c,minSize:o,maxSize:s,onResize:l,onResizeEnd:d});(0,t.useEffect)(()=>{h.current={boundaryRef:e,size:n,keepAspectRatio:a,limitSize:c,minSize:o,maxSize:s,onResize:l,onResizeEnd:d}});let g=(0,t.useCallback)(e=>{let t=m.current;!t||e.pointerId!==t.pointerId||(m.current=null,p(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),h.current.onResizeEnd?.(t.lastSize))},[]),_=(0,t.useCallback)(e=>{let t=m.current;if(!t||e.pointerId!==t.pointerId)return;let n=u(e,t,h.current);t.lastSize=n,h.current.onResize?.(n)},[]);return(0,t.useEffect)(()=>()=>{m.current=null},[]),{isResizing:f,getHandleProps:(0,t.useCallback)(e=>({onPointerDown:t=>{if(t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=h.current.size,r={width:n.width,height:n.height};m.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startSize:r,direction:e,lastSize:r},p(!0)},onPointerMove:_,onPointerUp:g,onPointerCancel:g,style:{touchAction:`none`}}),[_,g])}}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,o as n}from"./file-B-UJkabO.mjs";import{n as r}from"./api-client-C0sbSOQf.mjs";import{useCallback as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";const l=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function u({ref:u,src:d,forceLoad:f=!1,folder:p=`media`,fallbackSrc:m,origin:h,originalWidth:g,loading:_=`lazy`,...v}){let y=r(),[b,x]=c(0),[S,C]=c(f||!d),[w,T]=c(!d),E=s(null),D=s(null),O=i(e=>{E.current=e,typeof u==`function`?u(e):u&&(u.current=e)},[u]),k=i((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?y.cdnStatic(n):y.cdnMedia(n)},[y]),A=o(()=>l.filter(e=>e<=g),[g]),j=o(()=>t(d)?d:k(d,p),[k,d,p]),M=o(()=>{if(h||!e(d)||A.length===0)return;let{filenameWithoutExtension:t,directory:r}=n(d,p);if(v.width){let e=A.find(e=>e>=v.width)??A[A.length-1],n=e*2,i=A.find(e=>e>=n)??A[A.length-1];return`${k(`${r}/subsets/w${e}/${t}.webp`,p)} 1x,${k(`${r}/subsets/w${i}/${t}.webp`,p)} 2x`}let i=``;for(let e of A)i+=`${k(`${r}/subsets/w${e}/${t}.webp`,p)} ${e}w, `;return i.trim()},[A,k,p,h,d,v.width]),N=i((e,t)=>{let{filenameWithoutExtension:r,directory:i}=n(e,t);return`${k(`${i}/subsets/origin/${r}.webp`,t)}`},[k]),P=o(()=>{if(d)return`${N(d,p)} 1x`},[d,p,N]),F=i(e=>{x(t=>t>=2?(e&&(D.current=e),3):t+1)},[]),I=()=>{if(b===0)return M;if(b===1)return P},L=b>=3?m:j,R=b===0?v.sizes:void 0,z=b>0?`eager`:_;a(()=>{b<3||T(!0)},[b]),a(()=>{let e=E.current;if(!e||w)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){F();return}if(e.complete&&e.naturalWidth>0){C(!0);return}let t=()=>{e.naturalWidth>0&&C(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[w,b,F]);let{fill:B,...V}=v;return{ref:O,isLoad:S,isError:w,imageProps:{...V,src:L,srcSet:I(),sizes:R,loading:z,onError:w?void 0:F}}}export{u as n,l as t};
|