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