@biela.dev/core 1.7.4 → 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 +11 -11
package/dist/lite.cjs
CHANGED
|
@@ -76,10 +76,17 @@ function useContainerSize(ref) {
|
|
|
76
76
|
react.useEffect(() => {
|
|
77
77
|
const el = ref.current;
|
|
78
78
|
if (!el) return;
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
let
|
|
79
|
+
const update = () => {
|
|
80
|
+
const rect = el.getBoundingClientRect();
|
|
81
|
+
let width = rect.width;
|
|
82
|
+
let height = rect.height;
|
|
82
83
|
if (typeof window !== "undefined") {
|
|
84
|
+
if (height <= 0) {
|
|
85
|
+
height = Math.max(200, window.innerHeight - Math.max(0, rect.top));
|
|
86
|
+
}
|
|
87
|
+
if (width <= 0) {
|
|
88
|
+
width = window.innerWidth;
|
|
89
|
+
}
|
|
83
90
|
width = Math.min(width, window.innerWidth);
|
|
84
91
|
height = Math.min(height, window.innerHeight);
|
|
85
92
|
}
|
|
@@ -87,9 +94,15 @@ function useContainerSize(ref) {
|
|
|
87
94
|
if (prev.width === width && prev.height === height) return prev;
|
|
88
95
|
return { width, height };
|
|
89
96
|
});
|
|
90
|
-
}
|
|
97
|
+
};
|
|
98
|
+
const observer = new ResizeObserver(() => update());
|
|
91
99
|
observer.observe(el);
|
|
92
|
-
|
|
100
|
+
update();
|
|
101
|
+
window.addEventListener("resize", update);
|
|
102
|
+
return () => {
|
|
103
|
+
observer.disconnect();
|
|
104
|
+
window.removeEventListener("resize", update);
|
|
105
|
+
};
|
|
93
106
|
}, [ref]);
|
|
94
107
|
return size;
|
|
95
108
|
}
|
|
@@ -722,9 +735,8 @@ function DeviceFrame({
|
|
|
722
735
|
className: "bielaframe-sentinel",
|
|
723
736
|
style: {
|
|
724
737
|
width: "100%",
|
|
725
|
-
height: "100%",
|
|
738
|
+
height: containerH > 0 ? containerH : "100%",
|
|
726
739
|
minHeight: 0,
|
|
727
|
-
maxHeight: "100%",
|
|
728
740
|
display: "flex",
|
|
729
741
|
flexDirection: "column",
|
|
730
742
|
alignItems: "center",
|