dsh-opencode-palette 1.5.1 → 1.6.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/lib/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * dsh-opencode-palette v1.5.1 — 浏览器半(构建产物,勿手改)
2
+ * dsh-opencode-palette v1.6.0 — 浏览器半(构建产物,勿手改)
3
3
  * 数据驱动管线:opencode v1.18.12 官方主题 JSON → 颜色解析 → DSH 适配注入
4
4
  * 源:src/engine/* + runtime/client.mjs(npm run build 重新生成)
5
5
  */
@@ -363,6 +363,25 @@ function generateTheme(colors, typography, themeName) {
363
363
  __mods["generate"] = { buildTokens, buildTypographyCss, buildColorCss, generateTheme }
364
364
  })();
365
365
  (function () {
366
+ // zh-names.mjs — 主题中文名表(单一来源)
367
+ // 供运行时面板(中文界面显示中文主题名)与 assets 生成器(矩阵/故事卡中文名)共用。
368
+ // 无中文译名者(opencode / One Dark / Monokai / Cursor / GitHub / Vercel)保留原名。
369
+
370
+ const THEME_ZH = {
371
+ opencode: "opencode", tokyonight: "东京之夜", dracula: "德古拉", gruvbox: "复古凹槽",
372
+ matrix: "黑客帝国", "rose-pine": "玫瑰松林", catppuccin: "卡布奇诺", "catppuccin-frappe": "卡布奇诺·冰沙",
373
+ "catppuccin-macchiato": "卡布奇诺·玛奇朵", solarized: "日光浴", synthwave84: "合成波 84",
374
+ everforest: "常青森林", nord: "北极", kanagawa: "神奈川", nightowl: "夜猫子",
375
+ "one-dark": "One Dark", monokai: "Monokai", palenight: "苍白之夜", material: "材料设计",
376
+ ayu: "鮎", carbonfox: "碳狐", cobalt2: "钴蓝", cursor: "Cursor", aura: "光环",
377
+ flexoki: "纸墨", github: "GitHub", zenburn: "禅燃", mercury: "水星",
378
+ "osaka-jade": "大阪翡翠", vesper: "黄昏星", vercel: "Vercel", "lucent-orng": "透光橙",
379
+ orng: "纯橙", system: "跟随系统",
380
+ }
381
+
382
+ __mods["zh-names"] = { THEME_ZH }
383
+ })();
384
+ (function () {
366
385
  // registry.mjs — 主题注册表:33 个静态主题(vendored JSON)+ system 特殊主题
367
386
  // 数据由 scripts/sync-themes.mjs 从 opencode v1.18.12 官方 tag 同步(见 MANIFEST.json 指纹)
368
387
  const aura = {
@@ -7962,6 +7981,7 @@ __mods["index"] = { renderTheme, previewColors, themeNames, themeGroups, GROUP_O
7962
7981
  // 依赖注入:theme(dsh-client-ui-theme)、slots(settings.plugins.tab / tool.view.cordis)
7963
7982
  const { renderTheme, previewColors, themeNames, themeGroups } = __mods["index"]
7964
7983
  const { FONTS, SANS_STACK } = __mods["map-dsh"]
7984
+ const { THEME_ZH } = __mods["zh-names"]
7965
7985
 
7966
7986
  const STORAGE_KEY = 'dsh.opencode-palette.v2'
7967
7987
  // 兼容迁移:旧插件(dsh-opencode-tui-theme)的本地设置键,读到即迁移到新键
@@ -8174,11 +8194,15 @@ function createClient(slotTarget) {
8174
8194
  const shown = q === ''
8175
8195
  ? props.groups()
8176
8196
  : props.groups()
8177
- .map(function (g) { return { name: g.name, color: g.color, themes: g.themes.filter(function (t) { return t.name.indexOf(q) >= 0 }) } })
8197
+ .map(function (g) { return { name: g.name, color: g.color, themes: g.themes.filter(function (t) { return (t.name + ' ' + (THEME_ZH[t.name] || '')).toLowerCase().indexOf(q) >= 0 }) } })
8178
8198
  .filter(function (g) { return g.themes.length > 0 })
8179
8199
 
8180
8200
  const muted = 'var(--dsw-alias-label-secondary)'
8181
8201
  const base = 'var(--dsw-alias-label-primary)'
8202
+ // 主题显示名:中文界面用中文名(system 走 i18n 文案)
8203
+ const themeLabel = function (name) {
8204
+ return currentLang === 'zh' && name !== 'system' ? (THEME_ZH[name] || name) : name
8205
+ }
8182
8206
  const fieldLabel = { fontSize: 11, color: muted }
8183
8207
  const secTitle = { fontSize: 11, color: muted, letterSpacing: '.08em', marginBottom: 8, display: 'flex', alignItems: 'baseline', gap: 8 }
8184
8208
  const countStyle = { color: 'var(--dsw-alias-label-dimmed)', fontSize: 11, letterSpacing: 0 }
@@ -8243,7 +8267,7 @@ function createClient(slotTarget) {
8243
8267
  },
8244
8268
  }, [
8245
8269
  dot(c && c.primary, 9),
8246
- t.name === 'system' ? tr('systemDefault') : t.name,
8270
+ t.name === 'system' ? tr('systemDefault') : themeLabel(t.name),
8247
8271
  isCur ? h('span', { style: { color: 'var(--dsw-alias-brand-primary)', fontWeight: 700 } }, '✓') : null,
8248
8272
  ])
8249
8273
  }
@@ -8350,32 +8374,49 @@ function createClient(slotTarget) {
8350
8374
  }),
8351
8375
  ])
8352
8376
  }
8377
+ // 面板 API(settings.plugins.tab 与 settings.section 两个入口共享同一份 state)
8378
+ const paletteApi = function () {
8379
+ return {
8380
+ getState: getState,
8381
+ toggle: toggle,
8382
+ refresh: refresh,
8383
+ setTheme: setTheme,
8384
+ themeNames: themeNames,
8385
+ groups: function () { return themeGroups() },
8386
+ subscribeLocale: function (fn) {
8387
+ localeListeners.push(fn)
8388
+ return function () {
8389
+ const i = localeListeners.indexOf(fn)
8390
+ if (i >= 0) localeListeners.splice(i, 1)
8391
+ }
8392
+ },
8393
+ previews: function () { return themeNames().map(function (n) { return { name: n, colors: previewColors(n) } }) },
8394
+ }
8395
+ }
8353
8396
  disposePanel = slots.inject(slotTarget, function () {
8354
8397
  return slots.register({
8355
8398
  name: slotTarget,
8356
8399
  id: 'opencode-palette',
8357
8400
  order: 30,
8358
8401
  label: function () { return tr('panelName') },
8359
- inject: function () {
8360
- return {
8361
- getState: getState,
8362
- toggle: toggle,
8363
- refresh: refresh,
8364
- setTheme: setTheme,
8365
- themeNames: themeNames,
8366
- groups: function () { return themeGroups() },
8367
- subscribeLocale: function (fn) {
8368
- localeListeners.push(fn)
8369
- return function () {
8370
- const i = localeListeners.indexOf(fn)
8371
- if (i >= 0) localeListeners.splice(i, 1)
8372
- }
8373
- },
8374
- previews: function () { return themeNames().map(function (n) { return { name: n, colors: previewColors(n) } }) },
8375
- }
8376
- },
8402
+ inject: paletteApi,
8377
8403
  }, Panel)
8378
8404
  })
8405
+ // 设置页左侧导航直达入口(保留「设置 → 插件」内的原入口)
8406
+ // settings.section = 设置页左侧 section 列表(general=0 / models=10 / plugins=15 / agent-presets=20)
8407
+ let disposeSection = null
8408
+ if (slotTarget === 'settings.plugins.tab') {
8409
+ disposeSection = slots.inject('settings.section', function () {
8410
+ return slots.register({
8411
+ name: 'settings.section',
8412
+ id: 'opencode-palette',
8413
+ order: 16,
8414
+ label: function () { return tr('panelName') },
8415
+ inject: paletteApi,
8416
+ }, Panel)
8417
+ })
8418
+ }
8419
+ disposeSection = disposeSection || null
8379
8420
  }
8380
8421
 
8381
8422
  // 卸载清理(cordis 语义:effect fn 立即执行,返回值才是清理器)
@@ -8383,6 +8424,7 @@ function createClient(slotTarget) {
8383
8424
  return function () {
8384
8425
  try { clearStyle() } catch (e) { /* 忽略 */ }
8385
8426
  try { if (disposePanel) disposePanel() } catch (e) { /* 忽略 */ }
8427
+ try { if (disposeSection) disposeSection() } catch (e) { /* 忽略 */ }
8386
8428
  try { if (globalThis.__opencodePalette) delete globalThis.__opencodePalette } catch (e) { /* 忽略 */ }
8387
8429
  try { if (localeObserver) localeObserver.disconnect() } catch (e) { /* 忽略 */ }
8388
8430
  }
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * dsh-opencode-palette v1.5.1 — 宿主半(no-op)
2
+ * dsh-opencode-palette v1.6.0 — 宿主半(no-op)
3
3
  *
4
4
  * 主题的全部工作在浏览器端(./client.js)完成:
5
5
  * - 34 个 opencode 主题(33 内置 JSON + system)经数据驱动管线解析
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-opencode-palette",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "让 DeepSeek Harness 穿上 34 款经典皮肤——东京的霓虹夜色、德古拉的暗红月光、复古工坊的暖黄灯火、黑客帝国的数字雨、玫瑰松林间的风……一键换肤,即点即换,重启不丢。34 legendary skins for DeepSeek Harness — tokyonight's neon dusk, dracula's crimson moon, gruvbox's retro glow, the matrix's digital rain, rose-pine's rosewood calm… one click, instant, persisted.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",