dsh-plugin-update 0.5.8 → 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;
@@ -69,10 +70,10 @@ export interface UpdatePanelOptions {
69
70
  */
70
71
  onCloseRequested?: () => void | Promise<void>;
71
72
  /**
72
- * 语言覆盖(#60 窗口期占位:本票只加选项不消费,传了暂不生效,消费留给 #61-#66)。
73
- * 形态与入口件一致:'zh' | 'en' | { getActive(): string; subscribe?(cb): () => void }。
73
+ * 语言覆盖(#61 起消费:'zh' | 'en' | { getActive(): string; subscribe?(cb): () => void },不传即跟随全局信号)。
74
+ * 与入口件同一口径:显式覆盖 > html[lang] > navigator > zh。
74
75
  */
75
- locale?: unknown;
76
+ locale?: LocaleOption;
76
77
  }
77
78
  /** 挂载点:只要有 innerHTML 的容器即可(浏览器元素或测试替身都行)。 */
78
79
  export interface UpdatePanelContainer {
@@ -112,8 +113,8 @@ export interface BlockedCopy {
112
113
  title: string;
113
114
  action: string;
114
115
  }
115
- /** 装不了的原因 → 中文一句话(能装传 null 即回 null,不猜)。 */
116
- 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;
117
118
  export interface FailureCopy {
118
119
  zh: string;
119
120
  act: string;
@@ -121,10 +122,10 @@ export interface FailureCopy {
121
122
  /** 14 码全表是否包含该码(8 阻塞 + 5 电话 + internal;未来码不在此列,走兜底)。 */
122
123
  export declare function isKnownFailureCode(code: unknown): boolean;
123
124
  /**
124
- * 稳定码 → 中文一句话(14 码全覆盖;未知码回未来兜底,空码回 null)。
125
- * 8 阻塞行复用 BLOCKED_COPY 原文,不另起措辞;面板分支只认返回值,不碰 diag。
125
+ * 稳定码 → 单语一句话(14 码全覆盖;未知码回未来兜底,空码回 null;lang 缺省 zh,零回归)。
126
+ * 8 阻塞行复用 blocked 行原文,不另起措辞;面板分支只认返回值,不碰 diag。
126
127
  */
127
- export declare function failureCopy(code: unknown): FailureCopy | null;
128
+ export declare function failureCopy(code: unknown, lang?: AppLang | string | null): FailureCopy | null;
128
129
  /**
129
130
  * 失败回包取稳定码:只认 errorKind,error 仅作回退(#22 验收:errorKind=internal 时
130
131
  * 不许误判为查新版失败;包内已把未知码收敛为 error=check-failed/errorKind=internal,
@@ -158,9 +159,11 @@ export interface PanelDiagnosticInput {
158
159
  /** 显式来源(diag 没有时用;有 diag 时显式优先,缺省仍说人话,不留白)。 */
159
160
  route?: string | null;
160
161
  checkId?: string | null;
162
+ /** 渲染语言(#63 单语:缺省 zh 零回归;挂载态传 currentLang,纯函数直调可显式传 en/zh)。 */
163
+ lang?: AppLang | string | null;
161
164
  }
162
- /** 组出一段自包含诊断(调用方直接拿去粘工单/issue;粘之前已脱敏,不必手检)。 */
163
- export declare function buildDiagnosticText(input: PanelDiagnosticInput): string;
165
+ /** 组出一段自包含诊断(调用方直接拿去粘工单/issue;粘之前已脱敏,不必手检;#63 入字典单语,lang 缺省 zh 零回归)。 */
166
+ export declare function buildDiagnosticText(input: PanelDiagnosticInput, langOverride?: AppLang | string | null): string;
164
167
  export type DiagCopyFormat = 'block' | 'line';
165
168
  export interface TolerantDiag {
166
169
  stage: string | null;
@@ -192,8 +195,11 @@ export interface UpdateDiagCopyInput extends PanelDiagnosticInput {
192
195
  * 第一性:顺序码→摘要→来源(#18 定),怎么办是面板页脚放最后,不插断三元组;
193
196
  * 缺省即省略(#18):路由/请求/检查/阶段等缺失即不出现,不占位“未知”;
194
197
  * 插件/版本/宿主/使用范围/队列恒显(面板侧显式值兜底),摘要缺省给人话,源缺省给人话(省略本身即信息,人读不懂所以必须说)。
198
+ * #63 入字典单语(§3.4 22 项,队列 3 复用旧块):标签跟随语言,变量与自由文本、两种复制形态与字段顺序冻结不动;
199
+ * 机读 tag [update-diag]/code=/·/— 冻结在代码里不进字典(非人类语言),人类标签(摘要/来源/怎么办/插件=…)走字典;
200
+ * lang 缺省 zh 零回归,detail/变量/占位符不译(v2 非目标,英文界面出现中文正文属正常)。
195
201
  */
196
- export declare function buildUpdateDiagCopy(input: UpdateDiagCopyInput): string;
202
+ export declare function buildUpdateDiagCopy(input: UpdateDiagCopyInput, langOverride?: AppLang | string | null): string;
197
203
  export declare function createMemorySkipStore(now?: () => number): PanelSkipStore;
198
204
  /** 浏览器跳过存储(localStorage 形状即可;没有或写坏退内存,绝不因跳过挡住更新)。 */
199
205
  export declare function createBrowserSkipStore(pluginId: string, storage?: unknown, now?: () => number): PanelSkipStore;
@@ -210,7 +216,7 @@ export interface PanelView {
210
216
  showManual: boolean;
211
217
  showReset: boolean;
212
218
  queueNote: string | null;
213
- /** 大印章(状态词)与小印章(一字):取值与原型 `d5-paper.html:431-432` 的状态映射一一对应。 */
219
+ /** 大印章(状态词)与小印章(一字):取值与原型 `archive.html:431-432` 的状态映射一一对应。 */
214
220
  seal: PanelSeal;
215
221
  }
216
222
  /** 印章色调:与原型 `seal-ink / seal-green / seal-yellow / seal-red` 四个类同名同义。 */
@@ -222,6 +228,8 @@ export interface PanelSeal {
222
228
  mini: string;
223
229
  tone: PanelSealTone;
224
230
  }
231
+ /** 状态 → 单语印章(lang 缺省 zh,零回归;tone 与原型同名同义,不入字典)。 */
232
+ export declare function panelSealFor(kind: PanelBanner['kind'], lang?: AppLang | string | null): PanelSeal;
225
233
  export interface PanelViewInput {
226
234
  snapshot: UpdateSnapshot | null;
227
235
  manual: string | null;
@@ -236,15 +244,17 @@ export interface PanelViewInput {
236
244
  */
237
245
  changelogMarkdown?: string | null;
238
246
  }
239
- export declare function panelViewModel(input: PanelViewInput): PanelView;
247
+ export declare function panelViewModel(input: PanelViewInput, lang?: AppLang | string | null): PanelView;
240
248
  export declare const UPDATE_PANEL_CSS: string;
241
- export declare const UPDATE_PANEL_D5_CSS: string;
249
+ export declare const UPDATE_PANEL_ARCHIVE_CSS: string;
242
250
  export interface PanelRenderInput extends PanelViewInput {
243
251
  mode: UpdatePanelMode;
244
252
  showOthers: boolean;
245
253
  pluginId: string;
246
254
  copyNotice: string | null;
247
- /** 可选主题:不传即默认(输出与旧版一字不差);`archive` 切档案卷(旧别名 `d5-paper` 仍收)。 */
255
+ /** 渲染语言(#61 单语:缺省 zh;挂载态传 currentLang,纯函数直调可显式传 en/zh)。 */
256
+ lang?: AppLang | string | null;
257
+ /** 可选主题:不传即默认(输出与旧版一字不差);`archive` 切档案卷。 */
248
258
  theme?: UpdatePanelTheme;
249
259
  /** 使用范围名(profile):面板「使用范围」一栏的唯一来源,缺省显示“未知”,不猜。 */
250
260
  profileName?: string | null;
@@ -279,12 +289,12 @@ export interface PanelFailureRef {
279
289
  source: 'check' | 'install' | null;
280
290
  volatile: boolean;
281
291
  }
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;
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;
286
296
  /** 整面板 HTML(含样式;重绘即整体替换 innerHTML,故每次都带 style 也只留一份)。 */
287
- export declare function renderUpdatePanelHTML(input: PanelRenderInput): string;
297
+ export declare function renderUpdatePanelHTML(input: PanelRenderInput, lang?: AppLang | string | null): string;
288
298
  /**
289
299
  * mount 自动查抑制谓词(#48:#46 结论固化,纯函数):
290
300
  * 仅当快照任务态为 installing/verifying,或已有查/装在途动作时不发起;