@biela.dev/core 1.7.5 → 1.7.6
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/index.cjs +19 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/lite.cjs +19 -7
- package/dist/lite.cjs.map +1 -1
- package/dist/lite.js +19 -7
- package/dist/lite.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10,10 +10,17 @@ function useContainerSize(ref) {
|
|
|
10
10
|
react.useEffect(() => {
|
|
11
11
|
const el = ref.current;
|
|
12
12
|
if (!el) return;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
let
|
|
13
|
+
const update = () => {
|
|
14
|
+
const rect = el.getBoundingClientRect();
|
|
15
|
+
let width = rect.width;
|
|
16
|
+
let height = rect.height;
|
|
16
17
|
if (typeof window !== "undefined") {
|
|
18
|
+
if (height <= 0) {
|
|
19
|
+
height = Math.max(200, window.innerHeight - Math.max(0, rect.top));
|
|
20
|
+
}
|
|
21
|
+
if (width <= 0) {
|
|
22
|
+
width = window.innerWidth;
|
|
23
|
+
}
|
|
17
24
|
width = Math.min(width, window.innerWidth);
|
|
18
25
|
height = Math.min(height, window.innerHeight);
|
|
19
26
|
}
|
|
@@ -21,9 +28,15 @@ function useContainerSize(ref) {
|
|
|
21
28
|
if (prev.width === width && prev.height === height) return prev;
|
|
22
29
|
return { width, height };
|
|
23
30
|
});
|
|
24
|
-
}
|
|
31
|
+
};
|
|
32
|
+
const observer = new ResizeObserver(() => update());
|
|
25
33
|
observer.observe(el);
|
|
26
|
-
|
|
34
|
+
update();
|
|
35
|
+
window.addEventListener("resize", update);
|
|
36
|
+
return () => {
|
|
37
|
+
observer.disconnect();
|
|
38
|
+
window.removeEventListener("resize", update);
|
|
39
|
+
};
|
|
27
40
|
}, [ref]);
|
|
28
41
|
return size;
|
|
29
42
|
}
|
|
@@ -632,9 +645,8 @@ function DeviceFrame({
|
|
|
632
645
|
className: "bielaframe-sentinel",
|
|
633
646
|
style: {
|
|
634
647
|
width: "100%",
|
|
635
|
-
height: "100%",
|
|
648
|
+
height: containerH > 0 ? containerH : "100%",
|
|
636
649
|
minHeight: 0,
|
|
637
|
-
maxHeight: "100%",
|
|
638
650
|
display: "flex",
|
|
639
651
|
flexDirection: "column",
|
|
640
652
|
alignItems: "center",
|