@caisual/kit 0.10.0 → 0.13.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/dist/kit.js +196 -24
- package/dist/node.js +77 -18
- package/dist/overlay.js +134 -35
- package/dist/runtime.js +79 -18
- package/dist/types/api.d.ts +1 -0
- package/dist/types/contracts/biglietto.d.ts +3 -2
- package/dist/types/contracts/immagine.d.ts +27 -0
- package/dist/types/contracts/index.d.ts +3 -0
- package/dist/types/contracts/manifest.d.ts +4 -1
- package/dist/types/contracts/match-result.d.ts +16 -0
- package/dist/types/contracts/overlay.d.ts +7 -1
- package/dist/types/contracts/versioni.d.ts +18 -0
- package/dist/types/daily.d.ts +14 -0
- package/dist/types/errors.d.ts +2 -2
- package/dist/types/handshake.d.ts +2 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/types/node/index.d.ts +4 -0
- package/dist/types/overlay/host-bridge.d.ts +6 -1
- package/dist/types/overlay/i18n.d.ts +9 -0
- package/dist/types/overlay/styles.d.ts +1 -1
- package/dist/types/overlay/ui-model.d.ts +4 -0
- package/dist/types/overlay/ui.d.ts +2 -0
- package/dist/types/protocollo.d.ts +8 -0
- package/dist/types/runtime/index.d.ts +4 -0
- package/dist/types/server/index.d.ts +12 -1
- package/dist/types/session/index.d.ts +1 -1
- package/dist/types/stanza/nucleo.d.ts +3 -0
- package/dist/types/stanza/tipi.d.ts +11 -0
- package/dist/types/stanza-client/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// src/daily.ts
|
|
2
|
+
function prossimaMezzanotteUtc(ora) {
|
|
3
|
+
return (Math.floor(ora / 864e5) + 1) * 864e5;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// ../contracts/src/slug.ts
|
|
2
7
|
var NOMI_RISERVATI = [
|
|
3
8
|
"www",
|
|
@@ -321,6 +326,7 @@ var GRAZIA_MS = 6e4;
|
|
|
321
326
|
var STANZA_VUOTA_MS = 5 * 6e4;
|
|
322
327
|
var ATTESA_RIVINCITA_MS = 2 * 6e4;
|
|
323
328
|
var COUNTDOWN_MS = 3e3;
|
|
329
|
+
var GRAZIA_GIORNALIERA_MS = 10 * 6e4;
|
|
324
330
|
var RIPOSO_TICK_MS = 3e4;
|
|
325
331
|
var INATTIVITA_MS = 10 * 6e4;
|
|
326
332
|
var SCADENZA_PERSISTENTE_MS = 30 * 24 * 60 * 6e4;
|
|
@@ -383,10 +389,13 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
383
389
|
const nucleo = this;
|
|
384
390
|
const daily = {
|
|
385
391
|
get day() {
|
|
386
|
-
return nucleo.
|
|
392
|
+
return nucleo.richiediDati().daily.day;
|
|
387
393
|
},
|
|
388
394
|
get seed() {
|
|
389
|
-
return
|
|
395
|
+
return nucleo.richiediDati().daily.seed;
|
|
396
|
+
},
|
|
397
|
+
get expiresAt() {
|
|
398
|
+
return nucleo.richiediDati().daily.expiresAt;
|
|
390
399
|
}
|
|
391
400
|
};
|
|
392
401
|
this.room = {
|
|
@@ -441,7 +450,7 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
441
450
|
nucleo.impostaSquadraDalServer(idGiocatore(player), team);
|
|
442
451
|
},
|
|
443
452
|
end(result, options) {
|
|
444
|
-
nucleo.richiediFine(result, options?.rematch
|
|
453
|
+
nucleo.richiediFine(result, options?.rematch ?? false);
|
|
445
454
|
},
|
|
446
455
|
save(key, value) {
|
|
447
456
|
return nucleo.salva(key, value);
|
|
@@ -471,7 +480,11 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
471
480
|
},
|
|
472
481
|
board: {
|
|
473
482
|
submit(player, board, score, options = {}) {
|
|
474
|
-
|
|
483
|
+
if (typeof board === "number") {
|
|
484
|
+
const active = nucleo.richiediDati().giocatori.filter((p) => p.role !== "spectator");
|
|
485
|
+
if (nucleo.configurazione.players.max !== 1 || active.length !== 1) throw erroreConCodice("board_player_required", "Specify the player when submitting a multiplayer score.");
|
|
486
|
+
nucleo.accodaPunteggio(active[0].id, player, board, typeof score === "object" ? score : {});
|
|
487
|
+
} else nucleo.accodaPunteggio(idGiocatore(player), board, score, options);
|
|
475
488
|
}
|
|
476
489
|
},
|
|
477
490
|
daily,
|
|
@@ -502,7 +515,8 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
502
515
|
if (salvato !== void 0) {
|
|
503
516
|
nucleo.dati = salvato;
|
|
504
517
|
nucleo.tickRateSincronizzato = salvato.tickRate;
|
|
505
|
-
const daAggiornare = salvato.ultimoInputAt === void 0 || salvato.ultimoCambioStatoAt === void 0;
|
|
518
|
+
const daAggiornare = salvato.ultimoInputAt === void 0 || salvato.ultimoCambioStatoAt === void 0 || salvato.daily === void 0;
|
|
519
|
+
salvato.daily ??= nucleo.contestoGiornaliero();
|
|
506
520
|
salvato.ultimoInputAt ??= adattatore.ora();
|
|
507
521
|
salvato.ultimoCambioStatoAt ??= salvato.ultimoInputAt;
|
|
508
522
|
nucleo.ultimoStatoOsservato = JSON.stringify(salvato.state);
|
|
@@ -534,6 +548,7 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
534
548
|
const ora = this.adattatore.ora();
|
|
535
549
|
this.dati = {
|
|
536
550
|
versione: 1,
|
|
551
|
+
daily: this.contestoGiornaliero(ora),
|
|
537
552
|
id,
|
|
538
553
|
mode,
|
|
539
554
|
status: "lobby",
|
|
@@ -576,7 +591,8 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
576
591
|
return true;
|
|
577
592
|
}
|
|
578
593
|
get configurazione() {
|
|
579
|
-
|
|
594
|
+
const mode = risolviModalita(this.manifest, this.dati?.mode ?? null);
|
|
595
|
+
return mode.players.max === 1 ? { ...mode, lobby: false } : mode;
|
|
580
596
|
}
|
|
581
597
|
info(playerId) {
|
|
582
598
|
if (this.dati === null) return null;
|
|
@@ -899,7 +915,7 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
899
915
|
else await this.rimuoviGiocatore(player, "timeout");
|
|
900
916
|
}
|
|
901
917
|
if (this.dati.status === "countdown" && this.dati.countdownAt !== null && this.dati.countdownAt <= ora) {
|
|
902
|
-
const errore = this.erroreMinimi();
|
|
918
|
+
const errore = this.erroreMinimi(this.dati.countdownRivincita);
|
|
903
919
|
if (errore !== null) {
|
|
904
920
|
this.dati.status = "lobby";
|
|
905
921
|
this.dati.countdownAt = null;
|
|
@@ -1067,13 +1083,13 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1067
1083
|
if (player === void 0) throw erroreConCodice("player_not_found", "Player not found.");
|
|
1068
1084
|
return player;
|
|
1069
1085
|
}
|
|
1070
|
-
erroreMinimi() {
|
|
1086
|
+
erroreMinimi(saltaPronti = false) {
|
|
1071
1087
|
const connessi = this.richiediDati().giocatori.filter((player) => player.connected);
|
|
1072
1088
|
const attivi = connessi.filter((player) => player.role !== "spectator");
|
|
1073
1089
|
if (attivi.length < this.configurazione.players.min) {
|
|
1074
1090
|
return { code: "not_enough_players", message: "The room does not have enough players." };
|
|
1075
1091
|
}
|
|
1076
|
-
if (connessi.some((player) => !player.ready)) {
|
|
1092
|
+
if (!saltaPronti && connessi.some((player) => !player.ready)) {
|
|
1077
1093
|
return { code: "players_not_ready", message: "Every connected player must be ready." };
|
|
1078
1094
|
}
|
|
1079
1095
|
for (const role of this.manifest.roles) {
|
|
@@ -1095,31 +1111,48 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1095
1111
|
this.inviaErrore(player, "rematch_unavailable", "This room is not waiting for a rematch.");
|
|
1096
1112
|
return;
|
|
1097
1113
|
}
|
|
1114
|
+
if (this.configurazione.players.max === 1) {
|
|
1115
|
+
await this.avviaRivincita();
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1098
1118
|
if (player.role !== "spectator" && !player.ready) {
|
|
1099
1119
|
player.ready = true;
|
|
1100
1120
|
this.inviaGiocatori();
|
|
1101
|
-
await this.
|
|
1121
|
+
if (dati.rivincita?.autoStart && this.prontiRivincita()) await this.avviaRivincita();
|
|
1122
|
+
else await this.persistiEProgramma();
|
|
1102
1123
|
return;
|
|
1103
1124
|
}
|
|
1104
1125
|
if (dati.hostId !== player.id) return;
|
|
1105
|
-
|
|
1106
|
-
if (attivi.length < this.configurazione.players.min || attivi.some((item) => !item.ready)) {
|
|
1126
|
+
if (!this.prontiRivincita(dati.rivincita?.autoStart === true)) {
|
|
1107
1127
|
this.inviaErrore(player, "players_not_ready", "Enough connected players must be ready for the rematch.");
|
|
1108
1128
|
return;
|
|
1109
1129
|
}
|
|
1110
|
-
|
|
1130
|
+
await this.avviaRivincita();
|
|
1131
|
+
}
|
|
1132
|
+
prontiRivincita(anticipata = false) {
|
|
1133
|
+
const attivi = this.richiediDati().giocatori.filter((item) => item.connected && item.role !== "spectator");
|
|
1134
|
+
return attivi.filter((item) => item.ready).length >= this.configurazione.players.min && (anticipata || attivi.every((item) => item.ready));
|
|
1135
|
+
}
|
|
1136
|
+
async avviaRivincita() {
|
|
1137
|
+
const dati = this.richiediDati(), solo = this.configurazione.players.max === 1;
|
|
1138
|
+
const keepSetup = dati.rivincita?.keepSetup === true && !solo;
|
|
1139
|
+
dati.status = solo ? "playing" : keepSetup ? "countdown" : this.configurazione.lobby ? "lobby" : "playing";
|
|
1140
|
+
dati.countdownRivincita = keepSetup;
|
|
1141
|
+
dati.countdownAt = keepSetup ? this.adattatore.ora() + COUNTDOWN_MS : null;
|
|
1111
1142
|
dati.rivincitaFinoA = null;
|
|
1143
|
+
dati.rivincita = null;
|
|
1112
1144
|
dati.result = null;
|
|
1113
1145
|
dati.resultAt = null;
|
|
1114
1146
|
dati.ultimoInputAt = this.adattatore.ora();
|
|
1115
|
-
for (const item of dati.giocatori) item.ready = false;
|
|
1147
|
+
for (const item of dati.giocatori) item.ready = keepSetup && (dati.prontiPrecedenti?.includes(item.id) ?? false);
|
|
1148
|
+
dati.prontiPrecedenti = [];
|
|
1116
1149
|
await this.chiama(this.definizione.onRestart, this.room);
|
|
1117
1150
|
await this.applicaAzioni();
|
|
1118
1151
|
if (dati.status === "playing") {
|
|
1119
1152
|
await this.chiama(this.definizione.onStart, this.room);
|
|
1120
1153
|
}
|
|
1121
1154
|
await this.concludiEvento();
|
|
1122
|
-
if (dati.status === "lobby" || dati.status === "playing") {
|
|
1155
|
+
if (dati.status === "lobby" || dati.status === "playing" || dati.status === "countdown") {
|
|
1123
1156
|
this.inviaSnapshotTutti();
|
|
1124
1157
|
this.inviaGiocatori();
|
|
1125
1158
|
this.inviaStatus(this.adattatore.ora());
|
|
@@ -1138,13 +1171,14 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1138
1171
|
return;
|
|
1139
1172
|
}
|
|
1140
1173
|
dati.status = "countdown";
|
|
1174
|
+
dati.countdownRivincita = false;
|
|
1141
1175
|
dati.countdownAt = this.adattatore.ora() + COUNTDOWN_MS;
|
|
1142
1176
|
this.inviaStatus(dati.countdownAt);
|
|
1143
1177
|
await this.persistiEProgramma();
|
|
1144
1178
|
}
|
|
1145
1179
|
verificaCountdown() {
|
|
1146
1180
|
const dati = this.richiediDati();
|
|
1147
|
-
if (dati.status !== "countdown" || this.erroreMinimi() === null) return;
|
|
1181
|
+
if (dati.status !== "countdown" || this.erroreMinimi(dati.countdownRivincita) === null) return;
|
|
1148
1182
|
dati.status = "lobby";
|
|
1149
1183
|
dati.countdownAt = null;
|
|
1150
1184
|
this.inviaStatus(this.adattatore.ora());
|
|
@@ -1213,7 +1247,11 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1213
1247
|
giornata(ora = this.adattatore.ora()) {
|
|
1214
1248
|
return this.adattatore.giorno?.(ora) ?? giornoUtc(ora);
|
|
1215
1249
|
}
|
|
1216
|
-
|
|
1250
|
+
contestoGiornaliero(ora = this.adattatore.ora()) {
|
|
1251
|
+
const day = this.giornata(ora);
|
|
1252
|
+
return { day, seed: seedGiornata(this.manifest.id, day), expiresAt: prossimaMezzanotteUtc(ora) };
|
|
1253
|
+
}
|
|
1254
|
+
accodaPunteggio(playerId, board, score, options) {
|
|
1217
1255
|
if (!this.richiediDati().giocatori.some((player2) => player2.id === playerId)) {
|
|
1218
1256
|
throw new Error("Player not found.");
|
|
1219
1257
|
}
|
|
@@ -1224,7 +1262,19 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1224
1262
|
throw new TypeError("Score must be a non-negative safe integer.");
|
|
1225
1263
|
}
|
|
1226
1264
|
const submittedAt = this.adattatore.ora();
|
|
1227
|
-
const
|
|
1265
|
+
const daily = options.daily === true || options.day !== void 0;
|
|
1266
|
+
let day = daily ? this.giornata(submittedAt) : null;
|
|
1267
|
+
const start = this.manifest.boards?.[board]?.day === "start";
|
|
1268
|
+
if (options.day !== void 0 && (!start || options.daily === false)) {
|
|
1269
|
+
throw erroreConCodice("board_day_policy", "An explicit day requires a start-day board and a daily score.");
|
|
1270
|
+
}
|
|
1271
|
+
if (daily && start) {
|
|
1272
|
+
const run = this.richiediDati().daily;
|
|
1273
|
+
if (options.day === void 0) throw erroreConCodice("board_day_required", "Submit the daily score with room.daily.day.");
|
|
1274
|
+
if (options.day !== run.day) throw erroreConCodice("board_day_mismatch", "The score day must match room.daily.day.");
|
|
1275
|
+
if (submittedAt > run.expiresAt + GRAZIA_GIORNALIERA_MS) throw erroreConCodice("board_day_expired", "The starting day grace period has expired.");
|
|
1276
|
+
day = run.day;
|
|
1277
|
+
}
|
|
1228
1278
|
this.richiediDati().punteggi.push({
|
|
1229
1279
|
playerId,
|
|
1230
1280
|
board,
|
|
@@ -1412,6 +1462,7 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1412
1462
|
seed: seedStanza(dati.id),
|
|
1413
1463
|
status: dati.status,
|
|
1414
1464
|
result: dati.result,
|
|
1465
|
+
rematch: dati.status === "finished" ? dati.rivincita ?? null : null,
|
|
1415
1466
|
mode: dati.mode,
|
|
1416
1467
|
tick: dati.tick,
|
|
1417
1468
|
tickRate: dati.tickRate,
|
|
@@ -1433,6 +1484,7 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1433
1484
|
const dati = this.richiediDati();
|
|
1434
1485
|
this.broadcast({
|
|
1435
1486
|
t: "status",
|
|
1487
|
+
rematch: dati.status === "finished" ? dati.rivincita ?? null : null,
|
|
1436
1488
|
status: dati.status,
|
|
1437
1489
|
host: dati.hostId,
|
|
1438
1490
|
countdownAt: dati.countdownAt,
|
|
@@ -1505,6 +1557,10 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1505
1557
|
async concludiEvento() {
|
|
1506
1558
|
await this.applicaAzioni();
|
|
1507
1559
|
if (this.dati === null || this.dati.status === "ended") return;
|
|
1560
|
+
if (this.dati.status === "finished" && this.dati.rivincita?.autoStart && this.prontiRivincita()) {
|
|
1561
|
+
await this.avviaRivincita();
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1508
1564
|
this.inviaGuadagniCambiati();
|
|
1509
1565
|
const stato = await this.verificaStato();
|
|
1510
1566
|
if (stato === null || this.stanzaTerminata()) return;
|
|
@@ -1600,6 +1656,11 @@ var NucleoStanza = class _NucleoStanza {
|
|
|
1600
1656
|
if (dati.status === "ended") return;
|
|
1601
1657
|
const giaFinita = dati.status === "finished";
|
|
1602
1658
|
dati.status = rematch ? "finished" : "ended";
|
|
1659
|
+
dati.rivincita = rematch ? {
|
|
1660
|
+
keepSetup: typeof rematch === "object" && rematch.keepSetup === true,
|
|
1661
|
+
autoStart: typeof rematch === "object" && rematch.autoStart === true
|
|
1662
|
+
} : null;
|
|
1663
|
+
dati.prontiPrecedenti = rematch ? dati.giocatori.filter((p) => p.ready).map((p) => p.id) : [];
|
|
1603
1664
|
dati.rivincitaFinoA = rematch ? this.adattatore.ora() + ATTESA_RIVINCITA_MS : null;
|
|
1604
1665
|
dati.timer = [];
|
|
1605
1666
|
if (rematch) for (const player of dati.giocatori) player.ready = false;
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type VersioneGioco } from './versioni.js';
|
|
1
2
|
export type DestinatarioBiglietto = 'portal' | 'live';
|
|
2
|
-
export interface Biglietto {
|
|
3
|
+
export interface Biglietto extends VersioneGioco {
|
|
3
4
|
sub: string;
|
|
4
5
|
game: string;
|
|
5
6
|
name: string;
|
|
@@ -8,7 +9,7 @@ export interface Biglietto {
|
|
|
8
9
|
iat: number;
|
|
9
10
|
exp: number;
|
|
10
11
|
}
|
|
11
|
-
export interface DatiBiglietto {
|
|
12
|
+
export interface DatiBiglietto extends VersioneGioco {
|
|
12
13
|
sub: string;
|
|
13
14
|
game: string;
|
|
14
15
|
name: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ImageFormat = 'png' | 'jpeg' | 'webp';
|
|
2
|
+
export interface ImageSize {
|
|
3
|
+
format: ImageFormat;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const MASSIMO_BYTE_IMMAGINE = 2000000;
|
|
8
|
+
export declare const IMMAGINI: {
|
|
9
|
+
readonly cover: {
|
|
10
|
+
readonly width: 1536;
|
|
11
|
+
readonly height: 1024;
|
|
12
|
+
readonly ratio: '3:2';
|
|
13
|
+
};
|
|
14
|
+
readonly card: {
|
|
15
|
+
readonly width: 1024;
|
|
16
|
+
readonly height: 1024;
|
|
17
|
+
readonly ratio: '1:1';
|
|
18
|
+
};
|
|
19
|
+
readonly icon: {
|
|
20
|
+
readonly width: 1024;
|
|
21
|
+
readonly height: 1024;
|
|
22
|
+
readonly ratio: '1:1';
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ImageField = keyof typeof IMMAGINI;
|
|
26
|
+
export declare function readImageSize(bytes: Uint8Array): ImageSize | null;
|
|
27
|
+
export declare function validaImmagine(campo: ImageField, bytes: Uint8Array): string | null;
|
|
@@ -41,6 +41,7 @@ export interface ManifestOverlay {
|
|
|
41
41
|
accent?: string;
|
|
42
42
|
}
|
|
43
43
|
export interface ManifestBoard {
|
|
44
|
+
day?: 'submit' | 'start';
|
|
44
45
|
label?: LocalizedText;
|
|
45
46
|
periods?: BoardPeriod[];
|
|
46
47
|
source: 'client' | 'server';
|
|
@@ -79,7 +80,9 @@ export interface Manifest {
|
|
|
79
80
|
id: string;
|
|
80
81
|
name: string;
|
|
81
82
|
description: string;
|
|
82
|
-
cover: string
|
|
83
|
+
cover: string;
|
|
84
|
+
card: string;
|
|
85
|
+
icon: string;
|
|
83
86
|
screenshots: string[];
|
|
84
87
|
tags: string[];
|
|
85
88
|
languages: string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type ResultJson = null | boolean | number | string | ResultJson[] | {
|
|
2
|
+
[key: string]: ResultJson;
|
|
3
|
+
};
|
|
4
|
+
export type MatchResult = {
|
|
5
|
+
standings: Array<{
|
|
6
|
+
playerId: string;
|
|
7
|
+
score?: number;
|
|
8
|
+
rank?: number;
|
|
9
|
+
}>;
|
|
10
|
+
winners?: string[];
|
|
11
|
+
draw?: boolean;
|
|
12
|
+
unit?: 'points' | 'time' | 'distance' | (string & {});
|
|
13
|
+
data?: ResultJson;
|
|
14
|
+
} & Record<string, ResultJson>;
|
|
15
|
+
export declare function readMatchResult(value: unknown, playerIds: readonly string[]): MatchResult | null;
|
|
16
|
+
export {};
|
|
@@ -24,6 +24,7 @@ export interface OverlayView {
|
|
|
24
24
|
export interface OverlayConfiguration {
|
|
25
25
|
manifest: Manifest;
|
|
26
26
|
coverUrl: string | null;
|
|
27
|
+
iconUrl: string | null;
|
|
27
28
|
invite: string | null;
|
|
28
29
|
}
|
|
29
30
|
export interface OverlayCapabilities {
|
|
@@ -55,6 +56,11 @@ export interface SessionResume {
|
|
|
55
56
|
updatedAt: number;
|
|
56
57
|
}
|
|
57
58
|
export interface OverlayRoom {
|
|
59
|
+
rematch?: {
|
|
60
|
+
keepSetup: boolean;
|
|
61
|
+
autoStart: boolean;
|
|
62
|
+
} | null;
|
|
63
|
+
result?: unknown;
|
|
58
64
|
code: string;
|
|
59
65
|
mode: string | null;
|
|
60
66
|
status: 'lobby' | 'countdown' | 'playing' | 'finished' | 'ended';
|
|
@@ -212,7 +218,7 @@ export interface OverlayHello {
|
|
|
212
218
|
epoch: string;
|
|
213
219
|
configuration: OverlayConfiguration;
|
|
214
220
|
}
|
|
215
|
-
export declare function overlayConfiguration(manifest: Manifest, coverUrl?: string | null, invite?: string | null): OverlayConfiguration;
|
|
221
|
+
export declare function overlayConfiguration(manifest: Manifest, coverUrl?: string | null, invite?: string | null, iconUrl?: string | null): OverlayConfiguration;
|
|
216
222
|
export declare function record(value: unknown): Record<string, unknown> | null;
|
|
217
223
|
export declare function validOverlayHello(value: unknown): value is OverlayHello;
|
|
218
224
|
export declare function normalizeOverlayHello(value: unknown): OverlayHello | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Il numero identifica gli artefatti del gioco, non il formato dei dati salvati. */
|
|
2
|
+
export interface VersioneGioco {
|
|
3
|
+
n: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ErroreVersione {
|
|
6
|
+
currentVersion?: number;
|
|
7
|
+
roomVersion?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RicaricaGioco {
|
|
10
|
+
code?: string;
|
|
11
|
+
roomId?: string;
|
|
12
|
+
watch?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function numeroVersione(value: unknown): value is number;
|
|
15
|
+
export declare function analizzaRoomId(roomId: string): {
|
|
16
|
+
gameId: number;
|
|
17
|
+
n: number;
|
|
18
|
+
} | null;
|
package/dist/types/daily.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export interface DailyContext {
|
|
2
|
+
day: string;
|
|
3
|
+
seed: number;
|
|
4
|
+
expiresAt: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function prossimaMezzanotteUtc(ora: number): number;
|
|
7
|
+
export declare function creaDaily(initial: DailyContext, now: () => number, refresh: () => Promise<DailyContext>): {
|
|
8
|
+
day: string;
|
|
9
|
+
seed: number;
|
|
10
|
+
expiresAt: number;
|
|
11
|
+
random: () => number;
|
|
12
|
+
rng: () => () => number;
|
|
13
|
+
onChange(listener: (context: DailyContext) => void): () => void;
|
|
14
|
+
};
|
|
1
15
|
export declare function giornoUtc(ora: number): string;
|
|
2
16
|
export declare function calcolaSeed(gioco: string, giorno: string, subtle: SubtleCrypto): Promise<number>;
|
|
3
17
|
export declare function creaMulberry32(seed: number): () => number;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type ErroreCaisual = Error & {
|
|
2
2
|
code: string;
|
|
3
|
-
};
|
|
4
|
-
export declare function creaErrore(code: string, message: string): ErroreCaisual;
|
|
3
|
+
} & import('./contracts/index.js').ErroreVersione;
|
|
4
|
+
export declare function creaErrore(code: string, message: string, version?: import('./contracts/index.js').ErroreVersione): ErroreCaisual;
|
|
5
5
|
export declare function erroreOffline(): ErroreCaisual;
|
|
6
6
|
export declare function codiceErrore(valore: unknown): unknown;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OverlayHello } from './contracts/index.js';
|
|
2
|
+
import type { VersioneGioco } from './contracts/index.js';
|
|
2
3
|
export interface GenitoreHandshake {
|
|
3
4
|
postMessage(message: unknown, targetOrigin: string): void;
|
|
4
5
|
}
|
|
@@ -9,7 +10,7 @@ export interface FinestraHandshakeKit extends GenitoreHandshake {
|
|
|
9
10
|
setTimeout(handler: () => void, timeout: number): number;
|
|
10
11
|
clearTimeout(id: number): void;
|
|
11
12
|
}
|
|
12
|
-
export interface EsitoHandshake {
|
|
13
|
+
export interface EsitoHandshake extends VersioneGioco {
|
|
13
14
|
language?: string;
|
|
14
15
|
uiLanguage?: string;
|
|
15
16
|
languagePreferences?: string[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { DailyContext } from './daily.js';
|
|
2
|
+
export type { MatchResult } from './contracts/index.js';
|
|
1
3
|
import type { Text } from './text.js';
|
|
2
4
|
export type { Text } from './text.js';
|
|
3
5
|
import type { ConnectionState, QueuedScore } from './contracts/index.js';
|
|
@@ -92,6 +94,10 @@ export interface RoomInvite {
|
|
|
92
94
|
url: string;
|
|
93
95
|
}
|
|
94
96
|
export interface RoomMetadata {
|
|
97
|
+
rematch?: {
|
|
98
|
+
keepSetup: boolean;
|
|
99
|
+
autoStart: boolean;
|
|
100
|
+
} | null;
|
|
95
101
|
host: string | null;
|
|
96
102
|
mode: string | null;
|
|
97
103
|
countdownAt: number | null;
|
|
@@ -178,6 +184,8 @@ export interface MatchOptions {
|
|
|
178
184
|
}): void;
|
|
179
185
|
}
|
|
180
186
|
export interface Rooms {
|
|
187
|
+
reload(): void;
|
|
188
|
+
onError(listener: (error: import('./errors.js').ErroreCaisual) => void): () => void;
|
|
181
189
|
readonly invited: string | null;
|
|
182
190
|
create(options: {
|
|
183
191
|
mode: string | null;
|
|
@@ -194,6 +202,8 @@ export interface CaisualConnection {
|
|
|
194
202
|
device: DeviceReport;
|
|
195
203
|
player: Player;
|
|
196
204
|
daily: {
|
|
205
|
+
readonly expiresAt: number;
|
|
206
|
+
onChange(listener: (context: import('./daily.js').DailyContext) => void): () => void;
|
|
197
207
|
day: string;
|
|
198
208
|
seed: number;
|
|
199
209
|
random(): number;
|
|
@@ -20,6 +20,9 @@ export interface HostBridgeInput {
|
|
|
20
20
|
frame: FrameHandshake;
|
|
21
21
|
origineGioco: string;
|
|
22
22
|
origineLive: string;
|
|
23
|
+
n: number;
|
|
24
|
+
watch?: boolean;
|
|
25
|
+
reload?(target?: import('../contracts/index.js').RicaricaGioco): void;
|
|
23
26
|
language?: string;
|
|
24
27
|
languagePreferences?: readonly string[];
|
|
25
28
|
invite: string | null;
|
|
@@ -39,6 +42,8 @@ export declare function stanzaDaMessaggio(value: unknown): {
|
|
|
39
42
|
code: string;
|
|
40
43
|
} | null | undefined;
|
|
41
44
|
export declare function creaPonteOspite(input: HostBridgeInput): {
|
|
45
|
+
readonly watch: boolean;
|
|
46
|
+
reload(): void;
|
|
42
47
|
readonly epoch: string | null;
|
|
43
48
|
serverTime(): number | null;
|
|
44
49
|
readonly state: OverlaySessionState | null;
|
|
@@ -46,7 +51,7 @@ export declare function creaPonteOspite(input: HostBridgeInput): {
|
|
|
46
51
|
onShortcut(listener: () => void): () => void;
|
|
47
52
|
onOpen(listener: (value: OverlayPanel) => void): () => void;
|
|
48
53
|
onError(listener: (value: {
|
|
49
|
-
sessionId: string;
|
|
54
|
+
sessionId: string | null;
|
|
50
55
|
error: {
|
|
51
56
|
code: string;
|
|
52
57
|
message: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const languages: readonly ['en', 'it', 'es', 'fr', 'de', 'pt'];
|
|
2
2
|
export type OverlayLanguage = typeof languages[number];
|
|
3
3
|
declare const words: {
|
|
4
|
+
readonly gameUpdated: readonly ["This game was updated", "Questo gioco è stato aggiornato", "Este juego se ha actualizado", "Ce jeu a été mis à jour", "Dieses Spiel wurde aktualisiert", "Este jogo foi atualizado"];
|
|
5
|
+
readonly reloadGame: readonly ["Reload game", "Ricarica il gioco", "Recargar el juego", "Recharger le jeu", "Spiel neu laden", "Recarregar o jogo"];
|
|
4
6
|
readonly gameLanguages: readonly ["Game languages", "Lingue del gioco", "Idiomas del juego", "Langues du jeu", "Spielsprachen", "Idiomas do jogo"];
|
|
5
7
|
readonly loading: readonly ["Loading game...", "Caricamento...", "Cargando...", "Chargement...", "Spiel wird geladen...", "Carregando..."];
|
|
6
8
|
readonly loadingSlow: readonly ["This game is taking longer than expected. You can wait a little longer or try again.", "Il gioco ci sta mettendo più del previsto. Puoi aspettare ancora un po’ o riprovare.", "El juego está tardando más de lo esperado. Puedes esperar un poco más o volver a intentarlo.", "Le jeu met plus de temps que prévu. Vous pouvez patienter encore un peu ou réessayer.", "Das Spiel braucht länger als erwartet. Du kannst noch etwas warten oder es erneut versuchen.", "O jogo está demorando mais do que o esperado. Você pode esperar mais um pouco ou tentar novamente."];
|
|
@@ -43,6 +45,13 @@ declare const words: {
|
|
|
43
45
|
readonly ended: readonly ["Game finished", "Partita conclusa", "Partida terminada", "Partie terminée", "Spiel beendet", "Partida encerrada"];
|
|
44
46
|
readonly rematchReady: readonly ["{n}/{max} ready", "{n}/{max} pronti", "{n}/{max} listos", "{n}/{max} prêts", "{n}/{max} bereit", "{n}/{max} prontos"];
|
|
45
47
|
readonly rematchStart: readonly ["Start rematch", "Avvia rivincita", "Iniciar revancha", "Lancer la revanche", "Revanche starten", "Iniciar revanche"];
|
|
48
|
+
readonly won: readonly ["You won", "Hai vinto", "Has ganado", "Vous avez gagné", "Du hast gewonnen", "Você venceu"];
|
|
49
|
+
readonly lost: readonly ["You lost", "Hai perso", "Has perdido", "Vous avez perdu", "Du hast verloren", "Você perdeu"];
|
|
50
|
+
readonly draw: readonly ["Draw", "Pareggio", "Empate", "Égalité", "Unentschieden", "Empate"];
|
|
51
|
+
readonly standings: readonly ["Standings", "Piazzamenti", "Posiciones", "Résultats", "Platzierungen", "Colocações"];
|
|
52
|
+
readonly points: readonly ["points", "punti", "puntos", "points", "Punkte", "pontos"];
|
|
53
|
+
readonly time: readonly ["time", "tempo", "tiempo", "temps", "Zeit", "tempo"];
|
|
54
|
+
readonly distance: readonly ["distance", "distanza", "distancia", "distance", "Distanz", "distância"];
|
|
46
55
|
readonly again: readonly ["Play again", "Gioca ancora", "Jugar de nuevo", "Rejouer", "Erneut spielen", "Jogar novamente"];
|
|
47
56
|
readonly newRoom: readonly ["New room. Share the new invite.", "Nuova stanza. Condividi il nuovo invito.", "Nueva sala. Comparte la invitación.", "Nouvelle salle. Partagez le lien.", "Neuer Raum. Neue Einladung teilen.", "Nova sala. Compartilhe o convite."];
|
|
48
57
|
readonly watching: readonly ["Watching", "In osservazione", "Observando", "Spectateur", "Zuschauen", "Assistindo"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const styles = "\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:
|
|
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:56px;height:56px;margin-bottom:12px}\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[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@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}.boot{transition:none}.boot-progress span{animation:none;transform:translateX(65%)}}\n";
|
|
@@ -43,3 +43,7 @@ export declare function primaryAction(manifest: Manifest, mode: string): {
|
|
|
43
43
|
export declare function startReason(manifest: Manifest, session: OverlaySessionState | null): string | null;
|
|
44
44
|
export declare function canPlayAgain(session: OverlaySessionState | null): boolean;
|
|
45
45
|
export declare function normalizeInvite(code: string): string | null;
|
|
46
|
+
export declare function matchPresentation(session: OverlaySessionState | null): {
|
|
47
|
+
result: import("../contracts/index.js").MatchResult;
|
|
48
|
+
outcome: "draw" | "ended" | "lost" | "won";
|
|
49
|
+
} | null;
|
|
@@ -8,6 +8,7 @@ export interface CrewPerson {
|
|
|
8
8
|
game: {
|
|
9
9
|
slug: string;
|
|
10
10
|
name: string;
|
|
11
|
+
iconUrl: string;
|
|
11
12
|
} | null;
|
|
12
13
|
room: {
|
|
13
14
|
code: string;
|
|
@@ -41,6 +42,7 @@ export interface CrewSnapshot {
|
|
|
41
42
|
game: {
|
|
42
43
|
slug: string;
|
|
43
44
|
name: string;
|
|
45
|
+
iconUrl: string;
|
|
44
46
|
};
|
|
45
47
|
code: string;
|
|
46
48
|
} | null;
|
|
@@ -41,6 +41,10 @@ export interface RoomConfiguration {
|
|
|
41
41
|
requestRole: boolean;
|
|
42
42
|
}
|
|
43
43
|
export interface StanzaProtocollo {
|
|
44
|
+
rematch?: {
|
|
45
|
+
keepSetup: boolean;
|
|
46
|
+
autoStart: boolean;
|
|
47
|
+
} | null;
|
|
44
48
|
result?: JsonValue;
|
|
45
49
|
countdownAt?: number | null;
|
|
46
50
|
configuration?: RoomConfiguration;
|
|
@@ -222,6 +226,10 @@ export type MessaggioServerStanza = {
|
|
|
222
226
|
score: QueuedScore;
|
|
223
227
|
} | {
|
|
224
228
|
t: 'status';
|
|
229
|
+
rematch?: {
|
|
230
|
+
keepSetup: boolean;
|
|
231
|
+
autoStart: boolean;
|
|
232
|
+
} | null;
|
|
225
233
|
status: RoomStatus;
|
|
226
234
|
at: number;
|
|
227
235
|
result: JsonValue;
|
|
@@ -1,6 +1,10 @@
|
|
|
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
|
+
}>;
|
|
4
8
|
id: string;
|
|
5
9
|
players: {
|
|
6
10
|
min: number;
|