@yuhuanowo/yunui 0.2.17 → 0.2.18
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 +3 -1
- package/README.zh-CN.md +5 -1
- package/README.zh-TW.md +5 -1
- package/dist/ai.d.ts +99 -3
- package/dist/ai.js +212 -104
- package/dist/ai.js.map +1 -1
- package/dist/chat.d.ts +10 -3
- package/dist/chat.js +12 -7
- package/dist/chat.js.map +1 -1
- package/dist/{chunk-HH3JBHRP.js → chunk-AFVENY4D.js} +286 -31
- package/dist/chunk-AFVENY4D.js.map +1 -0
- package/dist/{chunk-F2HG4TOQ.js → chunk-GAXVET76.js} +13 -19
- package/dist/chunk-GAXVET76.js.map +1 -0
- package/dist/{chunk-DDUP7GAX.js → chunk-LEBQPP4B.js} +69 -3
- package/dist/chunk-LEBQPP4B.js.map +1 -0
- package/dist/chunk-ST6TSBVQ.js +208 -0
- package/dist/chunk-ST6TSBVQ.js.map +1 -0
- package/dist/chunk-V7VJKZ5Q.js +254 -0
- package/dist/chunk-V7VJKZ5Q.js.map +1 -0
- package/dist/{chunk-BCOKFWXC.js → chunk-YKWRCA2S.js} +80 -156
- package/dist/chunk-YKWRCA2S.js.map +1 -0
- package/dist/content.d.ts +10 -2
- package/dist/content.js +50 -40
- package/dist/content.js.map +1 -1
- package/dist/index.d.ts +266 -16
- package/dist/index.js +4 -4
- package/dist/patterns.d.ts +471 -22
- package/dist/patterns.js +783 -131
- package/dist/patterns.js.map +1 -1
- package/icons/providers/gmi.svg +5 -0
- package/package.json +3 -4
- package/styles/content.css +3 -1
- package/styles/yunui.css +197 -84
- package/dist/chunk-BCOKFWXC.js.map +0 -1
- package/dist/chunk-DDUP7GAX.js.map +0 -1
- package/dist/chunk-F2HG4TOQ.js.map +0 -1
- package/dist/chunk-HH3JBHRP.js.map +0 -1
- package/dist/chunk-N4QO7RN5.js +0 -98
- package/dist/chunk-N4QO7RN5.js.map +0 -1
- package/dist/chunk-QEIBYOG2.js +0 -188
- package/dist/chunk-QEIBYOG2.js.map +0 -1
package/dist/ai.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { copyToClipboard } from './chunk-
|
|
3
|
-
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-
|
|
4
|
-
import { TextShimmer, ThemeToggle } from './chunk-
|
|
5
|
-
import { cn, useAnchoredPosition } from './chunk-
|
|
2
|
+
import { capabilityIconColor, copyToClipboard } from './chunk-LEBQPP4B.js';
|
|
3
|
+
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-LEBQPP4B.js';
|
|
4
|
+
import { TextShimmer, ThemeToggle } from './chunk-GAXVET76.js';
|
|
5
|
+
import { cn, useAnchoredPosition, useDismissOnOutside } from './chunk-V7VJKZ5Q.js';
|
|
6
6
|
import { useYunUI } from './chunk-3RT24MSH.js';
|
|
7
7
|
import { memo, useState, useEffect, useRef, useMemo } from 'react';
|
|
8
8
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
9
|
-
import { Pin, MessageSquare, Waves, Code, Eye, Brain, Pencil, Ban, Fingerprint, Layers, SlidersHorizontal, Mic, Video, Music, Box, Radio, ChevronUp, ChevronDown, Check, Copy, Image, PauseCircle, Search, X, Sparkles, Bot, Globe, Menu, ShieldAlert, Wrench, FileText, Terminal, Loader2, Shield, Shuffle, Volume2, Headphones, Palette, Hash } from 'lucide-react';
|
|
9
|
+
import { Pin, MessageSquare, Waves, Code, Eye, Brain, Pencil, Ban, Fingerprint, Layers, SlidersHorizontal, Mic, Video, Music, Box, Radio, ChevronUp, ChevronDown, Check, Copy, Image, PauseCircle, Search, X, Sparkles, Bot, Globe, Menu, CircleUserRound, LogOut, ShieldAlert, Wrench, FileText, Terminal, Loader2, Shield, Shuffle, Volume2, Headphones, Palette, Hash } from 'lucide-react';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
|
|
@@ -340,17 +340,17 @@ function IDBadge({
|
|
|
340
340
|
);
|
|
341
341
|
}
|
|
342
342
|
var CAPABILITY_ICONS = {
|
|
343
|
-
streaming: {
|
|
344
|
-
vision: {
|
|
345
|
-
thinking: {
|
|
346
|
-
function_calling: {
|
|
347
|
-
image_edit: {
|
|
348
|
-
negative_prompt: {
|
|
349
|
-
seed_control: {
|
|
350
|
-
lora: {
|
|
351
|
-
guidance_scale: {
|
|
352
|
-
strength: {
|
|
353
|
-
batch: {
|
|
343
|
+
streaming: { color: capabilityIconColor("streaming"), icon: Waves },
|
|
344
|
+
vision: { color: capabilityIconColor("vision"), icon: Eye },
|
|
345
|
+
thinking: { color: capabilityIconColor("thinking"), icon: Brain },
|
|
346
|
+
function_calling: { color: capabilityIconColor("function_calling"), icon: Code },
|
|
347
|
+
image_edit: { color: capabilityIconColor("image_edit"), icon: Image },
|
|
348
|
+
negative_prompt: { color: capabilityIconColor("negative_prompt"), icon: Ban },
|
|
349
|
+
seed_control: { color: capabilityIconColor("seed_control"), icon: Fingerprint },
|
|
350
|
+
lora: { color: capabilityIconColor("lora"), icon: Layers },
|
|
351
|
+
guidance_scale: { color: capabilityIconColor("guidance_scale"), icon: SlidersHorizontal },
|
|
352
|
+
strength: { color: capabilityIconColor("strength"), icon: SlidersHorizontal },
|
|
353
|
+
batch: { color: capabilityIconColor("batch"), icon: Waves }
|
|
354
354
|
};
|
|
355
355
|
function ModelCard({
|
|
356
356
|
name,
|
|
@@ -408,7 +408,7 @@ function ModelCard({
|
|
|
408
408
|
] }),
|
|
409
409
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
410
410
|
context && /* @__PURE__ */ jsx("span", { className: "bg-muted px-1.5 py-0.5 rounded-sm font-medium", children: context }),
|
|
411
|
-
tier && tier !== "free" && /* @__PURE__ */ jsx("span", { className: "bg-
|
|
411
|
+
tier && tier !== "free" && /* @__PURE__ */ jsx("span", { className: "bg-warning-soft text-warning px-1.5 py-0.5 rounded-sm font-medium", children: tier }),
|
|
412
412
|
price && /* @__PURE__ */ jsx("span", { className: "font-mono", children: price })
|
|
413
413
|
] })
|
|
414
414
|
] })
|
|
@@ -529,17 +529,7 @@ function ModelSelect({
|
|
|
529
529
|
const panelRef = useRef(null);
|
|
530
530
|
const { shift, maxHeight, placement } = useAnchoredPosition(isOpen, panelRef);
|
|
531
531
|
const pinnedSet = useMemo(() => new Set(pinned ?? []), [pinned]);
|
|
532
|
-
|
|
533
|
-
const onDown = (e) => {
|
|
534
|
-
if (rootRef.current && !rootRef.current.contains(e.target)) setIsOpen(false);
|
|
535
|
-
};
|
|
536
|
-
document.addEventListener("mousedown", onDown);
|
|
537
|
-
document.addEventListener("touchstart", onDown);
|
|
538
|
-
return () => {
|
|
539
|
-
document.removeEventListener("mousedown", onDown);
|
|
540
|
-
document.removeEventListener("touchstart", onDown);
|
|
541
|
-
};
|
|
542
|
-
}, []);
|
|
532
|
+
useDismissOnOutside(isOpen, () => setIsOpen(false), rootRef, { escape: false });
|
|
543
533
|
useEffect(() => {
|
|
544
534
|
if (!isOpen) return;
|
|
545
535
|
const t = setTimeout(() => {
|
|
@@ -647,7 +637,7 @@ function ModelSelect({
|
|
|
647
637
|
"aria-expanded": isOpen,
|
|
648
638
|
"aria-haspopup": "listbox",
|
|
649
639
|
className: cn(
|
|
650
|
-
"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",
|
|
640
|
+
"flex items-center gap-2 px-3 py-2 bg-card border border-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",
|
|
651
641
|
isOpen ? "border-ring/60 ring-2 ring-ring/25" : "border-border hover:border-ring"
|
|
652
642
|
),
|
|
653
643
|
children: [
|
|
@@ -687,7 +677,7 @@ function ModelSelect({
|
|
|
687
677
|
"aria-expanded": isOpen,
|
|
688
678
|
"aria-controls": "yunui-ms-listbox",
|
|
689
679
|
"aria-activedescendant": activeId ? rowDomId(activeId) : void 0,
|
|
690
|
-
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"
|
|
680
|
+
className: "w-full pl-9 pr-8 py-2 text-base md:text-sm bg-muted/50 border border-transparent rounded-xl outline-none focus:border-ring focus:bg-background transition-colors"
|
|
691
681
|
}
|
|
692
682
|
),
|
|
693
683
|
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 }) })
|
|
@@ -858,37 +848,37 @@ function ModelManagerCard({
|
|
|
858
848
|
);
|
|
859
849
|
}
|
|
860
850
|
var llmCapabilityConfig = [
|
|
861
|
-
{ value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-
|
|
862
|
-
{ value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-
|
|
863
|
-
{ value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-
|
|
864
|
-
{ value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-
|
|
865
|
-
{ value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-
|
|
851
|
+
{ value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
|
|
852
|
+
{ value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-700 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" },
|
|
853
|
+
{ value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-700 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" },
|
|
854
|
+
{ value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/20 hover:bg-amber-500/20" },
|
|
855
|
+
{ value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-700 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
|
|
866
856
|
];
|
|
867
857
|
var imageCapabilityConfig = [
|
|
868
|
-
{ value: "image_edit", icon: Pencil, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-
|
|
869
|
-
{ value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-
|
|
870
|
-
{ value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-
|
|
871
|
-
{ value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-
|
|
872
|
-
{ value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-
|
|
873
|
-
{ value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-
|
|
874
|
-
{ value: "batch", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-
|
|
858
|
+
{ value: "image_edit", icon: Pencil, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
|
|
859
|
+
{ value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" },
|
|
860
|
+
{ value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-700 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" },
|
|
861
|
+
{ value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-700 dark:text-teal-400 border-teal-500/20 hover:bg-teal-500/20" },
|
|
862
|
+
{ value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" },
|
|
863
|
+
{ value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
|
|
864
|
+
{ value: "batch", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-700 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" }
|
|
875
865
|
];
|
|
876
866
|
var audioCapabilityConfig = [
|
|
877
|
-
{ value: "tts", icon: Mic, iconColor: "text-green-500", color: "bg-green-500/10 text-green-
|
|
878
|
-
{ value: "stt", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-
|
|
879
|
-
{ value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-
|
|
867
|
+
{ value: "tts", icon: Mic, iconColor: "text-green-500", color: "bg-green-500/10 text-green-700 dark:text-green-400 border-green-500/20 hover:bg-green-500/20" },
|
|
868
|
+
{ value: "stt", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
|
|
869
|
+
{ value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-700 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" }
|
|
880
870
|
];
|
|
881
871
|
var videoCapabilityConfig = [
|
|
882
|
-
{ value: "video_generation", icon: Video, iconColor: "text-red-500", color: "bg-red-500/10 text-red-
|
|
872
|
+
{ value: "video_generation", icon: Video, iconColor: "text-red-500", color: "bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" }
|
|
883
873
|
];
|
|
884
874
|
var musicCapabilityConfig = [
|
|
885
|
-
{ value: "music_generation", icon: Music, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-
|
|
875
|
+
{ value: "music_generation", icon: Music, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-700 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
|
|
886
876
|
];
|
|
887
877
|
var threedCapabilityConfig = [
|
|
888
|
-
{ value: "threed_generation", icon: Box, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-
|
|
878
|
+
{ value: "threed_generation", icon: Box, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-700 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" }
|
|
889
879
|
];
|
|
890
880
|
var realtimeCapabilityConfig = [
|
|
891
|
-
{ value: "realtime_voice", icon: Radio, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-
|
|
881
|
+
{ value: "realtime_voice", icon: Radio, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" }
|
|
892
882
|
];
|
|
893
883
|
function CapabilitySelector({ selected, onChange, disabled = false, size = "md", columns = 4, modelType }) {
|
|
894
884
|
const t = useYunUI().useT("capabilities");
|
|
@@ -1505,6 +1495,7 @@ var providerIconMap = {
|
|
|
1505
1495
|
ppio: "ppio.webp",
|
|
1506
1496
|
vertexai: "vertexai.webp",
|
|
1507
1497
|
gcp: "vertexai.webp",
|
|
1498
|
+
gmi: "gmi.svg",
|
|
1508
1499
|
"302ai": "302ai.webp",
|
|
1509
1500
|
aihubmix: "aihubmix.webp",
|
|
1510
1501
|
dmxapi: "DMXAPI.png",
|
|
@@ -1721,6 +1712,7 @@ var ProviderNames = {
|
|
|
1721
1712
|
ppio: "PPIO",
|
|
1722
1713
|
vertexai: "Vertex AI",
|
|
1723
1714
|
gcp: "Vertex AI",
|
|
1715
|
+
gmi: "GMI Cloud",
|
|
1724
1716
|
"302ai": "302.AI",
|
|
1725
1717
|
aihubmix: "AiHubMix",
|
|
1726
1718
|
dmxapi: "DMXAPI",
|
|
@@ -1864,20 +1856,20 @@ function ProviderIconImg({ provider, size = 16 }) {
|
|
|
1864
1856
|
return /* @__PURE__ */ jsx(ProviderIcon, { provider, size, rounded: true });
|
|
1865
1857
|
}
|
|
1866
1858
|
var MODEL_TYPE_ICONS = {
|
|
1867
|
-
chat: /* @__PURE__ */ jsx(MessageSquare, { size: 16, className: "text-blue-
|
|
1868
|
-
completion: /* @__PURE__ */ jsx(FileText, { size: 16, className: "text-gray-
|
|
1869
|
-
embedding: /* @__PURE__ */ jsx(Hash, { size: 16, className: "text-purple-
|
|
1870
|
-
image_generation: /* @__PURE__ */ jsx(Palette, { size: 16, className: "text-pink-
|
|
1871
|
-
audio: /* @__PURE__ */ jsx(Headphones, { size: 16, className: "text-orange-
|
|
1872
|
-
tts: /* @__PURE__ */ jsx(Volume2, { size: 16, className: "text-green-
|
|
1873
|
-
stt: /* @__PURE__ */ jsx(Mic, { size: 16, className: "text-red-
|
|
1874
|
-
video: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-
|
|
1875
|
-
video_generation: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-
|
|
1876
|
-
music_generation: /* @__PURE__ */ jsx(Music, { size: 16, className: "text-orange-
|
|
1877
|
-
rerank: /* @__PURE__ */ jsx(Shuffle, { size: 16, className: "text-indigo-
|
|
1878
|
-
moderation: /* @__PURE__ */ jsx(Shield, { size: 16, className: "text-yellow-
|
|
1879
|
-
"3d": /* @__PURE__ */ jsx(Box, { size: 16, className: "text-amber-
|
|
1880
|
-
realtime: /* @__PURE__ */ jsx(Radio, { size: 16, className: "text-yellow-
|
|
1859
|
+
chat: /* @__PURE__ */ jsx(MessageSquare, { size: 16, className: "text-blue-600" }),
|
|
1860
|
+
completion: /* @__PURE__ */ jsx(FileText, { size: 16, className: "text-gray-600" }),
|
|
1861
|
+
embedding: /* @__PURE__ */ jsx(Hash, { size: 16, className: "text-purple-600" }),
|
|
1862
|
+
image_generation: /* @__PURE__ */ jsx(Palette, { size: 16, className: "text-pink-600" }),
|
|
1863
|
+
audio: /* @__PURE__ */ jsx(Headphones, { size: 16, className: "text-orange-600" }),
|
|
1864
|
+
tts: /* @__PURE__ */ jsx(Volume2, { size: 16, className: "text-green-600" }),
|
|
1865
|
+
stt: /* @__PURE__ */ jsx(Mic, { size: 16, className: "text-red-600" }),
|
|
1866
|
+
video: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-600" }),
|
|
1867
|
+
video_generation: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-600" }),
|
|
1868
|
+
music_generation: /* @__PURE__ */ jsx(Music, { size: 16, className: "text-orange-600" }),
|
|
1869
|
+
rerank: /* @__PURE__ */ jsx(Shuffle, { size: 16, className: "text-indigo-600" }),
|
|
1870
|
+
moderation: /* @__PURE__ */ jsx(Shield, { size: 16, className: "text-yellow-600" }),
|
|
1871
|
+
"3d": /* @__PURE__ */ jsx(Box, { size: 16, className: "text-amber-600" }),
|
|
1872
|
+
realtime: /* @__PURE__ */ jsx(Radio, { size: 16, className: "text-yellow-600" })
|
|
1881
1873
|
};
|
|
1882
1874
|
function ModelTypeIcon({ type, size = 16 }) {
|
|
1883
1875
|
const icon = MODEL_TYPE_ICONS[type.toLowerCase()];
|
|
@@ -1887,13 +1879,13 @@ function ModelTypeIcon({ type, size = 16 }) {
|
|
|
1887
1879
|
return /* @__PURE__ */ jsx(Bot, { size, className: "text-muted-foreground" });
|
|
1888
1880
|
}
|
|
1889
1881
|
var variants = {
|
|
1890
|
-
primary: "bg-
|
|
1891
|
-
outline: "border hover:bg-
|
|
1892
|
-
ghost: "hover:bg-
|
|
1893
|
-
secondary: "border bg-
|
|
1882
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/80 disabled:bg-secondary disabled:text-secondary-foreground",
|
|
1883
|
+
outline: "border border-border hover:bg-accent hover:text-accent-foreground",
|
|
1884
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
1885
|
+
secondary: "border border-border bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground"
|
|
1894
1886
|
};
|
|
1895
1887
|
var buttonVariants = cva(
|
|
1896
|
-
"inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
1888
|
+
"inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1897
1889
|
{
|
|
1898
1890
|
variants: {
|
|
1899
1891
|
variant: variants,
|
|
@@ -1923,15 +1915,7 @@ function LanguageSwitcher({
|
|
|
1923
1915
|
const triggerRef = useRef(null);
|
|
1924
1916
|
const panelRef = useRef(null);
|
|
1925
1917
|
const { shift, maxHeight, placement } = useAnchoredPosition(isOpen, panelRef);
|
|
1926
|
-
|
|
1927
|
-
const handleClickOutside = (e) => {
|
|
1928
|
-
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1929
|
-
setIsOpen(false);
|
|
1930
|
-
}
|
|
1931
|
-
};
|
|
1932
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
1933
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1934
|
-
}, []);
|
|
1918
|
+
useDismissOnOutside(isOpen, () => setIsOpen(false), containerRef, { escape: false });
|
|
1935
1919
|
useEffect(() => {
|
|
1936
1920
|
if (!isOpen) return;
|
|
1937
1921
|
const onKey = (e) => {
|
|
@@ -2012,7 +1996,14 @@ function Navbar({
|
|
|
2012
1996
|
themeToggle,
|
|
2013
1997
|
homeHref = "/",
|
|
2014
1998
|
loginHref = "/login",
|
|
2015
|
-
signupHref = "/signup"
|
|
1999
|
+
signupHref = "/signup",
|
|
2000
|
+
account,
|
|
2001
|
+
brand,
|
|
2002
|
+
actions,
|
|
2003
|
+
mobileMenuHeader,
|
|
2004
|
+
mobileMenuFooter,
|
|
2005
|
+
label,
|
|
2006
|
+
className
|
|
2016
2007
|
}) {
|
|
2017
2008
|
const { Link, Image } = useYunUI();
|
|
2018
2009
|
const [scrollSection, setScrollSection] = useState("");
|
|
@@ -2064,12 +2055,13 @@ function Navbar({
|
|
|
2064
2055
|
"nav",
|
|
2065
2056
|
{
|
|
2066
2057
|
style: { top: "max(1.5rem, env(safe-area-inset-top))" },
|
|
2067
|
-
|
|
2058
|
+
"aria-label": label,
|
|
2059
|
+
className: `fixed inset-x-0 mx-auto z-50 px-6 py-2.5 max-w-6xl w-[calc(100%-48px)] bg-background/80 backdrop-blur-xl border border-border rounded-full shadow-md flex items-center justify-between${className ? ` ${className}` : ""}`,
|
|
2068
2060
|
children: [
|
|
2069
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ jsx(Link, { href: homeHref, className: "flex items-center gap-2 min-w-0 rounded-lg px-2 py-1 -mx-2 hover:bg-foreground/5 transition-colors duration-200", children: brand ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2070
2062
|
/* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 28, height: 28, className: "w-7 h-7 shrink-0" }),
|
|
2071
2063
|
/* @__PURE__ */ jsx("span", { className: "font-semibold text-sm tracking-tight truncate", children: appName })
|
|
2072
|
-
] }),
|
|
2064
|
+
] }) }),
|
|
2073
2065
|
variant === "public" && /* @__PURE__ */ jsx("div", { className: "hidden md:flex items-center gap-6 lg:gap-8 absolute left-1/2 -translate-x-1/2", children: links.map((link) => /* @__PURE__ */ jsxs(
|
|
2074
2066
|
Link,
|
|
2075
2067
|
{
|
|
@@ -2083,9 +2075,11 @@ function Navbar({
|
|
|
2083
2075
|
link.href
|
|
2084
2076
|
)) }),
|
|
2085
2077
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
2086
|
-
/* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children:
|
|
2078
|
+
actions && /* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children: actions }),
|
|
2079
|
+
languageSwitcher && /* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children: languageSwitcher }),
|
|
2087
2080
|
themeToggle ?? /* @__PURE__ */ jsx(ThemeToggle, { variant: "pill" }),
|
|
2088
|
-
variant !== "minimal" &&
|
|
2081
|
+
variant !== "minimal" && account,
|
|
2082
|
+
variant !== "minimal" && !account && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2089
2083
|
/* @__PURE__ */ jsx(
|
|
2090
2084
|
Link,
|
|
2091
2085
|
{
|
|
@@ -2117,7 +2111,8 @@ function Navbar({
|
|
|
2117
2111
|
] }),
|
|
2118
2112
|
variant === "public" && menuOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2119
2113
|
/* @__PURE__ */ jsx("div", { className: "md:hidden fixed inset-0 -z-10", "aria-hidden": "true", onClick: () => setMenuOpen(false) }),
|
|
2120
|
-
/* @__PURE__ */ jsxs("div", { className: "md:hidden absolute top-full left-0 right-0 mt-3 p-2 bg-popover
|
|
2114
|
+
/* @__PURE__ */ jsxs("div", { className: "md:hidden absolute top-full left-0 right-0 mt-3 p-2 bg-popover border border-border rounded-2xl shadow-lg shadow-black/5 flex flex-col gap-0.5", children: [
|
|
2115
|
+
mobileMenuHeader,
|
|
2121
2116
|
links.map((link) => /* @__PURE__ */ jsx(
|
|
2122
2117
|
Link,
|
|
2123
2118
|
{
|
|
@@ -2129,32 +2124,145 @@ function Navbar({
|
|
|
2129
2124
|
link.href
|
|
2130
2125
|
)),
|
|
2131
2126
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
2132
|
-
languageSwitcher && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: languageSwitcher }),
|
|
2133
|
-
/* @__PURE__ */
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2127
|
+
mobileMenuFooter ?? (languageSwitcher && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: languageSwitcher })),
|
|
2128
|
+
!account && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2129
|
+
/* @__PURE__ */ jsx(
|
|
2130
|
+
Link,
|
|
2131
|
+
{
|
|
2132
|
+
href: loginHref,
|
|
2133
|
+
onClick: () => setMenuOpen(false),
|
|
2134
|
+
className: "px-4 py-2.5 rounded-xl text-sm text-muted-foreground transition-colors hover:bg-foreground/5",
|
|
2135
|
+
children: signIn
|
|
2136
|
+
}
|
|
2137
|
+
),
|
|
2138
|
+
/* @__PURE__ */ jsx(
|
|
2139
|
+
Link,
|
|
2140
|
+
{
|
|
2141
|
+
href: signupHref,
|
|
2142
|
+
onClick: () => setMenuOpen(false),
|
|
2143
|
+
className: "mt-0.5 px-4 py-2.5 rounded-xl text-sm font-medium text-center bg-foreground text-background hover:bg-foreground/90 transition-colors yunui-accent-bg yunui-accent-on",
|
|
2144
|
+
children: signUp
|
|
2145
|
+
}
|
|
2146
|
+
)
|
|
2147
|
+
] })
|
|
2151
2148
|
] })
|
|
2152
2149
|
] })
|
|
2153
2150
|
]
|
|
2154
2151
|
}
|
|
2155
2152
|
);
|
|
2156
2153
|
}
|
|
2154
|
+
function AccountMenu({
|
|
2155
|
+
user,
|
|
2156
|
+
items = [],
|
|
2157
|
+
signInHref,
|
|
2158
|
+
onSignOut,
|
|
2159
|
+
labels,
|
|
2160
|
+
className
|
|
2161
|
+
}) {
|
|
2162
|
+
const { Link } = useYunUI();
|
|
2163
|
+
const [open, setOpen] = useState(false);
|
|
2164
|
+
const ref = useRef(null);
|
|
2165
|
+
const signInLabel = labels?.signIn ?? "Sign in";
|
|
2166
|
+
const signOutLabel = labels?.signOut ?? "Sign out";
|
|
2167
|
+
const fallbackName = labels?.fallbackName ?? "Account";
|
|
2168
|
+
useDismissOnOutside(open, () => setOpen(false), ref);
|
|
2169
|
+
if (user === void 0) {
|
|
2170
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("block h-9 w-9", className) });
|
|
2171
|
+
}
|
|
2172
|
+
if (user === null) {
|
|
2173
|
+
return /* @__PURE__ */ jsx(
|
|
2174
|
+
Link,
|
|
2175
|
+
{
|
|
2176
|
+
href: signInHref,
|
|
2177
|
+
"aria-label": signInLabel,
|
|
2178
|
+
className: cn(
|
|
2179
|
+
"flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground",
|
|
2180
|
+
className
|
|
2181
|
+
),
|
|
2182
|
+
children: /* @__PURE__ */ jsx(CircleUserRound, { className: "h-4 w-4" })
|
|
2183
|
+
}
|
|
2184
|
+
);
|
|
2185
|
+
}
|
|
2186
|
+
const name = user.name || fallbackName;
|
|
2187
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn("relative", className), children: [
|
|
2188
|
+
/* @__PURE__ */ jsx(
|
|
2189
|
+
"button",
|
|
2190
|
+
{
|
|
2191
|
+
type: "button",
|
|
2192
|
+
onClick: () => setOpen((v) => !v),
|
|
2193
|
+
"aria-haspopup": "menu",
|
|
2194
|
+
"aria-expanded": open,
|
|
2195
|
+
"aria-label": labels?.menu ?? name,
|
|
2196
|
+
className: "flex h-9 w-9 items-center justify-center overflow-hidden rounded-full transition-colors hover:bg-foreground/5 outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2197
|
+
children: user.avatarUrl ? (
|
|
2198
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
2199
|
+
/* @__PURE__ */ jsx("img", { src: user.avatarUrl, alt: "", width: 28, height: 28, className: "h-7 w-7 rounded-full" })
|
|
2200
|
+
) : /* @__PURE__ */ jsx(CircleUserRound, { className: "h-4 w-4 text-muted-foreground" })
|
|
2201
|
+
}
|
|
2202
|
+
),
|
|
2203
|
+
open && /* @__PURE__ */ jsxs(
|
|
2204
|
+
"div",
|
|
2205
|
+
{
|
|
2206
|
+
role: "menu",
|
|
2207
|
+
className: "absolute right-0 top-full z-50 mt-2 w-56 rounded-2xl border border-border bg-popover/95 p-1.5 shadow-lg shadow-black/5 backdrop-blur-2xl",
|
|
2208
|
+
children: [
|
|
2209
|
+
/* @__PURE__ */ jsxs("div", { className: "border-b border-border px-3 py-2.5", children: [
|
|
2210
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: name }),
|
|
2211
|
+
user.email && /* @__PURE__ */ jsx("p", { className: "text-caption truncate", children: user.email })
|
|
2212
|
+
] }),
|
|
2213
|
+
items.map((item) => {
|
|
2214
|
+
const Icon = item.icon;
|
|
2215
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2216
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2217
|
+
item.label
|
|
2218
|
+
] });
|
|
2219
|
+
const rowClass = "mt-1 flex w-full items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
2220
|
+
return item.onSelect ? /* @__PURE__ */ jsx(
|
|
2221
|
+
"button",
|
|
2222
|
+
{
|
|
2223
|
+
type: "button",
|
|
2224
|
+
role: "menuitem",
|
|
2225
|
+
onClick: () => {
|
|
2226
|
+
item.onSelect?.();
|
|
2227
|
+
setOpen(false);
|
|
2228
|
+
},
|
|
2229
|
+
className: rowClass,
|
|
2230
|
+
children: body
|
|
2231
|
+
},
|
|
2232
|
+
item.key
|
|
2233
|
+
) : /* @__PURE__ */ jsx(
|
|
2234
|
+
Link,
|
|
2235
|
+
{
|
|
2236
|
+
href: item.href ?? "#",
|
|
2237
|
+
onClick: () => setOpen(false),
|
|
2238
|
+
className: rowClass,
|
|
2239
|
+
children: body
|
|
2240
|
+
},
|
|
2241
|
+
item.key
|
|
2242
|
+
);
|
|
2243
|
+
}),
|
|
2244
|
+
onSignOut && /* @__PURE__ */ jsxs(
|
|
2245
|
+
"button",
|
|
2246
|
+
{
|
|
2247
|
+
type: "button",
|
|
2248
|
+
role: "menuitem",
|
|
2249
|
+
onClick: () => {
|
|
2250
|
+
onSignOut();
|
|
2251
|
+
setOpen(false);
|
|
2252
|
+
},
|
|
2253
|
+
className: "mt-1 flex w-full items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2254
|
+
children: [
|
|
2255
|
+
/* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2256
|
+
signOutLabel
|
|
2257
|
+
]
|
|
2258
|
+
}
|
|
2259
|
+
)
|
|
2260
|
+
]
|
|
2261
|
+
}
|
|
2262
|
+
)
|
|
2263
|
+
] });
|
|
2264
|
+
}
|
|
2157
2265
|
|
|
2158
|
-
export { AgentRunStatus, AgentTimeline, CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelManagerCard, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getModelDeveloperId, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
2266
|
+
export { AccountMenu, AgentRunStatus, AgentTimeline, CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelManagerCard, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getModelDeveloperId, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
2159
2267
|
//# sourceMappingURL=ai.js.map
|
|
2160
2268
|
//# sourceMappingURL=ai.js.map
|