用途:当用户提供多个 Logo SVG 文件(图标、文字标、完整标志),或提到“变体”“明暗模式”时,按 Elements 代码库既有模式创建支持变体的 Logo 组件。
主要能力:识别变体类型(icon、logo、wordmark)与明暗版本(-dark.svg、-light.svg);提取 viewBox、颜色与尺寸;生成组件文件 src/components/ui/logos/{name}.tsx,提供 className、variant、mode 三个 props,默认 variant="wordmark"、mode="dark",用 COLORS 对象支持主题感知;将 SVG 转为 JSX(如 fill-rule→fillRule、stroke-width→strokeWidth),替换硬编码颜色并添加 title 提升可访问性。
使用方式:创建 registry/default/blocks/logos/{name}-logo/ 下的 registry-item.json,variants 数组须显式列出全部 {base}-{mode} 组合(如 icon-dark、logo-light),并设置 hasVariants: true;同步更新 registry/index.ts(构建的 source of truth)与 logos 集合 registry-item.json;最后运行 bun run build:registry。完成后组件位于 @/components/ui/logos/{name},可通过 npx shadcn@latest add @elements/{name}-logo 安装。
适用场景:为 Elements 的 logos 集合新增或更新品牌 Logo,需支持多变体与明暗主题切换。
限制:需遵循 clerk.tsx 参考实现与既有注册表结构;组件须同时复制到 src/ 与 registry/ 两处;颜色不得硬编码;改动后必须重新构建注册表;具体品牌规范与命名以用户提供为准,资料未提供收费、价格或平台信息。