@blocklet/ui-react 3.4.14 → 3.5.0
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/lib/common/org-switch/use-org.d.ts +4 -4
- package/lib/common/ws.d.ts +22 -1
- package/package.json +10 -7
- package/.aigne/doc-smith/.local/afs-storage.sqlite3 +0 -0
- package/.aigne/doc-smith/config.yaml +0 -78
- package/.aigne/doc-smith/history.yaml +0 -14
- package/.aigne/doc-smith/media-description.yaml +0 -11
- package/.aigne/doc-smith/output/structure-plan.json +0 -255
- package/.aigne/doc-smith/translation-cache.yaml +0 -11
- package/.aigne/doc-smith/upload-cache.yaml +0 -528
- package/build.config.ts +0 -24
- package/docs/_sidebar.md +0 -19
- package/docs/assets/diagram/component-installer-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh.jpg +0 -0
- package/docs/components-component-management-blocklet-studio.ja.md +0 -194
- package/docs/components-component-management-blocklet-studio.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh-TW.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh.md +0 -194
- package/docs/components-component-management-component-installer.ja.md +0 -182
- package/docs/components-component-management-component-installer.md +0 -182
- package/docs/components-component-management-component-installer.zh-TW.md +0 -182
- package/docs/components-component-management-component-installer.zh.md +0 -182
- package/docs/components-component-management.ja.md +0 -30
- package/docs/components-component-management.md +0 -30
- package/docs/components-component-management.zh-TW.md +0 -30
- package/docs/components-component-management.zh.md +0 -30
- package/docs/components-layout-dashboard.ja.md +0 -185
- package/docs/components-layout-dashboard.md +0 -187
- package/docs/components-layout-dashboard.zh-TW.md +0 -185
- package/docs/components-layout-dashboard.zh.md +0 -185
- package/docs/components-layout-footer.ja.md +0 -165
- package/docs/components-layout-footer.md +0 -165
- package/docs/components-layout-footer.zh-TW.md +0 -165
- package/docs/components-layout-footer.zh.md +0 -165
- package/docs/components-layout-header.ja.md +0 -183
- package/docs/components-layout-header.md +0 -183
- package/docs/components-layout-header.zh-TW.md +0 -183
- package/docs/components-layout-header.zh.md +0 -183
- package/docs/components-layout.ja.md +0 -31
- package/docs/components-layout.md +0 -31
- package/docs/components-layout.zh-TW.md +0 -31
- package/docs/components-layout.zh.md +0 -31
- package/docs/components-notifications.ja.md +0 -125
- package/docs/components-notifications.md +0 -125
- package/docs/components-notifications.zh-TW.md +0 -125
- package/docs/components-notifications.zh.md +0 -125
- package/docs/components-user-management-user-center.ja.md +0 -148
- package/docs/components-user-management-user-center.md +0 -147
- package/docs/components-user-management-user-center.zh-TW.md +0 -148
- package/docs/components-user-management-user-center.zh.md +0 -148
- package/docs/components-user-management-user-sessions.ja.md +0 -121
- package/docs/components-user-management-user-sessions.md +0 -123
- package/docs/components-user-management-user-sessions.zh-TW.md +0 -121
- package/docs/components-user-management-user-sessions.zh.md +0 -121
- package/docs/components-user-management.ja.md +0 -49
- package/docs/components-user-management.md +0 -51
- package/docs/components-user-management.zh-TW.md +0 -49
- package/docs/components-user-management.zh.md +0 -49
- package/docs/components-utilities-icon.ja.md +0 -106
- package/docs/components-utilities-icon.md +0 -106
- package/docs/components-utilities-icon.zh-TW.md +0 -106
- package/docs/components-utilities-icon.zh.md +0 -106
- package/docs/components-utilities.ja.md +0 -136
- package/docs/components-utilities.md +0 -136
- package/docs/components-utilities.zh-TW.md +0 -136
- package/docs/components-utilities.zh.md +0 -136
- package/docs/components.ja.md +0 -27
- package/docs/components.md +0 -27
- package/docs/components.zh-TW.md +0 -27
- package/docs/components.zh.md +0 -27
- package/docs/core-concepts.ja.md +0 -134
- package/docs/core-concepts.md +0 -135
- package/docs/core-concepts.zh-TW.md +0 -134
- package/docs/core-concepts.zh.md +0 -134
- package/docs/getting-started.ja.md +0 -132
- package/docs/getting-started.md +0 -132
- package/docs/getting-started.zh-TW.md +0 -132
- package/docs/getting-started.zh.md +0 -132
- package/docs/hooks-api.ja.md +0 -214
- package/docs/hooks-api.md +0 -214
- package/docs/hooks-api.zh-TW.md +0 -214
- package/docs/hooks-api.zh.md +0 -214
- package/docs/how-to-guides.ja.md +0 -413
- package/docs/how-to-guides.md +0 -413
- package/docs/how-to-guides.zh-TW.md +0 -413
- package/docs/how-to-guides.zh.md +0 -413
- package/docs/overview.ja.md +0 -51
- package/docs/overview.md +0 -51
- package/docs/overview.zh-TW.md +0 -51
- package/docs/overview.zh.md +0 -51
- package/glossary.md +0 -12
- package/src/@types/index.ts +0 -230
- package/src/@types/shims.d.ts +0 -18
- package/src/BlockletStudio/README.md +0 -116
- package/src/BlockletStudio/index.tsx +0 -145
- package/src/ComponentInstaller/ComponentInstaller.stories.jsx +0 -16
- package/src/ComponentInstaller/index.jsx +0 -207
- package/src/ComponentInstaller/installer-item.jsx +0 -129
- package/src/ComponentInstaller/locales.js +0 -22
- package/src/ComponentInstaller/use-component-installed.js +0 -88
- package/src/ComponentManager/components/add-component.tsx +0 -136
- package/src/ComponentManager/components/check-component.tsx +0 -3
- package/src/ComponentManager/components/publish-component.tsx +0 -90
- package/src/ComponentManager/components/resource-dialog.tsx +0 -91
- package/src/ComponentManager/index.tsx +0 -3
- package/src/ComponentManager/libs/locales.ts +0 -15
- package/src/Dashboard/Dashboard.stories.jsx +0 -20
- package/src/Dashboard/app-shell/app-badge.stories.tsx +0 -64
- package/src/Dashboard/app-shell/app-badge.tsx +0 -94
- package/src/Dashboard/app-shell/app-header.tsx +0 -104
- package/src/Dashboard/app-shell/app-info-context.tsx +0 -182
- package/src/Dashboard/app-shell/badges/app-badge-default.tsx +0 -130
- package/src/Dashboard/app-shell/badges/app-badge-did.tsx +0 -28
- package/src/Dashboard/app-shell/badges/app-badge-state.tsx +0 -40
- package/src/Dashboard/app-shell/badges/app-badge-switch.tsx +0 -72
- package/src/Dashboard/app-shell/badges/app-badge-version.tsx +0 -60
- package/src/Dashboard/app-shell/index.ts +0 -5
- package/src/Dashboard/index.jsx +0 -184
- package/src/Footer/Footer.stories.jsx +0 -33
- package/src/Footer/brand.jsx +0 -81
- package/src/Footer/copyright.jsx +0 -22
- package/src/Footer/index.jsx +0 -111
- package/src/Footer/internal-footer.jsx +0 -139
- package/src/Footer/layout/plain.jsx +0 -55
- package/src/Footer/layout/row.jsx +0 -43
- package/src/Footer/layout/standard.jsx +0 -114
- package/src/Footer/links.jsx +0 -321
- package/src/Footer/social-media.jsx +0 -55
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/index.tsx +0 -259
- package/src/Icon/Icon.stories.jsx +0 -12
- package/src/Icon/index.tsx +0 -87
- package/src/Notifications/Snackbar.tsx +0 -261
- package/src/Notifications/hooks/use-title.tsx +0 -254
- package/src/Notifications/hooks/use-width.tsx +0 -16
- package/src/Notifications/utils.ts +0 -246
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/config-inviter.tsx +0 -48
- package/src/UserCenter/components/config-profile.tsx +0 -99
- package/src/UserCenter/components/danger-zone.tsx +0 -82
- package/src/UserCenter/components/editable-field.tsx +0 -273
- package/src/UserCenter/components/fallback.tsx +0 -57
- package/src/UserCenter/components/nft-preview.tsx +0 -84
- package/src/UserCenter/components/nft.tsx +0 -279
- package/src/UserCenter/components/notification.tsx +0 -319
- package/src/UserCenter/components/passport.tsx +0 -107
- package/src/UserCenter/components/privacy.tsx +0 -120
- package/src/UserCenter/components/settings.tsx +0 -170
- package/src/UserCenter/components/status-dialog/date-picker.tsx +0 -77
- package/src/UserCenter/components/status-dialog/index.tsx +0 -293
- package/src/UserCenter/components/status-selector/duration-menu.tsx +0 -90
- package/src/UserCenter/components/status-selector/index.tsx +0 -58
- package/src/UserCenter/components/status-selector/menu-item.tsx +0 -56
- package/src/UserCenter/components/storage/action.tsx +0 -49
- package/src/UserCenter/components/storage/connected.tsx +0 -61
- package/src/UserCenter/components/storage/delete.tsx +0 -72
- package/src/UserCenter/components/storage/disconnect.tsx +0 -40
- package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -1
- package/src/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/src/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/src/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/src/UserCenter/components/storage/index.tsx +0 -41
- package/src/UserCenter/components/storage/preview-nft.tsx +0 -72
- package/src/UserCenter/components/third-party-login/index.tsx +0 -199
- package/src/UserCenter/components/third-party-login/third-party-item.tsx +0 -296
- package/src/UserCenter/components/user-center.tsx +0 -787
- package/src/UserCenter/components/user-info/address.tsx +0 -143
- package/src/UserCenter/components/user-info/index.tsx +0 -4
- package/src/UserCenter/components/user-info/link-preview-input.tsx +0 -274
- package/src/UserCenter/components/user-info/metadata.tsx +0 -658
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +0 -43
- package/src/UserCenter/components/user-info/social-actions/follow.tsx +0 -23
- package/src/UserCenter/components/user-info/social-actions/index.tsx +0 -17
- package/src/UserCenter/components/user-info/switch-role.tsx +0 -42
- package/src/UserCenter/components/user-info/timezone-select.tsx +0 -119
- package/src/UserCenter/components/user-info/user-basic-info.tsx +0 -292
- package/src/UserCenter/components/user-info/user-info-item.tsx +0 -54
- package/src/UserCenter/components/user-info/user-info.tsx +0 -91
- package/src/UserCenter/components/user-info/user-status.tsx +0 -234
- package/src/UserCenter/components/user-info/utils.ts +0 -320
- package/src/UserCenter/components/webhook-item.tsx +0 -248
- package/src/UserCenter/index.tsx +0 -1
- package/src/UserCenter/libs/locales.ts +0 -378
- package/src/UserCenter/libs/utils.ts +0 -30
- package/src/UserSessions/components/user-session-info.tsx +0 -78
- package/src/UserSessions/components/user-sessions.tsx +0 -545
- package/src/UserSessions/index.tsx +0 -1
- package/src/UserSessions/libs/locales.ts +0 -60
- package/src/UserSessions/libs/utils.ts +0 -82
- package/src/blocklets.js +0 -195
- package/src/common/domain-warning.jsx +0 -178
- package/src/common/header-addons.jsx +0 -119
- package/src/common/link-blocker.jsx +0 -20
- package/src/common/notification-addon.jsx +0 -135
- package/src/common/org-switch/avatar-uploader.jsx +0 -271
- package/src/common/org-switch/create.jsx +0 -267
- package/src/common/org-switch/index.jsx +0 -407
- package/src/common/org-switch/locales.js +0 -52
- package/src/common/org-switch/use-org.jsx +0 -79
- package/src/common/overridable-theme-provider.jsx +0 -17
- package/src/common/wallet-hidden-topbar.js +0 -14
- package/src/common/wizard-modal.jsx +0 -200
- package/src/common/ws.js +0 -68
- package/src/contexts/config-user-space.tsx +0 -88
- package/src/contexts/user-followers.tsx +0 -54
- package/src/hooks/use-follow.tsx +0 -75
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -16
- package/src/libs/constant.ts +0 -1
- package/src/libs/spaces.tsx +0 -18
- package/src/libs/with-hide-when-embed.tsx +0 -24
- package/src/types.js +0 -45
- package/src/utils.js +0 -161
- package/vite.config.mjs +0 -34
package/docs/how-to-guides.zh.md
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
# 操作指南
|
|
2
|
-
|
|
3
|
-
本节提供了使用该库的组件完成常见任务和实现特定工作流的实用分步指南。每个指南都设计为一套独立的操作说明,旨在帮助您高效地实现特定目标。
|
|
4
|
-
|
|
5
|
-
<x-cards data-columns="2">
|
|
6
|
-
<x-card data-title="如何向 Header 添加自定义元素" data-icon="lucide:layout-template" data-href="#how-to-add-custom-elements-to-the-header">
|
|
7
|
-
学习如何使用 `addons` 渲染属性来扩展 `Header` 组件,添加自定义按钮、导航或其他交互元素。
|
|
8
|
-
</x-card>
|
|
9
|
-
<x-card data-title="如何处理可选组件依赖" data-icon="lucide:puzzle" data-href="#how-to-handle-optional-component-dependencies">
|
|
10
|
-
实现一个工作流,提示管理员按需安装所需组件,确保您的 Blocklet 功能顺利运行。
|
|
11
|
-
</x-card>
|
|
12
|
-
<x-card data-title="如何实现实时用户通知" data-icon="lucide:bell-ring" data-href="#how-to-implement-real-time-user-notifications">
|
|
13
|
-
使用 WebSockets 建立一个实时通知系统,让用户随时了解应用内的重要事件。
|
|
14
|
-
</x-card>
|
|
15
|
-
<x-card data-title="如何使用 BlockletStudio 发布资源" data-icon="lucide:rocket" data-href="#how-to-publish-resources-with-blockletstudio">
|
|
16
|
-
集成 `BlockletStudio` 组件,为发布和管理资源及依赖组件提供用户界面。
|
|
17
|
-
</x-card>
|
|
18
|
-
</x-cards>
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 如何向 Header 添加自定义元素
|
|
23
|
-
|
|
24
|
-
`Header` 组件被设计为可扩展的。您可以利用 `addons` 属性,直接在页眉中添加自定义按钮、搜索栏或其他 React 组件。
|
|
25
|
-
|
|
26
|
-
### 目标
|
|
27
|
-
|
|
28
|
-
在主应用页眉中添加一个自定义的“聊天”按钮、一个搜索输入框以及其他操作图标。
|
|
29
|
-
|
|
30
|
-
### 前提条件
|
|
31
|
-
|
|
32
|
-
- 一个已安装 `@arcblock/ux` 库并能正常运行的 React 应用。
|
|
33
|
-
- 一个已有的 `<Header>` 组件实例。更多信息,请参阅 [Header 组件文档](./components-layout-header.md)。
|
|
34
|
-
|
|
35
|
-
### 步骤
|
|
36
|
-
|
|
37
|
-
`addons` 属性接受一个渲染函数。该函数接收默认插件(如会话管理器)作为其第一个参数,让您能够决定将自定义元素放置在默认元素的相对位置。
|
|
38
|
-
|
|
39
|
-
1. **定义 `addons` 渲染属性**
|
|
40
|
-
|
|
41
|
-
在您的 `Header` 组件中,向 `addons` 属性传递一个函数。该函数应返回您想要渲染的 JSX。
|
|
42
|
-
|
|
43
|
-
```jsx
|
|
44
|
-
<Header
|
|
45
|
-
meta={meta}
|
|
46
|
-
addons={(defaultAddons, { navigation }) => {
|
|
47
|
-
// 您的自定义组件将放在这里
|
|
48
|
-
return (
|
|
49
|
-
<>
|
|
50
|
-
{/* 渲染您的自定义组件 */}
|
|
51
|
-
{defaultAddons}
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
2. **添加自定义组件**
|
|
59
|
-
|
|
60
|
-
在渲染函数内部,您可以添加任何您需要的组件。在此示例中,我们将添加一个标准的 Material-UI `Button`、几个用于图标的 `AddonButton` 组件和一个 `Divider`。
|
|
61
|
-
|
|
62
|
-
3. **与默认插件结合**
|
|
63
|
-
|
|
64
|
-
通常的做法是渲染传入函数的 `defaultAddons`。这可以确保像区域设置切换器和会话管理器这样的基本元素仍然显示。您可以将自定义组件放置在 `defaultAddons` 之前或之后。
|
|
65
|
-
|
|
66
|
-
### 完整示例
|
|
67
|
-
|
|
68
|
-
以下是一个完整的示例,演示了如何向页眉添加多个自定义元素。这包括导航、按钮和图标,它们与默认的会话管理器一起渲染。
|
|
69
|
-
|
|
70
|
-
```javascript How to Add Custom Elements to the Header icon=logos:react
|
|
71
|
-
import { Box, Divider, Button } from '@mui/material';
|
|
72
|
-
import { SessionContext } from '@arcblock/did-connect-react/lib/Session';
|
|
73
|
-
import { AddonButton } from '@arcblock/ux/lib/Header/addon-button';
|
|
74
|
-
import NavMenu from '@arcblock/ux/lib/NavMenu';
|
|
75
|
-
import SessionManager from '@arcblock/ux/lib/SessionManager';
|
|
76
|
-
import Header from '@arcblock/ux/lib/Header';
|
|
77
|
-
import { Icon } from '@iconify/react';
|
|
78
|
-
|
|
79
|
-
// 用于演示的模拟数据
|
|
80
|
-
const mockBlockletMeta = {
|
|
81
|
-
title: 'My App',
|
|
82
|
-
description: 'A great application',
|
|
83
|
-
logoUrl: 'https://www.arcblock.io/image-bin/uploads/eb1cf5d60cd85c42362920c49e3768cb.svg'
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const mockSessionContextValue = {
|
|
87
|
-
session: {
|
|
88
|
-
user: {
|
|
89
|
-
fullName: 'Demo User',
|
|
90
|
-
did: 'z1ex...',
|
|
91
|
-
role: 'admin',
|
|
92
|
-
},
|
|
93
|
-
// ... 其他会话属性
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default function CustomHeaderGuide() {
|
|
98
|
-
const meta = {
|
|
99
|
-
...mockBlockletMeta,
|
|
100
|
-
enableConnect: true,
|
|
101
|
-
enableLocale: true,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<SessionContext.Provider value={mockSessionContextValue}>
|
|
106
|
-
<Header
|
|
107
|
-
meta={meta}
|
|
108
|
-
homeLink="https://www.arcblock.io"
|
|
109
|
-
addons={(defaultAddons, { navigation }) => (
|
|
110
|
-
<>
|
|
111
|
-
{/* 1. 添加自定义导航 */}
|
|
112
|
-
{navigation.navItems?.length > 0 && (
|
|
113
|
-
<NavMenu
|
|
114
|
-
activeId={navigation.activeId}
|
|
115
|
-
items={navigation.navItems}
|
|
116
|
-
className="header-nav"
|
|
117
|
-
/>
|
|
118
|
-
)}
|
|
119
|
-
{/* 2. 添加自定义按钮 */}
|
|
120
|
-
<Button variant="contained" color="primary" size="small">
|
|
121
|
-
Button
|
|
122
|
-
</Button>
|
|
123
|
-
{/* 3. 添加自定义图标按钮 */}
|
|
124
|
-
<AddonButton icon={<Icon icon="tabler:message-circle" />}>Chat</AddonButton>
|
|
125
|
-
<AddonButton icon={<Icon icon="tabler:bell" />} />
|
|
126
|
-
<Divider orientation="vertical" flexItem sx={{ height: 12, alignSelf: 'center' }} />
|
|
127
|
-
{/* 4. 渲染默认插件(包括会话管理器) */}
|
|
128
|
-
{defaultAddons}
|
|
129
|
-
</>
|
|
130
|
-
)}
|
|
131
|
-
/>
|
|
132
|
-
</SessionContext.Provider>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## 如何处理可选组件依赖
|
|
140
|
-
|
|
141
|
-
许多 Blocklet 依赖其他组件来提供特定功能。`ComponentInstaller` 允许您构建依赖于可选组件的功能,如果这些组件未安装,它会为管理员提供一个用户友好的安装方式。
|
|
142
|
-
|
|
143
|
-
### 目标
|
|
144
|
-
|
|
145
|
-
保护一个需要安装其他 Blocklet 组件才能使用的功能。如果该组件缺失,管理员将看到一个安装界面,而其他用户则什么也看不到。
|
|
146
|
-
|
|
147
|
-
### 前提条件
|
|
148
|
-
|
|
149
|
-
- 您的应用中有一个依赖于其他组件的功能(例如,一个需要“媒体套件”Blocklet 的“媒体管理器”)。
|
|
150
|
-
- 组件依赖项的 DID。
|
|
151
|
-
- 熟悉用户角色(`owner`、`admin`)。
|
|
152
|
-
|
|
153
|
-
### 步骤
|
|
154
|
-
|
|
155
|
-
1. **导入 `ComponentInstaller`**
|
|
156
|
-
|
|
157
|
-
首先,从库中导入该组件。
|
|
158
|
-
|
|
159
|
-
```javascript
|
|
160
|
-
import ComponentInstaller from '@arcblock/ux/lib/ComponentInstaller';
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
2. **包裹您的功能**
|
|
164
|
-
|
|
165
|
-
用 `ComponentInstaller` 包裹具有依赖项的组件或功能。
|
|
166
|
-
|
|
167
|
-
3. **提供组件 DID**
|
|
168
|
-
|
|
169
|
-
将所需组件的 DID 传递给 `did` 属性。如果存在多个依赖项,这可以是一个字符串,也可以是一个字符串数组。
|
|
170
|
-
|
|
171
|
-
4. **为非管理员配置行为**
|
|
172
|
-
|
|
173
|
-
使用 `noPermissionMute` 属性。当设置为 `true` 时,没有权限安装组件的用户(即非管理员)将不会看到安装提示。您可以提供一个 `fallback` 组件来替代显示。
|
|
174
|
-
|
|
175
|
-
### 完整示例
|
|
176
|
-
|
|
177
|
-
在此场景中,我们有一个 `MyFeatureButton`,它只应在 DID 为 `z8ia...` 的组件安装后才渲染。
|
|
178
|
-
|
|
179
|
-
```javascript How to Handle Optional Component Dependencies icon=logos:react
|
|
180
|
-
import ComponentInstaller from '@arcblock/ux/lib/ComponentInstaller';
|
|
181
|
-
import { Button } from '@mui/material';
|
|
182
|
-
|
|
183
|
-
const REQUIRED_COMPONENT_DID = 'z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9'; // 示例 DID
|
|
184
|
-
|
|
185
|
-
// 这是需要依赖项的组件
|
|
186
|
-
function MyFeatureButton() {
|
|
187
|
-
return <Button variant="contained">Use Awesome Feature</Button>;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export default function OptionalComponentGuide() {
|
|
191
|
-
return (
|
|
192
|
-
<ComponentInstaller
|
|
193
|
-
// 要检查的组件的 DID
|
|
194
|
-
did={REQUIRED_COMPONENT_DID}
|
|
195
|
-
// 允许查看安装程序 UI 的角色列表
|
|
196
|
-
roles={['owner', 'admin']}
|
|
197
|
-
// 如果为 true,非管理员将看不到安装程序 UI
|
|
198
|
-
noPermissionMute
|
|
199
|
-
// 可选:如果组件未安装,向非管理员显示的内容
|
|
200
|
-
fallback={<div>This feature is not available.</div>}
|
|
201
|
-
// 成功安装后触发的回调
|
|
202
|
-
onInstalled={() => console.log('Component was installed successfully!')}
|
|
203
|
-
>
|
|
204
|
-
{/* 只有在组件已安装的情况下才会渲染此子组件 */}
|
|
205
|
-
<MyFeatureButton />
|
|
206
|
-
</ComponentInstaller>
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
当管理员访问此页面且组件未安装时,他们会看到一个允许他们安装的弹出窗口。普通用户将看到回退消息。一旦安装,所有用户都将看到 `MyFeatureButton`。
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
## 如何实现实时用户通知
|
|
216
|
-
|
|
217
|
-
您可以通过监听来自 Blocklet Server 的 WebSocket 事件,为用户提供实时反馈和通知。`NotificationAddon` 组件是一个即用型解决方案,用于在页眉中显示未读通知计数。
|
|
218
|
-
|
|
219
|
-
### 目标
|
|
220
|
-
|
|
221
|
-
在应用页眉中添加一个通知铃铛图标,该图标会显示带有未读通知数量的徽章,并实时更新。
|
|
222
|
-
|
|
223
|
-
### 前提条件
|
|
224
|
-
|
|
225
|
-
- 您的 Blocklet 必须运行在支持通知服务的 Blocklet Server 版本上(`1.16.42` 或更高)。
|
|
226
|
-
- 一个用于放置通知图标的 `<Header>` 组件。
|
|
227
|
-
- 一个提供用户信息的会话上下文。
|
|
228
|
-
|
|
229
|
-
### 关键概念
|
|
230
|
-
|
|
231
|
-
- **WebSocket 事件**:当通知被创建或读取时,Blocklet Server 会广播事件。
|
|
232
|
-
- **`useListenWsClient`**:一个用于获取特定频道(例如 'user')的 WebSocket 客户端实例的钩子。
|
|
233
|
-
- **事件命名**:事件的作用域限定于用户和 Blocklet。新通知的格式为 `${blocklet.did}/${user.did}/notification:blocklet:create`。
|
|
234
|
-
|
|
235
|
-
### 步骤
|
|
236
|
-
|
|
237
|
-
`NotificationAddon` 组件封装了监听 WebSocket 事件和显示未读计数所需的所有逻辑。
|
|
238
|
-
|
|
239
|
-
1. **导入 `NotificationAddon`**
|
|
240
|
-
|
|
241
|
-
```javascript
|
|
242
|
-
import NotificationAddon from '@arcblock/ux/lib/common/notification-addon';
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
2. **添加到 Header `addons`**
|
|
246
|
-
|
|
247
|
-
使用此组件最简单的方法是将其添加到 `Header` 的 `addons` 渲染属性中。
|
|
248
|
-
|
|
249
|
-
3. **传递会话对象**
|
|
250
|
-
|
|
251
|
-
`NotificationAddon` 组件需要 `session` 对象来识别当前用户并管理未读计数状态。
|
|
252
|
-
|
|
253
|
-
### 完整示例
|
|
254
|
-
|
|
255
|
-
此示例展示了如何将 `NotificationAddon` 集成到 `Header` 中。它将自动连接到 WebSocket,监听事件,并更新徽章计数。
|
|
256
|
-
|
|
257
|
-
```javascript How to Implement Real-time User Notifications icon=logos:react
|
|
258
|
-
import { SessionContext } from '@arcblock/did-connect-react/lib/Session';
|
|
259
|
-
import Header from '@arcblock/ux/lib/Header';
|
|
260
|
-
import NotificationAddon from '@arcblock/ux/lib/common/notification-addon';
|
|
261
|
-
|
|
262
|
-
// 用于演示的模拟数据
|
|
263
|
-
const mockBlockletMeta = {
|
|
264
|
-
title: 'My App',
|
|
265
|
-
description: 'A great application',
|
|
266
|
-
logoUrl: 'https://www.arcblock.io/image-bin/uploads/eb1cf5d60cd85c42362920c49e3768cb.svg'
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const mockSessionContextValue = {
|
|
270
|
-
session: {
|
|
271
|
-
user: {
|
|
272
|
-
fullName: 'Demo User',
|
|
273
|
-
did: 'z1ex...',
|
|
274
|
-
role: 'admin',
|
|
275
|
-
},
|
|
276
|
-
unReadCount: 3, // 初始未读计数
|
|
277
|
-
setUnReadCount: () => {}, // 状态设置函数
|
|
278
|
-
// ... 其他会话属性
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
export default function NotificationGuide() {
|
|
283
|
-
const meta = { ...mockBlockletMeta, enableConnect: true };
|
|
284
|
-
|
|
285
|
-
return (
|
|
286
|
-
<SessionContext.Provider value={mockSessionContextValue}>
|
|
287
|
-
<Header
|
|
288
|
-
meta={meta}
|
|
289
|
-
addons={(defaultAddons) => (
|
|
290
|
-
<>
|
|
291
|
-
{/* NotificationAddon 将处理实时更新 */}
|
|
292
|
-
<NotificationAddon session={mockSessionContextValue.session} />
|
|
293
|
-
{defaultAddons}
|
|
294
|
-
</>
|
|
295
|
-
)}
|
|
296
|
-
/>
|
|
297
|
-
</SessionContext.Provider>
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
当为已登录用户创建新通知时,铃铛图标上的徽章计数将自动增加。点击该图标将导航用户到他们的通知页面。
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## 如何使用 BlockletStudio 发布资源
|
|
307
|
-
|
|
308
|
-
`BlockletStudio` 组件提供了一个完整的、可嵌入的 UI,用于发布资源和组件。它处理用户连接、资源选择和发布流程,将一个复杂的工作流简化为一个单一的组件。
|
|
309
|
-
|
|
310
|
-
### 目标
|
|
311
|
-
|
|
312
|
-
添加一个按钮,该按钮可以打开一个对话框,允许用户从 Blocklet 中选择并发布文件和依赖组件。
|
|
313
|
-
|
|
314
|
-
### 前提条件
|
|
315
|
-
|
|
316
|
-
- 您的 Blocklet 中有一个 API 端点,用于返回可用资源列表。
|
|
317
|
-
- 提供发布 UI 的组件(“工作室”组件)的 DID。
|
|
318
|
-
|
|
319
|
-
### 步骤
|
|
320
|
-
|
|
321
|
-
1. **导入 `BlockletStudio` 并管理状态**
|
|
322
|
-
|
|
323
|
-
您需要使用组件状态来管理工作室对话框的可见性。
|
|
324
|
-
|
|
325
|
-
```javascript
|
|
326
|
-
import { useState } from 'react';
|
|
327
|
-
import { BlockletStudio } from '@arcblock/ux/lib/BlockletStudio';
|
|
328
|
-
import { Button, CircularProgress } from '@mui/material';
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
2. **渲染组件**
|
|
332
|
-
|
|
333
|
-
将 `<BlockletStudio />` 组件放置在您的应用中,并使用 `open` 和 `setOpen` 属性控制其可见性。
|
|
334
|
-
|
|
335
|
-
3. **配置基本属性**
|
|
336
|
-
|
|
337
|
-
- `componentDid`:提供发布服务的工作室 Blocklet 的 DID。
|
|
338
|
-
- `title`、`description`:正在发布的项目的元数据。
|
|
339
|
-
- `resourcesParams`:作为查询参数传递给您的资源获取 API 的对象。
|
|
340
|
-
- `components`:要预选或必须包含的组件数组。
|
|
341
|
-
- `resources`:指定要预选的资源的对象。
|
|
342
|
-
|
|
343
|
-
4. **处理生命周期事件**
|
|
344
|
-
|
|
345
|
-
使用 `onOpened`、`onUploaded` 和 `onReleased` 回调来响应发布生命周期中的事件,例如隐藏加载指示器或显示成功消息。
|
|
346
|
-
|
|
347
|
-
### 完整示例
|
|
348
|
-
|
|
349
|
-
此示例展示了一个按钮,点击后会打开 `BlockletStudio` 对话框。它还演示了如何管理加载状态以提供更好的用户体验。
|
|
350
|
-
|
|
351
|
-
```javascript How to Publish Resources with BlockletStudio icon=logos:react
|
|
352
|
-
import { useState } from 'react';
|
|
353
|
-
import { Button, CircularProgress } from '@mui/material';
|
|
354
|
-
import { BlockletStudio } from '@arcblock/ux/lib/BlockletStudio';
|
|
355
|
-
|
|
356
|
-
// 提供工作室/发布 UI 的 Blocklet 的 DID
|
|
357
|
-
const AI_STUDIO_COMPONENT_DID = 'z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9'; // 示例 DID
|
|
358
|
-
|
|
359
|
-
export default function PublisherGuide() {
|
|
360
|
-
const [isStudioOpen, setStudioOpen] = useState(false);
|
|
361
|
-
const [isOpening, setOpening] = useState(false);
|
|
362
|
-
|
|
363
|
-
const handleShowDialog = () => {
|
|
364
|
-
setOpening(true);
|
|
365
|
-
setStudioOpen(true);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
return (
|
|
369
|
-
<>
|
|
370
|
-
<Button
|
|
371
|
-
variant="contained"
|
|
372
|
-
onClick={handleShowDialog}
|
|
373
|
-
disabled={isOpening}
|
|
374
|
-
startIcon={isOpening ? <CircularProgress size={16} /> : null}>
|
|
375
|
-
Publish to Studio
|
|
376
|
-
</Button>
|
|
377
|
-
|
|
378
|
-
<BlockletStudio
|
|
379
|
-
// 控制对话框的可见性
|
|
380
|
-
open={isStudioOpen}
|
|
381
|
-
setOpen={setStudioOpen}
|
|
382
|
-
// 已发布项目的基本信息
|
|
383
|
-
title="My Demo Project"
|
|
384
|
-
description="This is a project published from my blocklet."
|
|
385
|
-
// 工作室服务组件的 DID
|
|
386
|
-
componentDid={AI_STUDIO_COMPONENT_DID}
|
|
387
|
-
// 发送到您的 Blocklet 资源 API 的参数
|
|
388
|
-
resourcesParams={{ projectId: 'test-project-123' }}
|
|
389
|
-
// 预选组件
|
|
390
|
-
components={[
|
|
391
|
-
{ did: 'z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ', included: true, required: true },
|
|
392
|
-
{ did: 'z2qZyjnsRffFtn2PDnDwDHTRbAu53RpKqDtFZ', included: true, required: false },
|
|
393
|
-
]}
|
|
394
|
-
// 预选资源
|
|
395
|
-
resources={{
|
|
396
|
-
// 键是资源提供者 Blocklet 的 DID
|
|
397
|
-
z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB: [
|
|
398
|
-
'template-448698592710885376',
|
|
399
|
-
'example-448698592710885376',
|
|
400
|
-
],
|
|
401
|
-
}}
|
|
402
|
-
// 事件处理程序
|
|
403
|
-
onOpened={() => setOpening(false)}
|
|
404
|
-
onUploaded={() => alert('Upload complete!')}
|
|
405
|
-
onReleased={() => {
|
|
406
|
-
alert('Successfully released!');
|
|
407
|
-
setStudioOpen(false);
|
|
408
|
-
}}
|
|
409
|
-
/>
|
|
410
|
-
</>
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
```
|
package/docs/overview.ja.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# 概要
|
|
2
|
-
|
|
3
|
-
`@blocklet/ui-react`ライブラリは、Blockletと呼ばれるアプリケーションの開発を加速するために設計された、必須のReactコンポーネントのコレクションを提供します。これは、Blockletのメタデータをインテリジェントに使用することで、一般的なユーザーインターフェース要素の作成を合理化し、開発者が最小限の労力で一貫性のある機能豊富なUIを構築できるようにします。
|
|
4
|
-
|
|
5
|
-
このライブラリは、Material-UIのテーマ付き拡張である`@arcblock/ux`を基盤として構築されています。この基盤により、すべてのコンポーネントが堅牢で、アクセシビリティが高く、アプリケーションのブランディングに合わせて簡単にカスタマイズできることが保証されます。
|
|
6
|
-
|
|
7
|
-
## 解決する課題
|
|
8
|
-
|
|
9
|
-
現代のWebアプリケーションでは、レイアウト、ユーザー管理、通知のために標準的なUIコンポーネントのセットがしばしば必要とされます。これらをプロジェクトごとにゼロから実装するのは時間がかかり、一貫性の欠如につながる可能性があります。Blocklet UI Reactライブラリは、Blockletのメタデータ(`blocklet.yml`)に基づいて自動的に設定される、事前に構築されたコンポーネントを提供することで、この問題に対処します。
|
|
10
|
-
|
|
11
|
-
このメタデータ駆動のアプローチは、アプリケーション名、ロゴ、ナビゲーションリンク、テーマカラーなどの要素がコンポーネント全体に自動的に適用されることを意味し、定型的なコードを大幅に削減し、ブランドの一貫性を確保します。
|
|
12
|
-
|
|
13
|
-
## コアアーキテクチャ
|
|
14
|
-
|
|
15
|
-
このライブラリのアーキテクチャは、シンプルさと自動化を目的として設計されています。`Header`や`Footer`のようなコンポーネントがレンダリングされると、`window.blocklet`オブジェクトから設定データを読み取ります。このオブジェクトは、Blocklet Serverによって`blocklet.yml`ファイルから読み込まれます。これにより、UIの構造とブランディングを中央の設定ファイルで定義でき、コンポーネントはそれに応じて適応します。
|
|
16
|
-
|
|
17
|
-
<!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
|
|
18
|
-

|
|
19
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
20
|
-
|
|
21
|
-
## 主な機能
|
|
22
|
-
|
|
23
|
-
- **メタデータ駆動:** `blocklet.yml`で定義されたBlockletの名前、ロゴ、ナビゲーション構造を使用して、`Header`や`Footer`などのコンポーネントを自動的に設定します。
|
|
24
|
-
- **統合されたセッション管理:** コンポーネントはDID Connectセッションとシームレスに統合し、ユーザープロファイル情報、セッションコントロール、およびナビゲーションリンクへのロールベースのアクセスを自動的に表示します。
|
|
25
|
-
- **レスポンシブレイアウト:** `Dashboard`のような強力なレイアウトコンポーネントが含まれており、管理インターフェースのためのレスポンシブな構造をすぐに提供します。
|
|
26
|
-
- **コンポーネント管理:** `ComponentInstaller`や`BlockletStudio`などのツールを提供し、Blockletエコシステム内での依存関係やリソースの管理を支援します。
|
|
27
|
-
|
|
28
|
-
## コアコンポーネント
|
|
29
|
-
|
|
30
|
-
ライブラリはいくつかの主要なモジュールに整理されており、それぞれがアプリケーションUIの特定の領域に対応しています。
|
|
31
|
-
|
|
32
|
-
<x-cards data-columns="2">
|
|
33
|
-
<x-card data-title="Layout" data-icon="lucide:layout-template" data-href="/components/layout">
|
|
34
|
-
Header、Footer、Dashboardのような主要コンポーネントで、Blockletアプリケーションの主要な構造を形成します。
|
|
35
|
-
</x-card>
|
|
36
|
-
<x-card data-title="User Management" data-icon="lucide:users" data-href="/components/user-management">
|
|
37
|
-
ユーザープロファイル、セッション管理、組織の切り替えを処理するための一連のコンポーネント。
|
|
38
|
-
</x-card>
|
|
39
|
-
<x-card data-title="Component Management" data-icon="lucide:box" data-href="/components/component-management">
|
|
40
|
-
アプリケーション内でBlockletコンポーネントを動的にインストール、公開、管理するためのツール。
|
|
41
|
-
</x-card>
|
|
42
|
-
<x-card data-title="Utilities" data-icon="lucide:wrench" data-href="/components/utilities">
|
|
43
|
-
多機能なIconコンポーネントやテーマプロバイダーなど、ヘルパーコンポーネントとユーティリティのコレクション。
|
|
44
|
-
</x-card>
|
|
45
|
-
</x-cards>
|
|
46
|
-
|
|
47
|
-
## まとめ
|
|
48
|
-
|
|
49
|
-
`@blocklet/ui-react`ライブラリを活用することで、開発時間を大幅に短縮し、アプリケーション独自の機能に集中することができます。メタデータ駆動のアプローチは一貫性を確保し、一般的なUI要素の管理を簡素化します。
|
|
50
|
-
|
|
51
|
-
アプリケーションの構築を開始するには、[はじめに](./getting-started.md)ガイドに進み、ライブラリのインストールと最初のコンポーネントのレンダリングに関するステップバイステップのチュートリアルをご覧ください。
|
package/docs/overview.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Overview
|
|
2
|
-
|
|
3
|
-
The `@blocklet/ui-react` library provides a collection of essential React components designed to accelerate the development of applications, known as Blocklets. It streamlines the creation of common user interface elements by intelligently using the blocklet's metadata, enabling developers to build consistent and feature-rich UIs with minimal effort.
|
|
4
|
-
|
|
5
|
-
This library is built upon `@arcblock/ux`, which is a themed extension of Material-UI. This foundation ensures that all components are robust, accessible, and easily customizable to fit your application's branding.
|
|
6
|
-
|
|
7
|
-
## The Problem It Solves
|
|
8
|
-
|
|
9
|
-
Modern web applications often require a standard set of UI components for layout, user management, and notifications. Implementing these from scratch for every project is time-consuming and can lead to inconsistencies. The Blocklet UI React library addresses this by providing pre-built components that automatically configure themselves based on your blocklet's metadata (`blocklet.yml`).
|
|
10
|
-
|
|
11
|
-
This metadata-driven approach means that elements like your application's name, logo, navigation links, and theme colors are automatically applied across components, drastically reducing boilerplate code and ensuring brand consistency.
|
|
12
|
-
|
|
13
|
-
## Core Architecture
|
|
14
|
-
|
|
15
|
-
The library's architecture is designed for simplicity and automation. When a component like `Header` or `Footer` is rendered, it reads configuration data from the `window.blocklet` object, which is populated by the Blocklet Server from your `blocklet.yml` file. This allows you to define your UI's structure and branding in a central configuration file, and the components adapt accordingly.
|
|
16
|
-
|
|
17
|
-
<!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
|
|
18
|
-

|
|
19
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
20
|
-
|
|
21
|
-
## Key Features
|
|
22
|
-
|
|
23
|
-
- **Metadata-Driven:** Automatically configures components like `Header` and `Footer` using your blocklet's name, logo, and navigation structure defined in `blocklet.yml`.
|
|
24
|
-
- **Integrated Session Management:** Components seamlessly integrate with DID Connect sessions, automatically displaying user profile information, session controls, and role-based access to navigation links.
|
|
25
|
-
- **Responsive Layouts:** Includes powerful layout components like `Dashboard` that provide a responsive structure for administrative interfaces out of the box.
|
|
26
|
-
- **Component Management:** Offers tools like `ComponentInstaller` and `BlockletStudio` to help manage dependencies and resources within the Blocklet ecosystem.
|
|
27
|
-
|
|
28
|
-
## Core Components
|
|
29
|
-
|
|
30
|
-
The library is organized into several key modules, each addressing a specific area of application UI.
|
|
31
|
-
|
|
32
|
-
<x-cards data-columns="2">
|
|
33
|
-
<x-card data-title="Layout" data-icon="lucide:layout-template" data-href="/components/layout">
|
|
34
|
-
Primary components like Header, Footer, and Dashboard that form the main structure of a blocklet application.
|
|
35
|
-
</x-card>
|
|
36
|
-
<x-card data-title="User Management" data-icon="lucide:users" data-href="/components/user-management">
|
|
37
|
-
A suite of components for handling user profiles, session management, and organization switching.
|
|
38
|
-
</x-card>
|
|
39
|
-
<x-card data-title="Component Management" data-icon="lucide:box" data-href="/components/component-management">
|
|
40
|
-
Tools for dynamically installing, publishing, and managing blocklet components within an application.
|
|
41
|
-
</x-card>
|
|
42
|
-
<x-card data-title="Utilities" data-icon="lucide:wrench" data-href="/components/utilities">
|
|
43
|
-
A collection of helper components and utilities, such as a versatile Icon component and theme providers.
|
|
44
|
-
</x-card>
|
|
45
|
-
</x-cards>
|
|
46
|
-
|
|
47
|
-
## Summary
|
|
48
|
-
|
|
49
|
-
By leveraging the `@blocklet/ui-react` library, you can significantly reduce development time and focus on your application's unique features. The metadata-driven approach ensures consistency and simplifies the management of common UI elements.
|
|
50
|
-
|
|
51
|
-
To start building your application, proceed to the [Getting Started](./getting-started.md) guide for a step-by-step tutorial on installing the library and rendering your first components.
|
package/docs/overview.zh-TW.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# 概覽
|
|
2
|
-
|
|
3
|
-
`@blocklet/ui-react` 程式庫提供了一系列必要的 React 元件,旨在加速應用程式(稱為 Blocklet)的開發。它透過智慧地使用 blocklet 的元資料,簡化了通用使用者介面元素的建立過程,讓開發者能以最少的精力建構出一致且功能豐富的使用者介面。
|
|
4
|
-
|
|
5
|
-
此程式庫建構於 `@arcblock/ux` 之上,後者是 Material-UI 的主題化擴充。這個基礎確保了所有元件都堅固、易於存取且易於自訂,以符合您應用程式的品牌形象。
|
|
6
|
-
|
|
7
|
-
## 解決的問題
|
|
8
|
-
|
|
9
|
-
現代 Web 應用程式通常需要一套標準的 UI 元件來進行佈局、使用者管理和通知。為每個專案從頭開始實作這些元件既耗時又可能導致不一致。Blocklet UI React 程式庫透過提供預先建構的元件來解決此問題,這些元件會根據您的 blocklet 元資料(`blocklet.yml`)自動進行設定。
|
|
10
|
-
|
|
11
|
-
這種由元資料驅動的方法意味著,諸如您應用程式的名稱、標誌、導覽連結和主題顏色等元素會自動應用於所有元件,從而大幅減少樣板程式碼並確保品牌一致性。
|
|
12
|
-
|
|
13
|
-
## 核心架構
|
|
14
|
-
|
|
15
|
-
此程式庫的架構設計旨在簡潔與自動化。當 `Header` 或 `Footer` 等元件被渲染時,它會從 `window.blocklet` 物件中讀取設定資料,該物件由 Blocklet Server 從您的 `blocklet.yml` 檔案中填入。這讓您可以在一個中央設定檔中定義 UI 的結構和品牌,而元件會相應地進行調整。
|
|
16
|
-
|
|
17
|
-
<!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
|
|
18
|
-

|
|
19
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
20
|
-
|
|
21
|
-
## 主要特色
|
|
22
|
-
|
|
23
|
-
- **元資料驅動:** 使用您在 `blocklet.yml` 中定義的 blocklet 名稱、標誌和導覽結構,自動設定 `Header` 和 `Footer` 等元件。
|
|
24
|
-
- **整合式階段作業管理:** 元件與 DID Connect 階段作業無縫整合,自動顯示使用者個人資料資訊、階段作業控制,以及基於角色的導覽連結存取權限。
|
|
25
|
-
- **響應式佈局:** 包含強大的佈局元件,如 `Dashboard`,可立即為管理介面提供響應式結構。
|
|
26
|
-
- **元件管理:** 提供 `ComponentInstaller` 和 `BlockletStudio` 等工具,以協助在 Blocklet 生態系統中管理相依性和資源。
|
|
27
|
-
|
|
28
|
-
## 核心元件
|
|
29
|
-
|
|
30
|
-
此程式庫分為幾個關鍵模組,每個模組處理應用程式 UI 的特定領域。
|
|
31
|
-
|
|
32
|
-
<x-cards data-columns="2">
|
|
33
|
-
<x-card data-title="佈局" data-icon="lucide:layout-template" data-href="/components/layout">
|
|
34
|
-
構成 blocklet 應用程式主要結構的核心元件,如 Header、Footer 和 Dashboard。
|
|
35
|
-
</x-card>
|
|
36
|
-
<x-card data-title="使用者管理" data-icon="lucide:users" data-href="/components/user-management">
|
|
37
|
-
一套用於處理使用者個人資料、階段作業管理和組織切換的元件。
|
|
38
|
-
</x-card>
|
|
39
|
-
<x-card data-title="元件管理" data-icon="lucide:box" data-href="/components/component-management">
|
|
40
|
-
用於在應用程式內動態安裝、發布和管理 blocklet 元件的工具。
|
|
41
|
-
</x-card>
|
|
42
|
-
<x-card data-title="公用程式" data-icon="lucide:wrench" data-href="/components/utilities">
|
|
43
|
-
一系列輔助元件和公用程式,例如多功能的圖示元件和主題提供者。
|
|
44
|
-
</x-card>
|
|
45
|
-
</x-cards>
|
|
46
|
-
|
|
47
|
-
## 總結
|
|
48
|
-
|
|
49
|
-
透過利用 `@blocklet/ui-react` 程式庫,您可以大幅縮短開發時間,並專注於應用程式的獨特功能。由元資料驅動的方法確保了一致性,並簡化了通用 UI 元素的管理。
|
|
50
|
-
|
|
51
|
-
要開始建構您的應用程式,請參閱 [入門指南](./getting-started.md),以取得安裝程式庫和渲染第一個元件的逐步教學。
|
package/docs/overview.zh.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# 概述
|
|
2
|
-
|
|
3
|
-
`@blocklet/ui-react` 库提供了一系列核心 React 组件,旨在加速 Blocklet 应用程序的开发。它通过智能地利用 blocklet 的元数据来简化通用用户界面元素的创建,使开发人员能够以最少的工作量构建一致且功能丰富的 UI。
|
|
4
|
-
|
|
5
|
-
该库基于 `@arcblock/ux` 构建,后者是 Material-UI 的一个主题扩展。这一基础确保了所有组件都功能强大、易于访问,并且可以轻松定制以适应您的应用程序品牌。
|
|
6
|
-
|
|
7
|
-
## 它解决的问题
|
|
8
|
-
|
|
9
|
-
现代 Web 应用程序通常需要一套标准的 UI 组件用于布局、用户管理和通知。为每个项目从头开始实施这些组件非常耗时,并可能导致不一致性。Blocklet UI React 库通过提供预构建的组件来解决这个问题,这些组件会根据您的 blocklet 元数据(`blocklet.yml`)自动进行配置。
|
|
10
|
-
|
|
11
|
-
这种元数据驱动的方法意味着,诸如应用程序名称、徽标、导航链接和主题颜色等元素会自动应用于所有组件,从而极大地减少了样板代码并确保了品牌一致性。
|
|
12
|
-
|
|
13
|
-
## 核心架构
|
|
14
|
-
|
|
15
|
-
该库的架构设计旨在实现简洁和自动化。当渲染 `Header` 或 `Footer` 等组件时,它会从 `window.blocklet` 对象中读取配置数据,该对象由 Blocklet Server 从您的 `blocklet.yml` 文件中填充。这使您能够在一个中央配置文件中定义 UI 的结构和品牌,而组件会相应地进行调整。
|
|
16
|
-
|
|
17
|
-
<!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
|
|
18
|
-

|
|
19
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
20
|
-
|
|
21
|
-
## 主要特性
|
|
22
|
-
|
|
23
|
-
- **元数据驱动:** 使用您在 `blocklet.yml` 中定义的 blocklet 名称、徽标和导航结构,自动配置 `Header` 和 `Footer` 等组件。
|
|
24
|
-
- **集成会话管理:** 组件与 DID Connect 会话无缝集成,自动显示用户个人资料信息、会话控制以及基于角色的导航链接访问权限。
|
|
25
|
-
- **响应式布局:** 包含 `Dashboard` 等强大的布局组件,为管理界面提供开箱即用的响应式结构。
|
|
26
|
-
- **组件管理:** 提供 `ComponentInstaller` 和 `BlockletStudio` 等工具,帮助在 Blocklet 生态系统中管理依赖项和资源。
|
|
27
|
-
|
|
28
|
-
## 核心组件
|
|
29
|
-
|
|
30
|
-
该库分为几个关键模块,每个模块都针对应用程序 UI 的一个特定领域。
|
|
31
|
-
|
|
32
|
-
<x-cards data-columns="2">
|
|
33
|
-
<x-card data-title="布局" data-icon="lucide:layout-template" data-href="/components/layout">
|
|
34
|
-
构成 blocklet 应用程序主要结构的主要组件,如 Header、Footer 和 Dashboard。
|
|
35
|
-
</x-card>
|
|
36
|
-
<x-card data-title="用户管理" data-icon="lucide:users" data-href="/components/user-management">
|
|
37
|
-
一套用于处理用户个人资料、会话管理和组织切换的组件。
|
|
38
|
-
</x-card>
|
|
39
|
-
<x-card data-title="组件管理" data-icon="lucide:box" data-href="/components/component-management">
|
|
40
|
-
用于在应用程序内动态安装、发布和管理 blocklet 组件的工具。
|
|
41
|
-
</x-card>
|
|
42
|
-
<x-card data-title="实用工具" data-icon="lucide:wrench" data-href="/components/utilities">
|
|
43
|
-
一系列辅助组件和实用工具,例如通用的 Icon 组件和主题提供程序。
|
|
44
|
-
</x-card>
|
|
45
|
-
</x-cards>
|
|
46
|
-
|
|
47
|
-
## 总结
|
|
48
|
-
|
|
49
|
-
通过利用 `@blocklet/ui-react` 库,您可以显著减少开发时间,专注于应用程序的独特功能。元数据驱动的方法确保了一致性,并简化了常用 UI 元素的管理。
|
|
50
|
-
|
|
51
|
-
要开始构建您的应用程序,请参阅 [入门指南](./getting-started.md),其中提供了关于如何安装该库并渲染您的第一个组件的分步教程。
|