@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.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",
|
|
@@ -781,10 +793,11 @@ function DeviceFrame({
|
|
|
781
793
|
children: /* @__PURE__ */ jsxRuntime.jsx(DeviceErrorBoundary, { children })
|
|
782
794
|
}
|
|
783
795
|
),
|
|
784
|
-
DeviceSVGComponent && /* @__PURE__ */ jsxRuntime.
|
|
785
|
-
|
|
796
|
+
DeviceSVGComponent && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
797
|
+
"div",
|
|
786
798
|
{
|
|
787
|
-
|
|
799
|
+
ref: frameOverlayRef,
|
|
800
|
+
className: "bielaframe-svg-overlay",
|
|
788
801
|
style: {
|
|
789
802
|
position: "absolute",
|
|
790
803
|
top: 0,
|
|
@@ -792,10 +805,24 @@ function DeviceFrame({
|
|
|
792
805
|
width: frameTotalW,
|
|
793
806
|
height: frameTotalH,
|
|
794
807
|
pointerEvents: "none",
|
|
795
|
-
zIndex: 10
|
|
796
|
-
|
|
808
|
+
zIndex: 10,
|
|
809
|
+
overflow: "hidden"
|
|
810
|
+
},
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: `.bielaframe-svg-overlay svg { width: 100% !important; height: 100% !important; }` } }),
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
+
DeviceSVGComponent,
|
|
815
|
+
{
|
|
816
|
+
colorScheme,
|
|
817
|
+
style: {
|
|
818
|
+
width: "100%",
|
|
819
|
+
height: "100%"
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
]
|
|
797
824
|
}
|
|
798
|
-
)
|
|
825
|
+
),
|
|
799
826
|
showSafeAreaOverlay && /* @__PURE__ */ jsxRuntime.jsx(
|
|
800
827
|
"div",
|
|
801
828
|
{
|