@littlepartytime/dev-kit 1.22.3 → 1.22.4-debug.0
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/webapp/pages/Mobile.tsx +46 -18
- package/package.json +1 -1
|
@@ -21,39 +21,59 @@ const gameOuterStyle: React.CSSProperties = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* We use visualViewport.height to detect the keyboard and override the
|
|
28
|
-
* container height only while it's open. When the keyboard closes, we
|
|
29
|
-
* revert to 100dvh so Safari toolbar/address bar changes don't leave
|
|
30
|
-
* a dead zone at the bottom.
|
|
24
|
+
* Diagnostic: track viewport values for debugging keyboard/layout issues.
|
|
25
|
+
* Shows a small overlay on screen with real-time values.
|
|
26
|
+
* TODO: Remove after debugging is complete.
|
|
31
27
|
*/
|
|
32
|
-
|
|
28
|
+
interface ViewportDebug {
|
|
29
|
+
height: string;
|
|
30
|
+
debug: {
|
|
31
|
+
vvHeight: number;
|
|
32
|
+
vvOffsetTop: number;
|
|
33
|
+
innerHeight: number;
|
|
34
|
+
documentHeight: number;
|
|
35
|
+
scrollY: number;
|
|
36
|
+
rootHeight: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function useViewportHeight(): ViewportDebug {
|
|
33
41
|
const [height, setHeight] = useState('100dvh');
|
|
42
|
+
const [debug, setDebug] = useState({
|
|
43
|
+
vvHeight: 0, vvOffsetTop: 0, innerHeight: 0,
|
|
44
|
+
documentHeight: 0, scrollY: 0, rootHeight: 0,
|
|
45
|
+
});
|
|
34
46
|
const initialHeight = useRef(0);
|
|
35
47
|
|
|
36
48
|
useEffect(() => {
|
|
37
49
|
const vv = window.visualViewport;
|
|
38
50
|
if (!vv) return;
|
|
39
51
|
|
|
40
|
-
// Capture the full viewport height on first load (no keyboard)
|
|
41
52
|
initialHeight.current = vv.height;
|
|
42
53
|
|
|
43
|
-
const KEYBOARD_THRESHOLD = 100;
|
|
54
|
+
const KEYBOARD_THRESHOLD = 100;
|
|
44
55
|
|
|
45
56
|
const update = () => {
|
|
57
|
+
const root = document.getElementById('root');
|
|
58
|
+
setDebug({
|
|
59
|
+
vvHeight: Math.round(vv.height),
|
|
60
|
+
vvOffsetTop: Math.round(vv.offsetTop),
|
|
61
|
+
innerHeight: window.innerHeight,
|
|
62
|
+
documentHeight: document.documentElement.clientHeight,
|
|
63
|
+
scrollY: Math.round(window.scrollY),
|
|
64
|
+
rootHeight: root ? root.clientHeight : 0,
|
|
65
|
+
});
|
|
66
|
+
|
|
46
67
|
window.scrollTo(0, 0);
|
|
47
68
|
const shrunk = initialHeight.current - vv.height;
|
|
48
69
|
if (shrunk > KEYBOARD_THRESHOLD) {
|
|
49
|
-
// Keyboard is open: use exact pixel height so content compresses
|
|
50
70
|
setHeight(`${vv.height}px`);
|
|
51
71
|
} else {
|
|
52
|
-
// Keyboard is closed: use 100dvh to fill the screen fully
|
|
53
72
|
setHeight('100dvh');
|
|
54
73
|
}
|
|
55
74
|
};
|
|
56
75
|
|
|
76
|
+
update();
|
|
57
77
|
vv.addEventListener('resize', update);
|
|
58
78
|
vv.addEventListener('scroll', update);
|
|
59
79
|
return () => {
|
|
@@ -62,11 +82,18 @@ function useViewportHeight(): string {
|
|
|
62
82
|
};
|
|
63
83
|
}, []);
|
|
64
84
|
|
|
65
|
-
return height;
|
|
85
|
+
return { height, debug };
|
|
66
86
|
}
|
|
67
87
|
|
|
88
|
+
const debugOverlayStyle: React.CSSProperties = {
|
|
89
|
+
position: 'fixed', bottom: 0, left: 0, right: 0,
|
|
90
|
+
background: 'rgba(0,0,0,0.85)', color: '#0f0',
|
|
91
|
+
fontSize: 10, fontFamily: 'monospace', padding: 4,
|
|
92
|
+
zIndex: 99999, pointerEvents: 'none', lineHeight: 1.4,
|
|
93
|
+
};
|
|
94
|
+
|
|
68
95
|
export default function Mobile() {
|
|
69
|
-
const viewportHeight = useViewportHeight();
|
|
96
|
+
const { height: viewportHeight, debug } = useViewportHeight();
|
|
70
97
|
const [socket, setSocket] = useState<Socket | null>(null);
|
|
71
98
|
const [nickname, setNickname] = useState('');
|
|
72
99
|
const [joined, setJoined] = useState(false);
|
|
@@ -218,10 +245,7 @@ export default function Mobile() {
|
|
|
218
245
|
);
|
|
219
246
|
}
|
|
220
247
|
|
|
221
|
-
// Game — mirrors platform container structure
|
|
222
|
-
// div.h-[100dvh].flex.flex-col.overflow-hidden (root)
|
|
223
|
-
// div.flex-1.min-h-0.overflow-y-auto (game outer)
|
|
224
|
-
// div.game-sandbox (safe area padding)
|
|
248
|
+
// Game — mirrors platform container structure
|
|
225
249
|
return (
|
|
226
250
|
<div style={{ ...baseStyle, height: viewportHeight }}>
|
|
227
251
|
<div style={gameOuterStyle}>
|
|
@@ -239,6 +263,10 @@ export default function Mobile() {
|
|
|
239
263
|
)}
|
|
240
264
|
</div>
|
|
241
265
|
</div>
|
|
266
|
+
{/* DEBUG: viewport diagnostic overlay — remove after fixing */}
|
|
267
|
+
<div style={debugOverlayStyle}>
|
|
268
|
+
container: {viewportHeight} | vv: {debug.vvHeight} | vvOff: {debug.vvOffsetTop} | inner: {debug.innerHeight} | doc: {debug.documentHeight} | scrollY: {debug.scrollY} | root: {debug.rootHeight}
|
|
269
|
+
</div>
|
|
242
270
|
</div>
|
|
243
271
|
);
|
|
244
272
|
}
|