@biela.dev/core 1.7.5 → 1.7.7
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 +40 -13
- 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 +40 -13
- package/dist/index.js.map +1 -1
- package/dist/lite.cjs +40 -13
- package/dist/lite.cjs.map +1 -1
- package/dist/lite.js +40 -13
- package/dist/lite.js.map +1 -1
- package/package.json +1 -1
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
|
|
78
|
-
|
|
79
|
-
let
|
|
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
|
-
|
|
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",
|
|
@@ -779,10 +791,11 @@ function DeviceFrame({
|
|
|
779
791
|
children: /* @__PURE__ */ jsx(DeviceErrorBoundary, { children })
|
|
780
792
|
}
|
|
781
793
|
),
|
|
782
|
-
DeviceSVGComponent && /* @__PURE__ */
|
|
783
|
-
|
|
794
|
+
DeviceSVGComponent && /* @__PURE__ */ jsxs(
|
|
795
|
+
"div",
|
|
784
796
|
{
|
|
785
|
-
|
|
797
|
+
ref: frameOverlayRef,
|
|
798
|
+
className: "bielaframe-svg-overlay",
|
|
786
799
|
style: {
|
|
787
800
|
position: "absolute",
|
|
788
801
|
top: 0,
|
|
@@ -790,10 +803,24 @@ function DeviceFrame({
|
|
|
790
803
|
width: frameTotalW,
|
|
791
804
|
height: frameTotalH,
|
|
792
805
|
pointerEvents: "none",
|
|
793
|
-
zIndex: 10
|
|
794
|
-
|
|
806
|
+
zIndex: 10,
|
|
807
|
+
overflow: "hidden"
|
|
808
|
+
},
|
|
809
|
+
children: [
|
|
810
|
+
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: `.bielaframe-svg-overlay svg { width: 100% !important; height: 100% !important; }` } }),
|
|
811
|
+
/* @__PURE__ */ jsx(
|
|
812
|
+
DeviceSVGComponent,
|
|
813
|
+
{
|
|
814
|
+
colorScheme,
|
|
815
|
+
style: {
|
|
816
|
+
width: "100%",
|
|
817
|
+
height: "100%"
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
]
|
|
795
822
|
}
|
|
796
|
-
)
|
|
823
|
+
),
|
|
797
824
|
showSafeAreaOverlay && /* @__PURE__ */ jsx(
|
|
798
825
|
"div",
|
|
799
826
|
{
|