officialblock 1.0.0 → 1.0.2

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 (42) hide show
  1. package/README.md +140 -5
  2. package/dist/official-block.cjs.js +186 -1
  3. package/dist/official-block.es.js +22627 -70
  4. package/dist/official-block.umd.js +186 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +12 -2
  7. package/src/App.vue +32 -82
  8. package/src/components/ArticleList/article.vue +73 -0
  9. package/src/components/ArticleList/contact.vue +95 -0
  10. package/src/components/ArticleList/index.vue +220 -48
  11. package/src/components/ArticleList/setting.vue +407 -0
  12. package/src/components/Button/index.vue +183 -0
  13. package/src/components/HeroSlide/index.ts +1 -0
  14. package/src/components/HeroSlide/index.vue +21 -3
  15. package/src/components/HeroSlide/type.ts +19 -0
  16. package/src/components/Media/index.vue +327 -0
  17. package/src/components/Operate/index.vue +74 -0
  18. package/src/components/RichTextEditor/RichTextEditor.vue +277 -0
  19. package/src/components/RichTextEditor/index.ts +7 -0
  20. package/src/components/ThemePreview/ThemePreview.vue +462 -0
  21. package/src/components/ThemePreview/index.ts +4 -0
  22. package/src/components/index.ts +14 -0
  23. package/src/composables/useTheme.ts +205 -0
  24. package/src/index.ts +26 -8
  25. package/src/main.ts +16 -1
  26. package/src/router/index.ts +84 -0
  27. package/src/style.css +0 -1
  28. package/src/styles/editor.scss +649 -0
  29. package/src/styles/test.scss +20 -0
  30. package/src/styles/variables.scss +639 -0
  31. package/src/types.ts +8 -0
  32. package/src/utils/common.ts +13 -0
  33. package/src/utils/theme.ts +335 -0
  34. package/src/views/Layout.vue +247 -0
  35. package/src/views/NotFound.vue +114 -0
  36. package/src/views/components/ArticleListDemo.vue +167 -0
  37. package/src/views/components/HeroSlideDemo.vue +353 -0
  38. package/src/views/components/RichTextEditorDemo.vue +53 -0
  39. package/src/views/components/ThemeDemo.vue +477 -0
  40. package/src/views/guide/Installation.vue +234 -0
  41. package/src/views/guide/Introduction.vue +174 -0
  42. package/src/views/guide/QuickStart.vue +265 -0
package/README.md CHANGED
@@ -1,6 +1,30 @@
1
1
  # OfficialBlock
2
2
 
3
- A Vue 3 article list component library.
3
+ 一个基于 Vue 3 + TypeScript 的组件库,提供高质量的 UI 组件。
4
+
5
+ ## 📖 文档
6
+
7
+ 本项目包含完整的在线文档系统,类似 Element Plus 官方文档的设计:
8
+
9
+ - **开发指南**:介绍、安装、快速开始
10
+ - **组件文档**:每个组件的详细使用说明和 API 文档
11
+ - **在线演示**:可交互的组件示例
12
+
13
+ ### 本地查看文档
14
+
15
+ ```bash
16
+ # 克隆项目
17
+ git clone <your-repo-url>
18
+ cd OfficialBlock
19
+
20
+ # 安装依赖
21
+ npm install
22
+
23
+ # 启动文档服务器
24
+ npm run dev
25
+
26
+ # 访问 http://localhost:5166
27
+ ```
4
28
 
5
29
  ## Installation
6
30
 
@@ -21,13 +45,29 @@ const app = createApp(App)
21
45
  app.use(OfficialBlock)
22
46
 
23
47
  // 现在可以在任何组件中使用
24
- // <ArticleList />
48
+ // <ArticleList model-value="test" />
25
49
  // <HeroSlide />
26
50
  ```
27
51
 
28
52
  ### 方式二:按需引入组件
29
53
 
30
54
  ```javascript
55
+ // Vue 3 Composition API
56
+ <template>
57
+ <div>
58
+ <ArticleList model-value="Hello" />
59
+ <HeroSlide />
60
+ </div>
61
+ </template>
62
+
63
+ <script setup>
64
+ import { ArticleList, HeroSlide } from 'officialblock'
65
+ import 'officialblock/style.css'
66
+ </script>
67
+ ```
68
+
69
+ ```javascript
70
+ // Vue 3 Options API
31
71
  import { ArticleList, HeroSlide } from 'officialblock'
32
72
  import 'officialblock/style.css'
33
73
 
@@ -35,6 +75,11 @@ export default {
35
75
  components: {
36
76
  ArticleList,
37
77
  HeroSlide
78
+ },
79
+ data() {
80
+ return {
81
+ articleValue: 'Hello World'
82
+ }
38
83
  }
39
84
  }
40
85
  ```
@@ -56,13 +101,103 @@ app.use(HeroSlidePlugin) // 只注册 HeroSlide 组件
56
101
  This package includes TypeScript definitions.
57
102
 
58
103
  ```typescript
59
- import type { ComponentProps, ComponentEmits, ComponentSlots } from 'officialblock'
104
+ import type {
105
+ ComponentProps,
106
+ ComponentEmits,
107
+ ComponentSlots,
108
+ HeroSlideProps,
109
+ HeroSlideEmits,
110
+ SlideItem
111
+ } from 'officialblock'
112
+
113
+ // 使用类型
114
+ const articleProps: ComponentProps = {
115
+ modelValue: 'Hello',
116
+ size: 'medium',
117
+ disabled: false
118
+ }
119
+
120
+ const heroProps: HeroSlideProps = {
121
+ autoPlayInterval: 5000,
122
+ showIndicators: true,
123
+ autoPlay: true
124
+ }
60
125
  ```
61
126
 
62
127
  ## Components
63
128
 
64
- - **ArticleList**: 文章列表组件
65
- - **HeroSlide**: 轮播图组件
129
+ ### ArticleList 文章列表组件
130
+
131
+ ```vue
132
+ <template>
133
+ <ArticleList
134
+ v-model="articleValue"
135
+ size="medium"
136
+ :disabled="false"
137
+ @change="handleChange"
138
+ >
139
+ <template #header="{ title }">
140
+ <h3>{{ title }}</h3>
141
+ </template>
142
+ <template #default="{ value }">
143
+ <p>当前值: {{ value }}</p>
144
+ </template>
145
+ </ArticleList>
146
+ </template>
147
+
148
+ <script setup>
149
+ import { ref } from 'vue'
150
+ import { ArticleList } from 'officialblock'
151
+
152
+ const articleValue = ref('Hello World')
153
+
154
+ const handleChange = (value) => {
155
+ console.log('值改变了:', value)
156
+ }
157
+ </script>
158
+ ```
159
+
160
+ **Props:**
161
+ - `modelValue`: 双向绑定的值
162
+ - `size`: 组件尺寸 (`'small' | 'medium' | 'large'`)
163
+ - `disabled`: 是否禁用
164
+
165
+ **Events:**
166
+ - `change`: 值改变时触发
167
+ - `update:modelValue`: v-model 更新事件
168
+
169
+ **Slots:**
170
+ - `default`: 默认内容插槽
171
+ - `header`: 头部内容插槽
172
+
173
+ ### HeroSlide 轮播图组件
174
+
175
+ ```vue
176
+ <template>
177
+ <HeroSlide
178
+ :auto-play-interval="5000"
179
+ :show-indicators="true"
180
+ :auto-play="true"
181
+ @change="handleSlideChange"
182
+ />
183
+ </template>
184
+
185
+ <script setup>
186
+ import { HeroSlide } from 'officialblock'
187
+
188
+ const handleSlideChange = (index) => {
189
+ console.log('切换到第', index + 1, '张')
190
+ }
191
+ </script>
192
+ ```
193
+
194
+ **Props:**
195
+ - `autoPlayInterval`: 自动播放间隔时间(毫秒),默认 3000
196
+ - `showIndicators`: 是否显示指示器,默认 true
197
+ - `autoPlay`: 是否启用自动播放,默认 true
198
+
199
+ **Events:**
200
+ - `change`: 幻灯片切换时触发
66
201
 
67
202
  ## Development
68
203