dsh-delete-session 0.2.8 → 0.3.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/README.md +15 -2
- package/package.json +1 -1
- package/src/client.js +441 -14
- package/test/checkbox.dom.test.js +765 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ DSH 侧边栏的会话菜单只有**重命名 / 分叉 / 归档**——归档只
|
|
|
30
30
|
- **跳过 git 仓库内的文件(默认开)** —— 在项目里干过活的对话,产出文件里往往就是项目源码。开启后仓库内的文件一律不碰,避免删一个对话把项目搬空
|
|
31
31
|
- **删除后回到新会话** —— 若删除的正是当前打开的会话,自动切到一个全新会话,而不是落到已不可用的邻居页
|
|
32
32
|
- **默认安全** —— 宿主路由仅限本机回环(回环 socket + 回环 Host 头 + 同源校验);被 DSH 打开占用的会话会被明确拒绝(409),绝不与活跃写者竞争
|
|
33
|
-
-
|
|
33
|
+
- **三种语言** —— 菜单项、对话框与设置页跟随 DSH 界面语言(zh / en);浏览器语言为 ru 时显示俄语(DSH 本身尚未提供 ru 界面,插件自带字典兜底)
|
|
34
34
|
- **零依赖** —— 不引入任何 DSH SDK,所有服务(`sessions` / `sessionPersistence` / `agents` / `workspaceRegistry` / `webServer`)都在调用时通过 cordis 上下文获取
|
|
35
35
|
|
|
36
36
|
### 安装
|
|
@@ -162,6 +162,19 @@ MIT
|
|
|
162
162
|
|
|
163
163
|
## 修复记录
|
|
164
164
|
|
|
165
|
+
**(v0.3.0)** —— 多选支持按工作区全选,也能一次选中全部会话。
|
|
166
|
+
|
|
167
|
+
- **两个全选框**:`工作区 N` 那一行多一个框,选中**所有**会话;每个工作区标题行(含「未分组」)各多一个框,只选中**该组**。点一下全选,再点一下清空。
|
|
168
|
+
- **分组归属从 DOM 读,不向宿主索取**:会话行与工作区标题行同属一个 `groupSection`,从标题行向上找容器再取子行即可。宿主给工作区行的外面还套了一层 `HoverCard` 的 `<span>`,所以不能只看 `parentElement`,要逐层向上,并在「这一层已经装着几个工作区」时停手——否则会把别组的会话一起卷进来。嵌套的 `div[role="group"]` 直接跳过。
|
|
169
|
+
- **半选状态**:组里只勾了几个时,组框显示 `−`(`aria-checked="mixed"`),而不是谎报全选或全不选。
|
|
170
|
+
- **位置在标签文字右边**:宿主把行尾操作区用 `margin-left:auto` 推到最右,直接 `appendChild` 会落到行的另一头;框插在 `[class*="_rowActions"]` 之前。工作区名是 `flex:1`,会把剩余宽度全部吃掉,所以框后面还要跟一条 `flex:1` 的间隔条,把数值/菜单/新建重新顶回行尾。
|
|
171
|
+
- **修饰过的元素不参与行点击**:多选的点击走 document 的 capture 阶段,框会长在工作区行里面,不加标记就会被当成「点了一行」而被吞掉。所有自建元素都带 `data-dsh-delete-session`,capture 监听先跳过它们。
|
|
172
|
+
- **不再自己触发自己**:装饰只在位置不对时碰 DOM,变更观察器也忽略自己插入的节点。原来每帧重插会把框从指针底下反复摘走,表现为「狂点十几次才中一次」。
|
|
173
|
+
- **不假设 `children` 是数组**:浏览器里它是 `HTMLCollection`,没有 `indexOf`,一次误用就让整趟装饰抛异常、框一个都不出现。
|
|
174
|
+
**(v0.2.9)** —— 俄语界面 + 修掉拖拽标签里的 `{name}`。
|
|
175
|
+
|
|
176
|
+
- **俄语(`ru`)**:来自社区贡献([#1](https://github.com/DDDMUC/dsh-delete-session/pull/1),作者 [@aleXela17](https://github.com/aleXela17))。98 条词条与中英完全对齐,函数型条目仍然返回数字。DSH 自身没有 ru 语言包,所以俄语浏览器下插件字典优先于宿主翻译;中英路径不变,宿主仍是权威。
|
|
177
|
+
- **修掉拖拽标签的占位符**:`dropRelease` 模板是「松手删除「{name}」」,但插值参数表里没有 `name`,调用处又把标题当裸字符串传进去,于是三种语言都原样显示 `{name}`。现在传 `{ name }`,标题真正进到句子里。
|
|
165
178
|
**(v0.2.8)** —— 删除更快:退避改成指数,批量改成三阶段流水线。
|
|
166
179
|
|
|
167
180
|
- **lease 探测不再固定等 200ms**:活跃会话的第一次探测几乎必然 busy(detach 后 lease 由异步 retirement 释放),原来每条都要先付 200ms。现在 20 → 40 → 80 → 160 → 200(封顶不变),典型情况落在 20–40ms,最坏总等待从 2200ms 降到 1900ms。
|
|
@@ -197,7 +210,7 @@ This plugin puts **Delete** back where you already click: the session row's `...
|
|
|
197
210
|
- **Skip files inside git repositories (on by default)** — a conversation that worked in a project produces that project's source. With this on, nothing inside a repository is touched
|
|
198
211
|
- **Lands on a fresh session** — deleting the session you are looking at switches to a new one instead of an unusable neighbour page
|
|
199
212
|
- **Safe by default** — host routes are loopback-only (loopback socket, loopback Host header, same-origin check); a session the host still holds open is refused with 409 rather than raced
|
|
200
|
-
- **
|
|
213
|
+
- **Three languages** — menu rows, dialog and settings follow the DSH UI language (zh / en), and a Russian browser gets Russian from the bundled dictionary even though DSH itself ships no ru locale
|
|
201
214
|
- **Zero dependencies** — no DSH SDK import; `sessions`, `sessionPersistence`, `agents`, `workspaceRegistry` and `webServer` are all resolved from the cordis context at call time
|
|
202
215
|
|
|
203
216
|
### Install
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-delete-session",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Delete sessions from the DSH Web sidebar: adds a Delete action to the session row menu with a risk-consent dialog, sends the session log, workspace accounting and live session state to the system trash (or removes them outright), and, when opted in, quarantines the files the conversation produced.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/client.js
CHANGED
|
@@ -36,6 +36,8 @@ window.__ModuleLoader__.load({
|
|
|
36
36
|
const zh = {
|
|
37
37
|
menu: '删除会话',
|
|
38
38
|
multiSelect: '多选',
|
|
39
|
+
selectAllGroup: '全选这个工作区',
|
|
40
|
+
selectAllWorkspaces: '全选所有工作区',
|
|
39
41
|
title: '删除会话',
|
|
40
42
|
descRecycle: '将把该会话及其全部对话记录(会话日志、工作区记账与统计)从列表中移除,并放进系统回收站。',
|
|
41
43
|
descPermanent: '将永久删除该会话及其全部对话记录(会话日志、工作区记账与统计),此操作不可恢复。',
|
|
@@ -140,6 +142,8 @@ window.__ModuleLoader__.load({
|
|
|
140
142
|
const en = {
|
|
141
143
|
menu: 'Delete session',
|
|
142
144
|
multiSelect: 'Select multiple',
|
|
145
|
+
selectAllGroup: 'Select every session in this workspace',
|
|
146
|
+
selectAllWorkspaces: 'Select every session in every workspace',
|
|
143
147
|
title: 'Delete session',
|
|
144
148
|
descRecycle: 'This removes the session and all of its conversation records (log, workspace accounting and statistics) from the list and puts them in the system trash.',
|
|
145
149
|
descPermanent: 'This permanently deletes the session and all of its conversation records (log, workspace accounting and statistics). This cannot be undone.',
|
|
@@ -238,6 +242,111 @@ window.__ModuleLoader__.load({
|
|
|
238
242
|
doneQuarantineFailed: (ok, fail) => `Session deleted, ${ok} quarantined and ${fail} failed`,
|
|
239
243
|
}
|
|
240
244
|
|
|
245
|
+
const ru = {
|
|
246
|
+
menu: 'Удалить сессию',
|
|
247
|
+
multiSelect: 'Выбрать несколько',
|
|
248
|
+
selectAllGroup: 'Выбрать все сессии этой рабочей папки',
|
|
249
|
+
selectAllWorkspaces: 'Выбрать все сессии во всех рабочих папках',
|
|
250
|
+
title: 'Удалить сессию',
|
|
251
|
+
descRecycle: 'Сессия и все её записи (журнал, учёт рабочей папки и статистика) будут убраны из списка и перемещены в системную корзину.',
|
|
252
|
+
descPermanent: 'Сессия и все её записи (журнал, учёт рабочей папки и статистика) будут удалены безвозвратно. Отменить это нельзя.',
|
|
253
|
+
cancel: 'Отмена',
|
|
254
|
+
confirm: 'Удалить',
|
|
255
|
+
deleting: 'Удаление…',
|
|
256
|
+
done: 'Сессия удалена',
|
|
257
|
+
failed: 'Не удалось удалить: ',
|
|
258
|
+
busy: 'Сессия сейчас открыта в DSH, удаление не завершилось. Повторите через момент (обычно пара секунд) или перезапустите DSH и попробуйте снова.',
|
|
259
|
+
notFound: 'Сессия не найдена (возможно, она уже удалена).',
|
|
260
|
+
untitled: 'Сессия без названия',
|
|
261
|
+
cancelSelect: 'Отмена',
|
|
262
|
+
selectedCount: (n) => `Выбрано: ${n}`,
|
|
263
|
+
batchRunning: (done, total) => `Удаление ${done}/${total}…`,
|
|
264
|
+
moveSelected: 'Переместить',
|
|
265
|
+
batchMoving: (done, total) => `Перемещение ${done}/${total}…`,
|
|
266
|
+
batchMoved: (ok, fail) => (fail > 0 ? `Перемещено ${ok}, не удалось ${fail}` : `Перемещено ${ok}`),
|
|
267
|
+
moveBadResult: (fields) => `В ответе о перемещении нет полей: ${fields}`,
|
|
268
|
+
deleteSelected: 'Удалить',
|
|
269
|
+
batchDone: (n) => `Удалено сессий: ${n}`,
|
|
270
|
+
batchPartial: (ok, fail) => `Удалено ${ok}, не удалось ${fail}`,
|
|
271
|
+
batchFailed: 'Массовое удаление не удалось: ',
|
|
272
|
+
pageAsk: 'Спрашивать перед удалением',
|
|
273
|
+
pageRecycle: 'Удалять в корзину',
|
|
274
|
+
pageSyncChildren: 'Удалять и дочерние сессии',
|
|
275
|
+
dropHint: 'Перетащите сюда, чтобы удалить',
|
|
276
|
+
dropRelease: 'Отпустите, чтобы удалить «{name}»',
|
|
277
|
+
dropFallback: 'этот диалог',
|
|
278
|
+
starAsk: '⭐ Звёздочка на GitHub сделает автору день',
|
|
279
|
+
starCta: 'Ладно, держи звезду',
|
|
280
|
+
pageSyncChildrenOn: 'Удаление сессии удаляет и порождённые ею сессии субагентов.',
|
|
281
|
+
pageSyncChildrenOff: 'Если выключено, перед удалением появится список дочерних сессий и вы отметите, какие удалить.',
|
|
282
|
+
childrenHint: 'У этого диалога {n} дочерних сессий (субагентов). Отмеченные удалятся вместе с ним.',
|
|
283
|
+
pageRecycleOn: 'Сессия попадёт в системную корзину, её можно восстановить.',
|
|
284
|
+
pageRecycleOff: 'Сессия сразу удаляется с диска, восстановить её нельзя.',
|
|
285
|
+
pageHintAsk: 'Перед каждым удалением сессии показывать подтверждение.',
|
|
286
|
+
pageHintAuto: 'Удалять сессию сразу, не спрашивая.',
|
|
287
|
+
// The produced-file list only exists inside the dialog, so ask mode keeps a
|
|
288
|
+
// delete dialog even when the confirmation above is turned off.
|
|
289
|
+
pageHintAutoWithArtifacts: 'Диалог всё равно откроется: сначала нужно показать список созданных файлов.',
|
|
290
|
+
pageSummaryAsk: 'Спрашивать перед удалением',
|
|
291
|
+
pageSummaryAuto: 'Удалять не спрашивая',
|
|
292
|
+
pageArtifactsOff: 'Не трогать созданные файлы (как сейчас)',
|
|
293
|
+
pageHintArtifactsOff: 'Удаление сессии убирает только её записи и не касается файлов в рабочей папке.',
|
|
294
|
+
pageHintArtifactsOn: 'При удалении сессии разбираются и файлы, которые она трогала в рабочей папке.',
|
|
295
|
+
pageArtifactsAuto: 'Сразу отправлять созданные файлы в карантин',
|
|
296
|
+
pageHintArtifactsAuto: 'Все файлы из области ниже переносятся в карантин без вопросов.',
|
|
297
|
+
pageHintArtifactsAsk: 'При удалении появится список файлов, и вы отметите, какие переносить.',
|
|
298
|
+
pageScopeCreated: 'Только созданные файлы',
|
|
299
|
+
pageScopeAll: 'Созданные и изменённые файлы',
|
|
300
|
+
pageScopeCreatedHint: 'Затрагиваются только файлы, созданные этим диалогом; изменённые им существующие файлы не трогаются.',
|
|
301
|
+
pageScopeAllHint: 'Сюда входят и существующие файлы, которые этот диалог переписал: их перенос изменит то, что уже было в рабочей папке.',
|
|
302
|
+
pageSkipGit: 'Пропускать файлы внутри git-репозитория',
|
|
303
|
+
pageSkipGitOn: 'Обрабатываются только файлы вне git-репозиториев; код из репозитория не переносится.',
|
|
304
|
+
pageSkipGitOff: 'Файлы из репозитория тоже уйдут в карантин: удалив диалог, поработавший в проекте, можно унести и исходники.',
|
|
305
|
+
pageSummaryArtifactsOff: 'Созданные файлы не трогаются',
|
|
306
|
+
pageSummaryArtifactsAuto: 'Созданные файлы — в карантин',
|
|
307
|
+
pageSummaryArtifactsAsk: 'Созданные файлы — спросить',
|
|
308
|
+
pageRootLabel: 'Где хранить карантин',
|
|
309
|
+
pageRootPlaceholder: 'Пусто — путь по умолчанию',
|
|
310
|
+
pageRootBrowse: 'Выбрать папку…',
|
|
311
|
+
pageRootOpen: 'Открыть',
|
|
312
|
+
rootOpened: 'Открыто в файловом менеджере',
|
|
313
|
+
rootOpenFailed: 'Не удалось открыть: ',
|
|
314
|
+
pickerOpening: 'Системный диалог открыт — выберите папку в его окне',
|
|
315
|
+
pickerFailed: 'Не удалось открыть выбор папки: ',
|
|
316
|
+
pageRootReset: 'По умолчанию',
|
|
317
|
+
pageRootDefaultHint: (path) => `Используется путь по умолчанию: ${path}`,
|
|
318
|
+
pageRootCustomHint: 'Карантин создаётся здесь: по подпапке с отметкой времени на каждое удаление',
|
|
319
|
+
pickerTitle: 'Куда переносить файлы в карантин',
|
|
320
|
+
pickerLoading: 'Чтение…',
|
|
321
|
+
pickerEmpty: 'Здесь нет подпапок',
|
|
322
|
+
pickerChoose: 'Выбрать эту папку',
|
|
323
|
+
pickerTruncated: 'Подпапок слишком много: показаны первые 500',
|
|
324
|
+
pickerDefault: (path) => `Путь по умолчанию: ${path}`,
|
|
325
|
+
rootSet: 'Место сохранения обновлено',
|
|
326
|
+
artifactSection: 'Файлы, созданные этим диалогом',
|
|
327
|
+
artifactOpenFolder: 'Открыть папку',
|
|
328
|
+
artifactDeleteFile: 'Удалить этот файл',
|
|
329
|
+
fileDeleted: 'Файл удалён',
|
|
330
|
+
fileRecycled: 'Файл перемещён в корзину',
|
|
331
|
+
fileDeleteFailed: 'Не удалось удалить файл: ',
|
|
332
|
+
revealFailed: 'Не удалось открыть папку: ',
|
|
333
|
+
artifactLoading: 'Сканирование…',
|
|
334
|
+
artifactFailed: 'Сканирование не удалось: ',
|
|
335
|
+
artifactNone: 'Нечего обрабатывать.',
|
|
336
|
+
artifactCount: (created, modified) => `Создано: ${created} · изменено: ${modified}`,
|
|
337
|
+
artifactAutoNote: (n) => `После удаления в карантин уйдёт файлов: ${n}`,
|
|
338
|
+
artifactAutoOnly: 'Созданные файлы уходят в карантин автоматически, здесь они не перечисляются.',
|
|
339
|
+
artifactRefused: (n) => `Пропущено ещё: ${n}`,
|
|
340
|
+
artifactSelected: (n) => `Выбрано: ${n}`,
|
|
341
|
+
artifactMore: (n) => `Не показано ещё: ${n}`,
|
|
342
|
+
artifactTruncated: 'Список сокращён: всё, что не показано, останется нетронутым.',
|
|
343
|
+
artifactScopeCreated: 'Область: только созданные',
|
|
344
|
+
artifactScopeAll: 'Область: созданные + изменённые',
|
|
345
|
+
artifactModifiedWarn: 'Изменённые существующие файлы (по умолчанию не отмечены):',
|
|
346
|
+
doneQuarantine: (n) => `Сессия удалена, файлов в карантине: ${n}`,
|
|
347
|
+
doneQuarantineFailed: (ok, fail) => `Сессия удалена, в карантине ${ok}, не удалось ${fail}`,
|
|
348
|
+
}
|
|
349
|
+
|
|
241
350
|
let sessionsSvc = null
|
|
242
351
|
let localeSvc = null
|
|
243
352
|
|
|
@@ -245,16 +354,31 @@ window.__ModuleLoader__.load({
|
|
|
245
354
|
if (typeof navigator === 'undefined') return 'zh'
|
|
246
355
|
for (const tag of (navigator.languages || []).concat([navigator.language])) {
|
|
247
356
|
const primary = String(tag || '').toLowerCase().split('-')[0]
|
|
248
|
-
if (primary === 'zh' || primary === 'en') return primary
|
|
357
|
+
if (primary === 'zh' || primary === 'en' || primary === 'ru') return primary
|
|
249
358
|
}
|
|
250
359
|
return 'zh'
|
|
251
360
|
}
|
|
252
361
|
|
|
362
|
+
const dictionaries = { zh, en, ru }
|
|
363
|
+
|
|
364
|
+
// The dictionary the built-in lookup reads: the browser's language when it is
|
|
365
|
+
// one we ship, the historical zh fallback otherwise.
|
|
366
|
+
function activeDictionary() {
|
|
367
|
+
return dictionaries[browserLang()] || zh
|
|
368
|
+
}
|
|
369
|
+
|
|
253
370
|
// The DOM decoration layer (row checkboxes, batch bar, toast) is not a slot
|
|
254
371
|
// occupant, so it has no injected `t`; it uses the built-in dictionaries and
|
|
255
372
|
// honours the registered `locale` namespace when the host provides one.
|
|
256
373
|
// Slot components receive the host-injected `t` and use that instead.
|
|
257
374
|
function t(key, a, b) {
|
|
375
|
+
// A Russian browser reads the plugin's own dictionary first: DSH ships no
|
|
376
|
+
// ru locale, so the host translator would answer in Chinese or English and
|
|
377
|
+
// the Russian strings registered below would never be seen.
|
|
378
|
+
if (browserLang() === 'ru') {
|
|
379
|
+
const own = activeDictionary()[key]
|
|
380
|
+
if (own !== undefined) return typeof own === 'function' ? own(a, b) : own
|
|
381
|
+
}
|
|
258
382
|
if (localeSvc && typeof localeSvc.translate === 'function') {
|
|
259
383
|
try {
|
|
260
384
|
const text = localeSvc.translate(NS, key)
|
|
@@ -263,7 +387,7 @@ window.__ModuleLoader__.load({
|
|
|
263
387
|
// fall back to the built-in dictionaries
|
|
264
388
|
}
|
|
265
389
|
}
|
|
266
|
-
const value = (
|
|
390
|
+
const value = activeDictionary()[key]
|
|
267
391
|
return typeof value === 'function' ? value(a, b) : value || key
|
|
268
392
|
}
|
|
269
393
|
|
|
@@ -288,8 +412,8 @@ window.__ModuleLoader__.load({
|
|
|
288
412
|
// and all. Calling it without params is no better: the host (and this
|
|
289
413
|
// module's own `t`) invoke function entries with no arguments, which
|
|
290
414
|
// produces "已选 undefined 个".
|
|
291
|
-
const
|
|
292
|
-
const local =
|
|
415
|
+
const dict = activeDictionary()
|
|
416
|
+
const local = dict[key]
|
|
293
417
|
if (local !== undefined) {
|
|
294
418
|
if (typeof local === 'function') return local(a, b)
|
|
295
419
|
if (typeof local === 'string' && local.includes('{') && a !== undefined) {
|
|
@@ -310,6 +434,20 @@ window.__ModuleLoader__.load({
|
|
|
310
434
|
return wrapped
|
|
311
435
|
}
|
|
312
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Pick the translator the session-menu rows render through.
|
|
439
|
+
*
|
|
440
|
+
* The host injects a `t` bound to this namespace and stays the authority for
|
|
441
|
+
* the languages DSH itself ships (zh, en): following it is what keeps the menu
|
|
442
|
+
* in step when the UI language is changed in the settings. For a Russian
|
|
443
|
+
* browser there is nothing to follow - DSH ships no ru locale - so the plugin's
|
|
444
|
+
* own dictionary answers first and the rows do not drop back to English.
|
|
445
|
+
*/
|
|
446
|
+
function slotTranslator(injected) {
|
|
447
|
+
const raw = typeof injected === 'function' ? injected : t
|
|
448
|
+
return browserLang() === 'ru' ? localizedTranslator(raw) : raw
|
|
449
|
+
}
|
|
450
|
+
|
|
313
451
|
// --- state -----------------------------------------------------------------
|
|
314
452
|
// One module-level store shared by the slot components and the DOM layer.
|
|
315
453
|
// Components read it through `useSnapshot`, so each stays a plain function of
|
|
@@ -761,6 +899,27 @@ window.__ModuleLoader__.load({
|
|
|
761
899
|
'@keyframes dsdel-toast-in{from{opacity:0;transform:translate(-50%,6px)}to{opacity:1;transform:translate(-50%,0)}}',
|
|
762
900
|
'@media (prefers-reduced-motion:reduce){.dsdel-toast{animation:none}.dsdel-field{transition:none}}',
|
|
763
901
|
'.dsdel-check{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;border:1.5px solid var(--dsw-alias-border-l3,rgba(128,128,128,.5));background:transparent;flex:none;margin-right:8px;box-sizing:border-box;cursor:pointer}',
|
|
902
|
+
// The two select-all boxes sit where the host puts them: inside each
|
|
903
|
+
// workspace header row, and inside the `工作区 N` heading above all of them.
|
|
904
|
+
//
|
|
905
|
+
// They live in the SIDEBAR, outside the `.dsdel-page` / `.dsdel-modal` /
|
|
906
|
+
// `.dsdel-bar` token scope, so every rule here reads a host alias with its
|
|
907
|
+
// own fallback. Reaching for `var(--dsdel-border)` was the bug: an unknown
|
|
908
|
+
// custom property voids the whole declaration, which left the box with no
|
|
909
|
+
// border, no content and nothing to click on.
|
|
910
|
+
|
|
911
|
+
// The spacer is the only child that grows, so the right-hand cluster keeps
|
|
912
|
+
// its place at the row's end while the box stays beside the name.
|
|
913
|
+
'.dsdel-flex-spacer{flex:1 1 auto;min-width:0;align-self:center;height:1px}',
|
|
914
|
+
'.dsdel-select-all,.dsdel-select-all-workspaces{flex:0 0 auto;box-sizing:border-box;width:15px;height:15px;min-width:15px;margin:0 0 0 6px;padding:0;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.45));border-radius:4px;background:transparent;color:var(--dsw-alias-label-secondary,#666);font-size:10px;line-height:1;cursor:pointer;opacity:1;visibility:visible;align-self:center}',
|
|
915
|
+
'.dsdel-select-all:hover,.dsdel-select-all-workspaces:hover{border-color:var(--dsw-alias-brand-primary,#4c8dff);color:var(--dsw-alias-brand-primary,#4c8dff)}',
|
|
916
|
+
'.dsdel-select-all[aria-checked="true"],.dsdel-select-all-workspaces[aria-checked="true"]{background:var(--dsw-alias-brand-primary,#4c8dff);border-color:var(--dsw-alias-brand-primary,#4c8dff);color:#fff}',
|
|
917
|
+
'.dsdel-select-all[aria-checked="mixed"],.dsdel-select-all-workspaces[aria-checked="mixed"]{border-color:var(--dsw-alias-brand-primary,#4c8dff);color:var(--dsw-alias-brand-primary,#4c8dff)}',
|
|
918
|
+
'.dsdel-select-all:focus-visible,.dsdel-select-all-workspaces:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4c8dff);outline-offset:1px}',
|
|
919
|
+
// While the mode runs, let the workspace name size to its own text. With
|
|
920
|
+
// `flex:1` it fills the row, so the select-all box inserted after it was
|
|
921
|
+
// pushed to the far edge even though it sits early in the child list.
|
|
922
|
+
'body.dsdel-selecting [class*="_projectText"]{flex:0 1 auto;min-width:0}',
|
|
764
923
|
'.dsdel-check-on{background:var(--dsw-alias-state-business-primary,#4c6ef5);border-color:var(--dsw-alias-state-business-primary,#4c6ef5)}',
|
|
765
924
|
'.dsdel-check-on::after{content:"";width:9px;height:5px;border-left:2px solid #fff;border-bottom:2px solid #fff;transform:rotate(-45deg) translateY(-1px)}',
|
|
766
925
|
// 乐观删除:行先隐藏,失败时随 decorate 恢复
|
|
@@ -952,6 +1111,244 @@ window.__ModuleLoader__.load({
|
|
|
952
1111
|
else openDeleteDialog(drag.sessionId, drag.title)
|
|
953
1112
|
}
|
|
954
1113
|
|
|
1114
|
+
// --- select a whole workspace ----------------------------------------------
|
|
1115
|
+
//
|
|
1116
|
+
// The sidebar groups sessions under `[data-row-key="workspace:<key>"]` headers,
|
|
1117
|
+
// and the host renders the `工作区 N` heading above all of them as
|
|
1118
|
+
// `[data-sidebar-workspace-header]`. Both get a checkbox of their own while the
|
|
1119
|
+
// mode runs: one per group, one for every group together.
|
|
1120
|
+
//
|
|
1121
|
+
// Group membership is read off the DOM rather than asked from the host: a
|
|
1122
|
+
// session row and its workspace row are siblings inside the same section
|
|
1123
|
+
// element, so a subtree query from the header finds exactly that group.
|
|
1124
|
+
|
|
1125
|
+
const GROUP_BUTTON = 'dsdel-select-all'
|
|
1126
|
+
const SPACER = 'dsdel-flex-spacer'
|
|
1127
|
+
const ALL_BUTTON = 'dsdel-select-all-workspaces'
|
|
1128
|
+
const WORKSPACE_ROWS_HEADER = '[data-sidebar-workspace-header]'
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Position of `node` among `parent`'s element children, or -1.
|
|
1132
|
+
*
|
|
1133
|
+
* `children` is an HTMLCollection in a browser and a plain array in the test
|
|
1134
|
+
* stub. HTMLCollection has no `indexOf`, so the call has to be spelled out.
|
|
1135
|
+
*/
|
|
1136
|
+
function childIndex(parent, node) {
|
|
1137
|
+
if (parent === null || parent === undefined) return -1
|
|
1138
|
+
const kids = parent.children
|
|
1139
|
+
if (kids === null || kids === undefined) return -1
|
|
1140
|
+
for (let i = 0; i < kids.length; i += 1) {
|
|
1141
|
+
if (kids[i] === node) return i
|
|
1142
|
+
}
|
|
1143
|
+
return -1
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/** `data-row-key` of a sidebar row, or null. */
|
|
1147
|
+
function rowKeyOf(node) {
|
|
1148
|
+
if (node === null || node === undefined || typeof node.getAttribute !== 'function') return null
|
|
1149
|
+
return node.getAttribute('data-row-key')
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* The session ids under one workspace header row.
|
|
1154
|
+
*
|
|
1155
|
+
* The row is not always a direct child of its section: the host may wrap it
|
|
1156
|
+
* (a hover card, a drag shell), and a subtree query from that wrapper finds
|
|
1157
|
+
* no sessions at all. So the ancestors are climbed until one of them owns
|
|
1158
|
+
* session rows — that ancestor is the section.
|
|
1159
|
+
*/
|
|
1160
|
+
/**
|
|
1161
|
+
* Rows that sit directly in `node`, looking one level into a wrapper.
|
|
1162
|
+
*
|
|
1163
|
+
* The host wraps the workspace row in `HoverCard`'s <span>, so the row's
|
|
1164
|
+
* `parentElement` is that span and not the group section. Whatever contains
|
|
1165
|
+
* the rows also has to be read through it.
|
|
1166
|
+
*
|
|
1167
|
+
* A `div[role="group"]` child is a NESTED workspace: it is skipped, or a
|
|
1168
|
+
* parent's select-all would sweep in its children's sessions.
|
|
1169
|
+
*/
|
|
1170
|
+
function ownRows(node) {
|
|
1171
|
+
const rows = []
|
|
1172
|
+
const visit = (parent, depth) => {
|
|
1173
|
+
if (parent === null || parent === undefined || parent.children === undefined) return
|
|
1174
|
+
for (const child of parent.children) {
|
|
1175
|
+
const key = typeof child.getAttribute === 'function' ? child.getAttribute('data-row-key') : null
|
|
1176
|
+
if (key !== null) { rows.push(child); continue }
|
|
1177
|
+
if (depth >= 2) continue
|
|
1178
|
+
if (typeof child.getAttribute === 'function' && child.getAttribute('role') === 'group') continue
|
|
1179
|
+
visit(child, depth + 1)
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
visit(node, 0)
|
|
1183
|
+
return rows
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* The session ids under one workspace header row.
|
|
1188
|
+
*
|
|
1189
|
+
* Climbed rather than assumed: a wrapper span put every id out of reach, so
|
|
1190
|
+
* the box ended up with an empty list and `toggleGroup` returned without
|
|
1191
|
+
* doing anything. The climb stops as soon as it reaches a container holding
|
|
1192
|
+
* more than one workspace, which is the shared list — grabbing there would
|
|
1193
|
+
* hand this group every other group's sessions.
|
|
1194
|
+
*/
|
|
1195
|
+
function sessionsUnderWorkspace(headRow) {
|
|
1196
|
+
let node = headRow.parentElement
|
|
1197
|
+
for (let depth = 0; depth < 6; depth += 1) {
|
|
1198
|
+
if (node === null || node === undefined) return []
|
|
1199
|
+
const rows = ownRows(node)
|
|
1200
|
+
let workspaces = 0
|
|
1201
|
+
const ids = []
|
|
1202
|
+
for (const row of rows) {
|
|
1203
|
+
const key = rowKeyOf(row)
|
|
1204
|
+
if (typeof key !== 'string') continue
|
|
1205
|
+
if (key.startsWith('workspace:')) workspaces += 1
|
|
1206
|
+
else if (key.startsWith('session:')) ids.push(key.slice('session:'.length))
|
|
1207
|
+
}
|
|
1208
|
+
if (workspaces > 1) return []
|
|
1209
|
+
if (ids.length > 0) return ids
|
|
1210
|
+
node = node.parentElement
|
|
1211
|
+
}
|
|
1212
|
+
return []
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* The tri-state a select-all box shows: every id in, none in, or something
|
|
1218
|
+
* between. `mixed` is what tells a user their group is partly ticked.
|
|
1219
|
+
*/
|
|
1220
|
+
function groupState(ids) {
|
|
1221
|
+
if (ids.length === 0) return 'false'
|
|
1222
|
+
let picked = 0
|
|
1223
|
+
for (const id of ids) if (state.selected.has(id)) picked += 1
|
|
1224
|
+
if (picked === 0) return 'false'
|
|
1225
|
+
return picked === ids.length ? 'true' : 'mixed'
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/** Ticking a full or partly ticked box clears the group; an empty one fills it. */
|
|
1229
|
+
function toggleGroup(ids) {
|
|
1230
|
+
if (ids.length === 0) return
|
|
1231
|
+
const fill = groupState(ids) !== 'true'
|
|
1232
|
+
for (const id of ids) {
|
|
1233
|
+
if (fill) state.selected.add(id)
|
|
1234
|
+
else state.selected.delete(id)
|
|
1235
|
+
}
|
|
1236
|
+
publish()
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Place (or refresh) one of the two boxes. `host` gets nothing appended twice:
|
|
1241
|
+
* the element is looked up by class first, so a decorate pass after a host
|
|
1242
|
+
* re-render reuses the box it already owns.
|
|
1243
|
+
*/
|
|
1244
|
+
/**
|
|
1245
|
+
* Place (or refresh) one of the two boxes.
|
|
1246
|
+
*
|
|
1247
|
+
* `anchor` is the class of the element the box should sit IN FRONT OF: the
|
|
1248
|
+
* host pushes its right-hand actions out with an auto margin, so appending at
|
|
1249
|
+
* the end drops the box at the row's far edge. Inserting before those actions
|
|
1250
|
+
* puts it right after the label, which is where it reads as part of the
|
|
1251
|
+
* heading.
|
|
1252
|
+
*/
|
|
1253
|
+
function placeGroupBox(host, className, label, ids, anchor) {
|
|
1254
|
+
if (host === null || host === undefined) return
|
|
1255
|
+
let box = typeof host.querySelector === 'function' ? host.querySelector('.' + className) : null
|
|
1256
|
+
const created = box === null
|
|
1257
|
+
if (created) {
|
|
1258
|
+
box = document.createElement('button')
|
|
1259
|
+
box.setAttribute('type', 'button')
|
|
1260
|
+
box.className = className
|
|
1261
|
+
box.setAttribute('role', 'checkbox')
|
|
1262
|
+
box.addEventListener('click', (event) => {
|
|
1263
|
+
// The workspace header toggles its group on click; this box must not.
|
|
1264
|
+
if (event && typeof event.stopPropagation === 'function') event.stopPropagation()
|
|
1265
|
+
toggleGroup(box.__dsdelIds || [])
|
|
1266
|
+
})
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
// The anchor is a comma list, tried one at a time: a document-order match
|
|
1270
|
+
// could otherwise pick a later sibling than the caller meant.
|
|
1271
|
+
let before = null
|
|
1272
|
+
if (anchor !== undefined && anchor !== null) {
|
|
1273
|
+
for (const selector of String(anchor).split(',')) {
|
|
1274
|
+
const found = host.querySelector(selector.trim())
|
|
1275
|
+
if (found !== null && found !== undefined) { before = found; break }
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// ALWAYS insert, not only on creation. A box placed by an earlier decorate
|
|
1280
|
+
// pass (or an earlier build) kept its old seat forever, because the insert
|
|
1281
|
+
// sat inside the `created` branch: the header box moved on the next pass and
|
|
1282
|
+
// the workspace box did not. `insertBefore` on an existing child just moves
|
|
1283
|
+
// it, so this is idempotent.
|
|
1284
|
+
// One flex child has to absorb the free space, or the whole right-hand
|
|
1285
|
+
// cluster (count, menu, new-session) slides left with the box. The spacer
|
|
1286
|
+
// takes that job so the name can stay at its natural width.
|
|
1287
|
+
let spacer = host.querySelector('.' + SPACER)
|
|
1288
|
+
if (before !== null && before !== undefined) {
|
|
1289
|
+
if (spacer === null) {
|
|
1290
|
+
spacer = document.createElement('span')
|
|
1291
|
+
spacer.className = SPACER
|
|
1292
|
+
spacer.setAttribute('aria-hidden', 'true')
|
|
1293
|
+
spacer.setAttribute('data-dsh-delete-session', 'spacer')
|
|
1294
|
+
}
|
|
1295
|
+
// Only touch the DOM when something is actually out of place. Every
|
|
1296
|
+
// `insertBefore` is a real mutation, and the list observer counted it as
|
|
1297
|
+
// a change: moving the box on every pass fed the observer its own work,
|
|
1298
|
+
// so a new pass was scheduled for the next frame, forever. A click that
|
|
1299
|
+
// landed while the box was detached and re-attached never completed,
|
|
1300
|
+
// which is why it took a dozen taps to hit it once.
|
|
1301
|
+
const boxAt = childIndex(host, box)
|
|
1302
|
+
const spacerAt = childIndex(host, spacer)
|
|
1303
|
+
const beforeAt = childIndex(host, before)
|
|
1304
|
+
if (boxAt === -1 || spacerAt === -1 || beforeAt === -1
|
|
1305
|
+
|| boxAt !== spacerAt - 1 || beforeAt !== spacerAt + 1) {
|
|
1306
|
+
host.insertBefore(spacer, before)
|
|
1307
|
+
host.insertBefore(box, spacer)
|
|
1308
|
+
}
|
|
1309
|
+
} else if (created) {
|
|
1310
|
+
host.appendChild(box)
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
box.setAttribute('aria-label', label)
|
|
1314
|
+
box.setAttribute('data-dsh-delete-session', 'select-all')
|
|
1315
|
+
const state_ = groupState(ids)
|
|
1316
|
+
box.setAttribute('aria-checked', state_)
|
|
1317
|
+
box.textContent = state_ === 'true' ? '✓' : (state_ === 'mixed' ? '−' : '')
|
|
1318
|
+
box.__dsdelIds = ids
|
|
1319
|
+
}
|
|
1320
|
+
function decorateSelectAll(rows) {
|
|
1321
|
+
if (!state.selecting) {
|
|
1322
|
+
for (const el of document.querySelectorAll('.' + GROUP_BUTTON)) el.remove()
|
|
1323
|
+
for (const el of document.querySelectorAll('.' + ALL_BUTTON)) el.remove()
|
|
1324
|
+
for (const el of document.querySelectorAll('.' + SPACER)) el.remove()
|
|
1325
|
+
return
|
|
1326
|
+
}
|
|
1327
|
+
const headings = document.querySelectorAll(WORKSPACE_ROWS_HEADER)
|
|
1328
|
+
if (headings.length > 0) {
|
|
1329
|
+
const every = []
|
|
1330
|
+
for (const row of rows) {
|
|
1331
|
+
const key = rowKeyOf(row)
|
|
1332
|
+
if (typeof key === 'string' && key.startsWith('session:')) every.push(key.slice('session:'.length))
|
|
1333
|
+
}
|
|
1334
|
+
// In the heading the label is followed by the search slot; inserting before
|
|
1335
|
+
// it keeps the box beside the words instead of inside the action cluster.
|
|
1336
|
+
// The heading row is: label, search slot, options, add. The box goes after
|
|
1337
|
+
// the label, before the first action it can find.
|
|
1338
|
+
placeGroupBox(headings[0], ALL_BUTTON, t('selectAllWorkspaces'), every,
|
|
1339
|
+
'[class*="_searchSlot"], [class*="_headerActions"]')
|
|
1340
|
+
}
|
|
1341
|
+
for (const row of rows) {
|
|
1342
|
+
const key = rowKeyOf(row)
|
|
1343
|
+
if (typeof key !== 'string' || !key.startsWith('workspace:')) continue
|
|
1344
|
+
// The workspace row is: folder, chevron, label block, then the actions. The
|
|
1345
|
+
// actions carry `margin-left:auto`, so anything appended after them lands at
|
|
1346
|
+
// the far edge; inserting before them keeps the box beside the name.
|
|
1347
|
+
placeGroupBox(row, GROUP_BUTTON, t('selectAllGroup'), sessionsUnderWorkspace(row),
|
|
1348
|
+
'[class*="_rowActions"]')
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
|
|
955
1352
|
function decorateRows() {
|
|
956
1353
|
if (typeof document === 'undefined') return
|
|
957
1354
|
const rows = document.querySelectorAll('[role="treeitem"]')
|
|
@@ -983,6 +1380,7 @@ window.__ModuleLoader__.load({
|
|
|
983
1380
|
}
|
|
984
1381
|
row.classList.toggle('dsdel-row-pending', state.pending.has(id))
|
|
985
1382
|
})
|
|
1383
|
+
decorateSelectAll(rows)
|
|
986
1384
|
if (!state.selecting) {
|
|
987
1385
|
document.querySelectorAll('.dsdel-check').forEach((el) => el.remove())
|
|
988
1386
|
}
|
|
@@ -992,16 +1390,32 @@ window.__ModuleLoader__.load({
|
|
|
992
1390
|
* inside the transcript produces characterData records forever; scheduling a
|
|
993
1391
|
* full row scan for those would burn a frame's budget on every token.
|
|
994
1392
|
*/
|
|
1393
|
+
/** True for the nodes this plugin itself inserts into the sidebar. */
|
|
1394
|
+
function isOwnNode(node) {
|
|
1395
|
+
if (node === null || node === undefined || typeof node.getAttribute !== 'function') return false
|
|
1396
|
+
return node.getAttribute('data-dsh-delete-session') !== null
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
function allOwnNodes(list) {
|
|
1400
|
+
if (list === null || list === undefined || list.length === 0) return true
|
|
1401
|
+
for (const node of list) if (!isOwnNode(node)) return false
|
|
1402
|
+
return true
|
|
1403
|
+
}
|
|
1404
|
+
|
|
995
1405
|
function onRowMutations(records) {
|
|
996
1406
|
if (records === undefined || records === null) return scheduleDecorate()
|
|
997
1407
|
for (const record of records) {
|
|
998
1408
|
const added = record === null || record === undefined ? null : record.addedNodes
|
|
999
1409
|
const removed = record === null || record === undefined ? null : record.removedNodes
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1410
|
+
const hasAdded = added !== null && added !== undefined && added.length > 0
|
|
1411
|
+
const hasRemoved = removed !== null && removed !== undefined && removed.length > 0
|
|
1412
|
+
if (!hasAdded && !hasRemoved) continue
|
|
1413
|
+
// Its own boxes and spacers are not a reason to scan again. Counting
|
|
1414
|
+
// them made every pass schedule the next one: a loop that kept moving
|
|
1415
|
+
// the box out from under the cursor.
|
|
1416
|
+
if (allOwnNodes(added) && allOwnNodes(removed)) continue
|
|
1417
|
+
scheduleDecorate()
|
|
1418
|
+
return
|
|
1005
1419
|
}
|
|
1006
1420
|
}
|
|
1007
1421
|
|
|
@@ -1071,7 +1485,7 @@ window.__ModuleLoader__.load({
|
|
|
1071
1485
|
},
|
|
1072
1486
|
h('span', { key: 'icon', className: 'dsdel-drop-icon' }, glyph(TRASH_PATHS)),
|
|
1073
1487
|
h('span', { key: 'text', className: 'dsdel-drop-text' },
|
|
1074
|
-
armed ? translate('dropRelease', name) : translate('dropHint'
|
|
1488
|
+
armed ? translate('dropRelease', { name }) : translate('dropHint')),
|
|
1075
1489
|
)
|
|
1076
1490
|
}
|
|
1077
1491
|
// Outside selection mode the footer keeps its normal face.
|
|
@@ -1130,7 +1544,12 @@ window.__ModuleLoader__.load({
|
|
|
1130
1544
|
|
|
1131
1545
|
function onSelectClickCapture(e) {
|
|
1132
1546
|
if (!state.selecting) return
|
|
1133
|
-
const
|
|
1547
|
+
const target = e.target && typeof e.target.closest === 'function' ? e.target : null
|
|
1548
|
+
// Anything this plugin drew handles its own click. Its document listener
|
|
1549
|
+
// runs first (capture), so without this guard a click on a select-all box
|
|
1550
|
+
// inside a workspace treeitem is swallowed as if the row itself was clicked.
|
|
1551
|
+
if (target !== null && target.closest('[data-dsh-delete-session]') !== null) return
|
|
1552
|
+
const row = target === null ? null : target.closest('[role="treeitem"]')
|
|
1134
1553
|
if (!row) return
|
|
1135
1554
|
const id = sessionIdFromRow(row)
|
|
1136
1555
|
if (!id) return
|
|
@@ -1201,6 +1620,12 @@ window.__ModuleLoader__.load({
|
|
|
1201
1620
|
document.removeEventListener('keydown', onSelectKeydown, true)
|
|
1202
1621
|
if (rowObserver) { rowObserver.disconnect(); rowObserver = null }
|
|
1203
1622
|
document.querySelectorAll('.dsdel-check').forEach((el) => el.remove())
|
|
1623
|
+
// Take the select-all boxes and their spacer with the mode, now rather than
|
|
1624
|
+
// on the next decorate pass: the spacer grows, so a frame of it left behind
|
|
1625
|
+
// would visibly shove the row's right-hand cluster to the left.
|
|
1626
|
+
for (const cls of [GROUP_BUTTON, ALL_BUTTON, SPACER]) {
|
|
1627
|
+
document.querySelectorAll('.' + cls).forEach((el) => el.remove())
|
|
1628
|
+
}
|
|
1204
1629
|
publish()
|
|
1205
1630
|
}
|
|
1206
1631
|
|
|
@@ -1666,7 +2091,8 @@ window.__ModuleLoader__.load({
|
|
|
1666
2091
|
// contract and must not change how the menu looks.
|
|
1667
2092
|
|
|
1668
2093
|
/** "Select multiple" row (order 409, directly above the delete row). */
|
|
1669
|
-
function SelectMultipleMenuItem({ useMenuOpenState, t:
|
|
2094
|
+
function SelectMultipleMenuItem({ useMenuOpenState, t: injected }) {
|
|
2095
|
+
const translate = slotTranslator(injected)
|
|
1670
2096
|
const [, setMenuOpen] = useMenuOpenState()
|
|
1671
2097
|
return h(primitives.MenuItemButton, {
|
|
1672
2098
|
icon: glyph(SELECT_PATHS),
|
|
@@ -1679,7 +2105,8 @@ window.__ModuleLoader__.load({
|
|
|
1679
2105
|
}
|
|
1680
2106
|
|
|
1681
2107
|
/** "Delete session" row (order 410, in the host's danger colour). */
|
|
1682
|
-
function DeleteSessionMenuItem({ sessionId, displayTitle, useMenuOpenState, t:
|
|
2108
|
+
function DeleteSessionMenuItem({ sessionId, displayTitle, useMenuOpenState, t: injected }) {
|
|
2109
|
+
const translate = slotTranslator(injected)
|
|
1683
2110
|
const [, setMenuOpen] = useMenuOpenState()
|
|
1684
2111
|
return h(primitives.MenuItemButton, {
|
|
1685
2112
|
danger: true,
|
|
@@ -2271,7 +2698,7 @@ window.__ModuleLoader__.load({
|
|
|
2271
2698
|
localeSvc = svc || null
|
|
2272
2699
|
if (localeRegistered || !localeSvc || typeof localeSvc.register !== 'function') return
|
|
2273
2700
|
localeRegistered = true
|
|
2274
|
-
const register = () => localeSvc.register(NS, { zh, en })
|
|
2701
|
+
const register = () => localeSvc.register(NS, { zh, en, ru })
|
|
2275
2702
|
try {
|
|
2276
2703
|
if (typeof ctx.effect === 'function') ctx.effect(register, `${NS}: dictionaries`)
|
|
2277
2704
|
else register()
|