dsh-plugin-update 0.5.7 → 0.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/dist/panel.d.ts CHANGED
@@ -1,15 +1,16 @@
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 顺序;`d5-paper` 为旧别名)。 */
6
+ /** 面板主题:默认最小可用样式;`archive` 为档案卷纸面浅色(只换肤,不换 DOM 顺序)。 */
6
7
  /**
7
8
  * 面板主题:`default` 最小可用深色;`archive` 档案卷纸面浅色(原型敲定的案卷风格,只换肤)。
8
- * `d5-paper` 是 archive 的旧别名(历史取值),仍可用,渲染逐字相同。
9
+ * `archive` 是 archive 的旧别名(历史取值),仍可用,渲染逐字相同。
9
10
  */
10
- export type UpdatePanelTheme = 'default' | 'archive' | 'd5-paper';
11
+ export type UpdatePanelTheme = 'default' | 'archive';
11
12
  /**
12
- * 主题归一:archive 为首选名,旧别名 d5-paper 仍收并归到 archive(DOM 属性只出 archive);
13
+ * 主题归一:`archive` 挂 `data-theme="archive"`,其余一律回 `default`(DOM 属性只出 `archive`);
13
14
  * 其余一律回 default(纯渲染函数永不抛;挂载/setTheme 的非法值另行抛错)。
14
15
  */
15
16
  export declare function normalizePanelTheme(value: unknown): 'default' | 'archive';
@@ -26,7 +27,7 @@ export interface UpdatePanelOptions {
26
27
  prefix?: string;
27
28
  /** 摆放形态:默认内嵌。 */
28
29
  mode?: UpdatePanelMode;
29
- /** 面板主题:默认 `default`(最小可用样式,一字不动);传 `archive` 切档案卷(`d5-paper` 为旧别名)。 */
30
+ /** 面板主题:默认 `default`(最小可用样式,一字不动);传 `archive` 切档案卷。 */
30
31
  theme?: UpdatePanelTheme;
31
32
  /** 是否看他人排队明细:默认只看自己的(他人仅露正忙占位,位置照给)。 */
32
33
  showOthers?: boolean;
@@ -68,6 +69,11 @@ export interface UpdatePanelOptions {
68
69
  * 不传则回退为只停轮询(unmount),DOM 留给调用方处理。入口件打开的 dialog 已内置(收 dialog + 还原按钮)。
69
70
  */
70
71
  onCloseRequested?: () => void | Promise<void>;
72
+ /**
73
+ * 语言覆盖(#61 起消费:'zh' | 'en' | { getActive(): string; subscribe?(cb): () => void },不传即跟随全局信号)。
74
+ * 与入口件同一口径:显式覆盖 > html[lang] > navigator > zh。
75
+ */
76
+ locale?: LocaleOption;
71
77
  }
72
78
  /** 挂载点:只要有 innerHTML 的容器即可(浏览器元素或测试替身都行)。 */
73
79
  export interface UpdatePanelContainer {
@@ -107,8 +113,8 @@ export interface BlockedCopy {
107
113
  title: string;
108
114
  action: string;
109
115
  }
110
- /** 装不了的原因 → 中文一句话(能装传 null 即回 null,不猜)。 */
111
- export declare function blockedCopy(reason: BlockedReason | null): BlockedCopy | null;
116
+ /** 装不了的原因 → 单语一句话(能装传 null 即回 null,不猜;lang 缺省 zh,零回归)。 */
117
+ export declare function blockedCopy(reason: BlockedReason | null, lang?: AppLang | string | null): BlockedCopy | null;
112
118
  export interface FailureCopy {
113
119
  zh: string;
114
120
  act: string;
@@ -116,10 +122,10 @@ export interface FailureCopy {
116
122
  /** 14 码全表是否包含该码(8 阻塞 + 5 电话 + internal;未来码不在此列,走兜底)。 */
117
123
  export declare function isKnownFailureCode(code: unknown): boolean;
118
124
  /**
119
- * 稳定码 → 中文一句话(14 码全覆盖;未知码回未来兜底,空码回 null)。
120
- * 8 阻塞行复用 BLOCKED_COPY 原文,不另起措辞;面板分支只认返回值,不碰 diag。
125
+ * 稳定码 → 单语一句话(14 码全覆盖;未知码回未来兜底,空码回 null;lang 缺省 zh,零回归)。
126
+ * 8 阻塞行复用 blocked 行原文,不另起措辞;面板分支只认返回值,不碰 diag。
121
127
  */
122
- export declare function failureCopy(code: unknown): FailureCopy | null;
128
+ export declare function failureCopy(code: unknown, lang?: AppLang | string | null): FailureCopy | null;
123
129
  /**
124
130
  * 失败回包取稳定码:只认 errorKind,error 仅作回退(#22 验收:errorKind=internal 时
125
131
  * 不许误判为查新版失败;包内已把未知码收敛为 error=check-failed/errorKind=internal,
@@ -153,9 +159,11 @@ export interface PanelDiagnosticInput {
153
159
  /** 显式来源(diag 没有时用;有 diag 时显式优先,缺省仍说人话,不留白)。 */
154
160
  route?: string | null;
155
161
  checkId?: string | null;
162
+ /** 渲染语言(#63 单语:缺省 zh 零回归;挂载态传 currentLang,纯函数直调可显式传 en/zh)。 */
163
+ lang?: AppLang | string | null;
156
164
  }
157
- /** 组出一段自包含诊断(调用方直接拿去粘工单/issue;粘之前已脱敏,不必手检)。 */
158
- export declare function buildDiagnosticText(input: PanelDiagnosticInput): string;
165
+ /** 组出一段自包含诊断(调用方直接拿去粘工单/issue;粘之前已脱敏,不必手检;#63 入字典单语,lang 缺省 zh 零回归)。 */
166
+ export declare function buildDiagnosticText(input: PanelDiagnosticInput, langOverride?: AppLang | string | null): string;
159
167
  export type DiagCopyFormat = 'block' | 'line';
160
168
  export interface TolerantDiag {
161
169
  stage: string | null;
@@ -187,8 +195,11 @@ export interface UpdateDiagCopyInput extends PanelDiagnosticInput {
187
195
  * 第一性:顺序码→摘要→来源(#18 定),怎么办是面板页脚放最后,不插断三元组;
188
196
  * 缺省即省略(#18):路由/请求/检查/阶段等缺失即不出现,不占位“未知”;
189
197
  * 插件/版本/宿主/使用范围/队列恒显(面板侧显式值兜底),摘要缺省给人话,源缺省给人话(省略本身即信息,人读不懂所以必须说)。
198
+ * #63 入字典单语(§3.4 22 项,队列 3 复用旧块):标签跟随语言,变量与自由文本、两种复制形态与字段顺序冻结不动;
199
+ * 机读 tag [update-diag]/code=/·/— 冻结在代码里不进字典(非人类语言),人类标签(摘要/来源/怎么办/插件=…)走字典;
200
+ * lang 缺省 zh 零回归,detail/变量/占位符不译(v2 非目标,英文界面出现中文正文属正常)。
190
201
  */
191
- export declare function buildUpdateDiagCopy(input: UpdateDiagCopyInput): string;
202
+ export declare function buildUpdateDiagCopy(input: UpdateDiagCopyInput, langOverride?: AppLang | string | null): string;
192
203
  export declare function createMemorySkipStore(now?: () => number): PanelSkipStore;
193
204
  /** 浏览器跳过存储(localStorage 形状即可;没有或写坏退内存,绝不因跳过挡住更新)。 */
194
205
  export declare function createBrowserSkipStore(pluginId: string, storage?: unknown, now?: () => number): PanelSkipStore;
@@ -205,7 +216,7 @@ export interface PanelView {
205
216
  showManual: boolean;
206
217
  showReset: boolean;
207
218
  queueNote: string | null;
208
- /** 大印章(状态词)与小印章(一字):取值与原型 `d5-paper.html:431-432` 的状态映射一一对应。 */
219
+ /** 大印章(状态词)与小印章(一字):取值与原型 `archive.html:431-432` 的状态映射一一对应。 */
209
220
  seal: PanelSeal;
210
221
  }
211
222
  /** 印章色调:与原型 `seal-ink / seal-green / seal-yellow / seal-red` 四个类同名同义。 */
@@ -217,6 +228,8 @@ export interface PanelSeal {
217
228
  mini: string;
218
229
  tone: PanelSealTone;
219
230
  }
231
+ /** 状态 → 单语印章(lang 缺省 zh,零回归;tone 与原型同名同义,不入字典)。 */
232
+ export declare function panelSealFor(kind: PanelBanner['kind'], lang?: AppLang | string | null): PanelSeal;
220
233
  export interface PanelViewInput {
221
234
  snapshot: UpdateSnapshot | null;
222
235
  manual: string | null;
@@ -231,15 +244,17 @@ export interface PanelViewInput {
231
244
  */
232
245
  changelogMarkdown?: string | null;
233
246
  }
234
- export declare function panelViewModel(input: PanelViewInput): PanelView;
247
+ export declare function panelViewModel(input: PanelViewInput, lang?: AppLang | string | null): PanelView;
235
248
  export declare const UPDATE_PANEL_CSS: string;
236
- export declare const UPDATE_PANEL_D5_CSS: string;
249
+ export declare const UPDATE_PANEL_ARCHIVE_CSS: string;
237
250
  export interface PanelRenderInput extends PanelViewInput {
238
251
  mode: UpdatePanelMode;
239
252
  showOthers: boolean;
240
253
  pluginId: string;
241
254
  copyNotice: string | null;
242
- /** 可选主题:不传即默认(输出与旧版一字不差);`archive` 切档案卷(旧别名 `d5-paper` 仍收)。 */
255
+ /** 渲染语言(#61 单语:缺省 zh;挂载态传 currentLang,纯函数直调可显式传 en/zh)。 */
256
+ lang?: AppLang | string | null;
257
+ /** 可选主题:不传即默认(输出与旧版一字不差);`archive` 切档案卷。 */
243
258
  theme?: UpdatePanelTheme;
244
259
  /** 使用范围名(profile):面板「使用范围」一栏的唯一来源,缺省显示“未知”,不猜。 */
245
260
  profileName?: string | null;
@@ -274,12 +289,12 @@ export interface PanelFailureRef {
274
289
  source: 'check' | 'install' | null;
275
290
  volatile: boolean;
276
291
  }
277
- /** 锁存时刻 → 本地 HH:MM:SS(失败档案“失败于”用;非法值回 null,不画时间)。 */
278
- export declare function formatLatchTime(atMs: unknown): string | null;
279
- /** 内核 HTML(双形态行为等价的根:同一视图产出同一内核,只换外层)。 */
280
- export declare function renderUpdatePanelKernel(input: PanelRenderInput, view: PanelView): string;
292
+ /** 锁存时刻 → 本地 HH:MM:SS(失败档案“失败于”用;非法值回 null,不画时间;#62 跟随宿主 locale)。 */
293
+ export declare function formatLatchTime(atMs: unknown, lang?: AppLang | string | null): string | null;
294
+ /** 内核 HTML(双形态行为等价的根:同一视图产出同一内核,只换外层;#62 按 lang 单语,缺省 zh 零回归)。 */
295
+ export declare function renderUpdatePanelKernel(input: PanelRenderInput, view: PanelView, lang?: AppLang | string | null): string;
281
296
  /** 整面板 HTML(含样式;重绘即整体替换 innerHTML,故每次都带 style 也只留一份)。 */
282
- export declare function renderUpdatePanelHTML(input: PanelRenderInput): string;
297
+ export declare function renderUpdatePanelHTML(input: PanelRenderInput, lang?: AppLang | string | null): string;
283
298
  /**
284
299
  * mount 自动查抑制谓词(#48:#46 结论固化,纯函数):
285
300
  * 仅当快照任务态为 installing/verifying,或已有查/装在途动作时不发起;