@littlepartytime/dev-kit 1.22.4-debug.1 → 1.22.4
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/index.html +11 -1
- package/dist/webapp/pages/Mobile.tsx +7 -57
- package/package.json +1 -1
package/dist/webapp/index.html
CHANGED
|
@@ -11,12 +11,22 @@
|
|
|
11
11
|
html { height: 100%; }
|
|
12
12
|
body { height: 100%; min-height: 100%; }
|
|
13
13
|
|
|
14
|
-
/* ── Game sandbox:
|
|
14
|
+
/* ── Game sandbox: based on platform globals.css ── */
|
|
15
|
+
/* Platform uses height:100% which works in PWA/Capacitor.
|
|
16
|
+
In a regular browser, keyboard interaction breaks the CSS
|
|
17
|
+
height chain for descendant elements. Using flex + stretch
|
|
18
|
+
forces game renderers to fill the container regardless. */
|
|
15
19
|
.game-sandbox {
|
|
16
20
|
height: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
17
23
|
padding-top: env(safe-area-inset-top, 0px);
|
|
18
24
|
padding-bottom: env(safe-area-inset-bottom, 0px);
|
|
19
25
|
}
|
|
26
|
+
.game-sandbox > * {
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-height: 0;
|
|
29
|
+
}
|
|
20
30
|
.game-sandbox, .game-sandbox * {
|
|
21
31
|
-webkit-user-select: auto;
|
|
22
32
|
user-select: auto;
|
|
@@ -21,11 +21,11 @@ const gameOuterStyle: React.CSSProperties = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Track viewport height for mobile keyboard handling.
|
|
25
|
+
* In regular Safari (non-PWA), 100dvh doesn't shrink with keyboard.
|
|
26
|
+
* Uses VisualViewport to detect keyboard and switch to pixel height.
|
|
27
27
|
*/
|
|
28
|
-
function useViewportHeight() {
|
|
28
|
+
function useViewportHeight(): string {
|
|
29
29
|
const [height, setHeight] = useState('100dvh');
|
|
30
30
|
const initialHeight = useRef(0);
|
|
31
31
|
|
|
@@ -54,57 +54,8 @@ function useViewportHeight() {
|
|
|
54
54
|
return height;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Debug overlay that measures each container layer on every render.
|
|
59
|
-
* Ref-based: reads computed sizes of actual DOM elements.
|
|
60
|
-
*/
|
|
61
|
-
function DebugOverlay({ containerRef, outerRef, sandboxRef }: {
|
|
62
|
-
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
63
|
-
outerRef: React.RefObject<HTMLDivElement | null>;
|
|
64
|
-
sandboxRef: React.RefObject<HTMLDivElement | null>;
|
|
65
|
-
}) {
|
|
66
|
-
const [info, setInfo] = useState('');
|
|
67
|
-
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
const measure = () => {
|
|
70
|
-
const c = containerRef.current;
|
|
71
|
-
const o = outerRef.current;
|
|
72
|
-
const s = sandboxRef.current;
|
|
73
|
-
const gameEl = s?.firstElementChild as HTMLElement | null;
|
|
74
|
-
const vv = window.visualViewport;
|
|
75
|
-
|
|
76
|
-
const lines = [
|
|
77
|
-
`vv:${vv ? Math.round(vv.height) : '?'} inner:${window.innerHeight} scrollY:${Math.round(window.scrollY)}`,
|
|
78
|
-
`container:${c?.clientHeight ?? '?'} computedH:${c ? getComputedStyle(c).height : '?'}`,
|
|
79
|
-
`outer:${o?.clientHeight ?? '?'} scrollTop:${o?.scrollTop ?? '?'} scrollH:${o?.scrollHeight ?? '?'}`,
|
|
80
|
-
`sandbox:${s?.clientHeight ?? '?'} game1st:${gameEl?.clientHeight ?? '?'}`,
|
|
81
|
-
];
|
|
82
|
-
setInfo(lines.join('\n'));
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
measure();
|
|
86
|
-
const id = setInterval(measure, 500);
|
|
87
|
-
return () => clearInterval(id);
|
|
88
|
-
}, [containerRef, outerRef, sandboxRef]);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div style={{
|
|
92
|
-
position: 'fixed', bottom: 0, left: 0, right: 0,
|
|
93
|
-
background: 'rgba(0,0,0,0.85)', color: '#0f0',
|
|
94
|
-
fontSize: 10, fontFamily: 'monospace', padding: 4,
|
|
95
|
-
zIndex: 99999, pointerEvents: 'none', lineHeight: 1.4,
|
|
96
|
-
whiteSpace: 'pre',
|
|
97
|
-
}}>
|
|
98
|
-
{info}
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
57
|
export default function Mobile() {
|
|
104
58
|
const viewportHeight = useViewportHeight();
|
|
105
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
106
|
-
const outerRef = useRef<HTMLDivElement>(null);
|
|
107
|
-
const sandboxRef = useRef<HTMLDivElement>(null);
|
|
108
59
|
const [socket, setSocket] = useState<Socket | null>(null);
|
|
109
60
|
const [nickname, setNickname] = useState('');
|
|
110
61
|
const [joined, setJoined] = useState(false);
|
|
@@ -258,9 +209,9 @@ export default function Mobile() {
|
|
|
258
209
|
|
|
259
210
|
// Game — mirrors platform container structure
|
|
260
211
|
return (
|
|
261
|
-
<div
|
|
262
|
-
<div
|
|
263
|
-
<div
|
|
212
|
+
<div style={{ ...baseStyle, height: viewportHeight }}>
|
|
213
|
+
<div style={gameOuterStyle}>
|
|
214
|
+
<div className="game-sandbox">
|
|
264
215
|
{gameOver ? (
|
|
265
216
|
<PlatformTakeover
|
|
266
217
|
result={gameResult}
|
|
@@ -274,7 +225,6 @@ export default function Mobile() {
|
|
|
274
225
|
)}
|
|
275
226
|
</div>
|
|
276
227
|
</div>
|
|
277
|
-
<DebugOverlay containerRef={containerRef} outerRef={outerRef} sandboxRef={sandboxRef} />
|
|
278
228
|
</div>
|
|
279
229
|
);
|
|
280
230
|
}
|