@hadoku/prefs-client 1.1.14 → 1.1.16
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/avatar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AvatarCosmetics, C as CosmeticsView, L as LoadoutUpdate } from './cosmetics-contract-
|
|
2
|
-
export { a as CosmeticSlot, b as Loadout, P as Placement } from './cosmetics-contract-
|
|
1
|
+
import { A as AvatarCosmetics, C as CosmeticsView, L as LoadoutUpdate } from './cosmetics-contract-CzRH-ZG0.js';
|
|
2
|
+
export { a as CosmeticSlot, b as Loadout, P as Placement } from './cosmetics-contract-CzRH-ZG0.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Avatars — the wire contract, shared by prefs-api and the client.
|
|
@@ -132,6 +132,14 @@ interface AvatarCosmetics {
|
|
|
132
132
|
message?: string;
|
|
133
133
|
placement?: Placement;
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* What someone wears, as an app relays it over its own wire (a room's presence),
|
|
137
|
+
* made safe to render: known, shown items in their own slots only, and the
|
|
138
|
+
* placement refitted to the allowed area. Ownership was decided by prefs-api,
|
|
139
|
+
* which only ever serves what a person owns; this guards the shape, not the
|
|
140
|
+
* inventory. Undefined when nothing valid is worn.
|
|
141
|
+
*/
|
|
142
|
+
declare function cleanWorn(raw: unknown): AvatarCosmetics | undefined;
|
|
135
143
|
/** In AvatarSettings: what the owner has earned and what they wear. */
|
|
136
144
|
interface CosmeticsView {
|
|
137
145
|
/** What the person can wear: free items and the earned ones granted, in catalogue order. */
|
|
@@ -171,4 +179,4 @@ interface CosmeticGrantList {
|
|
|
171
179
|
}[];
|
|
172
180
|
}
|
|
173
181
|
|
|
174
|
-
export { type AvatarCosmetics as A, type Box as B, type CosmeticsView as C, EARNED_COSMETICS as E, type LoadoutUpdate as L, type OverlayArt as O, type Placement as P, type CosmeticSlot as a, type Loadout as b, COSMETICS as c, COSMETICS_BY_ID as d, COSMETIC_ID_PATTERN as e, COSMETIC_SLOTS as f, type CosmeticGrantList as g, type CosmeticGrantRequest as h, type CosmeticItem as i, PLACEMENT_DEFAULT as j, PLACEMENT_LIMITS as k, PLACEMENT_ZONE as l, cleanLoadout as m,
|
|
182
|
+
export { type AvatarCosmetics as A, type Box as B, type CosmeticsView as C, EARNED_COSMETICS as E, type LoadoutUpdate as L, type OverlayArt as O, type Placement as P, type CosmeticSlot as a, type Loadout as b, COSMETICS as c, COSMETICS_BY_ID as d, COSMETIC_ID_PATTERN as e, COSMETIC_SLOTS as f, type CosmeticGrantList as g, type CosmeticGrantRequest as h, type CosmeticItem as i, PLACEMENT_DEFAULT as j, PLACEMENT_LIMITS as k, PLACEMENT_ZONE as l, cleanLoadout as m, cleanWorn as n, emptyLoadout as o, fitPlacement as p, overlayBounds as q, ownedFrom as r, wornCosmetics as w };
|
package/dist/cosmetics.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AvatarCosmetics, P as Placement } from './cosmetics-contract-
|
|
2
|
-
export { B as Box, c as COSMETICS, d as COSMETICS_BY_ID, e as COSMETIC_ID_PATTERN, f as COSMETIC_SLOTS, g as CosmeticGrantList, h as CosmeticGrantRequest, i as CosmeticItem, a as CosmeticSlot, C as CosmeticsView, E as EARNED_COSMETICS, b as Loadout, L as LoadoutUpdate, O as OverlayArt, j as PLACEMENT_DEFAULT, k as PLACEMENT_LIMITS, l as PLACEMENT_ZONE, m as cleanLoadout, n as
|
|
1
|
+
import { A as AvatarCosmetics, P as Placement } from './cosmetics-contract-CzRH-ZG0.js';
|
|
2
|
+
export { B as Box, c as COSMETICS, d as COSMETICS_BY_ID, e as COSMETIC_ID_PATTERN, f as COSMETIC_SLOTS, g as CosmeticGrantList, h as CosmeticGrantRequest, i as CosmeticItem, a as CosmeticSlot, C as CosmeticsView, E as EARNED_COSMETICS, b as Loadout, L as LoadoutUpdate, O as OverlayArt, j as PLACEMENT_DEFAULT, k as PLACEMENT_LIMITS, l as PLACEMENT_ZONE, m as cleanLoadout, n as cleanWorn, o as emptyLoadout, p as fitPlacement, q as overlayBounds, r as ownedFrom, w as wornCosmetics } from './cosmetics-contract-CzRH-ZG0.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Avatar cosmetics — the renderer every app uses, so a name, an avatar and a
|
|
@@ -55,9 +55,16 @@ declare function avatarHtml(o: {
|
|
|
55
55
|
declare function messageHtml(text: string, worn?: AvatarCosmetics, opts?: {
|
|
56
56
|
keep?: boolean;
|
|
57
57
|
}): string;
|
|
58
|
+
/**
|
|
59
|
+
* When a reveal's last piece finishes, put the plain text back. An
|
|
60
|
+
* `animationend` handler: ensureCosmeticsStyles installs it on the document;
|
|
61
|
+
* a page that ships the stylesheet statically (and must not touch the
|
|
62
|
+
* document) attaches it to its own container instead.
|
|
63
|
+
*/
|
|
64
|
+
declare function finishReveal(e: AnimationEvent): void;
|
|
58
65
|
/** The whole stylesheet, with asset URLs under `assetBase`. */
|
|
59
66
|
declare function cosmeticsCss(assetBase?: string): string;
|
|
60
67
|
/** Add the stylesheet and the reveal clean-up to a document, once. */
|
|
61
68
|
declare function ensureCosmeticsStyles(doc?: Document, assetBase?: string): void;
|
|
62
69
|
|
|
63
|
-
export { AvatarCosmetics, COSMETICS_ASSET_BASE, Placement, avatarHtml, colourStyle, cosmeticsCss, decorHtml, ensureCosmeticsStyles, messageHtml, nameHtml, placementTransform };
|
|
70
|
+
export { AvatarCosmetics, COSMETICS_ASSET_BASE, Placement, avatarHtml, colourStyle, cosmeticsCss, decorHtml, ensureCosmeticsStyles, finishReveal, messageHtml, nameHtml, placementTransform };
|
package/dist/cosmetics.js
CHANGED
|
@@ -179,6 +179,21 @@ function emptyLoadout() {
|
|
|
179
179
|
placement: {}
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
+
function cleanWorn(raw) {
|
|
183
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
184
|
+
const src = raw;
|
|
185
|
+
const worn = {};
|
|
186
|
+
for (const slot of COSMETIC_SLOTS) {
|
|
187
|
+
const id = src[slot];
|
|
188
|
+
const it = typeof id === "string" ? COSMETICS_BY_ID.get(id) : void 0;
|
|
189
|
+
if (it && !it.hidden && it.slot === slot) worn[slot] = it.id;
|
|
190
|
+
}
|
|
191
|
+
const art = worn.overlay ? COSMETICS_BY_ID.get(worn.overlay)?.art : void 0;
|
|
192
|
+
if (art && src.placement && typeof src.placement === "object") {
|
|
193
|
+
worn.placement = fitPlacement(art, src.placement);
|
|
194
|
+
}
|
|
195
|
+
return Object.keys(worn).length ? worn : void 0;
|
|
196
|
+
}
|
|
182
197
|
function cleanLoadout(raw, owned) {
|
|
183
198
|
const out = emptyLoadout();
|
|
184
199
|
const src = raw && typeof raw === "object" ? raw : {};
|
|
@@ -510,11 +525,13 @@ export {
|
|
|
510
525
|
PLACEMENT_ZONE,
|
|
511
526
|
avatarHtml,
|
|
512
527
|
cleanLoadout,
|
|
528
|
+
cleanWorn,
|
|
513
529
|
colourStyle,
|
|
514
530
|
cosmeticsCss,
|
|
515
531
|
decorHtml,
|
|
516
532
|
emptyLoadout,
|
|
517
533
|
ensureCosmeticsStyles,
|
|
534
|
+
finishReveal,
|
|
518
535
|
fitPlacement,
|
|
519
536
|
messageHtml,
|
|
520
537
|
nameHtml,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/prefs-client",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.1.16",
|
|
4
|
+
"gitHead": "1870f7b16a89299f75df81e0fc3b0dda3af35798",
|
|
5
5
|
"description": "Client SDK for the hadoku unified preferences store. Wraps /prefs/api/v1/* with localStorage caching, debounced writes, Zod-validated reads, and a usePrefs() React hook, plus match history, ratings and leaderboards for every game (./games), the one resolved avatar per user (./avatar), and the avatar cosmetics renderer (./cosmetics).",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|