@yunkersek/dsh-prts-theme 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js ADDED
@@ -0,0 +1,1030 @@
1
+ /**
2
+ * PRTS theme for the DSH Web GUI.
3
+ *
4
+ * Design source: MooncellWiki/prts-design (Storybook at
5
+ * https://mooncellwiki.github.io/prts-design/storybook/), MIT.
6
+ * Two registered themes ride the two PRTS palettes:
7
+ * - `prts-dark` "终端" — in-game terminal: #0f0f10 canvas, #18d1ff cyan accent.
8
+ * - `prts-light` "日间" — the site palette: #f5f5f5 canvas, #0098dc blue accent.
9
+ * Both are alias-token overrides over the built-in palettes, plus one small
10
+ * shell stylesheet that squares every corner (the PRTS frame language) and
11
+ * tints the elevation hairline.
12
+ *
13
+ * The Appearance row only offers light/dark/system, so this bundle registers
14
+ * its own General-settings row and remembers the choice in localStorage;
15
+ * picking a built-in appearance surrenders the skin.
16
+ */
17
+ window.__ModuleLoader__.load({
18
+ id: '@yunkersek/dsh-prts-theme',
19
+ factory(require) {
20
+ const React = require('react')
21
+
22
+ ;
23
+ const h = React.createElement;
24
+
25
+ const STORAGE_KEY = 'prts-theme:choice';
26
+ const CHOICES = [
27
+ { id: 'prts-dark', label: '终端', hint: '暗色终端界面' },
28
+ { id: 'prts-light', label: '日间', hint: '站点亮色界面' },
29
+ { id: 'default', label: '默认', hint: '跟随系统外观' },
30
+ ];
31
+ const PRTS_IDS = ['prts-dark', 'prts-light'];
32
+
33
+ /** PRTS "终端" (dark) palette. Values from packages/tokens, in-game terminal set. */
34
+
35
+ /* Alias tokens the curated table does not name, auto-derived from the
36
+ prts-design palette so charts, diffs and tooltips follow too. */
37
+ const PRTS_EXTRA_DARK = {
38
+ '--dsw-alias-bg-mask-2': 'rgba(11, 12, 13, 0.2)',
39
+ '--dsw-alias-bg-mask-3': 'rgba(11, 12, 13, 0.48)',
40
+ '--dsw-alias-bg-mask-drop': 'rgba(45, 46, 48, 0.7)',
41
+ '--dsw-alias-bg-mask-photo': 'rgba(11, 12, 13, 0.88)',
42
+ '--dsw-alias-border-l2-darkmode-thin': 'rgba(255, 255, 255, 0.06)',
43
+ '--dsw-alias-button-tool-bar-fill-invisible': 'rgba(26, 27, 28, 0.36)',
44
+ '--dsw-alias-state-success-tertiary': '#2d2e30',
45
+ '--dsw-alias-state-warn-tertiary': '#232425',
46
+ '--dsw-specific-file-upload-track': 'rgba(11, 12, 13, 0.08)',
47
+ '--dsw-specific-login-input': '#1a1b1c',
48
+ '--dsw-specific-sidebar-glass-collapsed-fill': 'rgba(255, 255, 255, 0.15)',
49
+ '--dsw-specific-sidebar-glass-collapsed-hover': 'rgba(255, 255, 255, 0.2)',
50
+ '--dsw-specific-sidebar-glass-fill': 'rgba(255, 255, 255, 0.15)',
51
+ '--dsw-specific-sidebar-glass-hover': 'rgba(255, 255, 255, 0.2)',
52
+ '--dsw-specific-sidebar-right-flash': '#ffffff',
53
+ '--dsw-specific-sidebar-tint': 'rgba(26, 27, 28, 0.5)',
54
+ '--dsw-specific-sidebar-wash-bottom': 'rgba(93, 220, 255, 0.07)',
55
+ '--dsw-specific-sidebar-wash-top': 'rgba(93, 220, 255, 0.08)',
56
+ };
57
+
58
+ const PRTS_EXTRA_LIGHT = {
59
+ '--dsw-alias-bg-mask-2': 'rgba(29, 31, 32, 0.12)',
60
+ '--dsw-alias-bg-mask-3': 'rgba(29, 31, 32, 0.48)',
61
+ '--dsw-alias-bg-mask-drop': 'rgba(255, 255, 255, 0.7)',
62
+ '--dsw-alias-bg-mask-photo': 'rgba(29, 31, 32, 0.88)',
63
+ '--dsw-alias-border-l2-darkmode-thin': 'rgba(29, 31, 32, 0.1)',
64
+ '--dsw-alias-button-tool-bar-fill-invisible': 'rgba(29, 31, 32, 0.36)',
65
+ '--dsw-alias-state-success-tertiary': '#eaf8f1',
66
+ '--dsw-alias-state-warn-tertiary': '#fff6e8',
67
+ '--dsw-specific-file-upload-track': 'rgba(29, 31, 32, 0.08)',
68
+ '--dsw-specific-login-input': '#fafafa',
69
+ '--dsw-specific-sidebar-glass-collapsed-hover': 'rgba(0, 90, 130, 0.06)',
70
+ '--dsw-specific-sidebar-glass-fill': 'rgba(255, 255, 255, 0.55)',
71
+ '--dsw-specific-sidebar-glass-hover': 'rgba(255, 255, 255, 0.3)',
72
+ '--dsw-specific-sidebar-right-flash': '#22bbff',
73
+ '--dsw-specific-sidebar-wash-bottom': 'rgba(93, 220, 255, 0.09)',
74
+ '--dsw-specific-sidebar-wash-bottom-clear': 'rgba(93, 220, 255, 0.0)',
75
+ '--dsw-specific-sidebar-wash-top': 'rgba(93, 220, 255, 0.1)',
76
+ '--dsw-specific-sidebar-wash-top-clear': 'rgba(93, 220, 255, 0.0)',
77
+ };
78
+
79
+ const DARK_TOKENS = {
80
+ ...PRTS_EXTRA_DARK,
81
+ // Canvas and surfaces
82
+ '--dsw-alias-bg-base': '#0f0f10',
83
+ '--dsw-alias-bg-layer-1': '#1a1b1c',
84
+ '--dsw-alias-bg-layer-2': '#232425',
85
+ '--dsw-alias-bg-layer-3': '#2d2e30',
86
+ '--dsw-alias-bg-overlay': '#232425',
87
+ '--dsw-alias-bg-mask-1': 'rgba(0, 0, 0, 0.62)',
88
+ '--dsw-alias-bg-skeleton': 'rgba(255, 255, 255, 0.07)',
89
+ '--dsw-alias-bg-multi-select': '#1f2122',
90
+ '--dsw-alias-bg-module-platform': '#232425',
91
+ '--dsw-alias-bg-document-preview': '#141516',
92
+ '--dsw-alias-bg-document-selection': 'rgba(24, 209, 255, 0.28)',
93
+ '--dsw-alias-label-document-preview': '#c9c9c9',
94
+
95
+ // Lines
96
+ '--dsw-alias-border-l1': '#262729',
97
+ '--dsw-alias-border-l2': '#2f3133',
98
+ '--dsw-alias-border-l3': '#3a3d40',
99
+ '--dsw-alias-border-l4': '#4a4c4f',
100
+ '--dsw-alias-border-inverted': 'rgba(255, 255, 255, 0.06)',
101
+ '--dsw-alias-border-inverted2': 'rgba(255, 255, 255, 0.08)',
102
+ '--dsw-alias-border-selected': '#18d1ff',
103
+
104
+ // Brand and buttons
105
+ '--dsw-alias-brand-primary': '#18d1ff',
106
+ '--dsw-alias-brand-primary-invert': '#f0f0f0',
107
+ '--dsw-alias-brand-text': '#18d1ff',
108
+ '--dsw-alias-button-primary-fill': '#18d1ff',
109
+ '--dsw-alias-button-primary-hover': '#7ee5ff',
110
+ '--dsw-alias-button-primary-dimmed': '#166b80',
111
+ '--dsw-alias-button-contrast-fill': '#f0f0f0',
112
+ '--dsw-alias-button-elevated-fill': '#2a2c2e',
113
+ '--dsw-alias-button-floating-fill': '#202122',
114
+ '--dsw-alias-button-floating-hover': '#2c2e30',
115
+ '--dsw-alias-button-ghost-active-fill': '#2a2c2e',
116
+ '--dsw-alias-button-ghost-active-hover': '#333638',
117
+ '--dsw-alias-button-ghost-active-border': '#4a4c4f',
118
+ '--dsw-alias-button-info-fill': '#18d1ff',
119
+ '--dsw-alias-button-info-hover': '#22bbff',
120
+ '--dsw-alias-button-tool-bar-fill': 'rgba(49, 49, 49, 0.6)',
121
+ '--dsw-alias-button-tool-bar-hover': 'rgba(60, 61, 63, 0.7)',
122
+
123
+ // Labels
124
+ '--dsw-alias-label-on-color': '#04161c',
125
+ '--dsw-alias-label-primary': '#f0f0f0',
126
+ '--dsw-alias-label-primary-bluish': '#f0f0f0',
127
+ '--dsw-alias-label-primary-dimmed': '#d5d7d8',
128
+ '--dsw-alias-label-primary-inverted': '#181818',
129
+ '--dsw-alias-label-primary-foreground': '#0f0f10',
130
+ '--dsw-alias-label-secondary': '#c9c9c9',
131
+ '--dsw-alias-label-tertiary': '#9c9e9f',
132
+ '--dsw-alias-label-caption': '#6f7071',
133
+ '--dsw-alias-label-dimmed': '#4a4b4c',
134
+ '--dsw-alias-label-shimmer': 'rgba(255, 255, 255, 0.38)',
135
+ '--dsw-alias-label-deep-diving': '#5ddcff',
136
+ '--dsw-alias-link': '#5ddcff',
137
+ '--dsw-alias-menu-icon': '#d5d7d8',
138
+
139
+ // States
140
+ '--dsw-alias-state-business-primary': '#18d1ff',
141
+ '--dsw-alias-state-business-tertiary': '#166b80',
142
+ '--dsw-alias-state-done-primary': '#bf96ed',
143
+ '--dsw-alias-state-error-primary': '#ff5c5c',
144
+ '--dsw-alias-state-error-secondary': '#ff6237',
145
+ '--dsw-alias-state-idle-primary': '#5b5d60',
146
+ '--dsw-alias-state-success-primary': '#4fd18f',
147
+ '--dsw-alias-state-success-secondary': '#6ce0a8',
148
+ '--dsw-alias-state-warn-primary': '#ffb340',
149
+ '--dsw-alias-state-warn-secondary': '#ffc90e',
150
+ '--dsw-alias-state-warn-label': '#ffc90e',
151
+
152
+ // Interaction
153
+ '--dsw-alias-interactive-bg-hover': 'rgba(255, 255, 255, 0.06)',
154
+ '--dsw-alias-interactive-bg-active': 'rgba(255, 255, 255, 0.11)',
155
+ '--dsw-alias-interactive-bg-hover-solid': '#2a2c2e',
156
+ '--dsw-alias-interactive-bg-hover-accent': 'rgba(24, 209, 255, 0.16)',
157
+ '--dsw-alias-interactive-bg-hover-danger': 'rgba(255, 92, 92, 0.16)',
158
+ '--dsw-alias-switch-thumb': '#8d8d8d',
159
+
160
+ // Chrome: sidebar, menus, cards
161
+ '--dsw-specific-sidebar-fill': '#141516',
162
+ '--dsw-specific-menu': 'rgba(24, 25, 26, 0.88)',
163
+ '--dsw-menu-surface-fill': 'rgba(24, 25, 26, 0.72)',
164
+ '--dsw-alias-menu-group-header-fill': 'rgba(24, 25, 26, 0.94)',
165
+ '--dsw-specific-selector': '#1f2122',
166
+ '--dsw-specific-input-major': '#1a1b1c',
167
+ '--dsw-specific-tip': '#202122',
168
+ '--dsw-specific-sidebar-nav-item-active': '#26282a',
169
+ '--dsw-specific-sidebar-nav-item-active-accent': '#1c6f85',
170
+ '--dsw-alias-card-fill': '#1a1b1c',
171
+ '--dsw-alias-card-fill-hover': '#202122',
172
+ '--dsw-alias-card-tile-fill': 'rgba(255, 255, 255, 0.04)',
173
+ '--dsw-alias-settings-card-fill': '#1a1b1c',
174
+ '--dsw-alias-settings-card-stroke': '#2f3133',
175
+ '--dsw-alias-trajectory-accent': '#18d1ff',
176
+ '--dsw-alias-turn-trigger-bg': '#232425',
177
+ '--dsw-alias-turn-trigger-bg-hover': '#2a2c2e',
178
+
179
+ // Code and markdown
180
+ '--dsw-alias-markdown-code-block': '#141516',
181
+ '--dsw-alias-markdown-code-block-banner': '#1a1b1c',
182
+ '--dsw-alias-markdown-code-segment-selected': '#2a2c2e',
183
+ '--dsw-alias-markdown-code-segment-unselected': '#141516',
184
+ '--dsw-alias-markdown-inline-code': '#232425',
185
+ '--dsw-alias-markdown-placeholder': '#232425',
186
+ '--dsw-alias-markdown-tag': '#232425',
187
+ '--dsw-alias-markdown-citation': '#2a2c2e',
188
+ '--dsw-alias-code-diff-added': 'rgba(79, 209, 143, 0.16)',
189
+ '--dsw-alias-code-diff-deleted': 'rgba(255, 92, 92, 0.16)',
190
+ '--dsw-alias-file-diff-added-bg': '#14261c',
191
+ '--dsw-alias-file-diff-added-gutter': '#101d16',
192
+ '--dsw-alias-file-diff-added-marker': '#4fd18f',
193
+ '--dsw-alias-file-diff-deleted-bg': '#2a1719',
194
+ '--dsw-alias-file-diff-deleted-gutter': '#1d1012',
195
+ '--dsw-alias-file-diff-deleted-marker': '#ff5c5c',
196
+
197
+ // Overlays
198
+ '--dsw-alias-toast-bg': '#232425',
199
+ '--dsw-alias-toast-label': '#f0f0f0',
200
+ '--dsw-alias-toast-action': '#18d1ff',
201
+ '--dsw-alias-tooltip-bg': '#1a1b1c',
202
+ '--dsw-alias-tooltip-label': '#f0f0f0',
203
+ '--dsw-alias-hovercard-bg': '#1a1b1c',
204
+ '--dsw-alias-hovercard-label-primary': '#f0f0f0',
205
+ '--dsw-alias-hovercard-label-secondary': '#c9c9c9',
206
+ '--dsw-alias-hovercard-label-tertiary': '#9c9e9f',
207
+ '--dsw-alias-hovercard-state-done': '#bf96ed',
208
+ '--dsw-alias-hovercard-state-error': '#ff5c5c',
209
+
210
+ // Scrollbars, charts, JSON tree
211
+ '--dsw-alias-scrollbar-bg-l1': '#3b3d40',
212
+ '--dsw-alias-scrollbar-bg-l2': '#46484b',
213
+ '--dsw-alias-scrollbar-hover-l1': '#4a4c4f',
214
+ '--dsw-alias-scrollbar-hover-l2': '#585a5e',
215
+ '--dsw-alias-chart-messages': '#18d1ff',
216
+ '--dsw-alias-chart-system': '#6f7071',
217
+ '--dsw-alias-chart-tools': '#bf96ed',
218
+ '--dsw-alias-json-tree-keyword': '#7ee5ff',
219
+ '--dsw-alias-json-tree-number': '#7ee5ff',
220
+ '--dsw-alias-json-tree-string': '#ff9433',
221
+ '--dsw-alias-json-tree-property': '#4fd18f',
222
+ '--dsw-alias-json-tree-punctuation': '#d5d7d8',
223
+ '--dsw-alias-json-tree-icon': '#9c9e9f',
224
+ '--dsw-alias-json-tree-hover': 'rgba(24, 209, 255, 0.06)',
225
+
226
+ // Conversation bubbles and illustrations
227
+ '--dsw-specific-bubble': '#232425',
228
+ '--dsw-specific-bubble-highlight': '#2d2e30',
229
+ '--dsw-specific-guide-hero': '#2a2c2e',
230
+ '--dsw-alias-illustration-background': '#1a1b1c',
231
+ '--dsw-alias-illustration-surface': '#232425',
232
+ '--dsw-alias-illustration-backing': '#141516',
233
+ '--dsw-alias-illustration-detail': '#8d8d8d',
234
+ '--dsw-alias-illustration-inset': '#141516',
235
+ '--dsw-alias-illustration-shadow': '#141516',
236
+ };
237
+
238
+ /** PRTS "日间" (light) palette. Values from packages/tokens, site set. */
239
+ const LIGHT_TOKENS = {
240
+ ...PRTS_EXTRA_LIGHT,
241
+ // Canvas and surfaces
242
+ '--dsw-alias-bg-base': '#f5f5f5',
243
+ '--dsw-alias-bg-layer-1': '#ffffff',
244
+ '--dsw-alias-bg-layer-2': '#f5f5f5',
245
+ '--dsw-alias-bg-layer-3': '#ebebeb',
246
+ '--dsw-alias-bg-overlay': '#ffffff',
247
+ '--dsw-alias-bg-mask-1': 'rgba(15, 15, 16, 0.55)',
248
+ '--dsw-alias-bg-skeleton': 'rgba(0, 0, 0, 0.06)',
249
+ '--dsw-alias-bg-multi-select': '#eef0f1',
250
+ '--dsw-alias-bg-document-preview': '#eef0f1',
251
+ '--dsw-alias-bg-document-selection': 'rgba(0, 152, 220, 0.25)',
252
+ '--dsw-alias-label-document-preview': '#454647',
253
+
254
+ // Lines
255
+ '--dsw-alias-border-l1': '#e8eaeb',
256
+ '--dsw-alias-border-l2': '#d9dbdc',
257
+ '--dsw-alias-border-l3': '#c4c7c9',
258
+ '--dsw-alias-border-l4': '#aeb2b5',
259
+ '--dsw-alias-border-inverted': 'rgba(0, 0, 0, 0.05)',
260
+ '--dsw-alias-border-inverted2': 'rgba(0, 0, 0, 0.08)',
261
+ '--dsw-alias-border-selected': '#0098dc',
262
+
263
+ // Brand and buttons
264
+ '--dsw-alias-brand-primary': '#0098dc',
265
+ '--dsw-alias-brand-primary-invert': '#1d1f20',
266
+ '--dsw-alias-brand-text': '#0072a8',
267
+ '--dsw-alias-button-primary-fill': '#0098dc',
268
+ '--dsw-alias-button-primary-hover': '#0075a9',
269
+ '--dsw-alias-button-primary-dimmed': '#b8ddec',
270
+ '--dsw-alias-button-contrast-fill': '#1d1f20',
271
+ '--dsw-alias-button-elevated-fill': '#ffffff',
272
+ '--dsw-alias-button-floating-fill': '#ffffff',
273
+ '--dsw-alias-button-floating-hover': '#f5f5f5',
274
+ '--dsw-alias-switch-thumb': '#ffffff',
275
+
276
+ // Labels
277
+ '--dsw-alias-label-on-color': '#ffffff',
278
+ '--dsw-alias-label-primary': '#1d1f20',
279
+ '--dsw-alias-label-primary-bluish': '#1d1f20',
280
+ '--dsw-alias-label-primary-dimmed': '#2f3133',
281
+ '--dsw-alias-label-primary-inverted': '#ffffff',
282
+ '--dsw-alias-label-secondary': '#454647',
283
+ '--dsw-alias-label-tertiary': '#626262',
284
+ '--dsw-alias-label-caption': '#8d8d8d',
285
+ '--dsw-alias-label-dimmed': '#b1b1b1',
286
+ '--dsw-alias-label-shimmer': 'rgba(0, 0, 0, 0.22)',
287
+ '--dsw-alias-label-deep-diving': '#0098dc',
288
+ '--dsw-alias-link': '#0072a8',
289
+ '--dsw-alias-menu-icon': '#535353',
290
+
291
+ // States
292
+ '--dsw-alias-state-business-primary': '#0098dc',
293
+ '--dsw-alias-state-business-tertiary': '#b8ddec',
294
+ '--dsw-alias-state-done-primary': '#9266b2',
295
+ '--dsw-alias-state-error-primary': '#c8102e',
296
+ '--dsw-alias-state-error-secondary': '#d83c3c',
297
+ '--dsw-alias-state-idle-primary': '#8d8d8d',
298
+ '--dsw-alias-state-success-primary': '#1f8f5f',
299
+ '--dsw-alias-state-success-secondary': '#2fac78',
300
+ '--dsw-alias-state-warn-primary': '#b86f00',
301
+ '--dsw-alias-state-warn-secondary': '#eab841',
302
+ '--dsw-alias-state-warn-label': '#b86f00',
303
+
304
+ // Interaction
305
+ '--dsw-alias-interactive-bg-hover': 'rgba(0, 0, 0, 0.05)',
306
+ '--dsw-alias-interactive-bg-active': 'rgba(0, 0, 0, 0.09)',
307
+ '--dsw-alias-interactive-bg-hover-accent': 'rgba(0, 152, 220, 0.12)',
308
+ '--dsw-alias-interactive-bg-hover-danger': 'rgba(200, 16, 46, 0.10)',
309
+
310
+ // Chrome: sidebar, menus, cards
311
+ '--dsw-specific-sidebar-fill': '#fafafa',
312
+ '--dsw-specific-menu': 'rgba(255, 255, 255, 0.78)',
313
+ '--dsw-menu-surface-fill': 'rgba(255, 255, 255, 0.72)',
314
+ '--dsw-alias-menu-group-header-fill': 'rgba(250, 250, 250, 0.94)',
315
+ '--dsw-specific-selector': '#eef0f1',
316
+ '--dsw-specific-input-major': '#ffffff',
317
+ '--dsw-specific-tip': '#f5f5f5',
318
+ '--dsw-specific-sidebar-nav-item-active': '#ebebeb',
319
+ '--dsw-specific-sidebar-nav-item-active-accent': '#dcecf3',
320
+ '--dsw-alias-card-fill': '#ffffff',
321
+ '--dsw-alias-card-fill-hover': '#fafafa',
322
+ '--dsw-alias-card-tile-fill': 'rgba(0, 0, 0, 0.03)',
323
+ '--dsw-alias-settings-card-fill': '#ffffff',
324
+ '--dsw-alias-settings-card-stroke': '#e8eaeb',
325
+ '--dsw-alias-trajectory-accent': '#0098dc',
326
+ '--dsw-alias-turn-trigger-bg': '#ebebeb',
327
+ '--dsw-alias-turn-trigger-bg-hover': '#e0e3e4',
328
+
329
+ // Code and markdown
330
+ '--dsw-alias-markdown-code-block': '#eef0f1',
331
+ '--dsw-alias-markdown-code-block-banner': '#f5f5f5',
332
+ '--dsw-alias-markdown-code-segment-selected': '#ebebeb',
333
+ '--dsw-alias-markdown-code-segment-unselected': '#eef0f1',
334
+ '--dsw-alias-markdown-inline-code': '#ebebeb',
335
+ '--dsw-alias-markdown-placeholder': '#ebebeb',
336
+ '--dsw-alias-markdown-tag': '#ebebeb',
337
+ '--dsw-alias-markdown-citation': '#eef0f1',
338
+ '--dsw-alias-code-diff-added': 'rgba(31, 143, 95, 0.12)',
339
+ '--dsw-alias-code-diff-deleted': 'rgba(200, 16, 46, 0.10)',
340
+ '--dsw-alias-file-diff-added-bg': '#eaf6ef',
341
+ '--dsw-alias-file-diff-added-gutter': '#e0f0e6',
342
+ '--dsw-alias-file-diff-added-marker': '#1f8f5f',
343
+ '--dsw-alias-file-diff-deleted-bg': '#fbecee',
344
+ '--dsw-alias-file-diff-deleted-gutter': '#f6e0e3',
345
+ '--dsw-alias-file-diff-deleted-marker': '#c8102e',
346
+
347
+ // Overlays
348
+ '--dsw-alias-toast-bg': '#1d1f20',
349
+ '--dsw-alias-toast-label': '#ffffff',
350
+ '--dsw-alias-toast-action': '#5ddcff',
351
+ '--dsw-alias-tooltip-bg': '#1d1f20',
352
+ '--dsw-alias-tooltip-label': '#ffffff',
353
+ '--dsw-alias-hovercard-bg': '#1d1f20',
354
+ '--dsw-alias-hovercard-label-primary': '#ffffff',
355
+ '--dsw-alias-hovercard-label-secondary': '#c9c9c9',
356
+ '--dsw-alias-hovercard-label-tertiary': '#9c9e9f',
357
+ '--dsw-alias-hovercard-state-done': '#bf96ed',
358
+ '--dsw-alias-hovercard-state-error': '#ff5c5c',
359
+
360
+ // Scrollbars, charts, JSON tree
361
+ '--dsw-alias-scrollbar-bg-l1': '#c4c7c9',
362
+ '--dsw-alias-scrollbar-bg-l2': '#b1b1b1',
363
+ '--dsw-alias-scrollbar-hover-l1': '#aeb2b5',
364
+ '--dsw-alias-scrollbar-hover-l2': '#8d8d8d',
365
+ '--dsw-alias-chart-messages': '#0098dc',
366
+ '--dsw-alias-chart-system': '#8d8d8d',
367
+ '--dsw-alias-chart-tools': '#9266b2',
368
+ '--dsw-alias-json-tree-keyword': '#0072a8',
369
+ '--dsw-alias-json-tree-number': '#0072a8',
370
+ '--dsw-alias-json-tree-string': '#c82a36',
371
+ '--dsw-alias-json-tree-property': '#1f8f5f',
372
+ '--dsw-alias-json-tree-punctuation': '#1d1f20',
373
+ '--dsw-alias-json-tree-icon': '#8d8d8d',
374
+ '--dsw-alias-json-tree-hover': 'rgba(0, 152, 220, 0.06)',
375
+
376
+ // Conversation bubbles and illustrations
377
+ '--dsw-specific-bubble': '#eef5f8',
378
+ '--dsw-specific-bubble-highlight': '#dcecf3',
379
+ '--dsw-specific-guide-hero': '#ebebeb',
380
+ '--dsw-alias-illustration-background': '#f5f5f5',
381
+ '--dsw-alias-illustration-surface': '#ffffff',
382
+ '--dsw-alias-illustration-backing': '#ebebeb',
383
+ '--dsw-alias-illustration-detail': '#8d8d8d',
384
+ '--dsw-alias-illustration-inset': '#ebebeb',
385
+ '--dsw-alias-illustration-shadow': '#e8eaeb',
386
+ };
387
+
388
+ /**
389
+ * PRTS frame language: the design system cuts almost every corner square
390
+ * and outlines raised surfaces with a hairline. Radii and the elevation
391
+ * stroke are plain CSS, so the skin carries them in one stylesheet that
392
+ * only applies while a PRTS theme is active.
393
+ */
394
+ const STYLE = `
395
+ html[data-prts-theme] body {
396
+ --dsw-radius-xs: 2px;
397
+ --dsw-radius-sm: 2px;
398
+ --dsw-radius-md: 3px;
399
+ --dsw-radius-lg: 4px;
400
+ --dsw-radius-xl: 4px;
401
+ --dsw-radius-panel: 6px;
402
+ }
403
+ html[data-prts-theme='dark'] body { --dsw-elevation-stroke-color: rgba(24, 209, 255, 0.20); }
404
+ html[data-prts-theme='light'] body { --dsw-elevation-stroke-color: rgba(0, 152, 220, 0.24); }
405
+ html[data-prts-theme='dark'] ::selection { background: rgba(24, 209, 255, 0.30); color: #f0f0f0; }
406
+ html[data-prts-theme='light'] ::selection { background: rgba(0, 152, 220, 0.24); color: #1d1f20; }
407
+
408
+ /* ---------- PRTS chrome: redrawn controls ---------- */
409
+ html[data-prts-theme] body {
410
+ --prts-accent: #18d1ff;
411
+ --prts-accent-soft: rgba(24, 209, 255, 0.13);
412
+ --prts-accent-line: rgba(24, 209, 255, 0.42);
413
+ --prts-hairline: rgba(255, 255, 255, 0.10);
414
+ --prts-ink: #eafaff;
415
+ --prts-cta-bg: linear-gradient(180deg, rgba(24, 209, 255, 0.18), rgba(24, 209, 255, 0.05) 62%, rgba(24, 209, 255, 0.02)), #16171a;
416
+ --prts-cta-fg: #eafaff;
417
+ --prts-go-bg: linear-gradient(180deg, #7ee5ff, #18d1ff 55%, #00b4e6);
418
+ --prts-go-fg: #04161c;
419
+ --prts-go-line: rgba(24, 209, 255, 0.55);
420
+ }
421
+ html[data-prts-theme='light'] body {
422
+ --prts-accent: #0098dc;
423
+ --prts-accent-soft: rgba(0, 152, 220, 0.10);
424
+ --prts-accent-line: rgba(0, 152, 220, 0.45);
425
+ --prts-hairline: rgba(29, 31, 32, 0.12);
426
+ --prts-ink: #ffffff;
427
+ --prts-cta-bg: linear-gradient(180deg, #1fa9e6, #0098dc);
428
+ --prts-cta-fg: #ffffff;
429
+ --prts-go-bg: linear-gradient(180deg, #26a9e4, #0098dc);
430
+ --prts-go-fg: #ffffff;
431
+ --prts-go-line: rgba(0, 117, 169, 0.55);
432
+ }
433
+
434
+ /* every rounded chrome edge goes square */
435
+ html[data-prts-theme] :where(
436
+ button, [role='button'], [role='tab'], [role='menuitem'],
437
+ input, textarea, select, kbd,
438
+ [class*='card'], [class*='dialog'], [class*='popover'],
439
+ [class*='menu'], [class*='tooltip'], [class*='chip'], [class*='badge']
440
+ ) { border-radius: 2px !important; }
441
+
442
+ html[data-prts-theme] button,
443
+ html[data-prts-theme] [role='button'] {
444
+ letter-spacing: 0.02em;
445
+ transition: background-color 120ms linear, border-color 120ms linear, color 120ms linear;
446
+ }
447
+ html[data-prts-theme] button:focus-visible,
448
+ html[data-prts-theme] [role='button']:focus-visible,
449
+ html[data-prts-theme] [role='tab']:focus-visible {
450
+ outline: 1px solid var(--prts-accent);
451
+ outline-offset: 2px;
452
+ }
453
+
454
+ /* New session: a cut-corner CTA plate, not a pill */
455
+ html[data-prts-theme] button[class*='newSession'] {
456
+ position: relative;
457
+ border: 1px solid var(--prts-accent-line) !important;
458
+ background: var(--prts-cta-bg) !important;
459
+ color: var(--prts-cta-fg) !important;
460
+ font-weight: 600;
461
+ letter-spacing: 0.10em;
462
+ clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
463
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
464
+ }
465
+ html[data-prts-theme] button[class*='newSession']::before {
466
+ content: '';
467
+ position: absolute;
468
+ top: 0;
469
+ left: 12px;
470
+ width: 52px;
471
+ height: 2px;
472
+ background: var(--prts-accent);
473
+ pointer-events: none;
474
+ }
475
+ html[data-prts-theme] button[class*='newSession']:hover {
476
+ border-color: var(--prts-accent) !important;
477
+ box-shadow: inset 0 0 24px rgba(24, 209, 255, 0.18), 0 0 0 1px rgba(24, 209, 255, 0.20);
478
+ }
479
+ html[data-prts-theme] button[class*='newSession']:active { transform: translateY(1px); }
480
+ html[data-prts-theme] [class*='newSessionLabel'] {
481
+ letter-spacing: 0.14em;
482
+ font-size: 12.5px;
483
+ text-transform: uppercase;
484
+ }
485
+ html[data-prts-theme] [class*='newSessionShortcut'] {
486
+ border: 1px solid var(--prts-hairline);
487
+ border-radius: 2px;
488
+ padding: 1px 5px;
489
+ font-size: 10px;
490
+ letter-spacing: 0.06em;
491
+ color: var(--dsw-alias-label-tertiary);
492
+ background: rgba(255, 255, 255, 0.04);
493
+ }
494
+
495
+ /* Toolbar icon buttons: hairline squares */
496
+ html[data-prts-theme] button[class*='iconButton'] {
497
+ border: 1px solid transparent;
498
+ border-radius: 2px !important;
499
+ color: var(--dsw-alias-label-secondary);
500
+ }
501
+ html[data-prts-theme] button[class*='iconButton']:hover {
502
+ border-color: var(--prts-accent-line);
503
+ background: var(--prts-accent-soft);
504
+ color: var(--prts-ink);
505
+ }
506
+
507
+ /* Sidebar rows: hover wash plus a 2px accent bar when active */
508
+ html[data-prts-theme] [class*='panelRow']:hover,
509
+ html[data-prts-theme] [class*='panelEntry']:hover { background: var(--prts-accent-soft); }
510
+ html[data-prts-theme] [class*='panelEntryActive'],
511
+ html[data-prts-theme] [class*='panelRow'][aria-expanded='true'] {
512
+ box-shadow: inset 2px 0 0 var(--prts-accent);
513
+ background: var(--prts-accent-soft);
514
+ }
515
+
516
+ /* Primary / send buttons: chamfered cyan plate with dark glyph */
517
+ html[data-prts-theme] button[class*='primary'] {
518
+ background: var(--prts-go-bg) !important;
519
+ color: var(--prts-go-fg) !important;
520
+ border: 1px solid var(--prts-go-line) !important;
521
+ clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
522
+ box-shadow: 0 2px 12px rgba(24, 209, 255, 0.22);
523
+ }
524
+ html[data-prts-theme] button[class*='primary']:hover:not(:disabled) { filter: brightness(1.08); }
525
+ html[data-prts-theme] button[class*='primary']:disabled { filter: grayscale(0.35) brightness(0.9); }
526
+
527
+ /* Add / select affordances in the composer */
528
+ html[data-prts-theme] button[class*='add'] {
529
+ border-radius: 2px !important;
530
+ border: 1px solid var(--prts-hairline) !important;
531
+ background: transparent !important;
532
+ color: var(--dsw-alias-label-secondary) !important;
533
+ }
534
+ html[data-prts-theme] button[class*='add']:hover {
535
+ border-color: var(--prts-accent-line) !important;
536
+ color: var(--prts-ink) !important;
537
+ background: var(--prts-accent-soft) !important;
538
+ }
539
+ html[data-prts-theme] kbd {
540
+ border: 1px solid var(--prts-hairline);
541
+ background: rgba(255, 255, 255, 0.04);
542
+ padding: 1px 5px;
543
+ font-size: 10.5px;
544
+ }
545
+
546
+ /* Tabs, menus, sidebar chrome */
547
+ html[data-prts-theme] [role='tab'][aria-selected='true'] {
548
+ color: var(--prts-accent);
549
+ box-shadow: inset 0 -2px 0 var(--prts-accent);
550
+ }
551
+ html[data-prts-theme] [role='menuitem']:hover,
552
+ html[data-prts-theme] [role='menuitemcheckbox']:hover,
553
+ html[data-prts-theme] [role='option']:hover {
554
+ background: var(--prts-accent-soft);
555
+ }
556
+ html[data-prts-theme] [class*='topStrip'] {
557
+ border-bottom: 1px solid var(--prts-hairline);
558
+ box-shadow: 0 1px 0 rgba(24, 209, 255, 0.14);
559
+ }
560
+ html[data-prts-theme] [class*='footArea'],
561
+ html[data-prts-theme] [class*='settingsArea'] {
562
+ border-top: 1px solid var(--prts-hairline);
563
+ }
564
+ html[data-prts-theme] [class*='older'] button {
565
+ border: 1px solid var(--prts-hairline);
566
+ background: transparent;
567
+ color: var(--dsw-alias-label-secondary);
568
+ }
569
+ html[data-prts-theme] [class*='older'] button:hover {
570
+ border-color: var(--prts-accent-line);
571
+ color: var(--prts-ink);
572
+ }
573
+ html[data-prts-theme] ::-webkit-scrollbar-thumb {
574
+ border-radius: 0;
575
+ background: var(--dsw-alias-scrollbar-bg-l1);
576
+ border: 1px solid transparent;
577
+ background-clip: content-box;
578
+ }
579
+ html[data-prts-theme] ::-webkit-scrollbar-thumb:hover {
580
+ background: var(--prts-accent-line);
581
+ background-clip: content-box;
582
+ }
583
+
584
+ /* Header controls + inline chips */
585
+ html[data-prts-theme] header button,
586
+ html[data-prts-theme] [data-conversation-header-leading] button {
587
+ border-radius: 2px !important;
588
+ }
589
+ html[data-prts-theme] header button:hover,
590
+ html[data-prts-theme] [data-conversation-header-leading] button:hover {
591
+ box-shadow: inset 0 0 0 1px var(--prts-accent-line);
592
+ }
593
+ html[data-prts-theme] [class*='select'] {
594
+ border-radius: 2px !important;
595
+ }
596
+ html[data-prts-theme] kbd {
597
+ letter-spacing: 0.08em;
598
+ text-transform: uppercase;
599
+ }
600
+
601
+ /* The PRTS theme row in Settings > General */
602
+ .dsh-prts-row { display: flex; flex-direction: column; gap: 10px; }
603
+ .dsh-prts-row__head { display: flex; align-items: baseline; gap: 8px; }
604
+ .dsh-prts-row__title { color: var(--dsw-alias-label-primary); font-size: 14px; font-weight: 500; }
605
+ .dsh-prts-row__tag {
606
+ color: var(--dsw-alias-label-caption);
607
+ font-size: 11px;
608
+ letter-spacing: 0.08em;
609
+ text-transform: uppercase;
610
+ }
611
+ .dsh-prts-row__cubes { display: flex; flex-wrap: wrap; gap: 8px; }
612
+ .dsh-prts-cube {
613
+ align-items: flex-start;
614
+ appearance: none;
615
+ background: var(--dsw-alias-bg-layer-2);
616
+ border: 1px solid var(--dsw-alias-border-l1);
617
+ border-radius: var(--dsw-radius-sm);
618
+ color: var(--dsw-alias-label-secondary);
619
+ cursor: pointer;
620
+ display: flex;
621
+ flex-direction: column;
622
+ gap: 2px;
623
+ min-width: 104px;
624
+ padding: 10px 12px 9px;
625
+ text-align: left;
626
+ transition: background var(--ds-transition-duration-fast) var(--ds-ease-in-out),
627
+ border-color var(--ds-transition-duration-fast) var(--ds-ease-in-out);
628
+ }
629
+ .dsh-prts-cube:hover { background: var(--dsw-alias-interactive-bg-hover); }
630
+ .dsh-prts-cube.is-selected {
631
+ border-color: var(--dsw-alias-brand-primary);
632
+ background: var(--dsw-alias-interactive-bg-hover-accent);
633
+ color: var(--dsw-alias-label-primary);
634
+ }
635
+ .dsh-prts-cube__mark {
636
+ width: 100%;
637
+ height: 3px;
638
+ margin-bottom: 6px;
639
+ background: var(--dsw-alias-border-l2);
640
+ }
641
+ .dsh-prts-cube.is-selected .dsh-prts-cube__mark { background: var(--dsw-alias-brand-primary); }
642
+ .dsh-prts-cube__label { font-size: 13px; font-weight: 500; }
643
+ .dsh-prts-cube__hint { color: var(--dsw-alias-label-caption); font-size: 11px; }
644
+ .dsh-prts-row__foot {
645
+ color: var(--dsw-alias-label-caption);
646
+ font-size: 11px;
647
+ letter-spacing: 0.02em;
648
+ }
649
+ /* ---------- PRTS Progress: timeline meters ---------- */
650
+ /* Spec lifted from prts-design packages/css/src/components/progress.css:
651
+ flat track (--ak-bg-surface-3), square 8px meter, accent fill, optional
652
+ -45deg stripe reserve, .ak-progress-label typography. */
653
+ html[data-prts-theme] body {
654
+ --prts-meter-track: #22262a;
655
+ --prts-meter-edge: rgba(255, 255, 255, 0.12);
656
+ --prts-meter-stripe: rgba(0, 0, 0, 0.24);
657
+ --prts-meter-label: #8d8d8d;
658
+ }
659
+ html[data-prts-theme='light'] body {
660
+ --prts-meter-track: #e3e7ea;
661
+ --prts-meter-edge: rgba(29, 31, 32, 0.14);
662
+ --prts-meter-stripe: rgba(0, 0, 0, 0.13);
663
+ --prts-meter-label: #626262;
664
+ }
665
+
666
+ /* .ak-progress — flat track, square ends, hairline instead of a 0.5px border */
667
+ html[data-prts-theme] .timeline-progress {
668
+ --prts-meter-fill: var(--dsw-alias-brand-primary);
669
+ height: 8px;
670
+ border: 0 !important;
671
+ border-radius: 0 !important;
672
+ background: var(--prts-meter-track) !important;
673
+ box-shadow: inset 0 0 0 1px var(--prts-meter-edge);
674
+ overflow: hidden;
675
+ }
676
+ html[data-prts-theme] .timeline-progress > span,
677
+ html[data-prts-theme] .timeline-progress[data-segmented] > [data-part] {
678
+ border-radius: 0 !important;
679
+ transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 180ms linear !important;
680
+ }
681
+
682
+ /* .ak-progress::before — plain meter fills flat with the accent */
683
+ html[data-prts-theme] .timeline-progress:not([data-segmented]) > span {
684
+ background: var(--prts-meter-fill) !important;
685
+ }
686
+
687
+ /* .ak-progress--stripes — queued work reads as a striped reserve */
688
+ html[data-prts-theme] .timeline-progress[data-segmented] > [data-part='pending'] {
689
+ background-color: var(--prts-meter-track) !important;
690
+ background-image: repeating-linear-gradient(
691
+ -45deg,
692
+ transparent 0 4px,
693
+ var(--prts-meter-stripe) 4px 8px
694
+ ) !important;
695
+ }
696
+ html[data-prts-theme] .timeline-progress[data-segmented] > [data-part='blocked'] {
697
+ background-color: var(--prts-meter-track) !important;
698
+ background-image: repeating-linear-gradient(
699
+ -45deg,
700
+ transparent 0 3px,
701
+ color-mix(in srgb, var(--dsw-alias-state-warn-primary) 34%, transparent) 3px 6px
702
+ ) !important;
703
+ }
704
+
705
+ /* .ak-progress--segmented > i + i { gap } — hairline seams keep 100% exact */
706
+ html[data-prts-theme] .timeline-progress[data-segmented] > [data-part] + [data-part] {
707
+ box-shadow: inset 1px 0 0 var(--prts-meter-track);
708
+ }
709
+ html[data-prts-theme] .timeline-progress:focus-visible {
710
+ outline: 1px solid var(--prts-accent);
711
+ outline-offset: 3px;
712
+ }
713
+
714
+ /* the sheen becomes a scan line rather than a gloss */
715
+ html[data-prts-theme] :is(
716
+ .timeline-progress > [data-flow='true'],
717
+ .timeline-progress:not([data-segmented])[data-status='active'] > span
718
+ ):after {
719
+ background: linear-gradient(
720
+ 100deg,
721
+ transparent 26%,
722
+ rgba(255, 255, 255, 0.18) 50%,
723
+ transparent 74%
724
+ ) !important;
725
+ }
726
+
727
+ /* .ak-progress-label — 600 label type, muted, percent in tabular numerals */
728
+ html[data-prts-theme] .timeline-dock-bar {
729
+ border-radius: 2px !important;
730
+ letter-spacing: 0.02em;
731
+ }
732
+ html[data-prts-theme] .timeline-dock-title {
733
+ font-weight: 600;
734
+ letter-spacing: 0.04em;
735
+ }
736
+ html[data-prts-theme] .timeline-dock-percent {
737
+ font-family: var(--dsw-font-family-brand, inherit);
738
+ font-size: 11px;
739
+ font-weight: 600;
740
+ letter-spacing: 0.08em;
741
+ color: color-mix(in srgb, var(--dsw-alias-brand-primary) 58%, var(--prts-meter-label));
742
+ font-variant-numeric: tabular-nums;
743
+ }
744
+ html[data-prts-theme] .timeline-dock-action {
745
+ border: 1px solid var(--dsw-alias-border-l1);
746
+ border-radius: 2px !important;
747
+ color: var(--dsw-alias-label-secondary);
748
+ }
749
+ html[data-prts-theme] .timeline-dock-action:hover:not(:disabled) {
750
+ border-color: var(--prts-accent-line);
751
+ color: var(--dsw-alias-label-primary);
752
+ }
753
+
754
+ /* .ak-progress--sm — the inline meter on task rows */
755
+ html[data-prts-theme] .timeline-task .timeline-progress {
756
+ height: 4px;
757
+ box-shadow: none;
758
+ }
759
+
760
+ /* ---------- PRTS Dialog & Menu: surfaces, rails, headers ---------- */
761
+ /* Specs lifted from prts-design components/{dialog,dropdown,panel}.css:
762
+ surface fill + 1px border + shadow-lg; head/foot split by hairlines with a
763
+ short accent stub; menu items 7px/14px rows with a 2px left rail that lights
764
+ up on hover; overlays dim with a 2px blur. */
765
+ :root,
766
+ html[data-prts-theme] body {
767
+ --prts-scrim: rgba(6, 8, 10, 0.62);
768
+ --prts-menu-fill: var(--dsw-alias-bg-layer-1);
769
+ --prts-menu-hover: color-mix(in srgb, var(--dsw-alias-brand-primary) 14%, transparent);
770
+ --prts-menu-border: var(--dsw-alias-border-l2);
771
+ --prts-dialog-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(0, 0, 0, 0.3);
772
+ }
773
+
774
+ /* .ak-menu — square card, hairline border, flat top padding for the caption */
775
+ [role='menu'],
776
+ [role='listbox'] {
777
+ --dsw-menu-surface-fill: var(--prts-menu-fill);
778
+ padding: 4px 0 0;
779
+ border: 1px solid var(--prts-menu-border);
780
+ border-radius: 0 !important;
781
+ background: transparent;
782
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
783
+ backdrop-filter: none;
784
+ }
785
+ [role='menu'] > div:first-child,
786
+ [role='listbox'] > div:first-child {
787
+ border-radius: 0 !important;
788
+ backdrop-filter: none;
789
+ }
790
+
791
+ /* .ak-menu__item — 2px rail stays transparent until hover / current */
792
+ [role='menuitem'],
793
+ [role='menuitemradio'],
794
+ [role='menuitemcheckbox'],
795
+ [role='option'] {
796
+ border-left: 2px solid transparent;
797
+ border-radius: 0 !important;
798
+ padding: 7px 14px;
799
+ gap: 8px;
800
+ font-size: 13px;
801
+ line-height: 1.5;
802
+ color: var(--dsw-alias-label-primary);
803
+ transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
804
+ }
805
+ [role='menuitem']:hover,
806
+ [role='menuitem']:focus-visible,
807
+ [role='menuitemradio']:hover,
808
+ [role='menuitemradio']:focus-visible,
809
+ [role='menuitemcheckbox']:hover,
810
+ [role='menuitemcheckbox']:focus-visible,
811
+ [role='option']:hover,
812
+ [role='option']:focus-visible,
813
+ [role='menuitem'][data-highlighted],
814
+ [role='option'][data-highlighted] {
815
+ background: var(--prts-menu-hover) !important;
816
+ border-left-color: var(--dsw-alias-brand-primary);
817
+ color: var(--dsw-alias-label-primary);
818
+ outline: none;
819
+ }
820
+ [role='menuitem'][aria-checked='true'],
821
+ [role='menuitemradio'][aria-checked='true'],
822
+ [role='menuitemcheckbox'][aria-checked='true'],
823
+ [role='option'][aria-selected='true'] {
824
+ color: var(--dsw-alias-brand-primary);
825
+ border-left-color: var(--dsw-alias-brand-primary);
826
+ }
827
+ [role='menuitem'][aria-disabled='true'],
828
+ [role='option'][aria-disabled='true'] {
829
+ color: var(--dsw-alias-label-tertiary);
830
+ border-left-color: transparent;
831
+ background: none !important;
832
+ }
833
+ [role='menu'] [role='separator'],
834
+ [role='listbox'] [role='separator'] {
835
+ height: 1px;
836
+ margin: 4px 0;
837
+ border: 0;
838
+ background: var(--dsw-alias-border-l1);
839
+ }
840
+ [role='menu'] [role='menuitem'] > span:first-child,
841
+ [role='menu'] [role='menuitem'] > svg:first-child {
842
+ color: var(--dsw-alias-label-tertiary);
843
+ flex: none;
844
+ }
845
+ [role='menu'] [role='menuitem']:hover > span:first-child,
846
+ [role='menu'] [role='menuitem']:hover > svg:first-child {
847
+ color: var(--dsw-alias-brand-primary);
848
+ }
849
+ [role='menu'] [role='menuitem'] > span:last-child {
850
+ letter-spacing: 0.01em;
851
+ }
852
+
853
+ /* .ak-dialog — square plate, 1px hairline, accent stub on the top edge */
854
+ [role='dialog'][aria-modal='true'],
855
+ [role='alertdialog'] {
856
+ position: relative;
857
+ border: 1px solid var(--prts-menu-border);
858
+ border-radius: 0 !important;
859
+ background: var(--dsw-alias-bg-layer-1);
860
+ box-shadow: var(--prts-dialog-shadow);
861
+ }
862
+ [role='dialog'][aria-modal='true']::before,
863
+ [role='alertdialog']::before {
864
+ content: '';
865
+ position: absolute;
866
+ top: 0;
867
+ left: 0;
868
+ width: 84px;
869
+ height: 2px;
870
+ background: var(--dsw-alias-brand-primary);
871
+ pointer-events: none;
872
+ z-index: 2;
873
+ }
874
+ /* .ak-dialog::backdrop — dim once, blur 2px, no colour cast */
875
+ [role='presentation']:has(> [role='dialog'][aria-modal='true']) > [aria-hidden='true'] {
876
+ background: var(--prts-scrim);
877
+ backdrop-filter: blur(2px);
878
+ }
879
+ dialog[open] {
880
+ border: 1px solid var(--prts-menu-border);
881
+ border-radius: 0;
882
+ background: var(--dsw-alias-bg-layer-1);
883
+ box-shadow: var(--prts-dialog-shadow);
884
+ }
885
+ dialog[open]::backdrop {
886
+ background: var(--prts-scrim);
887
+ backdrop-filter: blur(2px);
888
+ }
889
+
890
+ /* settings-style dialogs: nav cells become PRTS list rows with the same rail */
891
+ [role='dialog'] nav button {
892
+ border-radius: 0 !important;
893
+ border-left: 2px solid transparent;
894
+ transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear;
895
+ }
896
+ [role='dialog'] nav button:hover {
897
+ background: var(--prts-menu-hover);
898
+ }
899
+ [role='dialog'] nav button[aria-current='true'] {
900
+ color: var(--dsw-alias-brand-primary);
901
+ border-left-color: var(--dsw-alias-brand-primary);
902
+ background: color-mix(in srgb, var(--dsw-alias-brand-primary) 10%, transparent);
903
+ }
904
+ [role='dialog'] nav button[aria-current='true'] span {
905
+ color: inherit;
906
+ }
907
+ `;
908
+
909
+ function readChoice() {
910
+ try {
911
+ const stored = window.localStorage.getItem(STORAGE_KEY);
912
+ if (stored === 'default' || PRTS_IDS.includes(stored)) return stored;
913
+ } catch (error) {
914
+ /* storage can be unavailable; fall through to the first-run default */
915
+ }
916
+ return 'prts-dark';
917
+ }
918
+
919
+ function writeChoice(choice) {
920
+ try {
921
+ window.localStorage.setItem(STORAGE_KEY, choice);
922
+ } catch (error) {
923
+ /* keep the in-memory choice when storage is unavailable */
924
+ }
925
+ }
926
+
927
+ /** One General-settings row: pick the PRTS skin or surrender to the built-in appearance. */
928
+ function PrtsThemeRow(props) {
929
+ const [choice, setChoice] = React.useState(() => props.readChoice());
930
+ const select = (id) => {
931
+ setChoice(id);
932
+ props.selectTheme(id);
933
+ };
934
+ return h('div', { className: 'dsh-prts-row' },
935
+ h('div', { className: 'dsh-prts-row__head' },
936
+ h('span', { className: 'dsh-prts-row__title' }, 'PRTS 主题'),
937
+ h('span', { className: 'dsh-prts-row__tag' }, 'TERMINAL / DAYLIGHT'),
938
+ ),
939
+ h('div', { className: 'dsh-prts-row__cubes' },
940
+ CHOICES.map(entry => h('button', {
941
+ key: entry.id,
942
+ type: 'button',
943
+ className: `dsh-prts-cube${choice === entry.id ? ' is-selected' : ''}`,
944
+ 'aria-pressed': choice === entry.id,
945
+ onClick: () => select(entry.id),
946
+ },
947
+ h('span', { className: 'dsh-prts-cube__mark' }),
948
+ h('span', { className: 'dsh-prts-cube__label' }, entry.label),
949
+ h('span', { className: 'dsh-prts-cube__hint' }, entry.hint),
950
+ )),
951
+ ),
952
+ h('div', { className: 'dsh-prts-row__foot' }, '配色取自 prts-design(MooncellWiki),选用内置外观即恢复默认皮肤。'),
953
+ );
954
+ }
955
+
956
+ return {
957
+ inject: ['theme', 'slots'],
958
+ apply(ctx) {
959
+ const theme = ctx.theme;
960
+ const root = document.documentElement;
961
+
962
+ const paintSelection = (preference) => {
963
+ if (preference === 'prts-dark' || preference === 'prts-light') {
964
+ root.setAttribute('data-prts-theme', preference === 'prts-dark' ? 'dark' : 'light');
965
+ } else {
966
+ root.removeAttribute('data-prts-theme');
967
+ }
968
+ };
969
+
970
+ ctx.effect(() => {
971
+ const style = document.createElement('style');
972
+ style.setAttribute('data-prts-theme-style', '');
973
+ style.textContent = STYLE;
974
+ document.head.appendChild(style);
975
+ return () => style.remove();
976
+ }, 'prts-theme: shell stylesheet');
977
+
978
+ ctx.effect(
979
+ () => theme.register({ id: 'prts-dark', colorScheme: 'dark', tokens: DARK_TOKENS }),
980
+ 'prts-theme: prts-dark registration',
981
+ );
982
+ ctx.effect(
983
+ () => theme.register({ id: 'prts-light', colorScheme: 'light', tokens: LIGHT_TOKENS }),
984
+ 'prts-theme: prts-light registration',
985
+ );
986
+
987
+ const selectTheme = (id) => {
988
+ writeChoice(id);
989
+ if (id === 'default') {
990
+ // Surrender the skin: back to the built-in preference (system).
991
+ if (theme.getTheme().preference !== 'system') theme.setTheme('system');
992
+ paintSelection('system');
993
+ return;
994
+ }
995
+ theme.setTheme(id);
996
+ paintSelection(id);
997
+ };
998
+
999
+ // Restore the stored skin before listening, so the first change event
1000
+ // is not mistaken for the user leaving the skin.
1001
+ const initial = readChoice();
1002
+ if (PRTS_IDS.includes(initial)) {
1003
+ selectTheme(initial);
1004
+ } else {
1005
+ paintSelection(theme.getTheme().preference);
1006
+ }
1007
+
1008
+ ctx.on('theme/change', (snapshot) => {
1009
+ const preference = snapshot.preference;
1010
+ paintSelection(preference);
1011
+ if (!PRTS_IDS.includes(preference) && readChoice() !== 'default') {
1012
+ // The user picked a built-in appearance; remember that choice so a
1013
+ // reload does not drag the PRTS skin back.
1014
+ writeChoice('default');
1015
+ }
1016
+ });
1017
+
1018
+ ctx.effect(() => ctx.slots.inject('settings.general.item', () => ctx.slots.register({
1019
+ name: 'settings.general.item',
1020
+ id: 'prts-theme',
1021
+ order: 12,
1022
+ inject: () => ({ readChoice, selectTheme }),
1023
+ }, PrtsThemeRow)), 'prts-theme: settings row');
1024
+
1025
+
1026
+
1027
+ },
1028
+ };
1029
+ },
1030
+ });