@asabot/panel-ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +41 -2
- package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/assets/noto-sans-sc-100-wght-normal-DluiXYzi.woff2 +0 -0
- package/dist/assets/noto-sans-sc-101-wght-normal-CPkZHnw0.woff2 +0 -0
- package/dist/assets/noto-sans-sc-102-wght-normal-gzIulUH6.woff2 +0 -0
- package/dist/assets/noto-sans-sc-103-wght-normal-CJfSBxFo.woff2 +0 -0
- package/dist/assets/noto-sans-sc-104-wght-normal-B3QMglgE.woff2 +0 -0
- package/dist/assets/noto-sans-sc-105-wght-normal-xXh_OMfk.woff2 +0 -0
- package/dist/assets/noto-sans-sc-106-wght-normal-B9n3jMjP.woff2 +0 -0
- package/dist/assets/noto-sans-sc-107-wght-normal-D7fvVprN.woff2 +0 -0
- package/dist/assets/noto-sans-sc-108-wght-normal-J0_LhxVo.woff2 +0 -0
- package/dist/assets/noto-sans-sc-109-wght-normal-Dsp-De_0.woff2 +0 -0
- package/dist/assets/noto-sans-sc-110-wght-normal-DE_6NUrb.woff2 +0 -0
- package/dist/assets/noto-sans-sc-111-wght-normal-C4S-TlTn.woff2 +0 -0
- package/dist/assets/noto-sans-sc-112-wght-normal-BcFuP3w6.woff2 +0 -0
- package/dist/assets/noto-sans-sc-113-wght-normal-Dk932kmj.woff2 +0 -0
- package/dist/assets/noto-sans-sc-114-wght-normal-CO_5Xo-i.woff2 +0 -0
- package/dist/assets/noto-sans-sc-115-wght-normal-BWy07H14.woff2 +0 -0
- package/dist/assets/noto-sans-sc-116-wght-normal-B4HVAfHo.woff2 +0 -0
- package/dist/assets/noto-sans-sc-117-wght-normal-siZzFqgK.woff2 +0 -0
- package/dist/assets/noto-sans-sc-118-wght-normal-xhBB7f6V.woff2 +0 -0
- package/dist/assets/noto-sans-sc-119-wght-normal-Ck_g2FGz.woff2 +0 -0
- package/dist/assets/noto-sans-sc-21-wght-normal-D0x9-yBt.woff2 +0 -0
- package/dist/assets/noto-sans-sc-22-wght-normal-BBUVTShg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-23-wght-normal-Du1oYWkE.woff2 +0 -0
- package/dist/assets/noto-sans-sc-24-wght-normal-CmWjJ0gt.woff2 +0 -0
- package/dist/assets/noto-sans-sc-25-wght-normal-BFHiqilg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-26-wght-normal-C0sF2Z2f.woff2 +0 -0
- package/dist/assets/noto-sans-sc-27-wght-normal-COFdrquJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-28-wght-normal-DMgdNu1o.woff2 +0 -0
- package/dist/assets/noto-sans-sc-29-wght-normal-Cmq8em30.woff2 +0 -0
- package/dist/assets/noto-sans-sc-30-wght-normal-CZWqZ3yU.woff2 +0 -0
- package/dist/assets/noto-sans-sc-31-wght-normal-Wfi_lutW.woff2 +0 -0
- package/dist/assets/noto-sans-sc-32-wght-normal-BRJQ4PY5.woff2 +0 -0
- package/dist/assets/noto-sans-sc-33-wght-normal-CUVQXNAJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-34-wght-normal-Bspba0wC.woff2 +0 -0
- package/dist/assets/noto-sans-sc-35-wght-normal-K8fX_YPG.woff2 +0 -0
- package/dist/assets/noto-sans-sc-36-wght-normal-CkITyjoT.woff2 +0 -0
- package/dist/assets/noto-sans-sc-37-wght-normal-WCZ2zfEe.woff2 +0 -0
- package/dist/assets/noto-sans-sc-38-wght-normal-DeM7CUce.woff2 +0 -0
- package/dist/assets/noto-sans-sc-39-wght-normal-BMZNLWQU.woff2 +0 -0
- package/dist/assets/noto-sans-sc-4-wght-normal-AR5bdDjz.woff2 +0 -0
- package/dist/assets/noto-sans-sc-40-wght-normal-BQ5xpS5j.woff2 +0 -0
- package/dist/assets/noto-sans-sc-41-wght-normal-Hthm7FFi.woff2 +0 -0
- package/dist/assets/noto-sans-sc-42-wght-normal-eaS2gKds.woff2 +0 -0
- package/dist/assets/noto-sans-sc-43-wght-normal-o-T53XXV.woff2 +0 -0
- package/dist/assets/noto-sans-sc-44-wght-normal-BJH5J4Ez.woff2 +0 -0
- package/dist/assets/noto-sans-sc-45-wght-normal-BKuxSCOJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-46-wght-normal-BR_5Mu6e.woff2 +0 -0
- package/dist/assets/noto-sans-sc-47-wght-normal-CyY7gKNX.woff2 +0 -0
- package/dist/assets/noto-sans-sc-48-wght-normal-BNMfTR6k.woff2 +0 -0
- package/dist/assets/noto-sans-sc-49-wght-normal-DX-0y7wg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-5-wght-normal-CfWugllB.woff2 +0 -0
- package/dist/assets/noto-sans-sc-50-wght-normal-DAOGW-Dr.woff2 +0 -0
- package/dist/assets/noto-sans-sc-51-wght-normal-BlFLOjcP.woff2 +0 -0
- package/dist/assets/noto-sans-sc-52-wght-normal-OZjrybnw.woff2 +0 -0
- package/dist/assets/noto-sans-sc-53-wght-normal-CwyWNT6x.woff2 +0 -0
- package/dist/assets/noto-sans-sc-54-wght-normal-DM0nRe18.woff2 +0 -0
- package/dist/assets/noto-sans-sc-55-wght-normal-DBK2wUOR.woff2 +0 -0
- package/dist/assets/noto-sans-sc-56-wght-normal-C-VKK1LS.woff2 +0 -0
- package/dist/assets/noto-sans-sc-57-wght-normal-Cdbfh5kq.woff2 +0 -0
- package/dist/assets/noto-sans-sc-58-wght-normal-CflMKARZ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-59-wght-normal-BS4Kwzxx.woff2 +0 -0
- package/dist/assets/noto-sans-sc-6-wght-normal-ChnZIQfQ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-60-wght-normal-B7QOYsXJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-61-wght-normal-C8JjQS7w.woff2 +0 -0
- package/dist/assets/noto-sans-sc-62-wght-normal-bS4wq1Gg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-63-wght-normal-BJr8P-OB.woff2 +0 -0
- package/dist/assets/noto-sans-sc-64-wght-normal-DVB11t7j.woff2 +0 -0
- package/dist/assets/noto-sans-sc-65-wght-normal-DMPCXBvK.woff2 +0 -0
- package/dist/assets/noto-sans-sc-66-wght-normal-BobaG10V.woff2 +0 -0
- package/dist/assets/noto-sans-sc-67-wght-normal-Dzk7WhCR.woff2 +0 -0
- package/dist/assets/noto-sans-sc-68-wght-normal-DGbCD9xu.woff2 +0 -0
- package/dist/assets/noto-sans-sc-69-wght-normal-Ctrv1EqA.woff2 +0 -0
- package/dist/assets/noto-sans-sc-70-wght-normal-RgTO941D.woff2 +0 -0
- package/dist/assets/noto-sans-sc-71-wght-normal-D9sG-CWv.woff2 +0 -0
- package/dist/assets/noto-sans-sc-72-wght-normal-C4oWy3ul.woff2 +0 -0
- package/dist/assets/noto-sans-sc-73-wght-normal-B1ZoOTgM.woff2 +0 -0
- package/dist/assets/noto-sans-sc-74-wght-normal-F7dH_rZJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-75-wght-normal-Cp2wp4si.woff2 +0 -0
- package/dist/assets/noto-sans-sc-76-wght-normal-B494D7xS.woff2 +0 -0
- package/dist/assets/noto-sans-sc-77-wght-normal-B3MVY9Ax.woff2 +0 -0
- package/dist/assets/noto-sans-sc-78-wght-normal-5jX7iNMC.woff2 +0 -0
- package/dist/assets/noto-sans-sc-79-wght-normal-BIoZy8fr.woff2 +0 -0
- package/dist/assets/noto-sans-sc-80-wght-normal-Bje1Fxy1.woff2 +0 -0
- package/dist/assets/noto-sans-sc-81-wght-normal-B2NN7Qi3.woff2 +0 -0
- package/dist/assets/noto-sans-sc-82-wght-normal-CUggNZi4.woff2 +0 -0
- package/dist/assets/noto-sans-sc-83-wght-normal-99rD8YO-.woff2 +0 -0
- package/dist/assets/noto-sans-sc-84-wght-normal-zMBmUocm.woff2 +0 -0
- package/dist/assets/noto-sans-sc-85-wght-normal-CjI3qdxG.woff2 +0 -0
- package/dist/assets/noto-sans-sc-86-wght-normal-BHY8TVEH.woff2 +0 -0
- package/dist/assets/noto-sans-sc-87-wght-normal-DioZSHnU.woff2 +0 -0
- package/dist/assets/noto-sans-sc-88-wght-normal-BXYxwf2t.woff2 +0 -0
- package/dist/assets/noto-sans-sc-89-wght-normal-ClMFrFaL.woff2 +0 -0
- package/dist/assets/noto-sans-sc-90-wght-normal-BnOlPreP.woff2 +0 -0
- package/dist/assets/noto-sans-sc-91-wght-normal-DTr9RQcS.woff2 +0 -0
- package/dist/assets/noto-sans-sc-97-wght-normal-9u6Aiav-.woff2 +0 -0
- package/dist/assets/noto-sans-sc-98-wght-normal-BR-H2C0V.woff2 +0 -0
- package/dist/assets/noto-sans-sc-99-wght-normal-BI6XPoxp.woff2 +0 -0
- package/dist/assets/noto-sans-sc-cyrillic-wght-normal-BGmsQlw-.woff2 +0 -0
- package/dist/assets/noto-sans-sc-latin-ext-wght-normal-DuJTpTg_.woff2 +0 -0
- package/dist/assets/noto-sans-sc-latin-wght-normal-DDW8mKAR.woff2 +0 -0
- package/dist/assets/noto-sans-sc-vietnamese-wght-normal-Bi3ATJ76.woff2 +0 -0
- package/dist/avatar.d.ts +11 -0
- package/dist/avatar.js +25 -0
- package/dist/compatibility-info.d.ts +11 -0
- package/dist/compatibility-info.js +12 -0
- package/dist/delivery-failure.d.ts +4 -0
- package/dist/delivery-failure.js +10 -0
- package/dist/fonts.css +1 -0
- package/dist/format.d.ts +25 -0
- package/dist/format.js +33 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +21 -0
- package/dist/licenses/geist-mono.txt +93 -0
- package/dist/licenses/geist.txt +93 -0
- package/dist/licenses/noto-sans-sc.txt +93 -0
- package/dist/logo.d.ts +3 -0
- package/dist/logo.js +8 -0
- package/dist/markdown.d.ts +4 -0
- package/dist/markdown.js +25 -0
- package/dist/message-chart.d.ts +6 -0
- package/dist/message-chart.js +103 -0
- package/dist/motion.d.ts +45 -0
- package/dist/motion.js +22 -0
- package/dist/plugin-page-layout.d.ts +7 -0
- package/dist/plugin-page-layout.js +6 -0
- package/dist/provider.d.ts +4 -0
- package/dist/provider.js +6 -0
- package/dist/schema-form.d.ts +39 -0
- package/dist/schema-form.js +244 -0
- package/dist/segments.d.ts +10 -0
- package/dist/segments.js +81 -0
- package/dist/styles.css +2 -0
- package/dist/trace-view.d.ts +6 -0
- package/dist/trace-view.js +58 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.js +1 -0
- package/dist/ui/button.d.ts +25 -0
- package/dist/ui/button.js +24 -0
- package/dist/ui/date-picker.d.ts +15 -0
- package/dist/ui/date-picker.js +167 -0
- package/dist/ui/dialog.d.ts +20 -0
- package/dist/ui/dialog.js +17 -0
- package/dist/ui/input.d.ts +14 -0
- package/dist/ui/input.js +15 -0
- package/dist/ui/misc.d.ts +62 -0
- package/dist/ui/misc.js +53 -0
- package/dist/ui/primitives.d.ts +59 -0
- package/dist/ui/primitives.js +51 -0
- package/dist/ui/select.d.ts +17 -0
- package/dist/ui/select.js +12 -0
- package/dist/ui/switch.d.ts +8 -0
- package/dist/ui/switch.js +8 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +15 -0
- package/package.json +68 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 isyuah
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @asabot/panel-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AsaBot 控制台与插件页面共用的 React 19 组件。组件按传入的数据和回调工作,插件通过 `ctx.panel.route` 和面板 SDK 读写自己的数据。
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Button, Card, PanelUIProvider, PluginPageLayout } from '@asabot/panel-ui'
|
|
7
|
+
import '@asabot/panel-ui/styles.css'
|
|
8
|
+
|
|
9
|
+
export function App() {
|
|
10
|
+
return (
|
|
11
|
+
<PanelUIProvider>
|
|
12
|
+
<PluginPageLayout toolbar={<Button>刷新</Button>}>
|
|
13
|
+
<Card>插件内容</Card>
|
|
14
|
+
</PluginPageLayout>
|
|
15
|
+
</PanelUIProvider>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`styles.css` 已经编译,插件不需要配置 Tailwind。需要与控制台相同的 Geist 和 Noto Sans SC 字体时,再导入 `@asabot/panel-ui/fonts.css`;该入口会增加约 4.5 MB 的字体资产,面板 ZIP 上传的上限为 2 MB。
|
|
21
|
+
|
|
22
|
+
- `PanelUIProvider` 提供 Tooltip 上下文,并遵循用户的减少动效偏好。
|
|
23
|
+
- `PluginPageLayout` 适合放在 iframe 内容的最外层。`toolbar` 固定在顶部,正文超出时在内部滚动。简单 HTML 插件也可以直接使用 iframe 内的文档滚动。
|
|
24
|
+
- `@asabot/panel-ui` 提供按钮、表单、卡片、弹窗、侧滑面板、Tab、头像、消息片段、趋势图、处理轨迹等组件。`Markdown` 从 `@asabot/panel-ui/markdown` 导入,也可单独懒加载。
|
|
25
|
+
- `Select` 可通过 `id` 关联 `Field` 的 `htmlFor`。`undefined` 显示占位文本,`''` 可以作为真实选项,例如「全部」或「不设默认」。
|
|
26
|
+
- `DatePicker` 同样可关联 `Field`,`value`、`min` 和 `max` 使用 `YYYY-MM-DD`,清空时回传 `undefined`。默认按本地日期显示「今天」,UTC 筛选可使用 `timeZone="UTC"`。
|
|
27
|
+
- 在插件的 `index.html` 中用 `<script src="/plugin-pages/_sdk.js"></script>` 加载面板 SDK,接收主题更新、调用插件接口和显示面板通知。在插件内按 `Ctrl/⌘ + K` 也可以打开控制台命令面板。插件自己的弹窗和菜单在 iframe 内显示。
|
|
28
|
+
- 前端构建产物使用相对路径(Vite 设置 `base: './'`),再用 `ctx.panel.page({ title, root })` 将入口目录指向构建产物。
|
|
29
|
+
|
|
30
|
+
## 运行示例插件
|
|
31
|
+
|
|
32
|
+
从 AsaBot 仓库根目录构建并打包共享组件,把示例目录复制到 `plugins/panel-ui-demo`:
|
|
33
|
+
|
|
34
|
+
```powershell
|
|
35
|
+
pnpm --filter @asabot/panel-ui build
|
|
36
|
+
Copy-Item -Recurse packages/panel-ui/example plugins/panel-ui-demo
|
|
37
|
+
pnpm --dir packages/panel-ui pack --out ../../plugins/panel-ui-demo/panel-ui.tgz
|
|
38
|
+
pnpm --dir plugins/panel-ui-demo --ignore-workspace install --lockfile=false
|
|
39
|
+
pnpm --dir plugins/panel-ui-demo --ignore-workspace build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
启动或刷新控制台后,在「插件页面」打开「消息统计示例」。可以切换短列表与长列表、筛选消息和打开详情弹窗。部署示例插件时只需要它的 `index.ts` 和 `dist/`,浏览器依赖已包含在 `dist/` 里。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shows the avatar URL supplied by the backend (adapters know where their platform keeps avatars), falling back to a
|
|
3
|
+
* soft colored initial. The panel itself never builds platform-specific avatar URLs.
|
|
4
|
+
*/
|
|
5
|
+
export declare function Avatar({ id, name, src, size, className, }: {
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
src?: string;
|
|
9
|
+
size?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
}): import("react").JSX.Element;
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { cn } from './utils.js';
|
|
4
|
+
const palettes = [
|
|
5
|
+
'bg-[#efedff] text-[#5245de] dark:bg-[#8b7ffa]/15 dark:text-[#b4acff]',
|
|
6
|
+
'bg-[#e2f5ef] text-[#0e8a6c] dark:bg-[#2bbd95]/15 dark:text-[#5fd6b3]',
|
|
7
|
+
'bg-[#fdeef4] text-[#c2457a] dark:bg-[#f2a5c8]/15 dark:text-[#f2a5c8]',
|
|
8
|
+
'bg-[#e7effd] text-[#2f6fd6] dark:bg-[#5f9cf3]/15 dark:text-[#8ab8f7]',
|
|
9
|
+
'bg-[#fcf0d9] text-[#a76a05] dark:bg-[#e9a43a]/15 dark:text-[#f0bf70]',
|
|
10
|
+
];
|
|
11
|
+
function hash(value) {
|
|
12
|
+
let result = 0;
|
|
13
|
+
for (const char of value)
|
|
14
|
+
result = (result * 31 + char.charCodeAt(0)) >>> 0;
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Shows the avatar URL supplied by the backend (adapters know where their platform keeps avatars), falling back to a
|
|
19
|
+
* soft colored initial. The panel itself never builds platform-specific avatar URLs.
|
|
20
|
+
*/
|
|
21
|
+
export function Avatar({ id, name, src, size = 32, className, }) {
|
|
22
|
+
const [failedSrc, setFailedSrc] = useState();
|
|
23
|
+
const initial = (name?.trim() || id).slice(0, 1).toUpperCase();
|
|
24
|
+
return (_jsxs("span", { className: cn('relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium select-none', palettes[hash(id) % palettes.length], className), style: { width: size, height: size, fontSize: size * 0.4 }, children: [src && src !== failedSrc ? (_jsx("img", { src: src, alt: "", loading: "lazy", referrerPolicy: "no-referrer", className: "size-full object-cover", onError: () => setFailedSrc(src) })) : (initial), _jsx("span", { className: "absolute inset-0 rounded-full ring-1 ring-black/5 ring-inset dark:ring-white/10" })] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AlertTriangle } from 'lucide-react';
|
|
3
|
+
import { Badge } from './ui/primitives.js';
|
|
4
|
+
export function CompatibilityInfo({ value, }) {
|
|
5
|
+
if (!value)
|
|
6
|
+
return _jsx(Badge, { children: "\u6682\u65E0\u80FD\u529B\u8BB0\u5F55" });
|
|
7
|
+
if (!value.declared)
|
|
8
|
+
return _jsx(Badge, { children: "\u672A\u58F0\u660E\u80FD\u529B\u8981\u6C42" });
|
|
9
|
+
if (!value.required.length && !value.optional.length)
|
|
10
|
+
return _jsx(Badge, { tone: "success", children: "\u80FD\u529B\u5339\u914D" });
|
|
11
|
+
return (_jsxs("div", { className: "space-y-1 text-[12px]", children: [value.required.length > 0 && (_jsxs("p", { className: "flex items-start gap-1.5 text-warning", children: [_jsx(AlertTriangle, { className: "mt-0.5 size-3.5 shrink-0" }), "\u7F3A\u5C11\u5FC5\u987B\u80FD\u529B\uFF1A", value.required.map((item) => item.name).join('、')] })), value.optional.length > 0 && (_jsxs("p", { className: "text-fg-3", children: ["\u7F3A\u5C11\u53EF\u9009\u80FD\u529B\uFF1A", value.optional.map((item) => item.name).join('、')] })), _jsx("p", { className: "text-fg-3", children: "\u4ECD\u53EF\u542F\u7528\uFF1B\u76F8\u5173\u529F\u80FD\u53EF\u80FD\u4E0D\u53EF\u7528\u6216\u964D\u7EA7\u3002" })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from './ui/primitives.js';
|
|
3
|
+
const labels = { not_sent: '未送达', unknown: '结果未知', partial: '部分送达' };
|
|
4
|
+
export function DeliveryFailureDetails({ failure }) {
|
|
5
|
+
const { target, code, platformCode, confirmedMessageIds } = failure;
|
|
6
|
+
const destination = [target.platform, target.selfId, target.id, target.thread?.id]
|
|
7
|
+
.filter(Boolean)
|
|
8
|
+
.join(' / ');
|
|
9
|
+
return (_jsxs("div", { className: "space-y-1.5 text-[12px] text-fg-3", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [_jsx(Badge, { tone: failure.outcome === 'not_sent' ? 'neutral' : 'warning', children: labels[failure.outcome] }), _jsxs("code", { className: "break-all font-mono", children: [code, platformCode === undefined ? '' : ` · ${platformCode}`] })] }), _jsxs("p", { className: "break-all", children: [target.type === 'group' ? '群聊' : '私聊', " ", _jsx("code", { className: "font-mono", children: destination })] }), !!confirmedMessageIds?.length && (_jsxs("p", { className: "break-all", children: ["\u5DF2\u786E\u8BA4\u6D88\u606F ", _jsx("code", { className: "font-mono", children: confirmedMessageIds.join('、') })] }))] }));
|
|
10
|
+
}
|