yx-web-sdk 0.0.4

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.
Files changed (100) hide show
  1. package/README.md +424 -0
  2. package/dist/AntdIcon-B0sjNvGu.mjs +307 -0
  3. package/dist/CloseOutlined-DDb89ei3.mjs +37 -0
  4. package/dist/_plugin-vue_export-helper-1tPrXgE0.mjs +10 -0
  5. package/dist/ait-person-popover/index.d.ts +3 -0
  6. package/dist/ait-person-popover/index.js +5 -0
  7. package/dist/ait-person-popover/index.vue.d.ts +39 -0
  8. package/dist/chat-card/index.d.ts +3 -0
  9. package/dist/chat-card/index.js +5 -0
  10. package/dist/chat-card/index.vue.d.ts +25 -0
  11. package/dist/chat-content/index.d.ts +3 -0
  12. package/dist/chat-content/index.js +5 -0
  13. package/dist/chat-content/index.vue.d.ts +51 -0
  14. package/dist/chat-page/index.d.ts +3 -0
  15. package/dist/chat-page/index.js +5 -0
  16. package/dist/chat-page/index.vue.d.ts +6 -0
  17. package/dist/chat-room/index.d.ts +3 -0
  18. package/dist/chat-room/index.js +5 -0
  19. package/dist/chat-room/index.vue.d.ts +9 -0
  20. package/dist/common-avatar/index.d.ts +3 -0
  21. package/dist/common-avatar/index.js +5 -0
  22. package/dist/common-avatar/index.vue.d.ts +17 -0
  23. package/dist/components/ait-person-popover/index.d.ts +3 -0
  24. package/dist/components/ait-person-popover/index.vue.d.ts +39 -0
  25. package/dist/components/chat-card/index.d.ts +3 -0
  26. package/dist/components/chat-card/index.vue.d.ts +25 -0
  27. package/dist/components/chat-content/composables/ait-person.d.ts +86 -0
  28. package/dist/components/chat-content/index.d.ts +3 -0
  29. package/dist/components/chat-content/index.vue.d.ts +51 -0
  30. package/dist/components/chat-page/index.d.ts +3 -0
  31. package/dist/components/chat-page/index.vue.d.ts +6 -0
  32. package/dist/components/chat-room/index.d.ts +3 -0
  33. package/dist/components/chat-room/index.vue.d.ts +9 -0
  34. package/dist/components/common-avatar/index.d.ts +3 -0
  35. package/dist/components/common-avatar/index.vue.d.ts +17 -0
  36. package/dist/components/icon-font/index.d.ts +47 -0
  37. package/dist/components/index-entry/index.d.ts +2 -0
  38. package/dist/components/index-entry/index.vue.d.ts +25 -0
  39. package/dist/components/index.d.ts +12 -0
  40. package/dist/components/list.d.ts +2 -0
  41. package/dist/components/members-sidebar/index.d.ts +3 -0
  42. package/dist/components/members-sidebar/index.vue.d.ts +4 -0
  43. package/dist/components/notice-box/index.d.ts +3 -0
  44. package/dist/components/notice-box/index.vue.d.ts +13 -0
  45. package/dist/components/server-channel-sidebar/index.d.ts +3 -0
  46. package/dist/components/server-channel-sidebar/index.vue.d.ts +18 -0
  47. package/dist/global.css +39 -0
  48. package/dist/icon-font/index.d.ts +47 -0
  49. package/dist/icon-font/index.js +7 -0
  50. package/dist/index/style.css +199 -0
  51. package/dist/index/style2.css +175 -0
  52. package/dist/index/style3.css +36 -0
  53. package/dist/index/style4.css +168 -0
  54. package/dist/index/style5.css +147 -0
  55. package/dist/index/style6.css +43 -0
  56. package/dist/index/style7.css +491 -0
  57. package/dist/index/style8.css +19 -0
  58. package/dist/index-3sSWCzxu.mjs +225 -0
  59. package/dist/index-4m4OVlx8.mjs +611 -0
  60. package/dist/index-CFI0URc5.mjs +135 -0
  61. package/dist/index-Dg8Q3cli.mjs +1092 -0
  62. package/dist/index-entry/index.d.ts +2 -0
  63. package/dist/index-entry/index.js +271 -0
  64. package/dist/index-entry/index.vue.d.ts +25 -0
  65. package/dist/index-entry/style.css +51 -0
  66. package/dist/index.d.ts +8 -0
  67. package/dist/index.vue_vue_type_script_setup_true_lang-DkMXpHkt.mjs +158 -0
  68. package/dist/index.vue_vue_type_style_index_0_lang-CfLKcYM9.mjs +102 -0
  69. package/dist/index.vue_vue_type_style_index_0_lang-CibeOmhP.mjs +407 -0
  70. package/dist/index.vue_vue_type_style_index_0_lang-CmfE8EVU.mjs +288 -0
  71. package/dist/index.vue_vue_type_style_index_0_lang-XiDTgYoZ.mjs +1012 -0
  72. package/dist/index.vue_vue_type_style_index_0_lang-Y-vyKHWz.mjs +36985 -0
  73. package/dist/members-sidebar/index.d.ts +3 -0
  74. package/dist/members-sidebar/index.js +5 -0
  75. package/dist/members-sidebar/index.vue.d.ts +4 -0
  76. package/dist/notice-box/index.d.ts +3 -0
  77. package/dist/notice-box/index.js +5 -0
  78. package/dist/notice-box/index.vue.d.ts +13 -0
  79. package/dist/plugin/index.d.ts +22 -0
  80. package/dist/resolver/index.d.ts +22 -0
  81. package/dist/resolver/index.es.js +36 -0
  82. package/dist/resolver/index.umd.js +40 -0
  83. package/dist/server-channel-sidebar/index.d.ts +3 -0
  84. package/dist/server-channel-sidebar/index.js +5 -0
  85. package/dist/server-channel-sidebar/index.vue.d.ts +18 -0
  86. package/dist/stores/channel.d.ts +114 -0
  87. package/dist/stores/global.d.ts +15 -0
  88. package/dist/stores/index.d.ts +7 -0
  89. package/dist/stores/qchat.d.ts +397 -0
  90. package/dist/stores/sdk.d.ts +48 -0
  91. package/dist/stores/server.d.ts +58 -0
  92. package/dist/stores/user.d.ts +9 -0
  93. package/dist/style.css +1359 -0
  94. package/dist/types/missing.d.ts +14 -0
  95. package/dist/utils/events.d.ts +7 -0
  96. package/dist/utils/index.d.ts +26 -0
  97. package/dist/utils/storage.d.ts +15 -0
  98. package/dist/yx-web-sdk.es.js +41593 -0
  99. package/dist/yx-web-sdk.umd.js +41590 -0
  100. package/package.json +191 -0
package/README.md ADDED
@@ -0,0 +1,424 @@
1
+ # yx-web-sdk
2
+
3
+ 一个基于 Vue 3 + TypeScript 的轻量级组件库
4
+
5
+ ## ✨ 特性
6
+
7
+ - 🚀 基于 Vue 3 + TypeScript 构建
8
+ - 📦 支持 ES Module 和 UMD 格式
9
+ - 🌲 支持按需加载(Tree Shaking)
10
+ - 💪 完整的 TypeScript 类型定义
11
+ - 🎨 支持自动导入组件和样式
12
+ - 📖 提供 VitePress 文档
13
+
14
+ ## 📦 安装
15
+
16
+ ```bash
17
+ # 使用 npm 安装
18
+ npm install yx-web-sdk
19
+
20
+ # 或使用 pnpm
21
+ pnpm add yx-web-sdk
22
+
23
+ # 或使用 yarn
24
+ yarn add yx-web-sdk
25
+ ```
26
+
27
+ ## 🚀 快速开始
28
+
29
+ ### 开发环境(使用源码)
30
+ 1. 在yx-web-sdk项目中使用 npm link,创建一个符号链接
31
+ 2. 在你的项目使用 npm link yx-web-sdk
32
+
33
+ 在开发组件库或本地调试时,使用 `development` 入口直接引用源码:
34
+ ```js
35
+ import { createApp } from 'vue'
36
+ // 开发环境:直接使用源码,支持热更新
37
+ import yxWebSdk from 'yx-web-sdk/development'
38
+ import App from './App.vue'
39
+
40
+ const app = createApp(App)
41
+ // 注册组件库
42
+ app.use(yxWebSdk)
43
+ app.mount('#app')
44
+ ```
45
+
46
+ ### 正式环境(使用打包产物)
47
+
48
+ 在生产环境或正式项目中,使用主入口引用打包后的代码:
49
+
50
+ ```js
51
+ import { createApp } from 'vue'
52
+ // 正式环境:使用打包后的代码
53
+ import yxWebSdk from 'yx-web-sdk'
54
+ // 引入全量样式
55
+ import 'yx-web-sdk/style.css'
56
+ import App from './App.vue'
57
+
58
+ const app = createApp(App)
59
+ // 注册组件库
60
+ app.use(yxWebSdk)
61
+ app.mount('#app')
62
+ ```
63
+
64
+ ## 📖 使用方式
65
+
66
+ ### 方式一:完整引入
67
+
68
+ 适合快速开发和原型设计,一次性引入所有组件:
69
+
70
+ ```js
71
+ import { createApp } from 'vue'
72
+ // 正式环境使用打包产物
73
+ import yxWebSdk from 'yx-web-sdk'
74
+ // 引入全量样式(包含所有组件样式)
75
+ import 'yx-web-sdk/style.css'
76
+ import App from './App.vue'
77
+
78
+ const app = createApp(App)
79
+ // 注册所有组件
80
+ app.use(yxWebSdk)
81
+ app.mount('#app')
82
+ ```
83
+
84
+ **开发环境完整引入:**
85
+
86
+ ```js
87
+ import { createApp } from 'vue'
88
+ // 开发环境使用源码
89
+ import yxWebSdk from 'yx-web-sdk/development'
90
+ // 引入全局样式
91
+ import 'yx-web-sdk/global.css'
92
+ import App from './App.vue'
93
+
94
+ const app = createApp(App)
95
+ app.use(yxWebSdk)
96
+ app.mount('#app')
97
+ ```
98
+
99
+ ### 方式二:按需引入(推荐)✨
100
+
101
+ 按需引入可以减少打包体积,只引入使用的组件:
102
+
103
+ #### 从主入口按需引入(支持 Tree Shaking)
104
+
105
+ ```js
106
+ // 正式环境:从主入口引入,支持 Tree Shaking
107
+ import { Input } from 'yx-web-sdk'
108
+ // 引入全局样式(包含 CSS 变量等基础样式)
109
+ import 'yx-web-sdk/global.css'
110
+ // 引入组件样式
111
+ import 'yx-web-sdk/input/style.css'
112
+ ```
113
+
114
+ 在 Vue 3 的 `<script setup>` 中使用:
115
+
116
+ ```vue
117
+ <script setup>
118
+ // 正式环境:按需引入组件
119
+ import { Input } from 'yx-web-sdk'
120
+ // 引入全局样式
121
+ import 'yx-web-sdk/global.css'
122
+ // 引入组件样式
123
+ import 'yx-web-sdk/input/style.css'
124
+ </script>
125
+
126
+ <template>
127
+ <Input placeholder="请输入内容" />
128
+ </template>
129
+ ```
130
+
131
+ #### 直接引入单个组件
132
+
133
+ ```js
134
+ // 正式环境:直接引入单个组件
135
+ import Input from 'yx-web-sdk/input'
136
+ // 引入全局样式
137
+ import 'yx-web-sdk/global.css'
138
+ // 引入组件样式
139
+ import 'yx-web-sdk/input/style.css'
140
+ ```
141
+
142
+ **开发环境按需引入:**
143
+
144
+ ```js
145
+ // 开发环境:使用 development 入口
146
+ import yxWebSdk from 'yx-web-sdk/development'
147
+ import 'yx-web-sdk/global.css'
148
+ ```
149
+
150
+ > **💡 提示:**
151
+ > - 按需引入时,使用 `'yx-web-sdk/global.css'` 引入全局样式(包含 CSS 变量等基础样式)
152
+ > - 使用 `'yx-web-sdk/style.css'` 引入全量样式(包含所有组件样式)
153
+ > - 按需引入时推荐使用 `global.css`,避免样式重复
154
+
155
+ ### 方式三:自动按需引入(最优雅)🎯
156
+
157
+ 这是**最推荐的方式**,像 Element Plus 一样,无需手动导入组件和样式!
158
+
159
+ #### 安装依赖
160
+
161
+ ```bash
162
+ npm install -D unplugin-vue-components
163
+ ```
164
+
165
+ #### 配置 Vite
166
+
167
+ ```ts
168
+ // vite.config.ts
169
+ import { defineConfig } from 'vite'
170
+ import vue from '@vitejs/plugin-vue'
171
+ import Components from 'unplugin-vue-components/vite'
172
+ import { YxWebSDKResolver } from 'yx-web-sdk'
173
+
174
+ export default defineConfig({
175
+ plugins: [
176
+ vue(),
177
+ Components({
178
+ resolvers: [
179
+ YxWebSDKResolver({
180
+ importStyle: true, // 自动导入样式
181
+ prefix: 'Yx', // 组件前缀,默认为 'Yx'
182
+ }),
183
+ ],
184
+ }),
185
+ ],
186
+ })
187
+ ```
188
+
189
+ #### 使用方式
190
+
191
+ 配置完成后,可以直接在模板中使用组件,无需任何导入语句!
192
+
193
+ ```vue
194
+ <template>
195
+ <!-- 组件和样式会自动导入 -->
196
+ <YxInput placeholder="请输入内容" />
197
+ </template>
198
+
199
+ <!-- 无需 script setup,组件和样式会自动导入 -->
200
+ ```
201
+
202
+ #### 高级配置
203
+
204
+ ```ts
205
+ YxWebSDKResolver({
206
+ importStyle: true, // 是否自动导入样式,默认: true
207
+ prefix: 'Yx', // 组件前缀,默认: 'Yx'
208
+ lib: 'yx-web-sdk', // 库名,默认: 'yx-web-sdk'
209
+ })
210
+ ```
211
+
212
+ ## 📋 组件列表
213
+
214
+ - **Input** - 输入框组件
215
+
216
+ 更多组件正在开发中...
217
+
218
+ ## 🛠️ 开发
219
+
220
+ ### 环境要求
221
+
222
+ - Node.js >= 18
223
+ - npm / pnpm / yarn
224
+
225
+ ### 开发命令
226
+
227
+ ```bash
228
+ # 安装依赖
229
+ npm install
230
+
231
+ # 启动开发环境(使用本地源码,端口 3000)
232
+ npm run dev
233
+
234
+ # 启动 Demo 应用(使用打包产物,端口 4000)
235
+ npm run dev:examples
236
+
237
+ # 构建组件库
238
+ npm run build
239
+
240
+ # 构建组件库 + 预览 Demo 应用
241
+ npm run preview
242
+
243
+ # 启动文档
244
+ npm run docs:dev
245
+
246
+ # 运行测试
247
+ npm test
248
+
249
+ # 代码检查
250
+ npm run lint
251
+
252
+ # 代码格式化
253
+ npm run format
254
+ ```
255
+
256
+ ### 项目结构
257
+
258
+ ```
259
+ yx-web-sdk/
260
+ ├── src/ # 组件库源码
261
+ │ ├── components/ # 组件目录
262
+ │ │ ├── input/ # Input 组件
263
+ │ │ └── index.ts # 组件导出
264
+ │ ├── resolver/ # 自动导入解析器
265
+ │ ├── plugin/ # Vite 插件
266
+ │ ├── styles/ # 全局样式
267
+ │ ├── stores/ # 状态管理
268
+ │ ├── utils/ # 工具函数
269
+ │ └── index.ts # 主入口
270
+ ├── test/ # 开发环境测试
271
+ │ ├── App.vue # 测试应用
272
+ │ └── vite.config.ts # 开发环境配置
273
+ ├── examples/ # Demo 应用
274
+ │ ├── App.vue # Demo 应用
275
+ │ └── vite.config.ts # Demo 应用配置
276
+ ├── dist/ # 构建产物
277
+ └── docs/ # 文档
278
+ ```
279
+
280
+ ### 开发环境说明
281
+
282
+ - **`npm run dev`** - 开发环境,端口 3000,使用 `test/` 文件夹,引用本地源码(`yx-web-sdk/development`),支持热更新
283
+ - **`npm run dev:examples`** - Demo 应用,端口 4000,使用 `examples/` 文件夹,引用打包产物(`yx-web-sdk`)
284
+ - **`npm run preview`** - 先构建再启动 Demo 应用,模拟真实使用场景
285
+
286
+ ## 📦 构建产物结构
287
+
288
+ ```
289
+ dist/
290
+ ├── style.css # 全量样式
291
+ ├── global.css # 全局样式(CSS 变量等)
292
+ ├── yx-web-sdk.es.js # ES Module 主入口
293
+ ├── yx-web-sdk.umd.js # UMD 主入口
294
+ ├── index.d.ts # 主入口类型定义
295
+ ├── input/ # Input 组件独立目录
296
+ │ ├── index.es.js # Input 组件 JS
297
+ │ └── style.css # Input 组件样式
298
+ └── components/ # TypeScript 类型定义
299
+ └── input/
300
+ └── index.d.ts # Input 类型定义
301
+ ```
302
+
303
+ ## 🌲 按需加载原理
304
+
305
+ ### Tree Shaking(JS 按需加载)
306
+
307
+ 组件库支持多种导入方式,都支持 Tree Shaking:
308
+
309
+ ```js
310
+ // 方式1: 从主入口导入(推荐用于多个组件)
311
+ import { Input } from 'yx-web-sdk'
312
+
313
+ // 方式2: 按需导入单个组件(推荐用于少量组件)
314
+ import Input from 'yx-web-sdk/input'
315
+
316
+ // 方式3: 自动导入(最优雅,无需手动导入)
317
+ <YxInput /> <!-- 自动导入组件和样式 -->
318
+ ```
319
+
320
+ 打包工具(Vite/Webpack)会通过 **Tree Shaking** 自动移除未使用的代码,只打包你使用的组件。
321
+
322
+ ### 样式按需加载
323
+
324
+ 每个组件都有独立的样式文件:
325
+
326
+ ```js
327
+ // 按需引入:先加载全局样式(包含 CSS 变量,不包含组件样式)
328
+ import 'yx-web-sdk/global.css'
329
+ // 再加载使用的组件样式
330
+ import 'yx-web-sdk/input/style.css'
331
+
332
+ // 或者使用全量样式(包含所有组件样式,适合完整引入)
333
+ import 'yx-web-sdk/style.css'
334
+ ```
335
+
336
+ ## ✨ 最佳实践
337
+
338
+ ### 🚀 推荐:自动导入(最优雅)
339
+
340
+ 对于新项目,强烈推荐使用自动导入方案:
341
+
342
+ ```bash
343
+ # 安装依赖
344
+ npm install -D unplugin-vue-components
345
+
346
+ # 配置 vite.config.ts
347
+ import { YxWebSDKResolver } from 'yx-web-sdk'
348
+ ```
349
+
350
+ 然后直接在模板中使用,无需任何导入!
351
+
352
+ ### 手动导入方案(备选)
353
+
354
+ **小项目(使用 1-2 个组件,按需引入):**
355
+
356
+ ```js
357
+ // 正式环境
358
+ import Input from 'yx-web-sdk/input'
359
+ import 'yx-web-sdk/global.css'
360
+ import 'yx-web-sdk/input/style.css'
361
+ ```
362
+
363
+ **中型项目(使用 3-5 个组件):**
364
+
365
+ ```js
366
+ // 正式环境
367
+ import { Input } from 'yx-web-sdk'
368
+ import 'yx-web-sdk/global.css'
369
+ // 或使用全量样式
370
+ import 'yx-web-sdk/style.css'
371
+ ```
372
+
373
+ **大型项目(使用多个组件,完整引入):**
374
+
375
+ ```js
376
+ // 正式环境
377
+ import yxWebSdk from 'yx-web-sdk'
378
+ import 'yx-web-sdk/style.css'
379
+ ```
380
+
381
+ ### 核心优势
382
+
383
+ - ✅ **零配置导入** - 像 Element Plus 一样优雅
384
+ - ✅ **自动样式导入** - 无需手动管理 CSS
385
+ - ✅ **Tree Shaking** - 只打包使用的组件
386
+ - ✅ **TypeScript 支持** - 完整的类型提示
387
+ - ✅ **热重载友好** - 开发体验极佳
388
+ - ✅ **打包体积最小** - 按需加载,无冗余代码
389
+
390
+ ## 🔧 环境区分
391
+
392
+ ### 开发环境
393
+
394
+ 在开发组件库或本地调试时,使用 `development` 入口:
395
+
396
+ ```js
397
+ // 开发环境:直接使用源码,支持热更新
398
+ import yxWebSdk from 'yx-web-sdk/development'
399
+ import 'yx-web-sdk/global.css'
400
+ ```
401
+
402
+ **特点:**
403
+ - ✅ 直接使用源码,无需构建
404
+ - ✅ 支持热更新
405
+ - ✅ 便于调试和开发
406
+
407
+ ### 正式环境
408
+
409
+ 在生产环境或正式项目中,使用主入口:
410
+
411
+ ```js
412
+ // 正式环境:使用打包后的代码
413
+ import yxWebSdk from 'yx-web-sdk'
414
+ import 'yx-web-sdk/style.css'
415
+ ```
416
+
417
+ **特点:**
418
+ - ✅ 使用优化后的打包产物
419
+ - ✅ 体积更小,性能更好
420
+ - ✅ 适合生产环境
421
+
422
+ ## 📄 License
423
+
424
+ MIT