@oinone/kunlun-theme 6.2.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/dist/oinone-kunlun-theme.esm.js +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/src/color/dark-vars.d.ts +87 -0
- package/dist/types/src/color/default-vars.d.ts +87 -0
- package/dist/types/src/color/index.d.ts +3 -0
- package/dist/types/src/color/menu-color-vars.d.ts +37 -0
- package/dist/types/src/init/currentTheme.d.ts +3 -0
- package/dist/types/src/init/index.d.ts +2 -0
- package/dist/types/src/init/initTheme.d.ts +6 -0
- package/dist/types/src/mount/constant.d.ts +1 -0
- package/dist/types/src/mount/index.d.ts +11 -0
- package/dist/types/src/register/index.d.ts +6 -0
- package/dist/types/src/size/default/index.d.ts +3 -0
- package/dist/types/src/size/default/large.d.ts +32 -0
- package/dist/types/src/size/default/medium.d.ts +32 -0
- package/dist/types/src/size/default/small.d.ts +32 -0
- package/dist/types/src/size/index.d.ts +8 -0
- package/dist/types/src/size/input/index.d.ts +2 -0
- package/dist/types/src/size/input/large.d.ts +6 -0
- package/dist/types/src/size/input/medium.d.ts +6 -0
- package/dist/types/src/size/menu/index.d.ts +3 -0
- package/dist/types/src/size/menu/large.d.ts +18 -0
- package/dist/types/src/size/menu/medium.d.ts +18 -0
- package/dist/types/src/size/menu/small.d.ts +18 -0
- package/dist/types/src/size/pagination/index.d.ts +3 -0
- package/dist/types/src/size/pagination/large.d.ts +5 -0
- package/dist/types/src/size/pagination/medium.d.ts +5 -0
- package/dist/types/src/size/pagination/small.d.ts +5 -0
- package/dist/types/src/size/select/index.d.ts +3 -0
- package/dist/types/src/size/select/large.d.ts +3 -0
- package/dist/types/src/size/select/medium.d.ts +3 -0
- package/dist/types/src/size/select/small.d.ts +3 -0
- package/dist/types/src/size/table/index.d.ts +3 -0
- package/dist/types/src/size/table/large.d.ts +5 -0
- package/dist/types/src/size/table/medium.d.ts +5 -0
- package/dist/types/src/size/table/small.d.ts +5 -0
- package/dist/types/src/size/tabs/index.d.ts +3 -0
- package/dist/types/src/size/tabs/large.d.ts +3 -0
- package/dist/types/src/size/tabs/medium.d.ts +3 -0
- package/dist/types/src/size/tabs/small.d.ts +3 -0
- package/dist/types/src/size/tree-select/index.d.ts +3 -0
- package/dist/types/src/size/tree-select/large.d.ts +4 -0
- package/dist/types/src/size/tree-select/medium.d.ts +4 -0
- package/dist/types/src/size/tree-select/small.d.ts +4 -0
- package/dist/types/src/style/dark/app-switch/app-switch.d.ts +11 -0
- package/dist/types/src/style/dark/button/constant.d.ts +2 -0
- package/dist/types/src/style/dark/button/danger.d.ts +126 -0
- package/dist/types/src/style/dark/button/index.d.ts +604 -0
- package/dist/types/src/style/dark/button/info.d.ts +126 -0
- package/dist/types/src/style/dark/button/standard.d.ts +126 -0
- package/dist/types/src/style/dark/button/success.d.ts +126 -0
- package/dist/types/src/style/dark/button/warning.d.ts +126 -0
- package/dist/types/src/style/dark/checkbox/checkbox.d.ts +7 -0
- package/dist/types/src/style/dark/component-theme.d.ts +2889 -0
- package/dist/types/src/style/dark/drawer/drawer.d.ts +9 -0
- package/dist/types/src/style/dark/dropdown/index.d.ts +12 -0
- package/dist/types/src/style/dark/form-item/form-item.d.ts +7 -0
- package/dist/types/src/style/dark/header/header.d.ts +5 -0
- package/dist/types/src/style/dark/index.d.ts +1 -0
- package/dist/types/src/style/dark/input/input.d.ts +36 -0
- package/dist/types/src/style/dark/menu/menu.d.ts +38 -0
- package/dist/types/src/style/dark/modal/modal.d.ts +10 -0
- package/dist/types/src/style/dark/multi-tab/multi-tab.d.ts +57 -0
- package/dist/types/src/style/dark/pagination/pagination.d.ts +6 -0
- package/dist/types/src/style/dark/popconfirm/popconfirm.d.ts +7 -0
- package/dist/types/src/style/dark/registry.d.ts +1 -0
- package/dist/types/src/style/dark/rich-text/rich-text.d.ts +22 -0
- package/dist/types/src/style/dark/scrollbar/scrollbar.d.ts +5 -0
- package/dist/types/src/style/dark/select/select.d.ts +39 -0
- package/dist/types/src/style/dark/switch/switch.d.ts +4 -0
- package/dist/types/src/style/dark/table/table.d.ts +21 -0
- package/dist/types/src/style/dark/tabs/tabs.d.ts +1 -0
- package/dist/types/src/style/dark/textarea/textarea.d.ts +27 -0
- package/dist/types/src/style/dark/transfer/transfer.d.ts +5 -0
- package/dist/types/src/style/dark/tree-select/tree-select.d.ts +1 -0
- package/dist/types/src/style/dark/upload/upload.d.ts +27 -0
- package/dist/types/src/style/default/app-switch/app-switch.d.ts +11 -0
- package/dist/types/src/style/default/button/constant.d.ts +2 -0
- package/dist/types/src/style/default/button/danger.d.ts +126 -0
- package/dist/types/src/style/default/button/index.d.ts +604 -0
- package/dist/types/src/style/default/button/info.d.ts +126 -0
- package/dist/types/src/style/default/button/standard.d.ts +126 -0
- package/dist/types/src/style/default/button/success.d.ts +126 -0
- package/dist/types/src/style/default/button/warning.d.ts +126 -0
- package/dist/types/src/style/default/checkbox/checkbox.d.ts +7 -0
- package/dist/types/src/style/default/component-theme.d.ts +2900 -0
- package/dist/types/src/style/default/datetime/datetime.d.ts +4 -0
- package/dist/types/src/style/default/drawer/drawer.d.ts +9 -0
- package/dist/types/src/style/default/dropdown/index.d.ts +12 -0
- package/dist/types/src/style/default/form-item/form-item.d.ts +7 -0
- package/dist/types/src/style/default/header/header.d.ts +5 -0
- package/dist/types/src/style/default/index.d.ts +1 -0
- package/dist/types/src/style/default/input/input.d.ts +36 -0
- package/dist/types/src/style/default/menu/menu.d.ts +38 -0
- package/dist/types/src/style/default/modal/modal.d.ts +10 -0
- package/dist/types/src/style/default/multi-tab/multi-tab.d.ts +57 -0
- package/dist/types/src/style/default/pagination/pagination.d.ts +6 -0
- package/dist/types/src/style/default/popconfirm/popconfirm.d.ts +7 -0
- package/dist/types/src/style/default/registry.d.ts +1 -0
- package/dist/types/src/style/default/rich-text/rich-text.d.ts +22 -0
- package/dist/types/src/style/default/scrollbar/scrollbar.d.ts +5 -0
- package/dist/types/src/style/default/select/select.d.ts +39 -0
- package/dist/types/src/style/default/switch/switch.d.ts +4 -0
- package/dist/types/src/style/default/table/table.d.ts +21 -0
- package/dist/types/src/style/default/tabs/tabs.d.ts +1 -0
- package/dist/types/src/style/default/textarea/textarea.d.ts +27 -0
- package/dist/types/src/style/default/transfer/transfer.d.ts +5 -0
- package/dist/types/src/style/default/tree-select/tree-select.d.ts +1 -0
- package/dist/types/src/style/default/upload/upload.d.ts +27 -0
- package/dist/types/src/style/index.d.ts +2 -0
- package/dist/types/src/typing.d.ts +15 -0
- package/index.ts +5 -0
- package/package.json +14 -0
- package/rollup.config.js +4 -0
- package/src/color/dark-vars.ts +112 -0
- package/src/color/default-vars.ts +113 -0
- package/src/color/index.ts +3 -0
- package/src/color/menu-color-vars.ts +130 -0
- package/src/init/currentTheme.ts +7 -0
- package/src/init/index.ts +2 -0
- package/src/init/initTheme.ts +14 -0
- package/src/mount/constant.ts +1 -0
- package/src/mount/index.ts +69 -0
- package/src/register/index.ts +23 -0
- package/src/size/default/index.ts +3 -0
- package/src/size/default/large.ts +43 -0
- package/src/size/default/medium.ts +43 -0
- package/src/size/default/small.ts +43 -0
- package/src/size/index.ts +8 -0
- package/src/size/input/index.ts +2 -0
- package/src/size/input/large.ts +8 -0
- package/src/size/input/medium.ts +8 -0
- package/src/size/menu/index.ts +3 -0
- package/src/size/menu/large.ts +23 -0
- package/src/size/menu/medium.ts +23 -0
- package/src/size/menu/small.ts +23 -0
- package/src/size/pagination/index.ts +3 -0
- package/src/size/pagination/large.ts +5 -0
- package/src/size/pagination/medium.ts +5 -0
- package/src/size/pagination/small.ts +5 -0
- package/src/size/select/index.ts +3 -0
- package/src/size/select/large.ts +3 -0
- package/src/size/select/medium.ts +3 -0
- package/src/size/select/small.ts +3 -0
- package/src/size/table/index.ts +3 -0
- package/src/size/table/large.ts +5 -0
- package/src/size/table/medium.ts +5 -0
- package/src/size/table/small.ts +5 -0
- package/src/size/tabs/index.ts +3 -0
- package/src/size/tabs/large.ts +5 -0
- package/src/size/tabs/medium.ts +5 -0
- package/src/size/tabs/small.ts +5 -0
- package/src/size/tree-select/index.ts +3 -0
- package/src/size/tree-select/large.ts +4 -0
- package/src/size/tree-select/medium.ts +4 -0
- package/src/size/tree-select/small.ts +4 -0
- package/src/style/dark/app-switch/app-switch.ts +14 -0
- package/src/style/dark/button/constant.ts +4 -0
- package/src/style/dark/button/danger.ts +146 -0
- package/src/style/dark/button/index.ts +28 -0
- package/src/style/dark/button/info.ts +146 -0
- package/src/style/dark/button/standard.ts +146 -0
- package/src/style/dark/button/success.ts +146 -0
- package/src/style/dark/button/warning.ts +146 -0
- package/src/style/dark/checkbox/checkbox.ts +10 -0
- package/src/style/dark/component-theme.ts +174 -0
- package/src/style/dark/drawer/drawer.ts +10 -0
- package/src/style/dark/dropdown/index.ts +14 -0
- package/src/style/dark/form-item/form-item.ts +10 -0
- package/src/style/dark/header/header.ts +6 -0
- package/src/style/dark/index.ts +1 -0
- package/src/style/dark/input/input.ts +46 -0
- package/src/style/dark/menu/menu.ts +7 -0
- package/src/style/dark/modal/modal.ts +11 -0
- package/src/style/dark/multi-tab/multi-tab.ts +67 -0
- package/src/style/dark/pagination/pagination.ts +9 -0
- package/src/style/dark/popconfirm/popconfirm.ts +8 -0
- package/src/style/dark/registry.ts +62 -0
- package/src/style/dark/rich-text/rich-text.ts +25 -0
- package/src/style/dark/scrollbar/scrollbar.ts +6 -0
- package/src/style/dark/select/select.ts +48 -0
- package/src/style/dark/switch/switch.ts +5 -0
- package/src/style/dark/table/table.ts +44 -0
- package/src/style/dark/tabs/tabs.ts +1 -0
- package/src/style/dark/textarea/textarea.ts +34 -0
- package/src/style/dark/transfer/transfer.ts +6 -0
- package/src/style/dark/tree-select/tree-select.ts +1 -0
- package/src/style/dark/upload/upload.ts +34 -0
- package/src/style/default/app-switch/app-switch.ts +14 -0
- package/src/style/default/button/constant.ts +4 -0
- package/src/style/default/button/danger.ts +146 -0
- package/src/style/default/button/index.ts +28 -0
- package/src/style/default/button/info.ts +146 -0
- package/src/style/default/button/standard.ts +146 -0
- package/src/style/default/button/success.ts +146 -0
- package/src/style/default/button/warning.ts +146 -0
- package/src/style/default/checkbox/checkbox.ts +10 -0
- package/src/style/default/component-theme.ts +178 -0
- package/src/style/default/datetime/datetime.ts +5 -0
- package/src/style/default/drawer/drawer.ts +10 -0
- package/src/style/default/dropdown/index.ts +14 -0
- package/src/style/default/form-item/form-item.ts +10 -0
- package/src/style/default/header/header.ts +6 -0
- package/src/style/default/index.ts +1 -0
- package/src/style/default/input/input.ts +46 -0
- package/src/style/default/menu/menu.ts +7 -0
- package/src/style/default/modal/modal.ts +11 -0
- package/src/style/default/multi-tab/multi-tab.ts +67 -0
- package/src/style/default/pagination/pagination.ts +9 -0
- package/src/style/default/popconfirm/popconfirm.ts +8 -0
- package/src/style/default/registry.ts +63 -0
- package/src/style/default/rich-text/rich-text.ts +25 -0
- package/src/style/default/scrollbar/scrollbar.ts +6 -0
- package/src/style/default/select/select.ts +49 -0
- package/src/style/default/switch/switch.ts +5 -0
- package/src/style/default/table/table.ts +44 -0
- package/src/style/default/tabs/tabs.ts +1 -0
- package/src/style/default/textarea/textarea.ts +34 -0
- package/src/style/default/transfer/transfer.ts +6 -0
- package/src/style/default/tree-select/tree-select.ts +1 -0
- package/src/style/default/upload/upload.ts +34 -0
- package/src/style/index.ts +2 -0
- package/src/typing.ts +31 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { currentOioThemeType } from '../init';
|
|
2
|
+
import { darkVars } from './dark-vars';
|
|
3
|
+
import { defaultVars } from './default-vars';
|
|
4
|
+
|
|
5
|
+
interface IMenuColorVars {
|
|
6
|
+
'main-background': string;
|
|
7
|
+
'body-background': string;
|
|
8
|
+
'border-color': string;
|
|
9
|
+
'text-color': string;
|
|
10
|
+
'icon-color': string;
|
|
11
|
+
'text-color-rgb': string;
|
|
12
|
+
'primary-color': string;
|
|
13
|
+
'hover-background-color': string;
|
|
14
|
+
'text-color-secondary': string;
|
|
15
|
+
'active-parent-title-color': string;
|
|
16
|
+
'collapsed-button-background-color': string;
|
|
17
|
+
'designer-font-color': string;
|
|
18
|
+
'select-background': string;
|
|
19
|
+
'placeholder-color': string;
|
|
20
|
+
'select-color': string;
|
|
21
|
+
'select-dropdown-background': string;
|
|
22
|
+
'select-dropdown-selected-color': string;
|
|
23
|
+
'select-dropdown-color': string;
|
|
24
|
+
'select-dropdown-selected': string;
|
|
25
|
+
'select-dropdown-box-shadow': string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 默认主题的菜单css变量
|
|
30
|
+
*/
|
|
31
|
+
const defaultMenuColorVars: IMenuColorVars = {
|
|
32
|
+
'main-background': defaultVars['main-background'],
|
|
33
|
+
'body-background': defaultVars['main-background'],
|
|
34
|
+
'border-color': defaultVars['border-color'],
|
|
35
|
+
'text-color': defaultVars['text-color'],
|
|
36
|
+
'icon-color': defaultVars['icon-color'],
|
|
37
|
+
'text-color-rgb': defaultVars['text-color-rgb'],
|
|
38
|
+
'primary-color': defaultVars['primary-color'],
|
|
39
|
+
'hover-background-color': defaultVars['hover-background-color'],
|
|
40
|
+
'text-color-secondary': defaultVars['text-color-secondary'],
|
|
41
|
+
'active-parent-title-color': 'rgba(0, 0, 0, 0.85)',
|
|
42
|
+
'collapsed-button-background-color': 'rgba(38, 38, 38, 0.05)',
|
|
43
|
+
'designer-font-color': '#333333',
|
|
44
|
+
'select-background': defaultVars['main-background'],
|
|
45
|
+
'placeholder-color': defaultVars['placeholder-color'],
|
|
46
|
+
'select-color': defaultVars['text-color'],
|
|
47
|
+
'select-dropdown-background': defaultVars['main-background'],
|
|
48
|
+
'select-dropdown-selected-color': defaultVars['primary-color'],
|
|
49
|
+
'select-dropdown-color': defaultVars['text-color-secondary'],
|
|
50
|
+
'select-dropdown-selected': defaultVars['hover-background-color'],
|
|
51
|
+
'select-dropdown-box-shadow':
|
|
52
|
+
'0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08),0 9px 28px 8px rgba(0, 0, 0, 0.05)'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 暗色主题的菜单css变量
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
const darkMenuColorVars: IMenuColorVars = {
|
|
60
|
+
'main-background': darkVars['main-background'],
|
|
61
|
+
'body-background': darkVars['body-background'],
|
|
62
|
+
'border-color': darkVars['border-color'],
|
|
63
|
+
'text-color': darkVars['text-color'],
|
|
64
|
+
'icon-color': darkVars['icon-color'],
|
|
65
|
+
'text-color-rgb': darkVars['text-color-rgb'],
|
|
66
|
+
'primary-color': '#fff',
|
|
67
|
+
'hover-background-color': darkVars['hover-background-color'],
|
|
68
|
+
'text-color-secondary': darkVars['text-color-secondary'],
|
|
69
|
+
'active-parent-title-color': '#fff',
|
|
70
|
+
'collapsed-button-background-color': 'rgba(38, 38, 38, 0.05)',
|
|
71
|
+
'designer-font-color': '#333333',
|
|
72
|
+
'select-background': darkVars['body-background'],
|
|
73
|
+
'placeholder-color': darkVars['placeholder-color'],
|
|
74
|
+
'select-color': darkVars['text-color'],
|
|
75
|
+
'select-dropdown-background': darkVars['main-background'],
|
|
76
|
+
'select-dropdown-selected-color': '#fff',
|
|
77
|
+
'select-dropdown-color': darkVars['text-color'],
|
|
78
|
+
'select-dropdown-selected': darkVars['hover-background-color'],
|
|
79
|
+
'select-dropdown-box-shadow': '0px 0px 6px 0px rgba(0,0,0,0.2)'
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const getMenuColorVarsByTheme = () => {
|
|
83
|
+
const menuColorVars = currentOioThemeType === 'dark' ? darkMenuColorVars : defaultMenuColorVars;
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
'background-color': menuColorVars['main-background'],
|
|
87
|
+
'border-color': menuColorVars['border-color'],
|
|
88
|
+
'font-color': menuColorVars['text-color'],
|
|
89
|
+
'expand-background-color': menuColorVars['main-background'],
|
|
90
|
+
'default-icon-color': menuColorVars['icon-color'],
|
|
91
|
+
'default-expand-icon-color': `rgba(${menuColorVars['text-color-rgb']}, 0.75)`,
|
|
92
|
+
'search-background-color': menuColorVars['body-background'],
|
|
93
|
+
|
|
94
|
+
'select-dropdown-background': menuColorVars['select-dropdown-background'],
|
|
95
|
+
'select-dropdown-color': menuColorVars['select-dropdown-color'],
|
|
96
|
+
'select-dropdown-selected-color': menuColorVars['select-dropdown-selected-color'],
|
|
97
|
+
'select-dropdown-selected': menuColorVars['select-dropdown-selected'],
|
|
98
|
+
'select-dropdown-box-shadow': menuColorVars['select-dropdown-box-shadow'],
|
|
99
|
+
'select-color': menuColorVars['select-color'],
|
|
100
|
+
'select-background': menuColorVars['select-background'],
|
|
101
|
+
'select-placeholder-color': menuColorVars['placeholder-color'],
|
|
102
|
+
'selected-icon-color': menuColorVars['primary-color'],
|
|
103
|
+
'selected-background-color': menuColorVars['hover-background-color'],
|
|
104
|
+
'selected-title-color': menuColorVars['primary-color'],
|
|
105
|
+
'selected-title-hover-color': menuColorVars['primary-color'],
|
|
106
|
+
'selected-root-title-color': menuColorVars['primary-color'],
|
|
107
|
+
'selected-root-icon-color': menuColorVars['primary-color'],
|
|
108
|
+
'selected-root-background-color': menuColorVars['hover-background-color'],
|
|
109
|
+
|
|
110
|
+
'hover-background-color': menuColorVars['hover-background-color'],
|
|
111
|
+
|
|
112
|
+
'root-title-hover-color': menuColorVars['primary-color'],
|
|
113
|
+
'root-title-hover-icon-color': menuColorVars['primary-color'],
|
|
114
|
+
'active-parent-title-color': menuColorVars['active-parent-title-color'],
|
|
115
|
+
|
|
116
|
+
'search-display': 'unset',
|
|
117
|
+
'search-background': menuColorVars['body-background'],
|
|
118
|
+
|
|
119
|
+
'collapsed-button-hover-background-color': menuColorVars['hover-background-color'],
|
|
120
|
+
'collapsed-button-background-color': menuColorVars['collapsed-button-background-color'],
|
|
121
|
+
|
|
122
|
+
'collapsed-button-title-color': menuColorVars['text-color-secondary'],
|
|
123
|
+
|
|
124
|
+
// 设计器菜单
|
|
125
|
+
'designer-font-color': menuColorVars['designer-font-color'],
|
|
126
|
+
'designer-background-color': menuColorVars['main-background'],
|
|
127
|
+
'designer-collapsed-button-hover-background-color': menuColorVars['hover-background-color'],
|
|
128
|
+
'designer-collapsed-button-background-color': menuColorVars['collapsed-button-background-color']
|
|
129
|
+
};
|
|
130
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { registerDarkThemeFn, registerDefaultThemeFn } from '../style';
|
|
2
|
+
import { DefaultSideBarTheme, ThemeType } from '../typing';
|
|
3
|
+
import { setCurrentThemeType } from './currentTheme';
|
|
4
|
+
|
|
5
|
+
interface DefaultComponentTheme {
|
|
6
|
+
sideBarTheme: DefaultSideBarTheme;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function initOioComponentTheme(config: Partial<DefaultComponentTheme>) {
|
|
10
|
+
const mode = config.sideBarTheme?.mode || 'default';
|
|
11
|
+
setCurrentThemeType(mode.toLocaleLowerCase() as ThemeType);
|
|
12
|
+
registerDefaultThemeFn();
|
|
13
|
+
registerDarkThemeFn();
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_PREFIX = 'oio';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getTheme } from '../register';
|
|
2
|
+
import { DefaultThemeName, ThemeName } from '../typing';
|
|
3
|
+
import { DEFAULT_PREFIX } from './constant';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* el:
|
|
7
|
+
* 初始化时为body
|
|
8
|
+
* 应用加载时应用父类class
|
|
9
|
+
* 页面加载时页面父类class
|
|
10
|
+
*/
|
|
11
|
+
const THEME_CONFIG: Record<string, any> = {};
|
|
12
|
+
|
|
13
|
+
export function genCSSVars(themes: ThemeName[], el?: string, prefix?: string) {
|
|
14
|
+
const headNode = document.querySelector('head')!;
|
|
15
|
+
|
|
16
|
+
const element = el
|
|
17
|
+
? (document.getElementsByClassName(el)[0] as HTMLElement)
|
|
18
|
+
: (document.documentElement as HTMLElement);
|
|
19
|
+
if (!element) {
|
|
20
|
+
throw new Error('挂载dom匹配失败');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const styleTags = Array.from(document.getElementsByTagName('style')) || [];
|
|
24
|
+
|
|
25
|
+
// 每次构建的时候,都需要初始化默认主题
|
|
26
|
+
const currentThemes = [DefaultThemeName.DEFAULT_MEDIUM, ...themes];
|
|
27
|
+
|
|
28
|
+
const cssVars = currentThemes
|
|
29
|
+
.map((t) => getTheme(t) || {})
|
|
30
|
+
.reduce((preVars, nextVars) => {
|
|
31
|
+
return Object.assign(preVars, nextVars);
|
|
32
|
+
}, {});
|
|
33
|
+
|
|
34
|
+
if (!Object.keys(cssVars).length) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const className = 'oio-theme';
|
|
39
|
+
const themeTag = styleTags.find((tag) => tag.getAttribute('theme-id') === className);
|
|
40
|
+
|
|
41
|
+
const styleRules = Object.keys(cssVars)
|
|
42
|
+
.map((key) => {
|
|
43
|
+
if (Object.prototype.toString.call(cssVars[key]) === '[object Object]') {
|
|
44
|
+
THEME_CONFIG[key] = cssVars[key];
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
return `--${prefix || DEFAULT_PREFIX}-${key}: ${cssVars[key]};`;
|
|
48
|
+
})
|
|
49
|
+
.filter((v) => v);
|
|
50
|
+
|
|
51
|
+
const innerHTML = `:root{${styleRules.join('')}}`;
|
|
52
|
+
|
|
53
|
+
if (themeTag) {
|
|
54
|
+
themeTag.innerHTML = innerHTML;
|
|
55
|
+
} else {
|
|
56
|
+
const style = document.createElement('style');
|
|
57
|
+
|
|
58
|
+
[
|
|
59
|
+
{ key: 'type', value: 'text/css' },
|
|
60
|
+
{ key: 'theme-id', value: className }
|
|
61
|
+
].forEach(({ key, value }) => style!.setAttribute(key, value));
|
|
62
|
+
|
|
63
|
+
style.innerHTML = innerHTML;
|
|
64
|
+
|
|
65
|
+
headNode.appendChild(style);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { DEFAULT_PREFIX, THEME_CONFIG };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ThemeName } from '../typing';
|
|
2
|
+
|
|
3
|
+
const themeMap = new Map<string, Record<string, unknown>>();
|
|
4
|
+
|
|
5
|
+
const registerTheme = (theme: ThemeName, cssVars: Record<string, unknown>) => {
|
|
6
|
+
themeMap.set(theme, cssVars);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getTheme = (theme: ThemeName) => {
|
|
10
|
+
return themeMap.get(theme);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const registerThemeItem = (theme: ThemeName, cssVars: Record<string, unknown>) => {
|
|
14
|
+
const _theme = theme;
|
|
15
|
+
const themeObj = themeMap.get(_theme);
|
|
16
|
+
if (themeObj) {
|
|
17
|
+
Object.assign(themeObj, cssVars);
|
|
18
|
+
} else {
|
|
19
|
+
themeMap.set(_theme, cssVars);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { themeMap, registerTheme, getTheme, registerThemeItem };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const defaultLargeSizeVars = {
|
|
2
|
+
// font
|
|
3
|
+
'font-size': '14px',
|
|
4
|
+
'font-size-lg': '16px',
|
|
5
|
+
'font-size-sm': '12px',
|
|
6
|
+
|
|
7
|
+
padding: '24px',
|
|
8
|
+
margin: '24px',
|
|
9
|
+
|
|
10
|
+
'row-gap': '24px',
|
|
11
|
+
|
|
12
|
+
'line-height': '18px',
|
|
13
|
+
'line-height-lg': '20px',
|
|
14
|
+
'line-height-sm': '16px',
|
|
15
|
+
'line-height-xs': '14px',
|
|
16
|
+
'line-height-xxs': '12px',
|
|
17
|
+
// radius
|
|
18
|
+
'border-radius': '4px',
|
|
19
|
+
'border-radius-lg': '8px',
|
|
20
|
+
'border-radius-sm': '2px',
|
|
21
|
+
|
|
22
|
+
// padding
|
|
23
|
+
'padding-lg': '24px',
|
|
24
|
+
'padding-md': '16px',
|
|
25
|
+
'padding-sm': '12px',
|
|
26
|
+
'padding-xs': '8px',
|
|
27
|
+
'padding-xxs': '4px',
|
|
28
|
+
// margin
|
|
29
|
+
'margin-lg': '24px',
|
|
30
|
+
'margin-md': '16px',
|
|
31
|
+
'margin-sm': '12px',
|
|
32
|
+
'margin-xs': '8px',
|
|
33
|
+
'margin-xxs': '4px',
|
|
34
|
+
// height
|
|
35
|
+
height: '40px',
|
|
36
|
+
'height-lg': '54px',
|
|
37
|
+
'height-sm': '32px',
|
|
38
|
+
|
|
39
|
+
'min-height': '32px',
|
|
40
|
+
|
|
41
|
+
'label-height': '30px',
|
|
42
|
+
'horizontal-label-height': '32px'
|
|
43
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const defaultMediumSizeVars = {
|
|
2
|
+
// font
|
|
3
|
+
'font-size': '14px',
|
|
4
|
+
'font-size-lg': '16px',
|
|
5
|
+
'font-size-sm': '12px',
|
|
6
|
+
|
|
7
|
+
padding: '16px',
|
|
8
|
+
margin: '16px',
|
|
9
|
+
|
|
10
|
+
'row-gap': '16px',
|
|
11
|
+
|
|
12
|
+
'line-height': '18px',
|
|
13
|
+
'line-height-lg': '20px',
|
|
14
|
+
'line-height-sm': '16px',
|
|
15
|
+
'line-height-xs': '14px',
|
|
16
|
+
'line-height-xxs': '12px',
|
|
17
|
+
// radius
|
|
18
|
+
'border-radius': '4px',
|
|
19
|
+
'border-radius-lg': '8px',
|
|
20
|
+
'border-radius-sm': '2px',
|
|
21
|
+
|
|
22
|
+
// padding
|
|
23
|
+
'padding-lg': '16px',
|
|
24
|
+
'padding-md': '12px',
|
|
25
|
+
'padding-sm': '8px',
|
|
26
|
+
'padding-xs': '4px',
|
|
27
|
+
'padding-xxs': '2px',
|
|
28
|
+
// margin
|
|
29
|
+
'margin-lg': '16px',
|
|
30
|
+
'margin-md': '12px',
|
|
31
|
+
'margin-sm': '8px',
|
|
32
|
+
'margin-xs': '4px',
|
|
33
|
+
'margin-xxs': '2px',
|
|
34
|
+
// height
|
|
35
|
+
height: '32px',
|
|
36
|
+
'height-lg': '48px',
|
|
37
|
+
'height-sm': '32px',
|
|
38
|
+
|
|
39
|
+
'min-height': '32px',
|
|
40
|
+
|
|
41
|
+
'label-height': '28px',
|
|
42
|
+
'horizontal-label-height': '32px'
|
|
43
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const defaultSmallSizeVars = {
|
|
2
|
+
// font
|
|
3
|
+
'font-size': '14px',
|
|
4
|
+
'font-size-lg': '16px',
|
|
5
|
+
'font-size-sm': '12px',
|
|
6
|
+
|
|
7
|
+
padding: '12px',
|
|
8
|
+
margin: '12px',
|
|
9
|
+
|
|
10
|
+
'row-gap': '12px',
|
|
11
|
+
|
|
12
|
+
'line-height': '18px',
|
|
13
|
+
'line-height-lg': '20px',
|
|
14
|
+
'line-height-sm': '12px',
|
|
15
|
+
'line-height-xs': '14px',
|
|
16
|
+
'line-height-xxs': '12px',
|
|
17
|
+
// radius
|
|
18
|
+
'border-radius': '4px',
|
|
19
|
+
'border-radius-lg': '8px',
|
|
20
|
+
'border-radius-sm': '2px',
|
|
21
|
+
|
|
22
|
+
// padding
|
|
23
|
+
'padding-lg': '12px',
|
|
24
|
+
'padding-md': '10px',
|
|
25
|
+
'padding-sm': '8px',
|
|
26
|
+
'padding-xs': '4px',
|
|
27
|
+
'padding-xxs': '2px',
|
|
28
|
+
// margin
|
|
29
|
+
'margin-lg': '12px',
|
|
30
|
+
'margin-md': '10px',
|
|
31
|
+
'margin-sm': '8px',
|
|
32
|
+
'margin-xs': '4px',
|
|
33
|
+
'margin-xxs': '2px',
|
|
34
|
+
// height
|
|
35
|
+
height: '24px',
|
|
36
|
+
'height-lg': '40px',
|
|
37
|
+
'height-sm': '24px',
|
|
38
|
+
|
|
39
|
+
'min-height': '24px',
|
|
40
|
+
|
|
41
|
+
'label-height': '24px',
|
|
42
|
+
'horizontal-label-height': '32px'
|
|
43
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DEFAULT_PREFIX } from '../../mount';
|
|
2
|
+
|
|
3
|
+
export const largeInputSizeVars = {
|
|
4
|
+
'border-width': `var(--${DEFAULT_PREFIX}-border-width)`,
|
|
5
|
+
'border-radius': `var(--${DEFAULT_PREFIX}-border-radius)`,
|
|
6
|
+
'line-height': '22px',
|
|
7
|
+
'counter-font-size': `var(--${DEFAULT_PREFIX}-font-size-sm)`
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DEFAULT_PREFIX } from '../../mount';
|
|
2
|
+
|
|
3
|
+
export const mediumInputSizeVars = {
|
|
4
|
+
'border-width': `var(--${DEFAULT_PREFIX}-border-width)`,
|
|
5
|
+
'border-radius': `var(--${DEFAULT_PREFIX}-border-radius)`,
|
|
6
|
+
'line-height': '22px',
|
|
7
|
+
'counter-font-size': `var(--${DEFAULT_PREFIX}-font-size-sm)`
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const largeMenuSizeVars = {
|
|
2
|
+
padding: `0 16px`,
|
|
3
|
+
|
|
4
|
+
'margin-top': `4px`,
|
|
5
|
+
|
|
6
|
+
'item-height': `40px`,
|
|
7
|
+
'item-margin-top': `4px`,
|
|
8
|
+
'area-width': `263px`,
|
|
9
|
+
|
|
10
|
+
'collapsed-popup-item-padding': `0 16px`,
|
|
11
|
+
'collapsed-popup-margin-left': `-16px`,
|
|
12
|
+
'collapsed-button-border-radius': `4px`,
|
|
13
|
+
'collapsed-button-height': `40px`,
|
|
14
|
+
'collapsed-button-line-height': `38px`,
|
|
15
|
+
'designer-collapsed-button-height': `40px`,
|
|
16
|
+
'designer-collapsed-button-line-height': `30px`,
|
|
17
|
+
'designer-collapsed-button-border-radius': `4px`,
|
|
18
|
+
|
|
19
|
+
'border-radius': `4px`,
|
|
20
|
+
'selected-root-border-radius': `4px`,
|
|
21
|
+
|
|
22
|
+
'selected-margin-top': `4px`
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const mediumMenuSizeVars = {
|
|
2
|
+
padding: `0 16px`,
|
|
3
|
+
|
|
4
|
+
'margin-top': `8px`,
|
|
5
|
+
|
|
6
|
+
'item-height': `32px`,
|
|
7
|
+
'item-margin-top': `4px`,
|
|
8
|
+
'area-width': `263px`,
|
|
9
|
+
|
|
10
|
+
'collapsed-popup-item-padding': `0 16px`,
|
|
11
|
+
'collapsed-popup-margin-left': `-16px`,
|
|
12
|
+
'collapsed-button-border-radius': `4px`,
|
|
13
|
+
'collapsed-button-height': `32px`,
|
|
14
|
+
'collapsed-button-line-height': `30px`,
|
|
15
|
+
'designer-collapsed-button-height': `32px`,
|
|
16
|
+
'designer-collapsed-button-line-height': `30px`,
|
|
17
|
+
'designer-collapsed-button-border-radius': `4px`,
|
|
18
|
+
|
|
19
|
+
'border-radius': `4px`,
|
|
20
|
+
'selected-root-border-radius': `4px`,
|
|
21
|
+
|
|
22
|
+
'selected-margin-top': `4px`
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const smallMenuSizeVars = {
|
|
2
|
+
padding: `0 16px`,
|
|
3
|
+
|
|
4
|
+
'margin-top': `8px`,
|
|
5
|
+
|
|
6
|
+
'item-height': `24px`,
|
|
7
|
+
'item-margin-top': `4px`,
|
|
8
|
+
'area-width': `263px`,
|
|
9
|
+
|
|
10
|
+
'collapsed-popup-item-padding': `0 16px`,
|
|
11
|
+
'collapsed-popup-margin-left': `-16px`,
|
|
12
|
+
'collapsed-button-border-radius': `4px`,
|
|
13
|
+
'collapsed-button-height': `24px`,
|
|
14
|
+
'collapsed-button-line-height': `22px`,
|
|
15
|
+
'designer-collapsed-button-height': `24px`,
|
|
16
|
+
'designer-collapsed-button-line-height': `22px`,
|
|
17
|
+
'designer-collapsed-button-border-radius': `4px`,
|
|
18
|
+
|
|
19
|
+
'border-radius': `4px`,
|
|
20
|
+
'selected-root-border-radius': `4px`,
|
|
21
|
+
|
|
22
|
+
'selected-margin-top': `4px`
|
|
23
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DEFAULT_PREFIX } from '../../../mount';
|
|
2
|
+
|
|
3
|
+
export const component = 'app-switch';
|
|
4
|
+
|
|
5
|
+
export const cssVars = {
|
|
6
|
+
'background-color': '#333E4C',
|
|
7
|
+
'border-color': 'var(--oio-border-color)',
|
|
8
|
+
'app-name-overflow': `unset`,
|
|
9
|
+
'app-name-margin-right': `8px`,
|
|
10
|
+
'app-name-caret-down-display': `unset`,
|
|
11
|
+
'logo-color': `var(--${DEFAULT_PREFIX}-primary-color)`,
|
|
12
|
+
'designer-background-color': `var(--${DEFAULT_PREFIX}-primary-color)`,
|
|
13
|
+
'designer-logo-color': `var(--${DEFAULT_PREFIX}-primary-color)`
|
|
14
|
+
};
|