@caisual/kit 0.20.0 → 0.21.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 +1 -1
- package/dist/kit.js +4 -4
- package/dist/kit.js.map +3 -3
- package/dist/node.js +21 -51
- package/dist/overlay.js +8 -177
- package/dist/overlay.js.map +4 -4
- package/dist/runtime.js +27 -51
- package/dist/types/api.d.ts +1 -8
- package/dist/types/contracts/index.d.ts +0 -1
- package/dist/types/contracts/manifest.d.ts +1 -0
- package/dist/types/contracts/overlay.d.ts +4 -9
- package/dist/types/index.d.ts +0 -40
- package/dist/types/node/index.d.ts +0 -4
- package/dist/types/overlay/host-bridge.d.ts +1 -2
- package/dist/types/overlay/i18n.d.ts +0 -18
- package/dist/types/overlay/index.d.ts +0 -1
- package/dist/types/overlay/styles.d.ts +1 -1
- package/dist/types/overlay/ui-model.d.ts +1 -1
- package/dist/types/overlay/ui.d.ts +0 -2
- package/dist/types/overlay/voice-panel.d.ts +1 -1
- package/dist/types/runtime/index.d.ts +4 -4
- package/dist/types/server/index.d.ts +0 -10
- package/dist/types/session/index.d.ts +1 -2
- package/dist/types/stanza/nucleo.d.ts +4 -1
- package/dist/types/stanza/tipi.d.ts +3 -4
- package/package.json +2 -3
- package/dist/types/contracts/overlay-boards.d.ts +0 -3
- package/dist/types/overlay/boards.d.ts +0 -48
package/dist/runtime.js
CHANGED
|
@@ -163,10 +163,10 @@ function visitaDiff(prima, dopo, path, patch) {
|
|
|
163
163
|
}
|
|
164
164
|
if (isObject(prima) && isObject(dopo)) {
|
|
165
165
|
for (const key of Object.keys(prima)) {
|
|
166
|
-
if (!(key
|
|
166
|
+
if (!Object.hasOwn(dopo, key)) patch.push({ op: "del", path: [...path, key] });
|
|
167
167
|
}
|
|
168
168
|
for (const [key, value] of Object.entries(dopo)) {
|
|
169
|
-
if (!(key
|
|
169
|
+
if (!Object.hasOwn(prima, key)) patch.push({ op: "set", path: [...path, key], value });
|
|
170
170
|
else visitaDiff(prima[key], value, [...path, key], patch);
|
|
171
171
|
}
|
|
172
172
|
return;
|
|
@@ -333,7 +333,6 @@ var GRAZIA_MS = 6e4;
|
|
|
333
333
|
var STANZA_VUOTA_MS = 5 * 6e4;
|
|
334
334
|
var ATTESA_RIVINCITA_MS = 2 * 6e4;
|
|
335
335
|
var COUNTDOWN_MS = 3e3;
|
|
336
|
-
var GRAZIA_GIORNALIERA_MS = 10 * 6e4;
|
|
337
336
|
var RIPOSO_TICK_MS = 3e4;
|
|
338
337
|
var INATTIVITA_MS = 10 * 6e4;
|
|
339
338
|
var SCADENZA_PERSISTENTE_MS = 30 * 24 * 60 * 6e4;
|
|
@@ -489,15 +488,6 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
489
488
|
schedule(milliseconds, handler, payload) {
|
|
490
489
|
nucleo.pianifica(milliseconds, handler, payload);
|
|
491
490
|
},
|
|
492
|
-
board: {
|
|
493
|
-
submit(player, board, score, options = {}) {
|
|
494
|
-
if (typeof board === "number") {
|
|
495
|
-
const active = nucleo.richiediDati().giocatori.filter((p) => p.role !== "spectator");
|
|
496
|
-
if (nucleo.configurazione.players.max !== 1 || active.length !== 1) throw erroreConCodice("board_player_required", "Specify the player when submitting a multiplayer score.");
|
|
497
|
-
nucleo.accodaPunteggio(active[0].id, player, board, typeof score === "object" ? score : {});
|
|
498
|
-
} else nucleo.accodaPunteggio(idGiocatore(player), board, score, options);
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
491
|
daily,
|
|
502
492
|
time: { now: () => nucleo.adattatore.ora() },
|
|
503
493
|
voice: {
|
|
@@ -961,6 +951,25 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
961
951
|
await this.concludiEvento();
|
|
962
952
|
await this.persistiEProgramma();
|
|
963
953
|
}
|
|
954
|
+
async preparaFlush() {
|
|
955
|
+
const dati = this.richiediDati();
|
|
956
|
+
if (dati.flushInAttesa !== void 0) {
|
|
957
|
+
await this.persistiEProgramma();
|
|
958
|
+
return dati.flushInAttesa;
|
|
959
|
+
}
|
|
960
|
+
if (dati.punteggi.length === 0 && dati.fineInCoda === null) return null;
|
|
961
|
+
dati.flushInAttesa = { id: crypto.randomUUID(), scores: dati.punteggi, ended: dati.fineInCoda };
|
|
962
|
+
dati.punteggi = [];
|
|
963
|
+
dati.fineInCoda = null;
|
|
964
|
+
await this.persistiEProgramma();
|
|
965
|
+
return dati.flushInAttesa;
|
|
966
|
+
}
|
|
967
|
+
async confermaFlush(id) {
|
|
968
|
+
const dati = this.richiediDati();
|
|
969
|
+
if (dati.flushInAttesa?.id !== id) return;
|
|
970
|
+
delete dati.flushInAttesa;
|
|
971
|
+
await this.persistiEProgramma();
|
|
972
|
+
}
|
|
964
973
|
async flush() {
|
|
965
974
|
const dati = this.richiediDati();
|
|
966
975
|
const esito = {
|
|
@@ -1265,45 +1274,6 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1265
1274
|
const day = this.giornata(ora);
|
|
1266
1275
|
return { day, seed: seedGiornata(this.manifest.id, day), expiresAt: prossimaMezzanotteUtc(ora) };
|
|
1267
1276
|
}
|
|
1268
|
-
accodaPunteggio(playerId, board, score, options) {
|
|
1269
|
-
if (!this.richiediDati().giocatori.some((player2) => player2.id === playerId)) {
|
|
1270
|
-
throw new Error("Player not found.");
|
|
1271
|
-
}
|
|
1272
|
-
if (!CHIAVE.test(board)) {
|
|
1273
|
-
throw new TypeError("Board names must use lowercase letters, numbers, underscores, or hyphens.");
|
|
1274
|
-
}
|
|
1275
|
-
if (!Number.isSafeInteger(score) || score < 0) {
|
|
1276
|
-
throw new TypeError("Score must be a non-negative safe integer.");
|
|
1277
|
-
}
|
|
1278
|
-
const submittedAt = this.adattatore.ora();
|
|
1279
|
-
const daily = options.daily === true || options.day !== void 0;
|
|
1280
|
-
let day = daily ? this.giornata(submittedAt) : null;
|
|
1281
|
-
const start = this.manifest.boards?.[board]?.day === "start";
|
|
1282
|
-
if (options.day !== void 0 && (!start || options.daily === false)) {
|
|
1283
|
-
throw erroreConCodice("board_day_policy", "An explicit day requires a start-day board and a daily score.");
|
|
1284
|
-
}
|
|
1285
|
-
if (daily && start) {
|
|
1286
|
-
const run = this.richiediDati().daily;
|
|
1287
|
-
if (options.day === void 0) throw erroreConCodice("board_day_required", "Submit the daily score with room.daily.day.");
|
|
1288
|
-
if (options.day !== run.day) throw erroreConCodice("board_day_mismatch", "The score day must match room.daily.day.");
|
|
1289
|
-
if (submittedAt > run.expiresAt + GRAZIA_GIORNALIERA_MS) throw erroreConCodice("board_day_expired", "The starting day grace period has expired.");
|
|
1290
|
-
day = run.day;
|
|
1291
|
-
}
|
|
1292
|
-
this.richiediDati().punteggi.push({
|
|
1293
|
-
playerId,
|
|
1294
|
-
board,
|
|
1295
|
-
score,
|
|
1296
|
-
daily,
|
|
1297
|
-
submittedAt,
|
|
1298
|
-
day
|
|
1299
|
-
});
|
|
1300
|
-
const player = this.richiediDati().giocatori.find((item) => item.id === playerId);
|
|
1301
|
-
if (player.connected && player.connessione !== null) this.adattatore.invia(player.connessione, {
|
|
1302
|
-
t: "score-queued",
|
|
1303
|
-
score: { player: playerId, board, score, day, submittedAt }
|
|
1304
|
-
});
|
|
1305
|
-
this.broadcast({ t: "flush" });
|
|
1306
|
-
}
|
|
1307
1277
|
richiediFine(result, rematch = false) {
|
|
1308
1278
|
const json = analizzaJson(result);
|
|
1309
1279
|
if (!json.ok) throw new TypeError("Game result must be valid JSON.");
|
|
@@ -2015,6 +1985,12 @@ function creaFacetStanza(DurableObject, definizione, manifest) {
|
|
|
2015
1985
|
flush() {
|
|
2016
1986
|
return this.#serializza((nucleo) => nucleo.flush());
|
|
2017
1987
|
}
|
|
1988
|
+
preparaFlush() {
|
|
1989
|
+
return this.#serializza((nucleo) => nucleo.preparaFlush());
|
|
1990
|
+
}
|
|
1991
|
+
confermaFlush(id) {
|
|
1992
|
+
return this.#serializza((nucleo) => nucleo.confermaFlush(id));
|
|
1993
|
+
}
|
|
2018
1994
|
};
|
|
2019
1995
|
}
|
|
2020
1996
|
export {
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JsonValue, Player, SaveInfo } from './index.js';
|
|
2
2
|
import type { GestoreBiglietto } from './handshake.js';
|
|
3
3
|
export interface RispostaMe {
|
|
4
4
|
player: Omit<Player, 'language' | 'uiLanguage'>;
|
|
@@ -16,11 +16,4 @@ export declare function creaClienteApi(appOrigin: string, fetcher: typeof fetch,
|
|
|
16
16
|
saveGet(key: string): Promise<JsonValue | null>;
|
|
17
17
|
saveRemove(key: string): Promise<void>;
|
|
18
18
|
saveList(): Promise<SaveInfo[]>;
|
|
19
|
-
boardSubmit(board: string, score: number, daily: boolean): Promise<BoardResult>;
|
|
20
|
-
boardTop(board: string, opzioni: {
|
|
21
|
-
day?: string;
|
|
22
|
-
daily?: boolean;
|
|
23
|
-
limit?: number;
|
|
24
|
-
guests?: boolean;
|
|
25
|
-
}): Promise<BoardTop>;
|
|
26
19
|
};
|
|
@@ -8,7 +8,6 @@ export * from './slug.js';
|
|
|
8
8
|
export * from './biglietto.js';
|
|
9
9
|
export * from './token-crew.js';
|
|
10
10
|
export * from './overlay.js';
|
|
11
|
-
export * from './overlay-boards.js';
|
|
12
11
|
export * from './i18n.js';
|
|
13
12
|
export * from './room-limits.js';
|
|
14
13
|
export * from './player.js';
|
|
@@ -105,6 +105,7 @@ export interface Manifest {
|
|
|
105
105
|
voice: Voice;
|
|
106
106
|
modes: ManifestMode[];
|
|
107
107
|
}
|
|
108
|
+
export type GameManifest = Omit<Manifest, 'boards'>;
|
|
108
109
|
export declare const AVVISO_ISOLATED = "isolated has no effect: games run inside the portal page, which is not cross-origin isolated";
|
|
109
110
|
export declare function avvisiManifest(value: unknown): string[];
|
|
110
111
|
export type EsitoManifest = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReplayPlayback } from './replay.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type GameManifest } from './manifest.js';
|
|
3
3
|
export declare const OVERLAY_VERSION: 1;
|
|
4
|
-
export declare const OVERLAY_PANELS: readonly ['home', 'room', 'invite', 'friends', 'voice'
|
|
4
|
+
export declare const OVERLAY_PANELS: readonly ['home', 'room', 'invite', 'friends', 'voice'];
|
|
5
5
|
export type OverlayPanel = typeof OVERLAY_PANELS[number];
|
|
6
6
|
export type ConnectionState = 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'ended' | 'closed' | 'replaced';
|
|
7
7
|
export interface ReservedRect {
|
|
@@ -23,7 +23,7 @@ export interface OverlayView {
|
|
|
23
23
|
shortcutEnabled?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export interface OverlayConfiguration {
|
|
26
|
-
manifest:
|
|
26
|
+
manifest: GameManifest;
|
|
27
27
|
coverUrl: string | null;
|
|
28
28
|
iconUrl: string | null;
|
|
29
29
|
invite: string | null;
|
|
@@ -218,18 +218,13 @@ export type OverlayEvent = {
|
|
|
218
218
|
code: string;
|
|
219
219
|
message: string;
|
|
220
220
|
};
|
|
221
|
-
} | {
|
|
222
|
-
type: 'caisual:overlay-score';
|
|
223
|
-
v: 1;
|
|
224
|
-
epoch: string;
|
|
225
|
-
score: QueuedScore;
|
|
226
221
|
};
|
|
227
222
|
export interface OverlayHello {
|
|
228
223
|
v: 1;
|
|
229
224
|
epoch: string;
|
|
230
225
|
configuration: OverlayConfiguration;
|
|
231
226
|
}
|
|
232
|
-
export declare function overlayConfiguration(manifest:
|
|
227
|
+
export declare function overlayConfiguration(manifest: GameManifest, coverUrl?: string | null, invite?: string | null, iconUrl?: string | null): OverlayConfiguration;
|
|
233
228
|
export declare function record(value: unknown): Record<string, unknown> | null;
|
|
234
229
|
export declare function validOverlayHello(value: unknown): value is OverlayHello;
|
|
235
230
|
export declare function normalizeOverlayHello(value: unknown): OverlayHello | null;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,35 +24,6 @@ export interface SaveInfo {
|
|
|
24
24
|
bytes: number;
|
|
25
25
|
updatedAt: number;
|
|
26
26
|
}
|
|
27
|
-
export interface BoardEntry {
|
|
28
|
-
rank: number;
|
|
29
|
-
name: string;
|
|
30
|
-
score: number;
|
|
31
|
-
guest: boolean;
|
|
32
|
-
me: boolean;
|
|
33
|
-
verified: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface BoardTop {
|
|
36
|
-
day: string | null;
|
|
37
|
-
entries: BoardEntry[];
|
|
38
|
-
me: {
|
|
39
|
-
rank: number;
|
|
40
|
-
score: number;
|
|
41
|
-
verified: boolean;
|
|
42
|
-
} | null;
|
|
43
|
-
}
|
|
44
|
-
export type BoardResult = {
|
|
45
|
-
accepted: true;
|
|
46
|
-
best: number;
|
|
47
|
-
rank: number;
|
|
48
|
-
day: string | null;
|
|
49
|
-
verified: boolean;
|
|
50
|
-
};
|
|
51
|
-
export type BoardOffline = {
|
|
52
|
-
accepted: false;
|
|
53
|
-
reason: 'offline';
|
|
54
|
-
verified: false;
|
|
55
|
-
};
|
|
56
27
|
export type RoomStatus = 'lobby' | 'countdown' | 'playing' | 'finished' | 'ended';
|
|
57
28
|
export interface RoomPlayer {
|
|
58
29
|
id: string;
|
|
@@ -227,17 +198,6 @@ export interface CaisualConnection {
|
|
|
227
198
|
remove(key: string): Promise<void>;
|
|
228
199
|
list(): Promise<SaveInfo[]>;
|
|
229
200
|
};
|
|
230
|
-
board: {
|
|
231
|
-
submit(board: string, score: number, options?: {
|
|
232
|
-
daily?: boolean;
|
|
233
|
-
}): Promise<BoardResult | BoardOffline>;
|
|
234
|
-
top(board: string, options?: {
|
|
235
|
-
daily?: boolean;
|
|
236
|
-
day?: string;
|
|
237
|
-
limit?: number;
|
|
238
|
-
guests?: boolean;
|
|
239
|
-
}): Promise<BoardTop>;
|
|
240
|
-
};
|
|
241
201
|
room: Rooms | ReplayRooms;
|
|
242
202
|
}
|
|
243
203
|
export type BaseConnection = Omit<CaisualConnection, 'device' | 'session' | 'overlay' | 'text' | 'player'> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type OverlayConfiguration, type OverlayOperations, type OverlaySessionState, type
|
|
1
|
+
import { type OverlayConfiguration, type OverlayOperations, type OverlaySessionState, type OverlayPanel } from '../contracts/index.js';
|
|
2
2
|
export interface FinestraHandshake {
|
|
3
3
|
addEventListener(type: 'message', listener: (event: MessageEvent) => void): void;
|
|
4
4
|
removeEventListener(type: 'message', listener: (event: MessageEvent) => void): void;
|
|
@@ -59,7 +59,6 @@ export declare function creaPonteOspite(input: HostBridgeInput): {
|
|
|
59
59
|
message: string;
|
|
60
60
|
};
|
|
61
61
|
}) => void): () => void;
|
|
62
|
-
onScore(listener: (value: QueuedScore) => void): () => void;
|
|
63
62
|
request<K extends keyof OverlayOperations>(op: K, args: OverlayOperations[K]): Promise<void>;
|
|
64
63
|
dispose(): void;
|
|
65
64
|
};
|
|
@@ -85,24 +85,6 @@ declare const words: {
|
|
|
85
85
|
readonly unavailable: readonly ["Unavailable right now", "Non disponibile ora", "No disponible ahora", "Indisponible pour le moment", "Derzeit nicht verfügbar", "Indisponivel agora", "現在利用できません"];
|
|
86
86
|
readonly offline: readonly ["Connection unavailable. Try again.", "Connessione non disponibile. Riprova.", "Sin conexión. Reintenta.", "Connexion indisponible. Réessayez.", "Keine Verbindung. Erneut versuchen.", "Sem conexão. Tente novamente.", "接続できません。もう一度お試しください。"];
|
|
87
87
|
readonly saveFailed: readonly ["Keep the room code. Resume could not be saved.", "Conserva il codice. Riprendi non è stato salvato.", "Guarda el código. No se pudo guardar el regreso.", "Gardez le code. La reprise ne peut pas être enregistrée.", "Raumcode aufbewahren. Fortsetzen nicht gespeichert.", "Guarde o código. O retorno não foi salvo.", "ルームコードを控えてください。再開情報を保存できませんでした。"];
|
|
88
|
-
readonly boards: readonly ["Leaderboard", "Classifica", "Clasificación", "Classement", "Bestenliste", "Classificação", "ランキング"];
|
|
89
|
-
readonly board: readonly ["Board", "Classifica", "Tabla", "Classement", "Bestenliste", "Tabela", "ランキング"];
|
|
90
|
-
readonly daily: readonly ["Daily", "Giornaliera", "Diaria", "Du jour", "Täglich", "Diária", "日別"];
|
|
91
|
-
readonly allTime: readonly ["All time", "Di sempre", "Histórica", "Tous les temps", "Gesamt", "Geral", "全期間"];
|
|
92
|
-
readonly accounts: readonly ["Accounts", "Account", "Cuentas", "Comptes", "Konten", "Contas", "アカウント"];
|
|
93
|
-
readonly guests: readonly ["Guests", "Ospiti", "Invitados", "Invités", "Gäste", "Visitantes", "ゲスト"];
|
|
94
|
-
readonly category: readonly ["Category", "Categoria", "Categoria", "Catégorie", "Kategorie", "Categoria", "区分"];
|
|
95
|
-
readonly period: readonly ["Period", "Periodo", "Período", "Période", "Zeitraum", "Período", "期間"];
|
|
96
|
-
readonly rank: readonly ["Rank", "Posizione", "Puesto", "Rang", "Platz", "Posicao", "順位"];
|
|
97
|
-
readonly score: readonly ["Score", "Punteggio", "Puntos", "Score", "Punkte", "Pontos", "スコア"];
|
|
98
|
-
readonly verified: readonly ["Verified", "Verificato", "Verificado", "Vérifié", "Verifiziert", "Verificado", "確認済み"];
|
|
99
|
-
readonly own: readonly ["Your best", "Il tuo record", "Tu record", "Votre record", "Dein Rekord", "Seu recorde", "自己ベスト"];
|
|
100
|
-
readonly empty: readonly ["No scores yet", "Nessun punteggio", "Aún no hay puntos", "Aucun score", "Noch keine Punkte", "Ainda sem pontos", "まだスコアがありません"];
|
|
101
|
-
readonly saving: readonly ["Saving score...", "Salvataggio punteggio...", "Guardando puntos...", "Enregistrement du score...", "Punkte werden gespeichert...", "Salvando pontos...", "スコアを保存中..."];
|
|
102
|
-
readonly saved: readonly ["Your best is on the board", "Il tuo record è in classifica", "Tu record está en la tabla", "Votre record est au classement", "Dein Rekord ist eingetragen", "Seu recorde está na tabela", "自己ベストがランキングに反映されました"];
|
|
103
|
-
readonly bestAlready: readonly ["Your best is already on the board", "Il tuo record era già in classifica", "Tu record ya estaba en la tabla", "Votre record est déjà au classement", "Dein Rekord ist bereits eingetragen", "Seu recorde já está na tabela", "自己ベストは反映済みです"];
|
|
104
|
-
readonly refresh: readonly ["Refresh", "Aggiorna", "Actualizar", "Actualiser", "Aktualisieren", "Atualizar", "更新"];
|
|
105
|
-
readonly refreshHint: readonly ["Score not visible yet. Refresh to check.", "Punteggio non ancora visibile. Aggiorna per controllare.", "Puntos aún no visibles. Actualiza.", "Score pas encore visible. Actualisez.", "Punkte noch nicht sichtbar. Aktualisieren.", "Pontos ainda não visiveis. Atualize.", "スコアがまだ表示されません。更新して確認してください。"];
|
|
106
88
|
readonly friends: readonly ["Friends & party", "Amici e gruppo", "Amigos y grupo", "Amis et groupe", "Freunde & Gruppe", "Amigos e grupo", "友達とパーティー"];
|
|
107
89
|
readonly localCrew: readonly ["Friends and party are unavailable in local preview.", "Amici e gruppo non disponibili in anteprima locale.", "Amigos y grupo no disponibles en la vista local.", "Amis et groupe indisponibles en aperçu local.", "Freunde und Gruppe in lokaler Vorschau nicht verfügbar.", "Amigos e grupo indisponíveis na prévia local.", "ローカルプレビューでは友達とパーティーは利用できません。"];
|
|
108
90
|
readonly loginCrew: readonly ["Sign in on Caisual to use friends and party.", "Accedi a Caisual per amici e gruppo.", "Inicia sesion para amigos y grupo.", "Connectez-vous pour utiliser amis et groupe.", "Für Freunde und Gruppe bei Caisual anmelden.", "Entre no Caisual para amigos e grupo.", "友達とパーティーを利用するにはCaisualにログインしてください。"];
|
|
@@ -4,7 +4,6 @@ export { overlayConfiguration } from '../contracts/index.js';
|
|
|
4
4
|
export type { OverlayConfiguration, OverlayOperations, OverlaySessionState, OverlayCapabilities, OverlayPanel, OverlayView, OverlayVoice, OverlayVoicePeer } from '../contracts/index.js';
|
|
5
5
|
export { mountOverlay } from './ui.js';
|
|
6
6
|
export type { MountOverlayInput, OverlayCrew, CrewSnapshot } from './ui.js';
|
|
7
|
-
export type { BoardReader, BoardQuery, BoardData } from './boards.js';
|
|
8
7
|
export { overlayLanguage } from './i18n.js';
|
|
9
8
|
export { styles as overlayStyles } from './styles.js';
|
|
10
9
|
export { overlayLocale } from './i18n.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const styles = "\n.game-icon{width:28px;height:28px;aspect-ratio:1;object-fit:contain;border-radius:7px;flex:none;vertical-align:middle}.game-icon-title{width:36px;height:36px;border-radius:10px}\n.safe-area-probe{position:fixed;visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}\n:host{all:initial;position:fixed;inset:0;z-index:10000;pointer-events:none;font:15px/1.45 system-ui,sans-serif;color:#f4f4f1;color-scheme:dark;--accent:#a8efc5}\n[data-layout],[data-surface],.sr{pointer-events:none}*{box-sizing:border-box}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}button,select,input{border:1px solid #ffffff30;background:#25292b;color:inherit;border-radius:12px;min-height:44px;padding:10px 14px}button{cursor:pointer}button:disabled{opacity:.45;cursor:default}button:hover:not(:disabled){background:#343b3a}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--accent);outline-offset:3px}a{color:var(--accent)}.primary{background:var(--accent);color:var(--accent-ink,#11221b);border-color:transparent;font-weight:700}.primary:hover:not(:disabled){filter:brightness(1.1);background:var(--accent)}.quiet{background:transparent}label{display:grid;gap:6px;text-align:left}select,input{width:100%;min-width:0}h1,h2,p{margin:0}h1{font-size:clamp(26px,5vw,42px);line-height:1.1;letter-spacing:-.035em}h2{font-size:20px}small,.muted{color:#bdc5c1}.stack{display:grid;gap:16px}.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.row>*{flex:0 1 auto}.row .grow,.grow{flex:1}.split{display:grid;grid-template-columns:1fr 1fr;gap:10px}.pill{position:absolute;top:max(10px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));display:flex;height:44px;border:1px solid #ffffff35;border-radius:24px;background:#171e20eF;box-shadow:0 4px 20px #0004;pointer-events:auto;overflow:hidden}.pill button{border:0;border-radius:0;padding:8px 13px;background:transparent}.pill button:focus-visible{outline-offset:-4px}.pill small{margin-left:8px}.backdrop{position:absolute;inset:0;background:#0b151ce8;backdrop-filter:blur(10px);pointer-events:auto;display:grid;place-items:center;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow:auto}.backdrop.home{background-color:#142127;background-size:contain;background-repeat:no-repeat;background-position:center}.dialog{position:relative;width:min(100%,540px);max-height:100%;overflow:auto;overscroll-behavior:contain;background:#141b1df5;border:1px solid #ffffff25;border-radius:22px;padding:24px;box-shadow:0 20px 80px #0005}.dialog.wide{width:min(100%,700px)}.top{display:flex;align-items:center;gap:12px;margin-bottom:18px}.top h2{flex:1}.tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid #ffffff25;padding-bottom:12px}.tabs button{min-height:36px;padding:6px 10px}.tabs [aria-current=true]{border-color:var(--accent)}.roster{list-style:none;padding:0;margin:0;display:grid;gap:8px;max-height:32dvh;overflow:auto}.roster li{display:flex;align-items:center;gap:8px;padding:10px;background:#ffffff08;border-radius:10px}.roster .name{flex:1;overflow-wrap:anywhere}.badge{border:1px solid #ffffff30;border-radius:6px;padding:2px 6px;font-size:12px}.code{font-size:24px;letter-spacing:.13em;font-variant-numeric:tabular-nums}.notice,.error{border-radius:10px;padding:10px;background:#a8efc514;overflow-wrap:anywhere}.error{background:#ff8b7720;color:#ffd2c9}.countdown{font-size:88px;line-height:1;text-align:center;font-variant-numeric:tabular-nums}.ended{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);max-width:calc(100% - 24px);width:max-content;background:#171e20f5;pointer-events:auto;border:1px solid #ffffff30;border-radius:16px;padding:10px;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}.ended [data-rematch-players]{max-width:100%;max-height:3.2em;overflow:auto;overflow-wrap:anywhere}.standings{list-style:none;margin:0;padding:0;flex-basis:100%;max-height:20dvh;overflow:auto;font-size:13px}.standings li{display:flex;justify-content:space-between;gap:16px;overflow-wrap:anywhere}.ended{max-height:calc(100dvh - 80px);overflow:auto}.ended strong{padding:0 8px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.table-wrap{overflow:auto;max-height:38dvh}table{width:100%;border-collapse:collapse;text-align:left}th,td{padding:9px 6px;border-bottom:1px solid #ffffff20}td:nth-child(3){text-align:right}td small{display:block}.self{background:#ffffff0a}.checkbox{display:flex;align-items:center;gap:8px;font-size:13px}.checkbox input{width:18px;min-height:18px}.full{width:100%}\n.game-heading{display:flex;align-items:center;gap:12px;min-width:0;flex:1}.game-heading h1{font-size:28px;overflow-wrap:anywhere}.home .top{margin-bottom:12px}.game-description{font-size:13px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.experience-tabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border:1px solid #ffffff18;border-radius:14px;background:#0003}.experience-tabs button{background:transparent;border-color:transparent;font-size:14px;font-weight:600;padding:10px 8px;border-radius:10px;color:#bdc5c1}.experience-tabs [aria-selected=true]{background:#ffffff16;color:#f4f4f1;box-shadow:0 1px 4px #0003}.experience-tabs button:focus-visible{outline-offset:-3px}.home-content{gap:14px;min-width:0}.mode-details{display:grid;gap:6px;min-width:0}.mode-details h2{font-size:16px;font-weight:600}.mode-details label{font-size:13px}.mode-instructions{font-size:12px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.play-actions{gap:8px}.play-actions .primary{min-height:50px;font-size:16px}.home-links{gap:4px}.home-links button{border-color:transparent;font-size:13px}.home-links button:hover:not(:disabled){background:#ffffff0a}.resume-action{gap:4px}.resume-action small{text-align:center}.panel-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:18px;padding-top:10px;border-top:1px solid #ffffff18;color:#bdc5c1}.panel-footer .checkbox{font-size:11px;white-space:nowrap;min-height:32px;gap:6px}.panel-footer input{margin:0;accent-color:var(--accent);width:14px;min-height:14px}.panel-footer small{min-width:0;text-align:right;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:uppercase}\n[hidden]{display:none!important}.voice-peers{list-style:none;margin:0;padding:0;display:grid;gap:10px}.voice-peers li{border:1px solid #ffffff25;border-radius:12px;padding:12px;display:grid;gap:8px}.voice-peers [data-speaking=true]{border-color:var(--accent)}.voice-peers input{width:100%;accent-color:var(--accent);padding:0}.voice-peers label{font-size:13px}.pill .voice-toggle{width:44px;padding:8px}.voice-toggle[data-voice-state=on][data-muted=false]{color:var(--accent)}\n.boot{position:absolute;inset:0;z-index:2;isolation:isolate;display:grid;place-items:center;overflow:auto;overscroll-behavior:contain;padding:max(100px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(48px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));background:#0b151c;opacity:1;transition:opacity .4s ease;pointer-events:auto;outline:none}\n.boot::before,.boot::after{content:\"\";position:fixed;inset:0;pointer-events:none;z-index:-1}.boot::before{background:radial-gradient(ellipse at 50% 38%,color-mix(in srgb,var(--accent),transparent 80%),transparent 65%)}.boot::after{background:radial-gradient(ellipse at 50% 38%,#0b151c20,#0b151cd9 85%),linear-gradient(#0b151c66,#0b151cbf)}\n.boot-cover{position:fixed;inset:0;z-index:-2;width:100%;height:100%;aspect-ratio:3 / 2;object-fit:contain;filter:blur(20px);opacity:.65;pointer-events:none}\n.boot-brand{position:absolute;top:max(28px,env(safe-area-inset-top));left:max(32px,env(safe-area-inset-left));display:flex;align-items:center;gap:10px;font-size:14px;font-weight:650;letter-spacing:.02em;color:#f4f4f1b3}.boot-brand span{display:grid;place-items:center;width:36px;height:36px;border:1px solid #ffffff25;border-radius:12px;background:#171e20af;box-shadow:0 4px 20px #0004;color:var(--boot-accent);font-size:20px;font-weight:800}\n.boot-content{width:min(100%,900px);text-align:center;display:grid;justify-items:center;gap:24px}.boot h1{max-width:16ch;font-size:clamp(44px,8vw,108px);font-weight:800;line-height:1.04;letter-spacing:-.05em;overflow-wrap:anywhere;text-wrap:balance;color:var(--boot-accent);text-shadow:0 20px 80px #0005}\n.boot-progress{width:112px;height:3px;border-radius:12px;background:#ffffff20;overflow:hidden;margin-top:12px}.boot-progress span{display:block;width:44%;height:100%;border-radius:inherit;background:var(--boot-accent);animation:boot-progress 1.8s ease-in-out infinite}.boot-status{max-width:42ch;min-height:3em;font-size:14px;line-height:1.5;color:#d3dad6;text-wrap:balance}.boot-recovery{min-height:44px}.boot-recovery .row{justify-content:center}.boot-leaving{opacity:0;pointer-events:none}\n@keyframes boot-progress{0%{transform:translateX(-110%)}100%{transform:translateX(340%)}}\n@media(max-width:480px){.dialog{padding:18px;border-radius:18px}.split{grid-template-columns:1fr 1fr;gap:8px}.tabs{gap:4px}.tabs button{font-size:13px;padding:6px 8px}.pill button:focus-visible{outline-offset:-4px}.pill small{display:none}.ended{gap:6px}.standings{list-style:none;margin:0;padding:0;flex-basis:100%;max-height:20dvh;overflow:auto;font-size:13px}.standings li{display:flex;justify-content:space-between;gap:16px;overflow-wrap:anywhere}.ended{max-height:calc(100dvh - 80px);overflow:auto}.ended strong{font-size:13px}.ended button{padding:8px 10px;font-size:13px}.roster{max-height:28dvh}}\n.replay-controls{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:12px;right:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:12px;background:#141b1df5;border:1px solid #ffffff30;border-radius:16px;pointer-events:auto}.replay-position{flex:1;min-width:100px}.replay-controls label{font-size:12px}.replay-controls span{font-variant-numeric:tabular-nums;font-size:13px}.replay-link{display:inline-flex;align-items:center;min-height:44px;padding:10px 14px;border-radius:12px;text-decoration:none}\n@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}.boot{transition:none}.boot-progress span{animation:none;transform:translateX(65%)}}\n";
|
|
1
|
+
export declare const styles = "\n.game-icon{width:28px;height:28px;aspect-ratio:1;object-fit:contain;border-radius:7px;flex:none;vertical-align:middle}.game-icon-title{width:36px;height:36px;border-radius:10px}\n.safe-area-probe{position:fixed;visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}\n:host{all:initial;position:fixed;inset:0;z-index:10000;pointer-events:none;font:15px/1.45 system-ui,sans-serif;color:#f4f4f1;color-scheme:dark;--accent:#a8efc5}\n[data-layout],[data-surface],.sr{pointer-events:none}*{box-sizing:border-box}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}button,select,input{border:1px solid #ffffff30;background:#25292b;color:inherit;border-radius:12px;min-height:44px;padding:10px 14px}button{cursor:pointer}button:disabled{opacity:.45;cursor:default}button:hover:not(:disabled){background:#343b3a}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--accent);outline-offset:3px}a{color:var(--accent)}.primary{background:var(--accent);color:var(--accent-ink,#11221b);border-color:transparent;font-weight:700}.primary:hover:not(:disabled){filter:brightness(1.1);background:var(--accent)}.quiet{background:transparent}label{display:grid;gap:6px;text-align:left}select,input{width:100%;min-width:0}h1,h2,p{margin:0}h1{font-size:clamp(26px,5vw,42px);line-height:1.1;letter-spacing:-.035em}h2{font-size:20px}small,.muted{color:#bdc5c1}.stack{display:grid;gap:16px}.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.row>*{flex:0 1 auto}.row .grow,.grow{flex:1}.split{display:grid;grid-template-columns:1fr 1fr;gap:10px}.pill{position:absolute;top:max(10px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));display:flex;height:44px;border:1px solid #ffffff35;border-radius:24px;background:#171e20eF;box-shadow:0 4px 20px #0004;pointer-events:auto;overflow:hidden}.pill button{border:0;border-radius:0;padding:8px 13px;background:transparent}.pill button:focus-visible{outline-offset:-4px}.pill small{margin-left:8px}.backdrop{position:absolute;inset:0;background:#0b151ce8;backdrop-filter:blur(10px);pointer-events:auto;display:grid;place-items:center;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow:auto}.backdrop.home{background-color:#142127;background-size:contain;background-repeat:no-repeat;background-position:center}.dialog{position:relative;width:min(100%,540px);max-height:100%;overflow:auto;overscroll-behavior:contain;background:#141b1df5;border:1px solid #ffffff25;border-radius:22px;padding:24px;box-shadow:0 20px 80px #0005}.dialog.wide{width:min(100%,700px)}.top{display:flex;align-items:center;gap:12px;margin-bottom:18px}.top h2{flex:1}.tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid #ffffff25;padding-bottom:12px}.tabs button{min-height:36px;padding:6px 10px}.tabs [aria-current=true]{border-color:var(--accent)}.roster{list-style:none;padding:0;margin:0;display:grid;gap:8px;max-height:32dvh;overflow:auto}.roster li{display:flex;align-items:center;gap:8px;padding:10px;background:#ffffff08;border-radius:10px}.roster .name{flex:1;overflow-wrap:anywhere}.badge{border:1px solid #ffffff30;border-radius:6px;padding:2px 6px;font-size:12px}.code{font-size:24px;letter-spacing:.13em;font-variant-numeric:tabular-nums}.notice,.error{border-radius:10px;padding:10px;background:#a8efc514;overflow-wrap:anywhere}.error{background:#ff8b7720;color:#ffd2c9}.countdown{font-size:88px;line-height:1;text-align:center;font-variant-numeric:tabular-nums}.ended{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);max-width:calc(100% - 24px);width:max-content;background:#171e20f5;pointer-events:auto;border:1px solid #ffffff30;border-radius:16px;padding:10px;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}.ended [data-rematch-players]{max-width:100%;max-height:3.2em;overflow:auto;overflow-wrap:anywhere}.standings{list-style:none;margin:0;padding:0;flex-basis:100%;max-height:20dvh;overflow:auto;font-size:13px}.standings li{display:flex;justify-content:space-between;gap:16px;overflow-wrap:anywhere}.ended{max-height:calc(100dvh - 80px);overflow:auto}.ended strong{padding:0 8px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.checkbox{display:flex;align-items:center;gap:8px;font-size:13px}.checkbox input{width:18px;min-height:18px}.full{width:100%}\n.game-heading{display:flex;align-items:center;gap:12px;min-width:0;flex:1}.game-heading h1{font-size:28px;overflow-wrap:anywhere}.home .top{margin-bottom:12px}.game-description{font-size:13px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.experience-tabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border:1px solid #ffffff18;border-radius:14px;background:#0003}.experience-tabs button{background:transparent;border-color:transparent;font-size:14px;font-weight:600;padding:10px 8px;border-radius:10px;color:#bdc5c1}.experience-tabs [aria-selected=true]{background:#ffffff16;color:#f4f4f1;box-shadow:0 1px 4px #0003}.experience-tabs button:focus-visible{outline-offset:-3px}.home-content{gap:14px;min-width:0}.mode-details{display:grid;gap:6px;min-width:0}.mode-details h2{font-size:16px;font-weight:600}.mode-details label{font-size:13px}.mode-instructions{font-size:12px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.play-actions{gap:8px}.play-actions .primary{min-height:50px;font-size:16px}.home-links{gap:4px}.home-links button{border-color:transparent;font-size:13px}.home-links button:hover:not(:disabled){background:#ffffff0a}.resume-action{gap:4px}.resume-action small{text-align:center}.panel-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:18px;padding-top:10px;border-top:1px solid #ffffff18;color:#bdc5c1}.panel-footer .checkbox{font-size:11px;white-space:nowrap;min-height:32px;gap:6px}.panel-footer input{margin:0;accent-color:var(--accent);width:14px;min-height:14px}.panel-footer small{min-width:0;text-align:right;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:uppercase}\n[hidden]{display:none!important}.voice-peers{list-style:none;margin:0;padding:0;display:grid;gap:10px}.voice-peers li{border:1px solid #ffffff25;border-radius:12px;padding:12px;display:grid;gap:8px}.voice-peers [data-speaking=true]{border-color:var(--accent)}.voice-peers input{width:100%;accent-color:var(--accent);padding:0}.voice-peers label{font-size:13px}.pill .voice-toggle{width:44px;padding:8px}.voice-toggle[data-voice-state=on][data-muted=false]{color:var(--accent)}\n.boot{position:absolute;inset:0;z-index:2;isolation:isolate;display:grid;place-items:center;overflow:auto;overscroll-behavior:contain;padding:max(100px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(48px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));background:#0b151c;opacity:1;transition:opacity .4s ease;pointer-events:auto;outline:none}\n.boot::before,.boot::after{content:\"\";position:fixed;inset:0;pointer-events:none;z-index:-1}.boot::before{background:radial-gradient(ellipse at 50% 38%,color-mix(in srgb,var(--accent),transparent 80%),transparent 65%)}.boot::after{background:radial-gradient(ellipse at 50% 38%,#0b151c20,#0b151cd9 85%),linear-gradient(#0b151c66,#0b151cbf)}\n.boot-cover{position:fixed;inset:0;z-index:-2;width:100%;height:100%;aspect-ratio:3 / 2;object-fit:contain;filter:blur(20px);opacity:.65;pointer-events:none}\n.boot-brand{position:absolute;top:max(28px,env(safe-area-inset-top));left:max(32px,env(safe-area-inset-left));display:flex;align-items:center;gap:10px;font-size:14px;font-weight:650;letter-spacing:.02em;color:#f4f4f1b3}.boot-brand span{display:grid;place-items:center;width:36px;height:36px;border:1px solid #ffffff25;border-radius:12px;background:#171e20af;box-shadow:0 4px 20px #0004;color:var(--boot-accent);font-size:20px;font-weight:800}\n.boot-content{width:min(100%,900px);text-align:center;display:grid;justify-items:center;gap:24px}.boot h1{max-width:16ch;font-size:clamp(44px,8vw,108px);font-weight:800;line-height:1.04;letter-spacing:-.05em;overflow-wrap:anywhere;text-wrap:balance;color:var(--boot-accent);text-shadow:0 20px 80px #0005}\n.boot-progress{width:112px;height:3px;border-radius:12px;background:#ffffff20;overflow:hidden;margin-top:12px}.boot-progress span{display:block;width:44%;height:100%;border-radius:inherit;background:var(--boot-accent);animation:boot-progress 1.8s ease-in-out infinite}.boot-status{max-width:42ch;min-height:3em;font-size:14px;line-height:1.5;color:#d3dad6;text-wrap:balance}.boot-recovery{min-height:44px}.boot-recovery .row{justify-content:center}.boot-leaving{opacity:0;pointer-events:none}\n@keyframes boot-progress{0%{transform:translateX(-110%)}100%{transform:translateX(340%)}}\n@media(max-width:480px){.dialog{padding:18px;border-radius:18px}.split{grid-template-columns:1fr 1fr;gap:8px}.tabs{gap:4px}.tabs button{font-size:13px;padding:6px 8px}.pill button:focus-visible{outline-offset:-4px}.pill small{display:none}.ended{gap:6px}.standings{list-style:none;margin:0;padding:0;flex-basis:100%;max-height:20dvh;overflow:auto;font-size:13px}.standings li{display:flex;justify-content:space-between;gap:16px;overflow-wrap:anywhere}.ended{max-height:calc(100dvh - 80px);overflow:auto}.ended strong{font-size:13px}.ended button{padding:8px 10px;font-size:13px}.roster{max-height:28dvh}}\n.replay-controls{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:12px;right:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:12px;background:#141b1df5;border:1px solid #ffffff30;border-radius:16px;pointer-events:auto}.replay-position{flex:1;min-width:100px}.replay-controls label{font-size:12px}.replay-controls span{font-variant-numeric:tabular-nums;font-size:13px}.replay-link{display:inline-flex;align-items:center;min-height:44px;padding:10px 14px;border-radius:12px;text-decoration:none}\n@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}.boot{transition:none}.boot-progress span{animation:none;transform:translateX(65%)}}\n";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Manifest, type OverlayPanel, type OverlaySessionState } from '../contracts/index.js';
|
|
1
|
+
import { type GameManifest as Manifest, type OverlayPanel, type OverlaySessionState } from '../contracts/index.js';
|
|
2
2
|
export type Phase = 'boot' | 'home' | 'attaching' | 'matching' | 'lobby' | 'countdown' | 'playing' | 'ended' | 'watching' | 'error';
|
|
3
3
|
export type Panel = OverlayPanel | 'join' | 'watch' | 'exit';
|
|
4
4
|
export interface UiModel {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type OverlayConfiguration } from '../contracts/index.js';
|
|
2
2
|
import { type HostBridge } from './host-bridge.js';
|
|
3
|
-
import { type BoardReader } from './boards.js';
|
|
4
3
|
export interface CrewPerson {
|
|
5
4
|
id: string;
|
|
6
5
|
name: string;
|
|
@@ -73,7 +72,6 @@ export interface MountOverlayInput {
|
|
|
73
72
|
exit(): void;
|
|
74
73
|
inviteUrl(code: string): string;
|
|
75
74
|
replayUrl?(id: string): string;
|
|
76
|
-
boards?: BoardReader;
|
|
77
75
|
crew?: OverlayCrew;
|
|
78
76
|
}
|
|
79
77
|
export declare function mountOverlay(input: MountOverlayInput): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Manifest, OverlaySessionState, OverlayVoice } from '../contracts/index.js';
|
|
1
|
+
import type { GameManifest as Manifest, OverlaySessionState, OverlayVoice } from '../contracts/index.js';
|
|
2
2
|
import { type translator } from './i18n.js';
|
|
3
3
|
type Translate = ReturnType<typeof translator>;
|
|
4
4
|
export declare function voiceEligible(manifest: Manifest, session: OverlaySessionState | null): boolean;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { FotografiaStanza } from '../protocollo.js';
|
|
2
2
|
import type { GameDefinition, JsonValue, RoomStatus } from '../server/index.js';
|
|
3
3
|
export interface RoomManifest {
|
|
4
|
-
boards?: Record<string, {
|
|
5
|
-
source: 'client' | 'server';
|
|
6
|
-
day?: 'submit' | 'start';
|
|
7
|
-
}>;
|
|
8
4
|
id: string;
|
|
9
5
|
players: {
|
|
10
6
|
min: number;
|
|
@@ -107,6 +103,10 @@ export interface FacetStanza {
|
|
|
107
103
|
tick(): Promise<Esito>;
|
|
108
104
|
sveglia(): Promise<Esito>;
|
|
109
105
|
flush(): Promise<EsitoFlush>;
|
|
106
|
+
preparaFlush(): Promise<(EsitoFlush & {
|
|
107
|
+
id: string;
|
|
108
|
+
}) | null>;
|
|
109
|
+
confermaFlush(id: string): Promise<void>;
|
|
110
110
|
}
|
|
111
111
|
export interface StorageFacet {
|
|
112
112
|
get<T>(chiave: string): Promise<T | undefined>;
|
|
@@ -47,16 +47,6 @@ export interface Room<State extends JsonValue = JsonValue> {
|
|
|
47
47
|
load(key: string): Promise<JsonValue | null>;
|
|
48
48
|
readonly shared: SharedGameStore;
|
|
49
49
|
schedule(milliseconds: number, handler: string, payload: JsonValue): void;
|
|
50
|
-
readonly board: {
|
|
51
|
-
submit(board: string, score: number, options?: {
|
|
52
|
-
daily?: boolean;
|
|
53
|
-
day?: string;
|
|
54
|
-
}): void;
|
|
55
|
-
submit(player: Player | string, board: string, score: number, options?: {
|
|
56
|
-
daily?: boolean;
|
|
57
|
-
day?: string;
|
|
58
|
-
}): void;
|
|
59
|
-
};
|
|
60
50
|
readonly daily: {
|
|
61
51
|
readonly day: string;
|
|
62
52
|
readonly seed: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReplayClient } from '../replay/index.js';
|
|
2
|
-
import { type OverlayCapabilities, type OverlayConfiguration, type OverlayPanel, type OverlayRequest, type OverlaySessionState, type OverlayView
|
|
2
|
+
import { type OverlayCapabilities, type OverlayConfiguration, type OverlayPanel, type OverlayRequest, type OverlaySessionState, type OverlayView } from '../contracts/index.js';
|
|
3
3
|
import type { BaseConnection, Room, Rooms, ReplayRooms, Spectate } from '../index.js';
|
|
4
4
|
export type GameSession = {
|
|
5
5
|
kind: 'idle';
|
|
@@ -43,7 +43,6 @@ export declare function createSession(base: BaseConnection, configuration?: Over
|
|
|
43
43
|
message: string;
|
|
44
44
|
};
|
|
45
45
|
}) => void): () => void;
|
|
46
|
-
onScore(listener: (value: QueuedScore) => void): () => void;
|
|
47
46
|
execute(request: OverlayRequest): Promise<void>;
|
|
48
47
|
dispose(): void;
|
|
49
48
|
};
|
|
@@ -34,6 +34,10 @@ export declare class NucleoStanza {
|
|
|
34
34
|
ricevi(connessione: string, frame: string, limiteVerificato?: boolean): Promise<void>;
|
|
35
35
|
eseguiTick(): Promise<void>;
|
|
36
36
|
sveglia(): Promise<void>;
|
|
37
|
+
preparaFlush(): Promise<(EsitoFlush & {
|
|
38
|
+
id: string;
|
|
39
|
+
}) | null>;
|
|
40
|
+
confermaFlush(id: string): Promise<void>;
|
|
37
41
|
flush(): Promise<EsitoFlush>;
|
|
38
42
|
riconciliaConnessioni(): Promise<void>;
|
|
39
43
|
private ruoloAutomatico;
|
|
@@ -58,7 +62,6 @@ export declare class NucleoStanza {
|
|
|
58
62
|
private pianifica;
|
|
59
63
|
private giornata;
|
|
60
64
|
private contestoGiornaliero;
|
|
61
|
-
private accodaPunteggio;
|
|
62
65
|
private richiediFine;
|
|
63
66
|
private salva;
|
|
64
67
|
private caricaSave;
|
|
@@ -9,10 +9,6 @@ export interface ManifestStanza {
|
|
|
9
9
|
lobby: boolean;
|
|
10
10
|
persistent?: boolean;
|
|
11
11
|
replays?: boolean;
|
|
12
|
-
boards?: Record<string, {
|
|
13
|
-
source: 'client' | 'server';
|
|
14
|
-
day?: 'submit' | 'start';
|
|
15
|
-
}>;
|
|
16
12
|
roles: Array<{
|
|
17
13
|
id: string;
|
|
18
14
|
min: number;
|
|
@@ -115,6 +111,9 @@ export interface StatoPersistito {
|
|
|
115
111
|
prossimoTimerId: number;
|
|
116
112
|
punteggi: PunteggioPersistito[];
|
|
117
113
|
fineInCoda: FinePersistita | null;
|
|
114
|
+
flushInAttesa?: EsitoFlush & {
|
|
115
|
+
id: string;
|
|
116
|
+
};
|
|
118
117
|
vuotaDa: number | null;
|
|
119
118
|
cancellaDopoFlush: boolean;
|
|
120
119
|
tickSincronizzato: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caisual/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Client and server kit for Caisual games",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://caisual.com",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"multiplayer",
|
|
11
11
|
"game-kit",
|
|
12
12
|
"websocket",
|
|
13
|
-
"rooms"
|
|
14
|
-
"leaderboards"
|
|
13
|
+
"rooms"
|
|
15
14
|
],
|
|
16
15
|
"author": "Damiano Rodriguez",
|
|
17
16
|
"type": "module",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Manifest } from './manifest.js';
|
|
2
|
-
export declare function overlayBoardError(manifest: Manifest, board: string, params: URLSearchParams): string | null;
|
|
3
|
-
export declare function overlayReadOrigin(origin: string | null, site: string | null, expected: string): boolean;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { type Manifest, type QueuedScore } from '../contracts/index.js';
|
|
2
|
-
export interface BoardQuery {
|
|
3
|
-
board: string;
|
|
4
|
-
period: 'daily' | 'all-time';
|
|
5
|
-
guests: boolean;
|
|
6
|
-
day?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface BoardData {
|
|
9
|
-
day: string | null;
|
|
10
|
-
entries: {
|
|
11
|
-
rank: number;
|
|
12
|
-
name: string;
|
|
13
|
-
guest: boolean;
|
|
14
|
-
me: boolean;
|
|
15
|
-
score: number;
|
|
16
|
-
verified: boolean;
|
|
17
|
-
}[];
|
|
18
|
-
me: {
|
|
19
|
-
rank: number;
|
|
20
|
-
score: number;
|
|
21
|
-
verified: boolean;
|
|
22
|
-
} | null;
|
|
23
|
-
ownGuest: boolean;
|
|
24
|
-
}
|
|
25
|
-
export type BoardReader = (query: BoardQuery) => Promise<BoardData>;
|
|
26
|
-
export type Saving = 'saving' | 'saved' | 'bestAlready' | 'refreshHint';
|
|
27
|
-
export declare function createBoardController(input: {
|
|
28
|
-
manifest: Manifest;
|
|
29
|
-
player: string;
|
|
30
|
-
guests?: boolean;
|
|
31
|
-
read: BoardReader;
|
|
32
|
-
changed(): void;
|
|
33
|
-
later?: (callback: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
34
|
-
clear?: (timer: ReturnType<typeof setTimeout>) => void;
|
|
35
|
-
}): {
|
|
36
|
-
readonly state: {
|
|
37
|
-
query: BoardQuery | null;
|
|
38
|
-
data: BoardData | null;
|
|
39
|
-
loading: boolean;
|
|
40
|
-
error: boolean;
|
|
41
|
-
saving: Saving | null;
|
|
42
|
-
};
|
|
43
|
-
select(next: BoardQuery): void;
|
|
44
|
-
queued(score: QueuedScore): void;
|
|
45
|
-
refresh: () => Promise<void>;
|
|
46
|
-
reset(): void;
|
|
47
|
-
dispose(): void;
|
|
48
|
-
};
|