dsh-theme-escook 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -23
- package/README.zh.md +25 -30
- package/client/client.bundle.js +251 -310
- package/client/client.js +74 -333
- package/client/palette.js +76 -51
- package/client/theme-settings.js +32 -0
- package/package.json +5 -3
package/client/client.bundle.js
CHANGED
|
@@ -27,339 +27,280 @@ var client_exports = {};
|
|
|
27
27
|
__export(client_exports, {
|
|
28
28
|
THEME_SCHEMES: () => THEME_SCHEMES,
|
|
29
29
|
apply: () => apply,
|
|
30
|
-
default: () => activate
|
|
30
|
+
default: () => activate,
|
|
31
|
+
inject: () => inject
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(client_exports);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
|
|
35
|
+
// client/palette.js
|
|
36
|
+
var PALETTES = {
|
|
37
|
+
dark: {
|
|
38
|
+
name: "\u7ECF\u5178\u6697\u9ED1",
|
|
37
39
|
type: "dark",
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
--dsw-specific-sidebar-nav-item-active: rgba(239, 130, 12, 0.2) !important;
|
|
54
|
-
--dsw-specific-sidebar-nav-item-active-accent: #ef820c !important;
|
|
55
|
-
--dsw-specific-input-major: #29292c !important;
|
|
56
|
-
--dsw-specific-bubble: #29292c !important;
|
|
57
|
-
--dsw-specific-menu: #202021 !important;
|
|
58
|
-
--dsw-hovercard-bg: #29292c !important;
|
|
59
|
-
--dsw-alias-tooltip-bg: #1c1c1d !important;
|
|
60
|
-
--dsw-alias-button-elevated-fill: #2f2f33 !important;
|
|
61
|
-
--dsw-alias-button-floating-hover: #38383c !important;
|
|
62
|
-
--dsw-alias-brand-primary: #ef820c !important;
|
|
63
|
-
--dsw-alias-button-primary-fill: #ef820c !important;
|
|
64
|
-
--dsw-alias-button-primary-hover: #ff9940 !important;
|
|
65
|
-
--dsw-alias-label-primary-foreground: #ffffff !important;
|
|
66
|
-
--dsw-alias-label-primary: #fafafa !important;
|
|
67
|
-
--dsw-alias-label-secondary: #cccccc !important;
|
|
68
|
-
--dsw-alias-label-tertiary: #888888 !important;
|
|
69
|
-
--dsw-alias-label-dimmed: #555555 !important;
|
|
70
|
-
--dsw-alias-label-caption: #888888 !important;
|
|
71
|
-
--dsw-alias-interactive-bg-hover: rgba(239, 130, 12, 0.1) !important;
|
|
72
|
-
--dsw-alias-interactive-bg-active: rgba(239, 130, 12, 0.2) !important;
|
|
73
|
-
--dsw-alias-border-l1: #333333 !important;
|
|
74
|
-
--dsw-alias-border-l2: #2a2a2a !important;
|
|
75
|
-
--dsw-alias-border-l3: #3e3e3e !important;
|
|
76
|
-
--dsw-alias-border-l4: #555555 !important;
|
|
77
|
-
--dsw-alias-markdown-code-block: #1c1c1d !important;
|
|
78
|
-
--dsw-alias-markdown-code-block-banner: #252526 !important;
|
|
79
|
-
--dsw-alias-scrollbar-bg-l2: #333333 !important;
|
|
80
|
-
--dsw-alias-scrollbar-hover-l2: #ef820c !important;
|
|
81
|
-
}
|
|
82
|
-
body, body[data-ds-dark-theme] { background-color: #252526 !important; color: #fafafa !important; }
|
|
83
|
-
pre, code, [class*="codeBlock"] {
|
|
84
|
-
background-color: #1c1c1d !important;
|
|
85
|
-
color: #fafafa !important;
|
|
86
|
-
border-color: #333333 !important;
|
|
87
|
-
}
|
|
88
|
-
[class*="selector"], [class*="themeCube"] {
|
|
89
|
-
color: #fafafa !important;
|
|
90
|
-
background-color: #2d2d30 !important;
|
|
91
|
-
}
|
|
92
|
-
[class*="selected"], [class*="themeCube"]:hover {
|
|
93
|
-
border-color: #ef820c !important;
|
|
94
|
-
}
|
|
95
|
-
`
|
|
40
|
+
bg: "#252526",
|
|
41
|
+
sidebar: "#202021",
|
|
42
|
+
surface: "#29292c",
|
|
43
|
+
layer: "#2d2d30",
|
|
44
|
+
hover: "#363638",
|
|
45
|
+
selected: "#403628",
|
|
46
|
+
accent: "#ef820c",
|
|
47
|
+
accentHover: "#ff9940",
|
|
48
|
+
brand: "#ef820c",
|
|
49
|
+
foreground: "#202021",
|
|
50
|
+
text: "#fafafa",
|
|
51
|
+
secondary: "#cccccc",
|
|
52
|
+
muted: "#b6b6bd",
|
|
53
|
+
border: "#606065",
|
|
54
|
+
code: "#1c1c1d"
|
|
96
55
|
},
|
|
97
56
|
"dark-soft": {
|
|
98
|
-
name: "
|
|
99
|
-
desc: "Ayu \u7ECF\u5178\u6DF1\u6D77\u84DD\u7070\u5E95\u8272\u642D\u914D\u6E29\u6DA6\u5976\u674F\u9EC4\uFF0C\u7EC6\u817B\u67D4\u548C\u957F\u6548\u9632\u75B2\u52B3",
|
|
57
|
+
name: "\u67D4\u548C\u6697\u9ED1",
|
|
100
58
|
type: "dark",
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
--dsw-specific-sidebar-nav-item-active: rgba(255, 204, 102, 0.18) !important;
|
|
117
|
-
--dsw-specific-sidebar-nav-item-active-accent: #ffcc66 !important;
|
|
118
|
-
--dsw-specific-input-major: #232834 !important;
|
|
119
|
-
--dsw-specific-bubble: #232834 !important;
|
|
120
|
-
--dsw-specific-menu: #191e28 !important;
|
|
121
|
-
--dsw-hovercard-bg: #191e28 !important;
|
|
122
|
-
--dsw-alias-tooltip-bg: #171b24 !important;
|
|
123
|
-
--dsw-alias-button-elevated-fill: #2b3140 !important;
|
|
124
|
-
--dsw-alias-button-floating-hover: #333a4c !important;
|
|
125
|
-
--dsw-alias-brand-primary: #ffcc66 !important;
|
|
126
|
-
--dsw-alias-button-primary-fill: #ffcc66 !important;
|
|
127
|
-
--dsw-alias-button-primary-hover: #ffd580 !important;
|
|
128
|
-
--dsw-alias-label-primary-foreground: #1f2430 !important;
|
|
129
|
-
--dsw-alias-label-primary: #cbccc6 !important;
|
|
130
|
-
--dsw-alias-label-secondary: #969aa4 !important;
|
|
131
|
-
--dsw-alias-label-tertiary: #707a8c !important;
|
|
132
|
-
--dsw-alias-label-dimmed: #515764 !important;
|
|
133
|
-
--dsw-alias-label-caption: #707a8c !important;
|
|
134
|
-
--dsw-alias-interactive-bg-hover: rgba(255, 204, 102, 0.1) !important;
|
|
135
|
-
--dsw-alias-interactive-bg-active: rgba(255, 204, 102, 0.18) !important;
|
|
136
|
-
--dsw-alias-border-l1: #373e4c !important;
|
|
137
|
-
--dsw-alias-border-l2: #2d3340 !important;
|
|
138
|
-
--dsw-alias-border-l3: #444c5e !important;
|
|
139
|
-
--dsw-alias-border-l4: #515764 !important;
|
|
140
|
-
--dsw-alias-markdown-code-block: #171b24 !important;
|
|
141
|
-
--dsw-alias-markdown-code-block-banner: #1f2430 !important;
|
|
142
|
-
--dsw-alias-scrollbar-bg-l2: #373e4c !important;
|
|
143
|
-
--dsw-alias-scrollbar-hover-l2: #ffcc66 !important;
|
|
144
|
-
}
|
|
145
|
-
body, body[data-ds-dark-theme] { background-color: #1f2430 !important; color: #cbccc6 !important; }
|
|
146
|
-
pre, code, [class*="codeBlock"] {
|
|
147
|
-
background-color: #171b24 !important;
|
|
148
|
-
color: #cbccc6 !important;
|
|
149
|
-
border-color: #373e4c !important;
|
|
150
|
-
}
|
|
151
|
-
[class*="selector"], [class*="themeCube"] {
|
|
152
|
-
color: #cbccc6 !important;
|
|
153
|
-
background-color: #262c3b !important;
|
|
154
|
-
}
|
|
155
|
-
[class*="selected"], [class*="themeCube"]:hover {
|
|
156
|
-
border-color: #ffcc66 !important;
|
|
157
|
-
}
|
|
158
|
-
`
|
|
59
|
+
bg: "#1f2430",
|
|
60
|
+
sidebar: "#191e28",
|
|
61
|
+
surface: "#232834",
|
|
62
|
+
layer: "#262c3b",
|
|
63
|
+
hover: "#333a4c",
|
|
64
|
+
selected: "#41404a",
|
|
65
|
+
accent: "#ffcc66",
|
|
66
|
+
accentHover: "#ffd580",
|
|
67
|
+
brand: "#ffcc66",
|
|
68
|
+
foreground: "#1f2430",
|
|
69
|
+
text: "#eceee9",
|
|
70
|
+
secondary: "#c1c5cf",
|
|
71
|
+
muted: "#b6bcc9",
|
|
72
|
+
border: "#68738a",
|
|
73
|
+
code: "#171b24"
|
|
159
74
|
},
|
|
160
|
-
|
|
161
|
-
name: "
|
|
162
|
-
desc: "Solarized \u7ECF\u5178\u62A4\u773C\u6696\u7C73\u767D\u642D\u914D\u5178\u96C5\u7D2B\u7F57\u5170\u4E0E\u9752\u58A8\u6587\u672C\uFF0C\u6E29\u6DA6\u7EB8\u8D28\u4E66\u5377\u611F",
|
|
75
|
+
light: {
|
|
76
|
+
name: "\u7ECF\u5178\u6D45\u8272",
|
|
163
77
|
type: "light",
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
--dsw-specific-sidebar-nav-item-active: rgba(112, 86, 151, 0.16) !important;
|
|
180
|
-
--dsw-specific-sidebar-nav-item-active-accent: #705697 !important;
|
|
181
|
-
--dsw-specific-input-major: #ffffff !important;
|
|
182
|
-
--dsw-specific-bubble: #ffffff !important;
|
|
183
|
-
--dsw-specific-menu: #ffffff !important;
|
|
184
|
-
--dsw-hovercard-bg: #ffffff !important;
|
|
185
|
-
--dsw-alias-tooltip-bg: #2b2638 !important;
|
|
186
|
-
--dsw-alias-button-elevated-fill: #f4ecce !important;
|
|
187
|
-
--dsw-alias-button-floating-hover: #ece2c4 !important;
|
|
188
|
-
--dsw-alias-brand-primary: #705697 !important;
|
|
189
|
-
--dsw-alias-button-primary-fill: #705697 !important;
|
|
190
|
-
--dsw-alias-button-primary-hover: #876cad !important;
|
|
191
|
-
--dsw-alias-label-primary-foreground: #ffffff !important;
|
|
192
|
-
--dsw-alias-label-primary: #586e75 !important;
|
|
193
|
-
--dsw-alias-label-secondary: #657b83 !important;
|
|
194
|
-
--dsw-alias-label-tertiary: #93a1a1 !important;
|
|
195
|
-
--dsw-alias-label-dimmed: #b58900 !important;
|
|
196
|
-
--dsw-alias-label-caption: #93a1a1 !important;
|
|
197
|
-
--dsw-alias-interactive-bg-hover: rgba(112, 86, 151, 0.08) !important;
|
|
198
|
-
--dsw-alias-interactive-bg-active: rgba(112, 86, 151, 0.15) !important;
|
|
199
|
-
--dsw-alias-border-l1: #e3dac6 !important;
|
|
200
|
-
--dsw-alias-border-l2: #ece3cf !important;
|
|
201
|
-
--dsw-alias-border-l3: #d8ceb8 !important;
|
|
202
|
-
--dsw-alias-border-l4: #b58900 !important;
|
|
203
|
-
--dsw-alias-markdown-code-block: #f5eed8 !important;
|
|
204
|
-
--dsw-alias-markdown-code-block-banner: #ebe4cc !important;
|
|
205
|
-
--dsw-alias-scrollbar-bg-l2: #e3dac6 !important;
|
|
206
|
-
--dsw-alias-scrollbar-hover-l2: #705697 !important;
|
|
207
|
-
}
|
|
208
|
-
body, body[data-ds-dark-theme] { background-color: #fdf6e3 !important; color: #586e75 !important; }
|
|
209
|
-
pre, code, [class*="codeBlock"] {
|
|
210
|
-
background-color: #f5eed8 !important;
|
|
211
|
-
color: #586e75 !important;
|
|
212
|
-
border-color: #e3dac6 !important;
|
|
213
|
-
}
|
|
214
|
-
[class*="selector"], [class*="themeCube"] {
|
|
215
|
-
color: #586e75 !important;
|
|
216
|
-
background-color: #eee8d5 !important;
|
|
217
|
-
}
|
|
218
|
-
[class*="selected"], [class*="themeCube"]:hover {
|
|
219
|
-
border-color: #705697 !important;
|
|
220
|
-
}
|
|
221
|
-
`
|
|
78
|
+
bg: "#fdf6e3",
|
|
79
|
+
sidebar: "#f8f0d8",
|
|
80
|
+
surface: "#ffffff",
|
|
81
|
+
layer: "#eee8d5",
|
|
82
|
+
hover: "#e9e2d2",
|
|
83
|
+
selected: "#e1d8cc",
|
|
84
|
+
accent: "#705697",
|
|
85
|
+
accentHover: "#654c89",
|
|
86
|
+
brand: "#705697",
|
|
87
|
+
foreground: "#ffffff",
|
|
88
|
+
text: "#35484f",
|
|
89
|
+
secondary: "#465a61",
|
|
90
|
+
muted: "#4c5e66",
|
|
91
|
+
border: "#8b8173",
|
|
92
|
+
code: "#f5eed8"
|
|
222
93
|
},
|
|
223
94
|
"light-soft": {
|
|
224
|
-
name: "
|
|
225
|
-
desc: "\u73B0\u4EE3\u6781\u7B80\u6E05\u900F\u6D45\u7070\u642D\u914D\u67D4\u548C\u6D3B\u529B\u6A59\uFF0C\u660E\u4EAE\u6E05\u723D\u4E0D\u523A\u773C",
|
|
95
|
+
name: "\u67D4\u548C\u6D45\u8272",
|
|
226
96
|
type: "light",
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
--dsw-specific-sidebar-nav-item-active: rgba(255, 153, 64, 0.16) !important;
|
|
243
|
-
--dsw-specific-sidebar-nav-item-active-accent: #ff9940 !important;
|
|
244
|
-
--dsw-specific-input-major: #ffffff !important;
|
|
245
|
-
--dsw-specific-bubble: #ffffff !important;
|
|
246
|
-
--dsw-specific-menu: #ffffff !important;
|
|
247
|
-
--dsw-hovercard-bg: #ffffff !important;
|
|
248
|
-
--dsw-alias-tooltip-bg: #2d3748 !important;
|
|
249
|
-
--dsw-alias-button-elevated-fill: #eaeaea !important;
|
|
250
|
-
--dsw-alias-button-floating-hover: #e0e0e0 !important;
|
|
251
|
-
--dsw-alias-brand-primary: #ff9940 !important;
|
|
252
|
-
--dsw-alias-button-primary-fill: #ff9940 !important;
|
|
253
|
-
--dsw-alias-button-primary-hover: #f58220 !important;
|
|
254
|
-
--dsw-alias-label-primary-foreground: #ffffff !important;
|
|
255
|
-
--dsw-alias-label-primary: #2d3748 !important;
|
|
256
|
-
--dsw-alias-label-secondary: #4a5568 !important;
|
|
257
|
-
--dsw-alias-label-tertiary: #718096 !important;
|
|
258
|
-
--dsw-alias-label-dimmed: #a0aec0 !important;
|
|
259
|
-
--dsw-alias-label-caption: #718096 !important;
|
|
260
|
-
--dsw-alias-interactive-bg-hover: rgba(255, 153, 64, 0.08) !important;
|
|
261
|
-
--dsw-alias-interactive-bg-active: rgba(255, 153, 64, 0.15) !important;
|
|
262
|
-
--dsw-alias-border-l1: #dcdcdc !important;
|
|
263
|
-
--dsw-alias-border-l2: #e8e8e8 !important;
|
|
264
|
-
--dsw-alias-border-l3: #d0d0d0 !important;
|
|
265
|
-
--dsw-alias-border-l4: #a0aec0 !important;
|
|
266
|
-
--dsw-alias-markdown-code-block: #f0f2f5 !important;
|
|
267
|
-
--dsw-alias-markdown-code-block-banner: #e6e9ee !important;
|
|
268
|
-
--dsw-alias-scrollbar-bg-l2: #dcdcdc !important;
|
|
269
|
-
--dsw-alias-scrollbar-hover-l2: #ff9940 !important;
|
|
270
|
-
}
|
|
271
|
-
body, body[data-ds-dark-theme] { background-color: #fafafa !important; color: #2d3748 !important; }
|
|
272
|
-
pre, code, [class*="codeBlock"] {
|
|
273
|
-
background-color: #f0f2f5 !important;
|
|
274
|
-
color: #2d3748 !important;
|
|
275
|
-
border-color: #dcdcdc !important;
|
|
276
|
-
}
|
|
277
|
-
[class*="selector"], [class*="themeCube"] {
|
|
278
|
-
color: #2d3748 !important;
|
|
279
|
-
background-color: #e8e8e8 !important;
|
|
280
|
-
}
|
|
281
|
-
[class*="selected"], [class*="themeCube"]:hover {
|
|
282
|
-
border-color: #ff9940 !important;
|
|
283
|
-
}
|
|
284
|
-
`
|
|
97
|
+
bg: "#fafafa",
|
|
98
|
+
sidebar: "#f2f2f2",
|
|
99
|
+
surface: "#ffffff",
|
|
100
|
+
layer: "#e8e8e8",
|
|
101
|
+
hover: "#e4e4e4",
|
|
102
|
+
selected: "#f1dfca",
|
|
103
|
+
accent: "#ff9940",
|
|
104
|
+
accentHover: "#f58220",
|
|
105
|
+
brand: "#934400",
|
|
106
|
+
foreground: "#222936",
|
|
107
|
+
text: "#2d3748",
|
|
108
|
+
secondary: "#4a5568",
|
|
109
|
+
muted: "#505d70",
|
|
110
|
+
border: "#838b96",
|
|
111
|
+
code: "#f0f2f5"
|
|
285
112
|
}
|
|
286
113
|
};
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
114
|
+
function tokens(p) {
|
|
115
|
+
return {
|
|
116
|
+
"--dsw-alias-bg-base": p.bg,
|
|
117
|
+
"--dsw-alias-bg-layer-1": p.sidebar,
|
|
118
|
+
"--dsw-alias-bg-layer-2": p.surface,
|
|
119
|
+
"--dsw-alias-bg-layer-3": p.layer,
|
|
120
|
+
"--dsw-alias-bg-module-platform": p.layer,
|
|
121
|
+
"--dsw-alias-bg-multi-select": p.selected,
|
|
122
|
+
"--dsw-alias-bg-overlay": p.surface,
|
|
123
|
+
"--dsw-specific-selector": p.layer,
|
|
124
|
+
"--dsw-specific-sidebar-fill": p.sidebar,
|
|
125
|
+
"--dsw-specific-sidebar-nav-item-hover": p.hover,
|
|
126
|
+
"--dsw-specific-sidebar-nav-item-active": p.selected,
|
|
127
|
+
"--dsw-specific-sidebar-nav-item-active-accent": p.brand,
|
|
128
|
+
"--dsw-specific-input-major": p.surface,
|
|
129
|
+
"--dsw-specific-login-input": p.surface,
|
|
130
|
+
"--dsw-specific-bubble": p.surface,
|
|
131
|
+
"--dsw-specific-menu": p.surface,
|
|
132
|
+
"--dsw-menu-surface-fill": p.surface,
|
|
133
|
+
"--dsw-alias-menu-group-header-fill": p.surface,
|
|
134
|
+
"--dsw-alias-menu-icon": p.text,
|
|
135
|
+
"--dsw-hovercard-bg": p.surface,
|
|
136
|
+
"--dsw-alias-tooltip-bg": "#222936",
|
|
137
|
+
"--escook-tooltip-text": "#ffffff",
|
|
138
|
+
"--dsw-alias-button-elevated-fill": p.surface,
|
|
139
|
+
"--dsw-alias-button-floating-fill": p.surface,
|
|
140
|
+
"--dsw-alias-button-floating-hover": p.hover,
|
|
141
|
+
"--dsw-alias-button-ghost-active-fill": p.selected,
|
|
142
|
+
"--dsw-alias-button-ghost-active-hover": p.hover,
|
|
143
|
+
"--dsw-alias-button-ghost-active-border": p.border,
|
|
144
|
+
"--dsw-alias-brand-primary": p.brand,
|
|
145
|
+
"--dsw-alias-link": p.brand,
|
|
146
|
+
"--dsw-alias-button-primary-fill": p.accent,
|
|
147
|
+
"--dsw-alias-button-primary-hover": p.accentHover,
|
|
148
|
+
"--dsw-alias-label-primary-foreground": p.foreground,
|
|
149
|
+
"--dsw-alias-label-primary": p.text,
|
|
150
|
+
"--dsw-alias-label-primary-dimmed": p.secondary,
|
|
151
|
+
"--dsw-alias-label-primary-bluish": p.text,
|
|
152
|
+
"--dsw-alias-label-document-preview": p.secondary,
|
|
153
|
+
"--dsw-alias-label-secondary": p.secondary,
|
|
154
|
+
"--dsw-alias-label-tertiary": p.muted,
|
|
155
|
+
"--dsw-alias-label-dimmed": p.muted,
|
|
156
|
+
"--dsw-alias-label-caption": p.muted,
|
|
157
|
+
"--dsw-alias-interactive-bg-hover": p.hover,
|
|
158
|
+
"--dsw-alias-interactive-bg-active": p.selected,
|
|
159
|
+
"--dsw-alias-border-l1": p.border,
|
|
160
|
+
"--dsw-alias-border-l2": p.border,
|
|
161
|
+
"--dsw-alias-border-l3": p.border,
|
|
162
|
+
"--dsw-alias-border-l4": p.border,
|
|
163
|
+
"--dsw-alias-markdown-code-block": p.code,
|
|
164
|
+
"--dsw-alias-markdown-code-block-banner": p.layer,
|
|
165
|
+
"--dsw-alias-scrollbar-bg-l2": p.border,
|
|
166
|
+
"--dsw-alias-scrollbar-hover-l2": p.brand
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
var THEME_SCHEMES = Object.fromEntries(Object.entries(PALETTES).map(([key, palette]) => [key, {
|
|
170
|
+
id: `escook-${key}`,
|
|
171
|
+
name: palette.name,
|
|
172
|
+
type: palette.type,
|
|
173
|
+
colorPreview: palette.accent,
|
|
174
|
+
bgPreview: palette.bg,
|
|
175
|
+
tokens: tokens(palette)
|
|
176
|
+
}]));
|
|
177
|
+
|
|
178
|
+
// client/theme-settings.js
|
|
179
|
+
var import_react = require("react");
|
|
180
|
+
function ThemeSettings({ controller }) {
|
|
181
|
+
const selected = (0, import_react.useSyncExternalStore)(controller.subscribe, controller.getCurrentScheme, controller.getCurrentScheme);
|
|
182
|
+
const options = [...Object.entries(THEME_SCHEMES), ["application", { name: "\u8DDF\u968F\u5E94\u7528" }]];
|
|
183
|
+
return (0, import_react.createElement)(
|
|
184
|
+
"section",
|
|
185
|
+
{ className: "escook-settings", "aria-label": "Escook \u4E3B\u9898" },
|
|
186
|
+
(0, import_react.createElement)("h3", null, "Escook \u4E3B\u9898"),
|
|
187
|
+
(0, import_react.createElement)("p", null, "\u9009\u62E9\u914D\u8272\u540E\u7ACB\u5373\u751F\u6548\u3002\u9009\u62E9\u201C\u8DDF\u968F\u5E94\u7528\u201D\u540E\uFF0C\u53EF\u4F7F\u7528\u4E0A\u65B9\u7684\u5E94\u7528\u5916\u89C2\u8BBE\u7F6E\u3002"),
|
|
188
|
+
(0, import_react.createElement)(
|
|
189
|
+
"div",
|
|
190
|
+
{ className: "escook-settings-options", role: "group", "aria-label": "\u4E3B\u9898\u914D\u8272" },
|
|
191
|
+
options.map(([key, scheme]) => (0, import_react.createElement)("button", {
|
|
192
|
+
key,
|
|
193
|
+
type: "button",
|
|
194
|
+
"data-escook-scheme": key,
|
|
195
|
+
"aria-pressed": selected === key,
|
|
196
|
+
onClick: () => controller.setScheme(key)
|
|
197
|
+
}, scheme.bgPreview && (0, import_react.createElement)("span", {
|
|
198
|
+
className: "escook-settings-preview",
|
|
199
|
+
"aria-hidden": true,
|
|
200
|
+
style: { background: scheme.bgPreview, borderColor: scheme.colorPreview }
|
|
201
|
+
}, (0, import_react.createElement)("span", { style: { background: scheme.colorPreview } })), scheme.name))
|
|
202
|
+
)
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
var SETTINGS_CSS = `
|
|
206
|
+
.escook-settings{padding:16px 0;border-bottom:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}
|
|
207
|
+
.escook-settings h3{font-size:14px;font-weight:500;margin:0 0 8px}
|
|
208
|
+
.escook-settings p{font-size:13px;color:var(--dsw-alias-label-secondary);margin:0 0 12px;line-height:1.6}
|
|
209
|
+
.escook-settings-options{display:flex;flex-wrap:wrap;gap:8px}
|
|
210
|
+
.escook-settings-options button{display:flex;align-items:center;gap:8px;min-height:44px;padding:10px 14px;font:inherit;font-size:14px;border:1px solid var(--dsw-alias-border-l4);border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);cursor:pointer}
|
|
211
|
+
.escook-settings-options button:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
212
|
+
.escook-settings-options button[aria-pressed="true"]{background:var(--dsw-alias-interactive-bg-active);border-color:var(--dsw-alias-brand-primary);box-shadow:inset 0 0 0 1px var(--dsw-alias-brand-primary)}
|
|
213
|
+
.escook-settings-options button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}
|
|
214
|
+
.escook-settings-preview{display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;border:2px solid;border-radius:6px}
|
|
215
|
+
.escook-settings-preview span{width:10px;height:10px;border-radius:50%}
|
|
216
|
+
`;
|
|
217
|
+
|
|
218
|
+
// client/client.js
|
|
219
|
+
var inject = ["theme", "slots"];
|
|
220
|
+
var STORAGE_KEY = "dsh_theme_escook_scheme";
|
|
221
|
+
function activate(ctx) {
|
|
222
|
+
const cleanups = [];
|
|
223
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
224
|
+
const previousPreference = ctx.theme.getTheme().preference;
|
|
225
|
+
let disposed = false;
|
|
226
|
+
const read = () => {
|
|
227
|
+
try {
|
|
228
|
+
return localStorage.getItem(STORAGE_KEY) || localStorage.getItem("dsh_selected_theme");
|
|
229
|
+
} catch {
|
|
230
|
+
return null;
|
|
321
231
|
}
|
|
322
|
-
|
|
323
|
-
|
|
232
|
+
};
|
|
233
|
+
const save = (key) => {
|
|
324
234
|
try {
|
|
325
|
-
localStorage.setItem(
|
|
326
|
-
} catch
|
|
235
|
+
localStorage.setItem(STORAGE_KEY, key);
|
|
236
|
+
} catch {
|
|
327
237
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
try {
|
|
332
|
-
savedScheme = localStorage.getItem(storageKey) || localStorage.getItem("dsh_selected_theme") || "dark-soft";
|
|
333
|
-
} catch (e) {
|
|
334
|
-
}
|
|
335
|
-
applyScheme(savedScheme);
|
|
336
|
-
const themeController = {
|
|
238
|
+
};
|
|
239
|
+
const current = () => Object.keys(THEME_SCHEMES).find((key) => THEME_SCHEMES[key].id === ctx.theme.getTheme().preference) || "application";
|
|
240
|
+
const controller = {
|
|
337
241
|
schemes: Object.keys(THEME_SCHEMES),
|
|
338
|
-
|
|
339
|
-
|
|
242
|
+
subscribe(listener) {
|
|
243
|
+
listeners.add(listener);
|
|
244
|
+
return () => listeners.delete(listener);
|
|
340
245
|
},
|
|
341
|
-
getCurrentScheme
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
246
|
+
getCurrentScheme: current,
|
|
247
|
+
setScheme(key) {
|
|
248
|
+
if (disposed) return;
|
|
249
|
+
if (key !== "application" && !THEME_SCHEMES[key]) throw new Error(`\u672A\u77E5 Escook \u4E3B\u9898\uFF1A${key}`);
|
|
250
|
+
ctx.theme.setTheme(key === "application" ? "system" : THEME_SCHEMES[key].id);
|
|
251
|
+
save(key);
|
|
347
252
|
},
|
|
348
253
|
dispose() {
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if (window.__ESCOOK_THEME__ ===
|
|
354
|
-
delete window.__ESCOOK_THEME__;
|
|
355
|
-
}
|
|
254
|
+
if (disposed) return;
|
|
255
|
+
disposed = true;
|
|
256
|
+
for (const cleanup of cleanups.reverse()) cleanup();
|
|
257
|
+
listeners.clear();
|
|
258
|
+
if (window.__ESCOOK_THEME__ === controller) delete window.__ESCOOK_THEME__;
|
|
356
259
|
}
|
|
357
260
|
};
|
|
358
|
-
|
|
359
|
-
|
|
261
|
+
try {
|
|
262
|
+
for (const scheme of Object.values(THEME_SCHEMES)) {
|
|
263
|
+
cleanups.push(ctx.theme.register({ id: scheme.id, colorScheme: scheme.type, tokens: scheme.tokens }));
|
|
264
|
+
}
|
|
265
|
+
cleanups.push(() => {
|
|
266
|
+
if (current() !== "application") {
|
|
267
|
+
const available = ctx.theme.getTheme().themes?.some((theme) => theme.id === previousPreference);
|
|
268
|
+
ctx.theme.setTheme(available || previousPreference === "system" ? previousPreference : "system");
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
const style = document.createElement("style");
|
|
272
|
+
style.id = "dsh-theme-escook-settings";
|
|
273
|
+
style.textContent = SETTINGS_CSS;
|
|
274
|
+
document.head.appendChild(style);
|
|
275
|
+
cleanups.push(() => style.parentNode?.removeChild(style));
|
|
276
|
+
const saved = read();
|
|
277
|
+
if (saved !== "application") controller.setScheme(THEME_SCHEMES[saved] ? saved : "dark-soft");
|
|
278
|
+
let previousSnapshot = ctx.theme.getTheme();
|
|
279
|
+
cleanups.push(ctx.on("theme/change", (snapshot) => {
|
|
280
|
+
const previous = previousSnapshot;
|
|
281
|
+
previousSnapshot = snapshot;
|
|
282
|
+
if (Object.values(THEME_SCHEMES).some((scheme) => scheme.id === previous.preference) && snapshot.fontSize !== previous.fontSize && snapshot.preference !== previous.preference) {
|
|
283
|
+
ctx.theme.setTheme(previous.preference);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
save(current());
|
|
287
|
+
for (const listener of listeners) listener();
|
|
288
|
+
}));
|
|
289
|
+
cleanups.push(ctx.slots.inject("settings.general.item", () => ctx.slots.register({
|
|
290
|
+
name: "settings.general.item",
|
|
291
|
+
id: "dsh-theme-escook",
|
|
292
|
+
order: 12,
|
|
293
|
+
inject: () => ({ controller })
|
|
294
|
+
}, ThemeSettings)));
|
|
295
|
+
window.__ESCOOK_THEME__ = controller;
|
|
296
|
+
return controller;
|
|
297
|
+
} catch (error) {
|
|
298
|
+
controller.dispose();
|
|
299
|
+
throw error;
|
|
300
|
+
}
|
|
360
301
|
}
|
|
361
|
-
var apply = (
|
|
362
|
-
const controller = activate(
|
|
302
|
+
var apply = (ctx) => {
|
|
303
|
+
const controller = activate(ctx);
|
|
363
304
|
return () => controller.dispose();
|
|
364
305
|
};
|
|
365
306
|
|