react-bounded-overlay-manager 1.0.0-beta.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/README.md +30 -0
- package/dist/assets/Overlay.css +1 -0
- package/dist/assets/OverlaysContainer.css +1 -0
- package/dist/events-B7I8KoZ9.js +228 -0
- package/dist/index-7ofMxoL9.js +8811 -0
- package/dist/index.module-WXM1Xk0w.js +60 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +12 -0
- package/dist/react.esm-GKFzux-6.js +12736 -0
- package/dist/src/api/BoundedOverlayManagerApi.d.ts +14 -0
- package/dist/src/api/BoundedOverlayManagerApi.js +24 -0
- package/dist/src/components/BoundedOverlayManager.d.ts +7 -0
- package/dist/src/components/BoundedOverlayManager.js +17 -0
- package/dist/src/components/BoundedOverlayManagerContent.d.ts +15 -0
- package/dist/src/components/BoundedOverlayManagerContent.js +46 -0
- package/dist/src/components/Overlay.d.ts +26 -0
- package/dist/src/components/Overlay.js +43 -0
- package/dist/src/components/OverlaysContainer.d.ts +11 -0
- package/dist/src/components/OverlaysContainer.js +12 -0
- package/dist/src/components/test/BoundedOverlayManager.test.d.ts +0 -0
- package/dist/src/components/test/BoundedOverlayManager.test.js +37 -0
- package/dist/src/components/test/BoundedOverlayManagerContent.test.d.ts +0 -0
- package/dist/src/components/test/BoundedOverlayManagerContent.test.js +92 -0
- package/dist/src/components/test/Overlay.test.d.ts +0 -0
- package/dist/src/components/test/Overlay.test.js +245 -0
- package/dist/src/components/test/OverlaysContainer.test.d.ts +0 -0
- package/dist/src/components/test/OverlaysContainer.test.js +36 -0
- package/dist/src/config.d.ts +6 -0
- package/dist/src/config.js +9 -0
- package/dist/src/context/OverlayManagerContext.d.ts +13 -0
- package/dist/src/context/OverlayManagerContext.js +23 -0
- package/dist/src/context/test/OverlayManagerContext.test.d.ts +1 -0
- package/dist/src/context/test/OverlayManagerContext.test.js +31 -0
- package/dist/src/enum/PredefinedPosition.d.ts +12 -0
- package/dist/src/enum/PredefinedPosition.js +4 -0
- package/dist/src/hooks/test/useApiUpdateHandler.test.d.ts +1 -0
- package/dist/src/hooks/test/useApiUpdateHandler.test.js +28 -0
- package/dist/src/hooks/test/useForwardBoundingComponentEvents.test.d.ts +1 -0
- package/dist/src/hooks/test/useForwardBoundingComponentEvents.test.js +62 -0
- package/dist/src/hooks/test/useForwardOverlayEvents.test.d.ts +1 -0
- package/dist/src/hooks/test/useForwardOverlayEvents.test.js +43 -0
- package/dist/src/hooks/test/useFullscreenChange.test.d.ts +1 -0
- package/dist/src/hooks/test/useFullscreenChange.test.js +33 -0
- package/dist/src/hooks/test/useOverlayManagerEvents.test.d.ts +1 -0
- package/dist/src/hooks/test/useOverlayManagerEvents.test.js +87 -0
- package/dist/src/hooks/test/useResizeObserver.test.d.ts +1 -0
- package/dist/src/hooks/test/useResizeObserver.test.js +47 -0
- package/dist/src/hooks/test/useScrollOnDocument.test.d.ts +1 -0
- package/dist/src/hooks/test/useScrollOnDocument.test.js +38 -0
- package/dist/src/hooks/test/useTimedEventManager.test.d.ts +1 -0
- package/dist/src/hooks/test/useTimedEventManager.test.js +41 -0
- package/dist/src/hooks/test/useWindowResize.test.d.ts +1 -0
- package/dist/src/hooks/test/useWindowResize.test.js +38 -0
- package/dist/src/hooks/test/util.d.ts +7 -0
- package/dist/src/hooks/test/util.js +20 -0
- package/dist/src/hooks/useApiUpdateHandler.d.ts +6 -0
- package/dist/src/hooks/useApiUpdateHandler.js +10 -0
- package/dist/src/hooks/useForwardBoundingComponentEvents.d.ts +2 -0
- package/dist/src/hooks/useForwardBoundingComponentEvents.js +20 -0
- package/dist/src/hooks/useForwardOverlayEvents.d.ts +6 -0
- package/dist/src/hooks/useForwardOverlayEvents.js +21 -0
- package/dist/src/hooks/useFullscreenChange.d.ts +5 -0
- package/dist/src/hooks/useFullscreenChange.js +16 -0
- package/dist/src/hooks/useOverlayManagerEvents.d.ts +8 -0
- package/dist/src/hooks/useOverlayManagerEvents.js +34 -0
- package/dist/src/hooks/useResizeObserver.d.ts +6 -0
- package/dist/src/hooks/useResizeObserver.js +19 -0
- package/dist/src/hooks/useScrollOnDocument.d.ts +5 -0
- package/dist/src/hooks/useScrollOnDocument.js +11 -0
- package/dist/src/hooks/useTimedEventManager.d.ts +6 -0
- package/dist/src/hooks/useTimedEventManager.js +15 -0
- package/dist/src/hooks/useWindowResize.d.ts +5 -0
- package/dist/src/hooks/useWindowResize.js +11 -0
- package/dist/src/timer/TimedEventManager.d.ts +16 -0
- package/dist/src/timer/TimedEventManager.js +25 -0
- package/dist/src/timer/test/TimedEventManager.test.d.ts +1 -0
- package/dist/src/timer/test/TimedEventManager.test.js +26 -0
- package/dist/src/types/OffsetProps.d.ts +37 -0
- package/dist/src/types/OffsetProps.js +1 -0
- package/dist/src/util/bbox.d.ts +7 -0
- package/dist/src/util/bbox.js +20 -0
- package/dist/vite-env.d.js +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useRef as i, useEffect as q, useMemo as P } from "react";
|
|
2
|
+
function j(g, t, u) {
|
|
3
|
+
var O = this, c = i(null), o = i(0), e = i(null), a = i([]), f = i(), l = i(), F = i(g), m = i(!0);
|
|
4
|
+
F.current = g;
|
|
5
|
+
var h = typeof window < "u", s = !t && t !== 0 && h;
|
|
6
|
+
if (typeof g != "function")
|
|
7
|
+
throw new TypeError("Expected a function");
|
|
8
|
+
t = +t || 0;
|
|
9
|
+
var D = !!(u = u || {}).leading, E = !("trailing" in u) || !!u.trailing, v = "maxWait" in u, M = "debounceOnServer" in u && !!u.debounceOnServer, x = v ? Math.max(+u.maxWait || 0, t) : null;
|
|
10
|
+
q(function() {
|
|
11
|
+
return m.current = !0, function() {
|
|
12
|
+
m.current = !1;
|
|
13
|
+
};
|
|
14
|
+
}, []);
|
|
15
|
+
var S = P(function() {
|
|
16
|
+
var y = function(r) {
|
|
17
|
+
var n = a.current, w = f.current;
|
|
18
|
+
return a.current = f.current = null, o.current = r, l.current = F.current.apply(w, n);
|
|
19
|
+
}, d = function(r, n) {
|
|
20
|
+
s && cancelAnimationFrame(e.current), e.current = s ? requestAnimationFrame(r) : setTimeout(r, n);
|
|
21
|
+
}, T = function(r) {
|
|
22
|
+
if (!m.current)
|
|
23
|
+
return !1;
|
|
24
|
+
var n = r - c.current;
|
|
25
|
+
return !c.current || n >= t || n < 0 || v && r - o.current >= x;
|
|
26
|
+
}, b = function(r) {
|
|
27
|
+
return e.current = null, E && a.current ? y(r) : (a.current = f.current = null, l.current);
|
|
28
|
+
}, A = function r() {
|
|
29
|
+
var n = Date.now();
|
|
30
|
+
if (T(n))
|
|
31
|
+
return b(n);
|
|
32
|
+
if (m.current) {
|
|
33
|
+
var w = t - (n - c.current), W = v ? Math.min(w, x - (n - o.current)) : w;
|
|
34
|
+
d(r, W);
|
|
35
|
+
}
|
|
36
|
+
}, p = function() {
|
|
37
|
+
if (h || M) {
|
|
38
|
+
var r = Date.now(), n = T(r);
|
|
39
|
+
if (a.current = [].slice.call(arguments), f.current = O, c.current = r, n) {
|
|
40
|
+
if (!e.current && m.current)
|
|
41
|
+
return o.current = c.current, d(A, t), D ? y(c.current) : l.current;
|
|
42
|
+
if (v)
|
|
43
|
+
return d(A, t), y(c.current);
|
|
44
|
+
}
|
|
45
|
+
return e.current || d(A, t), l.current;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return p.cancel = function() {
|
|
49
|
+
e.current && (s ? cancelAnimationFrame(e.current) : clearTimeout(e.current)), o.current = 0, a.current = c.current = f.current = e.current = null;
|
|
50
|
+
}, p.isPending = function() {
|
|
51
|
+
return !!e.current;
|
|
52
|
+
}, p.flush = function() {
|
|
53
|
+
return e.current ? b(Date.now()) : l.current;
|
|
54
|
+
}, p;
|
|
55
|
+
}, [D, v, t, x, E, s, h, M]);
|
|
56
|
+
return S;
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
j as c
|
|
60
|
+
};
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import PredefinedPosition from './src/enum/PredefinedPosition';
|
|
2
|
+
import BoundedOverlayManager from './src/components/BoundedOverlayManager';
|
|
3
|
+
import Overlay from './src/components/Overlay';
|
|
4
|
+
import BoundedOverlayManagerApi from './src/api/BoundedOverlayManagerApi';
|
|
5
|
+
import { NO_TIMEOUT } from './src/timer/TimedEventManager';
|
|
6
|
+
export { PredefinedPosition, Overlay, BoundedOverlayManagerApi, NO_TIMEOUT };
|
|
7
|
+
export default BoundedOverlayManager;
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as t } from "./src/enum/PredefinedPosition.js";
|
|
2
|
+
import r from "./src/components/BoundedOverlayManager.js";
|
|
3
|
+
import { default as f } from "./src/components/Overlay.js";
|
|
4
|
+
import { default as p } from "./src/api/BoundedOverlayManagerApi.js";
|
|
5
|
+
import { NO_TIMEOUT as n } from "./src/timer/TimedEventManager.js";
|
|
6
|
+
export {
|
|
7
|
+
p as BoundedOverlayManagerApi,
|
|
8
|
+
n as NO_TIMEOUT,
|
|
9
|
+
f as Overlay,
|
|
10
|
+
t as PredefinedPosition,
|
|
11
|
+
r as default
|
|
12
|
+
};
|