@hadoku/game-ui 0.1.56 → 0.1.57

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.
@@ -11,13 +11,14 @@ export declare function watchpartyOrigin(): string;
11
11
  /**
12
12
  * The image that draws one avatar, or null when there is nothing to draw.
13
13
  *
14
- * `square_<id>.png` under the chrome's own `serverOrigin` is watchparty's own
15
- * media convention, not ours: every id in `@wolffm/rooms-protocol`'s `AVATAR_POOL` has
16
- * one (checked 2026-11-01), and `@wolffm/prefs-client/avatar`'s `ResolvedAvatar`
17
- * carries no URL for a `sprite` source by design — "the app that owns the art
18
- * … owns its URL and revision" (its own `.d.ts`). So this stays the one place
19
- * that builds the path, same-origin by construction (no host written down,
20
- * so a local e2e stays local).
14
+ * The path is watchparty's own media convention, not ours, and it is the room
15
+ * protocol's to spell: `@wolffm/rooms-protocol`'s `avatarPortraitPath`
16
+ * (`square_<id>.png`, plus `?v=<rev>` for art redrawn in place — the sprites are
17
+ * served immutable for a year, so without it a redrawn character kept its old
18
+ * face here). `@wolffm/prefs-client/avatar`'s `ResolvedAvatar` carries no URL
19
+ * for a `sprite` source by design — "the app that owns the art … owns its URL
20
+ * and revision" (its own `.d.ts`). This prefixes the origin, same-origin by
21
+ * construction (no host written down, so a local e2e stays local).
21
22
  *
22
23
  * Null for an absent, blank or over-long id rather than a URL ending
23
24
  * `square_.png`, which is a 404 drawn as a broken image where the caller wanted
@@ -15,6 +15,7 @@
15
15
  * keeps one for an account that never picked, so it is the same in every app.
16
16
  */
17
17
  import { AVATAR_ID_MAX } from '@wolffm/platform-wire/look';
18
+ import { avatarPortraitPath } from '@wolffm/rooms-protocol';
18
19
  /**
19
20
  * Watchparty's server, on whatever origin serves this page. In production that
20
21
  * is `https://hadoku.me/watchparty` — both apps sit behind the same edge — and
@@ -30,13 +31,14 @@ export function watchpartyOrigin() {
30
31
  /**
31
32
  * The image that draws one avatar, or null when there is nothing to draw.
32
33
  *
33
- * `square_<id>.png` under the chrome's own `serverOrigin` is watchparty's own
34
- * media convention, not ours: every id in `@wolffm/rooms-protocol`'s `AVATAR_POOL` has
35
- * one (checked 2026-11-01), and `@wolffm/prefs-client/avatar`'s `ResolvedAvatar`
36
- * carries no URL for a `sprite` source by design — "the app that owns the art
37
- * … owns its URL and revision" (its own `.d.ts`). So this stays the one place
38
- * that builds the path, same-origin by construction (no host written down,
39
- * so a local e2e stays local).
34
+ * The path is watchparty's own media convention, not ours, and it is the room
35
+ * protocol's to spell: `@wolffm/rooms-protocol`'s `avatarPortraitPath`
36
+ * (`square_<id>.png`, plus `?v=<rev>` for art redrawn in place — the sprites are
37
+ * served immutable for a year, so without it a redrawn character kept its old
38
+ * face here). `@wolffm/prefs-client/avatar`'s `ResolvedAvatar` carries no URL
39
+ * for a `sprite` source by design — "the app that owns the art … owns its URL
40
+ * and revision" (its own `.d.ts`). This prefixes the origin, same-origin by
41
+ * construction (no host written down, so a local e2e stays local).
40
42
  *
41
43
  * Null for an absent, blank or over-long id rather than a URL ending
42
44
  * `square_.png`, which is a 404 drawn as a broken image where the caller wanted
@@ -49,7 +51,7 @@ export function avatarSquareUrl(avatarId, origin) {
49
51
  const id = normalizeAvatarId(avatarId);
50
52
  if (id === null)
51
53
  return null;
52
- return `${(origin ?? watchpartyOrigin()).replace(/\/$/, '')}/media/sprites/square_${encodeURIComponent(id)}.png`;
54
+ return `${(origin ?? watchpartyOrigin()).replace(/\/$/, '')}${avatarPortraitPath(id)}`;
53
55
  }
54
56
  /** The same two-state reading the server does, so a client cannot send what it would refuse. */
55
57
  export function normalizeAvatarId(v) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-ui",
3
- "version": "0.1.56",
4
- "gitHead": "47587613c847d40817f0dd6fe9ced413b01e3d3e",
3
+ "version": "0.1.57",
4
+ "gitHead": "ac68d11a0057750d0f231f6502f9710f9e3d855d",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "The browser parts any hosted game shares, above ui-shell: the room shell and session, seats and looks, the room route, the front page's generic pieces (gate, polls, gallery, patch notes), the bundle slot and relay channel a game's client mounts in, settings and trim screens, the HTTP and socket helpers, and the generic components (modal, popover, avatar, action button, radio cards). Knows no game; Magic's UI (games/magic/ui) plugs in, composed by the site (apps/ui). MIT; imports only react, react-dom, socket.io-client, @wolffm/* and the platform packages.",
@@ -49,8 +49,8 @@
49
49
  "react-dom": "^19.2.8"
50
50
  },
51
51
  "dependencies": {
52
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.60",
53
- "@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.60",
52
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.61",
53
+ "@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.61",
54
54
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.28",
55
55
  "@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.117",
56
56
  "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.117",