dsh-plugin-update 0.5.8 → 0.7.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 +16 -4
- package/README.md +46 -9
- package/dist/bilingual.d.ts +4 -4
- package/dist/bilingual.js +300 -1
- package/dist/changelog.d.ts +19 -13
- package/dist/changelog.js +60 -22
- package/dist/diag.d.ts +3 -0
- package/dist/diag.js +32 -20
- package/dist/entry-batch.d.ts +10 -2
- package/dist/entry-batch.js +21 -7
- package/dist/entry.d.ts +31 -2
- package/dist/entry.js +83 -27
- package/dist/host-batch.js +104 -13
- package/dist/http.d.ts +2 -2
- package/dist/http.js +1 -1
- package/dist/panel-batch.d.ts +53 -11
- package/dist/panel-batch.js +500 -153
- package/dist/panel.d.ts +84 -25
- package/dist/panel.js +618 -364
- package/dist/store.d.ts +42 -0
- package/dist/store.js +139 -0
- package/package.json +1 -1
package/dist/panel.d.ts
CHANGED
|
@@ -1,18 +1,62 @@
|
|
|
1
1
|
import { type VisibleQueue } from './queue.js';
|
|
2
2
|
import type { BlockedReason, UpdateSnapshot } from './ports.js';
|
|
3
|
+
import { type AppLang, type LocaleOption } from './lang.js';
|
|
3
4
|
/** 摆放形态:默认内嵌,切弹窗走同一参数。 */
|
|
4
5
|
export type UpdatePanelMode = 'embedded' | 'dialog';
|
|
5
|
-
/** 面板主题:默认最小可用样式;`archive` 为档案卷纸面浅色(只换肤,不换 DOM
|
|
6
|
+
/** 面板主题:默认最小可用样式;`archive` 为档案卷纸面浅色(只换肤,不换 DOM 顺序)。 */
|
|
6
7
|
/**
|
|
7
8
|
* 面板主题:`default` 最小可用深色;`archive` 档案卷纸面浅色(原型敲定的案卷风格,只换肤)。
|
|
8
|
-
* `d5-paper` 是 archive 的旧别名(历史取值),仍可用,渲染逐字相同。
|
|
9
9
|
*/
|
|
10
|
-
export type UpdatePanelTheme = 'default' | 'archive'
|
|
10
|
+
export type UpdatePanelTheme = 'default' | 'archive';
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* 主题归一:`archive` 挂 `data-theme="archive"`,其余一律回 `default`(DOM 属性只出 `archive`);
|
|
13
13
|
* 其余一律回 default(纯渲染函数永不抛;挂载/setTheme 的非法值另行抛错)。
|
|
14
14
|
*/
|
|
15
15
|
export declare function normalizePanelTheme(value: unknown): 'default' | 'archive';
|
|
16
|
+
/** 第三方主题变量覆盖:键为语义名;颜色收 hex(#rgb/#rrggbb/#rrggbbaa)或英文名单词;其余收安全 CSS 值;缺省即主题默认值,零回归。 */
|
|
17
|
+
export interface UpdateThemeTokens {
|
|
18
|
+
text?: string;
|
|
19
|
+
textMuted?: string;
|
|
20
|
+
bg?: string;
|
|
21
|
+
bgSoft?: string;
|
|
22
|
+
border?: string;
|
|
23
|
+
borderStrong?: string;
|
|
24
|
+
buttonBg?: string;
|
|
25
|
+
primary?: string;
|
|
26
|
+
primaryDeep?: string;
|
|
27
|
+
focus?: string;
|
|
28
|
+
okBg?: string;
|
|
29
|
+
okBorder?: string;
|
|
30
|
+
okText?: string;
|
|
31
|
+
warnBg?: string;
|
|
32
|
+
warnBorder?: string;
|
|
33
|
+
warnText?: string;
|
|
34
|
+
badBg?: string;
|
|
35
|
+
badBorder?: string;
|
|
36
|
+
badText?: string;
|
|
37
|
+
busyBg?: string;
|
|
38
|
+
busyBorder?: string;
|
|
39
|
+
busyText?: string;
|
|
40
|
+
fontSans?: string;
|
|
41
|
+
fontSerif?: string;
|
|
42
|
+
fontMono?: string;
|
|
43
|
+
shadow?: string;
|
|
44
|
+
radiusPanel?: string;
|
|
45
|
+
radiusButton?: string;
|
|
46
|
+
radiusBadge?: string;
|
|
47
|
+
entryFontSize?: string;
|
|
48
|
+
entryPadding?: string;
|
|
49
|
+
entryBorderRadius?: string;
|
|
50
|
+
/** 入口件整体缩放(对应 CSS `zoom`),须为大于 0 的有限数。 */
|
|
51
|
+
entryScale?: number;
|
|
52
|
+
}
|
|
53
|
+
/** CSS 值最小安全检查(与入口件 sizing 同口径):放 style 属性前先拦掉注入。 */
|
|
54
|
+
export declare function isSafeThemeCssValue(value: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* `themeTokens` → 根 style 属性体(纯函数:同一输入永远算出同一串;空/缺省回空串,即不写 style)。
|
|
57
|
+
* 非法即抛(未知键、空串、注入字符、颜色形状不对、非正有限 entryScale 都不收)。
|
|
58
|
+
*/
|
|
59
|
+
export declare function themeTokensStyleFor(tokens: UpdateThemeTokens | null | undefined): string;
|
|
16
60
|
/** 与宿主通话的传输函数:面板只认这个签名,不认任何宿主对象的具体形状。 */
|
|
17
61
|
export type UpdatePanelCall = (phoneName: string, args: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
18
62
|
/** 复制文本的出口:不传即尝试浏览器剪贴板,都没有则只留“已生成、请手动复制”提示。 */
|
|
@@ -26,8 +70,10 @@ export interface UpdatePanelOptions {
|
|
|
26
70
|
prefix?: string;
|
|
27
71
|
/** 摆放形态:默认内嵌。 */
|
|
28
72
|
mode?: UpdatePanelMode;
|
|
29
|
-
/** 面板主题:默认 `default`(最小可用样式,一字不动);传 `archive`
|
|
73
|
+
/** 面板主题:默认 `default`(最小可用样式,一字不动);传 `archive` 切档案卷。 */
|
|
30
74
|
theme?: UpdatePanelTheme;
|
|
75
|
+
/** 主题变量覆盖:见 UpdateThemeTokens;两个主题通用,不传即零回归。 */
|
|
76
|
+
themeTokens?: UpdateThemeTokens;
|
|
31
77
|
/** 是否看他人排队明细:默认只看自己的(他人仅露正忙占位,位置照给)。 */
|
|
32
78
|
showOthers?: boolean;
|
|
33
79
|
/** 是否显示深挖日志指引:默认显示;面向纯终端用户的嵌入可关(失败证据行不受影响)。 */
|
|
@@ -69,10 +115,10 @@ export interface UpdatePanelOptions {
|
|
|
69
115
|
*/
|
|
70
116
|
onCloseRequested?: () => void | Promise<void>;
|
|
71
117
|
/**
|
|
72
|
-
* 语言覆盖(#
|
|
73
|
-
*
|
|
118
|
+
* 语言覆盖(#61 起消费:'zh' | 'en' | { getActive(): string; subscribe?(cb): () => void },不传即跟随全局信号)。
|
|
119
|
+
* 与入口件同一口径:显式覆盖 > html[lang] > navigator > zh。
|
|
74
120
|
*/
|
|
75
|
-
locale?:
|
|
121
|
+
locale?: LocaleOption;
|
|
76
122
|
}
|
|
77
123
|
/** 挂载点:只要有 innerHTML 的容器即可(浏览器元素或测试替身都行)。 */
|
|
78
124
|
export interface UpdatePanelContainer {
|
|
@@ -89,6 +135,8 @@ export interface UpdatePanelController {
|
|
|
89
135
|
setMode(mode: UpdatePanelMode): Promise<void>;
|
|
90
136
|
/** 切换主题(同一内核重绘,只换肤;默认主题输出与旧版一字不差)。 */
|
|
91
137
|
setTheme(theme: UpdatePanelTheme): Promise<void>;
|
|
138
|
+
/** 换一套主题变量(同一内核重绘,只换变量;传 undefined 即清掉覆盖,回主题默认)。 */
|
|
139
|
+
setThemeTokens(tokens: UpdateThemeTokens | undefined): Promise<void>;
|
|
92
140
|
/** 切换排队可见性(重查一次,位置口径不变)。 */
|
|
93
141
|
setShowOthers(show: boolean): Promise<void>;
|
|
94
142
|
/** 收起/展开更新日志(纯视图态,不调电话;轮询与换肤不丢)。 */
|
|
@@ -112,8 +160,8 @@ export interface BlockedCopy {
|
|
|
112
160
|
title: string;
|
|
113
161
|
action: string;
|
|
114
162
|
}
|
|
115
|
-
/** 装不了的原因 →
|
|
116
|
-
export declare function blockedCopy(reason: BlockedReason | null): BlockedCopy | null;
|
|
163
|
+
/** 装不了的原因 → 单语一句话(能装传 null 即回 null,不猜;lang 缺省 zh,零回归)。 */
|
|
164
|
+
export declare function blockedCopy(reason: BlockedReason | null, lang?: AppLang | string | null): BlockedCopy | null;
|
|
117
165
|
export interface FailureCopy {
|
|
118
166
|
zh: string;
|
|
119
167
|
act: string;
|
|
@@ -121,10 +169,10 @@ export interface FailureCopy {
|
|
|
121
169
|
/** 14 码全表是否包含该码(8 阻塞 + 5 电话 + internal;未来码不在此列,走兜底)。 */
|
|
122
170
|
export declare function isKnownFailureCode(code: unknown): boolean;
|
|
123
171
|
/**
|
|
124
|
-
* 稳定码 →
|
|
125
|
-
* 8 阻塞行复用
|
|
172
|
+
* 稳定码 → 单语一句话(14 码全覆盖;未知码回未来兜底,空码回 null;lang 缺省 zh,零回归)。
|
|
173
|
+
* 8 阻塞行复用 blocked 行原文,不另起措辞;面板分支只认返回值,不碰 diag。
|
|
126
174
|
*/
|
|
127
|
-
export declare function failureCopy(code: unknown): FailureCopy | null;
|
|
175
|
+
export declare function failureCopy(code: unknown, lang?: AppLang | string | null): FailureCopy | null;
|
|
128
176
|
/**
|
|
129
177
|
* 失败回包取稳定码:只认 errorKind,error 仅作回退(#22 验收:errorKind=internal 时
|
|
130
178
|
* 不许误判为查新版失败;包内已把未知码收敛为 error=check-failed/errorKind=internal,
|
|
@@ -158,9 +206,11 @@ export interface PanelDiagnosticInput {
|
|
|
158
206
|
/** 显式来源(diag 没有时用;有 diag 时显式优先,缺省仍说人话,不留白)。 */
|
|
159
207
|
route?: string | null;
|
|
160
208
|
checkId?: string | null;
|
|
209
|
+
/** 渲染语言(#63 单语:缺省 zh 零回归;挂载态传 currentLang,纯函数直调可显式传 en/zh)。 */
|
|
210
|
+
lang?: AppLang | string | null;
|
|
161
211
|
}
|
|
162
|
-
/** 组出一段自包含诊断(调用方直接拿去粘工单/issue
|
|
163
|
-
export declare function buildDiagnosticText(input: PanelDiagnosticInput): string;
|
|
212
|
+
/** 组出一段自包含诊断(调用方直接拿去粘工单/issue;粘之前已脱敏,不必手检;#63 入字典单语,lang 缺省 zh 零回归)。 */
|
|
213
|
+
export declare function buildDiagnosticText(input: PanelDiagnosticInput, langOverride?: AppLang | string | null): string;
|
|
164
214
|
export type DiagCopyFormat = 'block' | 'line';
|
|
165
215
|
export interface TolerantDiag {
|
|
166
216
|
stage: string | null;
|
|
@@ -192,8 +242,11 @@ export interface UpdateDiagCopyInput extends PanelDiagnosticInput {
|
|
|
192
242
|
* 第一性:顺序码→摘要→来源(#18 定),怎么办是面板页脚放最后,不插断三元组;
|
|
193
243
|
* 缺省即省略(#18):路由/请求/检查/阶段等缺失即不出现,不占位“未知”;
|
|
194
244
|
* 插件/版本/宿主/使用范围/队列恒显(面板侧显式值兜底),摘要缺省给人话,源缺省给人话(省略本身即信息,人读不懂所以必须说)。
|
|
245
|
+
* #63 入字典单语(§3.4 22 项,队列 3 复用旧块):标签跟随语言,变量与自由文本、两种复制形态与字段顺序冻结不动;
|
|
246
|
+
* 机读 tag [update-diag]/code=/·/— 冻结在代码里不进字典(非人类语言),人类标签(摘要/来源/怎么办/插件=…)走字典;
|
|
247
|
+
* lang 缺省 zh 零回归,detail/变量/占位符不译(v2 非目标,英文界面出现中文正文属正常)。
|
|
195
248
|
*/
|
|
196
|
-
export declare function buildUpdateDiagCopy(input: UpdateDiagCopyInput): string;
|
|
249
|
+
export declare function buildUpdateDiagCopy(input: UpdateDiagCopyInput, langOverride?: AppLang | string | null): string;
|
|
197
250
|
export declare function createMemorySkipStore(now?: () => number): PanelSkipStore;
|
|
198
251
|
/** 浏览器跳过存储(localStorage 形状即可;没有或写坏退内存,绝不因跳过挡住更新)。 */
|
|
199
252
|
export declare function createBrowserSkipStore(pluginId: string, storage?: unknown, now?: () => number): PanelSkipStore;
|
|
@@ -210,7 +263,7 @@ export interface PanelView {
|
|
|
210
263
|
showManual: boolean;
|
|
211
264
|
showReset: boolean;
|
|
212
265
|
queueNote: string | null;
|
|
213
|
-
/** 大印章(状态词)与小印章(一字):取值与原型 `
|
|
266
|
+
/** 大印章(状态词)与小印章(一字):取值与原型 `archive.html:431-432` 的状态映射一一对应。 */
|
|
214
267
|
seal: PanelSeal;
|
|
215
268
|
}
|
|
216
269
|
/** 印章色调:与原型 `seal-ink / seal-green / seal-yellow / seal-red` 四个类同名同义。 */
|
|
@@ -222,6 +275,8 @@ export interface PanelSeal {
|
|
|
222
275
|
mini: string;
|
|
223
276
|
tone: PanelSealTone;
|
|
224
277
|
}
|
|
278
|
+
/** 状态 → 单语印章(lang 缺省 zh,零回归;tone 与原型同名同义,不入字典)。 */
|
|
279
|
+
export declare function panelSealFor(kind: PanelBanner['kind'], lang?: AppLang | string | null): PanelSeal;
|
|
225
280
|
export interface PanelViewInput {
|
|
226
281
|
snapshot: UpdateSnapshot | null;
|
|
227
282
|
manual: string | null;
|
|
@@ -236,16 +291,20 @@ export interface PanelViewInput {
|
|
|
236
291
|
*/
|
|
237
292
|
changelogMarkdown?: string | null;
|
|
238
293
|
}
|
|
239
|
-
export declare function panelViewModel(input: PanelViewInput): PanelView;
|
|
294
|
+
export declare function panelViewModel(input: PanelViewInput, lang?: AppLang | string | null): PanelView;
|
|
240
295
|
export declare const UPDATE_PANEL_CSS: string;
|
|
241
|
-
export declare const
|
|
296
|
+
export declare const UPDATE_PANEL_ARCHIVE_CSS: string;
|
|
242
297
|
export interface PanelRenderInput extends PanelViewInput {
|
|
243
298
|
mode: UpdatePanelMode;
|
|
244
299
|
showOthers: boolean;
|
|
245
300
|
pluginId: string;
|
|
246
301
|
copyNotice: string | null;
|
|
247
|
-
/**
|
|
302
|
+
/** 渲染语言(#61 单语:缺省 zh;挂载态传 currentLang,纯函数直调可显式传 en/zh)。 */
|
|
303
|
+
lang?: AppLang | string | null;
|
|
304
|
+
/** 可选主题:不传即默认(输出与旧版一字不差);`archive` 切档案卷。 */
|
|
248
305
|
theme?: UpdatePanelTheme;
|
|
306
|
+
/** 主题变量覆盖:见 UpdateThemeTokens;写到面板根上,不传即无 style 属性。 */
|
|
307
|
+
themeTokens?: UpdateThemeTokens;
|
|
249
308
|
/** 使用范围名(profile):面板「使用范围」一栏的唯一来源,缺省显示“未知”,不猜。 */
|
|
250
309
|
profileName?: string | null;
|
|
251
310
|
/** 宿主种类:进诊断文本;缺省显示“未知”。 */
|
|
@@ -279,12 +338,12 @@ export interface PanelFailureRef {
|
|
|
279
338
|
source: 'check' | 'install' | null;
|
|
280
339
|
volatile: boolean;
|
|
281
340
|
}
|
|
282
|
-
/** 锁存时刻 → 本地 HH:MM:SS(失败档案“失败于”用;非法值回 null
|
|
283
|
-
export declare function formatLatchTime(atMs: unknown): string | null;
|
|
284
|
-
/** 内核 HTML
|
|
285
|
-
export declare function renderUpdatePanelKernel(input: PanelRenderInput, view: PanelView): string;
|
|
341
|
+
/** 锁存时刻 → 本地 HH:MM:SS(失败档案“失败于”用;非法值回 null,不画时间;#62 跟随宿主 locale)。 */
|
|
342
|
+
export declare function formatLatchTime(atMs: unknown, lang?: AppLang | string | null): string | null;
|
|
343
|
+
/** 内核 HTML(双形态行为等价的根:同一视图产出同一内核,只换外层;#62 按 lang 单语,缺省 zh 零回归)。 */
|
|
344
|
+
export declare function renderUpdatePanelKernel(input: PanelRenderInput, view: PanelView, lang?: AppLang | string | null): string;
|
|
286
345
|
/** 整面板 HTML(含样式;重绘即整体替换 innerHTML,故每次都带 style 也只留一份)。 */
|
|
287
|
-
export declare function renderUpdatePanelHTML(input: PanelRenderInput): string;
|
|
346
|
+
export declare function renderUpdatePanelHTML(input: PanelRenderInput, lang?: AppLang | string | null): string;
|
|
288
347
|
/**
|
|
289
348
|
* mount 自动查抑制谓词(#48:#46 结论固化,纯函数):
|
|
290
349
|
* 仅当快照任务态为 installing/verifying,或已有查/装在途动作时不发起;
|