@zjhc/ui 0.0.0-stage → 0.1.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 +51 -0
- package/NOTICE +23 -0
- package/README.md +177 -2
- package/dist/component.d.ts +3 -0
- package/dist/components/autocomplete/index.d.ts +5 -0
- package/dist/components/autocomplete/src/autoComplete.vue.d.ts +511 -0
- package/dist/components/autocomplete/src/autocomplete.d.ts +50 -0
- package/dist/components/collapse-container/index.d.ts +6 -0
- package/dist/components/collapse-container/src/collapseContainer.vue.d.ts +47 -0
- package/dist/components/collapse-container/src/instance.d.ts +2 -0
- package/dist/components/collapse-panel/index.d.ts +6 -0
- package/dist/components/collapse-panel/src/collapsePanel.vue.d.ts +68 -0
- package/dist/components/collapse-panel/src/instance.d.ts +2 -0
- package/dist/components/complex-table/index.d.ts +7 -0
- package/dist/components/complex-table/src/ComplexTable.vue.d.ts +1428 -0
- package/dist/components/complex-table/src/TableOperator.vue.d.ts +41 -0
- package/dist/components/complex-table/src/instance.d.ts +4 -0
- package/dist/components/dialog/index.d.ts +5 -0
- package/dist/components/dialog/src/dialog-content.d.ts +20 -0
- package/dist/components/dialog/src/dialog.d.ts +76 -0
- package/dist/components/dialog/src/dialog.vue.d.ts +456 -0
- package/dist/components/dialog/src/dialogContent.vue.d.ts +74 -0
- package/dist/components/dialog/src/use-dialog.d.ts +23 -0
- package/dist/components/edit-table-column/EditTableColumn.vue.d.ts +79 -0
- package/dist/components/edit-table-column/index.d.ts +6 -0
- package/dist/components/edit-table-column/registerComp.d.ts +3 -0
- package/dist/components/edit-table-column/type.d.ts +14 -0
- package/dist/components/group-container/index.d.ts +6 -0
- package/dist/components/group-container/src/groupContainer.vue.d.ts +43 -0
- package/dist/components/group-container/src/instance.d.ts +2 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/components/loading/index.d.ts +11 -0
- package/dist/components/loading/src/directive.d.ts +13 -0
- package/dist/components/loading/src/loading.d.ts +27 -0
- package/dist/components/loading/src/service.d.ts +3 -0
- package/dist/components/loading/src/types.d.ts +61 -0
- package/dist/components/search-layout/index.d.ts +6 -0
- package/dist/components/search-layout/src/instance.d.ts +2 -0
- package/dist/components/search-layout/src/searchLayout.vue.d.ts +22 -0
- package/dist/components/search-panel/index.d.ts +6 -0
- package/dist/components/search-panel/src/instance.d.ts +2 -0
- package/dist/components/search-panel/src/searchPanel.vue.d.ts +17 -0
- package/dist/components/search-panel-layout/index.d.ts +6 -0
- package/dist/components/search-panel-layout/src/layout.d.ts +95 -0
- package/dist/components/sticky-toolbar/index.d.ts +6 -0
- package/dist/components/sticky-toolbar/src/instance.d.ts +2 -0
- package/dist/components/sticky-toolbar/src/stickyToolbar.vue.d.ts +43 -0
- package/dist/components/switch-mode/index.d.ts +7 -0
- package/dist/components/switch-theme/index.d.ts +7 -0
- package/dist/components/table-toolbar/index.d.ts +7 -0
- package/dist/components/table-toolbar/src/buttonGroup.vue.d.ts +79 -0
- package/dist/components/table-toolbar/src/interface.d.ts +21 -0
- package/dist/components/table-toolbar/src/tableToolbar.vue.d.ts +71 -0
- package/dist/constants/aria.d.ts +17 -0
- package/dist/constants/date.d.ts +3 -0
- package/dist/constants/event.d.ts +3 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/key.d.ts +1 -0
- package/dist/constants/size.d.ts +7 -0
- package/dist/defaults.d.ts +5 -0
- package/dist/hooks/complex-table/index.d.ts +33 -0
- package/dist/hooks/get-cookie/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/oper-modal/index.d.ts +8 -0
- package/dist/hooks/post-message/index.d.ts +19 -0
- package/dist/hooks/set-theme/index.d.ts +2 -0
- package/dist/hooks/use-draggable-resize/index.d.ts +10 -0
- package/dist/hooks/use-loading/index.d.ts +4 -0
- package/dist/hooks/use-namespace/index.d.ts +20 -0
- package/dist/icons/arrow-down.vue.d.ts +2 -0
- package/dist/icons/arrow-up.vue.d.ts +2 -0
- package/dist/icons/check.vue.d.ts +2 -0
- package/dist/icons/close.vue.d.ts +2 -0
- package/dist/icons/copy-document.vue.d.ts +2 -0
- package/dist/icons/filter.vue.d.ts +2 -0
- package/dist/icons/full-screen.vue.d.ts +2 -0
- package/dist/icons/index.d.ts +9 -0
- package/dist/icons/loading.vue.d.ts +2 -0
- package/dist/icons/minus.vue.d.ts +2 -0
- package/dist/index.cjs +3985 -0
- package/dist/index.css +2661 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +3985 -0
- package/dist/make-installer.d.ts +5 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/types/enhance/accessory.d.ts +45 -0
- package/dist/types/enhance/biztrace.d.ts +75 -0
- package/dist/types/enhance/form.d.ts +83 -0
- package/dist/types/enhance/heai.d.ts +47 -0
- package/dist/types/enhance/workflow.d.ts +385 -0
- package/dist/types/extension/extension.d.ts +58 -0
- package/dist/types/extension/frame.d.ts +48 -0
- package/dist/types/extension/job.d.ts +36 -0
- package/dist/types/framework/auth.d.ts +38 -0
- package/dist/types/framework/config.d.ts +13 -0
- package/dist/types/framework/core.d.ts +24 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/style.d.ts +10 -0
- package/dist/utils/tools/istype.d.ts +11 -0
- package/dist/utils/tools/security.d.ts +2 -0
- package/dist/utils/tools/throw-error.d.ts +1 -0
- package/dist/utils/tools/tree.d.ts +2 -0
- package/dist/utils/vue/index.d.ts +2 -0
- package/dist/utils/vue/install.d.ts +6 -0
- package/dist/utils/vue/shared.d.ts +10 -0
- package/dist/utils/vue/typescript.d.ts +5 -0
- package/dist/version.d.ts +1 -0
- package/package.json +76 -4
- package/theme-chalk/autocomplete.css +144 -0
- package/theme-chalk/base-var.css +1037 -0
- package/theme-chalk/base.css +120 -0
- package/theme-chalk/collapse-container.css +71 -0
- package/theme-chalk/collapse-panel.css +49 -0
- package/theme-chalk/complextable.css +72 -0
- package/theme-chalk/dark.css +134 -0
- package/theme-chalk/dialog.css +0 -0
- package/theme-chalk/document-tables.css +175 -0
- package/theme-chalk/group-container.css +159 -0
- package/theme-chalk/index.css +2661 -0
- package/theme-chalk/loading.css +86 -0
- package/theme-chalk/page.css +34 -0
- package/theme-chalk/pub-class.css +417 -0
- package/theme-chalk/reset.css +152 -0
- package/theme-chalk/search-panel.css +31 -0
- package/theme-chalk/searchlayout.css +125 -0
- package/theme-chalk/src/autocomplete.scss +103 -0
- package/theme-chalk/src/base-var.scss +489 -0
- package/theme-chalk/src/base.scss +1 -0
- package/theme-chalk/src/black/index.scss +4 -0
- package/theme-chalk/src/collapse-container.scss +44 -0
- package/theme-chalk/src/collapse-panel.scss +26 -0
- package/theme-chalk/src/common/var.scss +154 -0
- package/theme-chalk/src/complextable.scss +47 -0
- package/theme-chalk/src/dark/css-vars.scss +35 -0
- package/theme-chalk/src/dark/var.scss +198 -0
- package/theme-chalk/src/dialog.scss +0 -0
- package/theme-chalk/src/document-tables.scss +133 -0
- package/theme-chalk/src/group-container.scss +139 -0
- package/theme-chalk/src/index.scss +17 -0
- package/theme-chalk/src/light/css-vars.scss +4 -0
- package/theme-chalk/src/light/var.scss +158 -0
- package/theme-chalk/src/loading.scss +68 -0
- package/theme-chalk/src/mixins/_var.scss +48 -0
- package/theme-chalk/src/mixins/config.scss +5 -0
- package/theme-chalk/src/mixins/function.scss +133 -0
- package/theme-chalk/src/mixins/mixins.scss +211 -0
- package/theme-chalk/src/page.scss +8 -0
- package/theme-chalk/src/pub-class.scss +127 -0
- package/theme-chalk/src/reset.scss +155 -0
- package/theme-chalk/src/search-panel.scss +10 -0
- package/theme-chalk/src/searchlayout.scss +114 -0
- package/theme-chalk/src/sticky-toolbar.scss +59 -0
- package/theme-chalk/src/table-toolbar.scss +36 -0
- package/theme-chalk/src/var.scss +32 -0
- package/theme-chalk/src/zjhc/alert.scss +16 -0
- package/theme-chalk/src/zjhc/anchor.scss +10 -0
- package/theme-chalk/src/zjhc/autocomplete.scss +11 -0
- package/theme-chalk/src/zjhc/backtop.scss +8 -0
- package/theme-chalk/src/zjhc/breadcrumb.scss +3 -0
- package/theme-chalk/src/zjhc/button.scss +82 -0
- package/theme-chalk/src/zjhc/calendar.scss +5 -0
- package/theme-chalk/src/zjhc/card.scss +5 -0
- package/theme-chalk/src/zjhc/cascader.scss +26 -0
- package/theme-chalk/src/zjhc/checkbox.scss +59 -0
- package/theme-chalk/src/zjhc/collapse.scss +8 -0
- package/theme-chalk/src/zjhc/dateEditor.scss +14 -0
- package/theme-chalk/src/zjhc/descriptions.scss +32 -0
- package/theme-chalk/src/zjhc/dialog.scss +148 -0
- package/theme-chalk/src/zjhc/drawer.scss +4 -0
- package/theme-chalk/src/zjhc/dropdown.scss +16 -0
- package/theme-chalk/src/zjhc/empty.scss +3 -0
- package/theme-chalk/src/zjhc/fontsize.scss +42 -0
- package/theme-chalk/src/zjhc/form.scss +33 -0
- package/theme-chalk/src/zjhc/index.scss +48 -0
- package/theme-chalk/src/zjhc/input.scss +47 -0
- package/theme-chalk/src/zjhc/link.scss +20 -0
- package/theme-chalk/src/zjhc/main.scss +3 -0
- package/theme-chalk/src/zjhc/mention.scss +9 -0
- package/theme-chalk/src/zjhc/menu.scss +0 -0
- package/theme-chalk/src/zjhc/message-box.scss +57 -0
- package/theme-chalk/src/zjhc/message.scss +13 -0
- package/theme-chalk/src/zjhc/notification.scss +4 -0
- package/theme-chalk/src/zjhc/number.scss +9 -0
- package/theme-chalk/src/zjhc/overlay.scss +3 -0
- package/theme-chalk/src/zjhc/page.scss +3 -0
- package/theme-chalk/src/zjhc/pagination.scss +64 -0
- package/theme-chalk/src/zjhc/picker.scss +85 -0
- package/theme-chalk/src/zjhc/popover.scss +13 -0
- package/theme-chalk/src/zjhc/popper.scss +13 -0
- package/theme-chalk/src/zjhc/radio.scss +49 -0
- package/theme-chalk/src/zjhc/scrollbar.scss +5 -0
- package/theme-chalk/src/zjhc/segmented.scss +18 -0
- package/theme-chalk/src/zjhc/select.scss +49 -0
- package/theme-chalk/src/zjhc/steps.scss +40 -0
- package/theme-chalk/src/zjhc/switch.scss +11 -0
- package/theme-chalk/src/zjhc/table-v2.scss +16 -0
- package/theme-chalk/src/zjhc/table.scss +44 -0
- package/theme-chalk/src/zjhc/tabs.scss +15 -0
- package/theme-chalk/src/zjhc/tags.scss +25 -0
- package/theme-chalk/src/zjhc/timeline.scss +16 -0
- package/theme-chalk/src/zjhc/tour.scss +9 -0
- package/theme-chalk/src/zjhc/tree.scss +6 -0
- package/theme-chalk/src/zjhc/upload.scss +6 -0
- package/theme-chalk/sticky-toolbar.css +71 -0
- package/theme-chalk/table-toolbar.css +53 -0
- package/theme-chalk/var.css +120 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zjhc
|
|
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.
|
|
22
|
+
|
|
23
|
+
---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
This package contains code derived from third-party projects:
|
|
26
|
+
|
|
27
|
+
Element Plus — https://github.com/element-plus/element-plus
|
|
28
|
+
Copyright (c) 2020-PRESENT Element Plus
|
|
29
|
+
Licensed under the MIT License (full text below)
|
|
30
|
+
|
|
31
|
+
MIT License
|
|
32
|
+
|
|
33
|
+
Copyright (c) 2020-PRESENT Element Plus
|
|
34
|
+
|
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
37
|
+
in the Software without restriction, including without limitation the rights
|
|
38
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
39
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
40
|
+
furnished to do so, subject to the following conditions:
|
|
41
|
+
|
|
42
|
+
The above copyright notice and this permission notice shall be included in all
|
|
43
|
+
copies or substantial portions of the Software.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
51
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
This package is a Vue 3 component library built on top of Element Plus.
|
|
4
|
+
|
|
5
|
+
## 第三方来源
|
|
6
|
+
|
|
7
|
+
### Element Plus
|
|
8
|
+
|
|
9
|
+
- 项目地址: https://github.com/element-plus/element-plus
|
|
10
|
+
- 版权: Copyright (c) 2020-PRESENT Element Plus
|
|
11
|
+
- 许可证: MIT
|
|
12
|
+
|
|
13
|
+
本项目的部分实现(包括 `src/utils`、`src/hooks` 中的若干工具与 `theme-chalk`
|
|
14
|
+
主题变量的组织方式)派生自 Element Plus,并按 MIT 许可证的要求保留其版权声明。
|
|
15
|
+
完整许可证文本见 `LICENSE` 文件。
|
|
16
|
+
|
|
17
|
+
Element Plus 本身作为 `peerDependency` 使用,不会被本包打包。
|
|
18
|
+
|
|
19
|
+
## 归属说明
|
|
20
|
+
|
|
21
|
+
`src/components` 下的业务组件(complex-table、search-panel、dialog、
|
|
22
|
+
table-toolbar、sticky-toolbar 等)源自内部业务组件库(发布形态为 `@cacp/ui@0.3.24`),
|
|
23
|
+
由本仓库维护并统一改用 `zjhc` 命名空间。其对外接口与实现版权归本仓库所有。
|
package/README.md
CHANGED
|
@@ -1,3 +1,178 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zjhc/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于 [Element Plus](https://element-plus.org) 的 Vue 3 业务组件库,提供复杂表格、搜索面板、可折叠面板、可拖拽弹窗等中后台常用组件。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- Vue 3 + TypeScript 编写,完整类型声明
|
|
8
|
+
- 直接复用 Element Plus 的能力与主题变量,无需重复引入基础组件
|
|
9
|
+
- 提供 ESM / CJS 双格式产物与独立样式文件
|
|
10
|
+
- 统一 `zjhc` 命名空间:类名前缀 `.zjhc-*`、CSS 变量前缀 `--zjhc-*`
|
|
11
|
+
- 主题可通过 `theme-chalk` 中的 SCSS 变量定制
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @zjhc/ui element-plus
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`element-plus`、`vue`、`crypto-js` 是 peerDependencies,需要由使用方自行安装。
|
|
20
|
+
|
|
21
|
+
## 使用
|
|
22
|
+
|
|
23
|
+
### 全量引入
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { createApp } from 'vue'
|
|
27
|
+
import ElementPlus from 'element-plus'
|
|
28
|
+
import 'element-plus/dist/index.css'
|
|
29
|
+
import ZjhcUI from '@zjhc/ui'
|
|
30
|
+
import '@zjhc/ui/dist/index.css'
|
|
31
|
+
import App from './App.vue'
|
|
32
|
+
|
|
33
|
+
createApp(App).use(ElementPlus).use(ZjhcUI).mount('#app')
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
全量注册后 `ZjhcLoading` 会同时注册 `v-zjhc-loading` 指令与 `$zjhcLoading` 全局方法。
|
|
37
|
+
|
|
38
|
+
### 按需引入
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { ZjhcComplexTable } from '@zjhc/ui'
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<ZjhcComplexTable :data="rows" :actions="actions" />
|
|
47
|
+
</template>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
样式只需引一次:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import '@zjhc/ui/dist/index.css'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
若要按组件体积更省,可以只引对应组件的样式:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import '@zjhc/ui/theme-chalk/complextable.css'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 加载指令
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import { ZjhcLoading } from '@zjhc/ui'
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<div v-zjhc-loading="loading">内容</div>
|
|
71
|
+
</template>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
也可以直接调服务:`ZjhcLoading.service({ text: '加载中' })`。
|
|
75
|
+
|
|
76
|
+
## 组件
|
|
77
|
+
|
|
78
|
+
| 组件 | 说明 |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `ZjhcComplexTable` | 带分页、工具栏、操作列的复杂表格 |
|
|
81
|
+
| `ZjhcTableToolbar` | 表格工具栏 / 按钮组 |
|
|
82
|
+
| `ZjhcSearchPanel` | 搜索面板 |
|
|
83
|
+
| `ZjhcSearchPanelLayout` | 搜索面板布局 |
|
|
84
|
+
| `ZjhcSearchLayout` | 搜索区布局容器 |
|
|
85
|
+
| `ZjhcCollapseContainer` / `ZjhcCollapsePanel` | 可折叠容器/面板 |
|
|
86
|
+
| `ZjhcDialog` | 可最小化、拖拽、全屏的弹窗 |
|
|
87
|
+
| `ZjhcGroupContainer` | 分组容器 |
|
|
88
|
+
| `ZjhcStickyToolbar` | 吸顶工具栏 |
|
|
89
|
+
| `ZjhcAutocomplete` | 增强自动完成 |
|
|
90
|
+
| `ZjhcEditTableColumn` | 可编辑表格列 |
|
|
91
|
+
| `ZjhcLoading` | 加载指令与服务 |
|
|
92
|
+
|
|
93
|
+
同时还导出 `hooks`(`useNamespace`、`useDraggableResize`、`useLoading`、
|
|
94
|
+
`useComplexTable` 等)、`utils` 与 `constants`。
|
|
95
|
+
|
|
96
|
+
## 命名空间
|
|
97
|
+
|
|
98
|
+
类名与 CSS 变量统一使用 `zjhc` 前缀,由 `useNamespace` 与
|
|
99
|
+
`theme-chalk/src/mixins/config.scss` 的 `$namespace` 共同决定:
|
|
100
|
+
|
|
101
|
+
```css
|
|
102
|
+
.zjhc-complex-table { }
|
|
103
|
+
.zjhc-complex-table__header { }
|
|
104
|
+
.zjhc-dialog--fullscreen { }
|
|
105
|
+
|
|
106
|
+
:root { --zjhc-color-primary: #409eff; }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
需要改前缀时这两处必须同时改,否则类名与样式选择器会对不上。
|
|
110
|
+
业务侧覆盖样式时也应使用 `--zjhc-*` 变量。
|
|
111
|
+
|
|
112
|
+
## 主题定制
|
|
113
|
+
|
|
114
|
+
`theme-chalk/src` 下是完整的 SCSS 源码,通过覆盖变量重新编译即可换肤:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
sass --no-source-map theme-chalk/src/index.scss my-theme.css
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
或在业务项目里用 Vite 的 `css.preprocessorOptions.scss.additionalData` 注入变量覆盖:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
additionalData: `@use "@zjhc/ui/theme-chalk/src/mixins/config.scss" as *;`
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## 产物
|
|
127
|
+
|
|
128
|
+
| 文件 | 说明 |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| `dist/index.mjs` | ESM 入口(约 135 KB,gzip 30 KB) |
|
|
131
|
+
| `dist/index.cjs` | CommonJS 入口 |
|
|
132
|
+
| `dist/index.d.ts` | 类型入口,配套 100+ 个按模块拆分的声明文件 |
|
|
133
|
+
| `dist/index.css` | 完整样式,由 `theme-chalk/src/index.scss` 编译得到 |
|
|
134
|
+
| `theme-chalk/index.css` | 与 `dist/index.css` 内容相同的别名,兼容老写法 |
|
|
135
|
+
| `theme-chalk/<name>.css` | 单组件样式,供按需引入 |
|
|
136
|
+
| `theme-chalk/dark.css` | 暗色模式变量 |
|
|
137
|
+
| `theme-chalk/src/**` | SCSS 源码,供自定义主题 |
|
|
138
|
+
|
|
139
|
+
`vue`、`element-plus`、`crypto-js`、`@vueuse/core`、`lodash-es` 都是外部依赖,不会被打进产物。
|
|
140
|
+
|
|
141
|
+
> 关于 CJS:`element-plus` 的深层子路径(`element-plus/es/...`)只对 ESM 开放,
|
|
142
|
+
> 直接 `require` 会报 `ERR_PACKAGE_PATH_NOT_EXPORTED`。构建时已对 CJS 产物做路径改写,
|
|
143
|
+
> 指向同构的 `element-plus/lib/*.js`,因此 ESM 与 CJS 两种格式都能在纯 Node 环境加载。
|
|
144
|
+
|
|
145
|
+
## 定制命名空间
|
|
146
|
+
|
|
147
|
+
`zjhc` 前缀来自两个地方,改的时候要成对修改:
|
|
148
|
+
|
|
149
|
+
- `src/hooks/use-namespace/index.ts` 的 `defaultNamespace`
|
|
150
|
+
- `theme-chalk/src/mixins/config.scss` 的 `$namespace`
|
|
151
|
+
|
|
152
|
+
改完执行 `npm run build`,`scripts/build-css.mjs` 会校验产物中不含旧前缀。
|
|
153
|
+
|
|
154
|
+
## 开发
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm install
|
|
158
|
+
npm run build # 产出 dist/index.mjs、dist/index.cjs、dist/index.d.ts,以及全部 CSS
|
|
159
|
+
npm run build:css # 只重编样式(dist/index.css + theme-chalk/*.css)
|
|
160
|
+
npm run type-check
|
|
161
|
+
npm test # 冒烟测试:导出完整性 + 命名空间 + SSR 渲染
|
|
162
|
+
npm run test:consume # 模拟真实安装,验证 ESM/CJS 与各样式路径可解析
|
|
163
|
+
npm run preflight # 发布前自检:registry / 登录 / 2FA / 版本占用 / 产物
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 发布
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm run preflight # 自检:registry / 登录 / 2FA / 版本占用 / 产物
|
|
170
|
+
npm run publish:otp # 账号已开 2FA,必须带动态码,脚本会提示输入
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`npm publish` 直接跑会报 `E403 ... 2FA ... required`,因为 registry 返回的是 **E403**
|
|
174
|
+
而非 **EOTP**,npm 不会弹窗索要验证码。详见 [docs/publish.md](docs/publish.md) 第四节「坑 3」。
|
|
175
|
+
|
|
176
|
+
## 许可证
|
|
177
|
+
|
|
178
|
+
MIT。部分实现派生自 Element Plus(MIT),版权声明见 `LICENSE` 与 `NOTICE`。
|