powergrid-viewer 2.1.2 → 2.1.3
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/powergrid-viewer.umd.min.js +11 -11
- package/package.json +7 -4
- package/src/components/Game.vue +2 -1
- package/src/game-chat.ts +107 -265
- package/src/launch.ts +68 -64
- package/src/sounds.ts +6 -4
- package/tsconfig.json +4 -2
package/src/sounds.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ViewerEmitter } from '@boardgamers/protocol/viewer';
|
|
1
2
|
type Note = [number, number, number, number, number?];
|
|
2
3
|
type Cue = { label: string; notes: Note[] };
|
|
3
4
|
export const soundCues: Record<string, Cue> = {
|
|
@@ -97,7 +98,7 @@ export function playSound(name: string): void {
|
|
|
97
98
|
.catch(() => undefined);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
export function installActionSounds(emitter:
|
|
101
|
+
export function installActionSounds(emitter: Pick<ViewerEmitter<any, any>, 'on'>): void {
|
|
101
102
|
let previous: string[] | undefined;
|
|
102
103
|
let replaying = false;
|
|
103
104
|
emitter.on('update:preference', (pref) => {
|
|
@@ -139,13 +140,14 @@ export function installActionSounds(emitter: { on: (event: string, fn: (value: a
|
|
|
139
140
|
};
|
|
140
141
|
emitter.on('state', receiveState);
|
|
141
142
|
emitter.on('gamelog', (event) => {
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
const data = event?.data as { state?: any } | undefined;
|
|
144
|
+
if (data?.state) {
|
|
145
|
+
receiveState(data.state);
|
|
144
146
|
}
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
|
|
148
|
-
export function mountSoundTests(emitter:
|
|
150
|
+
export function mountSoundTests(emitter: Pick<ViewerEmitter<any, any>, 'emit'>): void {
|
|
149
151
|
const panel = document.createElement('details');
|
|
150
152
|
panel.style.cssText =
|
|
151
153
|
'position:relative;z-index:5;padding:10px 16px;margin:8px;background:#172638;color:#f0f4f8;border:1px solid #56718a;border-radius:8px;font:14px system-ui';
|
package/tsconfig.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"strict": true,
|
|
6
6
|
"jsx": "preserve",
|
|
7
7
|
"importHelpers": true,
|
|
8
|
-
"moduleResolution": "
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
9
|
"experimentalDecorators": true,
|
|
10
10
|
"esModuleInterop": true,
|
|
11
11
|
"allowSyntheticDefaultImports": true,
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"paths": {
|
|
17
17
|
"@/*": ["src/*"]
|
|
18
18
|
},
|
|
19
|
-
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
|
|
19
|
+
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"useDefineForClassFields": false
|
|
20
22
|
},
|
|
21
23
|
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
|
|
22
24
|
"exclude": ["node_modules"]
|