@caisual/kit 0.20.0 → 0.22.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 +6 -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 +182 -457
- package/dist/runtime.js +236 -299
- package/dist/types/api.d.ts +2 -9
- 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 -3
- package/dist/types/contracts/manifest.d.ts +6 -40
- 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 -38
- package/dist/types/index.d.ts +64 -90
- package/dist/types/node/index.d.ts +6 -27
- package/dist/types/protocollo.d.ts +1 -20
- package/dist/types/runtime/index.d.ts +8 -15
- package/dist/types/runtime/network-probe.d.ts +4 -0
- package/dist/types/server/index.d.ts +0 -20
- package/dist/types/stanza/nucleo.d.ts +12 -17
- package/dist/types/stanza/tipi.d.ts +7 -23
- package/dist/types/voce/index.d.ts +0 -1
- package/package.json +16 -19
- package/dist/overlay.d.ts +0 -1
- package/dist/overlay.js +0 -2326
- package/dist/overlay.js.map +0 -7
- package/dist/types/contracts/overlay-boards.d.ts +0 -3
- package/dist/types/contracts/overlay.d.ts +0 -240
- package/dist/types/contracts/replay.d.ts +0 -83
- package/dist/types/overlay/boards.d.ts +0 -48
- package/dist/types/overlay/bridge.d.ts +0 -3
- package/dist/types/overlay/i18n.d.ts +0 -146
- package/dist/types/overlay/index.d.ts +0 -10
- 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 -83
- 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 -50
- package/dist/types/session/resume.d.ts +0 -13
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type Manifest, type OverlayPanel, type OverlaySessionState } from '../contracts/index.js';
|
|
2
|
-
export type Phase = 'boot' | 'home' | 'attaching' | 'matching' | 'lobby' | 'countdown' | 'playing' | 'ended' | 'watching' | 'error';
|
|
3
|
-
export type Panel = OverlayPanel | 'join' | 'watch' | 'exit';
|
|
4
|
-
export interface UiModel {
|
|
5
|
-
session: OverlaySessionState | null;
|
|
6
|
-
panel: Panel | 'auto' | null;
|
|
7
|
-
mode: string;
|
|
8
|
-
busy: boolean;
|
|
9
|
-
error: string | null;
|
|
10
|
-
notice: string | null;
|
|
11
|
-
shortcutEnabled: boolean;
|
|
12
|
-
}
|
|
13
|
-
export type UiAction = {
|
|
14
|
-
type: 'session';
|
|
15
|
-
session: OverlaySessionState | null;
|
|
16
|
-
} | {
|
|
17
|
-
type: 'panel';
|
|
18
|
-
panel: Panel | null;
|
|
19
|
-
} | {
|
|
20
|
-
type: 'mode';
|
|
21
|
-
mode: string;
|
|
22
|
-
} | {
|
|
23
|
-
type: 'busy';
|
|
24
|
-
busy: boolean;
|
|
25
|
-
} | {
|
|
26
|
-
type: 'error';
|
|
27
|
-
code: string | null;
|
|
28
|
-
} | {
|
|
29
|
-
type: 'notice';
|
|
30
|
-
notice: string | null;
|
|
31
|
-
} | {
|
|
32
|
-
type: 'shortcut';
|
|
33
|
-
enabled: boolean;
|
|
34
|
-
};
|
|
35
|
-
export declare function phase(session: OverlaySessionState | null): Phase;
|
|
36
|
-
export declare function initialUi(manifest: Manifest): UiModel;
|
|
37
|
-
export declare function groupModes(manifest: Manifest): {
|
|
38
|
-
singlePlayer: Manifest['modes'];
|
|
39
|
-
multiplayer: Manifest['modes'];
|
|
40
|
-
};
|
|
41
|
-
export declare function reduceUi(model: UiModel, action: UiAction): UiModel;
|
|
42
|
-
export declare function visiblePanel(model: UiModel): Panel | 'boot' | 'attaching' | 'matching' | 'countdown' | 'error' | null;
|
|
43
|
-
export declare function primaryAction(manifest: Manifest, mode: string): {
|
|
44
|
-
op: "local.start" | "room.create";
|
|
45
|
-
friends: boolean;
|
|
46
|
-
} | null;
|
|
47
|
-
export declare function startReason(manifest: Manifest, session: OverlaySessionState | null): string | null;
|
|
48
|
-
export declare function canPlayAgain(session: OverlaySessionState | null): boolean;
|
|
49
|
-
export declare function normalizeInvite(code: string): string | null;
|
|
50
|
-
export declare function matchPresentation(session: OverlaySessionState | null): {
|
|
51
|
-
result: import("../contracts/index.js").MatchResult;
|
|
52
|
-
outcome: "draw" | "ended" | "lost" | "won";
|
|
53
|
-
} | null;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { type OverlayConfiguration } from '../contracts/index.js';
|
|
2
|
-
import { type HostBridge } from './host-bridge.js';
|
|
3
|
-
import { type BoardReader } from './boards.js';
|
|
4
|
-
export interface CrewPerson {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
online: boolean;
|
|
8
|
-
game: {
|
|
9
|
-
slug: string;
|
|
10
|
-
name: string;
|
|
11
|
-
iconUrl: string;
|
|
12
|
-
} | null;
|
|
13
|
-
room: {
|
|
14
|
-
code: string;
|
|
15
|
-
} | null;
|
|
16
|
-
}
|
|
17
|
-
export interface CrewSnapshot {
|
|
18
|
-
connected: boolean;
|
|
19
|
-
you: {
|
|
20
|
-
id: string;
|
|
21
|
-
name: string;
|
|
22
|
-
} | null;
|
|
23
|
-
friends: CrewPerson[];
|
|
24
|
-
party: {
|
|
25
|
-
id: string;
|
|
26
|
-
leader: string;
|
|
27
|
-
members: CrewPerson[];
|
|
28
|
-
} | null;
|
|
29
|
-
invites: {
|
|
30
|
-
party: string;
|
|
31
|
-
from: {
|
|
32
|
-
id: string;
|
|
33
|
-
name: string;
|
|
34
|
-
};
|
|
35
|
-
at: number;
|
|
36
|
-
}[];
|
|
37
|
-
follow: {
|
|
38
|
-
from: {
|
|
39
|
-
id: string;
|
|
40
|
-
name: string;
|
|
41
|
-
};
|
|
42
|
-
game: {
|
|
43
|
-
slug: string;
|
|
44
|
-
name: string;
|
|
45
|
-
iconUrl: string;
|
|
46
|
-
};
|
|
47
|
-
code: string;
|
|
48
|
-
} | null;
|
|
49
|
-
}
|
|
50
|
-
export interface OverlayCrew {
|
|
51
|
-
unavailable?: 'local' | 'login';
|
|
52
|
-
getSnapshot(): CrewSnapshot;
|
|
53
|
-
subscribe(listener: () => void): () => void;
|
|
54
|
-
party: {
|
|
55
|
-
create(): void;
|
|
56
|
-
invite(player: string): void;
|
|
57
|
-
accept(party: string): void;
|
|
58
|
-
decline(party: string): void;
|
|
59
|
-
leave(): void;
|
|
60
|
-
};
|
|
61
|
-
follow(game: string, code: string): void;
|
|
62
|
-
}
|
|
63
|
-
export interface MountOverlayInput {
|
|
64
|
-
container: HTMLElement;
|
|
65
|
-
frame: HTMLIFrameElement;
|
|
66
|
-
bridge: HostBridge;
|
|
67
|
-
configuration: OverlayConfiguration;
|
|
68
|
-
language: string;
|
|
69
|
-
player: {
|
|
70
|
-
id: string;
|
|
71
|
-
guest: boolean;
|
|
72
|
-
};
|
|
73
|
-
exit(): void;
|
|
74
|
-
inviteUrl(code: string): string;
|
|
75
|
-
replayUrl?(id: string): string;
|
|
76
|
-
boards?: BoardReader;
|
|
77
|
-
crew?: OverlayCrew;
|
|
78
|
-
}
|
|
79
|
-
export declare function mountOverlay(input: MountOverlayInput): {
|
|
80
|
-
element: HTMLDivElement;
|
|
81
|
-
root: ShadowRoot;
|
|
82
|
-
dispose(): void;
|
|
83
|
-
} | null;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { 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,50 +0,0 @@
|
|
|
1
|
-
import type { ReplayClient } from '../replay/index.js';
|
|
2
|
-
import { type OverlayCapabilities, type OverlayConfiguration, type OverlayPanel, type OverlayRequest, type OverlaySessionState, type OverlayView, type QueuedScore } 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
|
-
onScore(listener: (value: QueuedScore) => void): () => void;
|
|
47
|
-
execute(request: OverlayRequest): Promise<void>;
|
|
48
|
-
dispose(): void;
|
|
49
|
-
};
|
|
50
|
-
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
|
-
};
|