@lynn123411/dsh-model-submenu 0.3.5 → 0.3.10
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/DETAILS.md +60 -4
- package/README.md +12 -11
- package/lib/client.js +754 -631
- package/lib/client.js.map +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +18 -17
- package/src/client/EffortSlider.tsx +159 -0
- package/src/client/EffortTint.tsx +61 -0
- package/src/client/ModelMenuBridge.tsx +203 -0
- package/src/client/ModelOptions.module.css +372 -0
- package/src/client/ModelPicker.tsx +10 -4
- package/src/client/ModelPickerHost.tsx +146 -0
- package/src/client/ModelRow.tsx +55 -96
- package/src/client/index.ts +65 -28
- package/src/client/level-color.ts +51 -0
- package/src/client/locales.ts +12 -33
- package/src/client/picker-state.ts +55 -0
- package/src/client/selection.ts +43 -17
- package/src/client/slider.ts +51 -0
- package/src/client/ModelSubmenu.module.css +0 -509
- package/src/client/ModelSubmenu.tsx +0 -429
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The composer model seat and the picker it opens. The menu surface renders
|
|
3
|
-
* through the primitives' MenuSurface and the dialog through Modal, so neither
|
|
4
|
-
* this file paints a floating fill — it only places content on the surfaces
|
|
5
|
-
* those two own.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
.root {
|
|
9
|
-
min-width: 0;
|
|
10
|
-
position: relative;
|
|
11
|
-
display: flex;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* The Models glyph replaces the text when the composer row cannot fit it; the
|
|
15
|
-
* row owns both variables, so this plugin follows the same compact contract as
|
|
16
|
-
* the built-in occupant. */
|
|
17
|
-
.trigger {
|
|
18
|
-
min-width: 0;
|
|
19
|
-
max-width: min(360px, 45cqw);
|
|
20
|
-
height: 28px;
|
|
21
|
-
color: var(--dsw-alias-label-secondary);
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
background: 0 0;
|
|
24
|
-
border: none;
|
|
25
|
-
border-radius: 24px;
|
|
26
|
-
outline: none;
|
|
27
|
-
align-items: center;
|
|
28
|
-
gap: 4px;
|
|
29
|
-
padding: 0 4px 0 8px;
|
|
30
|
-
font-size: 13px;
|
|
31
|
-
font-weight: 500;
|
|
32
|
-
line-height: 20px;
|
|
33
|
-
display: flex;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.trigger:hover:not(:disabled) {
|
|
37
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.trigger:focus-visible {
|
|
41
|
-
box-shadow: 0 0 0 2px var(--dsw-alias-border-l3);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.trigger:disabled {
|
|
45
|
-
color: var(--dsw-alias-label-dimmed);
|
|
46
|
-
cursor: default;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.triggerLabel {
|
|
50
|
-
text-overflow: ellipsis;
|
|
51
|
-
white-space: nowrap;
|
|
52
|
-
min-width: 0;
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
display: var(--dsh-composer-model-text-display, block);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* The effort caption is the accent the reference UI uses to say "this is the
|
|
58
|
-
* thinking level in force"; it carries no extra meaning of its own. */
|
|
59
|
-
.triggerEffort {
|
|
60
|
-
text-overflow: ellipsis;
|
|
61
|
-
white-space: nowrap;
|
|
62
|
-
min-width: 0;
|
|
63
|
-
color: var(--dsw-alias-state-business-primary);
|
|
64
|
-
flex-shrink: 1000;
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
display: var(--dsh-composer-model-text-display, block);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.triggerIcon {
|
|
70
|
-
flex: 0 0 auto;
|
|
71
|
-
display: var(--dsh-composer-model-icon-display, none);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.triggerBadge {
|
|
75
|
-
flex: none;
|
|
76
|
-
margin-inline-end: 4px;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.rowBadge {
|
|
80
|
-
flex: none;
|
|
81
|
-
margin-inline-start: 6px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.chevron {
|
|
85
|
-
color: var(--dsw-alias-label-caption);
|
|
86
|
-
flex: none;
|
|
87
|
-
transition: transform .12s;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.chevronOpen {
|
|
91
|
-
transform: rotate(180deg);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.menu {
|
|
95
|
-
z-index: 1100;
|
|
96
|
-
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1);
|
|
97
|
-
/* A fixed width keeps the card independent of the trigger's text length, so
|
|
98
|
-
* opening the menu never reflows the composer. */
|
|
99
|
-
box-sizing: border-box;
|
|
100
|
-
width: min(252px, calc(100vw - 24px));
|
|
101
|
-
max-height: var(--dsh-anchored-max-height, min(70vh, calc(100vh - 96px)));
|
|
102
|
-
box-shadow: var(--dsw-elevation-prominent);
|
|
103
|
-
color: var(--dsw-alias-label-primary);
|
|
104
|
-
--dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
|
|
105
|
-
--dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);
|
|
106
|
-
border: 0;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
padding: 4px;
|
|
109
|
-
display: flex;
|
|
110
|
-
position: fixed;
|
|
111
|
-
overflow: hidden;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/* The provider name is a heading, not a control: it says which provider's
|
|
115
|
-
* models the list below belongs to. */
|
|
116
|
-
.providerName {
|
|
117
|
-
text-overflow: ellipsis;
|
|
118
|
-
white-space: nowrap;
|
|
119
|
-
min-height: 24px;
|
|
120
|
-
color: var(--dsw-alias-label-tertiary);
|
|
121
|
-
align-items: center;
|
|
122
|
-
padding: 3px 8px;
|
|
123
|
-
font-size: 12px;
|
|
124
|
-
font-weight: 500;
|
|
125
|
-
line-height: 18px;
|
|
126
|
-
overflow: hidden;
|
|
127
|
-
display: flex;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.groups {
|
|
131
|
-
min-height: 0;
|
|
132
|
-
overflow-y: auto;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.row {
|
|
136
|
-
align-items: center;
|
|
137
|
-
gap: 2px;
|
|
138
|
-
display: flex;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.rowPick {
|
|
142
|
-
box-sizing: border-box;
|
|
143
|
-
/* A slightly tighter side padding buys the name a few more characters, which
|
|
144
|
-
* is what keeps a long provider suffix readable inside a narrow card. */
|
|
145
|
-
padding-inline: 6px;
|
|
146
|
-
/* The scroll list is a block container, so a flex item's `flex: 1` does
|
|
147
|
-
* nothing here: the row must claim the full width or a long model name pushes
|
|
148
|
-
* the favorite mark and the check past the card's edge, where overflow clips
|
|
149
|
-
* them. */
|
|
150
|
-
width: 100%;
|
|
151
|
-
flex: 1;
|
|
152
|
-
min-width: 0;
|
|
153
|
-
min-height: 34px;
|
|
154
|
-
color: inherit;
|
|
155
|
-
text-align: left;
|
|
156
|
-
cursor: pointer;
|
|
157
|
-
background: 0 0;
|
|
158
|
-
border: none;
|
|
159
|
-
border-radius: 10px;
|
|
160
|
-
outline: none;
|
|
161
|
-
align-items: center;
|
|
162
|
-
gap: 4px;
|
|
163
|
-
padding: 5px 7px;
|
|
164
|
-
display: flex;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.rowPick:hover:not(:disabled),
|
|
168
|
-
.rowPick:focus-visible {
|
|
169
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.rowPick:disabled {
|
|
173
|
-
color: var(--dsw-alias-label-dimmed);
|
|
174
|
-
cursor: default;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.rowCopy {
|
|
178
|
-
flex-direction: column;
|
|
179
|
-
flex: 1;
|
|
180
|
-
min-width: 0;
|
|
181
|
-
display: flex;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.rowName {
|
|
185
|
-
color: inherit;
|
|
186
|
-
text-overflow: ellipsis;
|
|
187
|
-
white-space: nowrap;
|
|
188
|
-
font-size: 11.5px;
|
|
189
|
-
font-weight: 400;
|
|
190
|
-
line-height: 17px;
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/* The menu's names carry the weight: at this size a regular face reads thin
|
|
195
|
-
* against the card. The picker's rows keep theirs regular — there the metadata
|
|
196
|
-
* line already separates the rows. */
|
|
197
|
-
.menu .rowName {
|
|
198
|
-
font-weight: 600;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.rowMeta {
|
|
202
|
-
color: var(--dsw-alias-label-tertiary);
|
|
203
|
-
text-overflow: ellipsis;
|
|
204
|
-
white-space: nowrap;
|
|
205
|
-
font-size: 12px;
|
|
206
|
-
line-height: 18px;
|
|
207
|
-
overflow: hidden;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.check {
|
|
211
|
-
color: var(--dsw-alias-label-primary);
|
|
212
|
-
flex: 0 0 15px;
|
|
213
|
-
place-items: center;
|
|
214
|
-
display: grid;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/* The menu's favorite mark: it lives inside the row button, so hovering it
|
|
218
|
-
* highlights the row and clicking it picks the model — no separate hit area. */
|
|
219
|
-
.starStatic {
|
|
220
|
-
color: var(--dsw-alias-state-warn-primary);
|
|
221
|
-
flex: none;
|
|
222
|
-
place-items: center;
|
|
223
|
-
width: 14px;
|
|
224
|
-
display: grid;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/* The picker's star is a real control: outline until hover or focus, solid and
|
|
228
|
-
* gold once favorited, and visible without hover on touch screens. */
|
|
229
|
-
.starButton {
|
|
230
|
-
color: var(--dsw-alias-label-tertiary);
|
|
231
|
-
cursor: pointer;
|
|
232
|
-
background: 0 0;
|
|
233
|
-
border: none;
|
|
234
|
-
border-radius: 8px;
|
|
235
|
-
outline: none;
|
|
236
|
-
flex: none;
|
|
237
|
-
place-items: center;
|
|
238
|
-
width: 26px;
|
|
239
|
-
height: 26px;
|
|
240
|
-
display: grid;
|
|
241
|
-
opacity: 0;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.starButton:focus-visible {
|
|
245
|
-
outline: 2px solid var(--dsw-alias-border-l3);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.row:hover .starButton,
|
|
249
|
-
.row:focus-within .starButton {
|
|
250
|
-
opacity: 1;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.starButton[aria-pressed='true'] {
|
|
254
|
-
color: var(--dsw-alias-state-warn-primary);
|
|
255
|
-
opacity: 1;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
@media (hover: none) {
|
|
259
|
-
.starButton {
|
|
260
|
-
opacity: 1;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.star {
|
|
265
|
-
flex: none;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.divider {
|
|
269
|
-
height: .5px;
|
|
270
|
-
background: var(--dsw-alias-border-l2);
|
|
271
|
-
flex: none;
|
|
272
|
-
margin: 3px 2px;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.effortRow {
|
|
276
|
-
align-items: center;
|
|
277
|
-
gap: 6px;
|
|
278
|
-
padding: 3px 6px;
|
|
279
|
-
display: flex;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.effortHeading {
|
|
283
|
-
color: var(--dsw-alias-label-primary);
|
|
284
|
-
flex: none;
|
|
285
|
-
font-size: 12px;
|
|
286
|
-
line-height: 18px;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/* The segments scroll sideways rather than wrap, so the row keeps one height
|
|
290
|
-
* however many levels a model advertises. */
|
|
291
|
-
.effortTrack {
|
|
292
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
293
|
-
border-radius: 999px;
|
|
294
|
-
align-items: center;
|
|
295
|
-
gap: 1px;
|
|
296
|
-
min-width: 0;
|
|
297
|
-
margin-left: auto;
|
|
298
|
-
padding: 2px;
|
|
299
|
-
display: flex;
|
|
300
|
-
overflow-x: auto;
|
|
301
|
-
scrollbar-width: none;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.effortTrack::-webkit-scrollbar {
|
|
305
|
-
display: none;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.effortSegment {
|
|
309
|
-
color: var(--dsw-alias-label-secondary);
|
|
310
|
-
cursor: pointer;
|
|
311
|
-
background: 0 0;
|
|
312
|
-
border: none;
|
|
313
|
-
border-radius: 999px;
|
|
314
|
-
outline: none;
|
|
315
|
-
flex: none;
|
|
316
|
-
padding: 2px 7px;
|
|
317
|
-
font-size: 11px;
|
|
318
|
-
line-height: 16px;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.effortSegment:hover:not(:disabled) {
|
|
322
|
-
color: var(--dsw-alias-label-primary);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.effortSegment[aria-checked='true'] {
|
|
326
|
-
color: var(--dsw-alias-label-primary);
|
|
327
|
-
background: var(--dsw-alias-bg-layer-1);
|
|
328
|
-
box-shadow: var(--dsw-elevation-soft);
|
|
329
|
-
font-weight: 600;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.effortSegment:disabled {
|
|
333
|
-
color: var(--dsw-alias-label-dimmed);
|
|
334
|
-
cursor: default;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.effortSegment:focus-visible {
|
|
338
|
-
outline: 2px solid var(--dsw-alias-border-l3);
|
|
339
|
-
outline-offset: -2px;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.hint {
|
|
343
|
-
color: var(--dsw-alias-label-tertiary);
|
|
344
|
-
margin: 0;
|
|
345
|
-
padding: 6px 8px;
|
|
346
|
-
font-size: 11px;
|
|
347
|
-
line-height: 16px;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.moreRow {
|
|
351
|
-
color: var(--dsw-alias-label-secondary);
|
|
352
|
-
cursor: pointer;
|
|
353
|
-
background: 0 0;
|
|
354
|
-
border: none;
|
|
355
|
-
border-radius: 10px;
|
|
356
|
-
outline: none;
|
|
357
|
-
align-items: center;
|
|
358
|
-
gap: 6px;
|
|
359
|
-
min-height: 32px;
|
|
360
|
-
padding: 5px 8px;
|
|
361
|
-
font-size: 12px;
|
|
362
|
-
line-height: 18px;
|
|
363
|
-
display: flex;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
.moreRow:hover,
|
|
367
|
-
.moreRow:focus-visible {
|
|
368
|
-
color: var(--dsw-alias-label-primary);
|
|
369
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
.moreIcon {
|
|
373
|
-
color: var(--dsw-alias-label-tertiary);
|
|
374
|
-
flex: none;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.notice {
|
|
378
|
-
color: var(--dsw-alias-label-tertiary);
|
|
379
|
-
justify-content: space-between;
|
|
380
|
-
align-items: flex-start;
|
|
381
|
-
gap: 8px;
|
|
382
|
-
padding: 6px 10px;
|
|
383
|
-
font-size: 12px;
|
|
384
|
-
line-height: 18px;
|
|
385
|
-
display: flex;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
.retry {
|
|
389
|
-
color: inherit;
|
|
390
|
-
font: inherit;
|
|
391
|
-
cursor: pointer;
|
|
392
|
-
background: 0 0;
|
|
393
|
-
border: none;
|
|
394
|
-
flex: none;
|
|
395
|
-
padding: 0;
|
|
396
|
-
font-weight: 600;
|
|
397
|
-
text-decoration: underline;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/* ── the picker dialog ───────────────────────────────────────────────────── */
|
|
401
|
-
|
|
402
|
-
.pickerDialog {
|
|
403
|
-
width: min(680px, 100%);
|
|
404
|
-
height: min(640px, 80vh);
|
|
405
|
-
gap: 0;
|
|
406
|
-
padding: 0;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
.pickerContent {
|
|
410
|
-
min-height: 0;
|
|
411
|
-
flex: 1;
|
|
412
|
-
display: flex;
|
|
413
|
-
flex-direction: column;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/* Modal wraps children in a body row of its own; that row — the content
|
|
417
|
-
* region's last child — is what has to carry the column and give the list its
|
|
418
|
-
* remaining height, so the footer stays put while the list scrolls. */
|
|
419
|
-
.pickerContent > :last-child {
|
|
420
|
-
min-height: 0;
|
|
421
|
-
flex: 1;
|
|
422
|
-
display: flex;
|
|
423
|
-
flex-direction: column;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
.pickerSearch {
|
|
427
|
-
padding: 0 20px 12px;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.pickerSearchInput {
|
|
431
|
-
width: 100%;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/* The tabs scroll sideways rather than wrap: the dialog keeps one row of
|
|
435
|
-
* providers however many the catalog has, so the list below starts at the same
|
|
436
|
-
* height every time. The bar keeps its hairline and hides its scrollbar the way
|
|
437
|
-
* the effort track does. */
|
|
438
|
-
.pickerTabs {
|
|
439
|
-
border-bottom: .5px solid var(--dsw-alias-border-l2);
|
|
440
|
-
gap: 2px;
|
|
441
|
-
padding: 0 16px;
|
|
442
|
-
display: flex;
|
|
443
|
-
flex-wrap: nowrap;
|
|
444
|
-
overflow-x: auto;
|
|
445
|
-
overscroll-behavior-x: contain;
|
|
446
|
-
scrollbar-width: none;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.pickerTabs::-webkit-scrollbar {
|
|
450
|
-
display: none;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
.pickerTab {
|
|
454
|
-
color: var(--dsw-alias-label-secondary);
|
|
455
|
-
cursor: pointer;
|
|
456
|
-
background: 0 0;
|
|
457
|
-
border: none;
|
|
458
|
-
border-radius: 8px;
|
|
459
|
-
outline: none;
|
|
460
|
-
flex: none;
|
|
461
|
-
padding: 6px 10px;
|
|
462
|
-
font-size: 13px;
|
|
463
|
-
line-height: 18px;
|
|
464
|
-
white-space: nowrap;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
.pickerTab:hover {
|
|
468
|
-
color: var(--dsw-alias-label-primary);
|
|
469
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.pickerTab[aria-selected='true'] {
|
|
473
|
-
color: var(--dsw-alias-label-primary);
|
|
474
|
-
background: var(--dsw-alias-interactive-bg-hover);
|
|
475
|
-
font-weight: 600;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
.pickerTab:focus-visible {
|
|
479
|
-
outline: 2px solid var(--dsw-alias-border-l3);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.pickerList {
|
|
483
|
-
min-height: 0;
|
|
484
|
-
flex: 1;
|
|
485
|
-
padding: 8px 12px;
|
|
486
|
-
overflow-y: auto;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
.pickerFooter {
|
|
490
|
-
border-top: .5px solid var(--dsw-alias-border-l2);
|
|
491
|
-
color: var(--dsw-alias-label-tertiary);
|
|
492
|
-
align-items: center;
|
|
493
|
-
gap: 6px;
|
|
494
|
-
padding: 10px 20px;
|
|
495
|
-
font-size: 12px;
|
|
496
|
-
line-height: 18px;
|
|
497
|
-
display: flex;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.footerHint {
|
|
501
|
-
align-items: center;
|
|
502
|
-
gap: 6px;
|
|
503
|
-
display: flex;
|
|
504
|
-
flex-wrap: wrap;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
.footerDot {
|
|
508
|
-
color: var(--dsw-alias-label-dimmed);
|
|
509
|
-
}
|