dsh-cool-theme 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -0
  3. package/README.zh.md +2 -0
  4. package/lib/client.js +1437 -1240
  5. package/lib/index.js +4 -1
  6. package/lib/types/client/css/primitives.d.ts +20 -0
  7. package/lib/types/client/css/primitives.d.ts.map +1 -0
  8. package/lib/types/client/css/shiki.d.ts +11 -0
  9. package/lib/types/client/css/shiki.d.ts.map +1 -0
  10. package/lib/types/client/locales.d.ts +6 -0
  11. package/lib/types/client/locales.d.ts.map +1 -1
  12. package/lib/types/client/presets/_helpers.d.ts +41 -0
  13. package/lib/types/client/presets/_helpers.d.ts.map +1 -0
  14. package/lib/types/client/presets/ayu.d.ts +26 -0
  15. package/lib/types/client/presets/ayu.d.ts.map +1 -0
  16. package/lib/types/client/presets/catppuccin.d.ts +26 -0
  17. package/lib/types/client/presets/catppuccin.d.ts.map +1 -0
  18. package/lib/types/client/presets/dracula.d.ts +26 -0
  19. package/lib/types/client/presets/dracula.d.ts.map +1 -0
  20. package/lib/types/client/presets/dsh.d.ts +10 -0
  21. package/lib/types/client/presets/dsh.d.ts.map +1 -0
  22. package/lib/types/client/presets/github.d.ts +26 -0
  23. package/lib/types/client/presets/github.d.ts.map +1 -0
  24. package/lib/types/client/presets/gruvbox.d.ts +26 -0
  25. package/lib/types/client/presets/gruvbox.d.ts.map +1 -0
  26. package/lib/types/client/presets/monokai.d.ts +26 -0
  27. package/lib/types/client/presets/monokai.d.ts.map +1 -0
  28. package/lib/types/client/presets/nord.d.ts +26 -0
  29. package/lib/types/client/presets/nord.d.ts.map +1 -0
  30. package/lib/types/client/presets/onedark.d.ts +26 -0
  31. package/lib/types/client/presets/onedark.d.ts.map +1 -0
  32. package/lib/types/client/presets/rosepine.d.ts +26 -0
  33. package/lib/types/client/presets/rosepine.d.ts.map +1 -0
  34. package/lib/types/client/presets/solarized.d.ts +26 -0
  35. package/lib/types/client/presets/solarized.d.ts.map +1 -0
  36. package/lib/types/client/presets/tokyonight.d.ts +26 -0
  37. package/lib/types/client/presets/tokyonight.d.ts.map +1 -0
  38. package/lib/types/client/presets/zenburn.d.ts +26 -0
  39. package/lib/types/client/presets/zenburn.d.ts.map +1 -0
  40. package/lib/types/client/presets.d.ts +246 -360
  41. package/lib/types/client/presets.d.ts.map +1 -1
  42. package/lib/types/client/style-injector.d.ts.map +1 -1
  43. package/lib/types/client/theme.d.ts +0 -3
  44. package/lib/types/client/theme.d.ts.map +1 -1
  45. package/lib/types/client/tokens.d.ts +1 -23
  46. package/lib/types/client/tokens.d.ts.map +1 -1
  47. package/lib/types/host/index.d.ts +4 -1
  48. package/lib/types/host/index.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/lib/types/client/colors.d.ts +0 -6
  51. package/lib/types/client/colors.d.ts.map +0 -1
package/lib/client.js CHANGED
@@ -35,1132 +35,1131 @@ window.__ModuleLoader__.load({
35
35
  const THEME_STORAGE_KEY = "cool-theme-preset";
36
36
  const THEME_STORAGE_KEY_LEGACY = "cooltea-theme-preset";
37
37
  //#endregion
38
- //#region src/client/presets.ts
38
+ //#region src/client/presets/_helpers.ts
39
39
  /**
40
- * Theme presets: 12 popular color schemes, each with a light and a dark palette.
41
- * Pure data + shared types only; token projection lives in tokens.ts.
40
+ * Helpers for preset color scale generation.
41
+ * Uses the same linear RGB interpolation as scripts/interpolate-colors.ts
42
42
  */
43
- const PRESETS = {
44
- nord: {
45
- label: "Nord",
46
- light: {
47
- base: "#ffffff",
48
- l1: "#eceff4",
49
- l2: "#e5e9f0",
50
- l3: "#d8dee9",
51
- overlay: "#e5e9f0",
52
- b1: "#d8dee9",
53
- b2: "#b8c4d8",
54
- brand: "#5e81ac",
55
- lp: "#2e3440",
56
- ls: "#4c566a",
57
- err: "#bf616a",
58
- ok: "#a3be8c",
59
- warn: "#ebcb8b",
60
- side: "#eceff4"
61
- },
62
- dark: {
63
- base: "#242933",
64
- l1: "#2e3440",
65
- l2: "#3b4252",
66
- l3: "#434c5e",
67
- overlay: "#3b4252",
68
- b1: "#434c5e",
69
- b2: "#4c566a",
70
- brand: "#88c0d0",
71
- lp: "#eceff4",
72
- ls: "#d8dee9",
73
- err: "#bf616a",
74
- ok: "#a3be8c",
75
- warn: "#ebcb8b",
76
- side: "#242933"
77
- }
43
+ const BLUISH_STEPS = [
44
+ 0,
45
+ 50,
46
+ 60,
47
+ 75,
48
+ 100,
49
+ 150,
50
+ 200,
51
+ 300,
52
+ 400,
53
+ 500,
54
+ 600,
55
+ 700,
56
+ 750,
57
+ 800,
58
+ 850,
59
+ 875,
60
+ 900,
61
+ 950,
62
+ 1e3
63
+ ];
64
+ const NEUTRAL_STEPS = [
65
+ 0,
66
+ 50,
67
+ 100,
68
+ 150,
69
+ 200,
70
+ 250,
71
+ 300,
72
+ 400,
73
+ 500,
74
+ 550,
75
+ 600,
76
+ 700,
77
+ 800,
78
+ 850,
79
+ 900,
80
+ 1e3
81
+ ];
82
+ /** Semantic steps — kept identical to original hand-picked presets for compatibility */
83
+ const DEEPSEEK_STEPS = [
84
+ 50,
85
+ 100,
86
+ 200,
87
+ 300,
88
+ 400,
89
+ 450,
90
+ 500,
91
+ 600,
92
+ 800,
93
+ 900
94
+ ];
95
+ const BLUE_STEPS = [
96
+ 50,
97
+ 100,
98
+ 300,
99
+ 400,
100
+ 450,
101
+ 500,
102
+ 600,
103
+ 800,
104
+ 900
105
+ ];
106
+ const BLUE_EXTRA_STEPS = [
107
+ "50p",
108
+ "75",
109
+ "950"
110
+ ];
111
+ const GREEN_STEPS = [
112
+ 100,
113
+ 400,
114
+ 500,
115
+ 900
116
+ ];
117
+ const AMBER_STEPS = [
118
+ 100,
119
+ 400,
120
+ 500,
121
+ 600,
122
+ 900
123
+ ];
124
+ const RED_STEPS = [
125
+ 50,
126
+ 100,
127
+ 400,
128
+ 500,
129
+ 600,
130
+ 900
131
+ ];
132
+ function hexToRgb(hex) {
133
+ const clean = hex.replace(/^#/, "");
134
+ if (clean.length !== 6) throw new Error(`Invalid hex color: ${hex}`);
135
+ return [
136
+ parseInt(clean.substring(0, 2), 16),
137
+ parseInt(clean.substring(2, 4), 16),
138
+ parseInt(clean.substring(4, 6), 16)
139
+ ];
140
+ }
141
+ function rgbToHex(rgb) {
142
+ const [r, g, b] = rgb.map((v) => Math.round(v).toString(16).padStart(2, "0").toUpperCase());
143
+ return `#${r}${g}${b}`;
144
+ }
145
+ /**
146
+ * Linearly interpolate between two colors (RGB space, same as scripts/interpolate-colors.ts)
147
+ * @param colorStart color at scale 0, e.g. "#FAFAFA"
148
+ * @param colorEnd color at scale 1000, e.g. "#0D1017"
149
+ * @param steps array of scales to compute
150
+ * @returns map of scale -> hex color
151
+ */
152
+ function interpolateColors(colorStart, colorEnd, steps) {
153
+ const start = hexToRgb(colorStart);
154
+ const end = hexToRgb(colorEnd);
155
+ const diffR = end[0] - start[0];
156
+ const diffG = end[1] - start[1];
157
+ const diffB = end[2] - start[2];
158
+ const result = {};
159
+ for (const step of steps) {
160
+ const t = step / 1e3;
161
+ let r = Math.round(start[0] + diffR * t);
162
+ let g = Math.round(start[1] + diffG * t);
163
+ let b = Math.round(start[2] + diffB * t);
164
+ r = Math.max(0, Math.min(255, r));
165
+ g = Math.max(0, Math.min(255, g));
166
+ b = Math.max(0, Math.min(255, b));
167
+ result[step] = rgbToHex([
168
+ r,
169
+ g,
170
+ b
171
+ ]);
172
+ }
173
+ return result;
174
+ }
175
+ /**
176
+ * Build CSS variable map for a neutral scale
177
+ * e.g. prefix '--dsw-static-neutral-bluish', start '#FAFAFA', end '#0D1017'
178
+ * -> { '--dsw-static-neutral-bluish-00': '#FAFAFA', '--dsw-static-neutral-bluish-50': '...' }
179
+ */
180
+ function buildScale(prefix, start, end, steps) {
181
+ const colors = interpolateColors(start, end, steps);
182
+ const map = {};
183
+ for (const step of steps) {
184
+ const key = step === 0 ? `${prefix}-00` : `${prefix}-${step}`;
185
+ map[key] = colors[step];
186
+ }
187
+ return map;
188
+ }
189
+ /** Mix two colors linearly in RGB. weight 0 -> colorA, 1 -> colorB */
190
+ function mix(colorA, colorB, weight) {
191
+ const a = hexToRgb(colorA);
192
+ const b = hexToRgb(colorB);
193
+ const w = Math.max(0, Math.min(1, weight));
194
+ return rgbToHex([
195
+ a[0] * (1 - w) + b[0] * w,
196
+ a[1] * (1 - w) + b[1] * w,
197
+ a[2] * (1 - w) + b[2] * w
198
+ ]);
199
+ }
200
+ /**
201
+ * Semantic weight maps — tuned to approximate the original hand-picked palettes
202
+ * while staying deterministic. Light steps (<500) are tints (white -> base),
203
+ * dark steps (>500) are shades (base -> black). Values are intentionally
204
+ * shared across all presets for consistency; per-preset drift vs. hand-picked
205
+ * is typically <= 8 per channel.
206
+ */
207
+ const DEEPSEEK_WEIGHTS = {
208
+ 50: .08,
209
+ 100: .15,
210
+ 200: .32,
211
+ 300: .52,
212
+ 400: .78,
213
+ 450: .88,
214
+ 500: 1,
215
+ 600: .82,
216
+ 800: .55,
217
+ 900: .35
218
+ };
219
+ const BLUE_WEIGHTS = {
220
+ 50: .08,
221
+ 100: .15,
222
+ 300: .52,
223
+ 400: .78,
224
+ 450: .88,
225
+ 500: 1,
226
+ 600: .82,
227
+ 800: .55,
228
+ 900: .35
229
+ };
230
+ const BLUE_EXTRA_WEIGHTS = {
231
+ "50p": .1,
232
+ "75": .12,
233
+ "950": .25
234
+ };
235
+ const GREEN_WEIGHTS = {
236
+ 100: .15,
237
+ 400: .78,
238
+ 500: 1,
239
+ 900: .35
240
+ };
241
+ const AMBER_WEIGHTS = {
242
+ 100: .15,
243
+ 400: .78,
244
+ 500: 1,
245
+ 600: .82,
246
+ 900: .35
247
+ };
248
+ const RED_WEIGHTS = {
249
+ 50: .08,
250
+ 100: .15,
251
+ 400: .78,
252
+ 500: 1,
253
+ 600: .82,
254
+ 900: .35
255
+ };
256
+ function buildTintShadeScale(prefix, base, steps, weights) {
257
+ const map = {};
258
+ for (const step of steps) {
259
+ const w = weights[step];
260
+ if (w === void 0) continue;
261
+ const color = step === 500 || step === "500" ? base.toUpperCase() : typeof step === "number" && step > 500 || step === "950" ? mix("#000000", base, w) : mix("#FFFFFF", base, w);
262
+ map[`${prefix}-${step}`] = color;
263
+ }
264
+ return map;
265
+ }
266
+ function buildDeepseekScale(base) {
267
+ return buildTintShadeScale("--dsw-static-deepseek", base, DEEPSEEK_STEPS, DEEPSEEK_WEIGHTS);
268
+ }
269
+ function buildBlueScale(base) {
270
+ const main = buildTintShadeScale("--dsw-static-blue", base, BLUE_STEPS, BLUE_WEIGHTS);
271
+ const extra = buildTintShadeScale("--dsw-static-blue", base, BLUE_EXTRA_STEPS, BLUE_EXTRA_WEIGHTS);
272
+ return {
273
+ ...main,
274
+ ...extra
275
+ };
276
+ }
277
+ function buildGreenScale(base) {
278
+ return buildTintShadeScale("--dsw-static-green", base, GREEN_STEPS, GREEN_WEIGHTS);
279
+ }
280
+ function buildAmberScale(base) {
281
+ return buildTintShadeScale("--dsw-static-amber", base, AMBER_STEPS, AMBER_WEIGHTS);
282
+ }
283
+ function buildRedScale(base) {
284
+ return buildTintShadeScale("--dsw-static-red", base, RED_STEPS, RED_WEIGHTS);
285
+ }
286
+ /** Convenience: build all semantic scales from 5 base colors (500 values) */
287
+ function buildSemanticScales(opts) {
288
+ return {
289
+ ...buildDeepseekScale(opts.deepseek),
290
+ ...buildBlueScale(opts.blue),
291
+ ...buildGreenScale(opts.green),
292
+ ...buildAmberScale(opts.amber),
293
+ ...buildRedScale(opts.red),
294
+ "--dsw-static-deepseek-700-delete": mix("#000000", opts.deepseek, .7)
295
+ };
296
+ }
297
+ //#endregion
298
+ //#region src/client/presets/ayu.ts
299
+ const bluish$12 = buildScale("--dsw-static-neutral-bluish", "#FAFAFA", "#0D1017", BLUISH_STEPS);
300
+ const neutral$12 = buildScale("--dsw-static-neutral", "#FAFAFA", "#0F1419", NEUTRAL_STEPS);
301
+ const lightSemantic$12 = buildSemanticScales({
302
+ deepseek: "#4AA8C8",
303
+ blue: "#4AA8C8",
304
+ green: "#5FB978",
305
+ amber: "#EA9F41",
306
+ red: "#E6656A"
307
+ });
308
+ const darkSemantic$12 = buildSemanticScales({
309
+ deepseek: "#3FB7E3",
310
+ blue: "#3FB7E3",
311
+ green: "#78D05C",
312
+ amber: "#E4A75C",
313
+ red: "#F58572"
314
+ });
315
+ const ayu = {
316
+ label: "Ayu",
317
+ light: {
318
+ ...bluish$12,
319
+ ...neutral$12,
320
+ ...lightSemantic$12,
321
+ "--shiki-token-constant": "#A37ACC",
322
+ "--shiki-token-string": "#6F8F00",
323
+ "--shiki-token-comment": "#6E7681",
324
+ "--shiki-token-keyword": "#C76A1A",
325
+ "--shiki-token-parameter": "#B87500",
326
+ "--shiki-token-function": "#227FC0",
327
+ "--shiki-token-string-expression": "#6F8F00",
328
+ "--shiki-token-punctuation": "#4F5964",
329
+ "--shiki-token-link": "#2F86B7"
78
330
  },
79
- onedark: {
80
- label: "One Dark",
81
- light: {
82
- base: "#ffffff",
83
- l1: "#f8f9fb",
84
- l2: "#eef1f5",
85
- l3: "#e4e8ef",
86
- overlay: "#ffffff",
87
- b1: "#e4e8ef",
88
- b2: "#d1d7e0",
89
- brand: "#4078f2",
90
- lp: "#383a42",
91
- ls: "#6c7086",
92
- err: "#e45649",
93
- ok: "#50a14f",
94
- warn: "#c18401",
95
- side: "#f8f9fb"
96
- },
97
- dark: {
98
- base: "#1e2127",
99
- l1: "#282c34",
100
- l2: "#2c313a",
101
- l3: "#353b48",
102
- overlay: "#1d2026",
103
- b1: "#3e4451",
104
- b2: "#4b5263",
105
- brand: "#61afef",
106
- lp: "#abb2bf",
107
- ls: "#7f848e",
108
- err: "#e06c75",
109
- ok: "#98c379",
110
- warn: "#e5c07b",
111
- side: "#1e2127"
112
- }
331
+ dark: {
332
+ ...bluish$12,
333
+ ...neutral$12,
334
+ ...darkSemantic$12,
335
+ "--shiki-token-constant": "#D2A6FF",
336
+ "--shiki-token-string": "#AAD94C",
337
+ "--shiki-token-comment": "#5A6673",
338
+ "--shiki-token-keyword": "#FF8F40",
339
+ "--shiki-token-parameter": "#FFB454",
340
+ "--shiki-token-function": "#59C2FF",
341
+ "--shiki-token-string-expression": "#AAD94C",
342
+ "--shiki-token-punctuation": "#D6DAE0",
343
+ "--shiki-token-link": "#39BAE6"
344
+ }
345
+ };
346
+ //#endregion
347
+ //#region src/client/presets/catppuccin.ts
348
+ const bluish$11 = buildScale("--dsw-static-neutral-bluish", "#eff1f5", "#1e1e2e", BLUISH_STEPS);
349
+ const neutral$11 = buildScale("--dsw-static-neutral", "#eff1f5", "#1e1e2e", NEUTRAL_STEPS);
350
+ const lightSemantic$11 = buildSemanticScales({
351
+ deepseek: "#7287FD",
352
+ blue: "#7287FD",
353
+ green: "#40A02B",
354
+ amber: "#DF8E1D",
355
+ red: "#D20F39"
356
+ });
357
+ const darkSemantic$11 = buildSemanticScales({
358
+ deepseek: "#B4BEFE",
359
+ blue: "#B4BEFE",
360
+ green: "#A6D189",
361
+ amber: "#F4B8E4",
362
+ red: "#F38BA8"
363
+ });
364
+ const catppuccin = {
365
+ label: "Catppuccin",
366
+ light: {
367
+ ...bluish$11,
368
+ ...neutral$11,
369
+ ...lightSemantic$11,
370
+ "--shiki-token-constant": "#CA6702",
371
+ "--shiki-token-string": "#40A02B",
372
+ "--shiki-token-comment": "#6C7086",
373
+ "--shiki-token-keyword": "#8839EF",
374
+ "--shiki-token-parameter": "#1E66F5",
375
+ "--shiki-token-function": "#7287FD",
376
+ "--shiki-token-string-expression": "#40A02B",
377
+ "--shiki-token-punctuation": "#5C5F77",
378
+ "--shiki-token-link": "#04A5E5"
113
379
  },
114
- github: {
115
- label: "GitHub",
116
- light: {
117
- base: "#ffffff",
118
- l1: "#f6f8fa",
119
- l2: "#eef1f4",
120
- l3: "#e6eaf0",
121
- overlay: "#ffffff",
122
- b1: "#d0d7de",
123
- b2: "#b7c0cc",
124
- brand: "#0969da",
125
- lp: "#24292f",
126
- ls: "#656d76",
127
- err: "#cf222e",
128
- ok: "#1a7f37",
129
- warn: "#9a6700",
130
- side: "#f6f8fa"
131
- },
132
- dark: {
133
- base: "#010409",
134
- l1: "#0d1117",
135
- l2: "#161b22",
136
- l3: "#21262d",
137
- overlay: "#161b22",
138
- b1: "#30363d",
139
- b2: "#3d444d",
140
- brand: "#58a6ff",
141
- lp: "#e6edf3",
142
- ls: "#9198a1",
143
- err: "#f85149",
144
- ok: "#3fb950",
145
- warn: "#d29922",
146
- side: "#010409"
147
- }
380
+ dark: {
381
+ ...bluish$11,
382
+ ...neutral$11,
383
+ ...darkSemantic$11,
384
+ "--shiki-token-constant": "#FAB387",
385
+ "--shiki-token-string": "#A6D189",
386
+ "--shiki-token-comment": "#6C7086",
387
+ "--shiki-token-keyword": "#CBA6F7",
388
+ "--shiki-token-parameter": "#89B4FA",
389
+ "--shiki-token-function": "#B4BEFE",
390
+ "--shiki-token-string-expression": "#A6D189",
391
+ "--shiki-token-punctuation": "#CDD6F4",
392
+ "--shiki-token-link": "#89DCEB"
393
+ }
394
+ };
395
+ //#endregion
396
+ //#region src/client/presets/dracula.ts
397
+ const bluish$10 = buildScale("--dsw-static-neutral-bluish", "#FAFAFA", "#282a36", BLUISH_STEPS);
398
+ const neutral$10 = buildScale("--dsw-static-neutral", "#FAFAFA", "#282a36", NEUTRAL_STEPS);
399
+ const lightSemantic$10 = buildSemanticScales({
400
+ deepseek: "#7C3AED",
401
+ blue: "#7C3AED",
402
+ green: "#2A9D4A",
403
+ amber: "#B78100",
404
+ red: "#E63C3C"
405
+ });
406
+ const darkSemantic$10 = buildSemanticScales({
407
+ deepseek: "#BD93F9",
408
+ blue: "#BD93F9",
409
+ green: "#50FA7B",
410
+ amber: "#F1FA8C",
411
+ red: "#FF5555"
412
+ });
413
+ const dracula = {
414
+ label: "Dracula",
415
+ light: {
416
+ ...bluish$10,
417
+ ...neutral$10,
418
+ ...lightSemantic$10,
419
+ "--shiki-token-constant": "#6A3FB5",
420
+ "--shiki-token-string": "#1A7A3A",
421
+ "--shiki-token-comment": "#6D7A9E",
422
+ "--shiki-token-keyword": "#A21CAF",
423
+ "--shiki-token-parameter": "#B45309",
424
+ "--shiki-token-function": "#7C3AED",
425
+ "--shiki-token-string-expression": "#1A7A3A",
426
+ "--shiki-token-punctuation": "#44475A",
427
+ "--shiki-token-link": "#7C3AED"
148
428
  },
149
- catppuccin: {
150
- label: "Catppuccin",
151
- light: {
152
- base: "#ffffff",
153
- l1: "#eff1f5",
154
- l2: "#e6e9ef",
155
- l3: "#dce0e8",
156
- overlay: "#eff1f5",
157
- b1: "#ccd0da",
158
- b2: "#bcc0cc",
159
- brand: "#1e66f5",
160
- lp: "#4c4f69",
161
- ls: "#5c5f77",
162
- err: "#d20f39",
163
- ok: "#40a02b",
164
- warn: "#df8e1d",
165
- side: "#eff1f5"
166
- },
167
- dark: {
168
- base: "#1e1e2e",
169
- l1: "#313244",
170
- l2: "#414558",
171
- l3: "#45475a",
172
- overlay: "#313244",
173
- b1: "#45475a",
174
- b2: "#585b70",
175
- brand: "#89b4fa",
176
- lp: "#cdd6f4",
177
- ls: "#a6adc8",
178
- err: "#f38ba8",
179
- ok: "#a6e3a1",
180
- warn: "#f9e2af",
181
- side: "#1e1e2e"
182
- }
429
+ dark: {
430
+ ...bluish$10,
431
+ ...neutral$10,
432
+ ...darkSemantic$10,
433
+ "--shiki-token-constant": "#8BE9FD",
434
+ "--shiki-token-string": "#50FA7B",
435
+ "--shiki-token-comment": "#99A3C4",
436
+ "--shiki-token-keyword": "#FF79C6",
437
+ "--shiki-token-parameter": "#FFB86C",
438
+ "--shiki-token-function": "#BD93F9",
439
+ "--shiki-token-string-expression": "#50FA7B",
440
+ "--shiki-token-punctuation": "#F8F8F2",
441
+ "--shiki-token-link": "#BD93F9"
442
+ }
443
+ };
444
+ //#endregion
445
+ //#region src/client/presets/dsh.ts
446
+ const bluish$9 = buildScale("--dsw-static-neutral-bluish", "#FFFFFF", "#0F1115", BLUISH_STEPS);
447
+ const neutral$9 = buildScale("--dsw-static-neutral", "#FFFFFF", "#000000", NEUTRAL_STEPS);
448
+ const lightSemantic$9 = buildSemanticScales({
449
+ deepseek: "#4176E6",
450
+ blue: "#3B82F6",
451
+ green: "#22C55E",
452
+ amber: "#F59E0B",
453
+ red: "#EF4444"
454
+ });
455
+ const darkSemantic$9 = buildSemanticScales({
456
+ deepseek: "#4176E6",
457
+ blue: "#3B82F6",
458
+ green: "#22C55E",
459
+ amber: "#F59E0B",
460
+ red: "#EF4444"
461
+ });
462
+ const dsh = {
463
+ label: "DSH",
464
+ light: {
465
+ ...bluish$9,
466
+ ...neutral$9,
467
+ ...lightSemantic$9
183
468
  },
184
- dracula: {
185
- label: "Dracula",
186
- light: {
187
- base: "#ffffff",
188
- l1: "#f8f8f2",
189
- l2: "#f1f2f8",
190
- l3: "#e9eaf3",
191
- overlay: "#ffffff",
192
- b1: "#d0d3e6",
193
- b2: "#b8bccc",
194
- brand: "#7c3aed",
195
- lp: "#282a36",
196
- ls: "#6272a4",
197
- err: "#e63c3c",
198
- ok: "#2a9d4a",
199
- warn: "#b78100",
200
- side: "#f8f8f2"
201
- },
202
- dark: {
203
- base: "#282a36",
204
- l1: "#343746",
205
- l2: "#44475a",
206
- l3: "#52556c",
207
- overlay: "#343746",
208
- b1: "#6272a4",
209
- b2: "#7a86b8",
210
- brand: "#bd93f9",
211
- lp: "#f8f8f2",
212
- ls: "#bfc0d6",
213
- err: "#ff5555",
214
- ok: "#50fa7b",
215
- warn: "#f1fa8c",
216
- side: "#282a36"
217
- }
469
+ dark: {
470
+ ...bluish$9,
471
+ ...neutral$9,
472
+ ...darkSemantic$9
473
+ }
474
+ };
475
+ //#endregion
476
+ //#region src/client/presets/github.ts
477
+ const bluish$8 = buildScale("--dsw-static-neutral-bluish", "#ffffff", "#0d1117", BLUISH_STEPS);
478
+ const neutral$8 = buildScale("--dsw-static-neutral", "#ffffff", "#0d1117", NEUTRAL_STEPS);
479
+ const lightSemantic$8 = buildSemanticScales({
480
+ deepseek: "#0969da",
481
+ blue: "#0969da",
482
+ green: "#1A7F37",
483
+ amber: "#9A6700",
484
+ red: "#CF222E"
485
+ });
486
+ const darkSemantic$8 = buildSemanticScales({
487
+ deepseek: "#58A6FF",
488
+ blue: "#58A6FF",
489
+ green: "#3FB950",
490
+ amber: "#D29922",
491
+ red: "#F85149"
492
+ });
493
+ const github = {
494
+ label: "GitHub",
495
+ light: {
496
+ ...bluish$8,
497
+ ...neutral$8,
498
+ ...lightSemantic$8,
499
+ "--shiki-token-constant": "#0550AE",
500
+ "--shiki-token-string": "#0A3069",
501
+ "--shiki-token-comment": "#6E7781",
502
+ "--shiki-token-keyword": "#CF222E",
503
+ "--shiki-token-parameter": "#953800",
504
+ "--shiki-token-function": "#8250DF",
505
+ "--shiki-token-string-expression": "#1A7F37",
506
+ "--shiki-token-punctuation": "#656D76",
507
+ "--shiki-token-link": "#0969DA"
218
508
  },
219
- tokyonight: {
220
- label: "Tokyo Night",
221
- light: {
222
- base: "#ffffff",
223
- l1: "#f7f8fb",
224
- l2: "#e9eaf2",
225
- l3: "#dfe2f0",
226
- overlay: "#ffffff",
227
- b1: "#cbd0e3",
228
- b2: "#b4b9cc",
229
- brand: "#34548a",
230
- lp: "#1a1b26",
231
- ls: "#5a638c",
232
- err: "#c53b53",
233
- ok: "#33635c",
234
- warn: "#8f5e15",
235
- side: "#f7f8fb"
236
- },
237
- dark: {
238
- base: "#1a1b26",
239
- l1: "#24283b",
240
- l2: "#2f354e",
241
- l3: "#414868",
242
- overlay: "#24283b",
243
- b1: "#414868",
244
- b2: "#5a638c",
245
- brand: "#7aa2f7",
246
- lp: "#c0caf5",
247
- ls: "#9aa1bf",
248
- err: "#f7768e",
249
- ok: "#9ece6a",
250
- warn: "#e0af68",
251
- side: "#1a1b26"
252
- }
509
+ dark: {
510
+ ...bluish$8,
511
+ ...neutral$8,
512
+ ...darkSemantic$8,
513
+ "--shiki-token-constant": "#79C0FF",
514
+ "--shiki-token-string": "#A5D6FF",
515
+ "--shiki-token-comment": "#8B949E",
516
+ "--shiki-token-keyword": "#FF7B72",
517
+ "--shiki-token-parameter": "#FFA657",
518
+ "--shiki-token-function": "#D2A8FF",
519
+ "--shiki-token-string-expression": "#7EE787",
520
+ "--shiki-token-punctuation": "#8B949E",
521
+ "--shiki-token-link": "#58A6FF"
522
+ }
523
+ };
524
+ //#endregion
525
+ //#region src/client/presets/gruvbox.ts
526
+ const bluish$7 = buildScale("--dsw-static-neutral-bluish", "#fbf1c7", "#282828", BLUISH_STEPS);
527
+ const neutral$7 = buildScale("--dsw-static-neutral", "#fbf1c7", "#282828", NEUTRAL_STEPS);
528
+ const lightSemantic$7 = buildSemanticScales({
529
+ deepseek: "#076678",
530
+ blue: "#076678",
531
+ green: "#98971A",
532
+ amber: "#D79921",
533
+ red: "#CC241D"
534
+ });
535
+ const darkSemantic$7 = buildSemanticScales({
536
+ deepseek: "#83A598",
537
+ blue: "#83A598",
538
+ green: "#B8BB26",
539
+ amber: "#FABD2F",
540
+ red: "#FB4934"
541
+ });
542
+ const gruvbox = {
543
+ label: "Gruvbox",
544
+ light: {
545
+ ...bluish$7,
546
+ ...neutral$7,
547
+ ...lightSemantic$7,
548
+ "--shiki-token-constant": "#076678",
549
+ "--shiki-token-string": "#79740E",
550
+ "--shiki-token-comment": "#928374",
551
+ "--shiki-token-keyword": "#9D0006",
552
+ "--shiki-token-parameter": "#AF3A03",
553
+ "--shiki-token-function": "#076678",
554
+ "--shiki-token-string-expression": "#79740E",
555
+ "--shiki-token-punctuation": "#504945",
556
+ "--shiki-token-link": "#076678"
253
557
  },
254
- solarized: {
255
- label: "Solarized",
256
- light: {
257
- base: "#fdf6e3",
258
- l1: "#eee8d5",
259
- l2: "#e7dfc8",
260
- l3: "#d9d2b8",
261
- overlay: "#eee8d5",
262
- b1: "#93a1a1",
263
- b2: "#839496",
264
- brand: "#268bd2",
265
- lp: "#586e75",
266
- ls: "#657b83",
267
- err: "#dc322f",
268
- ok: "#859900",
269
- warn: "#b58900",
270
- side: "#fdf6e3"
271
- },
272
- dark: {
273
- base: "#002b36",
274
- l1: "#073642",
275
- l2: "#0e4654",
276
- l3: "#204e5b",
277
- overlay: "#073642",
278
- b1: "#586e75",
279
- b2: "#657b83",
280
- brand: "#268bd2",
281
- lp: "#fdf6e3",
282
- ls: "#93a1a1",
283
- err: "#dc322f",
284
- ok: "#859900",
285
- warn: "#b58900",
286
- side: "#002b36"
287
- }
558
+ dark: {
559
+ ...bluish$7,
560
+ ...neutral$7,
561
+ ...darkSemantic$7,
562
+ "--shiki-token-constant": "#83A598",
563
+ "--shiki-token-string": "#B8BB26",
564
+ "--shiki-token-comment": "#B1A69B",
565
+ "--shiki-token-keyword": "#FB4934",
566
+ "--shiki-token-parameter": "#FE8019",
567
+ "--shiki-token-function": "#FABD2F",
568
+ "--shiki-token-string-expression": "#B8BB26",
569
+ "--shiki-token-punctuation": "#EBDBB2",
570
+ "--shiki-token-link": "#83A598"
571
+ }
572
+ };
573
+ //#endregion
574
+ //#region src/client/presets/monokai.ts
575
+ const bluish$6 = buildScale("--dsw-static-neutral-bluish", "#fcfcfa", "#2d2a2e", BLUISH_STEPS);
576
+ const neutral$6 = buildScale("--dsw-static-neutral", "#fcfcfa", "#2d2a2e", NEUTRAL_STEPS);
577
+ const lightSemantic$6 = buildSemanticScales({
578
+ deepseek: "#6B42A0",
579
+ blue: "#6B42A0",
580
+ green: "#5A8A2A",
581
+ amber: "#B87A00",
582
+ red: "#FF6188"
583
+ });
584
+ const darkSemantic$6 = buildSemanticScales({
585
+ deepseek: "#AB9DF2",
586
+ blue: "#AB9DF2",
587
+ green: "#A9DC76",
588
+ amber: "#FFD866",
589
+ red: "#FF9DB5"
590
+ });
591
+ const monokai = {
592
+ label: "Monokai",
593
+ light: {
594
+ ...bluish$6,
595
+ ...neutral$6,
596
+ ...lightSemantic$6,
597
+ "--shiki-token-constant": "#6B42A0",
598
+ "--shiki-token-string": "#2A7A2A",
599
+ "--shiki-token-comment": "#8A8A8A",
600
+ "--shiki-token-keyword": "#C4265E",
601
+ "--shiki-token-parameter": "#B45A00",
602
+ "--shiki-token-function": "#6B42A0",
603
+ "--shiki-token-string-expression": "#2A7A2A",
604
+ "--shiki-token-punctuation": "#5B5956",
605
+ "--shiki-token-link": "#6B42A0"
288
606
  },
289
- gruvbox: {
290
- label: "Gruvbox",
291
- light: {
292
- base: "#fbf1c7",
293
- l1: "#ebdbb2",
294
- l2: "#d5c4a1",
295
- l3: "#bdae93",
296
- overlay: "#ebdbb2",
297
- b1: "#a89984",
298
- b2: "#928374",
299
- brand: "#076678",
300
- lp: "#3c3836",
301
- ls: "#504945",
302
- err: "#cc241d",
303
- ok: "#98971a",
304
- warn: "#d79921",
305
- side: "#fbf1c7"
306
- },
307
- dark: {
308
- base: "#282828",
309
- l1: "#3c3836",
310
- l2: "#504945",
311
- l3: "#665c54",
312
- overlay: "#3c3836",
313
- b1: "#7c6f64",
314
- b2: "#928374",
315
- brand: "#83a598",
316
- lp: "#ebdbb2",
317
- ls: "#d5c4a1",
318
- err: "#fb4934",
319
- ok: "#b8bb26",
320
- warn: "#fabd2f",
321
- side: "#282828"
322
- }
607
+ dark: {
608
+ ...bluish$6,
609
+ ...neutral$6,
610
+ ...darkSemantic$6,
611
+ "--shiki-token-constant": "#AB9DF2",
612
+ "--shiki-token-string": "#A9DC76",
613
+ "--shiki-token-comment": "#A9A8A7",
614
+ "--shiki-token-keyword": "#FF6188",
615
+ "--shiki-token-parameter": "#FC9867",
616
+ "--shiki-token-function": "#78DCE8",
617
+ "--shiki-token-string-expression": "#A9DC76",
618
+ "--shiki-token-punctuation": "#FCFCFA",
619
+ "--shiki-token-link": "#AB9DF2"
620
+ }
621
+ };
622
+ //#endregion
623
+ //#region src/client/presets/nord.ts
624
+ const bluish$5 = buildScale("--dsw-static-neutral-bluish", "#D8DEE9", "#2E3440", BLUISH_STEPS);
625
+ const neutral$5 = buildScale("--dsw-static-neutral", "#D8DEE9", "#2E3440", NEUTRAL_STEPS);
626
+ const lightSemantic$5 = buildSemanticScales({
627
+ deepseek: "#5E81AC",
628
+ blue: "#5E81AC",
629
+ green: "#A3BE8C",
630
+ amber: "#EBCB8B",
631
+ red: "#BF616A"
632
+ });
633
+ const darkSemantic$5 = buildSemanticScales({
634
+ deepseek: "#88C0D0",
635
+ blue: "#88C0D0",
636
+ green: "#C6D7B8",
637
+ amber: "#F3DFB7",
638
+ red: "#D79DA3"
639
+ });
640
+ const nord = {
641
+ label: "Nord",
642
+ light: {
643
+ ...bluish$5,
644
+ ...neutral$5,
645
+ ...lightSemantic$5,
646
+ "--shiki-token-constant": "#2E6EA6",
647
+ "--shiki-token-string": "#3D7A1F",
648
+ "--shiki-token-comment": "#6C7A8E",
649
+ "--shiki-token-keyword": "#8B4A9A",
650
+ "--shiki-token-parameter": "#9A5D2E",
651
+ "--shiki-token-function": "#2F6F8A",
652
+ "--shiki-token-string-expression": "#3D7A1F",
653
+ "--shiki-token-punctuation": "#4C566A",
654
+ "--shiki-token-link": "#5E81AC"
323
655
  },
324
- monokai: {
325
- label: "Monokai",
326
- light: {
327
- base: "#ffffff",
328
- l1: "#f9f8f5",
329
- l2: "#ebe8e3",
330
- l3: "#ddd8d0",
331
- overlay: "#f9f8f5",
332
- b1: "#c7c0b3",
333
- b2: "#a8a194",
334
- brand: "#6b42a0",
335
- lp: "#2d2a2e",
336
- ls: "#5b5956",
337
- err: "#ff6188",
338
- ok: "#5a8a2a",
339
- warn: "#b87a00",
340
- side: "#f9f8f5"
341
- },
342
- dark: {
343
- base: "#2d2a2e",
344
- l1: "#403e41",
345
- l2: "#5b5956",
346
- l3: "#69676c",
347
- overlay: "#403e41",
348
- b1: "#7a7978",
349
- b2: "#948d8a",
350
- brand: "#ab9df2",
351
- lp: "#fcfcfa",
352
- ls: "#c1c0c0",
353
- err: "#ff6188",
354
- ok: "#a9dc76",
355
- warn: "#ffd866",
356
- side: "#2d2a2e"
357
- }
656
+ dark: {
657
+ ...bluish$5,
658
+ ...neutral$5,
659
+ ...darkSemantic$5,
660
+ "--shiki-token-constant": "#8BE9FD",
661
+ "--shiki-token-string": "#A3BE8C",
662
+ "--shiki-token-comment": "#99A3C4",
663
+ "--shiki-token-keyword": "#FF79C6",
664
+ "--shiki-token-parameter": "#D08770",
665
+ "--shiki-token-function": "#88C0D0",
666
+ "--shiki-token-string-expression": "#A3BE8C",
667
+ "--shiki-token-punctuation": "#8CA0B8",
668
+ "--shiki-token-link": "#88C0D0"
669
+ }
670
+ };
671
+ //#endregion
672
+ //#region src/client/presets/onedark.ts
673
+ const bluish$4 = buildScale("--dsw-static-neutral-bluish", "#FAFAFA", "#383A42", BLUISH_STEPS);
674
+ const neutral$4 = buildScale("--dsw-static-neutral", "#FAFAFA", "#383A42", NEUTRAL_STEPS);
675
+ const lightSemantic$4 = buildSemanticScales({
676
+ deepseek: "#4078F2",
677
+ blue: "#4078F2",
678
+ green: "#50A14F",
679
+ amber: "#C18401",
680
+ red: "#E45649"
681
+ });
682
+ const darkSemantic$4 = buildSemanticScales({
683
+ deepseek: "#61AFEF",
684
+ blue: "#61AFEF",
685
+ green: "#98C379",
686
+ amber: "#E5C07B",
687
+ red: "#E06C75"
688
+ });
689
+ const onedark = {
690
+ label: "One Dark",
691
+ light: {
692
+ ...bluish$4,
693
+ ...neutral$4,
694
+ ...lightSemantic$4,
695
+ "--shiki-token-constant": "#0B7EA4",
696
+ "--shiki-token-string": "#1F7A3A",
697
+ "--shiki-token-comment": "#76808F",
698
+ "--shiki-token-keyword": "#A626A4",
699
+ "--shiki-token-parameter": "#986801",
700
+ "--shiki-token-function": "#4078F2",
701
+ "--shiki-token-string-expression": "#1F7A3A",
702
+ "--shiki-token-punctuation": "#5C6370",
703
+ "--shiki-token-link": "#4078F2"
358
704
  },
359
- rosepine: {
360
- label: "Rosé Pine",
361
- light: {
362
- base: "#faf4ed",
363
- l1: "#fffaf3",
364
- l2: "#f2e9e1",
365
- l3: "#e8ddd3",
366
- overlay: "#fffaf3",
367
- b1: "#cecacd",
368
- b2: "#9893a5",
369
- brand: "#907aa9",
370
- lp: "#575279",
371
- ls: "#6e6a86",
372
- err: "#b4637a",
373
- ok: "#286983",
374
- warn: "#ea9d34",
375
- side: "#faf4ed"
376
- },
377
- dark: {
378
- base: "#191724",
379
- l1: "#1f1d2e",
380
- l2: "#26233a",
381
- l3: "#353142",
382
- overlay: "#1f1d2e",
383
- b1: "#6e6a86",
384
- b2: "#908caa",
385
- brand: "#c4a7e7",
386
- lp: "#e0def4",
387
- ls: "#908caa",
388
- err: "#eb6f92",
389
- ok: "#9ccfd8",
390
- warn: "#f6c177",
391
- side: "#191724"
392
- }
705
+ dark: {
706
+ ...bluish$4,
707
+ ...neutral$4,
708
+ ...darkSemantic$4,
709
+ "--shiki-token-constant": "#56B6C2",
710
+ "--shiki-token-string": "#98C379",
711
+ "--shiki-token-comment": "#A0A6B0",
712
+ "--shiki-token-keyword": "#C678DD",
713
+ "--shiki-token-parameter": "#D19A66",
714
+ "--shiki-token-function": "#61AFEF",
715
+ "--shiki-token-string-expression": "#98C379",
716
+ "--shiki-token-punctuation": "#ABB2BF",
717
+ "--shiki-token-link": "#61AFEF"
718
+ }
719
+ };
720
+ //#endregion
721
+ //#region src/client/presets/rosepine.ts
722
+ const bluish$3 = buildScale("--dsw-static-neutral-bluish", "#faf4ed", "#191724", BLUISH_STEPS);
723
+ const neutral$3 = buildScale("--dsw-static-neutral", "#faf4ed", "#191724", NEUTRAL_STEPS);
724
+ const lightSemantic$3 = buildSemanticScales({
725
+ deepseek: "#907AA9",
726
+ blue: "#907AA9",
727
+ green: "#286983",
728
+ amber: "#EA9D34",
729
+ red: "#B4637A"
730
+ });
731
+ const darkSemantic$3 = buildSemanticScales({
732
+ deepseek: "#C4A7E7",
733
+ blue: "#C4A7E7",
734
+ green: "#9CCFD8",
735
+ amber: "#F6C177",
736
+ red: "#EB6F92"
737
+ });
738
+ const rosepine = {
739
+ label: "Rosé Pine",
740
+ light: {
741
+ ...bluish$3,
742
+ ...neutral$3,
743
+ ...lightSemantic$3,
744
+ "--shiki-token-constant": "#56949F",
745
+ "--shiki-token-string": "#286983",
746
+ "--shiki-token-comment": "#9893A5",
747
+ "--shiki-token-keyword": "#907AA9",
748
+ "--shiki-token-parameter": "#B4637A",
749
+ "--shiki-token-function": "#907AA9",
750
+ "--shiki-token-string-expression": "#286983",
751
+ "--shiki-token-punctuation": "#575279",
752
+ "--shiki-token-link": "#907AA9"
393
753
  },
394
- ayu: {
395
- label: "Ayu",
396
- light: {
397
- base: "#fafafa",
398
- l1: "#f3f4f5",
399
- l2: "#eaecee",
400
- l3: "#e1e4e8",
401
- overlay: "#f3f4f5",
402
- b1: "#c4c9d0",
403
- b2: "#a8b0bb",
404
- brand: "#55b4d4",
405
- lp: "#5c6773",
406
- ls: "#5c6773",
407
- err: "#e65050",
408
- ok: "#86b300",
409
- warn: "#fa8d3e",
410
- side: "#fafafa"
411
- },
412
- dark: {
413
- base: "#0a0e14",
414
- l1: "#1f2430",
415
- l2: "#242a38",
416
- l3: "#3e4b5c",
417
- overlay: "#1f2430",
418
- b1: "#5c6773",
419
- b2: "#7a8a9b",
420
- brand: "#39bae6",
421
- lp: "#c5cddb",
422
- ls: "#95a0b0",
423
- err: "#ff3333",
424
- ok: "#7fd962",
425
- warn: "#ffb454",
426
- side: "#0a0e14"
427
- }
754
+ dark: {
755
+ ...bluish$3,
756
+ ...neutral$3,
757
+ ...darkSemantic$3,
758
+ "--shiki-token-constant": "#9CCFD8",
759
+ "--shiki-token-string": "#EBBCBA",
760
+ "--shiki-token-comment": "#A19EB0",
761
+ "--shiki-token-keyword": "#C4A7E7",
762
+ "--shiki-token-parameter": "#EB6F92",
763
+ "--shiki-token-function": "#E0DEF4",
764
+ "--shiki-token-string-expression": "#EBBCBA",
765
+ "--shiki-token-punctuation": "#E0DEF4",
766
+ "--shiki-token-link": "#C4A7E7"
767
+ }
768
+ };
769
+ //#endregion
770
+ //#region src/client/presets/solarized.ts
771
+ const bluish$2 = buildScale("--dsw-static-neutral-bluish", "#fdf6e3", "#002b36", BLUISH_STEPS);
772
+ const neutral$2 = buildScale("--dsw-static-neutral", "#fdf6e3", "#002b36", NEUTRAL_STEPS);
773
+ const lightSemantic$2 = buildSemanticScales({
774
+ deepseek: "#268BD2",
775
+ blue: "#268BD2",
776
+ green: "#859900",
777
+ amber: "#B58900",
778
+ red: "#DC322F"
779
+ });
780
+ const darkSemantic$2 = buildSemanticScales({
781
+ deepseek: "#78B7E3",
782
+ blue: "#78B7E3",
783
+ green: "#B3C061",
784
+ amber: "#D1B661",
785
+ red: "#E9807E"
786
+ });
787
+ const solarized = {
788
+ label: "Solarized",
789
+ light: {
790
+ ...bluish$2,
791
+ ...neutral$2,
792
+ ...lightSemantic$2,
793
+ "--shiki-token-constant": "#2AA198",
794
+ "--shiki-token-string": "#586E75",
795
+ "--shiki-token-comment": "#93A1A1",
796
+ "--shiki-token-keyword": "#859900",
797
+ "--shiki-token-parameter": "#CB4B16",
798
+ "--shiki-token-function": "#268BD2",
799
+ "--shiki-token-string-expression": "#2AA198",
800
+ "--shiki-token-punctuation": "#657B83",
801
+ "--shiki-token-link": "#268BD2"
428
802
  },
803
+ dark: {
804
+ ...bluish$2,
805
+ ...neutral$2,
806
+ ...darkSemantic$2,
807
+ "--shiki-token-constant": "#66BBB5",
808
+ "--shiki-token-string": "#859900",
809
+ "--shiki-token-comment": "#92A1A5",
810
+ "--shiki-token-keyword": "#268BD2",
811
+ "--shiki-token-parameter": "#DA7D57",
812
+ "--shiki-token-function": "#B58900",
813
+ "--shiki-token-string-expression": "#66BBB5",
814
+ "--shiki-token-punctuation": "#93A1A1",
815
+ "--shiki-token-link": "#63ABDF"
816
+ }
817
+ };
818
+ //#endregion
819
+ //#region src/client/presets/tokyonight.ts
820
+ const bluish$1 = buildScale("--dsw-static-neutral-bluish", "#e6e7ed", "#1a1b26", BLUISH_STEPS);
821
+ const neutral$1 = buildScale("--dsw-static-neutral", "#e6e7ed", "#1a1b26", NEUTRAL_STEPS);
822
+ const lightSemantic$1 = buildSemanticScales({
823
+ deepseek: "#34548A",
824
+ blue: "#34548A",
825
+ green: "#33635C",
826
+ amber: "#8F5E15",
827
+ red: "#C53B53"
828
+ });
829
+ const darkSemantic$1 = buildSemanticScales({
830
+ deepseek: "#7AA2F7",
831
+ blue: "#7AA2F7",
832
+ green: "#9ECE6A",
833
+ amber: "#E0AF68",
834
+ red: "#F7768E"
835
+ });
836
+ const tokyonight = {
837
+ label: "Tokyo Night",
838
+ light: {
839
+ ...bluish$1,
840
+ ...neutral$1,
841
+ ...lightSemantic$1,
842
+ "--shiki-token-constant": "#0F4B6E",
843
+ "--shiki-token-string": "#1A7A3A",
844
+ "--shiki-token-comment": "#6E7A9E",
845
+ "--shiki-token-keyword": "#8C4351",
846
+ "--shiki-token-parameter": "#965027",
847
+ "--shiki-token-function": "#34548A",
848
+ "--shiki-token-string-expression": "#1A7A3A",
849
+ "--shiki-token-punctuation": "#5A638C",
850
+ "--shiki-token-link": "#34548A"
851
+ },
852
+ dark: {
853
+ ...bluish$1,
854
+ ...neutral$1,
855
+ ...darkSemantic$1,
856
+ "--shiki-token-constant": "#7DCFFF",
857
+ "--shiki-token-string": "#9ECE6A",
858
+ "--shiki-token-comment": "#9197B2",
859
+ "--shiki-token-keyword": "#BB9AF7",
860
+ "--shiki-token-parameter": "#FF9E64",
861
+ "--shiki-token-function": "#7AA2F7",
862
+ "--shiki-token-string-expression": "#9ECE6A",
863
+ "--shiki-token-punctuation": "#C0CAF5",
864
+ "--shiki-token-link": "#7AA2F7"
865
+ }
866
+ };
867
+ //#endregion
868
+ //#region src/client/presets/zenburn.ts
869
+ const bluish = buildScale("--dsw-static-neutral-bluish", "#FFFFEF", "#3f3f3f", BLUISH_STEPS);
870
+ const neutral = buildScale("--dsw-static-neutral", "#FFFFEF", "#3f3f3f", NEUTRAL_STEPS);
871
+ const lightSemantic = buildSemanticScales({
872
+ deepseek: "#2B6F6F",
873
+ blue: "#2B6F6F",
874
+ green: "#4A6F4A",
875
+ amber: "#8F7A3A",
876
+ red: "#8C3333"
877
+ });
878
+ const darkSemantic = buildSemanticScales({
879
+ deepseek: "#8CD0D3",
880
+ blue: "#8CD0D3",
881
+ green: "#7F9F7F",
882
+ amber: "#D0BF8F",
883
+ red: "#CC9393"
884
+ });
885
+ //#endregion
886
+ //#region src/client/presets.ts
887
+ const PRESETS = {
888
+ ayu,
889
+ catppuccin,
890
+ dracula,
891
+ dsh,
892
+ github,
893
+ gruvbox,
894
+ monokai,
895
+ nord,
896
+ onedark,
897
+ rosepine,
898
+ solarized,
899
+ tokyonight,
429
900
  zenburn: {
430
901
  label: "Zenburn",
431
902
  light: {
432
- base: "#ffffef",
433
- l1: "#f6f1e1",
434
- l2: "#ebe3c8",
435
- l3: "#ddd6b8",
436
- overlay: "#f6f1e1",
437
- b1: "#c2b8a3",
438
- b2: "#a8a090",
439
- brand: "#2b6f6f",
440
- lp: "#3f3f3f",
441
- ls: "#5f6f5f",
442
- err: "#8c3333",
443
- ok: "#4a6f4a",
444
- warn: "#8f7a3a",
445
- side: "#ffffef"
903
+ ...bluish,
904
+ ...neutral,
905
+ ...lightSemantic,
906
+ "--shiki-token-constant": "#2B6F6F",
907
+ "--shiki-token-string": "#8C3333",
908
+ "--shiki-token-comment": "#7A8A7A",
909
+ "--shiki-token-keyword": "#705040",
910
+ "--shiki-token-parameter": "#8F5A00",
911
+ "--shiki-token-function": "#2B6F6F",
912
+ "--shiki-token-string-expression": "#8C3333",
913
+ "--shiki-token-punctuation": "#5F6F5F",
914
+ "--shiki-token-link": "#2B6F6F"
446
915
  },
447
916
  dark: {
448
- base: "#3f3f3f",
449
- l1: "#4f4f4f",
450
- l2: "#5f5f5f",
451
- l3: "#6f6f6f",
452
- overlay: "#4f4f4f",
453
- b1: "#7f7f7f",
454
- b2: "#9a9a9a",
455
- brand: "#8cd0d3",
456
- lp: "#dcdccc",
457
- ls: "#9ab0a0",
458
- err: "#cc9393",
459
- ok: "#7f9f7f",
460
- warn: "#d0bf8f",
461
- side: "#3f3f3f"
917
+ ...bluish,
918
+ ...neutral,
919
+ ...darkSemantic,
920
+ "--shiki-token-constant": "#8CD0D3",
921
+ "--shiki-token-string": "#CC9393",
922
+ "--shiki-token-comment": "#7F9F7F",
923
+ "--shiki-token-keyword": "#F0DFAF",
924
+ "--shiki-token-parameter": "#D0BF8F",
925
+ "--shiki-token-function": "#8CD0D3",
926
+ "--shiki-token-string-expression": "#CC9393",
927
+ "--shiki-token-punctuation": "#DCDCCC",
928
+ "--shiki-token-link": "#8CD0D3"
462
929
  }
463
930
  }
464
931
  };
465
- const presetOptions = [
466
- {
467
- value: "native",
468
- label: "DeepSeek Harness"
469
- },
470
- {
471
- value: "ayu",
472
- label: "Ayu"
473
- },
474
- {
475
- value: "catppuccin",
476
- label: "Catppuccin"
477
- },
478
- {
479
- value: "dracula",
480
- label: "Dracula"
481
- },
482
- {
483
- value: "github",
484
- label: "GitHub"
485
- },
486
- {
487
- value: "gruvbox",
488
- label: "Gruvbox"
489
- },
490
- {
491
- value: "monokai",
492
- label: "Monokai"
493
- },
494
- {
495
- value: "nord",
496
- label: "Nord"
497
- },
498
- {
499
- value: "onedark",
500
- label: "One Dark"
501
- },
502
- {
503
- value: "rosepine",
504
- label: "Rosé Pine"
505
- },
506
- {
507
- value: "solarized",
508
- label: "Solarized"
509
- },
510
- {
511
- value: "tokyonight",
512
- label: "Tokyo Night"
513
- },
514
- {
515
- value: "zenburn",
516
- label: "Zenburn"
517
- }
518
- ];
932
+ const presetOptions = [{
933
+ value: "dsh",
934
+ label: PRESETS.dsh.label
935
+ }, ...Object.keys(PRESETS).filter((id) => id !== "dsh").map((id) => ({
936
+ value: id,
937
+ label: PRESETS[id].label
938
+ }))];
519
939
  //#endregion
520
- //#region src/client/colors.ts
521
- function hexLum(hex) {
522
- const h = hex.replace("#", "");
523
- const r = parseInt(h.slice(0, 2), 16);
524
- const g = parseInt(h.slice(2, 4), 16);
525
- const b = parseInt(h.slice(4, 6), 16);
526
- return r * .299 + g * .587 + b * .114;
940
+ //#region src/client/css/primitives.ts
941
+ const PRIMITIVES_LIGHT = {
942
+ "--dsw-static-amber-100": "rgb(254, 245, 231)",
943
+ "--dsw-static-amber-400": "rgb(247, 173, 49)",
944
+ "--dsw-static-amber-500": "rgb(245, 158, 11)",
945
+ "--dsw-static-amber-600": "rgb(221, 134, 41)",
946
+ "--dsw-static-amber-900": "rgb(39, 36, 31)",
947
+ "--dsw-static-blue-100": "rgb(219, 234, 254)",
948
+ "--dsw-static-blue-300": "rgb(147, 197, 253)",
949
+ "--dsw-static-blue-400": "rgb(96, 165, 250)",
950
+ "--dsw-static-blue-450": "rgb(77, 147, 248)",
951
+ "--dsw-static-blue-500": "rgb(59, 130, 246)",
952
+ "--dsw-static-blue-50": "rgb(239, 246, 255)",
953
+ "--dsw-static-blue-50p": "rgb(234, 243, 255)",
954
+ "--dsw-static-blue-600": "rgb(37, 99, 235)",
955
+ "--dsw-static-blue-75": "rgb(229, 240, 255)",
956
+ "--dsw-static-blue-800": "rgb(30, 64, 175)",
957
+ "--dsw-static-blue-900": "rgb(14, 48, 116)",
958
+ "--dsw-static-blue-950": "rgb(23, 37, 84)",
959
+ "--dsw-static-deepseek-100": "rgb(228, 237, 253)",
960
+ "--dsw-static-deepseek-200": "rgb(211, 226, 255)",
961
+ "--dsw-static-deepseek-300": "rgb(183, 200, 254)",
962
+ "--dsw-static-deepseek-400": "rgb(103, 158, 254)",
963
+ "--dsw-static-deepseek-450": "rgb(86, 134, 254)",
964
+ "--dsw-static-deepseek-500": "rgb(65, 118, 230)",
965
+ "--dsw-static-deepseek-50": "rgb(237, 243, 254)",
966
+ "--dsw-static-deepseek-600": "rgb(72, 104, 178)",
967
+ "--dsw-static-deepseek-700-delete": "rgb(47, 76, 143)",
968
+ "--dsw-static-deepseek-800": "rgb(52, 65, 91)",
969
+ "--dsw-static-deepseek-900": "rgb(40, 49, 66)",
970
+ "--dsw-static-green-100": "rgb(230, 250, 237)",
971
+ "--dsw-static-green-400": "rgb(78, 209, 126)",
972
+ "--dsw-static-green-500": "rgb(34, 197, 94)",
973
+ "--dsw-static-green-900": "rgb(35, 60, 44)",
974
+ "--dsw-static-neutral-00": "rgb(255, 255, 255)",
975
+ "--dsw-static-neutral-1000": "rgb(0, 0, 0)",
976
+ "--dsw-static-neutral-100": "rgb(245, 245, 245)",
977
+ "--dsw-static-neutral-150": "rgb(237, 237, 237)",
978
+ "--dsw-static-neutral-200": "rgb(229, 229, 229)",
979
+ "--dsw-static-neutral-250": "rgb(220, 220, 220)",
980
+ "--dsw-static-neutral-300": "rgb(212, 212, 212)",
981
+ "--dsw-static-neutral-400": "rgb(162, 164, 166)",
982
+ "--dsw-static-neutral-500": "rgb(127, 130, 135)",
983
+ "--dsw-static-neutral-50": "rgb(250, 250, 250)",
984
+ "--dsw-static-neutral-550": "rgb(101, 103, 107)",
985
+ "--dsw-static-neutral-600": "rgb(84, 85, 87)",
986
+ "--dsw-static-neutral-700": "rgb(60, 60, 61)",
987
+ "--dsw-static-neutral-800": "rgb(41, 41, 41)",
988
+ "--dsw-static-neutral-850": "rgb(33, 33, 35)",
989
+ "--dsw-static-neutral-900": "rgb(15, 15, 15)",
990
+ "--dsw-static-neutral-bluish-00": "rgb(255, 255, 255)",
991
+ "--dsw-static-neutral-bluish-1000": "rgb(15, 17, 21)",
992
+ "--dsw-static-neutral-bluish-100": "rgb(235, 238, 242)",
993
+ "--dsw-static-neutral-bluish-150": "rgb(233, 236, 242)",
994
+ "--dsw-static-neutral-bluish-200": "rgb(225, 229, 238)",
995
+ "--dsw-static-neutral-bluish-300": "rgb(207, 211, 214)",
996
+ "--dsw-static-neutral-bluish-400": "rgb(173, 178, 184)",
997
+ "--dsw-static-neutral-bluish-500": "rgb(151, 157, 166)",
998
+ "--dsw-static-neutral-bluish-50": "rgb(249, 250, 251)",
999
+ "--dsw-static-neutral-bluish-600": "rgb(129, 133, 140)",
1000
+ "--dsw-static-neutral-bluish-60": "rgb(245, 246, 247)",
1001
+ "--dsw-static-neutral-bluish-700": "rgb(97, 102, 107)",
1002
+ "--dsw-static-neutral-bluish-750": "rgb(67, 69, 74)",
1003
+ "--dsw-static-neutral-bluish-75": "rgb(241, 243, 245)",
1004
+ "--dsw-static-neutral-bluish-800": "rgb(53, 54, 56)",
1005
+ "--dsw-static-neutral-bluish-850": "rgb(44, 44, 46)",
1006
+ "--dsw-static-neutral-bluish-875": "rgb(35, 35, 36)",
1007
+ "--dsw-static-neutral-bluish-900": "rgb(27, 27, 28)",
1008
+ "--dsw-static-neutral-bluish-950": "rgb(21, 21, 23)",
1009
+ "--dsw-static-red-100": "rgb(254, 226, 226)",
1010
+ "--dsw-static-red-400": "rgb(242, 90, 90)",
1011
+ "--dsw-static-red-500": "rgb(239, 68, 68)",
1012
+ "--dsw-static-red-50": "rgb(254, 242, 242)",
1013
+ "--dsw-static-red-600": "rgb(236, 19, 19)",
1014
+ "--dsw-static-red-900": "rgb(87, 12, 12)"
1015
+ };
1016
+ const PRIMITIVES_DARK = {
1017
+ ...PRIMITIVES_LIGHT,
1018
+ "--dsw-static-neutral-00": "rgb(21, 21, 23)",
1019
+ "--dsw-static-neutral-1000": "rgb(255, 255, 255)",
1020
+ "--dsw-static-neutral-100": "rgb(27, 27, 28)",
1021
+ "--dsw-static-neutral-150": "rgb(35, 35, 36)",
1022
+ "--dsw-static-neutral-200": "rgb(44, 44, 46)",
1023
+ "--dsw-static-neutral-250": "rgb(53, 54, 56)",
1024
+ "--dsw-static-neutral-300": "rgb(67, 69, 74)",
1025
+ "--dsw-static-neutral-400": "rgb(97, 102, 107)",
1026
+ "--dsw-static-neutral-500": "rgb(129, 133, 140)",
1027
+ "--dsw-static-neutral-50": "rgb(33, 33, 35)",
1028
+ "--dsw-static-neutral-550": "rgb(151, 157, 166)",
1029
+ "--dsw-static-neutral-600": "rgb(173, 178, 184)",
1030
+ "--dsw-static-neutral-700": "rgb(207, 211, 214)",
1031
+ "--dsw-static-neutral-800": "rgb(225, 229, 238)",
1032
+ "--dsw-static-neutral-850": "rgb(235, 238, 242)",
1033
+ "--dsw-static-neutral-900": "rgb(241, 243, 245)",
1034
+ "--dsw-static-neutral-bluish-00": "rgb(21, 21, 23)",
1035
+ "--dsw-static-neutral-bluish-1000": "rgb(255, 255, 255)",
1036
+ "--dsw-static-neutral-bluish-100": "rgb(53, 54, 56)",
1037
+ "--dsw-static-neutral-bluish-150": "rgb(67, 69, 74)",
1038
+ "--dsw-static-neutral-bluish-200": "rgb(97, 102, 107)",
1039
+ "--dsw-static-neutral-bluish-300": "rgb(129, 133, 140)",
1040
+ "--dsw-static-neutral-bluish-400": "rgb(151, 157, 166)",
1041
+ "--dsw-static-neutral-bluish-50": "rgb(27, 27, 28)",
1042
+ "--dsw-static-neutral-bluish-500": "rgb(173, 178, 184)",
1043
+ "--dsw-static-neutral-bluish-600": "rgb(207, 211, 214)",
1044
+ "--dsw-static-neutral-bluish-60": "rgb(35, 35, 36)",
1045
+ "--dsw-static-neutral-bluish-700": "rgb(225, 229, 238)",
1046
+ "--dsw-static-neutral-bluish-750": "rgb(233, 236, 242)",
1047
+ "--dsw-static-neutral-bluish-75": "rgb(44, 44, 46)",
1048
+ "--dsw-static-neutral-bluish-800": "rgb(235, 238, 242)",
1049
+ "--dsw-static-neutral-bluish-850": "rgb(241, 243, 245)",
1050
+ "--dsw-static-neutral-bluish-875": "rgb(245, 246, 247)",
1051
+ "--dsw-static-neutral-bluish-900": "rgb(249, 250, 251)",
1052
+ "--dsw-static-neutral-bluish-950": "rgb(255, 255, 255)"
1053
+ };
1054
+ function buildPrimitivesCss(light = PRIMITIVES_LIGHT, dark = PRIMITIVES_DARK) {
1055
+ const toBlock = (selector, map) => `${selector} {\n${Object.entries(map).map(([k, v]) => ` ${k}: ${v};`).join("\n")}\n}`;
1056
+ return `${toBlock(":root", light)}\n\n${toBlock("html[data-ds-dark-theme], body[data-ds-dark-theme]", dark)}`;
527
1057
  }
528
- function pickCodeBlockColors(p) {
529
- const page = p.base ?? p.l1;
530
- const isLight = hexLum(page) > 128;
531
- const brightest = (colors) => {
532
- let best = colors[0];
533
- let max = -1;
534
- for (const c of colors) {
535
- const l = hexLum(c);
536
- if (l > max) {
537
- max = l;
538
- best = c;
539
- }
540
- }
541
- return best;
542
- };
543
- if (isLight) {
544
- const banner = brightest([
545
- p.l1,
546
- p.l2,
547
- p.l3
548
- ].filter((c) => c !== page));
549
- const bannerLum = hexLum(banner);
550
- let block;
551
- let bestL = -1;
552
- for (const c of [
553
- p.l2,
554
- p.l3,
555
- p.b1
556
- ]) {
557
- if (c === page || c === banner) continue;
558
- const l = hexLum(c);
559
- if (l < bannerLum && l > bestL) {
560
- bestL = l;
561
- block = c;
562
- }
563
- }
564
- const resolved = block ?? [
565
- p.l2,
566
- p.l3,
567
- p.b1
568
- ].find((c) => c !== page && c !== banner) ?? p.l2;
569
- if (hexLum(banner) < hexLum(resolved)) return {
570
- banner: resolved,
571
- block: banner
572
- };
573
- if (banner === resolved) return {
574
- banner,
575
- block: p.l3 !== banner ? p.l3 : p.b1
576
- };
577
- return {
578
- banner,
579
- block: resolved
580
- };
581
- }
582
- const banner = brightest([
583
- p.l3,
584
- p.b1,
585
- p.b2,
586
- p.l2
587
- ].filter((c) => c !== page));
588
- let block = [
589
- p.l2,
590
- p.l3,
591
- p.b1,
592
- p.b2
593
- ].find((c) => c !== page && c !== banner) ?? p.l2;
594
- {
595
- let min = Infinity;
596
- for (const c of [
597
- p.l2,
598
- p.b1,
599
- p.l3,
600
- p.b2
601
- ]) {
602
- if (c === page || c === banner) continue;
603
- const l = hexLum(c);
604
- if (l < min) {
605
- min = l;
606
- block = c;
607
- }
608
- }
609
- }
610
- if (hexLum(banner) < hexLum(block)) return {
611
- banner: block,
612
- block: banner
613
- };
614
- if (block === page) block = p.l2 !== banner ? p.l2 : p.b1;
615
- if (banner === block) block = p.b2 !== banner ? p.b2 : p.b1;
616
- return {
617
- banner,
618
- block
1058
+ function primitiveOverrides(light, dark) {
1059
+ const out = {};
1060
+ const keys = /* @__PURE__ */ new Set([...Object.keys(light), ...Object.keys(dark)]);
1061
+ for (const k of keys) out[k] = {
1062
+ light: light[k] ?? dark[k],
1063
+ dark: dark[k] ?? light[k]
619
1064
  };
1065
+ return out;
620
1066
  }
621
1067
  //#endregion
622
- //#region src/client/tokens.ts
1068
+ //#region src/client/css/shiki.ts
623
1069
  /**
624
- * Token projection: preset palette -> DSH theme-token overrides.
1070
+ * Shiki token palette: values behind --shiki-* custom properties emitted by
1071
+ * ui-primitives CodeBlock. Light values on :root, dark overrides on
1072
+ * body[data-ds-dark-theme] — same cascade as every other token sheet.
1073
+ *
1074
+ * Background/foreground alias the markdown code-block tokens so highlighted
1075
+ * and plain blocks agree.
1076
+ * Dark selector covers both html and body for DSH compatibility.
625
1077
  */
626
- function brightest(...colors) {
627
- let best = colors[0];
628
- let max = -1;
629
- for (const c of colors) {
630
- const l = hexLum(c);
631
- if (l > max) {
632
- max = l;
633
- best = c;
634
- }
635
- }
636
- return best;
637
- }
638
- function aliasCss(p) {
639
- const m = {};
640
- const base = p.base ?? p.l1;
641
- const isLight = hexLum(base) > 128;
642
- m["--dsw-alias-bg-base"] = base;
643
- m["--dsw-alias-bg-layer-1"] = p.l1;
644
- m["--dsw-alias-bg-layer-2"] = p.l2;
645
- m["--dsw-alias-bg-layer-3"] = p.l3;
646
- m["--dsw-alias-bg-mask-1"] = base + "3d";
647
- m["--dsw-alias-bg-mask-2"] = base + "1f";
648
- m["--dsw-alias-bg-mask-3"] = base + "7a";
649
- m["--dsw-alias-bg-mask-photo"] = "#000000e0";
650
- m["--dsw-alias-bg-mask-drop"] = base + "b3";
651
- m["--dsw-alias-bg-module-platform"] = isLight ? p.l1 : p.l3;
652
- m["--dsw-alias-bg-multi-select"] = isLight ? p.l1 : p.l3;
653
- m["--dsw-alias-bg-overlay"] = p.l2;
654
- m["--dsw-alias-bg-skeleton"] = p.b1 + "0a";
655
- m["--dsw-alias-border-inverted2"] = "#0000";
656
- m["--dsw-alias-border-inverted"] = "#0000";
657
- m["--dsw-alias-border-l1"] = p.b1;
658
- m["--dsw-alias-border-l2-darkmode-thin"] = p.b2;
659
- m["--dsw-alias-border-l2"] = p.b2;
660
- m["--dsw-alias-border-l3"] = p.b2;
661
- m["--dsw-alias-border-l4"] = p.b2;
662
- m["--dsw-alias-brand-primary-invert"] = p.lp;
663
- m["--dsw-alias-brand-primary-new-colorprimary-new-color"] = p.brand;
664
- m["--dsw-alias-brand-primary"] = p.brand;
665
- m["--dsw-alias-brand-text"] = p.brand;
666
- m["--dsw-alias-button-contrast-fill"] = p.lp;
667
- m["--dsw-alias-button-elevated-fill"] = isLight ? base : p.l2;
668
- m["--dsw-alias-button-floating-fill"] = isLight ? base : p.l2;
669
- m["--dsw-alias-button-floating-hover"] = isLight ? p.l2 : p.l3;
670
- m["--dsw-alias-button-ghost-active-border"] = p.b1;
671
- m["--dsw-alias-button-ghost-active-fill"] = p.l2;
672
- m["--dsw-alias-button-ghost-active-hover"] = p.l3;
673
- m["--dsw-alias-button-info-fill"] = p.brand;
674
- m["--dsw-alias-button-info-hover"] = p.brand;
675
- m["--dsw-alias-button-primary-dimmed"] = p.l2;
676
- m["--dsw-alias-button-primary-fill"] = p.brand;
677
- m["--dsw-alias-button-primary-hover"] = p.lp;
678
- m["--dsw-alias-button-tool-bar-fill-invisible"] = p.l2 + "5c";
679
- m["--dsw-alias-button-tool-bar-fill"] = p.b1 + "80";
680
- m["--dsw-alias-button-tool-bar-hover"] = p.b1 + "99";
681
- const interactiveHover = isLight ? p.l3 : p.b2;
682
- m["--dsw-alias-interactive-bg-active"] = isLight ? p.b2 : p.l3;
683
- m["--dsw-alias-interactive-bg-hover-accent"] = p.brand + "14";
684
- m["--dsw-alias-interactive-bg-hover-danger"] = p.err + "14";
685
- m["--dsw-alias-interactive-bg-hover-solid"] = interactiveHover;
686
- m["--dsw-alias-interactive-bg-hover"] = interactiveHover;
687
- m["--dsw-alias-label-caption"] = p.lp + "99";
688
- m["--dsw-alias-label-dimmed"] = p.b1;
689
- m["--dsw-alias-label-primary-bluish"] = p.brand;
690
- m["--dsw-alias-label-primary-dimmed"] = p.lp;
691
- m["--dsw-alias-label-primary-foreground"] = base;
692
- m["--dsw-alias-label-primary-inverted"] = base;
693
- m["--dsw-alias-label-primary"] = p.lp;
694
- m["--dsw-alias-label-secondary"] = p.ls;
695
- m["--dsw-alias-label-tertiary"] = p.ls;
696
- m["--dsw-alias-markdown-citation"] = p.l3;
697
- const code = pickCodeBlockColors(p);
698
- m["--dsw-alias-markdown-code-block-banner"] = code.banner;
699
- m["--dsw-alias-markdown-code-block"] = code.block;
700
- m["--dsw-alias-markdown-code-segment-selected"] = p.l2;
701
- m["--dsw-alias-markdown-code-segment-unselected"] = p.l3;
702
- m["--dsw-alias-markdown-inline-code"] = p.l3;
703
- m["--dsw-alias-markdown-placeholder"] = p.b1;
704
- m["--dsw-alias-markdown-tag"] = p.l3;
705
- m["--dsw-alias-scrollbar-bg-l1"] = p.b1;
706
- m["--dsw-alias-scrollbar-bg-l2"] = p.b2;
707
- m["--dsw-alias-scrollbar-hover-l1"] = p.b2;
708
- m["--dsw-alias-scrollbar-hover-l2"] = p.b2;
709
- m["--dsw-alias-state-business-primary"] = p.brand;
710
- m["--dsw-alias-state-business-tertiary"] = p.brand + "20";
711
- m["--dsw-alias-state-error-primary"] = p.err;
712
- m["--dsw-alias-state-error-secondary"] = p.err;
713
- m["--dsw-alias-state-success-primary"] = p.ok;
714
- m["--dsw-alias-state-success-secondary"] = p.ok;
715
- m["--dsw-alias-state-success-tertiary"] = p.ok + "20";
716
- m["--dsw-alias-state-warn-label"] = p.warn;
717
- m["--dsw-alias-state-warn-primary"] = p.warn;
718
- m["--dsw-alias-state-warn-secondary"] = p.warn;
719
- m["--dsw-alias-state-warn-tertiary"] = p.warn + "20";
720
- m["--dsw-alias-toast-bg"] = isLight ? base : p.l3;
721
- m["--dsw-cool-theme-toast-bg"] = isLight ? base : p.l3;
722
- m["--dsw-cool-theme-toast-fg"] = p.lp;
723
- m["--dsw-cool-theme-toast-border"] = p.b1;
724
- m["--dsw-alias-tooltip-bg"] = isLight ? p.l3 : brightest(p.l3, p.b2);
725
- m["--dsw-specific-bubble-highlight"] = p.brand + "30";
726
- m["--dsw-specific-bubble"] = p.brand + "15";
727
- m["--dsw-specific-input-major"] = isLight ? base : p.l1;
728
- m["--dsw-specific-login-input"] = p.l1;
729
- m["--dsw-specific-menu"] = p.l2;
730
- m["--dsw-specific-selector"] = isLight ? p.l1 : p.l3;
731
- m["--dsw-specific-sidebar-fill"] = p.l1;
732
- m["--dsw-specific-sidebar-nav-item-hover"] = p.l3;
733
- m["--dsw-specific-sidebar-nav-item-active"] = p.l3;
734
- m["--dsw-specific-sidebar-nav-item-active-accent"] = p.brand + "20";
735
- m["--dsw-specific-tip"] = p.l1;
736
- return m;
737
- }
738
- function staticCss(p) {
739
- const m = {};
740
- const base = p.base ?? p.l1;
741
- m["--dsw-static-neutral-bluish-00"] = p.lp;
742
- m["--dsw-static-neutral-bluish-50"] = p.lp;
743
- m["--dsw-static-neutral-bluish-60"] = p.l3;
744
- m["--dsw-static-neutral-bluish-75"] = p.l3;
745
- m["--dsw-static-neutral-bluish-100"] = p.ls;
746
- m["--dsw-static-neutral-bluish-150"] = p.ls;
747
- m["--dsw-static-neutral-bluish-200"] = p.b1;
748
- m["--dsw-static-neutral-bluish-300"] = p.b1;
749
- m["--dsw-static-neutral-bluish-400"] = p.b1;
750
- m["--dsw-static-neutral-bluish-500"] = p.b2;
751
- m["--dsw-static-neutral-bluish-600"] = p.b2;
752
- m["--dsw-static-neutral-bluish-700"] = p.l2;
753
- m["--dsw-static-neutral-bluish-750"] = p.l2;
754
- m["--dsw-static-neutral-bluish-800"] = p.l2;
755
- m["--dsw-static-neutral-bluish-850"] = p.l1;
756
- m["--dsw-static-neutral-bluish-875"] = p.l1;
757
- m["--dsw-static-neutral-bluish-900"] = p.l1;
758
- m["--dsw-static-neutral-bluish-950"] = base;
759
- m["--dsw-static-neutral-bluish-1000"] = base;
760
- for (const k of [
761
- "100",
762
- "200",
763
- "300",
764
- "400",
765
- "450",
766
- "500",
767
- "600",
768
- "800",
769
- "900"
770
- ]) {
771
- m[`--dsw-static-deepseek-${k}`] = p.brand;
772
- m[`--dsw-static-blue-${k}`] = p.brand;
773
- }
774
- m["--dsw-static-deepseek-50"] = p.brand + "15";
775
- m["--dsw-static-blue-50"] = p.brand + "15";
776
- m["--dsw-static-blue-50p"] = p.brand + "15";
777
- m["--dsw-static-blue-75"] = p.brand + "20";
778
- m["--dsw-static-green-100"] = p.ok + "20";
779
- m["--dsw-static-green-400"] = p.ok;
780
- m["--dsw-static-green-500"] = p.ok;
781
- m["--dsw-static-green-900"] = p.ok + "30";
782
- m["--dsw-static-amber-100"] = p.warn + "20";
783
- m["--dsw-static-amber-400"] = p.warn;
784
- m["--dsw-static-amber-500"] = p.warn;
785
- m["--dsw-static-amber-600"] = p.warn;
786
- m["--dsw-static-amber-900"] = p.warn + "30";
787
- m["--dsw-static-red-50"] = p.err + "15";
788
- m["--dsw-static-red-100"] = p.err + "20";
789
- m["--dsw-static-red-400"] = p.err;
790
- m["--dsw-static-red-500"] = p.err;
791
- m["--dsw-static-red-600"] = p.err;
792
- m["--dsw-static-red-900"] = p.err + "30";
793
- m["--dsw-static-neutral-00"] = p.lp;
794
- m["--dsw-static-neutral-50"] = p.lp;
795
- m["--dsw-static-neutral-100"] = p.ls;
796
- m["--dsw-static-neutral-150"] = p.ls;
797
- m["--dsw-static-neutral-200"] = p.b1;
798
- m["--dsw-static-neutral-250"] = p.b1;
799
- m["--dsw-static-neutral-300"] = p.b1;
800
- m["--dsw-static-neutral-400"] = p.b1;
801
- m["--dsw-static-neutral-500"] = p.b2;
802
- m["--dsw-static-neutral-550"] = p.b2;
803
- m["--dsw-static-neutral-600"] = p.b2;
804
- m["--dsw-static-neutral-700"] = p.l2;
805
- m["--dsw-static-neutral-800"] = p.l2;
806
- m["--dsw-static-neutral-850"] = p.l1;
807
- m["--dsw-static-neutral-900"] = base;
808
- m["--dsw-static-neutral-1000"] = base;
809
- return m;
810
- }
811
- const SHIKI_TABLE = /* @__PURE__ */ new Map([
812
- [PRESETS.nord.light, {
813
- constant: "#2e6ea6",
814
- string: "#3d7a1f",
815
- comment: "#6c7a8e",
816
- keyword: "#8b4a9a",
817
- parameter: "#9a5d2e",
818
- function: "#2f6f8a",
819
- stringExpression: "#3d7a1f",
820
- punctuation: "#4c566a",
821
- link: "#5e81ac"
822
- }],
823
- [PRESETS.nord.dark, {
824
- constant: "#8be9fd",
825
- string: "#a3be8c",
826
- comment: "#6272a4",
827
- keyword: "#ff79c6",
828
- parameter: "#d08770",
829
- function: "#88c0d0",
830
- stringExpression: "#a3be8c",
831
- punctuation: "#8ca0b8",
832
- link: "#88c0d0"
833
- }],
834
- [PRESETS.onedark.light, {
835
- constant: "#0b7ea4",
836
- string: "#1f7a3a",
837
- comment: "#76808f",
838
- keyword: "#a626a4",
839
- parameter: "#986801",
840
- function: "#4078f2",
841
- stringExpression: "#1f7a3a",
842
- punctuation: "#5c6370",
843
- link: "#4078f2"
844
- }],
845
- [PRESETS.onedark.dark, {
846
- constant: "#56b6c2",
847
- string: "#98c379",
848
- comment: "#7f848e",
849
- keyword: "#c678dd",
850
- parameter: "#d19a66",
851
- function: "#61afef",
852
- stringExpression: "#98c379",
853
- punctuation: "#abb2bf",
854
- link: "#61afef"
855
- }],
856
- [PRESETS.github.light, {
857
- constant: "#0550ae",
858
- string: "#0a3069",
859
- comment: "#6e7781",
860
- keyword: "#cf222e",
861
- parameter: "#953800",
862
- function: "#8250df",
863
- stringExpression: "#1a7f37",
864
- punctuation: "#656d76",
865
- link: "#0969da"
866
- }],
867
- [PRESETS.github.dark, {
868
- constant: "#79c0ff",
869
- string: "#a5d6ff",
870
- comment: "#8b949e",
871
- keyword: "#ff7b72",
872
- parameter: "#ffa657",
873
- function: "#d2a8ff",
874
- stringExpression: "#7ee787",
875
- punctuation: "#8b949e",
876
- link: "#58a6ff"
877
- }],
878
- [PRESETS.catppuccin.light, {
879
- constant: "#0b7ec8",
880
- string: "#1a7a3a",
881
- comment: "#7a7f8e",
882
- keyword: "#8839ef",
883
- parameter: "#fe640b",
884
- function: "#1e66f5",
885
- stringExpression: "#1a7a3a",
886
- punctuation: "#5c5f77",
887
- link: "#1e66f5"
888
- }],
889
- [PRESETS.catppuccin.dark, {
890
- constant: "#89dceb",
891
- string: "#a6e3a1",
892
- comment: "#6c7086",
893
- keyword: "#cba6f7",
894
- parameter: "#fab387",
895
- function: "#89b4fa",
896
- stringExpression: "#a6e3a1",
897
- punctuation: "#bac2de",
898
- link: "#89b4fa"
899
- }],
900
- [PRESETS.dracula.light, {
901
- constant: "#6a3fb5",
902
- string: "#1a7a3a",
903
- comment: "#6d7a9e",
904
- keyword: "#a21caf",
905
- parameter: "#b45309",
906
- function: "#7c3aed",
907
- stringExpression: "#1a7a3a",
908
- punctuation: "#44475a",
909
- link: "#7c3aed"
910
- }],
911
- [PRESETS.dracula.dark, {
912
- constant: "#8be9fd",
913
- string: "#50fa7b",
914
- comment: "#6272a4",
915
- keyword: "#ff79c6",
916
- parameter: "#ffb86c",
917
- function: "#bd93f9",
918
- stringExpression: "#50fa7b",
919
- punctuation: "#f8f8f2",
920
- link: "#bd93f9"
921
- }],
922
- [PRESETS.tokyonight.light, {
923
- constant: "#0f4b6e",
924
- string: "#1a7a3a",
925
- comment: "#6e7a9e",
926
- keyword: "#8c4351",
927
- parameter: "#965027",
928
- function: "#34548a",
929
- stringExpression: "#1a7a3a",
930
- punctuation: "#5a638c",
931
- link: "#34548a"
932
- }],
933
- [PRESETS.tokyonight.dark, {
934
- constant: "#7dcfff",
935
- string: "#9ece6a",
936
- comment: "#565f89",
937
- keyword: "#bb9af7",
938
- parameter: "#ff9e64",
939
- function: "#7aa2f7",
940
- stringExpression: "#9ece6a",
941
- punctuation: "#c0caf5",
942
- link: "#7aa2f7"
943
- }],
944
- [PRESETS.solarized.light, {
945
- constant: "#2aa198",
946
- string: "#586e75",
947
- comment: "#93a1a1",
948
- keyword: "#859900",
949
- parameter: "#cb4b16",
950
- function: "#268bd2",
951
- stringExpression: "#2aa198",
952
- punctuation: "#657b83",
953
- link: "#268bd2"
954
- }],
955
- [PRESETS.solarized.dark, {
956
- constant: "#2aa198",
957
- string: "#859900",
958
- comment: "#586e75",
959
- keyword: "#268bd2",
960
- parameter: "#cb4b16",
961
- function: "#b58900",
962
- stringExpression: "#2aa198",
963
- punctuation: "#93a1a1",
964
- link: "#268bd2"
965
- }],
966
- [PRESETS.gruvbox.light, {
967
- constant: "#076678",
968
- string: "#79740e",
969
- comment: "#928374",
970
- keyword: "#9d0006",
971
- parameter: "#af3a03",
972
- function: "#076678",
973
- stringExpression: "#79740e",
974
- punctuation: "#504945",
975
- link: "#076678"
976
- }],
977
- [PRESETS.gruvbox.dark, {
978
- constant: "#83a598",
979
- string: "#b8bb26",
980
- comment: "#928374",
981
- keyword: "#fb4934",
982
- parameter: "#fe8019",
983
- function: "#fabd2f",
984
- stringExpression: "#b8bb26",
985
- punctuation: "#ebdbb2",
986
- link: "#83a598"
987
- }],
988
- [PRESETS.monokai.light, {
989
- constant: "#6b42a0",
990
- string: "#2a7a2a",
991
- comment: "#8a8a8a",
992
- keyword: "#c4265e",
993
- parameter: "#b45a00",
994
- function: "#6b42a0",
995
- stringExpression: "#2a7a2a",
996
- punctuation: "#5b5956",
997
- link: "#6b42a0"
998
- }],
999
- [PRESETS.monokai.dark, {
1000
- constant: "#ab9df2",
1001
- string: "#a9dc76",
1002
- comment: "#7a7978",
1003
- keyword: "#ff6188",
1004
- parameter: "#fc9867",
1005
- function: "#78dce8",
1006
- stringExpression: "#a9dc76",
1007
- punctuation: "#fcfcfa",
1008
- link: "#ab9df2"
1009
- }],
1010
- [PRESETS.rosepine.light, {
1011
- constant: "#56949f",
1012
- string: "#286983",
1013
- comment: "#9893a5",
1014
- keyword: "#907aa9",
1015
- parameter: "#b4637a",
1016
- function: "#907aa9",
1017
- stringExpression: "#286983",
1018
- punctuation: "#575279",
1019
- link: "#907aa9"
1020
- }],
1021
- [PRESETS.rosepine.dark, {
1022
- constant: "#9ccfd8",
1023
- string: "#ebbcba",
1024
- comment: "#6e6a86",
1025
- keyword: "#c4a7e7",
1026
- parameter: "#eb6f92",
1027
- function: "#e0def4",
1028
- stringExpression: "#ebbcba",
1029
- punctuation: "#e0def4",
1030
- link: "#c4a7e7"
1031
- }],
1032
- [PRESETS.ayu.light, {
1033
- constant: "#55b4d4",
1034
- string: "#86b300",
1035
- comment: "#a8b0bb",
1036
- keyword: "#fa8d3e",
1037
- parameter: "#f07171",
1038
- function: "#55b4d4",
1039
- stringExpression: "#86b300",
1040
- punctuation: "#5c6773",
1041
- link: "#55b4d4"
1042
- }],
1043
- [PRESETS.ayu.dark, {
1044
- constant: "#39bae6",
1045
- string: "#7fd962",
1046
- comment: "#5c6773",
1047
- keyword: "#ffb454",
1048
- parameter: "#ff8f40",
1049
- function: "#59e1ff",
1050
- stringExpression: "#7fd962",
1051
- punctuation: "#c5cddb",
1052
- link: "#39bae6"
1053
- }],
1054
- [PRESETS.zenburn.light, {
1055
- constant: "#2b6f6f",
1056
- string: "#8c3333",
1057
- comment: "#7a8a7a",
1058
- keyword: "#705040",
1059
- parameter: "#8f5a00",
1060
- function: "#2b6f6f",
1061
- stringExpression: "#8c3333",
1062
- punctuation: "#5f6f5f",
1063
- link: "#2b6f6f"
1064
- }],
1065
- [PRESETS.zenburn.dark, {
1066
- constant: "#8cd0d3",
1067
- string: "#cc9393",
1068
- comment: "#7f9f7f",
1069
- keyword: "#f0dfaf",
1070
- parameter: "#d0bf8f",
1071
- function: "#8cd0d3",
1072
- stringExpression: "#cc9393",
1073
- punctuation: "#dcdccc",
1074
- link: "#8cd0d3"
1075
- }]
1076
- ]);
1077
- const SHIKI_FALLBACK = {
1078
- constant: "#0550ae",
1079
- string: "#1a7f37",
1080
- comment: "#6e7781",
1081
- keyword: "#cf222e",
1082
- parameter: "#953800",
1083
- function: "#8250df",
1084
- stringExpression: "#1a7f37",
1085
- punctuation: "#656d76",
1086
- link: "#0969da"
1087
- };
1088
- function shikiCss(p) {
1089
- const m = {};
1090
- m["--shiki-foreground"] = p.lp;
1091
- m["--shiki-background"] = pickCodeBlockColors(p).block;
1092
- const t = SHIKI_TABLE.get(p) ?? SHIKI_FALLBACK;
1093
- m["--shiki-token-constant"] = t.constant;
1094
- m["--shiki-token-string"] = t.string;
1095
- m["--shiki-token-comment"] = t.comment;
1096
- m["--shiki-token-keyword"] = t.keyword;
1097
- m["--shiki-token-parameter"] = t.parameter;
1098
- m["--shiki-token-function"] = t.function;
1099
- m["--shiki-token-string-expression"] = t.stringExpression;
1100
- m["--shiki-token-punctuation"] = t.punctuation;
1101
- m["--shiki-token-link"] = t.link;
1102
- return m;
1078
+ const SHIKI_CSS = `
1079
+ :root {
1080
+ --shiki-foreground: var(--dsw-alias-label-primary);
1081
+ --shiki-background: var(--dsw-alias-markdown-code-block);
1082
+ --shiki-token-constant: #1c7ed6;
1083
+ --shiki-token-string: #2f9e44;
1084
+ --shiki-token-comment: #868e96;
1085
+ --shiki-token-keyword: #d6336c;
1086
+ --shiki-token-parameter: #e8590c;
1087
+ --shiki-token-function: #6741d9;
1088
+ --shiki-token-string-expression: #2b8a3e;
1089
+ --shiki-token-punctuation: #495057;
1090
+ --shiki-token-link: #1971c2;
1091
+ }
1092
+
1093
+ html[data-ds-dark-theme], body[data-ds-dark-theme] {
1094
+ --shiki-token-constant: #4dabf7;
1095
+ --shiki-token-string: #69db7c;
1096
+ --shiki-token-comment: #adb5bd;
1097
+ --shiki-token-keyword: #faa2c1;
1098
+ --shiki-token-parameter: #ffa94d;
1099
+ --shiki-token-function: #b197fc;
1100
+ --shiki-token-string-expression: #8ce99a;
1101
+ --shiki-token-punctuation: #ced4da;
1102
+ --shiki-token-link: #74c0fc;
1103
+ }
1104
+ `;
1105
+ //#endregion
1106
+ //#region src/client/tokens.ts
1107
+ function buildBaseCss() {
1108
+ return `${buildPrimitivesCss()}\n\n${SHIKI_CSS}`;
1103
1109
  }
1104
- function getTokenMaps(id) {
1110
+ const NOOP_PRESETS = /* @__PURE__ */ new Set(["native", "dsh"]);
1111
+ function resolvePreset(id) {
1112
+ if (NOOP_PRESETS.has(id)) return null;
1105
1113
  const preset = PRESETS[id];
1114
+ if (!preset) return null;
1106
1115
  return {
1107
- lightAlias: aliasCss(preset.light),
1108
- darkAlias: aliasCss(preset.dark),
1109
- lightStat: staticCss(preset.light),
1110
- darkStat: staticCss(preset.dark),
1111
- lightShiki: shikiCss(preset.light),
1112
- darkShiki: shikiCss(preset.dark)
1116
+ light: {
1117
+ ...PRIMITIVES_LIGHT,
1118
+ ...preset.light
1119
+ },
1120
+ dark: {
1121
+ ...PRIMITIVES_DARK,
1122
+ ...preset.dark
1123
+ }
1113
1124
  };
1114
1125
  }
1115
1126
  function buildOverrides(id) {
1116
- if (id === "native") return {};
1117
- const { lightAlias, darkAlias, lightStat, darkStat, lightShiki, darkShiki } = getTokenMaps(id);
1118
- const overrides = {};
1119
- const add = (a, b) => {
1120
- for (const k of /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])) overrides[k] = {
1121
- light: a[k] ?? b[k],
1122
- dark: b[k] ?? a[k]
1123
- };
1124
- };
1125
- add(lightAlias, darkAlias);
1126
- add(lightStat, darkStat);
1127
- add(lightShiki, darkShiki);
1128
- return overrides;
1127
+ const resolved = resolvePreset(id);
1128
+ if (!resolved) return {};
1129
+ return primitiveOverrides(resolved.light, resolved.dark);
1129
1130
  }
1130
1131
  function buildFullCssFallback(id) {
1131
- if (id === "native") return "";
1132
- const { lightAlias, darkAlias, lightStat, darkStat, lightShiki, darkShiki } = getTokenMaps(id);
1133
- const block = (map) => Object.entries(map).map(([k, v]) => ` ${k}: ${v};`).join("\n");
1134
- return `:root{\n${block(lightStat)}\n${block(lightAlias)}\n${block(lightShiki)}\n}\nbody[data-ds-dark-theme]{\n${block(darkStat)}\n${block(darkAlias)}\n${block(darkShiki)}\n}`;
1132
+ const resolved = resolvePreset(id);
1133
+ if (!resolved) return "";
1134
+ const toBlock = (m) => Object.entries(m).map(([k, v]) => ` ${k}: ${v};`).join("\n");
1135
+ return `:root{\n${toBlock(resolved.light)}\n}\nhtml[data-ds-dark-theme], body[data-ds-dark-theme]{\n${toBlock(resolved.dark)}\n}`;
1135
1136
  }
1136
1137
  //#endregion
1137
1138
  //#region src/client/style-injector.ts
1138
1139
  function createStyleInjector() {
1139
1140
  const disposers = /* @__PURE__ */ new Set();
1141
+ function track(dispose) {
1142
+ const wrapped = () => {
1143
+ try {
1144
+ dispose();
1145
+ } catch {}
1146
+ disposers.delete(wrapped);
1147
+ };
1148
+ disposers.add(wrapped);
1149
+ return wrapped;
1150
+ }
1140
1151
  function insert(css) {
1141
1152
  try {
1142
1153
  if (typeof styles !== "undefined" && typeof styles.insert === "function") {
1143
1154
  const dispose = styles.insert(css);
1144
- const wrapped = () => {
1145
- try {
1146
- dispose?.();
1147
- } catch {}
1148
- disposers.delete(wrapped);
1149
- };
1150
- disposers.add(wrapped);
1151
- return wrapped;
1155
+ if (typeof dispose === "function") return track(dispose);
1152
1156
  }
1153
1157
  } catch {}
1154
1158
  const tag = document.createElement("style");
1155
1159
  tag.dataset.plugin = "dsh-cool-theme";
1156
1160
  tag.textContent = css;
1157
1161
  document.head.appendChild(tag);
1158
- const wrapped = () => {
1159
- tag.remove();
1160
- disposers.delete(wrapped);
1161
- };
1162
- disposers.add(wrapped);
1163
- return wrapped;
1162
+ return track(() => tag.remove());
1164
1163
  }
1165
1164
  function disposeAll() {
1166
1165
  for (const d of [...disposers]) try {
@@ -1332,7 +1331,10 @@ window.__ModuleLoader__.load({
1332
1331
  "presets.desc": "一键套用主流配色方案",
1333
1332
  "scheme.light": "浅色",
1334
1333
  "scheme.dark": "深色",
1335
- "scheme.system": "跟随系统"
1334
+ "scheme.system": "跟随系统",
1335
+ "command.desc": "打开主题设置",
1336
+ "command.open": "打开主题设置",
1337
+ "command.detail": "快速打开主题面板"
1336
1338
  };
1337
1339
  /** English dictionary, checked complete against the zh key set. */
1338
1340
  const en = {
@@ -1343,36 +1345,35 @@ window.__ModuleLoader__.load({
1343
1345
  "presets.desc": "Apply popular color schemes in one click",
1344
1346
  "scheme.light": "Light",
1345
1347
  "scheme.dark": "Dark",
1346
- "scheme.system": "System"
1348
+ "scheme.system": "System",
1349
+ "command.desc": "Open theme settings",
1350
+ "command.open": "Open theme settings",
1351
+ "command.detail": "Quickly open theme panel"
1347
1352
  };
1348
1353
  //#endregion
1349
1354
  //#region src/client/theme.tsx
1350
- /**
1351
- * Client theme module — registers settings.section id=cool-theme.
1352
- */
1353
- const PALETTE_ICON_PATH = "M12 22a1 1 0 0 1 0-20a10 9 0 0 1 10 9a5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z";
1354
- const PALETTE_ICON_DOTS = [
1355
- {
1356
- cx: "13.5",
1357
- cy: "6.5",
1358
- r: "1.4"
1359
- },
1360
- {
1361
- cx: "17.5",
1362
- cy: "10.5",
1363
- r: "1.4"
1364
- },
1365
- {
1366
- cx: "6.5",
1367
- cy: "12.5",
1368
- r: "1.4"
1369
- },
1370
- {
1371
- cx: "8.5",
1372
- cy: "7.5",
1373
- r: "1.4"
1374
- }
1375
- ];
1355
+ const BASE_CSS = [
1356
+ ".ct-select{box-sizing:border-box;display:inline-flex;align-items:center;gap:12px;height:36px;padding:0 14px;border:none;border-radius:18px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;font-size:14px;line-height:22px;white-space:nowrap;width:auto;min-width:0;max-width:100%;}",
1357
+ ".ct-select:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
1358
+ ".ct-select:focus-visible{outline:none;box-shadow:0 0 0 2px var(--dsw-alias-border-l3);}",
1359
+ ".ct-select-label{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;}",
1360
+ ".ct-select-chevron{flex:none;color:var(--dsw-alias-label-tertiary);display:inline-flex;transition:transform 120ms ease;}",
1361
+ ".ct-select[aria-expanded=\"true\"] .ct-select-chevron{transform:rotate(180deg);}",
1362
+ ".ct-menu-list{box-sizing:border-box;padding:4px;display:flex;flex-direction:column;gap:0;border:1px solid var(--dsw-alias-border-inverted);border-radius:12px;background:var(--dsw-specific-menu);box-shadow:var(--dsw-shadow-lv3);min-width:218px;max-width:360px;}",
1363
+ ".ct-menu-item{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:8px 10px;border:none;border-radius:10px;background:transparent;cursor:pointer;font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary);text-align:left;font-family:inherit;}",
1364
+ ".ct-menu-item:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
1365
+ ".ct-menu-check{flex:none;color:var(--dsw-alias-label-primary);display:inline-flex;margin-left:auto;}",
1366
+ ".ct-menu-item-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
1367
+ ".ct-row{border-bottom:1px solid var(--dsw-alias-border-l2);padding:16px 2px;display:flex;align-items:center;gap:16px;}",
1368
+ ".ct-row:last-child{border-bottom:none;}",
1369
+ ".ct-row-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px;padding-right:48px;}",
1370
+ ".ct-row-title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px;}",
1371
+ ".ct-row-desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px;}"
1372
+ ].join("\n");
1373
+ const NOOP = /* @__PURE__ */ new Set(["native", "dsh"]);
1374
+ function isValidPreset(v) {
1375
+ return !!v && (NOOP.has(v) || v in PRESETS);
1376
+ }
1376
1377
  function registerTheme(ctx) {
1377
1378
  const slots = ctx.get("slots");
1378
1379
  const theme = ctx.get("theme");
@@ -1387,71 +1388,48 @@ window.__ModuleLoader__.load({
1387
1388
  }), "dsh-cool-theme: theme dictionaries");
1388
1389
  t = locale.bind(NS);
1389
1390
  }
1390
- const baseCss = [
1391
- ".ct-select{box-sizing:border-box;display:inline-flex;align-items:center;gap:12px;height:36px;padding:0 14px;border:none;border-radius:18px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;font-size:14px;line-height:22px;white-space:nowrap;width:auto;min-width:0;max-width:100%;}",
1392
- ".ct-select:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
1393
- ".ct-select:focus-visible{outline:none;box-shadow:0 0 0 2px var(--dsw-alias-border-l3);}",
1394
- ".ct-select-label{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;}",
1395
- ".ct-select-chevron{flex:none;color:var(--dsw-alias-label-tertiary);display:inline-flex;transition:transform 120ms ease;}",
1396
- ".ct-select[aria-expanded=\"true\"] .ct-select-chevron{transform:rotate(180deg);}",
1397
- ".ct-menu-list{box-sizing:border-box;padding:4px;display:flex;flex-direction:column;gap:0;border:1px solid var(--dsw-alias-border-inverted);border-radius:12px;background:var(--dsw-specific-menu);box-shadow:var(--dsw-shadow-lv3);min-width:218px;max-width:360px;}",
1398
- ".ct-menu-item{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:8px 10px;border:none;border-radius:10px;background:transparent;cursor:pointer;font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary);text-align:left;font-family:inherit;}",
1399
- ".ct-menu-item:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
1400
- ".ct-menu-check{flex:none;color:var(--dsw-alias-label-primary);display:inline-flex;margin-left:auto;}",
1401
- ".ct-menu-item-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
1402
- ".ct-row{border-bottom:1px solid var(--dsw-alias-border-l2);padding:16px 2px;display:flex;align-items:center;gap:16px;}",
1403
- ".ct-row-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px;padding-right:48px;}",
1404
- ".ct-row-title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px;}",
1405
- ".ct-row-desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px;}",
1406
- "[class*=\"navCell\"]:hover{background:var(--dsw-specific-sidebar-nav-item-hover) !important;}",
1407
- "[class*=\"navCell\"].active,[class*=\"navCell\"][aria-current=\"true\"]{background:var(--dsw-specific-sidebar-nav-item-active) !important;font-weight:500;}",
1408
- "[class*=\"navCell\"].active [class*=\"navIcon\"],[class*=\"navCell\"][aria-current=\"true\"] [class*=\"navIcon\"]{color:var(--dsw-alias-brand-primary) !important;}",
1409
- ".ct-select:hover,.ct-select[aria-expanded=\"true\"]{background:var(--dsw-alias-interactive-bg-hover) !important;}",
1410
- ".ct-menu-item:hover{background:var(--dsw-alias-interactive-bg-hover) !important;}",
1411
- ".ct-menu-item:active{background:var(--dsw-alias-interactive-bg-active) !important;}",
1412
- "[class*=\"AppearanceRow_group\"]{display:none !important;}",
1413
- ":root{--dsw-cool-theme-toast-bg:#ffffff;--dsw-cool-theme-toast-fg:#2e3440;--dsw-cool-theme-toast-border:#e5e9f0;}",
1414
- "body[data-ds-dark-theme]{--dsw-cool-theme-toast-bg:#3b4252;--dsw-cool-theme-toast-fg:#eceff4;--dsw-cool-theme-toast-border:#4c566a;}",
1415
- "[class*=\"Toast_toast\"],[class*=\"toast\"],[role=\"alert\"],[data-sonner-toast]{background:var(--dsw-cool-theme-toast-bg) !important;color:var(--dsw-cool-theme-toast-fg) !important;border:1px solid var(--dsw-cool-theme-toast-border, var(--dsw-alias-border-l1)) !important;box-shadow:var(--dsw-shadow-lv3, 0 8px 24px rgba(0,0,0,.12)) !important;}",
1416
- "body:not([data-ds-dark-theme]) [class*=\"toast\"], body:not([data-ds-dark-theme]) [class*=\"Toast_toast\"], body:not([data-ds-dark-theme]) [data-sonner-toast]{background:#ffffff !important;color:#2e3440 !important;border-color:#e5e9f0 !important;}",
1417
- "body[data-ds-dark-theme] [class*=\"toast\"], body[data-ds-dark-theme] [class*=\"Toast_toast\"], body[data-ds-dark-theme] [data-sonner-toast]{background:#3b4252 !important;color:#eceff4 !important;border-color:#4c566a !important;}",
1418
- "[data-sonner-toast]{--normal-bg:var(--dsw-cool-theme-toast-bg) !important;--normal-border:var(--dsw-cool-theme-toast-border) !important;--normal-text:var(--dsw-cool-theme-toast-fg) !important;}",
1419
- "button[class*=\"Button_primary\"]:hover,button[class*=\"primary\"]:hover{background:var(--dsw-alias-button-primary-hover) !important;color:var(--dsw-alias-label-primary-foreground) !important;}",
1420
- "button[class*=\"Button_outline\"]:hover{color:var(--dsw-alias-label-primary) !important;}"
1421
- ].join("\n");
1422
1391
  const injector = createStyleInjector();
1423
- const baseDisposer = injector.insert(baseCss);
1392
+ const pluginCssDisposer = injector.insert(BASE_CSS);
1393
+ let baselineDisposer = null;
1424
1394
  let overrideDispose = null;
1425
1395
  let fallbackDispose = null;
1426
- function isValidPreset(v) {
1427
- return !!v && (v === "native" || v in PRESETS);
1396
+ const release = (fn) => {
1397
+ if (!fn) return null;
1398
+ try {
1399
+ fn();
1400
+ } catch {}
1401
+ return null;
1402
+ };
1403
+ function ensureBaseline(active) {
1404
+ if (active) {
1405
+ if (!baselineDisposer) baselineDisposer = injector.insert(buildBaseCss());
1406
+ } else if (baselineDisposer) baselineDisposer = release(baselineDisposer);
1428
1407
  }
1429
1408
  function getPreset() {
1430
- try {
1431
- const cur = localStorage.getItem(THEME_STORAGE_KEY);
1432
- if (isValidPreset(cur)) return cur;
1433
- const legacy = localStorage.getItem(THEME_STORAGE_KEY_LEGACY);
1434
- if (isValidPreset(legacy)) {
1435
- try {
1436
- localStorage.setItem(THEME_STORAGE_KEY, legacy);
1437
- } catch {}
1438
- return legacy;
1439
- }
1409
+ for (const key of [THEME_STORAGE_KEY, THEME_STORAGE_KEY_LEGACY]) try {
1410
+ const cur = localStorage.getItem(key);
1411
+ if (!isValidPreset(cur)) continue;
1412
+ const normalized = cur === "native" ? "dsh" : cur;
1413
+ if (cur !== normalized) try {
1414
+ localStorage.setItem(THEME_STORAGE_KEY, normalized);
1415
+ } catch {}
1416
+ else if (key === "cooltea-theme-preset") try {
1417
+ localStorage.setItem(THEME_STORAGE_KEY, cur);
1418
+ } catch {}
1419
+ return normalized;
1440
1420
  } catch {}
1441
- return "native";
1421
+ return "dsh";
1442
1422
  }
1443
1423
  function applyPreset(id) {
1444
- try {
1445
- overrideDispose?.();
1446
- } catch {}
1447
- overrideDispose = null;
1448
- try {
1449
- fallbackDispose?.();
1450
- } catch {}
1451
- fallbackDispose = null;
1452
- if (id === "native") return;
1424
+ overrideDispose = release(overrideDispose);
1425
+ fallbackDispose = release(fallbackDispose);
1426
+ if (NOOP.has(id)) {
1427
+ ensureBaseline(false);
1428
+ return;
1429
+ }
1430
+ ensureBaseline(true);
1453
1431
  const overrides = buildOverrides(id);
1454
- if (theme && typeof theme.overrideTokens === "function") try {
1432
+ if (theme?.overrideTokens) try {
1455
1433
  overrideDispose = theme.overrideTokens("dsh-cool-theme", overrides);
1456
1434
  return;
1457
1435
  } catch {}
@@ -1463,88 +1441,13 @@ window.__ModuleLoader__.load({
1463
1441
  } catch {}
1464
1442
  applyPreset(id);
1465
1443
  }
1466
- try {
1467
- const init = getPreset();
1468
- if (init !== "native") applyPreset(init);
1469
- } catch {}
1470
- function hideGeneralAppearance() {
1471
- try {
1472
- const titles = document.querySelectorAll("[class*=\"AppearanceRow_title\"], [class*=\"title\"]");
1473
- for (const el of Array.from(titles)) {
1474
- const txt = (el.textContent || "").trim();
1475
- if (txt === "外观" || txt === "Appearance" || txt.toLowerCase() === "appearance") {
1476
- const group = el.closest("[class*=\"AppearanceRow_group\"]") || el.closest("[class*=\"group\"]") || el.parentElement;
1477
- if (group && group.querySelector("[class*=\"themeCube\"]")) group.style.display = "none";
1478
- }
1479
- }
1480
- const groups = document.querySelectorAll("[class*=\"AppearanceRow_group\"]");
1481
- for (const g of Array.from(groups)) if (g.querySelector("[class*=\"themeCube\"]")) g.style.display = "none";
1482
- } catch {}
1483
- }
1484
- function fixThemeNavIcon() {
1485
- try {
1486
- const cells = document.querySelectorAll("[class*=\"navCell\"]");
1487
- for (const cell of Array.from(cells)) {
1488
- const label = cell.querySelector("[class*=\"navLabel\"]");
1489
- if (!label) continue;
1490
- const txt = (label.textContent || "").trim();
1491
- if (txt !== "主题" && txt !== "Theme") continue;
1492
- const icon = cell.querySelector("svg");
1493
- if (!icon || icon.dataset.ctPalette === "1") continue;
1494
- const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1495
- svg.setAttribute("class", icon.getAttribute("class") || "");
1496
- svg.setAttribute("width", "16");
1497
- svg.setAttribute("height", "16");
1498
- svg.setAttribute("viewBox", "0 0 24 24");
1499
- svg.setAttribute("fill", "none");
1500
- svg.setAttribute("data-ct-palette", "1");
1501
- const body = document.createElementNS("http://www.w3.org/2000/svg", "path");
1502
- body.setAttribute("fill", "none");
1503
- body.setAttribute("stroke", "currentColor");
1504
- body.setAttribute("stroke-width", "2");
1505
- body.setAttribute("stroke-linecap", "round");
1506
- body.setAttribute("stroke-linejoin", "round");
1507
- body.setAttribute("d", PALETTE_ICON_PATH);
1508
- svg.appendChild(body);
1509
- for (const dot of PALETTE_ICON_DOTS) {
1510
- const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
1511
- circle.setAttribute("fill", "currentColor");
1512
- circle.setAttribute("stroke", "none");
1513
- circle.setAttribute("cx", dot.cx);
1514
- circle.setAttribute("cy", dot.cy);
1515
- circle.setAttribute("r", dot.r);
1516
- svg.appendChild(circle);
1517
- }
1518
- icon.replaceWith(svg);
1519
- }
1520
- } catch {}
1521
- }
1522
- hideGeneralAppearance();
1523
- fixThemeNavIcon();
1524
- try {
1525
- const obs = new MutationObserver(() => {
1526
- hideGeneralAppearance();
1527
- fixThemeNavIcon();
1528
- });
1529
- obs.observe(document.body, {
1530
- childList: true,
1531
- subtree: true
1532
- });
1533
- ctx.effect(() => () => obs.disconnect());
1534
- } catch {}
1444
+ applyPreset(getPreset());
1535
1445
  ctx.effect(() => () => {
1536
- try {
1537
- baseDisposer();
1538
- } catch {}
1539
- try {
1540
- overrideDispose?.();
1541
- } catch {}
1542
- try {
1543
- fallbackDispose?.();
1544
- } catch {}
1545
- try {
1546
- injector.disposeAll();
1547
- } catch {}
1446
+ release(pluginCssDisposer);
1447
+ baselineDisposer = release(baselineDisposer);
1448
+ overrideDispose = release(overrideDispose);
1449
+ fallbackDispose = release(fallbackDispose);
1450
+ injector.disposeAll();
1548
1451
  });
1549
1452
  slots.inject("settings.section", () => {
1550
1453
  const options = {
@@ -1561,6 +1464,300 @@ window.__ModuleLoader__.load({
1561
1464
  setPreset
1562
1465
  }));
1563
1466
  });
1467
+ const PALETTE_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M12 22a1 1 0 0 1 0-20a10 9 0 0 1 10 9a5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"/><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/></g></svg>";
1468
+ let paletteObs = null;
1469
+ function patchThemeNavIcon() {
1470
+ if (typeof document === "undefined") return;
1471
+ let currentLabel = "";
1472
+ try {
1473
+ currentLabel = t("nav");
1474
+ } catch {}
1475
+ const candidates = new Set([
1476
+ currentLabel,
1477
+ zh.nav,
1478
+ en.nav
1479
+ ].filter(Boolean));
1480
+ const cells = document.querySelectorAll("[class*=\"navCell\"], button[class*=\"navCell\"]");
1481
+ const toPatch = [];
1482
+ if (cells.length > 0) cells.forEach((c) => toPatch.push(c));
1483
+ else document.querySelectorAll("[class*=\"nav\"] button").forEach((b) => toPatch.push(b));
1484
+ for (const cell of toPatch) {
1485
+ const text = ((cell.querySelector("[class*=\"navLabel\"]") || cell)?.textContent || cell.textContent || "").trim();
1486
+ if (!Array.from(candidates).some((lbl) => text === lbl || text.includes(lbl))) continue;
1487
+ if (cell.querySelector("[data-palette-icon]")) continue;
1488
+ const svg = cell.querySelector("svg");
1489
+ if (!svg) continue;
1490
+ svg.style.display = "none";
1491
+ svg.setAttribute("data-palette-hidden", "1");
1492
+ const holder = document.createElement("span");
1493
+ holder.setAttribute("data-palette-icon", "1");
1494
+ holder.style.display = "inline-flex";
1495
+ holder.style.flex = "none";
1496
+ holder.setAttribute("aria-hidden", "true");
1497
+ holder.innerHTML = PALETTE_SVG;
1498
+ svg.parentNode?.insertBefore(holder, svg.nextSibling);
1499
+ }
1500
+ }
1501
+ if (typeof document !== "undefined" && typeof MutationObserver !== "undefined") {
1502
+ try {
1503
+ patchThemeNavIcon();
1504
+ } catch {}
1505
+ try {
1506
+ paletteObs = new MutationObserver(() => {
1507
+ try {
1508
+ patchThemeNavIcon();
1509
+ } catch {}
1510
+ });
1511
+ paletteObs.observe(document.body, {
1512
+ childList: true,
1513
+ subtree: true,
1514
+ characterData: true
1515
+ });
1516
+ } catch {}
1517
+ ctx.effect(() => () => {
1518
+ if (paletteObs) {
1519
+ try {
1520
+ paletteObs.disconnect();
1521
+ } catch {}
1522
+ paletteObs = null;
1523
+ }
1524
+ if (typeof document !== "undefined") {
1525
+ document.querySelectorAll("svg[data-palette-hidden=\"1\"]").forEach((el) => {
1526
+ el.style.display = "";
1527
+ el.removeAttribute("data-palette-hidden");
1528
+ });
1529
+ document.querySelectorAll("[data-palette-icon]").forEach((el) => el.remove());
1530
+ }
1531
+ });
1532
+ }
1533
+ const HIDE_APPEARANCE_CSS = ".OVFIkW_section [data-slot=\"settings.general.item\"] .D7wrZG_group{display:none !important;}";
1534
+ let hideCssDisposer = null;
1535
+ let apObs = null;
1536
+ function isAppearanceNode(el) {
1537
+ const text = el.textContent || "";
1538
+ const hasTitle = text.includes("外观") || text.includes("Appearance");
1539
+ const hasCubes = el.querySelector("[class*=\"themeCube\"]") !== null || el.querySelector("[class*=\"D7wrZG\"]") !== null;
1540
+ return hasTitle && hasCubes;
1541
+ }
1542
+ function hideAppearanceInGeneral() {
1543
+ if (typeof document === "undefined") return;
1544
+ const container = document.querySelector(".OVFIkW_section [data-slot=\"settings.general.item\"]");
1545
+ if (!container) return;
1546
+ for (const child of Array.from(container.children)) if (isAppearanceNode(child)) child.style.display = "none";
1547
+ }
1548
+ slots.inject("settings.general.item", () => {
1549
+ try {
1550
+ hideCssDisposer = injector.insert(HIDE_APPEARANCE_CSS);
1551
+ } catch {}
1552
+ let disposeShadow = null;
1553
+ try {
1554
+ disposeShadow = slots.register({
1555
+ name: "settings.general.item",
1556
+ id: "appearance",
1557
+ priority: -1
1558
+ }, () => null);
1559
+ } catch {}
1560
+ if (typeof MutationObserver !== "undefined" && typeof document !== "undefined") {
1561
+ hideAppearanceInGeneral();
1562
+ try {
1563
+ apObs = new MutationObserver(hideAppearanceInGeneral);
1564
+ const target = document.body;
1565
+ apObs.observe(target, {
1566
+ childList: true,
1567
+ subtree: true
1568
+ });
1569
+ } catch {}
1570
+ }
1571
+ return () => {
1572
+ if (disposeShadow) {
1573
+ try {
1574
+ disposeShadow();
1575
+ } catch {}
1576
+ disposeShadow = null;
1577
+ }
1578
+ if (hideCssDisposer) {
1579
+ try {
1580
+ hideCssDisposer();
1581
+ } catch {}
1582
+ hideCssDisposer = null;
1583
+ }
1584
+ if (apObs) {
1585
+ try {
1586
+ apObs.disconnect();
1587
+ } catch {}
1588
+ apObs = null;
1589
+ }
1590
+ if (typeof document !== "undefined") {
1591
+ const container = document.querySelector(".OVFIkW_section [data-slot=\"settings.general.item\"]");
1592
+ if (container) for (const child of Array.from(container.children)) {
1593
+ const el = child;
1594
+ if (el.style.display === "none") el.style.display = "";
1595
+ }
1596
+ }
1597
+ };
1598
+ });
1599
+ function collectThemeLabels() {
1600
+ const s = /* @__PURE__ */ new Set();
1601
+ try {
1602
+ const cur = t("nav");
1603
+ if (cur) s.add(cur);
1604
+ } catch {}
1605
+ if (zh.nav) s.add(zh.nav);
1606
+ if (en.nav) s.add(en.nav);
1607
+ return s;
1608
+ }
1609
+ function isSettingsPanelOpen() {
1610
+ if (typeof document === "undefined") return false;
1611
+ return document.querySelector("[role=\"dialog\"][aria-modal=\"true\"]") !== null;
1612
+ }
1613
+ function findSettingsTrigger() {
1614
+ if (typeof document === "undefined") return null;
1615
+ const btn = document.querySelector("button[aria-haspopup=\"dialog\"]");
1616
+ if (btn) return btn;
1617
+ for (const b of Array.from(document.querySelectorAll("button"))) {
1618
+ const txt = (b.textContent || "").trim();
1619
+ if (txt.includes("设置") || txt.toLowerCase().includes("settings")) {
1620
+ if (b.getAttribute("aria-haspopup") === "dialog" || b.getAttribute("aria-expanded") !== null) return b;
1621
+ }
1622
+ }
1623
+ return null;
1624
+ }
1625
+ function findThemeNavCell(labels) {
1626
+ if (typeof document === "undefined") return null;
1627
+ const cells = document.querySelectorAll("[class*=\"navCell\"]");
1628
+ if (cells.length > 0) for (const c of Array.from(cells)) {
1629
+ const text = ((c.querySelector("[class*=\"navLabel\"]") || c).textContent || c.textContent || "").trim();
1630
+ for (const lbl of labels) if (text === lbl || text.includes(lbl)) return c;
1631
+ }
1632
+ const navButtons = document.querySelectorAll("[class*=\"nav\"] button, nav button");
1633
+ for (const b of Array.from(navButtons)) {
1634
+ const text = (b.textContent || "").trim();
1635
+ for (const lbl of labels) if (text === lbl || text.includes(lbl)) return b;
1636
+ }
1637
+ return null;
1638
+ }
1639
+ function openCoolThemeSettings() {
1640
+ if (typeof document === "undefined") return false;
1641
+ const labels = collectThemeLabels();
1642
+ if (isSettingsPanelOpen()) {
1643
+ const cell = findThemeNavCell(labels);
1644
+ if (cell) {
1645
+ try {
1646
+ cell.click();
1647
+ } catch {}
1648
+ return true;
1649
+ }
1650
+ return false;
1651
+ }
1652
+ const trigger = findSettingsTrigger();
1653
+ if (!trigger) return false;
1654
+ try {
1655
+ trigger.click();
1656
+ } catch {
1657
+ return false;
1658
+ }
1659
+ let attempts = 0;
1660
+ const maxAttempts = 40;
1661
+ const timer = setInterval(() => {
1662
+ attempts++;
1663
+ try {
1664
+ patchThemeNavIcon();
1665
+ } catch {}
1666
+ const cell = findThemeNavCell(labels);
1667
+ if (cell) {
1668
+ clearInterval(timer);
1669
+ setTimeout(() => {
1670
+ try {
1671
+ cell.click();
1672
+ } catch {}
1673
+ }, 30);
1674
+ return;
1675
+ }
1676
+ if (attempts >= maxAttempts) clearInterval(timer);
1677
+ }, 50);
1678
+ setTimeout(() => {
1679
+ try {
1680
+ patchThemeNavIcon();
1681
+ } catch {}
1682
+ }, 120);
1683
+ return true;
1684
+ }
1685
+ try {
1686
+ ctx.inject(["commandUi", "locale"], (scope) => {
1687
+ const commandUi = scope.get("commandUi");
1688
+ const loc = scope.get("locale");
1689
+ if (!commandUi || !loc) return;
1690
+ let dispose = null;
1691
+ const sync = () => {
1692
+ if (dispose) {
1693
+ try {
1694
+ dispose();
1695
+ } catch {}
1696
+ dispose = null;
1697
+ }
1698
+ try {
1699
+ dispose = commandUi.register({
1700
+ name: "cool-theme",
1701
+ description: t("command.desc"),
1702
+ available: () => true,
1703
+ ui: {
1704
+ kind: "popupSelect",
1705
+ options: async () => [{
1706
+ id: "open",
1707
+ label: t("command.open"),
1708
+ detail: t("command.detail")
1709
+ }],
1710
+ onSelect: async () => {
1711
+ openCoolThemeSettings();
1712
+ }
1713
+ }
1714
+ });
1715
+ } catch {}
1716
+ };
1717
+ sync();
1718
+ let off = null;
1719
+ try {
1720
+ off = loc.subscribe(sync);
1721
+ } catch {}
1722
+ scope.effect(() => () => {
1723
+ if (off) {
1724
+ try {
1725
+ off();
1726
+ } catch {}
1727
+ off = null;
1728
+ }
1729
+ if (dispose) {
1730
+ try {
1731
+ dispose();
1732
+ } catch {}
1733
+ dispose = null;
1734
+ }
1735
+ }, "dsh-cool-theme: /cool-theme contribution");
1736
+ });
1737
+ } catch {}
1738
+ if (typeof document !== "undefined") {
1739
+ const onKey = (e) => {
1740
+ if (!(e.ctrlKey || e.metaKey) || !e.shiftKey) return;
1741
+ if (e.key.toLowerCase() !== "t") return;
1742
+ const target = e.target;
1743
+ if (target) {
1744
+ const tag = target.tagName?.toLowerCase();
1745
+ if (tag === "input" || tag === "textarea" || target.isContentEditable) return;
1746
+ }
1747
+ e.preventDefault();
1748
+ try {
1749
+ openCoolThemeSettings();
1750
+ } catch {}
1751
+ };
1752
+ try {
1753
+ document.addEventListener("keydown", onKey);
1754
+ ctx.effect(() => () => {
1755
+ try {
1756
+ document.removeEventListener("keydown", onKey);
1757
+ } catch {}
1758
+ });
1759
+ } catch {}
1760
+ }
1564
1761
  }
1565
1762
  //#endregion
1566
1763
  //#region src/client/index.ts