@lmzhen/dsh-evolution-client-kit 0.47.0 → 0.49.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/lib/generated/i18n/evolution-merge.js +48 -16
- package/lib/index.js +59 -319
- package/lib/types/generated/contracts.generated.d.ts +0 -2
- package/lib/types/generated/i18n/evolution-merge.d.ts +40 -8
- package/lib/types/generated/i18n/evolution-merge.js +48 -16
- package/lib/types/generated/i18n.generated.d.ts +40 -8
- package/lib/types/index.d.ts +3 -9
- package/lib/types/index.js +3 -7
- package/lib/types/locale.d.ts +17 -0
- package/lib/types/locale.js +53 -0
- package/lib/types/panel.d.ts +2 -3
- package/lib/types/panel.js +4 -47
- package/lib/types/presentation/action-menu.d.ts +0 -14
- package/lib/types/presentation/action-menu.js +0 -25
- package/lib/types/styles.d.ts +4 -0
- package/lib/types/styles.js +13 -0
- package/lib/types/workbench-view.js +4 -43
- package/package.json +1 -1
- package/lib/types/action.d.ts +0 -42
- package/lib/types/action.js +0 -46
- package/lib/types/async-resource.d.ts +0 -48
- package/lib/types/async-resource.js +0 -96
- package/lib/types/notice.d.ts +0 -18
- package/lib/types/notice.js +0 -17
- package/lib/types/presentation/chips.d.ts +0 -23
- package/lib/types/presentation/chips.js +0 -24
- package/lib/types/presentation/disclosure-group.d.ts +0 -13
- package/lib/types/presentation/disclosure-group.js +0 -11
- package/lib/types/presentation/time-text.d.ts +0 -15
- package/lib/types/presentation/time-text.js +0 -20
|
@@ -22,7 +22,7 @@ const dictionaries = {
|
|
|
22
22
|
"blocked.doctor": "复制诊断命令",
|
|
23
23
|
"blocked.hint": "修好合并数据后再刷新;面板不会自动退回旧数据。",
|
|
24
24
|
"blocked.reason.forward-only": "合并状态版本过新,当前面板暂不支持。",
|
|
25
|
-
"blocked.reason.migration-blocked": "
|
|
25
|
+
"blocked.reason.migration-blocked": "合并数据还是旧格式,自动升级没有完成;面板已暂停读取。",
|
|
26
26
|
"blocked.reason.needs-repair": "合并状态需要修复,面板已暂停读取。",
|
|
27
27
|
"blocked.reason.unknown": "合并状态未就绪,面板已暂停读取。",
|
|
28
28
|
"blocked.title": "合并状态未就绪",
|
|
@@ -225,7 +225,11 @@ const dictionaries = {
|
|
|
225
225
|
"verify.cancelled": "已取消",
|
|
226
226
|
"verify.failed": "失败",
|
|
227
227
|
"verify.queued": "排队",
|
|
228
|
-
"verify.running": "进行中"
|
|
228
|
+
"verify.running": "进行中",
|
|
229
|
+
"blocked.hint.migration-blocked": "先停止宿主,再运行迁移工具;它会先备份旧数据,失败可以恢复。完成后刷新页面。",
|
|
230
|
+
"blocked.hint.forward-only": "合并数据来自更新版本的面板;先升级插件,再刷新页面。",
|
|
231
|
+
"blocked.hint.needs-repair": "合并数据不完整;运行迁移工具,它会先备份再修复。完成后刷新页面。",
|
|
232
|
+
"blocked.hint.unknown": "先运行诊断命令确认合并状态,再刷新页面。"
|
|
229
233
|
},
|
|
230
234
|
en: {
|
|
231
235
|
"action.approve": "Copy approve command",
|
|
@@ -246,7 +250,7 @@ const dictionaries = {
|
|
|
246
250
|
"blocked.doctor": "Copy diagnostics command",
|
|
247
251
|
"blocked.hint": "Fix the merge data, then refresh; the panel won't fall back to older data on its own.",
|
|
248
252
|
"blocked.reason.forward-only": "The merge state was written by a newer version; this panel doesn't support it yet.",
|
|
249
|
-
"blocked.reason.migration-blocked": "The merge data
|
|
253
|
+
"blocked.reason.migration-blocked": "The merge data is still in the old format and the automatic upgrade did not finish, so the panel has paused reading it.",
|
|
250
254
|
"blocked.reason.needs-repair": "The merge state needs repair, so the panel has stopped reading it.",
|
|
251
255
|
"blocked.reason.unknown": "The merge state isn't ready, so the panel has stopped reading it.",
|
|
252
256
|
"blocked.title": "Merge state isn't ready",
|
|
@@ -449,7 +453,11 @@ const dictionaries = {
|
|
|
449
453
|
"verify.cancelled": "Cancelled",
|
|
450
454
|
"verify.failed": "Failed",
|
|
451
455
|
"verify.queued": "Queued",
|
|
452
|
-
"verify.running": "Running"
|
|
456
|
+
"verify.running": "Running",
|
|
457
|
+
"blocked.hint.migration-blocked": "Stop the host, then run the migration tool. It backs up the old data first and can restore it on failure. Refresh when done.",
|
|
458
|
+
"blocked.hint.forward-only": "The merge data comes from a newer panel version. Upgrade the plugin, then refresh.",
|
|
459
|
+
"blocked.hint.needs-repair": "The merge data is incomplete. Run the migration tool; it backs up before repairing. Refresh when done.",
|
|
460
|
+
"blocked.hint.unknown": "Run diagnostics to check the merge state, then refresh."
|
|
453
461
|
},
|
|
454
462
|
ja: {
|
|
455
463
|
"action.approve": "承認コマンドをコピー",
|
|
@@ -470,7 +478,7 @@ const dictionaries = {
|
|
|
470
478
|
"blocked.doctor": "診断コマンドをコピー",
|
|
471
479
|
"blocked.hint": "マージデータを修復してから更新してください。パネルが自動で古いデータに戻ることはありません。",
|
|
472
480
|
"blocked.reason.forward-only": "マージ状態のバージョンが新しすぎるため、このパネルでは読み取れません。",
|
|
473
|
-
"blocked.reason.migration-blocked": "
|
|
481
|
+
"blocked.reason.migration-blocked": "マージデータが旧形式のままで、自動アップグレードが完了していません。パネルは読み取りを停止しています。",
|
|
474
482
|
"blocked.reason.needs-repair": "マージ状態の修復が必要なため、パネルの読み取りを一時停止しています。",
|
|
475
483
|
"blocked.reason.unknown": "マージ状態が未準備のため、パネルの読み取りを一時停止しています。",
|
|
476
484
|
"blocked.title": "マージ状態が未準備です",
|
|
@@ -673,7 +681,11 @@ const dictionaries = {
|
|
|
673
681
|
"verify.cancelled": "キャンセル済み",
|
|
674
682
|
"verify.failed": "失敗",
|
|
675
683
|
"verify.queued": "待機中",
|
|
676
|
-
"verify.running": "実行中"
|
|
684
|
+
"verify.running": "実行中",
|
|
685
|
+
"blocked.hint.migration-blocked": "ホストを停止してから移行ツールを実行してください。実行前に旧データをバックアップし、失敗時は復元できます。完了後に再読み込みしてください。",
|
|
686
|
+
"blocked.hint.forward-only": "マージデータは新しいバージョンのパネルで作成されています。プラグインを更新してから再読み込みしてください。",
|
|
687
|
+
"blocked.hint.needs-repair": "マージデータが不完全です。移行ツールを実行してください。修復前にバックアップします。完了後に再読み込みしてください。",
|
|
688
|
+
"blocked.hint.unknown": "診断を実行してマージ状態を確認してから、再読み込みしてください。"
|
|
677
689
|
},
|
|
678
690
|
es: {
|
|
679
691
|
"action.approve": "Copiar el comando de aprobación",
|
|
@@ -694,7 +706,7 @@ const dictionaries = {
|
|
|
694
706
|
"blocked.doctor": "Copiar el comando de diagnóstico",
|
|
695
707
|
"blocked.hint": "Arregla los datos del merge y luego actualiza; el panel no vuelve por su cuenta a datos antiguos.",
|
|
696
708
|
"blocked.reason.forward-only": "El estado del merge es más nuevo de lo que admite este panel.",
|
|
697
|
-
"blocked.reason.migration-blocked": "Los datos
|
|
709
|
+
"blocked.reason.migration-blocked": "Los datos de fusión siguen en el formato antiguo y la actualización automática no terminó; el panel ha pausado la lectura.",
|
|
698
710
|
"blocked.reason.needs-repair": "El estado del merge necesita reparación; el panel ha dejado de leerlo.",
|
|
699
711
|
"blocked.reason.unknown": "El estado del merge no está listo; el panel ha dejado de leerlo.",
|
|
700
712
|
"blocked.title": "El estado del merge no está listo",
|
|
@@ -897,7 +909,11 @@ const dictionaries = {
|
|
|
897
909
|
"verify.cancelled": "cancelada",
|
|
898
910
|
"verify.failed": "fallida",
|
|
899
911
|
"verify.queued": "en cola",
|
|
900
|
-
"verify.running": "en curso"
|
|
912
|
+
"verify.running": "en curso",
|
|
913
|
+
"blocked.hint.migration-blocked": "Detén el host y ejecuta la herramienta de migración. Antes hace una copia de seguridad y puede restaurarla si falla. Actualiza la página al terminar.",
|
|
914
|
+
"blocked.hint.forward-only": "Los datos de fusión vienen de una versión más reciente del panel. Actualiza el plugin y vuelve a cargar.",
|
|
915
|
+
"blocked.hint.needs-repair": "Los datos de fusión están incompletos. Ejecuta la herramienta de migración; hace copia antes de reparar. Actualiza al terminar.",
|
|
916
|
+
"blocked.hint.unknown": "Ejecuta el diagnóstico para comprobar el estado de fusión y luego actualiza la página."
|
|
901
917
|
},
|
|
902
918
|
fr: {
|
|
903
919
|
"action.approve": "Copier la commande d’approbation",
|
|
@@ -918,7 +934,7 @@ const dictionaries = {
|
|
|
918
934
|
"blocked.doctor": "Copier la commande de diagnostic",
|
|
919
935
|
"blocked.hint": "Réparez les données de fusion puis actualisez ; le panneau ne revient pas tout seul aux anciennes données.",
|
|
920
936
|
"blocked.reason.forward-only": "L’état de fusion a été écrit par une version plus récente ; ce panneau ne peut pas le lire.",
|
|
921
|
-
"blocked.reason.migration-blocked": "Les données de fusion
|
|
937
|
+
"blocked.reason.migration-blocked": "Les données de fusion sont encore dans l’ancien format et la mise à niveau automatique ne s’est pas terminée ; le panneau a suspendu la lecture.",
|
|
922
938
|
"blocked.reason.needs-repair": "L’état de fusion doit être réparé ; le panneau est en pause.",
|
|
923
939
|
"blocked.reason.unknown": "L’état de fusion n’est pas prêt ; le panneau est en pause.",
|
|
924
940
|
"blocked.title": "État de fusion bloqué",
|
|
@@ -1121,7 +1137,11 @@ const dictionaries = {
|
|
|
1121
1137
|
"verify.cancelled": "annulé",
|
|
1122
1138
|
"verify.failed": "échec",
|
|
1123
1139
|
"verify.queued": "en file",
|
|
1124
|
-
"verify.running": "en cours"
|
|
1140
|
+
"verify.running": "en cours",
|
|
1141
|
+
"blocked.hint.migration-blocked": "Arrêtez l’hôte, puis lancez l’outil de migration. Il sauvegarde d’abord les anciennes données et peut les restaurer en cas d’échec. Rechargez ensuite.",
|
|
1142
|
+
"blocked.hint.forward-only": "Les données de fusion proviennent d’une version plus récente du panneau. Mettez le plugin à jour, puis rechargez.",
|
|
1143
|
+
"blocked.hint.needs-repair": "Les données de fusion sont incomplètes. Lancez l’outil de migration ; il sauvegarde avant de réparer. Rechargez ensuite.",
|
|
1144
|
+
"blocked.hint.unknown": "Lancez le diagnostic pour vérifier l’état de fusion, puis rechargez."
|
|
1125
1145
|
},
|
|
1126
1146
|
de: {
|
|
1127
1147
|
"action.approve": "Freigabe-Befehl kopieren",
|
|
@@ -1142,7 +1162,7 @@ const dictionaries = {
|
|
|
1142
1162
|
"blocked.doctor": "Diagnose-Befehl kopieren",
|
|
1143
1163
|
"blocked.hint": "Merge-Daten reparieren und dann aktualisieren; das Panel fällt nicht von selbst auf ältere Daten zurück.",
|
|
1144
1164
|
"blocked.reason.forward-only": "Der Merge-Status stammt aus einer neueren Version; dieses Panel kann ihn nicht lesen.",
|
|
1145
|
-
"blocked.reason.migration-blocked": "Die
|
|
1165
|
+
"blocked.reason.migration-blocked": "Die Zusammenführungsdaten liegen noch im alten Format vor, und die automatische Aktualisierung wurde nicht abgeschlossen; die Oberfläche liest sie nicht mehr.",
|
|
1146
1166
|
"blocked.reason.needs-repair": "Der Merge-Status muss repariert werden; das Lesen ist pausiert.",
|
|
1147
1167
|
"blocked.reason.unknown": "Der Merge-Status ist nicht bereit; das Lesen ist pausiert.",
|
|
1148
1168
|
"blocked.title": "Merge-Status blockiert",
|
|
@@ -1345,7 +1365,11 @@ const dictionaries = {
|
|
|
1345
1365
|
"verify.cancelled": "Abgebrochen",
|
|
1346
1366
|
"verify.failed": "Fehlgeschlagen",
|
|
1347
1367
|
"verify.queued": "In Warteschlange",
|
|
1348
|
-
"verify.running": "Läuft"
|
|
1368
|
+
"verify.running": "Läuft",
|
|
1369
|
+
"blocked.hint.migration-blocked": "Beenden Sie den Host und starten Sie dann das Migrationswerkzeug. Es sichert zuerst die alten Daten und kann sie bei einem Fehler wiederherstellen. Danach neu laden.",
|
|
1370
|
+
"blocked.hint.forward-only": "Die Zusammenführungsdaten stammen aus einer neueren Version der Oberfläche. Aktualisieren Sie das Plugin und laden Sie dann neu.",
|
|
1371
|
+
"blocked.hint.needs-repair": "Die Zusammenführungsdaten sind unvollständig. Starten Sie das Migrationswerkzeug; es sichert vor der Reparatur. Danach neu laden.",
|
|
1372
|
+
"blocked.hint.unknown": "Starten Sie die Diagnose, um den Zusammenführungsstatus zu prüfen, und laden Sie dann neu."
|
|
1349
1373
|
},
|
|
1350
1374
|
ru: {
|
|
1351
1375
|
"action.approve": "Скопировать команду одобрения",
|
|
@@ -1366,7 +1390,7 @@ const dictionaries = {
|
|
|
1366
1390
|
"blocked.doctor": "Скопировать команду диагностики",
|
|
1367
1391
|
"blocked.hint": "Исправьте данные объединения и обновите; сама панель к старым данным не вернётся.",
|
|
1368
1392
|
"blocked.reason.forward-only": "Состояние объединения записано более новой версией; эта панель его не читает.",
|
|
1369
|
-
"blocked.reason.migration-blocked": "Данные объединения
|
|
1393
|
+
"blocked.reason.migration-blocked": "Данные объединения всё ещё в старом формате, а автоматическое обновление не завершилось; панель приостановила чтение.",
|
|
1370
1394
|
"blocked.reason.needs-repair": "Состояние объединения требует исправления; чтение приостановлено.",
|
|
1371
1395
|
"blocked.reason.unknown": "Состояние объединения не готово; чтение приостановлено.",
|
|
1372
1396
|
"blocked.title": "Состояние объединения не готово",
|
|
@@ -1569,7 +1593,11 @@ const dictionaries = {
|
|
|
1569
1593
|
"verify.cancelled": "отменена",
|
|
1570
1594
|
"verify.failed": "не прошла",
|
|
1571
1595
|
"verify.queued": "в очереди",
|
|
1572
|
-
"verify.running": "выполняется"
|
|
1596
|
+
"verify.running": "выполняется",
|
|
1597
|
+
"blocked.hint.migration-blocked": "Остановите хост и запустите инструмент миграции. Сначала он создаёт резервную копию старых данных и может восстановить её при сбое. Затем перезагрузите страницу.",
|
|
1598
|
+
"blocked.hint.forward-only": "Данные объединения созданы более новой версией панели. Обновите плагин и перезагрузите страницу.",
|
|
1599
|
+
"blocked.hint.needs-repair": "Данные объединения неполные. Запустите инструмент миграции: перед восстановлением он создаёт резервную копию. Затем перезагрузите страницу.",
|
|
1600
|
+
"blocked.hint.unknown": "Запустите диагностику, чтобы проверить состояние объединения, и перезагрузите страницу."
|
|
1573
1601
|
},
|
|
1574
1602
|
pt: {
|
|
1575
1603
|
"action.approve": "Copiar comando de aprovação",
|
|
@@ -1590,7 +1618,7 @@ const dictionaries = {
|
|
|
1590
1618
|
"blocked.doctor": "Copiar comando de diagnóstico",
|
|
1591
1619
|
"blocked.hint": "Corrija os dados de merge e atualize; o painel não volta sozinho para dados antigos.",
|
|
1592
1620
|
"blocked.reason.forward-only": "O estado de merge foi gravado por uma versão mais nova; este painel não consegue lê-lo.",
|
|
1593
|
-
"blocked.reason.migration-blocked": "Os dados de merge
|
|
1621
|
+
"blocked.reason.migration-blocked": "Os dados de merge ainda estão no formato antigo e a atualização automática não terminou; o painel pausou a leitura.",
|
|
1594
1622
|
"blocked.reason.needs-repair": "O estado de merge precisa de reparo; a leitura está pausada.",
|
|
1595
1623
|
"blocked.reason.unknown": "O estado de merge não está pronto; a leitura está pausada.",
|
|
1596
1624
|
"blocked.title": "Estado de merge bloqueado",
|
|
@@ -1793,7 +1821,11 @@ const dictionaries = {
|
|
|
1793
1821
|
"verify.cancelled": "cancelada",
|
|
1794
1822
|
"verify.failed": "falhou",
|
|
1795
1823
|
"verify.queued": "na fila",
|
|
1796
|
-
"verify.running": "em execução"
|
|
1824
|
+
"verify.running": "em execução",
|
|
1825
|
+
"blocked.hint.migration-blocked": "Pare o host e execute a ferramenta de migração. Ela faz backup dos dados antigos primeiro e pode restaurá-los em caso de falha. Recarregue depois.",
|
|
1826
|
+
"blocked.hint.forward-only": "Os dados de merge vêm de uma versão mais recente do painel. Atualize o plugin e recarregue.",
|
|
1827
|
+
"blocked.hint.needs-repair": "Os dados de merge estão incompletos. Execute a ferramenta de migração; ela faz backup antes de reparar. Recarregue depois.",
|
|
1828
|
+
"blocked.hint.unknown": "Execute o diagnóstico para verificar o estado do merge e recarregue."
|
|
1797
1829
|
}
|
|
1798
1830
|
};
|
|
1799
1831
|
//#endregion
|
package/lib/index.js
CHANGED
|
@@ -4,20 +4,58 @@ import "./generated/contracts.generated.js";
|
|
|
4
4
|
import { Block, FailureBlock, failureText, loadStateOf } from "./generated/states.generated.js";
|
|
5
5
|
import { TOKENS, TOKEN_CSS, tokenVars } from "./tokens.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
|
-
import { createElement
|
|
7
|
+
import { createElement } from "react";
|
|
8
8
|
//#region \0rolldown/runtime.js
|
|
9
9
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
10
|
-
/** Fail loud when a client bundle is mounted without the shell seats it consumes. */
|
|
11
|
-
function requireClientSeats(ctx, owner) {
|
|
12
|
-
const candidate = ctx;
|
|
13
|
-
if (candidate.slots === void 0 || candidate.locale === void 0) throw new Error(owner + ": the client slots/locale seats are not mounted");
|
|
14
|
-
return candidate;
|
|
15
|
-
}
|
|
16
10
|
function interpolate(text, values) {
|
|
17
11
|
if (values === void 0) return text;
|
|
18
12
|
return text.replace(/\{(\w+)\}/g, (_match, key) => String(values[key] ?? ""));
|
|
19
13
|
}
|
|
20
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Fill `{slot}` placeholders, keeping an unmatched placeholder visible.
|
|
16
|
+
* This is the panel-copy contract (a missing value is a bug to see, not an empty string).
|
|
17
|
+
*/
|
|
18
|
+
function fillTemplate(text, values) {
|
|
19
|
+
if (values === void 0) return text;
|
|
20
|
+
return text.replace(/\{(\w+)\}/g, (match, key) => {
|
|
21
|
+
const value = values[key];
|
|
22
|
+
return value === void 0 ? match : String(value);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** Register one namespace's dictionaries and bind a fallback-first lookup. */
|
|
26
|
+
function bindLocale(ctx, namespace, dictionaries, fallback = "en", register = true) {
|
|
27
|
+
const seam = ctx;
|
|
28
|
+
let registered = !register;
|
|
29
|
+
if (register) ctx.effect(() => {
|
|
30
|
+
try {
|
|
31
|
+
const dispose = seam.locale.register(namespace, dictionaries);
|
|
32
|
+
registered = true;
|
|
33
|
+
return dispose;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
ctx.logger.warn(namespace + ": the locale seat refused the dictionary (" + String(error) + "); falls back to the bundle copy");
|
|
36
|
+
return () => {};
|
|
37
|
+
}
|
|
38
|
+
}, namespace + ": locale");
|
|
39
|
+
const own = dictionaries[fallback] ?? dictionaries.en;
|
|
40
|
+
const lookup = (key) => {
|
|
41
|
+
const fallbackText = own[key] ?? key;
|
|
42
|
+
if (!registered) return fallbackText;
|
|
43
|
+
try {
|
|
44
|
+
return seam.locale.bind(namespace)(key);
|
|
45
|
+
} catch {
|
|
46
|
+
return fallbackText;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
t: (key, values) => interpolate(lookup(key), values),
|
|
51
|
+
label: () => lookup("entry.label")
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region lib/types/styles.js
|
|
56
|
+
/** The one owner of plugin `<style>` tags; a new owner replaces the old tag so the
|
|
57
|
+
* old disposer only removes a detached node. */
|
|
58
|
+
function injectPluginStyles(doc, css, tagId) {
|
|
21
59
|
if (doc === void 0) return () => {};
|
|
22
60
|
doc.querySelector("style[data-plugin-css=\"" + tagId + "\"]")?.remove();
|
|
23
61
|
const tag = doc.createElement("style");
|
|
@@ -28,6 +66,14 @@ function injectStyles$1(doc, css, tagId) {
|
|
|
28
66
|
tag.remove();
|
|
29
67
|
};
|
|
30
68
|
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region lib/types/panel.js
|
|
71
|
+
/** Fail loud when a client bundle is mounted without the shell seats it consumes. */
|
|
72
|
+
function requireClientSeats(ctx, owner) {
|
|
73
|
+
const candidate = ctx;
|
|
74
|
+
if (candidate.slots === void 0 || candidate.locale === void 0) throw new Error(owner + ": the client slots/locale seats are not mounted");
|
|
75
|
+
return candidate;
|
|
76
|
+
}
|
|
31
77
|
/**
|
|
32
78
|
* Register one sidebar row and its main body under one lifecycle.
|
|
33
79
|
* @param ctx - the client context carrying the slots and locale seats.
|
|
@@ -35,30 +81,8 @@ function injectStyles$1(doc, css, tagId) {
|
|
|
35
81
|
*/
|
|
36
82
|
function registerSidebarPanel(ctx, spec) {
|
|
37
83
|
const seam = ctx;
|
|
38
|
-
|
|
39
|
-
ctx.
|
|
40
|
-
try {
|
|
41
|
-
const dispose = seam.locale.register(spec.namespace, spec.dictionaries);
|
|
42
|
-
registered = true;
|
|
43
|
-
return dispose;
|
|
44
|
-
} catch (error) {
|
|
45
|
-
ctx.logger.warn(spec.namespace + ": the locale seat refused the dictionary (" + String(error) + "); the panel falls back to the bundle copy");
|
|
46
|
-
return () => {};
|
|
47
|
-
}
|
|
48
|
-
}, spec.namespace + ": locale");
|
|
49
|
-
ctx.effect(() => injectStyles$1(typeof document === "undefined" ? void 0 : document, spec.styles.css, spec.styles.tagId), spec.namespace + ": styles");
|
|
50
|
-
const fallback = spec.dictionaries[spec.fallback ?? "en"] ?? spec.dictionaries.en;
|
|
51
|
-
const lookup = (key) => {
|
|
52
|
-
const own = fallback[key] ?? key;
|
|
53
|
-
if (!registered) return own;
|
|
54
|
-
try {
|
|
55
|
-
return seam.locale.bind(spec.namespace)(key);
|
|
56
|
-
} catch {
|
|
57
|
-
return own;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const t = (key, values) => interpolate(lookup(key), values);
|
|
61
|
-
const label = () => lookup("entry.label");
|
|
84
|
+
ctx.effect(() => injectPluginStyles(typeof document === "undefined" ? void 0 : document, spec.styles.css, spec.styles.tagId), spec.namespace + ": styles");
|
|
85
|
+
const { t, label } = bindLocale(ctx, spec.namespace, spec.dictionaries, spec.fallback ?? "en");
|
|
62
86
|
seam.slots.inject("sidebar.panellist", function* () {
|
|
63
87
|
yield seam.slots.register({
|
|
64
88
|
name: "sidebar.panellist",
|
|
@@ -77,17 +101,6 @@ function registerSidebarPanel(ctx, spec) {
|
|
|
77
101
|
}
|
|
78
102
|
//#endregion
|
|
79
103
|
//#region lib/types/workbench-view.js
|
|
80
|
-
function injectStyles(doc, css, tagId) {
|
|
81
|
-
if (doc === void 0) return () => {};
|
|
82
|
-
doc.querySelector("style[data-plugin-css=\"" + tagId + "\"]")?.remove();
|
|
83
|
-
const tag = doc.createElement("style");
|
|
84
|
-
tag.setAttribute("data-plugin-css", tagId);
|
|
85
|
-
tag.textContent = css;
|
|
86
|
-
doc.head.appendChild(tag);
|
|
87
|
-
return () => {
|
|
88
|
-
tag.remove();
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
104
|
/**
|
|
92
105
|
* Register one view into `evolution.workbench.view`.
|
|
93
106
|
* @param ctx - client cordis context.
|
|
@@ -95,33 +108,8 @@ function injectStyles(doc, css, tagId) {
|
|
|
95
108
|
*/
|
|
96
109
|
function registerWorkbenchView(ctx, spec) {
|
|
97
110
|
const seam = ctx;
|
|
98
|
-
|
|
99
|
-
ctx.
|
|
100
|
-
try {
|
|
101
|
-
const dispose = seam.locale.register(spec.namespace, spec.dictionaries);
|
|
102
|
-
registered = true;
|
|
103
|
-
return dispose;
|
|
104
|
-
} catch (error) {
|
|
105
|
-
ctx.logger.warn(spec.namespace + ": locale refused (" + String(error) + "); the view falls back to the bundle copy");
|
|
106
|
-
return () => {};
|
|
107
|
-
}
|
|
108
|
-
}, spec.namespace + ": locale");
|
|
109
|
-
ctx.effect(() => injectStyles(typeof document === "undefined" ? void 0 : document, spec.styles.css, spec.styles.tagId), spec.namespace + ": styles");
|
|
110
|
-
const fallback = spec.dictionaries["en"];
|
|
111
|
-
const lookup = (key) => {
|
|
112
|
-
const own = fallback[key] ?? key;
|
|
113
|
-
if (!registered) return own;
|
|
114
|
-
try {
|
|
115
|
-
return seam.locale.bind(spec.namespace)(key);
|
|
116
|
-
} catch {
|
|
117
|
-
return own;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const t = (key, values) => {
|
|
121
|
-
const template = lookup(key);
|
|
122
|
-
if (values === void 0) return template;
|
|
123
|
-
return template.replace(/\{(\w+)\}/g, (match, slot) => values[slot] === void 0 ? match : String(values[slot]));
|
|
124
|
-
};
|
|
111
|
+
ctx.effect(() => injectPluginStyles(typeof document === "undefined" ? void 0 : document, spec.styles.css, spec.styles.tagId), spec.namespace + ": styles");
|
|
112
|
+
const { t } = bindLocale(ctx, spec.namespace, spec.dictionaries);
|
|
125
113
|
seam.slots.inject("evolution.workbench.view", function* () {
|
|
126
114
|
yield seam.slots.register({
|
|
127
115
|
name: "evolution.workbench.view",
|
|
@@ -149,112 +137,6 @@ function panelWorkspaceId(ctx) {
|
|
|
149
137
|
} catch {}
|
|
150
138
|
}
|
|
151
139
|
//#endregion
|
|
152
|
-
//#region lib/types/async-resource.js
|
|
153
|
-
/**
|
|
154
|
-
* One read operation's lifecycle: initial load, background refresh, stale-answer
|
|
155
|
-
* suppression, and an explicit failure slot. Consumers derive `empty` from a
|
|
156
|
-
* successful `data` value; this type never conflates "not loaded yet" with
|
|
157
|
-
* "loaded and empty".
|
|
158
|
-
* @module @lmzhen/dsh-evolution-client-kit
|
|
159
|
-
*/
|
|
160
|
-
/**
|
|
161
|
-
* Serialize one resource's reads without remounting the consumer.
|
|
162
|
-
*/
|
|
163
|
-
var AsyncResource = class {
|
|
164
|
-
#state = Object.freeze({
|
|
165
|
-
status: "loading",
|
|
166
|
-
refreshing: false,
|
|
167
|
-
data: void 0,
|
|
168
|
-
failure: void 0,
|
|
169
|
-
generation: 0
|
|
170
|
-
});
|
|
171
|
-
#listeners = /* @__PURE__ */ new Set();
|
|
172
|
-
#generation = 0;
|
|
173
|
-
#controller;
|
|
174
|
-
#disposed = false;
|
|
175
|
-
/** @returns the stable snapshot for uSES. */
|
|
176
|
-
getSnapshot() {
|
|
177
|
-
return this.#state;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Observe snapshot replacements.
|
|
181
|
-
* @param listener - called after each publish.
|
|
182
|
-
* @returns the disposer.
|
|
183
|
-
*/
|
|
184
|
-
subscribe(listener) {
|
|
185
|
-
this.#listeners.add(listener);
|
|
186
|
-
return () => {
|
|
187
|
-
this.#listeners.delete(listener);
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Run one read. A prior read is aborted; only this generation may publish.
|
|
192
|
-
* @param load - loader receiving the cancellation signal.
|
|
193
|
-
* @returns settlement after this generation commits or is superseded.
|
|
194
|
-
*/
|
|
195
|
-
async load(load) {
|
|
196
|
-
if (this.#disposed) return;
|
|
197
|
-
const generation = this.#generation + 1;
|
|
198
|
-
this.#generation = generation;
|
|
199
|
-
this.#controller?.abort();
|
|
200
|
-
const controller = new AbortController();
|
|
201
|
-
this.#controller = controller;
|
|
202
|
-
const previous = this.#state;
|
|
203
|
-
this.#publish({
|
|
204
|
-
status: previous.data === void 0 ? "loading" : "ready",
|
|
205
|
-
refreshing: previous.data !== void 0,
|
|
206
|
-
data: previous.data,
|
|
207
|
-
failure: previous.failure,
|
|
208
|
-
generation
|
|
209
|
-
});
|
|
210
|
-
try {
|
|
211
|
-
const data = await load(controller.signal);
|
|
212
|
-
if (this.#disposed || generation !== this.#generation) return;
|
|
213
|
-
this.#publish({
|
|
214
|
-
status: "ready",
|
|
215
|
-
refreshing: false,
|
|
216
|
-
data,
|
|
217
|
-
failure: void 0,
|
|
218
|
-
generation
|
|
219
|
-
});
|
|
220
|
-
} catch (failure) {
|
|
221
|
-
if (this.#disposed || generation !== this.#generation || controller.signal.aborted) return;
|
|
222
|
-
this.#publish({
|
|
223
|
-
status: previous.data === void 0 ? "error" : "ready",
|
|
224
|
-
refreshing: false,
|
|
225
|
-
data: previous.data,
|
|
226
|
-
failure,
|
|
227
|
-
generation
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
/** Drop the current value and return to the initial loading state. */
|
|
232
|
-
reset() {
|
|
233
|
-
this.#generation += 1;
|
|
234
|
-
this.#controller?.abort();
|
|
235
|
-
this.#controller = void 0;
|
|
236
|
-
this.#publish({
|
|
237
|
-
status: "loading",
|
|
238
|
-
refreshing: false,
|
|
239
|
-
data: void 0,
|
|
240
|
-
failure: void 0,
|
|
241
|
-
generation: this.#generation
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
/** Abort the in-flight read and stop notifying. */
|
|
245
|
-
dispose() {
|
|
246
|
-
this.#disposed = true;
|
|
247
|
-
this.#generation += 1;
|
|
248
|
-
this.#controller?.abort();
|
|
249
|
-
this.#controller = void 0;
|
|
250
|
-
this.#listeners.clear();
|
|
251
|
-
}
|
|
252
|
-
#publish(state) {
|
|
253
|
-
this.#state = Object.freeze(state);
|
|
254
|
-
for (const listener of this.#listeners) listener();
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
//#endregion
|
|
258
140
|
//#region lib/types/format.js
|
|
259
141
|
/** Parse an ISO string, epoch ms, or null into a valid Date; null when absent/invalid. */
|
|
260
142
|
function toLocalDate(value) {
|
|
@@ -304,23 +186,6 @@ function isSameLocalDay(value, now = /* @__PURE__ */ new Date()) {
|
|
|
304
186
|
return date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate();
|
|
305
187
|
}
|
|
306
188
|
//#endregion
|
|
307
|
-
//#region lib/types/notice.js
|
|
308
|
-
/** One inline state notice: semantic tone plus text, no surface-specific styling. */
|
|
309
|
-
/**
|
|
310
|
-
* Render one informative/warning/error line. The caller owns the surface class and CSS;
|
|
311
|
-
* this leaf owns only the accessible role and the fact/count split.
|
|
312
|
-
* @param props - tone, text, optional count/class.
|
|
313
|
-
* @returns a semantic state notice.
|
|
314
|
-
*/
|
|
315
|
-
function StateNotice({ tone, text, count, className }) {
|
|
316
|
-
return createElement("div", {
|
|
317
|
-
"data-role": "state-notice",
|
|
318
|
-
"data-tone": tone,
|
|
319
|
-
role: tone === "error" ? "alert" : "status",
|
|
320
|
-
...className === void 0 ? {} : { className }
|
|
321
|
-
}, createElement("span", { "data-role": "state-notice-text" }, text), count === void 0 ? null : createElement("span", { "data-role": "state-notice-count" }, String(count)));
|
|
322
|
-
}
|
|
323
|
-
//#endregion
|
|
324
189
|
//#region lib/types/presentation/decision-frame.js
|
|
325
190
|
/** One decision card: title, facts, at most one primary, secondary actions and details. */
|
|
326
191
|
function actionButton$1(action, role) {
|
|
@@ -370,31 +235,6 @@ function TaskBanner({ count, text, className }) {
|
|
|
370
235
|
}, createElement("strong", { "data-role": "task-banner-count" }, String(count)), createElement("span", { "data-role": "task-banner-text" }, text));
|
|
371
236
|
}
|
|
372
237
|
//#endregion
|
|
373
|
-
//#region lib/types/presentation/chips.js
|
|
374
|
-
/** Read-only status chips and toggleable filter chips. */
|
|
375
|
-
/** Render one semantic status word. */
|
|
376
|
-
function StatusChip({ label, tone = "neutral", className }) {
|
|
377
|
-
return createElement("span", {
|
|
378
|
-
"data-role": "status-chip",
|
|
379
|
-
"data-tone": tone,
|
|
380
|
-
...className === void 0 ? {} : { className }
|
|
381
|
-
}, label);
|
|
382
|
-
}
|
|
383
|
-
/** Render a toggleable filter with the pressed state exposed to assistive tech. */
|
|
384
|
-
function FilterChip({ label, active, onClick, count, disabled = false, className }) {
|
|
385
|
-
return createElement("button", {
|
|
386
|
-
type: "button",
|
|
387
|
-
"data-role": "filter-chip",
|
|
388
|
-
"data-active": active ? "true" : "false",
|
|
389
|
-
"aria-pressed": active ? "true" : "false",
|
|
390
|
-
disabled,
|
|
391
|
-
...className === void 0 ? {} : { className },
|
|
392
|
-
onClick: () => {
|
|
393
|
-
if (!disabled) onClick();
|
|
394
|
-
}
|
|
395
|
-
}, createElement("span", { "data-role": "filter-chip-label" }, label), count === void 0 ? null : createElement("span", { "data-role": "filter-chip-count" }, String(count)));
|
|
396
|
-
}
|
|
397
|
-
//#endregion
|
|
398
238
|
//#region lib/types/presentation/empty-state.js
|
|
399
239
|
/** A compact completed/empty state with at most one primary next step. */
|
|
400
240
|
function actionButton(action, role) {
|
|
@@ -445,36 +285,6 @@ const RESPONSIVE_TABLE_CSS = [
|
|
|
445
285
|
"}"
|
|
446
286
|
].join(String.fromCharCode(10));
|
|
447
287
|
//#endregion
|
|
448
|
-
//#region lib/types/presentation/disclosure-group.js
|
|
449
|
-
/** A native details group for normal/secondary facts. */
|
|
450
|
-
/** Render a closed-by-default disclosure without introducing another accordion model. */
|
|
451
|
-
function DisclosureGroup({ summary, count, children, defaultOpen = false, className }) {
|
|
452
|
-
return createElement("details", {
|
|
453
|
-
"data-role": "disclosure-group",
|
|
454
|
-
...defaultOpen ? { open: true } : {},
|
|
455
|
-
...className === void 0 ? {} : { className }
|
|
456
|
-
}, createElement("summary", { "data-role": "disclosure-summary" }, createElement("span", { "data-role": "disclosure-title" }, summary), count === void 0 ? null : createElement("span", { "data-role": "disclosure-count" }, String(count))), createElement("div", { "data-role": "disclosure-content" }, children));
|
|
457
|
-
}
|
|
458
|
-
//#endregion
|
|
459
|
-
//#region lib/types/presentation/time-text.js
|
|
460
|
-
/** The one local-time presentation used by reading surfaces. */
|
|
461
|
-
/**
|
|
462
|
-
* Render a local wall time, or a neutral dash when the fact is unknown.
|
|
463
|
-
* @param props - ISO/epoch value and seconds preference.
|
|
464
|
-
* @returns a time element with the raw value in dateTime when valid.
|
|
465
|
-
*/
|
|
466
|
-
function TimeText({ value, seconds = true, className }) {
|
|
467
|
-
const text = formatLocalDateTime(value, { seconds });
|
|
468
|
-
const ms = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : NaN;
|
|
469
|
-
const raw = Number.isFinite(ms) ? new Date(ms).toISOString() : void 0;
|
|
470
|
-
return createElement("time", {
|
|
471
|
-
"data-role": "time-text",
|
|
472
|
-
...raw === void 0 ? {} : { dateTime: raw },
|
|
473
|
-
...text === null ? {} : { title: text },
|
|
474
|
-
...className === void 0 ? {} : { className }
|
|
475
|
-
}, text ?? "—");
|
|
476
|
-
}
|
|
477
|
-
//#endregion
|
|
478
288
|
//#region lib/types/presentation/action-menu.js
|
|
479
289
|
/**
|
|
480
290
|
* The one seam onto the platform's menu material, plus a small fallback for deployments
|
|
@@ -482,31 +292,6 @@ function TimeText({ value, seconds = true, className }) {
|
|
|
482
292
|
*/
|
|
483
293
|
const PLATFORM_UI_MODULE = "@deepseek-ai/dsh-client-ui-primitives";
|
|
484
294
|
/**
|
|
485
|
-
* Render the coordinate/action menu through the platform primitives, or a plain fallback.
|
|
486
|
-
* @param props - rows, accessible label, position/style and optional primitive override.
|
|
487
|
-
* @returns the menu element.
|
|
488
|
-
*/
|
|
489
|
-
function ActionMenu({ actions, label, style, className, primitives = PLATFORM_MENU }) {
|
|
490
|
-
if (primitives !== void 0) return renderPlatformMenu(primitives, actions, label, style ?? {}, className);
|
|
491
|
-
return createElement("div", {
|
|
492
|
-
"data-role": "action-menu-fallback",
|
|
493
|
-
role: "menu",
|
|
494
|
-
"aria-label": label,
|
|
495
|
-
...style === void 0 ? {} : { style },
|
|
496
|
-
...className === void 0 ? {} : { className }
|
|
497
|
-
}, actions.map((action) => createElement("button", {
|
|
498
|
-
key: action.id,
|
|
499
|
-
type: "button",
|
|
500
|
-
role: "menuitem",
|
|
501
|
-
disabled: action.disabled === true,
|
|
502
|
-
"data-danger": action.danger === true ? "true" : "false",
|
|
503
|
-
...action.separatorBefore === true ? { "data-separator-before": "true" } : {},
|
|
504
|
-
onClick: () => {
|
|
505
|
-
if (action.disabled !== true) action.onSelect();
|
|
506
|
-
}
|
|
507
|
-
}, action.label)));
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
295
|
* Render the platform menu directly. Kept exported for callers that already own the primitive row.
|
|
511
296
|
* @param primitives - platform MenuSurface/MenuItemButton pair.
|
|
512
297
|
* @param actions - rows in display order.
|
|
@@ -555,51 +340,6 @@ const PLATFORM_MENU = (() => {
|
|
|
555
340
|
}
|
|
556
341
|
})();
|
|
557
342
|
//#endregion
|
|
558
|
-
//#region lib/types/action.js
|
|
559
|
-
/**
|
|
560
|
-
* Command-only actions. Approval decisions are a separate host API and must never
|
|
561
|
-
* be represented as a copyable command here.
|
|
562
|
-
* @module @lmzhen/dsh-evolution-client-kit
|
|
563
|
-
*/
|
|
564
|
-
/**
|
|
565
|
-
* Copy one command and report the host verdict.
|
|
566
|
-
* @param action - the command action.
|
|
567
|
-
* @param writeClipboard - platform clipboard writer.
|
|
568
|
-
* @param confirm - optional in-UI confirmation.
|
|
569
|
-
* @returns the settled copy status.
|
|
570
|
-
*/
|
|
571
|
-
async function copyAction(action, writeClipboard, confirm) {
|
|
572
|
-
if (action.enabled === false) return "idle";
|
|
573
|
-
if (confirm !== void 0 && !confirm(action)) return "idle";
|
|
574
|
-
if (action.confirm !== void 0 && !action.confirm(action)) return "idle";
|
|
575
|
-
try {
|
|
576
|
-
return await writeClipboard(action.command) ? "copied" : "failed";
|
|
577
|
-
} catch {
|
|
578
|
-
return "failed";
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Render one command-copy action with real success/failure feedback.
|
|
583
|
-
* @param props - action, clipboard writer, and localized labels.
|
|
584
|
-
* @returns the button and its status line.
|
|
585
|
-
*/
|
|
586
|
-
function CommandCopyButton({ action, writeClipboard, labels, className }) {
|
|
587
|
-
const [status, setStatus] = useState("idle");
|
|
588
|
-
const text = status === "copying" ? labels.copying : status === "copied" ? labels.copied : status === "failed" ? labels.failed : labels.copy;
|
|
589
|
-
return createElement("span", { className }, createElement("button", {
|
|
590
|
-
type: "button",
|
|
591
|
-
disabled: action.enabled === false || status === "copying",
|
|
592
|
-
"aria-label": action.label,
|
|
593
|
-
onClick: () => {
|
|
594
|
-
setStatus("copying");
|
|
595
|
-
copyAction(action, writeClipboard).then(setStatus);
|
|
596
|
-
}
|
|
597
|
-
}, action.label), createElement("span", {
|
|
598
|
-
role: "status",
|
|
599
|
-
"aria-live": "polite"
|
|
600
|
-
}, text === labels.copy ? "" : text));
|
|
601
|
-
}
|
|
602
|
-
//#endregion
|
|
603
343
|
//#region lib/types/surface.js
|
|
604
344
|
/**
|
|
605
345
|
* Shared opaque page surface. Skin images may sit behind the shell; every
|
|
@@ -611,4 +351,4 @@ const PAGE_SURFACE_CLASS = "evolution-page-surface";
|
|
|
611
351
|
/** Stylesheet for {@link PAGE_SURFACE_CLASS}; consumers append it to their own CSS. */
|
|
612
352
|
const PAGE_SURFACE_CSS = ".evolution-page-surface{min-height:100%;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}";
|
|
613
353
|
//#endregion
|
|
614
|
-
export {
|
|
354
|
+
export { Block, DecisionFrame, EmptyState, FALLBACKS, FailureBlock, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, PLATFORM_MENU, RESPONSIVE_TABLE_CSS, ROUTES, TOKENS, TOKEN_CSS, TaskBanner, bindLocale, failureText, fillTemplate, formatLocalClock, formatLocalDateTime, injectPluginStyles, isSameLocalDay, loadStateOf, menuPrimitivesFrom, panelWorkspaceId, registerSidebarPanel, registerWorkbenchView, renderPlatformMenu, requireClientSeats, tokenVars };
|
|
@@ -27,8 +27,6 @@ export interface DiagnosticsView {
|
|
|
27
27
|
readonly facts: readonly DocFactRow[];
|
|
28
28
|
readonly runtime: readonly DiagnosticRow[];
|
|
29
29
|
}
|
|
30
|
-
/** The installation form the doctor reports (W8 install-form-detected row). */
|
|
31
|
-
export type InstallFormId = 'M1' | 'M2' | 'M3' | 'M4';
|
|
32
30
|
/** One surface's command-face path(s) — the client `fallbacks.generated.ts` table's row type. */
|
|
33
31
|
export interface FallbackHint {
|
|
34
32
|
readonly command: string;
|