dsh-edit-turn 0.5.22 → 0.5.24

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 CHANGED
@@ -371,11 +371,39 @@ window.__ModuleLoader__.load({
371
371
  clearVar('--dshet-panel')
372
372
  clearVar('--dshet-chip')
373
373
  clearVar('--dshet-field')
374
+ clearVar('--dshet-ink')
375
+ clearVar('--dshet-ink-dim')
376
+ clearVar('--dshet-ink-soft')
374
377
  } else {
375
378
  const fieldSolid = solid(layer2) ?? panelSolid
376
379
  setVar('--dshet-panel', css(panelSolid))
377
380
  setVar('--dshet-chip', css(panelSolid))
378
381
  setVar('--dshet-field', css(fieldSolid))
382
+ // 文字颜色必须和「我们自己画的那块底」配,而不是和主题的底色配:
383
+ // 皮肤可能只覆盖了表面色、没覆盖 label-primary(或把它定义在别的
384
+ // 作用域),这时 `var(--dsw-alias-label-primary, #0f1524)` 会落到近黑,
385
+ // 深色面板上就是「黑底黑字」——看起来像整块黑板。
386
+ // 用面板亮度直接决定前景色。
387
+ const channel = (value) => {
388
+ const v = value / 255
389
+ return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4
390
+ }
391
+ const panelLuminance = 0.2126 * channel(panelSolid.r) + 0.7152 * channel(panelSolid.g) + 0.0722 * channel(panelSolid.b)
392
+ const declaredInk = read('--dsw-alias-label-primary')
393
+ const readableOnDark = panelLuminance < 0.4
394
+ const declaredContrast = declaredInk === null
395
+ ? 0
396
+ : Math.abs(0.2126 * channel(declaredInk.r) + 0.7152 * channel(declaredInk.g) + 0.0722 * channel(declaredInk.b) - panelLuminance)
397
+ if (declaredContrast < 0.24) {
398
+ // 主题给的前景在这个面板上没有对比度(或根本没给)——自己配一套。
399
+ setVar('--dshet-ink', readableOnDark ? '#f2f4f8' : '#0f1524')
400
+ setVar('--dshet-ink-dim', readableOnDark ? 'rgba(242,244,248,.76)' : 'rgba(15,21,36,.72)')
401
+ setVar('--dshet-ink-soft', readableOnDark ? 'rgba(242,244,248,.58)' : 'rgba(15,21,36,.55)')
402
+ } else {
403
+ clearVar('--dshet-ink')
404
+ clearVar('--dshet-ink-dim')
405
+ clearVar('--dshet-ink-soft')
406
+ }
379
407
  }
380
408
  if (accent === null) {
381
409
  clearVar('--dshet-on-accent')
package/lib/index.js CHANGED
@@ -78,7 +78,7 @@ export const PLUGIN_ID = 'dsh-edit-turn'
78
78
  export const name = PLUGIN_ID
79
79
 
80
80
  /** Keep in sync with package.json and lib/client.js. */
81
- export const PLUGIN_VERSION = '0.5.22'
81
+ export const PLUGIN_VERSION = '0.5.24'
82
82
 
83
83
  // A ring of the last few requests, answering "did the browser half even ask, and
84
84
  // what did it get?" without needing its console. Read-only diagnostics: the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-edit-turn",
3
- "version": "0.5.22",
3
+ "version": "0.5.24",
4
4
  "description": "Edit any message in DeepSeek Harness in place: a prompt is replaced where it stands; a model reply block (answer text or reasoning) is patched through a plugin record and a message projection, so the turn stays where it is, later turns are untouched and the log grows by one small record. Falls back to the replay splice on hosts without the projection API. The append-only session log is never rewritten.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",