From 513a13b36b4fa7d785dbb94300278cc9388d1bfc Mon Sep 17 00:00:00 2001
From: caorushizi <84996057@qq.com>
Date: Fri, 2 Oct 2026 16:06:52 +0800
Subject: [PATCH 1/7] feat(templates): migrate shadcn components to Base UI
---
apps/dashboard/src/locales/en-US.json | 4 +-
apps/dashboard/src/locales/zh-CN.json | 4 +-
packages/templates/electron-app/README.md | 10 +
.../electron-app/apps/ui/components.json | 8 +-
.../electron-app/apps/ui/package.json | 3 +-
.../electron-app/apps/ui/src/App.tsx | 2 +-
.../apps/ui/src/components/ui/button.tsx | 53 ++-
.../apps/ui/src/components/ui/sonner.tsx | 29 +-
.../apps/ui/src/nodes/HomePage/index.tsx | 4 +-
.../apps/ui/src/styles/globals.css | 1 +
packages/templates/nextjs-app/README.md | 21 +-
packages/templates/nextjs-app/components.json | 10 +-
packages/templates/nextjs-app/package.json | 6 +-
.../templates/nextjs-app/src/app/globals.css | 23 +-
.../templates/nextjs-app/src/app/page.tsx | 3 +-
.../src/components/theme-toggle.tsx | 10 +-
.../nextjs-app/src/components/ui/avatar.tsx | 138 ++++--
.../nextjs-app/src/components/ui/badge.tsx | 45 +-
.../nextjs-app/src/components/ui/button.tsx | 68 +--
.../nextjs-app/src/components/ui/card.tsx | 127 ++++--
.../src/components/ui/dropdown-menu.tsx | 415 +++++++++++-------
.../nextjs-app/src/components/ui/input.tsx | 35 +-
.../nextjs-app/src/components/ui/label.tsx | 26 +-
.../nextjs-app/src/components/ui/skeleton.tsx | 4 +-
.../nextjs-app/src/components/ui/sonner.tsx | 21 +
packages/templates/react-spa/README.md | 21 +-
packages/templates/react-spa/components.json | 10 +-
packages/templates/react-spa/package.json | 5 +-
packages/templates/react-spa/src/App.tsx | 4 +-
.../react-spa/src/components/ui/alert.tsx | 73 ++-
.../react-spa/src/components/ui/badge.tsx | 36 +-
.../react-spa/src/components/ui/button.tsx | 64 +--
.../react-spa/src/components/ui/card.tsx | 127 +++---
.../react-spa/src/components/ui/input.tsx | 32 +-
.../react-spa/src/components/ui/label.tsx | 26 +-
.../react-spa/src/components/ui/sonner.tsx | 40 +-
.../templates/react-spa/src/pages/Home.tsx | 3 +-
.../react-spa/src/styles/tailwind.css | 4 +
.../templates/react-spa/src/styles/tokens.css | 1 +
packages/templates/react-spa/tsconfig.json | 14 +-
packages/templates/react-spa/vite.config.ts | 2 +-
41 files changed, 970 insertions(+), 562 deletions(-)
diff --git a/apps/dashboard/src/locales/en-US.json b/apps/dashboard/src/locales/en-US.json
index b67a9b0d..673f54c4 100644
--- a/apps/dashboard/src/locales/en-US.json
+++ b/apps/dashboard/src/locales/en-US.json
@@ -497,14 +497,14 @@
"description": "Build web applications with server rendering, API routes, and search-friendly pages.",
"stack": "Next.js · React · TypeScript",
"feature1": "App Router pages and route handlers",
- "feature2": "shadcn/ui components and theme switching",
+ "feature2": "shadcn/ui (Base UI) components and theme switching",
"feature3": "SWR data fetching and Zustand state management"
},
"react-spa": {
"description": "Create interactive dashboards, admin panels, and browser-based business applications.",
"stack": "React · Vite · TypeScript",
"feature1": "Client-side routing and error boundaries",
- "feature2": "shadcn/ui components and light / dark themes",
+ "feature2": "shadcn/ui (Base UI) components and light / dark themes",
"feature3": "SWR data fetching and Zustand state management"
},
"expo-mobile": {
diff --git a/apps/dashboard/src/locales/zh-CN.json b/apps/dashboard/src/locales/zh-CN.json
index f86e45b7..28bd61a3 100644
--- a/apps/dashboard/src/locales/zh-CN.json
+++ b/apps/dashboard/src/locales/zh-CN.json
@@ -497,14 +497,14 @@
"description": "构建需要服务端渲染、API 路由和搜索引擎友好页面的 Web 应用。",
"stack": "Next.js · React · TypeScript",
"feature1": "App Router 页面与接口路由",
- "feature2": "shadcn/ui 组件与主题切换",
+ "feature2": "shadcn/ui (Base UI) 组件与主题切换",
"feature3": "SWR 数据请求与 Zustand 状态管理"
},
"react-spa": {
"description": "构建交互丰富的仪表盘、管理后台和浏览器端业务系统。",
"stack": "React · Vite · TypeScript",
"feature1": "客户端路由与错误边界",
- "feature2": "shadcn/ui 组件与明暗主题",
+ "feature2": "shadcn/ui (Base UI) 组件与明暗主题",
"feature3": "SWR 数据请求与 Zustand 状态管理"
},
"expo-mobile": {
diff --git a/packages/templates/electron-app/README.md b/packages/templates/electron-app/README.md
index 72008bfb..c5140186 100644
--- a/packages/templates/electron-app/README.md
+++ b/packages/templates/electron-app/README.md
@@ -3,6 +3,16 @@
Electron + React + Vite,包含主进程、渲染进程和 preload 三个内部包。
Electron + React + Vite, with separate main, renderer, and preload packages.
+## UI / 界面
+
+渲染进程使用 shadcn/ui 的 `base-nova`(Base UI)组件,保留 `apps/ui/components.json`。
+在 `apps/ui` 目录执行 `pnpm dlx shadcn@latest add dialog` 可继续添加组件;组合使用 `render`。
+Sonner 保留现有通知与主题接口。
+
+The renderer uses shadcn/ui's `base-nova` (Base UI) components and keeps
+`apps/ui/components.json`. Run `pnpm dlx shadcn@latest add dialog` from `apps/ui`
+to add components, and compose them with `render`. Sonner keeps the existing notification and theme API.
+
## 工作区 / Workspace
这是一个 One 项目,内部包共享仓库根目录的 `pnpm-workspace.yaml` 和
diff --git a/packages/templates/electron-app/apps/ui/components.json b/packages/templates/electron-app/apps/ui/components.json
index 285033d3..36b30ac5 100644
--- a/packages/templates/electron-app/apps/ui/components.json
+++ b/packages/templates/electron-app/apps/ui/components.json
@@ -1,6 +1,6 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
- "style": "new-york",
+ "style": "base-nova",
"rsc": false,
"tsx": true,
"tailwind": {
@@ -17,5 +17,9 @@
"lib": "@/lib",
"hooks": "@/hooks"
},
- "iconLibrary": "lucide"
+ "iconLibrary": "lucide",
+ "rtl": false,
+ "menuColor": "default",
+ "menuAccent": "subtle",
+ "registries": {}
}
diff --git a/packages/templates/electron-app/apps/ui/package.json b/packages/templates/electron-app/apps/ui/package.json
index 88e9ef06..3d59fd7d 100644
--- a/packages/templates/electron-app/apps/ui/package.json
+++ b/packages/templates/electron-app/apps/ui/package.json
@@ -11,8 +11,8 @@
"preview": "vite preview"
},
"dependencies": {
+ "@base-ui/react": "^1.8.0",
"@one-template-electron/preload": "workspace:*",
- "@radix-ui/react-slot": "^1.3.3",
"axios": "^1.20.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
@@ -21,6 +21,7 @@
"react": "^19.3.0",
"react-dom": "^19.3.0",
"react-router-dom": "^7.18.4",
+ "shadcn": "^4.21.0",
"sonner": "^2.0.8",
"swr": "^2.5.1",
"tailwind-merge": "^3.7.0",
diff --git a/packages/templates/electron-app/apps/ui/src/App.tsx b/packages/templates/electron-app/apps/ui/src/App.tsx
index dda431b4..a7fc8384 100644
--- a/packages/templates/electron-app/apps/ui/src/App.tsx
+++ b/packages/templates/electron-app/apps/ui/src/App.tsx
@@ -9,7 +9,7 @@ const App: FC = () => {
electron-template
- electron + react 19 + tailwind v4 + shadcn
+ electron + react 19 + tailwind v4 + shadcn/ui (Base UI)