@jianghuifr/dsh-ui-optimize 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +76 -2
- package/cordis.patch.yml +3 -0
- package/docs/release.md +42 -0
- package/docs/settings.png +0 -0
- package/icon.svg +8 -0
- package/lib/client.js +274 -0
- package/lib/index.js +7 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +70 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 jianghui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @jianghuifr/dsh-ui-optimize
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/jianghuifr/dsh-ui-optimize/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@jianghuifr/dsh-ui-optimize)
|
|
5
|
+
|
|
6
|
+
Three measurable readability tweaks for the DeepSeek Harness Web UI: composer placeholder contrast, sidebar session timestamp type, and unselected session title hierarchy.
|
|
7
|
+
|
|
8
|
+
属于同一插件拆分出的三个独立包之一:[icons](https://github.com/jianghuifr/dsh-material-icon-theme-icon) · [dotfile highlight](https://github.com/jianghuifr/dsh-highlight) · [UI optimize](https://github.com/jianghuifr/dsh-ui-optimize)。
|
|
9
|
+
|
|
10
|
+
## 三条微调
|
|
11
|
+
|
|
12
|
+
| # | 选择器 | 改动 | 效果 |
|
|
13
|
+
| --- | --- | --- | --- |
|
|
14
|
+
| S1 | `[data-composer-placeholder]` | `color: var(--dsw-alias-label-secondary)` | 输入框 placeholder 对比度 2.14:1 → 约 5.9:1 |
|
|
15
|
+
| S2 | `[class*="_sidebarCol"] [class*="_timestamp"]` | `font-size: 11px` + `label-secondary` | 侧栏会话时间戳 10px/3.72:1 → 11px/5.9:1 |
|
|
16
|
+
| S3 | `[class*="_sessionRow"]:not([aria-selected="true"]) [class*="_title"]` | `color: var(--dsw-alias-label-secondary)` | 未选中会话标题比工作区标题弱一档 |
|
|
17
|
+
|
|
18
|
+
全部只用 `--dsw-*` 主题 token,关闭开关即整张样式表移除。
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 安装
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 发布到 npm 之后
|
|
25
|
+
plugin_manager install_bundle target=@jianghuifr/dsh-ui-optimize
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
本地开发也可直接 link 本目录(或在 Plugins → Add plugin 选择本目录):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
plugin_manager install_bundle target=<本仓库绝对路径>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 设置页
|
|
35
|
+
|
|
36
|
+
**Plugins → Installed plugins → 本插件详情 → Components → `界面优化 ›`**
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
开关存在浏览器 `localStorage`,切换立即生效、刷新后保持;会从旧合并版 `dsh-material-icon-theme` 的共享 key 迁移一次。
|
|
41
|
+
|
|
42
|
+
## 开发
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm ci
|
|
46
|
+
npm run verify # check + eslint + node --test
|
|
47
|
+
npm test
|
|
48
|
+
npm run check
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
零 npm 运行时依赖(仅 eslint 作为开发依赖),`lib/client.js` 是手写经典脚本、无构建步骤。
|
|
52
|
+
|
|
53
|
+
仓库结构:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
lib/index.js # 宿主半边
|
|
57
|
+
lib/client.js # 客户端半边(经典脚本 bundle)
|
|
58
|
+
locale/ # en/zh 插件页 meta
|
|
59
|
+
test/ # node --test
|
|
60
|
+
scripts/check.mjs # 自检
|
|
61
|
+
.github/workflows/ # CI + Release
|
|
62
|
+
docs/ # README 截图
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 发版
|
|
66
|
+
|
|
67
|
+
见 [docs/release.md](docs/release.md):staged publishing + trusted publishing,CI 只暂存,维护者用 2FA 批准后上线。
|
|
68
|
+
|
|
69
|
+
## 已知边界
|
|
70
|
+
|
|
71
|
+
1. 选择器基于 App CSS Module 类名前缀,App 大改版后可能需要同步。
|
|
72
|
+
2. 只做这三条,不改变布局与交互。
|
|
73
|
+
3. 浏览器级设置:换浏览器/隐私模式回落默认(开)。
|
|
74
|
+
|
|
75
|
+
## 许可
|
|
76
|
+
|
|
77
|
+
MIT,见 [LICENSE](LICENSE)。
|
package/cordis.patch.yml
ADDED
package/docs/release.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 发版
|
|
2
|
+
|
|
3
|
+
发布走 **staged publishing + trusted publishing**:CI 只把版本暂存到 npm 的 stage 队列,
|
|
4
|
+
维护者用 2FA 批准后才真正上线。全程不需要任何长期 token。
|
|
5
|
+
|
|
6
|
+
## 一次性准备
|
|
7
|
+
|
|
8
|
+
1. **npm 账号开启 2FA。** staged publishing 的批准步骤依赖它。
|
|
9
|
+
2. **包必须先存在于 registry。** `npm stage` 不支持全新包 —— 首次发布只能手工:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm login --registry https://registry.npmjs.org
|
|
13
|
+
npm publish --registry https://registry.npmjs.org --access public
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
之后 `release.yml` 才能接管后续版本。
|
|
17
|
+
3. **配置 trusted publisher。** npmjs.com → 包页面 → Settings → Trusted Publisher:
|
|
18
|
+
填本仓库(`jianghuifr/dsh-ui-optimize`)、workflow 文件名 `release.yml`,
|
|
19
|
+
并把权限限制为 **stage-only**。这一步让 CI 用 OIDC 换凭据,无需 `NPM_TOKEN`。
|
|
20
|
+
|
|
21
|
+
## 每个版本
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm version patch # 或 minor / major
|
|
25
|
+
git push --follow-tags
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
打上 `v*` 标签触发 `release.yml`:
|
|
29
|
+
|
|
30
|
+
1. 校验标签与 `package.json` 的版本一致(不一致直接失败);
|
|
31
|
+
2. 跑 `npm run verify`(bundle 完整性检查 + eslint + node --test);
|
|
32
|
+
3. 若 registry 上还没有这个版本,`npm stage publish` 把它暂存;
|
|
33
|
+
4. 建一个 GitHub Release。
|
|
34
|
+
|
|
35
|
+
## 批准
|
|
36
|
+
|
|
37
|
+
暂存**不等于发布**,对公众不可见。用 2FA 批准:
|
|
38
|
+
|
|
39
|
+
- 网页:npmjs.com → 账号 → **Staged Packages** → Approve
|
|
40
|
+
- CLI:`npm stage list` 拿 stage id → `npm stage approve <stage-id>`
|
|
41
|
+
|
|
42
|
+
批准后 `https://www.npmjs.com/package/@jianghuifr/dsh-ui-optimize` 才会更新。
|
|
Binary file
|
package/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-label="UI tweaks">
|
|
2
|
+
<rect x="8" y="10" width="48" height="8" rx="4" fill="#90caf9"/>
|
|
3
|
+
<circle cx="24" cy="14" r="7" fill="#1e88e5"/>
|
|
4
|
+
<rect x="8" y="28" width="48" height="8" rx="4" fill="#a5d6a7"/>
|
|
5
|
+
<circle cx="41" cy="32" r="7" fill="#43a047"/>
|
|
6
|
+
<rect x="8" y="46" width="48" height="8" rx="4" fill="#ffe082"/>
|
|
7
|
+
<circle cx="30" cy="50" r="7" fill="#f9a825"/>
|
|
8
|
+
</svg>
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@jianghuifr/dsh-ui-optimize` — Web client half.
|
|
3
|
+
*
|
|
4
|
+
* A pure stylesheet switch. Three rules, each one measurable:
|
|
5
|
+
* S1 composer placeholder contrast: 2.14:1 -> about 5.9:1.
|
|
6
|
+
* S2 sidebar session timestamp: 10px / 3.72:1 -> 11px / 5.9:1.
|
|
7
|
+
* S3 an unselected session title sits one level below its workspace title.
|
|
8
|
+
*
|
|
9
|
+
* Only host theme tokens are used; removing the sheet restores the app exactly.
|
|
10
|
+
*/
|
|
11
|
+
window.__ModuleLoader__.load({
|
|
12
|
+
id: '@jianghuifr/dsh-ui-optimize',
|
|
13
|
+
factory(require) {
|
|
14
|
+
'use strict'
|
|
15
|
+
|
|
16
|
+
const React = require('react')
|
|
17
|
+
const h = React.createElement
|
|
18
|
+
|
|
19
|
+
// -----------------------------------------------------------------------
|
|
20
|
+
// Identity and constants
|
|
21
|
+
// -----------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
const ROW_ID = 'dsh-ui-optimize'
|
|
24
|
+
const ROW_CONFIG_KEY = '@jianghuifr/dsh-ui-optimize#' + ROW_ID
|
|
25
|
+
const LOCALE_NS = 'dshMaterialIconThemeUi'
|
|
26
|
+
const STORAGE_KEY = '@jianghuifr/dsh-ui-optimize:features'
|
|
27
|
+
/** Keys tried when this package's own key is absent: the previous split name, then the merged plugin. */
|
|
28
|
+
const LEGACY_STORAGE_KEYS = [
|
|
29
|
+
'@jianghuifr/dsh-material-icon-theme-ui:features',
|
|
30
|
+
'dsh-material-icon-theme:features',
|
|
31
|
+
]
|
|
32
|
+
const FEATURE_KEYS = ['styleTweaks']
|
|
33
|
+
|
|
34
|
+
const DEFAULT_FEATURES = Object.freeze({ styleTweaks: true })
|
|
35
|
+
|
|
36
|
+
/** The three tweaks, kept as one sheet so the switch is all-or-nothing. */
|
|
37
|
+
const TWEAK_CSS = [
|
|
38
|
+
'/* S1: composer placeholder 2.14:1 -> about 5.9:1. */',
|
|
39
|
+
'[data-composer-placeholder]{color:var(--dsw-alias-label-secondary)!important}',
|
|
40
|
+
'/* S2: sidebar session timestamp 10px/3.72:1 -> 11px/5.9:1. */',
|
|
41
|
+
'[class*="_sidebarCol"] [class*="_timestamp"]{font-size:11px!important;color:var(--dsw-alias-label-secondary)!important}',
|
|
42
|
+
'/* S3: an unselected session title sits one level below its workspace title. */',
|
|
43
|
+
'[class*="_sessionRow"]:not([aria-selected="true"]) [class*="_title"]{color:var(--dsw-alias-label-secondary)!important}',
|
|
44
|
+
].join('\n')
|
|
45
|
+
|
|
46
|
+
const SETTINGS_CSS = [
|
|
47
|
+
'.dmi-feature-row{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:14px 0;border-bottom:.5px solid var(--dsw-alias-border-l3)}',
|
|
48
|
+
'.dmi-feature-row:last-child{border-bottom:0}',
|
|
49
|
+
'.dmi-feature-copy{display:flex;flex-direction:column;gap:3px;min-width:0}',
|
|
50
|
+
'.dmi-feature-label{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:18px}',
|
|
51
|
+
'.dmi-feature-description{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:17px}',
|
|
52
|
+
'.dmi-feature-note{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:17px;padding:8px 0;margin:0}',
|
|
53
|
+
'.dmi-switch{box-sizing:border-box;position:relative;flex:0 0 auto;width:36px;height:20px;padding:2px;border:0;border-radius:999px;background:var(--dsw-alias-border-l3);cursor:pointer}',
|
|
54
|
+
'.dmi-switch[aria-checked="true"]{background:var(--dsw-alias-brand-primary)}',
|
|
55
|
+
'.dmi-switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}',
|
|
56
|
+
'.dmi-switch-thumb{display:block;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-switch-thumb);transition:transform .12s ease}',
|
|
57
|
+
'.dmi-switch[aria-checked="true"] .dmi-switch-thumb{transform:translate(16px);background:var(--dsw-alias-label-primary-foreground)}',
|
|
58
|
+
'.dmi-settings{display:flex;flex-direction:column;padding:2px 0}',
|
|
59
|
+
].join('\n')
|
|
60
|
+
|
|
61
|
+
// -----------------------------------------------------------------------
|
|
62
|
+
// Feature store (localStorage, shared by the settings page and runtime)
|
|
63
|
+
// -----------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
let features = null
|
|
66
|
+
const featureListeners = new Set()
|
|
67
|
+
|
|
68
|
+
function readOwnFeatures() {
|
|
69
|
+
const next = { ...DEFAULT_FEATURES }
|
|
70
|
+
try {
|
|
71
|
+
const raw = window.localStorage.getItem(STORAGE_KEY)
|
|
72
|
+
if (raw !== null) {
|
|
73
|
+
const parsed = JSON.parse(raw)
|
|
74
|
+
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
75
|
+
for (const key of FEATURE_KEYS) {
|
|
76
|
+
if (typeof parsed[key] === 'boolean') next[key] = parsed[key]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return next
|
|
80
|
+
}
|
|
81
|
+
for (const legacyKey of LEGACY_STORAGE_KEYS) {
|
|
82
|
+
const legacy = window.localStorage.getItem(legacyKey)
|
|
83
|
+
if (legacy === null) continue
|
|
84
|
+
try {
|
|
85
|
+
const parsed = JSON.parse(legacy)
|
|
86
|
+
if (parsed !== null && typeof parsed === 'object' && typeof parsed.styleTweaks === 'boolean') {
|
|
87
|
+
next.styleTweaks = parsed.styleTweaks
|
|
88
|
+
break
|
|
89
|
+
}
|
|
90
|
+
} catch {
|
|
91
|
+
// Skip a corrupt legacy value and try the next key.
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch {
|
|
95
|
+
// A corrupt or blocked store falls back to the defaults.
|
|
96
|
+
}
|
|
97
|
+
return next
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getFeatures() {
|
|
101
|
+
if (features === null) features = Object.freeze(readOwnFeatures())
|
|
102
|
+
return features
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function subscribeFeatures(listener) {
|
|
106
|
+
featureListeners.add(listener)
|
|
107
|
+
return () => {
|
|
108
|
+
featureListeners.delete(listener)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function setFeature(key, value) {
|
|
113
|
+
if (!FEATURE_KEYS.includes(key) || typeof value !== 'boolean') return
|
|
114
|
+
const current = getFeatures()
|
|
115
|
+
if (current[key] === value) return
|
|
116
|
+
features = Object.freeze({ ...current, [key]: value })
|
|
117
|
+
try {
|
|
118
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(features))
|
|
119
|
+
} catch {
|
|
120
|
+
// Persistence may be blocked; the live value still applies.
|
|
121
|
+
}
|
|
122
|
+
for (const listener of [...featureListeners]) {
|
|
123
|
+
try {
|
|
124
|
+
listener()
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error('[dsh-ui-optimize] feature listener failed', error)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// -----------------------------------------------------------------------
|
|
132
|
+
// Stylesheets
|
|
133
|
+
// -----------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
function installStyle(name, css) {
|
|
136
|
+
const existing = document.querySelector('style[data-dsh-mi-style="' + name + '"]')
|
|
137
|
+
if (existing !== null) return existing
|
|
138
|
+
const style = document.createElement('style')
|
|
139
|
+
style.setAttribute('data-dsh-mi-style', name)
|
|
140
|
+
style.textContent = css
|
|
141
|
+
;(document.head === null ? document.documentElement : document.head).appendChild(style)
|
|
142
|
+
return style
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function removeStyle(name) {
|
|
146
|
+
for (const style of document.querySelectorAll('style[data-dsh-mi-style="' + name + '"]')) style.remove()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// -----------------------------------------------------------------------
|
|
150
|
+
// Settings page
|
|
151
|
+
// -----------------------------------------------------------------------
|
|
152
|
+
|
|
153
|
+
function Switch({ checked, label, labelId, onChange }) {
|
|
154
|
+
return h(
|
|
155
|
+
'button',
|
|
156
|
+
{
|
|
157
|
+
type: 'button',
|
|
158
|
+
role: 'switch',
|
|
159
|
+
'aria-checked': checked,
|
|
160
|
+
'aria-label': label,
|
|
161
|
+
'aria-describedby': labelId,
|
|
162
|
+
className: 'dmi-switch',
|
|
163
|
+
onClick: () => onChange(!checked),
|
|
164
|
+
},
|
|
165
|
+
h('span', { className: 'dmi-switch-thumb' }),
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function SettingsView(props) {
|
|
170
|
+
const t = props.t
|
|
171
|
+
const current = React.useSyncExternalStore(subscribeFeatures, getFeatures, getFeatures)
|
|
172
|
+
if (props.view === 'summary') return t('settings.summary')
|
|
173
|
+
const descriptionId = 'dmi-description-styleTweaks'
|
|
174
|
+
return h(
|
|
175
|
+
'div',
|
|
176
|
+
{ className: 'dmi-settings' },
|
|
177
|
+
h(
|
|
178
|
+
'div',
|
|
179
|
+
{ className: 'dmi-feature-row' },
|
|
180
|
+
h(
|
|
181
|
+
'div',
|
|
182
|
+
{ className: 'dmi-feature-copy' },
|
|
183
|
+
h('span', { className: 'dmi-feature-label' }, t('settings.styleTweaks.label')),
|
|
184
|
+
h('span', { id: descriptionId, className: 'dmi-feature-description' }, t('settings.styleTweaks.description')),
|
|
185
|
+
),
|
|
186
|
+
h(Switch, {
|
|
187
|
+
checked: current.styleTweaks,
|
|
188
|
+
label: t('settings.styleTweaks.label'),
|
|
189
|
+
labelId: descriptionId,
|
|
190
|
+
onChange: value => setFeature('styleTweaks', value),
|
|
191
|
+
}),
|
|
192
|
+
),
|
|
193
|
+
h('p', { className: 'dmi-feature-note' }, t('settings.note.storage')),
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// -----------------------------------------------------------------------
|
|
198
|
+
// Locale dictionaries (en + zh are required by the locale service)
|
|
199
|
+
// -----------------------------------------------------------------------
|
|
200
|
+
|
|
201
|
+
const zh = {
|
|
202
|
+
'settings.summary': '三条可读性微调:placeholder 对比度、会话时间戳、未选中会话标题层级。',
|
|
203
|
+
'settings.note.storage': '设置保存在当前浏览器,切换立即生效、刷新后保持。',
|
|
204
|
+
'settings.styleTweaks.label': '样式微调',
|
|
205
|
+
'settings.styleTweaks.description': '提高输入框 placeholder 与会话时间戳的对比度,并让未选中会话标题弱一档。',
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const en = {
|
|
209
|
+
'settings.summary': 'Three readability tweaks: placeholder contrast, session timestamps and unselected session title hierarchy.',
|
|
210
|
+
'settings.note.storage': 'Settings are stored in this browser and apply immediately; they survive a reload.',
|
|
211
|
+
'settings.styleTweaks.label': 'Style tweaks',
|
|
212
|
+
'settings.styleTweaks.description': 'Raise contrast of the composer placeholder and session timestamps, and soften unselected session titles.',
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// -----------------------------------------------------------------------
|
|
216
|
+
// Runtime: stylesheet switch
|
|
217
|
+
// -----------------------------------------------------------------------
|
|
218
|
+
|
|
219
|
+
function createRuntime() {
|
|
220
|
+
let disposed = false
|
|
221
|
+
let unsubscribeStore = null
|
|
222
|
+
|
|
223
|
+
function applyTweaks(enabled) {
|
|
224
|
+
if (enabled) installStyle('dsh-ui-optimize:tweaks', TWEAK_CSS)
|
|
225
|
+
else removeStyle('dsh-ui-optimize:tweaks')
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
start() {
|
|
230
|
+
installStyle('dsh-ui-optimize:settings', SETTINGS_CSS)
|
|
231
|
+
applyTweaks(getFeatures().styleTweaks)
|
|
232
|
+
unsubscribeStore = subscribeFeatures(() => applyTweaks(getFeatures().styleTweaks))
|
|
233
|
+
return () => {
|
|
234
|
+
if (disposed) return
|
|
235
|
+
disposed = true
|
|
236
|
+
if (unsubscribeStore !== null) {
|
|
237
|
+
unsubscribeStore()
|
|
238
|
+
unsubscribeStore = null
|
|
239
|
+
}
|
|
240
|
+
removeStyle('dsh-ui-optimize:tweaks')
|
|
241
|
+
removeStyle('dsh-ui-optimize:settings')
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// -----------------------------------------------------------------------
|
|
248
|
+
// Plugin export
|
|
249
|
+
// -----------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
function apply(ctx) {
|
|
252
|
+
ctx.effect(() => ctx.locale.register(LOCALE_NS, { zh, en }), 'dsh-ui-optimize: locale')
|
|
253
|
+
|
|
254
|
+
ctx.effect(
|
|
255
|
+
() => ctx.slots.inject('plugins.row.config', () => ctx.slots.register({
|
|
256
|
+
name: 'plugins.row.config',
|
|
257
|
+
key: ROW_CONFIG_KEY,
|
|
258
|
+
locale: LOCALE_NS,
|
|
259
|
+
}, SettingsView)),
|
|
260
|
+
'dsh-ui-optimize: settings row',
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
ctx.effect(
|
|
264
|
+
() => createRuntime().start(),
|
|
265
|
+
'dsh-ui-optimize: stylesheet runtime',
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return {
|
|
270
|
+
inject: ['slots', 'locale'],
|
|
271
|
+
apply,
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
})
|
package/lib/index.js
ADDED
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jianghuifr/dsh-ui-optimize",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Three measurable readability tweaks for the DeepSeek Harness Web UI: composer placeholder contrast, sidebar session timestamp type, and unselected session title hierarchy.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"deepseek-harness",
|
|
9
|
+
"ui",
|
|
10
|
+
"contrast",
|
|
11
|
+
"readability"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"icon": "icon.svg",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./lib/index.js",
|
|
18
|
+
"./client": "./lib/client.js",
|
|
19
|
+
"./package.json": "./package.json",
|
|
20
|
+
"./locale/*.json": "./locale/*.json",
|
|
21
|
+
"./icon": "./icon.svg"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/",
|
|
25
|
+
"locale/",
|
|
26
|
+
"docs/",
|
|
27
|
+
"cordis.patch.yml",
|
|
28
|
+
"icon.svg",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"lint": "eslint .",
|
|
34
|
+
"test": "node --test test/*.test.mjs",
|
|
35
|
+
"check": "node scripts/check.mjs",
|
|
36
|
+
"verify": "npm run check && npm run lint && npm test",
|
|
37
|
+
"prepublishOnly": "npm run verify"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/jianghuifr/dsh-ui-optimize.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/jianghuifr/dsh-ui-optimize#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/jianghuifr/dsh-ui-optimize/issues"
|
|
46
|
+
},
|
|
47
|
+
"author": "jianghuifr",
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=22.19.0",
|
|
50
|
+
"dsh": ">=0.2.2-rc.1"
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public",
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"dsh": {
|
|
58
|
+
"manifestVersion": 1,
|
|
59
|
+
"bundle": {
|
|
60
|
+
"patch": "./cordis.patch.yml"
|
|
61
|
+
},
|
|
62
|
+
"client": {
|
|
63
|
+
"platform": "web",
|
|
64
|
+
"inject": [],
|
|
65
|
+
"immediately": false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@eslint/js": "^10.0.1",
|
|
70
|
+
"eslint": "^10.10.0"
|
|
71
|
+
}
|
|
72
|
+
}
|