@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/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",
|
|
@@ -691,10 +703,11 @@ function DeviceFrame({
|
|
|
691
703
|
children: /* @__PURE__ */ jsxRuntime.jsx(DeviceErrorBoundary, { children })
|
|
692
704
|
}
|
|
693
705
|
),
|
|
694
|
-
DeviceSVGComponent && /* @__PURE__ */ jsxRuntime.
|
|
695
|
-
|
|
706
|
+
DeviceSVGComponent && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
707
|
+
"div",
|
|
696
708
|
{
|
|
697
|
-
|
|
709
|
+
ref: frameOverlayRef,
|
|
710
|
+
className: "bielaframe-svg-overlay",
|
|
698
711
|
style: {
|
|
699
712
|
position: "absolute",
|
|
700
713
|
top: 0,
|
|
@@ -702,10 +715,24 @@ function DeviceFrame({
|
|
|
702
715
|
width: frameTotalW,
|
|
703
716
|
height: frameTotalH,
|
|
704
717
|
pointerEvents: "none",
|
|
705
|
-
zIndex: 10
|
|
706
|
-
|
|
718
|
+
zIndex: 10,
|
|
719
|
+
overflow: "hidden"
|
|
720
|
+
},
|
|
721
|
+
children: [
|
|
722
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: `.bielaframe-svg-overlay svg { width: 100% !important; height: 100% !important; }` } }),
|
|
723
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
724
|
+
DeviceSVGComponent,
|
|
725
|
+
{
|
|
726
|
+
colorScheme,
|
|
727
|
+
style: {
|
|
728
|
+
width: "100%",
|
|
729
|
+
height: "100%"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
)
|
|
733
|
+
]
|
|
707
734
|
}
|
|
708
|
-
)
|
|
735
|
+
),
|
|
709
736
|
showSafeAreaOverlay && /* @__PURE__ */ jsxRuntime.jsx(
|
|
710
737
|
"div",
|
|
711
738
|
{
|