@linxin666/dsh-pet 0.4.10 → 0.4.11

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.
Files changed (53) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +1 -1
  3. package/README.zh.md +4 -4
  4. package/lib/client.js +1092 -348
  5. package/lib/client.js.map +1 -1
  6. package/lib/types/client/PetPreview.d.ts +12 -0
  7. package/lib/types/client/PetPreview.d.ts.map +1 -0
  8. package/lib/types/client/PetPreview.js +32 -0
  9. package/lib/types/client/PetSettingsCard.d.ts +30 -2
  10. package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
  11. package/lib/types/client/PetSettingsCard.js +48 -8
  12. package/lib/types/client/PluginSettingsCard.d.ts +131 -17
  13. package/lib/types/client/PluginSettingsCard.d.ts.map +1 -1
  14. package/lib/types/client/PluginSettingsCard.js +158 -37
  15. package/lib/types/client/RangeBubble.d.ts +47 -0
  16. package/lib/types/client/RangeBubble.d.ts.map +1 -0
  17. package/lib/types/client/RangeBubble.js +107 -0
  18. package/lib/types/client/SegmentGroup.d.ts +29 -0
  19. package/lib/types/client/SegmentGroup.d.ts.map +1 -0
  20. package/lib/types/client/SegmentGroup.js +81 -0
  21. package/lib/types/client/index.d.ts.map +1 -1
  22. package/lib/types/client/index.js +9 -28
  23. package/lib/types/client/locales.d.ts +36 -44
  24. package/lib/types/client/locales.d.ts.map +1 -1
  25. package/lib/types/client/locales.js +36 -44
  26. package/lib/types/client/settings-form.d.ts +79 -41
  27. package/lib/types/client/settings-form.d.ts.map +1 -1
  28. package/lib/types/client/settings-form.js +96 -36
  29. package/lib/types/client/settings-registration.d.ts +15 -0
  30. package/lib/types/client/settings-registration.d.ts.map +1 -0
  31. package/lib/types/client/settings-registration.js +24 -0
  32. package/lib/types/client/web-extension-contract.d.ts +32 -0
  33. package/lib/types/client/web-extension-contract.d.ts.map +1 -0
  34. package/lib/types/client/web-extension-contract.js +6 -0
  35. package/lib/types/client/web-extension-page.d.ts +51 -0
  36. package/lib/types/client/web-extension-page.d.ts.map +1 -0
  37. package/lib/types/client/web-extension-page.js +122 -0
  38. package/package.json +1 -1
  39. package/src/client/PetPreview.tsx +51 -0
  40. package/src/client/PetSettingsCard.test.tsx +28 -22
  41. package/src/client/PetSettingsCard.tsx +201 -110
  42. package/src/client/PluginSettingsCard.tsx +369 -108
  43. package/src/client/RangeBubble.tsx +163 -0
  44. package/src/client/SegmentGroup.tsx +92 -0
  45. package/src/client/index.ts +9 -27
  46. package/src/client/locales.ts +36 -44
  47. package/src/client/settings-card.module.css +493 -91
  48. package/src/client/settings-form.ts +116 -49
  49. package/src/client/settings-registration.test.ts +79 -0
  50. package/src/client/settings-registration.ts +34 -0
  51. package/src/client/settings-section.module.css +182 -0
  52. package/src/client/web-extension-contract.ts +35 -0
  53. package/src/client/web-extension-page.ts +150 -0
package/lib/client.js CHANGED
@@ -2875,7 +2875,7 @@ window.__ModuleLoader__.load({
2875
2875
  }
2876
2876
  //#endregion
2877
2877
  //#region \0dsh-css:src/client/settings-card.module.css.mjs
2878
- const css$1 = ".KApx_W_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.KApx_W_card:hover{border-color:var(--dsw-alias-label-dimmed)}.KApx_W_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.KApx_W_header{appearance:none;box-sizing:border-box;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.KApx_W_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.KApx_W_headerStatic{box-sizing:border-box;border-radius:12px;align-items:center;gap:12px;width:100%;padding:14px 16px;display:flex}.KApx_W_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.KApx_W_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.KApx_W_description{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.5}.KApx_W_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.KApx_W_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.KApx_W_chevronOpen{transform:rotate(180deg)}.KApx_W_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.KApx_W_readOnly{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.5}.KApx_W_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}.KApx_W_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.KApx_W_failed{min-width:0;color:var(--dsw-alias-state-error-primary,#b42318);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:12px;line-height:1.5;overflow:hidden}.KApx_W_discard,.KApx_W_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.KApx_W_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.KApx_W_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}.KApx_W_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.KApx_W_discard:disabled,.KApx_W_save:disabled{opacity:.4;cursor:default}.KApx_W_discard:focus-visible,.KApx_W_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.KApx_W_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.KApx_W_field+.KApx_W_field{border-top:1px solid var(--dsw-alias-border-l2)}.KApx_W_head{align-items:center;gap:8px;display:flex}.KApx_W_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.KApx_W_badges{align-items:center;gap:8px;display:inline-flex}.KApx_W_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.KApx_W_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.KApx_W_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.KApx_W_reset:disabled{cursor:default}.KApx_W_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.KApx_W_input,.KApx_W_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.KApx_W_input:focus-visible,.KApx_W_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.KApx_W_input:disabled,.KApx_W_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.KApx_W_inputInvalid{border:1px solid var(--dsw-alias-state-error-primary,#b42318);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.KApx_W_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-state-error-primary,#b42318);outline-offset:1px;border-color:var(--dsw-alias-state-error-primary,#b42318)}.KApx_W_selectWrap{position:relative}.KApx_W_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}.KApx_W_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.KApx_W_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.KApx_W_selectChevronOpen{transform:rotate(180deg)}.KApx_W_selectPopup{z-index:40;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);max-height:240px;box-shadow:0 8px 24px var(--dsw-alias-bg-mask-2);opacity:0;border-radius:8px;flex-direction:column;padding:4px;transition:opacity .1s,transform .1s;display:flex;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto;transform:translateY(-4px)}.KApx_W_selectPopupOpen{opacity:1;transform:none}.KApx_W_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}.KApx_W_selectOption{color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;border-radius:6px;flex-shrink:0;padding:6px 10px;font-size:13px;line-height:1.5;overflow:hidden}.KApx_W_selectOption:hover,.KApx_W_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}.KApx_W_selectOptionSelected{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 10%, transparent);font-weight:500}.KApx_W_invalid{color:var(--dsw-alias-state-error-primary,#b42318);margin:0;font-size:12px;line-height:1.5}.KApx_W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:1.5}@media (prefers-reduced-motion:reduce){.KApx_W_card,.KApx_W_header,.KApx_W_chevron,.KApx_W_chevronOpen,.KApx_W_discard,.KApx_W_save,.KApx_W_selectChevron,.KApx_W_selectChevronOpen,.KApx_W_selectPopup{transition:none}}";
2878
+ const css$1 = ".KApx_W_card{--settings-card-radius:12px;--settings-card-header-pad:16px;--settings-card-header-gap:13px;--settings-card-title-size:15px;--settings-card-description-size:13px;--settings-card-body-inset:16px;--settings-card-motion:.18s;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:var(--settings-card-radius);list-style:none;transition:border-color .16s,background .16s}.KApx_W_card:hover{border-color:var(--dsw-alias-label-dimmed)}.KApx_W_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.KApx_W_cardNested{--settings-card-radius:10px;--settings-card-header-pad:10px 12px;--settings-card-header-gap:10px;--settings-card-title-size:13px;--settings-card-description-size:12px;--settings-card-body-inset:12px}.KApx_W_cardNested .KApx_W_description{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.KApx_W_header{appearance:none;box-sizing:border-box;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;border-radius:var(--settings-card-radius);align-items:center;gap:var(--settings-card-header-gap);padding:var(--settings-card-header-pad);background:0 0;border:0;display:flex}.KApx_W_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.KApx_W_headerStatic{box-sizing:border-box;border-radius:var(--settings-card-radius);align-items:center;gap:var(--settings-card-header-gap);width:100%;padding:var(--settings-card-header-pad);display:flex}.KApx_W_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.KApx_W_mark{background:var(--dsw-alias-bg-module-platform);width:34px;height:34px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;place-items:center;transition:color .16s;display:grid}.KApx_W_header:hover .KApx_W_mark,.KApx_W_cardOpen .KApx_W_mark{color:var(--dsw-alias-label-primary)}.KApx_W_name{color:var(--dsw-alias-label-primary);font-size:var(--settings-card-title-size);font-weight:600;line-height:1.4}.KApx_W_description{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.KApx_W_headerAction{flex:none;align-items:center;display:inline-flex}.KApx_W_chevron{color:var(--dsw-alias-label-tertiary);flex:none;width:16px;height:16px;transition:transform .16s,color .16s}.KApx_W_header:hover .KApx_W_chevron{color:var(--dsw-alias-label-secondary)}.KApx_W_chevronOpen{transform:rotate(180deg)}.KApx_W_disclosure{opacity:0;transition:grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;grid-template-rows:0fr;display:grid}.KApx_W_disclosure[data-state=collapsed],.KApx_W_disclosure[data-state=entering],.KApx_W_disclosure[data-state=closing]{overflow:hidden}.KApx_W_disclosure[data-state=entering],.KApx_W_disclosure[data-state=shown]{opacity:1;grid-template-rows:1fr}.KApx_W_disclosure>.KApx_W_body{min-height:0}.KApx_W_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 var(--settings-card-body-inset);padding-bottom:8px;container:KApx_W_settings-card/inline-size}.KApx_W_readOnly{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.5}.KApx_W_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}.KApx_W_failed{color:var(--dsw-alias-state-error-primary,#b42318);overflow-wrap:anywhere;margin:8px 0 4px;font-size:12px;line-height:18px}.KApx_W_field{grid-template-columns:minmax(0,1fr) fit-content(50%);grid-template-areas:\"KApx_W_head KApx_W_control\"\"KApx_W_hint KApx_W_control\";align-items:center;gap:4px 24px;padding:16px 0;display:grid}.KApx_W_field>.KApx_W_head{grid-area:KApx_W_head}.KApx_W_field>:is(.KApx_W_hint,.KApx_W_invalid){grid-area:KApx_W_hint}.KApx_W_field>:not(.KApx_W_head,.KApx_W_hint,.KApx_W_invalid){grid-area:KApx_W_control;justify-self:end;max-width:100%}.KApx_W_field+.KApx_W_field{border-top:1px solid var(--dsw-alias-border-l2)}.KApx_W_head{align-items:center;gap:8px;display:flex}.KApx_W_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:14px;font-weight:400;line-height:22px}.KApx_W_badges{align-items:center;gap:8px;display:inline-flex}.KApx_W_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.KApx_W_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.KApx_W_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.KApx_W_reset:disabled{cursor:default}.KApx_W_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.KApx_W_segmentGroup{background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);border-radius:8px;flex-wrap:wrap;align-items:center;gap:2px;padding:2px;display:inline-flex;position:relative}.KApx_W_segment{appearance:none;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:7px;margin:0;padding:3px 12px;font-size:13px;font-weight:500;line-height:18px;transition:background-color .12s,color .12s}.KApx_W_segment:hover:not(:disabled):not([data-active]){color:var(--dsw-alias-label-primary)}.KApx_W_segmentGroup:not([data-pill])>.KApx_W_segment[data-active],.KApx_W_segmentGroup[data-pill]:before{background:var(--dsw-alias-bg-overlay,var(--dsw-alias-bg-layer-3));box-shadow:0 1px 2px #14141314}body[data-ds-dark-theme] .KApx_W_segmentGroup:not([data-pill])>.KApx_W_segment[data-active],body[data-ds-dark-theme] .KApx_W_segmentGroup[data-pill]:before{box-shadow:none;background:#ffffff24}.KApx_W_segment[data-active]{color:var(--dsw-alias-label-primary)}.KApx_W_segmentGroup[data-pill]:before{content:\"\";width:var(--segment-pill-w,0px);height:var(--segment-pill-h,0px);transform:translate(var(--segment-pill-x,0px), var(--segment-pill-y,0px));pointer-events:none;border-radius:7px;transition:transform .24s cubic-bezier(.22,.61,.36,1),width .24s cubic-bezier(.22,.61,.36,1),height .24s cubic-bezier(.22,.61,.36,1);position:absolute;top:0;left:0}.KApx_W_segmentGroup>*{z-index:1;position:relative}.KApx_W_segment:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.KApx_W_segment:disabled{cursor:not-allowed;opacity:.45}.KApx_W_segmentGroup[data-pill]:has(>.KApx_W_segment:disabled):before{opacity:.45}.KApx_W_input,.KApx_W_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.KApx_W_input:focus-visible,.KApx_W_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.KApx_W_input:disabled,.KApx_W_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.KApx_W_inputInvalid{border:1px solid var(--dsw-alias-state-error-primary,#b42318);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.KApx_W_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-state-error-primary,#b42318);outline-offset:1px;border-color:var(--dsw-alias-state-error-primary,#b42318)}.KApx_W_field>:is(.KApx_W_input,.KApx_W_inputInvalid,.KApx_W_select,.KApx_W_selectWrap,.KApx_W_rangeAnchor){box-sizing:border-box;width:220px}.KApx_W_rangeAnchor>:is(.KApx_W_input,.KApx_W_inputInvalid){box-sizing:border-box;width:100%}@container KApx_W_settings-card (width<=440px){.KApx_W_field{grid-template-columns:minmax(0,1fr);grid-template-areas:\"KApx_W_head\"\"KApx_W_hint\"\"KApx_W_control\";row-gap:8px}.KApx_W_field>:not(.KApx_W_head,.KApx_W_hint,.KApx_W_invalid){justify-self:start}.KApx_W_field>:is(.KApx_W_input,.KApx_W_inputInvalid,.KApx_W_select,.KApx_W_selectWrap,.KApx_W_rangeAnchor){justify-self:stretch;width:auto}}.KApx_W_selectWrap{position:relative}.KApx_W_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}.KApx_W_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.KApx_W_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.KApx_W_selectChevronOpen{transform:rotate(180deg)}.KApx_W_selectPopup{z-index:40;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);max-height:240px;box-shadow:0 8px 24px var(--dsw-alias-bg-mask-2);opacity:0;border-radius:8px;flex-direction:column;padding:4px;transition:opacity .1s,transform .1s;display:flex;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto;transform:translateY(-4px)}.KApx_W_selectPopupOpen{opacity:1;transform:none}.KApx_W_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}.KApx_W_rangeAnchor{display:inline-flex;position:relative}.KApx_W_rangeBubble{z-index:40;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);width:220px;box-shadow:0 8px 24px var(--dsw-alias-bg-mask-2);opacity:0;visibility:hidden;border-radius:10px;padding:10px 12px 6px;transition:opacity .12s,transform .12s,visibility 0s linear .12s;position:absolute;right:0}.KApx_W_rangeBubble[data-side=above]{bottom:calc(100% + 6px);transform:translateY(4px)}.KApx_W_rangeBubble[data-side=below]{top:calc(100% + 6px);transform:translateY(-4px)}.KApx_W_rangeBubble[data-open]{opacity:1;visibility:visible;transition:opacity .12s,transform .12s,visibility;transform:none}.KApx_W_rangeSlider{appearance:none;cursor:pointer;background:0 0;width:100%;height:18px;margin:0;display:block}.KApx_W_rangeSlider::-webkit-slider-runnable-track{background:linear-gradient(to right, var(--dsw-alias-brand-primary) var(--range-fill,0%), color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent) var(--range-fill,0%));border-radius:999px;height:4px}.KApx_W_rangeSlider::-moz-range-track{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent);border-radius:999px;height:4px}.KApx_W_rangeSlider::-moz-range-progress{background:var(--dsw-alias-brand-primary);border-radius:999px;height:4px}.KApx_W_rangeSlider::-webkit-slider-thumb{appearance:none;background:#fff;border:0;border-radius:50%;width:14px;height:14px;margin-top:-5px;transition:transform .12s;box-shadow:0 0 0 1px #0000001f,0 1px 3px #00000040}.KApx_W_rangeSlider::-moz-range-thumb{background:#fff;border:0;border-radius:50%;width:14px;height:14px;box-shadow:0 0 0 1px #0000001f,0 1px 3px #00000040}.KApx_W_rangeSlider:active::-webkit-slider-thumb{transform:scale(1.15)}.KApx_W_rangeSlider:focus-visible{outline:none}.KApx_W_rangeSlider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 2px var(--dsw-alias-brand-primary)}.KApx_W_rangeSlider:disabled{cursor:not-allowed}.KApx_W_rangeEnds{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;justify-content:space-between;margin-top:2px;font-size:11px;line-height:16px;display:flex}.KApx_W_selectOption{color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;border-radius:6px;flex-shrink:0;padding:6px 10px;font-size:13px;line-height:1.5;overflow:hidden}.KApx_W_selectOption:hover,.KApx_W_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}.KApx_W_selectOptionSelected{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary) 10%, transparent);font-weight:500}.KApx_W_invalid{color:var(--dsw-alias-state-error-primary,#b42318);margin:0;font-size:12px;line-height:18px}.KApx_W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:18px}.KApx_W_toggle{appearance:none;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:999px;align-items:center;margin:0;padding:0;display:inline-flex}.KApx_W_toggleTrack{background:var(--dsw-alias-label-dimmed);border-radius:999px;flex:none;width:36px;height:20px;transition:background-color .18s;position:relative}.KApx_W_toggleThumb{--toggle-travel:16px;--toggle-overshoot:1px;background:var(--dsw-alias-bg-layer-3);border-radius:50%;width:16px;height:16px;transition:translate .18s;position:absolute;top:2px;left:2px;translate:0;box-shadow:0 1px 2px #1414132e}.KApx_W_toggle[aria-checked=true] .KApx_W_toggleTrack{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-label-primary))}.KApx_W_toggle[aria-checked=true] .KApx_W_toggleThumb{translate:var(--toggle-travel) 0;background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-3))}.KApx_W_toggle[data-moved][aria-checked=true] .KApx_W_toggleThumb{animation:.35s cubic-bezier(.34,1.45,.64,1) both KApx_W_toggle-on}.KApx_W_toggle[data-moved][aria-checked=false] .KApx_W_toggleThumb{animation:.35s cubic-bezier(.34,1.45,.64,1) both KApx_W_toggle-off}@keyframes KApx_W_toggle-on{0%{translate:0}55%{translate:calc(var(--toggle-travel) + var(--toggle-overshoot)) 0}80%,to{translate:var(--toggle-travel) 0}}@keyframes KApx_W_toggle-off{0%{translate:var(--toggle-travel) 0}55%{translate:calc(0px - var(--toggle-overshoot)) 0}80%,to{translate:0}}.KApx_W_toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.KApx_W_toggle:disabled{opacity:.45;cursor:not-allowed}@media (prefers-reduced-motion:reduce){.KApx_W_card,.KApx_W_header,.KApx_W_mark,.KApx_W_chevron,.KApx_W_chevronOpen,.KApx_W_rangeBubble,.KApx_W_selectChevron,.KApx_W_selectChevronOpen,.KApx_W_selectPopup,.KApx_W_toggleTrack,.KApx_W_toggleThumb{transition:none}.KApx_W_toggle[data-moved] .KApx_W_toggleThumb{animation:none}.KApx_W_disclosure{transition-property:opacity}}";
2879
2879
  const tagId$1 = "@linxin666/dsh-pet/src/client/settings-card.module.css";
2880
2880
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
2881
2881
  const tag = document.createElement("style");
@@ -2889,29 +2889,36 @@ window.__ModuleLoader__.load({
2889
2889
  "badges": "KApx_W_badges",
2890
2890
  "body": "KApx_W_body",
2891
2891
  "card": "KApx_W_card",
2892
+ "cardNested": "KApx_W_cardNested",
2892
2893
  "cardOpen": "KApx_W_cardOpen",
2893
2894
  "chevron": "KApx_W_chevron",
2894
2895
  "chevronOpen": "KApx_W_chevronOpen",
2896
+ "control": "KApx_W_control",
2895
2897
  "description": "KApx_W_description",
2896
- "discard": "KApx_W_discard",
2898
+ "disclosure": "KApx_W_disclosure",
2897
2899
  "failed": "KApx_W_failed",
2898
2900
  "field": "KApx_W_field",
2899
- "footer": "KApx_W_footer",
2900
2901
  "head": "KApx_W_head",
2901
2902
  "headText": "KApx_W_headText",
2902
2903
  "header": "KApx_W_header",
2904
+ "headerAction": "KApx_W_headerAction",
2903
2905
  "headerStatic": "KApx_W_headerStatic",
2904
2906
  "hint": "KApx_W_hint",
2905
2907
  "input": "KApx_W_input",
2906
2908
  "inputInvalid": "KApx_W_inputInvalid",
2907
2909
  "invalid": "KApx_W_invalid",
2908
2910
  "label": "KApx_W_label",
2911
+ "mark": "KApx_W_mark",
2909
2912
  "name": "KApx_W_name",
2910
2913
  "notExposed": "KApx_W_notExposed",
2911
- "pending": "KApx_W_pending",
2914
+ "rangeAnchor": "KApx_W_rangeAnchor",
2915
+ "rangeBubble": "KApx_W_rangeBubble",
2916
+ "rangeEnds": "KApx_W_rangeEnds",
2917
+ "rangeSlider": "KApx_W_rangeSlider",
2912
2918
  "readOnly": "KApx_W_readOnly",
2913
2919
  "reset": "KApx_W_reset",
2914
- "save": "KApx_W_save",
2920
+ "segment": "KApx_W_segment",
2921
+ "segmentGroup": "KApx_W_segmentGroup",
2915
2922
  "select": "KApx_W_select",
2916
2923
  "selectButton": "KApx_W_selectButton",
2917
2924
  "selectChevron": "KApx_W_selectChevron",
@@ -2923,19 +2930,276 @@ window.__ModuleLoader__.load({
2923
2930
  "selectPopup": "KApx_W_selectPopup",
2924
2931
  "selectPopupClose": "KApx_W_selectPopupClose",
2925
2932
  "selectPopupOpen": "KApx_W_selectPopupOpen",
2926
- "selectWrap": "KApx_W_selectWrap"
2933
+ "selectWrap": "KApx_W_selectWrap",
2934
+ "settings-card": "KApx_W_settings-card",
2935
+ "toggle": "KApx_W_toggle",
2936
+ "toggle-off": "KApx_W_toggle-off",
2937
+ "toggle-on": "KApx_W_toggle-on",
2938
+ "toggleThumb": "KApx_W_toggleThumb",
2939
+ "toggleTrack": "KApx_W_toggleTrack"
2927
2940
  };
2928
2941
  //#endregion
2942
+ //#region src/client/RangeBubble.tsx
2943
+ /**
2944
+ * Coarse adjustment for a bounded number: resting the pointer on the control
2945
+ * (or moving focus into it) raises a small bubble holding a slider across the
2946
+ * field's whole range, so a large change is one drag instead of many presses
2947
+ * or a retyped value. The control itself stays the precise entry.
2948
+ *
2949
+ * The bubble belongs to the anchor's subtree, so moving from the control onto
2950
+ * the bubble never counts as leaving. It opens after a short rest and closes a
2951
+ * moment after the pointer and focus have both gone, so crossing the control
2952
+ * on the way elsewhere does not flash it. While a drag is in progress the
2953
+ * bubble stays put even if the pointer strays off it.
2954
+ *
2955
+ * Dragging reports each value through `onInput`, so the field shows it live;
2956
+ * releasing the thumb, or a key press on it, reports `onCommit` once. The
2957
+ * bubble opens on the side of the control that has room inside the nearest
2958
+ * scrolling ancestor, so a row near the top of a settings page does not hang
2959
+ * its bubble under the page edge.
2960
+ */
2961
+ /** Rest on the control before the bubble opens. */
2962
+ const OPEN_DELAY_MS = 220;
2963
+ /** Grace after pointer and focus have left before the bubble closes. */
2964
+ const CLOSE_DELAY_MS = 200;
2965
+ /** Room the bubble needs between the control and the scroller's edge. */
2966
+ const BUBBLE_ROOM_PX = 64;
2967
+ /** The nearest ancestor that scrolls vertically, or the viewport's root. */
2968
+ function scroller(node) {
2969
+ for (let parent = node.parentElement; parent !== null; parent = parent.parentElement) {
2970
+ const overflow = getComputedStyle(parent).overflowY;
2971
+ if (overflow === "auto" || overflow === "scroll") return parent;
2972
+ }
2973
+ return node.ownerDocument.documentElement;
2974
+ }
2975
+ /**
2976
+ * Render the control with its coarse-adjustment bubble.
2977
+ * @param props - the range, the value and the two report callbacks.
2978
+ * @returns the anchor holding the control and the bubble.
2979
+ */
2980
+ function RangeBubble(props) {
2981
+ const { min, max, step, disabled = false } = props;
2982
+ const [open, setOpen] = (0, react.useState)(false);
2983
+ const [side, setSide] = (0, react.useState)("above");
2984
+ const [live, setLive] = (0, react.useState)(null);
2985
+ const anchorRef = (0, react.useRef)(null);
2986
+ const timer = (0, react.useRef)(void 0);
2987
+ const hovered = (0, react.useRef)(false);
2988
+ const focused = (0, react.useRef)(false);
2989
+ const dragging = (0, react.useRef)(false);
2990
+ (0, react.useEffect)(() => () => {
2991
+ clearTimeout(timer.current);
2992
+ }, []);
2993
+ (0, react.useEffect)(() => {
2994
+ if (disabled) {
2995
+ clearTimeout(timer.current);
2996
+ setOpen(false);
2997
+ }
2998
+ }, [disabled]);
2999
+ const show = () => {
3000
+ const anchor = anchorRef.current;
3001
+ if (anchor !== null) {
3002
+ const room = anchor.getBoundingClientRect().top - scroller(anchor).getBoundingClientRect().top;
3003
+ setSide(room >= BUBBLE_ROOM_PX ? "above" : "below");
3004
+ }
3005
+ setOpen(true);
3006
+ };
3007
+ const schedule = () => {
3008
+ clearTimeout(timer.current);
3009
+ if (disabled) return;
3010
+ if (hovered.current || focused.current || dragging.current) {
3011
+ if (!open) timer.current = setTimeout(show, focused.current ? 0 : OPEN_DELAY_MS);
3012
+ return;
3013
+ }
3014
+ timer.current = setTimeout(() => {
3015
+ setOpen(false);
3016
+ }, CLOSE_DELAY_MS);
3017
+ };
3018
+ const commit = (value) => {
3019
+ dragging.current = false;
3020
+ setLive(null);
3021
+ props.onCommit(value);
3022
+ schedule();
3023
+ };
3024
+ const onChange = (event) => {
3025
+ const value = Number(event.target.value);
3026
+ setLive(value);
3027
+ props.onInput(value);
3028
+ };
3029
+ const onKeyUp = (event) => {
3030
+ if (live !== null) commit(live);
3031
+ if (event.key === "Escape") {
3032
+ clearTimeout(timer.current);
3033
+ setOpen(false);
3034
+ }
3035
+ };
3036
+ const shown = live ?? Math.min(max, Math.max(min, props.value));
3037
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3038
+ ref: anchorRef,
3039
+ className: settings_card_module_css_default.rangeAnchor,
3040
+ onPointerEnter: () => {
3041
+ hovered.current = true;
3042
+ schedule();
3043
+ },
3044
+ onPointerLeave: () => {
3045
+ hovered.current = false;
3046
+ schedule();
3047
+ },
3048
+ onFocus: () => {
3049
+ focused.current = true;
3050
+ schedule();
3051
+ },
3052
+ onBlur: (event) => {
3053
+ if (event.currentTarget.contains(event.relatedTarget)) return;
3054
+ focused.current = false;
3055
+ if (live !== null) commit(live);
3056
+ else schedule();
3057
+ },
3058
+ children: [props.children, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3059
+ className: settings_card_module_css_default.rangeBubble,
3060
+ "data-open": open ? "" : void 0,
3061
+ "data-side": side,
3062
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3063
+ type: "range",
3064
+ className: settings_card_module_css_default.rangeSlider,
3065
+ min,
3066
+ max,
3067
+ step,
3068
+ value: shown,
3069
+ "aria-label": props.label,
3070
+ tabIndex: open ? 0 : -1,
3071
+ disabled,
3072
+ style: { "--range-fill": `${(shown - min) / (max - min) * 100}%` },
3073
+ onPointerDown: () => {
3074
+ dragging.current = true;
3075
+ },
3076
+ onPointerUp: (event) => {
3077
+ commit(Number(event.currentTarget.value));
3078
+ },
3079
+ onPointerCancel: (event) => {
3080
+ commit(Number(event.currentTarget.value));
3081
+ },
3082
+ onChange,
3083
+ onKeyUp
3084
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3085
+ className: settings_card_module_css_default.rangeEnds,
3086
+ "aria-hidden": "true",
3087
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: min }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: max })]
3088
+ })]
3089
+ })]
3090
+ });
3091
+ }
3092
+ //#endregion
3093
+ //#region src/client/SegmentGroup.tsx
3094
+ /**
3095
+ * The family's segmented control: a quiet track whose options share one
3096
+ * highlight that slides to the pressed option, instead of each option fading
3097
+ * its own background out and the next one in. The settings fields' small
3098
+ * choices and the Web Extensions TAB strip both render through it, so the two
3099
+ * read as one control.
3100
+ *
3101
+ * The caller builds the option buttons and marks the pressed one with
3102
+ * `data-active`; the group measures that button after every render and writes
3103
+ * its box as four custom properties, and the stylesheet draws the highlight
3104
+ * there (`.segmentGroup[data-pill]::before`). Attribute and first placement
3105
+ * land in the same task, so the highlight appears in place and only later
3106
+ * changes slide. A ResizeObserver re-measures when the group or an option
3107
+ * changes size: a longer locale, a font arriving, a container growing, a
3108
+ * strip wrapping onto a second line.
3109
+ */
3110
+ /** The attribute marking a group whose highlight has been placed. */
3111
+ const PILL_ATTR = "data-pill";
3112
+ /** The pressed option, relative to the group. */
3113
+ const ACTIVE_SELECTOR = ":scope > [data-active]";
3114
+ const PILL_PROPERTIES = [
3115
+ "--segment-pill-x",
3116
+ "--segment-pill-y",
3117
+ "--segment-pill-w",
3118
+ "--segment-pill-h"
3119
+ ];
3120
+ /**
3121
+ * Write the highlight's box from the pressed option's box, or take the
3122
+ * highlight off when nothing is pressed or the group has no layout yet.
3123
+ * The two boxes are read in viewport pixels and turned back into the group's
3124
+ * own CSS pixels, so a dialog that opens through a scale transform still
3125
+ * lands the highlight on its option.
3126
+ */
3127
+ function placePill(group) {
3128
+ const item = group.querySelector(ACTIVE_SELECTOR);
3129
+ const box = group.getBoundingClientRect();
3130
+ if (item === null || group.offsetWidth === 0 || box.width === 0) {
3131
+ group.removeAttribute(PILL_ATTR);
3132
+ for (const property of PILL_PROPERTIES) group.style.removeProperty(property);
3133
+ return;
3134
+ }
3135
+ const scale = box.width / group.offsetWidth;
3136
+ const itemBox = item.getBoundingClientRect();
3137
+ [
3138
+ (itemBox.left - box.left) / scale - group.clientLeft,
3139
+ (itemBox.top - box.top) / scale - group.clientTop,
3140
+ itemBox.width / scale,
3141
+ itemBox.height / scale
3142
+ ].forEach((value, index) => {
3143
+ group.style.setProperty(PILL_PROPERTIES[index], `${Math.round(value * 100) / 100}px`);
3144
+ });
3145
+ if (!group.hasAttribute(PILL_ATTR)) group.setAttribute(PILL_ATTR, "");
3146
+ }
3147
+ /**
3148
+ * Render a segmented track around the caller's option buttons.
3149
+ * @param props - the track's attributes (role, accessible name, key handler) and its options.
3150
+ * @returns the track.
3151
+ */
3152
+ function SegmentGroup(props) {
3153
+ const { children, className, ...rest } = props;
3154
+ const group = (0, react.useRef)(null);
3155
+ const count = react.Children.count(children);
3156
+ (0, react.useLayoutEffect)(() => {
3157
+ if (group.current !== null) placePill(group.current);
3158
+ });
3159
+ (0, react.useLayoutEffect)(() => {
3160
+ const element = group.current;
3161
+ if (element === null || typeof ResizeObserver === "undefined") return void 0;
3162
+ const observer = new ResizeObserver(() => {
3163
+ placePill(element);
3164
+ });
3165
+ observer.observe(element);
3166
+ for (const item of Array.from(element.children)) observer.observe(item);
3167
+ return () => {
3168
+ observer.disconnect();
3169
+ };
3170
+ }, [count]);
3171
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3172
+ ...rest,
3173
+ ref: group,
3174
+ className: className === void 0 ? settings_card_module_css_default.segmentGroup : `${settings_card_module_css_default.segmentGroup} ${className}`,
3175
+ children
3176
+ });
3177
+ }
3178
+ //#endregion
2929
3179
  //#region src/client/PluginSettingsCard.tsx
2930
3180
  /**
2931
3181
  * Family-shared chrome for plugin settings cards: a disclosure header naming
2932
- * the plugin and what its settings govern, the controls inside, and the save
2933
- * that writes them. Renders nothing while the namespace is unavailable — a
3182
+ * the plugin and what its settings govern, the controls inside, and the line
3183
+ * that reports a refused write. A pick is written the moment it is made and a
3184
+ * typed value after a pause, so the card has no save button and nothing waits
3185
+ * on the reader. Renders nothing while the namespace is unavailable — a
2934
3186
  * deployment that does not compose the owning plugin should show no trace of
2935
3187
  * it. Inlined into each consumer's client bundle; mirrors the official
2936
3188
  * ui-plugin-config PluginCard in a self-contained slice.
3189
+ *
3190
+ * Every field inside the body is one settings row: the label and its hint on
3191
+ * the left, the control on the right, a hairline between two rows; a narrow
3192
+ * card stacks the control under the text (settings-card.module.css).
2937
3193
  */
2938
3194
  /**
3195
+ * What a text field inside a card reaches without its plugin wiring it: write
3196
+ * the pending draft now (Enter, leaving the field) or put it back (Escape).
3197
+ * Picks need neither; they are written the moment they are made.
3198
+ */
3199
+ const CardApply = (0, react.createContext)(null);
3200
+ /** Length of the body's disclosure motion; it matches `--settings-card-motion` on the card root. */
3201
+ const BODY_MOTION_MS = 180;
3202
+ /**
2939
3203
  * Render one plugin settings card.
2940
3204
  * @param props - the plugin's copy keys, its form state, and its controls.
2941
3205
  * @returns the card, or nothing while the namespace is still loading.
@@ -2943,30 +3207,73 @@ window.__ModuleLoader__.load({
2943
3207
  function PluginSettingsCard(props) {
2944
3208
  const [open, setOpen] = (0, react.useState)(props.defaultOpen ?? true);
2945
3209
  const { state, alwaysOpen } = props;
3210
+ const expanded = alwaysOpen === true || open;
3211
+ const [bodyPhase, setBodyPhase] = (0, react.useState)(expanded ? "shown" : "hidden");
3212
+ const bodyRef = (0, react.useRef)(null);
3213
+ (0, react.useLayoutEffect)(() => {
3214
+ if (expanded) {
3215
+ if (bodyPhase === "hidden") setBodyPhase("collapsed");
3216
+ else if (bodyPhase === "collapsed") {
3217
+ const node = bodyRef.current;
3218
+ if (node !== null) node.offsetHeight;
3219
+ setBodyPhase("entering");
3220
+ } else if (bodyPhase === "closing") setBodyPhase("entering");
3221
+ return;
3222
+ }
3223
+ if (bodyPhase === "collapsed") setBodyPhase("hidden");
3224
+ else if (bodyPhase === "entering" || bodyPhase === "shown") setBodyPhase("closing");
3225
+ }, [expanded, bodyPhase]);
3226
+ (0, react.useEffect)(() => {
3227
+ if (bodyPhase !== "entering" && bodyPhase !== "closing") return;
3228
+ const timer = setTimeout(() => {
3229
+ setBodyPhase(bodyPhase === "entering" ? "shown" : "hidden");
3230
+ }, BODY_MOTION_MS);
3231
+ return () => {
3232
+ clearTimeout(timer);
3233
+ };
3234
+ }, [bodyPhase]);
2946
3235
  if (!state.available) return null;
2947
3236
  const title = props.t(props.titleKey);
2948
3237
  const description = props.t(props.descriptionKey);
2949
- const blocked = !state.dirty || state.invalid || state.saving;
2950
- const expanded = alwaysOpen === true || open;
2951
- const cardClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
3238
+ const descriptionTitle = props.descriptionTitleKey === void 0 ? description : props.t(props.descriptionTitleKey);
3239
+ const baseClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
3240
+ const cardClass = props.density === "nested" ? `${baseClass} ${settings_card_module_css_default.cardNested}` : baseClass;
3241
+ /** The body region both legs share; a hidden phase renders nothing at all. */
3242
+ const bodyRegion = (content) => bodyPhase === "hidden" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3243
+ className: settings_card_module_css_default.disclosure,
3244
+ "data-state": bodyPhase,
3245
+ ref: bodyRef,
3246
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3247
+ className: settings_card_module_css_default.body,
3248
+ children: content
3249
+ })
3250
+ });
2952
3251
  const header = alwaysOpen === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2953
3252
  className: settings_card_module_css_default.headerStatic,
2954
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2955
- className: settings_card_module_css_default.headText,
2956
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2957
- className: settings_card_module_css_default.name,
2958
- title,
2959
- children: title
2960
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2961
- className: settings_card_module_css_default.description,
2962
- title: description,
2963
- children: props.descriptionNode ?? description
2964
- })]
2965
- }), state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2966
- className: settings_card_module_css_default.pending,
2967
- title: props.t("settings.unsaved"),
2968
- children: props.t("settings.unsaved")
2969
- }) : null]
3253
+ children: [
3254
+ props.icon !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3255
+ className: settings_card_module_css_default.mark,
3256
+ "aria-hidden": "true",
3257
+ children: props.icon
3258
+ }) : null,
3259
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3260
+ className: settings_card_module_css_default.headText,
3261
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3262
+ className: settings_card_module_css_default.name,
3263
+ id: props.titleId,
3264
+ title,
3265
+ children: title
3266
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3267
+ className: settings_card_module_css_default.description,
3268
+ title: descriptionTitle,
3269
+ children: props.descriptionNode ?? description
3270
+ })]
3271
+ }),
3272
+ props.headerAction !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3273
+ className: settings_card_module_css_default.headerAction,
3274
+ children: props.headerAction
3275
+ }) : null
3276
+ ]
2970
3277
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2971
3278
  type: "button",
2972
3279
  className: settings_card_module_css_default.header,
@@ -2976,22 +3283,27 @@ window.__ModuleLoader__.load({
2976
3283
  setOpen(!open);
2977
3284
  },
2978
3285
  children: [
3286
+ props.icon !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3287
+ className: settings_card_module_css_default.mark,
3288
+ "aria-hidden": "true",
3289
+ children: props.icon
3290
+ }) : null,
2979
3291
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2980
3292
  className: settings_card_module_css_default.headText,
2981
3293
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2982
3294
  className: settings_card_module_css_default.name,
3295
+ id: props.titleId,
2983
3296
  title,
2984
3297
  children: title
2985
3298
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2986
3299
  className: settings_card_module_css_default.description,
2987
- title: description,
3300
+ title: descriptionTitle,
2988
3301
  children: props.descriptionNode ?? description
2989
3302
  })]
2990
3303
  }),
2991
- state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2992
- className: settings_card_module_css_default.pending,
2993
- title: props.t("settings.unsaved"),
2994
- children: props.t("settings.unsaved")
3304
+ props.headerAction !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3305
+ className: settings_card_module_css_default.headerAction,
3306
+ children: props.headerAction
2995
3307
  }) : null,
2996
3308
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
2997
3309
  width: "14",
@@ -3011,57 +3323,72 @@ window.__ModuleLoader__.load({
3011
3323
  const showNotice = props.hideNotExposedNotice !== true;
3012
3324
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3013
3325
  className: cardClass,
3014
- children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3015
- className: settings_card_module_css_default.body,
3016
- children: showNotice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3017
- className: settings_card_module_css_default.notExposed,
3018
- role: "status",
3019
- children: props.t("settings.notExposed")
3020
- }) : null
3021
- }) : null]
3326
+ children: [header, bodyRegion(showNotice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3327
+ className: settings_card_module_css_default.notExposed,
3328
+ role: "status",
3329
+ children: props.t("settings.notExposed")
3330
+ }) : null)]
3022
3331
  });
3023
3332
  }
3333
+ const bodyVisible = props.headerOnly !== true;
3024
3334
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3025
3335
  className: cardClass,
3026
- children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3027
- className: settings_card_module_css_default.body,
3028
- children: [
3029
- !state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3030
- className: settings_card_module_css_default.readOnly,
3031
- role: "status",
3032
- children: props.t("settings.readOnly")
3033
- }) : null,
3034
- props.children,
3035
- props.hideFooter === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3036
- className: settings_card_module_css_default.footer,
3037
- children: [
3038
- state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3039
- className: settings_card_module_css_default.failed,
3040
- role: "status",
3041
- children: [props.t("settings.saveFailed"), state.failedReason ? " - " + state.failedReason : ""]
3042
- }) : null,
3043
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3044
- type: "button",
3045
- className: settings_card_module_css_default.discard,
3046
- disabled: !state.dirty || state.saving,
3047
- onClick: props.onDiscard,
3048
- children: props.t("settings.discard")
3049
- }),
3050
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3051
- type: "button",
3052
- className: settings_card_module_css_default.save,
3053
- disabled: blocked,
3054
- onClick: props.onSave,
3055
- children: props.t(!state.saving ? "settings.save" : "settings.saving")
3056
- })
3057
- ]
3058
- })
3059
- ]
3060
- }) : null]
3336
+ children: [header, bodyVisible ? bodyRegion(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3337
+ !state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3338
+ className: settings_card_module_css_default.readOnly,
3339
+ role: "status",
3340
+ children: props.t("settings.readOnly")
3341
+ }) : null,
3342
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardApply.Provider, {
3343
+ value: {
3344
+ commit: props.onSave,
3345
+ revert: props.onDiscard
3346
+ },
3347
+ children: props.children
3348
+ }),
3349
+ props.hideFooter !== true && state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3350
+ className: settings_card_module_css_default.failed,
3351
+ role: "status",
3352
+ children: [props.t("settings.saveFailed"), state.failedReason ? " - " + state.failedReason : ""]
3353
+ }) : null
3354
+ ] })) : null]
3061
3355
  });
3062
3356
  }
3063
- /** A staged value field. `numeric` only hints the keypad: which drafts a field accepts is decided by its spec. */
3357
+ /**
3358
+ * A typed value field. Its draft is written after a pause in typing, at once on
3359
+ * Enter or when focus leaves, and Escape puts the stored value back. `numeric`
3360
+ * only hints the keypad: which drafts a field accepts is decided by its spec.
3361
+ * A field given a `range` also offers the coarse slider bubble: dragging fills
3362
+ * the draft live and releasing writes it.
3363
+ */
3064
3364
  function ValueField(props) {
3365
+ const apply = (0, react.useContext)(CardApply);
3366
+ const onKeyDown = (event) => {
3367
+ if (apply === null || event.key !== "Enter" && event.key !== "Escape") return;
3368
+ event.preventDefault();
3369
+ if (event.key === "Enter") apply.commit();
3370
+ else apply.revert();
3371
+ event.currentTarget.blur();
3372
+ };
3373
+ const input = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3374
+ id: props.id,
3375
+ className: props.invalid ? settings_card_module_css_default.inputInvalid : settings_card_module_css_default.input,
3376
+ type: "text",
3377
+ ...props.numeric === true ? { inputMode: "numeric" } : {},
3378
+ ...props.invalid ? { "aria-invalid": true } : {},
3379
+ value: props.text,
3380
+ placeholder: props.placeholder ?? "",
3381
+ disabled: props.disabled,
3382
+ onChange: (event) => {
3383
+ props.onEdit(event.target.value);
3384
+ },
3385
+ onKeyDown,
3386
+ onBlur: () => {
3387
+ apply?.commit();
3388
+ }
3389
+ });
3390
+ const { range } = props;
3391
+ const typed = Number(props.text);
3065
3392
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3066
3393
  className: settings_card_module_css_default.field,
3067
3394
  children: [
@@ -3085,21 +3412,25 @@ window.__ModuleLoader__.load({
3085
3412
  })]
3086
3413
  }) : null]
3087
3414
  }),
3088
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3089
- id: props.id,
3090
- className: props.invalid ? settings_card_module_css_default.inputInvalid : settings_card_module_css_default.input,
3091
- type: "text",
3092
- ...props.numeric === true ? { inputMode: "numeric" } : {},
3093
- ...props.invalid ? { "aria-invalid": true } : {},
3094
- value: props.text,
3095
- placeholder: props.placeholder ?? "",
3415
+ range === void 0 ? input : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RangeBubble, {
3416
+ min: range.min,
3417
+ max: range.max,
3418
+ step: range.step,
3419
+ value: props.text.trim() === "" || Number.isNaN(typed) ? range.min : typed,
3420
+ label: `${props.label} ${range.min}–${range.max}`,
3096
3421
  disabled: props.disabled,
3097
- onChange: (event) => {
3098
- props.onEdit(event.target.value);
3099
- }
3422
+ onInput: (value) => {
3423
+ props.onEdit(String(value));
3424
+ },
3425
+ onCommit: (value) => {
3426
+ props.onEdit(String(value));
3427
+ apply?.commit();
3428
+ },
3429
+ children: input
3100
3430
  }),
3101
3431
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3102
3432
  className: props.invalid ? settings_card_module_css_default.invalid : settings_card_module_css_default.hint,
3433
+ title: props.hintTitle,
3103
3434
  children: props.invalid ? props.invalidLabel : props.hint
3104
3435
  })
3105
3436
  ]
@@ -3115,8 +3446,8 @@ window.__ModuleLoader__.load({
3115
3446
  * renders the legacy native `<select>` untouched, so element-level skin
3116
3447
  * selectors keep working; under the default appearance it renders a
3117
3448
  * self-drawn `role="listbox"` popup whose open/close is transition-animated.
3118
- * Staged cards reach it through BooleanField/ChoiceField; immediate-apply
3119
- * editors (the side-card prefs) bind it directly through onEdit.
3449
+ * Cards reach it through BooleanField/ChoiceField; editors outside a card
3450
+ * (the side-card prefs) bind it directly through onEdit.
3120
3451
  * 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。
3121
3452
  */
3122
3453
  function SelectField(props) {
@@ -3274,14 +3605,48 @@ window.__ModuleLoader__.load({
3274
3605
  }) : null]
3275
3606
  });
3276
3607
  }
3277
- /** A staged boolean field: 继承 / 开 / 关. */
3608
+ /**
3609
+ * A visible segmented group for a small set of mutually exclusive values.
3610
+ * Every option stays on screen, so inherit/on/off and short enum fields take
3611
+ * one click without opening a popup. The pressed option carries the group's
3612
+ * sliding highlight and `aria-pressed`; the group takes the field label as its
3613
+ * accessible name.
3614
+ */
3615
+ function SegmentField(props) {
3616
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentGroup, {
3617
+ id: props.id,
3618
+ role: "group",
3619
+ "aria-label": props.label,
3620
+ "aria-invalid": props.invalid || void 0,
3621
+ children: props.options.map((option, index) => {
3622
+ const active = option.value === props.value;
3623
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3624
+ type: "button",
3625
+ className: settings_card_module_css_default.segment,
3626
+ "aria-pressed": active,
3627
+ disabled: props.disabled,
3628
+ "data-active": active ? "" : void 0,
3629
+ "data-segment-index": index,
3630
+ onClick: () => {
3631
+ if (!active) props.onEdit(option.value);
3632
+ },
3633
+ children: option.label
3634
+ }, option.value);
3635
+ })
3636
+ });
3637
+ }
3638
+ /** A boolean field: 继承 / 开 / 关. */
3278
3639
  function BooleanField(props) {
3640
+ const segmented = props.presentation !== "select";
3279
3641
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3280
3642
  className: settings_card_module_css_default.field,
3281
3643
  children: [
3282
3644
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3283
3645
  className: settings_card_module_css_default.head,
3284
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
3646
+ children: [segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3647
+ className: settings_card_module_css_default.label,
3648
+ children: props.label
3649
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
3285
3650
  className: settings_card_module_css_default.label,
3286
3651
  htmlFor: props.id,
3287
3652
  children: props.label
@@ -3299,7 +3664,28 @@ window.__ModuleLoader__.load({
3299
3664
  })]
3300
3665
  }) : null]
3301
3666
  }),
3302
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
3667
+ segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentField, {
3668
+ id: props.id,
3669
+ label: props.label,
3670
+ options: [
3671
+ {
3672
+ value: "",
3673
+ label: props.inheritLabel
3674
+ },
3675
+ {
3676
+ value: "true",
3677
+ label: props.onLabel
3678
+ },
3679
+ {
3680
+ value: "false",
3681
+ label: props.offLabel
3682
+ }
3683
+ ],
3684
+ value: props.text,
3685
+ disabled: props.disabled,
3686
+ invalid: props.invalid,
3687
+ onEdit: props.onEdit
3688
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
3303
3689
  id: props.id,
3304
3690
  options: [
3305
3691
  {
@@ -3322,19 +3708,28 @@ window.__ModuleLoader__.load({
3322
3708
  }),
3323
3709
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3324
3710
  className: settings_card_module_css_default.hint,
3711
+ title: props.hintTitle,
3325
3712
  children: props.hint
3326
3713
  })
3327
3714
  ]
3328
3715
  });
3329
3716
  }
3330
- /** A staged enumerated field rendered as a select. */
3717
+ /** An enumerated field, selecting or segmenting its small choice set. */
3331
3718
  function ChoiceField(props) {
3719
+ const segmented = props.presentation === "segment";
3720
+ const options = [{
3721
+ value: "",
3722
+ label: props.inheritLabel
3723
+ }, ...props.choices];
3332
3724
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3333
3725
  className: settings_card_module_css_default.field,
3334
3726
  children: [
3335
3727
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3336
3728
  className: settings_card_module_css_default.head,
3337
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
3729
+ children: [segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3730
+ className: settings_card_module_css_default.label,
3731
+ children: props.label
3732
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
3338
3733
  className: settings_card_module_css_default.label,
3339
3734
  htmlFor: props.id,
3340
3735
  children: props.label
@@ -3352,12 +3747,17 @@ window.__ModuleLoader__.load({
3352
3747
  })]
3353
3748
  }) : null]
3354
3749
  }),
3355
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
3750
+ segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentField, {
3356
3751
  id: props.id,
3357
- options: [{
3358
- value: "",
3359
- label: props.inheritLabel
3360
- }, ...props.choices],
3752
+ label: props.label,
3753
+ options,
3754
+ value: props.text,
3755
+ disabled: props.disabled,
3756
+ invalid: props.invalid,
3757
+ onEdit: props.onEdit
3758
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
3759
+ id: props.id,
3760
+ options,
3361
3761
  value: props.text,
3362
3762
  disabled: props.disabled,
3363
3763
  invalid: props.invalid,
@@ -3365,18 +3765,132 @@ window.__ModuleLoader__.load({
3365
3765
  }),
3366
3766
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3367
3767
  className: props.invalid ? settings_card_module_css_default.invalid : settings_card_module_css_default.hint,
3768
+ title: props.hintTitle,
3368
3769
  children: props.invalid ? props.invalidLabel : props.hint
3369
3770
  })
3370
3771
  ]
3371
3772
  });
3372
3773
  }
3774
+ /**
3775
+ * A boolean toggle drawn as a switch track, for a setting that is only on or
3776
+ * off and applies on flip. It is a real button with
3777
+ * `role="switch"` and `aria-checked`, so keyboard and assistive activation
3778
+ * arrive as a click and the state is announced instead of inferred from a
3779
+ * checkbox tick.
3780
+ *
3781
+ * The thumb bounces across only once the reader has pressed this switch: the
3782
+ * press writes the mark that arms the bounce, so a page opening, a TAB
3783
+ * switching back or a value arriving from elsewhere draws every thumb at rest.
3784
+ */
3785
+ function ToggleSwitch(props) {
3786
+ const [moved, setMoved] = (0, react.useState)(false);
3787
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3788
+ type: "button",
3789
+ className: settings_card_module_css_default.toggle,
3790
+ role: "switch",
3791
+ "aria-checked": props.checked,
3792
+ "aria-labelledby": props.labelledBy,
3793
+ "aria-label": props.labelledBy === void 0 ? props.ariaLabel : void 0,
3794
+ disabled: props.disabled,
3795
+ "data-moved": moved ? "" : void 0,
3796
+ onClick: () => {
3797
+ setMoved(true);
3798
+ props.onChange(!props.checked);
3799
+ },
3800
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3801
+ className: settings_card_module_css_default.toggleTrack,
3802
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: settings_card_module_css_default.toggleThumb })
3803
+ })
3804
+ });
3805
+ }
3373
3806
  //#endregion
3374
- //#region src/client/settings-form.ts
3375
- /** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints blocks the save. */
3807
+ //#region \0dsh-css:src/client/settings-section.module.css.mjs
3808
+ const css = ".c5M8OW_sectionList{margin:0;padding:0;list-style:none;container-type:inline-size}.c5M8OW_settingsLayout{grid-template-columns:minmax(220px,.85fr) minmax(280px,1.15fr);align-items:start;gap:16px;display:grid}.c5M8OW_settingsColumn{flex-direction:column;gap:16px;min-width:0;display:flex}.c5M8OW_selectionGroup,.c5M8OW_settingsGroup{border:1px solid color-mix(in srgb, currentColor 13%, transparent);background:color-mix(in srgb, currentColor 3%, transparent);border-radius:12px;min-width:0;padding:16px}.c5M8OW_groupHeader{justify-content:space-between;align-items:center;gap:12px;min-height:24px;margin-bottom:14px;display:flex}.c5M8OW_groupTitle{color:inherit;margin:0;font-size:14px;font-weight:400;line-height:22px}.c5M8OW_textAction{appearance:none;color:inherit;font:inherit;cursor:pointer;opacity:.7;background:0 0;border:0;padding:2px 0;font-size:12px}.c5M8OW_textAction:hover:not(:disabled){opacity:1}.c5M8OW_petGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.c5M8OW_petChoice{appearance:none;border:1px solid color-mix(in srgb, currentColor 12%, transparent);background:color-mix(in srgb, currentColor 3%, transparent);min-width:0;min-height:112px;color:inherit;font:inherit;cursor:pointer;border-radius:10px;flex-direction:column;justify-content:center;align-items:center;gap:7px;padding:9px 7px;transition:border-color .12s,background-color .12s;display:flex}.c5M8OW_petChoice:hover:not(:disabled){border-color:color-mix(in srgb, currentColor 30%, transparent);background:color-mix(in srgb, currentColor 6%, transparent)}.c5M8OW_petChoiceSelected{border-color:color-mix(in srgb, currentColor 52%, transparent);background:color-mix(in srgb, currentColor 8%, transparent)}.c5M8OW_petChoice:focus-visible,.c5M8OW_textAction:focus-visible{outline:2px solid color-mix(in srgb, currentColor 55%, transparent);outline-offset:2px}.c5M8OW_petChoice:disabled,.c5M8OW_textAction:disabled{cursor:default;opacity:.5}.c5M8OW_petChoiceLabel{text-align:center;text-overflow:ellipsis;white-space:nowrap;max-width:100%;font-size:12px;line-height:16px;overflow:hidden}.c5M8OW_previewFrame{background:color-mix(in srgb, currentColor 5%, transparent);border-radius:9px;justify-content:center;align-items:center;width:76px;height:76px;display:flex;overflow:hidden}.c5M8OW_previewAtlas{background-position:0 0;background-repeat:no-repeat;flex:none;display:block}.c5M8OW_previewImage{object-fit:contain;width:100%;height:100%;display:block}.c5M8OW_previewFallback{opacity:.65;font-size:25px;font-weight:600}.c5M8OW_groupHint,.c5M8OW_invalid{margin:4px 0 0;font-size:12px;line-height:18px}.c5M8OW_groupHint{color:var(--dsw-alias-label-secondary)}.c5M8OW_invalid{color:var(--dsw-alias-text-danger,#d55454)}.c5M8OW_fields{flex-direction:column;gap:12px;display:flex}@container (width<=640px){.c5M8OW_settingsLayout{grid-template-columns:minmax(0,1fr)}.c5M8OW_petGrid{grid-template-columns:repeat(3,minmax(0,1fr))}}@container (width<=420px){.c5M8OW_petGrid{grid-template-columns:repeat(2,minmax(0,1fr))}}";
3809
+ const tagId = "@linxin666/dsh-pet/src/client/settings-section.module.css";
3810
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
3811
+ const tag = document.createElement("style");
3812
+ tag.dataset.plugin = "@linxin666/dsh-pet";
3813
+ tag.dataset.pluginCss = tagId;
3814
+ tag.textContent = css;
3815
+ document.head.appendChild(tag);
3816
+ }
3817
+ var settings_section_module_css_default = {
3818
+ "fields": "c5M8OW_fields",
3819
+ "groupHeader": "c5M8OW_groupHeader",
3820
+ "groupHint": "c5M8OW_groupHint",
3821
+ "groupTitle": "c5M8OW_groupTitle",
3822
+ "invalid": "c5M8OW_invalid",
3823
+ "petChoice": "c5M8OW_petChoice",
3824
+ "petChoiceLabel": "c5M8OW_petChoiceLabel",
3825
+ "petChoiceSelected": "c5M8OW_petChoiceSelected",
3826
+ "petGrid": "c5M8OW_petGrid",
3827
+ "previewAtlas": "c5M8OW_previewAtlas",
3828
+ "previewFallback": "c5M8OW_previewFallback",
3829
+ "previewFrame": "c5M8OW_previewFrame",
3830
+ "previewImage": "c5M8OW_previewImage",
3831
+ "sectionList": "c5M8OW_sectionList",
3832
+ "selectionGroup": "c5M8OW_selectionGroup",
3833
+ "settingsColumn": "c5M8OW_settingsColumn",
3834
+ "settingsGroup": "c5M8OW_settingsGroup",
3835
+ "settingsLayout": "c5M8OW_settingsLayout",
3836
+ "textAction": "c5M8OW_textAction"
3837
+ };
3838
+ //#endregion
3839
+ //#region src/client/PetPreview.tsx
3840
+ const PREVIEW_LIMIT = 72;
3841
+ const DEFAULT_CELL = {
3842
+ width: 192,
3843
+ height: 208
3844
+ };
3845
+ /**
3846
+ * Render the atlas's first sprite cell or a frames2d idle frame. Live2d and
3847
+ * incomplete legacy responses degrade to a text mark instead of a broken image.
3848
+ */
3849
+ function PetPreview(props) {
3850
+ const { pet } = props;
3851
+ const renderer = pet.renderer ?? "sprite2d";
3852
+ if (renderer === "sprite2d" && pet.atlasUrl !== void 0) {
3853
+ const cell = pet.cell ?? DEFAULT_CELL;
3854
+ const scale = Math.min(PREVIEW_LIMIT / cell.width, PREVIEW_LIMIT / cell.height);
3855
+ const width = Math.max(1, Math.round(cell.width * scale));
3856
+ const height = Math.max(1, Math.round(cell.height * scale));
3857
+ const columns = pet.columns ?? 8;
3858
+ const rows = pet.atlasRows ?? 9;
3859
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3860
+ className: settings_section_module_css_default.previewFrame,
3861
+ "aria-hidden": "true",
3862
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3863
+ className: settings_section_module_css_default.previewAtlas,
3864
+ style: {
3865
+ width,
3866
+ height,
3867
+ backgroundImage: `url("${pet.atlasUrl}")`,
3868
+ backgroundSize: `${columns * width}px ${rows * height}px`
3869
+ }
3870
+ })
3871
+ });
3872
+ }
3873
+ const frame = renderer === "frames2d" ? pet.frames2d?.tracks.idle?.frames[0] ?? pet.atlasUrl : void 0;
3874
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3875
+ className: settings_section_module_css_default.previewFrame,
3876
+ "aria-hidden": "true",
3877
+ children: frame === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3878
+ className: settings_section_module_css_default.previewFallback,
3879
+ children: pet.displayName.slice(0, 1)
3880
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
3881
+ className: settings_section_module_css_default.previewImage,
3882
+ src: frame,
3883
+ alt: "",
3884
+ draggable: false
3885
+ })
3886
+ });
3887
+ }
3888
+ /** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
3376
3889
  function numberField(field, constraints = {}) {
3377
3890
  const { integer = false, min } = constraints;
3378
3891
  return {
3379
3892
  field,
3893
+ entry: "type",
3380
3894
  format: (value) => typeof value === "number" ? String(value) : "",
3381
3895
  parse: (text) => {
3382
3896
  const trimmed = text.trim();
@@ -3396,6 +3910,7 @@ window.__ModuleLoader__.load({
3396
3910
  function booleanField(field) {
3397
3911
  return {
3398
3912
  field,
3913
+ entry: "pick",
3399
3914
  format: (value) => typeof value === "boolean" ? String(value) : "",
3400
3915
  parse: (text) => {
3401
3916
  const trimmed = text.trim();
@@ -3415,6 +3930,7 @@ window.__ModuleLoader__.load({
3415
3930
  function choiceField(field, choices) {
3416
3931
  return {
3417
3932
  field,
3933
+ entry: "pick",
3418
3934
  format: (value) => typeof value === "string" && choices.includes(value) ? value : "",
3419
3935
  parse: (text) => {
3420
3936
  if (text === "") return { kind: "clear" };
@@ -3426,12 +3942,14 @@ window.__ModuleLoader__.load({
3426
3942
  };
3427
3943
  }
3428
3944
  /**
3429
- * Stages one card's edits over one settings namespace and writes them on save.
3945
+ * Applies one card's edits to one settings namespace as the reader makes them.
3430
3946
  *
3431
3947
  * The Host is the only authority on whether a value was accepted — its
3432
3948
  * validators own the constraints no schema can express — so the outcome is
3433
- * read back from the section rather than predicted here. A save that did not
3434
- * land keeps its drafts, so the user can correct them instead of retyping.
3949
+ * read back from the section rather than predicted here. A write that did not
3950
+ * land puts each pick back to the stored value, the way a switch that could not
3951
+ * flip springs back, and keeps typed text so the reader can correct it instead
3952
+ * of retyping.
3435
3953
  */
3436
3954
  var CardForm = class {
3437
3955
  scope;
@@ -3441,7 +3959,11 @@ window.__ModuleLoader__.load({
3441
3959
  /** The form subscription installed in the constructor; released by dispose(). */
3442
3960
  disposeForm;
3443
3961
  disposed = false;
3962
+ /** The pending write of typed text, waiting for typing to pause. */
3963
+ typePause;
3444
3964
  saving = false;
3965
+ /** A save asked for while one was in flight; it runs once the first settles (#1754). */
3966
+ saveQueued = false;
3445
3967
  failed = false;
3446
3968
  failedReason;
3447
3969
  /** @param scope - the bound configuration form for this card's namespace. */
@@ -3459,6 +3981,7 @@ window.__ModuleLoader__.load({
3459
3981
  dispose() {
3460
3982
  if (this.disposed) return;
3461
3983
  this.disposed = true;
3984
+ clearTimeout(this.typePause);
3462
3985
  this.disposeForm();
3463
3986
  this.listeners.clear();
3464
3987
  }
@@ -3470,7 +3993,7 @@ window.__ModuleLoader__.load({
3470
3993
  });
3471
3994
  return store;
3472
3995
  }
3473
- /** Read the card-level state: what the Host serves, and what a save would do. */
3996
+ /** Read the card-level state: what the Host serves, and what is still waiting to be written. */
3474
3997
  shell() {
3475
3998
  const snapshot = this.scope.getSnapshot();
3476
3999
  const plan = this.plan();
@@ -3517,9 +4040,10 @@ window.__ModuleLoader__.load({
3517
4040
  });
3518
4041
  },
3519
4042
  save: () => {
3520
- this.save();
4043
+ this.applyNow();
3521
4044
  },
3522
4045
  discard: () => {
4046
+ clearTimeout(this.typePause);
3523
4047
  if (this.staged.size === 0 && !this.failed) return;
3524
4048
  this.staged.clear();
3525
4049
  this.failed = false;
@@ -3529,27 +4053,48 @@ window.__ModuleLoader__.load({
3529
4053
  };
3530
4054
  }
3531
4055
  /**
3532
- * Write every staged edit in one atomic form mutation, then re-seed from
3533
- * what the Host accepted.
4056
+ * Run one write, and re-run it once if another was asked for while this one
4057
+ * was still in flight.
3534
4058
  *
3535
- * The whole batch rides one mutate, so cross-field validate hooks
3536
- * (baseURL+model) judge it as a unit: the Host either applies every write
3537
- * or refuses the batch. The form contract answers a refusal or a skipped
3538
- * write with `false` (it recovers with a fresh Host view instead of
3539
- * throwing), so the outcome is judged twice: the answer itself, and then the
3540
- * settled snapshot read back one planned write at a time. One missed write
3541
- * fails the whole save. A transport that rejects instead (the dsh-web bridge
3542
- * controller on a dead connection) reports through the same failure path
3543
- * with its rejection message. A save that did not land keeps its drafts, so
3544
- * the user can correct them instead of retyping.
4059
+ * A write is a Host round trip that also drives the profile reconcile, and
4060
+ * the Host runs it inside one exclusive transaction. Answering an edit that
4061
+ * arrives mid-flight by returning immediately dropped it with no explanation
4062
+ * (#1754). Serializing instead means an edit made while another write is
4063
+ * still settling is written against the settled state.
4064
+ * @returns settlement after the mutation and the read-back.
4065
+ */
4066
+ async requestSave() {
4067
+ if (this.saving) {
4068
+ this.saveQueued = true;
4069
+ return;
4070
+ }
4071
+ await this.save();
4072
+ if (!this.saveQueued) return;
4073
+ this.saveQueued = false;
4074
+ await this.requestSave();
4075
+ }
4076
+ /**
4077
+ * Write every valid draft in one atomic form mutation, then re-seed from
4078
+ * what the Host accepted. A draft the field does not accept stays on screen,
4079
+ * unwritten, without holding the others back.
4080
+ *
4081
+ * The batch rides one mutate, so cross-field validate hooks (baseURL+model)
4082
+ * judge it as a unit: the Host either applies every write or refuses the
4083
+ * batch. The form contract answers a refusal or a skipped write with `false`
4084
+ * (it recovers with a fresh Host view instead of throwing), so the outcome is
4085
+ * judged twice: the answer itself, and then the settled snapshot read back
4086
+ * one planned write at a time. One missed write fails the whole batch. A
4087
+ * transport that rejects instead (the dsh-web bridge controller on a dead
4088
+ * connection) reports through the same failure path with its rejection
4089
+ * message. A batch that did not land puts its picks and clears back to the
4090
+ * stored value and keeps its typed text, so the reader can correct it.
3545
4091
  * @returns settlement after the mutation and the read-back.
3546
4092
  */
3547
4093
  async save() {
3548
- const plan = this.plan();
3549
- const valid = plan.filter((item) => item.judge !== void 0);
3550
- if (plan.length === 0 || this.saving || valid.length !== plan.length) return;
4094
+ const valid = this.plan().filter((item) => item.judge !== void 0);
4095
+ if (valid.length === 0 || this.saving) return;
3551
4096
  const pending = /* @__PURE__ */ new Map();
3552
- for (const item of plan) pending.set(item.field, this.staged.get(item.field));
4097
+ for (const item of valid) pending.set(item.field, this.staged.get(item.field));
3553
4098
  this.saving = true;
3554
4099
  this.failed = false;
3555
4100
  this.failedReason = void 0;
@@ -3570,16 +4115,19 @@ window.__ModuleLoader__.load({
3570
4115
  failedReason = error instanceof Error ? error.message : String(error);
3571
4116
  }
3572
4117
  const landed = accepted && failedReason === void 0 && valid.every((item) => item.judge());
3573
- for (const [field, before] of pending) if (landed && this.staged.get(field) === before) this.staged.delete(field);
4118
+ for (const [field, before] of pending) {
4119
+ if (this.staged.get(field) !== before) continue;
4120
+ if (landed || before === void 0 || before.clear || this.specOf(field).entry === "pick") this.staged.delete(field);
4121
+ }
3574
4122
  this.saving = false;
3575
4123
  this.failed = !landed;
3576
4124
  this.failedReason = failedReason;
3577
4125
  this.publish();
3578
4126
  }
3579
4127
  /**
3580
- * Every staged edit a save would write. An entry whose draft is not a value
3581
- * its field accepts carries no write: the form is still dirty, and the save
3582
- * refuses rather than dropping the edit. A staged edit that matches the
4128
+ * Every staged edit a write would carry. An entry whose draft is not a value
4129
+ * its field accepts carries no write: the form is still dirty, and the draft
4130
+ * stays on screen rather than being dropped. A staged edit that matches the
3583
4131
  * effective section is not a write at all.
3584
4132
  * @returns the planned writes, in the order the fields were staged.
3585
4133
  */
@@ -3643,11 +4191,30 @@ window.__ModuleLoader__.load({
3643
4191
  landedUnset(field) {
3644
4192
  return !this.stored(field);
3645
4193
  }
4194
+ /**
4195
+ * Take one edit and schedule its write: a pick or a clear is written now,
4196
+ * typed text once typing has rested for TYPE_PAUSE_MS.
4197
+ */
3646
4198
  stage(field, edit) {
3647
4199
  this.staged.set(field, edit);
3648
4200
  this.failed = false;
3649
4201
  this.failedReason = void 0;
3650
4202
  this.publish();
4203
+ if (edit.clear || this.specOf(field).entry === "pick") {
4204
+ this.applyNow();
4205
+ return;
4206
+ }
4207
+ clearTimeout(this.typePause);
4208
+ this.typePause = setTimeout(() => {
4209
+ this.applyNow();
4210
+ }, 600);
4211
+ }
4212
+ /** Write every pending draft now, taking the place of a waiting pause. */
4213
+ applyNow() {
4214
+ clearTimeout(this.typePause);
4215
+ this.typePause = void 0;
4216
+ if (this.disposed) return;
4217
+ this.requestSave();
3651
4218
  }
3652
4219
  specOf(field) {
3653
4220
  const spec = this.specs.get(field);
@@ -3675,18 +4242,6 @@ window.__ModuleLoader__.load({
3675
4242
  }
3676
4243
  };
3677
4244
  //#endregion
3678
- //#region \0dsh-css:src/client/settings-section.module.css.mjs
3679
- const css = ".c5M8OW_sectionList{margin:0;padding:0;list-style:none}";
3680
- const tagId = "@linxin666/dsh-pet/src/client/settings-section.module.css";
3681
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
3682
- const tag = document.createElement("style");
3683
- tag.dataset.plugin = "@linxin666/dsh-pet";
3684
- tag.dataset.pluginCss = tagId;
3685
- tag.textContent = css;
3686
- document.head.appendChild(tag);
3687
- }
3688
- var settings_section_module_css_default = { "sectionList": "c5M8OW_sectionList" };
3689
- //#endregion
3690
4245
  //#region src/client/PetSettingsCard.tsx
3691
4246
  /**
3692
4247
  * The bubble modes this card can write, in render order. Mirrors the host
@@ -3694,6 +4249,27 @@ window.__ModuleLoader__.load({
3694
4249
  * host module for a value, so the accepted set is spelled here as literals.
3695
4250
  */
3696
4251
  const STATUS_BUBBLE_CHOICES = ["auto", "off"];
4252
+ /**
4253
+ * The spans the coarse sliders cover, spelled as literals for the same reason.
4254
+ * Size and bubble scale are the schema's own bounds (src/persist.ts); the
4255
+ * insets reach the schema's far end only by typing, so their slider covers the
4256
+ * distances a window can show.
4257
+ */
4258
+ const SIZE_RANGE = {
4259
+ min: 32,
4260
+ max: 1024,
4261
+ step: 1
4262
+ };
4263
+ const INSET_RANGE = {
4264
+ min: 0,
4265
+ max: 1e3,
4266
+ step: 1
4267
+ };
4268
+ const BUBBLE_SCALE_RANGE = {
4269
+ min: .5,
4270
+ max: 2,
4271
+ step: .05
4272
+ };
3697
4273
  /** Fetch the registry list (the same data the sprite renders from). */
3698
4274
  async function fetchPetChoices() {
3699
4275
  const response = await fetch("/api/pet/pets");
@@ -3717,11 +4293,14 @@ window.__ModuleLoader__.load({
3717
4293
  store;
3718
4294
  petChoices = [];
3719
4295
  petLabels = /* @__PURE__ */ new Map();
4296
+ petPreviews = [];
3720
4297
  selectedPetId;
3721
4298
  selectedVisible;
3722
4299
  stagedPetId;
3723
4300
  stagedVisible;
3724
4301
  savingPet = false;
4302
+ /** A fallback pick made while a write was in flight. */
4303
+ fallbackQueued = false;
3725
4304
  petSaveFailed = false;
3726
4305
  loaded = false;
3727
4306
  attempts = 0;
@@ -3756,6 +4335,7 @@ window.__ModuleLoader__.load({
3756
4335
  const list = await fetchPetChoices();
3757
4336
  if (this.disposed) return;
3758
4337
  this.petChoices.splice(0, this.petChoices.length, ...list.map((choice) => choice.id));
4338
+ this.petPreviews = list;
3759
4339
  for (const choice of list) this.petLabels.set(choice.id, choice.displayName);
3760
4340
  this.loaded = true;
3761
4341
  this.store.set(this.projection());
@@ -3799,12 +4379,16 @@ window.__ModuleLoader__.load({
3799
4379
  * Persist the staged selection and visibility through the pet API — the only
3800
4380
  * writer available when the aggregate shell serves this card, since there is
3801
4381
  * no Host settings form to mutate — then confirm the read-back before the
3802
- * drafts are cleared.
4382
+ * drafts are cleared. A refused write puts both picks back to what the pet
4383
+ * persisted. A pick made while a write is in flight runs once it settles.
3803
4384
  */
3804
4385
  async saveFallback() {
3805
4386
  const petId = this.stagedPetId;
3806
4387
  const visible = this.stagedVisible;
3807
- if (this.savingPet) return;
4388
+ if (this.savingPet) {
4389
+ this.fallbackQueued = true;
4390
+ return;
4391
+ }
3808
4392
  if (petId === void 0 && visible === void 0) return;
3809
4393
  if (petId !== void 0 && !this.petChoices.includes(petId)) return;
3810
4394
  this.savingPet = true;
@@ -3836,10 +4420,16 @@ window.__ModuleLoader__.load({
3836
4420
  if (this.stagedVisible === visible) this.stagedVisible = void 0;
3837
4421
  } catch {
3838
4422
  this.petSaveFailed = true;
4423
+ if (this.stagedPetId === petId) this.stagedPetId = void 0;
4424
+ if (this.stagedVisible === visible) this.stagedVisible = void 0;
3839
4425
  } finally {
3840
4426
  this.savingPet = false;
3841
4427
  if (!this.disposed) this.store.set(this.projection());
3842
4428
  }
4429
+ if (this.fallbackQueued && !this.disposed) {
4430
+ this.fallbackQueued = false;
4431
+ await this.saveFallback();
4432
+ }
3843
4433
  }
3844
4434
  projection() {
3845
4435
  const fallback = this.fallback();
@@ -3876,7 +4466,8 @@ window.__ModuleLoader__.load({
3876
4466
  petChoices: this.petChoices.map((id) => ({
3877
4467
  value: id,
3878
4468
  label: this.petLabels.get(id) ?? id
3879
- }))
4469
+ })),
4470
+ petPreviews: this.petPreviews
3880
4471
  };
3881
4472
  }
3882
4473
  /**
@@ -3894,6 +4485,7 @@ window.__ModuleLoader__.load({
3894
4485
  else return;
3895
4486
  this.petSaveFailed = false;
3896
4487
  this.store.set(this.projection());
4488
+ this.saveFallback();
3897
4489
  },
3898
4490
  resetField: (field) => {
3899
4491
  if (!this.fallback()) return actions.resetField(field);
@@ -3943,159 +4535,223 @@ window.__ModuleLoader__.load({
3943
4535
  overriddenLabel: t("settings.overridden"),
3944
4536
  resetLabel: t("settings.reset"),
3945
4537
  invalidLabel: t("settings.invalidNumber"),
3946
- disabled
4538
+ disabled,
4539
+ presentation: "segment"
3947
4540
  };
3948
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PluginSettingsCard, {
4541
+ const enabledSwitch = state.petSelectionFallback ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleSwitch, {
4542
+ labelledBy: "settings-pet-title",
4543
+ checked: state.enabled.text !== "false",
4544
+ disabled,
4545
+ onChange: (next) => {
4546
+ props.edit("enabled", String(next));
4547
+ }
4548
+ });
4549
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PluginSettingsCard, {
3949
4550
  t,
3950
4551
  titleKey: "settings.title",
4552
+ titleId: "settings-pet-title",
3951
4553
  descriptionKey: "settings.description",
3952
4554
  descriptionNode: state.petSelectionFallback ? t("settings.petHint") : void 0,
4555
+ headerAction: enabledSwitch,
3953
4556
  state,
3954
4557
  onSave: props.save,
3955
4558
  onDiscard: props.discard,
3956
4559
  alwaysOpen: true,
3957
- children: [
3958
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
3959
- id: "settings-pet-enabled",
3960
- label: t("settings.enabled"),
3961
- hint: t("settings.enabledHint"),
3962
- inheritLabel: t("settings.inherit"),
3963
- onLabel: t("settings.on"),
3964
- offLabel: t("settings.off"),
3965
- ...fieldProps,
3966
- ...state.enabled,
3967
- onEdit: (text) => {
3968
- props.edit("enabled", text);
3969
- },
3970
- onReset: () => {
3971
- props.resetField("enabled");
3972
- }
3973
- }),
3974
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
3975
- id: "settings-pet-decoration",
3976
- label: t("settings.decoration"),
3977
- hint: t("settings.decorationHint"),
3978
- inheritLabel: t("settings.inherit"),
3979
- onLabel: t("settings.on"),
3980
- offLabel: t("settings.off"),
3981
- ...fieldProps,
3982
- ...state.decorationEnabled,
3983
- onEdit: (text) => {
3984
- props.edit("decorationEnabled", text);
3985
- },
3986
- onReset: () => {
3987
- props.resetField("decorationEnabled");
3988
- }
3989
- }),
3990
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChoiceField, {
3991
- id: "settings-pet-status-bubbles",
3992
- label: t("settings.statusBubbles"),
3993
- hint: t("settings.statusBubblesHint"),
3994
- inheritLabel: t("settings.inherit"),
3995
- ...fieldProps,
3996
- ...state.statusBubbles,
3997
- choices: [{
3998
- value: STATUS_BUBBLE_CHOICES[0],
3999
- label: t("settings.on")
4000
- }, {
4001
- value: STATUS_BUBBLE_CHOICES[1],
4002
- label: t("settings.off")
4003
- }],
4004
- onEdit: (text) => {
4005
- props.edit("statusBubbles", text);
4006
- },
4007
- onReset: () => {
4008
- props.resetField("statusBubbles");
4009
- }
4010
- }),
4011
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChoiceField, {
4012
- id: "settings-pet-pet",
4013
- label: t("settings.pet"),
4014
- hint: t("settings.petHint"),
4015
- inheritLabel: t("settings.inherit"),
4016
- ...fieldProps,
4017
- ...state.petId,
4018
- choices: state.petChoices,
4019
- onEdit: (text) => {
4020
- props.edit("petId", text);
4021
- },
4022
- onReset: () => {
4023
- props.resetField("petId");
4024
- }
4025
- }),
4026
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
4027
- id: "settings-pet-visible",
4028
- label: t("settings.visible"),
4029
- hint: t("settings.visibleHint"),
4030
- inheritLabel: t("settings.inherit"),
4031
- onLabel: t("settings.on"),
4032
- offLabel: t("settings.off"),
4033
- ...fieldProps,
4034
- ...state.visible,
4035
- onEdit: (text) => {
4036
- props.edit("visible", text);
4037
- },
4038
- onReset: () => {
4039
- props.resetField("visible");
4040
- }
4041
- }),
4042
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4043
- id: "settings-pet-size",
4044
- label: t("settings.size"),
4045
- hint: t("settings.sizeHint"),
4046
- numeric: true,
4047
- ...fieldProps,
4048
- ...state.size,
4049
- onEdit: (text) => {
4050
- props.edit("size", text);
4051
- },
4052
- onReset: () => {
4053
- props.resetField("size");
4054
- }
4055
- }),
4056
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4057
- id: "settings-pet-right",
4058
- label: t("settings.right"),
4059
- hint: t("settings.rightHint"),
4060
- numeric: true,
4061
- ...fieldProps,
4062
- ...state.right,
4063
- onEdit: (text) => {
4064
- props.edit("right", text);
4065
- },
4066
- onReset: () => {
4067
- props.resetField("right");
4068
- }
4069
- }),
4070
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4071
- id: "settings-pet-bottom",
4072
- label: t("settings.bottom"),
4073
- hint: t("settings.bottomHint"),
4074
- numeric: true,
4075
- ...fieldProps,
4076
- ...state.bottom,
4077
- onEdit: (text) => {
4078
- props.edit("bottom", text);
4079
- },
4080
- onReset: () => {
4081
- props.resetField("bottom");
4082
- }
4083
- }),
4084
- state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4085
- id: "settings-pet-bubble-scale",
4086
- label: t("settings.bubbleScale"),
4087
- hint: t("settings.bubbleScaleHint"),
4088
- numeric: true,
4089
- ...fieldProps,
4090
- ...state.bubbleScale,
4091
- onEdit: (text) => {
4092
- props.edit("bubbleScale", text);
4093
- },
4094
- onReset: () => {
4095
- props.resetField("bubbleScale");
4096
- }
4097
- })
4098
- ]
4560
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4561
+ className: settings_section_module_css_default.settingsLayout,
4562
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4563
+ className: settings_section_module_css_default.selectionGroup,
4564
+ children: [
4565
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4566
+ className: settings_section_module_css_default.groupHeader,
4567
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
4568
+ className: settings_section_module_css_default.groupTitle,
4569
+ id: "settings-pet-selection-title",
4570
+ children: t("settings.pet")
4571
+ }), state.petId.overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4572
+ type: "button",
4573
+ className: settings_section_module_css_default.textAction,
4574
+ disabled,
4575
+ onClick: () => {
4576
+ props.resetField("petId");
4577
+ },
4578
+ children: t("settings.reset")
4579
+ }) : null]
4580
+ }),
4581
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4582
+ id: "settings-pet-pet",
4583
+ className: settings_section_module_css_default.petGrid,
4584
+ role: "group",
4585
+ "aria-labelledby": "settings-pet-selection-title",
4586
+ children: state.petPreviews.map((pet) => {
4587
+ const selected = state.petId.text === pet.id;
4588
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4589
+ type: "button",
4590
+ className: selected ? `${settings_section_module_css_default.petChoice} ${settings_section_module_css_default.petChoiceSelected}` : settings_section_module_css_default.petChoice,
4591
+ "aria-pressed": selected,
4592
+ title: pet.displayName,
4593
+ disabled,
4594
+ onClick: () => {
4595
+ props.edit("petId", pet.id);
4596
+ },
4597
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PetPreview, { pet }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4598
+ className: settings_section_module_css_default.petChoiceLabel,
4599
+ children: pet.displayName
4600
+ })]
4601
+ }, pet.id);
4602
+ })
4603
+ }),
4604
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4605
+ className: state.petId.invalid ? settings_section_module_css_default.invalid : settings_section_module_css_default.groupHint,
4606
+ children: state.petId.invalid ? t("settings.invalidNumber") : t("settings.petHint")
4607
+ })
4608
+ ]
4609
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4610
+ className: settings_section_module_css_default.settingsColumn,
4611
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4612
+ className: settings_section_module_css_default.settingsGroup,
4613
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4614
+ className: settings_section_module_css_default.groupHeader,
4615
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
4616
+ className: settings_section_module_css_default.groupTitle,
4617
+ id: "settings-pet-display-title",
4618
+ children: t("settings.displayGroup")
4619
+ })
4620
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4621
+ className: settings_section_module_css_default.fields,
4622
+ children: [
4623
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
4624
+ id: "settings-pet-visible",
4625
+ label: t("settings.visible"),
4626
+ hint: t("settings.visibleHint"),
4627
+ inheritLabel: t("settings.inherit"),
4628
+ onLabel: t("settings.on"),
4629
+ offLabel: t("settings.off"),
4630
+ ...fieldProps,
4631
+ ...state.visible,
4632
+ onEdit: (text) => {
4633
+ props.edit("visible", text);
4634
+ },
4635
+ onReset: () => {
4636
+ props.resetField("visible");
4637
+ }
4638
+ }),
4639
+ state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4640
+ id: "settings-pet-size",
4641
+ label: t("settings.size"),
4642
+ hint: t("settings.sizeHint"),
4643
+ numeric: true,
4644
+ range: SIZE_RANGE,
4645
+ ...fieldProps,
4646
+ ...state.size,
4647
+ onEdit: (text) => {
4648
+ props.edit("size", text);
4649
+ },
4650
+ onReset: () => {
4651
+ props.resetField("size");
4652
+ }
4653
+ }),
4654
+ state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4655
+ id: "settings-pet-right",
4656
+ label: t("settings.right"),
4657
+ hint: t("settings.rightHint"),
4658
+ numeric: true,
4659
+ range: INSET_RANGE,
4660
+ ...fieldProps,
4661
+ ...state.right,
4662
+ onEdit: (text) => {
4663
+ props.edit("right", text);
4664
+ },
4665
+ onReset: () => {
4666
+ props.resetField("right");
4667
+ }
4668
+ }),
4669
+ state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4670
+ id: "settings-pet-bottom",
4671
+ label: t("settings.bottom"),
4672
+ hint: t("settings.bottomHint"),
4673
+ numeric: true,
4674
+ range: INSET_RANGE,
4675
+ ...fieldProps,
4676
+ ...state.bottom,
4677
+ onEdit: (text) => {
4678
+ props.edit("bottom", text);
4679
+ },
4680
+ onReset: () => {
4681
+ props.resetField("bottom");
4682
+ }
4683
+ })
4684
+ ]
4685
+ })]
4686
+ }), state.petSelectionFallback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4687
+ className: settings_section_module_css_default.settingsGroup,
4688
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4689
+ className: settings_section_module_css_default.groupHeader,
4690
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
4691
+ className: settings_section_module_css_default.groupTitle,
4692
+ id: "settings-pet-behavior-title",
4693
+ children: t("settings.bubbleGroup")
4694
+ })
4695
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4696
+ className: settings_section_module_css_default.fields,
4697
+ children: [
4698
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
4699
+ id: "settings-pet-decoration",
4700
+ label: t("settings.decoration"),
4701
+ hint: t("settings.decorationHint"),
4702
+ inheritLabel: t("settings.inherit"),
4703
+ onLabel: t("settings.on"),
4704
+ offLabel: t("settings.off"),
4705
+ ...fieldProps,
4706
+ ...state.decorationEnabled,
4707
+ onEdit: (text) => {
4708
+ props.edit("decorationEnabled", text);
4709
+ },
4710
+ onReset: () => {
4711
+ props.resetField("decorationEnabled");
4712
+ }
4713
+ }),
4714
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChoiceField, {
4715
+ id: "settings-pet-status-bubbles",
4716
+ label: t("settings.statusBubbles"),
4717
+ hint: t("settings.statusBubblesHint"),
4718
+ inheritLabel: t("settings.inherit"),
4719
+ ...fieldProps,
4720
+ ...state.statusBubbles,
4721
+ choices: [{
4722
+ value: STATUS_BUBBLE_CHOICES[0],
4723
+ label: t("settings.on")
4724
+ }, {
4725
+ value: STATUS_BUBBLE_CHOICES[1],
4726
+ label: t("settings.off")
4727
+ }],
4728
+ onEdit: (text) => {
4729
+ props.edit("statusBubbles", text);
4730
+ },
4731
+ onReset: () => {
4732
+ props.resetField("statusBubbles");
4733
+ }
4734
+ }),
4735
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueField, {
4736
+ id: "settings-pet-bubble-scale",
4737
+ label: t("settings.bubbleScale"),
4738
+ hint: t("settings.bubbleScaleHint"),
4739
+ numeric: true,
4740
+ range: BUBBLE_SCALE_RANGE,
4741
+ ...fieldProps,
4742
+ ...state.bubbleScale,
4743
+ onEdit: (text) => {
4744
+ props.edit("bubbleScale", text);
4745
+ },
4746
+ onReset: () => {
4747
+ props.resetField("bubbleScale");
4748
+ }
4749
+ })
4750
+ ]
4751
+ })]
4752
+ })]
4753
+ })]
4754
+ })
4099
4755
  });
4100
4756
  }
4101
4757
  /** Render the pet settings card as a first-level settings page. */
@@ -4103,6 +4759,8 @@ window.__ModuleLoader__.load({
4103
4759
  const { t, usePetSettingsCard, save, discard, edit, resetField } = props;
4104
4760
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
4105
4761
  className: settings_section_module_css_default.sectionList,
4762
+ "data-dsh-plugin": "pet",
4763
+ "data-dsh-part": "panel",
4106
4764
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PetSettingsCard, {
4107
4765
  t,
4108
4766
  usePetSettingsCard,
@@ -4164,40 +4822,36 @@ window.__ModuleLoader__.load({
4164
4822
  "pet.moreSessions": "展开其余 {n} 个会话的气泡",
4165
4823
  "pet.collapseSessions": "收起会话气泡",
4166
4824
  "settings.title": "宠物",
4167
- "settings.description": "选择宠物并调整它的显示布局。",
4825
+ "settings.description": "选一只宠物,摆在页面的角落里。",
4168
4826
  "settings.pet": "宠物",
4169
- "settings.petHint": "选择显示哪只宠物;每只宠物独立命名,可在宠物悬浮面板改名。",
4170
- "settings.enabled": "启用宠物",
4171
- "settings.enabledHint": "关闭后隐藏宠物并停止轮询,可在设置里重新启用。",
4827
+ "settings.petHint": "名字跟着宠物走,在宠物面板里改。",
4828
+ "settings.displayGroup": "显示",
4829
+ "settings.bubbleGroup": "气泡",
4172
4830
  "settings.decoration": "状态装饰",
4173
- "settings.decorationHint": "在宠物状态气泡里显示喷水鲸鱼等状态装饰;关闭后气泡只剩文字。",
4831
+ "settings.decorationHint": "气泡里带上喷水鲸鱼这类装饰。",
4174
4832
  "settings.statusBubbles": "状态气泡",
4175
- "settings.statusBubblesHint": "宠物自带的会话/状态气泡(正在思考、正在使用 xxx)。关掉后只剩第三方插件通过公告契约推送的气泡与互动反馈气泡;默认开启。",
4833
+ "settings.statusBubblesHint": "宠物报告正在思考、正在用哪个工具。",
4176
4834
  "settings.visible": "显示宠物",
4177
- "settings.visibleHint": "关闭后宠物隐藏,可从聊天输入区重新召唤。",
4835
+ "settings.visibleHint": "藏起来后可在输入区召唤回来。",
4178
4836
  "settings.size": "大小(px)",
4179
- "settings.sizeHint": "精灵单元高度,范围 32–1024。",
4180
- "settings.bubbleScale": "气泡字号倍率",
4181
- "settings.bubbleScaleHint": "状态、碎碎念与用量气泡的字号会随宠物大小自动缩放;这一项是在此基础上再乘一个倍率(0.5–2,默认 1)。字号本身不小于 10px、不大于 24px。",
4837
+ "settings.sizeHint": "宠物的高度。",
4838
+ "settings.bubbleScale": "气泡字号",
4839
+ "settings.bubbleScaleHint": "字号随宠物缩放,再乘上这个倍数。",
4182
4840
  "settings.right": "距右侧(px)",
4183
- "settings.rightHint": "距视口右边缘的水平内缩距离。",
4841
+ "settings.rightHint": "离窗口右边的距离。",
4184
4842
  "settings.bottom": "距底部(px)",
4185
- "settings.bottomHint": "距视口底边的垂直内缩距离。",
4186
- "settings.inherit": "继承",
4843
+ "settings.bottomHint": "离窗口底边的距离。",
4844
+ "settings.inherit": "默认",
4187
4845
  "settings.on": "开",
4188
4846
  "settings.off": "关",
4189
- "settings.overridden": "已覆盖",
4847
+ "settings.overridden": "已修改",
4190
4848
  "settings.reset": "恢复默认",
4191
- "settings.notExposed": "当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 $DSH_HOME/settings.yaml 直接配置,或确认提供该命名空间的插件已挂载其设置域并重启。",
4192
- "settings.readOnly": "当前部署的设置只读。",
4849
+ "settings.notExposed": "这个版本的 DSH 没有开放宠物的设置,可直接编辑 $DSH_HOME/settings.yaml。",
4850
+ "settings.readOnly": "设置只读。",
4193
4851
  "settings.expand": "展开设置",
4194
4852
  "settings.collapse": "收起设置",
4195
- "settings.save": "保存",
4196
- "settings.saving": "保存中…",
4197
- "settings.discard": "放弃",
4198
- "settings.unsaved": "未保存",
4199
- "settings.saveFailed": "部署未接受这些值,已保留供你修改。",
4200
- "settings.invalidNumber": "请输入数字,留空则使用默认值。"
4853
+ "settings.saveFailed": "没有保存成功,输入的值还留着。",
4854
+ "settings.invalidNumber": "填一个数字,留空用默认值。"
4201
4855
  };
4202
4856
  /** English copy. */
4203
4857
  const en = {
@@ -4248,42 +4902,145 @@ window.__ModuleLoader__.load({
4248
4902
  "pet.moreSessions": "Expand {n} more session bubbles",
4249
4903
  "pet.collapseSessions": "Collapse session bubbles",
4250
4904
  "settings.title": "Pet",
4251
- "settings.description": "Pick a pet and tune its display layout.",
4905
+ "settings.description": "Pick a pet to sit in a corner of the page.",
4252
4906
  "settings.pet": "Pet",
4253
- "settings.petHint": "Choose which pet shows. Names are stored per pet; rename from the pet hover panel.",
4254
- "settings.enabled": "Enable the pet",
4255
- "settings.enabledHint": "When off, the pet hides and polling stops; re-enable it here.",
4907
+ "settings.petHint": "Each pet keeps its own name; rename it from the pet panel.",
4908
+ "settings.displayGroup": "Display",
4909
+ "settings.bubbleGroup": "Bubbles",
4256
4910
  "settings.decoration": "Status decoration",
4257
- "settings.decorationHint": "Show ornaments like the spouting whale inside the pet status bubbles; when off, bubbles stay text-only.",
4911
+ "settings.decorationHint": "Bubbles carry ornaments like the spouting whale.",
4258
4912
  "settings.statusBubbles": "Status bubbles",
4259
- "settings.statusBubblesHint": "The pet's own session/status bubbles (thinking, using ...). Turning them off leaves only bubbles a third-party plugin pushes through the announcement contract, plus the interaction feedback bubble; on by default.",
4913
+ "settings.statusBubblesHint": "The pet reports when it is thinking and which tool it is using.",
4260
4914
  "settings.visible": "Show the pet",
4261
- "settings.visibleHint": "When off, the pet hides; summon it again from the input row.",
4915
+ "settings.visibleHint": "A hidden pet comes back from the input row.",
4262
4916
  "settings.size": "Size (px)",
4263
- "settings.sizeHint": "Sprite cell height, 32–1024.",
4264
- "settings.bubbleScale": "Bubble text multiplier",
4265
- "settings.bubbleScaleHint": "Status, whisper, and usage bubbles scale with the pet automatically; this multiplies that result (0.5–2, default 1). The rendered text stays between 10px and 24px.",
4917
+ "settings.sizeHint": "How tall the pet stands.",
4918
+ "settings.bubbleScale": "Bubble text",
4919
+ "settings.bubbleScaleHint": "Text follows the pet size, times this factor.",
4266
4920
  "settings.right": "Right inset (px)",
4267
- "settings.rightHint": "Horizontal inset from the viewport right edge.",
4921
+ "settings.rightHint": "Distance from the right edge of the window.",
4268
4922
  "settings.bottom": "Bottom inset (px)",
4269
- "settings.bottomHint": "Vertical inset from the viewport bottom edge.",
4270
- "settings.inherit": "Inherit",
4923
+ "settings.bottomHint": "Distance from the bottom edge of the window.",
4924
+ "settings.inherit": "Default",
4271
4925
  "settings.on": "On",
4272
4926
  "settings.off": "Off",
4273
- "settings.overridden": "Overridden",
4927
+ "settings.overridden": "Changed",
4274
4928
  "settings.reset": "Reset to default",
4275
- "settings.notExposed": "This DSH version does not expose this plugin's settings namespace to the configuration page, so the form is unavailable. Edit $DSH_HOME/settings.yaml directly, or confirm that the plugin owning the namespace is mounted with its settings domain and restart.",
4276
- "settings.readOnly": "This deployment stores settings read-only.",
4929
+ "settings.notExposed": "This DSH version does not open the pet settings here; edit $DSH_HOME/settings.yaml instead.",
4930
+ "settings.readOnly": "Settings are read-only.",
4277
4931
  "settings.expand": "Show settings",
4278
4932
  "settings.collapse": "Hide settings",
4279
- "settings.save": "Save",
4280
- "settings.saving": "Saving…",
4281
- "settings.discard": "Discard",
4282
- "settings.unsaved": "Unsaved",
4283
- "settings.saveFailed": "The deployment did not accept these values; they were left for you to correct.",
4284
- "settings.invalidNumber": "Enter a number, or leave blank to use the default."
4933
+ "settings.saveFailed": "Not saved; what you typed is still there.",
4934
+ "settings.invalidNumber": "Enter a number, or leave it empty for the default."
4285
4935
  };
4286
4936
  //#endregion
4937
+ //#region src/client/web-extension-page.ts
4938
+ const SETTINGS_SECTION = "settings.section";
4939
+ const WEB_EXTENSION_SLOT = "web-ui.extension";
4940
+ function serviceOf(ctx) {
4941
+ if (typeof ctx.get !== "function") return void 0;
4942
+ try {
4943
+ const candidate = ctx.get("webUiExtensions");
4944
+ return candidate !== null && typeof candidate === "object" && typeof candidate.sectionId === "string" && typeof candidate.registerPage === "function" ? candidate : void 0;
4945
+ } catch {
4946
+ return;
4947
+ }
4948
+ }
4949
+ function warn(seat, error) {
4950
+ try {
4951
+ console.warn(`[dsh-web-settings] page "${seat}" could not be mounted`, error);
4952
+ } catch {}
4953
+ }
4954
+ /**
4955
+ * Keep exactly one reachable page contribution while the parent loads or
4956
+ * unloads. The parent service owns integrated mounting; only the fallback uses
4957
+ * this plugin's own slot registry. Slot disposal is synchronous, so the latch
4958
+ * prevents a move from recursively registering a duplicate.
4959
+ */
4960
+ function installWebExtensionPage(ctx, page) {
4961
+ let dispose;
4962
+ let current;
4963
+ let reconciling = false;
4964
+ let disposed = false;
4965
+ const present = (seat) => {
4966
+ if (typeof ctx.slots.entries !== "function") return current === seat;
4967
+ const slot = seat === "integrated" ? WEB_EXTENSION_SLOT : SETTINGS_SECTION;
4968
+ return ctx.slots.entries(slot).some((entry) => entry.component === page.component && (seat === "integrated" ? entry.options.key : entry.options.id) === page.key);
4969
+ };
4970
+ const registerSeat = (seat) => {
4971
+ if (seat === "integrated") {
4972
+ const service = serviceOf(ctx);
4973
+ if (service === void 0) throw new Error("webUiExtensions service is unavailable");
4974
+ return service.registerPage(page);
4975
+ }
4976
+ return ctx.slots.register({
4977
+ name: SETTINGS_SECTION,
4978
+ id: page.key,
4979
+ order: page.order,
4980
+ label: page.label,
4981
+ locale: page.locale,
4982
+ inject: page.inject,
4983
+ ...page.children === void 0 ? {} : { children: page.children }
4984
+ }, page.component);
4985
+ };
4986
+ const reconcile = () => {
4987
+ if (disposed || reconciling) return;
4988
+ const target = serviceOf(ctx) === void 0 ? "legacy" : "integrated";
4989
+ if (current === target && present(target)) return;
4990
+ const slot = target === "integrated" ? WEB_EXTENSION_SLOT : SETTINGS_SECTION;
4991
+ if (typeof ctx.slots.spec === "function" && ctx.slots.spec(slot) === void 0) return;
4992
+ reconciling = true;
4993
+ const previous = current;
4994
+ const disposePrevious = dispose;
4995
+ current = void 0;
4996
+ dispose = void 0;
4997
+ disposePrevious?.();
4998
+ try {
4999
+ dispose = registerSeat(target);
5000
+ current = target;
5001
+ } catch (error) {
5002
+ warn(target, error);
5003
+ if (previous !== void 0 && previous !== target) try {
5004
+ dispose = registerSeat(previous);
5005
+ current = previous;
5006
+ } catch (restoreError) {
5007
+ warn(previous, restoreError);
5008
+ }
5009
+ } finally {
5010
+ reconciling = false;
5011
+ }
5012
+ };
5013
+ if (typeof ctx.on === "function") try {
5014
+ ctx.on("slots/changed", reconcile);
5015
+ } catch {}
5016
+ reconcile();
5017
+ return () => {
5018
+ if (disposed) return;
5019
+ disposed = true;
5020
+ dispose?.();
5021
+ dispose = void 0;
5022
+ current = void 0;
5023
+ };
5024
+ }
5025
+ //#endregion
5026
+ //#region src/client/settings-registration.ts
5027
+ /**
5028
+ * Register exactly one reachable pet entry and follow the parent across late
5029
+ * loading or teardown. The controller belongs to apply(), not a registration,
5030
+ * so moving seats never resets staged edits or subscriptions.
5031
+ * @returns the page contribution's disposer.
5032
+ */
5033
+ function installPetSettingsRegistration(ctx, controller) {
5034
+ return installWebExtensionPage(ctx, {
5035
+ key: "pet",
5036
+ order: 130,
5037
+ locale: "pet",
5038
+ label: () => ctx.locale.bind("pet")("settings.title"),
5039
+ inject: () => controller.inject(),
5040
+ component: PetSettingsSection
5041
+ });
5042
+ }
5043
+ //#endregion
4287
5044
  //#region src/client/main-session.ts
4288
5045
  /**
4289
5046
  * Resolve the Session the main view currently shows.
@@ -4306,7 +5063,7 @@ window.__ModuleLoader__.load({
4306
5063
  /** The building package's version, when the bundle carries it. */
4307
5064
  function bakedVersion() {
4308
5065
  try {
4309
- return "0.4.10";
5066
+ return "0.4.11";
4310
5067
  } catch {
4311
5068
  return;
4312
5069
  }
@@ -4631,24 +5388,11 @@ window.__ModuleLoader__.load({
4631
5388
  return snapshot.status === "ready" ? snapshot.value?.enabled ?? true : snapshot.status === "unavailable";
4632
5389
  };
4633
5390
  const petSettings = new PetSettingsCardController(settingsForm);
4634
- ctx.slots.inject("settings.section", () => {
4635
- try {
4636
- const unregister = ctx.slots.register({
4637
- name: "settings.section",
4638
- id: "pet",
4639
- order: 130,
4640
- label: () => ctx.locale.bind("pet")("settings.title"),
4641
- locale: "pet",
4642
- inject: () => petSettings.inject()
4643
- }, PetSettingsSection);
4644
- return () => {
4645
- unregister();
4646
- petSettings.dispose();
4647
- };
4648
- } catch {
4649
- return () => {};
4650
- }
4651
- });
5391
+ const disposeSettingsRegistration = installPetSettingsRegistration(ctx, petSettings);
5392
+ ctx.effect(() => () => {
5393
+ disposeSettingsRegistration();
5394
+ petSettings.dispose();
5395
+ }, "pet: settings page");
4652
5396
  let disposeUi;
4653
5397
  let clearUiTeardown;
4654
5398
  let uiDead = false;