dsh-opencode-palette 2.0.2 → 2.0.4
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 +78 -15
- package/package.json +4 -1
package/lib/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-opencode-palette v2.0.
|
|
2
|
+
* dsh-opencode-palette v2.0.4 — 浏览器半(构建产物,勿手改)
|
|
3
3
|
* 数据驱动管线:opencode v1.18.12 官方主题 JSON → 颜色解析 → DSH 适配注入
|
|
4
4
|
* 面板「检查更新」:dsh-plugin-update 客户端入口经构建期内联(vendor)
|
|
5
5
|
* 源:src/engine/* + runtime/*.mjs + npm 包 dsh-log / dsh-plugin-update 的客户端入口
|
|
@@ -971,7 +971,8 @@ const TOKEN_MAP = [
|
|
|
971
971
|
['--dsw-alias-bg-overlay', 'background'],
|
|
972
972
|
['--dsw-alias-bg-layer-3', 'background'],
|
|
973
973
|
['--dsw-specific-sidebar-fill', 'background'],
|
|
974
|
-
|
|
974
|
+
// F3 退出:--dsw-specific-menu 不透明底杀毛玻璃(DSH 0.1.7 起半透明材料 + web-styling 禁止覆盖菜单材料)
|
|
975
|
+
// 老版影响为菜单回默认、可读,不算功能回归;菜单材料/滤镜变量永不输出。
|
|
975
976
|
['--dsw-alias-markdown-code-segment-unselected', 'background'],
|
|
976
977
|
['--dsw-alias-markdown-code-segment-selected', 'backgroundElement'],
|
|
977
978
|
// 中层芯片:step2(DSH 深色 850 级:tag/placeholder/bubble/multi-select)
|
|
@@ -990,6 +991,8 @@ const TOKEN_MAP = [
|
|
|
990
991
|
['--dsw-specific-login-input', 'backgroundPanel'],
|
|
991
992
|
['--dsw-alias-markdown-code-block', 'backgroundPanel'],
|
|
992
993
|
['--dsw-alias-markdown-code-block-banner', 'backgroundElement'],
|
|
994
|
+
// F2 新头部(DSH 0.1.7 CodeCard.header 只读此变量,不读 banner token;老横幅路径保留,老版继续命中)
|
|
995
|
+
['--dsl-code-block-background', 'backgroundElement'],
|
|
993
996
|
['--dsw-alias-toast-bg', 'backgroundElement'],
|
|
994
997
|
['--dsw-alias-tooltip-bg', 'backgroundElement'],
|
|
995
998
|
['--dsw-alias-button-elevated-fill', 'backgroundPanel'],
|
|
@@ -1001,6 +1004,8 @@ const TOKEN_MAP = [
|
|
|
1001
1004
|
['--dsw-alias-label-tertiary', 'textMuted'],
|
|
1002
1005
|
['--dsw-alias-label-caption', 'textMuted'],
|
|
1003
1006
|
['--dsw-alias-label-primary-bluish', 'markdownLink'],
|
|
1007
|
+
// F1 链接(上游 .markdown a 只读此变量;老 bluish/shiki-link/裸 a 规则全部保留,加法兼容)
|
|
1008
|
+
['--dsw-alias-link', 'markdownLink'],
|
|
1004
1009
|
// 品牌与状态(含旧报告 R2/R3 修复后迁入派生的 invert/dimmed/ghost,见 §2)
|
|
1005
1010
|
['--dsw-alias-brand-primary', 'primary'],
|
|
1006
1011
|
['--dsw-alias-brand-text', 'primary'],
|
|
@@ -1019,6 +1024,20 @@ const TOKEN_MAP = [
|
|
|
1019
1024
|
['--dsw-alias-border-l3', 'borderActive'],
|
|
1020
1025
|
['--dsw-alias-border-l4', 'borderActive'],
|
|
1021
1026
|
['--dsw-alias-button-ghost-active-border', 'borderActive'],
|
|
1027
|
+
// F5 新增缺口(DSH 0.1.7 rc.1/rc.2 design-platform diff 全量直配;缺槽/透明靠 usable() 跳过,不污染)
|
|
1028
|
+
// diff 系取增/删前景与背景槽直配;state-idle 取中性次级(缺槽即跳过);菜单/toast/tooltip 取中性直配。
|
|
1029
|
+
['--dsw-alias-code-diff-added', 'diffAdded'],
|
|
1030
|
+
['--dsw-alias-code-diff-deleted', 'diffRemoved'],
|
|
1031
|
+
['--dsw-alias-file-diff-added-bg', 'diffAddedBg'],
|
|
1032
|
+
['--dsw-alias-file-diff-added-gutter', 'diffAddedLineNumberBg'],
|
|
1033
|
+
['--dsw-alias-file-diff-added-marker', 'diffAdded'],
|
|
1034
|
+
['--dsw-alias-file-diff-deleted-bg', 'diffRemovedBg'],
|
|
1035
|
+
['--dsw-alias-file-diff-deleted-gutter', 'diffRemovedLineNumberBg'],
|
|
1036
|
+
['--dsw-alias-file-diff-deleted-marker', 'diffRemoved'],
|
|
1037
|
+
['--dsw-alias-state-idle-primary', 'secondary'],
|
|
1038
|
+
['--dsw-alias-menu-icon', 'textMuted'],
|
|
1039
|
+
['--dsw-alias-toast-label', 'text'],
|
|
1040
|
+
['--dsw-alias-tooltip-key-bg', 'backgroundElement'],
|
|
1022
1041
|
// 内联代码无芯片(opencode TUI 风格,固定 transparent)
|
|
1023
1042
|
['--dsw-alias-markdown-inline-code', '__transparent__'],
|
|
1024
1043
|
]
|
|
@@ -1088,6 +1107,8 @@ const SHIKI_MAP = [
|
|
|
1088
1107
|
const CSS_RULES = [
|
|
1089
1108
|
{ selector: 'body h1,body h2,body h3,body h4,body h5,body h6', prop: 'color', from: 'markdownHeading' },
|
|
1090
1109
|
{ selector: 'a', prop: 'color', from: 'markdownLink' },
|
|
1110
|
+
// F1 链接:与上游 MarkdownText.module.css 选择器镜像(.markdown a 0,1,1 碾压裸 a 0,0,1;老 a 规则保留,老版继续命中)
|
|
1111
|
+
{ selector: '.markdown a, .markdown .fileLink', prop: 'color', from: 'markdownLink' },
|
|
1091
1112
|
{ selector: 'code:not(pre code)', prop: 'color', from: 'markdownCode' },
|
|
1092
1113
|
{ selector: 'em', prop: 'color', from: 'markdownEmph' },
|
|
1093
1114
|
{ selector: 'strong', prop: 'color', from: 'markdownStrong' },
|
|
@@ -1508,6 +1529,8 @@ function buildTypographyCss(typography) {
|
|
|
1508
1529
|
'body,body[data-ds-dark-theme]{',
|
|
1509
1530
|
'--dsw-font-family:' + bodyFont + ';',
|
|
1510
1531
|
'--ds-font-family-code:' + codeFont + ';',
|
|
1532
|
+
// F4 新卡片字号(DSH 0.1.7 CodeCard .card/.body 只读此变量;size=13 默认恰好还原上游 11px/19px,跟随 11–18 档)
|
|
1533
|
+
'--dsw-font-markdown-code-block:' + (size - 2) + 'px/' + (size + 6) + 'px var(--ds-font-family-code);',
|
|
1511
1534
|
'--dsw-font-markdown-base:' + size + 'px/' + lh + 'px var(--dsw-font-family);',
|
|
1512
1535
|
'--dsw-font-markdown-base-font-size:' + size + 'px;',
|
|
1513
1536
|
'--dsw-font-markdown-base-line-height:' + lh + 'px;',
|
|
@@ -9684,10 +9707,11 @@ __mods["channel"] = { CHANNEL, ENDPOINT, ROUTE_PATH, PLUGIN_ID, PHONE_PREFIX, TA
|
|
|
9684
9707
|
/**
|
|
9685
9708
|
* runtime/update-panel.mjs — 面板「检查更新」的状态机(纯逻辑:不碰 React、不碰 DOM、不碰全局宿主)
|
|
9686
9709
|
*
|
|
9687
|
-
* 三条口径(沿用更新包 README
|
|
9710
|
+
* 三条口径(沿用更新包 README 与规格,#41 起进面板自动查一次):
|
|
9688
9711
|
* 1. 「待重启」只认宿主当场算出的原因码 pending-restart,不自己比较版本号;
|
|
9689
|
-
* 2.
|
|
9690
|
-
*
|
|
9712
|
+
* 2. 打开面板自动联网检查一次(静默:只变按钮,不自动弹窗);失败/无新版静默保持原样;
|
|
9713
|
+
* 用户亲手点「检查更新」/红色「有新版本」时才允许弹窗;
|
|
9714
|
+
* 3. 有新版只变按钮(红字“有新版本”),点按钮才开弹窗;无新版只回一句「已是最新」,不弹窗、不打扰。
|
|
9691
9715
|
*
|
|
9692
9716
|
* 电话名与轮询间隔由调用方从更新包的客户端入口派生后传进来(本文件不写字面量)。
|
|
9693
9717
|
*/
|
|
@@ -9713,12 +9737,13 @@ function readSnapshot(res) {
|
|
|
9713
9737
|
}
|
|
9714
9738
|
}
|
|
9715
9739
|
|
|
9716
|
-
/** 按钮状态:UI 据此选词条,不在渲染里堆条件。
|
|
9740
|
+
/** 按钮状态:UI 据此选词条,不在渲染里堆条件。
|
|
9741
|
+
* 优先级(#41 用户拍板):正在升级 > 待重启 > 有新版本 > 检查中 > 空闲。 */
|
|
9717
9742
|
function buttonState(state) {
|
|
9718
9743
|
if (state.installing) return 'installing'
|
|
9719
|
-
if (state.checking) return 'checking'
|
|
9720
9744
|
if (state.pending) return 'pending'
|
|
9721
9745
|
if (state.hasNew) return 'hasNew'
|
|
9746
|
+
if (state.checking) return 'checking'
|
|
9722
9747
|
return 'idle'
|
|
9723
9748
|
}
|
|
9724
9749
|
|
|
@@ -9884,6 +9909,39 @@ function createUpdateController(deps) {
|
|
|
9884
9909
|
}
|
|
9885
9910
|
}
|
|
9886
9911
|
|
|
9912
|
+
/** 进面板时的静默检查(联网一次,但只变按钮、不自动弹窗)。
|
|
9913
|
+
* 回 'new' | 'latest' | 'failed' | 'busy'。失败静默:不弹窗、不置 failure 文案。 */
|
|
9914
|
+
async function checkSilently() {
|
|
9915
|
+
if (!state.available) return 'failed'
|
|
9916
|
+
if (state.checking || state.installing) return 'busy'
|
|
9917
|
+
// 磁盘已有新版(待重启)无需再联网;已有新版凭证也无需重复联网
|
|
9918
|
+
if (state.pending) return 'latest'
|
|
9919
|
+
if (state.hasNew && state.checkId) return 'new'
|
|
9920
|
+
patch({ checking: true, failure: null })
|
|
9921
|
+
try {
|
|
9922
|
+
const res = await invoke(phones.updateCheck, {})
|
|
9923
|
+
patch({ checking: false })
|
|
9924
|
+
if (!res || res.ok !== true) return 'failed'
|
|
9925
|
+
const facts = absorb(res)
|
|
9926
|
+
if (facts.canInstall) return 'new'
|
|
9927
|
+
return 'latest'
|
|
9928
|
+
} catch (e) {
|
|
9929
|
+
patch({ checking: false })
|
|
9930
|
+
transportFail(phones.updateCheck, 'throw', e)
|
|
9931
|
+
return 'failed'
|
|
9932
|
+
}
|
|
9933
|
+
}
|
|
9934
|
+
|
|
9935
|
+
/** 打开面板时调用:先本地读一次,再静默联网查一次(#41)。
|
|
9936
|
+
* 待重启/安装中/检查中时跳过联网,避免打扰。 */
|
|
9937
|
+
async function autoCheckOnOpen() {
|
|
9938
|
+
await readStatus()
|
|
9939
|
+
if (!state.available) return null
|
|
9940
|
+
if (state.pending || state.installing || state.checking) return null
|
|
9941
|
+
if (state.hasNew && state.checkId) return 'new'
|
|
9942
|
+
return checkSilently()
|
|
9943
|
+
}
|
|
9944
|
+
|
|
9887
9945
|
/** 弹窗里的「立即升级」。 */
|
|
9888
9946
|
async function install() {
|
|
9889
9947
|
if (!state.available || state.installing) return false
|
|
@@ -9921,6 +9979,8 @@ function createUpdateController(deps) {
|
|
|
9921
9979
|
},
|
|
9922
9980
|
readStatus: readStatus,
|
|
9923
9981
|
check: check,
|
|
9982
|
+
checkSilently: checkSilently,
|
|
9983
|
+
autoCheckOnOpen: autoCheckOnOpen,
|
|
9924
9984
|
install: install,
|
|
9925
9985
|
openDialog: function () { patch({ dialogOpen: true }) },
|
|
9926
9986
|
closeDialog: function () { patch({ dialogOpen: false, failure: null }) },
|
|
@@ -9963,7 +10023,7 @@ const STORAGE_KEY = 'dsh.opencode-palette.v2'
|
|
|
9963
10023
|
const LEGACY_STORAGE_KEY = 'dsh.opencode-tui-theme.v2'
|
|
9964
10024
|
const DEFAULT_STATE = { enabled: true, theme: 'opencode', mode: 'mono', size: 13, fontKey: 'JetBrains Mono' }
|
|
9965
10025
|
// 构建时由 scripts/build-client.mjs 替换为 package.json 版本(面板底部署小字)
|
|
9966
|
-
const PALETTE_VERSION = '2.0.
|
|
10026
|
+
const PALETTE_VERSION = '2.0.4'
|
|
9967
10027
|
|
|
9968
10028
|
function getReact() {
|
|
9969
10029
|
if (typeof require === 'function') { try { return require('react') } catch (e) { /* 动态版无 require */ } }
|
|
@@ -10075,6 +10135,7 @@ const I18N = {
|
|
|
10075
10135
|
'authorPlugin.imCompanion': { zh: 'dsh-im 的增强插件,在原插件基础上提供了超过你想象力的能力', en: "Supercharges dsh-im with more than you'd expect" },
|
|
10076
10136
|
// ── 检查更新(面板头行按钮 + 升级弹窗 + 待重启横幅)──
|
|
10077
10137
|
updateCheck: { zh: '检查更新', en: 'Check for updates' },
|
|
10138
|
+
updateHasNew: { zh: '有新版本', en: 'New version' },
|
|
10078
10139
|
updateChecking: { zh: '检查中…', en: 'Checking…' },
|
|
10079
10140
|
updateInstalling: { zh: '正在升级…', en: 'Updating…' },
|
|
10080
10141
|
updateToVersion: { zh: '更新至 v{v}', en: 'Update to v{v}' },
|
|
@@ -10663,8 +10724,10 @@ function createClient(slotTarget) {
|
|
|
10663
10724
|
if (!props.update) return undefined
|
|
10664
10725
|
setUpd(props.update.getState())
|
|
10665
10726
|
const unsub = props.update.subscribe(function () { setUpd(props.update.getState()) })
|
|
10666
|
-
//
|
|
10667
|
-
|
|
10727
|
+
// 打开面板自动联网检查一次(静默:只变按钮,不自动弹窗;失败静默保持原样)
|
|
10728
|
+
// 待重启/安装中时控制器内部会跳过联网
|
|
10729
|
+
if (typeof props.update.autoCheckOnOpen === 'function') props.update.autoCheckOnOpen()
|
|
10730
|
+
else props.update.readStatus()
|
|
10668
10731
|
return unsub
|
|
10669
10732
|
}, [])
|
|
10670
10733
|
const updState = upd
|
|
@@ -10677,9 +10740,9 @@ function createClient(slotTarget) {
|
|
|
10677
10740
|
const updLabel = function (s) {
|
|
10678
10741
|
const which = buttonState(s)
|
|
10679
10742
|
if (which === 'installing') return tr('updateInstalling')
|
|
10680
|
-
if (which === 'checking') return tr('updateChecking')
|
|
10681
10743
|
if (which === 'pending') return tr('updateRestart')
|
|
10682
|
-
if (which === 'hasNew') return
|
|
10744
|
+
if (which === 'hasNew') return tr('updateHasNew')
|
|
10745
|
+
if (which === 'checking') return tr('updateChecking')
|
|
10683
10746
|
return tr('updateCheck')
|
|
10684
10747
|
}
|
|
10685
10748
|
const copyManual = function () {
|
|
@@ -10695,10 +10758,10 @@ function createClient(slotTarget) {
|
|
|
10695
10758
|
disabled: !!(updState.checking || updState.installing),
|
|
10696
10759
|
title: tr('updateCheck'),
|
|
10697
10760
|
style: {
|
|
10698
|
-
border: '1px solid ' + (updState.hasNew ? 'var(--dsw-alias-
|
|
10761
|
+
border: '1px solid ' + (updState.hasNew ? 'var(--dsw-alias-state-error-primary)' : 'var(--dsw-alias-border-l1)'),
|
|
10699
10762
|
borderRadius: 6, padding: '3px 9px', fontSize: 11, cursor: 'pointer',
|
|
10700
|
-
background:
|
|
10701
|
-
color: updState.hasNew ? 'var(--dsw-alias-
|
|
10763
|
+
background: 'transparent',
|
|
10764
|
+
color: updState.hasNew ? 'var(--dsw-alias-state-error-primary)' : muted,
|
|
10702
10765
|
fontFamily: 'var(--dsw-font-family)', whiteSpace: 'nowrap',
|
|
10703
10766
|
},
|
|
10704
10767
|
}, updLabel(updState))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-opencode-palette",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "让 DeepSeek Harness 穿上 38 款经典皮肤——东京的霓虹夜色、德古拉的暗红月光、复古工坊的暖黄灯火、黑客帝国的数字雨、玫瑰松林间的风……一键换肤,即点即换,重启不丢。38 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",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"dsh-log": "0.2.1"
|
|
37
37
|
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"dsh": ">=0.1.0-rc.6 <0.2.0-0"
|
|
40
|
+
},
|
|
38
41
|
"dsh": {
|
|
39
42
|
"bundle": {
|
|
40
43
|
"patch": "./cordis.patch.yml"
|