@linxin666/dsh-pet 0.2.9 → 0.3.0

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 CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: b3edd49ede7b31ff40195aec2082088b24255656
6
- README.zh.md: 1476678e2ed514eeaea69bcf0d77dd7c71a74fe1
5
+ README.md: 02e682f7c14dee40461f177660a3c976fc4bb05d
6
+ README.zh.md: d263d62d64cde1cd14a4e8656646166b944c4c0c
package/README.md CHANGED
@@ -13,7 +13,7 @@ Re-implemented from the pet feature of the Codex desktop app, as an official DSH
13
13
  | Feature | Description |
14
14
  |---|---|
15
15
  | Multi-pet registry | The host scans built-in `assets/`, the hatch-pet custom pets directory, and composed config entries; each pet is a manifest plus an atlas |
16
- | Pet selection in settings | The plugin settings card lists every registered pet; switching persists and the sprite swaps immediately |
16
+ | Pet selection in settings | The plugin settings card lists every registered pet (built-in assets plus user directories — the installed set); switching persists and the sprite swaps immediately. The card sits in the first-level Pet settings section |
17
17
  | Per-pet naming | Rename from the hover panel; each pet keeps its own name (stored per pet id, migrated from the legacy flat name) |
18
18
  | State animation | Official session activity → manifest-defined sequences of 9-state tracks; each track finishes its full duration before the sequence advances and the complete sequence loops |
19
19
  | Head-pat interaction | Click the pet → bubble feedback + affinity +1 (10s cooldown) |
package/README.zh.md CHANGED
@@ -13,7 +13,7 @@
13
13
  | 功能 | 说明 |
14
14
  |---|---|
15
15
  | 多宠物注册表 | 宿主扫描内置 `assets/`、hatch-pet 自定义宠物目录和组合配置条目;每只宠物 = manifest + 图集 |
16
- | 设置中选择宠物 | 插件设置卡片列出所有已注册宠物;切换即持久化,精灵立即更换 |
16
+ | 设置中选择宠物 | 插件设置卡片列出所有已注册宠物(内置资产 + 用户目录,即已安装集合);切换即持久化,精灵立即更换。卡片位于一级设置分区「宠物」 |
17
17
  | 每只宠物独立命名 | 在悬浮面板改名;每只宠物保存自己的名字(按宠物 id 存储,旧版平铺名字自动迁移) |
18
18
  | 状态动画 | 官方会话活动 → manifest 定义的 9 态轨道序列;每条轨道播完自身完整时长后切换,整条序列循环 |
19
19
  | 摸头互动 | 点击宠物 → 气泡反馈 + 亲密度 +1(10s 冷却) |
package/lib/client.js CHANGED
@@ -165,7 +165,7 @@ window.__ModuleLoader__.load({
165
165
  }
166
166
  //#endregion
167
167
  //#region \0dsh-css:packages/dsh-pet/src/client/pet.module.css.mjs
168
- const css$2 = ".kz2Bea_float{pointer-events:auto;-webkit-user-select:none;user-select:none;flex-direction:column;align-items:center;display:flex;position:fixed}.kz2Bea_sprite{image-rendering:auto;touch-action:none;position:relative}.kz2Bea_bubble{white-space:nowrap;color:#f4f7ff;pointer-events:none;border-radius:999px;margin-bottom:6px;padding:4px 10px;font-size:12px;line-height:1.4;animation:2.6s ease-out forwards kz2Bea_pet-bubble-pop;position:absolute;bottom:100%;box-shadow:0 2px 8px #00000040}.kz2Bea_bubblePet{background:#4d6bfef2}.kz2Bea_bubbleFeed{background:#0369a1f2}.kz2Bea_bubbleStatus{text-overflow:ellipsis;backdrop-filter:blur(8px);letter-spacing:.02em;background:linear-gradient(160deg,#131c36e6,#070b1af0);border:1px solid #7e98ff73;max-width:min(280px,100vw - 24px);padding:5px 12px;animation:.24s ease-out kz2Bea_pet-bubble-in;overflow:hidden;box-shadow:0 4px 12px #02061759,inset 0 1px #e2e8ff1a,0 0 12px #4d6bfe2e}.kz2Bea_bubbleWhisper{letter-spacing:.03em;animation:.32s cubic-bezier(.22,1,.36,1) kz2Bea_pet-whisper-in}.kz2Bea_bubbleWhisper:before{content:\"「\";opacity:.7;margin-right:2px}.kz2Bea_bubbleWhisper:after{content:\"」\";opacity:.7;margin-left:2px}.kz2Bea_bubbleStack{pointer-events:auto;flex-direction:column-reverse;align-items:center;gap:4px;display:flex;position:absolute;bottom:100%}.kz2Bea_bubbleAnchor{display:inline-flex;position:relative}.kz2Bea_bubbleMore{z-index:1;color:#eef2ff;cursor:pointer;background:linear-gradient(160deg,#4a68f5f2,#2f44b8f2);border:1px solid #7e98ff8c;border-radius:999px;justify-content:center;align-items:center;min-width:18px;height:18px;padding:0 5px;font-size:10px;font-weight:600;line-height:1;transition:filter .12s;display:inline-flex;position:absolute;top:-9px;right:-10px;box-shadow:0 2px 6px #02061766}.kz2Bea_bubbleMore:hover{filter:brightness(1.15)}.kz2Bea_bubbleMore:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.kz2Bea_bubbleStack .kz2Bea_bubble{pointer-events:auto;margin-bottom:0;position:relative;bottom:auto}.kz2Bea_bubbleClickable{cursor:pointer;font:inherit;text-align:center;appearance:none;transition:filter .12s,box-shadow .12s}.kz2Bea_bubbleClickable:hover{filter:brightness(1.12)}.kz2Bea_bubbleClickable:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@keyframes kz2Bea_pet-bubble-in{0%{opacity:0;transform:translateY(6px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes kz2Bea_pet-whisper-in{0%{opacity:0;transform:translateY(8px)scale(.9)}60%{transform:translateY(-1px)scale(1.02)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes kz2Bea_pet-panel-in{0%{opacity:0;transform:translateY(4px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes kz2Bea_pet-bubble-pop{0%{opacity:0;transform:translateY(6px)scale(.85)}15%{opacity:1;transform:translateY(0)scale(1.05)}25%{transform:translateY(0)scale(1)}75%{opacity:1}to{opacity:0;transform:translateY(-8px)scale(.95)}}.kz2Bea_panel{color:#e6ebf8;backdrop-filter:blur(10px);transform-origin:50% 0;background:linear-gradient(165deg,#131c36f2,#070b1af7);border:1px solid #7e98ff4d;border-radius:12px;flex-direction:column;gap:7px;min-width:148px;margin-top:8px;padding:10px 12px;font-size:12px;animation:.2s cubic-bezier(.22,1,.36,1) kz2Bea_pet-panel-in;display:flex;position:absolute;top:100%;box-shadow:0 8px 24px #02061773,0 0 0 1px #4d6bfe1a,inset 0 1px #e2e8ff14}.kz2Bea_panel:after{content:\"\";height:14px;position:absolute;bottom:100%;left:0;right:0}.kz2Bea_panelAbove{transform-origin:50% 100%;margin-top:0;margin-bottom:8px;top:auto;bottom:100%}.kz2Bea_panelAbove:after{top:100%;bottom:auto}.kz2Bea_rankRow{white-space:nowrap;justify-content:space-between;gap:10px;display:flex}.kz2Bea_nameCell{letter-spacing:.02em;background:linear-gradient(90deg,#a9c1ff,#6c8bff 60%,#4d6bfe);color:#0000;-webkit-background-clip:text;background-clip:text;font-weight:600}.kz2Bea_statRank{color:#9db4ff;font-weight:600}.kz2Bea_statTreats{color:#7dd3fc;font-weight:600}.kz2Bea_statPoints{color:#fcd34d;font-weight:600}.kz2Bea_renameRow{align-items:center;gap:6px;display:flex}.kz2Bea_nameInput{color:#e6ebf8;background:#131c36e6;border:1px solid #7e98ff80;border-radius:6px;outline:none;flex:1;min-width:0;padding:3px 6px;font-size:12px}.kz2Bea_nameInput:focus{border-color:#4d6bfe;box-shadow:0 0 0 2px #4d6bfe73}.kz2Bea_actions{gap:6px;display:flex}.kz2Bea_action{cursor:pointer;color:#fff;background:linear-gradient(#4a68f5,#3a55e0);border:none;border-radius:6px;flex:1;padding:4px 8px;font-size:12px;font-weight:600;transition:filter .12s,box-shadow .12s,transform .12s;box-shadow:0 2px 6px #4d6bfe4d}.kz2Bea_action:hover{filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 4px 10px #4d6bfe66}.kz2Bea_action:active{filter:brightness(.94);transform:translateY(0);box-shadow:0 1px 4px #4d6bfe4d}.kz2Bea_action:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.kz2Bea_summon{color:#8ea6ff;cursor:pointer;background:#070b1abf;border:1px dashed #7e98ff99;border-radius:999px;padding:2px 10px;font-size:11px;transition:border-color .12s,color .12s,background .12s,box-shadow .12s}.kz2Bea_summon:hover{color:#c3d3ff;background:#070b1ae6;border-color:#7e98fff2}.kz2Bea_summon:active{color:#8ea6ff;border-color:#7e98ffcc}.kz2Bea_summon:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@media (prefers-reduced-motion:reduce){.kz2Bea_bubble,.kz2Bea_bubbleStatus,.kz2Bea_bubbleWhisper,.kz2Bea_panel{opacity:1;animation:none}.kz2Bea_action,.kz2Bea_summon,.kz2Bea_bubbleMore{transition:none}}";
168
+ const css$2 = ".kz2Bea_float{pointer-events:auto;-webkit-user-select:none;user-select:none;flex-direction:column;align-items:center;display:flex;position:fixed}.kz2Bea_sprite{image-rendering:auto;touch-action:none}.kz2Bea_spriteWrap{flex:none;position:relative}.kz2Bea_closeButton{z-index:2;color:#f8fafc;cursor:pointer;touch-action:manipulation;background:#070b1ac7;border:1px solid #e2e8ffb8;border-radius:999px;width:24px;height:24px;padding:0;font:600 18px/20px sans-serif;transition:background .12s,box-shadow .12s;position:absolute;top:4px;right:4px}.kz2Bea_closeButton:hover{background:#2c3e7ef2}.kz2Bea_closeButton:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98fff2}.kz2Bea_bubble{white-space:nowrap;color:#f4f7ff;pointer-events:none;border-radius:999px;margin-bottom:6px;padding:4px 10px;font-size:12px;line-height:1.4;animation:2.6s ease-out forwards kz2Bea_pet-bubble-pop;position:absolute;bottom:100%;box-shadow:0 2px 8px #00000040}.kz2Bea_bubblePet{background:#4d6bfef2}.kz2Bea_bubbleFeed{background:#0369a1f2}.kz2Bea_bubbleStatus{text-overflow:ellipsis;backdrop-filter:blur(8px);letter-spacing:.02em;background:linear-gradient(160deg,#131c36e6,#070b1af0);border:1px solid #7e98ff73;max-width:min(280px,100vw - 24px);padding:5px 12px;animation:.24s ease-out kz2Bea_pet-bubble-in;overflow:hidden;box-shadow:0 4px 12px #02061759,inset 0 1px #e2e8ff1a,0 0 12px #4d6bfe2e}.kz2Bea_bubbleWhisper{letter-spacing:.03em;animation:.32s cubic-bezier(.22,1,.36,1) kz2Bea_pet-whisper-in}.kz2Bea_bubbleWhisper:before{content:\"「\";opacity:.7;margin-right:2px}.kz2Bea_bubbleWhisper:after{content:\"」\";opacity:.7;margin-left:2px}.kz2Bea_bubbleStack{pointer-events:auto;flex-direction:column-reverse;align-items:center;gap:4px;display:flex;position:absolute;bottom:100%}.kz2Bea_bubbleAnchor{display:inline-flex;position:relative}.kz2Bea_bubbleMore{z-index:1;color:#eef2ff;cursor:pointer;background:linear-gradient(160deg,#4a68f5f2,#2f44b8f2);border:1px solid #7e98ff8c;border-radius:999px;justify-content:center;align-items:center;min-width:18px;height:18px;padding:0 5px;font-size:10px;font-weight:600;line-height:1;transition:filter .12s;display:inline-flex;position:absolute;top:-9px;right:-10px;box-shadow:0 2px 6px #02061766}.kz2Bea_bubbleMore:hover{filter:brightness(1.15)}.kz2Bea_bubbleMore:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.kz2Bea_bubbleStack .kz2Bea_bubble{pointer-events:auto;margin-bottom:0;position:relative;bottom:auto}.kz2Bea_bubbleClickable{cursor:pointer;font:inherit;text-align:center;appearance:none;transition:filter .12s,box-shadow .12s}.kz2Bea_bubbleClickable:hover{filter:brightness(1.12)}.kz2Bea_bubbleClickable:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@keyframes kz2Bea_pet-bubble-in{0%{opacity:0;transform:translateY(6px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes kz2Bea_pet-whisper-in{0%{opacity:0;transform:translateY(8px)scale(.9)}60%{transform:translateY(-1px)scale(1.02)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes kz2Bea_pet-panel-in{0%{opacity:0;transform:translateY(4px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes kz2Bea_pet-bubble-pop{0%{opacity:0;transform:translateY(6px)scale(.85)}15%{opacity:1;transform:translateY(0)scale(1.05)}25%{transform:translateY(0)scale(1)}75%{opacity:1}to{opacity:0;transform:translateY(-8px)scale(.95)}}.kz2Bea_panel{color:#e6ebf8;backdrop-filter:blur(10px);transform-origin:50% 0;background:linear-gradient(165deg,#131c36f2,#070b1af7);border:1px solid #7e98ff4d;border-radius:12px;flex-direction:column;gap:7px;min-width:148px;margin-top:8px;padding:10px 12px;font-size:12px;animation:.2s cubic-bezier(.22,1,.36,1) kz2Bea_pet-panel-in;display:flex;position:absolute;top:100%;box-shadow:0 8px 24px #02061773,0 0 0 1px #4d6bfe1a,inset 0 1px #e2e8ff14}.kz2Bea_panel:after{content:\"\";height:14px;position:absolute;bottom:100%;left:0;right:0}.kz2Bea_panelAbove{transform-origin:50% 100%;margin-top:0;margin-bottom:8px;top:auto;bottom:100%}.kz2Bea_panelAbove:after{top:100%;bottom:auto}.kz2Bea_rankRow{white-space:nowrap;justify-content:space-between;gap:10px;display:flex}.kz2Bea_nameCell{letter-spacing:.02em;background:linear-gradient(90deg,#a9c1ff,#6c8bff 60%,#4d6bfe);color:#0000;-webkit-background-clip:text;background-clip:text;font-weight:600}.kz2Bea_statRank{color:#9db4ff;font-weight:600}.kz2Bea_statTreats{color:#7dd3fc;font-weight:600}.kz2Bea_statPoints{color:#fcd34d;font-weight:600}.kz2Bea_renameRow{align-items:center;gap:6px;display:flex}.kz2Bea_nameInput{color:#e6ebf8;background:#131c36e6;border:1px solid #7e98ff80;border-radius:6px;outline:none;flex:1;min-width:0;padding:3px 6px;font-size:12px}.kz2Bea_nameInput:focus{border-color:#4d6bfe;box-shadow:0 0 0 2px #4d6bfe73}.kz2Bea_actions{gap:6px;display:flex}.kz2Bea_action{cursor:pointer;color:#fff;background:linear-gradient(#4a68f5,#3a55e0);border:none;border-radius:6px;flex:1;padding:4px 8px;font-size:12px;font-weight:600;transition:filter .12s,box-shadow .12s,transform .12s;box-shadow:0 2px 6px #4d6bfe4d}.kz2Bea_action:hover{filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 4px 10px #4d6bfe66}.kz2Bea_action:active{filter:brightness(.94);transform:translateY(0);box-shadow:0 1px 4px #4d6bfe4d}.kz2Bea_action:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.kz2Bea_summon{color:#8ea6ff;cursor:pointer;background:#070b1abf;border:1px dashed #7e98ff99;border-radius:999px;padding:2px 10px;font-size:11px;transition:border-color .12s,color .12s,background .12s,box-shadow .12s}.kz2Bea_summon:hover{color:#c3d3ff;background:#070b1ae6;border-color:#7e98fff2}.kz2Bea_summon:active{color:#8ea6ff;border-color:#7e98ffcc}.kz2Bea_summon:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@media (prefers-reduced-motion:reduce){.kz2Bea_bubble,.kz2Bea_bubbleStatus,.kz2Bea_bubbleWhisper,.kz2Bea_panel{opacity:1;animation:none}.kz2Bea_action,.kz2Bea_summon,.kz2Bea_bubbleMore,.kz2Bea_closeButton{transition:none}}";
169
169
  const tagId$2 = "@linxin666/dsh-pet/pet.module.css";
170
170
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
171
171
  const tag = document.createElement("style");
@@ -186,6 +186,7 @@ window.__ModuleLoader__.load({
186
186
  "bubbleStack": "kz2Bea_bubbleStack",
187
187
  "bubbleStatus": "kz2Bea_bubbleStatus",
188
188
  "bubbleWhisper": "kz2Bea_bubbleWhisper",
189
+ "closeButton": "kz2Bea_closeButton",
189
190
  "float": "kz2Bea_float",
190
191
  "nameCell": "kz2Bea_nameCell",
191
192
  "nameInput": "kz2Bea_nameInput",
@@ -198,6 +199,7 @@ window.__ModuleLoader__.load({
198
199
  "rankRow": "kz2Bea_rankRow",
199
200
  "renameRow": "kz2Bea_renameRow",
200
201
  "sprite": "kz2Bea_sprite",
202
+ "spriteWrap": "kz2Bea_spriteWrap",
201
203
  "statPoints": "kz2Bea_statPoints",
202
204
  "statRank": "kz2Bea_statRank",
203
205
  "statTreats": "kz2Bea_statTreats",
@@ -535,30 +537,51 @@ window.__ModuleLoader__.load({
535
537
  hideTimerRef.current = window.setTimeout(() => setHovered(false), 300);
536
538
  },
537
539
  children: [
538
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
539
- ref: spriteRef,
540
- className: pet_module_css_default.sprite,
540
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
541
+ className: pet_module_css_default.spriteWrap,
541
542
  style: {
542
543
  width: spriteWidth,
543
- height: spriteHeight,
544
- ...props.visual === void 0 ? {
545
- backgroundImage: imageReady ? "url(" + definition.atlasUrl + ")" : void 0,
546
- backgroundSize: cell.width * columns * spriteScale + "px " + cell.height * (definition.atlasRows ?? rows.length) * spriteScale + "px",
547
- backgroundRepeat: "no-repeat",
548
- backgroundPosition: "0 0"
549
- } : {},
550
- cursor: dragRef.current === null ? "grab" : "grabbing"
551
- },
552
- onPointerDown,
553
- onPointerMove,
554
- onPointerUp,
555
- onClick: () => {
556
- if (draggedRef.current) return;
557
- props.onPet();
544
+ height: spriteHeight
558
545
  },
559
- role: "button",
560
- "aria-label": definition.displayName,
561
- children: props.visual
546
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
547
+ ref: spriteRef,
548
+ className: pet_module_css_default.sprite,
549
+ style: {
550
+ width: spriteWidth,
551
+ height: spriteHeight,
552
+ ...props.visual === void 0 ? {
553
+ backgroundImage: imageReady ? "url(" + definition.atlasUrl + ")" : void 0,
554
+ backgroundSize: cell.width * columns * spriteScale + "px " + cell.height * (definition.atlasRows ?? rows.length) * spriteScale + "px",
555
+ backgroundRepeat: "no-repeat",
556
+ backgroundPosition: "0 0"
557
+ } : {},
558
+ cursor: dragRef.current === null ? "grab" : "grabbing"
559
+ },
560
+ onPointerDown,
561
+ onPointerMove,
562
+ onPointerUp,
563
+ onClick: () => {
564
+ if (draggedRef.current) return;
565
+ props.onPet();
566
+ },
567
+ role: "button",
568
+ "aria-label": definition.displayName,
569
+ children: props.visual
570
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
571
+ type: "button",
572
+ className: pet_module_css_default.closeButton,
573
+ "aria-label": panelLabel("hide", props.t("pet.hide")),
574
+ title: panelLabel("hide", props.t("pet.hide")),
575
+ "data-testid": "pet-close",
576
+ onPointerDown: (e) => {
577
+ e.stopPropagation();
578
+ },
579
+ onClick: (e) => {
580
+ e.stopPropagation();
581
+ props.onHide();
582
+ },
583
+ children: "×"
584
+ })]
562
585
  }),
563
586
  feedback !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
564
587
  ref: bubbleRef,
@@ -2063,7 +2086,7 @@ window.__ModuleLoader__.load({
2063
2086
  };
2064
2087
  //#endregion
2065
2088
  //#region \0dsh-css:packages/dsh-pet/src/client/settings-section.module.css.mjs
2066
- const css = ".t0P0pa_sectionList{margin:0;padding:0;list-style:none}.t0P0pa_diagnostics{border:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-dimmed);border-radius:8px;margin:8px 0;padding:8px 12px;font-size:12px}.t0P0pa_diagnosticsTitle{color:var(--dsw-alias-label);margin-bottom:4px;font-weight:600;display:block}.t0P0pa_diagnostics ul{margin:0;padding-left:16px}.t0P0pa_diagnostics li[data-level=error]{color:var(--dsw-alias-error,#c04848)}";
2089
+ const css = ".t0P0pa_sectionList{margin:0;padding:0;list-style:none}.t0P0pa_diagnostics{border:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);border-radius:8px;margin:8px 0;padding:8px 12px;font-size:12px}.t0P0pa_diagnosticsTitle{color:var(--dsw-alias-label-primary);margin-bottom:4px;font-weight:600;display:block}.t0P0pa_diagnostics ul{margin:0;padding-left:16px}.t0P0pa_diagnostics li[data-level=error]{color:var(--dsw-alias-label-error,#c04848)}";
2067
2090
  const tagId = "@linxin666/dsh-pet/settings-section.module.css";
2068
2091
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
2069
2092
  const tag = document.createElement("style");
@@ -2100,6 +2123,9 @@ window.__ModuleLoader__.load({
2100
2123
  diagnostics = [];
2101
2124
  loaded = false;
2102
2125
  attempts = 0;
2126
+ disposed = false;
2127
+ /** Pending deferred-load or retry timer; cancelled by dispose(). */
2128
+ pendingTimer;
2103
2129
  /** @param scope - the bound settings scope for the 'pet' namespace. */
2104
2130
  constructor(scope) {
2105
2131
  this.form = new CardForm(scope, [
@@ -2112,7 +2138,9 @@ window.__ModuleLoader__.load({
2112
2138
  choiceField("petId", this.petChoices)
2113
2139
  ]);
2114
2140
  this.store = this.form.bind(() => this.projection());
2115
- window.setTimeout(() => {
2141
+ this.pendingTimer = window.setTimeout(() => {
2142
+ this.pendingTimer = void 0;
2143
+ if (this.disposed) return;
2116
2144
  this.loadPets();
2117
2145
  this.loadDiagnostics();
2118
2146
  }, 0);
@@ -2121,6 +2149,7 @@ window.__ModuleLoader__.load({
2121
2149
  async loadDiagnostics() {
2122
2150
  try {
2123
2151
  this.diagnostics = await fetchPetDiagnostics();
2152
+ if (this.disposed) return;
2124
2153
  this.store.set(this.projection());
2125
2154
  } catch {
2126
2155
  this.diagnostics = [];
@@ -2128,16 +2157,20 @@ window.__ModuleLoader__.load({
2128
2157
  }
2129
2158
  /** Resolve the registry choices once (retried a few times on failure). */
2130
2159
  async loadPets() {
2131
- if (this.loaded) return;
2160
+ if (this.loaded || this.disposed) return;
2132
2161
  try {
2133
2162
  const list = await fetchPetChoices();
2163
+ if (this.disposed) return;
2134
2164
  this.petChoices.splice(0, this.petChoices.length, ...list.map((choice) => choice.id));
2135
2165
  for (const choice of list) this.petLabels.set(choice.id, choice.displayName);
2136
2166
  this.loaded = true;
2137
2167
  this.store.set(this.projection());
2138
2168
  } catch {
2169
+ if (this.disposed) return;
2139
2170
  this.attempts += 1;
2140
- if (this.attempts < 3) window.setTimeout(() => {
2171
+ if (this.attempts < 3) this.pendingTimer = window.setTimeout(() => {
2172
+ this.pendingTimer = void 0;
2173
+ if (this.disposed) return;
2141
2174
  this.loadPets();
2142
2175
  }, 3e3);
2143
2176
  }
@@ -2170,10 +2203,16 @@ window.__ModuleLoader__.load({
2170
2203
  };
2171
2204
  }
2172
2205
  /**
2173
- * Release the card's scope subscription and bound stores; the slot
2174
- * disposer calls this on teardown.
2206
+ * Release the card's scope subscription, bound stores and pending load
2207
+ * timers; the slot disposer calls this on teardown.
2175
2208
  */
2176
2209
  dispose() {
2210
+ if (this.disposed) return;
2211
+ this.disposed = true;
2212
+ if (this.pendingTimer !== void 0) {
2213
+ window.clearTimeout(this.pendingTimer);
2214
+ this.pendingTimer = void 0;
2215
+ }
2177
2216
  this.form.dispose();
2178
2217
  }
2179
2218
  };
@@ -2528,8 +2567,8 @@ window.__ModuleLoader__.load({
2528
2567
  inject: () => petSettings.inject()
2529
2568
  }, PetSettingsSection);
2530
2569
  return () => {
2531
- petSettings.dispose();
2532
2570
  unregister();
2571
+ petSettings.dispose();
2533
2572
  };
2534
2573
  });
2535
2574
  let disposeUi;