@linxin666/dsh-pet 0.4.10 → 0.4.11

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 (53) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +1 -1
  3. package/README.zh.md +4 -4
  4. package/lib/client.js +1092 -348
  5. package/lib/client.js.map +1 -1
  6. package/lib/types/client/PetPreview.d.ts +12 -0
  7. package/lib/types/client/PetPreview.d.ts.map +1 -0
  8. package/lib/types/client/PetPreview.js +32 -0
  9. package/lib/types/client/PetSettingsCard.d.ts +30 -2
  10. package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
  11. package/lib/types/client/PetSettingsCard.js +48 -8
  12. package/lib/types/client/PluginSettingsCard.d.ts +131 -17
  13. package/lib/types/client/PluginSettingsCard.d.ts.map +1 -1
  14. package/lib/types/client/PluginSettingsCard.js +158 -37
  15. package/lib/types/client/RangeBubble.d.ts +47 -0
  16. package/lib/types/client/RangeBubble.d.ts.map +1 -0
  17. package/lib/types/client/RangeBubble.js +107 -0
  18. package/lib/types/client/SegmentGroup.d.ts +29 -0
  19. package/lib/types/client/SegmentGroup.d.ts.map +1 -0
  20. package/lib/types/client/SegmentGroup.js +81 -0
  21. package/lib/types/client/index.d.ts.map +1 -1
  22. package/lib/types/client/index.js +9 -28
  23. package/lib/types/client/locales.d.ts +36 -44
  24. package/lib/types/client/locales.d.ts.map +1 -1
  25. package/lib/types/client/locales.js +36 -44
  26. package/lib/types/client/settings-form.d.ts +79 -41
  27. package/lib/types/client/settings-form.d.ts.map +1 -1
  28. package/lib/types/client/settings-form.js +96 -36
  29. package/lib/types/client/settings-registration.d.ts +15 -0
  30. package/lib/types/client/settings-registration.d.ts.map +1 -0
  31. package/lib/types/client/settings-registration.js +24 -0
  32. package/lib/types/client/web-extension-contract.d.ts +32 -0
  33. package/lib/types/client/web-extension-contract.d.ts.map +1 -0
  34. package/lib/types/client/web-extension-contract.js +6 -0
  35. package/lib/types/client/web-extension-page.d.ts +51 -0
  36. package/lib/types/client/web-extension-page.d.ts.map +1 -0
  37. package/lib/types/client/web-extension-page.js +122 -0
  38. package/package.json +1 -1
  39. package/src/client/PetPreview.tsx +51 -0
  40. package/src/client/PetSettingsCard.test.tsx +28 -22
  41. package/src/client/PetSettingsCard.tsx +201 -110
  42. package/src/client/PluginSettingsCard.tsx +369 -108
  43. package/src/client/RangeBubble.tsx +163 -0
  44. package/src/client/SegmentGroup.tsx +92 -0
  45. package/src/client/index.ts +9 -27
  46. package/src/client/locales.ts +36 -44
  47. package/src/client/settings-card.module.css +493 -91
  48. package/src/client/settings-form.ts +116 -49
  49. package/src/client/settings-registration.test.ts +79 -0
  50. package/src/client/settings-registration.ts +34 -0
  51. package/src/client/settings-section.module.css +182 -0
  52. package/src/client/web-extension-contract.ts +35 -0
  53. package/src/client/web-extension-page.ts +150 -0
@@ -1,13 +1,22 @@
1
- /* Generated by scripts/sync-shared.mjs from shared/client/settings/settings-card.module.css. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs". */
2
1
  /* Plugin settings card chrome + staged form fields.
3
2
  * Aligned with the official ui-settings-plugins PluginCard / fields CSS:
4
3
  * same semantic tokens, radius, typography and states so family cards read
5
4
  * as siblings of the built-in Shell / Agent loop / Web search cards. */
6
5
 
7
6
  .card {
7
+ /* The card's local scale: every literal below reads one of these, and the
8
+ nested density overrides the same seven on the same element, so one rule
9
+ set serves both densities. */
10
+ --settings-card-radius: 12px;
11
+ --settings-card-header-pad: 16px;
12
+ --settings-card-header-gap: 13px;
13
+ --settings-card-title-size: 15px;
14
+ --settings-card-description-size: 13px;
15
+ --settings-card-body-inset: 16px;
16
+ --settings-card-motion: 0.18s;
8
17
  border: 1px solid var(--dsw-alias-border-l2);
9
18
  background: var(--dsw-alias-bg-layer-3);
10
- border-radius: 12px;
19
+ border-radius: var(--settings-card-radius);
11
20
  list-style: none;
12
21
  transition: border-color 0.16s, background 0.16s;
13
22
  }
@@ -21,12 +30,30 @@
21
30
  border-color: var(--dsw-alias-label-dimmed);
22
31
  }
23
32
 
33
+ /* Nested density: a topic card inside another card's body. It overrides the
34
+ local scale only, so the first-level card and this one stay one rule set. */
35
+ .cardNested {
36
+ --settings-card-radius: 10px;
37
+ --settings-card-header-pad: 10px 12px;
38
+ --settings-card-header-gap: 10px;
39
+ --settings-card-title-size: 13px;
40
+ --settings-card-description-size: 12px;
41
+ --settings-card-body-inset: 12px;
42
+ }
43
+
44
+ /* One line: the header already carries the full sentence on its title. */
45
+ .cardNested .description {
46
+ white-space: nowrap;
47
+ overflow: hidden;
48
+ text-overflow: ellipsis;
49
+ }
50
+
24
51
  .header {
25
52
  appearance: none;
26
53
  width: 100%;
27
54
  /* The suite does not force a global border-box, so width:100% + padding
28
- would stretch the row 32px past the card and push the trailing pending
29
- badge (last flex item) outside the card border. */
55
+ would stretch the row 32px past the card and push the trailing chevron
56
+ (last flex item) outside the card border. */
30
57
  box-sizing: border-box;
31
58
  font: inherit;
32
59
  color: inherit;
@@ -34,10 +61,10 @@
34
61
  cursor: pointer;
35
62
  background: transparent;
36
63
  border: 0;
37
- border-radius: 12px;
64
+ border-radius: var(--settings-card-radius);
38
65
  align-items: center;
39
- gap: 12px;
40
- padding: 14px 16px;
66
+ gap: var(--settings-card-header-gap);
67
+ padding: var(--settings-card-header-pad);
41
68
  display: flex;
42
69
  }
43
70
 
@@ -49,10 +76,10 @@
49
76
  .headerStatic {
50
77
  width: 100%;
51
78
  box-sizing: border-box;
52
- border-radius: 12px;
79
+ border-radius: var(--settings-card-radius);
53
80
  align-items: center;
54
- gap: 12px;
55
- padding: 14px 16px;
81
+ gap: var(--settings-card-header-gap);
82
+ padding: var(--settings-card-header-pad);
56
83
  display: flex;
57
84
  }
58
85
 
@@ -64,9 +91,28 @@
64
91
  display: flex;
65
92
  }
66
93
 
94
+ /* Optional leading plugin mark: a quiet tile that takes the ink color on
95
+ hover and while the card is open, so the whole row reads as one control. */
96
+ .mark {
97
+ flex: none;
98
+ display: grid;
99
+ place-items: center;
100
+ width: 34px;
101
+ height: 34px;
102
+ border-radius: 10px;
103
+ background: var(--dsw-alias-bg-module-platform);
104
+ color: var(--dsw-alias-label-secondary);
105
+ transition: color 0.16s;
106
+ }
107
+
108
+ .header:hover .mark,
109
+ .cardOpen .mark {
110
+ color: var(--dsw-alias-label-primary);
111
+ }
112
+
67
113
  .name {
68
114
  color: var(--dsw-alias-label-primary);
69
- font-size: 15px;
115
+ font-size: var(--settings-card-title-size);
70
116
  font-weight: 600;
71
117
  line-height: 1.4;
72
118
  }
@@ -74,37 +120,70 @@
74
120
  .description {
75
121
  /* Secondary, not tertiary: skins whose tertiary token is tuned for large
76
122
  print leave 12-13px hint text below readable contrast (orca-link #778399
77
- on cream measures ~3.4:1). */
123
+ on cream measures ~3.4:1). The 18px leading matches the reference
124
+ settings-page description rhythm. */
78
125
  color: var(--dsw-alias-label-secondary);
79
- font-size: 13px;
80
- line-height: 1.5;
126
+ font-size: 12px;
127
+ line-height: 18px;
81
128
  }
82
129
 
83
- .pending {
84
- white-space: nowrap;
85
- background: var(--dsw-alias-bg-module-platform);
86
- color: var(--dsw-alias-label-secondary);
87
- border-radius: 999px;
130
+ /* Header trailing control (an immediate toggle): a flex item that keeps its
131
+ natural width while the title block takes the remaining space. */
132
+ .headerAction {
88
133
  flex: none;
89
- padding: 1px 8px;
90
- font-size: 11px;
91
- font-weight: 500;
92
- line-height: 17px;
134
+ display: inline-flex;
135
+ align-items: center;
93
136
  }
94
137
 
95
138
  .chevron {
96
139
  color: var(--dsw-alias-label-tertiary);
97
140
  flex: none;
98
- transition: transform 0.16s;
141
+ width: 16px;
142
+ height: 16px;
143
+ transition: transform 0.16s, color 0.16s;
144
+ }
145
+
146
+ .header:hover .chevron {
147
+ color: var(--dsw-alias-label-secondary);
99
148
  }
100
149
 
101
150
  .chevronOpen {
102
151
  transform: rotate(180deg);
103
152
  }
104
153
 
154
+ /* Body disclosure. One transition pair drives both legs: the wrapper
155
+ animates 0fr -> 1fr and back, the body is its only item and shrinks into the
156
+ collapsed track. Only the moving states clip, so a settled card never cuts
157
+ off a field's popup. */
158
+ .disclosure {
159
+ display: grid;
160
+ grid-template-rows: 0fr;
161
+ opacity: 0;
162
+ transition: grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;
163
+ }
164
+
165
+ .disclosure[data-state='collapsed'],
166
+ .disclosure[data-state='entering'],
167
+ .disclosure[data-state='closing'] {
168
+ overflow: hidden;
169
+ }
170
+
171
+ .disclosure[data-state='entering'],
172
+ .disclosure[data-state='shown'] {
173
+ grid-template-rows: 1fr;
174
+ opacity: 1;
175
+ }
176
+
177
+ .disclosure > .body {
178
+ min-height: 0;
179
+ }
180
+
181
+ /* The body is the query container its rows answer to: the card's own width,
182
+ not the viewport's, decides whether a control still fits beside its text. */
105
183
  .body {
184
+ container: settings-card / inline-size;
106
185
  border-top: 1px solid var(--dsw-alias-border-l2);
107
- margin: 0 16px;
186
+ margin: 0 var(--settings-card-body-inset);
108
187
  padding-bottom: 8px;
109
188
  }
110
189
 
@@ -122,75 +201,51 @@
122
201
  line-height: 1.5;
123
202
  }
124
203
 
125
- .footer {
126
- border-top: 1px solid var(--dsw-alias-border-l2);
127
- justify-content: flex-end;
128
- align-items: center;
129
- gap: 8px;
130
- padding: 12px 0 4px;
131
- display: flex;
132
- }
133
-
204
+ /* The refused write, under the rows it belongs to; the control itself has
205
+ already gone back to the stored value. */
134
206
  .failed {
135
- min-width: 0;
136
207
  /* The suite's error alias is state-error-primary; a label-error token does
137
208
  not exist, so the var() would resolve to nothing and the message would
138
209
  inherit the ink color, losing the failure signal. */
139
210
  color: var(--dsw-alias-state-error-primary, #b42318);
140
- flex: 1;
141
- margin: 0;
211
+ margin: 8px 0 4px;
142
212
  font-size: 12px;
143
- line-height: 1.5;
144
- text-overflow: ellipsis;
145
- overflow: hidden;
146
- white-space: nowrap;
147
- }
148
-
149
- .discard,
150
- .save {
151
- appearance: none;
152
- font: inherit;
153
- cursor: pointer;
154
- border: 1px solid transparent;
155
- border-radius: 8px;
156
- padding: 5px 14px;
157
- font-size: 13px;
158
- line-height: 1.5;
159
- }
160
-
161
- .discard {
162
- border-color: var(--dsw-alias-border-l2);
163
- color: var(--dsw-alias-label-secondary);
164
- background: transparent;
213
+ line-height: 18px;
214
+ overflow-wrap: anywhere;
165
215
  }
166
216
 
167
- .discard:hover:not(:disabled) {
168
- color: var(--dsw-alias-label-primary);
169
- border-color: var(--dsw-alias-label-dimmed);
217
+ /* One settings row: the label and its hint on the left, the control on the
218
+ right across both lines, 16px above and below, a hairline between two rows.
219
+ The markup keeps label, control, hint in reading order and the grid places
220
+ the control, so a field built outside this file (a plugin's own preset
221
+ picker) lands in the same row by using the same classes. */
222
+ .field {
223
+ display: grid;
224
+ /* The control track is capped at half the row: an auto track sizes to its
225
+ widest content, and a three-option segment carrying a long label (a
226
+ localized "inherit from the deployment") then leaves the text column a few
227
+ characters wide. Capped, the segment wraps its options instead. */
228
+ grid-template-columns: minmax(0, 1fr) fit-content(50%);
229
+ grid-template-areas:
230
+ "head control"
231
+ "hint control";
232
+ align-items: center;
233
+ gap: 4px 24px;
234
+ padding: 16px 0;
170
235
  }
171
236
 
172
- .save {
173
- background: var(--dsw-alias-label-primary);
174
- color: var(--dsw-alias-bg-layer-3);
237
+ .field > .head {
238
+ grid-area: head;
175
239
  }
176
240
 
177
- .discard:disabled,
178
- .save:disabled {
179
- opacity: 0.4;
180
- cursor: default;
241
+ .field > :is(.hint, .invalid) {
242
+ grid-area: hint;
181
243
  }
182
244
 
183
- .discard:focus-visible,
184
- .save:focus-visible {
185
- outline: 2px solid var(--dsw-alias-brand-primary);
186
- outline-offset: 1px;
187
- }
188
-
189
- .field {
190
- flex-direction: column;
191
- gap: 6px;
192
- padding: 12px 0;
193
- display: flex;
245
+ .field > :not(.head, .hint, .invalid) {
246
+ grid-area: control;
247
+ justify-self: end;
248
+ max-width: 100%;
194
249
  }
195
250
 
196
251
  .field + .field {
@@ -207,9 +262,9 @@
207
262
  min-width: 0;
208
263
  color: var(--dsw-alias-label-primary);
209
264
  flex: 1;
210
- font-size: 13px;
211
- font-weight: 500;
212
- line-height: 1.5;
265
+ font-size: 14px;
266
+ font-weight: 400;
267
+ line-height: 22px;
213
268
  }
214
269
 
215
270
  .badges {
@@ -253,9 +308,99 @@
253
308
  outline-offset: 2px;
254
309
  }
255
310
 
256
- .reset:focus-visible {
311
+ /* Segmented controls (SegmentGroup.tsx): a 2px-inset track the options sit in,
312
+ and one raised box that marks the pressed option. The track is the ink at low
313
+ alpha over whatever panel holds it: a layer token resolves to the panel's own
314
+ fill under the dark theme and under skins, which hides the groove. The track
315
+ wraps instead of clipping, so localized labels stay complete in a narrow card. */
316
+ .segmentGroup {
317
+ position: relative;
318
+ display: inline-flex;
319
+ flex-wrap: wrap;
320
+ align-items: center;
321
+ gap: 2px;
322
+ padding: 2px;
323
+ border-radius: 8px;
324
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent);
325
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
326
+ }
327
+
328
+ .segment {
329
+ appearance: none;
330
+ margin: 0;
331
+ padding: 3px 12px;
332
+ border: 0;
333
+ border-radius: 7px;
334
+ background: transparent;
335
+ color: var(--dsw-alias-label-secondary);
336
+ font: inherit;
337
+ font-size: 13px;
338
+ font-weight: 500;
339
+ line-height: 18px;
340
+ white-space: nowrap;
341
+ cursor: pointer;
342
+ transition: background-color 120ms ease, color 120ms ease;
343
+ }
344
+
345
+ .segment:hover:not(:disabled):not([data-active]) {
346
+ color: var(--dsw-alias-label-primary);
347
+ }
348
+
349
+ /* The raised box marking the pressed option: the highlight once the group has
350
+ measured it, the option's own background for the frame before. Dark lifts
351
+ by white alpha: a layer fill there resolves to the track's own grey. */
352
+ .segmentGroup:not([data-pill]) > .segment[data-active],
353
+ .segmentGroup[data-pill]::before {
354
+ background: var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-3));
355
+ box-shadow: 0 1px 2px rgb(20 20 19 / 8%);
356
+ }
357
+
358
+ :global(body[data-ds-dark-theme]) .segmentGroup:not([data-pill]) > .segment[data-active],
359
+ :global(body[data-ds-dark-theme]) .segmentGroup[data-pill]::before {
360
+ background: rgb(255 255 255 / 14%);
361
+ box-shadow: none;
362
+ }
363
+
364
+ .segment[data-active] {
365
+ color: var(--dsw-alias-label-primary);
366
+ }
367
+
368
+ /* The sliding highlight: one box at the pressed option's measured place that
369
+ glides to the next one. The glide keeps playing under reduced motion: a
370
+ quarter-second move of one small box is how the control reads. */
371
+ .segmentGroup[data-pill]::before {
372
+ content: "";
373
+ position: absolute;
374
+ left: 0;
375
+ top: 0;
376
+ width: var(--segment-pill-w, 0px);
377
+ height: var(--segment-pill-h, 0px);
378
+ border-radius: 7px;
379
+ transform: translate(var(--segment-pill-x, 0px), var(--segment-pill-y, 0px));
380
+ pointer-events: none;
381
+ transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1),
382
+ width 240ms cubic-bezier(0.22, 0.61, 0.36, 1),
383
+ height 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
384
+ }
385
+
386
+ /* The options paint above the highlight, the group's first painted box. */
387
+ .segmentGroup > * {
388
+ position: relative;
389
+ z-index: 1;
390
+ }
391
+
392
+ .segment:focus-visible {
257
393
  outline: 2px solid var(--dsw-alias-brand-primary);
258
- outline-offset: 2px;
394
+ outline-offset: 1px;
395
+ }
396
+
397
+ .segment:disabled {
398
+ cursor: not-allowed;
399
+ opacity: 0.45;
400
+ }
401
+
402
+ .segmentGroup[data-pill]:has(> .segment:disabled)::before {
403
+ opacity: 0.45;
259
404
  }
260
405
 
261
406
  .input,
@@ -301,6 +446,43 @@
301
446
  border-color: var(--dsw-alias-state-error-primary, #b42318);
302
447
  }
303
448
 
449
+ /* Beside its text a field keeps a width that reads a value at a glance and
450
+ leaves the hint its room; text fields and pickers share it, so a column of
451
+ rows lines their left edges up. */
452
+ .field > :is(.input, .inputInvalid, .select, .selectWrap, .rangeAnchor) {
453
+ box-sizing: border-box;
454
+ width: 220px;
455
+ }
456
+
457
+ .rangeAnchor > :is(.input, .inputInvalid) {
458
+ box-sizing: border-box;
459
+ width: 100%;
460
+ }
461
+
462
+ /* A narrow card hands the control the line under the text, where it starts at
463
+ the row's left edge, rather than crushing the hint into a few characters a
464
+ line; a text field or a picker then takes the row's whole width. This block
465
+ follows the widths above so it outranks them. */
466
+ @container settings-card (max-width: 440px) {
467
+ .field {
468
+ grid-template-columns: minmax(0, 1fr);
469
+ grid-template-areas:
470
+ "head"
471
+ "hint"
472
+ "control";
473
+ row-gap: 8px;
474
+ }
475
+
476
+ .field > :not(.head, .hint, .invalid) {
477
+ justify-self: start;
478
+ }
479
+
480
+ .field > :is(.input, .inputInvalid, .select, .selectWrap, .rangeAnchor) {
481
+ justify-self: stretch;
482
+ width: auto;
483
+ }
484
+ }
485
+
304
486
  .selectWrap {
305
487
  position: relative;
306
488
  }
@@ -364,6 +546,127 @@
364
546
  pointer-events: none;
365
547
  }
366
548
 
549
+ /* Coarse adjustment (RangeBubble.tsx): a popover with one slider over the
550
+ field's whole range, hung off the precise control. Hidden through
551
+ visibility, so a closed bubble takes no pointer and no tab stop; the delay on
552
+ visibility lets the fade finish before it goes. */
553
+ .rangeAnchor {
554
+ position: relative;
555
+ display: inline-flex;
556
+ }
557
+
558
+ .rangeBubble {
559
+ position: absolute;
560
+ right: 0;
561
+ z-index: 40;
562
+ box-sizing: border-box;
563
+ width: 220px;
564
+ padding: 10px 12px 6px;
565
+ border: 1px solid var(--dsw-alias-border-l2);
566
+ border-radius: 10px;
567
+ background: var(--dsw-alias-bg-layer-3);
568
+ box-shadow: 0 8px 24px var(--dsw-alias-bg-mask-2);
569
+ opacity: 0;
570
+ visibility: hidden;
571
+ transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
572
+ }
573
+
574
+ .rangeBubble[data-side="above"] {
575
+ bottom: calc(100% + 6px);
576
+ transform: translateY(4px);
577
+ }
578
+
579
+ .rangeBubble[data-side="below"] {
580
+ top: calc(100% + 6px);
581
+ transform: translateY(-4px);
582
+ }
583
+
584
+ .rangeBubble[data-open] {
585
+ opacity: 1;
586
+ visibility: visible;
587
+ transform: none;
588
+ transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s;
589
+ }
590
+
591
+ /* The slider: a thin groove filled up to the thumb in the brand color, and a
592
+ round thumb that grows a little while it is held. */
593
+ .rangeSlider {
594
+ appearance: none;
595
+ display: block;
596
+ width: 100%;
597
+ height: 18px;
598
+ margin: 0;
599
+ background: transparent;
600
+ cursor: pointer;
601
+ }
602
+
603
+ .rangeSlider::-webkit-slider-runnable-track {
604
+ height: 4px;
605
+ border-radius: 999px;
606
+ background: linear-gradient(to right,
607
+ var(--dsw-alias-brand-primary) var(--range-fill, 0%),
608
+ color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent) var(--range-fill, 0%));
609
+ }
610
+
611
+ .rangeSlider::-moz-range-track {
612
+ height: 4px;
613
+ border-radius: 999px;
614
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent);
615
+ }
616
+
617
+ .rangeSlider::-moz-range-progress {
618
+ height: 4px;
619
+ border-radius: 999px;
620
+ background: var(--dsw-alias-brand-primary);
621
+ }
622
+
623
+ .rangeSlider::-webkit-slider-thumb {
624
+ appearance: none;
625
+ width: 14px;
626
+ height: 14px;
627
+ margin-top: -5px;
628
+ border: 0;
629
+ border-radius: 50%;
630
+ background: #fff;
631
+ box-shadow: 0 0 0 1px rgb(0 0 0 / 12%), 0 1px 3px rgb(0 0 0 / 25%);
632
+ transition: transform 0.12s ease;
633
+ }
634
+
635
+ .rangeSlider::-moz-range-thumb {
636
+ width: 14px;
637
+ height: 14px;
638
+ border: 0;
639
+ border-radius: 50%;
640
+ background: #fff;
641
+ box-shadow: 0 0 0 1px rgb(0 0 0 / 12%), 0 1px 3px rgb(0 0 0 / 25%);
642
+ }
643
+
644
+ .rangeSlider:active::-webkit-slider-thumb {
645
+ transform: scale(1.15);
646
+ }
647
+
648
+ .rangeSlider:focus-visible {
649
+ outline: none;
650
+ }
651
+
652
+ .rangeSlider:focus-visible::-webkit-slider-thumb {
653
+ box-shadow: 0 0 0 2px var(--dsw-alias-brand-primary);
654
+ }
655
+
656
+ .rangeSlider:disabled {
657
+ cursor: not-allowed;
658
+ }
659
+
660
+ .rangeEnds {
661
+ display: flex;
662
+ justify-content: space-between;
663
+ margin-top: 2px;
664
+ color: var(--dsw-alias-label-secondary);
665
+ font-size: 11px;
666
+ line-height: 16px;
667
+ font-variant-numeric: tabular-nums;
668
+ }
669
+
367
670
  .selectOption {
368
671
  /* 弹层是 max-height 受限的 flex 列:选项必须保持自然行高,超出交给弹层滚动 */
369
672
  flex-shrink: 0;
@@ -386,33 +689,132 @@
386
689
  .selectOptionSelected {
387
690
  color: var(--dsw-alias-brand-primary);
388
691
  font-weight: 500;
389
- background: color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 10%, transparent);
692
+ background: color-mix(in srgb, var(--dsw-alias-brand-primary) 10%, transparent);
390
693
  }
391
694
 
392
695
  .invalid {
393
696
  color: var(--dsw-alias-state-error-primary, #b42318);
394
697
  margin: 0;
395
698
  font-size: 12px;
396
- line-height: 1.5;
699
+ line-height: 18px;
397
700
  }
398
701
 
399
702
  .hint {
400
703
  color: var(--dsw-alias-label-secondary);
401
704
  margin: 0;
402
705
  font-size: 12px;
403
- line-height: 1.5;
706
+ line-height: 18px;
707
+ }
708
+
709
+ /* Immediate boolean toggle: a 36x20 capsule with a 16px thumb. The on state
710
+ fills with the primary-action pair rather than a fixed state color, so it
711
+ stays legible in every theme; disabled dims through opacity instead of a
712
+ second palette. */
713
+ .toggle {
714
+ appearance: none;
715
+ display: inline-flex;
716
+ align-items: center;
717
+ background: transparent;
718
+ border: 0;
719
+ border-radius: 999px;
720
+ margin: 0;
721
+ padding: 0;
722
+ cursor: pointer;
723
+ font: inherit;
724
+ }
725
+
726
+ .toggleTrack {
727
+ position: relative;
728
+ flex: none;
729
+ width: 36px;
730
+ height: 20px;
731
+ border-radius: 999px;
732
+ /* Off must still read as a rail: border-l2 is an alpha hairline color and
733
+ leaves the track nearly invisible on a card surface. */
734
+ background: var(--dsw-alias-label-dimmed);
735
+ transition: background-color 0.18s ease;
736
+ }
737
+
738
+ .toggleThumb {
739
+ --toggle-travel: 16px;
740
+ --toggle-overshoot: 1px;
741
+ position: absolute;
742
+ top: 2px;
743
+ left: 2px;
744
+ width: 16px;
745
+ height: 16px;
746
+ border-radius: 50%;
747
+ background: var(--dsw-alias-bg-layer-3);
748
+ box-shadow: 0 1px 2px rgb(20 20 19 / 18%);
749
+ translate: 0 0;
750
+ transition: translate 0.18s ease;
751
+ }
752
+
753
+ .toggle[aria-checked='true'] .toggleTrack {
754
+ background: var(--dsw-alias-button-primary-fill, var(--dsw-alias-label-primary));
755
+ }
756
+
757
+ .toggle[aria-checked='true'] .toggleThumb {
758
+ translate: var(--toggle-travel) 0;
759
+ background: var(--dsw-alias-label-primary-foreground, var(--dsw-alias-bg-layer-3));
760
+ }
761
+
762
+ /* Pressed, the thumb travels across with a double bounce — past its end, back,
763
+ settled — while the track's colour changes on its own clock. Only a switch
764
+ the reader has pressed is armed (data-moved): a thumb drawn by a page
765
+ opening stands where it is. */
766
+ .toggle[data-moved][aria-checked='true'] .toggleThumb {
767
+ animation: toggle-on 0.35s cubic-bezier(0.34, 1.45, 0.64, 1) both;
768
+ }
769
+
770
+ .toggle[data-moved][aria-checked='false'] .toggleThumb {
771
+ animation: toggle-off 0.35s cubic-bezier(0.34, 1.45, 0.64, 1) both;
772
+ }
773
+
774
+ @keyframes toggle-on {
775
+ 0% { translate: 0 0; }
776
+ 55% { translate: calc(var(--toggle-travel) + var(--toggle-overshoot)) 0; }
777
+ 80%, 100% { translate: var(--toggle-travel) 0; }
778
+ }
779
+
780
+ @keyframes toggle-off {
781
+ 0% { translate: var(--toggle-travel) 0; }
782
+ 55% { translate: calc(0px - var(--toggle-overshoot)) 0; }
783
+ 80%, 100% { translate: 0 0; }
784
+ }
785
+
786
+ .toggle:focus-visible {
787
+ outline: 2px solid var(--dsw-alias-brand-primary);
788
+ outline-offset: 2px;
789
+ }
790
+
791
+ .toggle:disabled {
792
+ opacity: 0.45;
793
+ cursor: not-allowed;
404
794
  }
405
795
 
406
796
  @media (prefers-reduced-motion: reduce) {
407
797
  .card,
408
798
  .header,
799
+ .mark,
409
800
  .chevron,
410
801
  .chevronOpen,
411
- .discard,
412
- .save,
802
+ .rangeBubble,
413
803
  .selectChevron,
414
804
  .selectChevronOpen,
415
- .selectPopup {
805
+ .selectPopup,
806
+ .toggleTrack,
807
+ .toggleThumb {
416
808
  transition: none;
417
809
  }
810
+
811
+ .toggle[data-moved] .toggleThumb {
812
+ animation: none;
813
+ }
814
+
815
+ /* Reduced motion drops the height travel but keeps the fade, so a closing
816
+ body still leaves through the leg its own state started. */
817
+ .disclosure {
818
+ transition-property: opacity;
819
+ }
418
820
  }