@yuhuanowo/yunui 0.1.7 → 0.1.8

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 CHANGED
@@ -16,34 +16,42 @@ interface ThinkingBlockProps {
16
16
  declare function ThinkingBlock({ content, isStreaming, defaultOpen, renderContent }: ThinkingBlockProps): React.JSX.Element;
17
17
 
18
18
  interface ModelCardProps {
19
+ /** Model display name. */
19
20
  name: string;
20
21
  /** Avatar slot — host renders the provider/model icon. */
21
22
  icon?: ReactNode;
22
23
  /** Primary id + aliases, shown as mono badges. */
23
24
  ids?: string[];
25
+ /** Short description (falls back to a "No description" label). */
24
26
  description?: ReactNode;
25
- /** Capability keys (e.g. "vision", "thinking") → coloured icons. */
27
+ /** Capability keys (e.g. "vision", "thinking") → coloured icons (first 4 shown). */
26
28
  capabilities?: string[];
29
+ /** Developer/maker shown in the footer, with an optional icon. */
27
30
  developer?: {
28
31
  label: string;
29
32
  iconUrl?: string;
30
33
  };
31
34
  /** e.g. "128K" or "1024×1024". */
32
35
  context?: string;
33
- /** Optional tier chip (e.g. "pro"). */
36
+ /** Optional tier chip (e.g. "pro"); a `"free"` tier is hidden. */
34
37
  tier?: string;
35
38
  /** Formatted price node, e.g. "$0.50/M". */
36
39
  price?: ReactNode;
40
+ /** Mark the model as unofficial (shows a warning badge). */
37
41
  nonofficial?: boolean;
42
+ /** Mark the model as suspended (shows a paused badge). */
38
43
  suspended?: boolean;
44
+ /** Localized strings for the unofficial/suspended badges and the empty-description fallback. */
39
45
  labels?: {
40
46
  nonofficial?: string;
41
47
  suspended?: string;
42
48
  noDescription?: string;
43
49
  };
50
+ /** Makes the whole card a clickable button (keyboard-activatable). */
44
51
  onClick?: () => void;
45
52
  className?: string;
46
53
  }
54
+ /** Card summarizing an AI model: icon, name, capability chips, id badges, description, and a developer/context/tier/price footer. */
47
55
  declare function ModelCard({ name, icon, ids, description, capabilities, developer, context, tier, price, nonofficial, suspended, labels, onClick, className, }: ModelCardProps): React.JSX.Element;
48
56
 
49
57
  /** Click-to-copy mono ID badge (faithful port of Yunxin's IDBadge). */
@@ -53,13 +61,20 @@ declare function IDBadge({ text, truncate }: {
53
61
  }): React.JSX.Element;
54
62
 
55
63
  interface CapabilitySelectorProps {
64
+ /** Currently selected capability keys (controlled). */
56
65
  selected: string[];
66
+ /** Called with the next selection when a capability is toggled. */
57
67
  onChange: (capabilities: string[]) => void;
68
+ /** Disable interaction and dim the control. */
58
69
  disabled?: boolean;
70
+ /** Button size: `sm` or `md` (default). */
59
71
  size?: "sm" | "md";
72
+ /** Grid column count. @defaultValue 4 */
60
73
  columns?: 2 | 3 | 4;
74
+ /** Filters which capability set is shown (e.g. "image_generation", "audio", "video"). Defaults to the LLM set. */
61
75
  modelType?: string;
62
76
  }
77
+ /** Multi-select grid of toggleable model capabilities; the option set adapts to `modelType`. */
63
78
  declare function CapabilitySelector({ selected, onChange, disabled, size, columns, modelType }: CapabilitySelectorProps): React.JSX.Element;
64
79
 
65
80
  /**
@@ -81,6 +96,7 @@ declare const buttonVariants: (props?: ({
81
96
  color?: "outline" | "primary" | "ghost" | "secondary" | null | undefined;
82
97
  size?: "icon" | "sm" | "icon-sm" | "icon-xs" | null | undefined;
83
98
  } & class_variance_authority_types.ClassProp) | undefined) => string;
99
+ /** Variant props for {@link buttonVariants}: `variant`/`color` (primary, outline, ghost, secondary) and `size` (sm, icon, icon-sm, icon-xs). */
84
100
  type ButtonProps = VariantProps<typeof buttonVariants>;
85
101
 
86
102
  declare function getDeveloperIconPath(developer: string | null | undefined): string | null;
@@ -91,26 +107,39 @@ declare function getProviderIconOptions(): {
91
107
  declare function normalizeProviderId(id: string): string;
92
108
  declare function getIconPath(providerId: string): string | null;
93
109
  interface ProviderIconProps {
110
+ /** Provider id; resolved to a built-in icon by name (e.g. "openai", "anthropic"). */
94
111
  provider: string;
95
112
  className?: string;
113
+ /** Icon size in pixels. @defaultValue 20 */
96
114
  size?: number;
115
+ /** Render as a rounded avatar tile with a subtle background. */
97
116
  rounded?: boolean;
117
+ /** Custom icon URL that overrides the built-in lookup (falls back on load error). */
98
118
  iconUrl?: string | null;
99
119
  }
120
+ /** Provider logo resolved by id (or a custom `iconUrl`), with a letter/SVG fallback for unknown providers. */
100
121
  declare function ProviderIcon({ provider, className, size, rounded, iconUrl, }: ProviderIconProps): React.JSX.Element;
122
+ /** {@link ProviderIcon} preset that is always rounded with a background (avatar style). */
101
123
  declare function ProviderAvatar({ provider, size, className, }: {
124
+ /** Provider id (resolved by name). */
102
125
  provider: string;
126
+ /** Icon size in pixels. @defaultValue 32 */
103
127
  size?: number;
104
128
  className?: string;
105
129
  }): React.JSX.Element;
106
130
  declare const ProviderNames: Record<string, string>;
107
131
  declare function getProviderName(providerId: string): string;
108
132
  interface ModelIconProps {
133
+ /** Model's own icon URL or `/icons/models/` filename (highest priority). */
109
134
  iconUrl?: string | null;
135
+ /** Developer/maker id, used to resolve a developer icon (second priority). */
110
136
  developer?: string | null;
137
+ /** Provider id, used as the final fallback icon. */
111
138
  provider: string;
112
139
  className?: string;
140
+ /** Icon size in pixels. @defaultValue 20 */
113
141
  size?: number;
142
+ /** Render as a rounded avatar tile with a subtle background. */
114
143
  rounded?: boolean;
115
144
  }
116
145
  /**
@@ -123,16 +152,23 @@ interface ModelIconProps {
123
152
  * to the next priority level when an image can't be loaded.
124
153
  */
125
154
  declare function ModelIcon({ iconUrl, developer, provider, className, size, rounded, }: ModelIconProps): React.JSX.Element;
155
+ /** {@link ModelIcon} preset that is always rounded with a background (avatar style). */
126
156
  declare function ModelAvatar({ iconUrl, developer, provider, size, className, }: {
157
+ /** Model's own icon URL or filename (highest priority). */
127
158
  iconUrl?: string | null;
159
+ /** Developer id (second priority). */
128
160
  developer?: string | null;
161
+ /** Provider id (fallback). */
129
162
  provider: string;
163
+ /** Icon size in pixels. @defaultValue 32 */
130
164
  size?: number;
131
165
  className?: string;
132
166
  }): React.JSX.Element;
133
167
 
134
168
  interface LanguageOption {
169
+ /** Locale code (e.g. "en", "zh-TW"). */
135
170
  value: string;
171
+ /** Display name for the locale. */
136
172
  label: string;
137
173
  }
138
174
  interface LanguageSwitcherProps {
@@ -153,10 +189,13 @@ interface LanguageSwitcherProps {
153
189
  /** Additional className */
154
190
  className?: string;
155
191
  }
192
+ /** Locale picker dropdown; the host owns the actual locale change (cookie/reload). */
156
193
  declare function LanguageSwitcher({ locales, currentLocale, onChange, variant, align, label, pending, className, }: LanguageSwitcherProps): React.JSX.Element;
157
194
 
158
195
  interface NavLink {
196
+ /** Destination href (supports `/#section` anchors for scroll-spy on the home page). */
159
197
  href: string;
198
+ /** Link text. */
160
199
  label: string;
161
200
  }
162
201
  interface NavbarProps {
@@ -166,7 +205,9 @@ interface NavbarProps {
166
205
  logoSrc?: string;
167
206
  /** Center navigation links. The host builds these from branding/flags/i18n. */
168
207
  links?: NavLink[];
208
+ /** Current route, used for active-link + scroll-spy. @defaultValue "/" */
169
209
  currentPath?: string;
210
+ /** `public` (full nav + auth) or `minimal` (no links/auth). @defaultValue "public" */
170
211
  variant?: "public" | "minimal";
171
212
  /** Localized auth labels. */
172
213
  labels?: {
@@ -178,38 +219,56 @@ interface NavbarProps {
178
219
  languageSwitcher?: ReactNode;
179
220
  /** Defaults to YunUI's ThemeToggle. */
180
221
  themeToggle?: ReactNode;
222
+ /** Where the logo links to. @defaultValue "/" */
181
223
  homeHref?: string;
224
+ /** Sign-in link destination. @defaultValue "/login" */
182
225
  loginHref?: string;
226
+ /** Sign-up link destination. @defaultValue "/signup" */
183
227
  signupHref?: string;
184
228
  }
229
+ /** Floating top navigation bar: logo, center links with scroll-spy, theme/language slots, and auth buttons with a mobile menu. */
185
230
  declare function Navbar({ appName, logoSrc, links, currentPath, variant, labels, languageSwitcher, themeToggle, homeHref, loginHref, signupHref, }: NavbarProps): React.JSX.Element;
186
231
 
187
232
  declare const GithubIcon: () => React.JSX.Element;
188
233
  declare const InstagramIcon: () => React.JSX.Element;
189
234
  declare const DiscordIcon: () => React.JSX.Element;
190
235
  interface FooterLink {
236
+ /** Link text. */
191
237
  label: string;
238
+ /** Destination href. */
192
239
  href: string;
193
240
  }
194
241
  interface FooterSection {
242
+ /** Column heading. */
195
243
  title: string;
244
+ /** Links in this column. */
196
245
  links: FooterLink[];
197
246
  }
198
247
  interface FooterSocial {
248
+ /** Icon to render (e.g. {@link GithubIcon}). */
199
249
  icon: ReactNode;
250
+ /** Destination href (external links open in a new tab). */
200
251
  href: string;
252
+ /** Accessible label for the link. */
201
253
  label: string;
202
254
  }
203
255
  interface FooterProps {
256
+ /** Brand name shown next to the logo. */
204
257
  appName: string;
258
+ /** Logo image src. @defaultValue "/favicon.ico" */
205
259
  logoSrc?: string;
260
+ /** Where the logo links to. @defaultValue "/" */
206
261
  homeHref?: string;
262
+ /** Short brand tagline under the logo. */
207
263
  tagline?: string;
264
+ /** Link columns. */
208
265
  sections?: FooterSection[];
266
+ /** Social/icon links shown in the bottom bar. */
209
267
  social?: FooterSocial[];
210
268
  /** Defaults to `© <year> <appName>. All rights reserved.` */
211
269
  copyright?: string;
212
270
  }
271
+ /** Site footer: brand block, link columns, copyright line, and social icons. */
213
272
  declare function Footer({ appName, logoSrc, homeHref, tagline, sections, social, copyright, }: FooterProps): React.JSX.Element;
214
273
 
215
274
  export { type ButtonProps, CapabilitySelector, DiscordIcon, Footer, type FooterLink, type FooterProps, type FooterSection, type FooterSocial, GithubIcon, IDBadge, InstagramIcon, type LanguageOption, LanguageSwitcher, ModelAvatar, ModelCard, type ModelCardProps, ModelIcon, ModelTypeIcon, type NavLink, Navbar, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, normalizeProviderId };
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { copyToClipboard } from './chunk-WASCOOVD.js';
3
- import { cn, ThemeToggle } from './chunk-ORS36OUN.js';
3
+ import { cn, ThemeToggle } from './chunk-N7JHOWGR.js';
4
4
  import { useYunUI } from './chunk-T37N6OZA.js';
5
5
  import { useState, useRef, useEffect, useMemo } from 'react';
6
6
  import { AnimatePresence, motion } from 'framer-motion';