dsh-sidebar-fold 0.1.6 → 0.1.12

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/client.js CHANGED
@@ -34,6 +34,11 @@ window.__ModuleLoader__.load({
34
34
  switchKnob: 'dshsf-switch-knob',
35
35
  segmentGroup: 'dshsf-segment-group',
36
36
  segment: 'dshsf-segment',
37
+ /** "More" menu shortcut row: its group wrapper, the row, its text and glyph. */
38
+ menuGroup: 'dshsf-menu-group',
39
+ menuRow: 'dshsf-menu-row',
40
+ menuText: 'dshsf-menu-text',
41
+ menuIcon: 'dshsf-menu-icon',
37
42
  });
38
43
  /**
39
44
  * Alignment of a panel row's content (icon + label) inside the row.
@@ -57,6 +62,8 @@ window.__ModuleLoader__.load({
57
62
  own: 'data-dshsf-own',
58
63
  /** On the nav: row-content alignment (`start` | `center` | `end`). */
59
64
  align: 'data-dshsf-align',
65
+ /** On the toggle: the folded group holds the panel the user is looking at. */
66
+ activeInside: 'data-dshsf-active-inside',
60
67
  });
61
68
  /** Selector fragments (hash-tolerant). */
62
69
  const SEL = Object.freeze({
@@ -68,6 +75,17 @@ window.__ModuleLoader__.load({
68
75
  moreAnchor: '[class*="_moreAnchor"]',
69
76
  /** Sidebar root modifier present exactly while the column is a narrow rail. */
70
77
  collapsed: '[class*="_collapsed"]',
78
+ /**
79
+ * Per-row wrapper shipped from the 0.2.2 line on (`div._panelEntry`): the row
80
+ * button is its child, and it carries the host's own row fill. Hiding only the
81
+ * button there leaves an empty entry (plus its pin control) behind, so the fold
82
+ * mark has to land on this wrapper when it exists.
83
+ */
84
+ panelEntry: 'div[class*="_panelEntry"]',
85
+ /** The host's own "unpin" control inside a row — rendered at the wide width only. */
86
+ panelUnpin: 'button[class*="_panelUnpin"]',
87
+ /** The "pin back" control inside the portalled "More" list (0.2.2 on). */
88
+ pinButton: 'button[class*="_pinButton"]',
71
89
  });
72
90
  /** `localStorage` key for the open/closed state (window-level UI state, by design). */
73
91
  const STORAGE_KEY = `${PKG_NAME}.v1.folded`;
@@ -75,6 +93,15 @@ window.__ModuleLoader__.load({
75
93
  const MORE_LABELS = Object.freeze(['更多', 'More']);
76
94
  /** Accessible-name strings of the "Global panels" nav label (`client.js:533`). */
77
95
  const PANELS_LABELS = Object.freeze(['全局面板', 'Global panels']);
96
+ /**
97
+ * The host's own fixed panel row — `FIXED_PANEL_ID = 'plugins'` in the 0.2.2
98
+ * sidebar (`SidebarRoot.tsx`: `canUnpin = hasEntryActions && id !== FIXED_PANEL_ID`).
99
+ *
100
+ * It is the one entry the host never unpins, so offering “hide in More” for it
101
+ * would be a promise the host silently refuses. The names are the only handle we
102
+ * have: the id never reaches the DOM.
103
+ */
104
+ const FIXED_LABELS = Object.freeze(['插件', 'Plugins']);
78
105
  /** Self-drawn chevron geometry: the host `primitives` package is off-limits to plugins. */
79
106
  const ICON_PATH = Object.freeze({
80
107
  up: 'M3.5 10 8 5.5 12.5 10',
@@ -109,6 +136,14 @@ window.__ModuleLoader__.load({
109
136
  // `center!important` is a parse error in some engines and silently dropped.
110
137
  rule(`[${ATTR.align}="center"] ${SEL.panelRow}`, ['justify-content: center !important']),
111
138
  rule(`[${ATTR.align}="end"] ${SEL.panelRow}`, ['justify-content: flex-end !important']),
139
+ // 0.2.2 reserves the row's right gutter for its own pin control (host rule:
140
+ // `.panelEntryWide .panelRow { padding-right: 38px }`). That gutter is real for
141
+ // `start`/`end`, but at `center` it pushes the labelled pair off-centre, so the
142
+ // gutter is folded back into the row's shipped inset there. This selector is
143
+ // more specific than the host rule, so no `!important` is needed.
144
+ rule(`[${ATTR.align}="center"] ${SEL.panelEntry} ${SEL.panelRow}`, [
145
+ 'padding-right: calc(var(--dsh-sidebar-row-padding, 12px) - var(--dsh-sidebar-paint-inset, 3px))',
146
+ ]),
112
147
  rule(`.${CLS.toggle}`, [
113
148
  'position:absolute',
114
149
  'right:4px',
@@ -131,6 +166,18 @@ window.__ModuleLoader__.load({
131
166
  rule(`.${CLS.toggle}:hover`, ['background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.16))']),
132
167
  rule(`.${CLS.toggleIdle}`, ['opacity:.45', 'cursor:default']),
133
168
  rule(`.${CLS.toggleIdle}:hover`, ['background:transparent']),
169
+ // Folded, but the panel being looked at is one of the folded rows: a 5px dot
170
+ // says “what you are reading is inside here”, which a bare chevron cannot.
171
+ rule(`.${CLS.toggle}[${ATTR.activeInside}]::after`, [
172
+ 'content:""',
173
+ 'position:absolute',
174
+ 'top:4px',
175
+ 'right:4px',
176
+ 'width:5px',
177
+ 'height:5px',
178
+ 'border-radius:50%',
179
+ 'background:var(--dsw-alias-accent,var(--dsw-alias-state-business-primary,#4d6bfe))',
180
+ ]),
134
181
  rule(`.${CLS.toggle}:focus-visible`, [
135
182
  'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
136
183
  'outline-offset:-2px',
@@ -224,6 +271,40 @@ window.__ModuleLoader__.load({
224
271
  'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
225
272
  'outline-offset:1px',
226
273
  ]),
274
+ // "More" menu shortcut row. The host's own action rows live in that list behind
275
+ // their own hairline; a list seat can only append, so this row carries the
276
+ // hairline itself and closes the action group.
277
+ rule(`.${CLS.menuGroup}`, [
278
+ 'margin-top:6px',
279
+ 'padding-top:6px',
280
+ 'border-top:1px solid var(--dsw-alias-hairline,rgba(127,127,127,.22))',
281
+ ]),
282
+ rule(`.${CLS.menuRow}`, [
283
+ 'box-sizing:border-box',
284
+ 'display:flex',
285
+ 'align-items:center',
286
+ 'gap:8px',
287
+ 'width:100%',
288
+ 'height:32px',
289
+ 'margin:0',
290
+ 'padding:0 10px',
291
+ 'border:0',
292
+ 'border-radius:var(--dsw-radius-md,8px)',
293
+ 'background:transparent',
294
+ 'font:inherit',
295
+ 'font-size:13px',
296
+ 'color:var(--dsw-alias-label-primary,inherit)',
297
+ 'text-align:left',
298
+ 'cursor:pointer',
299
+ '-webkit-app-region:no-drag',
300
+ ]),
301
+ rule(`.${CLS.menuRow}:hover`, ['background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.16))']),
302
+ rule(`.${CLS.menuRow}:focus-visible`, [
303
+ 'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
304
+ 'outline-offset:-2px',
305
+ ]),
306
+ rule(`.${CLS.menuText}`, ['overflow:hidden', 'text-overflow:ellipsis', 'white-space:nowrap']),
307
+ rule(`.${CLS.menuIcon}`, ['flex:none', 'display:block']),
227
308
  ].join('');
228
309
  /**
229
310
  * Runtime dictionaries for the browser half (9 languages, zh key set is the
@@ -238,12 +319,22 @@ window.__ModuleLoader__.load({
238
319
  'fold.nothing': '当前没有可折叠的入口',
239
320
  'fold.expand': '展开侧边栏更多入口',
240
321
  'fold.collapse': '收起侧边栏更多入口',
322
+ 'menu.settings': '侧栏折叠设置',
241
323
  'settings.defaultFolded': '默认折叠',
242
324
  'settings.defaultFoldedHint': '新窗口在没有本地记录时采用的初始状态',
243
- 'settings.keep': '保持可见的入口',
244
- 'settings.keepHint': '以下是当前侧边栏里的入口行;打开开关的那一行在折叠时保持可见。',
245
- 'settings.keepRowHint': '折叠时保持可见',
246
- 'settings.keepEmpty': '当前侧边栏没有可折叠的入口。',
325
+ 'settings.rows': '入口行',
326
+ 'settings.rowsHint': '每行三档:显示=一直显示;折叠=允许折叠;隐藏到更多=移进「更多」菜单。',
327
+ 'settings.rowAlways': '显示',
328
+ 'settings.rowFold': '折叠',
329
+ 'settings.rowMore': '隐藏到更多',
330
+ 'settings.rowHint': '显示=一直显示,折叠=允许折叠',
331
+ 'settings.rowsEmpty': '当前侧边栏没有可管理的入口。',
332
+ 'settings.moreUnavailable': '当前宿主不支持「隐藏到更多」(需要 0.2.2 起的侧边栏)。',
333
+ 'settings.moreFixed': '宿主固定入口,不能隐藏到「更多」。',
334
+ 'settings.saving': '保存中…',
335
+ 'settings.saved': '已保存',
336
+ 'settings.saveFailed': '保存失败,侧栏已按新生效但宿主未落盘。',
337
+ 'settings.retrySave': '重试保存',
247
338
  'settings.align': '文字与图标对齐',
248
339
  'settings.alignHint': '作用于侧边栏里被折叠管理的入口行;「更多」行跟随同一个对齐。',
249
340
  'settings.alignStart': '左对齐',
@@ -255,12 +346,22 @@ window.__ModuleLoader__.load({
255
346
  'fold.nothing': 'Nothing to fold right now',
256
347
  'fold.expand': 'Expand sidebar entries',
257
348
  'fold.collapse': 'Collapse sidebar entries',
349
+ 'menu.settings': 'Sidebar fold settings',
258
350
  'settings.defaultFolded': 'Folded by default',
259
351
  'settings.defaultFoldedHint': 'Initial state for a window with no local record yet',
260
- 'settings.keep': 'Entries kept visible',
261
- 'settings.keepHint': 'These are the entry rows in this sidebar right now; a row switched on stays visible while the rest fold.',
262
- 'settings.keepRowHint': 'Keep visible while folded',
263
- 'settings.keepEmpty': 'This sidebar has no entry rows to fold.',
352
+ 'settings.rows': 'Entries',
353
+ 'settings.rowsHint': 'Three states per row: Show keeps it visible, Fold lets the fold hide it, Hide in More moves it into the “More” menu.',
354
+ 'settings.rowAlways': 'Show',
355
+ 'settings.rowFold': 'Fold',
356
+ 'settings.rowMore': 'Hide in More',
357
+ 'settings.rowHint': 'Show = always visible; Fold = may be folded',
358
+ 'settings.rowsEmpty': 'This sidebar has no entries to manage.',
359
+ 'settings.moreUnavailable': 'This host cannot hide entries in “More” (needs a 0.2.2 sidebar).',
360
+ 'settings.moreFixed': 'This is the host’s fixed entry; it cannot be hidden in “More”.',
361
+ 'settings.saving': 'Saving…',
362
+ 'settings.saved': 'Saved',
363
+ 'settings.saveFailed': 'Save failed: the sidebar applied it, the host did not store it.',
364
+ 'settings.retrySave': 'Retry save',
264
365
  'settings.align': 'Row alignment',
265
366
  'settings.alignHint': 'Applies to the entry rows managed by the fold; the “More” row follows the same alignment.',
266
367
  'settings.alignStart': 'Left',
@@ -272,12 +373,22 @@ window.__ModuleLoader__.load({
272
373
  'fold.nothing': '折りたたむ項目がありません',
273
374
  'fold.expand': 'サイドバーの項目を展開',
274
375
  'fold.collapse': 'サイドバーの項目を折りたたむ',
376
+ 'menu.settings': 'サイドバー折りたたみ設定',
275
377
  'settings.defaultFolded': '既定で折りたたむ',
276
378
  'settings.defaultFoldedHint': 'ローカル記録がないウィンドウの初期状態',
277
- 'settings.keep': '表示したままにする項目',
278
- 'settings.keepHint': '現在のサイドバーにある項目行です。オンにした行は折りたたみ時も表示されます。',
279
- 'settings.keepRowHint': '折りたたみ時も表示',
280
- 'settings.keepEmpty': '折りたためる項目行がありません。',
379
+ 'settings.rows': '項目',
380
+ 'settings.rowsHint': '行ごとに3段階:表示=常に表示、折りたたみ=折りたたみ可、「その他」へ隠す=「その他」メニューへ移動。',
381
+ 'settings.rowAlways': '表示',
382
+ 'settings.rowFold': '折りたたみ',
383
+ 'settings.rowMore': '「その他」へ隠す',
384
+ 'settings.rowHint': '表示=常に表示、折りたたみ=折りたたみ可',
385
+ 'settings.rowsEmpty': '管理できる項目行がありません。',
386
+ 'settings.moreUnavailable': 'このホストは「その他」への隠し表示に対応していません(0.2.2 以降のサイドバーが必要)。',
387
+ 'settings.moreFixed': 'ホスト固定の入口のため「その他」へ隠せません。',
388
+ 'settings.saving': '保存中…',
389
+ 'settings.saved': '保存しました',
390
+ 'settings.saveFailed': '保存に失敗しました(サイドバーには反映済み、ホスト未保存)。',
391
+ 'settings.retrySave': '保存を再試行',
281
392
  'settings.align': '行の配置',
282
393
  'settings.alignHint': '折りたたみ対象の入口行に適用されます。「その他」行も同じ配置になります。',
283
394
  'settings.alignStart': '左寄せ',
@@ -289,12 +400,22 @@ window.__ModuleLoader__.load({
289
400
  'fold.nothing': '접을 항목이 없습니다',
290
401
  'fold.expand': '사이드바 항목 펼치기',
291
402
  'fold.collapse': '사이드바 항목 접기',
403
+ 'menu.settings': '사이드바 접기 설정',
292
404
  'settings.defaultFolded': '기본으로 접힘',
293
405
  'settings.defaultFoldedHint': '로컬 기록이 없는 창의 초기 상태',
294
- 'settings.keep': '계속 표시할 항목',
295
- 'settings.keepHint': '현재 사이드바의 항목 행입니다. 켜 둔 행은 접을 때도 표시됩니다.',
296
- 'settings.keepRowHint': '접을 때도 표시',
297
- 'settings.keepEmpty': '접을 항목 행이 없습니다.',
406
+ 'settings.rows': '항목',
407
+ 'settings.rowsHint': '행마다 3단계: 표시=항상 표시, 접기=접기 허용, 더 보기에 숨기기=“더 보기” 메뉴로 이동.',
408
+ 'settings.rowAlways': '표시',
409
+ 'settings.rowFold': '접기',
410
+ 'settings.rowMore': '더 보기에 숨기기',
411
+ 'settings.rowHint': '표시=항상 표시, 접기=접기 허용',
412
+ 'settings.rowsEmpty': '관리할 항목 행이 없습니다.',
413
+ 'settings.moreUnavailable': '이 호스트는 “더 보기”에 숨기기를 지원하지 않습니다(0.2.2 이상 사이드바 필요).',
414
+ 'settings.moreFixed': '호스트 고정 항목이라 “더 보기”에 숨길 수 없습니다.',
415
+ 'settings.saving': '저장 중…',
416
+ 'settings.saved': '저장됨',
417
+ 'settings.saveFailed': '저장 실패: 사이드바에는 적용됐지만 호스트에 기록되지 않았습니다.',
418
+ 'settings.retrySave': '저장 다시 시도',
298
419
  'settings.align': '행 정렬',
299
420
  'settings.alignHint': '접기 대상 입구 행에 적용됩니다. “더 보기” 행도 같은 정렬을 따릅니다.',
300
421
  'settings.alignStart': '왼쪽',
@@ -306,12 +427,22 @@ window.__ModuleLoader__.load({
306
427
  'fold.nothing': 'Rien à replier pour le moment',
307
428
  'fold.expand': 'Déplier les entrées de la barre latérale',
308
429
  'fold.collapse': 'Replier les entrées de la barre latérale',
430
+ 'menu.settings': 'Réglages du repli de la barre latérale',
309
431
  'settings.defaultFolded': 'Replié par défaut',
310
432
  'settings.defaultFoldedHint': 'État initial d’une fenêtre sans enregistrement local',
311
- 'settings.keep': 'Entrées toujours visibles',
312
- 'settings.keepHint': 'Voici les lignes d’entrée présentes dans cette barre latérale ; une ligne activée reste visible lors du repli.',
313
- 'settings.keepRowHint': 'Rester visible pendant le repli',
314
- 'settings.keepEmpty': 'Cette barre latérale n’a aucune ligne à replier.',
433
+ 'settings.rows': 'Entrées',
434
+ 'settings.rowsHint': 'Trois états par ligne : Afficher la garde visible, Replier laisse le repli la masquer, Masquer dans « Plus » la déplace dans le menu « Plus ».',
435
+ 'settings.rowAlways': 'Afficher',
436
+ 'settings.rowFold': 'Replier',
437
+ 'settings.rowMore': 'Masquer dans « Plus »',
438
+ 'settings.rowHint': 'Afficher = toujours visible ; Replier = peut être replié',
439
+ 'settings.rowsEmpty': 'Cette barre latérale n’a aucune ligne à gérer.',
440
+ 'settings.moreUnavailable': 'Cet hôte ne sait pas masquer une entrée dans « Plus » (barre latérale 0.2.2 requise).',
441
+ 'settings.moreFixed': 'Entrée fixe de l’hôte : impossible de la masquer dans « Plus ».',
442
+ 'settings.saving': 'Enregistrement…',
443
+ 'settings.saved': 'Enregistré',
444
+ 'settings.saveFailed': 'Échec de l’enregistrement : appliqué à la barre latérale, non stocké par l’hôte.',
445
+ 'settings.retrySave': 'Réessayer',
315
446
  'settings.align': 'Alignement des lignes',
316
447
  'settings.alignHint': 'S’applique aux lignes gérées par le repli ; la ligne « Plus » suit le même alignement.',
317
448
  'settings.alignStart': 'Gauche',
@@ -323,12 +454,22 @@ window.__ModuleLoader__.load({
323
454
  'fold.nothing': 'Derzeit nichts einzuklappen',
324
455
  'fold.expand': 'Seiteneinträge ausklappen',
325
456
  'fold.collapse': 'Seiteneinträge einklappen',
457
+ 'menu.settings': 'Einstellungen für das Einklappen',
326
458
  'settings.defaultFolded': 'Standardmäßig eingeklappt',
327
459
  'settings.defaultFoldedHint': 'Anfangszustand eines Fensters ohne lokalen Eintrag',
328
- 'settings.keep': 'Sichtbar bleibende Einträge',
329
- 'settings.keepHint': 'Das sind die Eintragszeilen dieser Seitenleiste; eine aktivierte Zeile bleibt beim Einklappen sichtbar.',
330
- 'settings.keepRowHint': 'Beim Einklappen sichtbar bleiben',
331
- 'settings.keepEmpty': 'Diese Seitenleiste hat keine einklappbaren Zeilen.',
460
+ 'settings.rows': 'Einträge',
461
+ 'settings.rowsHint': 'Drei Zustände pro Zeile: Anzeigen bleibt sichtbar, Einklappen lässt die Zeile verschwinden, In „Mehr“ ausblenden verschiebt sie in das Menü „Mehr“.',
462
+ 'settings.rowAlways': 'Anzeigen',
463
+ 'settings.rowFold': 'Einklappen',
464
+ 'settings.rowMore': 'In „Mehr“ ausblenden',
465
+ 'settings.rowHint': 'Anzeigen = immer sichtbar; Einklappen = darf eingeklappt werden',
466
+ 'settings.rowsEmpty': 'Diese Seitenleiste hat keine verwaltbaren Zeilen.',
467
+ 'settings.moreUnavailable': 'Dieser Host kann Einträge nicht in „Mehr“ ausblenden (Seitenleiste 0.2.2 nötig).',
468
+ 'settings.moreFixed': 'Vom Host fixierter Eintrag — kann nicht in „Mehr“ ausgeblendet werden.',
469
+ 'settings.saving': 'Wird gespeichert…',
470
+ 'settings.saved': 'Gespeichert',
471
+ 'settings.saveFailed': 'Speichern fehlgeschlagen: in der Seitenleiste angewendet, vom Host nicht gespeichert.',
472
+ 'settings.retrySave': 'Speichern wiederholen',
332
473
  'settings.align': 'Zeilenausrichtung',
333
474
  'settings.alignHint': 'Gilt für die vom Einklappen verwalteten Einträge; die Zeile „Mehr“ folgt derselben Ausrichtung.',
334
475
  'settings.alignStart': 'Links',
@@ -340,12 +481,22 @@ window.__ModuleLoader__.load({
340
481
  'fold.nothing': 'Niente da comprimere al momento',
341
482
  'fold.expand': 'Espandi le voci della barra laterale',
342
483
  'fold.collapse': 'Comprimi le voci della barra laterale',
484
+ 'menu.settings': 'Impostazioni della compressione',
343
485
  'settings.defaultFolded': 'Compresse per impostazione predefinita',
344
486
  'settings.defaultFoldedHint': 'Stato iniziale di una finestra senza record locale',
345
- 'settings.keep': 'Voci sempre visibili',
346
- 'settings.keepHint': 'Queste sono le righe presenti nella barra laterale; una riga attiva resta visibile durante la compressione.',
347
- 'settings.keepRowHint': 'Resta visibile durante la compressione',
348
- 'settings.keepEmpty': 'Questa barra laterale non ha righe da comprimere.',
487
+ 'settings.rows': 'Voci',
488
+ 'settings.rowsHint': 'Tre stati per riga: Mostra resta visibile, Comprimi lascia che la compressione la nasconda, Nascondi in «Altro» la sposta nel menu «Altro».',
489
+ 'settings.rowAlways': 'Mostra',
490
+ 'settings.rowFold': 'Comprimi',
491
+ 'settings.rowMore': 'Nascondi in «Altro»',
492
+ 'settings.rowHint': 'Mostra = sempre visibile; Comprimi = può essere compressa',
493
+ 'settings.rowsEmpty': 'Questa barra laterale non ha righe da gestire.',
494
+ 'settings.moreUnavailable': 'Questo host non sa nascondere le voci in «Altro» (serve una barra laterale 0.2.2).',
495
+ 'settings.moreFixed': 'Voce fissa dell’host: non può essere nascosta in «Altro».',
496
+ 'settings.saving': 'Salvataggio…',
497
+ 'settings.saved': 'Salvato',
498
+ 'settings.saveFailed': 'Salvataggio non riuscito: applicato alla barra laterale, non memorizzato dall’host.',
499
+ 'settings.retrySave': 'Riprova a salvare',
349
500
  'settings.align': 'Allineamento delle righe',
350
501
  'settings.alignHint': 'Si applica alle righe gestite dalla compressione; anche la riga «Altro» segue lo stesso allineamento.',
351
502
  'settings.alignStart': 'Sinistra',
@@ -357,12 +508,22 @@ window.__ModuleLoader__.load({
357
508
  'fold.nothing': 'Сейчас нечего сворачивать',
358
509
  'fold.expand': 'Развернуть записи боковой панели',
359
510
  'fold.collapse': 'Свернуть записи боковой панели',
511
+ 'menu.settings': 'Настройки сворачивания',
360
512
  'settings.defaultFolded': 'Свёрнуто по умолчанию',
361
513
  'settings.defaultFoldedHint': 'Начальное состояние окна без локальной записи',
362
- 'settings.keep': 'Остаются видимыми',
363
- 'settings.keepHint': 'Это строки текущей боковой панели; включённая строка остаётся видимой при сворачивании.',
364
- 'settings.keepRowHint': 'Остаётся видимой при сворачивании',
365
- 'settings.keepEmpty': 'В этой боковой панели нет строк для сворачивания.',
514
+ 'settings.rows': 'Пункты',
515
+ 'settings.rowsHint': 'Три состояния на строку: Показывать оставляет её видимой, Сворачивать позволяет её скрыть, Скрыть в «Ещё» переносит её в меню «Ещё».',
516
+ 'settings.rowAlways': 'Показывать',
517
+ 'settings.rowFold': 'Сворачивать',
518
+ 'settings.rowMore': 'Скрыть в «Ещё»',
519
+ 'settings.rowHint': 'Показывать = всегда видна; Сворачивать = может быть скрыта',
520
+ 'settings.rowsEmpty': 'В этой боковой панели нет строк для управления.',
521
+ 'settings.moreUnavailable': 'Этот хост не умеет скрывать пункты в «Ещё» (нужна боковая панель 0.2.2).',
522
+ 'settings.moreFixed': 'Закреплённый хостом пункт — скрыть в «Ещё» нельзя.',
523
+ 'settings.saving': 'Сохранение…',
524
+ 'settings.saved': 'Сохранено',
525
+ 'settings.saveFailed': 'Не удалось сохранить: в панели применено, хостом не записано.',
526
+ 'settings.retrySave': 'Повторить сохранение',
366
527
  'settings.align': 'Выравнивание строк',
367
528
  'settings.alignHint': 'Применяется к строкам, которыми управляет сворачивание; строка «Ещё» следует тому же выравниванию.',
368
529
  'settings.alignStart': 'По левому краю',
@@ -374,12 +535,22 @@ window.__ModuleLoader__.load({
374
535
  'fold.nothing': 'Nada que plegar ahora mismo',
375
536
  'fold.expand': 'Desplegar entradas de la barra lateral',
376
537
  'fold.collapse': 'Plegar entradas de la barra lateral',
538
+ 'menu.settings': 'Ajustes del plegado de la barra lateral',
377
539
  'settings.defaultFolded': 'Plegado por defecto',
378
540
  'settings.defaultFoldedHint': 'Estado inicial de una ventana sin registro local',
379
- 'settings.keep': 'Entradas siempre visibles',
380
- 'settings.keepHint': 'Estas son las filas de la barra lateral actual; una fila activada sigue visible al plegar.',
381
- 'settings.keepRowHint': 'Mantener visible al plegar',
382
- 'settings.keepEmpty': 'Esta barra lateral no tiene filas que plegar.',
541
+ 'settings.rows': 'Entradas',
542
+ 'settings.rowsHint': 'Tres estados por fila: Mostrar la mantiene visible, Plegar deja que el pliegue la oculte, Ocultar en «Más» la mueve al menú «Más».',
543
+ 'settings.rowAlways': 'Mostrar',
544
+ 'settings.rowFold': 'Plegar',
545
+ 'settings.rowMore': 'Ocultar en «Más»',
546
+ 'settings.rowHint': 'Mostrar = siempre visible; Plegar = se puede plegar',
547
+ 'settings.rowsEmpty': 'Esta barra lateral no tiene filas que gestionar.',
548
+ 'settings.moreUnavailable': 'Este host no puede ocultar entradas en «Más» (requiere una barra lateral 0.2.2).',
549
+ 'settings.moreFixed': 'Entrada fija del host: no se puede ocultar en «Más».',
550
+ 'settings.saving': 'Guardando…',
551
+ 'settings.saved': 'Guardado',
552
+ 'settings.saveFailed': 'Error al guardar: aplicado en la barra lateral, no almacenado por el host.',
553
+ 'settings.retrySave': 'Reintentar guardado',
383
554
  'settings.align': 'Alineación de las filas',
384
555
  'settings.alignHint': 'Se aplica a las filas gestionadas por el pliegue; la fila «Más» sigue la misma alineación.',
385
556
  'settings.alignStart': 'Izquierda',
@@ -453,7 +624,7 @@ window.__ModuleLoader__.load({
453
624
  /** Whether the group is folded; `null` = never decided in this window yet. */
454
625
  let folded = null;
455
626
  /** Last config the fold was applied with (also read by the settings card). */
456
- let config = { defaultFolded: false, keepLabels: [], align: 'start' };
627
+ let config = { defaultFolded: false, keepLabels: [], hideLabels: [], align: 'start' };
457
628
  /** Registered so `index.ts` can notify the fold after a settings write. */
458
629
  const configListeners = new Set();
459
630
  /**
@@ -495,22 +666,87 @@ window.__ModuleLoader__.load({
495
666
  return true;
496
667
  return keepLabels.some((item) => item.trim().toLowerCase() === needle);
497
668
  }
669
+ /**
670
+ * True when a label belongs to the host's fixed panel row.
671
+ *
672
+ * The host never unpins that row (`FIXED_PANEL_ID`), so the third state is not
673
+ * available for it on any line — offering it would be a promise the host
674
+ * silently refuses.
675
+ */
676
+ function isFixedLabel(label) {
677
+ const needle = label.trim().toLowerCase();
678
+ if (needle === '')
679
+ return false;
680
+ return FIXED_LABELS.some((item) => item.toLowerCase() === needle);
681
+ }
682
+ /**
683
+ * Whether one row may be handed to the host's "More" list.
684
+ *
685
+ * Two gates: the host must ship the pin mechanism at all, and the row must not
686
+ * be the fixed one.
687
+ * @param label - the row's accessible name.
688
+ * @param hostCanPin - whether this host renders the 0.2.2 row structure.
689
+ */
690
+ function canMoveToMore(label, hostCanPin) {
691
+ return hostCanPin && !isFixedLabel(label);
692
+ }
693
+ /**
694
+ * Drop fixed labels from a stored hide list.
695
+ *
696
+ * A config written by an older build (or hand-edited) may list the fixed row;
697
+ * ignoring it here keeps the fold from chasing a move the host will never do.
698
+ * @param hideLabels - the served hide list.
699
+ * @returns the same list without the host's fixed labels.
700
+ */
701
+ function pruneHidden(hideLabels) {
702
+ return hideLabels.filter((label) => !isFixedLabel(label));
703
+ }
704
+ /**
705
+ * True when a label belongs to the host's "More" list (case/whitespace tolerant).
706
+ *
707
+ * An unnamed row is never hidden: the pin control is addressed by name, so a row
708
+ * we cannot name is a row we cannot move.
709
+ */
710
+ function isHidden(label, hideLabels) {
711
+ const needle = label.trim().toLowerCase();
712
+ if (needle === '' || isFixedLabel(label))
713
+ return false;
714
+ return hideLabels.some((item) => item.trim().toLowerCase() === needle);
715
+ }
716
+ /**
717
+ * One label's three-state setting, resolved from the two stored lists.
718
+ *
719
+ * `more` wins over `always`: a label that somehow sits in both lists must leave
720
+ * the column rather than be silently resurrected by the keep list.
721
+ */
722
+ function stateOf(label, keepLabels, hideLabels) {
723
+ if (isHidden(label, hideLabels))
724
+ return 'more';
725
+ return isKept(label, keepLabels) ? 'always' : 'foldable';
726
+ }
498
727
  /**
499
728
  * Split an ordered row list into the fold header and the fold group.
500
729
  *
501
730
  * The header is the row with `aria-haspopup="menu"` (the More launcher); with
502
731
  * the shipped DOM that is also always the last child, so the fallback keeps
503
732
  * working if a host ever drops the attribute. The group is every other row,
504
- * minus the `keepLabels` whitelist.
733
+ * minus the `keepLabels` whitelist and minus the `hideLabels` rows (those are on
734
+ * their way into the host's More list and must not count as foldable).
505
735
  * @param rows - the nav's `panelRow` buttons, in document order.
506
736
  * @param keepLabels - accessible names that are never folded.
737
+ * @param hideLabels - accessible names that live in the host's "More" list.
507
738
  * @returns the header plus the foldable group, or `null` when there is nothing to fold.
508
739
  */
509
- function splitRows(rows, keepLabels) {
740
+ function splitRows(rows, keepLabels, hideLabels = []) {
510
741
  if (rows.length < 2)
511
742
  return null;
512
743
  const header = rows.find((row) => row.getAttribute('aria-haspopup') === 'menu') ?? rows[rows.length - 1];
513
- const group = rows.filter((row) => row !== header && !isKept(labelOf(row), keepLabels));
744
+ const group = rows.filter((row) => {
745
+ if (row === header)
746
+ return false;
747
+ const label = labelOf(row);
748
+ return !isKept(label, keepLabels) && !isHidden(label, hideLabels);
749
+ });
514
750
  return { header, group };
515
751
  }
516
752
  /**
@@ -543,19 +779,20 @@ window.__ModuleLoader__.load({
543
779
  return Array.from(nav.querySelectorAll?.(SEL.panelRow) ?? []);
544
780
  }
545
781
  /** Apply {@link splitRows} to a live nav. */
546
- function resolveNavGroup(nav, keepLabels) {
547
- return splitRows(rowsOf(nav), keepLabels);
782
+ function resolveNavGroup(nav, keepLabels, hideLabels) {
783
+ return splitRows(rowsOf(nav), keepLabels, hideLabels);
548
784
  }
549
785
  /**
550
786
  * Decide the fold for one scan.
551
787
  * @param rows - the nav's panel rows, in document order.
552
788
  * @param keepLabels - rows that stay visible while the group folds.
789
+ * @param hideLabels - rows handed to the host's "More" list; never folded.
553
790
  * @param folded - the window's current fold choice.
554
791
  * @param rail - whether the sidebar is currently the 36px icon rail.
555
792
  * @returns the plan, or `null` when there is no header/group to work with.
556
793
  */
557
- function planFold(rows, keepLabels, folded, rail) {
558
- const resolved = splitRows(rows, keepLabels);
794
+ function planFold(rows, keepLabels, hideLabels, folded, rail) {
795
+ const resolved = splitRows(rows, keepLabels, hideLabels);
559
796
  if (resolved === null)
560
797
  return null;
561
798
  const { header, group } = resolved;
@@ -576,48 +813,95 @@ window.__ModuleLoader__.load({
576
813
  /** Last roster fingerprint, so we only notify on real change. */
577
814
  let rosterKey = '';
578
815
  /**
579
- * The fold group as the settings card shows it: every sibling panel row of the
580
- * "More" header, with whether it is currently kept visible.
816
+ * The rows the settings card shows: the sidebar's own panel rows, the entries the
817
+ * host already holds in its "More" list, and every label we still hide but whose
818
+ * row is not on screen right now (the More list is portalled, so it only exists
819
+ * while it is open).
581
820
  *
582
821
  * This is read from the **live DOM**, not from config: the point of the card is
583
- * to offer switches for whatever entries this profile actually has, including
584
- * ones installed after the card was written.
585
- * @returns one entry per foldable row, in document order.
822
+ * to offer controls for whatever this profile actually has, including entries
823
+ * installed after the card was written.
824
+ * @returns one entry per manageable row, in document order.
586
825
  */
587
826
  function roster() {
588
827
  const nav = findPanelNav(document);
589
- if (nav === null)
590
- return [];
591
- return rosterFrom(rowsOf(nav), config.keepLabels);
828
+ const rows = nav === null ? [] : rosterFrom(rowsOf(nav), config.keepLabels, config.hideLabels);
829
+ const seen = new Set(rows.map((row) => row.label.toLowerCase()));
830
+ for (const entry of moreMenuRows()) {
831
+ if (seen.has(entry.label.toLowerCase()))
832
+ continue;
833
+ rows.push(entry);
834
+ seen.add(entry.label.toLowerCase());
835
+ }
836
+ // A label we still hide whose row is gone from both surfaces keeps its control:
837
+ // dropping it would silently drop the setting with it.
838
+ for (const label of config.hideLabels) {
839
+ const trimmed = label.trim();
840
+ if (trimmed === '' || seen.has(trimmed.toLowerCase()))
841
+ continue;
842
+ rows.push({ label: trimmed, state: 'more' });
843
+ seen.add(trimmed.toLowerCase());
844
+ }
845
+ return rows;
846
+ }
847
+ /**
848
+ * The host's own "More" list, read from the portalled menu when it is open.
849
+ *
850
+ * The menu is rendered under `document.body`, so its rows never sit inside the
851
+ * nav and the nav scan can never see them. Each row is a menu item plus a
852
+ * `_pinButton` whose enclosing `div` owns the label text.
853
+ * @returns one entry per entry the host currently keeps out of the column.
854
+ */
855
+ function moreMenuRows() {
856
+ const out = [];
857
+ for (const button of Array.from(document.querySelectorAll(SEL.pinButton))) {
858
+ const label = (button.closest('div')?.textContent ?? '').trim();
859
+ if (label !== '')
860
+ out.push({ label, state: 'more' });
861
+ }
862
+ return out;
592
863
  }
593
864
  /**
594
865
  * The card's row list, computed from a row array instead of the live DOM.
595
866
  * @param rows - the nav's panel rows, in document order.
596
- * @param keepLabels - rows currently kept visible.
867
+ * @param keepLabels - rows set to stay visible.
868
+ * @param hideLabels - rows set to live in the host's "More" list.
597
869
  * @returns one entry per sibling of the header, unnamed rows dropped.
598
870
  */
599
- function rosterFrom(rows, keepLabels) {
600
- const resolved = splitRows(rows, keepLabels);
871
+ function rosterFrom(rows, keepLabels, hideLabels = []) {
872
+ const resolved = splitRows(rows, keepLabels, hideLabels);
601
873
  const header = resolved?.header;
602
874
  return rows
603
875
  .filter((row) => row !== header)
604
- .map((row) => ({ label: labelOf(row), keep: isKept(labelOf(row), keepLabels) }))
876
+ .map((row) => {
877
+ const label = labelOf(row);
878
+ return { label, state: stateOf(label, keepLabels, hideLabels) };
879
+ })
605
880
  .filter((row) => row.label !== '');
606
881
  }
607
882
  /**
608
- * Fold the per-row switches into the stored keep list.
883
+ * Fold one row's moved control into the two stored lists.
609
884
  *
610
- * The switch state IS the storage: switched-on rows are the kept ones, so a row
611
- * that disappeared from the sidebar drops out and a new row starts folded.
885
+ * The control state IS the storage: `always` rows are the keep list, `more` rows
886
+ * are the hide list, and `foldable` rows appear in neither. A row that dropped
887
+ * out of the roster loses its entry, and a row that appears starts foldable —
888
+ * which is what the shipped default means.
612
889
  * @param rows - the roster the card rendered.
613
- * @param label - the row whose switch moved.
890
+ * @param label - the row whose control moved.
614
891
  * @param next - its new state.
615
- * @returns the labels to write to `keepLabels`.
892
+ * @returns the two label lists to write to config.
616
893
  */
617
- function deriveKeep(rows, label, next) {
618
- return rows
619
- .filter((row) => (row.label === label ? next : row.keep))
620
- .map((row) => row.label);
894
+ function deriveLists(rows, label, next) {
895
+ const keepLabels = [];
896
+ const hideLabels = [];
897
+ for (const row of rows) {
898
+ const state = row.label === label ? next : row.state;
899
+ if (state === 'always')
900
+ keepLabels.push(row.label);
901
+ else if (state === 'more')
902
+ hideLabels.push(row.label);
903
+ }
904
+ return { keepLabels, hideLabels };
621
905
  }
622
906
  /**
623
907
  * Subscribe to roster changes (rows added/removed, or keep flags recomputed).
@@ -630,9 +914,9 @@ window.__ModuleLoader__.load({
630
914
  rosterListeners.delete(listener);
631
915
  };
632
916
  }
633
- /** Tell the card that the row inventory (or its keep flags) changed. */
917
+ /** Tell the card that the row inventory (or one row's state) changed. */
634
918
  function notifyRoster(rows) {
635
- const key = rows.map((row) => `${row.label}:${row.keep ? 1 : 0}`).join('|');
919
+ const key = rows.map((row) => `${row.label}:${row.state}`).join('|');
636
920
  if (key === rosterKey)
637
921
  return;
638
922
  rosterKey = key;
@@ -649,6 +933,48 @@ window.__ModuleLoader__.load({
649
933
  function isRail(nav) {
650
934
  return nav.closest?.(SEL.collapsed) !== null && nav.closest?.(SEL.collapsed) !== undefined;
651
935
  }
936
+ /**
937
+ * True when this row holds the panel the host marks as current.
938
+ *
939
+ * Two signals, because the line changed shape: the shipped rows carry
940
+ * `aria-current="page"`, and from 0.2.2 on the wrapper carries
941
+ * `_panelEntryActive`.
942
+ * @param row - one panel-row button.
943
+ */
944
+ function isActiveRow(row) {
945
+ if (row.getAttribute('aria-current') === 'page')
946
+ return true;
947
+ const entry = row.closest?.(SEL.panelEntry);
948
+ return (entry?.className ?? '').includes('_panelEntryActive');
949
+ }
950
+ /**
951
+ * Whether a mutation batch could concern the sidebar at all.
952
+ *
953
+ * The observer sees the whole body, so the first thing every batch gets is this
954
+ * cheap filter: a streaming reply mutates the tree dozens of times per second,
955
+ * and none of it can change the fold. Only added/removed nodes that are (or
956
+ * contain) a panel row count.
957
+ * @param records - one observer batch.
958
+ * @returns true when at least one record adds or removes a panel row.
959
+ */
960
+ function recordsTouchRows(records) {
961
+ for (const record of records) {
962
+ if (record.type !== undefined && record.type !== 'childList')
963
+ continue;
964
+ const nodes = [...Array.from(record.addedNodes ?? []), ...Array.from(record.removedNodes ?? [])];
965
+ for (const node of nodes) {
966
+ const element = node;
967
+ if (element === null || typeof element !== 'object' || element.nodeType !== 1)
968
+ continue;
969
+ if (element.matches?.(SEL.panelRow) === true)
970
+ return true;
971
+ const inside = element.querySelector?.(SEL.panelRow);
972
+ if (inside !== null && inside !== undefined)
973
+ return true;
974
+ }
975
+ }
976
+ return false;
977
+ }
652
978
  /** Inject (once) the sheet that draws the toggle and hides folded rows. */
653
979
  function ensureSheet() {
654
980
  const existing = document.head.querySelector(`style[data-plugin-css="${STYLE_TAG_ID}"]`);
@@ -708,6 +1034,138 @@ window.__ModuleLoader__.load({
708
1034
  toggle.setAttribute('aria-label', label);
709
1035
  toggle.setAttribute('title', label);
710
1036
  }
1037
+ /**
1038
+ * True when this host ships the 0.2.2 row wrapper, i.e. it owns the pin feature.
1039
+ *
1040
+ * The third state ("hide into More") is not ours to draw: the host removes the
1041
+ * row from the column and renders it in its own menu. What we own is driving it,
1042
+ * and the wrapper is the structure that says the host can be driven.
1043
+ */
1044
+ function hostHasPin() {
1045
+ return document.querySelector(SEL.panelEntry) !== null;
1046
+ }
1047
+ /**
1048
+ * The element a fold mark must hide.
1049
+ *
1050
+ * From the 0.2.2 line on, a row button is wrapped in `div._panelEntry` that also
1051
+ * carries the host's own pin control; hiding only the button left an empty entry
1052
+ * with a hover-visible pin behind (measured on 0.2.2-rc.3). Hiding the wrapper
1053
+ * takes the whole row with it and leaves the shipped DOM untouched on older lines.
1054
+ *
1055
+ * Exported as a seam: it is the one line that decides whether the host's
1056
+ * `.panelList { gap: 2px }` still sees an item, so the test has to reach it.
1057
+ */
1058
+ function foldTarget(row) {
1059
+ return (row.closest?.(SEL.panelEntry) ?? row);
1060
+ }
1061
+ /** The host's own "unpin" control of one row, or `null` in the 36px rail. */
1062
+ function unpinControl(row) {
1063
+ const scope = foldTarget(row);
1064
+ return (scope.querySelector?.(SEL.panelUnpin) ?? null);
1065
+ }
1066
+ /** The label text of one row inside the portalled "More" list. */
1067
+ function menuRowLabel(control) {
1068
+ return (control.closest('div')?.textContent ?? '').trim();
1069
+ }
1070
+ /** One key form for label matching (the host writes labels, we compare them). */
1071
+ function labelKey(label) {
1072
+ return label.trim().toLowerCase();
1073
+ }
1074
+ /** The "More" list's pin-back control for one label, when that list is on screen. */
1075
+ function pinControl(label) {
1076
+ const key = labelKey(label);
1077
+ if (key === '')
1078
+ return null;
1079
+ for (const control of Array.from(document.querySelectorAll(SEL.pinButton))) {
1080
+ if (labelKey(menuRowLabel(control)) === key)
1081
+ return control;
1082
+ }
1083
+ return null;
1084
+ }
1085
+ /** One label we owe the host a move, with how many times we asked and when. */
1086
+ const pinMoves = new Map();
1087
+ /** Labels waiting for the host to put their row back into the column. */
1088
+ const restoreWanted = new Map();
1089
+ /** One label is moved at most this often: every click re-renders the sidebar. */
1090
+ const PIN_COOLDOWN_MS = 1000;
1091
+ /** Moves per label before this window gives up (a rail refuses, so stop asking). */
1092
+ const PIN_MAX_TRIES = 3;
1093
+ /** How long a pin-back request waits for the list's pin control to render. */
1094
+ const RESTORE_WINDOW_MS = 2000;
1095
+ /**
1096
+ * Ask the host to move every `more` row out of the column.
1097
+ *
1098
+ * Only the host owns that decision (`setPinned` is not a plugin surface), so the
1099
+ * move rides its own pin control. The call is bounded: at most {@link PIN_MAX_TRIES}
1100
+ * clicks per label per window, at most one per {@link PIN_COOLDOWN_MS}, and never
1101
+ * while the row is missing its control (the 36px rail renders none).
1102
+ * @param rows - the nav's panel rows, in document order.
1103
+ */
1104
+ function moveRowsToMore(rows) {
1105
+ if (!hostHasPin() || config.hideLabels.length === 0)
1106
+ return;
1107
+ const now = Date.now();
1108
+ for (const row of rows) {
1109
+ const label = labelOf(row);
1110
+ if (!isHidden(label, config.hideLabels))
1111
+ continue;
1112
+ const key = labelKey(label);
1113
+ const move = pinMoves.get(key);
1114
+ if (move !== undefined && (move.tries >= PIN_MAX_TRIES || now - move.at < PIN_COOLDOWN_MS))
1115
+ continue;
1116
+ const control = unpinControl(row);
1117
+ if (control === null)
1118
+ continue;
1119
+ pinMoves.set(key, { tries: (move?.tries ?? 0) + 1, at: now });
1120
+ control.click();
1121
+ }
1122
+ }
1123
+ /**
1124
+ * Ask the host to pin rows back into the column.
1125
+ *
1126
+ * The pin-back control exists only inside the host's portalled "More" list, so
1127
+ * this opens that list when needed and waits for the control to render: the
1128
+ * sidebar's own mutation stream drives the retry, no timer of ours.
1129
+ * @param rows - the nav's panel rows, in document order.
1130
+ */
1131
+ function pinRowsBack(rows) {
1132
+ if (restoreWanted.size === 0)
1133
+ return;
1134
+ if (!hostHasPin()) {
1135
+ restoreWanted.clear();
1136
+ return;
1137
+ }
1138
+ const now = Date.now();
1139
+ const present = new Set(rows.map((row) => labelKey(labelOf(row))));
1140
+ let missing = 0;
1141
+ for (const [key, at] of Array.from(restoreWanted)) {
1142
+ // The row already came back (a restart drops the host's in-memory pins).
1143
+ if (present.has(key)) {
1144
+ restoreWanted.delete(key);
1145
+ continue;
1146
+ }
1147
+ if (now - at > RESTORE_WINDOW_MS) {
1148
+ restoreWanted.delete(key);
1149
+ continue;
1150
+ }
1151
+ const control = pinControl(key);
1152
+ if (control !== null) {
1153
+ control.click();
1154
+ restoreWanted.delete(key);
1155
+ continue;
1156
+ }
1157
+ missing += 1;
1158
+ }
1159
+ if (missing > 0)
1160
+ openMoreList();
1161
+ }
1162
+ /** Open the host's "More" list if it is closed (idempotent through aria-expanded). */
1163
+ function openMoreList() {
1164
+ const anchor = document.querySelector(`${SEL.panelRow}[aria-haspopup="menu"]`);
1165
+ if (anchor === null || anchor.getAttribute('aria-expanded') === 'true')
1166
+ return;
1167
+ anchor.click();
1168
+ }
711
1169
  /**
712
1170
  * Write the fold marks. Only attributes we own are touched: no host class,
713
1171
  * no host attribute, and never the anchor's `aria-expanded` (that one is the
@@ -717,7 +1175,7 @@ window.__ModuleLoader__.load({
717
1175
  if (mount === null)
718
1176
  return;
719
1177
  const rows = rowsOf(mount.nav);
720
- const plan = planFold(rows, config.keepLabels, currentFolded(), isRail(mount.nav));
1178
+ const plan = planFold(rows, config.keepLabels, config.hideLabels, currentFolded(), isRail(mount.nav));
721
1179
  if (plan === null)
722
1180
  return;
723
1181
  const { header } = plan;
@@ -730,17 +1188,20 @@ window.__ModuleLoader__.load({
730
1188
  if (mount.nav.getAttribute(ATTR.align) !== align)
731
1189
  mount.nav.setAttribute(ATTR.align, align);
732
1190
  // The settings card renders whatever is on screen right now; keep it in sync.
733
- notifyRoster(rosterFrom(rows, config.keepLabels));
1191
+ notifyRoster(rosterFrom(rows, config.keepLabels, config.hideLabels));
734
1192
  mount.toggle.classList.toggle(CLS.toggleIdle, plan.idle);
735
1193
  mount.toggle.setAttribute('aria-disabled', plan.idle ? 'true' : 'false');
736
1194
  for (const row of rows) {
737
1195
  const want = plan.folded.includes(row);
1196
+ // The mark lands on the row's wrapper where the host ships one (0.2.2 on),
1197
+ // so an emptied `_panelEntry` cannot outlive its row.
1198
+ const target = foldTarget(row);
738
1199
  // Touch an attribute only when it actually changes: every write is a
739
1200
  // mutation, and every mutation triggers the rescan that caused this write.
740
- if (want && !row.getAttribute(ATTR.folded))
741
- row.setAttribute(ATTR.folded, '');
742
- else if (!want && row.getAttribute(ATTR.folded) !== null)
743
- row.removeAttribute(ATTR.folded);
1201
+ if (want && !target.getAttribute(ATTR.folded))
1202
+ target.setAttribute(ATTR.folded, '');
1203
+ else if (!want && target.getAttribute(ATTR.folded) !== null)
1204
+ target.removeAttribute(ATTR.folded);
744
1205
  }
745
1206
  // The plan owns the idle case too: an idle control carries no state mark.
746
1207
  if (plan.state !== null && mount.nav.getAttribute(ATTR.state) !== plan.state)
@@ -749,12 +1210,23 @@ window.__ModuleLoader__.load({
749
1210
  mount.nav.removeAttribute(ATTR.state);
750
1211
  mount.toggle.style.display = plan.toggleVisible ? 'inline-flex' : 'none';
751
1212
  paintToggle(mount.toggle, { idle: plan.idle });
1213
+ // Folded while the current panel is one of the folded rows: mark the control so
1214
+ // a 5px dot can say “what you are reading lives in here”.
1215
+ const holdsActive = plan.active && plan.group.some((row) => isActiveRow(row));
1216
+ if (holdsActive && mount.toggle.getAttribute(ATTR.activeInside) === null)
1217
+ mount.toggle.setAttribute(ATTR.activeInside, '');
1218
+ else if (!holdsActive && mount.toggle.getAttribute(ATTR.activeInside) !== null)
1219
+ mount.toggle.removeAttribute(ATTR.activeInside);
1220
+ // Last, because both hand the sidebar back to the host and every click causes a
1221
+ // re-render: the third state and its recovery ride on the host's own pin controls.
1222
+ moveRowsToMore(rows);
1223
+ pinRowsBack(rows);
752
1224
  }
753
1225
  /** Toggle the group and persist the choice. */
754
1226
  function toggleFold() {
755
1227
  // An empty group must not pretend to fold: ignore the gesture entirely.
756
1228
  if (mount !== null) {
757
- const resolved = resolveNavGroup(mount.nav, config.keepLabels);
1229
+ const resolved = resolveNavGroup(mount.nav, config.keepLabels, config.hideLabels);
758
1230
  if (resolved !== null && resolved.group.length === 0)
759
1231
  return;
760
1232
  }
@@ -845,7 +1317,7 @@ window.__ModuleLoader__.load({
845
1317
  unmount();
846
1318
  return false;
847
1319
  }
848
- const resolved = resolveNavGroup(nav, config.keepLabels);
1320
+ const resolved = resolveNavGroup(nav, config.keepLabels, config.hideLabels);
849
1321
  if (resolved === null) {
850
1322
  unmount();
851
1323
  return false;
@@ -890,6 +1362,10 @@ window.__ModuleLoader__.load({
890
1362
  row.removeAttribute(ATTR.folded);
891
1363
  }
892
1364
  mount = null;
1365
+ // The pin bookkeeping belongs to one window's DOM; a remount starts from what
1366
+ // the host shows now, never from a count that may no longer refer to it.
1367
+ pinMoves.clear();
1368
+ restoreWanted.clear();
893
1369
  }
894
1370
  /**
895
1371
  * Install the fold and keep it installed across re-renders.
@@ -897,7 +1373,7 @@ window.__ModuleLoader__.load({
897
1373
  * @returns a disposer that leaves the sidebar exactly as shipped.
898
1374
  */
899
1375
  function installFold(cfg) {
900
- config = { defaultFolded: cfg.defaultFolded, keepLabels: [...cfg.keepLabels], align: normalizeAlign(cfg.align) };
1376
+ config = copyConfig(cfg);
901
1377
  readStored();
902
1378
  sweep();
903
1379
  let observer = null;
@@ -908,10 +1384,37 @@ window.__ModuleLoader__.load({
908
1384
  if (queued)
909
1385
  return;
910
1386
  queued = true;
1387
+ // 50ms, not 16: the sidebar re-renders on every pin/selection and a streaming
1388
+ // reply mutates the tree many times per frame. One scan per burst is enough.
911
1389
  setTimeout(() => {
912
1390
  queued = false;
913
1391
  rescan();
914
- }, 16);
1392
+ }, 50);
1393
+ };
1394
+ /**
1395
+ * Feed the observer's batches through a relevance filter before scanning.
1396
+ *
1397
+ * A batch matters when it adds/removes a panel row, or when a `class` flips on
1398
+ * the nav, one of its ancestors (the 36px rail switch) or a row inside it (the
1399
+ * wrapper's active mark, which the dot follows).
1400
+ */
1401
+ const onMutations = (records) => {
1402
+ if (recordsTouchRows(records)) {
1403
+ schedule();
1404
+ return;
1405
+ }
1406
+ const nav = mount?.nav ?? findPanelNav(document);
1407
+ if (nav === null)
1408
+ return;
1409
+ for (const record of records) {
1410
+ if (record.type !== 'attributes')
1411
+ continue;
1412
+ const target = record.target;
1413
+ if (target === nav || target.contains?.(nav) === true || nav.contains?.(target) === true) {
1414
+ schedule();
1415
+ return;
1416
+ }
1417
+ }
915
1418
  };
916
1419
  /**
917
1420
  * Boot retry: the sidebar can mount after this plugin, and a hidden/background
@@ -933,7 +1436,7 @@ window.__ModuleLoader__.load({
933
1436
  // `attributes` matters: collapsing the sidebar only flips a `class` on an
934
1437
  // ancestor, and the childList mutations of that same commit can land before
935
1438
  // the class change (measured) — watching only children read a stale rail.
936
- observer = new MutationObserver(schedule);
1439
+ observer = new MutationObserver(onMutations);
937
1440
  observer.observe(document.body, {
938
1441
  childList: true,
939
1442
  subtree: true,
@@ -957,19 +1460,47 @@ window.__ModuleLoader__.load({
957
1460
  /**
958
1461
  * Adopt a freshly served configuration (settings write, or first read) and
959
1462
  * repaint immediately — no restart, no reload.
1463
+ *
1464
+ * A label that left `hideLabels` is queued for a pin-back: the host put the row
1465
+ * in its own "More" list, and only that list's control can bring it back.
960
1466
  */
961
1467
  function applyConfig(cfg) {
962
- config = { defaultFolded: cfg.defaultFolded, keepLabels: [...cfg.keepLabels], align: normalizeAlign(cfg.align) };
1468
+ const previousHide = config.hideLabels;
1469
+ config = copyConfig(cfg);
1470
+ const now = Date.now();
1471
+ for (const label of previousHide) {
1472
+ if (isHidden(label, config.hideLabels))
1473
+ continue;
1474
+ const key = labelKey(label);
1475
+ if (key !== '')
1476
+ restoreWanted.set(key, now);
1477
+ }
963
1478
  for (const listener of Array.from(configListeners))
964
1479
  listener();
965
1480
  applyFold();
966
1481
  }
1482
+ /** One deep copy of a served configuration, with the alignment coerced. */
1483
+ function copyConfig(cfg) {
1484
+ return {
1485
+ defaultFolded: cfg.defaultFolded,
1486
+ keepLabels: [...cfg.keepLabels],
1487
+ // The fixed row can never be handed to the host, so a stale entry for it is
1488
+ // dropped on the way in instead of being retried on every scan.
1489
+ hideLabels: pruneHidden(cfg.hideLabels),
1490
+ align: normalizeAlign(cfg.align),
1491
+ };
1492
+ }
967
1493
  /** The configuration the fold is currently running with (settings card reads it). */
968
1494
  function effectiveConfig() {
969
- return { defaultFolded: config.defaultFolded, keepLabels: [...config.keepLabels], align: normalizeAlign(config.align) };
1495
+ return copyConfig(config);
970
1496
  }
971
1497
  /** Built-in defaults, used when a host serves no writable configuration surface. */
972
- const BUILTIN_CONFIG = { defaultFolded: false, keepLabels: ['插件', 'Plugins'], align: 'start' };
1498
+ const BUILTIN_CONFIG = {
1499
+ defaultFolded: false,
1500
+ keepLabels: ['插件', 'Plugins'],
1501
+ hideLabels: [],
1502
+ align: 'start',
1503
+ };
973
1504
  /**
974
1505
  * The configuration card on this bundle's Plugin-Manager page.
975
1506
  *
@@ -997,6 +1528,7 @@ window.__ModuleLoader__.load({
997
1528
  let fallback = {
998
1529
  defaultFolded: false,
999
1530
  keepLabels: ['插件', 'Plugins'],
1531
+ hideLabels: [],
1000
1532
  align: 'start',
1001
1533
  };
1002
1534
  /** The card body node, created once and re-used by every mount. */
@@ -1018,6 +1550,7 @@ window.__ModuleLoader__.load({
1018
1550
  return {
1019
1551
  defaultFolded: snap.value?.defaultFolded ?? fallback.defaultFolded,
1020
1552
  keepLabels: snap.value?.keepLabels ?? fallback.keepLabels,
1553
+ hideLabels: snap.value?.hideLabels ?? fallback.hideLabels,
1021
1554
  align: normalizeAlign(snap.value?.align ?? fallback.align),
1022
1555
  writable: snap.writable && snap.status === 'ready',
1023
1556
  status: snap.status,
@@ -1026,6 +1559,7 @@ window.__ModuleLoader__.load({
1026
1559
  return {
1027
1560
  defaultFolded: fallback.defaultFolded,
1028
1561
  keepLabels: fallback.keepLabels,
1562
+ hideLabels: fallback.hideLabels,
1029
1563
  align: normalizeAlign(fallback.align),
1030
1564
  writable: false,
1031
1565
  status: 'unavailable',
@@ -1075,12 +1609,53 @@ window.__ModuleLoader__.load({
1075
1609
  });
1076
1610
  return button;
1077
1611
  }
1078
- /** Write one field through the host's scoped form (the host owns conflicts). */
1079
- function write(field, value) {
1612
+ /** What the last write did, so the card can say it instead of failing silently. */
1613
+ let saveState = {
1614
+ status: 'idle',
1615
+ fields: {},
1616
+ };
1617
+ /** How long a host write may stay unconfirmed before the card reads the store. */
1618
+ const SAVE_CONFIRM_MS = 1200;
1619
+ /** Deep-equality over JSON values — enough for the strings and string arrays here. */
1620
+ function sameValue(left, right) {
1621
+ return JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
1622
+ }
1623
+ /**
1624
+ * Write fields through the host's scoped form and report the outcome.
1625
+ *
1626
+ * Two lies this replaces: the first build dropped `set()`'s promise entirely, and
1627
+ * the second believed it. On the 0.2.2 line the write is persisted but the
1628
+ * promise **never settles** (measured: still pending after 6s), so the confirm is
1629
+ * bounded by {@link SAVE_CONFIRM_MS} and then settled against the served
1630
+ * snapshot — the host's own store is the only thing that can say “stored”.
1631
+ */
1632
+ function commit(fields) {
1080
1633
  const scope = scopeRef.scope;
1081
1634
  if (scope === undefined)
1082
1635
  return;
1083
- void scope.set(field, value);
1636
+ saveState = { status: 'saving', fields };
1637
+ paint();
1638
+ const writes = Object.entries(fields).map(([field, value]) => Promise.resolve(scope.set(field, value)).then((ok) => ok === true).catch(() => false));
1639
+ const confirmed = new Promise((resolve) => {
1640
+ setTimeout(() => {
1641
+ let value;
1642
+ try {
1643
+ value = scope.getSnapshot().value;
1644
+ }
1645
+ catch {
1646
+ value = undefined;
1647
+ }
1648
+ resolve(Object.entries(fields).every(([field, expected]) => sameValue(value?.[field], expected)));
1649
+ }, SAVE_CONFIRM_MS);
1650
+ });
1651
+ void Promise.race([Promise.all(writes).then((results) => results.every(Boolean)), confirmed]).then((ok) => {
1652
+ saveState = { status: ok ? 'saved' : 'error', fields };
1653
+ paint();
1654
+ });
1655
+ }
1656
+ /** Write one field (the single-value controls go through here). */
1657
+ function write(field, value) {
1658
+ commit({ [field]: value });
1084
1659
  }
1085
1660
  /**
1086
1661
  * A segmented control for a small closed set of options.
@@ -1103,7 +1678,9 @@ window.__ModuleLoader__.load({
1103
1678
  button.setAttribute('aria-checked', String(option.value === value));
1104
1679
  button.dataset.option = option.value;
1105
1680
  button.textContent = option.label;
1106
- button.disabled = disabled;
1681
+ // One option can be absent from this host (a 0.2.1 sidebar has no pin
1682
+ // control); disabling just that segment keeps the other two usable.
1683
+ button.disabled = disabled || option.unavailable === true;
1107
1684
  button.addEventListener('click', () => {
1108
1685
  if (button.disabled)
1109
1686
  return;
@@ -1119,14 +1696,21 @@ window.__ModuleLoader__.load({
1119
1696
  return group;
1120
1697
  }
1121
1698
  /**
1122
- * Persist the keep list produced by the per-row switches.
1699
+ * Persist one row's moved control.
1700
+ *
1701
+ * Two lists, one source of truth: `always` rows are written to `keepLabels` and
1702
+ * `more` rows to `hideLabels`, so the control state never has to be inferred
1703
+ * from a stale list.
1123
1704
  *
1124
- * The stored list is exactly "labels currently switched on" — the switch state is
1125
- * the source of truth, so a row that disappears from the sidebar drops out and a
1126
- * row that appears starts folded.
1705
+ * The write is also adopted **locally**: the host persists the value but does not
1706
+ * echo a new snapshot within seconds (measured on 0.2.2-rc.3 while moving a row
1707
+ * into “More”), and a control whose click visibly does nothing reads as broken.
1127
1708
  */
1128
- function writeKeep(nextLabels) {
1129
- write('keepLabels', [...nextLabels]);
1709
+ function writeRowState(rows, label, next) {
1710
+ const lists = deriveLists(rows, label, next);
1711
+ applyConfig({ ...effectiveConfig(), keepLabels: lists.keepLabels, hideLabels: lists.hideLabels });
1712
+ paint();
1713
+ commit({ keepLabels: lists.keepLabels, hideLabels: lists.hideLabels });
1130
1714
  }
1131
1715
  /** Paint (or repaint) the card body from the current values and the live roster. */
1132
1716
  function paint() {
@@ -1148,30 +1732,66 @@ window.__ModuleLoader__.load({
1148
1732
  ], !values.writable, (next) => {
1149
1733
  write('align', normalizeAlign(next));
1150
1734
  })));
1151
- // ③ fold scope: one switch per row that exists in this profile right now
1735
+ // ③ fold scope: one three-state control per row that exists in this profile
1152
1736
  const scopeTitle = document.createElement('div');
1153
1737
  scopeTitle.className = CLS.label;
1154
1738
  scopeTitle.setAttribute(ATTR.own, '');
1155
- scopeTitle.textContent = dict['settings.keep'];
1739
+ scopeTitle.textContent = dict['settings.rows'];
1156
1740
  cardRoot.appendChild(scopeTitle);
1157
1741
  const hint = document.createElement('span');
1158
1742
  hint.className = CLS.hint;
1159
1743
  hint.setAttribute(ATTR.own, '');
1160
- hint.textContent = dict['settings.keepHint'];
1744
+ hint.textContent = dict['settings.rowsHint'];
1161
1745
  cardRoot.appendChild(hint);
1162
1746
  if (rows.length === 0) {
1163
1747
  const empty = document.createElement('span');
1164
1748
  empty.className = CLS.hint;
1165
1749
  empty.setAttribute(ATTR.own, '');
1166
- empty.textContent = dict['settings.keepEmpty'];
1750
+ empty.textContent = dict['settings.rowsEmpty'];
1167
1751
  cardRoot.appendChild(empty);
1168
1752
  }
1753
+ // Two gates on the third state, per row: this host must ship the pin mechanism
1754
+ // at all (0.2.2 on), and the row must not be the host's fixed panel — the host
1755
+ // never unpins that one, so offering it would be a promise it silently refuses.
1756
+ const canHide = hostHasPin();
1169
1757
  for (const entry of rows) {
1170
- cardRoot.appendChild(buildRow(entry.label, dict['settings.keepRowHint'], switchControl(`keep:${entry.label}`, entry.keep, !values.writable, (next) => {
1171
- // The switch state IS the stored list: switched-on rows are the kept ones.
1172
- writeKeep(deriveKeep(rows, entry.label, next));
1758
+ const movable = canMoveToMore(entry.label, canHide);
1759
+ const hintText = movable
1760
+ ? dict['settings.rowHint']
1761
+ : isFixedLabel(entry.label) ? dict['settings.moreFixed'] : dict['settings.moreUnavailable'];
1762
+ cardRoot.appendChild(buildRow(entry.label, hintText, segmentedControl(`row:${entry.label}`, entry.state, [
1763
+ { value: 'always', label: dict['settings.rowAlways'] },
1764
+ { value: 'foldable', label: dict['settings.rowFold'] },
1765
+ { value: 'more', label: dict['settings.rowMore'], unavailable: !movable },
1766
+ ], !values.writable, (next) => {
1767
+ writeRowState(rows, entry.label, next);
1173
1768
  })));
1174
1769
  }
1770
+ // ④ write outcome. The host owns persistence; a refused write leaves the card
1771
+ // and the sidebar agreeing with each other and disagreeing with the store, so
1772
+ // the state has to be on screen, with the retry next to it.
1773
+ if (saveState.status !== 'idle') {
1774
+ const status = document.createElement('span');
1775
+ status.className = CLS.hint;
1776
+ status.setAttribute(ATTR.own, '');
1777
+ status.dataset.saveState = saveState.status;
1778
+ status.textContent = saveState.status === 'saving'
1779
+ ? dict['settings.saving']
1780
+ : saveState.status === 'saved' ? dict['settings.saved'] : dict['settings.saveFailed'];
1781
+ cardRoot.appendChild(status);
1782
+ }
1783
+ if (saveState.status === 'error') {
1784
+ const retry = document.createElement('button');
1785
+ retry.type = 'button';
1786
+ retry.className = CLS.control;
1787
+ retry.dataset.field = 'retry';
1788
+ retry.setAttribute(ATTR.own, '');
1789
+ retry.textContent = dict['settings.retrySave'];
1790
+ retry.addEventListener('click', () => {
1791
+ commit(saveState.fields);
1792
+ });
1793
+ cardRoot.appendChild(retry);
1794
+ }
1175
1795
  if (!values.writable) {
1176
1796
  const note = document.createElement('span');
1177
1797
  note.className = CLS.hint;
@@ -1193,7 +1813,12 @@ window.__ModuleLoader__.load({
1193
1813
  }
1194
1814
  /** Adopt the built-in fallback (used when no writable surface exists). */
1195
1815
  function onFallback(next) {
1196
- fallback = { defaultFolded: next.defaultFolded, keepLabels: [...next.keepLabels], align: normalizeAlign(next.align) };
1816
+ fallback = {
1817
+ defaultFolded: next.defaultFolded,
1818
+ keepLabels: [...next.keepLabels],
1819
+ hideLabels: [...next.hideLabels],
1820
+ align: normalizeAlign(next.align),
1821
+ };
1197
1822
  paint();
1198
1823
  }
1199
1824
  /**
@@ -1225,7 +1850,133 @@ window.__ModuleLoader__.load({
1225
1850
  };
1226
1851
  }
1227
1852
  /** Exported for the guard test: the card writes no free-text label list. */
1228
- const CARD_WRITES = ['defaultFolded', 'align', 'keepLabels'];
1853
+ const CARD_WRITES = ['defaultFolded', 'align', 'keepLabels', 'hideLabels'];
1854
+ /**
1855
+ * The "More" menu's shortcut row into this plugin's own settings.
1856
+ *
1857
+ * Why a slot row and not DOM surgery: the host's More menu is rendered by
1858
+ * `sidebar.panellist.actions`, so a registration lands in the same list, follows
1859
+ * the menu's own keyboard walk and its dismiss path, and survives re-renders
1860
+ * without an observer. (The host also documents this seat as the additive way to
1861
+ * reach a plugin's surface from the menu.)
1862
+ *
1863
+ * Where it lands: the shipped rows in that list are 「浏览更多插件 / 创建你的插件」,
1864
+ * preceded by their own hairline. A list entry can only be appended to that block,
1865
+ * so the row carries its own hairline and reads as the last item of the action
1866
+ * group — see the README note for what exact placement would cost.
1867
+ *
1868
+ * Navigation: `pluginNavigation.openBundle(pkg)` is the host's own intent
1869
+ * (`plugin-manager/lib/client.js`: selectPanel('plugins') + tab 'installed' +
1870
+ * view {kind:'package', name}), which is the page our config card is registered
1871
+ * on. Older lines that do not provide the service fall back to the panel itself.
1872
+ */
1873
+ // Named `menuReact`, not `react`: the build concatenates every module into one
1874
+ // closure, and a second `const react` there is a duplicate declaration that kills
1875
+ // the whole bundle (measured: the sidebar simply kept its shipped shape).
1876
+ const menuReact = require('react');
1877
+ /**
1878
+ * The navigation face adopted through `ctx.inject` in `index.ts`.
1879
+ *
1880
+ * `ctx.get('pluginNavigation')` alone did not reach the service (measured: the
1881
+ * row fell back to the panel and the package page never opened), so the row is
1882
+ * handed the face by a scoped inject — the same arrangement the settings waists
1883
+ * use, which also keeps the plugin alive on lines that do not provide it.
1884
+ */
1885
+ let navigationFace;
1886
+ /**
1887
+ * Adopt the host's `pluginNavigation` service when it shows up.
1888
+ * @param face - whatever the scoped inject resolved; anything unusable is ignored.
1889
+ */
1890
+ function adoptPluginNavigation(face) {
1891
+ if (face === null || typeof face !== 'object')
1892
+ return;
1893
+ const candidate = face;
1894
+ if (typeof candidate.openBundle === 'function' || typeof candidate.openList === 'function')
1895
+ navigationFace = candidate;
1896
+ }
1897
+ /**
1898
+ * Open this bundle's page in the Plugin Manager.
1899
+ *
1900
+ * Three routes, most precise first: the bundle itself, then the plugin list, then
1901
+ * the panel. Each is probed — none of them is a stable plugin API.
1902
+ * @param ctx - the client context the row was registered from.
1903
+ */
1904
+ function openPluginSettings(ctx) {
1905
+ let navigation = navigationFace;
1906
+ try {
1907
+ navigation = navigation ?? ctx.get?.('pluginNavigation');
1908
+ }
1909
+ catch {
1910
+ navigation = navigation ?? undefined;
1911
+ }
1912
+ if (typeof navigation?.openBundle === 'function') {
1913
+ navigation.openBundle(PKG_NAME);
1914
+ return;
1915
+ }
1916
+ if (typeof navigation?.openList === 'function') {
1917
+ navigation.openList();
1918
+ return;
1919
+ }
1920
+ let layout;
1921
+ try {
1922
+ layout = ctx.get?.('layout');
1923
+ }
1924
+ catch {
1925
+ layout = undefined;
1926
+ }
1927
+ layout?.selectPanel?.('plugins');
1928
+ }
1929
+ /** A sliders glyph, drawn here because the host `primitives` package is off-limits. */
1930
+ function buildGlyph() {
1931
+ const svg = (props, children) => menuReact.createElement('svg', {
1932
+ width: 16,
1933
+ height: 16,
1934
+ viewBox: '0 0 16 16',
1935
+ fill: 'none',
1936
+ stroke: 'currentColor',
1937
+ strokeWidth: 1.3,
1938
+ strokeLinecap: 'round',
1939
+ strokeLinejoin: 'round',
1940
+ 'aria-hidden': 'true',
1941
+ ...props,
1942
+ }, ...children);
1943
+ return svg({ className: CLS.menuIcon }, [
1944
+ menuReact.createElement('path', { key: 'a', d: 'M2.5 5.5h11M2.5 10.5h11' }),
1945
+ menuReact.createElement('circle', { key: 'b', cx: 6, cy: 5.5, r: 1.6, fill: 'var(--dsw-alias-bg-layer-1)' }),
1946
+ menuReact.createElement('circle', { key: 'c', cx: 10.5, cy: 10.5, r: 1.6, fill: 'var(--dsw-alias-bg-layer-1)' }),
1947
+ ]);
1948
+ }
1949
+ /**
1950
+ * Build the component for one `sidebar.panellist.actions` seat.
1951
+ *
1952
+ * The menu hands every registration the same owner props (`onDismiss` among
1953
+ * them), so the row closes the list before navigating — otherwise the menu would
1954
+ * stay open over the page it just opened.
1955
+ * @param ctx - the client context the row was registered from.
1956
+ * @returns a React component the slot can render.
1957
+ */
1958
+ function createSettingsRow(ctx) {
1959
+ return function SidebarFoldSettingsRow(props) {
1960
+ const dict = pickDictionary(document.documentElement.lang ?? '');
1961
+ const label = dict['menu.settings'];
1962
+ return menuReact.createElement('div', { className: CLS.menuGroup }, menuReact.createElement('button', {
1963
+ type: 'button',
1964
+ role: 'menuitem',
1965
+ className: CLS.menuRow,
1966
+ title: label,
1967
+ 'aria-label': label,
1968
+ onClick: () => {
1969
+ try {
1970
+ props?.onDismiss?.();
1971
+ }
1972
+ catch {
1973
+ // A menu that cannot close must not take the navigation with it.
1974
+ }
1975
+ openPluginSettings(ctx);
1976
+ },
1977
+ }, buildGlyph(), menuReact.createElement('span', { className: CLS.menuText }, label)));
1978
+ };
1979
+ }
1229
1980
  /**
1230
1981
  * Browser half of `dsh-sidebar-fold`.
1231
1982
  *
@@ -1263,6 +2014,9 @@ window.__ModuleLoader__.load({
1263
2014
  const next = {
1264
2015
  defaultFolded: typeof value?.defaultFolded === 'boolean' ? value.defaultFolded : BUILTIN_CONFIG.defaultFolded,
1265
2016
  keepLabels: Array.isArray(value?.keepLabels) ? value.keepLabels : BUILTIN_CONFIG.keepLabels,
2017
+ // The third state: rows the host owns in its "More" list. Absent on a host
2018
+ // that serves an older document, so it falls back to none.
2019
+ hideLabels: Array.isArray(value?.hideLabels) ? value.hideLabels : BUILTIN_CONFIG.hideLabels,
1266
2020
  // Alignment is validated by `normalizeAlign` here so everything downstream
1267
2021
  // (fold marks, card radios) only ever sees one of the three known modes.
1268
2022
  align: normalizeAlign(typeof value?.align === 'string' ? value.align : BUILTIN_CONFIG.align),
@@ -1359,6 +2113,13 @@ window.__ModuleLoader__.load({
1359
2113
  }
1360
2114
  });
1361
2115
  });
2116
+ // The More-menu row navigates with this service; without it the row falls back
2117
+ // to selecting the plugins panel, so the seat is optional all the way down.
2118
+ safe('pluginNavigation', () => {
2119
+ ctx.inject?.(['pluginNavigation'], (sctx) => {
2120
+ adoptPluginNavigation(sctx.pluginNavigation);
2121
+ });
2122
+ });
1362
2123
  }
1363
2124
  /** Register the configuration card on this bundle's detail page. */
1364
2125
  function mountConfigCard(ctx) {
@@ -1370,6 +2131,23 @@ window.__ModuleLoader__.load({
1370
2131
  }, createConfigCard()));
1371
2132
  });
1372
2133
  }
2134
+ /**
2135
+ * Add the "More" menu row that jumps straight to this bundle's settings page.
2136
+ *
2137
+ * Seated in `sidebar.panellist.actions` — the list the shipped More menu renders,
2138
+ * so the row inherits the menu's keyboard walk and dismiss path. `order: 100`
2139
+ * keeps it after the host's own rows (a list seat can only append).
2140
+ */
2141
+ function mountMenuEntry(ctx) {
2142
+ safe('panellist.actions', () => {
2143
+ ctx.slots.inject('sidebar.panellist.actions', () => ctx.slots.register({
2144
+ name: 'sidebar.panellist.actions',
2145
+ id: `${PKG_NAME}-settings`,
2146
+ order: 100,
2147
+ inject: () => ({}),
2148
+ }, createSettingsRow(ctx)));
2149
+ });
2150
+ }
1373
2151
  /**
1374
2152
  * Activate the plugin.
1375
2153
  * @param ctx - the client context, narrowed to the faces this plugin probes.
@@ -1381,6 +2159,7 @@ window.__ModuleLoader__.load({
1381
2159
  disposer = installFold(BUILTIN_CONFIG);
1382
2160
  mountedNow = rescan();
1383
2161
  mountConfigCard(ctx);
2162
+ mountMenuEntry(ctx);
1384
2163
  bindSettingsWaists(ctx);
1385
2164
  // One line so a silent failure is never silent: without this the sidebar simply
1386
2165
  // keeps its shipped shape and nothing says why. `mounted:false` means the