diff --git a/bgs-gameinfo.draft.json b/bgs-gameinfo.draft.json index 3ef52a6..b72d432 100644 --- a/bgs-gameinfo.draft.json +++ b/bgs-gameinfo.draft.json @@ -105,7 +105,7 @@ ], "preferences": [ { - "name": "colorblind", + "name": "colorBlind", "label": "Show color labels (colorblind support)", "type": "checkbox", "default": false diff --git a/docs/bgs-integration.md b/docs/bgs-integration.md index 12f8cb1..1b4772a 100644 --- a/docs/bgs-integration.md +++ b/docs/bgs-integration.md @@ -39,7 +39,7 @@ Fuji has a shared win/loss. The wrapper gives all players the same ranking and r ## Viewer preferences -`colorblind` is a boolean UI preference, false by default. The viewer reads the platform `preferences` event and emits `update:preference` with `{ name: "colorblind", value: boolean }` when changed in Help. It adds color names to dice and color initials to map requirement symbols without changing game state. The local harness persists the same setting in localStorage. The draft registration declares the checkbox for the platform sidebar. +`colorBlind` is the platform’s shared color-blind preference, false by default. It is stored on the BGS account and used across supported games. The viewer reads the platform `preferences` event and emits `update:preference` with `{ name: "colorBlind", value: boolean }` when changed in Help. It adds color names to dice and color initials to map requirement symbols without changing game state. The local harness persists the same setting in localStorage. The draft registration declares the checkbox so the platform shows its shared control. Incoming preference updates must not write back to the host. ## Automatic movement resolution diff --git a/packages/viewer/package.json b/packages/viewer/package.json index 45e05e2..7f335ec 100644 --- a/packages/viewer/package.json +++ b/packages/viewer/package.json @@ -1,6 +1,6 @@ { "name": "fuji-viewer", - "version": "0.1.3", + "version": "0.1.4", "private": true, "license": "AGPL-3.0-only", "type": "module", diff --git a/packages/viewer/src/lib/store.svelte.ts b/packages/viewer/src/lib/store.svelte.ts index 4a00c46..1be1114 100644 --- a/packages/viewer/src/lib/store.svelte.ts +++ b/packages/viewer/src/lib/store.svelte.ts @@ -83,7 +83,7 @@ export class Store { savePreference: (name: string, value: boolean) => void = () => {}; setColorblind(value: boolean) { this.colorblind = value; - this.savePreference("colorblind", value); + this.savePreference("colorBlind", value); } send: (move: Move) => void = () => {}; selectSeat: (seat: number) => void = () => {}; diff --git a/packages/viewer/src/viewer.ts b/packages/viewer/src/viewer.ts index 4371b8a..8d96e20 100644 --- a/packages/viewer/src/viewer.ts +++ b/packages/viewer/src/viewer.ts @@ -26,7 +26,7 @@ registerViewer( }, onPreferences(preferences) { store.analysis = preferences.analysis === true; - store.colorblind = preferences.colorblind === true; + store.colorblind = preferences.colorBlind === true; store.setSound(preferences.sound !== false); }, onAvatars(avatars) { diff --git a/tests/bgs-bundle-smoke.mjs b/tests/bgs-bundle-smoke.mjs index cd01ed8..63a88ac 100644 --- a/tests/bgs-bundle-smoke.mjs +++ b/tests/bgs-bundle-smoke.mjs @@ -151,14 +151,14 @@ import path from "node:path"; ); if ((await page.locator(".revealed-team .die:not(.hidden)").count()) !== 6) throw Error("Radio not rendered"); if (await page.locator(".die-caption").count()) throw Error("Color labels should be off by default"); - await page.evaluate(() => window.bridge.emit("preferences", { colorblind: true })); + await page.evaluate(() => window.bridge.emit("preferences", { colorBlind: true })); await page.waitForSelector(".die-caption"); await page.getByRole("button", { name: "Open playing guide" }).click(); await page.getByRole("checkbox", { name: "Show color labels (colorblind support)" }).uncheck(); const preference = await page.evaluate( () => window.captured.findLast((e) => e.name === "update:preference")?.payload ); - if (preference?.name !== "colorblind" || preference.value !== false) throw Error("Wrong preference uplink"); + if (preference?.name !== "colorBlind" || preference.value !== false) throw Error("Wrong preference uplink"); if (await page.locator(".die-caption").count()) throw Error("Color labels did not turn off"); await page.keyboard.press("Escape"); if ((await page.locator(".village-marker").count()) !== 5) throw Error("Every village location needs a marker");