@caisual/kit 0.21.0 → 0.23.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/README.md +12 -9
- package/dist/host.d.ts +1 -0
- package/dist/host.js +169 -0
- package/dist/kit.js +2 -4
- package/dist/kit.js.map +4 -4
- package/dist/node.js +193 -427
- package/dist/runtime.js +241 -269
- package/dist/types/api.d.ts +1 -1
- package/dist/types/contracts/connessione.d.ts +1 -0
- package/dist/types/contracts/giornata.d.ts +1 -0
- package/dist/types/contracts/index.d.ts +3 -2
- package/dist/types/contracts/manifest.d.ts +7 -50
- package/dist/types/contracts/network-budget.d.ts +53 -0
- package/dist/types/contracts/versioni.d.ts +0 -1
- package/dist/types/crew/index.d.ts +4 -0
- package/dist/types/handshake.d.ts +0 -4
- package/dist/types/{overlay/host-bridge.d.ts → host/index.d.ts} +60 -37
- package/dist/types/index.d.ts +66 -57
- package/dist/types/node/index.d.ts +5 -25
- package/dist/types/protocollo.d.ts +2 -21
- package/dist/types/runtime/index.d.ts +3 -13
- package/dist/types/runtime/network-probe.d.ts +4 -0
- package/dist/types/server/index.d.ts +1 -11
- package/dist/types/stanza/nucleo.d.ts +8 -16
- package/dist/types/stanza/tipi.d.ts +3 -21
- package/dist/types/voce/index.d.ts +0 -1
- package/package.json +15 -17
- package/dist/overlay.d.ts +0 -1
- package/dist/overlay.js +0 -2157
- package/dist/overlay.js.map +0 -7
- package/dist/types/contracts/overlay.d.ts +0 -235
- package/dist/types/contracts/replay.d.ts +0 -83
- package/dist/types/overlay/bridge.d.ts +0 -3
- package/dist/types/overlay/i18n.d.ts +0 -128
- package/dist/types/overlay/index.d.ts +0 -9
- package/dist/types/overlay/locale.d.ts +0 -4
- package/dist/types/overlay/shortcut.d.ts +0 -4
- package/dist/types/overlay/styles.d.ts +0 -1
- package/dist/types/overlay/ui-model.d.ts +0 -53
- package/dist/types/overlay/ui.d.ts +0 -81
- package/dist/types/overlay/voice-panel.d.ts +0 -13
- package/dist/types/replay/index.d.ts +0 -65
- package/dist/types/session/index.d.ts +0 -49
- package/dist/types/session/resume.d.ts +0 -13
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { type OverlayConfiguration } from '../contracts/index.js';
|
|
2
|
-
import { type HostBridge } from './host-bridge.js';
|
|
3
|
-
export interface CrewPerson {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
online: boolean;
|
|
7
|
-
game: {
|
|
8
|
-
slug: string;
|
|
9
|
-
name: string;
|
|
10
|
-
iconUrl: string;
|
|
11
|
-
} | null;
|
|
12
|
-
room: {
|
|
13
|
-
code: string;
|
|
14
|
-
} | null;
|
|
15
|
-
}
|
|
16
|
-
export interface CrewSnapshot {
|
|
17
|
-
connected: boolean;
|
|
18
|
-
you: {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
} | null;
|
|
22
|
-
friends: CrewPerson[];
|
|
23
|
-
party: {
|
|
24
|
-
id: string;
|
|
25
|
-
leader: string;
|
|
26
|
-
members: CrewPerson[];
|
|
27
|
-
} | null;
|
|
28
|
-
invites: {
|
|
29
|
-
party: string;
|
|
30
|
-
from: {
|
|
31
|
-
id: string;
|
|
32
|
-
name: string;
|
|
33
|
-
};
|
|
34
|
-
at: number;
|
|
35
|
-
}[];
|
|
36
|
-
follow: {
|
|
37
|
-
from: {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
game: {
|
|
42
|
-
slug: string;
|
|
43
|
-
name: string;
|
|
44
|
-
iconUrl: string;
|
|
45
|
-
};
|
|
46
|
-
code: string;
|
|
47
|
-
} | null;
|
|
48
|
-
}
|
|
49
|
-
export interface OverlayCrew {
|
|
50
|
-
unavailable?: 'local' | 'login';
|
|
51
|
-
getSnapshot(): CrewSnapshot;
|
|
52
|
-
subscribe(listener: () => void): () => void;
|
|
53
|
-
party: {
|
|
54
|
-
create(): void;
|
|
55
|
-
invite(player: string): void;
|
|
56
|
-
accept(party: string): void;
|
|
57
|
-
decline(party: string): void;
|
|
58
|
-
leave(): void;
|
|
59
|
-
};
|
|
60
|
-
follow(game: string, code: string): void;
|
|
61
|
-
}
|
|
62
|
-
export interface MountOverlayInput {
|
|
63
|
-
container: HTMLElement;
|
|
64
|
-
frame: HTMLIFrameElement;
|
|
65
|
-
bridge: HostBridge;
|
|
66
|
-
configuration: OverlayConfiguration;
|
|
67
|
-
language: string;
|
|
68
|
-
player: {
|
|
69
|
-
id: string;
|
|
70
|
-
guest: boolean;
|
|
71
|
-
};
|
|
72
|
-
exit(): void;
|
|
73
|
-
inviteUrl(code: string): string;
|
|
74
|
-
replayUrl?(id: string): string;
|
|
75
|
-
crew?: OverlayCrew;
|
|
76
|
-
}
|
|
77
|
-
export declare function mountOverlay(input: MountOverlayInput): {
|
|
78
|
-
element: HTMLDivElement;
|
|
79
|
-
root: ShadowRoot;
|
|
80
|
-
dispose(): void;
|
|
81
|
-
} | null;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { GameManifest as Manifest, OverlaySessionState, OverlayVoice } from '../contracts/index.js';
|
|
2
|
-
import { type translator } from './i18n.js';
|
|
3
|
-
type Translate = ReturnType<typeof translator>;
|
|
4
|
-
export declare function voiceEligible(manifest: Manifest, session: OverlaySessionState | null): boolean;
|
|
5
|
-
export declare function voiceStatus(voice: OverlayVoice, t: Translate): string;
|
|
6
|
-
export declare function updateVoicePanel(container: HTMLElement, input: {
|
|
7
|
-
manifest: Manifest;
|
|
8
|
-
session: OverlaySessionState | null;
|
|
9
|
-
t: Translate;
|
|
10
|
-
error: string | null;
|
|
11
|
-
pending: string | null;
|
|
12
|
-
}): void;
|
|
13
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { type ReplayEvent, type ReplayIndex, type ReplayPlayback } from '../contracts/index.js';
|
|
2
|
-
import type { JsonValue, RoomMetadata, Spectate } from '../index.js';
|
|
3
|
-
export interface ReplayClock {
|
|
4
|
-
now(): number;
|
|
5
|
-
setInterval(callback: () => void, ms: number): number;
|
|
6
|
-
clearInterval(id: number): void;
|
|
7
|
-
}
|
|
8
|
-
export declare class ReplayClient implements Spectate {
|
|
9
|
-
readonly index: ReplayIndex;
|
|
10
|
-
private readonly events;
|
|
11
|
-
private readonly clock;
|
|
12
|
-
readonly replay = true;
|
|
13
|
-
readonly role = "spectator";
|
|
14
|
-
readonly delayMs = 0;
|
|
15
|
-
readonly code = "";
|
|
16
|
-
readonly latency: null;
|
|
17
|
-
readonly countdownAt: null;
|
|
18
|
-
private picture;
|
|
19
|
-
private cursor;
|
|
20
|
-
private position;
|
|
21
|
-
private paused;
|
|
22
|
-
private speedValue;
|
|
23
|
-
private timer;
|
|
24
|
-
private last;
|
|
25
|
-
private lastEmitted;
|
|
26
|
-
private disconnected;
|
|
27
|
-
private checkpoints;
|
|
28
|
-
private states;
|
|
29
|
-
private playersListeners;
|
|
30
|
-
private statuses;
|
|
31
|
-
private metadataListeners;
|
|
32
|
-
private connections;
|
|
33
|
-
private playbackListeners;
|
|
34
|
-
constructor(index: ReplayIndex, events: ReplayEvent[], clock?: ReplayClock);
|
|
35
|
-
get mode(): string | null;
|
|
36
|
-
get connection(): "connected" | "disconnected";
|
|
37
|
-
get metadata(): RoomMetadata;
|
|
38
|
-
get state(): JsonValue;
|
|
39
|
-
get tick(): number;
|
|
40
|
-
get tickRate(): number;
|
|
41
|
-
get seed(): number;
|
|
42
|
-
get status(): import("../contracts/index.js").ReplayStatus;
|
|
43
|
-
get players(): import("../contracts/index.js").OverlayPlayer[];
|
|
44
|
-
get host(): string | null;
|
|
45
|
-
get result(): JsonValue;
|
|
46
|
-
get playback(): ReplayPlayback;
|
|
47
|
-
serverTime(): number;
|
|
48
|
-
onState(listener: Parameters<Spectate['onState']>[0]): () => void;
|
|
49
|
-
onStatus(listener: Parameters<Spectate['onStatus']>[0]): () => void;
|
|
50
|
-
onPlayers(listener: Parameters<Spectate['onPlayers']>[0]): () => void;
|
|
51
|
-
onMetadata(listener: Parameters<Spectate['onMetadata']>[0]): () => void;
|
|
52
|
-
onConnection(listener: Parameters<Spectate['onConnection']>[0]): () => void;
|
|
53
|
-
onMessage(_listener: Parameters<Spectate['onMessage']>[0]): () => void;
|
|
54
|
-
onPlayback(listener: (value: ReplayPlayback) => void): () => void;
|
|
55
|
-
private apply;
|
|
56
|
-
seek(position: number): void;
|
|
57
|
-
private advance;
|
|
58
|
-
private step;
|
|
59
|
-
play(): void;
|
|
60
|
-
pause(): void;
|
|
61
|
-
speed(value: number): void;
|
|
62
|
-
disconnect(): void;
|
|
63
|
-
leave(): void;
|
|
64
|
-
}
|
|
65
|
-
export declare function loadReplay(fetcher: typeof fetch, url: string): Promise<ReplayClient>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { ReplayClient } from '../replay/index.js';
|
|
2
|
-
import { type OverlayCapabilities, type OverlayConfiguration, type OverlayPanel, type OverlayRequest, type OverlaySessionState, type OverlayView } from '../contracts/index.js';
|
|
3
|
-
import type { BaseConnection, Room, Rooms, ReplayRooms, Spectate } from '../index.js';
|
|
4
|
-
export type GameSession = {
|
|
5
|
-
kind: 'idle';
|
|
6
|
-
} | {
|
|
7
|
-
kind: 'local';
|
|
8
|
-
id: string;
|
|
9
|
-
mode: string | null;
|
|
10
|
-
status: 'playing' | 'ended';
|
|
11
|
-
} | {
|
|
12
|
-
kind: 'room';
|
|
13
|
-
id: string;
|
|
14
|
-
room: Room;
|
|
15
|
-
} | {
|
|
16
|
-
kind: 'watch';
|
|
17
|
-
id: string;
|
|
18
|
-
room: Spectate;
|
|
19
|
-
};
|
|
20
|
-
export interface Session {
|
|
21
|
-
readonly current: GameSession;
|
|
22
|
-
readonly capabilities: OverlayCapabilities;
|
|
23
|
-
onChange(listener: (session: GameSession) => void): () => void;
|
|
24
|
-
ready(): void;
|
|
25
|
-
finish(): void;
|
|
26
|
-
}
|
|
27
|
-
export interface Overlay {
|
|
28
|
-
open(panel: OverlayPanel): void;
|
|
29
|
-
onChange(listener: (view: OverlayView) => void): () => void;
|
|
30
|
-
}
|
|
31
|
-
export declare function createSession(base: BaseConnection, configuration?: OverlayConfiguration | null, roomsAvailable?: boolean, replay?: ReplayClient | null): {
|
|
32
|
-
session: Session;
|
|
33
|
-
overlay: Overlay;
|
|
34
|
-
rooms: ReplayRooms | Rooms;
|
|
35
|
-
snapshot: () => OverlaySessionState;
|
|
36
|
-
serverTime: () => number;
|
|
37
|
-
onState(listener: (value: OverlaySessionState) => void): () => void;
|
|
38
|
-
onOpen(listener: (value: OverlayPanel) => void): () => void;
|
|
39
|
-
onError(listener: (value: {
|
|
40
|
-
sessionId: string | null;
|
|
41
|
-
error: {
|
|
42
|
-
code: string;
|
|
43
|
-
message: string;
|
|
44
|
-
};
|
|
45
|
-
}) => void): () => void;
|
|
46
|
-
execute(request: OverlayRequest): Promise<void>;
|
|
47
|
-
dispose(): void;
|
|
48
|
-
};
|
|
49
|
-
export type SessionCoordinator = ReturnType<typeof createSession>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type SessionResume } from '../contracts/index.js';
|
|
2
|
-
import type { BaseConnection } from '../index.js';
|
|
3
|
-
export declare function createResume(save: BaseConnection['save'], changed: () => void): {
|
|
4
|
-
loaded: Promise<void>;
|
|
5
|
-
readonly value: {
|
|
6
|
-
version: 1;
|
|
7
|
-
code: string;
|
|
8
|
-
mode: string | null;
|
|
9
|
-
updatedAt: number;
|
|
10
|
-
} | null;
|
|
11
|
-
readonly error: boolean;
|
|
12
|
-
set(value: SessionResume | null): Promise<void>;
|
|
13
|
-
};
|