mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 00:18:41 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import "server-only"
|
|
|
|
import { registryItemSchema } from "shadcn/schema"
|
|
|
|
import { getThemesForBaseColor, type BaseName } from "@/registry/config"
|
|
import { ALLOWED_ITEM_TYPES } from "@/app/(create)/lib/constants"
|
|
|
|
export async function getItemsForBase(base: BaseName) {
|
|
const { Index } = await import("@/registry/bases/__index__")
|
|
const index = Index[base]
|
|
|
|
if (!index) {
|
|
return []
|
|
}
|
|
|
|
return Object.values(index).filter((item) =>
|
|
ALLOWED_ITEM_TYPES.includes(item.type)
|
|
)
|
|
}
|
|
|
|
export async function getBaseItem(name: string, base: BaseName) {
|
|
const { Index } = await import("@/registry/bases/__index__")
|
|
const index = Index[base]
|
|
|
|
if (!index?.[name]) {
|
|
return null
|
|
}
|
|
|
|
return registryItemSchema.parse(index[name])
|
|
}
|
|
|
|
export async function getBaseComponent(name: string, base: BaseName) {
|
|
const { Index } = await import("@/registry/bases/__index__")
|
|
const index = Index[base]
|
|
|
|
if (!index?.[name]) {
|
|
return null
|
|
}
|
|
|
|
return index[name].component
|
|
}
|
|
|
|
// Re-export for server-side use.
|
|
export { getThemesForBaseColor }
|