@yuhuanowo/yunui 0.2.13 → 0.2.14
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/dist/ai.d.ts +37 -1
- package/dist/ai.js +134 -33
- package/dist/ai.js.map +1 -1
- package/dist/{chunk-TFZKMJGF.js → chunk-GHO4RCDR.js} +5 -5
- package/dist/{chunk-TFZKMJGF.js.map → chunk-GHO4RCDR.js.map} +1 -1
- package/dist/{chunk-MTEICYIC.js → chunk-VXFEANVX.js} +103 -75
- package/dist/chunk-VXFEANVX.js.map +1 -0
- package/dist/index.d.ts +21 -5
- package/dist/index.js +2 -2
- package/dist/patterns.d.ts +216 -2
- package/dist/patterns.js +430 -28
- package/dist/patterns.js.map +1 -1
- package/package.json +1 -1
- package/styles/yunui.css +122 -19
- package/dist/chunk-MTEICYIC.js.map +0 -1
package/dist/ai.d.ts
CHANGED
|
@@ -115,6 +115,42 @@ interface ModelSelectProps {
|
|
|
115
115
|
* filters + a pinned section + a styled dropdown. Domain-agnostic. */
|
|
116
116
|
declare function ModelSelect({ options, value, onChange, className, labels, pinned, onTogglePin, filters, renderFooter, }: ModelSelectProps): React.JSX.Element;
|
|
117
117
|
|
|
118
|
+
/** One labelled spec shown in the card's spec grid. */
|
|
119
|
+
interface ModelManagerField {
|
|
120
|
+
label: ReactNode;
|
|
121
|
+
value: ReactNode;
|
|
122
|
+
/** Span both grid columns (e.g. a long price line). */
|
|
123
|
+
full?: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface ModelManagerCardProps {
|
|
126
|
+
/** Leading model icon. */
|
|
127
|
+
icon?: ReactNode;
|
|
128
|
+
/** Model display name (the card title). */
|
|
129
|
+
name: ReactNode;
|
|
130
|
+
/** Inline status badges next to the name (YAML, deprecated, inactive, suspended…). */
|
|
131
|
+
nameBadges?: ReactNode;
|
|
132
|
+
/** Id / alias chips rendered under the name. */
|
|
133
|
+
ids?: ReactNode;
|
|
134
|
+
/** Row-select control (a checkbox). Sits at the left of the top control bar. */
|
|
135
|
+
selectSlot?: ReactNode;
|
|
136
|
+
/** Row actions (edit / enable / inspect / delete …) — sit at the right of the
|
|
137
|
+
* top control bar (no footer rule). */
|
|
138
|
+
actions?: ReactNode;
|
|
139
|
+
/** Labelled specs — provider, developer, type, status, context/resolution,
|
|
140
|
+
* max output, price, … — laid out in a 2-column grid. */
|
|
141
|
+
fields?: ModelManagerField[];
|
|
142
|
+
/** Capability badges + an optional label. */
|
|
143
|
+
capabilities?: {
|
|
144
|
+
label?: ReactNode;
|
|
145
|
+
value: ReactNode;
|
|
146
|
+
};
|
|
147
|
+
/** Mark the row selected (a ring + tint). */
|
|
148
|
+
selected?: boolean;
|
|
149
|
+
className?: string;
|
|
150
|
+
}
|
|
151
|
+
/** A model-management row as a card (all admin columns, top-to-bottom). */
|
|
152
|
+
declare function ModelManagerCard({ icon, name, nameBadges, ids, selectSlot, actions, fields, capabilities, selected, className, }: ModelManagerCardProps): React.JSX.Element;
|
|
153
|
+
|
|
118
154
|
/** Click-to-copy mono ID badge (faithful port of Yunxin's IDBadge). */
|
|
119
155
|
declare function IDBadge({ text, truncate }: {
|
|
120
156
|
text: string;
|
|
@@ -302,4 +338,4 @@ interface NavbarProps {
|
|
|
302
338
|
/** Floating top navigation bar: logo, center links with scroll-spy, theme/language slots, and auth buttons with a mobile menu. */
|
|
303
339
|
declare function Navbar({ appName, logoSrc, links, currentPath, variant, labels, languageSwitcher, themeToggle, homeHref, loginHref, signupHref, }: NavbarProps): React.JSX.Element;
|
|
304
340
|
|
|
305
|
-
export { type ButtonProps, CapabilityIcon, CapabilitySelector, IDBadge, type LanguageOption, LanguageSwitcher, ModelAvatar, ModelCard, type ModelCardProps, ModelIcon, ModelSelect, type ModelSelectFilter, type ModelSelectLabels, type ModelSelectOption, type ModelSelectProps, ModelTypeIcon, type NavLink, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
341
|
+
export { type ButtonProps, CapabilityIcon, CapabilitySelector, IDBadge, type LanguageOption, LanguageSwitcher, ModelAvatar, ModelCard, type ModelCardProps, ModelIcon, ModelManagerCard, type ModelManagerCardProps, type ModelManagerField, ModelSelect, type ModelSelectFilter, type ModelSelectLabels, type ModelSelectOption, type ModelSelectProps, ModelTypeIcon, type NavLink, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
package/dist/ai.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { copyToClipboard } from './chunk-N53PNMPJ.js';
|
|
3
3
|
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-N53PNMPJ.js';
|
|
4
|
-
import { cn, ThemeToggle } from './chunk-
|
|
4
|
+
import { cn, ThemeToggle } from './chunk-GHO4RCDR.js';
|
|
5
5
|
import { useYunUI } from './chunk-U2LNRVMI.js';
|
|
6
6
|
import { memo, useState, useRef, useMemo, useEffect } from 'react';
|
|
7
7
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
@@ -17,7 +17,8 @@ function ThinkingBlock({ content, isStreaming, defaultOpen = false, renderConten
|
|
|
17
17
|
"button",
|
|
18
18
|
{
|
|
19
19
|
onClick: () => setIsOpen(!isOpen),
|
|
20
|
-
|
|
20
|
+
"aria-expanded": isOpen,
|
|
21
|
+
className: "w-full flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
21
22
|
children: [
|
|
22
23
|
/* @__PURE__ */ jsx("div", { className: cn(
|
|
23
24
|
"flex items-center justify-center w-5 h-5 rounded-md bg-muted text-muted-foreground",
|
|
@@ -62,12 +63,13 @@ function IDBadge({ text, truncate = true }) {
|
|
|
62
63
|
setTimeout(() => setCopied(false), 1500);
|
|
63
64
|
};
|
|
64
65
|
return /* @__PURE__ */ jsxs(
|
|
65
|
-
"
|
|
66
|
+
"button",
|
|
66
67
|
{
|
|
67
|
-
|
|
68
|
+
type: "button",
|
|
68
69
|
onClick: handleCopy,
|
|
69
|
-
className: `group/badge relative inline-flex items-center rounded-md bg-muted border border-border hover:bg-muted/70 cursor-pointer transition-colors duration-200 overflow-hidden ${truncate ? "max-w-full min-w-0" : ""}`,
|
|
70
|
+
className: `group/badge relative inline-flex items-center rounded-md bg-muted border border-border hover:bg-muted/70 cursor-pointer transition-colors duration-200 overflow-hidden outline-none focus-visible:ring-2 focus-visible:ring-ring ${truncate ? "max-w-full min-w-0" : ""}`,
|
|
70
71
|
title: t("clickToCopy", { text }),
|
|
72
|
+
"aria-label": t("clickToCopy", { text }),
|
|
71
73
|
children: [
|
|
72
74
|
/* @__PURE__ */ jsx("span", { className: `px-2 py-0.5 text-xs font-mono block ${truncate ? "truncate max-w-full min-w-0" : "whitespace-nowrap"}`, children: text }),
|
|
73
75
|
/* @__PURE__ */ jsx("span", { className: "opacity-0 group-hover/badge:opacity-100 absolute right-0 inset-y-0 w-5 flex items-center justify-center rounded-r-md bg-muted/90 backdrop-blur-sm transition-opacity duration-200", children: copied ? /* @__PURE__ */ jsx(Check, { size: 10 }) : /* @__PURE__ */ jsx(Copy, { size: 10 }) })
|
|
@@ -118,7 +120,7 @@ function ModelCard({
|
|
|
118
120
|
onClick();
|
|
119
121
|
}
|
|
120
122
|
},
|
|
121
|
-
className: `card card-interactive p-4 text-left w-full group cursor-pointer flex flex-col ${className}`,
|
|
123
|
+
className: `card card-interactive p-4 text-left w-full group cursor-pointer flex flex-col outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background ${className}`,
|
|
122
124
|
children: [
|
|
123
125
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-3", children: [
|
|
124
126
|
icon,
|
|
@@ -130,7 +132,7 @@ function ModelCard({
|
|
|
130
132
|
/* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxs("div", { className: "font-medium text-sm group-hover:text-foreground flex items-center gap-1.5", children: [
|
|
131
133
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: name }),
|
|
132
134
|
nonofficial && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] px-1.5 py-0.5 rounded badge-warning font-medium whitespace-nowrap", children: labels?.nonofficial ?? "Unofficial" }),
|
|
133
|
-
suspended && /* @__PURE__ */ jsxs("span", { className: "shrink-0 inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded font-medium whitespace-nowrap
|
|
135
|
+
suspended && /* @__PURE__ */ jsxs("span", { className: "shrink-0 inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded badge-warning font-medium whitespace-nowrap", children: [
|
|
134
136
|
/* @__PURE__ */ jsx(PauseCircle, { size: 10 }),
|
|
135
137
|
labels?.suspended ?? "Suspended"
|
|
136
138
|
] })
|
|
@@ -139,7 +141,7 @@ function ModelCard({
|
|
|
139
141
|
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground line-clamp-2 mb-3 min-h-[2.5em]", children: description || /* @__PURE__ */ jsx("span", { className: "opacity-40", children: labels?.noDescription ?? "No description" }) }),
|
|
140
142
|
/* @__PURE__ */ jsxs("div", { className: "mt-auto flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 text-[11px] text-muted-foreground pt-3 border-t border-border", children: [
|
|
141
143
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
142
|
-
developer?.iconUrl && /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-
|
|
144
|
+
developer?.iconUrl && /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-muted", style: { width: 12, height: 12 }, children: /* @__PURE__ */ jsx(Image, { src: developer.iconUrl, alt: developer.label, width: 12, height: 12, className: "object-cover" }) }),
|
|
143
145
|
developer?.label && /* @__PURE__ */ jsx("span", { children: developer.label })
|
|
144
146
|
] }),
|
|
145
147
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -253,6 +255,39 @@ function ModelSelect({
|
|
|
253
255
|
onChange(id);
|
|
254
256
|
setIsOpen(false);
|
|
255
257
|
};
|
|
258
|
+
const flatOptions = useMemo(() => {
|
|
259
|
+
const out = [...pinnedList];
|
|
260
|
+
for (const opts of Object.values(grouped)) out.push(...opts);
|
|
261
|
+
return out;
|
|
262
|
+
}, [pinnedList, grouped]);
|
|
263
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
setActiveIndex(-1);
|
|
266
|
+
}, [isOpen, search, activeGroup, activeFilters]);
|
|
267
|
+
const clearActiveOnPointer = () => setActiveIndex((i) => i === -1 ? i : -1);
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
const id = flatOptions[activeIndex]?.id;
|
|
270
|
+
if (!isOpen || !id || !listRef.current) return;
|
|
271
|
+
listRef.current.querySelector(`[data-model-id="${CSS.escape(id)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
272
|
+
}, [activeIndex, isOpen, flatOptions]);
|
|
273
|
+
const activeId = flatOptions[activeIndex]?.id;
|
|
274
|
+
const rowDomId = (id) => `yunui-ms-opt-${id.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
275
|
+
const onSearchKeyDown = (e) => {
|
|
276
|
+
if (e.key === "ArrowDown") {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
setActiveIndex((i) => Math.min(i + 1, flatOptions.length - 1));
|
|
279
|
+
} else if (e.key === "ArrowUp") {
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
setActiveIndex((i) => i < 0 ? flatOptions.length - 1 : Math.max(i - 1, 0));
|
|
282
|
+
} else if (e.key === "Enter") {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
const o = flatOptions[activeIndex] ?? flatOptions[0];
|
|
285
|
+
if (o) select(o.id);
|
|
286
|
+
} else if (e.key === "Escape") {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
setIsOpen(false);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
256
291
|
return (
|
|
257
292
|
// Fixed-width root so the trigger doesn't grow/shrink as the selected
|
|
258
293
|
// label changes; override the width via `className`.
|
|
@@ -262,8 +297,10 @@ function ModelSelect({
|
|
|
262
297
|
{
|
|
263
298
|
type: "button",
|
|
264
299
|
onClick: () => setIsOpen((o) => !o),
|
|
300
|
+
"aria-expanded": isOpen,
|
|
301
|
+
"aria-haspopup": "listbox",
|
|
265
302
|
className: cn(
|
|
266
|
-
"flex items-center gap-2 px-3 py-2 bg-card border rounded-xl text-left group transition-all w-full shadow-sm hover:shadow-md",
|
|
303
|
+
"flex items-center gap-2 px-3 py-2 bg-card border rounded-xl text-left group transition-all w-full shadow-sm hover:shadow-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
267
304
|
isOpen ? "border-ring/60 ring-2 ring-ring/25" : "border-border hover:border-ring"
|
|
268
305
|
),
|
|
269
306
|
children: [
|
|
@@ -293,48 +330,53 @@ function ModelSelect({
|
|
|
293
330
|
ref: inputRef,
|
|
294
331
|
value: search,
|
|
295
332
|
onChange: (e) => setSearch(e.target.value),
|
|
333
|
+
onKeyDown: onSearchKeyDown,
|
|
296
334
|
placeholder: L.search,
|
|
335
|
+
role: "combobox",
|
|
336
|
+
"aria-expanded": isOpen,
|
|
337
|
+
"aria-controls": "yunui-ms-listbox",
|
|
338
|
+
"aria-activedescendant": activeId ? rowDomId(activeId) : void 0,
|
|
297
339
|
className: "w-full pl-9 pr-8 py-2 text-sm bg-muted/50 border border-transparent rounded-xl outline-none focus:border-ring focus:bg-background transition-colors"
|
|
298
340
|
}
|
|
299
341
|
),
|
|
300
|
-
search && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSearch(""), title: L.clearSearch, className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded-md hover:bg-muted", children: /* @__PURE__ */ jsx(X, { size: 13 }) })
|
|
342
|
+
search && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSearch(""), title: L.clearSearch, "aria-label": L.clearSearch, className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded-md hover:bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 13 }) })
|
|
301
343
|
] }),
|
|
302
344
|
filters && filters.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-2 px-1", children: [
|
|
303
345
|
filters.map((f) => {
|
|
304
346
|
const on = activeFilters.includes(f.key);
|
|
305
|
-
return /* @__PURE__ */ jsx("button", { type: "button", title: f.title, onClick: () => setActiveFilters((p) => p.includes(f.key) ? p.filter((k) => k !== f.key) : [...p, f.key]), className: cn("p-1 rounded-md transition-colors", on ? "bg-foreground/10" : "hover:bg-muted"), children: f.node }, f.key);
|
|
347
|
+
return /* @__PURE__ */ jsx("button", { type: "button", title: f.title, "aria-label": f.title, "aria-pressed": on, onClick: () => setActiveFilters((p) => p.includes(f.key) ? p.filter((k) => k !== f.key) : [...p, f.key]), className: cn("p-1 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", on ? "bg-foreground/10" : "hover:bg-muted"), children: f.node }, f.key);
|
|
306
348
|
}),
|
|
307
|
-
activeFilters.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveFilters([]), title: L.clearFilters, className: "p-1 rounded-md text-muted-foreground hover:bg-muted", children: /* @__PURE__ */ jsx(X, { size: 14 }) })
|
|
349
|
+
activeFilters.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveFilters([]), title: L.clearFilters, "aria-label": L.clearFilters, className: "p-1 rounded-md text-muted-foreground hover:bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 14 }) })
|
|
308
350
|
] })
|
|
309
351
|
] }),
|
|
310
352
|
groups.length > 1 && /* @__PURE__ */ jsx("div", { className: "px-2.5 py-2 border-b border-border/50 overflow-x-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 min-w-max", children: [
|
|
311
|
-
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup(null), className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors whitespace-nowrap", !activeGroup ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
353
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup(null), "aria-pressed": !activeGroup, className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring", !activeGroup ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
312
354
|
L.all,
|
|
313
355
|
" (",
|
|
314
356
|
options.length,
|
|
315
357
|
")"
|
|
316
358
|
] }),
|
|
317
|
-
groups.map((g) => /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup((c) => c === g ? null : g), className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap", activeGroup === g ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
359
|
+
groups.map((g) => /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup((c) => c === g ? null : g), "aria-pressed": activeGroup === g, className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring", activeGroup === g ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
318
360
|
groupIcon[g],
|
|
319
361
|
groupLabel[g] ?? g
|
|
320
362
|
] }, g))
|
|
321
363
|
] }) }),
|
|
322
|
-
/* @__PURE__ */ jsxs("div", { ref: listRef, onWheel, className: "max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
364
|
+
/* @__PURE__ */ jsxs("div", { ref: listRef, onWheel, onMouseMove: clearActiveOnPointer, id: "yunui-ms-listbox", role: "listbox", className: "max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
323
365
|
pinnedList.length > 0 && /* @__PURE__ */ jsxs("div", { className: "px-1.5 py-1.5 border-b border-border/40", children: [
|
|
324
366
|
/* @__PURE__ */ jsxs("div", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide px-2 mb-1 flex items-center gap-1", children: [
|
|
325
367
|
/* @__PURE__ */ jsx(Pin, { size: 9 }),
|
|
326
368
|
" ",
|
|
327
369
|
L.pinned
|
|
328
370
|
] }),
|
|
329
|
-
pinnedList.map((o) => /* @__PURE__ */ jsx(ModelRow, { option: o, selected: o.id === value, pinned: true, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
|
|
371
|
+
pinnedList.map((o) => /* @__PURE__ */ jsx(ModelRow, { domId: rowDomId(o.id), active: o.id === activeId, option: o, selected: o.id === value, pinned: true, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
|
|
330
372
|
] }),
|
|
331
373
|
/* @__PURE__ */ jsx("div", { className: "px-1.5 py-1.5", children: Object.entries(grouped).map(([g, opts]) => /* @__PURE__ */ jsxs("div", { className: "mb-3 last:mb-0", children: [
|
|
332
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 pt-1 pb-1.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-xl bg-muted px-3 py-2", children: [
|
|
333
375
|
groupIcon[g],
|
|
334
376
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: groupLabel[g] ?? g }),
|
|
335
|
-
/* @__PURE__ */ jsx("span", { className: "ml-auto text-[10px] text-muted-foreground bg-
|
|
336
|
-
] }),
|
|
337
|
-
opts.map((o) => /* @__PURE__ */ jsx(ModelRow, { option: o, selected: o.id === value, pinned: false, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
|
|
377
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 min-w-5 text-center text-[10px] font-semibold tabular-nums text-muted-foreground bg-foreground/10 px-1.5 py-0.5 rounded-md", children: opts.length })
|
|
378
|
+
] }) }),
|
|
379
|
+
opts.map((o) => /* @__PURE__ */ jsx(ModelRow, { domId: rowDomId(o.id), active: o.id === activeId, option: o, selected: o.id === value, pinned: false, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
|
|
338
380
|
] }, g)) }),
|
|
339
381
|
filtered.length === 0 && /* @__PURE__ */ jsxs("div", { className: "py-12 text-center text-muted-foreground", children: [
|
|
340
382
|
/* @__PURE__ */ jsx(Sparkles, { size: 28, className: "mx-auto mb-3 opacity-40" }),
|
|
@@ -351,6 +393,8 @@ function ModelSelect({
|
|
|
351
393
|
var ModelRow = memo(function ModelRow2({
|
|
352
394
|
option,
|
|
353
395
|
selected,
|
|
396
|
+
active,
|
|
397
|
+
domId,
|
|
354
398
|
pinned,
|
|
355
399
|
isPinnable,
|
|
356
400
|
onSelect,
|
|
@@ -359,13 +403,18 @@ var ModelRow = memo(function ModelRow2({
|
|
|
359
403
|
return /* @__PURE__ */ jsxs(
|
|
360
404
|
"div",
|
|
361
405
|
{
|
|
406
|
+
id: domId,
|
|
362
407
|
"data-model-id": option.id,
|
|
408
|
+
role: "option",
|
|
409
|
+
"aria-selected": selected,
|
|
363
410
|
onClick: onSelect,
|
|
364
411
|
className: cn(
|
|
365
412
|
"relative flex items-center gap-3 px-3 py-2.5 rounded-xl cursor-pointer group transition-colors",
|
|
366
413
|
// A clear gray fill on both states (selected solid, hover lighter)
|
|
367
414
|
// — the bar's opacity then tells selected from merely-hovered.
|
|
368
|
-
selected ? "bg-muted" : "hover:bg-muted"
|
|
415
|
+
selected ? "bg-muted" : "hover:bg-muted",
|
|
416
|
+
// keyboard highlight (arrow-key navigation)
|
|
417
|
+
active && "bg-muted ring-2 ring-ring/40"
|
|
369
418
|
),
|
|
370
419
|
children: [
|
|
371
420
|
/* @__PURE__ */ jsx(
|
|
@@ -406,6 +455,53 @@ var ModelRow = memo(function ModelRow2({
|
|
|
406
455
|
}
|
|
407
456
|
);
|
|
408
457
|
});
|
|
458
|
+
function ModelManagerCard({
|
|
459
|
+
icon,
|
|
460
|
+
name,
|
|
461
|
+
nameBadges,
|
|
462
|
+
ids,
|
|
463
|
+
selectSlot,
|
|
464
|
+
actions,
|
|
465
|
+
fields,
|
|
466
|
+
capabilities,
|
|
467
|
+
selected,
|
|
468
|
+
className
|
|
469
|
+
}) {
|
|
470
|
+
return /* @__PURE__ */ jsxs(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
className: cn(
|
|
474
|
+
"card p-5 transition-shadow hover:shadow-md",
|
|
475
|
+
selected && "ring-2 ring-primary/40 bg-muted/30",
|
|
476
|
+
className
|
|
477
|
+
),
|
|
478
|
+
children: [
|
|
479
|
+
(selectSlot || actions) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 -mt-2 mb-3 min-h-7", children: [
|
|
480
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: selectSlot }),
|
|
481
|
+
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 -mr-1.5 text-muted-foreground", children: actions })
|
|
482
|
+
] }),
|
|
483
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
484
|
+
icon && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: icon }),
|
|
485
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
486
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 gap-y-1 flex-wrap", children: [
|
|
487
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold leading-tight min-w-0 break-words", children: name }),
|
|
488
|
+
nameBadges
|
|
489
|
+
] }),
|
|
490
|
+
ids && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1 mt-1.5", children: ids })
|
|
491
|
+
] })
|
|
492
|
+
] }),
|
|
493
|
+
fields && fields.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-3 mt-4 text-sm", children: fields.map((f, i) => /* @__PURE__ */ jsxs("div", { className: cn("min-w-0", f.full && "col-span-2"), children: [
|
|
494
|
+
/* @__PURE__ */ jsx("dt", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: f.label }),
|
|
495
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1", children: f.value })
|
|
496
|
+
] }, i)) }),
|
|
497
|
+
capabilities && /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
|
|
498
|
+
capabilities.label && /* @__PURE__ */ jsx("div", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5", children: capabilities.label }),
|
|
499
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: capabilities.value })
|
|
500
|
+
] })
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
409
505
|
var llmCapabilityConfig = [
|
|
410
506
|
{ value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
|
|
411
507
|
{ value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" },
|
|
@@ -498,7 +594,8 @@ function CapabilitySelector({ selected, onChange, disabled = false, size = "md",
|
|
|
498
594
|
type: "button",
|
|
499
595
|
onClick: () => toggleCapability(cap.value),
|
|
500
596
|
disabled,
|
|
501
|
-
|
|
597
|
+
"aria-pressed": isSelected,
|
|
598
|
+
className: `rounded-lg border text-left transition-colors flex items-center outline-none focus-visible:ring-2 focus-visible:ring-ring ${sizeClasses} ${isSelected ? cap.color : "bg-background border-border hover:bg-muted/50"} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
502
599
|
children: [
|
|
503
600
|
/* @__PURE__ */ jsx(Icon, { size: iconSize, className: `${isSelected ? "" : cap.iconColor} shrink-0` }),
|
|
504
601
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: cap.label })
|
|
@@ -1090,7 +1187,7 @@ function ProviderIcon({
|
|
|
1090
1187
|
return /* @__PURE__ */ jsx(
|
|
1091
1188
|
"div",
|
|
1092
1189
|
{
|
|
1093
|
-
className: `${getRadius()} overflow-hidden bg-
|
|
1190
|
+
className: `${getRadius()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
1094
1191
|
style: { width: size, height: size },
|
|
1095
1192
|
children: /* @__PURE__ */ jsx("img", { src: effectiveIconUrl, alt: provider, width: size, height: size, className: "object-cover", onError: () => setCustomError(true) })
|
|
1096
1193
|
}
|
|
@@ -1109,7 +1206,7 @@ function ProviderIcon({
|
|
|
1109
1206
|
return /* @__PURE__ */ jsx(
|
|
1110
1207
|
"div",
|
|
1111
1208
|
{
|
|
1112
|
-
className: `${getRadiusClass()} overflow-hidden bg-
|
|
1209
|
+
className: `${getRadiusClass()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
1113
1210
|
style: { width: size, height: size },
|
|
1114
1211
|
children: /* @__PURE__ */ jsx(
|
|
1115
1212
|
Image,
|
|
@@ -1143,7 +1240,7 @@ function ProviderIcon({
|
|
|
1143
1240
|
return /* @__PURE__ */ jsx(
|
|
1144
1241
|
"div",
|
|
1145
1242
|
{
|
|
1146
|
-
className: `${getRadiusClass()} bg-
|
|
1243
|
+
className: `${getRadiusClass()} bg-muted flex items-center justify-center ${className}`,
|
|
1147
1244
|
style: { width: size, height: size },
|
|
1148
1245
|
children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: (provider || "?").charAt(0).toUpperCase() })
|
|
1149
1246
|
}
|
|
@@ -1292,7 +1389,7 @@ function ModelIcon({
|
|
|
1292
1389
|
return /* @__PURE__ */ jsx(
|
|
1293
1390
|
"div",
|
|
1294
1391
|
{
|
|
1295
|
-
className: `${getRadiusClass()} overflow-hidden bg-
|
|
1392
|
+
className: `${getRadiusClass()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
1296
1393
|
style: { width: size, height: size },
|
|
1297
1394
|
children: /* @__PURE__ */ jsx(
|
|
1298
1395
|
Image,
|
|
@@ -1331,7 +1428,7 @@ function ModelIcon({
|
|
|
1331
1428
|
return /* @__PURE__ */ jsx(
|
|
1332
1429
|
"div",
|
|
1333
1430
|
{
|
|
1334
|
-
className: `${getRadiusClass()} overflow-hidden bg-
|
|
1431
|
+
className: `${getRadiusClass()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
1335
1432
|
style: { width: size, height: size },
|
|
1336
1433
|
children: /* @__PURE__ */ jsx(
|
|
1337
1434
|
Image,
|
|
@@ -1453,25 +1550,29 @@ function LanguageSwitcher({
|
|
|
1453
1550
|
"button",
|
|
1454
1551
|
{
|
|
1455
1552
|
onClick: () => setIsOpen(!isOpen),
|
|
1456
|
-
className: "flex items-center gap-1.5 h-9 px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) disabled:opacity-50",
|
|
1553
|
+
className: "flex items-center gap-1.5 h-9 px-2.5 sm:px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1457
1554
|
disabled: pending,
|
|
1458
1555
|
"aria-label": label,
|
|
1556
|
+
"aria-expanded": isOpen,
|
|
1557
|
+
"aria-haspopup": "listbox",
|
|
1459
1558
|
children: [
|
|
1460
|
-
/* @__PURE__ */ jsx(Globe, { size: 14 }),
|
|
1461
|
-
/* @__PURE__ */ jsx("span", { children: currentLabel })
|
|
1559
|
+
/* @__PURE__ */ jsx(Globe, { size: 14, className: "shrink-0" }),
|
|
1560
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: currentLabel })
|
|
1462
1561
|
]
|
|
1463
1562
|
}
|
|
1464
1563
|
) : /* @__PURE__ */ jsx(
|
|
1465
1564
|
"button",
|
|
1466
1565
|
{
|
|
1467
1566
|
onClick: () => setIsOpen(!isOpen),
|
|
1468
|
-
className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors disabled:opacity-50",
|
|
1567
|
+
className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1469
1568
|
disabled: pending,
|
|
1470
1569
|
"aria-label": label,
|
|
1570
|
+
"aria-expanded": isOpen,
|
|
1571
|
+
"aria-haspopup": "listbox",
|
|
1471
1572
|
children: /* @__PURE__ */ jsx(Globe, { className: "h-[1.2rem] w-[1.2rem]" })
|
|
1472
1573
|
}
|
|
1473
1574
|
),
|
|
1474
|
-
isOpen && /* @__PURE__ */ jsx("div", { className: `absolute ${align === "left" ? "left-0" : "right-0"} top-full mt-2 z-50 rounded-2xl border border-
|
|
1575
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: `absolute ${align === "left" ? "left-0" : "right-0"} top-full mt-2 z-50 rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`, children: /* @__PURE__ */ jsx("div", { className: "p-1", children: locales.map((lang) => /* @__PURE__ */ jsx(
|
|
1475
1576
|
"button",
|
|
1476
1577
|
{
|
|
1477
1578
|
onClick: () => handleLocaleChange(lang.value),
|
|
@@ -1629,6 +1730,6 @@ function Navbar({
|
|
|
1629
1730
|
] });
|
|
1630
1731
|
}
|
|
1631
1732
|
|
|
1632
|
-
export { CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
1733
|
+
export { CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelManagerCard, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
1633
1734
|
//# sourceMappingURL=ai.js.map
|
|
1634
1735
|
//# sourceMappingURL=ai.js.map
|