dsh-sidebar-fold 0.1.6 → 0.1.13
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 +164 -135
- package/README.pt.md +171 -0
- package/README.zh.md +141 -120
- package/dsh.plugin.json +3 -3
- package/lib/client.js +910 -102
- package/locale/pt.json +6 -0
- package/package.json +6 -5
- package/src/client/constants.ts +319 -237
- package/src/client/fold.ts +1031 -657
- package/src/client/index.ts +223 -187
- package/src/client/locales.ts +330 -210
- package/src/client/menu-entry.ts +157 -0
- package/src/client/settings-card.ts +451 -334
- package/src/index.js +99 -88
package/README.md
CHANGED
|
@@ -1,135 +1,164 @@
|
|
|
1
|
-
# dsh-sidebar-fold
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/dsh-sidebar-fold)
|
|
4
|
-
[](https://github.com/drscrewdriver/dsh-sidebar-fold/blob/main/LICENSE)
|
|
5
|
-
|
|
6
|
-
Collapse the DSH sidebar's add-on entries into the shipped **“More”** row.
|
|
7
|
-
|
|
8
|
-
The left column's *Global panels* list grows with every installed plugin: schedules,
|
|
9
|
-
agent teams, the plugin market, context pages, … `dsh-sidebar-fold` puts a
|
|
10
|
-
**28×28 square arrow toggle** on the right end of the host's “More” row. One click
|
|
11
|
-
folds those add-on rows away so only the “More” line remains; the arrow flips from
|
|
12
|
-
▲ (can collapse) to ▼ (can expand) and a second click brings the rows back.
|
|
13
|
-
|
|
14
|
-
- **Non-invasive** — a client plugin that only adds DOM. The host bundle is never
|
|
15
|
-
patched, nothing in `app.asar` is touched, and uninstalling restores the sidebar
|
|
16
|
-
exactly as shipped (own `<style>` tag and `data-dshsf-*` marks removed).
|
|
17
|
-
- **Structural header detection** — the header row is the `panelRow` carrying
|
|
18
|
-
`aria-haspopup="menu"` inside the “Global panels” nav, which is locale-independent
|
|
19
|
-
and independent of plugin registration order.
|
|
20
|
-
- **State per window** — the folded/open choice persists in `localStorage`, so a
|
|
21
|
-
reload keeps it.
|
|
22
|
-
- **Alignment switch** — the managed rows (the “More” row included) can put their
|
|
23
|
-
icon + label pair **left / centred / right**. At `right` the toggle mirrors to the
|
|
24
|
-
row's left end so it never covers the text; the override is a single
|
|
25
|
-
`justify-content` longhand and leaves the row's `display`/`gap`/height alone.
|
|
26
|
-
- **
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
npm
|
|
54
|
-
dsh plugin --profile <profile> add
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
`
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1
|
+
# dsh-sidebar-fold
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-sidebar-fold)
|
|
4
|
+
[](https://github.com/drscrewdriver/dsh-sidebar-fold/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Collapse the DSH sidebar's add-on entries into the shipped **“More”** row.
|
|
7
|
+
|
|
8
|
+
The left column's *Global panels* list grows with every installed plugin: schedules,
|
|
9
|
+
agent teams, the plugin market, context pages, … `dsh-sidebar-fold` puts a
|
|
10
|
+
**28×28 square arrow toggle** on the right end of the host's “More” row. One click
|
|
11
|
+
folds those add-on rows away so only the “More” line remains; the arrow flips from
|
|
12
|
+
▲ (can collapse) to ▼ (can expand) and a second click brings the rows back.
|
|
13
|
+
|
|
14
|
+
- **Non-invasive** — a client plugin that only adds DOM. The host bundle is never
|
|
15
|
+
patched, nothing in `app.asar` is touched, and uninstalling restores the sidebar
|
|
16
|
+
exactly as shipped (own `<style>` tag and `data-dshsf-*` marks removed).
|
|
17
|
+
- **Structural header detection** — the header row is the `panelRow` carrying
|
|
18
|
+
`aria-haspopup="menu"` inside the “Global panels” nav, which is locale-independent
|
|
19
|
+
and independent of plugin registration order.
|
|
20
|
+
- **State per window** — the folded/open choice persists in `localStorage`, so a
|
|
21
|
+
reload keeps it.
|
|
22
|
+
- **Alignment switch** — the managed rows (the “More” row included) can put their
|
|
23
|
+
icon + label pair **left / centred / right**. At `right` the toggle mirrors to the
|
|
24
|
+
row's left end so it never covers the text; the override is a single
|
|
25
|
+
`justify-content` longhand and leaves the row's `display`/`gap`/height alone.
|
|
26
|
+
- **Three states per row (host 0.2.2 on)** — every row in the settings card picks one of
|
|
27
|
+
**Show** (always visible), **Fold** (may be folded) or **Hide in More** (hand the row to the
|
|
28
|
+
host's own “More” list, i.e. its unpin action). A hidden row leaves the column and appears
|
|
29
|
+
in the “More” menu, from where the host's own pin control brings it back; the plugin
|
|
30
|
+
reconciles both sides on boot, on a config write and on every sidebar repaint — including
|
|
31
|
+
after a reload, where the host's in-memory pin table comes back empty.
|
|
32
|
+
- **Configurable** — default state, the three-state row controls and the row alignment live
|
|
33
|
+
in the plugin's settings card (host `Config`, `.volatile()`, applied without a restart).
|
|
34
|
+
- **Rail-safe** — when the sidebar is collapsed to the 36 px icon rail the toggle is
|
|
35
|
+
removed and every row is shown again: no squeezing, no half-hidden state.
|
|
36
|
+
- **Quiet degradation** — if the host DOM drifts and the anchors are not found, the
|
|
37
|
+
plugin stays out of the way instead of breaking the sidebar (`dsh-sidebar-fold:
|
|
38
|
+
fold installed { mounted: false }` in the console tells you it happened).
|
|
39
|
+
|
|
40
|
+
## Screenshots
|
|
41
|
+
|
|
42
|
+
Expanded, rows centred — the toggle sits on the More row and the add-on rows are listed:
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
Folded — only the plugin row and the More row remain:
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
# npm channel (after release)
|
|
54
|
+
dsh plugin --profile <profile> add dsh-sidebar-fold
|
|
55
|
+
|
|
56
|
+
# local build
|
|
57
|
+
npm run build && npm run verify
|
|
58
|
+
npm pack --pack-destination .
|
|
59
|
+
dsh plugin --profile <profile> add ./dsh-sidebar-fold-0.1.2.tgz
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then add `dsh-sidebar-fold` to the profile's `dsh.profile.bundles` list (or
|
|
63
|
+
enable the bundle in the app) and restart. On the desktop profile, quit the Electron
|
|
64
|
+
app before editing its `package.json` — the running app rewrites that file and rolls
|
|
65
|
+
external edits back.
|
|
66
|
+
|
|
67
|
+
## Settings
|
|
68
|
+
|
|
69
|
+
Open **Plugins → dsh-sidebar-fold** (the card is registered on the
|
|
70
|
+
`plugins.bundle.config` seat, keyed by the package name), or click
|
|
71
|
+
**“Sidebar fold settings” at the bottom of the sidebar's “More” menu**: that row sits in
|
|
72
|
+
the `sidebar.panellist.actions` seat and jumps with the host's own
|
|
73
|
+
`pluginNavigation.openBundle(package)`, so it shares the menu's keyboard walk and dismiss
|
|
74
|
+
path; a host without that service falls back to selecting the Plugins panel.
|
|
75
|
+
|
|
76
|
+
| Field | Meaning | Default |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| Folded by default | State a window starts in when it has no local record | off |
|
|
79
|
+
| Row alignment | Three-way segmented control (left / centre / right) for the managed rows; the “More” row follows the same setting | left |
|
|
80
|
+
| Entries (one per row) | **Show** = always visible; **Fold** = may be folded (default); **Hide in More** = move it into the host's “More” menu | Fold |
|
|
81
|
+
|
|
82
|
+
The row list is read from the DOM at open time, so a panel installed later shows up
|
|
83
|
+
without editing anything. When every row is set to Show the toggle dims itself and
|
|
84
|
+
reports `aria-disabled="true"` instead of flipping an arrow over an unchanged list.
|
|
85
|
+
|
|
86
|
+
“Hide in More” needs the 0.2.2 row structure (`div._panelEntry` plus the in-row pin
|
|
87
|
+
control): on the 0.2.1 line that one segment is disabled in the card while the other two
|
|
88
|
+
keep working. The host's pin table is **in memory only** (a reload starts empty), so the
|
|
89
|
+
plugin reconciles on every scan: a row that should be hidden but is still in the column
|
|
90
|
+
gets its unpin control clicked, and a hidden label whose row came back is dropped from
|
|
91
|
+
the hide list.
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
npm run build # scripts/build-client.mjs -> lib/client.js (module-loader bundle)
|
|
97
|
+
npm run verify # gate: loader id === package name, dual-manifest same string,
|
|
98
|
+
# no module request, no host primitives, 10 locales, no
|
|
99
|
+
# machine-absolute paths
|
|
100
|
+
npm test # node --test on the pure seams (header split, nav fallback chain)
|
|
101
|
+
npm run hosts:check # enumeration drift vs scripts/hosts.mjs (--write to repair)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`prepack` runs build + verify, so a stale `lib/client.js` cannot be published.
|
|
105
|
+
|
|
106
|
+
## Supported hosts
|
|
107
|
+
|
|
108
|
+
**DSH hosts `>=0.2.1-rc.3 <0.3.0`** (the "More" row first ships in 0.2.1-rc.3; newer 0.2.x rcs stay installable without a republish). Single source of truth: `scripts/hosts.mjs` — `engines.dsh` carries that bounded range, `peerDependencies` keep the per-rc enumeration (npm resolution never assumes `includePrerelease`), and `dsh.plugin.json` mirrors the range; all generated, never hand-edited.
|
|
109
|
+
|
|
110
|
+
Why the floor is 0.2.1-rc.3: mounting needs the sidebar's panel list **and** the shipped "More"
|
|
111
|
+
row. Measured on every published `dsh-client-ui-sidebar` rc:
|
|
112
|
+
|
|
113
|
+
| host line | panel list | "More" row | row wrapper / in-row pin control |
|
|
114
|
+
|---|---|---|---|
|
|
115
|
+
| 0.1.0-rc.8 / 0.1.1-rc.2 / 0.1.2-rc.1 | no | no | — |
|
|
116
|
+
| 0.1.5-rc.3 / 0.1.7-rc.2 / 0.2.0-rc.2 | yes | no | — |
|
|
117
|
+
| 0.2.1-rc.1 / 0.2.1-rc.2 | yes | no | — |
|
|
118
|
+
| 0.2.1-rc.3 | yes | yes | no |
|
|
119
|
+
| 0.2.2-rc.3 (DOM-verified 2026-11-14) | yes | yes | **yes** (`div._panelEntry` + `button._panelUnpin`, `button._pinButton` inside the menu) |
|
|
120
|
+
|
|
121
|
+
On a line without the More row the plugin degrades quietly — it injects nothing and
|
|
122
|
+
leaves the sidebar as shipped. Declaring such a host would only install a plugin
|
|
123
|
+
that does nothing.
|
|
124
|
+
|
|
125
|
+
**Two measured differences on the 0.2.2 line** (both verified on 0.2.2-rc.3):
|
|
126
|
+
|
|
127
|
+
1. A row is wrapped in `div._panelEntry` and carries the host's own unpin control. The fold
|
|
128
|
+
mark therefore has to land on the **wrapper**: hiding only the inner `button._panelRow`
|
|
129
|
+
left a 32 px empty slot (plus a pin that appears on hover) behind — the real regression
|
|
130
|
+
v0.1.6 showed on newer hosts.
|
|
131
|
+
2. The host's unpin action *is* “hide in More”: an unpinned row is filtered out of the nav
|
|
132
|
+
and rendered by `sidebar.panellist.actions` into the “More” menu (each row with a
|
|
133
|
+
pin-back control). That pin table is in-memory and never persisted, so the plugin keeps
|
|
134
|
+
two label lists (`keepLabels` / `hideLabels`) as the source of truth and reconciles.
|
|
135
|
+
|
|
136
|
+
After a host upgrade, re-run the browser smoke test before widening this list:
|
|
137
|
+
CSS-module hashes drift every build (rc.2 emitted `wtg9ga_`, the 0.2.1/0.2.2 rc.3 runtimes
|
|
138
|
+
emit `hHd-Xa_`), so only the fragment selectors (`_panelList`, `_panelRow`, `_moreAnchor`,
|
|
139
|
+
`_collapsed`, `_panelEntry`, `_panelUnpin`, `_pinButton`) are stable.
|
|
140
|
+
|
|
141
|
+
## Upgrade guardrail
|
|
142
|
+
|
|
143
|
+
Host CSS-module hashes drift per build (`wtg9ga_` on rc.2 → `hHd-Xa_` on the 0.2.1/0.2.2
|
|
144
|
+
rc.3 runtimes), which is why every selector matches a *fragment* (`_panelList`, `_panelRow`,
|
|
145
|
+
`_moreAnchor`, `_collapsed`, `_panelEntry`, `_panelUnpin`, `_pinButton`). **After any host
|
|
146
|
+
upgrade, re-run the browser smoke** before assuming the three paths still hold: the fold
|
|
147
|
+
mount, the three-state write, and hide/pin-back. The plugin degrades quietly (or disables
|
|
148
|
+
one segment) by design, so a regression shows up as “nothing happened”, not as an error.
|
|
149
|
+
|
|
150
|
+
## Layout
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
src/index.js host half: Config schema + no-op apply (no build step)
|
|
154
|
+
src/client/constants.ts measured anchors, attribute marks, injected stylesheet
|
|
155
|
+
src/client/locales.ts 10 runtime dictionaries (zh = key-set source of truth)
|
|
156
|
+
src/client/fold.ts nav location, header/group split, toggle mount, fold state
|
|
157
|
+
src/client/settings-card.ts the bundle-page configuration card (plain DOM)
|
|
158
|
+
src/client/index.ts apply: fold first, then the guarded settings waists
|
|
159
|
+
scripts/ build-client / verify / sync-hosts / hosts / gen-locale-meta
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
MIT
|
package/README.pt.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# dsh-sidebar-fold
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-sidebar-fold)
|
|
4
|
+
[](https://github.com/drscrewdriver/dsh-sidebar-fold/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Recolhe as entradas adicionadas à barra lateral na linha **“Mais”** que já vem no host.
|
|
7
|
+
|
|
8
|
+
A lista *Painéis globais* da coluna esquerda cresce a cada plugin instalado: tarefas
|
|
9
|
+
agendadas, equipes de agentes, o mercado de plugins, páginas de contexto, … O
|
|
10
|
+
`dsh-sidebar-fold` coloca um **comutador de seta quadrada de 28×28** na extremidade direita
|
|
11
|
+
da linha “Mais” do host. Um clique recolhe essas linhas adicionadas, deixando apenas a linha
|
|
12
|
+
“Mais”; a seta inverte de ▲ (pode recolher) para ▼ (pode expandir) e um segundo clique traz as
|
|
13
|
+
linhas de volta.
|
|
14
|
+
|
|
15
|
+
- **Não invasivo** — um plugin de cliente que apenas acrescenta DOM. O bundle do host nunca é
|
|
16
|
+
modificado, nada em `app.asar` é tocado e desinstalar restaura a barra lateral exatamente como
|
|
17
|
+
veio de fábrica (a própria tag `<style>` e as marcas `data-dshsf-*` são removidas).
|
|
18
|
+
- **Detecção estrutural do cabeçalho** — a linha de cabeçalho é o `panelRow` que carrega
|
|
19
|
+
`aria-haspopup="menu"` dentro da navegação “Global panels”, o que independe do idioma e da
|
|
20
|
+
ordem de registro dos plugins.
|
|
21
|
+
- **Estado por janela** — a escolha entre recolhida e aberta persiste em `localStorage`, de modo
|
|
22
|
+
que um recarregamento a mantém.
|
|
23
|
+
- **Chave de alinhamento** — as linhas gerenciadas (incluída a linha “Mais”) podem pôr seu par
|
|
24
|
+
ícone + rótulo **à esquerda / centralizado / à direita**. Em `right` o comutador se espelha para a
|
|
25
|
+
extremidade esquerda da linha, para nunca cobrir o texto; a sobrescrita é um único
|
|
26
|
+
`justify-content` por extenso e não mexe em `display`/`gap`/altura da linha.
|
|
27
|
+
- **Três estados por linha (host 0.2.2 em diante)** — cada linha do cartão de configurações elege
|
|
28
|
+
um entre **Mostrar** (sempre visível), **Recolher** (pode ser recolhida) ou **Ocultar em «Mais»**
|
|
29
|
+
(entregar a linha à própria lista “Mais” do host, isto é, à ação de desafixação dele). Uma linha
|
|
30
|
+
oculta sai da coluna e aparece no menu “Mais”, de onde o controle de fixação do próprio host a
|
|
31
|
+
traz de volta; o plugin reconcilia os dois lados na inicialização, a cada escrita de configuração
|
|
32
|
+
e a cada repintura da barra lateral — inclusive depois de um recarregamento, em que a tabela de
|
|
33
|
+
fixações em memória do host volta vazia.
|
|
34
|
+
- **Configurável** — o estado padrão, os controles de linha em três estados e o alinhamento das
|
|
35
|
+
linhas vivem no cartão de configurações do plugin (`Config` do host, `.volatile()`, aplicado sem
|
|
36
|
+
reiniciar).
|
|
37
|
+
- **Seguro no rail** — quando a barra lateral é recolhida ao rail de ícones de 36 px, o comutador é
|
|
38
|
+
removido e todas as linhas voltam a ser mostradas: sem espremer, sem estado meio oculto.
|
|
39
|
+
- **Degradação silenciosa** — se a DOM do host divergir e os âncoras não forem encontrados, o
|
|
40
|
+
plugin fica de fora em vez de quebrar a barra lateral (`dsh-sidebar-fold:
|
|
41
|
+
fold installed { mounted: false }` no console conta o que aconteceu).
|
|
42
|
+
|
|
43
|
+
## Capturas de tela
|
|
44
|
+
|
|
45
|
+
Expandida, linhas centralizadas — o comutador fica na linha Mais e as linhas adicionadas são listadas:
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
Recolhida — apenas a linha do plugin e a linha Mais permanecem:
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
## Instalação
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
# canal npm (após o lançamento)
|
|
57
|
+
dsh plugin --profile <profile> add dsh-sidebar-fold
|
|
58
|
+
|
|
59
|
+
# compilação local
|
|
60
|
+
npm run build && npm run verify
|
|
61
|
+
npm pack --pack-destination .
|
|
62
|
+
dsh plugin --profile <profile> add ./dsh-sidebar-fold-0.1.2.tgz
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Depois adicione `dsh-sidebar-fold` à lista `dsh.profile.bundles` do perfil (ou ative o
|
|
66
|
+
bundle no app) e reinicie. No perfil desktop, encerre o app Electron antes de editar o
|
|
67
|
+
`package.json` dele — o app em execução reescreve esse arquivo e desfaz edições externas.
|
|
68
|
+
|
|
69
|
+
## Configurações
|
|
70
|
+
|
|
71
|
+
Abra **Plugins → dsh-sidebar-fold** (o cartão é registrado no assento
|
|
72
|
+
`plugins.bundle.config`, chaveado pelo nome do pacote), ou clique em
|
|
73
|
+
**“Configurações de recolhimento da barra lateral” no rodapé do menu “Mais” da barra
|
|
74
|
+
lateral**: essa linha fica no assento `sidebar.panellist.actions` e salta com o
|
|
75
|
+
`pluginNavigation.openBundle(package)` do próprio host, compartilhando assim a caminhada de
|
|
76
|
+
teclado e o caminho de dispensa do menu; um host sem esse serviço cai na seleção do painel Plugins.
|
|
77
|
+
|
|
78
|
+
| Campo | Significado | Padrão |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| Recolhido por padrão | Estado em que uma janela inicia quando não tem registro local | desligado |
|
|
81
|
+
| Alinhamento das linhas | Controle segmentado em três vias (esquerda / centro / direita) para as linhas gerenciadas; a linha “Mais” segue a mesma configuração | esquerda |
|
|
82
|
+
| Entradas (uma por linha) | **Mostrar** = sempre visível; **Recolher** = pode ser recolhida (padrão); **Ocultar em «Mais»** = movê-la para o menu “Mais” do host | Recolher |
|
|
83
|
+
|
|
84
|
+
A lista de linhas é lida da DOM no momento da abertura, então um painel instalado depois
|
|
85
|
+
aparece sem editar nada. Quando toda linha está em Mostrar, o comutador se esmaece e
|
|
86
|
+
reporta `aria-disabled="true"` em vez de girar uma seta sobre uma lista inalterada.
|
|
87
|
+
|
|
88
|
+
“Ocultar em «Mais»” exige a estrutura de linha da 0.2.2 (`div._panelEntry` mais o controle de
|
|
89
|
+
fixação dentro da linha): na linha 0.2.1 esse único segmento fica desabilitado no cartão enquanto
|
|
90
|
+
os outros dois continuam funcionando. A tabela de fixações do host existe **apenas em memória**
|
|
91
|
+
(um recarregamento começa vazia), então o plugin reconcilia a cada varredura: uma linha que deveria
|
|
92
|
+
estar oculta mas ainda está na coluna tem seu controle de desafixação clicado, e um rótulo oculto
|
|
93
|
+
cuja linha voltou é removido da lista de ocultação.
|
|
94
|
+
|
|
95
|
+
## Desenvolvimento
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npm run build # scripts/build-client.mjs -> lib/client.js (bundle do module-loader)
|
|
99
|
+
npm run verify # gate: loader id === nome do pacote, dois manifestos na mesma string,
|
|
100
|
+
# nenhuma requisição de módulo, nenhum primitive de host,
|
|
101
|
+
# 10 locales, nenhum caminho absoluto de máquina
|
|
102
|
+
npm test # node --test nas costuras puras (divisão do cabeçalho, cadeia de
|
|
103
|
+
# fallback da navegação)
|
|
104
|
+
npm run hosts:check # drift de enumeração vs scripts/hosts.mjs (--write para reparar)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`prepack` roda build + verify, então um `lib/client.js` obsoleto não pode ser publicado.
|
|
108
|
+
|
|
109
|
+
## Hosts suportados
|
|
110
|
+
|
|
111
|
+
**Hosts DSH `>=0.2.1-rc.3 <0.3.0`** (a linha "Mais" surge pela primeira vez em 0.2.1-rc.3; os rc 0.2.x
|
|
112
|
+
mais recentes continuam instaláveis sem um novo lançamento). Fonte única de verdade: `scripts/hosts.mjs`
|
|
113
|
+
— `engines.dsh` carrega esse intervalo limitado, `peerDependencies` mantêm a enumeração por rc (a
|
|
114
|
+
resolução do npm nunca assume `includePrerelease`) e `dsh.plugin.json` espelha o intervalo; tudo gerado,
|
|
115
|
+
nunca editado à mão.
|
|
116
|
+
|
|
117
|
+
Por que o piso é 0.2.1-rc.3: a montagem precisa da lista de painéis da barra lateral **e** da linha
|
|
118
|
+
"Mais" que vem no host. Medido em todo `dsh-client-ui-sidebar` rc publicado:
|
|
119
|
+
|
|
120
|
+
| linha do host | lista de painéis | linha "Mais" | wrapper de linha / controle de fixação na linha |
|
|
121
|
+
|---|---|---|---|
|
|
122
|
+
| 0.1.0-rc.8 / 0.1.1-rc.2 / 0.1.2-rc.1 | não | não | — |
|
|
123
|
+
| 0.1.5-rc.3 / 0.1.7-rc.2 / 0.2.0-rc.2 | sim | não | — |
|
|
124
|
+
| 0.2.1-rc.1 / 0.2.1-rc.2 | sim | não | — |
|
|
125
|
+
| 0.2.1-rc.3 | sim | sim | não |
|
|
126
|
+
| 0.2.2-rc.3 (DOM verificado em 2026-11-14) | sim | sim | **sim** (`div._panelEntry` + `button._panelUnpin`, `button._pinButton` dentro do menu) |
|
|
127
|
+
|
|
128
|
+
Numa linha sem a linha Mais o plugin degrada silenciosamente — não injeta nada e deixa a barra
|
|
129
|
+
lateral como veio. Declarar um host assim só faria o usuário instalar um plugin que não faz nada.
|
|
130
|
+
|
|
131
|
+
**Duas diferenças medidas na linha 0.2.2** (ambas verificadas em 0.2.2-rc.3):
|
|
132
|
+
|
|
133
|
+
1. Uma linha é envolvida por `div._panelEntry` e carrega o próprio controle de desafixação do host.
|
|
134
|
+
A marca de recolhimento, portanto, tem de cair no **wrapper**: ocultar apenas o
|
|
135
|
+
`button._panelRow` interno deixava um slot vazio de 32 px (mais um alfinete que aparece no hover)
|
|
136
|
+
para trás — a regressão real que a v0.1.6 mostrou em hosts mais novos.
|
|
137
|
+
2. A ação de desafixar do host *é* “ocultar em Mais”: uma linha desafixada é filtrada da navegação e
|
|
138
|
+
renderizada por `sidebar.panellist.actions` no menu “Mais” (cada linha com um controle de
|
|
139
|
+
fixar de volta). Essa tabela de fixações fica em memória e nunca é persistida, então o plugin
|
|
140
|
+
mantém duas listas de rótulos (`keepLabels` / `hideLabels`) como fonte de verdade e reconcilia.
|
|
141
|
+
|
|
142
|
+
Depois de uma atualização de host, rode de novo o teste de fumaça no navegador antes de alargar esta
|
|
143
|
+
lista: os hashes do CSS-module driftam a cada build (rc.2 emitia `wtg9ga_`, os runtimes
|
|
144
|
+
0.2.1/0.2.2 rc.3 emitem `hHd-Xa_`), então apenas os seletores por fragmento (`_panelList`, `_panelRow`,
|
|
145
|
+
`_moreAnchor`, `_collapsed`, `_panelEntry`, `_panelUnpin`, `_pinButton`) são estáveis.
|
|
146
|
+
|
|
147
|
+
## Guarda de atualização
|
|
148
|
+
|
|
149
|
+
Os hashes do CSS-module do host driftam a cada build (`wtg9ga_` na rc.2 → `hHd-Xa_` nos runtimes
|
|
150
|
+
0.2.1/0.2.2 rc.3), por isso todo seletor casa um *fragmento* (`_panelList`, `_panelRow`,
|
|
151
|
+
`_moreAnchor`, `_collapsed`, `_panelEntry`, `_panelUnpin`, `_pinButton`). **Depois de qualquer troca de
|
|
152
|
+
versão do host, rode o smoke no navegador** antes de assumir que os três caminhos continuam de pé: a
|
|
153
|
+
montagem do recolhimento, a escrita em três estados e ocultar/refixar. O plugin degrada
|
|
154
|
+
silenciosamente (ou desabilita um segmento) por design, então uma regressão aparece como “não
|
|
155
|
+
aconteceu nada”, não como erro.
|
|
156
|
+
|
|
157
|
+
## Estrutura
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
src/index.js metade host: schema Config + apply no-op (sem etapa de build)
|
|
161
|
+
src/client/constants.ts âncoras medidas, marcas de atributo, folha de estilo injetada
|
|
162
|
+
src/client/locales.ts 10 dicionários de runtime (o conjunto de chaves zh é a fonte de verdade)
|
|
163
|
+
src/client/fold.ts localização da navegação, divisão cabeçalho/grupo, montagem do comutador, estado
|
|
164
|
+
src/client/settings-card.ts o cartão de configuração da página do bundle (DOM puro)
|
|
165
|
+
src/client/index.ts apply: primeiro o recolhimento, depois as cinturas de configuração guardadas
|
|
166
|
+
scripts/ build-client / verify / sync-hosts / hosts / gen-locale-meta
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Licença
|
|
170
|
+
|
|
171
|
+
MIT
|