@caisual/kit 0.10.0 → 0.12.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 +127 -16
- package/dist/node.js +77 -18
- package/dist/overlay.js +109 -30
- package/dist/runtime.js +79 -18
- package/dist/types/api.d.ts +1 -0
- package/dist/types/contracts/immagine.d.ts +27 -0
- package/dist/types/contracts/index.d.ts +2 -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/daily.d.ts +14 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/node/index.d.ts +4 -0
- package/dist/types/overlay/i18n.d.ts +7 -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/stanza/nucleo.d.ts +3 -0
- package/dist/types/stanza/tipi.d.ts +11 -0
- package/package.json +1 -1
|
@@ -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;
|
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/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;
|
|
@@ -194,6 +200,8 @@ export interface CaisualConnection {
|
|
|
194
200
|
device: DeviceReport;
|
|
195
201
|
player: Player;
|
|
196
202
|
daily: {
|
|
203
|
+
readonly expiresAt: number;
|
|
204
|
+
onChange(listener: (context: import('./daily.js').DailyContext) => void): () => void;
|
|
197
205
|
day: string;
|
|
198
206
|
seed: number;
|
|
199
207
|
random(): number;
|
|
@@ -43,6 +43,13 @@ declare const words: {
|
|
|
43
43
|
readonly ended: readonly ["Game finished", "Partita conclusa", "Partida terminada", "Partie terminée", "Spiel beendet", "Partida encerrada"];
|
|
44
44
|
readonly rematchReady: readonly ["{n}/{max} ready", "{n}/{max} pronti", "{n}/{max} listos", "{n}/{max} prêts", "{n}/{max} bereit", "{n}/{max} prontos"];
|
|
45
45
|
readonly rematchStart: readonly ["Start rematch", "Avvia rivincita", "Iniciar revancha", "Lancer la revanche", "Revanche starten", "Iniciar revanche"];
|
|
46
|
+
readonly won: readonly ["You won", "Hai vinto", "Has ganado", "Vous avez gagné", "Du hast gewonnen", "Você venceu"];
|
|
47
|
+
readonly lost: readonly ["You lost", "Hai perso", "Has perdido", "Vous avez perdu", "Du hast verloren", "Você perdeu"];
|
|
48
|
+
readonly draw: readonly ["Draw", "Pareggio", "Empate", "Égalité", "Unentschieden", "Empate"];
|
|
49
|
+
readonly standings: readonly ["Standings", "Piazzamenti", "Posiciones", "Résultats", "Platzierungen", "Colocações"];
|
|
50
|
+
readonly points: readonly ["points", "punti", "puntos", "points", "Punkte", "pontos"];
|
|
51
|
+
readonly time: readonly ["time", "tempo", "tiempo", "temps", "Zeit", "tempo"];
|
|
52
|
+
readonly distance: readonly ["distance", "distanza", "distancia", "distance", "Distanz", "distância"];
|
|
46
53
|
readonly again: readonly ["Play again", "Gioca ancora", "Jugar de nuevo", "Rejouer", "Erneut spielen", "Jogar novamente"];
|
|
47
54
|
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
55
|
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;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
export type { MatchResult } from '../contracts/index.js';
|
|
1
2
|
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
2
3
|
[key: string]: JsonValue;
|
|
3
4
|
};
|
|
5
|
+
export type RematchOptions = boolean | {
|
|
6
|
+
keepSetup?: boolean;
|
|
7
|
+
autoStart?: boolean;
|
|
8
|
+
};
|
|
4
9
|
export type RoomStatus = 'lobby' | 'countdown' | 'playing' | 'finished' | 'ended';
|
|
5
10
|
export type VoiceMode = 'none' | 'room' | 'team' | 'proximity';
|
|
6
11
|
export type LeaveReason = 'left' | 'timeout' | 'kicked';
|
|
@@ -36,20 +41,26 @@ export interface Room<State extends JsonValue = JsonValue> {
|
|
|
36
41
|
setRole(player: Player | string, role: string): void;
|
|
37
42
|
setTeam(player: Player | string, team: number): void;
|
|
38
43
|
end(result: JsonValue, options?: {
|
|
39
|
-
rematch?:
|
|
44
|
+
rematch?: RematchOptions;
|
|
40
45
|
}): void;
|
|
41
46
|
save(key: string, value: JsonValue): Promise<void>;
|
|
42
47
|
load(key: string): Promise<JsonValue | null>;
|
|
43
48
|
readonly shared: SharedGameStore;
|
|
44
49
|
schedule(milliseconds: number, handler: string, payload: JsonValue): void;
|
|
45
50
|
readonly board: {
|
|
51
|
+
submit(board: string, score: number, options?: {
|
|
52
|
+
daily?: boolean;
|
|
53
|
+
day?: string;
|
|
54
|
+
}): void;
|
|
46
55
|
submit(player: Player | string, board: string, score: number, options?: {
|
|
47
56
|
daily?: boolean;
|
|
57
|
+
day?: string;
|
|
48
58
|
}): void;
|
|
49
59
|
};
|
|
50
60
|
readonly daily: {
|
|
51
61
|
readonly day: string;
|
|
52
62
|
readonly seed: number;
|
|
63
|
+
readonly expiresAt: number;
|
|
53
64
|
};
|
|
54
65
|
readonly time: {
|
|
55
66
|
now(): number;
|
|
@@ -46,6 +46,8 @@ export declare class NucleoStanza {
|
|
|
46
46
|
private giocatorePerModificaDalServer;
|
|
47
47
|
private erroreMinimi;
|
|
48
48
|
private rivincita;
|
|
49
|
+
private prontiRivincita;
|
|
50
|
+
private avviaRivincita;
|
|
49
51
|
private avviaCountdown;
|
|
50
52
|
private verificaCountdown;
|
|
51
53
|
private messaggioErrato;
|
|
@@ -55,6 +57,7 @@ export declare class NucleoStanza {
|
|
|
55
57
|
private eseguiTimer;
|
|
56
58
|
private pianifica;
|
|
57
59
|
private giornata;
|
|
60
|
+
private contestoGiornaliero;
|
|
58
61
|
private accodaPunteggio;
|
|
59
62
|
private richiediFine;
|
|
60
63
|
private salva;
|
|
@@ -8,6 +8,10 @@ export interface ManifestStanza {
|
|
|
8
8
|
};
|
|
9
9
|
lobby: boolean;
|
|
10
10
|
persistent?: boolean;
|
|
11
|
+
boards?: Record<string, {
|
|
12
|
+
source: 'client' | 'server';
|
|
13
|
+
day?: 'submit' | 'start';
|
|
14
|
+
}>;
|
|
11
15
|
roles: Array<{
|
|
12
16
|
id: string;
|
|
13
17
|
min: number;
|
|
@@ -96,6 +100,13 @@ export interface StatoPersistito {
|
|
|
96
100
|
hostId: string | null;
|
|
97
101
|
result: JsonValue | null;
|
|
98
102
|
resultAt: number | null;
|
|
103
|
+
daily?: import('../daily.js').DailyContext;
|
|
104
|
+
rivincita?: {
|
|
105
|
+
keepSetup: boolean;
|
|
106
|
+
autoStart: boolean;
|
|
107
|
+
} | null;
|
|
108
|
+
prontiPrecedenti?: string[];
|
|
109
|
+
countdownRivincita?: boolean;
|
|
99
110
|
rivincitaFinoA?: number | null;
|
|
100
111
|
countdownAt: number | null;
|
|
101
112
|
timer: TimerPersistito[];
|