@tu-design/vue 0.3.0 → 0.4.1
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/README.md +74 -0
- package/dist/index.d.mts +641 -285
- package/dist/index.mjs +1544 -902
- package/dist/registry/vue/alert-dialog.json +22 -0
- package/dist/registry/vue/alert.json +1 -1
- package/dist/registry/vue/avatar-group.json +1 -1
- package/dist/registry/vue/avatar.json +1 -1
- package/dist/registry/vue/badge.json +1 -1
- package/dist/registry/vue/button.json +2 -2
- package/dist/registry/vue/calendar.json +3 -3
- package/dist/registry/vue/card.json +1 -1
- package/dist/registry/vue/cascader.json +5 -5
- package/dist/registry/vue/checkbox.json +1 -1
- package/dist/registry/vue/context-menu.json +22 -0
- package/dist/registry/vue/currency-input.json +2 -2
- package/dist/registry/vue/date-picker.json +2 -2
- package/dist/registry/vue/date-range-picker.json +3 -3
- package/dist/registry/vue/date-shared.json +16 -2
- package/dist/registry/vue/dialog.json +3 -3
- package/dist/registry/vue/drawer.json +22 -0
- package/dist/registry/vue/dropdown-menu.json +4 -4
- package/dist/registry/vue/empty.json +1 -1
- package/dist/registry/vue/form-render.json +35 -34
- package/dist/registry/vue/form.json +2 -2
- package/dist/registry/vue/input.json +1 -1
- package/dist/registry/vue/label.json +1 -1
- package/dist/registry/vue/month-picker.json +2 -2
- package/dist/registry/vue/number-input.json +2 -2
- package/dist/registry/vue/overlay-shared.json +20 -0
- package/dist/registry/vue/password-input.json +1 -1
- package/dist/registry/vue/pin-input.json +1 -1
- package/dist/registry/vue/popconfirm.json +22 -0
- package/dist/registry/vue/popover.json +3 -3
- package/dist/registry/vue/progress.json +1 -1
- package/dist/registry/vue/radio-group.json +1 -1
- package/dist/registry/vue/registry.json +31 -1
- package/dist/registry/vue/select.json +4 -4
- package/dist/registry/vue/separator.json +1 -1
- package/dist/registry/vue/skeleton.json +1 -1
- package/dist/registry/vue/slider.json +1 -1
- package/dist/registry/vue/slot.json +3 -3
- package/dist/registry/vue/spin.json +1 -1
- package/dist/registry/vue/switch.json +1 -1
- package/dist/registry/vue/table-render.json +39 -11
- package/dist/registry/vue/tabs.json +1 -1
- package/dist/registry/vue/textarea.json +1 -1
- package/dist/registry/vue/toast.json +3 -3
- package/dist/registry/vue/tokens.json +2 -1
- package/dist/registry/vue/tooltip.json +3 -3
- package/dist/registry/vue/tree-select.json +5 -5
- package/dist/registry/vue/tree-shared.json +13 -12
- package/dist/registry/vue/week-picker.json +2 -2
- package/dist/registry/vue/year-picker.json +2 -2
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @tu-design/vue
|
|
2
|
+
|
|
3
|
+
shadcn 风格的 Vue 3 组件库 —— Tailwind CSS v4 + oklch CSS 变量主题,基于 [Ark UI](https://ark-ui.com) 原语,组件源码通过 [`tu-design` CLI](../cli) 按 registry 分发到你的项目中。
|
|
4
|
+
|
|
5
|
+
- 文档站:<https://gopowerteam.github.io/tu-design/>
|
|
6
|
+
- 组件清单与用法示例见文档站 Components 章节,本 README 只覆盖接入方式。
|
|
7
|
+
|
|
8
|
+
## 分发模式
|
|
9
|
+
|
|
10
|
+
和 shadcn/ui 一样,**推荐用法不是安装本包**,而是把组件源码复制进你的项目:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx tu-design init # 初始化 components.json / tokens / cn 工具
|
|
14
|
+
npx tu-design add button # 添加组件源码到 src/components/ui/button/
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
源码进入你的项目后归你所有,可以直接修改;组件依赖的运行时只有 `clsx`、`tailwind-merge`、`class-variance-authority`(及组件自身声明的 Ark UI / TanStack 等 npm 依赖)。
|
|
18
|
+
|
|
19
|
+
作为 npm 包安装时,本包导出:
|
|
20
|
+
|
|
21
|
+
- `TuDesignResolver` — unplugin-vue 组件自动导入解析器
|
|
22
|
+
- `cn` — clsx + tailwind-merge 封装
|
|
23
|
+
- 全部组件(`TButton`、`TTabs`……)供直接 import 使用
|
|
24
|
+
|
|
25
|
+
## 前置要求
|
|
26
|
+
|
|
27
|
+
- Vue 3.5+
|
|
28
|
+
- Tailwind CSS 4(含 `@tailwindcss/vite` 插件)
|
|
29
|
+
- 构建工具中将 `@` 别名指向 `src`(registry 源码以 `@/lib/utils` 导入 `cn`)
|
|
30
|
+
|
|
31
|
+
## 主题
|
|
32
|
+
|
|
33
|
+
`src/styles/tokens.css` 定义 shadcn 风格的 CSS 变量(oklch)并通过 Tailwind v4 `@theme inline` 映射为工具类:
|
|
34
|
+
|
|
35
|
+
- `:root` / `.dark` 提供默认亮/暗主题
|
|
36
|
+
- 支持 `data-theme` 自定义品牌主题配方(详见文档站主题指南)
|
|
37
|
+
|
|
38
|
+
`tokens.css` 依赖 `tw-animate-css`,需一并安装。CLI 的 `init` / `add tokens` 会自动合并注入。
|
|
39
|
+
|
|
40
|
+
## 自动导入
|
|
41
|
+
|
|
42
|
+
配合 [unplugin-vue-components](https://github.com/unplugin/unplugin-vue-components):
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm add -D unplugin-vue-components
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// vite.config.ts
|
|
50
|
+
import Components from "unplugin-vue-components/vite";
|
|
51
|
+
import { TuDesignResolver } from "@tu-design/vue";
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
plugins: [Components({ resolvers: [TuDesignResolver()] })],
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
模板中可直接使用 `TButton` / `t-button`(`T` 前缀 + 组件名)。解析器按组件名白名单工作,`Transition`、`Teleport` 等 Vue 内置组件不会被误解析。
|
|
59
|
+
|
|
60
|
+
## Registry
|
|
61
|
+
|
|
62
|
+
`registry/vue/*.json` 是 CLI 分发的数据源(遵循 shadcn registry-item schema),由 `scripts/generate-registry.ts` 从组件源码生成并有防漂移测试保护。线上地址为 `https://gopowerteam.github.io/tu-design/r/vue`。
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
vp run generate:registry # 改动组件源码 / utils / tokens 后重新生成
|
|
66
|
+
vp test # 运行组件测试
|
|
67
|
+
vp run typecheck # vue-tsc 类型检查
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 相关
|
|
71
|
+
|
|
72
|
+
- [`@tu-design/cli`](../cli) — registry 分发 CLI
|
|
73
|
+
- 仓库:<https://github.com/gopowerteam/tu-design>
|
|
74
|
+
- 许可:MIT
|