dsh-theme-palette 1.12.0 → 1.13.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  ## 版本一览
6
6
 
7
+ ### 1.13.0
8
+ 新增斜杠命令 `/theme-palette`:切换配色从 4 步(头像 → 设置 → 主题色 → 点卡片)变成 1 步 —— 输入 `/theme-palette` 弹出 5 套配色(黑白 / 暖砂 / 靛蓝 / 苔绿 / 自定义),当前配色带 active 标记,选中即切换并保存。
9
+
10
+ - **命令注册走可选依赖**:`ctx.inject(['commandUi'], …)`,宿主没有该服务时静默不挂,插件本体不受影响(不写进模块级 `inject`,否则缺服务会连插件一起拖住)。
11
+ - **两条来自生产先例的坑注记**(照 `dsh-free-search` 的注册骨架抄,`label`/`description` **必须传函数** —— 传字符串会让 ui-commands 读回时抛 TypeError,整份 `/` 候选列表一起失败、菜单空白、别的命令也点不到;命令名带前缀,避免与宿主命令目录撞名 —— `candidates()` 对撞名是直接 throw,同样炸整个菜单)。
12
+ - **回归覆盖**:`check-selfheal` 新增第 8 场景 —— 命令注册成功、`label`/`description` 均为函数、`ui.kind = popupSelect`、`options` 返回 5 项且恰有一个 active、`onSelect` 切换恰好 +1 次 `overrideTokens`、卸载时注册一并摘除。
13
+
7
14
  ### 1.12.0
8
15
  2026-10-28 一次外部审计(20 条问题,逐条核实后修订 14 条)。核心是**修好一个一直在发生的真 bug**:切换配色后颜色会跳回默认 —— 原因是自愈机制把自己刚装上的覆盖层撤掉了。此外把「失效不可见」「承诺与实现对不上」「发版门漏检」三类问题一并收口。
9
16
 
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  {
2
- "generatedAt": "2026-10-28T15:00:37.455Z",
3
- "pluginVersion": "1.12.0",
4
- "chrome": "Chrome/156.0.8078.48",
2
+ "generatedAt": "2026-10-29T04:10:00.434Z",
3
+ "pluginVersion": "1.13.0",
4
+ "chrome": "Chrome/156.0.8078.49",
5
5
  "width": 620,
6
6
  "scale": 1,
7
7
  "images": [
@@ -14,13 +14,13 @@
14
14
  "--adv",
15
15
  "0"
16
16
  ],
17
- "htmlSha256": "289761e97cde3f6f17747a1339be0ab2323ebfbb53a1cf49e0581e4068ca8b53",
17
+ "htmlSha256": "1a7a3756df07d60b8786a529826f98437931dfcab87ca4eb8b683534ebebfe7c",
18
18
  "cssWidth": 620,
19
19
  "cssHeight": 888,
20
20
  "width": 620,
21
21
  "height": 888,
22
- "bytes": 47332,
23
- "sha256": "f5891388817d2d728573370097bb81a5a0cbafecf5ad5f7be80e3e1ae89e357f"
22
+ "bytes": 47321,
23
+ "sha256": "0067707bc33b771982caa4e56124afb5cbb834252d1f920cb3bf7a0029d1accb"
24
24
  },
25
25
  {
26
26
  "file": "assets/screenshot-settings-dark.png",
@@ -31,13 +31,13 @@
31
31
  "--adv",
32
32
  "0"
33
33
  ],
34
- "htmlSha256": "cd396af525f555f9d7355be12c80ac737b2d57b069ba08e2297869bace8efade",
34
+ "htmlSha256": "d39655d79d4fdad287a0c9d0f11b3f516093f3bb9a367a1ead956ae7e40f70ca",
35
35
  "cssWidth": 620,
36
36
  "cssHeight": 888,
37
37
  "width": 620,
38
38
  "height": 888,
39
- "bytes": 47861,
40
- "sha256": "ea763c8330fdf8deccf7d230a21c8469679e79d30f62931f0a26c1dbc9ac7f97"
39
+ "bytes": 47853,
40
+ "sha256": "e96a4d6df4a57167d6dc0a828f6f9965360b69448cf822ce2ff310dfe8a87c07"
41
41
  },
42
42
  {
43
43
  "file": "assets/screenshot-settings-custom.png",
@@ -50,13 +50,13 @@
50
50
  "--out",
51
51
  "customadv"
52
52
  ],
53
- "htmlSha256": "52d45d45630c16aecb0cfa33989941dc27b451caed679703544b1a157d9f9bcc",
53
+ "htmlSha256": "9c8bc96958aa0f71fa53270e615d4b2f73e9f8c77ea8ac64c5e7e218a4bcd952",
54
54
  "cssWidth": 620,
55
55
  "cssHeight": 1753,
56
56
  "width": 620,
57
57
  "height": 1753,
58
- "bytes": 116292,
59
- "sha256": "892d8303d41e3dadd10569a73659fded652f20555006fc905c4908720f18d827"
58
+ "bytes": 116275,
59
+ "sha256": "0af31aa00159c70cf6d14e13973e991d8af99fe2dc9917881a5a59dc03cca54b"
60
60
  },
61
61
  {
62
62
  "file": "assets/screenshot-settings-hc.png",
@@ -69,13 +69,13 @@
69
69
  "--out",
70
70
  "hcadv"
71
71
  ],
72
- "htmlSha256": "a32aea3db6fee381795c7c9af6f695ba4bfe3c415ae0d36ee467221b3dd091cd",
72
+ "htmlSha256": "700aa2862c6f732e41d615363c3624e608c2890669fe817496aece5329528ebe",
73
73
  "cssWidth": 620,
74
74
  "cssHeight": 1463,
75
75
  "width": 620,
76
76
  "height": 1463,
77
- "bytes": 94272,
78
- "sha256": "6360409c0dc2e4dadc729bd5b4cc4b3df8ac32760420a057eaf8d206d2b478a6"
77
+ "bytes": 94256,
78
+ "sha256": "5648c6237f902c37d986aa0893266dbe2a50048b741f1353790522cbc68e0fb0"
79
79
  }
80
80
  ]
81
81
  }
package/client.js CHANGED
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
27
27
  const React = require('react')
28
28
  const h = React.createElement
29
29
 
30
- const PLUGIN_VERSION = '1.12.0'
30
+ const PLUGIN_VERSION = '1.13.0'
31
31
  const STORE_KEY = 'dsh-theme-palette.v1'
32
32
  const OVERRIDE_SOURCE = 'dsh-theme-palette'
33
33
 
@@ -2322,6 +2322,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2322
2322
  healedSuffix: ' 次',
2323
2323
  healStopped: '⚠ 自动恢复已停用(连续失败 {n} 次),主题可能无法自动回到你的配色。',
2324
2324
  healRetry: '重新启用自动恢复',
2325
+ cmdDesc: '切换主题配色(4 套预设 + 自定义)',
2325
2326
  text: '强度',
2326
2327
  sidebar: '左侧栏底色',
2327
2328
  lang: '语言',
@@ -2331,7 +2332,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2331
2332
  derive: '由主色派生',
2332
2333
  deriveHint: '用当前强调色的色相与色度推导底色与文字(明暗跟随当前模式)',
2333
2334
  deriveNote: '「由主色派生」以强调色为唯一输入,自动算出底色与文字 —— 会覆盖你手动设置的底色与文字;派生之后仍可逐项手改。',
2334
- notice: '1.12.0:修复「切换配色后颜色跳回默认」——自愈曾把自己刚装上的层撤掉;自动恢复停用时会在设置页给出提示并可一键重新启用;宿主改掉 token 名时现在能被发现(此前会静默失效)。',
2335
+ notice: '1.13.0:新增斜杠命令 /theme-palette —— 输入即可切换配色(4 套预设 + 自定义,当前配色带选中标记),不必再走「头像 → 设置 → 主题色 → 点卡片」四步。',
2335
2336
  dismiss: '知道了',
2336
2337
  explainClamp: '强调色已归一化:{from} → {to}(保证按钮与勾选可读)',
2337
2338
  explainLink: '链接已为可读性压暗:{ratio}:1(目标 {target}:1)',
@@ -2393,6 +2394,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2393
2394
  healedSuffix: ' 次',
2394
2395
  healStopped: '⚠ 自動恢復已停用(連續失敗 {n} 次),主題可能無法自動回到你的配色。',
2395
2396
  healRetry: '重新啟用自動恢復',
2397
+ cmdDesc: '切換主題配色(4 套預設 + 自訂)',
2396
2398
  text: '強度',
2397
2399
  sidebar: '左側欄底色',
2398
2400
  lang: '語言',
@@ -2402,7 +2404,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2402
2404
  derive: '由主色派生',
2403
2405
  deriveHint: '用目前強調色的色相與彩度推導底色與文字(明暗跟隨目前模式)',
2404
2406
  deriveNote: '「由主色派生」以強調色為唯一輸入,自動算出底色與文字 —— 會覆蓋你手動設置的底色與文字;派生之後仍可逐項手改。',
2405
- notice: '1.12.0:修復「切換配色後顏色跳回預設」——自癒曾把自己剛裝上的層撤掉;自動恢復停用時會在設定頁給出提示並可一鍵重新啟用;宿主改掉 token 名時現在能被發現(此前會靜默失效)。',
2407
+ notice: '1.13.0:新增斜杠命令 /theme-palette —— 輸入即可切換配色(4 套預設 + 自訂,目前配色帶選中標記),不必再走「頭像 → 設定 → 主題色 → 點卡片」四步。',
2406
2408
  dismiss: '知道了',
2407
2409
  explainClamp: '強調色已正規化:{from} → {to}(確保按鈕與勾選可讀)',
2408
2410
  explainLink: '連結已為可讀性壓暗:{ratio}:1(目標 {target}:1)',
@@ -2464,6 +2466,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2464
2466
  healedSuffix: 'x',
2465
2467
  healStopped: '⚠ Auto-restore is disabled ({n} consecutive failures). Your palette may not come back on its own.',
2466
2468
  healRetry: 'Re-enable auto-restore',
2469
+ cmdDesc: 'Switch the theme palette (4 presets + custom)',
2467
2470
  text: 'Strength',
2468
2471
  sidebar: 'Sidebar surface',
2469
2472
  lang: 'Language',
@@ -2473,7 +2476,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2473
2476
  derive: 'Derive from accent',
2474
2477
  deriveHint: 'Derive background and text from the current accent hue and chroma (follows the current light/dark mode)',
2475
2478
  deriveNote: '"Derive from accent" takes the accent as its only input and computes background and text from it — this overwrites the background and text you set by hand; you can still edit each of them afterwards.',
2476
- notice: '1.12.0: fixes "the colour jumps back to default after switching palettes" — self-healing used to remove the very layer it had just installed; when auto-restore gives up the settings page now says so and offers a one-click re-enable; a host that renames its tokens is now detected instead of failing silently.',
2479
+ notice: '1.13.0: new slash command /theme-palette — type it to switch palettes (4 presets + custom, current one marked); no more avatar → Settings → Color theme → card.',
2477
2480
  dismiss: 'Got it',
2478
2481
  explainClamp: 'Accent normalised: {from} → {to} (keeps buttons and checks readable)',
2479
2482
  explainLink: 'Link darkened for readability: {ratio}:1 (target {target}:1)',
@@ -2535,6 +2538,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2535
2538
  healedSuffix: ' 回)',
2536
2539
  healStopped: '⚠ 自動復元が停止しました(連続 {n} 回失敗)。配色が自動では戻らない可能性があります。',
2537
2540
  healRetry: '自動復元を再開',
2541
+ cmdDesc: 'テーマ配色を切り替える(4 プリセット + カスタム)',
2538
2542
  text: '強さ',
2539
2543
  sidebar: '左サイドバーの背景',
2540
2544
  lang: '言語',
@@ -2544,7 +2548,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2544
2548
  derive: 'メイン色から生成',
2545
2549
  deriveHint: '現在のアクセント色の色相と彩度から背景色と文字色を生成します(明暗は現在のモードに従います)',
2546
2550
  deriveNote: '「メイン色から生成」はアクセント色だけを入力として背景色と文字色を自動計算します。手動で設定した背景色と文字色は上書きされます(生成後に個別に変更できます)。',
2547
- notice: '1.12.0:「パレットを切り替えると色が既定に戻る」問題を修正しました(自動修復が、インストール直後のレイヤーを自分で取り除いてしまうことがありました)。自動修復が停止したときは設定ページに通知し、ワンクリックで再開できます。ホストが token 名を変更した場合も検出できるようになり、以前は静かに無効化されるだけでした。',
2551
+ notice: '1.13.0:新しいスラッシュコマンド /theme-palette(入力して配色を切り替え:4 プリセット + カスタム、現在選択中のものにチェックが付きます)。「アバター → 設定 → テーマカラー → カード」の 4 クリックが不要になりました。',
2548
2552
  dismiss: '了解',
2549
2553
  explainClamp: 'アクセント色を正規化しました:{from} → {to}(ボタンとチェックの可読性のため)',
2550
2554
  explainLink: 'リンクを可読性のため暗くしました:{ratio}:1(目標 {target}:1)',
@@ -3874,6 +3878,42 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
3874
3878
  PaletteSection,
3875
3879
  ),
3876
3880
  )
3881
+
3882
+ // /theme-palette 斜杠命令(2026-10-29,P2-K):4 步切换(头像 → 设置 → 主题色 → 点卡片)变 1 步。
3883
+ // 走 ctx.inject 做可选依赖:宿主没有 commandUi 服务时静默不挂,不影响主题本体。
3884
+ // 照 dsh-free-search 的生产先例抄骨架,两条它的坑注记一并遵守:
3885
+ // ① description/label 必须传**函数**——传字符串会让 ui-commands 读回时抛 TypeError,
3886
+ // 整份 "/" 候选列表一起失败(菜单空白、别的命令也点不到);
3887
+ // ② 名字带前缀避免与宿主命令目录撞名——candidates() 对撞名是直接 throw,同样炸整个菜单。
3888
+ try {
3889
+ ctx.inject(['commandUi'], (sctx) => {
3890
+ const command = sctx.get('commandUi')
3891
+ sctx.effect(() => {
3892
+ const dispose = command.register({
3893
+ name: 'theme-palette',
3894
+ label: () => TEXT[pickLocale(readLangPref())].nav,
3895
+ description: () => TEXT[pickLocale(readLangPref())].cmdDesc,
3896
+ available: () => true,
3897
+ ui: {
3898
+ kind: 'popupSelect',
3899
+ options: async () => {
3900
+ const loc = pickLocale(readLangPref())
3901
+ const lb = LABELS[loc] || LABELS['zh-CN']
3902
+ return SCHEMES.map((s) => ({
3903
+ id: s.id,
3904
+ label: lb.scheme[s.id] || s.label,
3905
+ active: s.id === current,
3906
+ }))
3907
+ },
3908
+ onSelect: async (option) => { setPalette(option.id) },
3909
+ },
3910
+ })
3911
+ return dispose
3912
+ })
3913
+ })
3914
+ } catch (err) {
3915
+ console.warn('[dsh-theme-palette] /theme-palette 命令注册失败(不影响配色本体):', err)
3916
+ }
3877
3917
  },
3878
3918
  }
3879
3919
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-theme-palette",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "DSH 主题配色:4 套配色 × 明暗两模式,OKLCH 色域安全重建 + 真实承载面对比度求解,可调强度与面板表面。",
5
5
  "type": "module",
6
6
  "main": "index.js",