Skip to content

Commit cfb0acf

Browse files
authored
Rename @halo-dev/console-shared to @halo-dev/ui-shared in docs (#524)
1 parent 714ff91 commit cfb0acf

18 files changed

+50
-39
lines changed

docs/developer-guide/plugin/api-changelog.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@ description: 记录每一个版本的插件 API 变更记录,方便开发者
55

66
## 2.22.0
77

8-
### `@halo-dev/console-shared` 工具库
8+
### `@halo-dev/console-shared` 改名
99

10-
在 2.22.0 中,Halo 在 `@halo-dev/console-shared` 包中提供一些常用工具,用于减少部分业务的开发工作量,目前提供:
10+
从 Halo 2.11 支持个人中心以后,插件的 UI 项目能同时扩展 Console 和 UC,所以为了避免歧义,我们在 Halo 2.22 中将 UI 的 `@halo-dev/console-shared` 依赖更名为 `@halo-dev/ui-shared`,虽然在 Halo 中兼容了旧版依赖,但仍然推荐使用新版依赖,迁移方案:
11+
12+
```bash
13+
pnpm uninstall @halo-dev/console-shared
14+
pnpm install @halo-dev/ui-shared
15+
```
16+
17+
然后在插件项目全局搜索 `@halo-dev/console-shared` 并替换为 `@halo-dev/ui-shared` 即可,同时需要将 `plugin.yaml``spec.requires` 字段修改为 `>=2.22.0`
18+
19+
### `@halo-dev/ui-shared` 工具库
20+
21+
在 2.22.0 中,Halo 在 `@halo-dev/ui-shared` 包中提供一些常用工具,用于减少部分业务的开发工作量,目前提供:
1122

1223
1. `stores`
1324
1. `currentUser`:用于获取当前用户信息
@@ -29,7 +40,7 @@ description: 记录每一个版本的插件 API 变更记录,方便开发者
2940
1. 升级依赖
3041

3142
```bash
32-
pnpm install @halo-dev/console-shared@2.22.0
43+
pnpm install @halo-dev/ui-shared@2.22.0
3344
```
3445

3546
2. 提升 [plugin.yaml#spec.requires](./basics/manifest.md#字段详解) 版本为 `>=2.22.0`

docs/developer-guide/plugin/api-reference/ui/shared.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: 共享工具库
3-
description: 介绍 @halo-dev/console-shared 包中的共享工具库
3+
description: 介绍 @halo-dev/ui-shared 包中的共享工具库
44
---
55

6-
从 Halo 2.22 开始,Halo 为插件的 UI 部分提供了共享的工具库并放置在了 `@halo-dev/console-shared` 中,利用这些工具,可以减少部分开发工作量。
6+
从 Halo 2.22 开始,Halo 为插件的 UI 部分提供了共享的工具库并放置在了 `@halo-dev/ui-shared` 中,利用这些工具,可以减少部分开发工作量。
77

8-
使用这些工具需要将插件项目的 `@halo-dev/console-shared` 依赖升级到 2.22.0。并在发布新版本插件时,将 [plugin.yaml#spec.requires](../../basics/manifest.md#字段详解) 提升到 `>=2.22.0`
8+
使用这些工具需要将插件项目的 `@halo-dev/ui-shared`(前 [@halo-dev/console-shared](../../api-changelog.md#halo-devconsole-shared-改名)依赖升级到 2.22.0。并在发布新版本插件时,将 [plugin.yaml#spec.requires](../../basics/manifest.md#字段详解) 提升到 `>=2.22.0`
99

1010
## stores
1111

@@ -21,7 +21,7 @@ pnpm install pinia
2121

2222
```vue title="ui/src/MyComponent.vue"
2323
<script lang="ts" setup>
24-
import { stores } from "@halo-dev/console-shared"
24+
import { stores } from "@halo-dev/ui-shared"
2525
import { storeToRefs } from "pinia"
2626
2727
const userStore = stores.currentUser()
@@ -55,7 +55,7 @@ const { currentUser, isAnonymous } = storeToRefs(stores.currentUser())
5555

5656
```vue title="ui/src/MyComponent.vue"
5757
<script lang="ts" setup>
58-
import { stores } from "@halo-dev/console-shared"
58+
import { stores } from "@halo-dev/ui-shared"
5959
import { storeToRefs } from "pinia"
6060
6161
const globalInfoStore = stores.globalInfo()
@@ -116,7 +116,7 @@ const { globalInfo } = storeToRefs(stores.globalInfo())
116116
**示例:**
117117

118118
```ts
119-
import { utils } from "@halo-dev/console-shared"
119+
import { utils } from "@halo-dev/ui-shared"
120120

121121
utils.date.format(new Date()) // "2025-11-05 14:30"
122122
utils.date.format("2025-10-22", "YYYY/MM/DD") // "2025/10/22"
@@ -136,7 +136,7 @@ utils.date.format(null) // ""
136136
**示例:**
137137

138138
```ts
139-
import { utils } from "@halo-dev/console-shared"
139+
import { utils } from "@halo-dev/ui-shared"
140140

141141
utils.date.toISOString(new Date("2025-10-22")) // "2025-10-22T00:00:00.000Z"
142142
```
@@ -154,7 +154,7 @@ utils.date.toISOString(new Date("2025-10-22")) // "2025-10-22T00:00:00.000Z"
154154
**示例:**
155155

156156
```ts
157-
import { utils } from "@halo-dev/console-shared"
157+
import { utils } from "@halo-dev/ui-shared"
158158

159159
utils.date.toDatetimeLocal(new Date("2025-10-22 14:30")) // "2025-10-22T14:30"
160160
```
@@ -172,7 +172,7 @@ utils.date.toDatetimeLocal(new Date("2025-10-22 14:30")) // "2025-10-22T14:30"
172172
**示例:**
173173

174174
```ts
175-
import { utils } from "@halo-dev/console-shared"
175+
import { utils } from "@halo-dev/ui-shared"
176176

177177
// 假设当前时间是 2025-10-22
178178
utils.date.timeAgo("2025-10-23") // "1 天后"
@@ -210,7 +210,7 @@ utils.date.timeAgo("2025-11-22") // "1 个月后"
210210
**示例:**
211211

212212
```ts
213-
import { utils } from "@halo-dev/console-shared"
213+
import { utils } from "@halo-dev/ui-shared"
214214

215215
// 检查是否拥有任意一个权限
216216
utils.permission.has(["core:posts:manage"], true) // true
@@ -237,7 +237,7 @@ utils.permission.has([
237237
**示例:**
238238

239239
```ts
240-
import { utils } from "@halo-dev/console-shared"
240+
import { utils } from "@halo-dev/ui-shared"
241241

242242
const permissions = utils.permission.getUserPermissions()
243243
console.log(permissions) // ["core:posts:manage", "core:attachments:view"]
@@ -270,7 +270,7 @@ console.log(permissions) // ["core:posts:manage", "core:attachments:view"]
270270
**示例:**
271271

272272
```ts
273-
import { utils } from "@halo-dev/console-shared"
273+
import { utils } from "@halo-dev/ui-shared"
274274

275275
// 本地图片
276276
utils.attachment.getThumbnailUrl("/uploads/image.jpg", "M")
@@ -294,7 +294,7 @@ utils.attachment.getThumbnailUrl("https://example.com/image.jpg", "S")
294294
**示例:**
295295

296296
```ts
297-
import { utils } from "@halo-dev/console-shared"
297+
import { utils } from "@halo-dev/ui-shared"
298298

299299
// 字符串 URL
300300
utils.attachment.getUrl("https://example.com/image.jpg")
@@ -332,7 +332,7 @@ interface AttachmentSimple {
332332
**示例:**
333333

334334
```ts
335-
import { utils } from "@halo-dev/console-shared"
335+
import { utils } from "@halo-dev/ui-shared"
336336

337337
// 字符串 URL
338338
utils.attachment.convertToSimple("https://example.com/image.jpg")
@@ -373,7 +373,7 @@ ID 生成工具,用于生成唯一且可排序的标识符。基于 [uuid](htt
373373
**示例:**
374374

375375
```ts
376-
import { utils } from "@halo-dev/console-shared"
376+
import { utils } from "@halo-dev/ui-shared"
377377

378378
const id = utils.id.uuid()
379379
console.log(id) // "018f1c2e-4fcb-7d04-9f21-1a2b3c4d5e6f"
@@ -390,7 +390,7 @@ const resourceId = utils.id.uuid()
390390

391391
```vue title="ui/src/MyComponent.vue"
392392
<script lang="ts" setup>
393-
import { events } from "@halo-dev/console-shared"
393+
import { events } from "@halo-dev/ui-shared"
394394
395395
// 监听事件
396396
events.on("core:plugin:configMap:updated", (data) => {

docs/developer-guide/plugin/basics/ui/build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Vite 和 Rsbuild 都是优秀的构建工具,但它们在不同的使用场景
213213
**动态导入示例:**
214214

215215
```typescript
216-
import { definePlugin } from '@halo-dev/console-shared';
216+
import { definePlugin } from '@halo-dev/ui-shared';
217217
import { defineAsyncComponent } from 'vue';
218218
import { VLoading } from '@halo-dev/components';
219219

docs/developer-guide/plugin/basics/ui/entry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: UI 扩展部分的入口文件
1010
## 定义入口文件
1111

1212
```ts title="ui/src/index.ts"
13-
import { definePlugin } from "@halo-dev/console-shared";
13+
import { definePlugin } from "@halo-dev/ui-shared";
1414

1515
export default definePlugin({
1616
components: {},

docs/developer-guide/plugin/extension-points/ui/attachment-list-item-operation-create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import OperationItem from "./interface/OperationItem.md";
4545
此示例将实现一个下载附件到本地的操作菜单项。
4646

4747
```ts
48-
import { definePlugin, type OperationItem } from "@halo-dev/console-shared";
48+
import { definePlugin, type OperationItem } from "@halo-dev/ui-shared";
4949
import { Toast, VDropdownItem } from "@halo-dev/components";
5050
import { markRaw, type Ref } from "vue";
5151
import type { Attachment } from "@halo-dev/api-client";

docs/developer-guide/plugin/extension-points/ui/attachment-selector-create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: 扩展附件选择组件的选项卡 - attachment:selector:create
1010
## 定义方式
1111

1212
```ts
13-
import { definePlugin, type AttachmentSelectProvider } from "@halo-dev/console-shared"
13+
import { definePlugin, type AttachmentSelectProvider } from "@halo-dev/ui-shared"
1414
import { markRaw } from "vue"
1515
import FooComponent from "./src/FooComponent.vue"
1616
export default definePlugin({
@@ -79,7 +79,7 @@ interface AttachmentSimple {
7979
import {
8080
definePlugin,
8181
type AttachmentSelectProvider,
82-
} from "@halo-dev/console-shared";
82+
} from "@halo-dev/ui-shared";
8383
import { markRaw } from "vue";
8484
import StickerSelectorProvider from "./components/StickerSelectorProvider.vue";
8585
@@ -102,7 +102,7 @@ export default definePlugin({
102102

103103
```vue title="StickerSelectorProvider.vue"
104104
<script lang="ts" setup>
105-
import type { AttachmentLike, AttachmentSimple } from '@halo-dev/console-shared';
105+
import type { AttachmentLike, AttachmentSimple } from '@halo-dev/ui-shared';
106106
import { ref } from 'vue';
107107
108108
const props = withDefaults(

docs/developer-guide/plugin/extension-points/ui/comment-list-item-operation-create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import OperationItem from "./interface/OperationItem.md";
4747
```ts
4848
import type { ListedComment } from "@halo-dev/api-client";
4949
import { VDropdownItem } from "@halo-dev/components";
50-
import { definePlugin } from "@halo-dev/console-shared";
50+
import { definePlugin } from "@halo-dev/ui-shared";
5151
import { markRaw } from "vue";
5252

5353
export default definePlugin({

docs/developer-guide/plugin/extension-points/ui/comment-subject-ref-create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export interface CommentSubjectRefResult {
6363
import {
6464
definePlugin,
6565
type CommentSubjectRefResult,
66-
} from "@halo-dev/console-shared";
66+
} from "@halo-dev/ui-shared";
6767
import { markRaw } from "vue";
6868
import type { Moment } from "@/types";
6969
import { formatDatetime } from "./utils/date";

docs/developer-guide/plugin/extension-points/ui/dashboard-widgets.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ description: 扩展仪表盘小部件 - console:dashboard:widgets:create
1717
### 定义方式
1818

1919
```ts
20-
import { definePlugin } from "@halo-dev/console-shared";
20+
import { definePlugin } from "@halo-dev/ui-shared";
2121
import { markRaw } from "vue";
2222
import MyCustomWidget from "./components/MyCustomWidget.vue";
2323

@@ -173,7 +173,7 @@ const emit = defineEmits<{
173173
### 定义方式
174174

175175
```ts
176-
import { definePlugin } from "@halo-dev/console-shared";
176+
import { definePlugin } from "@halo-dev/ui-shared";
177177
import { markRaw } from "vue";
178178
import { IconPlug } from "@halo-dev/components";
179179
import { useRouter } from "vue-router";
@@ -237,7 +237,7 @@ export default definePlugin({
237237
</template>
238238
239239
<script lang="ts" setup>
240-
import type { DashboardWidgetQuickActionItem } from "@halo-dev/console-shared";
240+
import type { DashboardWidgetQuickActionItem } from "@halo-dev/ui-shared";
241241
242242
defineProps<{
243243
item: DashboardWidgetQuickActionItem;

docs/developer-guide/plugin/extension-points/ui/editor-create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface EditorProvider {
5555
此示例将实现一个简单的 Markdown 编辑器。
5656

5757
```ts title="index.ts"
58-
import { definePlugin } from "@halo-dev/console-shared";
58+
import { definePlugin } from "@halo-dev/ui-shared";
5959
import { markRaw } from "vue";
6060
import MarkdownEditor from "./components/markdown-editor.vue";
6161

0 commit comments

Comments
 (0)