@huaqiu/dsh-tool-plugin-update 0.6.12 → 0.6.13
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 +50 -20
- package/lib/client.js.map +1 -1
- package/package.json +3 -3
- package/src/client/copy.ts +3 -1
- package/src/client/index.ts +25 -0
- package/src/client/update-view.ts +32 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-tool-plugin-update",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.mjs",
|
|
6
6
|
"types": "./lib/index.d.mts",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.2"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@huaqiu/dsh-plugin-log": "0.6.
|
|
35
|
-
"@huaqiu/dsh-sidebar-entry": "0.6.
|
|
34
|
+
"@huaqiu/dsh-plugin-log": "0.6.13",
|
|
35
|
+
"@huaqiu/dsh-sidebar-entry": "0.6.13"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"lib",
|
package/src/client/copy.ts
CHANGED
|
@@ -24,6 +24,7 @@ const zh = {
|
|
|
24
24
|
// it honestly rather than per-plugin.
|
|
25
25
|
installAll: (count: number) => `安装整套更新(${count} 项)`,
|
|
26
26
|
installOne: '安装整套',
|
|
27
|
+
installOnePlugin: '安装此插件',
|
|
27
28
|
installOneTip: '将安装整套 N 项更新并自动重启 DSH,而不仅是此插件',
|
|
28
29
|
installing: '正在安装…(DSH 将自动重启)',
|
|
29
30
|
retry: '重试',
|
|
@@ -187,7 +188,7 @@ const zh = {
|
|
|
187
188
|
// Footer
|
|
188
189
|
footerCount: (n: number) => `准备安装 ${n} 项兼容插件`,
|
|
189
190
|
footerSet: (v: string) => `版本集: v${v}`,
|
|
190
|
-
installAllSet: (v: string) =>
|
|
191
|
+
installAllSet: (v: string) => `更新插件集 (v${v})`,
|
|
191
192
|
ignoreBtn: '忽略',
|
|
192
193
|
footnote: '更新将自动应用并重启 DSH 视图,不影响 EDA 图纸数据',
|
|
193
194
|
},
|
|
@@ -216,6 +217,7 @@ const en: UpdateCopy = {
|
|
|
216
217
|
checkFailed: 'Failed to check for updates — please retry',
|
|
217
218
|
installAll: (count: number) => `Install whole set (${count})`,
|
|
218
219
|
installOne: 'Install set',
|
|
220
|
+
installOnePlugin: 'Install this plugin',
|
|
219
221
|
installOneTip: 'Installs the whole set of N updates and restarts DSH — not just this plugin',
|
|
220
222
|
installing: 'Installing… (DSH will restart)',
|
|
221
223
|
retry: 'Retry',
|
package/src/client/index.ts
CHANGED
|
@@ -1379,6 +1379,7 @@ const VIEW_CSS_TEXT = `
|
|
|
1379
1379
|
align-items: start;
|
|
1380
1380
|
}
|
|
1381
1381
|
.hqpu-card {
|
|
1382
|
+
position: relative;
|
|
1382
1383
|
margin: 0;
|
|
1383
1384
|
padding: 10px;
|
|
1384
1385
|
border-radius: 8px;
|
|
@@ -1444,6 +1445,30 @@ const VIEW_CSS_TEXT = `
|
|
|
1444
1445
|
.hqpu-log-toggle:hover { color: var(--hq-text); }
|
|
1445
1446
|
.hqpu-log-toggle svg { width: 12px; height: 12px; transition: transform 0.15s ease; }
|
|
1446
1447
|
.hqpu-log-toggle[data-open='true'] svg { transform: rotate(180deg); }
|
|
1448
|
+
.hqpu-changelog-actions {
|
|
1449
|
+
display: flex;
|
|
1450
|
+
gap: 8px;
|
|
1451
|
+
margin-top: 10px;
|
|
1452
|
+
padding-top: 8px;
|
|
1453
|
+
border-top: 0.5px solid var(--hq-border);
|
|
1454
|
+
}
|
|
1455
|
+
.hqpu-card-action {
|
|
1456
|
+
height: 28px;
|
|
1457
|
+
padding: 0 10px;
|
|
1458
|
+
border: 0.5px solid var(--hq-border-strong);
|
|
1459
|
+
border-radius: 6px;
|
|
1460
|
+
background: var(--hq-card);
|
|
1461
|
+
color: var(--hq-text);
|
|
1462
|
+
font-size: 10px;
|
|
1463
|
+
cursor: pointer;
|
|
1464
|
+
}
|
|
1465
|
+
.hqpu-card-action:hover { border-color: var(--hq-brand-soft); color: var(--hq-brand-soft); }
|
|
1466
|
+
.hqpu-card-action--install {
|
|
1467
|
+
border-color: var(--hq-brand);
|
|
1468
|
+
background: var(--hq-brand);
|
|
1469
|
+
color: var(--hq-brand-fg);
|
|
1470
|
+
}
|
|
1471
|
+
.hqpu-card-action--install:hover { border-color: var(--hq-brand-soft); background: var(--hq-brand-soft); color: var(--hq-brand-fg); }
|
|
1447
1472
|
.hqpu-changelog-drawer {
|
|
1448
1473
|
margin-top: 8px;
|
|
1449
1474
|
padding: 8px;
|
|
@@ -131,7 +131,13 @@ function avatarInitials(item: PluginUpdateItem): string {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/** Shared per-card changelog toggle drawer (the per-plugin changes[] list). */
|
|
134
|
-
function changelogDrawer(
|
|
134
|
+
function changelogDrawer(
|
|
135
|
+
item: PluginUpdateItem,
|
|
136
|
+
copy: UpdateCopy,
|
|
137
|
+
open: boolean,
|
|
138
|
+
onInstall: () => void,
|
|
139
|
+
onIgnore: () => void,
|
|
140
|
+
): HTMLElement {
|
|
135
141
|
const drawer = el('div', 'hqpu-changelog-drawer')
|
|
136
142
|
drawer.style.display = open ? '' : 'none'
|
|
137
143
|
drawer.append(el('div', 'hqpu-changelog-drawer-title', copy.ui.changelogTitle))
|
|
@@ -139,7 +145,24 @@ function changelogDrawer(item: PluginUpdateItem, copy: UpdateCopy, open: boolean
|
|
|
139
145
|
for (const change of item.changes ?? []) {
|
|
140
146
|
if (typeof change === 'string' && change.length > 0) ul.append(el('li', '', change))
|
|
141
147
|
}
|
|
142
|
-
drawer.append(ul)
|
|
148
|
+
if (ul.childElementCount > 0) drawer.append(ul)
|
|
149
|
+
const actions = el('div', 'hqpu-changelog-actions')
|
|
150
|
+
if (item.state === 'update' || item.state === 'install') {
|
|
151
|
+
const install = el('button', 'hqpu-card-action hqpu-card-action--install', copy.installOnePlugin)
|
|
152
|
+
install.type = 'button'
|
|
153
|
+
install.title = copy.installOneTip
|
|
154
|
+
install.addEventListener('click', onInstall)
|
|
155
|
+
const ignore = el('button', 'hqpu-card-action', copy.ignore)
|
|
156
|
+
ignore.type = 'button'
|
|
157
|
+
ignore.addEventListener('click', onIgnore)
|
|
158
|
+
actions.append(install, ignore)
|
|
159
|
+
} else if (item.state === 'ignored') {
|
|
160
|
+
const show = el('button', 'hqpu-card-action hqpu-card-action--install', copy.unignore)
|
|
161
|
+
show.type = 'button'
|
|
162
|
+
show.addEventListener('click', onIgnore)
|
|
163
|
+
actions.append(show)
|
|
164
|
+
}
|
|
165
|
+
if (actions.childElementCount > 0) drawer.append(actions)
|
|
143
166
|
return drawer
|
|
144
167
|
}
|
|
145
168
|
|
|
@@ -185,22 +208,9 @@ function packageCard(
|
|
|
185
208
|
left.append(avatar, main)
|
|
186
209
|
|
|
187
210
|
const right = el('div', 'hqpu-card-end')
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
install.title = copy.installOneTip
|
|
192
|
-
install.addEventListener('click', onInstall)
|
|
193
|
-
const ignore = el('button', 'hqpu-log-toggle', copy.ignore)
|
|
194
|
-
ignore.type = 'button'
|
|
195
|
-
ignore.addEventListener('click', onIgnore)
|
|
196
|
-
right.append(install, ignore)
|
|
197
|
-
} else if (item.state === 'ignored') {
|
|
198
|
-
const show = el('button', 'hqpu-log-toggle', copy.unignore)
|
|
199
|
-
show.type = 'button'
|
|
200
|
-
show.addEventListener('click', onIgnore)
|
|
201
|
-
right.append(show)
|
|
202
|
-
}
|
|
203
|
-
if (Array.isArray(item.changes) && item.changes.length > 0) {
|
|
211
|
+
const hasDetails = (Array.isArray(item.changes) && item.changes.length > 0) ||
|
|
212
|
+
item.state === 'update' || item.state === 'install' || item.state === 'ignored'
|
|
213
|
+
if (hasDetails) {
|
|
204
214
|
const toggle = el('button', 'hqpu-log-toggle')
|
|
205
215
|
toggle.type = 'button'
|
|
206
216
|
toggle.dataset.open = open ? 'true' : 'false'
|
|
@@ -211,9 +221,10 @@ function packageCard(
|
|
|
211
221
|
head.append(left, right)
|
|
212
222
|
card.append(head)
|
|
213
223
|
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
224
|
+
// The actions live in the expanded changelog/details drawer so cards keep
|
|
225
|
+
// their compact layout until a person asks for more information.
|
|
226
|
+
if (hasDetails) {
|
|
227
|
+
card.append(changelogDrawer(item, copy, open, onInstall, onIgnore))
|
|
217
228
|
}
|
|
218
229
|
return card
|
|
219
230
|
}
|