@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.
Files changed (41) hide show
  1. package/README.md +3 -1
  2. package/README.zh-CN.md +5 -1
  3. package/README.zh-TW.md +5 -1
  4. package/dist/ai.d.ts +99 -3
  5. package/dist/ai.js +212 -104
  6. package/dist/ai.js.map +1 -1
  7. package/dist/chat.d.ts +10 -3
  8. package/dist/chat.js +12 -7
  9. package/dist/chat.js.map +1 -1
  10. package/dist/{chunk-HH3JBHRP.js → chunk-AFVENY4D.js} +286 -31
  11. package/dist/chunk-AFVENY4D.js.map +1 -0
  12. package/dist/{chunk-F2HG4TOQ.js → chunk-GAXVET76.js} +13 -19
  13. package/dist/chunk-GAXVET76.js.map +1 -0
  14. package/dist/{chunk-DDUP7GAX.js → chunk-LEBQPP4B.js} +69 -3
  15. package/dist/chunk-LEBQPP4B.js.map +1 -0
  16. package/dist/chunk-ST6TSBVQ.js +208 -0
  17. package/dist/chunk-ST6TSBVQ.js.map +1 -0
  18. package/dist/chunk-V7VJKZ5Q.js +254 -0
  19. package/dist/chunk-V7VJKZ5Q.js.map +1 -0
  20. package/dist/{chunk-BCOKFWXC.js → chunk-YKWRCA2S.js} +80 -156
  21. package/dist/chunk-YKWRCA2S.js.map +1 -0
  22. package/dist/content.d.ts +10 -2
  23. package/dist/content.js +50 -40
  24. package/dist/content.js.map +1 -1
  25. package/dist/index.d.ts +266 -16
  26. package/dist/index.js +4 -4
  27. package/dist/patterns.d.ts +471 -22
  28. package/dist/patterns.js +783 -131
  29. package/dist/patterns.js.map +1 -1
  30. package/icons/providers/gmi.svg +5 -0
  31. package/package.json +3 -4
  32. package/styles/content.css +3 -1
  33. package/styles/yunui.css +197 -84
  34. package/dist/chunk-BCOKFWXC.js.map +0 -1
  35. package/dist/chunk-DDUP7GAX.js.map +0 -1
  36. package/dist/chunk-F2HG4TOQ.js.map +0 -1
  37. package/dist/chunk-HH3JBHRP.js.map +0 -1
  38. package/dist/chunk-N4QO7RN5.js +0 -98
  39. package/dist/chunk-N4QO7RN5.js.map +0 -1
  40. package/dist/chunk-QEIBYOG2.js +0 -188
  41. 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-DDUP7GAX.js';
3
- export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-DDUP7GAX.js';
4
- import { TextShimmer, ThemeToggle } from './chunk-F2HG4TOQ.js';
5
- import { cn, useAnchoredPosition } from './chunk-N4QO7RN5.js';
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: { icon: Waves, color: "text-cyan-500" },
344
- vision: { icon: Eye, color: "text-amber-500" },
345
- thinking: { icon: Brain, color: "text-pink-500" },
346
- function_calling: { icon: Code, color: "text-purple-500" },
347
- image_edit: { icon: Image, color: "text-orange-500" },
348
- negative_prompt: { icon: Ban, color: "text-red-500" },
349
- seed_control: { icon: Fingerprint, color: "text-indigo-500" },
350
- lora: { icon: Layers, color: "text-teal-500" },
351
- guidance_scale: { icon: SlidersHorizontal, color: "text-yellow-500" },
352
- strength: { icon: SlidersHorizontal, color: "text-orange-500" },
353
- batch: { icon: Waves, color: "text-cyan-500" }
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-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-1.5 py-0.5 rounded-sm font-medium", children: tier }),
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
- useEffect(() => {
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-600 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
862
- { 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" },
863
- { value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" },
864
- { value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20 hover:bg-amber-500/20" },
865
- { value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-600 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
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-600 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
869
- { value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" },
870
- { value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" },
871
- { value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-600 dark:text-teal-400 border-teal-500/20 hover:bg-teal-500/20" },
872
- { value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" },
873
- { value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
874
- { value: "batch", 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" }
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-600 dark:text-green-400 border-green-500/20 hover:bg-green-500/20" },
878
- { value: "stt", 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" },
879
- { value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" }
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-600 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" }
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-600 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
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-600 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" }
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-600 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" }
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-500" }),
1868
- completion: /* @__PURE__ */ jsx(FileText, { size: 16, className: "text-gray-500" }),
1869
- embedding: /* @__PURE__ */ jsx(Hash, { size: 16, className: "text-purple-500" }),
1870
- image_generation: /* @__PURE__ */ jsx(Palette, { size: 16, className: "text-pink-500" }),
1871
- audio: /* @__PURE__ */ jsx(Headphones, { size: 16, className: "text-orange-500" }),
1872
- tts: /* @__PURE__ */ jsx(Volume2, { size: 16, className: "text-green-500" }),
1873
- stt: /* @__PURE__ */ jsx(Mic, { size: 16, className: "text-red-500" }),
1874
- video: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-500" }),
1875
- video_generation: /* @__PURE__ */ jsx(Video, { size: 16, className: "text-cyan-400" }),
1876
- music_generation: /* @__PURE__ */ jsx(Music, { size: 16, className: "text-orange-400" }),
1877
- rerank: /* @__PURE__ */ jsx(Shuffle, { size: 16, className: "text-indigo-500" }),
1878
- moderation: /* @__PURE__ */ jsx(Shield, { size: 16, className: "text-yellow-500" }),
1879
- "3d": /* @__PURE__ */ jsx(Box, { size: 16, className: "text-amber-500" }),
1880
- realtime: /* @__PURE__ */ jsx(Radio, { size: 16, className: "text-yellow-400" })
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-fd-primary text-fd-primary-foreground hover:bg-fd-primary/80 disabled:bg-fd-secondary disabled:text-fd-secondary-foreground",
1891
- outline: "border hover:bg-fd-accent hover:text-fd-accent-foreground",
1892
- ghost: "hover:bg-fd-accent hover:text-fd-accent-foreground",
1893
- secondary: "border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"
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-fd-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
- useEffect(() => {
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
- 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",
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__ */ jsxs(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: [
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: languageSwitcher }),
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" && /* @__PURE__ */ jsxs(Fragment, { children: [
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/95 backdrop-blur-2xl border border-border rounded-2xl shadow-lg shadow-black/5 flex flex-col gap-0.5", children: [
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__ */ jsx(
2134
- Link,
2135
- {
2136
- href: loginHref,
2137
- onClick: () => setMenuOpen(false),
2138
- className: "px-4 py-2.5 rounded-xl text-sm text-muted-foreground transition-colors hover:bg-foreground/5",
2139
- children: signIn
2140
- }
2141
- ),
2142
- /* @__PURE__ */ jsx(
2143
- Link,
2144
- {
2145
- href: signupHref,
2146
- onClick: () => setMenuOpen(false),
2147
- 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",
2148
- children: signUp
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