dsh-plugin-core-demo 0.32.0 → 0.33.1

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/README.md CHANGED
@@ -1,43 +1,101 @@
1
1
  # dsh-plugin-core-demo
2
2
 
3
- 在 **真实 DSH 宿主**里预览 `dsh-plugin-core` 的控件与业务组件的插件。
3
+ **English** · [简体中文](https://github.com/cq-guojia/dsh-plugin-core/blob/main/packages/demo/README.zh-CN.md)
4
4
 
5
- 它和库是完全分开的两个 npm 包(库是纯库,只有子路径导出;本包是插件):
5
+ The live preview plugin for [`dsh-plugin-core`](https://www.npmjs.com/package/dsh-plugin-core) — in the DSH sidebar it appears as **Blue Whale Component Library**.
6
6
 
7
- | | 包 | 用途 |
7
+ Install it into a real DSH host and every base control and composed module renders with the host's own theme, tokens and data. There is no standalone web page: what you see is exactly what a plugin built on the library gets.
8
+
9
+ | | Package | Role |
8
10
  |---|---|---|
9
- | 库 | `dsh-plugin-core` | 各插件按子路径引用(`/ui` `/utils` `/design` …) |
10
- | 插件 | `dsh-plugin-core-demo`(本包) | 装进 DSH,宿主内预览 |
11
+ | Library | `dsh-plugin-core` | Imported by plugins by subpath (`/ui`, `/design`, `/utils`, `/explorer`, `/session`) |
12
+ | Plugin | `dsh-plugin-core-demo` (this package) | Installed into DSH, renders the library in place |
13
+
14
+ ## Install
15
+
16
+ Into a DSH host, with the DSH CLI:
17
+
18
+ ```bash
19
+ dsh plugin --profile web add dsh-plugin-core-demo
20
+ ```
11
21
 
12
- ## 构建
22
+ Or the npm package itself:
13
23
 
14
24
  ```bash
15
- # 在仓库根先构建库(本包引用 ../../dist/)
16
- pnpm run build
17
- # 再构建本包 → dist/index.js(server 壳)+ dist/client.js(预览页 bundle)
18
- pnpm run build:demo
25
+ npm install dsh-plugin-core-demo
19
26
  ```
20
27
 
21
- `dist/` 与 `src/` 一起入库:宿主安装插件时**不跑构建脚本**。
28
+ After installing: open the plugin in the DSH plugin list — the plugin page carries a **Component preview** entry that opens the full-page preview. The sidebar entry position (first level / under "More" / off) is a plugin setting.
29
+
30
+ ## What it shows
31
+
32
+ | Page | Content |
33
+ |---|---|
34
+ | Design foundation | The token palette, the dark-mode predicate, the style injector that puts both on the page |
35
+ | Actions | Button across all 18 appearance tiers and three heights, icon buttons, loading behaviour |
36
+ | Inputs | Input family, pickers, date and time, checkbox / switch / segmented, field hints |
37
+ | Display | Surface, cards, chips, section heads, marquee and flip text, tables with grouped headers and banner groups |
38
+ | Feedback | Modal, side sheet, promise-based confirm and alert, toasts, loaders and the global loading card |
39
+ | Layout and scrolling | The right-docked panel, toolbar behaviour, split groups and resizers |
40
+ | Navigation | Pagination on its own and built into a table |
41
+ | Workspace browsing | Docked file browser and every preview body, driven by real workspace files |
42
+ | Session preview | A read-only conversation dialog, including archive state and changed-file review |
43
+ | Utilities | Every helper with live input and output, including failure returns |
44
+ | Localization | Every built-in string in both Chinese and English |
45
+
46
+ Everything on these pages runs the same code the library ships — the preview plugin bundles core's build output into itself, so it always shows the current source, without publishing core first.
47
+
48
+ ## Screenshots
49
+
50
+ Design tokens, the theme predicate and the injector:
51
+
52
+ ![Design tokens and theme predicate](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/01-tokens.png)
53
+
54
+ Buttons:
22
55
 
23
- ## 发布与安装
56
+ ![Button tiers](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/02-buttons.png)
24
57
 
25
- **不要在本目录手跑 `npm publish`。** 本包与核心共用同一个 `vX.Y.Z` tag,由
26
- `.github/workflows/demo-publish.yml` 自动发布;版本必须与根 `package.json` 完全一致
27
- (`test/version-sync.test.mjs` 与 CI 都校验,不一致直接失败)。
58
+ Inputs:
59
+
60
+ ![Inputs](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/03-inputs.png)
61
+
62
+ Workspace browsing:
63
+
64
+ ![Workspace explorer](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/04-explorer.png)
65
+
66
+ Session preview:
67
+
68
+ ![Session preview](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/05-session.png)
69
+
70
+ ## Compatibility
71
+
72
+ | Area | Requirement |
73
+ |---|---|
74
+ | Host | DSH web client (`client.platform: web`); the plugin registers into the sidebar, the main area and the plugin settings page |
75
+ | Node.js | `>= 22.5` |
76
+ | React / React DOM | `>= 18`, optional peers provided by the host |
77
+ | Official modules | `@deepseek-ai/*` packages are resolved by the host at runtime and never declared as dependencies |
78
+ | Styling | Runtime-injected; variables and classes use the fixed `--dshpc-*` / `dshpc-*` prefixes and never touch the host's own |
79
+
80
+ ## Build from source
28
81
 
29
82
  ```bash
30
- git tag v0.1.3 && git push origin v0.1.3 # 在仓库根:一次 tag 发库 + 本包
31
- dsh plugin --profile web add dsh-plugin-core-demo
83
+ # in the repository root
84
+ pnpm run build # build the library first (this package imports ../../dist/)
85
+ pnpm run build:demo # build this package → dist/index.js (server shell) + dist/client.js (preview bundle)
32
86
  ```
33
87
 
34
- 装好后:插件列表 → 本插件 → 设置页里的「组件预览」卡片 → 点开即整页预览;也可点侧栏图标。
88
+ `dist/` is committed alongside `src/`: the host does not run build scripts when installing a plugin.
89
+
90
+ ## Release
91
+
92
+ Do not run `npm publish` in this directory. The library and this plugin share the same `vX.Y.Z` tag and are published by `.github/workflows/demo-publish.yml`; the two versions must match exactly (checked by `test/version-sync.test.mjs` and by CI).
93
+
94
+ ```bash
95
+ # from the repository root — one tag publishes both packages
96
+ git tag vX.Y.Z && git push origin vX.Y.Z
97
+ ```
35
98
 
36
- ## 实现要点
99
+ ## License
37
100
 
38
- - client 侧只导出 `apply`;依赖一律 `ctx.inject([...], cb)` 内等待(顶层导出 `inject` 会卡死宿主启动)。
39
- - 三块注册(`sidebar.panellist` / `main` / `settings.plugin.item`)各自 `ctx.inject`、自成一块;
40
- `settings.plugin.item` 与 `main` 的 key 必须 = 包名(宿主机制)。
41
- - 变量前缀统一用 `dshpc`,**不碰 `--dsw-*` / `--dsh-*`**(宿主在用);
42
- 展示代码直接用 `--dshpc-*`。
43
- - 零运行时依赖:不引内部 `@deepseek-ai/*`,故不声明 schemastery Config。
101
+ MIT
@@ -0,0 +1,101 @@
1
+ # dsh-plugin-core-demo
2
+
3
+ [English](https://github.com/cq-guojia/dsh-plugin-core/blob/main/packages/demo/README.md) · **简体中文**
4
+
5
+ [`dsh-plugin-core`](https://www.npmjs.com/package/dsh-plugin-core) 的实时预览插件——在 DSH 侧栏里显示为**蓝鲸组件库**。
6
+
7
+ 装进真实的 DSH 宿主后,每个基础控件与组合模块都用宿主自己的主题、token 和数据渲染。它没有独立的网页形态:你看到的就是一个用这套库写出来的插件该有的样子。
8
+
9
+ | | 包 | 角色 |
10
+ |---|---|---|
11
+ | 库 | `dsh-plugin-core` | 各插件按子路径引用(`/ui`、`/design`、`/utils`、`/explorer`、`/session`) |
12
+ | 插件 | `dsh-plugin-core-demo`(本包) | 装进 DSH,就地渲染这套库 |
13
+
14
+ ## 安装
15
+
16
+ 用 DSH 命令装进宿主:
17
+
18
+ ```bash
19
+ dsh plugin --profile web add dsh-plugin-core-demo
20
+ ```
21
+
22
+ 或用 npm 装这个包本身:
23
+
24
+ ```bash
25
+ npm install dsh-plugin-core-demo
26
+ ```
27
+
28
+ 装好后打开插件列表里的本插件:详情页有「组件预览」入口,点开即整页预览。侧栏入口位置(第一级 / 收入「更多」/ 关闭)是插件设置项。
29
+
30
+ ## 演示了什么
31
+
32
+ | 页面 | 内容 |
33
+ |---|---|
34
+ | 设计基础 | token 色板、明暗判据、把两者弄上页面的样式注入 |
35
+ | 动作 | 按钮全部 18 档外观与三档高度、图标按钮、loading 行为 |
36
+ | 录入 | 输入框家族、选择器、日期与时间、勾选 / 开关 / 分段、问号提示 |
37
+ | 展示 | 框容器、卡片、Chip、区块标题、跑马灯与翻牌文本、带分组表头与通栏分组的表格 |
38
+ | 反馈 | 弹窗、侧边抽屉、Promise 形态的确认与提示、toast、加载图标与全局加载卡 |
39
+ | 布局与滚动 | 右侧停靠分栏、工具栏行为、组合选择框与拖宽 |
40
+ | 导航 | 独立分页,以及表格内置分页 |
41
+ | 工作区浏览 | 停靠式文件浏览与全部预览体,读的是真实工作区文件 |
42
+ | 会话预览 | 只读会话弹窗,含归档态与变更文件审阅 |
43
+ | 工具方法 | 每个方法都给出实时输入与输出,包括失败返回值 |
44
+ | 多语言 | 每条内置文案的中英对照 |
45
+
46
+ 这些页面跑的都是库发布出去的同一份代码——预览插件把 core 的构建产物打进自己 bundle,所以它永远显示当前这份源码,不需要先把 core 发到 npm。
47
+
48
+ ## 截图
49
+
50
+ 设计基础——token、明暗判据与注入机制:
51
+
52
+ ![设计基础](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/01-tokens.png)
53
+
54
+ 动作——按钮:
55
+
56
+ ![按钮](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/02-buttons.png)
57
+
58
+ 录入:
59
+
60
+ ![录入](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/03-inputs.png)
61
+
62
+ 工作区浏览:
63
+
64
+ ![工作区浏览](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/04-explorer.png)
65
+
66
+ 会话预览:
67
+
68
+ ![会话预览](https://cdn.jsdelivr.net/gh/cq-guojia/dsh-plugin-core@main/assets/readme/05-session.png)
69
+
70
+ ## 适配范围
71
+
72
+ | 维度 | 要求 |
73
+ |---|---|
74
+ | 宿主 | DSH web client(`client.platform: web`);插件注册到侧栏、主区与插件设置页 |
75
+ | Node.js | `>= 22.5` |
76
+ | React / React DOM | `>= 18`,可选 peer,由宿主提供 |
77
+ | 官方模块 | `@deepseek-ai/*` 由宿主运行时解析,本包不声明为依赖 |
78
+ | 样式 | 运行时注入;变量与类名固定 `--dshpc-*` / `dshpc-*`,不碰宿主自己的前缀 |
79
+
80
+ ## 从源码构建
81
+
82
+ ```bash
83
+ # 在仓库根目录
84
+ pnpm run build # 先构建库(本包引用 ../../dist/)
85
+ pnpm run build:demo # 再构建本包 → dist/index.js(server 壳)+ dist/client.js(预览页 bundle)
86
+ ```
87
+
88
+ `dist/` 与 `src/` 一起入库:宿主安装插件时不跑构建脚本。
89
+
90
+ ## 发布
91
+
92
+ 不要在本目录手跑 `npm publish`。库与本插件共用同一个 `vX.Y.Z` tag,由 `.github/workflows/demo-publish.yml` 发布;两个版本必须完全一致(`test/version-sync.test.mjs` 与 CI 都校验)。
93
+
94
+ ```bash
95
+ # 在仓库根:一次 tag 发两个包
96
+ git tag vX.Y.Z && git push origin vX.Y.Z
97
+ ```
98
+
99
+ ## 许可证
100
+
101
+ MIT