@air-jam/sdk 0.1.1 → 0.1.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/{chunk-7M5D3Y3L.js → chunk-B5DURUWT.js} +11 -3
- package/dist/chunk-B5DURUWT.js.map +1 -0
- package/dist/index.cjs +226 -127
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -27
- package/dist/index.d.ts +19 -27
- package/dist/index.js +218 -129
- package/dist/index.js.map +1 -1
- package/dist/protocol.cjs +10 -0
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +19 -1
- package/dist/protocol.d.ts +19 -1
- package/dist/protocol.js +1 -1
- package/package.json +4 -1
- package/src/AirJamClient.ts +1 -552
- package/src/audio/audio-manager.ts +12 -1
- package/src/audio/volume-store.ts +47 -0
- package/src/components/air-jam-overlay.tsx +1 -1
- package/src/components/controller-shell.tsx +170 -171
- package/src/components/qr-scanner-dialog.tsx +2 -2
- package/src/constants.ts +3 -2
- package/src/context/air-jam-context.tsx +3 -14
- package/src/hooks/use-air-jam-controller.ts +1 -1
- package/src/hooks/use-air-jam-host.ts +94 -49
- package/src/hooks/use-air-jam-shell.ts +36 -0
- package/src/internal/input-manager.ts +28 -14
- package/src/protocol.ts +28 -0
- package/src/store/create-air-jam-store.ts +69 -7
- package/src/utils/url-builder.ts +3 -3
- package/dist/chunk-7M5D3Y3L.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React$1 from 'react';
|
|
|
3
3
|
import { ReactNode, JSX } from 'react';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { ControllerInputEvent, ConnectionRole, ConnectionStatus, RunMode, GameState, PlayerProfile, ServerToClientEvents, ClientToServerEvents, ControllerStatePayload, RoomCode, ControllerInputPayload, HapticSignalPayload, ToastSignalPayload } from './protocol.cjs';
|
|
6
|
-
export { AIRJAM_PROXY_PREFIX, AirJamActionRpcPayload, AirJamProxyMessage, AirJamStateSyncPayload, ClientLoadUiPayload, ControllerActionRpcPayload, ControllerJoinAck, ControllerJoinPayload, ControllerJoinedNotice, ControllerLeavePayload, ControllerLeftNotice, ControllerStateMessage, ControllerSystemPayload, ControllerWelcomePayload, ErrorCode, HostJoinAsChildPayload, HostLeftNotice, HostRegisterSystemPayload, HostRegistrationAck, HostRegistrationPayload, HostStateSyncPayload, InterServerEvents, PlaySoundEventPayload, PlaySoundPayload, ProxyInputMessage, ProxyMessageBase, ProxyReadyMessage, ProxyStateMessage, RoomReadyNotice, ServerErrorPayload, SignalPayload, SignalType, SocketData, SystemLaunchGameAck, SystemLaunchGamePayload, controllerInputSchema, controllerJoinSchema, controllerLeaveSchema, controllerStateSchema, controllerSystemSchema, hostJoinAsChildSchema, hostRegisterSystemSchema, hostRegistrationSchema, roomCodeSchema, systemLaunchGameSchema } from './protocol.cjs';
|
|
6
|
+
export { AIRJAM_PROXY_PREFIX, AirJamActionRpcPayload, AirJamProxyMessage, AirJamStateSyncPayload, ClientLoadUiPayload, ControllerActionRpcPayload, ControllerJoinAck, ControllerJoinPayload, ControllerJoinedNotice, ControllerLeavePayload, ControllerLeftNotice, ControllerStateMessage, ControllerSystemPayload, ControllerWelcomePayload, ErrorCode, HostCreateRoomPayload, HostJoinAsChildPayload, HostLeftNotice, HostReconnectPayload, HostRegisterSystemPayload, HostRegistrationAck, HostRegistrationPayload, HostStateSyncPayload, InterServerEvents, PlaySoundEventPayload, PlaySoundPayload, ProxyInputMessage, ProxyMessageBase, ProxyReadyMessage, ProxyStateMessage, RoomReadyNotice, ServerErrorPayload, SignalPayload, SignalType, SocketData, SystemLaunchGameAck, SystemLaunchGamePayload, controllerInputSchema, controllerJoinSchema, controllerLeaveSchema, controllerStateSchema, controllerSystemSchema, hostCreateRoomSchema, hostJoinAsChildSchema, hostReconnectSchema, hostRegisterSystemSchema, hostRegistrationSchema, roomCodeSchema, systemLaunchGameSchema } from './protocol.cjs';
|
|
7
7
|
import * as zustand from 'zustand';
|
|
8
8
|
import { StoreApi, StateCreator } from 'zustand';
|
|
9
9
|
import { Socket } from 'socket.io-client';
|
|
@@ -162,8 +162,7 @@ declare class InputManager<TSchema extends z.ZodSchema = z.ZodSchema> {
|
|
|
162
162
|
private inputBuffer;
|
|
163
163
|
private latchState;
|
|
164
164
|
private config;
|
|
165
|
-
|
|
166
|
-
constructor(config?: InputConfig<TSchema>, roomId?: string);
|
|
165
|
+
constructor(config?: InputConfig<TSchema>);
|
|
167
166
|
/**
|
|
168
167
|
* Handles incoming input events from the socket.
|
|
169
168
|
* Should be called when 'server:input' event is received.
|
|
@@ -179,10 +178,6 @@ declare class InputManager<TSchema extends z.ZodSchema = z.ZodSchema> {
|
|
|
179
178
|
* Clears input state for a controller (e.g., when player leaves).
|
|
180
179
|
*/
|
|
181
180
|
clearInput(controllerId: string): void;
|
|
182
|
-
/**
|
|
183
|
-
* Updates the room ID filter.
|
|
184
|
-
*/
|
|
185
|
-
setRoomId(roomId: string | undefined): void;
|
|
186
181
|
/**
|
|
187
182
|
* Internal method to apply latching logic.
|
|
188
183
|
*/
|
|
@@ -267,8 +262,6 @@ interface AirJamConfig {
|
|
|
267
262
|
serverUrl?: string;
|
|
268
263
|
/** API key for production authentication */
|
|
269
264
|
apiKey?: string;
|
|
270
|
-
/** Path for controller page (default: /joypad) */
|
|
271
|
-
controllerPath: string;
|
|
272
265
|
/** Maximum players allowed in a room */
|
|
273
266
|
maxPlayers: number;
|
|
274
267
|
/** Public host for controller URLs (optional) */
|
|
@@ -291,7 +284,6 @@ interface AirJamConfig {
|
|
|
291
284
|
* <AirJamProvider
|
|
292
285
|
* serverUrl="wss://your-server.com"
|
|
293
286
|
* apiKey="your-api-key"
|
|
294
|
-
* controllerPath="/controller"
|
|
295
287
|
* maxPlayers={4}
|
|
296
288
|
* input={{
|
|
297
289
|
* schema: myInputSchema,
|
|
@@ -315,12 +307,6 @@ interface AirJamProviderProps<TSchema extends z.ZodSchema = z.ZodSchema> {
|
|
|
315
307
|
* Falls back to VITE_AIR_JAM_API_KEY or NEXT_PUBLIC_AIR_JAM_API_KEY environment variables.
|
|
316
308
|
*/
|
|
317
309
|
apiKey?: string;
|
|
318
|
-
/**
|
|
319
|
-
* URL path for the controller page on your app.
|
|
320
|
-
* Controllers will be directed to this path with ?room=XXXX query parameter.
|
|
321
|
-
* @default "/joypad"
|
|
322
|
-
*/
|
|
323
|
-
controllerPath?: string;
|
|
324
310
|
/**
|
|
325
311
|
* Maximum number of players allowed in a room.
|
|
326
312
|
* @default 8
|
|
@@ -390,7 +376,7 @@ declare const AirJamContext: React$1.Context<AirJamContextValue | null>;
|
|
|
390
376
|
* <AirJamProvider>
|
|
391
377
|
* <Routes>
|
|
392
378
|
* <Route path="/" element={<HostView />} />
|
|
393
|
-
* <Route path="/
|
|
379
|
+
* <Route path="/controller" element={<ControllerView />} />
|
|
394
380
|
* </Routes>
|
|
395
381
|
* </AirJamProvider>
|
|
396
382
|
* );
|
|
@@ -423,7 +409,7 @@ declare const AirJamContext: React$1.Context<AirJamContextValue | null>;
|
|
|
423
409
|
* );
|
|
424
410
|
* ```
|
|
425
411
|
*/
|
|
426
|
-
declare const AirJamProvider: <TSchema extends z.ZodSchema = z.ZodSchema>({ children, serverUrl, apiKey,
|
|
412
|
+
declare const AirJamProvider: <TSchema extends z.ZodSchema = z.ZodSchema>({ children, serverUrl, apiKey, maxPlayers, publicHost, input, }: AirJamProviderProps<TSchema>) => react_jsx_runtime.JSX.Element;
|
|
427
413
|
/**
|
|
428
414
|
* Access the raw AirJam context value.
|
|
429
415
|
*
|
|
@@ -536,7 +522,12 @@ declare class AudioManager<T extends string = string> {
|
|
|
536
522
|
getCategory(soundId: string): SoundCategory;
|
|
537
523
|
setSocket(socket: Socket<ServerToClientEvents, ClientToServerEvents> | null, roomId?: string): void;
|
|
538
524
|
/**
|
|
539
|
-
*
|
|
525
|
+
* Resume audio context if suspended. This is automatically called by play(),
|
|
526
|
+
* so you typically don't need to call this manually.
|
|
527
|
+
*
|
|
528
|
+
* Note: Due to browser autoplay policies, audio context starts suspended
|
|
529
|
+
* and can only be resumed in response to a user gesture. The useAudio hook
|
|
530
|
+
* handles this automatically, and play() also calls init() internally.
|
|
540
531
|
*/
|
|
541
532
|
init(): void;
|
|
542
533
|
/**
|
|
@@ -625,11 +616,11 @@ declare const AirJamDebug: ({ state, title, updateInterval, className, }: AirJam
|
|
|
625
616
|
|
|
626
617
|
declare const AirJamOverlay: () => JSX.Element | null;
|
|
627
618
|
|
|
628
|
-
type OrientationRequirement = "portrait" | "landscape" | "any";
|
|
629
619
|
interface ControllerShellProps {
|
|
630
620
|
roomId?: string | null;
|
|
631
621
|
connectionStatus: ConnectionStatus;
|
|
632
|
-
|
|
622
|
+
/** Optional forced orientation. If not set, no orientation enforcement is applied. */
|
|
623
|
+
forceOrientation?: "portrait" | "landscape";
|
|
633
624
|
children: ReactNode;
|
|
634
625
|
gameState?: "paused" | "playing";
|
|
635
626
|
onTogglePlayPause?: () => void;
|
|
@@ -637,7 +628,7 @@ interface ControllerShellProps {
|
|
|
637
628
|
onRefresh?: () => void;
|
|
638
629
|
customActions?: ReactNode;
|
|
639
630
|
}
|
|
640
|
-
declare const ControllerShell: ({ roomId, connectionStatus,
|
|
631
|
+
declare const ControllerShell: ({ roomId, connectionStatus, forceOrientation, children, gameState, onTogglePlayPause, onReconnect, onRefresh, customActions, }: ControllerShellProps) => JSX.Element;
|
|
641
632
|
|
|
642
633
|
interface DebugStateDialogProps {
|
|
643
634
|
isOpen: boolean;
|
|
@@ -679,9 +670,10 @@ declare function VolumeControls({ className, compact }: VolumeControlsProps): re
|
|
|
679
670
|
*/
|
|
680
671
|
declare const DEFAULT_SERVER_PORT = 4000;
|
|
681
672
|
/**
|
|
682
|
-
*
|
|
673
|
+
* Standard path for controller endpoints.
|
|
674
|
+
* All Air Jam games use this convention - controller is always at {baseUrl}/controller
|
|
683
675
|
*/
|
|
684
|
-
declare const
|
|
676
|
+
declare const CONTROLLER_PATH = "/controller";
|
|
685
677
|
/**
|
|
686
678
|
* Input debounce time in milliseconds
|
|
687
679
|
* Used to prevent rapid input events from overwhelming the system
|
|
@@ -935,7 +927,7 @@ declare const Events: {
|
|
|
935
927
|
*
|
|
936
928
|
* @example Basic usage (room from URL)
|
|
937
929
|
* ```tsx
|
|
938
|
-
* // URL: https://yourgame.com/
|
|
930
|
+
* // URL: https://yourgame.com/controller?room=ABCD
|
|
939
931
|
* const controller = useAirJamController();
|
|
940
932
|
* // Automatically joins room ABCD
|
|
941
933
|
* ```
|
|
@@ -1568,10 +1560,10 @@ declare class UrlBuilder {
|
|
|
1568
1560
|
normalizeForMobile(url: string): Promise<string>;
|
|
1569
1561
|
/**
|
|
1570
1562
|
* Build a controller URL with room code.
|
|
1563
|
+
* Controller is always at {baseUrl}/controller (standardized convention).
|
|
1571
1564
|
* Automatically uses local IP when running on localhost.
|
|
1572
1565
|
*/
|
|
1573
1566
|
buildControllerUrl(roomId: RoomCode, options?: {
|
|
1574
|
-
path?: string;
|
|
1575
1567
|
host?: string;
|
|
1576
1568
|
}): Promise<string>;
|
|
1577
1569
|
/**
|
|
@@ -1590,4 +1582,4 @@ declare class UrlBuilder {
|
|
|
1590
1582
|
}
|
|
1591
1583
|
declare const urlBuilder: UrlBuilder;
|
|
1592
1584
|
|
|
1593
|
-
export { type AirJamConfig, AirJamContext, type AirJamContextValue, type AirJamControllerApi, type AirJamControllerOptions, AirJamDebug, type AirJamHostApi, type AirJamHostOptions, AirJamOverlay, AirJamProvider, type AirJamProviderProps, type AirJamShellApi, type AirJamSocket, AudioManager, AudioProvider, Button, ChildEvents, ClientEvents, ClientToServerEvents, ConnectionRole, ConnectionStatus, ControllerEvents, ControllerInputEvent, ControllerInputPayload, ControllerShell, ControllerStatePayload,
|
|
1585
|
+
export { type AirJamConfig, AirJamContext, type AirJamContextValue, type AirJamControllerApi, type AirJamControllerOptions, AirJamDebug, type AirJamHostApi, type AirJamHostOptions, AirJamOverlay, AirJamProvider, type AirJamProviderProps, type AirJamShellApi, type AirJamSocket, AudioManager, AudioProvider, Button, CONTROLLER_PATH, ChildEvents, ClientEvents, ClientToServerEvents, ConnectionRole, ConnectionStatus, ControllerEvents, ControllerInputEvent, ControllerInputPayload, ControllerShell, ControllerStatePayload, DEFAULT_MAX_PLAYERS, DEFAULT_SERVER_PORT, DebugStateDialog, Events, GameState, HapticSignalPayload, HostEvents, INPUT_DEBOUNCE_MS, type PlayOptions, PlayerAvatar, PlayerProfile, RoomCode, RunMode, SOCKET_CONFIG, type SendSignalFn, ServerEvents, ServerToClientEvents, Slider, SocketManager, type SoundCategory, type SoundConfig, type SoundManifest, SystemEvents, TOGGLE_DEBOUNCE_MS, ToastSignalPayload, UrlBuilder, VolumeControls, buttonVariants, createAirJamStore, createAudioManager, detectSoundCategory, generateControllerId, generateRoomCode, getLocalNetworkIp, urlBuilder, useAirJamConfig, useAirJamContext, useAirJamController, useAirJamHost, useAirJamShell, useAirJamSocket, useAirJamState, useAudio, useAudioLegacy, useAudioManager, useGetInput, useSendSignal, useVolumeStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React$1 from 'react';
|
|
|
3
3
|
import { ReactNode, JSX } from 'react';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { ControllerInputEvent, ConnectionRole, ConnectionStatus, RunMode, GameState, PlayerProfile, ServerToClientEvents, ClientToServerEvents, ControllerStatePayload, RoomCode, ControllerInputPayload, HapticSignalPayload, ToastSignalPayload } from './protocol.js';
|
|
6
|
-
export { AIRJAM_PROXY_PREFIX, AirJamActionRpcPayload, AirJamProxyMessage, AirJamStateSyncPayload, ClientLoadUiPayload, ControllerActionRpcPayload, ControllerJoinAck, ControllerJoinPayload, ControllerJoinedNotice, ControllerLeavePayload, ControllerLeftNotice, ControllerStateMessage, ControllerSystemPayload, ControllerWelcomePayload, ErrorCode, HostJoinAsChildPayload, HostLeftNotice, HostRegisterSystemPayload, HostRegistrationAck, HostRegistrationPayload, HostStateSyncPayload, InterServerEvents, PlaySoundEventPayload, PlaySoundPayload, ProxyInputMessage, ProxyMessageBase, ProxyReadyMessage, ProxyStateMessage, RoomReadyNotice, ServerErrorPayload, SignalPayload, SignalType, SocketData, SystemLaunchGameAck, SystemLaunchGamePayload, controllerInputSchema, controllerJoinSchema, controllerLeaveSchema, controllerStateSchema, controllerSystemSchema, hostJoinAsChildSchema, hostRegisterSystemSchema, hostRegistrationSchema, roomCodeSchema, systemLaunchGameSchema } from './protocol.js';
|
|
6
|
+
export { AIRJAM_PROXY_PREFIX, AirJamActionRpcPayload, AirJamProxyMessage, AirJamStateSyncPayload, ClientLoadUiPayload, ControllerActionRpcPayload, ControllerJoinAck, ControllerJoinPayload, ControllerJoinedNotice, ControllerLeavePayload, ControllerLeftNotice, ControllerStateMessage, ControllerSystemPayload, ControllerWelcomePayload, ErrorCode, HostCreateRoomPayload, HostJoinAsChildPayload, HostLeftNotice, HostReconnectPayload, HostRegisterSystemPayload, HostRegistrationAck, HostRegistrationPayload, HostStateSyncPayload, InterServerEvents, PlaySoundEventPayload, PlaySoundPayload, ProxyInputMessage, ProxyMessageBase, ProxyReadyMessage, ProxyStateMessage, RoomReadyNotice, ServerErrorPayload, SignalPayload, SignalType, SocketData, SystemLaunchGameAck, SystemLaunchGamePayload, controllerInputSchema, controllerJoinSchema, controllerLeaveSchema, controllerStateSchema, controllerSystemSchema, hostCreateRoomSchema, hostJoinAsChildSchema, hostReconnectSchema, hostRegisterSystemSchema, hostRegistrationSchema, roomCodeSchema, systemLaunchGameSchema } from './protocol.js';
|
|
7
7
|
import * as zustand from 'zustand';
|
|
8
8
|
import { StoreApi, StateCreator } from 'zustand';
|
|
9
9
|
import { Socket } from 'socket.io-client';
|
|
@@ -162,8 +162,7 @@ declare class InputManager<TSchema extends z.ZodSchema = z.ZodSchema> {
|
|
|
162
162
|
private inputBuffer;
|
|
163
163
|
private latchState;
|
|
164
164
|
private config;
|
|
165
|
-
|
|
166
|
-
constructor(config?: InputConfig<TSchema>, roomId?: string);
|
|
165
|
+
constructor(config?: InputConfig<TSchema>);
|
|
167
166
|
/**
|
|
168
167
|
* Handles incoming input events from the socket.
|
|
169
168
|
* Should be called when 'server:input' event is received.
|
|
@@ -179,10 +178,6 @@ declare class InputManager<TSchema extends z.ZodSchema = z.ZodSchema> {
|
|
|
179
178
|
* Clears input state for a controller (e.g., when player leaves).
|
|
180
179
|
*/
|
|
181
180
|
clearInput(controllerId: string): void;
|
|
182
|
-
/**
|
|
183
|
-
* Updates the room ID filter.
|
|
184
|
-
*/
|
|
185
|
-
setRoomId(roomId: string | undefined): void;
|
|
186
181
|
/**
|
|
187
182
|
* Internal method to apply latching logic.
|
|
188
183
|
*/
|
|
@@ -267,8 +262,6 @@ interface AirJamConfig {
|
|
|
267
262
|
serverUrl?: string;
|
|
268
263
|
/** API key for production authentication */
|
|
269
264
|
apiKey?: string;
|
|
270
|
-
/** Path for controller page (default: /joypad) */
|
|
271
|
-
controllerPath: string;
|
|
272
265
|
/** Maximum players allowed in a room */
|
|
273
266
|
maxPlayers: number;
|
|
274
267
|
/** Public host for controller URLs (optional) */
|
|
@@ -291,7 +284,6 @@ interface AirJamConfig {
|
|
|
291
284
|
* <AirJamProvider
|
|
292
285
|
* serverUrl="wss://your-server.com"
|
|
293
286
|
* apiKey="your-api-key"
|
|
294
|
-
* controllerPath="/controller"
|
|
295
287
|
* maxPlayers={4}
|
|
296
288
|
* input={{
|
|
297
289
|
* schema: myInputSchema,
|
|
@@ -315,12 +307,6 @@ interface AirJamProviderProps<TSchema extends z.ZodSchema = z.ZodSchema> {
|
|
|
315
307
|
* Falls back to VITE_AIR_JAM_API_KEY or NEXT_PUBLIC_AIR_JAM_API_KEY environment variables.
|
|
316
308
|
*/
|
|
317
309
|
apiKey?: string;
|
|
318
|
-
/**
|
|
319
|
-
* URL path for the controller page on your app.
|
|
320
|
-
* Controllers will be directed to this path with ?room=XXXX query parameter.
|
|
321
|
-
* @default "/joypad"
|
|
322
|
-
*/
|
|
323
|
-
controllerPath?: string;
|
|
324
310
|
/**
|
|
325
311
|
* Maximum number of players allowed in a room.
|
|
326
312
|
* @default 8
|
|
@@ -390,7 +376,7 @@ declare const AirJamContext: React$1.Context<AirJamContextValue | null>;
|
|
|
390
376
|
* <AirJamProvider>
|
|
391
377
|
* <Routes>
|
|
392
378
|
* <Route path="/" element={<HostView />} />
|
|
393
|
-
* <Route path="/
|
|
379
|
+
* <Route path="/controller" element={<ControllerView />} />
|
|
394
380
|
* </Routes>
|
|
395
381
|
* </AirJamProvider>
|
|
396
382
|
* );
|
|
@@ -423,7 +409,7 @@ declare const AirJamContext: React$1.Context<AirJamContextValue | null>;
|
|
|
423
409
|
* );
|
|
424
410
|
* ```
|
|
425
411
|
*/
|
|
426
|
-
declare const AirJamProvider: <TSchema extends z.ZodSchema = z.ZodSchema>({ children, serverUrl, apiKey,
|
|
412
|
+
declare const AirJamProvider: <TSchema extends z.ZodSchema = z.ZodSchema>({ children, serverUrl, apiKey, maxPlayers, publicHost, input, }: AirJamProviderProps<TSchema>) => react_jsx_runtime.JSX.Element;
|
|
427
413
|
/**
|
|
428
414
|
* Access the raw AirJam context value.
|
|
429
415
|
*
|
|
@@ -536,7 +522,12 @@ declare class AudioManager<T extends string = string> {
|
|
|
536
522
|
getCategory(soundId: string): SoundCategory;
|
|
537
523
|
setSocket(socket: Socket<ServerToClientEvents, ClientToServerEvents> | null, roomId?: string): void;
|
|
538
524
|
/**
|
|
539
|
-
*
|
|
525
|
+
* Resume audio context if suspended. This is automatically called by play(),
|
|
526
|
+
* so you typically don't need to call this manually.
|
|
527
|
+
*
|
|
528
|
+
* Note: Due to browser autoplay policies, audio context starts suspended
|
|
529
|
+
* and can only be resumed in response to a user gesture. The useAudio hook
|
|
530
|
+
* handles this automatically, and play() also calls init() internally.
|
|
540
531
|
*/
|
|
541
532
|
init(): void;
|
|
542
533
|
/**
|
|
@@ -625,11 +616,11 @@ declare const AirJamDebug: ({ state, title, updateInterval, className, }: AirJam
|
|
|
625
616
|
|
|
626
617
|
declare const AirJamOverlay: () => JSX.Element | null;
|
|
627
618
|
|
|
628
|
-
type OrientationRequirement = "portrait" | "landscape" | "any";
|
|
629
619
|
interface ControllerShellProps {
|
|
630
620
|
roomId?: string | null;
|
|
631
621
|
connectionStatus: ConnectionStatus;
|
|
632
|
-
|
|
622
|
+
/** Optional forced orientation. If not set, no orientation enforcement is applied. */
|
|
623
|
+
forceOrientation?: "portrait" | "landscape";
|
|
633
624
|
children: ReactNode;
|
|
634
625
|
gameState?: "paused" | "playing";
|
|
635
626
|
onTogglePlayPause?: () => void;
|
|
@@ -637,7 +628,7 @@ interface ControllerShellProps {
|
|
|
637
628
|
onRefresh?: () => void;
|
|
638
629
|
customActions?: ReactNode;
|
|
639
630
|
}
|
|
640
|
-
declare const ControllerShell: ({ roomId, connectionStatus,
|
|
631
|
+
declare const ControllerShell: ({ roomId, connectionStatus, forceOrientation, children, gameState, onTogglePlayPause, onReconnect, onRefresh, customActions, }: ControllerShellProps) => JSX.Element;
|
|
641
632
|
|
|
642
633
|
interface DebugStateDialogProps {
|
|
643
634
|
isOpen: boolean;
|
|
@@ -679,9 +670,10 @@ declare function VolumeControls({ className, compact }: VolumeControlsProps): re
|
|
|
679
670
|
*/
|
|
680
671
|
declare const DEFAULT_SERVER_PORT = 4000;
|
|
681
672
|
/**
|
|
682
|
-
*
|
|
673
|
+
* Standard path for controller endpoints.
|
|
674
|
+
* All Air Jam games use this convention - controller is always at {baseUrl}/controller
|
|
683
675
|
*/
|
|
684
|
-
declare const
|
|
676
|
+
declare const CONTROLLER_PATH = "/controller";
|
|
685
677
|
/**
|
|
686
678
|
* Input debounce time in milliseconds
|
|
687
679
|
* Used to prevent rapid input events from overwhelming the system
|
|
@@ -935,7 +927,7 @@ declare const Events: {
|
|
|
935
927
|
*
|
|
936
928
|
* @example Basic usage (room from URL)
|
|
937
929
|
* ```tsx
|
|
938
|
-
* // URL: https://yourgame.com/
|
|
930
|
+
* // URL: https://yourgame.com/controller?room=ABCD
|
|
939
931
|
* const controller = useAirJamController();
|
|
940
932
|
* // Automatically joins room ABCD
|
|
941
933
|
* ```
|
|
@@ -1568,10 +1560,10 @@ declare class UrlBuilder {
|
|
|
1568
1560
|
normalizeForMobile(url: string): Promise<string>;
|
|
1569
1561
|
/**
|
|
1570
1562
|
* Build a controller URL with room code.
|
|
1563
|
+
* Controller is always at {baseUrl}/controller (standardized convention).
|
|
1571
1564
|
* Automatically uses local IP when running on localhost.
|
|
1572
1565
|
*/
|
|
1573
1566
|
buildControllerUrl(roomId: RoomCode, options?: {
|
|
1574
|
-
path?: string;
|
|
1575
1567
|
host?: string;
|
|
1576
1568
|
}): Promise<string>;
|
|
1577
1569
|
/**
|
|
@@ -1590,4 +1582,4 @@ declare class UrlBuilder {
|
|
|
1590
1582
|
}
|
|
1591
1583
|
declare const urlBuilder: UrlBuilder;
|
|
1592
1584
|
|
|
1593
|
-
export { type AirJamConfig, AirJamContext, type AirJamContextValue, type AirJamControllerApi, type AirJamControllerOptions, AirJamDebug, type AirJamHostApi, type AirJamHostOptions, AirJamOverlay, AirJamProvider, type AirJamProviderProps, type AirJamShellApi, type AirJamSocket, AudioManager, AudioProvider, Button, ChildEvents, ClientEvents, ClientToServerEvents, ConnectionRole, ConnectionStatus, ControllerEvents, ControllerInputEvent, ControllerInputPayload, ControllerShell, ControllerStatePayload,
|
|
1585
|
+
export { type AirJamConfig, AirJamContext, type AirJamContextValue, type AirJamControllerApi, type AirJamControllerOptions, AirJamDebug, type AirJamHostApi, type AirJamHostOptions, AirJamOverlay, AirJamProvider, type AirJamProviderProps, type AirJamShellApi, type AirJamSocket, AudioManager, AudioProvider, Button, CONTROLLER_PATH, ChildEvents, ClientEvents, ClientToServerEvents, ConnectionRole, ConnectionStatus, ControllerEvents, ControllerInputEvent, ControllerInputPayload, ControllerShell, ControllerStatePayload, DEFAULT_MAX_PLAYERS, DEFAULT_SERVER_PORT, DebugStateDialog, Events, GameState, HapticSignalPayload, HostEvents, INPUT_DEBOUNCE_MS, type PlayOptions, PlayerAvatar, PlayerProfile, RoomCode, RunMode, SOCKET_CONFIG, type SendSignalFn, ServerEvents, ServerToClientEvents, Slider, SocketManager, type SoundCategory, type SoundConfig, type SoundManifest, SystemEvents, TOGGLE_DEBOUNCE_MS, ToastSignalPayload, UrlBuilder, VolumeControls, buttonVariants, createAirJamStore, createAudioManager, detectSoundCategory, generateControllerId, generateRoomCode, getLocalNetworkIp, urlBuilder, useAirJamConfig, useAirJamContext, useAirJamController, useAirJamHost, useAirJamShell, useAirJamSocket, useAirJamState, useAudio, useAudioLegacy, useAudioManager, useGetInput, useSendSignal, useVolumeStore };
|