@biela.dev/core 1.7.0 → 1.7.2
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 +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/lite.cjs +6 -2
- package/dist/lite.cjs.map +1 -1
- package/dist/lite.js +6 -2
- package/dist/lite.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -91,6 +91,10 @@ interface ContainerSize {
|
|
|
91
91
|
* Observes an element's content box dimensions via ResizeObserver.
|
|
92
92
|
* Foundation of adaptive scaling — same mechanism as Xcode's window resize detection.
|
|
93
93
|
* Uses the actual canvas div, not the window, so it's panel-independent.
|
|
94
|
+
*
|
|
95
|
+
* Safety: clamps reported size to the visual viewport so that a mis-sized
|
|
96
|
+
* parent (e.g. height: auto or height: 100% with no fixed ancestor) can never
|
|
97
|
+
* cause the device frame to render larger than the screen.
|
|
94
98
|
*/
|
|
95
99
|
declare function useContainerSize(ref: RefObject<HTMLElement | null>): ContainerSize;
|
|
96
100
|
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,10 @@ interface ContainerSize {
|
|
|
91
91
|
* Observes an element's content box dimensions via ResizeObserver.
|
|
92
92
|
* Foundation of adaptive scaling — same mechanism as Xcode's window resize detection.
|
|
93
93
|
* Uses the actual canvas div, not the window, so it's panel-independent.
|
|
94
|
+
*
|
|
95
|
+
* Safety: clamps reported size to the visual viewport so that a mis-sized
|
|
96
|
+
* parent (e.g. height: auto or height: 100% with no fixed ancestor) can never
|
|
97
|
+
* cause the device frame to render larger than the screen.
|
|
94
98
|
*/
|
|
95
99
|
declare function useContainerSize(ref: RefObject<HTMLElement | null>): ContainerSize;
|
|
96
100
|
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,11 @@ function useContainerSize(ref) {
|
|
|
10
10
|
if (!el) return;
|
|
11
11
|
const observer = new ResizeObserver(([entry]) => {
|
|
12
12
|
if (!entry) return;
|
|
13
|
-
|
|
13
|
+
let { width, height } = entry.contentRect;
|
|
14
|
+
if (typeof window !== "undefined") {
|
|
15
|
+
width = Math.min(width, window.innerWidth);
|
|
16
|
+
height = Math.min(height, window.innerHeight);
|
|
17
|
+
}
|
|
14
18
|
setSize((prev) => {
|
|
15
19
|
if (prev.width === width && prev.height === height) return prev;
|
|
16
20
|
return { width, height };
|
|
@@ -486,7 +490,7 @@ function DeviceFrame({
|
|
|
486
490
|
scaleMode = "fit",
|
|
487
491
|
manualScale,
|
|
488
492
|
showSafeAreaOverlay = false,
|
|
489
|
-
showScaleBar =
|
|
493
|
+
showScaleBar = false,
|
|
490
494
|
colorScheme = "dark",
|
|
491
495
|
onContractReady,
|
|
492
496
|
onScaleChange,
|