dsh-plugin-core 0.1.4 → 0.2.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 +6 -8
- package/dist/design/index.d.ts +1 -1
- package/dist/design/index.d.ts.map +1 -1
- package/dist/design/index.js +1 -1
- package/dist/design/index.js.map +1 -1
- package/dist/design/style-kit.d.ts +4 -9
- package/dist/design/style-kit.d.ts.map +1 -1
- package/dist/design/style-kit.js +11 -24
- package/dist/design/style-kit.js.map +1 -1
- package/dist/design/tokens-css.d.ts +1 -1
- package/dist/design/tokens-css.d.ts.map +1 -1
- package/dist/design/tokens-css.js +162 -132
- package/dist/design/tokens-css.js.map +1 -1
- package/dist/explorer/ExplorerPanel.js +14 -14
- package/dist/explorer/ExplorerPanel.js.map +1 -1
- package/dist/explorer/explorer-css.d.ts +1 -1
- package/dist/explorer/explorer-css.d.ts.map +1 -1
- package/dist/explorer/explorer-css.js +23 -23
- package/dist/explorer/explorer-css.js.map +1 -1
- package/dist/explorer/preview/index.js +4 -4
- package/dist/explorer/preview/index.js.map +1 -1
- package/dist/session/index.js +9 -9
- package/dist/session/index.js.map +1 -1
- package/dist/session/session-css.d.ts +1 -1
- package/dist/session/session-css.js +14 -14
- package/dist/session/session-css.js.map +1 -1
- package/dist/ui/BackToTop.d.ts +1 -1
- package/dist/ui/BackToTop.d.ts.map +1 -1
- package/dist/ui/BackToTop.js +5 -5
- package/dist/ui/BackToTop.js.map +1 -1
- package/dist/ui/Button.d.ts +16 -5
- package/dist/ui/Button.d.ts.map +1 -1
- package/dist/ui/Button.js +53 -14
- package/dist/ui/Button.js.map +1 -1
- package/dist/ui/Card.js +8 -8
- package/dist/ui/Card.js.map +1 -1
- package/dist/ui/Checkbox.d.ts +2 -2
- package/dist/ui/Checkbox.d.ts.map +1 -1
- package/dist/ui/Checkbox.js +4 -4
- package/dist/ui/Checkbox.js.map +1 -1
- package/dist/ui/Chip.d.ts +1 -1
- package/dist/ui/Chip.d.ts.map +1 -1
- package/dist/ui/Chip.js +2 -2
- package/dist/ui/Chip.js.map +1 -1
- package/dist/ui/EmptyState.js +1 -1
- package/dist/ui/EmptyState.js.map +1 -1
- package/dist/ui/ErrorBoundary.js +1 -1
- package/dist/ui/ErrorBoundary.js.map +1 -1
- package/dist/ui/Field.d.ts +1 -1
- package/dist/ui/Field.d.ts.map +1 -1
- package/dist/ui/Field.js +19 -19
- package/dist/ui/Field.js.map +1 -1
- package/dist/ui/FieldHint.js +2 -2
- package/dist/ui/FieldHint.js.map +1 -1
- package/dist/ui/Loading.d.ts +1 -1
- package/dist/ui/Loading.d.ts.map +1 -1
- package/dist/ui/Loading.js +9 -9
- package/dist/ui/Loading.js.map +1 -1
- package/dist/ui/MarqueeText.d.ts +3 -3
- package/dist/ui/MarqueeText.js +5 -5
- package/dist/ui/MarqueeText.js.map +1 -1
- package/dist/ui/Modal.js +5 -5
- package/dist/ui/Modal.js.map +1 -1
- package/dist/ui/ModelPicker.js +1 -1
- package/dist/ui/ModelPicker.js.map +1 -1
- package/dist/ui/Picker.js +16 -16
- package/dist/ui/Picker.js.map +1 -1
- package/dist/ui/SectionHead.d.ts +1 -1
- package/dist/ui/SectionHead.js +4 -4
- package/dist/ui/SectionHead.js.map +1 -1
- package/dist/ui/Segmented.js +5 -5
- package/dist/ui/Segmented.js.map +1 -1
- package/dist/ui/Textarea.d.ts +2 -2
- package/dist/ui/Textarea.js +3 -3
- package/dist/ui/Textarea.js.map +1 -1
- package/dist/ui/Toast.js +3 -3
- package/dist/ui/Toast.js.map +1 -1
- package/dist/ui/card-css.d.ts +1 -1
- package/dist/ui/card-css.d.ts.map +1 -1
- package/dist/ui/card-css.js +22 -22
- package/dist/ui/card-css.js.map +1 -1
- package/dist/ui/chip-css.d.ts +1 -1
- package/dist/ui/chip-css.d.ts.map +1 -1
- package/dist/ui/chip-css.js +10 -10
- package/dist/ui/chip-css.js.map +1 -1
- package/dist/ui/controls-css.d.ts +8 -8
- package/dist/ui/controls-css.d.ts.map +1 -1
- package/dist/ui/controls-css.js +261 -203
- package/dist/ui/controls-css.js.map +1 -1
- package/dist/ui/css.d.ts +0 -11
- package/dist/ui/css.d.ts.map +1 -1
- package/dist/ui/css.js +3 -16
- package/dist/ui/css.js.map +1 -1
- package/dist/ui/feedback-css.d.ts +1 -1
- package/dist/ui/feedback-css.d.ts.map +1 -1
- package/dist/ui/feedback-css.js +30 -31
- package/dist/ui/feedback-css.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/picker-css.d.ts +1 -1
- package/dist/ui/picker-css.d.ts.map +1 -1
- package/dist/ui/picker-css.js +32 -33
- package/dist/ui/picker-css.js.map +1 -1
- package/dist/ui/resizer.d.ts +1 -1
- package/dist/ui/resizer.d.ts.map +1 -1
- package/dist/ui/resizer.js +1 -1
- package/dist/ui/resizer.js.map +1 -1
- package/docs/design/architecture.md +3 -3
- package/docs/design/features/design.md +5 -7
- package/docs/design/features/ui.md +27 -9
- package/docs/design/features.md +1 -1
- package/docs/design/structure.md +1 -1
- package/docs/design/style.md +34 -17
- package/docs/examples/integration.md +3 -5
- package/docs/requirements.md +8 -12
- package/package.json +1 -1
package/docs/design/style.md
CHANGED
|
@@ -7,16 +7,17 @@ token 口径、注入器、明暗判据、定制边界。规则依据见 `docs/d
|
|
|
7
7
|
客户端产物是 `window.__ModuleLoader__.load({ id, factory })` 的 CJS 闭包,
|
|
8
8
|
`import './x.css'` 只会产出独立 css 资源、**内核不加载它** ⇒ CSS 只能以 TS 字符串在运行时打进 `<style>`。
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 前缀规则
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
12
|
+
变量与类名**全生态统一 `dshpc`**,代码里直接写死,不存在按插件替换这回事。
|
|
13
|
+
|
|
14
|
+
| 名称 | 规则 |
|
|
15
|
+
|---|---|
|
|
16
|
+
| 变量 `--dshpc-*` | 直接使用;token 定义与控件样式都写这个前缀 |
|
|
17
|
+
| 类名 `dshpc-*` | 必须与控件里硬编码的 className 逐字一致,改一处就得全改 |
|
|
16
18
|
|
|
17
|
-
>
|
|
18
|
-
>
|
|
19
|
-
> 主防线是 style 标签 id(`createStyleKit({ id })`)与变量前缀隔离。
|
|
19
|
+
> **已知限制**:两个插件若引的 core 版本不同,`.dshpc-*` 规则会互相覆盖(同版本内容一致、无害)。
|
|
20
|
+
> 隔离靠 style 标签 id(`createStyleKit({ id })`)。
|
|
20
21
|
|
|
21
22
|
## 明暗判据(硬约束)
|
|
22
23
|
|
|
@@ -35,26 +36,42 @@ token 原文提取自 `dsh-task-dispatch-table/src/client/ui/tokens.ts`,含深
|
|
|
35
36
|
|
|
36
37
|
| 类别 | 例 |
|
|
37
38
|
|---|---|
|
|
38
|
-
| 前景 / 背景面 | `--
|
|
39
|
-
| 边框 | `--
|
|
40
|
-
| 间距 | `--
|
|
41
|
-
| 字号 / 行高 | `--
|
|
42
|
-
| 语义色 | `--
|
|
43
|
-
| 语义面 | `--
|
|
44
|
-
| 代码 | `--
|
|
39
|
+
| 前景 / 背景面 | `--dshpc-fg` `--dshpc-fg-3` `--dshpc-fg-4` `--dshpc-surface-1` `--dshpc-surface-2` `--dshpc-surface-sunken` `--dshpc-surface-menu` `--dshpc-surface-base` |
|
|
40
|
+
| 边框 | `--dshpc-border` `--dshpc-border-faint` |
|
|
41
|
+
| 间距 | `--dshpc-space-1` … `--dshpc-space-3` |
|
|
42
|
+
| 字号 / 行高 | `--dshpc-font-sm` `--dshpc-font-lg` `--dshpc-line-sm` `--dshpc-line-md` `--dshpc-line-lg` |
|
|
43
|
+
| 语义色 | `--dshpc-business` `--dshpc-success` `--dshpc-danger` `--dshpc-warning` `--dshpc-link` |
|
|
44
|
+
| 语义面 | `--dshpc-open-bg` `--dshpc-open-bg-soft` `--dshpc-chip-bg` `--dshpc-chip-bg-hover` |
|
|
45
|
+
| 代码 | `--dshpc-code-surface` `--dshpc-code-font` |
|
|
45
46
|
|
|
46
47
|
完整清单以 `src/design/tokens-css.ts` 为准(**真源在代码,不在这里抄第二份**)。
|
|
47
48
|
消费方查某个变量叫什么:`kit.cssVar('fg')` 或直接 grep `tokens-css.ts`。
|
|
48
49
|
|
|
50
|
+
## 交互态颜色(hover / active)
|
|
51
|
+
|
|
52
|
+
**实心控件不许用 `opacity` 表达 hover**(2026-10-19 用户点名:「黑色和红色的按钮移上去变化太小,
|
|
53
|
+
完全感觉不到颜色变了」)。压 10% opacity 与底色无关,几乎不可见。
|
|
54
|
+
|
|
55
|
+
改用 token 层的**派生色**(`--dshpc-{accent,danger,success,warning,business}-hover / -active`):
|
|
56
|
+
|
|
57
|
+
| 主题 | 黑底(accent) | 红 / 绿 / 黄 / 蓝底 |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| 亮色 | 掺白提亮(黑 → 灰) | 掺黑压深(红 → 暗红) |
|
|
60
|
+
| 暗色 | 掺黑压深(近白 → 灰) | 掺白提亮 |
|
|
61
|
+
|
|
62
|
+
- 幅度 22% / 36%(hover / active),两种主题下都「一眼看出变了」。
|
|
63
|
+
- 混色对象写成**固定中性色字面量** `#fff` / `#000`,不依赖宿主 `--dsw-static-neutral-*` 是否存在。
|
|
64
|
+
- 旧内核不认 `color-mix` 时整条声明作废 ⇒ 回落该档原色(仍有基本可用性,只是没有 hover 反馈)。
|
|
65
|
+
|
|
49
66
|
## 三条硬规矩
|
|
50
67
|
|
|
51
68
|
1. 不许再有第二处 `document.createElement('style')` —— 一律走 kit。
|
|
52
69
|
2. 不许再出现第二套 style 标签 id —— 一个插件一套 kit。
|
|
53
|
-
3. 域内的规则只能消费 `var(
|
|
70
|
+
3. 域内的规则只能消费 `var(--dshpc-*)`,颜色 / 尺寸 / 字号一律来自 token 层,不写死值。
|
|
54
71
|
|
|
55
72
|
## 定制边界
|
|
56
73
|
|
|
57
74
|
- **换肤**:给同一批变量名赋新值(在插件自己的样式域里覆盖),不需要 fork。
|
|
58
|
-
- **加域**:`kit.registerStyle('
|
|
75
|
+
- **加域**:`kit.registerStyle('widget', css)`,同一域重复登记 = 覆盖。
|
|
59
76
|
- **`tokens` 域恒排最前**(变量定义必须先于消费它的规则),kit 内部已保证。
|
|
60
77
|
- 皮肤写在调用方自己的样式域里;组件只认 token,不认调用方的具体颜色。
|
|
@@ -19,14 +19,12 @@ pnpm add dsh-plugin-core
|
|
|
19
19
|
import { createStyleKit } from 'dsh-plugin-core/design'
|
|
20
20
|
import { ensureControls, setStyleKit } from 'dsh-plugin-core/ui'
|
|
21
21
|
|
|
22
|
-
const kit = createStyleKit({ id: 'dsh-task-reminder-ui'
|
|
22
|
+
const kit = createStyleKit({ id: 'dsh-task-reminder-ui' })
|
|
23
23
|
setStyleKit(kit)
|
|
24
24
|
ensureControls()
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
`id`
|
|
28
|
-
两者取值按**项目规范**定(多插件同页必须互不冲突)——示例里的 `dsh-task-reminder` / `reminder`
|
|
29
|
-
只是演示命名规律(前缀取插件名缩写),不是可用值的枚举。
|
|
27
|
+
`id` 必须插件内唯一(多插件同页靠它互不覆盖);变量与类名统一使用 `dshpc` 前缀,不需要传参。
|
|
30
28
|
|
|
31
29
|
## 2. 用一个控件
|
|
32
30
|
|
|
@@ -97,7 +95,7 @@ kit.dispose() // 撤掉 <style> 标签并清空登记域(插件卸载 / HMR
|
|
|
97
95
|
|
|
98
96
|
| 坑 | 现象 | 解法 |
|
|
99
97
|
|---|---|---|
|
|
100
|
-
| 忘了 `setStyleKit` 就渲染控件 |
|
|
98
|
+
| 忘了 `setStyleKit` 就渲染控件 | 样式晚一帧或落到默认 style id | 入口处先调,再渲染 |
|
|
101
99
|
| 直接 `import` 官方 `@deepseek-ai/*` 并指望本包帮你引 | Node 下 `ERR_MODULE_NOT_FOUND` | 本包 `ui` 已零官方依赖;你要用官方件就在插件侧自己处理平台模块 |
|
|
102
100
|
| 给 `read` 少传第三参 `range` | 远端拒:`expected 3 business argument(s) … got 2` | 一律显式传 `{}` |
|
|
103
101
|
| 用 `relativePast` 显示未来时间 | 「3 分钟后」显示成「刚刚」 | 用 `relativeFuture` |
|
package/docs/requirements.md
CHANGED
|
@@ -38,8 +38,8 @@ dsh-plugin-core/
|
|
|
38
38
|
|
|
39
39
|
### 2.1 design
|
|
40
40
|
|
|
41
|
-
- token
|
|
42
|
-
- 样式注入器工厂 `createStyleKit({ id
|
|
41
|
+
- token 变量表,**变量前缀全生态统一为 `dshpc`**
|
|
42
|
+
- 样式注入器工厂 `createStyleKit({ id })`
|
|
43
43
|
- 主题判据
|
|
44
44
|
- **零 React、没有组件**
|
|
45
45
|
|
|
@@ -76,7 +76,7 @@ dsh-plugin-core/
|
|
|
76
76
|
- 设置页骨架(**候补**:等出现第二个愿意用它的消费者再抽;`stp` 目前走官方 `SettingsForm`)
|
|
77
77
|
- `host` 子包(**已取消**)
|
|
78
78
|
- `llm/` 独立子包(**已取消**,ModelPicker 进 ui)
|
|
79
|
-
- 业务件:`TaskPicker` / 日历 / `CodeViewer` 审美 / 业务 token(`--
|
|
79
|
+
- 业务件:`TaskPicker` / 日历 / `CodeViewer` 审美 / 业务 token(`--dshpc-cal-*` / chip-bg /
|
|
80
80
|
filechip / PROCESS_FILES_CSS)/ 页面几何 / 插件私有路由 / DB 表 / `mirror/` 之外的业务 UI
|
|
81
81
|
|
|
82
82
|
## 4. 立包判据(防止子包无限膨胀)
|
|
@@ -104,8 +104,7 @@ dsh-plugin-core/
|
|
|
104
104
|
现 `dsh-task-dispatch-table/src/client/ui/style.ts:25` 是模块级单例 + 固定 style id
|
|
105
105
|
`dsh-task-dispatch-table-ui`,多插件同页必然互相覆盖。
|
|
106
106
|
|
|
107
|
-
⇒ 必须是 `createStyleKit({ id
|
|
108
|
-
(自己的 `<style>` 标签 id + 自己的变量前缀),互不干扰。
|
|
107
|
+
⇒ 必须是 `createStyleKit({ id })`:每个插件调一次领一套自己的(`<style>` 标签 id 按插件唯一)。
|
|
109
108
|
|
|
110
109
|
### 5.3 明暗色判据(别跟错)
|
|
111
110
|
|
|
@@ -134,15 +133,12 @@ dsh-plugin-core/
|
|
|
134
133
|
|
|
135
134
|
| 位置 | 约定 |
|
|
136
135
|
|---|---|
|
|
137
|
-
| design | `createStyleKit({ id
|
|
138
|
-
| ui / ModelPicker | `variant: 'cascade' \| 'flat'`(级联:先厂商后模型 /
|
|
139
|
-
数据统一为 `groups: [{ value, label, options }]`,一份数据两种渲染。**禁止用数字或无意义名** |
|
|
136
|
+
| design | `createStyleKit({ id })` → `{ registerStyle, ensureStyles, applyStyle }` |
|
|
137
|
+
| ui / ModelPicker | `variant: 'cascade' \| 'flat'`(级联:先厂商后模型 / 平铺:一个下拉列全部);数据统一为 `groups: [{ value, label, options }]`,一份数据两种渲染。**禁止用数字或无意义名** |
|
|
140
138
|
| ui / Picker | `mode: 'single' \| 'multiple'`、`max`、分组、搜索、空态、降级 |
|
|
141
139
|
| explorer | `WorkspaceFilesFace` 由插件注入(`list` / `stat` / `read` 最小面),组件不抓宿主全局 |
|
|
142
|
-
| explorer / WorkspacePicker | `WorkspacePicker({ workspaces, mode, max, onChange })` ——
|
|
143
|
-
|
|
144
|
-
| session | `SessionPreview({ sessionId, source, variant })` —— `source` = 取数能力接口
|
|
145
|
-
(会话预览内部有交互:传输文件等,光有静态消息流不够) |
|
|
140
|
+
| explorer / WorkspacePicker | `WorkspacePicker({ workspaces, mode, max, onChange })` —— 数据调用方给(工作区列表是 host 侧 `ctx.workspaceRegistry.list()` 取的,要经插件私有通道送到 client,**组件自己取不到**) |
|
|
141
|
+
| session | `SessionPreview({ sessionId, source, variant })` —— `source` = 取数能力接口(会话预览内部有交互:传输文件等,光有静态消息流不够) |
|
|
146
142
|
|
|
147
143
|
## 7. 分期与任务切分
|
|
148
144
|
|
package/package.json
CHANGED