@littlepartytime/dev-kit 1.22.0 → 1.22.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.
@@ -7,7 +7,9 @@
7
7
  <style>
8
8
  /* ── Dev-Kit UI base ── */
9
9
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
10
- html, body { background: #0a0a0a; color: #e5e5e5; font-family: system-ui, -apple-system, sans-serif; overflow: hidden; overscroll-behavior: none; }
10
+ html, body { background: #0a0a0a; color: #e5e5e5; font-family: system-ui, -apple-system, sans-serif; overscroll-behavior: none; }
11
+ html { height: 100%; }
12
+ body { height: 100%; min-height: 100%; }
11
13
 
12
14
  /* ── Game sandbox: mirrors platform globals.css ── */
13
15
  .game-sandbox {
@@ -5,13 +5,7 @@ import PlatformTakeover from '../components/PlatformTakeover';
5
5
  declare const __SOCKET_PORT__: number;
6
6
  declare const __DEV_KIT_MODE__: string;
7
7
 
8
- /**
9
- * Root container mirrors the platform's room page:
10
- * <div class="h-[100dvh] flex flex-col overflow-hidden">
11
- * No position:fixed — uses 100dvh which shrinks with mobile keyboard.
12
- */
13
- const rootStyle: React.CSSProperties = {
14
- height: '100dvh',
8
+ const baseStyle: React.CSSProperties = {
15
9
  display: 'flex',
16
10
  flexDirection: 'column',
17
11
  overflow: 'hidden',
@@ -20,17 +14,46 @@ const rootStyle: React.CSSProperties = {
20
14
  fontFamily: 'system-ui, -apple-system, sans-serif',
21
15
  };
22
16
 
23
- /**
24
- * Game outer wrapper mirrors the platform's flex-1 scrollable area:
25
- * <div class="flex-1 min-h-0 overflow-y-auto">
26
- */
27
17
  const gameOuterStyle: React.CSSProperties = {
28
18
  flex: 1,
29
19
  minHeight: 0,
30
20
  overflowY: 'auto',
31
21
  };
32
22
 
23
+ /**
24
+ * Track actual visible height via VisualViewport API.
25
+ * On iOS Safari, 100dvh does NOT shrink when the keyboard opens (unlike
26
+ * PWA/Capacitor where the platform runs). VisualViewport.height gives
27
+ * the real available space, achieving the same behavior: game content
28
+ * compresses instead of the page being pushed off-screen.
29
+ */
30
+ function useViewportHeight(): string {
31
+ const [height, setHeight] = useState('100dvh');
32
+
33
+ useEffect(() => {
34
+ const vv = window.visualViewport;
35
+ if (!vv) return;
36
+
37
+ const update = () => {
38
+ // Pin to top: counteract Safari scrolling the page up
39
+ window.scrollTo(0, 0);
40
+ setHeight(`${vv.height}px`);
41
+ };
42
+
43
+ update();
44
+ vv.addEventListener('resize', update);
45
+ vv.addEventListener('scroll', update);
46
+ return () => {
47
+ vv.removeEventListener('resize', update);
48
+ vv.removeEventListener('scroll', update);
49
+ };
50
+ }, []);
51
+
52
+ return height;
53
+ }
54
+
33
55
  export default function Mobile() {
56
+ const viewportHeight = useViewportHeight();
34
57
  const [socket, setSocket] = useState<Socket | null>(null);
35
58
  const [nickname, setNickname] = useState('');
36
59
  const [joined, setJoined] = useState(false);
@@ -121,7 +144,7 @@ export default function Mobile() {
121
144
  // Join screen
122
145
  if (!joined) {
123
146
  return (
124
- <div style={{ ...rootStyle, alignItems: 'center', justifyContent: 'center' }}>
147
+ <div style={{ ...baseStyle, height: viewportHeight, alignItems: 'center', justifyContent: 'center' }}>
125
148
  <div style={{ width: '85%', maxWidth: 320 }}>
126
149
  <h2 style={{ fontSize: 20, fontWeight: 700, marginBottom: 16, textAlign: 'center' }}>Join Game</h2>
127
150
  <input
@@ -146,7 +169,7 @@ export default function Mobile() {
146
169
  // Lobby
147
170
  if (room.phase === 'lobby' || room.phase === 'ready') {
148
171
  return (
149
- <div style={{ ...rootStyle, padding: 16 }}>
172
+ <div style={{ ...baseStyle, height: viewportHeight, padding: 16 }}>
150
173
  <h2 style={{ fontSize: 20, fontWeight: 700, marginBottom: 16 }}>Lobby</h2>
151
174
  <div style={{ flex: 1, overflow: 'auto', display: 'flex', flexDirection: 'column', gap: 8 }}>
152
175
  {room.players.map((p: any) => (
@@ -187,7 +210,7 @@ export default function Mobile() {
187
210
  // div.flex-1.min-h-0.overflow-y-auto (game outer)
188
211
  // div.game-sandbox (safe area padding)
189
212
  return (
190
- <div style={rootStyle}>
213
+ <div style={{ ...baseStyle, height: viewportHeight }}>
191
214
  <div style={gameOuterStyle}>
192
215
  <div className="game-sandbox">
193
216
  {gameOver ? (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@littlepartytime/dev-kit",
3
- "version": "1.22.0",
3
+ "version": "1.22.2",
4
4
  "description": "Development toolkit CLI for Little Party Time game developers",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",