dsh-long-plugins 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,6 +124,24 @@ MIT
124
124
 
125
125
  ## Changelog / 更新记录
126
126
 
127
+ ### v2.2.1
128
+
129
+ 修复输入框实底、浅色主题可读性问题,并为输入框、背景罩新增浅色/深色主题的分套设置。
130
+
131
+ 🐛 Bug 修复
132
+
133
+ - 输入框实底跟随主题:此前用操作系统深色偏好判断,导致浅色主题下黑底黑字。改为读取 DSH 真实主题(`<html>` 上的 `color-scheme`),浅色 = 白底深字、深色 = 深底浅字,切换主题自动实时重算。
134
+ - 浅色主题可读性:统一桌面浅色下,气泡、工具调用名(Bash 等)、推理(think)标签、底部状态/统计行文字在背景图上过浅看不清。已按主题提高对比度并加描边;状态/统计行改用稳定的 `data-slot` 槽位定位(不再依赖会变的混淆类名),提高升级稳定性。
135
+
136
+ ✨ 新增功能
137
+
138
+ - 输入框设置(设置面板新增"输入框"区):浅色主题、深色主题可分别设置背景颜色与不透明度,支持一键"恢复原生"。
139
+ - 背景罩设置(设置面板新增"背景罩"区):浅色主题、深色主题可分别设置罩色与罩强度,切换主题自动应用对应的一套。
140
+
141
+ 🎨 视觉 / 交互
142
+
143
+ - 左栏「新会话」按钮去掉白/黑实底边框,文字改为跟随侧边栏的白字+描边,更好融入背景。
144
+
127
145
  ### v2.2.0
128
146
 
129
147
  界面优化与重构
package/client/client.js CHANGED
@@ -974,8 +974,6 @@ window.__ModuleLoader__.load({
974
974
  const CSS = `
975
975
  @font-face{font-family:DshChipCellInput;src:url(data:font/ttf;base64,AAEAAAAKAIAAAwAgT1MvMkT8SmIAAAEoAAAAYGNtYXAADQBPAAABkAAAADRnbHlmAAAAAAAAAcwAAAABaGVhZCwtPGoAAACsAAAANmhoZWEDIg7bAAAA5AAAACRobXR4EZQAAAAAAYgAAAAIbG9jYQAAAAAAAAHEAAAABm1heHAAAwACAAABCAAAACBuYW1lvljk2gAAAdAAAABscG9zdNNweNQAAAI8AAAALQABAAAAAQAAdia1tV8PPPUAAwPoAAAAAOaLfcUAAAAA5ot9xQAAAAAAAAAAAAAAAwACAAAAAAAAAAEAAAMg/zgAAA+gAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAEAAAACAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAwjKAZAABQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAPz8/PwAA//z//AMg/zgAAAMgAMgAAAAAAAAAAAAAAAAAAAAgAAAB9AAAAAAAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAIAAAAAQABAABAAD//P//AAD//P//AAUAAQAAAAAAAAAAAAAAAAAAAAAAAAAEADYAAQAAAAAAAQALAAAAAQAAAAAAAgAHAAsAAwABBAkAAQAWABIAAwABBAkAAgAOAChEc2hDaGlwQ2VsbFJlZ3VsYXIARABzAGgAQwBoAGkAcABDAGUAbABsAFIAZQBnAHUAbABhAHIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAABAgZvYmpyZXAAAAA=)format("truetype")}
976
976
  .uV2eYG_input,.uV2eYG_mirror{font-family:"DshChipCellInput",var(--dsw-font-family)!important}
977
- /* 输入区随系统深/浅自动切换(原生系统色,文字/背景同源始终匹配),避免深色下白字配浅底 */
978
- .uV2eYG_input{color-scheme:light dark;background-color:Canvas!important;color:CanvasText!important}
979
977
  [data-decoration="chip"][title^="${HIDDEN_LABEL}"]{display:inline-block!important;width:0!important;height:0!important;overflow:hidden!important;background:transparent!important;border:none!important;box-shadow:none!important;margin:0!important;padding:0!important;font-size:0!important;line-height:0!important}
980
978
  [data-decoration="chip"][title^="${HIDDEN_LABEL}"]:before,[data-decoration="chip"][title^="${HIDDEN_LABEL}"]>*{display:none!important}
981
979
  .dsh-upload-control{display:flex;align-items:center;min-width:0}
@@ -3055,6 +3053,18 @@ window.__ModuleLoader__.load({
3055
3053
  backdrop-filter: none;
3056
3054
  -webkit-backdrop-filter: none;
3057
3055
  }
3056
+ /* 左栏顶部「新会话」按钮:去掉白/黑实底与边框,透出背景图;文字跟侧边栏一致(白+描边) */
3057
+ html[data-dsh-glass="on"] #root [class*="newSession"] {
3058
+ background-color: transparent !important;
3059
+ background-image: none !important;
3060
+ border: none !important;
3061
+ border-radius: 0 !important;
3062
+ box-shadow: none !important;
3063
+ backdrop-filter: none !important;
3064
+ -webkit-backdrop-filter: none !important;
3065
+ color: #ffffff !important;
3066
+ text-shadow: 0 1px 3px rgba(0,0,0,.85);
3067
+ }
3058
3068
  /* 左栏内部根 / 底部容器也用透明(这些是 DSH 当前版本哈希类名;背景图要透到左栏与底部) */
3059
3069
  html[data-dsh-glass="on"] #root [class*="hHd-Xa_root"],
3060
3070
  html[data-dsh-glass="on"] #root [class*="FJxK0a_root"] {
@@ -3074,7 +3084,7 @@ window.__ModuleLoader__.load({
3074
3084
  margin: 0 !important;
3075
3085
  }
3076
3086
  /* 背景图独立层:铺满整页、位于内容之下,可单独设背景图模糊与透明度,不影响内容清晰度 */
3077
- .dsh-glass-bgimg{position:fixed;inset:0;z-index:-1;pointer-events:none;background-size:cover;background-position:center;background-repeat:no-repeat;display:none;transform:translateZ(0);}
3087
+ .dsh-glass-bgimg{position:fixed;inset:0;z-index:-1;pointer-events:none;background-size:cover;background-position:center;background-repeat:no-repeat;display:none;}
3078
3088
  /* 滚动条:细、半透明、圆角,且左移贴在内容区(不占卡片最右边缘),让右边缘过渡柔和 */
3079
3089
  html[data-dsh-glass="on"] #root [class*="wSkVaW_scrollBody"]::-webkit-scrollbar { width: 8px; }
3080
3090
  html[data-dsh-glass="on"] #root [class*="wSkVaW_scrollBody"]::-webkit-scrollbar-track { background: transparent; }
@@ -3089,7 +3099,7 @@ window.__ModuleLoader__.load({
3089
3099
  border-radius: 0 !important;
3090
3100
  box-shadow: none !important;
3091
3101
  }
3092
- /* 输入区外围(composer根/位置座)透明透出背景;输入框盒子保留原生白/黑 */
3102
+ /* 输入区外围(composerSeat/uV2eYG_root)透明,白块去掉、透出背景 */
3093
3103
  html[data-dsh-glass="on"] [class*="wSkVaW_composerSeat"],
3094
3104
  html[data-dsh-glass="on"] [class*="uV2eYG_root"] {
3095
3105
  background-color: transparent !important;
@@ -3098,21 +3108,22 @@ window.__ModuleLoader__.load({
3098
3108
  backdrop-filter: none !important;
3099
3109
  -webkit-backdrop-filter: none !important;
3100
3110
  }
3101
- /* 输入框盒子(uV2eYG_card):只在外层铺淡色底(可调);里层输入区透明避免拼缝白条;文字随主题色 */
3111
+ /* 输入框盒子(uV2eYG_card):实底(浅色=白/深色=深)并在背景图之上,文字随主题,保证可读。
3112
+ 加 #root 提高优先级,压过 DSH 自身把 card 背景设透明的规则 */
3113
+ html[data-dsh-glass="on"] #root [class*="uV2eYG_card"],
3102
3114
  html[data-dsh-glass="on"] [class*="uV2eYG_card"] {
3103
- background: linear-gradient(var(--dsh-glass-input-white, rgba(255,255,255,0.3)), var(--dsh-glass-input-white, rgba(255,255,255,0.3))) var(--dsh-glass-input-bg, rgba(26,35,50,0.6)) !important;
3104
- color: var(--dsw-alias-label-primary, #111827) !important;
3115
+ position: relative !important;
3116
+ z-index: 0 !important;
3117
+ background-color: #ffffff !important;
3118
+ background-image: none !important;
3119
+ color: #1a2332 !important;
3105
3120
  box-shadow: none !important;
3106
3121
  backdrop-filter: none !important;
3107
3122
  -webkit-backdrop-filter: none !important;
3108
3123
  }
3109
- html[data-dsh-glass="on"] [class*="uV2eYG_input"] {
3110
- background-color: transparent !important;
3111
- color: var(--dsw-alias-label-primary, #111827) !important;
3112
- }
3113
3124
  @media (prefers-color-scheme: dark) {
3114
- html[data-dsh-glass="on"] [class*="uV2eYG_card"],
3115
- html[data-dsh-glass="on"] [class*="uV2eYG_input"] { color: var(--dsw-alias-label-primary, #e5e7eb) !important; }
3125
+ html[data-dsh-glass="on"] #root [class*="uV2eYG_card"],
3126
+ html[data-dsh-glass="on"] [class*="uV2eYG_card"] { background: #1c2530 !important; color: #f5f7fa !important; }
3116
3127
  }
3117
3128
  /* 轮次/历史提问预览:默认隐藏(点开才显示),并去掉头部底色,避免底部露出白条 */
3118
3129
  .dsh-turn-preview:not(.open){display:none !important;}
@@ -3122,11 +3133,32 @@ window.__ModuleLoader__.load({
3122
3133
  html[data-dsh-glass="off"] #root [class*="header"],
3123
3134
  html[data-dsh-glass="off"] #root [class*="centerCol"],
3124
3135
  html[data-dsh-glass="off"] #root [class*="wSkVaW_root"],
3125
- html[data-dsh-glass="off"] #root [class*="wSkVaW_scrollBody"],
3126
- html[data-dsh-glass="off"] #root [class*="uV2eYG_card"] { background-color: transparent !important; backdrop-filter: none; }
3127
- /* 用户消息气泡:浅色半透明底(随主题),与 AI 消息(透明/磨砂)区分 */
3128
- html[data-dsh-glass="on"] #root [class*="ngdEzaw_bubble"]:not([class*="button"]) {
3129
- background-color: color-mix(in srgb, var(--dsw-specific-input-major, #e8edf3) 62%, transparent) !important;
3136
+ html[data-dsh-glass="off"] #root [class*="wSkVaW_scrollBody"] { background-color: transparent !important; backdrop-filter: none; }
3137
+ /* 会话消息气泡:半透明底(随主题, 60%透明=40%不透明),与 AI 消息(透明/磨砂)区分、融入背景 */
3138
+ html[data-dsh-glass="on"] #root [class*="_bubble"]:not([class*="button"]) {
3139
+ background-color: color-mix(in srgb, var(--dsw-specific-input-major, #e8edf3) 40%, transparent) !important;
3140
+ }
3141
+ /* 统一桌面 + 浅色主题:DSH 的 secondary/tertiary 文字在浅色磨砂上太浅,统一加深,覆盖状态栏/工具标签等 */
3142
+ html[data-dsh-glass="on"][data-dsh-theme="light"] {
3143
+ --dsw-alias-label-secondary: #33414f !important;
3144
+ --dsw-alias-label-tertiary: #4a5866 !important;
3145
+ }
3146
+ /* 工具调用名(Bash/Shell等)与推理(think)标签:浅色下再显式压深,保证可读 */
3147
+ html[data-dsh-glass="on"][data-dsh-theme="light"] #root [class*="CY-8Ka_title"],
3148
+ html[data-dsh-glass="on"][data-dsh-theme="light"] #root [class*="QWLzLg_title"] {
3149
+ color: #2f3d4a !important;
3150
+ }
3151
+ /* 输入框下方状态/统计行(余额+步数/时长/速度等)都在 composer.dock 这个稳定 data 槽里:
3152
+ 混淆类名会变, 改用 data 属性锁定, 按主题给高对比色+描边, 保证在背景图上可读 */
3153
+ html[data-dsh-glass="on"][data-dsh-theme="light"] [data-slot-conversation="conversation.composer.dock"],
3154
+ html[data-dsh-glass="on"][data-dsh-theme="light"] [data-slot-conversation="conversation.composer.dock"] * {
3155
+ color: #243240 !important;
3156
+ text-shadow: 0 1px 2px rgba(255,255,255,.5);
3157
+ }
3158
+ html[data-dsh-glass="on"][data-dsh-theme="dark"] [data-slot-conversation="conversation.composer.dock"],
3159
+ html[data-dsh-glass="on"][data-dsh-theme="dark"] [data-slot-conversation="conversation.composer.dock"] * {
3160
+ color: #e8edf3 !important;
3161
+ text-shadow: 0 1px 2px rgba(0,0,0,.6);
3130
3162
  }
3131
3163
  /* 会话区所有内容元素背景透明化:去掉"反底色"小块衬底,统一融入磨砂卡片 */
3132
3164
  html[data-dsh-glass="on"] #root [class*="wSkVaW_scrollBody"] *:not([class*="button"]):not([class*="bubble"]):not([class*="_menu"]) {
@@ -3141,10 +3173,6 @@ window.__ModuleLoader__.load({
3141
3173
  html[data-dsh-glass="on"] #root [class*="wSkVaW_scrollBody"] [class*="md-code-block"] {
3142
3174
  background-color: transparent !important;
3143
3175
  }
3144
- /* uV2eYG_add: composer 里随内容变化的白色衬底,玻璃开启时透明化 */
3145
- html[data-dsh-glass="on"] #root [class*="uV2eYG_add"] {
3146
- background-color: transparent !important;
3147
- }
3148
3176
  /* 输入框下拉/悬浮菜单(如 / 命令、@ 提及):背景给不透明随主题色,避免叠在会话磨砂卡上重叠看不清 */
3149
3177
  html[data-dsh-glass="on"] #root [class*="_menu"][class*="_menu"][class*="_menu"][class*="_menu"] {
3150
3178
  background-color: var(--dsw-specific-input-major, #e8edf3) !important;
@@ -3181,6 +3209,9 @@ window.__ModuleLoader__.load({
3181
3209
  .dsh-glass-switch input{width:34px;height:20px;accent-color:var(--dsw-alias-state-business-primary);cursor:pointer}
3182
3210
  .dsh-glass-card{display:grid;gap:12px;padding:14px 16px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-specific-input-major)}
3183
3211
  .dsh-glass-zone-title{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}
3212
+ .dsh-glass-input-theme{border-top:1px dashed var(--dsw-alias-border-l2);padding-top:12px;display:grid;gap:12px}
3213
+ .dsh-glass-input-theme:first-of-type{border-top:none;padding-top:0}
3214
+ .dsh-glass-theme-label{font-size:12px;font-weight:600;color:var(--dsw-alias-label-secondary)}
3184
3215
  .dsh-glass-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
3185
3216
  .dsh-glass-row label{font-size:13px;color:var(--dsw-alias-label-primary);flex:none}
3186
3217
  .dsh-glass-range{flex:1;min-width:160px;max-width:320px;accent-color:var(--dsw-alias-state-business-primary)}
@@ -3258,6 +3289,18 @@ window.__ModuleLoader__.load({
3258
3289
  React.useEffect(() => { load(); }, [load])
3259
3290
  const patch = React.useCallback((p) => setState((s) => ({ ...s, cfg: { ...(s.cfg || {}), ...p } })), [])
3260
3291
  const patchZone = React.useCallback((key, p) => setState((s) => ({ ...s, cfg: { ...(s.cfg || {}), [key]: p } })), [])
3292
+ // 输入框设置:按主题(theme)合并进 cfg.inputBox[theme](不整体覆盖、不丢另一主题)
3293
+ const patchInput = React.useCallback((theme, p) => setState((s) => {
3294
+ const box = { light: { color: '', opacity: 1 }, dark: { color: '', opacity: 1 }, ...((s.cfg && s.cfg.inputBox) || {}) }
3295
+ box[theme] = { ...((box[theme]) || { color: '', opacity: 1 }), ...p }
3296
+ return { ...s, cfg: { ...(s.cfg || {}), inputBox: box } }
3297
+ }), [])
3298
+ // 背景罩设置:按主题合并进 cfg.bgTint[theme]
3299
+ const patchBgTint = React.useCallback((theme, p) => setState((s) => {
3300
+ const box = { light: { color: '#1a2332', mask: 0.28 }, dark: { color: '#1a2332', mask: 0.28 }, ...((s.cfg && s.cfg.bgTint) || {}) }
3301
+ box[theme] = { ...((box[theme]) || { color: '#1a2332', mask: 0.28 }), ...p }
3302
+ return { ...s, cfg: { ...(s.cfg || {}), bgTint: box } }
3303
+ }), [])
3261
3304
  const save = React.useCallback(async () => {
3262
3305
  setState((s) => ({ ...s, saving: true, error: '' }))
3263
3306
  try {
@@ -3266,6 +3309,14 @@ window.__ModuleLoader__.load({
3266
3309
  const payload = {
3267
3310
  enabled: !!cfg.enabled, blur: num(cfg.blur, 0),
3268
3311
  bgImage: state.bgImage || cfg.bgImage || '', bgMask: num(cfg.bgMask, 0.28), bgColor: cfg.bgColor || '#1a2332', bgBlur: num(cfg.bgBlur, 0), bgOpacity: num(cfg.bgOpacity, 1),
3312
+ bgTint: {
3313
+ light: { color: (cfg.bgTint?.light?.color) || '#1a2332', mask: num(cfg.bgTint?.light?.mask, 0.28) },
3314
+ dark: { color: (cfg.bgTint?.dark?.color) || '#1a2332', mask: num(cfg.bgTint?.dark?.mask, 0.28) },
3315
+ },
3316
+ inputBox: {
3317
+ light: { color: (cfg.inputBox?.light?.color) || '', opacity: num(cfg.inputBox?.light?.opacity, 1) },
3318
+ dark: { color: (cfg.inputBox?.dark?.color) || '', opacity: num(cfg.inputBox?.dark?.opacity, 1) },
3319
+ },
3269
3320
  zone: {
3270
3321
  session: { enabled: cfg.session && cfg.session.enabled !== false, color: (cfg.session && cfg.session.color) || '#1a2332', mask: num(cfg.session && cfg.session.mask, 0.45), opacity: num(cfg.session && cfg.session.opacity, 0.5) },
3271
3322
  input: { color: (cfg.input && cfg.input.color) || '#1a2332', mask: num(cfg.input && cfg.input.mask, 0.6), opacity: num(cfg.input && cfg.input.opacity, 0.55) },
@@ -3282,7 +3333,7 @@ window.__ModuleLoader__.load({
3282
3333
  if (state.loading) return React.createElement('div', { className: 'dsh-glass-section' }, '加载中…')
3283
3334
  return React.createElement('div', { className: 'dsh-glass-section' },
3284
3335
  React.createElement('div', { className: 'dsh-glass-head' },
3285
- React.createElement('div', null, React.createElement('h2', null, '毛玻璃界面'), React.createElement('p', null, '共用一张背景图铺满整页,仅消息滚动区做居中磨砂玻璃卡片,其余区域透出背景图。')),
3336
+ React.createElement('div', null, React.createElement('h2', null, 'RA-Span'), React.createElement('p', null, '共用一张背景图铺满整页(RA-Span):背景图、背景罩层颜色、背景模糊/透明度可调;会话区/输入区按需透明或实底。')),
3286
3337
  React.createElement('label', { className: 'dsh-glass-switch' }, React.createElement('input', { type: 'checkbox', checked: !!cfg.enabled, onChange: (e) => patch({ enabled: e.target.checked }) }), cfg.enabled ? '已开启' : '已关闭'),
3287
3338
  ),
3288
3339
  state.error ? React.createElement('div', { className: 'dsh-glass-error' }, state.error) : null,
@@ -3296,14 +3347,24 @@ window.__ModuleLoader__.load({
3296
3347
  React.createElement('label', null, '共用背景图'),
3297
3348
  React.createElement('div', { className: 'dsh-glass-bg' }, glassImageInput(state.bgImage, (v) => setState((s) => ({ ...s, bgImage: v })))),
3298
3349
  ),
3299
- React.createElement('div', { className: 'dsh-glass-row' },
3300
- React.createElement('label', null, '背景图罩'),
3301
- React.createElement('input', { type: 'range', className: 'dsh-glass-range', min: 0, max: 0.95, step: 0.01, value: cfg.bgMask ?? 0.28, onChange: (e) => patch({ bgMask: Number(e.target.value) }) }),
3302
- React.createElement('span', { className: 'dsh-glass-val' }, `${Math.round((Number(cfg.bgMask ?? 0.28)) * 100)}%`),
3303
- ),
3304
- React.createElement('div', { className: 'dsh-glass-row' },
3305
- React.createElement('label', null, '背景罩层颜色'),
3306
- React.createElement('label', { className: 'dsh-glass-colorpicker' }, '色盘', React.createElement('input', { type: 'color', value: cfg.bgColor || '#1a2332', onChange: (e) => patch({ bgColor: e.target.value }) })),
3350
+ React.createElement('div', { className: 'dsh-glass-card' },
3351
+ React.createElement('div', { className: 'dsh-glass-zone-title' }, '背景罩'),
3352
+ [['light', '浅色主题', '#1a2332'], ['dark', '深色主题', '#1a2332']].map(([t, label, native]) => {
3353
+ const bt = (cfg.bgTint && cfg.bgTint[t]) || { color: native, mask: 0.28 }
3354
+ return React.createElement('div', { key: t, className: 'dsh-glass-input-theme' },
3355
+ React.createElement('div', { className: 'dsh-glass-theme-label' }, label),
3356
+ React.createElement('div', { className: 'dsh-glass-row' },
3357
+ React.createElement('label', null, '罩色'),
3358
+ React.createElement('label', { className: 'dsh-glass-colorpicker' }, '色盘', React.createElement('input', { type: 'color', value: bt.color || native, onChange: (e) => patchBgTint(t, { color: e.target.value }) })),
3359
+ ),
3360
+ React.createElement('div', { className: 'dsh-glass-row' },
3361
+ React.createElement('label', null, '罩强度'),
3362
+ React.createElement('input', { type: 'range', className: 'dsh-glass-range', min: 0, max: 0.95, step: 0.01, value: (typeof bt.mask === 'number') ? bt.mask : 0.28, onChange: (e) => patchBgTint(t, { mask: Number(e.target.value) }) }),
3363
+ React.createElement('span', { className: 'dsh-glass-val' }, `${Math.round((typeof bt.mask === 'number' ? bt.mask : 0.28) * 100)}%`),
3364
+ ),
3365
+ )
3366
+ }),
3367
+ React.createElement('p', { className: 'dsh-glass-note' }, '浅色主题与深色主题可分别设置背景罩颜色与罩强度,切换主题时自动应用对应的一套。'),
3307
3368
  ),
3308
3369
  React.createElement('div', { className: 'dsh-glass-row' },
3309
3370
  React.createElement('label', null, '背景图模糊'),
@@ -3315,7 +3376,27 @@ window.__ModuleLoader__.load({
3315
3376
  React.createElement('input', { type: 'range', className: 'dsh-glass-range', min: 0, max: 1, step: 0.01, value: cfg.bgOpacity ?? 1, onChange: (e) => patch({ bgOpacity: Number(e.target.value) }) }),
3316
3377
  React.createElement('span', { className: 'dsh-glass-val' }, `${Math.round((Number(cfg.bgOpacity ?? 1)) * 100)}%`),
3317
3378
  ),
3318
- React.createElement('p', { className: 'dsh-glass-note' }, '提示:背景图铺满整页(可加背景图罩);背景图模糊/透明度单独可调;会话区使用自己的罩色、罩强度与透明度;左栏/顶部透出背景图;输入框保持系统原生样式。'),
3379
+ React.createElement('div', { className: 'dsh-glass-card' },
3380
+ React.createElement('div', { className: 'dsh-glass-zone-title' }, '输入框'),
3381
+ [['light', '浅色主题', '#ffffff'], ['dark', '深色主题', '#1c2530']].map(([t, label, native]) => {
3382
+ const tb = (cfg.inputBox && cfg.inputBox[t]) || { color: '', opacity: 1 }
3383
+ return React.createElement('div', { key: t, className: 'dsh-glass-input-theme' },
3384
+ React.createElement('div', { className: 'dsh-glass-theme-label' }, label),
3385
+ React.createElement('div', { className: 'dsh-glass-row' },
3386
+ React.createElement('label', null, '输入框颜色'),
3387
+ React.createElement('label', { className: 'dsh-glass-colorpicker' }, '色盘', React.createElement('input', { type: 'color', value: tb.color || native, onChange: (e) => patchInput(t, { color: e.target.value }) })),
3388
+ React.createElement('button', { type: 'button', style: { marginLeft: 8, fontSize: 12 }, onClick: () => patchInput(t, { color: '', opacity: 1 }) }, '原生'),
3389
+ ),
3390
+ React.createElement('div', { className: 'dsh-glass-row' },
3391
+ React.createElement('label', null, '不透明度'),
3392
+ React.createElement('input', { type: 'range', className: 'dsh-glass-range', min: 0, max: 1, step: 0.01, value: (typeof tb.opacity === 'number') ? tb.opacity : 1, onChange: (e) => patchInput(t, { opacity: Number(e.target.value) }) }),
3393
+ React.createElement('span', { className: 'dsh-glass-val' }, `${Math.round((typeof tb.opacity === 'number' ? tb.opacity : 1) * 100)}%`),
3394
+ ),
3395
+ )
3396
+ }),
3397
+ React.createElement('p', { className: 'dsh-glass-note' }, '浅色主题与深色主题可分别设置。100% = 实底不透明,越低越透出背景图;"原生" = 跟随该主题的 DSH 原生色。文字颜色按背景亮度自动配深/浅,保证可读。'),
3398
+ ),
3399
+ React.createElement('p', { className: 'dsh-glass-note' }, '提示:背景图铺满整页(可加背景图罩);背景图模糊/透明度单独可调;会话区使用自己的罩色、罩强度与透明度;左栏/顶部透出背景图;输入框颜色/不透明度可单独设置。'),
3319
3400
  React.createElement('div', { className: 'dsh-glass-actions' },
3320
3401
  React.createElement('button', { type: 'button', onClick: load }, '重置'),
3321
3402
  React.createElement('button', { type: 'button', className: 'primary', disabled: state.saving, onClick: save }, state.saving ? '保存中…' : '保存生效'),
@@ -3351,6 +3432,15 @@ window.__ModuleLoader__.load({
3351
3432
  }
3352
3433
  window.addEventListener('resize', centerScroll)
3353
3434
  window.__dshGlassCenter = centerScroll
3435
+ // 主题切换监听:观察 <html> 的 style/class;只创建一次(自触发的写入在 applyTheme 内先断开再重连,杜绝死循环)
3436
+ window.__dshGlassStyleObs = null
3437
+ if (!window.__dshGlassStyleObs) {
3438
+ window.__dshGlassStyleObs = new MutationObserver(() => window.__dshGlassApplyTheme && window.__dshGlassApplyTheme())
3439
+ window.__dshGlassStyleObs.observe(document.documentElement, { attributes: true, attributeFilter: ['style', 'class'] })
3440
+ }
3441
+ const themeMq = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)')
3442
+ const themeMqHandler = () => window.__dshGlassApplyTheme && window.__dshGlassApplyTheme()
3443
+ if (themeMq) themeMq.addEventListener('change', themeMqHandler)
3354
3444
  // win 风格文字:给左栏/顶栏内的可见文字元素加白色+深色描边;跳过弹窗(modal/overlay/dialog/settings/panel)内元素。
3355
3445
 
3356
3446
  window.__dshGlassApply = (cfg) => {
@@ -3370,6 +3460,15 @@ window.__ModuleLoader__.load({
3370
3460
  const bgEl = document.querySelector('.dsh-glass-bgimg'); if (bgEl) { bgEl.style.display = 'none' }
3371
3461
  return
3372
3462
  }
3463
+ // 读 DSH 真实主题(DSH 用 inline `color-scheme` 写在 <html style> 上,非 OS 偏好)
3464
+ const dshDark = () => /dark/i.test(getComputedStyle(document.documentElement).colorScheme)
3465
+ // 颜色亮度(0~1):用来自动决定文字用深色还是浅色,保证可读
3466
+ const relLum = (hex) => {
3467
+ const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(String(hex || ''))
3468
+ if (!m) return 0.5
3469
+ const map = (v) => { const s = parseInt(v, 16) / 255; return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4) }
3470
+ return 0.2126 * map(m[1]) + 0.7152 * map(m[2]) + 0.0722 * map(m[3])
3471
+ }
3373
3472
  root.setAttribute('data-dsh-glass', c.enabled ? 'on' : 'off')
3374
3473
  const sessOn = !(c.zone && c.zone.session && c.zone.session.enabled === false)
3375
3474
  root.setAttribute('data-dsh-session-glass', sessOn ? 'on' : 'off')
@@ -3386,20 +3485,65 @@ window.__ModuleLoader__.load({
3386
3485
  root.style.setProperty('--dsh-glass-session-white', `color-mix(in srgb, var(--dsw-specific-input-major, #e8edf3) ${Math.round((1 - sop) * 100)}%, transparent)`)
3387
3486
  const iop = Math.min(1, Math.max(0, Number.isFinite(Number(zi.opacity)) ? Number(zi.opacity) : 0.55))
3388
3487
  root.style.setProperty('--dsh-glass-input-white', `color-mix(in srgb, var(--dsw-specific-input-major, #e8edf3) ${Math.round((1 - iop) * 100)}%, transparent)`)
3389
- // 背景图罩:整页背景图上叠一层半透明罩色
3390
- const bgc = c.bgColor || '#1a2332'
3391
- const bgmn = Number(c.bgMask); const bgm = Math.min(0.95, Math.max(0, Number.isFinite(bgmn) ? bgmn : 0.28))
3392
- root.style.setProperty('--dsh-glass-bg-zone', `rgba(${hexToRgb(bgc)},${bgm})`)
3488
+
3489
+ // 背景图罩(整页背景图上叠一层半透明罩色):浅/深主题各一套 color+mask;
3490
+ // 兼容旧版单套 bgColor/bgMask
3491
+ const bgTint = (tk) => {
3492
+ const t = (c.bgTint && c.bgTint[tk]) || { color: c.bgColor || '#1a2332', mask: c.bgMask ?? 0.28 }
3493
+ const mask = Math.min(0.95, Math.max(0, Number.isFinite(Number(t && t.mask)) ? Number(t.mask) : 0.28))
3494
+ return { color: (t && t.color) || '#1a2332', mask }
3495
+ }
3496
+ // 给输入框卡片设内联实底+文字色,且用 !important,
3497
+ // 因为 DSH 核心样式用 background-color: transparent !important 压过普通内联样式;
3498
+ // 内联 !important 优先级最高,一定覆盖。颜色/不透明度来自配置 inputBox。
3499
+ const applyInputCard = () => {
3500
+ const inputCard = document.querySelector('#root [class*="uV2eYG_card"]')
3501
+ if (!inputCard) return
3502
+ const dark = dshDark()
3503
+ const ib = (c.inputBox && typeof c.inputBox === 'object') ? c.inputBox : {}
3504
+ // 浅色/深色各一套配置;兼容旧版单套 inputBox:{color,opacity}
3505
+ const tb = (ib.light && ib.dark) ? (dark ? ib.dark : ib.light) : ib
3506
+ const defBg = dark ? '#1c2530' : '#ffffff'
3507
+ // color: 空串/非法 => 用主题原生色;否则用用户指定的颜色
3508
+ const hasColor = tb && typeof tb.color === 'string' && /^#/.test(tb.color)
3509
+ const bgHex = hasColor ? tb.color : defBg
3510
+ const alpha = (tb && typeof tb.opacity === 'number' && Number.isFinite(tb.opacity)) ? Math.min(1, Math.max(0, tb.opacity)) : 1
3511
+ const bg = `rgba(${hexToRgb(bgHex)},${alpha})`
3512
+ const fg = relLum(bgHex) > 0.5 ? '#1a2332' : '#f5f7fa'
3513
+ inputCard.style.setProperty('background-color', bg, 'important')
3514
+ inputCard.style.setProperty('color', fg, 'important')
3515
+ // 子层(scroll/row)也是透明的,继承卡片文字色即可,确保可读
3516
+ inputCard.querySelectorAll('[class*="uV2eYG_scroll"],[class*="uV2eYG_row"]').forEach(el => {
3517
+ el.style.setProperty('color', fg, 'important')
3518
+ })
3519
+ }
3520
+ // 主题相关的东西统一重算:背景罩 + 输入框。切主题时由 observer/mq 触发。
3521
+ // 写入前先断开观察器,写完再重连,避免自触发造成死循环。
3522
+ const applyTheme = () => {
3523
+ const obs = window.__dshGlassStyleObs
3524
+ if (obs) obs.disconnect()
3525
+ try {
3526
+ const tk = dshDark() ? 'dark' : 'light'
3527
+ root.setAttribute('data-dsh-theme', tk)
3528
+ const bt = bgTint(tk)
3529
+ const v = `rgba(${hexToRgb(bt.color)},${bt.mask})`
3530
+ root.style.setProperty('--dsh-glass-bg-zone', v)
3531
+ applyInputCard()
3532
+ } finally {
3533
+ if (obs) obs.observe(document.documentElement, { attributes: true, attributeFilter: ['style', 'class'] })
3534
+ }
3535
+ }
3393
3536
 
3394
3537
  const body = document.body
3395
3538
  const frame = document.querySelector('#root > div > div') || document.querySelector('#root > div')
3396
- // 背景图独立层:铺满整页、位于内容之下;背景图模糊/透明度单独可调(不影响内容清晰度)
3539
+ // 背景图独立层:铺满整页、位于内容之下;背景图模糊/透明度单独可调(不影响内容清晰度)。
3540
+ // 背景罩用 CSS 变量 var(--dsh-glass-bg-zone),随主题切换自动刷新。
3397
3541
  let bgimg = document.querySelector('.dsh-glass-bgimg')
3398
3542
  if (!bgimg) { bgimg = document.createElement('div'); bgimg.className = 'dsh-glass-bgimg'; document.body.appendChild(bgimg) }
3399
- const gz = root.style.getPropertyValue('--dsh-glass-bg-zone') || `rgba(${hexToRgb(c.bgColor || '#1a2332')},0.28)`
3543
+ const gzv = root.style.getPropertyValue('--dsh-glass-bg-zone') || 'rgba(26,35,50,0.28)'
3400
3544
  if (c.enabled && c.bgImage) {
3401
3545
  bgimg.style.display = 'block'
3402
- bgimg.style.backgroundImage = `linear-gradient(${gz},${gz}), url('${c.bgImage}')`
3546
+ bgimg.style.backgroundImage = `linear-gradient(var(--dsh-glass-bg-zone, ${gzv}), var(--dsh-glass-bg-zone, ${gzv})), url('${c.bgImage}')`
3403
3547
  bgimg.style.backgroundSize = 'cover'
3404
3548
  bgimg.style.backgroundPosition = 'center'
3405
3549
  bgimg.style.backgroundRepeat = 'no-repeat'
@@ -3414,15 +3558,22 @@ window.__ModuleLoader__.load({
3414
3558
  body.style.backgroundImage = 'none'
3415
3559
  if (c.enabled && c.bgImage) { body.style.backgroundColor = 'transparent' } else { body.style.backgroundColor = '' }
3416
3560
  if (frame) { frame.style.backgroundImage = 'none'; frame.style.backgroundColor = 'transparent' }
3561
+
3562
+ applyTheme()
3563
+ // 记录当前主题应用函数,供唯一观察器/mq 调用
3564
+ window.__dshGlassApplyTheme = applyTheme
3417
3565
  centerScroll()
3418
3566
  }
3419
3567
  return () => {
3420
3568
  window.__dshGlassApply = undefined
3421
3569
  window.removeEventListener('resize', centerScroll)
3422
3570
  window.__dshGlassCenter = undefined
3571
+ if (window.__dshGlassStyleObs) { window.__dshGlassStyleObs.disconnect(); window.__dshGlassStyleObs = null }
3572
+ if (themeMq) themeMq.removeEventListener('change', themeMqHandler)
3573
+ window.__dshGlassApplyTheme = undefined
3423
3574
  }
3424
3575
  }, 'dsh-long-plugins: glass applier')
3425
- ctx.slots.inject('settings.section', () => ctx.slots.register({ name: 'settings.section', id: 'glass-ui', order: 40, label: '毛玻璃界面' }, GlassSettingsSection))
3576
+ ctx.slots.inject('settings.section', () => ctx.slots.register({ name: 'settings.section', id: 'glass-ui', order: 40, label: 'RA-Span' }, GlassSettingsSection))
3426
3577
  ctx.effect(() => {
3427
3578
  fetch('/api/dsh-uploads/glass-config', { cache: 'no-store' }).then((r) => r.json()).then((b) => {
3428
3579
  if (b && b.cfg) { window.__dshGlassApply && window.__dshGlassApply({ ...b.cfg, bgImage: b.bgImage }) }
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-long-plugins",
3
3
  "description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, Markdown-to-Word (md2docx), and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Markdown 转 Word(md2docx)、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。",
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "entry": {
6
6
  "name": "dsh-long-plugins",
7
7
  "inject": [
package/lib/index.js CHANGED
@@ -683,6 +683,36 @@ function sanitizeGlass(input) {
683
683
  if ("bgMask" in input) { const n = Number(input.bgMask); out.bgMask = Number.isFinite(n) ? Math.max(0, Math.min(0.95, n)) : undefined; }
684
684
  if ("bgBlur" in input) { const n = Number(input.bgBlur); out.bgBlur = Number.isFinite(n) ? Math.max(0, Math.min(80, n)) : undefined; }
685
685
  if ("bgOpacity" in input) { const n = Number(input.bgOpacity); out.bgOpacity = Number.isFinite(n) ? Math.max(0, Math.min(1, n)) : undefined; }
686
+ // 背景罩(整页背景图上叠的罩色):浅/深主题各一套 color + mask(罩强度)
687
+ if (input.bgTint && typeof input.bgTint === "object") {
688
+ const bt = {};
689
+ for (const key of ["light", "dark"]) {
690
+ const z = input.bgTint[key];
691
+ if (z && typeof z === "object") {
692
+ const o = {};
693
+ if ("color" in z) o.color = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(String(z.color)) ? String(z.color) : "#1a2332";
694
+ if ("mask" in z) { const n = Number(z.mask); o.mask = Number.isFinite(n) ? Math.max(0, Math.min(0.95, n)) : 0.28; }
695
+ bt[key] = Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
696
+ }
697
+ }
698
+ if (Object.keys(bt).length) out.bgTint = bt;
699
+ }
700
+ // 输入框(独立于 zone.input 的 DSH 玻璃变量):浅/深主题各一套 custom color + opacity(1=实底)。color 空串=用主题原生色
701
+ if (input.inputBox && typeof input.inputBox === "object") {
702
+ const ib = {};
703
+ for (const key of ["light", "dark"]) {
704
+ const z = input.inputBox[key];
705
+ if (z && typeof z === "object") {
706
+ const o = {};
707
+ const c = z.color;
708
+ if (c === "" || c === null || c === undefined) o.color = "";
709
+ else o.color = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(String(c)) ? String(c) : "";
710
+ if ("opacity" in z) { const n = Number(z.opacity); o.opacity = Number.isFinite(n) ? Math.max(0, Math.min(1, n)) : 1; }
711
+ ib[key] = Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
712
+ }
713
+ }
714
+ if (Object.keys(ib).length) out.inputBox = ib;
715
+ }
686
716
  // 会话区/输入区各自独立罩色+罩强度
687
717
  if (input.zone && typeof input.zone === "object") {
688
718
  const zo = {};
@@ -1595,6 +1625,8 @@ window.addEventListener('resize',function(){ try{ if(fitMode) zoomFit(); else ap
1595
1625
  // color=叠加/罩色;bgImage=共用背景图。顶栏/左栏的"罩"与整页共用 mask+color(不再单独存,简化)。
1596
1626
  const GLASS_DEFAULTS = {
1597
1627
  enabled: false, blur: 20, bgImage: "", bgColor: "#1a2332", bgMask: 0.28,
1628
+ bgTint: { light: { color: "#1a2332", mask: 0.28 }, dark: { color: "#1a2332", mask: 0.28 } },
1629
+ inputBox: { light: { color: "", opacity: 1 }, dark: { color: "", opacity: 1 } },
1598
1630
  zone: { session: { color: "#1a2332", mask: 0.45, opacity: 0.5 }, input: { color: "#1a2332", mask: 0.6, opacity: 0.55 } },
1599
1631
  };
1600
1632
  const glassDir = resolve(homedir(), ".dsh-long-plugins");
@@ -1614,6 +1646,8 @@ window.addEventListener('resize',function(){ try{ if(fitMode) zoomFit(); else ap
1614
1646
  enabled: cfg.enabled, blur: cfg.blur,
1615
1647
  session: cfg.zone?.session || { enabled: true, color: "#1a2332", mask: 0.45, opacity: 0.5 },
1616
1648
  input: cfg.zone?.input || { color: "#1a2332", mask: 0.6, opacity: 0.55 },
1649
+ inputBox: cfg.inputBox || { light: { color: "", opacity: 1 }, dark: { color: "", opacity: 1 } },
1650
+ bgTint: cfg.bgTint || { light: { color: "#1a2332", mask: 0.28 }, dark: { color: "#1a2332", mask: 0.28 } },
1617
1651
  bgColor: cfg.bgColor || "#1a2332", bgMask: cfg.bgMask ?? 0.28,
1618
1652
  bgImage: cfg.bgImage ? { present: true, bytes: Math.round((cfg.bgImage.length * 3) / 4) } : { present: false },
1619
1653
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-long-plugins",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, Markdown-to-Word (md2docx), and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Markdown 转 Word(md2docx)、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。",
5
5
  "type": "module",
6
6
  "license": "MIT",