dishui 0.0.4 → 0.0.5

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 CHANGED
@@ -1,103 +1,73 @@
1
- # DiShUI
1
+ # DiShui UI 组件库
2
2
 
3
- 一个基于React的组件库。
4
-
5
- ## 特性
6
-
7
- - 基于React和TypeScript开发
8
- - 使用Vite构建
9
- - 支持按需导入
3
+ 一个基于React的vibe coding出来的UI组件库。
10
4
 
11
5
  ## 安装
12
6
 
13
- ### 在线安装 (通过 npm)
14
-
15
- 推荐使用包管理器进行在线安装:
16
-
17
7
  ```bash
18
- # 使用 pnpm
19
- pnpm add dishui
20
-
21
- # 使用 npm
22
8
  npm install dishui
23
-
24
- # 使用 yarn
9
+ # 或
25
10
  yarn add dishui
26
11
  ```
27
12
 
28
- ### 离线安装 (手动安装)
29
-
30
- 如果您无法访问 npm 仓库或者需要在离线环境中使用,可以进行手动安装:
31
-
32
- 1. **获取打包文件:**
33
- 在 `dishui` 项目根目录下执行打包命令:
34
- ```bash
35
- pnpm build
36
- ```
37
- 这将在项目根目录下生成一个 `dist` 文件夹,其中包含了打包后的 JavaScript 文件、CSS 样式文件以及 TypeScript 类型声明文件。
38
-
39
- 2. **复制文件:**
40
- 将整个 `dist` 文件夹复制到您需要使用该组件库的项目中,例如放到项目的 `src/libs/dishui` 目录下。
41
-
42
- 3. **在项目中使用:**
43
- 根据您复制的路径,在您的代码中直接引入组件和样式。
44
-
45
- ```jsx
46
- import React from 'react';
47
- // 假设您将 dist 文件夹复制到了 src/libs/dishui
48
- import { Button, Badge } from './libs/dishui/dishui.es.js'; // 或 .umd.js
49
- import './libs/dishui/style.css';
50
-
51
- function App() {
52
- return (
53
- <div>
54
- <Button variant="primary">点击我</Button>
55
- <Badge variant="success">新功能</Badge>
56
- </div>
57
- );
58
- }
59
- ```
13
+ ## 使用方法
60
14
 
61
- **注意:** 手动安装时,您需要自行处理 `react` 和 `react-dom` 这两个外部依赖。请确保您的项目中已经安装了兼容版本的 React。
15
+ ### 导入组件和样式
62
16
 
63
- ## 使用
64
-
65
- 确保在使用组件前引入必要的 CSS 样式:
66
-
67
- ```jsx
68
- import React from 'react';
69
- import { Button, Badge } from 'dishui';
70
- import 'dishui/dist/style.css'; // 引入样式文件
17
+ ```tsx
18
+ import React from "react";
19
+ import { Button, Badge } from "dishui";
20
+ import "dishui/dist/dishui.css"; // 导入样式文件
71
21
 
72
22
  function App() {
73
23
  return (
74
- <div>
75
- <Button variant="primary">点击我</Button>
76
- <Badge variant="success">新功能</Badge>
24
+ <div className="p-4">
25
+ <h1 className="text-2xl font-bold mb-4">DiShui UI 示例</h1>
26
+
27
+ <div className="flex gap-2 mb-4">
28
+ <Button>默认按钮</Button>
29
+ <Button variant="primary">主要按钮</Button>
30
+ <Button variant="secondary">次要按钮</Button>
31
+ <Button variant="accent">强调按钮</Button>
32
+ </div>
33
+
34
+ <div className="flex gap-2">
35
+ <Badge>默认</Badge>
36
+ <Badge variant="primary">主要</Badge>
37
+ <Badge variant="secondary">次要</Badge>
38
+ <Badge variant="accent">强调</Badge>
39
+ </div>
77
40
  </div>
78
41
  );
79
42
  }
43
+
44
+ export default App;
80
45
  ```
81
46
 
82
- ## 本地开发
47
+ ### 可用组件
48
+
49
+ - Button - 按钮组件
50
+ - Badge - 徽章组件
51
+ - Input - 输入框组件
52
+ - Label - 标签组件
53
+ - 更多组件持续添加中...
54
+
55
+ ## 开发
83
56
 
84
57
  ```bash
85
58
  # 安装依赖
86
- pnpm install
59
+ npm install
87
60
 
88
61
  # 启动开发服务器
89
- pnpm dev
90
-
91
- # 构建组件库
92
- pnpm build
93
- ```
62
+ npm run dev
94
63
 
95
- ## 组件列表
64
+ # 构建库
65
+ npm run build
96
66
 
97
- - Button - 按钮组件
98
- - Badge - 徽章组件
99
- - 更多组件开发中...
67
+ # 发布到npm
68
+ npm run publish:npm
69
+ ```
100
70
 
101
71
  ## 许可证
102
72
 
103
- MIT
73
+ ISC
@@ -0,0 +1 @@
1
+ export * from './types/src/index';
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare module 'dishui' {
2
+ export * from './dist/types/src/index';
3
+ }
package/package.json CHANGED
@@ -1,18 +1,26 @@
1
1
  {
2
2
  "name": "dishui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "一个基于React的vibe coding出来的UI组件库",
5
5
  "main": "dist/dishui.umd.js",
6
6
  "module": "dist/dishui.es.js",
7
- "types": "dist/types/index.d.ts",
7
+ "types": "dist/index.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "*": [
11
+ "dist/index.d.ts"
12
+ ]
13
+ }
14
+ },
8
15
  "style": "dist/dishui.css",
9
16
  "files": [
10
- "dist"
17
+ "dist",
18
+ "index.d.ts"
11
19
  ],
12
20
  "scripts": {
13
21
  "dev": "vite",
14
- "build": "vite build && tsc --emitDeclarationOnly",
15
- "build:types": "tsc --emitDeclarationOnly",
22
+ "build": "vite build && tsc --emitDeclarationOnly && node scripts/fix-types.js",
23
+ "build:types": "tsc --emitDeclarationOnly && node scripts/fix-types.js",
16
24
  "prepublishOnly": "npm run build",
17
25
  "publish:npm": "npm publish --access public",
18
26
  "prepare:types": "node scripts/prepare-types.js",