@yuhuanowo/yunui 0.2.0 → 0.2.1
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 +51 -49
- package/README.zh-CN.md +154 -0
- package/README.zh-TW.md +154 -0
- package/dist/ai.d.ts +5 -46
- package/dist/ai.js +25 -59
- package/dist/ai.js.map +1 -1
- package/dist/chunk-FOP7I6N3.js +79 -0
- package/dist/chunk-FOP7I6N3.js.map +1 -0
- package/dist/{chunk-YRITK7CC.js → chunk-KTA7HC4V.js} +114 -11
- package/dist/chunk-KTA7HC4V.js.map +1 -0
- package/dist/footer-BoFu7Wqq.d.ts +46 -0
- package/dist/index.d.ts +52 -2
- package/dist/index.js +1 -1
- package/dist/patterns.d.ts +1 -0
- package/dist/patterns.js +3 -2
- package/dist/patterns.js.map +1 -1
- package/package.json +7 -3
- package/styles/tokens.css +2007 -0
- package/styles/yunui.css +44 -5
- package/dist/chunk-WASCOOVD.js +0 -29
- package/dist/chunk-WASCOOVD.js.map +0 -1
- package/dist/chunk-YRITK7CC.js.map +0 -1
package/dist/ai.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { copyToClipboard } from './chunk-
|
|
2
|
+
import { copyToClipboard } from './chunk-FOP7I6N3.js';
|
|
3
|
+
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-FOP7I6N3.js';
|
|
3
4
|
import { cn, ThemeToggle } from './chunk-N7JHOWGR.js';
|
|
4
5
|
import { useYunUI } from './chunk-T37N6OZA.js';
|
|
5
6
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
@@ -349,11 +350,13 @@ function getDeveloperIconFile(developer) {
|
|
|
349
350
|
if (developerIconMap[normalized]) {
|
|
350
351
|
return developerIconMap[normalized];
|
|
351
352
|
}
|
|
353
|
+
let best = null;
|
|
352
354
|
for (const [key, file] of Object.entries(developerIconMap)) {
|
|
353
|
-
if (normalized.includes(key) || key.
|
|
354
|
-
|
|
355
|
+
if (key.length >= 3 && normalized.includes(key) && (!best || key.length > best.key.length)) {
|
|
356
|
+
best = { key, file };
|
|
355
357
|
}
|
|
356
358
|
}
|
|
359
|
+
if (best) return best.file;
|
|
357
360
|
return null;
|
|
358
361
|
}
|
|
359
362
|
var providerIconMap = {
|
|
@@ -455,18 +458,21 @@ function getProviderIconOptions() {
|
|
|
455
458
|
return out.sort((a, b) => a.label.localeCompare(b.label));
|
|
456
459
|
}
|
|
457
460
|
function normalizeProviderId(id) {
|
|
458
|
-
return id.toLowerCase().replace(/[-_\s]/g, "");
|
|
461
|
+
return (id ?? "").toLowerCase().replace(/[-_\s]/g, "");
|
|
459
462
|
}
|
|
460
463
|
function getIconPath(providerId) {
|
|
461
464
|
const normalized = normalizeProviderId(providerId);
|
|
465
|
+
if (!normalized) return null;
|
|
462
466
|
if (providerIconMap[normalized]) {
|
|
463
467
|
return `/icons/providers/${providerIconMap[normalized]}`;
|
|
464
468
|
}
|
|
469
|
+
let best = null;
|
|
465
470
|
for (const [key, file] of Object.entries(providerIconMap)) {
|
|
466
|
-
if (normalized.includes(key) || key.
|
|
467
|
-
|
|
471
|
+
if (key.length >= 3 && normalized.includes(key) && (!best || key.length > best.key.length)) {
|
|
472
|
+
best = { key, file };
|
|
468
473
|
}
|
|
469
474
|
}
|
|
475
|
+
if (best) return `/icons/providers/${best.file}`;
|
|
470
476
|
return null;
|
|
471
477
|
}
|
|
472
478
|
function applyIconBase(path, base) {
|
|
@@ -482,6 +488,7 @@ function ProviderIcon({
|
|
|
482
488
|
}) {
|
|
483
489
|
const { Image, iconBasePath } = useYunUI();
|
|
484
490
|
const [customError, setCustomError] = useState(false);
|
|
491
|
+
const [pathError, setPathError] = useState(false);
|
|
485
492
|
const effectiveIconUrl = iconUrl;
|
|
486
493
|
if (effectiveIconUrl && !customError) {
|
|
487
494
|
if (rounded) {
|
|
@@ -503,7 +510,7 @@ function ProviderIcon({
|
|
|
503
510
|
if (size <= 20) return "rounded-md";
|
|
504
511
|
return "rounded-lg";
|
|
505
512
|
};
|
|
506
|
-
if (iconPath) {
|
|
513
|
+
if (iconPath && !pathError) {
|
|
507
514
|
if (rounded) {
|
|
508
515
|
return /* @__PURE__ */ jsx(
|
|
509
516
|
"div",
|
|
@@ -518,7 +525,8 @@ function ProviderIcon({
|
|
|
518
525
|
width: size,
|
|
519
526
|
height: size,
|
|
520
527
|
className: "object-cover",
|
|
521
|
-
unoptimized: true
|
|
528
|
+
unoptimized: true,
|
|
529
|
+
onError: () => setPathError(true)
|
|
522
530
|
}
|
|
523
531
|
)
|
|
524
532
|
}
|
|
@@ -532,7 +540,8 @@ function ProviderIcon({
|
|
|
532
540
|
width: size,
|
|
533
541
|
height: size,
|
|
534
542
|
className: `object-contain ${className}`,
|
|
535
|
-
unoptimized: true
|
|
543
|
+
unoptimized: true,
|
|
544
|
+
onError: () => setPathError(true)
|
|
536
545
|
}
|
|
537
546
|
);
|
|
538
547
|
}
|
|
@@ -542,7 +551,7 @@ function ProviderIcon({
|
|
|
542
551
|
{
|
|
543
552
|
className: `${getRadiusClass()} bg-linear-to-br from-black/5 to-black/10 flex items-center justify-center ${className}`,
|
|
544
553
|
style: { width: size, height: size },
|
|
545
|
-
children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: provider.charAt(0).toUpperCase() })
|
|
554
|
+
children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: (provider || "?").charAt(0).toUpperCase() })
|
|
546
555
|
}
|
|
547
556
|
);
|
|
548
557
|
}
|
|
@@ -652,13 +661,16 @@ var ProviderNames = {
|
|
|
652
661
|
aionly: "AiOnly"
|
|
653
662
|
};
|
|
654
663
|
function getProviderName(providerId) {
|
|
664
|
+
if (!providerId) return "";
|
|
655
665
|
const normalized = providerId.toLowerCase().replace(/[-_\s]/g, "");
|
|
656
666
|
if (ProviderNames[normalized]) return ProviderNames[normalized];
|
|
667
|
+
let best = null;
|
|
657
668
|
for (const [key, name] of Object.entries(ProviderNames)) {
|
|
658
|
-
if (normalized.includes(key) || key.
|
|
659
|
-
|
|
669
|
+
if (key.length >= 3 && normalized.includes(key) && (!best || key.length > best.key.length)) {
|
|
670
|
+
best = { key, name };
|
|
660
671
|
}
|
|
661
672
|
}
|
|
673
|
+
if (best) return best.name;
|
|
662
674
|
return providerId.charAt(0).toUpperCase() + providerId.slice(1);
|
|
663
675
|
}
|
|
664
676
|
function getProxiedImageUrl(url) {
|
|
@@ -1014,53 +1026,7 @@ function Navbar({
|
|
|
1014
1026
|
] })
|
|
1015
1027
|
] });
|
|
1016
1028
|
}
|
|
1017
|
-
var GithubIcon = () => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" }) });
|
|
1018
|
-
var InstagramIcon = () => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z" }) });
|
|
1019
|
-
var DiscordIcon = () => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z" }) });
|
|
1020
|
-
function Footer({
|
|
1021
|
-
appName,
|
|
1022
|
-
logoSrc = "/favicon.ico",
|
|
1023
|
-
homeHref = "/",
|
|
1024
|
-
tagline,
|
|
1025
|
-
sections = [],
|
|
1026
|
-
social = [],
|
|
1027
|
-
copyright
|
|
1028
|
-
}) {
|
|
1029
|
-
const { Link, Image } = useYunUI();
|
|
1030
|
-
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
1031
|
-
const copyrightText = copyright ?? `\xA9 ${year} ${appName}. All rights reserved.`;
|
|
1032
|
-
return /* @__PURE__ */ jsx("footer", { className: "mt-auto py-6 px-6", children: /* @__PURE__ */ jsx("div", { className: "max-w-6xl mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "card p-6", children: [
|
|
1033
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-6", children: [
|
|
1034
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1035
|
-
/* @__PURE__ */ jsxs(Link, { href: homeHref, className: "flex items-center gap-2 mb-2", children: [
|
|
1036
|
-
/* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 24, height: 24 }),
|
|
1037
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: appName })
|
|
1038
|
-
] }),
|
|
1039
|
-
tagline && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: tagline })
|
|
1040
|
-
] }),
|
|
1041
|
-
sections.map((section) => /* @__PURE__ */ jsxs("div", { children: [
|
|
1042
|
-
/* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2", children: section.title }),
|
|
1043
|
-
/* @__PURE__ */ jsx("ul", { className: "space-y-1.5 text-sm", children: section.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, { href: link.href, className: "text-muted-foreground hover:text-foreground transition-colors", children: link.label }) }, link.href)) })
|
|
1044
|
-
] }, section.title))
|
|
1045
|
-
] }),
|
|
1046
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-5 pt-4 border-t border-border flex flex-col sm:flex-row items-center justify-between gap-3 text-xs text-muted-foreground", children: [
|
|
1047
|
-
/* @__PURE__ */ jsx("span", { children: copyrightText }),
|
|
1048
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4", children: social.map((link) => /* @__PURE__ */ jsx(
|
|
1049
|
-
"a",
|
|
1050
|
-
{
|
|
1051
|
-
href: link.href,
|
|
1052
|
-
target: link.href.startsWith("/") || link.href.startsWith("mailto:") ? void 0 : "_blank",
|
|
1053
|
-
rel: link.href.startsWith("/") || link.href.startsWith("mailto:") ? void 0 : "noopener noreferrer",
|
|
1054
|
-
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
1055
|
-
"aria-label": link.label,
|
|
1056
|
-
children: link.icon
|
|
1057
|
-
},
|
|
1058
|
-
link.label
|
|
1059
|
-
)) })
|
|
1060
|
-
] })
|
|
1061
|
-
] }) }) });
|
|
1062
|
-
}
|
|
1063
1029
|
|
|
1064
|
-
export { CapabilitySelector,
|
|
1030
|
+
export { CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelTypeIcon, Navbar, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, normalizeProviderId };
|
|
1065
1031
|
//# sourceMappingURL=ai.js.map
|
|
1066
1032
|
//# sourceMappingURL=ai.js.map
|