dsh-model-select-plus 0.1.6 → 0.2.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/README.md +10 -8
- package/lib/client.cjs +380 -273
- package/package.json +6 -6
- package/src/client.js +470 -271
package/lib/client.cjs
CHANGED
|
@@ -46,71 +46,88 @@ var module = { exports: {} };
|
|
|
46
46
|
var API = "/plugins/dsh-model-select-plus/api";
|
|
47
47
|
var STYLE_TAG = "dsh-model-select-plus/style";
|
|
48
48
|
var FAVS_KEY = "__favorites__";
|
|
49
|
+
var h = import_react.default.createElement;
|
|
49
50
|
var CSS = `
|
|
50
|
-
.mdsl-root {
|
|
51
|
+
.mdsl-root, .mdsl-root *, .mdsl-root *::before, .mdsl-root *::after { box-sizing: border-box; }
|
|
52
|
+
.mdsl-root { position: relative; display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
|
|
51
53
|
.mdsl-backdrop { position: fixed; inset: 0; z-index: 35; }
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.mdsl-trigger:
|
|
56
|
-
.mdsl-trigger:disabled {
|
|
57
|
-
.mdsl-
|
|
58
|
-
.mdsl-
|
|
59
|
-
.mdsl-
|
|
60
|
-
|
|
54
|
+
|
|
55
|
+
/* Trigger: the composer's 28px chip, same as the sibling permission / plan
|
|
56
|
+
controls, so the row does not jump when this plugin replaces the seat. */
|
|
57
|
+
.mdsl-trigger { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 220px; max-width: min(360px, 45cqw); height: 28px; padding: 0 4px 0 8px; border: 0; border-radius: var(--dsw-radius-sm, 8px); background: transparent; color: var(--dsw-alias-label-secondary); font-family: inherit; font-size: 13px; line-height: 20px; font-weight: 400; cursor: pointer; outline: none; }
|
|
58
|
+
.mdsl-trigger:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
|
|
59
|
+
.mdsl-trigger:focus-visible { box-shadow: 0 0 0 2px var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); }
|
|
60
|
+
.mdsl-trigger:disabled { color: var(--dsw-alias-label-dimmed); cursor: default; }
|
|
61
|
+
.mdsl-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
62
|
+
/* The effort absorbs the deficit first: it ellipsizes to nothing before the
|
|
63
|
+
model name loses a pixel, and the chevron stays snug. */
|
|
64
|
+
.mdsl-effort { flex-shrink: 1000; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-caption); }
|
|
65
|
+
.mdsl-chevron { flex: none; display: inline-flex; color: var(--dsw-alias-label-caption); }
|
|
61
66
|
.mdsl-chevron-open { transform: rotate(180deg); }
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.mdsl-
|
|
66
|
-
.mdsl-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.mdsl-search
|
|
73
|
-
.mdsl-search:focus { border-color: var(--dsw-alias-
|
|
74
|
-
.mdsl-search-
|
|
75
|
-
.mdsl-search-
|
|
76
|
-
.mdsl-
|
|
77
|
-
.mdsl-
|
|
78
|
-
.mdsl-
|
|
79
|
-
.mdsl-
|
|
80
|
-
.mdsl-
|
|
81
|
-
|
|
82
|
-
.mdsl-
|
|
83
|
-
.mdsl-body {
|
|
84
|
-
.mdsl-body::-webkit-scrollbar {
|
|
85
|
-
.mdsl-body::-webkit-scrollbar-thumb { background: var(--dsw-alias-scrollbar-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.mdsl-group
|
|
91
|
-
.mdsl-group-
|
|
92
|
-
.mdsl-group-
|
|
93
|
-
.mdsl-group-
|
|
94
|
-
.mdsl-group-
|
|
95
|
-
.mdsl-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
.mdsl-
|
|
67
|
+
|
|
68
|
+
/* Card: the shipped menu material. 320px sits inside the native menu range
|
|
69
|
+
(240-420) and stays close to the trigger that opened it. */
|
|
70
|
+
.mdsl-menu { position: fixed; z-index: 40; display: flex; flex-direction: column; width: 320px; max-width: calc(100vw - 24px); max-height: min(440px, calc(100vh - 120px)); padding: 4px; background: var(--dsw-menu-surface-fill, var(--dsw-alias-bg-overlay)); -webkit-backdrop-filter: var(--dsw-menu-backdrop-filter, blur(20px) saturate(140%)); backdrop-filter: var(--dsw-menu-backdrop-filter, blur(20px) saturate(140%)); border: 0; border-radius: var(--dsw-radius-lg, 16px); --dsw-elevation-stroke-color: var(--dsw-alias-border-l1); box-shadow: var(--dsw-elevation-prominent, 0 10px 36px rgba(0,0,0,.14)); color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 13px; --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2); --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2); overflow: hidden; animation: mdsl-in .16s cubic-bezier(.22, 1, .36, 1); transform-origin: bottom right; }
|
|
71
|
+
body[data-ds-dark-theme] .mdsl-menu { --dsw-elevation-stroke-color: var(--dsw-alias-border-l3); }
|
|
72
|
+
@keyframes mdsl-in { from { opacity: 0; transform: translateY(4px) scale(.99); } to { opacity: 1; transform: none; } }
|
|
73
|
+
@media (prefers-reduced-motion: reduce) { .mdsl-menu { animation: none; } }
|
|
74
|
+
|
|
75
|
+
/* One search line with a 0.5px rule. No jump rail: 18 models are cheap to
|
|
76
|
+
scroll, and the second navigation layer only repeated the headings. */
|
|
77
|
+
.mdsl-search-wrap { position: relative; flex: none; display: flex; align-items: center; height: 34px; border-bottom: 0.5px solid var(--dsw-alias-border-l1); }
|
|
78
|
+
.mdsl-search-wrap:focus-within { border-bottom-color: var(--dsw-alias-state-business-primary); }
|
|
79
|
+
.mdsl-search-icon { position: absolute; left: 8px; display: flex; color: var(--dsw-alias-label-tertiary); pointer-events: none; }
|
|
80
|
+
.mdsl-search-wrap:focus-within .mdsl-search-icon { color: var(--dsw-alias-label-primary); }
|
|
81
|
+
.mdsl-search { width: 100%; height: 100%; padding: 0 28px 0 30px; border: 0; border-radius: 0; background: transparent; color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 13px; line-height: 20px; outline: none; }
|
|
82
|
+
.mdsl-search::placeholder { color: var(--dsw-alias-label-caption); }
|
|
83
|
+
.mdsl-search-clear { position: absolute; right: 4px; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
84
|
+
.mdsl-search-clear:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
85
|
+
.mdsl-search-clear:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary); }
|
|
86
|
+
|
|
87
|
+
.mdsl-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 2px 2px; scrollbar-width: thin; scrollbar-color: var(--dsh-scrollbar-thumb, var(--dsw-alias-scrollbar-bg-l2)) transparent; }
|
|
88
|
+
.mdsl-body::-webkit-scrollbar { width: 8px; }
|
|
89
|
+
.mdsl-body::-webkit-scrollbar-thumb { background: var(--dsh-scrollbar-thumb, var(--dsw-alias-scrollbar-bg-l2)); border: 2px solid transparent; border-radius: 999px; background-clip: content-box; }
|
|
90
|
+
.mdsl-body::-webkit-scrollbar-thumb:hover { background: var(--dsh-scrollbar-thumb-hover, var(--dsw-alias-scrollbar-hover-l2)); border: 2px solid transparent; background-clip: content-box; }
|
|
91
|
+
|
|
92
|
+
/* Sections: 10px of air between groups; a 22px heading that paints its
|
|
93
|
+
header fill only while stuck to the top, so static groups stay flat
|
|
94
|
+
instead of drawing a grey band each. */
|
|
95
|
+
.mdsl-group { position: relative; }
|
|
96
|
+
.mdsl-group + .mdsl-group { margin-top: 10px; }
|
|
97
|
+
.mdsl-group-title { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 4px; padding: 4px 8px 2px; background: transparent; color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 16px; font-weight: 500; }
|
|
98
|
+
.mdsl-group-title[data-stuck] { background: var(--dsw-alias-menu-group-header-fill, var(--dsw-alias-bg-overlay)); box-shadow: 0 0.5px 0 var(--dsw-alias-border-l1); }
|
|
99
|
+
.mdsl-group-icon { display: inline-flex; color: var(--dsw-alias-brand-primary); }
|
|
100
|
+
.mdsl-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
101
|
+
|
|
102
|
+
/* Row: 34px, the native menu row height. Selection is a 6% fill plus the
|
|
103
|
+
trailing check; the 10% block read as a disabled row. */
|
|
104
|
+
.mdsl-item { border-radius: var(--dsw-radius-md, 12px); }
|
|
105
|
+
.mdsl-item:hover, .mdsl-item-current { background: var(--dsw-alias-interactive-bg-hover); }
|
|
106
|
+
.mdsl-row { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border-radius: var(--dsw-radius-md, 12px); cursor: pointer; }
|
|
107
|
+
.mdsl-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--dsw-alias-state-business-primary); }
|
|
108
|
+
.mdsl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 20px; }
|
|
109
|
+
.mdsl-item-current .mdsl-name { font-weight: 500; }
|
|
110
|
+
.mdsl-prov { flex: none; color: var(--dsw-alias-label-caption); font-size: 11px; line-height: 16px; }
|
|
111
|
+
.mdsl-check { flex: none; display: inline-flex; color: var(--dsw-alias-label-primary); }
|
|
112
|
+
.mdsl-star { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-tertiary); opacity: 0; cursor: pointer; }
|
|
113
|
+
.mdsl-item:hover .mdsl-star, .mdsl-star-on, .mdsl-star:focus-visible { opacity: 1; }
|
|
114
|
+
.mdsl-star:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
115
|
+
.mdsl-star:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary); }
|
|
100
116
|
.mdsl-star-on { color: var(--dsw-alias-brand-primary); }
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.mdsl-
|
|
105
|
-
.mdsl-
|
|
106
|
-
.mdsl-
|
|
107
|
-
.mdsl-
|
|
108
|
-
.mdsl-
|
|
109
|
-
.mdsl-
|
|
110
|
-
.mdsl-
|
|
111
|
-
.mdsl-
|
|
112
|
-
|
|
113
|
-
.mdsl-
|
|
117
|
+
|
|
118
|
+
/* Only the current row expands: description and effort belong to it, so
|
|
119
|
+
every other row keeps the same 34px baseline. */
|
|
120
|
+
.mdsl-sub { padding: 2px 8px 8px; }
|
|
121
|
+
.mdsl-desc { color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
122
|
+
.mdsl-track { display: flex; align-items: center; gap: 2px; height: 26px; margin-top: 6px; padding: 3px; border-radius: 8px; background: var(--dsw-alias-interactive-bg-hover); }
|
|
123
|
+
.mdsl-seg { flex: 1; height: 20px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-tertiary); font-family: inherit; font-size: 11px; line-height: 20px; text-align: center; cursor: pointer; }
|
|
124
|
+
.mdsl-seg:hover { color: var(--dsw-alias-label-primary); }
|
|
125
|
+
.mdsl-seg:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary); }
|
|
126
|
+
.mdsl-seg-on { background: var(--dsw-alias-bg-base, #fff); color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: 0 0 0 0.5px var(--dsw-alias-border-l2), 0 1px 2px rgba(0, 0, 0, .05); }
|
|
127
|
+
body[data-ds-dark-theme] .mdsl-seg-on { background: var(--dsw-alias-interactive-bg-active); }
|
|
128
|
+
|
|
129
|
+
.mdsl-empty { padding: 16px 8px; text-align: center; color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 18px; }
|
|
130
|
+
.mdsl-error { margin: 4px 2px; padding: 6px 8px; border-radius: 8px; background: var(--dsw-alias-interactive-bg-hover-danger); color: var(--dsw-alias-state-error-primary); font-size: 11px; line-height: 16px; }
|
|
114
131
|
`;
|
|
115
132
|
function injectStyle() {
|
|
116
133
|
if (typeof document === "undefined") return () => {
|
|
@@ -125,38 +142,50 @@ var module = { exports: {} };
|
|
|
125
142
|
tag.remove();
|
|
126
143
|
};
|
|
127
144
|
}
|
|
128
|
-
var star = (filled) =>
|
|
145
|
+
var star = (filled) => h(
|
|
129
146
|
"svg",
|
|
130
|
-
{ width: 14, height: 14, viewBox: "0 0 24 24", fill: filled ? "currentColor" : "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
131
|
-
|
|
147
|
+
{ width: 14, height: 14, viewBox: "0 0 24 24", fill: filled ? "currentColor" : "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
148
|
+
h("path", { d: "M12 2.6l2.86 5.8 6.4.94-4.63 4.5 1.1 6.37L12 17.02 6.27 20.2l1.1-6.37-4.63-4.5 6.4-.94L12 2.6z", stroke: "currentColor", strokeWidth: 1.5, strokeLinejoin: "round" })
|
|
132
149
|
);
|
|
133
|
-
var
|
|
150
|
+
var check = () => h(
|
|
134
151
|
"svg",
|
|
135
|
-
{ width:
|
|
136
|
-
|
|
152
|
+
{ width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
153
|
+
h("path", { d: "M2.8 7.4l2.6 2.6 5.8-6.4", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })
|
|
137
154
|
);
|
|
138
|
-
var
|
|
155
|
+
var chevronDown = () => h(
|
|
156
|
+
"svg",
|
|
157
|
+
{ width: 12, height: 12, viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
158
|
+
h("path", { d: "M3 4.75L6 7.75l3-3", stroke: "currentColor", strokeWidth: 1.3, strokeLinecap: "round", strokeLinejoin: "round" })
|
|
159
|
+
);
|
|
160
|
+
var closeIcon = () => h(
|
|
161
|
+
"svg",
|
|
162
|
+
{ width: 12, height: 12, viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
163
|
+
h("path", { d: "M3 3l6 6M9 3L3 9", stroke: "currentColor", strokeWidth: 1.4, strokeLinecap: "round" })
|
|
164
|
+
);
|
|
165
|
+
var searchIcon = () => h(
|
|
139
166
|
"span",
|
|
140
167
|
{ className: "mdsl-search-icon" },
|
|
141
|
-
|
|
168
|
+
h(
|
|
142
169
|
"svg",
|
|
143
|
-
{ width:
|
|
144
|
-
|
|
145
|
-
|
|
170
|
+
{ width: 14, height: 14, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
171
|
+
h("circle", { cx: 7, cy: 7, r: 5, stroke: "currentColor", strokeWidth: 1.4 }),
|
|
172
|
+
h("line", { x1: 10.8, y1: 10.8, x2: 14, y2: 14, stroke: "currentColor", strokeWidth: 1.4, strokeLinecap: "round" })
|
|
146
173
|
)
|
|
147
174
|
);
|
|
148
175
|
function ModelSelectLite(props) {
|
|
149
176
|
const sessionId = props.sessionId;
|
|
150
177
|
const locked = props.locked === true;
|
|
178
|
+
const triggerRef = import_react.default.useRef(null);
|
|
151
179
|
const bodyRef = import_react.default.useRef(null);
|
|
180
|
+
const searchRef = import_react.default.useRef(null);
|
|
181
|
+
const [placement, setPlacement] = import_react.default.useState(null);
|
|
152
182
|
const [open, setOpen] = import_react.default.useState(false);
|
|
153
183
|
const [data, setData] = import_react.default.useState({ status: "idle", groups: [], failures: [], current: null, error: null });
|
|
154
184
|
const [query, setQuery] = import_react.default.useState("");
|
|
155
185
|
const [busy, setBusy] = import_react.default.useState(false);
|
|
156
186
|
const [, bump] = import_react.default.useState(0);
|
|
157
|
-
const [userToggled, setUserToggled] = import_react.default.useState(() => /* @__PURE__ */ new Map());
|
|
158
187
|
const load = () => {
|
|
159
|
-
setData((d) =>
|
|
188
|
+
setData((d) => d.groups.length > 0 ? { ...d, error: null } : { ...d, status: "loading", error: null });
|
|
160
189
|
const url = `${API}/catalog?sessionId=${encodeURIComponent(sessionId)}`;
|
|
161
190
|
fetch(url).then((res) => res.json()).then((res) => {
|
|
162
191
|
if (res === null || res && res.error !== void 0) {
|
|
@@ -169,11 +198,91 @@ var module = { exports: {} };
|
|
|
169
198
|
});
|
|
170
199
|
};
|
|
171
200
|
import_react.default.useEffect(() => {
|
|
172
|
-
if (sessionId !== void 0)
|
|
173
|
-
setUserToggled(/* @__PURE__ */ new Map());
|
|
174
|
-
load();
|
|
175
|
-
}
|
|
201
|
+
if (sessionId !== void 0) load();
|
|
176
202
|
}, [sessionId]);
|
|
203
|
+
const focusedForOpen = import_react.default.useRef(false);
|
|
204
|
+
import_react.default.useEffect(() => {
|
|
205
|
+
if (!open) {
|
|
206
|
+
focusedForOpen.current = false;
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (placement === null || focusedForOpen.current) return;
|
|
210
|
+
focusedForOpen.current = true;
|
|
211
|
+
const el = searchRef.current;
|
|
212
|
+
if (el) el.focus({ preventScroll: true });
|
|
213
|
+
}, [open, placement]);
|
|
214
|
+
const placeMenu = () => {
|
|
215
|
+
const trigger = triggerRef.current;
|
|
216
|
+
if (!trigger) return;
|
|
217
|
+
const rect = trigger.getBoundingClientRect();
|
|
218
|
+
const margin = 12;
|
|
219
|
+
const gap = 6;
|
|
220
|
+
const width = Math.min(320, window.innerWidth - margin * 2);
|
|
221
|
+
const spaceAbove = rect.top - gap - margin;
|
|
222
|
+
const spaceBelow = window.innerHeight - rect.bottom - gap - margin;
|
|
223
|
+
const side = spaceAbove >= spaceBelow ? "top" : "bottom";
|
|
224
|
+
const maxHeight = Math.max(180, Math.min(440, side === "top" ? spaceAbove : spaceBelow));
|
|
225
|
+
const left = Math.min(Math.max(margin, rect.right - width), window.innerWidth - width - margin);
|
|
226
|
+
setPlacement((prev) => {
|
|
227
|
+
const next = {
|
|
228
|
+
side,
|
|
229
|
+
maxHeight,
|
|
230
|
+
width,
|
|
231
|
+
left,
|
|
232
|
+
bottom: window.innerHeight - rect.top + gap,
|
|
233
|
+
top: rect.bottom + gap
|
|
234
|
+
};
|
|
235
|
+
if (prev !== null && prev.side === next.side && prev.maxHeight === next.maxHeight && prev.width === next.width && prev.left === next.left && prev.bottom === next.bottom && prev.top === next.top) return prev;
|
|
236
|
+
return next;
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
import_react.default.useLayoutEffect(() => {
|
|
240
|
+
if (open) placeMenu();
|
|
241
|
+
}, [open]);
|
|
242
|
+
import_react.default.useEffect(() => {
|
|
243
|
+
if (!open) return;
|
|
244
|
+
const reposition = (ev) => {
|
|
245
|
+
const body = bodyRef.current;
|
|
246
|
+
if (ev && ev.target instanceof Node && body !== null && body.contains(ev.target)) return;
|
|
247
|
+
placeMenu();
|
|
248
|
+
};
|
|
249
|
+
window.addEventListener("resize", reposition);
|
|
250
|
+
window.addEventListener("scroll", reposition, true);
|
|
251
|
+
return () => {
|
|
252
|
+
window.removeEventListener("resize", reposition);
|
|
253
|
+
window.removeEventListener("scroll", reposition, true);
|
|
254
|
+
};
|
|
255
|
+
}, [open]);
|
|
256
|
+
import_react.default.useEffect(() => {
|
|
257
|
+
if (!open) return;
|
|
258
|
+
const body = bodyRef.current;
|
|
259
|
+
if (!body) return;
|
|
260
|
+
let raf = 0;
|
|
261
|
+
const sync = () => {
|
|
262
|
+
raf = 0;
|
|
263
|
+
const top = body.getBoundingClientRect().top;
|
|
264
|
+
const heads = body.querySelectorAll(".mdsl-group-title");
|
|
265
|
+
for (const head of heads) {
|
|
266
|
+
if (head.getBoundingClientRect().top <= top + 1) head.setAttribute("data-stuck", "");
|
|
267
|
+
else head.removeAttribute("data-stuck");
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const schedule = () => {
|
|
271
|
+
if (!raf) raf = requestAnimationFrame(sync);
|
|
272
|
+
};
|
|
273
|
+
body.addEventListener("scroll", schedule, { passive: true });
|
|
274
|
+
window.addEventListener("resize", schedule);
|
|
275
|
+
schedule();
|
|
276
|
+
return () => {
|
|
277
|
+
body.removeEventListener("scroll", schedule);
|
|
278
|
+
window.removeEventListener("resize", schedule);
|
|
279
|
+
if (raf) cancelAnimationFrame(raf);
|
|
280
|
+
};
|
|
281
|
+
}, [open, placement, data.status, data.current, query]);
|
|
282
|
+
const focusTrigger = () => {
|
|
283
|
+
const el = triggerRef.current;
|
|
284
|
+
if (el) el.focus({ preventScroll: true });
|
|
285
|
+
};
|
|
177
286
|
const openMenu = () => {
|
|
178
287
|
setOpen(true);
|
|
179
288
|
load();
|
|
@@ -181,8 +290,10 @@ var module = { exports: {} };
|
|
|
181
290
|
const closeMenu = () => {
|
|
182
291
|
setOpen(false);
|
|
183
292
|
setQuery("");
|
|
293
|
+
setPlacement(null);
|
|
294
|
+
focusTrigger();
|
|
184
295
|
};
|
|
185
|
-
const selectSelection = (sel) => {
|
|
296
|
+
const selectSelection = (sel, keepOpen) => {
|
|
186
297
|
if (busy) return;
|
|
187
298
|
setBusy(true);
|
|
188
299
|
fetch(`${API}/select`, {
|
|
@@ -197,8 +308,8 @@ var module = { exports: {} };
|
|
|
197
308
|
}).then((res) => res.json()).then((res) => {
|
|
198
309
|
setBusy(false);
|
|
199
310
|
if (res && res.ok === true) {
|
|
200
|
-
setData((d) => ({ ...d, current: res.selected, error: null }));
|
|
201
|
-
|
|
311
|
+
setData((d) => ({ ...d, current: res.selected || null, error: null }));
|
|
312
|
+
if (keepOpen) return;
|
|
202
313
|
closeMenu();
|
|
203
314
|
} else {
|
|
204
315
|
setData((d) => ({ ...d, error: res && res.message || "\u9009\u62E9\u5931\u8D25" }));
|
|
@@ -208,243 +319,239 @@ var module = { exports: {} };
|
|
|
208
319
|
setData((d) => ({ ...d, error: String(err && err.message || err) }));
|
|
209
320
|
});
|
|
210
321
|
};
|
|
211
|
-
const toggleFav = (
|
|
212
|
-
|
|
213
|
-
const key = `${g}/${m}`;
|
|
322
|
+
const toggleFav = (gid, mid) => {
|
|
323
|
+
const key = `${gid}/${mid}`;
|
|
214
324
|
const next = new Set(favorites);
|
|
215
325
|
if (next.has(key)) next.delete(key);
|
|
216
326
|
else next.add(key);
|
|
217
327
|
favorites = next;
|
|
218
328
|
bump((x) => x + 1);
|
|
219
329
|
};
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const cur = data.current;
|
|
224
|
-
const isCurrentGroup = gid === FAVS_KEY ? cur !== null && favorites.has(cur.provider + "/" + cur.model) : cur !== null && cur.provider === gid;
|
|
225
|
-
return !isCurrentGroup;
|
|
226
|
-
};
|
|
227
|
-
const toggleCollapse = (gid) => {
|
|
228
|
-
const nextState = !isGroupCollapsed(gid);
|
|
229
|
-
setUserToggled((prev) => {
|
|
230
|
-
const next = new Map(prev);
|
|
231
|
-
next.set(gid, nextState);
|
|
232
|
-
return next;
|
|
233
|
-
});
|
|
330
|
+
const choose = (g, m) => {
|
|
331
|
+
const effort = m.reasoning ? m.reasoning.defaultEffort : void 0;
|
|
332
|
+
selectSelection({ provider: g.id, model: m.id, ...effort === void 0 ? {} : { reasoningEffort: effort } }, false);
|
|
234
333
|
};
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
setUserToggled((prev) => {
|
|
238
|
-
const next = /* @__PURE__ */ new Map();
|
|
239
|
-
if (data.groups) {
|
|
240
|
-
for (const g of data.groups) next.set(g.id, true);
|
|
241
|
-
}
|
|
242
|
-
next.set(FAVS_KEY, true);
|
|
243
|
-
next.set(gid, false);
|
|
244
|
-
return next;
|
|
245
|
-
});
|
|
246
|
-
setTimeout(() => {
|
|
247
|
-
if (!bodyRef.current) return;
|
|
248
|
-
const el = bodyRef.current.querySelector('[data-group-id="' + gid + '"]');
|
|
249
|
-
if (el) {
|
|
250
|
-
const bodyRect = bodyRef.current.getBoundingClientRect();
|
|
251
|
-
const elRect = el.getBoundingClientRect();
|
|
252
|
-
const targetScrollTop = bodyRef.current.scrollTop + (elRect.top - bodyRect.top);
|
|
253
|
-
bodyRef.current.scrollTo({ top: Math.max(0, targetScrollTop - 4), behavior: "smooth" });
|
|
254
|
-
}
|
|
255
|
-
}, 40);
|
|
334
|
+
const chooseEffort = (g, m, effort) => {
|
|
335
|
+
selectSelection({ provider: g.id, model: m.id, ...effort === void 0 ? {} : { reasoningEffort: effort } }, true);
|
|
256
336
|
};
|
|
257
337
|
const current = data.current;
|
|
258
338
|
const curGroup = current ? data.groups.find((g) => g.id === current.provider) : void 0;
|
|
259
339
|
const curModel = curGroup ? curGroup.models.find((mm) => mm.id === current.model) : void 0;
|
|
260
340
|
const providerName = curGroup ? curGroup.name : current ? current.provider : "";
|
|
261
|
-
const modelName = curModel && curModel.name || (current ? current.model : "
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
341
|
+
const modelName = curModel && curModel.name || (current ? current.model : "");
|
|
342
|
+
const pinnedEffort = current ? current.reasoningEffort : void 0;
|
|
343
|
+
let effortLabel;
|
|
344
|
+
if (curModel && curModel.reasoning) {
|
|
345
|
+
const shown = pinnedEffort !== void 0 ? pinnedEffort : curModel.reasoning.defaultEffort;
|
|
346
|
+
if (shown !== void 0) {
|
|
347
|
+
const hit = (curModel.reasoning.efforts || []).find((e) => e.id === shown);
|
|
348
|
+
effortLabel = hit ? hit.name : shown;
|
|
349
|
+
} else {
|
|
350
|
+
effortLabel = "\u9ED8\u8BA4";
|
|
272
351
|
}
|
|
273
352
|
}
|
|
274
353
|
const q = query.trim().toLowerCase();
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (g.models && g.models.length > 0) {
|
|
287
|
-
const isCurrent = current !== null && current.provider === g.id;
|
|
288
|
-
tagList.push({ id: g.id, name: g.name, isCurrent, count: g.models.length });
|
|
289
|
-
}
|
|
354
|
+
const matches = (g, m) => q === "" || (m.name + " " + (m.description || "") + " " + g.name).toLowerCase().includes(q);
|
|
355
|
+
let total = 0;
|
|
356
|
+
const favEntries = [];
|
|
357
|
+
const filteredGroups = [];
|
|
358
|
+
for (const g of data.groups || []) {
|
|
359
|
+
const models = [];
|
|
360
|
+
for (const m of g.models || []) {
|
|
361
|
+
total += 1;
|
|
362
|
+
if (!matches(g, m)) continue;
|
|
363
|
+
if (favorites.has(`${g.id}/${m.id}`)) favEntries.push({ g, m });
|
|
364
|
+
else models.push(m);
|
|
290
365
|
}
|
|
366
|
+
if (models.length > 0) filteredGroups.push({ id: g.id, name: g.name, models });
|
|
291
367
|
}
|
|
292
|
-
const
|
|
368
|
+
const noMatch = data.status === "ready" && q !== "" && filteredGroups.length === 0 && favEntries.length === 0;
|
|
369
|
+
const isCurrentModel = (g, m) => current !== null && current !== void 0 && current.provider === g.id && current.model === m.id;
|
|
370
|
+
const heading = (label, icon) => h(
|
|
293
371
|
"div",
|
|
294
|
-
{
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
tabIndex: 0,
|
|
298
|
-
"aria-expanded": isCollapsed ? false : true,
|
|
299
|
-
title: (isCollapsed ? "\u5C55\u5F00\uFF1A" : "\u6298\u53E0\uFF1A") + name2,
|
|
300
|
-
onClick: interactive ? () => toggleCollapse(gid) : void 0,
|
|
301
|
-
onKeyDown: interactive ? (ev) => {
|
|
302
|
-
if (ev.key === "Enter" || ev.key === " ") {
|
|
303
|
-
ev.preventDefault();
|
|
304
|
-
toggleCollapse(gid);
|
|
305
|
-
}
|
|
306
|
-
} : void 0
|
|
307
|
-
},
|
|
308
|
-
import_react.default.createElement("span", { className: "mdsl-group-chevron" }, chevron()),
|
|
309
|
-
import_react.default.createElement("span", null, name2),
|
|
310
|
-
import_react.default.createElement("span", { className: "mdsl-group-count" }, count)
|
|
372
|
+
{ className: "mdsl-group-title" },
|
|
373
|
+
icon ? h("span", { className: "mdsl-group-icon" }, icon) : null,
|
|
374
|
+
h("span", { className: "mdsl-group-name" }, label)
|
|
311
375
|
);
|
|
312
|
-
const renderRow = (
|
|
313
|
-
const
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
chips.push(import_react.default.createElement("button", { key: "default", className: "mdsl-chip" + (effEff === void 0 ? " mdsl-chip-on" : ""), onClick: (ev) => {
|
|
319
|
-
ev.stopPropagation();
|
|
320
|
-
selectSelection({ provider: c.g.id, model: c.m.id });
|
|
321
|
-
} }, "\u9ED8\u8BA4"));
|
|
322
|
-
for (const e of c.m.reasoning.efforts) {
|
|
323
|
-
chips.push(import_react.default.createElement("button", { key: e.id, className: "mdsl-chip" + (effEff === e.id ? " mdsl-chip-on" : ""), title: e.description || e.name, onClick: (ev) => {
|
|
324
|
-
ev.stopPropagation();
|
|
325
|
-
selectSelection({ provider: c.g.id, model: c.m.id, reasoningEffort: e.id });
|
|
326
|
-
} }, e.name));
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return import_react.default.createElement(
|
|
376
|
+
const renderRow = (g, m, showProvider) => {
|
|
377
|
+
const selected = isCurrentModel(g, m);
|
|
378
|
+
const fav = favorites.has(`${g.id}/${m.id}`);
|
|
379
|
+
const hasEfforts = !!(m.reasoning && m.reasoning.efforts && m.reasoning.efforts.length);
|
|
380
|
+
const desc = typeof m.description === "string" && m.description !== "" ? m.description : void 0;
|
|
381
|
+
const row = h(
|
|
330
382
|
"div",
|
|
331
383
|
{
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
384
|
+
className: "mdsl-row",
|
|
385
|
+
role: "button",
|
|
386
|
+
tabIndex: 0,
|
|
387
|
+
"aria-pressed": selected,
|
|
388
|
+
title: desc,
|
|
389
|
+
onClick: () => choose(g, m),
|
|
390
|
+
onKeyDown: (ev) => {
|
|
391
|
+
if (ev.key === "Enter" || ev.key === " ") {
|
|
392
|
+
ev.preventDefault();
|
|
393
|
+
choose(g, m);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
335
396
|
},
|
|
336
|
-
|
|
337
|
-
|
|
397
|
+
h("span", { className: "mdsl-name" }, m.name),
|
|
398
|
+
showProvider ? h("span", { className: "mdsl-prov" }, g.name) : null,
|
|
399
|
+
h(
|
|
400
|
+
"button",
|
|
401
|
+
{
|
|
402
|
+
type: "button",
|
|
403
|
+
className: "mdsl-star" + (fav ? " mdsl-star-on" : ""),
|
|
404
|
+
"aria-label": fav ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF",
|
|
405
|
+
"aria-pressed": fav,
|
|
406
|
+
onClick: (ev) => {
|
|
407
|
+
ev.stopPropagation();
|
|
408
|
+
toggleFav(g.id, m.id);
|
|
409
|
+
},
|
|
410
|
+
// A real button fires click on Enter/Space; keep the row's own
|
|
411
|
+
// keyboard handler out of the way so toggling does not select.
|
|
412
|
+
onKeyDown: (ev) => {
|
|
413
|
+
if (ev.key === "Enter" || ev.key === " ") ev.stopPropagation();
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
star(fav)
|
|
417
|
+
),
|
|
418
|
+
selected ? h("span", { className: "mdsl-check" }, check()) : null
|
|
419
|
+
);
|
|
420
|
+
const sub = selected && (desc !== void 0 || hasEfforts) ? h(
|
|
421
|
+
"div",
|
|
422
|
+
{ className: "mdsl-sub" },
|
|
423
|
+
desc ? h("div", { className: "mdsl-desc" }, desc) : null,
|
|
424
|
+
hasEfforts ? h(
|
|
338
425
|
"div",
|
|
339
|
-
{ className: "mdsl-
|
|
340
|
-
|
|
341
|
-
"
|
|
342
|
-
{ className: "mdsl-
|
|
343
|
-
|
|
344
|
-
c.selected ? import_react.default.createElement("span", { className: "mdsl-check" }, "\u2713") : null
|
|
426
|
+
{ className: "mdsl-track", role: "group", "aria-label": "\u63A8\u7406\u7B49\u7EA7" },
|
|
427
|
+
h(
|
|
428
|
+
"button",
|
|
429
|
+
{ type: "button", "aria-pressed": pinnedEffort === void 0, className: "mdsl-seg" + (pinnedEffort === void 0 ? " mdsl-seg-on" : ""), onClick: () => chooseEffort(g, m, void 0) },
|
|
430
|
+
"\u9ED8\u8BA4"
|
|
345
431
|
),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
432
|
+
m.reasoning.efforts.map((e) => h(
|
|
433
|
+
"button",
|
|
434
|
+
{
|
|
435
|
+
key: e.id,
|
|
436
|
+
type: "button",
|
|
437
|
+
title: e.description || e.name,
|
|
438
|
+
"aria-pressed": pinnedEffort === e.id,
|
|
439
|
+
className: "mdsl-seg" + (pinnedEffort === e.id ? " mdsl-seg-on" : ""),
|
|
440
|
+
onClick: () => chooseEffort(g, m, e.id)
|
|
441
|
+
},
|
|
442
|
+
e.name
|
|
443
|
+
))
|
|
444
|
+
) : null
|
|
445
|
+
) : null;
|
|
446
|
+
return h(
|
|
356
447
|
"div",
|
|
357
|
-
{
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
"data-group-id": g.id
|
|
361
|
-
},
|
|
362
|
-
groupTitle(g.id, g.name, items.length, isCollapsed, q === ""),
|
|
363
|
-
isCollapsed ? null : items.map(renderRow)
|
|
448
|
+
{ key: `${g.id}/${m.id}`, className: "mdsl-item" + (selected ? " mdsl-item-current" : "") },
|
|
449
|
+
row,
|
|
450
|
+
sub
|
|
364
451
|
);
|
|
365
452
|
};
|
|
366
|
-
|
|
453
|
+
const onMenuKeyDown = (ev) => {
|
|
454
|
+
if (ev.key === "Escape") {
|
|
455
|
+
ev.preventDefault();
|
|
456
|
+
ev.stopPropagation();
|
|
457
|
+
closeMenu();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (ev.key !== "ArrowDown" && ev.key !== "ArrowUp") return;
|
|
461
|
+
const body = bodyRef.current;
|
|
462
|
+
if (!body) return;
|
|
463
|
+
const rows = Array.from(body.querySelectorAll(".mdsl-row"));
|
|
464
|
+
if (rows.length === 0) return;
|
|
465
|
+
ev.preventDefault();
|
|
466
|
+
const at = rows.indexOf(document.activeElement);
|
|
467
|
+
const step = ev.key === "ArrowDown" ? 1 : -1;
|
|
468
|
+
const next = at === -1 ? step > 0 ? 0 : rows.length - 1 : (at + step + rows.length) % rows.length;
|
|
469
|
+
rows[next].focus();
|
|
470
|
+
};
|
|
471
|
+
const triggerTitle = current ? (providerName ? providerName + " / " + modelName : modelName) + (effortLabel ? " / " + effortLabel : "") : "\u9009\u62E9\u6A21\u578B";
|
|
472
|
+
return h(
|
|
367
473
|
"div",
|
|
368
474
|
{ className: "mdsl-root" },
|
|
369
|
-
|
|
475
|
+
h(
|
|
370
476
|
"button",
|
|
371
477
|
{
|
|
478
|
+
ref: triggerRef,
|
|
479
|
+
type: "button",
|
|
372
480
|
className: "mdsl-trigger",
|
|
373
481
|
onClick: () => {
|
|
374
482
|
if (open) closeMenu();
|
|
375
483
|
else openMenu();
|
|
376
484
|
},
|
|
377
485
|
disabled: locked,
|
|
378
|
-
title:
|
|
486
|
+
title: triggerTitle,
|
|
487
|
+
"aria-haspopup": "dialog",
|
|
488
|
+
"aria-expanded": open
|
|
379
489
|
},
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
490
|
+
h("span", { className: "mdsl-label" }, current ? modelName : "\u9009\u62E9\u6A21\u578B"),
|
|
491
|
+
effortLabel ? h("span", { className: "mdsl-effort" }, effortLabel) : null,
|
|
492
|
+
h("span", { className: "mdsl-chevron" + (open ? " mdsl-chevron-open" : "") }, chevronDown())
|
|
383
493
|
),
|
|
384
|
-
open ?
|
|
385
|
-
open ?
|
|
494
|
+
open ? h("div", { className: "mdsl-backdrop", onClick: closeMenu }) : null,
|
|
495
|
+
open && placement !== null ? h(
|
|
386
496
|
"div",
|
|
387
|
-
{
|
|
388
|
-
|
|
497
|
+
{
|
|
498
|
+
className: "mdsl-menu",
|
|
499
|
+
style: {
|
|
500
|
+
left: placement.left + "px",
|
|
501
|
+
width: placement.width + "px",
|
|
502
|
+
maxWidth: placement.width + "px",
|
|
503
|
+
maxHeight: placement.maxHeight + "px",
|
|
504
|
+
...placement.side === "top" ? { top: "auto", bottom: placement.bottom + "px" } : { top: placement.top + "px", bottom: "auto" },
|
|
505
|
+
transformOrigin: placement.side === "top" ? "bottom right" : "top right"
|
|
506
|
+
},
|
|
507
|
+
role: "dialog",
|
|
508
|
+
"aria-label": "\u9009\u62E9\u6A21\u578B",
|
|
509
|
+
onKeyDown: onMenuKeyDown
|
|
510
|
+
},
|
|
511
|
+
h(
|
|
389
512
|
"div",
|
|
390
|
-
{ className: "mdsl-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
{
|
|
412
|
-
key: tag.id,
|
|
413
|
-
type: "button",
|
|
414
|
-
className: "mdsl-tag" + (tag.isCurrent ? " mdsl-tag-current" : ""),
|
|
415
|
-
title: "\u8DF3\u8F6C\u81F3 " + tag.name,
|
|
416
|
-
onClick: () => scrollToGroup(tag.id)
|
|
417
|
-
},
|
|
418
|
-
tag.isCurrent ? import_react.default.createElement("span", { className: "mdsl-tag-dot" }) : null,
|
|
419
|
-
import_react.default.createElement("span", null, tag.name),
|
|
420
|
-
import_react.default.createElement("span", { className: "mdsl-tag-count" }, "(" + tag.count + ")")
|
|
421
|
-
))
|
|
422
|
-
) : null
|
|
513
|
+
{ className: "mdsl-search-wrap" },
|
|
514
|
+
searchIcon(),
|
|
515
|
+
h("input", {
|
|
516
|
+
ref: searchRef,
|
|
517
|
+
className: "mdsl-search",
|
|
518
|
+
type: "text",
|
|
519
|
+
"aria-label": "\u641C\u7D22\u6A21\u578B",
|
|
520
|
+
placeholder: "\u641C\u7D22\u6A21\u578B",
|
|
521
|
+
value: query,
|
|
522
|
+
onChange: (ev) => setQuery(ev.target.value)
|
|
523
|
+
}),
|
|
524
|
+
query !== "" ? h("button", {
|
|
525
|
+
type: "button",
|
|
526
|
+
className: "mdsl-search-clear",
|
|
527
|
+
"aria-label": "\u6E05\u9664\u641C\u7D22",
|
|
528
|
+
onClick: () => {
|
|
529
|
+
setQuery("");
|
|
530
|
+
const el = searchRef.current;
|
|
531
|
+
if (el) el.focus({ preventScroll: true });
|
|
532
|
+
}
|
|
533
|
+
}, closeIcon()) : null
|
|
423
534
|
),
|
|
424
|
-
data.status === "error" ?
|
|
425
|
-
data.failures && data.failures.length ?
|
|
426
|
-
|
|
535
|
+
data.status === "error" ? h("div", { className: "mdsl-error" }, data.error || "\u52A0\u8F7D\u5931\u8D25") : null,
|
|
536
|
+
data.failures && data.failures.length ? h("div", { className: "mdsl-error" }, data.failures.map((f) => f.name + ": " + f.message).join("\uFF1B")) : null,
|
|
537
|
+
h(
|
|
427
538
|
"div",
|
|
428
|
-
{ className: "mdsl-body", ref: bodyRef },
|
|
429
|
-
data.status === "loading" ?
|
|
430
|
-
data.status === "ready" &&
|
|
431
|
-
|
|
539
|
+
{ className: "mdsl-body", ref: bodyRef, role: "group", "aria-label": "\u6A21\u578B\u5217\u8868" },
|
|
540
|
+
data.status === "loading" ? h("div", { className: "mdsl-empty" }, "\u52A0\u8F7D\u4E2D\u2026") : null,
|
|
541
|
+
data.status === "ready" && total === 0 ? h("div", { className: "mdsl-empty" }, "\u6682\u65E0\u53EF\u7528\u6A21\u578B") : null,
|
|
542
|
+
noMatch ? h("div", { className: "mdsl-empty" }, "\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B") : null,
|
|
543
|
+
favEntries.length > 0 ? h(
|
|
432
544
|
"div",
|
|
433
|
-
{
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
"data-group-id": FAVS_KEY
|
|
437
|
-
},
|
|
438
|
-
groupTitle(FAVS_KEY, "\u6536\u85CF", favs.length, favsCollapsed, q === ""),
|
|
439
|
-
favsCollapsed ? null : favs.map(renderRow)
|
|
545
|
+
{ className: "mdsl-group", key: FAVS_KEY },
|
|
546
|
+
heading("\u6536\u85CF", star(true)),
|
|
547
|
+
favEntries.map(({ g, m }) => renderRow(g, m, true))
|
|
440
548
|
) : null,
|
|
441
|
-
(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
import_react.default.createElement("span", null, "\u70B9\u51FB\u6A21\u578B\u6216\u63A8\u7406\u7B49\u7EA7\u5373\u53EF\u5207\u6362 \xB7 \u661F\u6807\u6536\u85CF\u4F1A\u7F6E\u9876")
|
|
549
|
+
filteredGroups.map((g) => h(
|
|
550
|
+
"div",
|
|
551
|
+
{ className: "mdsl-group", key: g.id },
|
|
552
|
+
heading(g.name),
|
|
553
|
+
g.models.map((m) => renderRow(g, m, false))
|
|
554
|
+
))
|
|
448
555
|
)
|
|
449
556
|
) : null
|
|
450
557
|
);
|