@linxin666/dsh-liangshen 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.
- package/lib/client.js +326 -138
- package/lib/client.js.map +1 -1
- package/lib/types/client/PluginSettingsCard.d.ts +69 -22
- package/lib/types/client/RangeBubble.d.ts +46 -0
- package/lib/types/client/SegmentGroup.d.ts +28 -0
- package/lib/types/client/locales.d.ts +0 -4
- package/lib/types/client/plugin-card-seat.d.ts +2 -0
- package/lib/types/client/settings-form.d.ts +73 -51
- package/package.json +1 -1
- package/src/client/LiangShenSettingsCard.tsx +1 -0
- package/src/client/PluginSettingsCard.tsx +226 -93
- package/src/client/RangeBubble.tsx +164 -0
- package/src/client/SegmentGroup.tsx +93 -0
- package/src/client/locales.ts +36 -44
- package/src/client/plugin-card-seat.ts +6 -0
- package/src/client/settings-card.module.css +341 -94
- package/src/client/settings-form.ts +102 -60
package/lib/client.js
CHANGED
|
@@ -639,7 +639,7 @@ window.__ModuleLoader__.load({
|
|
|
639
639
|
}
|
|
640
640
|
//#endregion
|
|
641
641
|
//#region \0dsh-css:packages/dsh-liangshen/src/client/settings-card.module.css.mjs
|
|
642
|
-
const css = "._9t79wq_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}._9t79wq_card:hover{border-color:var(--dsw-alias-label-dimmed)}._9t79wq_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_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}._9t79wq_cardNested ._9t79wq_description{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._9t79wq_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}._9t79wq_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}._9t79wq_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}._9t79wq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._9t79wq_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}._9t79wq_header:hover ._9t79wq_mark,._9t79wq_cardOpen ._9t79wq_mark{color:var(--dsw-alias-label-primary)}._9t79wq_name{color:var(--dsw-alias-label-primary);font-size:var(--settings-card-title-size);font-weight:600;line-height:1.4}._9t79wq_description{color:var(--dsw-alias-label-secondary);font-size:var(--settings-card-description-size);line-height:1.5}._9t79wq_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}._9t79wq_headerAction{flex:none;align-items:center;display:inline-flex}._9t79wq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;width:16px;height:16px;transition:transform .16s,color .16s}._9t79wq_header:hover ._9t79wq_chevron{color:var(--dsw-alias-label-secondary)}._9t79wq_chevronOpen{transform:rotate(180deg)}._9t79wq_disclosure{opacity:0;transition:grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;grid-template-rows:0fr;display:grid}._9t79wq_disclosure[data-state=collapsed],._9t79wq_disclosure[data-state=entering],._9t79wq_disclosure[data-state=closing]{overflow:hidden}._9t79wq_disclosure[data-state=entering],._9t79wq_disclosure[data-state=shown]{opacity:1;grid-template-rows:1fr}._9t79wq_disclosure>._9t79wq_body{min-height:0}._9t79wq_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 var(--settings-card-body-inset);padding-bottom:8px}._9t79wq_readOnly{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_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}._9t79wq_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}._9t79wq_discard,._9t79wq_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}._9t79wq_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}._9t79wq_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}._9t79wq_discard:disabled,._9t79wq_save:disabled{opacity:.4;cursor:default}._9t79wq_discard:focus-visible,._9t79wq_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._9t79wq_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}._9t79wq_field+._9t79wq_field{border-top:1px solid var(--dsw-alias-border-l2)}._9t79wq_head{align-items:center;gap:8px;display:flex}._9t79wq_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}._9t79wq_badges{align-items:center;gap:8px;display:inline-flex}._9t79wq_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}._9t79wq_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}._9t79wq_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}._9t79wq_reset:disabled{cursor:default}._9t79wq_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}._9t79wq_input,._9t79wq_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}._9t79wq_input:focus-visible,._9t79wq_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}._9t79wq_input:disabled,._9t79wq_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}._9t79wq_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}._9t79wq_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)}._9t79wq_selectWrap{position:relative}._9t79wq_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}._9t79wq_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._9t79wq_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._9t79wq_selectChevronOpen{transform:rotate(180deg)}._9t79wq_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)}._9t79wq_selectPopupOpen{opacity:1;transform:none}._9t79wq_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}._9t79wq_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}._9t79wq_selectOption:hover,._9t79wq_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}._9t79wq_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}._9t79wq_invalid{color:var(--dsw-alias-state-error-primary,#b42318);margin:0;font-size:12px;line-height:1.5}._9t79wq_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:1.5}._9t79wq_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}._9t79wq_toggleTrack{background:var(--dsw-alias-label-dimmed);border-radius:999px;flex:none;width:30px;height:16px;transition:background .18s;position:relative}._9t79wq_toggleThumb{background:var(--dsw-alias-bg-layer-3);border-radius:50%;width:12px;height:12px;transition:left .18s;position:absolute;top:2px;left:2px}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleTrack{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-label-primary))}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleThumb{background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-3));left:16px}._9t79wq_toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_toggle:disabled{opacity:.45;cursor:default}@media (prefers-reduced-motion:reduce){._9t79wq_card,._9t79wq_header,._9t79wq_mark,._9t79wq_chevron,._9t79wq_chevronOpen,._9t79wq_discard,._9t79wq_save,._9t79wq_selectChevron,._9t79wq_selectChevronOpen,._9t79wq_selectPopup,._9t79wq_toggleTrack,._9t79wq_toggleThumb{transition:none}._9t79wq_disclosure{transition-property:opacity}}";
|
|
642
|
+
const css = "._9t79wq_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}._9t79wq_card:hover{border-color:var(--dsw-alias-label-dimmed)}._9t79wq_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_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}._9t79wq_cardNested ._9t79wq_description{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._9t79wq_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}._9t79wq_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}._9t79wq_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}._9t79wq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._9t79wq_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}._9t79wq_header:hover ._9t79wq_mark,._9t79wq_cardOpen ._9t79wq_mark{color:var(--dsw-alias-label-primary)}._9t79wq_name{color:var(--dsw-alias-label-primary);font-size:var(--settings-card-title-size);font-weight:600;line-height:1.4}._9t79wq_description{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._9t79wq_headerAction{flex:none;align-items:center;display:inline-flex}._9t79wq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;width:16px;height:16px;transition:transform .16s,color .16s}._9t79wq_header:hover ._9t79wq_chevron{color:var(--dsw-alias-label-secondary)}._9t79wq_chevronOpen{transform:rotate(180deg)}._9t79wq_disclosure{opacity:0;transition:grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;grid-template-rows:0fr;display:grid}._9t79wq_disclosure[data-state=collapsed],._9t79wq_disclosure[data-state=entering],._9t79wq_disclosure[data-state=closing]{overflow:hidden}._9t79wq_disclosure[data-state=entering],._9t79wq_disclosure[data-state=shown]{opacity:1;grid-template-rows:1fr}._9t79wq_disclosure>._9t79wq_body{min-height:0}._9t79wq_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 var(--settings-card-body-inset);padding-bottom:8px;container:_9t79wq_settings-card/inline-size}._9t79wq_readOnly{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_failed{color:var(--dsw-alias-state-error-primary,#b42318);overflow-wrap:anywhere;margin:8px 0 4px;font-size:12px;line-height:18px}._9t79wq_field{grid-template-columns:minmax(0,1fr) fit-content(50%);grid-template-areas:\"_9t79wq_head _9t79wq_control\"\"_9t79wq_hint _9t79wq_control\";align-items:center;gap:4px 24px;padding:16px 0;display:grid}._9t79wq_field>._9t79wq_head{grid-area:_9t79wq_head}._9t79wq_field>:is(._9t79wq_hint,._9t79wq_invalid){grid-area:_9t79wq_hint}._9t79wq_field>:not(._9t79wq_head,._9t79wq_hint,._9t79wq_invalid){grid-area:_9t79wq_control;justify-self:end;max-width:100%}._9t79wq_field+._9t79wq_field{border-top:1px solid var(--dsw-alias-border-l2)}._9t79wq_head{align-items:center;gap:8px;display:flex}._9t79wq_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:14px;font-weight:400;line-height:22px}._9t79wq_badges{align-items:center;gap:8px;display:inline-flex}._9t79wq_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}._9t79wq_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}._9t79wq_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}._9t79wq_reset:disabled{cursor:default}._9t79wq_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_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}._9t79wq_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}._9t79wq_segment:hover:not(:disabled):not([data-active]){color:var(--dsw-alias-label-primary)}._9t79wq_segmentGroup:not([data-pill])>._9t79wq_segment[data-active],._9t79wq_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] ._9t79wq_segmentGroup:not([data-pill])>._9t79wq_segment[data-active],body[data-ds-dark-theme] ._9t79wq_segmentGroup[data-pill]:before{box-shadow:none;background:#ffffff24}._9t79wq_segment[data-active]{color:var(--dsw-alias-label-primary)}._9t79wq_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}._9t79wq_segmentGroup>*{z-index:1;position:relative}._9t79wq_segment:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._9t79wq_segment:disabled{cursor:not-allowed;opacity:.45}._9t79wq_segmentGroup[data-pill]:has(>._9t79wq_segment:disabled):before{opacity:.45}._9t79wq_input,._9t79wq_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}._9t79wq_input:focus-visible,._9t79wq_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}._9t79wq_input:disabled,._9t79wq_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}._9t79wq_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}._9t79wq_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)}._9t79wq_field>:is(._9t79wq_input,._9t79wq_inputInvalid,._9t79wq_select,._9t79wq_selectWrap,._9t79wq_rangeAnchor){box-sizing:border-box;width:220px}._9t79wq_rangeAnchor>:is(._9t79wq_input,._9t79wq_inputInvalid){box-sizing:border-box;width:100%}@container _9t79wq_settings-card (width<=440px){._9t79wq_field{grid-template-columns:minmax(0,1fr);grid-template-areas:\"_9t79wq_head\"\"_9t79wq_hint\"\"_9t79wq_control\";row-gap:8px}._9t79wq_field>:not(._9t79wq_head,._9t79wq_hint,._9t79wq_invalid){justify-self:start}._9t79wq_field>:is(._9t79wq_input,._9t79wq_inputInvalid,._9t79wq_select,._9t79wq_selectWrap,._9t79wq_rangeAnchor){justify-self:stretch;width:auto}}._9t79wq_selectWrap{position:relative}._9t79wq_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}._9t79wq_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._9t79wq_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._9t79wq_selectChevronOpen{transform:rotate(180deg)}._9t79wq_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)}._9t79wq_selectPopupOpen{opacity:1;transform:none}._9t79wq_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}._9t79wq_rangeAnchor{display:inline-flex;position:relative}._9t79wq_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}._9t79wq_rangeBubble[data-side=above]{bottom:calc(100% + 6px);transform:translateY(4px)}._9t79wq_rangeBubble[data-side=below]{top:calc(100% + 6px);transform:translateY(-4px)}._9t79wq_rangeBubble[data-open]{opacity:1;visibility:visible;transition:opacity .12s,transform .12s,visibility;transform:none}._9t79wq_rangeSlider{appearance:none;cursor:pointer;background:0 0;width:100%;height:18px;margin:0;display:block}._9t79wq_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}._9t79wq_rangeSlider::-moz-range-track{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent);border-radius:999px;height:4px}._9t79wq_rangeSlider::-moz-range-progress{background:var(--dsw-alias-brand-primary);border-radius:999px;height:4px}._9t79wq_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}._9t79wq_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}._9t79wq_rangeSlider:active::-webkit-slider-thumb{transform:scale(1.15)}._9t79wq_rangeSlider:focus-visible{outline:none}._9t79wq_rangeSlider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 2px var(--dsw-alias-brand-primary)}._9t79wq_rangeSlider:disabled{cursor:not-allowed}._9t79wq_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}._9t79wq_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}._9t79wq_selectOption:hover,._9t79wq_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}._9t79wq_selectOptionSelected{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary) 10%, transparent);font-weight:500}._9t79wq_invalid{color:var(--dsw-alias-state-error-primary,#b42318);margin:0;font-size:12px;line-height:18px}._9t79wq_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:18px}._9t79wq_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}._9t79wq_toggleTrack{background:var(--dsw-alias-label-dimmed);border-radius:999px;flex:none;width:36px;height:20px;transition:background-color .18s;position:relative}._9t79wq_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}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleTrack{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-label-primary))}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleThumb{translate:var(--toggle-travel) 0;background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-3))}._9t79wq_toggle[data-moved][aria-checked=true] ._9t79wq_toggleThumb{animation:.35s cubic-bezier(.34,1.45,.64,1) both _9t79wq_toggle-on}._9t79wq_toggle[data-moved][aria-checked=false] ._9t79wq_toggleThumb{animation:.35s cubic-bezier(.34,1.45,.64,1) both _9t79wq_toggle-off}@keyframes _9t79wq_toggle-on{0%{translate:0}55%{translate:calc(var(--toggle-travel) + var(--toggle-overshoot)) 0}80%,to{translate:var(--toggle-travel) 0}}@keyframes _9t79wq_toggle-off{0%{translate:var(--toggle-travel) 0}55%{translate:calc(0px - var(--toggle-overshoot)) 0}80%,to{translate:0}}._9t79wq_toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_toggle:disabled{opacity:.45;cursor:not-allowed}@media (prefers-reduced-motion:reduce){._9t79wq_card,._9t79wq_header,._9t79wq_mark,._9t79wq_chevron,._9t79wq_chevronOpen,._9t79wq_rangeBubble,._9t79wq_selectChevron,._9t79wq_selectChevronOpen,._9t79wq_selectPopup,._9t79wq_toggleTrack,._9t79wq_toggleThumb{transition:none}._9t79wq_toggle[data-moved] ._9t79wq_toggleThumb{animation:none}._9t79wq_disclosure{transition-property:opacity}}";
|
|
643
643
|
const tagId = "@linxin666/dsh-liangshen/packages/dsh-liangshen/src/client/settings-card.module.css";
|
|
644
644
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
645
645
|
const tag = document.createElement("style");
|
|
@@ -657,12 +657,11 @@ window.__ModuleLoader__.load({
|
|
|
657
657
|
"cardOpen": "_9t79wq_cardOpen",
|
|
658
658
|
"chevron": "_9t79wq_chevron",
|
|
659
659
|
"chevronOpen": "_9t79wq_chevronOpen",
|
|
660
|
+
"control": "_9t79wq_control",
|
|
660
661
|
"description": "_9t79wq_description",
|
|
661
|
-
"discard": "_9t79wq_discard",
|
|
662
662
|
"disclosure": "_9t79wq_disclosure",
|
|
663
663
|
"failed": "_9t79wq_failed",
|
|
664
664
|
"field": "_9t79wq_field",
|
|
665
|
-
"footer": "_9t79wq_footer",
|
|
666
665
|
"head": "_9t79wq_head",
|
|
667
666
|
"headText": "_9t79wq_headText",
|
|
668
667
|
"header": "_9t79wq_header",
|
|
@@ -676,10 +675,14 @@ window.__ModuleLoader__.load({
|
|
|
676
675
|
"mark": "_9t79wq_mark",
|
|
677
676
|
"name": "_9t79wq_name",
|
|
678
677
|
"notExposed": "_9t79wq_notExposed",
|
|
679
|
-
"
|
|
678
|
+
"rangeAnchor": "_9t79wq_rangeAnchor",
|
|
679
|
+
"rangeBubble": "_9t79wq_rangeBubble",
|
|
680
|
+
"rangeEnds": "_9t79wq_rangeEnds",
|
|
681
|
+
"rangeSlider": "_9t79wq_rangeSlider",
|
|
680
682
|
"readOnly": "_9t79wq_readOnly",
|
|
681
683
|
"reset": "_9t79wq_reset",
|
|
682
|
-
"
|
|
684
|
+
"segment": "_9t79wq_segment",
|
|
685
|
+
"segmentGroup": "_9t79wq_segmentGroup",
|
|
683
686
|
"select": "_9t79wq_select",
|
|
684
687
|
"selectButton": "_9t79wq_selectButton",
|
|
685
688
|
"selectChevron": "_9t79wq_selectChevron",
|
|
@@ -692,20 +695,141 @@ window.__ModuleLoader__.load({
|
|
|
692
695
|
"selectPopupClose": "_9t79wq_selectPopupClose",
|
|
693
696
|
"selectPopupOpen": "_9t79wq_selectPopupOpen",
|
|
694
697
|
"selectWrap": "_9t79wq_selectWrap",
|
|
698
|
+
"settings-card": "_9t79wq_settings-card",
|
|
695
699
|
"toggle": "_9t79wq_toggle",
|
|
700
|
+
"toggle-off": "_9t79wq_toggle-off",
|
|
701
|
+
"toggle-on": "_9t79wq_toggle-on",
|
|
696
702
|
"toggleThumb": "_9t79wq_toggleThumb",
|
|
697
703
|
"toggleTrack": "_9t79wq_toggleTrack"
|
|
698
704
|
};
|
|
699
705
|
//#endregion
|
|
706
|
+
//#region src/client/RangeBubble.tsx
|
|
707
|
+
/**
|
|
708
|
+
* Coarse adjustment for a bounded number: resting the pointer on the control
|
|
709
|
+
* (or moving focus into it) raises a small bubble holding a slider across the
|
|
710
|
+
* field's whole range, so a large change is one drag instead of many presses
|
|
711
|
+
* or a retyped value. The control itself stays the precise entry.
|
|
712
|
+
*
|
|
713
|
+
* The bubble belongs to the anchor's subtree, so moving from the control onto
|
|
714
|
+
* the bubble never counts as leaving. It opens after a short rest and closes a
|
|
715
|
+
* moment after the pointer and focus have both gone, so crossing the control
|
|
716
|
+
* on the way elsewhere does not flash it. While a drag is in progress the
|
|
717
|
+
* bubble stays put even if the pointer strays off it.
|
|
718
|
+
*
|
|
719
|
+
* Dragging reports each value through `onInput`, so the field shows it live;
|
|
720
|
+
* releasing the thumb, or a key press on it, reports `onCommit` once. The
|
|
721
|
+
* bubble opens on the side of the control that has room inside the nearest
|
|
722
|
+
* scrolling ancestor, so a row near the top of a settings page does not hang
|
|
723
|
+
* its bubble under the page edge.
|
|
724
|
+
*/
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/client/SegmentGroup.tsx
|
|
727
|
+
/**
|
|
728
|
+
* The family's segmented control: a quiet track whose options share one
|
|
729
|
+
* highlight that slides to the pressed option, instead of each option fading
|
|
730
|
+
* its own background out and the next one in. The settings fields' small
|
|
731
|
+
* choices and the Web Extensions TAB strip both render through it, so the two
|
|
732
|
+
* read as one control.
|
|
733
|
+
*
|
|
734
|
+
* The caller builds the option buttons and marks the pressed one with
|
|
735
|
+
* `data-active`; the group measures that button after every render and writes
|
|
736
|
+
* its box as four custom properties, and the stylesheet draws the highlight
|
|
737
|
+
* there (`.segmentGroup[data-pill]::before`). Attribute and first placement
|
|
738
|
+
* land in the same task, so the highlight appears in place and only later
|
|
739
|
+
* changes slide. A ResizeObserver re-measures when the group or an option
|
|
740
|
+
* changes size: a longer locale, a font arriving, a container growing, a
|
|
741
|
+
* strip wrapping onto a second line.
|
|
742
|
+
*/
|
|
743
|
+
/** The attribute marking a group whose highlight has been placed. */
|
|
744
|
+
const PILL_ATTR = "data-pill";
|
|
745
|
+
/** The pressed option, relative to the group. */
|
|
746
|
+
const ACTIVE_SELECTOR = ":scope > [data-active]";
|
|
747
|
+
const PILL_PROPERTIES = [
|
|
748
|
+
"--segment-pill-x",
|
|
749
|
+
"--segment-pill-y",
|
|
750
|
+
"--segment-pill-w",
|
|
751
|
+
"--segment-pill-h"
|
|
752
|
+
];
|
|
753
|
+
/**
|
|
754
|
+
* Write the highlight's box from the pressed option's box, or take the
|
|
755
|
+
* highlight off when nothing is pressed or the group has no layout yet.
|
|
756
|
+
* The two boxes are read in viewport pixels and turned back into the group's
|
|
757
|
+
* own CSS pixels, so a dialog that opens through a scale transform still
|
|
758
|
+
* lands the highlight on its option.
|
|
759
|
+
*/
|
|
760
|
+
function placePill(group) {
|
|
761
|
+
const item = group.querySelector(ACTIVE_SELECTOR);
|
|
762
|
+
const box = group.getBoundingClientRect();
|
|
763
|
+
if (item === null || group.offsetWidth === 0 || box.width === 0) {
|
|
764
|
+
group.removeAttribute(PILL_ATTR);
|
|
765
|
+
for (const property of PILL_PROPERTIES) group.style.removeProperty(property);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
const scale = box.width / group.offsetWidth;
|
|
769
|
+
const itemBox = item.getBoundingClientRect();
|
|
770
|
+
[
|
|
771
|
+
(itemBox.left - box.left) / scale - group.clientLeft,
|
|
772
|
+
(itemBox.top - box.top) / scale - group.clientTop,
|
|
773
|
+
itemBox.width / scale,
|
|
774
|
+
itemBox.height / scale
|
|
775
|
+
].forEach((value, index) => {
|
|
776
|
+
group.style.setProperty(PILL_PROPERTIES[index], `${Math.round(value * 100) / 100}px`);
|
|
777
|
+
});
|
|
778
|
+
if (!group.hasAttribute(PILL_ATTR)) group.setAttribute(PILL_ATTR, "");
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Render a segmented track around the caller's option buttons.
|
|
782
|
+
* @param props - the track's attributes (role, accessible name, key handler) and its options.
|
|
783
|
+
* @returns the track.
|
|
784
|
+
*/
|
|
785
|
+
function SegmentGroup(props) {
|
|
786
|
+
const { children, className, ...rest } = props;
|
|
787
|
+
const group = (0, react.useRef)(null);
|
|
788
|
+
const count = react.Children.count(children);
|
|
789
|
+
(0, react.useLayoutEffect)(() => {
|
|
790
|
+
if (group.current !== null) placePill(group.current);
|
|
791
|
+
});
|
|
792
|
+
(0, react.useLayoutEffect)(() => {
|
|
793
|
+
const element = group.current;
|
|
794
|
+
if (element === null || typeof ResizeObserver === "undefined") return void 0;
|
|
795
|
+
const observer = new ResizeObserver(() => {
|
|
796
|
+
placePill(element);
|
|
797
|
+
});
|
|
798
|
+
observer.observe(element);
|
|
799
|
+
for (const item of Array.from(element.children)) observer.observe(item);
|
|
800
|
+
return () => {
|
|
801
|
+
observer.disconnect();
|
|
802
|
+
};
|
|
803
|
+
}, [count]);
|
|
804
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
805
|
+
...rest,
|
|
806
|
+
ref: group,
|
|
807
|
+
className: className === void 0 ? settings_card_module_css_default.segmentGroup : `${settings_card_module_css_default.segmentGroup} ${className}`,
|
|
808
|
+
children
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
//#endregion
|
|
700
812
|
//#region src/client/PluginSettingsCard.tsx
|
|
701
813
|
/**
|
|
702
814
|
* Family-shared chrome for plugin settings cards: a disclosure header naming
|
|
703
|
-
* the plugin and what its settings govern, the controls inside, and the
|
|
704
|
-
* that
|
|
815
|
+
* the plugin and what its settings govern, the controls inside, and the line
|
|
816
|
+
* that reports a refused write. A pick is written the moment it is made and a
|
|
817
|
+
* typed value after a pause, so the card has no save button and nothing waits
|
|
818
|
+
* on the reader. Renders nothing while the namespace is unavailable — a
|
|
705
819
|
* deployment that does not compose the owning plugin should show no trace of
|
|
706
820
|
* it. Inlined into each consumer's client bundle; mirrors the official
|
|
707
821
|
* ui-plugin-config PluginCard in a self-contained slice.
|
|
822
|
+
*
|
|
823
|
+
* Every field inside the body is one settings row: the label and its hint on
|
|
824
|
+
* the left, the control on the right, a hairline between two rows; a narrow
|
|
825
|
+
* card stacks the control under the text (settings-card.module.css).
|
|
826
|
+
*/
|
|
827
|
+
/**
|
|
828
|
+
* What a text field inside a card reaches without its plugin wiring it: write
|
|
829
|
+
* the pending draft now (Enter, leaving the field) or put it back (Escape).
|
|
830
|
+
* Picks need neither; they are written the moment they are made.
|
|
708
831
|
*/
|
|
832
|
+
const CardApply = (0, react.createContext)(null);
|
|
709
833
|
/** Length of the body's disclosure motion; it matches `--settings-card-motion` on the card root. */
|
|
710
834
|
const BODY_MOTION_MS = 180;
|
|
711
835
|
/**
|
|
@@ -745,7 +869,6 @@ window.__ModuleLoader__.load({
|
|
|
745
869
|
const title = props.t(props.titleKey);
|
|
746
870
|
const description = props.t(props.descriptionKey);
|
|
747
871
|
const descriptionTitle = props.descriptionTitleKey === void 0 ? description : props.t(props.descriptionTitleKey);
|
|
748
|
-
const blocked = !state.dirty || state.invalid || state.saving;
|
|
749
872
|
const baseClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
|
|
750
873
|
const cardClass = props.density === "nested" ? `${baseClass} ${settings_card_module_css_default.cardNested}` : baseClass;
|
|
751
874
|
/** The body region both legs share; a hidden phase renders nothing at all. */
|
|
@@ -782,11 +905,6 @@ window.__ModuleLoader__.load({
|
|
|
782
905
|
props.headerAction !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
783
906
|
className: settings_card_module_css_default.headerAction,
|
|
784
907
|
children: props.headerAction
|
|
785
|
-
}) : null,
|
|
786
|
-
state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
787
|
-
className: settings_card_module_css_default.pending,
|
|
788
|
-
title: props.t("settings.unsaved"),
|
|
789
|
-
children: props.t("settings.unsaved")
|
|
790
908
|
}) : null
|
|
791
909
|
]
|
|
792
910
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
@@ -820,11 +938,6 @@ window.__ModuleLoader__.load({
|
|
|
820
938
|
className: settings_card_module_css_default.headerAction,
|
|
821
939
|
children: props.headerAction
|
|
822
940
|
}) : null,
|
|
823
|
-
state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
824
|
-
className: settings_card_module_css_default.pending,
|
|
825
|
-
title: props.t("settings.unsaved"),
|
|
826
|
-
children: props.t("settings.unsaved")
|
|
827
|
-
}) : null,
|
|
828
941
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
829
942
|
width: "14",
|
|
830
943
|
height: "14",
|
|
@@ -855,31 +968,18 @@ window.__ModuleLoader__.load({
|
|
|
855
968
|
role: "status",
|
|
856
969
|
children: props.t("settings.readOnly")
|
|
857
970
|
}) : null,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
disabled: !state.dirty || state.saving,
|
|
871
|
-
onClick: props.onDiscard,
|
|
872
|
-
children: props.t("settings.discard")
|
|
873
|
-
}),
|
|
874
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
875
|
-
type: "button",
|
|
876
|
-
className: settings_card_module_css_default.save,
|
|
877
|
-
disabled: blocked,
|
|
878
|
-
onClick: props.onSave,
|
|
879
|
-
children: props.t(!state.saving ? "settings.save" : "settings.saving")
|
|
880
|
-
})
|
|
881
|
-
]
|
|
882
|
-
})
|
|
971
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardApply.Provider, {
|
|
972
|
+
value: {
|
|
973
|
+
commit: props.onSave,
|
|
974
|
+
revert: props.onDiscard
|
|
975
|
+
},
|
|
976
|
+
children: props.children
|
|
977
|
+
}),
|
|
978
|
+
props.hideFooter !== true && state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
979
|
+
className: settings_card_module_css_default.failed,
|
|
980
|
+
role: "status",
|
|
981
|
+
children: [props.t("settings.saveFailed"), state.failedReason ? " - " + state.failedReason : ""]
|
|
982
|
+
}) : null
|
|
883
983
|
] })) : null]
|
|
884
984
|
});
|
|
885
985
|
}
|
|
@@ -893,8 +993,8 @@ window.__ModuleLoader__.load({
|
|
|
893
993
|
* renders the legacy native `<select>` untouched, so element-level skin
|
|
894
994
|
* selectors keep working; under the default appearance it renders a
|
|
895
995
|
* self-drawn `role="listbox"` popup whose open/close is transition-animated.
|
|
896
|
-
*
|
|
897
|
-
*
|
|
996
|
+
* Cards reach it through BooleanField/ChoiceField; editors outside a card
|
|
997
|
+
* (the side-card prefs) bind it directly through onEdit.
|
|
898
998
|
* 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。
|
|
899
999
|
*/
|
|
900
1000
|
function SelectField(props) {
|
|
@@ -1052,14 +1152,48 @@ window.__ModuleLoader__.load({
|
|
|
1052
1152
|
}) : null]
|
|
1053
1153
|
});
|
|
1054
1154
|
}
|
|
1055
|
-
/**
|
|
1155
|
+
/**
|
|
1156
|
+
* A visible segmented group for a small set of mutually exclusive values.
|
|
1157
|
+
* Every option stays on screen, so inherit/on/off and short enum fields take
|
|
1158
|
+
* one click without opening a popup. The pressed option carries the group's
|
|
1159
|
+
* sliding highlight and `aria-pressed`; the group takes the field label as its
|
|
1160
|
+
* accessible name.
|
|
1161
|
+
*/
|
|
1162
|
+
function SegmentField(props) {
|
|
1163
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentGroup, {
|
|
1164
|
+
id: props.id,
|
|
1165
|
+
role: "group",
|
|
1166
|
+
"aria-label": props.label,
|
|
1167
|
+
"aria-invalid": props.invalid || void 0,
|
|
1168
|
+
children: props.options.map((option, index) => {
|
|
1169
|
+
const active = option.value === props.value;
|
|
1170
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1171
|
+
type: "button",
|
|
1172
|
+
className: settings_card_module_css_default.segment,
|
|
1173
|
+
"aria-pressed": active,
|
|
1174
|
+
disabled: props.disabled,
|
|
1175
|
+
"data-active": active ? "" : void 0,
|
|
1176
|
+
"data-segment-index": index,
|
|
1177
|
+
onClick: () => {
|
|
1178
|
+
if (!active) props.onEdit(option.value);
|
|
1179
|
+
},
|
|
1180
|
+
children: option.label
|
|
1181
|
+
}, option.value);
|
|
1182
|
+
})
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
/** A boolean field: 继承 / 开 / 关. */
|
|
1056
1186
|
function BooleanField(props) {
|
|
1187
|
+
const segmented = props.presentation !== "select";
|
|
1057
1188
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1058
1189
|
className: settings_card_module_css_default.field,
|
|
1059
1190
|
children: [
|
|
1060
1191
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1061
1192
|
className: settings_card_module_css_default.head,
|
|
1062
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
1193
|
+
children: [segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1194
|
+
className: settings_card_module_css_default.label,
|
|
1195
|
+
children: props.label
|
|
1196
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1063
1197
|
className: settings_card_module_css_default.label,
|
|
1064
1198
|
htmlFor: props.id,
|
|
1065
1199
|
children: props.label
|
|
@@ -1077,7 +1211,28 @@ window.__ModuleLoader__.load({
|
|
|
1077
1211
|
})]
|
|
1078
1212
|
}) : null]
|
|
1079
1213
|
}),
|
|
1080
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1214
|
+
segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentField, {
|
|
1215
|
+
id: props.id,
|
|
1216
|
+
label: props.label,
|
|
1217
|
+
options: [
|
|
1218
|
+
{
|
|
1219
|
+
value: "",
|
|
1220
|
+
label: props.inheritLabel
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
value: "true",
|
|
1224
|
+
label: props.onLabel
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
value: "false",
|
|
1228
|
+
label: props.offLabel
|
|
1229
|
+
}
|
|
1230
|
+
],
|
|
1231
|
+
value: props.text,
|
|
1232
|
+
disabled: props.disabled,
|
|
1233
|
+
invalid: props.invalid,
|
|
1234
|
+
onEdit: props.onEdit
|
|
1235
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
|
|
1081
1236
|
id: props.id,
|
|
1082
1237
|
options: [
|
|
1083
1238
|
{
|
|
@@ -1106,14 +1261,22 @@ window.__ModuleLoader__.load({
|
|
|
1106
1261
|
]
|
|
1107
1262
|
});
|
|
1108
1263
|
}
|
|
1109
|
-
/**
|
|
1264
|
+
/** An enumerated field, selecting or segmenting its small choice set. */
|
|
1110
1265
|
function ChoiceField(props) {
|
|
1266
|
+
const segmented = props.presentation === "segment";
|
|
1267
|
+
const options = [{
|
|
1268
|
+
value: "",
|
|
1269
|
+
label: props.inheritLabel
|
|
1270
|
+
}, ...props.choices];
|
|
1111
1271
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1112
1272
|
className: settings_card_module_css_default.field,
|
|
1113
1273
|
children: [
|
|
1114
1274
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1115
1275
|
className: settings_card_module_css_default.head,
|
|
1116
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
1276
|
+
children: [segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1277
|
+
className: settings_card_module_css_default.label,
|
|
1278
|
+
children: props.label
|
|
1279
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1117
1280
|
className: settings_card_module_css_default.label,
|
|
1118
1281
|
htmlFor: props.id,
|
|
1119
1282
|
children: props.label
|
|
@@ -1131,12 +1294,17 @@ window.__ModuleLoader__.load({
|
|
|
1131
1294
|
})]
|
|
1132
1295
|
}) : null]
|
|
1133
1296
|
}),
|
|
1134
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1297
|
+
segmented ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentField, {
|
|
1298
|
+
id: props.id,
|
|
1299
|
+
label: props.label,
|
|
1300
|
+
options,
|
|
1301
|
+
value: props.text,
|
|
1302
|
+
disabled: props.disabled,
|
|
1303
|
+
invalid: props.invalid,
|
|
1304
|
+
onEdit: props.onEdit
|
|
1305
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
|
|
1135
1306
|
id: props.id,
|
|
1136
|
-
options
|
|
1137
|
-
value: "",
|
|
1138
|
-
label: props.inheritLabel
|
|
1139
|
-
}, ...props.choices],
|
|
1307
|
+
options,
|
|
1140
1308
|
value: props.text,
|
|
1141
1309
|
disabled: props.disabled,
|
|
1142
1310
|
invalid: props.invalid,
|
|
@@ -1150,12 +1318,11 @@ window.__ModuleLoader__.load({
|
|
|
1150
1318
|
]
|
|
1151
1319
|
});
|
|
1152
1320
|
}
|
|
1153
|
-
//#endregion
|
|
1154
|
-
//#region src/client/settings-form.ts
|
|
1155
1321
|
/** A boolean field, edited through true/false draft text. */
|
|
1156
1322
|
function booleanField(field) {
|
|
1157
1323
|
return {
|
|
1158
1324
|
field,
|
|
1325
|
+
entry: "pick",
|
|
1159
1326
|
format: (value) => typeof value === "boolean" ? String(value) : "",
|
|
1160
1327
|
parse: (text) => {
|
|
1161
1328
|
const trimmed = text.trim();
|
|
@@ -1175,6 +1342,7 @@ window.__ModuleLoader__.load({
|
|
|
1175
1342
|
function choiceField(field, choices) {
|
|
1176
1343
|
return {
|
|
1177
1344
|
field,
|
|
1345
|
+
entry: "pick",
|
|
1178
1346
|
format: (value) => typeof value === "string" && choices.includes(value) ? value : "",
|
|
1179
1347
|
parse: (text) => {
|
|
1180
1348
|
if (text === "") return { kind: "clear" };
|
|
@@ -1186,12 +1354,14 @@ window.__ModuleLoader__.load({
|
|
|
1186
1354
|
};
|
|
1187
1355
|
}
|
|
1188
1356
|
/**
|
|
1189
|
-
*
|
|
1357
|
+
* Applies one card's edits to one settings namespace as the reader makes them.
|
|
1190
1358
|
*
|
|
1191
1359
|
* The Host is the only authority on whether a value was accepted — its
|
|
1192
1360
|
* validators own the constraints no schema can express — so the outcome is
|
|
1193
|
-
* read back from the section rather than predicted here. A
|
|
1194
|
-
* land
|
|
1361
|
+
* read back from the section rather than predicted here. A write that did not
|
|
1362
|
+
* land puts each pick back to the stored value, the way a switch that could not
|
|
1363
|
+
* flip springs back, and keeps typed text so the reader can correct it instead
|
|
1364
|
+
* of retyping.
|
|
1195
1365
|
*/
|
|
1196
1366
|
var CardForm = class {
|
|
1197
1367
|
scope;
|
|
@@ -1201,6 +1371,8 @@ window.__ModuleLoader__.load({
|
|
|
1201
1371
|
/** The form subscription installed in the constructor; released by dispose(). */
|
|
1202
1372
|
disposeForm;
|
|
1203
1373
|
disposed = false;
|
|
1374
|
+
/** The pending write of typed text, waiting for typing to pause. */
|
|
1375
|
+
typePause;
|
|
1204
1376
|
saving = false;
|
|
1205
1377
|
/** A save asked for while one was in flight; it runs once the first settles (#1754). */
|
|
1206
1378
|
saveQueued = false;
|
|
@@ -1221,6 +1393,7 @@ window.__ModuleLoader__.load({
|
|
|
1221
1393
|
dispose() {
|
|
1222
1394
|
if (this.disposed) return;
|
|
1223
1395
|
this.disposed = true;
|
|
1396
|
+
clearTimeout(this.typePause);
|
|
1224
1397
|
this.disposeForm();
|
|
1225
1398
|
this.listeners.clear();
|
|
1226
1399
|
}
|
|
@@ -1232,7 +1405,7 @@ window.__ModuleLoader__.load({
|
|
|
1232
1405
|
});
|
|
1233
1406
|
return store;
|
|
1234
1407
|
}
|
|
1235
|
-
/** Read the card-level state: what the Host serves, and what
|
|
1408
|
+
/** Read the card-level state: what the Host serves, and what is still waiting to be written. */
|
|
1236
1409
|
shell() {
|
|
1237
1410
|
const snapshot = this.scope.getSnapshot();
|
|
1238
1411
|
const plan = this.plan();
|
|
@@ -1279,9 +1452,10 @@ window.__ModuleLoader__.load({
|
|
|
1279
1452
|
});
|
|
1280
1453
|
},
|
|
1281
1454
|
save: () => {
|
|
1282
|
-
this.
|
|
1455
|
+
this.applyNow();
|
|
1283
1456
|
},
|
|
1284
1457
|
discard: () => {
|
|
1458
|
+
clearTimeout(this.typePause);
|
|
1285
1459
|
if (this.staged.size === 0 && !this.failed) return;
|
|
1286
1460
|
this.staged.clear();
|
|
1287
1461
|
this.failed = false;
|
|
@@ -1291,32 +1465,14 @@ window.__ModuleLoader__.load({
|
|
|
1291
1465
|
};
|
|
1292
1466
|
}
|
|
1293
1467
|
/**
|
|
1294
|
-
*
|
|
1295
|
-
* what the Host accepted.
|
|
1296
|
-
*
|
|
1297
|
-
* The whole batch rides one mutate, so cross-field validate hooks
|
|
1298
|
-
* (baseURL+model) judge it as a unit: the Host either applies every write
|
|
1299
|
-
* or refuses the batch. The form contract answers a refusal or a skipped
|
|
1300
|
-
* write with `false` (it recovers with a fresh Host view instead of
|
|
1301
|
-
* throwing), so the outcome is judged twice: the answer itself, and then the
|
|
1302
|
-
* settled snapshot read back one planned write at a time. One missed write
|
|
1303
|
-
* fails the whole save. A transport that rejects instead (the dsh-web bridge
|
|
1304
|
-
* controller on a dead connection) reports through the same failure path
|
|
1305
|
-
* with its rejection message. A save that did not land keeps its drafts, so
|
|
1306
|
-
* the user can correct them instead of retyping.
|
|
1307
|
-
* @returns settlement after the mutation and the read-back.
|
|
1308
|
-
*/
|
|
1309
|
-
/**
|
|
1310
|
-
* Run one save, and re-run it once if another was asked for while this one
|
|
1468
|
+
* Run one write, and re-run it once if another was asked for while this one
|
|
1311
1469
|
* was still in flight.
|
|
1312
1470
|
*
|
|
1313
|
-
* A
|
|
1314
|
-
* the Host runs
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
* another is still settling runs against the settled state - which is what
|
|
1319
|
-
* the operator meant by pressing it again.
|
|
1471
|
+
* A write is a Host round trip that also drives the profile reconcile, and
|
|
1472
|
+
* the Host runs it inside one exclusive transaction. Answering an edit that
|
|
1473
|
+
* arrives mid-flight by returning immediately dropped it with no explanation
|
|
1474
|
+
* (#1754). Serializing instead means an edit made while another write is
|
|
1475
|
+
* still settling is written against the settled state.
|
|
1320
1476
|
* @returns settlement after the mutation and the read-back.
|
|
1321
1477
|
*/
|
|
1322
1478
|
async requestSave() {
|
|
@@ -1329,12 +1485,28 @@ window.__ModuleLoader__.load({
|
|
|
1329
1485
|
this.saveQueued = false;
|
|
1330
1486
|
await this.requestSave();
|
|
1331
1487
|
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Write every valid draft in one atomic form mutation, then re-seed from
|
|
1490
|
+
* what the Host accepted. A draft the field does not accept stays on screen,
|
|
1491
|
+
* unwritten, without holding the others back.
|
|
1492
|
+
*
|
|
1493
|
+
* The batch rides one mutate, so cross-field validate hooks (baseURL+model)
|
|
1494
|
+
* judge it as a unit: the Host either applies every write or refuses the
|
|
1495
|
+
* batch. The form contract answers a refusal or a skipped write with `false`
|
|
1496
|
+
* (it recovers with a fresh Host view instead of throwing), so the outcome is
|
|
1497
|
+
* judged twice: the answer itself, and then the settled snapshot read back
|
|
1498
|
+
* one planned write at a time. One missed write fails the whole batch. A
|
|
1499
|
+
* transport that rejects instead (the dsh-web bridge controller on a dead
|
|
1500
|
+
* connection) reports through the same failure path with its rejection
|
|
1501
|
+
* message. A batch that did not land puts its picks and clears back to the
|
|
1502
|
+
* stored value and keeps its typed text, so the reader can correct it.
|
|
1503
|
+
* @returns settlement after the mutation and the read-back.
|
|
1504
|
+
*/
|
|
1332
1505
|
async save() {
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
if (plan.length === 0 || this.saving || valid.length !== plan.length) return;
|
|
1506
|
+
const valid = this.plan().filter((item) => item.judge !== void 0);
|
|
1507
|
+
if (valid.length === 0 || this.saving) return;
|
|
1336
1508
|
const pending = /* @__PURE__ */ new Map();
|
|
1337
|
-
for (const item of
|
|
1509
|
+
for (const item of valid) pending.set(item.field, this.staged.get(item.field));
|
|
1338
1510
|
this.saving = true;
|
|
1339
1511
|
this.failed = false;
|
|
1340
1512
|
this.failedReason = void 0;
|
|
@@ -1355,16 +1527,19 @@ window.__ModuleLoader__.load({
|
|
|
1355
1527
|
failedReason = error instanceof Error ? error.message : String(error);
|
|
1356
1528
|
}
|
|
1357
1529
|
const landed = accepted && failedReason === void 0 && valid.every((item) => item.judge());
|
|
1358
|
-
for (const [field, before] of pending)
|
|
1530
|
+
for (const [field, before] of pending) {
|
|
1531
|
+
if (this.staged.get(field) !== before) continue;
|
|
1532
|
+
if (landed || before === void 0 || before.clear || this.specOf(field).entry === "pick") this.staged.delete(field);
|
|
1533
|
+
}
|
|
1359
1534
|
this.saving = false;
|
|
1360
1535
|
this.failed = !landed;
|
|
1361
1536
|
this.failedReason = failedReason;
|
|
1362
1537
|
this.publish();
|
|
1363
1538
|
}
|
|
1364
1539
|
/**
|
|
1365
|
-
* Every staged edit a
|
|
1366
|
-
* its field accepts carries no write: the form is still dirty, and the
|
|
1367
|
-
*
|
|
1540
|
+
* Every staged edit a write would carry. An entry whose draft is not a value
|
|
1541
|
+
* its field accepts carries no write: the form is still dirty, and the draft
|
|
1542
|
+
* stays on screen rather than being dropped. A staged edit that matches the
|
|
1368
1543
|
* effective section is not a write at all.
|
|
1369
1544
|
* @returns the planned writes, in the order the fields were staged.
|
|
1370
1545
|
*/
|
|
@@ -1428,11 +1603,30 @@ window.__ModuleLoader__.load({
|
|
|
1428
1603
|
landedUnset(field) {
|
|
1429
1604
|
return !this.stored(field);
|
|
1430
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Take one edit and schedule its write: a pick or a clear is written now,
|
|
1608
|
+
* typed text once typing has rested for TYPE_PAUSE_MS.
|
|
1609
|
+
*/
|
|
1431
1610
|
stage(field, edit) {
|
|
1432
1611
|
this.staged.set(field, edit);
|
|
1433
1612
|
this.failed = false;
|
|
1434
1613
|
this.failedReason = void 0;
|
|
1435
1614
|
this.publish();
|
|
1615
|
+
if (edit.clear || this.specOf(field).entry === "pick") {
|
|
1616
|
+
this.applyNow();
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
clearTimeout(this.typePause);
|
|
1620
|
+
this.typePause = setTimeout(() => {
|
|
1621
|
+
this.applyNow();
|
|
1622
|
+
}, 600);
|
|
1623
|
+
}
|
|
1624
|
+
/** Write every pending draft now, taking the place of a waiting pause. */
|
|
1625
|
+
applyNow() {
|
|
1626
|
+
clearTimeout(this.typePause);
|
|
1627
|
+
this.typePause = void 0;
|
|
1628
|
+
if (this.disposed) return;
|
|
1629
|
+
this.requestSave();
|
|
1436
1630
|
}
|
|
1437
1631
|
specOf(field) {
|
|
1438
1632
|
const spec = this.specs.get(field);
|
|
@@ -1566,6 +1760,7 @@ window.__ModuleLoader__.load({
|
|
|
1566
1760
|
value: choice,
|
|
1567
1761
|
label: t(`presentation.${choice}`)
|
|
1568
1762
|
})),
|
|
1763
|
+
presentation: "segment",
|
|
1569
1764
|
...fieldProps,
|
|
1570
1765
|
...state.presentation,
|
|
1571
1766
|
onEdit: (text) => {
|
|
@@ -1618,32 +1813,28 @@ window.__ModuleLoader__.load({
|
|
|
1618
1813
|
"burst.line1": "三秒,三辈子的代码",
|
|
1619
1814
|
"burst.line2": "文言文 · 二进制 · 摩斯电码",
|
|
1620
1815
|
"settings.title": "梁神模式",
|
|
1621
|
-
"settings.description": "
|
|
1622
|
-
"settings.enabled": "
|
|
1623
|
-
"settings.enabledHint": "
|
|
1624
|
-
"settings.announceToAgent": "
|
|
1625
|
-
"settings.announceToAgentHint": "
|
|
1626
|
-
"settings.presentation": "
|
|
1627
|
-
"settings.presentationHint": "
|
|
1628
|
-
"settings.dispatcher": "
|
|
1629
|
-
"settings.dispatcherHint": "
|
|
1816
|
+
"settings.description": "梁神模式的开关、工具面与调度身份。",
|
|
1817
|
+
"settings.enabled": "总开关",
|
|
1818
|
+
"settings.enabledHint": "关掉后不再声明预设。",
|
|
1819
|
+
"settings.announceToAgent": "公告给 agent",
|
|
1820
|
+
"settings.announceToAgentHint": "每一轮系统提示都带上本插件公告。",
|
|
1821
|
+
"settings.presentation": "工具面",
|
|
1822
|
+
"settings.presentationHint": "ptc 把工具收进 run_code,native 保留原生清单。",
|
|
1823
|
+
"settings.dispatcher": "调度身份",
|
|
1824
|
+
"settings.dispatcherHint": "按调度 Agent 工作:分诊、访谈、派发子代理。",
|
|
1630
1825
|
"settings.on": "开",
|
|
1631
1826
|
"settings.off": "关",
|
|
1632
|
-
"settings.inherit": "
|
|
1633
|
-
"settings.overridden": "
|
|
1634
|
-
"settings.reset": "
|
|
1635
|
-
"settings.notExposed": "
|
|
1636
|
-
"settings.readOnly": "
|
|
1827
|
+
"settings.inherit": "继承",
|
|
1828
|
+
"settings.overridden": "已修改",
|
|
1829
|
+
"settings.reset": "恢复默认",
|
|
1830
|
+
"settings.notExposed": "这个版本的 DSH 没有开放梁神模式的设置。",
|
|
1831
|
+
"settings.readOnly": "设置只读。",
|
|
1637
1832
|
"settings.expand": "展开设置",
|
|
1638
1833
|
"settings.collapse": "收起设置",
|
|
1639
|
-
"settings.
|
|
1640
|
-
"settings.
|
|
1641
|
-
"
|
|
1642
|
-
"
|
|
1643
|
-
"settings.saveFailed": "部署未接受这些值,已保留供你修改。",
|
|
1644
|
-
"settings.invalidValue": "该取值不被接受",
|
|
1645
|
-
"presentation.ptc": "ptc(仅 run_code)",
|
|
1646
|
-
"presentation.native": "native(原生工具清单)"
|
|
1834
|
+
"settings.saveFailed": "没有保存成功。",
|
|
1835
|
+
"settings.invalidValue": "填一个可用的值。",
|
|
1836
|
+
"presentation.ptc": "ptc",
|
|
1837
|
+
"presentation.native": "native"
|
|
1647
1838
|
};
|
|
1648
1839
|
/** English counterpart; the key set mirrors {@link zh} exactly. */
|
|
1649
1840
|
const en = {
|
|
@@ -1663,32 +1854,28 @@ window.__ModuleLoader__.load({
|
|
|
1663
1854
|
"burst.line1": "Three seconds, three lifetimes of code",
|
|
1664
1855
|
"burst.line2": "Classical Chinese · Binary · Morse code",
|
|
1665
1856
|
"settings.title": "LiangShen mode",
|
|
1666
|
-
"settings.description": "
|
|
1667
|
-
"settings.enabled": "
|
|
1668
|
-
"settings.enabledHint": "When off, the preset is
|
|
1669
|
-
"settings.announceToAgent": "Announce
|
|
1670
|
-
"settings.announceToAgentHint": "
|
|
1671
|
-
"settings.presentation": "Wire
|
|
1672
|
-
"settings.presentationHint": "
|
|
1673
|
-
"settings.dispatcher": "Dispatcher
|
|
1674
|
-
"settings.dispatcherHint": "
|
|
1857
|
+
"settings.description": "The mode switch, the wire presentation and the dispatcher identity.",
|
|
1858
|
+
"settings.enabled": "Master switch",
|
|
1859
|
+
"settings.enabledHint": "When off, the preset is no longer declared.",
|
|
1860
|
+
"settings.announceToAgent": "Announce to agents",
|
|
1861
|
+
"settings.announceToAgentHint": "Every system prompt carries this plugin note.",
|
|
1862
|
+
"settings.presentation": "Wire",
|
|
1863
|
+
"settings.presentationHint": "ptc folds tools into run_code; native keeps the native roster.",
|
|
1864
|
+
"settings.dispatcher": "Dispatcher",
|
|
1865
|
+
"settings.dispatcherHint": "Works as a dispatcher: triage, interview, then dispatch subagents.",
|
|
1675
1866
|
"settings.on": "On",
|
|
1676
1867
|
"settings.off": "Off",
|
|
1677
|
-
"settings.inherit": "Inherit
|
|
1678
|
-
"settings.overridden": "
|
|
1679
|
-
"settings.reset": "Reset",
|
|
1680
|
-
"settings.notExposed": "This DSH version does not
|
|
1681
|
-
"settings.readOnly": "
|
|
1868
|
+
"settings.inherit": "Inherit",
|
|
1869
|
+
"settings.overridden": "Changed",
|
|
1870
|
+
"settings.reset": "Reset to default",
|
|
1871
|
+
"settings.notExposed": "This DSH version does not open the LiangShen settings.",
|
|
1872
|
+
"settings.readOnly": "Settings are read-only.",
|
|
1682
1873
|
"settings.expand": "Show settings",
|
|
1683
1874
|
"settings.collapse": "Hide settings",
|
|
1684
|
-
"settings.
|
|
1685
|
-
"settings.
|
|
1686
|
-
"
|
|
1687
|
-
"
|
|
1688
|
-
"settings.saveFailed": "The deployment did not accept these values; they were left for you to correct.",
|
|
1689
|
-
"settings.invalidValue": "The value is not accepted",
|
|
1690
|
-
"presentation.ptc": "ptc (run_code only)",
|
|
1691
|
-
"presentation.native": "native (native tool roster)"
|
|
1875
|
+
"settings.saveFailed": "Not saved.",
|
|
1876
|
+
"settings.invalidValue": "Enter a value this field accepts.",
|
|
1877
|
+
"presentation.ptc": "ptc",
|
|
1878
|
+
"presentation.native": "native"
|
|
1692
1879
|
};
|
|
1693
1880
|
//#endregion
|
|
1694
1881
|
//#region src/client/plugin-card-seat.ts
|
|
@@ -1782,6 +1969,7 @@ window.__ModuleLoader__.load({
|
|
|
1782
1969
|
if (reconciling) return;
|
|
1783
1970
|
const target = familyGroupLoaded(ctx) ? FAMILY_PLUGIN_CARD_SEAT : OFFICIAL_PLUGIN_CARD_SEAT;
|
|
1784
1971
|
if (current === target) return;
|
|
1972
|
+
if (typeof slots.spec === "function" && slots.spec(target) === void 0) return;
|
|
1785
1973
|
reconciling = true;
|
|
1786
1974
|
const previous = dispose;
|
|
1787
1975
|
dispose = void 0;
|