@minicode-dev/chat 0.1.7 → 0.1.8
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/README.md +25 -0
- package/dist/chunks/{BattleshipGameCard-CAWHxqJE.js → BattleshipGameCard-BFqA0cjT.js} +247 -246
- package/dist/chunks/{BattleshipGameCard-CAWHxqJE.js.map → BattleshipGameCard-BFqA0cjT.js.map} +1 -1
- package/dist/chunks/{ChatContext-CUiEAMKK.js → ChatContext-dty_KPDX.js} +2 -2
- package/dist/chunks/{ChatContext-CUiEAMKK.js.map → ChatContext-dty_KPDX.js.map} +1 -1
- package/dist/chunks/TanksGameCard-D0n-lzTs.js +1535 -0
- package/dist/chunks/TanksGameCard-D0n-lzTs.js.map +1 -0
- package/dist/chunks/TanksLiveGameCard-BmNRXP66.js +849 -0
- package/dist/chunks/TanksLiveGameCard-BmNRXP66.js.map +1 -0
- package/dist/chunks/WebRtcLab-B7xBlJy1.js +510 -0
- package/dist/chunks/WebRtcLab-B7xBlJy1.js.map +1 -0
- package/dist/chunks/{connect4Sounds-BDXQAvU1.js → connect4Sounds-BN7d_TM2.js} +654 -618
- package/dist/chunks/connect4Sounds-BN7d_TM2.js.map +1 -0
- package/dist/chunks/createLiveScene-CtYPcOPo.js +364 -0
- package/dist/chunks/createLiveScene-CtYPcOPo.js.map +1 -0
- package/dist/chunks/createPeerLink-qei05vpV.js +478 -0
- package/dist/chunks/createPeerLink-qei05vpV.js.map +1 -0
- package/dist/chunks/createTankScene-CV7Brxmt.js +685 -0
- package/dist/chunks/createTankScene-CV7Brxmt.js.map +1 -0
- package/dist/chunks/fx-BHsl4S_J.js +1470 -0
- package/dist/chunks/fx-BHsl4S_J.js.map +1 -0
- package/dist/chunks/gameStatus-Cu1Z8un9.js +69 -0
- package/dist/chunks/gameStatus-Cu1Z8un9.js.map +1 -0
- package/dist/chunks/signalFaults-Dv2YjjKy.js +36 -0
- package/dist/chunks/signalFaults-Dv2YjjKy.js.map +1 -0
- package/dist/chunks/tanksSounds-C99OD2xD.js +177 -0
- package/dist/chunks/tanksSounds-C99OD2xD.js.map +1 -0
- package/dist/index.js +1861 -1829
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +61 -0
- package/package.json +1 -1
- package/dist/chunks/TanksGameCard-BEnXTz_J.js +0 -1705
- package/dist/chunks/TanksGameCard-BEnXTz_J.js.map +0 -1
- package/dist/chunks/connect4Sounds-BDXQAvU1.js.map +0 -1
- package/dist/chunks/createTankScene-BuliAxwR.js +0 -2150
- package/dist/chunks/createTankScene-BuliAxwR.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -89,6 +89,8 @@ export interface ChatGamesFeatures {
|
|
|
89
89
|
battleshipPreview?: boolean;
|
|
90
90
|
/** Tanques de guerra 3D. Default false while the game is in preview. */
|
|
91
91
|
tanks?: boolean;
|
|
92
|
+
/** Simultaneous WebRTC tank combat; disabled by default. */
|
|
93
|
+
tanksLive?: boolean;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export interface ChatFeatures {
|
|
@@ -166,7 +168,14 @@ export interface ChatCallbacks {
|
|
|
166
168
|
onConnectionChange?: (status: TransportStatus) => void;
|
|
167
169
|
}
|
|
168
170
|
|
|
171
|
+
export interface ChatWebRtcConfig {
|
|
172
|
+
/** Host supplied STUN/TURN configuration. Obtain TURN credentials at runtime. */
|
|
173
|
+
iceServers?: RTCIceServer[];
|
|
174
|
+
iceTransportPolicy?: 'all' | 'relay';
|
|
175
|
+
}
|
|
176
|
+
|
|
169
177
|
export interface ChatConfig {
|
|
178
|
+
webrtc?: ChatWebRtcConfig;
|
|
170
179
|
websocket?: {
|
|
171
180
|
url?: string | (() => string | Promise<string>) | null;
|
|
172
181
|
reconnect?: ReconnectOptions;
|
|
@@ -507,3 +516,55 @@ export function sendRelayMessage(socket: WebSocket | null, roomId: string, messa
|
|
|
507
516
|
|
|
508
517
|
/** Lazily loads the Battleship 3D preview (three.js); use with React.lazy. */
|
|
509
518
|
export function loadBattleshipPreview(): Promise<{ default: ComponentType<any> }>;
|
|
519
|
+
|
|
520
|
+
// ---- WebRTC (chat-signaled peer links, TANQUES LIVE groundwork) ----
|
|
521
|
+
|
|
522
|
+
export interface ChatSignalFrame { userId: string; roomId: string; text: string }
|
|
523
|
+
export interface PeerSignaling {
|
|
524
|
+
send(text: string): Promise<unknown> | unknown;
|
|
525
|
+
subscribe(listener: (frame: ChatSignalFrame) => void): () => void;
|
|
526
|
+
dispose?(): void;
|
|
527
|
+
}
|
|
528
|
+
export type PeerLinkPhase = 'idle' | 'listening' | 'calling' | 'negotiating' | 'connected' | 'restarting' | 'reconnecting' | 'failed';
|
|
529
|
+
export interface PeerLinkState {
|
|
530
|
+
phase: PeerLinkPhase; role: 'caller' | 'answerer' | null; sid: string | null; gen: number;
|
|
531
|
+
tabId: string; peerTab: string | null; ice: string; connection: string; signalingState: string; gathering: string;
|
|
532
|
+
route: { local: string | null; remote: string | null; protocol: string | null; relay: boolean; label: string } | null;
|
|
533
|
+
rtt: number | null; statsRtt: number | null; reconnects: number; restarts: number; error: string | null;
|
|
534
|
+
move: { sent: number; dropped: number; received: number; outOfOrder: number; lossPct: number; hzIn: number; hzOut: number };
|
|
535
|
+
signals: { sent: number; received: number; retransmits: number; duplicates: number; ignored: number; invalid: number; tooLarge: number; maxLength: number };
|
|
536
|
+
events: { sent: number; received: number };
|
|
537
|
+
}
|
|
538
|
+
export interface PeerLink {
|
|
539
|
+
tabId: string;
|
|
540
|
+
connect(): void;
|
|
541
|
+
setListening(value: boolean): void;
|
|
542
|
+
sendMove(payload: unknown): boolean;
|
|
543
|
+
sendEvent(payload: unknown): boolean;
|
|
544
|
+
restartIce(): void;
|
|
545
|
+
getState(): PeerLinkState;
|
|
546
|
+
hangup(): void;
|
|
547
|
+
destroy(): void;
|
|
548
|
+
}
|
|
549
|
+
export function createPeerLink(options: {
|
|
550
|
+
signaling: PeerSignaling; selfId: string; peerId: string; roomId?: string | null; tabId?: string;
|
|
551
|
+
iceServers?: RTCIceServer[]; iceTransportPolicy?: RTCIceTransportPolicy; autoReconnect?: boolean; listen?: boolean;
|
|
552
|
+
RTCPeerConnectionImpl?: typeof RTCPeerConnection;
|
|
553
|
+
onChange?: (state: PeerLinkState) => void; onMove?: (payload: any, meta: { seq: number }) => void;
|
|
554
|
+
onEvent?: (payload: any) => void; log?: (line: string) => void;
|
|
555
|
+
}): PeerLink;
|
|
556
|
+
export const DEFAULT_ICE_SERVERS: RTCIceServer[];
|
|
557
|
+
export const rtcSignals: { emit(frame: ChatSignalFrame): void; subscribe(listener: (frame: ChatSignalFrame) => void): () => void };
|
|
558
|
+
export function createChatSignaling(options: { send: (roomId: string, text: string) => Promise<unknown> | unknown; roomId: string }): PeerSignaling;
|
|
559
|
+
export function withSignalFaults(signaling: PeerSignaling, getFaults?: () => { drop?: number; duplicate?: number; jitter?: number }): PeerSignaling & { pause(ms: number): void; dispose(): void };
|
|
560
|
+
export const WEBRTC_PREFIX: 'LIRA_WEBRTC_V1:';
|
|
561
|
+
export const MAX_SIGNAL_LENGTH: number;
|
|
562
|
+
export function isWebrtcMessage(text: unknown): boolean;
|
|
563
|
+
export function encodeSignal(signal: Record<string, unknown>): string | null;
|
|
564
|
+
export function decodeSignal(text: string): Record<string, any> | null;
|
|
565
|
+
/** Lazy lab UI; render inside <Suspense>. */
|
|
566
|
+
export const WebRtcLab: ComponentType<{
|
|
567
|
+
selfId: string | null; selfName?: string; peers?: { id: string; name?: string }[]; defaultPeerId?: string;
|
|
568
|
+
createSignaling: (opts: { peerId: string; log: (line: string) => void }) => PeerSignaling | Promise<PeerSignaling>;
|
|
569
|
+
socketStatus?: string; disabledReason?: string; title?: string; children?: ReactNode; iceServers?: RTCIceServer[];
|
|
570
|
+
}>;
|