@lengduan/dsh-client-ui-skin-815 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +11 -0
- package/README.md +125 -0
- package/cordis.patch.yml +4 -0
- package/lib/client.js +289 -0
- package/lib/index.js +6 -0
- package/package.json +50 -0
- package/skin.json +22 -0
- package/src/client/art.generated.ts +4 -0
- package/src/client/index.ts +312 -0
- package/src/client/titlebar-brand.ts +8 -0
- package/src/client/vj815.module.css +359 -0
- package/src/index.ts +4 -0
- package/tests/apply.spec.ts +53 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/* 1945-08-15 终战皮肤:史料照片底 + 可读玻璃层。 */
|
|
2
|
+
|
|
3
|
+
body[data-dsh-815] {
|
|
4
|
+
color-scheme: dark;
|
|
5
|
+
color: #f4ead6;
|
|
6
|
+
background-color: #080a06;
|
|
7
|
+
--dsw-alias-label-primary-inverted: #1a1c14;
|
|
8
|
+
--vj-brass: #c4a35a;
|
|
9
|
+
--vj-brass-soft: #e2c98a;
|
|
10
|
+
--vj-olive: #3d4630;
|
|
11
|
+
--vj-ink: #1c1a14;
|
|
12
|
+
--vj-paper: #f3ead4;
|
|
13
|
+
--vj-glass: rgba(18, 20, 14, 0.72);
|
|
14
|
+
--vj-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
|
|
15
|
+
|
|
16
|
+
--dsw-alias-bg-base: transparent;
|
|
17
|
+
--dsw-alias-bg-layer-1: rgba(28, 30, 22, 0.78);
|
|
18
|
+
--dsw-alias-bg-layer-2: rgba(36, 38, 28, 0.88);
|
|
19
|
+
--dsw-alias-bg-layer-3: rgba(44, 46, 34, 0.92);
|
|
20
|
+
--dsw-alias-bg-overlay: rgba(22, 24, 18, 0.94);
|
|
21
|
+
--dsw-alias-border-l1: rgba(196, 163, 90, 0.28);
|
|
22
|
+
--dsw-alias-border-l2-darkmode-thin: rgba(196, 163, 90, 0.36);
|
|
23
|
+
--dsw-alias-border-l2: rgba(196, 163, 90, 0.42);
|
|
24
|
+
--dsw-alias-border-l3: rgba(196, 163, 90, 0.7);
|
|
25
|
+
--dsw-alias-brand-primary: #c4a35a;
|
|
26
|
+
--dsw-alias-brand-text: #f4ead6;
|
|
27
|
+
--dsw-alias-button-elevated-fill: rgba(52, 54, 40, 0.9);
|
|
28
|
+
--dsw-alias-button-floating-fill: rgba(58, 60, 44, 0.94);
|
|
29
|
+
--dsw-alias-button-floating-hover: #4a4e38;
|
|
30
|
+
--dsw-alias-button-info-fill: #6a5a32;
|
|
31
|
+
--dsw-alias-button-info-hover: #7c6a3c;
|
|
32
|
+
--dsw-alias-interactive-bg-active: rgba(196, 163, 90, 0.28);
|
|
33
|
+
--dsw-alias-interactive-bg-hover: rgba(196, 163, 90, 0.14);
|
|
34
|
+
--dsw-alias-interactive-bg-hover-solid: #3a3e2c;
|
|
35
|
+
--dsw-alias-label-primary: #f4ead6;
|
|
36
|
+
--dsw-alias-label-primary-bluish: #e8dcb8;
|
|
37
|
+
--dsw-alias-label-secondary: #c8c0a4;
|
|
38
|
+
--dsw-alias-label-tertiary: #9e9780;
|
|
39
|
+
--dsw-alias-label-caption: #7e7866;
|
|
40
|
+
--dsw-alias-state-business-primary: #c4a35a;
|
|
41
|
+
--dsw-alias-state-business-tertiary: #3a3828;
|
|
42
|
+
--dsw-shadow-lv2: var(--vj-shadow);
|
|
43
|
+
--dsw-specific-input-major: rgba(28, 30, 22, 0.82);
|
|
44
|
+
--dsw-specific-selector: rgba(48, 50, 36, 0.9);
|
|
45
|
+
--dsw-specific-sidebar-fill: rgba(14, 16, 12, 0.88);
|
|
46
|
+
--dsw-alias-markdown-code-block: #141610;
|
|
47
|
+
--dsw-alias-markdown-code-block-banner: #1c1e16;
|
|
48
|
+
--shiki-token-constant: #4dabf7;
|
|
49
|
+
--shiki-token-string: #69db7c;
|
|
50
|
+
--shiki-token-comment: #adb5bd;
|
|
51
|
+
--shiki-token-keyword: #faa2c1;
|
|
52
|
+
--shiki-token-parameter: #ffa94d;
|
|
53
|
+
--shiki-token-function: #b197fc;
|
|
54
|
+
--shiki-token-string-expression: #8ce99a;
|
|
55
|
+
--shiki-token-punctuation: #ced4da;
|
|
56
|
+
--shiki-token-link: #74c0fc;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
body[data-dsh-815]::before {
|
|
60
|
+
content: '';
|
|
61
|
+
position: fixed;
|
|
62
|
+
inset: 0;
|
|
63
|
+
z-index: 0;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
background:
|
|
66
|
+
linear-gradient(
|
|
67
|
+
180deg,
|
|
68
|
+
rgba(10, 12, 8, 0.6) 0%,
|
|
69
|
+
rgba(10, 12, 8, 0.38) 30%,
|
|
70
|
+
rgba(12, 12, 10, 0.55) 52%,
|
|
71
|
+
rgba(10, 12, 8, 0.78) 78%,
|
|
72
|
+
rgba(8, 10, 6, 0.9) 100%
|
|
73
|
+
),
|
|
74
|
+
radial-gradient(ellipse at 50% 30%, transparent 18%, rgba(8, 10, 6, 0.5) 100%);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
body[data-dsh-815] [id='root'] {
|
|
78
|
+
position: relative;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
background: transparent;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
body[data-dsh-815] :is([data-pane='sidebar'], [class*='sidebarCol']) {
|
|
84
|
+
--dsw-alias-label-primary: #f4ead6;
|
|
85
|
+
--dsw-alias-label-secondary: #d4ccb0;
|
|
86
|
+
position: relative;
|
|
87
|
+
z-index: auto;
|
|
88
|
+
background: rgba(16, 18, 12, 0.92);
|
|
89
|
+
border-right: 1px solid rgba(196, 163, 90, 0.42);
|
|
90
|
+
box-shadow: 10px 0 28px rgba(0, 0, 0, 0.28);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
body[data-dsh-815] :is([data-pane='sidebar'], [class*='sidebarCol']) > div {
|
|
94
|
+
position: relative;
|
|
95
|
+
overflow: visible;
|
|
96
|
+
background:
|
|
97
|
+
linear-gradient(180deg, rgba(28, 30, 20, 0.55), rgba(12, 14, 10, 0.72));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
body[data-dsh-815] [data-skin-chrome='rescript-plaque'] {
|
|
101
|
+
position: absolute;
|
|
102
|
+
left: 50%;
|
|
103
|
+
bottom: 88px;
|
|
104
|
+
z-index: 1;
|
|
105
|
+
width: min(86%, 232px);
|
|
106
|
+
max-height: 28%;
|
|
107
|
+
object-fit: contain;
|
|
108
|
+
border-radius: 10px;
|
|
109
|
+
transform: translateX(-50%);
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
opacity: 0.88;
|
|
112
|
+
filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* 青天白日海军旗:蓝底白日十二芒。仅挂在会话选中行左侧。 */
|
|
116
|
+
body[data-dsh-815] [data-vj-session] {
|
|
117
|
+
position: relative;
|
|
118
|
+
padding-left: 26px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
body[data-dsh-815] [data-vj-session]:hover:not([aria-selected='true']) {
|
|
122
|
+
border-radius: 8px;
|
|
123
|
+
background: rgba(196, 163, 90, 0.1);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
body[data-dsh-815] [data-vj-session][aria-selected='true'] {
|
|
127
|
+
border-radius: 8px;
|
|
128
|
+
background: linear-gradient(90deg, rgba(196, 163, 90, 0.22), rgba(28, 30, 22, 0.12));
|
|
129
|
+
box-shadow: inset 0 0 0 1px rgba(196, 163, 90, 0.35);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
body[data-dsh-815] [data-vj-session][aria-selected='true'] [class*='title'] {
|
|
133
|
+
color: #fff8e8;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
body[data-dsh-815] [data-vj-session][aria-selected='true']::before {
|
|
137
|
+
content: '';
|
|
138
|
+
position: absolute;
|
|
139
|
+
left: 6px;
|
|
140
|
+
top: 50%;
|
|
141
|
+
z-index: 2;
|
|
142
|
+
width: 16px;
|
|
143
|
+
height: 11px;
|
|
144
|
+
transform: translateY(-50%);
|
|
145
|
+
pointer-events: none;
|
|
146
|
+
background-color: #000095;
|
|
147
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 20'%3E%3Crect width='30' height='20' fill='%23000095'/%3E%3Cg fill='%23fff' transform='translate(15 10)'%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(30)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(60)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(90)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(120)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(150)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(180)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(210)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(240)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(270)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(300)'/%3E%3Cpolygon points='0,-8.4 1.05,-3.5 -1.05,-3.5' transform='rotate(330)'/%3E%3Ccircle r='2.7'/%3E%3Ccircle r='3.55' fill='none' stroke='%23000095' stroke-width='0.85'/%3E%3C/g%3E%3C/svg%3E");
|
|
148
|
+
background-size: cover;
|
|
149
|
+
background-repeat: no-repeat;
|
|
150
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
body[data-dsh-815] :is([data-pane='conversation'], [class*='centerCol']) {
|
|
154
|
+
color: #f4ead6;
|
|
155
|
+
background: transparent;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* 对话列宿主会写 background: var(--dsw-alias-bg-base);主题若在内层重绑该 token,会盖住油画并和输入座切出一条水平线。 */
|
|
159
|
+
body[data-dsh-815] [data-phase='active'] {
|
|
160
|
+
--dsw-alias-bg-base: transparent;
|
|
161
|
+
background: transparent;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
body[data-dsh-815] [data-phase='active'] [class*='scrollBody'],
|
|
165
|
+
body[data-dsh-815] [data-phase='active'] [class*='viewArea'] {
|
|
166
|
+
background: transparent;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
body[data-dsh-815] :is([data-pane='details'], [class*='detailsCol']) {
|
|
170
|
+
background: rgba(18, 20, 14, 0.88);
|
|
171
|
+
border-left-color: rgba(196, 163, 90, 0.4);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
body[data-dsh-815] button[class*='brand'] {
|
|
175
|
+
color: #f3e3c0;
|
|
176
|
+
--dsw-alias-label-primary-inverted: #1a1c14;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
body[data-dsh-815] button[class*='brand'] > svg > rect {
|
|
180
|
+
fill: #c4a35a;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
body[data-dsh-815] [data-phase='hero'] [class*='headline'] {
|
|
184
|
+
color: #fff8e8;
|
|
185
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
186
|
+
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
body[data-dsh-815] [data-composer-card] {
|
|
190
|
+
isolation: isolate;
|
|
191
|
+
min-height: 0;
|
|
192
|
+
color: #1c1a14;
|
|
193
|
+
--dsw-alias-label-primary: #1c1a14;
|
|
194
|
+
--dsw-alias-label-primary-bluish: #2a261c;
|
|
195
|
+
--dsw-alias-label-secondary: #4a4638;
|
|
196
|
+
--dsw-alias-label-tertiary: #6a6454;
|
|
197
|
+
--dsw-alias-label-caption: #7e7866;
|
|
198
|
+
--dsw-alias-brand-text: #1c1a14;
|
|
199
|
+
--dsw-specific-input-major: #f3ead4;
|
|
200
|
+
--dsw-alias-bg-layer-1: #f3ead4;
|
|
201
|
+
--dsw-alias-bg-layer-2: #efe4c8;
|
|
202
|
+
border: 1px solid rgba(196, 163, 90, 0.55);
|
|
203
|
+
border-radius: 18px;
|
|
204
|
+
background: linear-gradient(180deg, #f3ead4, #e4d6b4);
|
|
205
|
+
box-shadow: var(--vj-shadow);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
body[data-dsh-815] [data-composer-card] :is(textarea, input, [contenteditable='true']) {
|
|
209
|
+
color: #1c1a14;
|
|
210
|
+
caret-color: #1c1a14;
|
|
211
|
+
background: #f3ead4;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
body[data-dsh-815] [data-composer-card] :is(textarea, input)::placeholder {
|
|
215
|
+
color: #6a6454;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
body[data-dsh-815] [data-phase='active'] [data-composer-seat] {
|
|
219
|
+
--dsw-alias-bg-base: transparent;
|
|
220
|
+
background: transparent;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
body[data-dsh-815] [data-chat-flow] {
|
|
224
|
+
max-width: var(--dsh-composer-card-max-width);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
body[data-dsh-815]
|
|
228
|
+
[data-chat-flow-kind='assistant-step'] > * > * > * > div[class*='markdown'] {
|
|
229
|
+
box-sizing: border-box;
|
|
230
|
+
align-self: stretch;
|
|
231
|
+
width: 100%;
|
|
232
|
+
max-width: 100%;
|
|
233
|
+
padding: 14px 18px;
|
|
234
|
+
border: 1px solid rgba(196, 163, 90, 0.32);
|
|
235
|
+
border-radius: 14px 14px 14px 6px;
|
|
236
|
+
color: #f4ead6;
|
|
237
|
+
background: rgba(28, 30, 22, 0.9);
|
|
238
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
body[data-dsh-815] [class*='markdown'] [class*='bannerWrap'] {
|
|
242
|
+
background-color: var(--dsw-alias-markdown-code-block-banner);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
body[data-dsh-815]
|
|
246
|
+
[data-chat-flow-kind='assistant-step'] > * > * > * > div[class*='markdown'] :not(pre) > code {
|
|
247
|
+
color: #1c1a14;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
body[data-dsh-815]
|
|
251
|
+
[data-chat-flow-kind='assistant-step'] > * > * > * > div[class*='markdown'] [class*='fileMention'] {
|
|
252
|
+
color: #6b4e16;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
body[data-dsh-815] [data-composer-card] button[class*='add'] {
|
|
256
|
+
color: #ffffff;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
body[data-dsh-815] [class*='userRow'] [class*='bubble'] {
|
|
260
|
+
color: #f4ead6;
|
|
261
|
+
border: 1px solid rgba(196, 163, 90, 0.4);
|
|
262
|
+
background: rgba(52, 48, 32, 0.92);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
body[data-dsh-815] [class*='userRow'] [class*='bubble'] :not(pre) > code {
|
|
266
|
+
color: #1c1a14;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
body[data-dsh-815] [data-terminal] {
|
|
270
|
+
--dsw-alias-markdown-code-block: rgba(18, 20, 14, 0.96);
|
|
271
|
+
--dsw-alias-label-primary: #f4ead6;
|
|
272
|
+
color: #f4ead6;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
body[data-dsh-815] :is([role='dialog'], [role='menu'], [data-radix-popper-content-wrapper] > *) {
|
|
276
|
+
color: #f4ead6;
|
|
277
|
+
--dsw-alias-label-primary: #f4ead6;
|
|
278
|
+
--dsw-alias-label-secondary: #d4ccb0;
|
|
279
|
+
--dsw-alias-label-tertiary: #9e9780;
|
|
280
|
+
--dsw-alias-label-caption: #7e7866;
|
|
281
|
+
--dsw-alias-bg-layer-1: #24261c;
|
|
282
|
+
--dsw-alias-bg-layer-2: #1c1e16;
|
|
283
|
+
--dsw-alias-bg-layer-3: #2c2e24;
|
|
284
|
+
--dsw-alias-bg-module-platform: #24261c;
|
|
285
|
+
--dsw-alias-bg-overlay: #323428;
|
|
286
|
+
--dsw-specific-input-major: #24261c;
|
|
287
|
+
--dsw-specific-selector: #323428;
|
|
288
|
+
--dsw-specific-menu: #2c2e24;
|
|
289
|
+
--dsw-specific-tip: #2a2c22;
|
|
290
|
+
--dsw-alias-button-elevated-fill: #2e3026;
|
|
291
|
+
--dsw-alias-button-floating-fill: #2a2c22;
|
|
292
|
+
--dsw-alias-button-floating-hover: #3a3e2c;
|
|
293
|
+
--dsw-alias-markdown-inline-code: #2a2c22;
|
|
294
|
+
border-color: rgba(196, 163, 90, 0.5);
|
|
295
|
+
box-shadow: var(--vj-shadow);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
body[data-dsh-815] [data-slot='sidebar.settings'] [role='dialog'][aria-modal='true'] {
|
|
299
|
+
--dsw-specific-sidebar-nav-item-active: rgba(196, 163, 90, 0.32);
|
|
300
|
+
--dsw-specific-sidebar-nav-item-hover: rgba(196, 163, 90, 0.14);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
body[data-dsh-815] [class*='titlebar'] > [class*='button']:first-of-type {
|
|
304
|
+
display: none;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
body[data-dsh-815] [data-skin-chrome='titlebar-brand'] {
|
|
308
|
+
position: absolute;
|
|
309
|
+
left: 50%;
|
|
310
|
+
top: 50%;
|
|
311
|
+
transform: translate(-50%, -50%);
|
|
312
|
+
display: inline-flex;
|
|
313
|
+
color: #f3e3c0;
|
|
314
|
+
--dsw-alias-label-primary-inverted: #1a1c14;
|
|
315
|
+
pointer-events: none;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
body[data-dsh-815] [data-skin-chrome='titlebar-brand'] svg {
|
|
319
|
+
display: block;
|
|
320
|
+
height: 18px;
|
|
321
|
+
width: auto;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
body[data-dsh-815] [class*='titlebar'] {
|
|
325
|
+
position: relative;
|
|
326
|
+
background: linear-gradient(to top, rgba(16, 18, 12, 0.96), rgba(36, 38, 26, 0.9));
|
|
327
|
+
border-bottom: 1px solid rgba(196, 163, 90, 0.42);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
body[data-dsh-815] [class*='titlebar'] [class*='button'] {
|
|
331
|
+
color: #d4bc7a;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
body[data-dsh-815] [data-skin-chrome='caption'] {
|
|
335
|
+
position: fixed;
|
|
336
|
+
right: 16px;
|
|
337
|
+
bottom: 12px;
|
|
338
|
+
z-index: 30;
|
|
339
|
+
max-width: min(52vw, 420px);
|
|
340
|
+
color: #e8dcb8;
|
|
341
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
342
|
+
font-size: 12px;
|
|
343
|
+
letter-spacing: 0.04em;
|
|
344
|
+
text-align: right;
|
|
345
|
+
text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
|
|
346
|
+
pointer-events: none;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@media (hover: hover) {
|
|
350
|
+
body[data-dsh-815] [data-time-hover-root] :is([class*='timeStart'], [class*='timeEnd']) {
|
|
351
|
+
opacity: 1;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
@media (prefers-reduced-motion: reduce) {
|
|
356
|
+
body[data-dsh-815] [data-composer-card] {
|
|
357
|
+
transition: none;
|
|
358
|
+
}
|
|
359
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import { Context, type Fiber } from '@deepseek-ai/cordis'
|
|
4
|
+
import { readFileSync } from 'node:fs'
|
|
5
|
+
import { resolve } from 'node:path'
|
|
6
|
+
import { apply } from '../src/client/index.ts'
|
|
7
|
+
|
|
8
|
+
let fiber: Fiber | undefined
|
|
9
|
+
|
|
10
|
+
async function mount(): Promise<Fiber> {
|
|
11
|
+
const f = new Context().plugin({ apply })
|
|
12
|
+
await f.await()
|
|
13
|
+
return f
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
afterEach(async () => {
|
|
17
|
+
await fiber?.dispose()
|
|
18
|
+
fiber = undefined
|
|
19
|
+
document.body.innerHTML = ''
|
|
20
|
+
document.title = ''
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
describe('815 skin apply', () => {
|
|
24
|
+
it('declares only the public client manifest', () => {
|
|
25
|
+
const manifest = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8'))
|
|
26
|
+
expect(manifest.dsh.client).toEqual({ inject: [], platform: 'web' })
|
|
27
|
+
expect(manifest.peerDependencies).toHaveProperty('@deepseek-ai/cordis', '^4.0.1')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('sets the body attribute and retracts it on dispose', async () => {
|
|
31
|
+
fiber = await mount()
|
|
32
|
+
expect(document.body.hasAttribute('data-dsh-815')).toBe(true)
|
|
33
|
+
await fiber.dispose()
|
|
34
|
+
expect(document.body.hasAttribute('data-dsh-815')).toBe(false)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('installs the photograph backdrop and restores prior body styles', async () => {
|
|
38
|
+
document.body.style.setProperty('background-position', 'left bottom')
|
|
39
|
+
fiber = await mount()
|
|
40
|
+
expect(document.body.style.backgroundImage).toContain('data:image/jpeg;base64,')
|
|
41
|
+
expect(document.body.style.backgroundPosition).toBe('center 42%')
|
|
42
|
+
await fiber.dispose()
|
|
43
|
+
expect(document.body.style.backgroundImage).toBe('')
|
|
44
|
+
expect(document.body.style.backgroundPosition).toBe('left bottom')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('injects chrome and retracts every owned element on dispose', async () => {
|
|
48
|
+
fiber = await mount()
|
|
49
|
+
expect(document.body.querySelectorAll('[data-skin-owner="815"]').length).toBeGreaterThan(0)
|
|
50
|
+
await fiber.dispose()
|
|
51
|
+
expect(document.body.querySelectorAll('[data-skin-owner="815"]').length).toBe(0)
|
|
52
|
+
})
|
|
53
|
+
})
|