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/locale/pt.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Recolhimento de «Mais» da barra lateral",
|
|
4
|
+
"description": "Adiciona um comutador de seta quadrada na linha «Mais» para recolher as linhas de painéis adicionados da barra lateral em uma única linha; estado padrão e lista de exceções configuráveis."
|
|
5
|
+
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-sidebar-fold",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Folds the sidebar's add-on panel rows
|
|
3
|
+
"version": "0.1.13",
|
|
4
|
+
"description": "Folds the sidebar's add-on panel rows under the shipped \"More\" row, and from host 0.2.2 on gives every row three states — show, fold, or hide in the host's own \"More\" list. The fold state persists per window, rows are read from the live sidebar, and the managed rows' icon + label can be aligned left, centre or right.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"cordis.patch.yml",
|
|
20
20
|
"dsh.plugin.json",
|
|
21
21
|
"README.md",
|
|
22
|
-
"README.zh.md"
|
|
22
|
+
"README.zh.md",
|
|
23
|
+
"README.pt.md"
|
|
23
24
|
],
|
|
24
25
|
"dsh": {
|
|
25
26
|
"bundle": {
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
],
|
|
58
59
|
"engines": {
|
|
59
60
|
"node": ">=22.6.0",
|
|
60
|
-
"dsh": ">=0.2.1-rc.3 <0.3.0"
|
|
61
|
+
"dsh": ">=0.2.1-rc.3 <0.3.0-0"
|
|
61
62
|
},
|
|
62
63
|
"license": "MIT",
|
|
63
64
|
"repository": {
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1"
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
80
|
"@types/node": "^22.20.5",
|
package/src/client/constants.ts
CHANGED
|
@@ -1,237 +1,319 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-half constants: the anchors this plugin reads and the surfaces it owns.
|
|
3
|
-
*
|
|
4
|
-
* Every selector here is measured against the shipped rc.3 runtime (host-farm
|
|
5
|
-
* `0.2.1-rc.3`, http://127.0.0.1:3093) and quoted from `dsh-client-ui-sidebar`
|
|
6
|
-
* `lib/client.js`. CSS-module hashes drift per build — rc.2 emitted `wtg9ga_`,
|
|
7
|
-
* the rc.3 runtime emits `hHd-Xa_` — so all class matching uses the *fragment*
|
|
8
|
-
* after the underscore and never a full class name.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** Package name / settings namespace / module-loader id (must equal package.json `name`). */
|
|
12
|
-
export const PKG_NAME = 'dsh-sidebar-fold'
|
|
13
|
-
|
|
14
|
-
/** One style tag, identified by the same convention the host uses for its own injected CSS. */
|
|
15
|
-
export const STYLE_TAG_ID = `${PKG_NAME}/SidebarFold.css`
|
|
16
|
-
|
|
17
|
-
/** Prefix for every class this plugin owns. */
|
|
18
|
-
export const CLS = Object.freeze({
|
|
19
|
-
toggle: 'dshsf-fold-toggle',
|
|
20
|
-
toggleIdle: 'dshsf-fold-idle',
|
|
21
|
-
icon: 'dshsf-fold-icon',
|
|
22
|
-
card: 'dshsf-card',
|
|
23
|
-
cardHost: 'dshsf-card-host',
|
|
24
|
-
row: 'dshsf-row',
|
|
25
|
-
rowMain: 'dshsf-row-main',
|
|
26
|
-
label: 'dshsf-label',
|
|
27
|
-
hint: 'dshsf-hint',
|
|
28
|
-
control: 'dshsf-control',
|
|
29
|
-
switch: 'dshsf-switch',
|
|
30
|
-
switchKnob: 'dshsf-switch-knob',
|
|
31
|
-
segmentGroup: 'dshsf-segment-group',
|
|
32
|
-
segment: 'dshsf-segment',
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
collapsed
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
rule(
|
|
142
|
-
rule(
|
|
143
|
-
rule(
|
|
144
|
-
rule(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
rule(
|
|
149
|
-
rule(`[${ATTR.
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
rule(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
'
|
|
160
|
-
'
|
|
161
|
-
'
|
|
162
|
-
'
|
|
163
|
-
'border-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
'
|
|
167
|
-
'
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
'
|
|
174
|
-
'
|
|
175
|
-
'
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
'
|
|
184
|
-
'
|
|
185
|
-
'
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
'
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
'
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
]),
|
|
205
|
-
rule(`.${CLS.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
'
|
|
210
|
-
'
|
|
211
|
-
'
|
|
212
|
-
'
|
|
213
|
-
'
|
|
214
|
-
'
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
'
|
|
222
|
-
'
|
|
223
|
-
'
|
|
224
|
-
'
|
|
225
|
-
'
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
'
|
|
229
|
-
'
|
|
230
|
-
'
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
]),
|
|
237
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Browser-half constants: the anchors this plugin reads and the surfaces it owns.
|
|
3
|
+
*
|
|
4
|
+
* Every selector here is measured against the shipped rc.3 runtime (host-farm
|
|
5
|
+
* `0.2.1-rc.3`, http://127.0.0.1:3093) and quoted from `dsh-client-ui-sidebar`
|
|
6
|
+
* `lib/client.js`. CSS-module hashes drift per build — rc.2 emitted `wtg9ga_`,
|
|
7
|
+
* the rc.3 runtime emits `hHd-Xa_` — so all class matching uses the *fragment*
|
|
8
|
+
* after the underscore and never a full class name.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Package name / settings namespace / module-loader id (must equal package.json `name`). */
|
|
12
|
+
export const PKG_NAME = 'dsh-sidebar-fold'
|
|
13
|
+
|
|
14
|
+
/** One style tag, identified by the same convention the host uses for its own injected CSS. */
|
|
15
|
+
export const STYLE_TAG_ID = `${PKG_NAME}/SidebarFold.css`
|
|
16
|
+
|
|
17
|
+
/** Prefix for every class this plugin owns. */
|
|
18
|
+
export const CLS = Object.freeze({
|
|
19
|
+
toggle: 'dshsf-fold-toggle',
|
|
20
|
+
toggleIdle: 'dshsf-fold-idle',
|
|
21
|
+
icon: 'dshsf-fold-icon',
|
|
22
|
+
card: 'dshsf-card',
|
|
23
|
+
cardHost: 'dshsf-card-host',
|
|
24
|
+
row: 'dshsf-row',
|
|
25
|
+
rowMain: 'dshsf-row-main',
|
|
26
|
+
label: 'dshsf-label',
|
|
27
|
+
hint: 'dshsf-hint',
|
|
28
|
+
control: 'dshsf-control',
|
|
29
|
+
switch: 'dshsf-switch',
|
|
30
|
+
switchKnob: 'dshsf-switch-knob',
|
|
31
|
+
segmentGroup: 'dshsf-segment-group',
|
|
32
|
+
segment: 'dshsf-segment',
|
|
33
|
+
/** "More" menu shortcut row: its group wrapper, the row, its text and glyph. */
|
|
34
|
+
menuGroup: 'dshsf-menu-group',
|
|
35
|
+
menuRow: 'dshsf-menu-row',
|
|
36
|
+
menuText: 'dshsf-menu-text',
|
|
37
|
+
menuIcon: 'dshsf-menu-icon',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Alignment of a panel row's content (icon + label) inside the row.
|
|
42
|
+
*
|
|
43
|
+
* `start` is the host's own layout and is applied as a no-op-ish value (the nav
|
|
44
|
+
* still carries the attribute so the CSS can stay declarative). `center` and
|
|
45
|
+
* `end` are ours: the host row is `display:flex` with `justify-content:normal`
|
|
46
|
+
* and the title does not stretch (`flex:0 1 auto`, measured on rc.3), so moving
|
|
47
|
+
* the pair only takes one `justify-content` override.
|
|
48
|
+
*/
|
|
49
|
+
export const ALIGN_MODES = Object.freeze(['start', 'center', 'end'] as const)
|
|
50
|
+
|
|
51
|
+
/** One of {@link ALIGN_MODES}. */
|
|
52
|
+
export type AlignMode = (typeof ALIGN_MODES)[number]
|
|
53
|
+
|
|
54
|
+
/** Attribute marks this plugin writes (and removes on dispose). */
|
|
55
|
+
export const ATTR = Object.freeze({
|
|
56
|
+
/** On the nav: the fold header, i.e. the shipped "More" row. */
|
|
57
|
+
header: 'data-dshsf-header',
|
|
58
|
+
/** On the nav: `folded` while the group is collapsed. */
|
|
59
|
+
state: 'data-dshsf-state',
|
|
60
|
+
/** On a panel row taken into the fold. */
|
|
61
|
+
folded: 'data-dshsf-folded',
|
|
62
|
+
/** On every element this plugin created — the dispose sweep key. */
|
|
63
|
+
own: 'data-dshsf-own',
|
|
64
|
+
/** On the nav: row-content alignment (`start` | `center` | `end`). */
|
|
65
|
+
align: 'data-dshsf-align',
|
|
66
|
+
/** On the toggle: the folded group holds the panel the user is looking at. */
|
|
67
|
+
activeInside: 'data-dshsf-active-inside',
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
/** Selector fragments (hash-tolerant). */
|
|
71
|
+
export const SEL = Object.freeze({
|
|
72
|
+
/** The panel-list `<nav>` and a collapsed rail's root carry these. */
|
|
73
|
+
panelList: '[class*="_panelList"]',
|
|
74
|
+
panelRow: 'button[class*="_panelRow"]',
|
|
75
|
+
panelTitle: '[class*="_panelTitle"]',
|
|
76
|
+
/** The `Menu` host element wrapping the "More" anchor: our toggle's parent. */
|
|
77
|
+
moreAnchor: '[class*="_moreAnchor"]',
|
|
78
|
+
/** Sidebar root modifier present exactly while the column is a narrow rail. */
|
|
79
|
+
collapsed: '[class*="_collapsed"]',
|
|
80
|
+
/**
|
|
81
|
+
* Per-row wrapper shipped from the 0.2.2 line on (`div._panelEntry`): the row
|
|
82
|
+
* button is its child, and it carries the host's own row fill. Hiding only the
|
|
83
|
+
* button there leaves an empty entry (plus its pin control) behind, so the fold
|
|
84
|
+
* mark has to land on this wrapper when it exists.
|
|
85
|
+
*/
|
|
86
|
+
panelEntry: 'div[class*="_panelEntry"]',
|
|
87
|
+
/** The host's own "unpin" control inside a row — rendered at the wide width only. */
|
|
88
|
+
panelUnpin: 'button[class*="_panelUnpin"]',
|
|
89
|
+
/** The "pin back" control inside the portalled "More" list (0.2.2 on). */
|
|
90
|
+
pinButton: 'button[class*="_pinButton"]',
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
/** `localStorage` key for the open/closed state (window-level UI state, by design). */
|
|
94
|
+
export const STORAGE_KEY = `${PKG_NAME}.v1.folded`
|
|
95
|
+
|
|
96
|
+
/** Accessible-name strings of the shipped "More" row (`client.js:528-544` zh/en dictionaries). */
|
|
97
|
+
export const MORE_LABELS = Object.freeze(['更多', 'More'])
|
|
98
|
+
|
|
99
|
+
/** Accessible-name strings of the "Global panels" nav label (`client.js:533`). */
|
|
100
|
+
export const PANELS_LABELS = Object.freeze(['全局面板', 'Global panels'])
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The host's own fixed panel row — `FIXED_PANEL_ID = 'plugins'` in the 0.2.2
|
|
104
|
+
* sidebar (`SidebarRoot.tsx`: `canUnpin = hasEntryActions && id !== FIXED_PANEL_ID`).
|
|
105
|
+
*
|
|
106
|
+
* It is the one entry the host never unpins, so offering “hide in More” for it
|
|
107
|
+
* would be a promise the host silently refuses. The names are the only handle we
|
|
108
|
+
* have: the id never reaches the DOM.
|
|
109
|
+
*/
|
|
110
|
+
export const FIXED_LABELS = Object.freeze(['插件', 'Plugins'])
|
|
111
|
+
|
|
112
|
+
/** Self-drawn chevron geometry: the host `primitives` package is off-limits to plugins. */
|
|
113
|
+
export const ICON_PATH = Object.freeze({
|
|
114
|
+
up: 'M3.5 10 8 5.5 12.5 10',
|
|
115
|
+
down: 'M3.5 6 8 10.5 12.5 6',
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
/** Measured host geometry this plugin matches instead of inventing (findings §2.6). */
|
|
119
|
+
export const TOGGLE_PX = 28
|
|
120
|
+
export const ICON_PX = 16
|
|
121
|
+
|
|
122
|
+
/** The CSS this plugin injects. Tokens are host-public aliases only; the anchor
|
|
123
|
+
* override keeps the row's height so the portal menu's anchor box is unchanged.
|
|
124
|
+
*
|
|
125
|
+
* Every rule is one joined string built from an explicit declaration list — the
|
|
126
|
+
* first smoke run shipped a sheet whose declarations ran together (no `;`),
|
|
127
|
+
* so `transform`/`cursor`/`padding` were all dropped and the toggle sat 14px low.
|
|
128
|
+
* Declarations are joined here, never by string concatenation across lines. */
|
|
129
|
+
const rule = (selector: string, declarations: string[]): string =>
|
|
130
|
+
`${selector}{${declarations.join(';')}}`
|
|
131
|
+
|
|
132
|
+
export const SHEET = [
|
|
133
|
+
// The header keeps `position:relative` so the toggle (a sibling inside the
|
|
134
|
+
// Menu's anchor span) is positioned against the row, not the span.
|
|
135
|
+
//
|
|
136
|
+
// Its horizontal padding is per alignment: at `start` the toggle sits on the
|
|
137
|
+
// right and needs a gutter; at `center` the gutter would push the labeled pair
|
|
138
|
+
// off-centre (measured +19px), so the padding has to be symmetric; at `end` the
|
|
139
|
+
// toggle mirrors to the left and the gutter moves with it. `padding-top/bottom`
|
|
140
|
+
// from the host (`7px 8px`) is untouched by these longhands.
|
|
141
|
+
rule(`[${ATTR.header}]`, ['position:relative']),
|
|
142
|
+
rule(`[${ATTR.align}="start"] [${ATTR.header}]`, [`padding-right:${TOGGLE_PX + 10}px`]),
|
|
143
|
+
rule(`[${ATTR.align}="center"] [${ATTR.header}]`, ['padding-left:8px', 'padding-right:8px']),
|
|
144
|
+
rule(`[${ATTR.align}="end"] [${ATTR.header}]`, [`padding-left:${TOGGLE_PX + 10}px`, 'padding-right:8px']),
|
|
145
|
+
rule(`[${ATTR.align}="end"] .${CLS.toggle}`, ['left:4px', 'right:auto']),
|
|
146
|
+
// Row-content alignment. The whitespace after `:` is deliberate — a bare
|
|
147
|
+
// `center!important` is a parse error in some engines and silently dropped.
|
|
148
|
+
rule(`[${ATTR.align}="center"] ${SEL.panelRow}`, ['justify-content: center !important']),
|
|
149
|
+
rule(`[${ATTR.align}="end"] ${SEL.panelRow}`, ['justify-content: flex-end !important']),
|
|
150
|
+
// 0.2.2 reserves the row's right gutter for its own pin control (host rule:
|
|
151
|
+
// `.panelEntryWide .panelRow { padding-right: 38px }`). That gutter is real for
|
|
152
|
+
// `start`/`end`, but at `center` it pushes the labelled pair off-centre, so the
|
|
153
|
+
// gutter is folded back into the row's shipped inset there. This selector is
|
|
154
|
+
// more specific than the host rule, so no `!important` is needed.
|
|
155
|
+
rule(`[${ATTR.align}="center"] ${SEL.panelEntry} ${SEL.panelRow}`, [
|
|
156
|
+
'padding-right: calc(var(--dsh-sidebar-row-padding, 12px) - var(--dsh-sidebar-paint-inset, 3px))',
|
|
157
|
+
]),
|
|
158
|
+
rule(`.${CLS.toggle}`, [
|
|
159
|
+
'position:absolute',
|
|
160
|
+
'right:4px',
|
|
161
|
+
'top:50%',
|
|
162
|
+
'transform:translateY(-50%)',
|
|
163
|
+
'box-sizing:border-box',
|
|
164
|
+
`width:${TOGGLE_PX}px`,
|
|
165
|
+
`height:${TOGGLE_PX}px`,
|
|
166
|
+
'border:0',
|
|
167
|
+
'padding:0',
|
|
168
|
+
'display:inline-flex',
|
|
169
|
+
'align-items:center',
|
|
170
|
+
'justify-content:center',
|
|
171
|
+
'border-radius:var(--dsw-radius-sm,6px)',
|
|
172
|
+
'background:transparent',
|
|
173
|
+
'color:var(--dsw-alias-label-secondary,currentColor)',
|
|
174
|
+
'cursor:pointer',
|
|
175
|
+
'-webkit-app-region:no-drag',
|
|
176
|
+
]),
|
|
177
|
+
rule(`.${CLS.toggle}:hover`, ['background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.16))']),
|
|
178
|
+
rule(`.${CLS.toggleIdle}`, ['opacity:.45', 'cursor:default']),
|
|
179
|
+
rule(`.${CLS.toggleIdle}:hover`, ['background:transparent']),
|
|
180
|
+
// Folded, but the panel being looked at is one of the folded rows: a 5px dot
|
|
181
|
+
// says “what you are reading is inside here”, which a bare chevron cannot.
|
|
182
|
+
rule(`.${CLS.toggle}[${ATTR.activeInside}]::after`, [
|
|
183
|
+
'content:""',
|
|
184
|
+
'position:absolute',
|
|
185
|
+
'top:4px',
|
|
186
|
+
'right:4px',
|
|
187
|
+
'width:5px',
|
|
188
|
+
'height:5px',
|
|
189
|
+
'border-radius:50%',
|
|
190
|
+
'background:var(--dsw-alias-accent,var(--dsw-alias-state-business-primary,#4d6bfe))',
|
|
191
|
+
]),
|
|
192
|
+
rule(`.${CLS.toggle}:focus-visible`, [
|
|
193
|
+
'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
|
|
194
|
+
'outline-offset:-2px',
|
|
195
|
+
]),
|
|
196
|
+
rule(`.${CLS.icon}`, ['display:inline-flex', 'align-items:center', 'justify-content:center']),
|
|
197
|
+
rule(`[${ATTR.state}="folded"] [${ATTR.folded}]`, ['display:none']),
|
|
198
|
+
// Settings card (bundle detail page): spacing only, colours come from tokens.
|
|
199
|
+
rule(`.${CLS.card}`, ['display:flex', 'flex-direction:column', 'gap:12px', 'min-width:0']),
|
|
200
|
+
rule(`.${CLS.cardHost}`, ['display:block', 'min-width:0', 'width:100%']),
|
|
201
|
+
rule(`.${CLS.row}`, ['display:flex', 'align-items:flex-start', 'justify-content:space-between', 'gap:16px']),
|
|
202
|
+
rule(`.${CLS.rowMain}`, ['display:flex', 'flex-direction:column', 'gap:2px', 'min-width:0']),
|
|
203
|
+
rule(`.${CLS.label}`, ['font-size:13px', 'line-height:20px']),
|
|
204
|
+
rule(`.${CLS.hint}`, ['font-size:12px', 'line-height:16px', 'opacity:.72']),
|
|
205
|
+
rule(`.${CLS.control}`, [
|
|
206
|
+
'box-sizing:border-box',
|
|
207
|
+
'flex:none',
|
|
208
|
+
'font:inherit',
|
|
209
|
+
'font-size:13px',
|
|
210
|
+
'padding:4px 8px',
|
|
211
|
+
'border-radius:8px',
|
|
212
|
+
'border:.5px solid var(--dsw-alias-border-l3,rgba(127,127,127,.35))',
|
|
213
|
+
'background:var(--dsw-specific-input-major,transparent)',
|
|
214
|
+
'color:inherit',
|
|
215
|
+
'max-width:280px',
|
|
216
|
+
]),
|
|
217
|
+
rule(`.${CLS.control}[type="checkbox"]`, ['width:16px', 'height:16px', 'margin-top:3px']),
|
|
218
|
+
// Pill switch (the shape this plugin family uses for on/off rows): the track is
|
|
219
|
+
// 36×20, the knob 16px, and the whole thing is a real button with role="switch".
|
|
220
|
+
rule(`.${CLS.switch}`, [
|
|
221
|
+
'position:relative',
|
|
222
|
+
'display:inline-block',
|
|
223
|
+
'flex:none',
|
|
224
|
+
'box-sizing:border-box',
|
|
225
|
+
'width:36px',
|
|
226
|
+
'height:20px',
|
|
227
|
+
'margin-top:2px',
|
|
228
|
+
'border:0',
|
|
229
|
+
'padding:0',
|
|
230
|
+
'border-radius:999px',
|
|
231
|
+
'background:var(--dsw-alias-border-l3,rgba(127,127,127,.35))',
|
|
232
|
+
'cursor:pointer',
|
|
233
|
+
'transition:background .15s ease',
|
|
234
|
+
]),
|
|
235
|
+
rule(`.${CLS.switch}[aria-checked="true"]`, ['background:var(--dsw-alias-state-business-primary,#4d6bfe)']),
|
|
236
|
+
rule(`.${CLS.switch}[disabled]`, ['opacity:.5', 'cursor:default']),
|
|
237
|
+
rule(`.${CLS.switch}:focus-visible`, [
|
|
238
|
+
'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
|
|
239
|
+
'outline-offset:2px',
|
|
240
|
+
]),
|
|
241
|
+
rule(`.${CLS.switchKnob}`, [
|
|
242
|
+
'position:absolute',
|
|
243
|
+
'top:2px',
|
|
244
|
+
'left:2px',
|
|
245
|
+
'width:16px',
|
|
246
|
+
'height:16px',
|
|
247
|
+
'border-radius:50%',
|
|
248
|
+
'background:#fff',
|
|
249
|
+
'box-shadow:0 1px 2px rgba(0,0,0,.2)',
|
|
250
|
+
'transition:transform .15s ease',
|
|
251
|
+
'pointer-events:none',
|
|
252
|
+
]),
|
|
253
|
+
rule(`.${CLS.switch}[aria-checked="true"] .${CLS.switchKnob}`, ['transform:translateX(16px)']),
|
|
254
|
+
// Segmented control (three-state alignment): a track holding one button per
|
|
255
|
+
// option, the chosen one raised. Same family shape as the pill switch above.
|
|
256
|
+
rule(`.${CLS.segmentGroup}`, [
|
|
257
|
+
'display:inline-flex',
|
|
258
|
+
'flex:none',
|
|
259
|
+
'gap:2px',
|
|
260
|
+
'padding:2px',
|
|
261
|
+
'border-radius:9px',
|
|
262
|
+
'background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))',
|
|
263
|
+
]),
|
|
264
|
+
rule(`.${CLS.segment}`, [
|
|
265
|
+
'border:0',
|
|
266
|
+
'background:transparent',
|
|
267
|
+
'border-radius:7px',
|
|
268
|
+
'padding:3px 10px',
|
|
269
|
+
'font:inherit',
|
|
270
|
+
'font-size:12px',
|
|
271
|
+
'line-height:16px',
|
|
272
|
+
'color:var(--dsw-alias-label-secondary,inherit)',
|
|
273
|
+
'cursor:pointer',
|
|
274
|
+
]),
|
|
275
|
+
rule(`.${CLS.segment}[aria-checked="true"]`, [
|
|
276
|
+
'background:var(--dsw-alias-bg-layer-1,#fff)',
|
|
277
|
+
'color:var(--dsw-alias-label-primary,inherit)',
|
|
278
|
+
'box-shadow:0 1px 2px rgba(0,0,0,.12)',
|
|
279
|
+
]),
|
|
280
|
+
rule(`.${CLS.segment}[disabled]`, ['opacity:.5', 'cursor:default']),
|
|
281
|
+
rule(`.${CLS.segment}:focus-visible`, [
|
|
282
|
+
'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
|
|
283
|
+
'outline-offset:1px',
|
|
284
|
+
]),
|
|
285
|
+
// "More" menu shortcut row. The host's own action rows live in that list behind
|
|
286
|
+
// their own hairline; a list seat can only append, so this row carries the
|
|
287
|
+
// hairline itself and closes the action group.
|
|
288
|
+
rule(`.${CLS.menuGroup}`, [
|
|
289
|
+
'margin-top:6px',
|
|
290
|
+
'padding-top:6px',
|
|
291
|
+
'border-top:1px solid var(--dsw-alias-hairline,rgba(127,127,127,.22))',
|
|
292
|
+
]),
|
|
293
|
+
rule(`.${CLS.menuRow}`, [
|
|
294
|
+
'box-sizing:border-box',
|
|
295
|
+
'display:flex',
|
|
296
|
+
'align-items:center',
|
|
297
|
+
'gap:8px',
|
|
298
|
+
'width:100%',
|
|
299
|
+
'height:32px',
|
|
300
|
+
'margin:0',
|
|
301
|
+
'padding:0 10px',
|
|
302
|
+
'border:0',
|
|
303
|
+
'border-radius:var(--dsw-radius-md,8px)',
|
|
304
|
+
'background:transparent',
|
|
305
|
+
'font:inherit',
|
|
306
|
+
'font-size:13px',
|
|
307
|
+
'color:var(--dsw-alias-label-primary,inherit)',
|
|
308
|
+
'text-align:left',
|
|
309
|
+
'cursor:pointer',
|
|
310
|
+
'-webkit-app-region:no-drag',
|
|
311
|
+
]),
|
|
312
|
+
rule(`.${CLS.menuRow}:hover`, ['background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.16))']),
|
|
313
|
+
rule(`.${CLS.menuRow}:focus-visible`, [
|
|
314
|
+
'outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#666))',
|
|
315
|
+
'outline-offset:-2px',
|
|
316
|
+
]),
|
|
317
|
+
rule(`.${CLS.menuText}`, ['overflow:hidden', 'text-overflow:ellipsis', 'white-space:nowrap']),
|
|
318
|
+
rule(`.${CLS.menuIcon}`, ['flex:none', 'display:block']),
|
|
319
|
+
].join('')
|