@jbpark/use-hooks 2.0.2 → 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/README.ko.md +18 -10
- package/README.md +16 -10
- package/dist/hooks/index.d.mts +13 -0
- package/dist/hooks/index.mjs +15 -0
- package/dist/hooks/useBodyScrollLock/index.d.mts +5 -0
- package/dist/hooks/useBodyScrollLock/index.mjs +115 -0
- package/dist/hooks/useBodyScrollLock/index.mjs.map +1 -0
- package/dist/hooks/useDebounce/index.d.mts +12 -0
- package/dist/hooks/useDebounce/index.mjs +41 -0
- package/dist/hooks/useDebounce/index.mjs.map +1 -0
- package/dist/hooks/useElementPosition/index.d.mts +8 -0
- package/dist/hooks/useElementPosition/index.mjs +32 -0
- package/dist/hooks/useElementPosition/index.mjs.map +1 -0
- package/dist/hooks/useElementScroll/index.d.mts +15 -0
- package/dist/hooks/useElementScroll/index.mjs +68 -0
- package/dist/hooks/useElementScroll/index.mjs.map +1 -0
- package/dist/hooks/useImage/index.d.mts +14 -0
- package/dist/hooks/useImage/index.mjs +56 -0
- package/dist/hooks/useImage/index.mjs.map +1 -0
- package/dist/hooks/useLocalStorage/index.d.mts +5 -0
- package/dist/hooks/useLocalStorage/index.mjs +40 -0
- package/dist/hooks/useLocalStorage/index.mjs.map +1 -0
- package/dist/hooks/useRecursiveTimeout/index.d.mts +5 -0
- package/dist/hooks/useRecursiveTimeout/index.mjs +27 -0
- package/dist/hooks/useRecursiveTimeout/index.mjs.map +1 -0
- package/dist/hooks/useResponsiveSize/index.d.mts +26 -0
- package/dist/hooks/useResponsiveSize/index.mjs +108 -0
- package/dist/hooks/useResponsiveSize/index.mjs.map +1 -0
- package/dist/hooks/useScrollToElements/index.d.mts +14 -0
- package/dist/hooks/useScrollToElements/index.mjs +34 -0
- package/dist/hooks/useScrollToElements/index.mjs.map +1 -0
- package/dist/hooks/useThrottle/index.d.mts +5 -0
- package/dist/hooks/useThrottle/index.mjs +42 -0
- package/dist/hooks/useThrottle/index.mjs.map +1 -0
- package/dist/hooks/useTimeline/index.d.mts +50 -0
- package/dist/hooks/useTimeline/index.mjs +175 -0
- package/dist/hooks/useTimeline/index.mjs.map +1 -0
- package/dist/hooks/useViewport/index.d.mts +18 -0
- package/dist/hooks/useViewport/index.mjs +87 -0
- package/dist/hooks/useViewport/index.mjs.map +1 -0
- package/dist/hooks/useWindowScroll/index.d.mts +12 -0
- package/dist/hooks/useWindowScroll/index.mjs +60 -0
- package/dist/hooks/useWindowScroll/index.mjs.map +1 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.mjs +16 -0
- package/package.json +7 -8
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -106
- package/dist/index.js +0 -424
- package/dist/vite.svg +0 -1
package/dist/index.js
DELETED
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
import { useRef as y, useEffect as f, useState as h, useCallback as p } from "react";
|
|
2
|
-
const V = (e, { delay: o = 100, autoInvoke: d = !0 }, t = []) => {
|
|
3
|
-
const n = y(null), i = y(e), s = y(t), l = y(void 0);
|
|
4
|
-
f(() => {
|
|
5
|
-
i.current = e;
|
|
6
|
-
}), f(() => {
|
|
7
|
-
s.current = t;
|
|
8
|
-
});
|
|
9
|
-
const r = y(null);
|
|
10
|
-
return r.current || (r.current = ((...c) => {
|
|
11
|
-
n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
12
|
-
i.current(...c);
|
|
13
|
-
}, o);
|
|
14
|
-
})), f(() => {
|
|
15
|
-
const c = l.current === void 0 || l.current.length !== t.length || l.current.some((a, u) => a !== t[u]);
|
|
16
|
-
c && n.current && clearTimeout(n.current), d && c && (l.current === void 0 ? i.current() : r.current && r.current()), l.current = t;
|
|
17
|
-
}), f(() => () => {
|
|
18
|
-
n.current && clearTimeout(n.current);
|
|
19
|
-
}, []), r.current;
|
|
20
|
-
}, I = (e = !0) => {
|
|
21
|
-
f(() => {
|
|
22
|
-
if (!e)
|
|
23
|
-
return;
|
|
24
|
-
const o = window.scrollY, d = /iPad|iPhone|iPod/.test(navigator.userAgent), t = {
|
|
25
|
-
documentElement: {
|
|
26
|
-
overflow: document.documentElement.style.overflow,
|
|
27
|
-
height: document.documentElement.style.height,
|
|
28
|
-
position: document.documentElement.style.position,
|
|
29
|
-
width: document.documentElement.style.width
|
|
30
|
-
},
|
|
31
|
-
body: {
|
|
32
|
-
overflow: document.body.style.overflow,
|
|
33
|
-
height: document.body.style.height,
|
|
34
|
-
position: document.body.style.position,
|
|
35
|
-
top: document.body.style.top,
|
|
36
|
-
left: document.body.style.left,
|
|
37
|
-
right: document.body.style.right,
|
|
38
|
-
width: document.body.style.width,
|
|
39
|
-
webkitOverflowScrolling: document.body.style.getPropertyValue(
|
|
40
|
-
"-webkit-overflow-scrolling"
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
if (document.documentElement.style.overflow = "hidden", document.documentElement.style.height = "100%", document.documentElement.style.position = "fixed", document.documentElement.style.width = "100%", document.body.style.overflow = "hidden", document.body.style.height = "100%", document.body.style.position = "fixed", document.body.style.top = `-${o}px`, document.body.style.left = "0", document.body.style.right = "0", document.body.style.width = "100%", d) {
|
|
45
|
-
document.body.style.setProperty("-webkit-overflow-scrolling", "touch");
|
|
46
|
-
const n = (r) => {
|
|
47
|
-
(r.target === document.body || r.target === document.documentElement || r.target === window) && (r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation());
|
|
48
|
-
}, i = () => {
|
|
49
|
-
window.scrollTo(0, 0), document.body.scrollTop = 0, document.documentElement.scrollTop = 0;
|
|
50
|
-
}, s = ["scroll", "touchmove", "touchstart", "touchend"];
|
|
51
|
-
s.forEach((r) => {
|
|
52
|
-
window.addEventListener(r, n, {
|
|
53
|
-
passive: !1,
|
|
54
|
-
capture: !0
|
|
55
|
-
}), document.addEventListener(r, n, {
|
|
56
|
-
passive: !1,
|
|
57
|
-
capture: !0
|
|
58
|
-
}), document.body.addEventListener(r, n, {
|
|
59
|
-
passive: !1,
|
|
60
|
-
capture: !0
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
const l = setInterval(i, 16);
|
|
64
|
-
return () => {
|
|
65
|
-
clearInterval(l), s.forEach((r) => {
|
|
66
|
-
window.removeEventListener(r, n, { capture: !0 }), document.removeEventListener(r, n, { capture: !0 }), document.body.removeEventListener(r, n, {
|
|
67
|
-
capture: !0
|
|
68
|
-
});
|
|
69
|
-
}), document.documentElement.style.overflow = t.documentElement.overflow, document.documentElement.style.height = t.documentElement.height, document.documentElement.style.position = t.documentElement.position, document.documentElement.style.width = t.documentElement.width, document.body.style.overflow = t.body.overflow, document.body.style.height = t.body.height, document.body.style.position = t.body.position, document.body.style.top = t.body.top, document.body.style.left = t.body.left, document.body.style.right = t.body.right, document.body.style.width = t.body.width, t.body.webkitOverflowScrolling ? document.body.style.setProperty(
|
|
70
|
-
"-webkit-overflow-scrolling",
|
|
71
|
-
t.body.webkitOverflowScrolling
|
|
72
|
-
) : document.body.style.removeProperty("-webkit-overflow-scrolling"), window.scrollTo(0, o);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return () => {
|
|
76
|
-
document.documentElement.style.overflow = t.documentElement.overflow, document.documentElement.style.height = t.documentElement.height, document.documentElement.style.position = t.documentElement.position, document.documentElement.style.width = t.documentElement.width, document.body.style.overflow = t.body.overflow, document.body.style.height = t.body.height, document.body.style.position = t.body.position, document.body.style.top = t.body.top, document.body.style.left = t.body.left, document.body.style.right = t.body.right, document.body.style.width = t.body.width, window.scrollTo(0, o);
|
|
77
|
-
};
|
|
78
|
-
}, [e]);
|
|
79
|
-
}, P = (e) => {
|
|
80
|
-
const [o, d] = h(null);
|
|
81
|
-
return f(() => {
|
|
82
|
-
const t = (s) => typeof s == "string" ? document.querySelector(s) : s.current, n = () => {
|
|
83
|
-
const s = t(e);
|
|
84
|
-
d(s ? s.getBoundingClientRect() : null);
|
|
85
|
-
}, i = () => {
|
|
86
|
-
requestAnimationFrame(n);
|
|
87
|
-
};
|
|
88
|
-
return n(), window.addEventListener("scroll", i, { passive: !0 }), window.addEventListener("resize", i, { passive: !0 }), () => {
|
|
89
|
-
window.removeEventListener("scroll", i), window.removeEventListener("resize", i);
|
|
90
|
-
};
|
|
91
|
-
}, [e]), o;
|
|
92
|
-
}, R = () => {
|
|
93
|
-
const [e, o] = h(null), [d, t] = h({
|
|
94
|
-
scrollY: 0,
|
|
95
|
-
scrollPercentage: 0,
|
|
96
|
-
isAtTop: !0,
|
|
97
|
-
isAtBottom: !1,
|
|
98
|
-
scrollableHeight: 0,
|
|
99
|
-
clientHeight: 0,
|
|
100
|
-
scrollHeight: 0
|
|
101
|
-
}), n = p((i) => {
|
|
102
|
-
o(i);
|
|
103
|
-
}, []);
|
|
104
|
-
return f(() => {
|
|
105
|
-
if (!e)
|
|
106
|
-
return;
|
|
107
|
-
const i = () => {
|
|
108
|
-
const { scrollTop: r, scrollHeight: c, clientHeight: a } = e, u = c - a;
|
|
109
|
-
if (u <= 0) {
|
|
110
|
-
t({
|
|
111
|
-
scrollY: 0,
|
|
112
|
-
scrollPercentage: 0,
|
|
113
|
-
isAtTop: !0,
|
|
114
|
-
isAtBottom: !0,
|
|
115
|
-
scrollableHeight: 0,
|
|
116
|
-
clientHeight: a,
|
|
117
|
-
scrollHeight: c
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const m = Math.min(
|
|
122
|
-
100,
|
|
123
|
-
Math.max(0, r / u * 100)
|
|
124
|
-
);
|
|
125
|
-
t({
|
|
126
|
-
scrollY: r,
|
|
127
|
-
scrollPercentage: m,
|
|
128
|
-
isAtTop: r <= 0,
|
|
129
|
-
isAtBottom: r >= u - 1,
|
|
130
|
-
scrollableHeight: u,
|
|
131
|
-
clientHeight: a,
|
|
132
|
-
scrollHeight: c
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
i();
|
|
136
|
-
const s = () => {
|
|
137
|
-
i();
|
|
138
|
-
};
|
|
139
|
-
e.addEventListener("scroll", s, { passive: !0 });
|
|
140
|
-
const l = new ResizeObserver(() => {
|
|
141
|
-
i();
|
|
142
|
-
});
|
|
143
|
-
return l.observe(e), () => {
|
|
144
|
-
e.removeEventListener("scroll", s), l.unobserve(e);
|
|
145
|
-
};
|
|
146
|
-
}, [e]), { ...d, element: e, setRef: n };
|
|
147
|
-
}, w = {
|
|
148
|
-
// < 640px
|
|
149
|
-
sm: 640,
|
|
150
|
-
// >= 640px
|
|
151
|
-
md: 768,
|
|
152
|
-
// >= 768px
|
|
153
|
-
lg: 1024,
|
|
154
|
-
// >= 1024px
|
|
155
|
-
xl: 1280,
|
|
156
|
-
// >= 1280px
|
|
157
|
-
"2xl": 1536
|
|
158
|
-
// >= 1536px
|
|
159
|
-
}, z = (e) => {
|
|
160
|
-
let o = "xs";
|
|
161
|
-
return e >= w["2xl"] ? o = "2xl" : e >= w.xl ? o = "xl" : e >= w.lg ? o = "lg" : e >= w.md ? o = "md" : e >= w.sm ? o = "sm" : o = "xs", {
|
|
162
|
-
current: o,
|
|
163
|
-
xs: e < w.sm,
|
|
164
|
-
sm: e >= w.sm && e < w.md,
|
|
165
|
-
md: e >= w.md && e < w.lg,
|
|
166
|
-
lg: e >= w.lg && e < w.xl,
|
|
167
|
-
xl: e >= w.xl && e < w["2xl"],
|
|
168
|
-
"2xl": e >= w["2xl"]
|
|
169
|
-
};
|
|
170
|
-
}, A = (e) => {
|
|
171
|
-
const { delay: o = 100, container: d } = e || {}, [t, n] = h({ width: 0, height: 0 }), [i, s] = h({
|
|
172
|
-
current: "xs",
|
|
173
|
-
xs: !0,
|
|
174
|
-
sm: !1,
|
|
175
|
-
md: !1,
|
|
176
|
-
lg: !1,
|
|
177
|
-
xl: !1,
|
|
178
|
-
"2xl": !1
|
|
179
|
-
}), [l, r] = h({ width: 0, height: 0 }), [c, a] = h(null), u = y(null), m = p((g) => {
|
|
180
|
-
a(g);
|
|
181
|
-
}, []);
|
|
182
|
-
return V(
|
|
183
|
-
() => {
|
|
184
|
-
r(t);
|
|
185
|
-
},
|
|
186
|
-
{ delay: o },
|
|
187
|
-
[t]
|
|
188
|
-
), f(() => {
|
|
189
|
-
const g = () => {
|
|
190
|
-
const b = d ?? c ?? document.body;
|
|
191
|
-
if (!b)
|
|
192
|
-
return;
|
|
193
|
-
const { offsetWidth: L, offsetHeight: x } = b;
|
|
194
|
-
n((E) => E.width !== L || E.height !== x ? { width: L, height: x } : E), s((E) => {
|
|
195
|
-
const T = z(L);
|
|
196
|
-
return E.current !== T.current ? T : E;
|
|
197
|
-
});
|
|
198
|
-
}, v = () => {
|
|
199
|
-
const b = d ?? c ?? document.body;
|
|
200
|
-
b && (g(), u.current && u.current.disconnect(), u.current = new ResizeObserver(() => {
|
|
201
|
-
requestAnimationFrame(() => {
|
|
202
|
-
g();
|
|
203
|
-
});
|
|
204
|
-
}), u.current.observe(b));
|
|
205
|
-
}, S = () => {
|
|
206
|
-
u.current && (u.current.disconnect(), u.current = null);
|
|
207
|
-
};
|
|
208
|
-
return v(), () => {
|
|
209
|
-
S();
|
|
210
|
-
};
|
|
211
|
-
}, [d, c]), {
|
|
212
|
-
size: l,
|
|
213
|
-
breakpoint: i,
|
|
214
|
-
ref: m
|
|
215
|
-
};
|
|
216
|
-
}, O = (e, o = {}) => {
|
|
217
|
-
const { retryCount: d = 0, retryDelay: t = 1e3 } = o, [n, i] = h(!0), [s, l] = h(null), [r, c] = h(!1), [a, u] = h(0), m = p(() => {
|
|
218
|
-
if (!e) {
|
|
219
|
-
i(!1), c(!1);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
i(!0), l(null);
|
|
223
|
-
const v = new Image();
|
|
224
|
-
v.src = e, v.onload = () => {
|
|
225
|
-
i(!1), c(!0), l(null), u(0);
|
|
226
|
-
}, v.onerror = (S) => {
|
|
227
|
-
i(!1), c(!1), l(S), a < d && setTimeout(() => {
|
|
228
|
-
u((b) => b + 1);
|
|
229
|
-
}, t);
|
|
230
|
-
};
|
|
231
|
-
}, [e, a, d, t]);
|
|
232
|
-
f(() => {
|
|
233
|
-
m();
|
|
234
|
-
}, [m]);
|
|
235
|
-
const g = p(() => {
|
|
236
|
-
u(0), m();
|
|
237
|
-
}, [m]);
|
|
238
|
-
return {
|
|
239
|
-
loading: n,
|
|
240
|
-
error: s,
|
|
241
|
-
loaded: r,
|
|
242
|
-
retry: g
|
|
243
|
-
};
|
|
244
|
-
}, M = (e, o) => {
|
|
245
|
-
const d = y(o), [t, n] = h(() => {
|
|
246
|
-
if (typeof window > "u")
|
|
247
|
-
return o;
|
|
248
|
-
try {
|
|
249
|
-
const s = window.localStorage.getItem(e);
|
|
250
|
-
return s ? JSON.parse(s) : o;
|
|
251
|
-
} catch {
|
|
252
|
-
return o;
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
f(() => {
|
|
256
|
-
if (!(typeof window > "u"))
|
|
257
|
-
try {
|
|
258
|
-
const s = window.localStorage.getItem(e);
|
|
259
|
-
s ? n(JSON.parse(s)) : window.localStorage.setItem(e, JSON.stringify(d.current));
|
|
260
|
-
} catch (s) {
|
|
261
|
-
console.error(`Error reading localStorage key "${e}":`, s);
|
|
262
|
-
}
|
|
263
|
-
}, [e]);
|
|
264
|
-
const i = p(
|
|
265
|
-
(s) => {
|
|
266
|
-
try {
|
|
267
|
-
n((l) => {
|
|
268
|
-
const r = s instanceof Function ? s(l) : s;
|
|
269
|
-
return localStorage.setItem(e, JSON.stringify(r)), r;
|
|
270
|
-
});
|
|
271
|
-
} catch (l) {
|
|
272
|
-
console.error(`Error setting localStorage key "${e}":`, l);
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
[e]
|
|
276
|
-
);
|
|
277
|
-
return [t, i];
|
|
278
|
-
}, Y = (e, o) => {
|
|
279
|
-
const d = y(e);
|
|
280
|
-
f(() => {
|
|
281
|
-
d.current = e;
|
|
282
|
-
}, [e]), f(() => {
|
|
283
|
-
let t;
|
|
284
|
-
function n() {
|
|
285
|
-
const i = d.current();
|
|
286
|
-
i instanceof Promise ? i.then(() => {
|
|
287
|
-
o && (t = setTimeout(n, o));
|
|
288
|
-
}) : o && (t = setTimeout(n, o));
|
|
289
|
-
}
|
|
290
|
-
if (o)
|
|
291
|
-
return t = setTimeout(n, o), () => t && clearTimeout(t);
|
|
292
|
-
}, [o]);
|
|
293
|
-
}, C = (e) => {
|
|
294
|
-
const o = y([]), d = p(
|
|
295
|
-
(n) => {
|
|
296
|
-
if (o.current[n] && (o.current[n].scrollIntoView({
|
|
297
|
-
behavior: "smooth",
|
|
298
|
-
block: "start",
|
|
299
|
-
inline: "start",
|
|
300
|
-
...e
|
|
301
|
-
}), e?.offset)) {
|
|
302
|
-
const i = o.current[n].getBoundingClientRect().top + window.scrollY - e.offset;
|
|
303
|
-
window.scrollTo({
|
|
304
|
-
top: i,
|
|
305
|
-
behavior: e.behavior || "smooth"
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
[e]
|
|
310
|
-
), t = p((n, i) => {
|
|
311
|
-
o.current[i] = n;
|
|
312
|
-
}, []);
|
|
313
|
-
return { elementRefs: o, setElementRef: t, scrollToElement: d };
|
|
314
|
-
}, k = () => {
|
|
315
|
-
const [e, o] = h({
|
|
316
|
-
x: 0,
|
|
317
|
-
y: 0,
|
|
318
|
-
percent: {
|
|
319
|
-
x: 0,
|
|
320
|
-
y: 0
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
return f(() => {
|
|
324
|
-
const d = () => {
|
|
325
|
-
const s = window.scrollX || 0, l = window.scrollY || 0, r = /iPad|iPhone|iPod/.test(navigator.userAgent), c = window.visualViewport, a = r && c ? c.width : window.innerWidth, u = r && c ? c.height : window.innerHeight, m = Math.max(
|
|
326
|
-
0,
|
|
327
|
-
document.documentElement.scrollWidth - a
|
|
328
|
-
), g = Math.max(
|
|
329
|
-
0,
|
|
330
|
-
document.documentElement.scrollHeight - u
|
|
331
|
-
), v = m === 0 ? 0 : Math.min(100, s / m * 100), S = g === 0 ? 0 : Math.min(100, l / g * 100);
|
|
332
|
-
o({
|
|
333
|
-
x: s,
|
|
334
|
-
y: l,
|
|
335
|
-
percent: {
|
|
336
|
-
x: Math.floor(Math.max(0, v)),
|
|
337
|
-
y: Math.floor(Math.max(0, S))
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
d();
|
|
342
|
-
const t = () => {
|
|
343
|
-
d();
|
|
344
|
-
}, n = () => {
|
|
345
|
-
setTimeout(d, 100);
|
|
346
|
-
}, i = () => {
|
|
347
|
-
setTimeout(d, 50);
|
|
348
|
-
};
|
|
349
|
-
return window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", n), window.addEventListener("orientationchange", n), window.visualViewport && window.visualViewport.addEventListener("resize", i), () => {
|
|
350
|
-
window.removeEventListener("scroll", t), window.removeEventListener("resize", n), window.removeEventListener("orientationchange", n), window.visualViewport && window.visualViewport.removeEventListener(
|
|
351
|
-
"resize",
|
|
352
|
-
i
|
|
353
|
-
);
|
|
354
|
-
};
|
|
355
|
-
}, []), e;
|
|
356
|
-
}, B = (e = {}) => {
|
|
357
|
-
const { isInApp: o = !1, debounce: d = 100 } = e, [t, n] = h({
|
|
358
|
-
width: 0,
|
|
359
|
-
height: 0,
|
|
360
|
-
offsetLeft: 0,
|
|
361
|
-
offsetTop: 0,
|
|
362
|
-
pageLeft: 0,
|
|
363
|
-
pageTop: 0,
|
|
364
|
-
scale: 1
|
|
365
|
-
}), i = p(() => {
|
|
366
|
-
const l = window.innerHeight, r = window.visualViewport?.height || l, c = document.documentElement.clientHeight, a = document.body.clientHeight;
|
|
367
|
-
return window.visualViewport && Math.abs(r - l) > 100 ? r : Math.max(l, c, a);
|
|
368
|
-
}, []), s = p(() => {
|
|
369
|
-
if (window.visualViewport && !o)
|
|
370
|
-
return window.visualViewport;
|
|
371
|
-
const l = window.visualViewport?.width || window.innerWidth, r = o ? i() : window.visualViewport?.height || window.innerHeight;
|
|
372
|
-
return {
|
|
373
|
-
width: l,
|
|
374
|
-
height: r,
|
|
375
|
-
offsetLeft: window.visualViewport?.offsetLeft || 0,
|
|
376
|
-
offsetTop: window.visualViewport?.offsetTop || 0,
|
|
377
|
-
pageLeft: window.scrollX ?? window.pageXOffset ?? 0,
|
|
378
|
-
pageTop: window.scrollY ?? window.pageYOffset ?? 0,
|
|
379
|
-
scale: window.visualViewport?.scale || 1
|
|
380
|
-
};
|
|
381
|
-
}, [o, i]);
|
|
382
|
-
return f(() => {
|
|
383
|
-
let l;
|
|
384
|
-
const r = () => {
|
|
385
|
-
clearTimeout(l), l = setTimeout(() => {
|
|
386
|
-
n(s());
|
|
387
|
-
}, d);
|
|
388
|
-
}, c = () => n(s());
|
|
389
|
-
c();
|
|
390
|
-
const a = ["resize", "orientationchange"];
|
|
391
|
-
o && a.push("focus", "blur", "touchstart", "touchend"), a.forEach((m) => {
|
|
392
|
-
m === "resize" || m === "orientationchange" ? window.addEventListener(m, r) : window.addEventListener(m, c, { passive: !0 });
|
|
393
|
-
}), window.visualViewport && (window.visualViewport.addEventListener("resize", c), window.visualViewport.addEventListener("scroll", c));
|
|
394
|
-
let u;
|
|
395
|
-
if (o) {
|
|
396
|
-
let m = s().height;
|
|
397
|
-
u = setInterval(() => {
|
|
398
|
-
const g = s().height;
|
|
399
|
-
Math.abs(g - m) > 50 && (m = g, c());
|
|
400
|
-
}, 500);
|
|
401
|
-
}
|
|
402
|
-
return () => {
|
|
403
|
-
clearTimeout(l), u && clearInterval(u), a.forEach((m) => {
|
|
404
|
-
window.removeEventListener(
|
|
405
|
-
m,
|
|
406
|
-
m === "resize" || m === "orientationchange" ? r : c
|
|
407
|
-
);
|
|
408
|
-
}), window.visualViewport && (window.visualViewport.removeEventListener("resize", c), window.visualViewport.removeEventListener("scroll", c));
|
|
409
|
-
};
|
|
410
|
-
}, [s, o, d]), t;
|
|
411
|
-
};
|
|
412
|
-
export {
|
|
413
|
-
I as useBodyScrollLock,
|
|
414
|
-
V as useDebounce,
|
|
415
|
-
P as useElementPosition,
|
|
416
|
-
R as useElementScroll,
|
|
417
|
-
O as useImage,
|
|
418
|
-
M as useLocalStorage,
|
|
419
|
-
Y as useRecursiveTimeout,
|
|
420
|
-
A as useResponsiveSize,
|
|
421
|
-
C as useScrollToElements,
|
|
422
|
-
B as useViewport,
|
|
423
|
-
k as useWindowScroll
|
|
424
|
-
};
|
package/dist/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|