mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 13:51:19 +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.
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { NextResponse, type NextRequest } from "next/server"
|
|
import { track } from "@vercel/analytics/server"
|
|
import { registryItemSchema } from "shadcn/schema"
|
|
|
|
import { buildRegistryBase, designSystemConfigSchema } from "@/registry/config"
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const searchParams = request.nextUrl.searchParams
|
|
|
|
const result = designSystemConfigSchema.safeParse({
|
|
base: searchParams.get("base"),
|
|
style: searchParams.get("style"),
|
|
iconLibrary: searchParams.get("iconLibrary"),
|
|
baseColor: searchParams.get("baseColor"),
|
|
theme: searchParams.get("theme"),
|
|
font: searchParams.get("font"),
|
|
menuAccent: searchParams.get("menuAccent"),
|
|
menuColor: searchParams.get("menuColor"),
|
|
radius: searchParams.get("radius"),
|
|
template: searchParams.get("template"),
|
|
rtl: searchParams.get("rtl") === "true",
|
|
})
|
|
|
|
if (!result.success) {
|
|
return NextResponse.json(
|
|
{ error: result.error.issues[0].message },
|
|
{ status: 400 }
|
|
)
|
|
}
|
|
|
|
const registryBase = buildRegistryBase(result.data)
|
|
const parseResult = registryItemSchema.safeParse(registryBase)
|
|
|
|
if (!parseResult.success) {
|
|
return NextResponse.json(
|
|
{
|
|
error: "Invalid registry base item",
|
|
details: parseResult.error.format(),
|
|
},
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
|
|
track("create_app", result.data)
|
|
|
|
return NextResponse.json(parseResult.data)
|
|
} catch (error) {
|
|
return NextResponse.json(
|
|
{
|
|
error:
|
|
error instanceof Error ? error.message : "An unknown error occurred",
|
|
},
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
}
|