chatluna-plugin-onebot-sandbox 1.2.5 → 1.2.7

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/client/index.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { Context } from 'cordis'
2
2
  import zh from './locales/zh.yml'
3
3
  import en from './locales/en.yml'
4
+ import './nav-badge.css'
5
+ import { name } from '../package.json'
6
+ import { PluginConfigNotice } from './plugin-config-notice'
4
7
 
5
8
  export default function apply(ctx: Context) {
6
9
  ctx.locale.register('onebot-sandbox', { zh, en })
@@ -8,10 +11,11 @@ export default function apply(ctx: Context) {
8
11
  ctx.slots.route({
9
12
  path: '/onebot-sandbox/:view?',
10
13
  page: async () => (await import('./app')).SandboxApp,
11
- title: () => t('onebot-sandbox.title'),
12
- icon: 'flask-conical',
14
+ title: () => t('onebot-sandbox.nav'),
15
+ icon: 'flask',
13
16
  order: 60,
14
17
  group: 'chat',
15
18
  groupOrder: 20,
16
19
  })
20
+ ctx.slots.register('plugin.config', { id: 'onebot-sandbox-settings', plugin: name, order: -1 }, PluginConfigNotice)
17
21
  }
@@ -1,3 +1,4 @@
1
+ onebot-sandbox.nav: "Sandbox"
1
2
  onebot-sandbox.title: "OneBot Sandbox"
2
3
  sandbox.avatar.back: "Back to profile"
3
4
  sandbox.avatar.builtin: "Built-in avatar {id}"
@@ -371,6 +372,8 @@ sandbox.notice.join: "{name} requested to join"
371
372
  sandbox.notice.label: "Notifications"
372
373
  sandbox.notice.labelCount: "Notifications ({count})"
373
374
  sandbox.notice.reject: "Reject"
375
+ sandbox.pluginConfig.description: "Plugin settings are edited on the Settings page of the OneBot sandbox"
376
+ sandbox.pluginConfig.open: "Open sandbox settings"
374
377
  sandbox.profile.copied: "ID copied"
375
378
  sandbox.profile.copyId: "Copy ID"
376
379
  sandbox.profile.title: "Profile"
@@ -1,3 +1,4 @@
1
+ onebot-sandbox.nav: "沙盒"
1
2
  onebot-sandbox.title: "OneBot 沙盒"
2
3
  sandbox.avatar.back: "返回资料编辑"
3
4
  sandbox.avatar.builtin: "内置头像 {id}"
@@ -371,6 +372,8 @@ sandbox.notice.join: "{name} 申请加入群聊"
371
372
  sandbox.notice.label: "通知"
372
373
  sandbox.notice.labelCount: "通知({count})"
373
374
  sandbox.notice.reject: "拒绝"
375
+ sandbox.pluginConfig.description: "插件设置在 OneBot 沙盒的「设置」页编辑"
376
+ sandbox.pluginConfig.open: "打开沙盒设置"
374
377
  sandbox.profile.copied: "已复制号码"
375
378
  sandbox.profile.copyId: "复制号码"
376
379
  sandbox.profile.title: "资料"
@@ -0,0 +1,12 @@
1
+ /* 侧栏标题只接受字符串,「OneBot」角标挂在宿主侧栏条目的标题后面;收起侧栏时标题不渲染,角标随之消失 */
2
+ [data-slot='sidebar-item'][href*='/onebot-sandbox'] > span::after {
3
+ content: 'OneBot';
4
+ display: inline-block;
5
+ margin-left: 2px;
6
+ font-size: 9px;
7
+ font-weight: 500;
8
+ line-height: 9px;
9
+ letter-spacing: 0.02em;
10
+ vertical-align: top;
11
+ opacity: 0.7;
12
+ }
@@ -0,0 +1,26 @@
1
+ import { SettingsIcon } from 'lucide-react'
2
+ import { useNavigate } from 'react-router'
3
+ import { Button, Item, ItemActions, ItemContent, ItemDescription } from '@chatluna/ui-kit'
4
+ import { useT } from './i18n'
5
+
6
+ /**
7
+ * v2 插件页「设置」标签里的提示:插件的配置全在沙盒设置页编辑,交给插件页的 `Config` 字段全部 hidden,
8
+ * 宿主的 SchemaForm 对没有可见字段的对象整块不渲染(连同 description),所以提示经 `plugin.config` 槽位单独挂上。
9
+ */
10
+ export function PluginConfigNotice() {
11
+ const t = useT()
12
+ const navigate = useNavigate()
13
+ return (
14
+ <Item variant="outline" size="sm" className="text-sm leading-5">
15
+ <ItemContent>
16
+ <ItemDescription>{t('sandbox.pluginConfig.description')}</ItemDescription>
17
+ </ItemContent>
18
+ <ItemActions>
19
+ <Button size="sm" variant="outline" onClick={() => navigate('/onebot-sandbox/settings')}>
20
+ <SettingsIcon />
21
+ {t('sandbox.pluginConfig.open')}
22
+ </Button>
23
+ </ItemActions>
24
+ </Item>
25
+ )
26
+ }
@@ -1,15 +1,25 @@
1
1
  {
2
+ "_i18n-BeNV36zL.js": {
3
+ "file": "i18n-BeNV36zL.js",
4
+ "name": "i18n"
5
+ },
2
6
  "client/app.tsx": {
3
- "file": "app-BhlZI8M1.js",
7
+ "file": "app-Cr5eX7UP.js",
4
8
  "name": "app",
5
9
  "src": "client/app.tsx",
6
- "isDynamicEntry": true
10
+ "isDynamicEntry": true,
11
+ "imports": [
12
+ "_i18n-BeNV36zL.js"
13
+ ]
7
14
  },
8
15
  "client/index.ts": {
9
16
  "file": "client.js",
10
17
  "name": "index",
11
18
  "src": "client/index.ts",
12
19
  "isEntry": true,
20
+ "imports": [
21
+ "_i18n-BeNV36zL.js"
22
+ ],
13
23
  "dynamicImports": [
14
24
  "client/app.tsx"
15
25
  ]