dsh-mcp-skills-controller 0.1.1 → 0.1.2
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/client.js +30 -56
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -40,8 +40,6 @@ window.__ModuleLoader__.load({
|
|
|
40
40
|
'state.saving': '保存中…',
|
|
41
41
|
'state.unsaved': '未写入磁盘',
|
|
42
42
|
'state.corrupt': '状态文件损坏,已备份并恢复默认',
|
|
43
|
-
'mode.on': '开',
|
|
44
|
-
'mode.off': '关',
|
|
45
43
|
'global.on': '全局默认:开',
|
|
46
44
|
'global.off': '全局默认:关',
|
|
47
45
|
'badge.all': '全开',
|
|
@@ -84,8 +82,6 @@ window.__ModuleLoader__.load({
|
|
|
84
82
|
'state.saving': 'Saving…',
|
|
85
83
|
'state.unsaved': 'not written to disk',
|
|
86
84
|
'state.corrupt': 'The state file was corrupt; backed up and reset to defaults',
|
|
87
|
-
'mode.on': 'On',
|
|
88
|
-
'mode.off': 'Off',
|
|
89
85
|
'global.on': 'Global default: On',
|
|
90
86
|
'global.off': 'Global default: Off',
|
|
91
87
|
'badge.all': 'All on',
|
|
@@ -428,28 +424,8 @@ window.__ModuleLoader__.load({
|
|
|
428
424
|
左侧成一条线),不随描述长度浮动。 */
|
|
429
425
|
.msc-itemSecondaryMain { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
430
426
|
.msc-itemSecondaryGlob { flex: none; font-variant-numeric: tabular-nums; }
|
|
431
|
-
/*
|
|
432
|
-
|
|
433
|
-
.msc-mode { flex: none; display: inline-flex; align-items: center; gap: 2px; align-self: center; }
|
|
434
|
-
.msc-tri {
|
|
435
|
-
flex: none; display: inline-flex; align-items: center; gap: 2px; padding: 2px;
|
|
436
|
-
border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-interactive-bg-hover);
|
|
437
|
-
}
|
|
438
|
-
.msc-triSeg {
|
|
439
|
-
padding: 1px 7px; border: none; border-radius: var(--dsw-radius-xs); outline: none;
|
|
440
|
-
background: transparent;
|
|
441
|
-
font-family: var(--dsw-font-family); font-size: 11px; line-height: 16px; font-weight: 500;
|
|
442
|
-
color: var(--dsw-alias-label-tertiary); cursor: pointer;
|
|
443
|
-
transition: color 120ms var(--ds-ease-in-out), background-color 120ms var(--ds-ease-in-out);
|
|
444
|
-
}
|
|
445
|
-
.msc-triSeg:hover:not(:disabled):not([data-active="true"]) { color: var(--dsw-alias-label-secondary); }
|
|
446
|
-
.msc-triSeg[data-active="true"] {
|
|
447
|
-
background: var(--dsw-alias-bg-base);
|
|
448
|
-
color: var(--dsw-alias-label-primary);
|
|
449
|
-
box-shadow: var(--dsw-shadow-lv1);
|
|
450
|
-
}
|
|
451
|
-
.msc-triSeg:focus-visible { outline: 2px solid var(--dsw-alias-border-l3); outline-offset: 1px; }
|
|
452
|
-
.msc-triSeg:disabled { cursor: default; }
|
|
427
|
+
/* 会话行与设置页共用官方 Switch 外观:显式覆盖时右侧另起 ↺。 */
|
|
428
|
+
.msc-mode { flex: none; display: inline-flex; align-items: center; gap: 4px; align-self: center; }
|
|
453
429
|
/* 单项恢复跟随:24px 图标按钮,仅覆盖存在时出现。 */
|
|
454
430
|
.msc-follow {
|
|
455
431
|
box-sizing: border-box; display: inline-flex;
|
|
@@ -644,24 +620,28 @@ window.__ModuleLoader__.load({
|
|
|
644
620
|
return React.createElement(SpriteIcon, { name: 'refresh-outline', size })
|
|
645
621
|
}
|
|
646
622
|
|
|
647
|
-
/**
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
const modes = [
|
|
651
|
-
['on', t('mode.on')],
|
|
652
|
-
['off', t('mode.off')],
|
|
653
|
-
]
|
|
654
|
-
return React.createElement('div', { className: 'msc-mode', role: 'group', 'aria-label': name },
|
|
655
|
-
React.createElement('div', { className: 'msc-tri' },
|
|
656
|
-
modes.map(([mode, label]) => React.createElement('button', {
|
|
657
|
-
key: mode,
|
|
623
|
+
/** 官方 Switch 外观的通用按钮:会话行与设置页共用同一尺寸、焦点与禁用态。 */
|
|
624
|
+
function SwitchButton({ checked, label, disabled, onClick }) {
|
|
625
|
+
return React.createElement('button', {
|
|
658
626
|
type: 'button',
|
|
659
|
-
className: 'msc-
|
|
660
|
-
'
|
|
661
|
-
'aria-
|
|
627
|
+
className: 'msc-switch',
|
|
628
|
+
role: 'switch',
|
|
629
|
+
'aria-checked': String(checked === true),
|
|
630
|
+
'aria-label': label,
|
|
631
|
+
disabled: disabled === true,
|
|
632
|
+
onClick,
|
|
633
|
+
})
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/** 会话行开关:显示当前实际生效值;有显式覆盖时右侧出现 ↺ 恢复跟随。 */
|
|
637
|
+
function ModeControl({ checked, name, busy, followable, onFollow, onChange, t }) {
|
|
638
|
+
return React.createElement('div', { className: 'msc-mode' },
|
|
639
|
+
React.createElement(SwitchButton, {
|
|
640
|
+
checked,
|
|
641
|
+
label: name,
|
|
662
642
|
disabled: busy === true,
|
|
663
|
-
onClick: () => { onChange(
|
|
664
|
-
}
|
|
643
|
+
onClick: () => { onChange(checked === true ? 'off' : 'on') },
|
|
644
|
+
}),
|
|
665
645
|
followable && React.createElement('button', {
|
|
666
646
|
type: 'button',
|
|
667
647
|
className: 'msc-follow',
|
|
@@ -928,7 +908,7 @@ window.__ModuleLoader__.load({
|
|
|
928
908
|
React.createElement(ModeControl, {
|
|
929
909
|
// 控件显示「当前实际生效值」:无覆盖时即全局状态;有覆盖时是显式值,
|
|
930
910
|
// 此时出现 ↺ 单项恢复跟随。
|
|
931
|
-
|
|
911
|
+
checked: item.effective === true,
|
|
932
912
|
name: item.name,
|
|
933
913
|
busy,
|
|
934
914
|
followable: item.mode !== 'follow',
|
|
@@ -957,7 +937,7 @@ window.__ModuleLoader__.load({
|
|
|
957
937
|
!project && React.createElement('span', { className: 'msc-itemSecondaryGlob' },
|
|
958
938
|
item.global === true ? t('global.on') : t('global.off')))),
|
|
959
939
|
React.createElement(ModeControl, {
|
|
960
|
-
|
|
940
|
+
checked: item.effective === true,
|
|
961
941
|
name: item.name,
|
|
962
942
|
busy,
|
|
963
943
|
// 项目级技能没有「跟随全局」可恢复:不显示 ↺,点「开」即回到默认开。
|
|
@@ -1149,12 +1129,9 @@ window.__ModuleLoader__.load({
|
|
|
1149
1129
|
React.createElement('div', { className: 'msc-rowDesc' }, meta)),
|
|
1150
1130
|
React.createElement('div', { className: 'msc-rowActions' },
|
|
1151
1131
|
React.createElement(ExpandIndicator, { open, t }),
|
|
1152
|
-
React.createElement(
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
role: 'switch',
|
|
1156
|
-
'aria-checked': String(server.enabled === true),
|
|
1157
|
-
'aria-label': server.name,
|
|
1132
|
+
React.createElement(SwitchButton, {
|
|
1133
|
+
checked: server.enabled === true,
|
|
1134
|
+
label: server.name,
|
|
1158
1135
|
disabled: busyKey !== undefined,
|
|
1159
1136
|
onClick: (event) => {
|
|
1160
1137
|
// 开关是行内独立动作:阻止冒泡,避免点开关时同时展开/收起详情。
|
|
@@ -1203,12 +1180,9 @@ window.__ModuleLoader__.load({
|
|
|
1203
1180
|
React.createElement('div', { className: 'msc-rowDesc' }, skill.description ?? '')),
|
|
1204
1181
|
React.createElement('div', { className: 'msc-rowActions' },
|
|
1205
1182
|
React.createElement(ExpandIndicator, { open, t }),
|
|
1206
|
-
React.createElement(
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
role: 'switch',
|
|
1210
|
-
'aria-checked': String(skill.enabled === true),
|
|
1211
|
-
'aria-label': skill.name,
|
|
1183
|
+
React.createElement(SwitchButton, {
|
|
1184
|
+
checked: skill.enabled === true,
|
|
1185
|
+
label: skill.name,
|
|
1212
1186
|
disabled: busyKey !== undefined,
|
|
1213
1187
|
onClick: (event) => {
|
|
1214
1188
|
// 开关是行内独立动作:阻止冒泡,避免点开关时同时展开/收起详情。
|