@dsh-plugin/dsh-ui-components 0.0.1 → 0.1.0-dev.43613492370

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.
Files changed (65) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +21 -21
  3. package/README.md +136 -136
  4. package/README.zh_CN.md +136 -136
  5. package/docs/tokens.md +67 -67
  6. package/lib/basic/form.js +49 -49
  7. package/lib/basic/styles.js +391 -391
  8. package/lib/composites/styles.js +427 -427
  9. package/lib/data/styles.js +257 -257
  10. package/lib/display/styles.js +310 -310
  11. package/lib/feedback/styles.js +228 -228
  12. package/lib/foundation/bridge.js +203 -203
  13. package/lib/navigation/styles.js +417 -417
  14. package/package.json +104 -104
  15. package/scripts/check-size.mjs +69 -69
  16. package/scripts/dump-npm-latest.mjs +59 -59
  17. package/scripts/gen-host-tokens.mjs +61 -61
  18. package/scripts/gen-icons.mjs +188 -178
  19. package/scripts/verify-no-literal-colors.mjs +63 -63
  20. package/scripts/verify-tokens.mjs +135 -135
  21. package/src/basic/button.tsx +76 -76
  22. package/src/basic/form.tsx +187 -187
  23. package/src/basic/icon-button.tsx +66 -66
  24. package/src/basic/index.ts +38 -38
  25. package/src/basic/input.tsx +140 -140
  26. package/src/basic/select.tsx +120 -120
  27. package/src/basic/styles.ts +412 -412
  28. package/src/basic/toggle.tsx +116 -116
  29. package/src/composites/data-view.tsx +189 -189
  30. package/src/composites/index.ts +11 -11
  31. package/src/composites/indicator.tsx +90 -90
  32. package/src/composites/menu-select.tsx +230 -230
  33. package/src/composites/panel.tsx +72 -72
  34. package/src/composites/settings.tsx +80 -80
  35. package/src/composites/styles.ts +450 -450
  36. package/src/data/collection.tsx +71 -71
  37. package/src/data/index.ts +39 -39
  38. package/src/data/info.tsx +89 -89
  39. package/src/data/picker.tsx +113 -113
  40. package/src/data/styles.ts +278 -278
  41. package/src/display/container.tsx +67 -67
  42. package/src/display/feedback.tsx +92 -92
  43. package/src/display/index.ts +44 -44
  44. package/src/display/label.tsx +165 -165
  45. package/src/display/overlay.tsx +103 -103
  46. package/src/display/styles.ts +332 -332
  47. package/src/feedback/global.tsx +110 -110
  48. package/src/feedback/index.ts +19 -19
  49. package/src/feedback/inline.tsx +50 -50
  50. package/src/feedback/panel.tsx +93 -93
  51. package/src/feedback/styles.ts +250 -250
  52. package/src/foundation/bridge.ts +318 -318
  53. package/src/foundation/icons.tsx +315 -315
  54. package/src/foundation/index.ts +33 -33
  55. package/src/foundation/palette.ts +153 -153
  56. package/src/foundation/provider.tsx +62 -62
  57. package/src/foundation/style.ts +63 -63
  58. package/src/foundation/tokens.ts +62 -62
  59. package/src/index.ts +18 -18
  60. package/src/navigation/hierarchy.tsx +82 -82
  61. package/src/navigation/index.ts +21 -21
  62. package/src/navigation/indicator.tsx +125 -125
  63. package/src/navigation/menu.tsx +94 -94
  64. package/src/navigation/segmented.tsx +136 -136
  65. package/src/navigation/styles.ts +438 -438
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026, dsh-ui-components contributors
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026, dsh-ui-components contributors
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/NOTICE CHANGED
@@ -1,21 +1,21 @@
1
- /* dsh-ui-components 第三方组件声明
2
- *
3
- * 本包在运行期依赖以下第三方作品,按其许可证要求在此声明来源与授权:
4
- *
5
- * 1. IconPark(@icon-park/react 1.4.2,Apache License 2.0)
6
- * https://github.com/bytedance/IconPark
7
- * 本包 src/icons/ 下的 2658 个图标模块由脚本从该包的 es/icons/ 于安装时
8
- * 直接转导出,不复制其源码;src/icons-index.ts 的图标元数据由该包
9
- * icons.json 生成。图标图形的著作权归 IconPark 及其贡献者所有。
10
- * 消费方使用本包即同时受 Apache License 2.0 约束,该许可证全文见
11
- * https://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * 2. Arco Design(@arco-design/web-react 2.66.18,MIT License)
14
- * https://github.com/arco-design/arco-design
15
- * 本包不复制、不打包 Arco 源码,仅在运行期通过 @dsh-plugin/dsh-loader
16
- * 提供的 Arco 单例使用其组件,并以 CSS 变量重绑的方式覆盖其外观。
17
- *
18
- * 3. DeepSeek Harness 设计令牌(--dsw-*)
19
- * 令牌名称与取值来自 DSH 源码 packages/client/ui-theme/src/styles/。
20
- * 本包只引用变量名并附带回退值,不内联其样式表。
21
- */
1
+ /* dsh-ui-components 第三方组件声明
2
+ *
3
+ * 本包在运行期依赖以下第三方作品,按其许可证要求在此声明来源与授权:
4
+ *
5
+ * 1. IconPark(@icon-park/react 1.4.2,Apache License 2.0)
6
+ * https://github.com/bytedance/IconPark
7
+ * 本包 src/icons/ 下的 2658 个图标模块由脚本从该包的 es/icons/ 于安装时
8
+ * 直接转导出,不复制其源码;src/icons-index.ts 的图标元数据由该包
9
+ * icons.json 生成。图标图形的著作权归 IconPark 及其贡献者所有。
10
+ * 消费方使用本包即同时受 Apache License 2.0 约束,该许可证全文见
11
+ * https://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * 2. Arco Design(@arco-design/web-react 2.66.18,MIT License)
14
+ * https://github.com/arco-design/arco-design
15
+ * 本包不复制、不打包 Arco 源码,仅在运行期通过 @dsh-plugin/dsh-loader
16
+ * 提供的 Arco 单例使用其组件,并以 CSS 变量重绑的方式覆盖其外观。
17
+ *
18
+ * 3. DeepSeek Harness 设计令牌(--dsw-*)
19
+ * 令牌名称与取值来自 DSH 源码 packages/client/ui-theme/src/styles/。
20
+ * 本包只引用变量名并附带回退值,不内联其样式表。
21
+ */
package/README.md CHANGED
@@ -1,136 +1,136 @@
1
- <div align="center">
2
-
3
- # dsh-ui-components
4
-
5
- **A React component library that restyles Arco Design with DeepSeek Harness design tokens and exposes the full IconPark icon set by name.**
6
-
7
- English | [简体中文](README.zh_CN.md)
8
-
9
- </div>
10
-
11
- ## What this is
12
-
13
- Plugins in the DSH family each hand-roll their own buttons, inputs and dialogs, so the same product ends up with three different border radii. This package is the shared answer: the semantics and keyboard behavior of [Arco Design](https://arco.design), skinned with the DeepSeek Harness `--dsw-*` design tokens, plus the [IconPark](https://iconpark.oceanengine.com) icon set.
14
-
15
- It ships as an unbundled ESM source library. Your plugin's bundler inlines it, so React and Arco stay the single instances the host already owns, and no CSS pipeline is needed on your side.
16
-
17
- ## Install
18
-
19
- ```sh
20
- npm install @dsh-plugin/dsh-ui-components
21
- ```
22
-
23
- `react`, `react-dom` and `@dsh-plugin/dsh-loader` are peer dependencies; the host provides all three.
24
-
25
- ## Use
26
-
27
- Wrap your plugin's React root once, then import components from the package root.
28
-
29
- ```tsx
30
- import { DshProvider, Card, Field, Input, Button, Switch } from '@dsh-plugin/dsh-ui-components'
31
-
32
- export function SettingsPage() {
33
- return (
34
- <DshProvider>
35
- <Card title="Proxy">
36
- <Field label="Host" description="Affects requests made through global fetch." htmlFor="host">
37
- <Input id="host" mono placeholder="127.0.0.1" />
38
- </Field>
39
- <Field label="Enabled" layout="inline">
40
- <Switch defaultChecked />
41
- </Field>
42
- <Button variant="primary">Save</Button>
43
- </Card>
44
- </DshProvider>
45
- )
46
- }
47
- ```
48
-
49
- `DshProvider` injects the skin, mounts icon defaults, and routes every Arco overlay through a container that carries the same CSS variables. Components render without it, but popups would then attach to `body` and lose the skin.
50
-
51
- In your `tsdown` config, keep these three external:
52
-
53
- ```js
54
- const CLIENT_EXTERNALS = [
55
- 'react',
56
- 'react/jsx-runtime',
57
- 'react-dom',
58
- 'react-dom/client',
59
- '@dsh-plugin/dsh-loader/client',
60
- ]
61
- ```
62
-
63
- ## Theming
64
-
65
- Colours are not configurable props and do not need to be. The skin is a single CSS variable bridge that rebinds Arco's own variables onto DSH semantic tokens, so light and dark follow the host's `body[data-ds-dark-theme]` attribute with no JavaScript involved and no theme branching in component code.
66
-
67
- The bridge sits on a `.dsh-ui` class rather than on `body`, which keeps the host's own Arco theme untouched. `scripts/verify-tokens.mjs` checks every host variable referenced by this package against the host stylesheets, so a rename in DSH fails offline instead of silently dropping styles.
68
-
69
- ## Icons
70
-
71
- Three channels, because inlining all 2658 icons into every plugin would be indefensible:
72
-
73
- ```tsx
74
- // 1. Curated set, intent-named (~110 icons, tree-shaken to what you use)
75
- import { Icon, Icons } from '@dsh-plugin/dsh-ui-components'
76
- <Icon name="Settings" size={18} />
77
- <Icons.GitBranch />
78
-
79
- // 2. Any of the 2658 icons, by subpath — only that icon enters your bundle
80
- import Rocket from '@dsh-plugin/dsh-ui-components/icons/Rocket'
81
- <Icon of={Rocket} size={18} />
82
-
83
- // 3. Full metadata for pickers and search, imports no icon modules
84
- import { ICON_INDEX } from '@dsh-plugin/dsh-ui-components/icons-index'
85
- ```
86
-
87
- Subpath names are the PascalCase form of the IconPark name: `a-cane` is `ACane`, `setting` is `Setting`. Every entry in `ICON_INDEX` carries `name`, `pascal`, `title`, `titleZh`, `category`, `tags` and `rtl`.
88
-
89
- Icons inherit `currentColor`, so they follow the surrounding text colour automatically.
90
-
91
- ## Components
92
-
93
- | Group | Exports |
94
- |---|---|
95
- | Foundation | `DshProvider`, `Icon`, `Icons`, `ICON_NAMES`, `DshIconProvider`, `G`, `cx`, `ICON_INDEX` |
96
- | Buttons | `Button`, `IconButton` |
97
- | Inputs | `Input`, `Textarea`, `InputNumber`, `Select`, `AutoComplete` |
98
- | Toggles | `Checkbox`, `CheckboxGroup`, `Radio`, `RadioGroup`, `Switch`, `Slider`, `Rate` |
99
- | Form | `Form`, `FormItem`, `Field` |
100
- | Display | `Card`, `Tag`, `Pill`, `Avatar`, `Badge`, `Divider`, `Descriptions`, `Typography`, `Text`, `Paragraph`, `Empty`, `Skeleton`, `Spin`, `Tooltip`, `Popover`, `HoverCard`, `Collapse`, `CollapseItem` |
101
- | Feedback | `Alert`, `Progress`, `Result`, `Popconfirm`, `Modal`, `confirm`, `Drawer`, `Message`, `Notification`, `message`, `messageSuccess`, `messageError`, `messageWarning` |
102
- | Navigation | `Menu`, `MenuItem`, `Dropdown`, `Tabs`, `TabPane`, `Breadcrumb`, `BreadcrumbItem`, `Pagination`, `Steps`, `Step`, `SegmentedControl`, `DisclosureRow`, `StateDot` |
103
- | Data | `Table`, `List`, `ListItem`, `Tree`, `DatePicker`, `TimePicker`, `Cascader`, `TreeSelect`, `Transfer`, `Statistic`, `Timeline`, `TimelineItem`, `Calendar`, `Carousel`, `Image` |
104
- | DSH composites | `SettingsCard`, `SettingsRow`, `PanelShell`, `MenuSelect`, `JsonTree`, `CodeBlockShell`, `FileTypeBadge`, `StatusLine` |
105
-
106
- Every control forwards native props and `className`, so escaping the defaults never requires forking a component.
107
-
108
- `SettingsCard` + `SettingsRow` render the host's settings-page card. `PanelShell` is a plain overlay shell that already satisfies the 120px top and bottom margin rule and scrolls its body through the host's `Scrollbar`. `MenuSelect` is the self-drawn dropdown for settings pages, where a native `<select>` popup cannot follow the DSH theme.
109
-
110
- ## Preview
111
-
112
- ```sh
113
- npm run gen:tokens # copy the host token sheets into docs/preview/
114
- npm run preview # http://localhost:5178
115
- ```
116
-
117
- The preview site renders every component against the host's own token values, with a light/dark switch and a searchable index over all 2658 icons. It reads the package source directly, so a change shows up on refresh without a build.
118
-
119
- ## Development
120
-
121
- ```sh
122
- npm install
123
- npm run gen:icons # regenerate the 2658 icon modules and metadata
124
- npm run typecheck
125
- npm run build
126
- npm test
127
- npm run verify # token names, icon channels, literal colours, package size
128
- ```
129
-
130
- `npm run verify:tokens` needs the DSH host stylesheets. Point `DSH_UI_THEME_DIR` at `packages/client/ui-theme/src/styles` of a DSH checkout, or keep one at `.dsh/temp/session-tree-harness` in the parent directory.
131
-
132
- See [PLAN.md](PLAN.md) for the batch scope and current progress, and [docs/tokens.md](docs/tokens.md) for the token mapping table.
133
-
134
- ## License
135
-
136
- MIT. IconPark artwork is Apache-2.0; see [NOTICE](NOTICE).
1
+ <div align="center">
2
+
3
+ # dsh-ui-components
4
+
5
+ **A React component library that restyles Arco Design with DeepSeek Harness design tokens and exposes the full IconPark icon set by name.**
6
+
7
+ English | [简体中文](README.zh_CN.md)
8
+
9
+ </div>
10
+
11
+ ## What this is
12
+
13
+ Plugins in the DSH family each hand-roll their own buttons, inputs and dialogs, so the same product ends up with three different border radii. This package is the shared answer: the semantics and keyboard behavior of [Arco Design](https://arco.design), skinned with the DeepSeek Harness `--dsw-*` design tokens, plus the [IconPark](https://iconpark.oceanengine.com) icon set.
14
+
15
+ It ships as an unbundled ESM source library. Your plugin's bundler inlines it, so React and Arco stay the single instances the host already owns, and no CSS pipeline is needed on your side.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ npm install @dsh-plugin/dsh-ui-components
21
+ ```
22
+
23
+ `react`, `react-dom` and `@dsh-plugin/dsh-loader` are peer dependencies; the host provides all three.
24
+
25
+ ## Use
26
+
27
+ Wrap your plugin's React root once, then import components from the package root.
28
+
29
+ ```tsx
30
+ import { DshProvider, Card, Field, Input, Button, Switch } from '@dsh-plugin/dsh-ui-components'
31
+
32
+ export function SettingsPage() {
33
+ return (
34
+ <DshProvider>
35
+ <Card title="Proxy">
36
+ <Field label="Host" description="Affects requests made through global fetch." htmlFor="host">
37
+ <Input id="host" mono placeholder="127.0.0.1" />
38
+ </Field>
39
+ <Field label="Enabled" layout="inline">
40
+ <Switch defaultChecked />
41
+ </Field>
42
+ <Button variant="primary">Save</Button>
43
+ </Card>
44
+ </DshProvider>
45
+ )
46
+ }
47
+ ```
48
+
49
+ `DshProvider` injects the skin, mounts icon defaults, and routes every Arco overlay through a container that carries the same CSS variables. Components render without it, but popups would then attach to `body` and lose the skin.
50
+
51
+ In your `tsdown` config, keep these three external:
52
+
53
+ ```js
54
+ const CLIENT_EXTERNALS = [
55
+ 'react',
56
+ 'react/jsx-runtime',
57
+ 'react-dom',
58
+ 'react-dom/client',
59
+ '@dsh-plugin/dsh-loader/client',
60
+ ]
61
+ ```
62
+
63
+ ## Theming
64
+
65
+ Colours are not configurable props and do not need to be. The skin is a single CSS variable bridge that rebinds Arco's own variables onto DSH semantic tokens, so light and dark follow the host's `body[data-ds-dark-theme]` attribute with no JavaScript involved and no theme branching in component code.
66
+
67
+ The bridge sits on a `.dsh-ui` class rather than on `body`, which keeps the host's own Arco theme untouched. `scripts/verify-tokens.mjs` checks every host variable referenced by this package against the host stylesheets, so a rename in DSH fails offline instead of silently dropping styles.
68
+
69
+ ## Icons
70
+
71
+ Three channels, because inlining all 2658 icons into every plugin would be indefensible:
72
+
73
+ ```tsx
74
+ // 1. Curated set, intent-named (~110 icons, tree-shaken to what you use)
75
+ import { Icon, Icons } from '@dsh-plugin/dsh-ui-components'
76
+ <Icon name="Settings" size={18} />
77
+ <Icons.GitBranch />
78
+
79
+ // 2. Any of the 2658 icons, by subpath — only that icon enters your bundle
80
+ import Rocket from '@dsh-plugin/dsh-ui-components/icons/Rocket'
81
+ <Icon of={Rocket} size={18} />
82
+
83
+ // 3. Full metadata for pickers and search, imports no icon modules
84
+ import { ICON_INDEX } from '@dsh-plugin/dsh-ui-components/icons-index'
85
+ ```
86
+
87
+ Subpath names are the PascalCase form of the IconPark name: `a-cane` is `ACane`, `setting` is `Setting`. Every entry in `ICON_INDEX` carries `name`, `pascal`, `title`, `titleZh`, `category`, `tags` and `rtl`.
88
+
89
+ Icons inherit `currentColor`, so they follow the surrounding text colour automatically.
90
+
91
+ ## Components
92
+
93
+ | Group | Exports |
94
+ |---|---|
95
+ | Foundation | `DshProvider`, `Icon`, `Icons`, `ICON_NAMES`, `DshIconProvider`, `G`, `cx`, `ICON_INDEX` |
96
+ | Buttons | `Button`, `IconButton` |
97
+ | Inputs | `Input`, `Textarea`, `InputNumber`, `Select`, `AutoComplete` |
98
+ | Toggles | `Checkbox`, `CheckboxGroup`, `Radio`, `RadioGroup`, `Switch`, `Slider`, `Rate` |
99
+ | Form | `Form`, `FormItem`, `Field` |
100
+ | Display | `Card`, `Tag`, `Pill`, `Avatar`, `Badge`, `Divider`, `Descriptions`, `Typography`, `Text`, `Paragraph`, `Empty`, `Skeleton`, `Spin`, `Tooltip`, `Popover`, `HoverCard`, `Collapse`, `CollapseItem` |
101
+ | Feedback | `Alert`, `Progress`, `Result`, `Popconfirm`, `Modal`, `confirm`, `Drawer`, `Message`, `Notification`, `message`, `messageSuccess`, `messageError`, `messageWarning` |
102
+ | Navigation | `Menu`, `MenuItem`, `Dropdown`, `Tabs`, `TabPane`, `Breadcrumb`, `BreadcrumbItem`, `Pagination`, `Steps`, `Step`, `SegmentedControl`, `DisclosureRow`, `StateDot` |
103
+ | Data | `Table`, `List`, `ListItem`, `Tree`, `DatePicker`, `TimePicker`, `Cascader`, `TreeSelect`, `Transfer`, `Statistic`, `Timeline`, `TimelineItem`, `Calendar`, `Carousel`, `Image` |
104
+ | DSH composites | `SettingsCard`, `SettingsRow`, `PanelShell`, `MenuSelect`, `JsonTree`, `CodeBlockShell`, `FileTypeBadge`, `StatusLine` |
105
+
106
+ Every control forwards native props and `className`, so escaping the defaults never requires forking a component.
107
+
108
+ `SettingsCard` + `SettingsRow` render the host's settings-page card. `PanelShell` is a plain overlay shell that already satisfies the 120px top and bottom margin rule and scrolls its body through the host's `Scrollbar`. `MenuSelect` is the self-drawn dropdown for settings pages, where a native `<select>` popup cannot follow the DSH theme.
109
+
110
+ ## Preview
111
+
112
+ ```sh
113
+ npm run gen:tokens # copy the host token sheets into docs/preview/
114
+ npm run preview # http://localhost:5178
115
+ ```
116
+
117
+ The preview site renders every component against the host's own token values, with a light/dark switch and a searchable index over all 2658 icons. It reads the package source directly, so a change shows up on refresh without a build.
118
+
119
+ ## Development
120
+
121
+ ```sh
122
+ npm install
123
+ npm run gen:icons # regenerate the 2658 icon modules and metadata
124
+ npm run typecheck
125
+ npm run build
126
+ npm test
127
+ npm run verify # token names, icon channels, literal colours, package size
128
+ ```
129
+
130
+ `npm run verify:tokens` needs the DSH host stylesheets. Point `DSH_UI_THEME_DIR` at `packages/client/ui-theme/src/styles` of a DSH checkout, or keep one at `.dsh/temp/session-tree-harness` in the parent directory.
131
+
132
+ See [PLAN.md](PLAN.md) for the batch scope and current progress, and [docs/tokens.md](docs/tokens.md) for the token mapping table.
133
+
134
+ ## License
135
+
136
+ MIT. IconPark artwork is Apache-2.0; see [NOTICE](NOTICE).
package/README.zh_CN.md CHANGED
@@ -1,136 +1,136 @@
1
- <div align="center">
2
-
3
- # dsh-ui-components
4
-
5
- **一套用 DeepSeek Harness 设计令牌重塑 Arco Design 外观、并按名暴露全量 IconPark 图标的 React 组件库。**
6
-
7
- [English](README.md) | 简体中文
8
-
9
- </div>
10
-
11
- ## 这是什么
12
-
13
- DSH 生态里的插件各自手写按钮、输入框与弹窗,同一个产品最后会出现三种圆角。本包是这些控件的统一实现:交互与键盘行为来自 [Arco Design](https://arco.design),外观由 DeepSeek Harness 的 `--dsw-*` 设计令牌驱动,图标取自 [IconPark](https://iconpark.oceanengine.com)。
14
-
15
- 产物是不打包的 ESM 源码库。插件自己的构建器把它内联进产物,因此运行期 React 与 Arco 仍是宿主持有的唯一实例,插件侧也不需要任何 CSS 处理管线。
16
-
17
- ## 安装
18
-
19
- ```sh
20
- npm install @dsh-plugin/dsh-ui-components
21
- ```
22
-
23
- `react`、`react-dom` 与 `@dsh-plugin/dsh-loader` 是 peer 依赖,三者都由宿主提供。
24
-
25
- ## 使用
26
-
27
- 在插件的 React 树根部挂一次 `DshProvider`,随后从包根导入组件。
28
-
29
- ```tsx
30
- import { DshProvider, Card, Field, Input, Button, Switch } from '@dsh-plugin/dsh-ui-components'
31
-
32
- export function SettingsPage() {
33
- return (
34
- <DshProvider>
35
- <Card title="代理">
36
- <Field label="地址" description="仅影响走全局 fetch 的请求。" htmlFor="host">
37
- <Input id="host" mono placeholder="127.0.0.1" />
38
- </Field>
39
- <Field label="启用" layout="inline">
40
- <Switch defaultChecked />
41
- </Field>
42
- <Button variant="primary">保存</Button>
43
- </Card>
44
- </DshProvider>
45
- )
46
- }
47
- ```
48
-
49
- `DshProvider` 注入皮肤、统一图标默认值,并把 Arco 的全部浮层收进持有同一套 CSS 变量的容器。不挂它组件也能渲染,但浮层会挂到 `body` 下而丢掉皮肤。
50
-
51
- 打包配置里把这三项保持为 external:
52
-
53
- ```js
54
- const CLIENT_EXTERNALS = [
55
- 'react',
56
- 'react/jsx-runtime',
57
- 'react-dom',
58
- 'react-dom/client',
59
- '@dsh-plugin/dsh-loader/client',
60
- ]
61
- ```
62
-
63
- ## 主题
64
-
65
- 颜色不是可配置的 props,也不需要是。皮肤是一张把 Arco 自身变量整体改指 DSH 语义令牌的 CSS 变量桥,因此深浅色跟随宿主的 `body[data-ds-dark-theme]` 属性自动切换,不涉及任何 JavaScript,组件代码里也没有主题分支。
66
-
67
- 桥接表挂在 `.dsh-ui` 类上而不是 `body` 上,宿主自己的 Arco 主题因此不受影响。`scripts/verify-tokens.mjs` 会把本包引用的每个宿主变量与宿主样式表比对,DSH 改名时在离线阶段直接报错,而不是等到样式静默失效。
68
-
69
- ## 图标
70
-
71
- 三条通道,因为把 2658 个图标全量内联进每个插件并不合理:
72
-
73
- ```tsx
74
- // 1. 策划命名集(约 110 个,未使用的会被 tree-shaking 移除)
75
- import { Icon, Icons } from '@dsh-plugin/dsh-ui-components'
76
- <Icon name="Settings" size={18} />
77
- <Icons.GitBranch />
78
-
79
- // 2. 全量 2658 个,按子路径引入 —— 只有该图标进入产物
80
- import Rocket from '@dsh-plugin/dsh-ui-components/icons/Rocket'
81
- <Icon of={Rocket} size={18} />
82
-
83
- // 3. 全量元数据,供选择器与搜索使用,不导入任何图标模块
84
- import { ICON_INDEX } from '@dsh-plugin/dsh-ui-components/icons-index'
85
- ```
86
-
87
- 子路径名是 IconPark 名字的 PascalCase 形式:`a-cane` 对应 `ACane`,`setting` 对应 `Setting`。`ICON_INDEX` 的每条记录带 `name`、`pascal`、`title`、`titleZh`、`category`、`tags` 与 `rtl` 七个字段。
88
-
89
- 图标继承 `currentColor`,颜色跟随周围文字。
90
-
91
- ## 组件
92
-
93
- | 分组 | 导出 |
94
- |---|---|
95
- | 基础层 | `DshProvider`、`Icon`、`Icons`、`ICON_NAMES`、`DshIconProvider`、`G`、`cx`、`ICON_INDEX` |
96
- | 按钮 | `Button`、`IconButton` |
97
- | 输入 | `Input`、`Textarea`、`InputNumber`、`Select`、`AutoComplete` |
98
- | 选择 | `Checkbox`、`CheckboxGroup`、`Radio`、`RadioGroup`、`Switch`、`Slider`、`Rate` |
99
- | 表单 | `Form`、`FormItem`、`Field` |
100
- | 展示 | `Card`、`Tag`、`Pill`、`Avatar`、`Badge`、`Divider`、`Descriptions`、`Typography`、`Text`、`Paragraph`、`Empty`、`Skeleton`、`Spin`、`Tooltip`、`Popover`、`HoverCard`、`Collapse`、`CollapseItem` |
101
- | 反馈 | `Alert`、`Progress`、`Result`、`Popconfirm`、`Modal`、`confirm`、`Drawer`、`Message`、`Notification`、`message`、`messageSuccess`、`messageError`、`messageWarning` |
102
- | 导航 | `Menu`、`MenuItem`、`Dropdown`、`Tabs`、`TabPane`、`Breadcrumb`、`BreadcrumbItem`、`Pagination`、`Steps`、`Step`、`SegmentedControl`、`DisclosureRow`、`StateDot` |
103
- | 数据 | `Table`、`List`、`ListItem`、`Tree`、`DatePicker`、`TimePicker`、`Cascader`、`TreeSelect`、`Transfer`、`Statistic`、`Timeline`、`TimelineItem`、`Calendar`、`Carousel`、`Image` |
104
- | DSH 组合件 | `SettingsCard`、`SettingsRow`、`PanelShell`、`MenuSelect`、`JsonTree`、`CodeBlockShell`、`FileTypeBadge`、`StatusLine` |
105
-
106
- 所有控件都透传原生 props 与 `className`,因此想脱离默认样式时不必 fork 组件。
107
-
108
- `SettingsCard` 加 `SettingsRow` 组成宿主设置页的卡片结构。`PanelShell` 是自带 120px 上下留白、内容区走宿主 `Scrollbar` 的浮层外壳。`MenuSelect` 是设置页用的自绘下拉,因为原生 `<select>` 的弹层无法跟随 DSH 主题。
109
-
110
- ## 预览
111
-
112
- ```sh
113
- npm run gen:tokens # 把宿主令牌样式表复制到 docs/preview/
114
- npm run preview # http://localhost:5178
115
- ```
116
-
117
- 预览站用宿主自己的令牌取值渲染全部组件,带深浅主题切换与覆盖 2658 个图标的可搜索索引。它直接读包源码,改完刷新即可看到效果,不必先构建。
118
-
119
- ## 开发
120
-
121
- ```sh
122
- npm install
123
- npm run gen:icons # 重新生成 2658 个图标模块与元数据
124
- npm run typecheck
125
- npm run build
126
- npm test
127
- npm run verify # 令牌名、图标通道、字面颜色、包体积
128
- ```
129
-
130
- `npm run verify:tokens` 需要宿主样式表。把 `DSH_UI_THEME_DIR` 指向 DSH 检出里的 `packages/client/ui-theme/src/styles`,或在上级目录保留一份 `.dsh/temp/session-tree-harness`。
131
-
132
- 分批范围与当前进度见 [PLAN.md](PLAN.md),令牌对照表见 [docs/tokens.md](docs/tokens.md)。
133
-
134
- ## 许可
135
-
136
- MIT。IconPark 图形为 Apache-2.0,详见 [NOTICE](NOTICE)。
1
+ <div align="center">
2
+
3
+ # dsh-ui-components
4
+
5
+ **一套用 DeepSeek Harness 设计令牌重塑 Arco Design 外观、并按名暴露全量 IconPark 图标的 React 组件库。**
6
+
7
+ [English](README.md) | 简体中文
8
+
9
+ </div>
10
+
11
+ ## 这是什么
12
+
13
+ DSH 生态里的插件各自手写按钮、输入框与弹窗,同一个产品最后会出现三种圆角。本包是这些控件的统一实现:交互与键盘行为来自 [Arco Design](https://arco.design),外观由 DeepSeek Harness 的 `--dsw-*` 设计令牌驱动,图标取自 [IconPark](https://iconpark.oceanengine.com)。
14
+
15
+ 产物是不打包的 ESM 源码库。插件自己的构建器把它内联进产物,因此运行期 React 与 Arco 仍是宿主持有的唯一实例,插件侧也不需要任何 CSS 处理管线。
16
+
17
+ ## 安装
18
+
19
+ ```sh
20
+ npm install @dsh-plugin/dsh-ui-components
21
+ ```
22
+
23
+ `react`、`react-dom` 与 `@dsh-plugin/dsh-loader` 是 peer 依赖,三者都由宿主提供。
24
+
25
+ ## 使用
26
+
27
+ 在插件的 React 树根部挂一次 `DshProvider`,随后从包根导入组件。
28
+
29
+ ```tsx
30
+ import { DshProvider, Card, Field, Input, Button, Switch } from '@dsh-plugin/dsh-ui-components'
31
+
32
+ export function SettingsPage() {
33
+ return (
34
+ <DshProvider>
35
+ <Card title="代理">
36
+ <Field label="地址" description="仅影响走全局 fetch 的请求。" htmlFor="host">
37
+ <Input id="host" mono placeholder="127.0.0.1" />
38
+ </Field>
39
+ <Field label="启用" layout="inline">
40
+ <Switch defaultChecked />
41
+ </Field>
42
+ <Button variant="primary">保存</Button>
43
+ </Card>
44
+ </DshProvider>
45
+ )
46
+ }
47
+ ```
48
+
49
+ `DshProvider` 注入皮肤、统一图标默认值,并把 Arco 的全部浮层收进持有同一套 CSS 变量的容器。不挂它组件也能渲染,但浮层会挂到 `body` 下而丢掉皮肤。
50
+
51
+ 打包配置里把这三项保持为 external:
52
+
53
+ ```js
54
+ const CLIENT_EXTERNALS = [
55
+ 'react',
56
+ 'react/jsx-runtime',
57
+ 'react-dom',
58
+ 'react-dom/client',
59
+ '@dsh-plugin/dsh-loader/client',
60
+ ]
61
+ ```
62
+
63
+ ## 主题
64
+
65
+ 颜色不是可配置的 props,也不需要是。皮肤是一张把 Arco 自身变量整体改指 DSH 语义令牌的 CSS 变量桥,因此深浅色跟随宿主的 `body[data-ds-dark-theme]` 属性自动切换,不涉及任何 JavaScript,组件代码里也没有主题分支。
66
+
67
+ 桥接表挂在 `.dsh-ui` 类上而不是 `body` 上,宿主自己的 Arco 主题因此不受影响。`scripts/verify-tokens.mjs` 会把本包引用的每个宿主变量与宿主样式表比对,DSH 改名时在离线阶段直接报错,而不是等到样式静默失效。
68
+
69
+ ## 图标
70
+
71
+ 三条通道,因为把 2658 个图标全量内联进每个插件并不合理:
72
+
73
+ ```tsx
74
+ // 1. 策划命名集(约 110 个,未使用的会被 tree-shaking 移除)
75
+ import { Icon, Icons } from '@dsh-plugin/dsh-ui-components'
76
+ <Icon name="Settings" size={18} />
77
+ <Icons.GitBranch />
78
+
79
+ // 2. 全量 2658 个,按子路径引入 —— 只有该图标进入产物
80
+ import Rocket from '@dsh-plugin/dsh-ui-components/icons/Rocket'
81
+ <Icon of={Rocket} size={18} />
82
+
83
+ // 3. 全量元数据,供选择器与搜索使用,不导入任何图标模块
84
+ import { ICON_INDEX } from '@dsh-plugin/dsh-ui-components/icons-index'
85
+ ```
86
+
87
+ 子路径名是 IconPark 名字的 PascalCase 形式:`a-cane` 对应 `ACane`,`setting` 对应 `Setting`。`ICON_INDEX` 的每条记录带 `name`、`pascal`、`title`、`titleZh`、`category`、`tags` 与 `rtl` 七个字段。
88
+
89
+ 图标继承 `currentColor`,颜色跟随周围文字。
90
+
91
+ ## 组件
92
+
93
+ | 分组 | 导出 |
94
+ |---|---|
95
+ | 基础层 | `DshProvider`、`Icon`、`Icons`、`ICON_NAMES`、`DshIconProvider`、`G`、`cx`、`ICON_INDEX` |
96
+ | 按钮 | `Button`、`IconButton` |
97
+ | 输入 | `Input`、`Textarea`、`InputNumber`、`Select`、`AutoComplete` |
98
+ | 选择 | `Checkbox`、`CheckboxGroup`、`Radio`、`RadioGroup`、`Switch`、`Slider`、`Rate` |
99
+ | 表单 | `Form`、`FormItem`、`Field` |
100
+ | 展示 | `Card`、`Tag`、`Pill`、`Avatar`、`Badge`、`Divider`、`Descriptions`、`Typography`、`Text`、`Paragraph`、`Empty`、`Skeleton`、`Spin`、`Tooltip`、`Popover`、`HoverCard`、`Collapse`、`CollapseItem` |
101
+ | 反馈 | `Alert`、`Progress`、`Result`、`Popconfirm`、`Modal`、`confirm`、`Drawer`、`Message`、`Notification`、`message`、`messageSuccess`、`messageError`、`messageWarning` |
102
+ | 导航 | `Menu`、`MenuItem`、`Dropdown`、`Tabs`、`TabPane`、`Breadcrumb`、`BreadcrumbItem`、`Pagination`、`Steps`、`Step`、`SegmentedControl`、`DisclosureRow`、`StateDot` |
103
+ | 数据 | `Table`、`List`、`ListItem`、`Tree`、`DatePicker`、`TimePicker`、`Cascader`、`TreeSelect`、`Transfer`、`Statistic`、`Timeline`、`TimelineItem`、`Calendar`、`Carousel`、`Image` |
104
+ | DSH 组合件 | `SettingsCard`、`SettingsRow`、`PanelShell`、`MenuSelect`、`JsonTree`、`CodeBlockShell`、`FileTypeBadge`、`StatusLine` |
105
+
106
+ 所有控件都透传原生 props 与 `className`,因此想脱离默认样式时不必 fork 组件。
107
+
108
+ `SettingsCard` 加 `SettingsRow` 组成宿主设置页的卡片结构。`PanelShell` 是自带 120px 上下留白、内容区走宿主 `Scrollbar` 的浮层外壳。`MenuSelect` 是设置页用的自绘下拉,因为原生 `<select>` 的弹层无法跟随 DSH 主题。
109
+
110
+ ## 预览
111
+
112
+ ```sh
113
+ npm run gen:tokens # 把宿主令牌样式表复制到 docs/preview/
114
+ npm run preview # http://localhost:5178
115
+ ```
116
+
117
+ 预览站用宿主自己的令牌取值渲染全部组件,带深浅主题切换与覆盖 2658 个图标的可搜索索引。它直接读包源码,改完刷新即可看到效果,不必先构建。
118
+
119
+ ## 开发
120
+
121
+ ```sh
122
+ npm install
123
+ npm run gen:icons # 重新生成 2658 个图标模块与元数据
124
+ npm run typecheck
125
+ npm run build
126
+ npm test
127
+ npm run verify # 令牌名、图标通道、字面颜色、包体积
128
+ ```
129
+
130
+ `npm run verify:tokens` 需要宿主样式表。把 `DSH_UI_THEME_DIR` 指向 DSH 检出里的 `packages/client/ui-theme/src/styles`,或在上级目录保留一份 `.dsh/temp/session-tree-harness`。
131
+
132
+ 分批范围与当前进度见 [PLAN.md](PLAN.md),令牌对照表见 [docs/tokens.md](docs/tokens.md)。
133
+
134
+ ## 许可
135
+
136
+ MIT。IconPark 图形为 Apache-2.0,详见 [NOTICE](NOTICE)。