@linxin666/dsh-pet 0.4.4 → 0.4.6
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/README.i18n.yaml +2 -2
- package/README.md +46 -6
- package/README.zh.md +46 -6
- package/lib/client.js +244 -47
- package/lib/client.js.map +1 -1
- package/lib/index.js +287 -28
- package/lib/types/announce.d.ts +16 -0
- package/lib/types/announce.d.ts.map +1 -1
- package/lib/types/announce.js +16 -0
- package/lib/types/client/PetDockEntry.d.ts +6 -0
- package/lib/types/client/PetDockEntry.d.ts.map +1 -1
- package/lib/types/client/PetDockEntry.js +1 -1
- package/lib/types/client/PetSettingsCard.d.ts +4 -0
- package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
- package/lib/types/client/PetSettingsCard.js +16 -1
- package/lib/types/client/PetSprite.d.ts +7 -0
- package/lib/types/client/PetSprite.d.ts.map +1 -1
- package/lib/types/client/PetSprite.js +23 -13
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +224 -28
- package/lib/types/client/locales.d.ts +4 -0
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js +4 -0
- package/lib/types/index.d.ts +14 -3
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +32 -3
- package/lib/types/panel-actions.d.ts +96 -0
- package/lib/types/panel-actions.d.ts.map +1 -0
- package/lib/types/panel-actions.js +134 -0
- package/lib/types/routes.d.ts.map +1 -1
- package/lib/types/routes.js +10 -0
- package/lib/types/service.d.ts +137 -9
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/service.js +163 -21
- package/package.json +1 -1
- package/src/announce.ts +17 -0
- package/src/client/PetDockEntry.test.tsx +1 -0
- package/src/client/PetDockEntry.tsx +7 -0
- package/src/client/PetSettingsCard.test.tsx +88 -0
- package/src/client/PetSettingsCard.tsx +31 -0
- package/src/client/PetSprite.test.tsx +197 -0
- package/src/client/PetSprite.tsx +56 -12
- package/src/client/index.test.tsx +152 -4
- package/src/client/index.ts +228 -29
- package/src/client/locales.ts +4 -0
- package/src/index.test.ts +22 -0
- package/src/index.ts +45 -3
- package/src/panel-actions.test.ts +130 -0
- package/src/panel-actions.ts +182 -0
- package/src/registry.test.ts +11 -1
- package/src/routes.ts +9 -0
- package/src/service.test.ts +128 -0
- package/src/service.ts +218 -24
package/lib/index.js
CHANGED
|
@@ -18,10 +18,10 @@ const ANNOUNCE_DEFAULT_TTL_MS = 1e4;
|
|
|
18
18
|
*/
|
|
19
19
|
const ANNOUNCE_MAX_TTL_MS = 72e5;
|
|
20
20
|
/** Hard bounds: lengths and the TTL range (1 s .. 60 s). */
|
|
21
|
-
const TITLE_MAX = 80;
|
|
21
|
+
const TITLE_MAX$1 = 80;
|
|
22
22
|
const TEXT_MAX = 120;
|
|
23
23
|
const SOURCE_MAX = 64;
|
|
24
|
-
function boundedString(value, max) {
|
|
24
|
+
function boundedString$1(value, max) {
|
|
25
25
|
if (typeof value !== "string") return void 0;
|
|
26
26
|
const trimmed = value.trim();
|
|
27
27
|
if (trimmed === "") return void 0;
|
|
@@ -37,14 +37,14 @@ function boundedString(value, max) {
|
|
|
37
37
|
function parseAnnouncement(input, now) {
|
|
38
38
|
if (typeof input !== "object" || input === null) return void 0;
|
|
39
39
|
const data = input;
|
|
40
|
-
const source = boundedString(data.source, SOURCE_MAX);
|
|
41
|
-
const title = boundedString(data.title, TITLE_MAX);
|
|
40
|
+
const source = boundedString$1(data.source, SOURCE_MAX);
|
|
41
|
+
const title = boundedString$1(data.title, TITLE_MAX$1);
|
|
42
42
|
if (source === void 0 || title === void 0) return void 0;
|
|
43
43
|
const kind = data.kind === "balance" || data.kind === "cost" || data.kind === "plan" ? data.kind : void 0;
|
|
44
44
|
if (kind === void 0) return void 0;
|
|
45
|
-
const amount = boundedString(data.amount, TEXT_MAX);
|
|
46
|
-
const resetAt = boundedString(data.resetAt, TEXT_MAX);
|
|
47
|
-
const note = boundedString(data.note, TITLE_MAX);
|
|
45
|
+
const amount = boundedString$1(data.amount, TEXT_MAX);
|
|
46
|
+
const resetAt = boundedString$1(data.resetAt, TEXT_MAX);
|
|
47
|
+
const note = boundedString$1(data.note, TITLE_MAX$1);
|
|
48
48
|
const percent = typeof data.percent === "number" && Number.isFinite(data.percent) ? Math.max(0, Math.min(100, data.percent)) : void 0;
|
|
49
49
|
if ((kind === "balance" || kind === "cost") && amount === void 0) return void 0;
|
|
50
50
|
if (kind === "plan" && percent === void 0) return void 0;
|
|
@@ -1338,6 +1338,127 @@ var PetLedger = class {
|
|
|
1338
1338
|
}
|
|
1339
1339
|
};
|
|
1340
1340
|
//#endregion
|
|
1341
|
+
//#region src/panel-actions.ts
|
|
1342
|
+
/**
|
|
1343
|
+
* Hover-panel action contract — the extension point a sibling plugin uses to
|
|
1344
|
+
* add its own button to the pet's floating hover panel (issue #6).
|
|
1345
|
+
*
|
|
1346
|
+
* A plugin registers one action in process through the pet service
|
|
1347
|
+
* (`ctx.pet.registerPanelAction({ id, label, onSelect })`); the host validates
|
|
1348
|
+
* it into a bounded view, serves the registered actions in the state snapshot
|
|
1349
|
+
* (`PetStateView.panelActions`), and the browser half renders one button per
|
|
1350
|
+
* entry at the end of the panel's action row. A click travels back through
|
|
1351
|
+
* `POST /api/pet/panel-action`, which dispatches to the registering plugin's
|
|
1352
|
+
* own callback — the pet owns the row, the plugin owns what the button does.
|
|
1353
|
+
*
|
|
1354
|
+
* The validation and the registry live in this pure module so the contract has
|
|
1355
|
+
* exactly one home and stays testable without the cordis service.
|
|
1356
|
+
* @module @linxin666/dsh-pet/panel-actions
|
|
1357
|
+
*/
|
|
1358
|
+
/** How many plugin actions one hover panel can carry at most. */
|
|
1359
|
+
const MAX_PANEL_ACTIONS = 8;
|
|
1360
|
+
/**
|
|
1361
|
+
* Action id grammar: a lowercase id in the shape pet and decoration ids use
|
|
1362
|
+
* (`^` + kebab/dot segments). The id is what a click travels back on, so it
|
|
1363
|
+
* has to be stable, addressable and free of separators the wire would treat as
|
|
1364
|
+
* structure.
|
|
1365
|
+
*/
|
|
1366
|
+
const ID_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
|
1367
|
+
/**
|
|
1368
|
+
* Label bound. The action row is compact and wraps beyond a few characters per
|
|
1369
|
+
* button, so a plugin names its action (换装, Quota) rather than a sentence;
|
|
1370
|
+
* the optional title carries the longer explanation as a tooltip.
|
|
1371
|
+
*/
|
|
1372
|
+
const LABEL_MAX = 24;
|
|
1373
|
+
/** Title (tooltip) bound; the same reason voice-pack labels are bounded. */
|
|
1374
|
+
const TITLE_MAX = 80;
|
|
1375
|
+
function boundedString(value, max) {
|
|
1376
|
+
if (typeof value !== "string") return void 0;
|
|
1377
|
+
const trimmed = value.trim();
|
|
1378
|
+
if (trimmed === "") return void 0;
|
|
1379
|
+
return trimmed.length <= max ? trimmed : trimmed.slice(0, max);
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Validate one registration. Returns undefined — never throws — when the shape
|
|
1383
|
+
* is unusable: the id must match the id grammar and the label must survive
|
|
1384
|
+
* truncation, so a click can always be dispatched back to a known row.
|
|
1385
|
+
* @param input - the registration a sibling plugin passed to the service.
|
|
1386
|
+
* @returns the wire view, or undefined when the registration is malformed.
|
|
1387
|
+
*/
|
|
1388
|
+
function normalizePanelAction(input) {
|
|
1389
|
+
if (typeof input !== "object" || input === null) return void 0;
|
|
1390
|
+
const data = input;
|
|
1391
|
+
const id = typeof data.id === "string" ? data.id.trim() : void 0;
|
|
1392
|
+
if (id === void 0 || !ID_PATTERN.test(id)) return void 0;
|
|
1393
|
+
const label = boundedString(data.label, LABEL_MAX);
|
|
1394
|
+
if (label === void 0) return void 0;
|
|
1395
|
+
const title = boundedString(data.title, TITLE_MAX);
|
|
1396
|
+
const order = typeof data.order === "number" && Number.isFinite(data.order) ? data.order : 0;
|
|
1397
|
+
return {
|
|
1398
|
+
id,
|
|
1399
|
+
label,
|
|
1400
|
+
...title === void 0 ? {} : { title },
|
|
1401
|
+
order
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* The panel's action registry: one bounded, ordered table of plugin actions.
|
|
1406
|
+
*
|
|
1407
|
+
* Registration is id-wins (a later registration of the same id replaces the
|
|
1408
|
+
* earlier one, and the superseded disposer stops touching the table so a
|
|
1409
|
+
* disposing plugin can never remove the action that replaced it). The table is
|
|
1410
|
+
* in-memory only — it dies with the pet service fiber — and every entry is
|
|
1411
|
+
* reclaimed by the disposer the registering plugin runs with its own fiber.
|
|
1412
|
+
*/
|
|
1413
|
+
var PanelActionRegistry = class {
|
|
1414
|
+
actions = /* @__PURE__ */ new Map();
|
|
1415
|
+
/**
|
|
1416
|
+
* Register one action.
|
|
1417
|
+
* @param input - the registration a sibling plugin passed to the service.
|
|
1418
|
+
* @returns a disposer removing this registration.
|
|
1419
|
+
* @throws when the registration is malformed. Unlike `announce` — a hot path
|
|
1420
|
+
* whose payload a caller may build from untrusted data — a registration is
|
|
1421
|
+
* built once at the registering plugin's own apply, so a bad id or label is a
|
|
1422
|
+
* wiring mistake that should fail where it was written.
|
|
1423
|
+
*/
|
|
1424
|
+
register(input) {
|
|
1425
|
+
const registration = typeof input === "object" && input !== null ? input : {};
|
|
1426
|
+
const view = normalizePanelAction(registration);
|
|
1427
|
+
if (view === void 0) throw new Error("[dsh-pet] invalid panel action: id and label are required");
|
|
1428
|
+
if (typeof registration.onSelect !== "function") throw new Error("[dsh-pet] invalid panel action: onSelect must be a function");
|
|
1429
|
+
if (!this.actions.has(view.id) && this.actions.size >= 8) throw new Error("[dsh-pet] panel action limit reached: 8");
|
|
1430
|
+
const entry = {
|
|
1431
|
+
view,
|
|
1432
|
+
onSelect: registration.onSelect
|
|
1433
|
+
};
|
|
1434
|
+
this.actions.set(view.id, entry);
|
|
1435
|
+
return () => {
|
|
1436
|
+
if (this.actions.get(view.id) === entry) this.actions.delete(view.id);
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
/** The registered actions as the state view serves them, in render order. */
|
|
1440
|
+
views() {
|
|
1441
|
+
return [...this.actions.values()].map((entry) => entry.view).sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Dispatch a click to the plugin that registered this id.
|
|
1445
|
+
* @param id - the id the browser half reported.
|
|
1446
|
+
* @param context - what the pet looked like when the click arrived.
|
|
1447
|
+
* @returns whether the id was registered. A handler that throws rejects:
|
|
1448
|
+
* the caller decides how a sibling plugin's failure is reported.
|
|
1449
|
+
*/
|
|
1450
|
+
async select(id, context) {
|
|
1451
|
+
const entry = this.actions.get(id);
|
|
1452
|
+
if (entry === void 0) return false;
|
|
1453
|
+
await entry.onSelect(context);
|
|
1454
|
+
return true;
|
|
1455
|
+
}
|
|
1456
|
+
/** Drop every registration (service teardown; tests). */
|
|
1457
|
+
clear() {
|
|
1458
|
+
this.actions.clear();
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
//#endregion
|
|
1341
1462
|
//#region src/dsh-home.ts
|
|
1342
1463
|
/**
|
|
1343
1464
|
* DSH_HOME resolution shared by the plugin family's Host halves: the
|
|
@@ -4597,6 +4718,18 @@ function petEntryView(entry, globalVoice) {
|
|
|
4597
4718
|
*/
|
|
4598
4719
|
/** The unified gameplay currency: the shared treat (小鱼干) ledger. */
|
|
4599
4720
|
const GAMEPLAY_TREATS_CURRENCY = "treats";
|
|
4721
|
+
/** Every accepted {@link PetStatusBubbleMode}, in settings-card order. */
|
|
4722
|
+
const STATUS_BUBBLE_MODES = ["auto", "off"];
|
|
4723
|
+
/** The shipped default; the switch changes nothing until a user turns it off. */
|
|
4724
|
+
const DEFAULT_STATUS_BUBBLE_MODE = "auto";
|
|
4725
|
+
/**
|
|
4726
|
+
* Normalize a stored, live or hand-edited bubble mode.
|
|
4727
|
+
* @param value - the value the settings document carries, when any.
|
|
4728
|
+
* @returns the effective mode; anything but 'off' renders the bubbles.
|
|
4729
|
+
*/
|
|
4730
|
+
function statusBubbleMode(value) {
|
|
4731
|
+
return value === "off" ? "off" : DEFAULT_STATUS_BUBBLE_MODE;
|
|
4732
|
+
}
|
|
4600
4733
|
/** Hard cap on simultaneously displayed session bubbles (most recent first). */
|
|
4601
4734
|
const MAX_SESSION_BUBBLES = 12;
|
|
4602
4735
|
/**
|
|
@@ -4615,8 +4748,17 @@ var PetService = class extends Service {
|
|
|
4615
4748
|
enabled;
|
|
4616
4749
|
/** Status-decoration master switch (M5, #567); mirrored from settings. */
|
|
4617
4750
|
decorationEnabled;
|
|
4618
|
-
/**
|
|
4619
|
-
|
|
4751
|
+
/** Whether the pet renders its own session/status bubbles (issue #6). */
|
|
4752
|
+
statusBubbles;
|
|
4753
|
+
/**
|
|
4754
|
+
* Plugin-authored announcements, one slot per `source` (issue #1812). The
|
|
4755
|
+
* contract started as a single slot, where a second announcing plugin
|
|
4756
|
+
* displaced the first; the map is the upgrade the design note predicted for
|
|
4757
|
+
* exactly this moment. Insertion order is the render order and re-announcing
|
|
4758
|
+
* a source updates its entry in place, so two publishers on different
|
|
4759
|
+
* cadences never swap positions.
|
|
4760
|
+
*/
|
|
4761
|
+
announcements = /* @__PURE__ */ new Map();
|
|
4620
4762
|
disposeActivity;
|
|
4621
4763
|
/** Session whose most recent meaningful event currently drives the global pet. */
|
|
4622
4764
|
displaySession;
|
|
@@ -4633,6 +4775,13 @@ var PetService = class extends Service {
|
|
|
4633
4775
|
*/
|
|
4634
4776
|
sessionActivity = /* @__PURE__ */ new Map();
|
|
4635
4777
|
/**
|
|
4778
|
+
* Hover-panel actions registered by sibling plugins (issue #6). The pet owns
|
|
4779
|
+
* the panel row and serves the registrations; each plugin owns the callback a
|
|
4780
|
+
* click dispatches to. Bounded, in-memory, reclaimed with the registering
|
|
4781
|
+
* plugin's disposer.
|
|
4782
|
+
*/
|
|
4783
|
+
panelActions = new PanelActionRegistry();
|
|
4784
|
+
/**
|
|
4636
4785
|
* Sessions whose reward source is the official event stream. This metadata
|
|
4637
4786
|
* outlives transient visual resets so a derived legacy `done` cannot reward
|
|
4638
4787
|
* the same turn again after the pet is disabled and re-enabled.
|
|
@@ -4661,12 +4810,10 @@ var PetService = class extends Service {
|
|
|
4661
4810
|
petId: this.registry.defaultEntry().id
|
|
4662
4811
|
};
|
|
4663
4812
|
const selected = this.registry.byId(persist.petId) ?? this.registry.defaultEntry();
|
|
4664
|
-
const voiceRemarks = mergeVoicePacks(this.registry.globalVoice, selected.voice)?.remarks;
|
|
4665
4813
|
const ledgerConfig = {
|
|
4666
4814
|
affinity: config.affinity,
|
|
4667
4815
|
treats: config.treats,
|
|
4668
|
-
|
|
4669
|
-
voiceRemarks
|
|
4816
|
+
...this.remarkLayers(selected)
|
|
4670
4817
|
};
|
|
4671
4818
|
this.ledger = new PetLedger(persist, ledgerConfig);
|
|
4672
4819
|
this.stateConfig = {
|
|
@@ -4676,6 +4823,7 @@ var PetService = class extends Service {
|
|
|
4676
4823
|
this.machine = new PetStateMachine(this.stateConfig);
|
|
4677
4824
|
this.enabled = config.enabled ?? true;
|
|
4678
4825
|
this.decorationEnabled = config.decorationEnabled ?? true;
|
|
4826
|
+
this.statusBubbles = statusBubbleMode(config.statusBubbles);
|
|
4679
4827
|
this.syncActivity();
|
|
4680
4828
|
}
|
|
4681
4829
|
/**
|
|
@@ -4699,22 +4847,115 @@ var PetService = class extends Service {
|
|
|
4699
4847
|
isEnabled() {
|
|
4700
4848
|
return this.enabled;
|
|
4701
4849
|
}
|
|
4850
|
+
/**
|
|
4851
|
+
* The remark layers one pet contributes to the ledger: its manifest pools
|
|
4852
|
+
* first, then the voice packs (a pet directory's voice.json over the global
|
|
4853
|
+
* `$DSH_HOME/pets/.voice.json`). Every path that seats the ledger's remark
|
|
4854
|
+
* pools resolves them here, so no call site can apply the manifest pools and
|
|
4855
|
+
* silently drop the voice layer: doing that reverted a pet whose lines a voice
|
|
4856
|
+
* pack had translated back to the built-in pools the moment the settings
|
|
4857
|
+
* surface applied.
|
|
4858
|
+
* @param entry - the pet whose remark pools apply.
|
|
4859
|
+
* @returns the layers `PetLedger.setRemarks` takes.
|
|
4860
|
+
*/
|
|
4861
|
+
remarkLayers(entry) {
|
|
4862
|
+
return {
|
|
4863
|
+
remarks: entry.remarks,
|
|
4864
|
+
voiceRemarks: mergeVoicePacks(this.registry.globalVoice, entry.voice)?.remarks
|
|
4865
|
+
};
|
|
4866
|
+
}
|
|
4867
|
+
/** Re-seat the ledger's remark pools from one pet's layers. */
|
|
4868
|
+
applyRemarks(entry) {
|
|
4869
|
+
const layers = this.remarkLayers(entry);
|
|
4870
|
+
this.ledger.setRemarks(layers.remarks, layers.voiceRemarks);
|
|
4871
|
+
}
|
|
4702
4872
|
/** RPC: current pet state snapshot. */
|
|
4703
4873
|
async state(currentSessionId) {
|
|
4704
4874
|
return this.view(currentSessionId);
|
|
4705
4875
|
}
|
|
4706
4876
|
/**
|
|
4707
|
-
* RPC: one plugin-authored announcement bubble
|
|
4708
|
-
*
|
|
4709
|
-
*
|
|
4710
|
-
*
|
|
4877
|
+
* RPC: one plugin-authored announcement bubble, held in the publisher's own
|
|
4878
|
+
* slot keyed by `source` (issue #1812). The payload is validated into a
|
|
4879
|
+
* bounded PetAnnouncement; a malformed one is dropped silently — a sibling
|
|
4880
|
+
* plugin's bug must never surface as pet breakage. Re-announcing replaces
|
|
4881
|
+
* only the caller's own slot, so publishers coexist instead of displacing
|
|
4882
|
+
* each other. Announcements are in-memory only.
|
|
4883
|
+
*
|
|
4884
|
+
* The slot table is bounded by {@link MAX_ANNOUNCEMENTS}. Expired entries are
|
|
4885
|
+
* pruned first, so a silent publisher never holds a slot; when the table is
|
|
4886
|
+
* genuinely full, the entry that has been silent longest gives up its slot
|
|
4887
|
+
* to the arriving one — a publisher that keeps refreshing is never evicted.
|
|
4711
4888
|
*/
|
|
4712
4889
|
announce(input) {
|
|
4713
4890
|
const parsed = parseAnnouncement(input, Date.now());
|
|
4714
4891
|
if (parsed === void 0) return { ok: false };
|
|
4715
|
-
|
|
4892
|
+
const now = Date.now();
|
|
4893
|
+
for (const [source, entry] of this.announcements) if (!announcementFresh(entry, now)) this.announcements.delete(source);
|
|
4894
|
+
if (!this.announcements.has(parsed.source) && this.announcements.size >= 4) {
|
|
4895
|
+
let oldest = "";
|
|
4896
|
+
let oldestAt = Number.POSITIVE_INFINITY;
|
|
4897
|
+
for (const [source, entry] of this.announcements) if (entry.at < oldestAt) {
|
|
4898
|
+
oldest = source;
|
|
4899
|
+
oldestAt = entry.at;
|
|
4900
|
+
}
|
|
4901
|
+
if (oldest !== "") this.announcements.delete(oldest);
|
|
4902
|
+
}
|
|
4903
|
+
this.announcements.set(parsed.source, parsed);
|
|
4716
4904
|
return { ok: true };
|
|
4717
4905
|
}
|
|
4906
|
+
/**
|
|
4907
|
+
* The announcement slots still fresh, in render order. An expired entry
|
|
4908
|
+
* simply stops appearing (the client's 2 s poll drops it); no timer owns its
|
|
4909
|
+
* removal.
|
|
4910
|
+
*/
|
|
4911
|
+
freshAnnouncements() {
|
|
4912
|
+
const now = Date.now();
|
|
4913
|
+
return [...this.announcements.values()].filter((entry) => announcementFresh(entry, now));
|
|
4914
|
+
}
|
|
4915
|
+
/**
|
|
4916
|
+
* Register one action into the hover panel's action row (issue #6). The pet
|
|
4917
|
+
* renders the button and dispatches the click back to `onSelect`; the plugin
|
|
4918
|
+
* decides what the button does. Registering is a wiring step, so a malformed
|
|
4919
|
+
* registration throws at the caller's own apply instead of being dropped.
|
|
4920
|
+
*
|
|
4921
|
+
* The registration is reclaimed by the disposer, so the idiomatic call binds
|
|
4922
|
+
* it to the registering plugin's fiber:
|
|
4923
|
+
* ```ts
|
|
4924
|
+
* ctx.effect(() => ctx.pet.registerPanelAction({
|
|
4925
|
+
* id: 'pet-quota-swap',
|
|
4926
|
+
* label: '换装',
|
|
4927
|
+
* onSelect: async () => { await cycleToNextPet(ctx.pet) },
|
|
4928
|
+
* }))
|
|
4929
|
+
* ```
|
|
4930
|
+
* @param action - the registration to serve in the panel row.
|
|
4931
|
+
* @returns a disposer that removes this registration.
|
|
4932
|
+
* @throws when the id, label or callback is unusable, or the row is full.
|
|
4933
|
+
*/
|
|
4934
|
+
registerPanelAction(action) {
|
|
4935
|
+
return this.panelActions.register(action);
|
|
4936
|
+
}
|
|
4937
|
+
/**
|
|
4938
|
+
* RPC: dispatch one hover-panel action click back to the plugin that
|
|
4939
|
+
* registered it. A rejected id is a stale click (the plugin disposed its
|
|
4940
|
+
* registration between render and click), and a throwing callback is that
|
|
4941
|
+
* plugin's own failure — neither may surface as pet breakage, so both answer
|
|
4942
|
+
* `{ ok: false }` instead of throwing out of the route.
|
|
4943
|
+
* @param id - the action id the browser half reported.
|
|
4944
|
+
* @returns whether the click reached a registered action.
|
|
4945
|
+
*/
|
|
4946
|
+
async selectPanelAction(id) {
|
|
4947
|
+
try {
|
|
4948
|
+
return await this.panelActions.select(id, { petId: this.selectedPetId() }) ? { ok: true } : {
|
|
4949
|
+
ok: false,
|
|
4950
|
+
error: "unknown-panel-action"
|
|
4951
|
+
};
|
|
4952
|
+
} catch {
|
|
4953
|
+
return {
|
|
4954
|
+
ok: false,
|
|
4955
|
+
error: "panel-action-failed"
|
|
4956
|
+
};
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4718
4959
|
/** Current persisted display config (read-only view). */
|
|
4719
4960
|
display() {
|
|
4720
4961
|
return { ...this.ledger.snapshot.display };
|
|
@@ -4762,8 +5003,7 @@ var PetService = class extends Service {
|
|
|
4762
5003
|
error: "unknown-pet"
|
|
4763
5004
|
};
|
|
4764
5005
|
this.ledger.setPetId(entry.id);
|
|
4765
|
-
|
|
4766
|
-
this.ledger.setRemarks(entry.remarks, voiceRemarks);
|
|
5006
|
+
this.applyRemarks(entry);
|
|
4767
5007
|
this.flush();
|
|
4768
5008
|
this.syncSettingsFromPet();
|
|
4769
5009
|
return {
|
|
@@ -5185,13 +5425,14 @@ var PetService = class extends Service {
|
|
|
5185
5425
|
*/
|
|
5186
5426
|
applySettingsSection(section) {
|
|
5187
5427
|
this.decorationEnabled = section.decorationEnabled ?? true;
|
|
5428
|
+
this.statusBubbles = statusBubbleMode(section.statusBubbles);
|
|
5188
5429
|
const selected = typeof section.petId === "string" ? this.registry.byId(section.petId) : void 0;
|
|
5189
5430
|
if (selected !== void 0) {
|
|
5190
5431
|
this.ledger.setPetId(selected.id);
|
|
5191
|
-
this.
|
|
5432
|
+
this.applyRemarks(selected);
|
|
5192
5433
|
} else if (section.petId !== void 0) this.syncSettingsFromPet();
|
|
5193
5434
|
const next = { ...this.ledger.snapshot.display };
|
|
5194
|
-
next.visible = section.visible
|
|
5435
|
+
next.visible = section.visible;
|
|
5195
5436
|
next.size = Math.round(Math.min(DISPLAY_SIZE_MAX, Math.max(32, section.size)));
|
|
5196
5437
|
next.right = Math.round(Math.min(DISPLAY_INSET_MAX, Math.max(0, section.right)));
|
|
5197
5438
|
next.bottom = Math.round(Math.min(DISPLAY_INSET_MAX, Math.max(0, section.bottom)));
|
|
@@ -5252,8 +5493,10 @@ var PetService = class extends Service {
|
|
|
5252
5493
|
settleGameplay(state, gameplayDef, Date.now(), { sessionActive: snapshot.sessionActive });
|
|
5253
5494
|
gameplay = this.gameplayViewOf(state);
|
|
5254
5495
|
}
|
|
5255
|
-
const
|
|
5496
|
+
const announcements = this.freshAnnouncements();
|
|
5497
|
+
const announcement = announcements.reduce((freshest, entry) => freshest === void 0 || entry.at > freshest.at ? entry : freshest, void 0);
|
|
5256
5498
|
const skin = this.persistedSkin(entry);
|
|
5499
|
+
const panelActions = this.panelActions.views();
|
|
5257
5500
|
return {
|
|
5258
5501
|
animation: snapshot.animation,
|
|
5259
5502
|
...snapshot.bubble === void 0 ? {} : { bubble: snapshot.bubble },
|
|
@@ -5262,8 +5505,14 @@ var PetService = class extends Service {
|
|
|
5262
5505
|
sessions,
|
|
5263
5506
|
...decoration === void 0 ? {} : { decoration },
|
|
5264
5507
|
...announcement === void 0 ? {} : { announcement },
|
|
5508
|
+
...announcements.length === 0 ? {} : { announcements },
|
|
5509
|
+
statusBubbles: this.statusBubbles,
|
|
5510
|
+
...panelActions.length === 0 ? {} : { panelActions },
|
|
5265
5511
|
affinity: this.ledger.affinityView(Date.now()),
|
|
5266
|
-
display: {
|
|
5512
|
+
display: {
|
|
5513
|
+
...this.ledger.snapshot.display,
|
|
5514
|
+
visible: this.isEnabled() && this.ledger.snapshot.display.visible
|
|
5515
|
+
},
|
|
5267
5516
|
pet: {
|
|
5268
5517
|
id: entry.id,
|
|
5269
5518
|
displayName: entry.displayName,
|
|
@@ -5967,6 +6216,11 @@ function makePetRoutes(deps) {
|
|
|
5967
6216
|
if (typeof petId !== "string") return Promise.reject(/* @__PURE__ */ new Error("invalid-pet"));
|
|
5968
6217
|
return service.setPetId(petId);
|
|
5969
6218
|
}),
|
|
6219
|
+
postRoute(ctx, "/api/pet/panel-action", (body) => {
|
|
6220
|
+
const id = body.id;
|
|
6221
|
+
if (typeof id !== "string") return Promise.reject(/* @__PURE__ */ new Error("invalid-panel-action"));
|
|
6222
|
+
return service.selectPanelAction(id);
|
|
6223
|
+
}),
|
|
5970
6224
|
postRoute(ctx, "/api/pet/gameplay/touch", (body) => {
|
|
5971
6225
|
const zone = body.zone;
|
|
5972
6226
|
if (zone !== void 0 && typeof zone !== "string") return Promise.reject(/* @__PURE__ */ new Error("invalid-zone"));
|
|
@@ -6142,7 +6396,8 @@ const PET_FORM_DEFAULTS = {
|
|
|
6142
6396
|
bubbleScale: 1,
|
|
6143
6397
|
petId: DEFAULT_PET_ID,
|
|
6144
6398
|
enabled: true,
|
|
6145
|
-
decorationEnabled: true
|
|
6399
|
+
decorationEnabled: true,
|
|
6400
|
+
statusBubbles: DEFAULT_STATUS_BUBBLE_MODE
|
|
6146
6401
|
};
|
|
6147
6402
|
/**
|
|
6148
6403
|
* Plugin configuration. Under the 0.1.7 settings model a plugin's own Cordis
|
|
@@ -6167,7 +6422,8 @@ const Config = z.object({
|
|
|
6167
6422
|
bubbleScale: z.number().step(.05).min(BUBBLE_SCALE_MIN).max(2).default(PET_FORM_DEFAULTS.bubbleScale).volatile(),
|
|
6168
6423
|
petId: z.string().volatile(),
|
|
6169
6424
|
enabled: z.boolean().default(PET_FORM_DEFAULTS.enabled).volatile(),
|
|
6170
|
-
decorationEnabled: z.boolean().default(PET_FORM_DEFAULTS.decorationEnabled).volatile()
|
|
6425
|
+
decorationEnabled: z.boolean().default(PET_FORM_DEFAULTS.decorationEnabled).volatile(),
|
|
6426
|
+
statusBubbles: z.union([...STATUS_BUBBLE_MODES]).default(PET_FORM_DEFAULTS.statusBubbles).volatile()
|
|
6171
6427
|
});
|
|
6172
6428
|
/**
|
|
6173
6429
|
* Read one live config field.
|
|
@@ -6224,6 +6480,7 @@ function displayField(key, live, persisted, committed) {
|
|
|
6224
6480
|
* @returns the resolved settings section.
|
|
6225
6481
|
*/
|
|
6226
6482
|
function petSettingsSection(config, fallbackPetId, persisted = {}, committed = {}) {
|
|
6483
|
+
const enabled = readLive(config.enabled, PET_FORM_DEFAULTS.enabled);
|
|
6227
6484
|
return {
|
|
6228
6485
|
visible: displayField("visible", config.visible, persisted, committed),
|
|
6229
6486
|
size: displayField("size", config.size, persisted, committed),
|
|
@@ -6231,8 +6488,9 @@ function petSettingsSection(config, fallbackPetId, persisted = {}, committed = {
|
|
|
6231
6488
|
bottom: displayField("bottom", config.bottom, persisted, committed),
|
|
6232
6489
|
bubbleScale: displayField("bubbleScale", config.bubbleScale, persisted, committed),
|
|
6233
6490
|
petId: readLive(config.petId, fallbackPetId),
|
|
6234
|
-
enabled
|
|
6235
|
-
decorationEnabled: readLive(config.decorationEnabled, PET_FORM_DEFAULTS.decorationEnabled)
|
|
6491
|
+
enabled,
|
|
6492
|
+
decorationEnabled: readLive(config.decorationEnabled, PET_FORM_DEFAULTS.decorationEnabled),
|
|
6493
|
+
statusBubbles: statusBubbleMode(readLive(config.statusBubbles, void 0))
|
|
6236
6494
|
};
|
|
6237
6495
|
}
|
|
6238
6496
|
/** The settings row ids a pet install is served under, most specific first. */
|
|
@@ -6277,6 +6535,7 @@ function applyImpl(ctx, config = {}) {
|
|
|
6277
6535
|
...config,
|
|
6278
6536
|
enabled: readLive(config.enabled, PET_FORM_DEFAULTS.enabled),
|
|
6279
6537
|
decorationEnabled: readLive(config.decorationEnabled, PET_FORM_DEFAULTS.decorationEnabled),
|
|
6538
|
+
statusBubbles: statusBubbleMode(readLive(config.statusBubbles, void 0)),
|
|
6280
6539
|
registry
|
|
6281
6540
|
});
|
|
6282
6541
|
service.settingsNamespaceProvider = () => servedRow(ctx)?.ns;
|
|
@@ -6320,4 +6579,4 @@ function applyImpl(ctx, config = {}) {
|
|
|
6320
6579
|
syncSettings();
|
|
6321
6580
|
}
|
|
6322
6581
|
//#endregion
|
|
6323
|
-
export { AFFINITY_MAX, AFFINITY_RANKS, BUILTIN_REMARKS, Config, DEFAULT_FRAME_COUNTS, DEFAULT_PET_CELL, DEFAULT_PET_COLUMNS, DEFAULT_PET_ID, DEFAULT_PET_NAME, DEFAULT_PET_ROW_COUNT, DEFAULT_TRACK_PATTERNS, MAX_SESSION_BUBBLES, PET_API_PREFIX, PET_ASSET_PREFIX, PET_FORM_DEFAULTS, PET_NAME_MAX_LENGTH, PET_ROW_ORDER, PetService, PetStateMachine, REMARK_KINDS, REMARK_LINES_MAX, REMARK_LINE_MAX, RemarkPicker, animationForPhase, apply, applyInteraction, applyTurnReward, builtinRemark, codexPetsDir, consumeTreat, defaultDisplayConfig, defaultTreatConfig, emptyAffinity, emptyPersist, emptyTreatLedger, inject, loadPetPersist, loadPetRegistry, makePetRoutes, name, normalizePetRemarks, petEntryView, petHomeDir, petPackageRoot, petSettingsSection, rankOf, resolvePetManifest, rowOf, savePetPersist, settleTreatGrants };
|
|
6582
|
+
export { AFFINITY_MAX, AFFINITY_RANKS, BUILTIN_REMARKS, Config, DEFAULT_FRAME_COUNTS, DEFAULT_PET_CELL, DEFAULT_PET_COLUMNS, DEFAULT_PET_ID, DEFAULT_PET_NAME, DEFAULT_PET_ROW_COUNT, DEFAULT_STATUS_BUBBLE_MODE, DEFAULT_TRACK_PATTERNS, MAX_PANEL_ACTIONS, MAX_SESSION_BUBBLES, PET_API_PREFIX, PET_ASSET_PREFIX, PET_FORM_DEFAULTS, PET_NAME_MAX_LENGTH, PET_ROW_ORDER, PanelActionRegistry, PetService, PetStateMachine, REMARK_KINDS, REMARK_LINES_MAX, REMARK_LINE_MAX, RemarkPicker, STATUS_BUBBLE_MODES, animationForPhase, apply, applyInteraction, applyTurnReward, builtinRemark, codexPetsDir, consumeTreat, defaultDisplayConfig, defaultTreatConfig, emptyAffinity, emptyPersist, emptyTreatLedger, inject, loadPetPersist, loadPetRegistry, makePetRoutes, name, normalizePanelAction, normalizePetRemarks, petEntryView, petHomeDir, petPackageRoot, petSettingsSection, rankOf, resolvePetManifest, rowOf, savePetPersist, settleTreatGrants, statusBubbleMode };
|
package/lib/types/announce.d.ts
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* validates it into a bounded payload, and the browser half renders it as a
|
|
5
5
|
* dedicated, specially styled bubble above the session bubble stack.
|
|
6
6
|
*
|
|
7
|
+
* One slot per publisher (issue #1812): `source` is the slot key, so two
|
|
8
|
+
* announcing plugins coexist instead of displacing each other, and each keeps
|
|
9
|
+
* its own TTL. The single-slot contract this replaced is kept on the wire as
|
|
10
|
+
* the freshest entry, so an older browser half keeps working unchanged.
|
|
11
|
+
*
|
|
7
12
|
* The validation lives in this pure module so the wire contract has exactly
|
|
8
13
|
* one home and stays testable without the cordis service.
|
|
9
14
|
* @module @linxin666/dsh-pet/announce
|
|
@@ -33,6 +38,17 @@ export interface PetAnnouncement {
|
|
|
33
38
|
}
|
|
34
39
|
/** Default freshness window. */
|
|
35
40
|
export declare const ANNOUNCE_DEFAULT_TTL_MS = 10000;
|
|
41
|
+
/**
|
|
42
|
+
* How many publishers can hold an announcement bubble at once (issue #1812).
|
|
43
|
+
*
|
|
44
|
+
* The contract has exactly one slot per `source` — that is the whole upgrade
|
|
45
|
+
* from the single-slot design — but the pet's bubble stack is a finite column,
|
|
46
|
+
* so the table is bounded rather than open. The bound is deliberately above the
|
|
47
|
+
* realistic publisher count (a quota bubble, a balance bubble, a notification):
|
|
48
|
+
* it exists so a misbehaving publisher that rotates `source` per bubble cannot
|
|
49
|
+
* grow the pet's stack without limit.
|
|
50
|
+
*/
|
|
51
|
+
export declare const MAX_ANNOUNCEMENTS = 4;
|
|
36
52
|
/**
|
|
37
53
|
* Hard TTL ceiling. A repeating announcer declares its poll cadence as
|
|
38
54
|
* the TTL, so an always-on bubble stays continuous across polls; the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../src/announce.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../src/announce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAA;IACd,yFAAyF;IACzF,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IACjC,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAA;IACb,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,KAAK,CAAA;IAC3B,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAA;CACX;AAED,gCAAgC;AAChC,eAAO,MAAM,uBAAuB,QAAS,CAAA;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,UAAY,CAAA;AAc5C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAgC1F;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAErF"}
|
package/lib/types/announce.js
CHANGED
|
@@ -4,12 +4,28 @@
|
|
|
4
4
|
* validates it into a bounded payload, and the browser half renders it as a
|
|
5
5
|
* dedicated, specially styled bubble above the session bubble stack.
|
|
6
6
|
*
|
|
7
|
+
* One slot per publisher (issue #1812): `source` is the slot key, so two
|
|
8
|
+
* announcing plugins coexist instead of displacing each other, and each keeps
|
|
9
|
+
* its own TTL. The single-slot contract this replaced is kept on the wire as
|
|
10
|
+
* the freshest entry, so an older browser half keeps working unchanged.
|
|
11
|
+
*
|
|
7
12
|
* The validation lives in this pure module so the wire contract has exactly
|
|
8
13
|
* one home and stays testable without the cordis service.
|
|
9
14
|
* @module @linxin666/dsh-pet/announce
|
|
10
15
|
*/
|
|
11
16
|
/** Default freshness window. */
|
|
12
17
|
export const ANNOUNCE_DEFAULT_TTL_MS = 10_000;
|
|
18
|
+
/**
|
|
19
|
+
* How many publishers can hold an announcement bubble at once (issue #1812).
|
|
20
|
+
*
|
|
21
|
+
* The contract has exactly one slot per `source` — that is the whole upgrade
|
|
22
|
+
* from the single-slot design — but the pet's bubble stack is a finite column,
|
|
23
|
+
* so the table is bounded rather than open. The bound is deliberately above the
|
|
24
|
+
* realistic publisher count (a quota bubble, a balance bubble, a notification):
|
|
25
|
+
* it exists so a misbehaving publisher that rotates `source` per bubble cannot
|
|
26
|
+
* grow the pet's stack without limit.
|
|
27
|
+
*/
|
|
28
|
+
export const MAX_ANNOUNCEMENTS = 4;
|
|
13
29
|
/**
|
|
14
30
|
* Hard TTL ceiling. A repeating announcer declares its poll cadence as
|
|
15
31
|
* the TTL, so an always-on bubble stays continuous across polls; the
|
|
@@ -34,6 +34,12 @@ export interface PetInjected {
|
|
|
34
34
|
dragEnd: (right: number, bottom: number) => void;
|
|
35
35
|
/** Rename the selected pet (persisted by the host). */
|
|
36
36
|
rename: (name: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Report a click on one plugin-registered panel action (issue #6). The host
|
|
39
|
+
* dispatches it to the plugin that registered the action; the panel itself
|
|
40
|
+
* only renders the button the state snapshot served.
|
|
41
|
+
*/
|
|
42
|
+
panelAction: (id: string) => void;
|
|
37
43
|
/** Navigate the GUI to the session a bubble reports on. */
|
|
38
44
|
openSession: (sessionId: string) => void;
|
|
39
45
|
/** Clear the reaction bubble. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PetDockEntry.d.ts","sourceRoot":"","sources":["../../../src/client/PetDockEntry.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAA2C,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAItD,OAAO,EAAe,KAAK,WAAW,EAAoB,MAAM,oBAAoB,CAAA;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAGjC,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,KAAK,EAAE,gBAAgB,CAAA;IACvB,kFAAkF;IAClF,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,IAAI,CAAA;IACf,uBAAuB;IACvB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,uBAAuB;IACvB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,qCAAqC;IACrC,MAAM,EAAE,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AAI,CAAA;IAChB,uBAAuB;IACvB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,qCAAqC;IACrC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,+BAA+B;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,uDAAuD;IACvD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B;;;;OAIG;IACH,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,2DAA2D;IAC3D,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,iCAAiC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,uGAAuG;IACvG,QAAQ,EAAE,WAAW,CAAA;CACtB;AAED,yFAAyF;AACzF,MAAM,MAAM,iBAAiB,GAC3B,WAAW,GACT,WAAW,CAAC,OAAO,EAAE,CAAC,GACtB;IACA;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAIH;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA2FnE"}
|
|
@@ -47,7 +47,7 @@ export function PetDockEntry(props) {
|
|
|
47
47
|
if (visible) {
|
|
48
48
|
return (_jsx("span", { "data-pet-dock": true, "data-testid": "pet-dock", children: snapshot === null || definition === null
|
|
49
49
|
? null
|
|
50
|
-
: (_jsx(PetRendererSwitch, { definition: definition, phase: snapshot?.phase ?? 'idle', onPet: props.pet, ...(aux === null ? {} : { drag: aux.drag, bus: aux.bus }), t: props.t, children: _jsx(PetSprite, { snapshot: snapshot, definition: definition, display: snapshot.display, feedback: feedback, onPet: props.pet, onFeed: props.feed, onHide: props.hide, onDragEnd: props.dragEnd, onRename: props.rename, onOpenSession: props.openSession, onFeedbackDone: props.feedbackDone, portalTarget: props.portalTarget, dragDisabled: snapshot.gameplay?.mode === 'work', ...(aux === null ? {} : { bus: aux.bus }), ...(gameplay === undefined || aux === null
|
|
50
|
+
: (_jsx(PetRendererSwitch, { definition: definition, phase: snapshot?.phase ?? 'idle', onPet: props.pet, ...(aux === null ? {} : { drag: aux.drag, bus: aux.bus }), t: props.t, children: _jsx(PetSprite, { snapshot: snapshot, definition: definition, display: snapshot.display, feedback: feedback, onPet: props.pet, onFeed: props.feed, onHide: props.hide, onDragEnd: props.dragEnd, onRename: props.rename, onPanelAction: props.panelAction, onOpenSession: props.openSession, onFeedbackDone: props.feedbackDone, portalTarget: props.portalTarget, dragDisabled: snapshot.gameplay?.mode === 'work', ...(aux === null ? {} : { bus: aux.bus }), ...(gameplay === undefined || aux === null
|
|
51
51
|
? {}
|
|
52
52
|
: {
|
|
53
53
|
onGameplayTap: (fx, fy) => aux.bus.tap?.(fx, fy),
|
|
@@ -31,6 +31,8 @@ export interface PetSettings {
|
|
|
31
31
|
petId?: string;
|
|
32
32
|
/** Status-decoration master switch (pet-center M5, #567). */
|
|
33
33
|
decorationEnabled?: boolean;
|
|
34
|
+
/** Whether the pet's own session/status bubbles render (issue #6). */
|
|
35
|
+
statusBubbles?: string;
|
|
34
36
|
}
|
|
35
37
|
/** What the pet settings card renders. */
|
|
36
38
|
export interface PetSettingsCardState extends CardShell {
|
|
@@ -52,6 +54,8 @@ export interface PetSettingsCardState extends CardShell {
|
|
|
52
54
|
petId: CardFieldState;
|
|
53
55
|
/** Status-decoration master switch. */
|
|
54
56
|
decorationEnabled: CardFieldState;
|
|
57
|
+
/** Whether the pet's own session/status bubbles render. */
|
|
58
|
+
statusBubbles: CardFieldState;
|
|
55
59
|
/** Pet choices (registry ids + display names), loaded from the host. */
|
|
56
60
|
petChoices: readonly {
|
|
57
61
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PetSettingsCard.d.ts","sourceRoot":"","sources":["../../../src/client/PetSettingsCard.tsx"],"names":[],"mappings":"AAAA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