@linxin666/dsh-pet 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +93 -74
- package/lib/client.js.map +1 -1
- package/lib/types/client/PetSettingsCard.d.ts +11 -5
- package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
- package/lib/types/client/PetSettingsCard.js +7 -1
- package/lib/types/client/PluginSettingsCard.d.ts +11 -0
- package/lib/types/client/PluginSettingsCard.d.ts.map +1 -1
- package/lib/types/client/PluginSettingsCard.js +11 -5
- package/lib/types/client/index.d.ts +3 -22
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +12 -11
- package/lib/types/client/locales.js +2 -2
- package/package.json +1 -1
- package/src/client/PetSettingsCard.tsx +27 -6
- package/src/client/PluginSettingsCard.tsx +50 -47
- package/src/client/index.ts +13 -29
- package/src/client/locales.ts +2 -2
- package/src/client/settings-card.module.css +9 -0
- package/src/client/settings-section.module.css +5 -0
package/lib/client.js
CHANGED
|
@@ -107,13 +107,13 @@ window.__ModuleLoader__.load({
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region \0dsh-css:packages/dsh-pet/src/client/pet.module.css.mjs
|
|
110
|
-
const css$
|
|
111
|
-
const tagId$
|
|
112
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
110
|
+
const css$2 = ".kz2Bea_float{pointer-events:auto;-webkit-user-select:none;user-select:none;flex-direction:column;align-items:center;display:flex;position:fixed}.kz2Bea_sprite{image-rendering:auto;touch-action:none;position:relative}.kz2Bea_bubble{white-space:nowrap;color:#fff;pointer-events:none;border-radius:999px;margin-bottom:6px;padding:4px 10px;font-size:12px;line-height:1.4;animation:2.6s ease-out forwards kz2Bea_pet-bubble-pop;position:absolute;bottom:100%;box-shadow:0 2px 8px #00000040}.kz2Bea_bubblePet{background:#f472b6eb}.kz2Bea_bubbleFeed{background:#38bdf8eb}.kz2Bea_bubbleStatus{text-overflow:ellipsis;background:#0f172ae6;border:1px solid #7dd3fc80;max-width:min(280px,100vw - 24px);animation:none;overflow:hidden}@keyframes kz2Bea_pet-bubble-pop{0%{opacity:0;transform:translateY(6px)scale(.85)}15%{opacity:1;transform:translateY(0)scale(1.05)}25%{transform:translateY(0)scale(1)}75%{opacity:1}to{opacity:0;transform:translateY(-8px)scale(.95)}}.kz2Bea_panel{color:#e2e8f0;backdrop-filter:blur(6px);background:#0f172aeb;border:1px solid #94a3b859;border-radius:10px;flex-direction:column;gap:6px;min-width:132px;padding:8px 10px;font-size:12px;display:flex;position:absolute;bottom:100%;box-shadow:0 4px 16px #00000059}.kz2Bea_panel:after{content:\"\";height:14px;position:absolute;top:100%;left:0;right:0}.kz2Bea_rankRow{white-space:nowrap;justify-content:space-between;gap:10px;display:flex}.kz2Bea_nameCell{font-weight:600}.kz2Bea_renameRow{align-items:center;gap:6px;display:flex}.kz2Bea_nameInput{color:#e2e8f0;background:#1e293be6;border:1px solid #7dd3fc80;border-radius:6px;outline:none;flex:1;min-width:0;padding:3px 6px;font-size:12px}.kz2Bea_nameInput:focus{border-color:#38bdf8;box-shadow:0 0 0 2px #38bdf873}.kz2Bea_actions{gap:6px;display:flex}.kz2Bea_action{cursor:pointer;color:#0f172a;background:linear-gradient(#7dd3fc,#38bdf8);border:none;border-radius:6px;flex:1;padding:4px 8px;font-size:12px;transition:filter .12s,box-shadow .12s}.kz2Bea_action:hover{filter:brightness(1.08)}.kz2Bea_action:active{filter:brightness(.94)}.kz2Bea_action:focus-visible{outline:none;box-shadow:0 0 0 2px #38bdf8d9}.kz2Bea_summon{color:#7dd3fc;cursor:pointer;background:#0f172abf;border:1px dashed #7dd3fc99;border-radius:999px;padding:2px 10px;font-size:11px;transition:border-color .12s,color .12s,background .12s,box-shadow .12s}.kz2Bea_summon:hover{color:#bae6fd;background:#0f172ae6;border-color:#7dd3fcf2}.kz2Bea_summon:active{color:#7dd3fc;border-color:#7dd3fccc}.kz2Bea_summon:focus-visible{outline:none;box-shadow:0 0 0 2px #38bdf8d9}@media (prefers-reduced-motion:reduce){.kz2Bea_bubble{opacity:1;animation:none}.kz2Bea_action,.kz2Bea_summon{transition:none}}";
|
|
111
|
+
const tagId$2 = "@linxin666/dsh-pet/pet.module.css";
|
|
112
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
|
|
113
113
|
const tag = document.createElement("style");
|
|
114
114
|
tag.dataset.plugin = "@linxin666/dsh-pet";
|
|
115
|
-
tag.dataset.pluginCss = tagId$
|
|
116
|
-
tag.textContent = css$
|
|
115
|
+
tag.dataset.pluginCss = tagId$2;
|
|
116
|
+
tag.textContent = css$2;
|
|
117
117
|
document.head.appendChild(tag);
|
|
118
118
|
}
|
|
119
119
|
var pet_module_css_default = {
|
|
@@ -491,13 +491,13 @@ window.__ModuleLoader__.load({
|
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region \0dsh-css:packages/dsh-pet/src/client/settings-card.module.css.mjs
|
|
494
|
-
const css = ".kKk9aW_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}.kKk9aW_card:hover{border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_header{appearance:none;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}.kKk9aW_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.kKk9aW_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.kKk9aW_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.kKk9aW_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}.kKk9aW_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}.kKk9aW_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.kKk9aW_chevronOpen{transform:rotate(180deg)}.kKk9aW_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.kKk9aW_readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}.kKk9aW_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}.kKk9aW_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}.kKk9aW_failed{min-width:0;color:var(--dsw-alias-label-error);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:12px;line-height:1.5;overflow:hidden}.kKk9aW_discard,.kKk9aW_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.kKk9aW_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.kKk9aW_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.kKk9aW_discard:disabled,.kKk9aW_save:disabled{opacity:.4;cursor:default}.kKk9aW_discard:focus-visible,.kKk9aW_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.kKk9aW_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.kKk9aW_field+.kKk9aW_field{border-top:1px solid var(--dsw-alias-border-l2)}.kKk9aW_head{align-items:center;gap:8px;display:flex}.kKk9aW_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.kKk9aW_badges{align-items:center;gap:8px;display:inline-flex}.kKk9aW_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}.kKk9aW_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}.kKk9aW_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.kKk9aW_reset:disabled{cursor:default}.kKk9aW_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}.kKk9aW_input,.kKk9aW_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}.kKk9aW_input:focus-visible,.kKk9aW_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.kKk9aW_input:disabled,.kKk9aW_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.kKk9aW_inputInvalid{border:1px solid var(--dsw-alias-label-error);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}.kKk9aW_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-label-error);outline-offset:1px;border-color:var(--dsw-alias-label-error)}.kKk9aW_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.kKk9aW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}@media (prefers-reduced-motion:reduce){.kKk9aW_card,.kKk9aW_header,.kKk9aW_chevron,.kKk9aW_chevronOpen,.kKk9aW_discard,.kKk9aW_save{transition:none}}";
|
|
495
|
-
const tagId = "@linxin666/dsh-pet/settings-card.module.css";
|
|
496
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
494
|
+
const css$1 = ".kKk9aW_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}.kKk9aW_card:hover{border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_header{appearance:none;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}.kKk9aW_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.kKk9aW_headerStatic{border-radius:12px;align-items:center;gap:12px;width:100%;padding:14px 16px;display:flex}.kKk9aW_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.kKk9aW_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.kKk9aW_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}.kKk9aW_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}.kKk9aW_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.kKk9aW_chevronOpen{transform:rotate(180deg)}.kKk9aW_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.kKk9aW_readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}.kKk9aW_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}.kKk9aW_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}.kKk9aW_failed{min-width:0;color:var(--dsw-alias-label-error);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:12px;line-height:1.5;overflow:hidden}.kKk9aW_discard,.kKk9aW_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.kKk9aW_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.kKk9aW_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.kKk9aW_discard:disabled,.kKk9aW_save:disabled{opacity:.4;cursor:default}.kKk9aW_discard:focus-visible,.kKk9aW_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.kKk9aW_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.kKk9aW_field+.kKk9aW_field{border-top:1px solid var(--dsw-alias-border-l2)}.kKk9aW_head{align-items:center;gap:8px;display:flex}.kKk9aW_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.kKk9aW_badges{align-items:center;gap:8px;display:inline-flex}.kKk9aW_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}.kKk9aW_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}.kKk9aW_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.kKk9aW_reset:disabled{cursor:default}.kKk9aW_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}.kKk9aW_input,.kKk9aW_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}.kKk9aW_input:focus-visible,.kKk9aW_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.kKk9aW_input:disabled,.kKk9aW_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.kKk9aW_inputInvalid{border:1px solid var(--dsw-alias-label-error);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}.kKk9aW_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-label-error);outline-offset:1px;border-color:var(--dsw-alias-label-error)}.kKk9aW_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.kKk9aW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}@media (prefers-reduced-motion:reduce){.kKk9aW_card,.kKk9aW_header,.kKk9aW_chevron,.kKk9aW_chevronOpen,.kKk9aW_discard,.kKk9aW_save{transition:none}}";
|
|
495
|
+
const tagId$1 = "@linxin666/dsh-pet/settings-card.module.css";
|
|
496
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
497
497
|
const tag = document.createElement("style");
|
|
498
498
|
tag.dataset.plugin = "@linxin666/dsh-pet";
|
|
499
|
-
tag.dataset.pluginCss = tagId;
|
|
500
|
-
tag.textContent = css;
|
|
499
|
+
tag.dataset.pluginCss = tagId$1;
|
|
500
|
+
tag.textContent = css$1;
|
|
501
501
|
document.head.appendChild(tag);
|
|
502
502
|
}
|
|
503
503
|
var settings_card_module_css_default = {
|
|
@@ -516,6 +516,7 @@ window.__ModuleLoader__.load({
|
|
|
516
516
|
"head": "kKk9aW_head",
|
|
517
517
|
"headText": "kKk9aW_headText",
|
|
518
518
|
"header": "kKk9aW_header",
|
|
519
|
+
"headerStatic": "kKk9aW_headerStatic",
|
|
519
520
|
"hint": "kKk9aW_hint",
|
|
520
521
|
"input": "kKk9aW_input",
|
|
521
522
|
"inputInvalid": "kKk9aW_inputInvalid",
|
|
@@ -545,24 +546,42 @@ window.__ModuleLoader__.load({
|
|
|
545
546
|
* @returns the card, or nothing while the namespace is still loading.
|
|
546
547
|
*/
|
|
547
548
|
function PluginSettingsCard(props) {
|
|
548
|
-
const [open, setOpen] = (0, react.useState)(
|
|
549
|
-
const { state } = props;
|
|
549
|
+
const [open, setOpen] = (0, react.useState)(props.defaultOpen ?? true);
|
|
550
|
+
const { state, alwaysOpen } = props;
|
|
550
551
|
if (!state.available) return null;
|
|
551
552
|
const title = props.t(props.titleKey);
|
|
552
553
|
const description = props.t(props.descriptionKey);
|
|
553
554
|
const blocked = !state.dirty || state.invalid || state.saving;
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
className: settings_card_module_css_default.
|
|
560
|
-
"
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
},
|
|
565
|
-
|
|
555
|
+
const expanded = alwaysOpen === true || open;
|
|
556
|
+
const cardClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
|
|
557
|
+
const header = alwaysOpen === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
558
|
+
className: settings_card_module_css_default.headerStatic,
|
|
559
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
560
|
+
className: settings_card_module_css_default.headText,
|
|
561
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
562
|
+
className: settings_card_module_css_default.name,
|
|
563
|
+
title,
|
|
564
|
+
children: title
|
|
565
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
566
|
+
className: settings_card_module_css_default.description,
|
|
567
|
+
title: description,
|
|
568
|
+
children: description
|
|
569
|
+
})]
|
|
570
|
+
}), state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
571
|
+
className: settings_card_module_css_default.pending,
|
|
572
|
+
title: props.t("settings.unsaved"),
|
|
573
|
+
children: props.t("settings.unsaved")
|
|
574
|
+
}) : null]
|
|
575
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
576
|
+
type: "button",
|
|
577
|
+
className: settings_card_module_css_default.header,
|
|
578
|
+
"aria-expanded": open,
|
|
579
|
+
"aria-label": `${props.t(open ? "settings.collapse" : "settings.expand")}: ${title}`,
|
|
580
|
+
onClick: () => {
|
|
581
|
+
setOpen(!open);
|
|
582
|
+
},
|
|
583
|
+
children: [
|
|
584
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
566
585
|
className: settings_card_module_css_default.headText,
|
|
567
586
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
568
587
|
className: settings_card_module_css_default.name,
|
|
@@ -573,7 +592,13 @@ window.__ModuleLoader__.load({
|
|
|
573
592
|
title: description,
|
|
574
593
|
children: description
|
|
575
594
|
})]
|
|
576
|
-
}),
|
|
595
|
+
}),
|
|
596
|
+
state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
597
|
+
className: settings_card_module_css_default.pending,
|
|
598
|
+
title: props.t("settings.unsaved"),
|
|
599
|
+
children: props.t("settings.unsaved")
|
|
600
|
+
}) : null,
|
|
601
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
577
602
|
width: "14",
|
|
578
603
|
height: "14",
|
|
579
604
|
viewBox: "0 0 14 14",
|
|
@@ -584,8 +609,12 @@ window.__ModuleLoader__.load({
|
|
|
584
609
|
d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
|
|
585
610
|
fill: "currentColor"
|
|
586
611
|
})
|
|
587
|
-
})
|
|
588
|
-
|
|
612
|
+
})
|
|
613
|
+
]
|
|
614
|
+
});
|
|
615
|
+
if (!state.exposed) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
616
|
+
className: cardClass,
|
|
617
|
+
children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
589
618
|
className: settings_card_module_css_default.body,
|
|
590
619
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
591
620
|
className: settings_card_module_css_default.notExposed,
|
|
@@ -596,46 +625,7 @@ window.__ModuleLoader__.load({
|
|
|
596
625
|
});
|
|
597
626
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
598
627
|
className: cardClass,
|
|
599
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
600
|
-
type: "button",
|
|
601
|
-
className: settings_card_module_css_default.header,
|
|
602
|
-
"aria-expanded": open,
|
|
603
|
-
"aria-label": `${props.t(open ? "settings.collapse" : "settings.expand")}: ${title}`,
|
|
604
|
-
onClick: () => {
|
|
605
|
-
setOpen(!open);
|
|
606
|
-
},
|
|
607
|
-
children: [
|
|
608
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
609
|
-
className: settings_card_module_css_default.headText,
|
|
610
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
611
|
-
className: settings_card_module_css_default.name,
|
|
612
|
-
title,
|
|
613
|
-
children: title
|
|
614
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
615
|
-
className: settings_card_module_css_default.description,
|
|
616
|
-
title: description,
|
|
617
|
-
children: description
|
|
618
|
-
})]
|
|
619
|
-
}),
|
|
620
|
-
state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
621
|
-
className: settings_card_module_css_default.pending,
|
|
622
|
-
title: props.t("settings.unsaved"),
|
|
623
|
-
children: props.t("settings.unsaved")
|
|
624
|
-
}) : null,
|
|
625
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
626
|
-
width: "14",
|
|
627
|
-
height: "14",
|
|
628
|
-
viewBox: "0 0 14 14",
|
|
629
|
-
fill: "none",
|
|
630
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
631
|
-
className: open ? `${settings_card_module_css_default.chevron} ${settings_card_module_css_default.chevronOpen}` : settings_card_module_css_default.chevron,
|
|
632
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
633
|
-
d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
|
|
634
|
-
fill: "currentColor"
|
|
635
|
-
})
|
|
636
|
-
})
|
|
637
|
-
]
|
|
638
|
-
}), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
628
|
+
children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
639
629
|
className: settings_card_module_css_default.body,
|
|
640
630
|
children: [
|
|
641
631
|
!state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -1097,6 +1087,18 @@ window.__ModuleLoader__.load({
|
|
|
1097
1087
|
}
|
|
1098
1088
|
};
|
|
1099
1089
|
//#endregion
|
|
1090
|
+
//#region \0dsh-css:packages/dsh-pet/src/client/settings-section.module.css.mjs
|
|
1091
|
+
const css = ".t0P0pa_sectionList{margin:0;padding:0;list-style:none}";
|
|
1092
|
+
const tagId = "@linxin666/dsh-pet/settings-section.module.css";
|
|
1093
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
1094
|
+
const tag = document.createElement("style");
|
|
1095
|
+
tag.dataset.plugin = "@linxin666/dsh-pet";
|
|
1096
|
+
tag.dataset.pluginCss = tagId;
|
|
1097
|
+
tag.textContent = css;
|
|
1098
|
+
document.head.appendChild(tag);
|
|
1099
|
+
}
|
|
1100
|
+
var settings_section_module_css_default = { "sectionList": "t0P0pa_sectionList" };
|
|
1101
|
+
//#endregion
|
|
1100
1102
|
//#region src/client/PetSettingsCard.tsx
|
|
1101
1103
|
/** Fetch the registry list (the same data the sprite renders from). */
|
|
1102
1104
|
async function fetchPetChoices() {
|
|
@@ -1189,6 +1191,7 @@ window.__ModuleLoader__.load({
|
|
|
1189
1191
|
state,
|
|
1190
1192
|
onSave: props.save,
|
|
1191
1193
|
onDiscard: props.discard,
|
|
1194
|
+
alwaysOpen: true,
|
|
1192
1195
|
children: [
|
|
1193
1196
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
|
|
1194
1197
|
id: "settings-pet-enabled",
|
|
@@ -1282,6 +1285,21 @@ window.__ModuleLoader__.load({
|
|
|
1282
1285
|
]
|
|
1283
1286
|
});
|
|
1284
1287
|
}
|
|
1288
|
+
/** Render the pet settings card as a first-level settings page. */
|
|
1289
|
+
function PetSettingsSection(props) {
|
|
1290
|
+
const { t, usePetSettingsCard, save, discard, edit, resetField } = props;
|
|
1291
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1292
|
+
className: settings_section_module_css_default.sectionList,
|
|
1293
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PetSettingsCard, {
|
|
1294
|
+
t,
|
|
1295
|
+
usePetSettingsCard,
|
|
1296
|
+
save,
|
|
1297
|
+
discard,
|
|
1298
|
+
edit,
|
|
1299
|
+
resetField
|
|
1300
|
+
})
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1285
1303
|
//#endregion
|
|
1286
1304
|
//#region src/client/locales.ts
|
|
1287
1305
|
/** Chinese copy. */
|
|
@@ -1428,8 +1446,8 @@ window.__ModuleLoader__.load({
|
|
|
1428
1446
|
];
|
|
1429
1447
|
/**
|
|
1430
1448
|
* Client plugin body: register dictionaries, mount the global pet entry and
|
|
1431
|
-
* poll loop while the plugin is enabled, and seat the settings card
|
|
1432
|
-
*
|
|
1449
|
+
* poll loop while the plugin is enabled, and seat the settings card as a
|
|
1450
|
+
* first-level settings section.
|
|
1433
1451
|
* @param ctx - client root context.
|
|
1434
1452
|
*/
|
|
1435
1453
|
function apply(ctx) {
|
|
@@ -1443,13 +1461,14 @@ window.__ModuleLoader__.load({
|
|
|
1443
1461
|
return snapshot.status === "ready" ? snapshot.value?.enabled ?? true : snapshot.status === "unavailable";
|
|
1444
1462
|
};
|
|
1445
1463
|
const petSettings = new PetSettingsCardController(settingsScope);
|
|
1446
|
-
ctx.slots.inject("
|
|
1447
|
-
name: "
|
|
1448
|
-
id: "pet
|
|
1449
|
-
order:
|
|
1464
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
1465
|
+
name: "settings.section",
|
|
1466
|
+
id: "pet",
|
|
1467
|
+
order: 130,
|
|
1468
|
+
label: () => ctx.locale.bind("pet")("settings.title"),
|
|
1450
1469
|
locale: "pet",
|
|
1451
1470
|
inject: () => petSettings.inject()
|
|
1452
|
-
},
|
|
1471
|
+
}, PetSettingsSection));
|
|
1453
1472
|
let disposeUi;
|
|
1454
1473
|
const syncUi = () => {
|
|
1455
1474
|
if (enabled() && disposeUi === void 0) {
|