@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.
Files changed (223) hide show
  1. package/dist/oinone-kunlun-theme.esm.js +1 -0
  2. package/dist/types/index.d.ts +5 -0
  3. package/dist/types/src/color/dark-vars.d.ts +87 -0
  4. package/dist/types/src/color/default-vars.d.ts +87 -0
  5. package/dist/types/src/color/index.d.ts +3 -0
  6. package/dist/types/src/color/menu-color-vars.d.ts +37 -0
  7. package/dist/types/src/init/currentTheme.d.ts +3 -0
  8. package/dist/types/src/init/index.d.ts +2 -0
  9. package/dist/types/src/init/initTheme.d.ts +6 -0
  10. package/dist/types/src/mount/constant.d.ts +1 -0
  11. package/dist/types/src/mount/index.d.ts +11 -0
  12. package/dist/types/src/register/index.d.ts +6 -0
  13. package/dist/types/src/size/default/index.d.ts +3 -0
  14. package/dist/types/src/size/default/large.d.ts +32 -0
  15. package/dist/types/src/size/default/medium.d.ts +32 -0
  16. package/dist/types/src/size/default/small.d.ts +32 -0
  17. package/dist/types/src/size/index.d.ts +8 -0
  18. package/dist/types/src/size/input/index.d.ts +2 -0
  19. package/dist/types/src/size/input/large.d.ts +6 -0
  20. package/dist/types/src/size/input/medium.d.ts +6 -0
  21. package/dist/types/src/size/menu/index.d.ts +3 -0
  22. package/dist/types/src/size/menu/large.d.ts +18 -0
  23. package/dist/types/src/size/menu/medium.d.ts +18 -0
  24. package/dist/types/src/size/menu/small.d.ts +18 -0
  25. package/dist/types/src/size/pagination/index.d.ts +3 -0
  26. package/dist/types/src/size/pagination/large.d.ts +5 -0
  27. package/dist/types/src/size/pagination/medium.d.ts +5 -0
  28. package/dist/types/src/size/pagination/small.d.ts +5 -0
  29. package/dist/types/src/size/select/index.d.ts +3 -0
  30. package/dist/types/src/size/select/large.d.ts +3 -0
  31. package/dist/types/src/size/select/medium.d.ts +3 -0
  32. package/dist/types/src/size/select/small.d.ts +3 -0
  33. package/dist/types/src/size/table/index.d.ts +3 -0
  34. package/dist/types/src/size/table/large.d.ts +5 -0
  35. package/dist/types/src/size/table/medium.d.ts +5 -0
  36. package/dist/types/src/size/table/small.d.ts +5 -0
  37. package/dist/types/src/size/tabs/index.d.ts +3 -0
  38. package/dist/types/src/size/tabs/large.d.ts +3 -0
  39. package/dist/types/src/size/tabs/medium.d.ts +3 -0
  40. package/dist/types/src/size/tabs/small.d.ts +3 -0
  41. package/dist/types/src/size/tree-select/index.d.ts +3 -0
  42. package/dist/types/src/size/tree-select/large.d.ts +4 -0
  43. package/dist/types/src/size/tree-select/medium.d.ts +4 -0
  44. package/dist/types/src/size/tree-select/small.d.ts +4 -0
  45. package/dist/types/src/style/dark/app-switch/app-switch.d.ts +11 -0
  46. package/dist/types/src/style/dark/button/constant.d.ts +2 -0
  47. package/dist/types/src/style/dark/button/danger.d.ts +126 -0
  48. package/dist/types/src/style/dark/button/index.d.ts +604 -0
  49. package/dist/types/src/style/dark/button/info.d.ts +126 -0
  50. package/dist/types/src/style/dark/button/standard.d.ts +126 -0
  51. package/dist/types/src/style/dark/button/success.d.ts +126 -0
  52. package/dist/types/src/style/dark/button/warning.d.ts +126 -0
  53. package/dist/types/src/style/dark/checkbox/checkbox.d.ts +7 -0
  54. package/dist/types/src/style/dark/component-theme.d.ts +2889 -0
  55. package/dist/types/src/style/dark/drawer/drawer.d.ts +9 -0
  56. package/dist/types/src/style/dark/dropdown/index.d.ts +12 -0
  57. package/dist/types/src/style/dark/form-item/form-item.d.ts +7 -0
  58. package/dist/types/src/style/dark/header/header.d.ts +5 -0
  59. package/dist/types/src/style/dark/index.d.ts +1 -0
  60. package/dist/types/src/style/dark/input/input.d.ts +36 -0
  61. package/dist/types/src/style/dark/menu/menu.d.ts +38 -0
  62. package/dist/types/src/style/dark/modal/modal.d.ts +10 -0
  63. package/dist/types/src/style/dark/multi-tab/multi-tab.d.ts +57 -0
  64. package/dist/types/src/style/dark/pagination/pagination.d.ts +6 -0
  65. package/dist/types/src/style/dark/popconfirm/popconfirm.d.ts +7 -0
  66. package/dist/types/src/style/dark/registry.d.ts +1 -0
  67. package/dist/types/src/style/dark/rich-text/rich-text.d.ts +22 -0
  68. package/dist/types/src/style/dark/scrollbar/scrollbar.d.ts +5 -0
  69. package/dist/types/src/style/dark/select/select.d.ts +39 -0
  70. package/dist/types/src/style/dark/switch/switch.d.ts +4 -0
  71. package/dist/types/src/style/dark/table/table.d.ts +21 -0
  72. package/dist/types/src/style/dark/tabs/tabs.d.ts +1 -0
  73. package/dist/types/src/style/dark/textarea/textarea.d.ts +27 -0
  74. package/dist/types/src/style/dark/transfer/transfer.d.ts +5 -0
  75. package/dist/types/src/style/dark/tree-select/tree-select.d.ts +1 -0
  76. package/dist/types/src/style/dark/upload/upload.d.ts +27 -0
  77. package/dist/types/src/style/default/app-switch/app-switch.d.ts +11 -0
  78. package/dist/types/src/style/default/button/constant.d.ts +2 -0
  79. package/dist/types/src/style/default/button/danger.d.ts +126 -0
  80. package/dist/types/src/style/default/button/index.d.ts +604 -0
  81. package/dist/types/src/style/default/button/info.d.ts +126 -0
  82. package/dist/types/src/style/default/button/standard.d.ts +126 -0
  83. package/dist/types/src/style/default/button/success.d.ts +126 -0
  84. package/dist/types/src/style/default/button/warning.d.ts +126 -0
  85. package/dist/types/src/style/default/checkbox/checkbox.d.ts +7 -0
  86. package/dist/types/src/style/default/component-theme.d.ts +2900 -0
  87. package/dist/types/src/style/default/datetime/datetime.d.ts +4 -0
  88. package/dist/types/src/style/default/drawer/drawer.d.ts +9 -0
  89. package/dist/types/src/style/default/dropdown/index.d.ts +12 -0
  90. package/dist/types/src/style/default/form-item/form-item.d.ts +7 -0
  91. package/dist/types/src/style/default/header/header.d.ts +5 -0
  92. package/dist/types/src/style/default/index.d.ts +1 -0
  93. package/dist/types/src/style/default/input/input.d.ts +36 -0
  94. package/dist/types/src/style/default/menu/menu.d.ts +38 -0
  95. package/dist/types/src/style/default/modal/modal.d.ts +10 -0
  96. package/dist/types/src/style/default/multi-tab/multi-tab.d.ts +57 -0
  97. package/dist/types/src/style/default/pagination/pagination.d.ts +6 -0
  98. package/dist/types/src/style/default/popconfirm/popconfirm.d.ts +7 -0
  99. package/dist/types/src/style/default/registry.d.ts +1 -0
  100. package/dist/types/src/style/default/rich-text/rich-text.d.ts +22 -0
  101. package/dist/types/src/style/default/scrollbar/scrollbar.d.ts +5 -0
  102. package/dist/types/src/style/default/select/select.d.ts +39 -0
  103. package/dist/types/src/style/default/switch/switch.d.ts +4 -0
  104. package/dist/types/src/style/default/table/table.d.ts +21 -0
  105. package/dist/types/src/style/default/tabs/tabs.d.ts +1 -0
  106. package/dist/types/src/style/default/textarea/textarea.d.ts +27 -0
  107. package/dist/types/src/style/default/transfer/transfer.d.ts +5 -0
  108. package/dist/types/src/style/default/tree-select/tree-select.d.ts +1 -0
  109. package/dist/types/src/style/default/upload/upload.d.ts +27 -0
  110. package/dist/types/src/style/index.d.ts +2 -0
  111. package/dist/types/src/typing.d.ts +15 -0
  112. package/index.ts +5 -0
  113. package/package.json +14 -0
  114. package/rollup.config.js +4 -0
  115. package/src/color/dark-vars.ts +112 -0
  116. package/src/color/default-vars.ts +113 -0
  117. package/src/color/index.ts +3 -0
  118. package/src/color/menu-color-vars.ts +130 -0
  119. package/src/init/currentTheme.ts +7 -0
  120. package/src/init/index.ts +2 -0
  121. package/src/init/initTheme.ts +14 -0
  122. package/src/mount/constant.ts +1 -0
  123. package/src/mount/index.ts +69 -0
  124. package/src/register/index.ts +23 -0
  125. package/src/size/default/index.ts +3 -0
  126. package/src/size/default/large.ts +43 -0
  127. package/src/size/default/medium.ts +43 -0
  128. package/src/size/default/small.ts +43 -0
  129. package/src/size/index.ts +8 -0
  130. package/src/size/input/index.ts +2 -0
  131. package/src/size/input/large.ts +8 -0
  132. package/src/size/input/medium.ts +8 -0
  133. package/src/size/menu/index.ts +3 -0
  134. package/src/size/menu/large.ts +23 -0
  135. package/src/size/menu/medium.ts +23 -0
  136. package/src/size/menu/small.ts +23 -0
  137. package/src/size/pagination/index.ts +3 -0
  138. package/src/size/pagination/large.ts +5 -0
  139. package/src/size/pagination/medium.ts +5 -0
  140. package/src/size/pagination/small.ts +5 -0
  141. package/src/size/select/index.ts +3 -0
  142. package/src/size/select/large.ts +3 -0
  143. package/src/size/select/medium.ts +3 -0
  144. package/src/size/select/small.ts +3 -0
  145. package/src/size/table/index.ts +3 -0
  146. package/src/size/table/large.ts +5 -0
  147. package/src/size/table/medium.ts +5 -0
  148. package/src/size/table/small.ts +5 -0
  149. package/src/size/tabs/index.ts +3 -0
  150. package/src/size/tabs/large.ts +5 -0
  151. package/src/size/tabs/medium.ts +5 -0
  152. package/src/size/tabs/small.ts +5 -0
  153. package/src/size/tree-select/index.ts +3 -0
  154. package/src/size/tree-select/large.ts +4 -0
  155. package/src/size/tree-select/medium.ts +4 -0
  156. package/src/size/tree-select/small.ts +4 -0
  157. package/src/style/dark/app-switch/app-switch.ts +14 -0
  158. package/src/style/dark/button/constant.ts +4 -0
  159. package/src/style/dark/button/danger.ts +146 -0
  160. package/src/style/dark/button/index.ts +28 -0
  161. package/src/style/dark/button/info.ts +146 -0
  162. package/src/style/dark/button/standard.ts +146 -0
  163. package/src/style/dark/button/success.ts +146 -0
  164. package/src/style/dark/button/warning.ts +146 -0
  165. package/src/style/dark/checkbox/checkbox.ts +10 -0
  166. package/src/style/dark/component-theme.ts +174 -0
  167. package/src/style/dark/drawer/drawer.ts +10 -0
  168. package/src/style/dark/dropdown/index.ts +14 -0
  169. package/src/style/dark/form-item/form-item.ts +10 -0
  170. package/src/style/dark/header/header.ts +6 -0
  171. package/src/style/dark/index.ts +1 -0
  172. package/src/style/dark/input/input.ts +46 -0
  173. package/src/style/dark/menu/menu.ts +7 -0
  174. package/src/style/dark/modal/modal.ts +11 -0
  175. package/src/style/dark/multi-tab/multi-tab.ts +67 -0
  176. package/src/style/dark/pagination/pagination.ts +9 -0
  177. package/src/style/dark/popconfirm/popconfirm.ts +8 -0
  178. package/src/style/dark/registry.ts +62 -0
  179. package/src/style/dark/rich-text/rich-text.ts +25 -0
  180. package/src/style/dark/scrollbar/scrollbar.ts +6 -0
  181. package/src/style/dark/select/select.ts +48 -0
  182. package/src/style/dark/switch/switch.ts +5 -0
  183. package/src/style/dark/table/table.ts +44 -0
  184. package/src/style/dark/tabs/tabs.ts +1 -0
  185. package/src/style/dark/textarea/textarea.ts +34 -0
  186. package/src/style/dark/transfer/transfer.ts +6 -0
  187. package/src/style/dark/tree-select/tree-select.ts +1 -0
  188. package/src/style/dark/upload/upload.ts +34 -0
  189. package/src/style/default/app-switch/app-switch.ts +14 -0
  190. package/src/style/default/button/constant.ts +4 -0
  191. package/src/style/default/button/danger.ts +146 -0
  192. package/src/style/default/button/index.ts +28 -0
  193. package/src/style/default/button/info.ts +146 -0
  194. package/src/style/default/button/standard.ts +146 -0
  195. package/src/style/default/button/success.ts +146 -0
  196. package/src/style/default/button/warning.ts +146 -0
  197. package/src/style/default/checkbox/checkbox.ts +10 -0
  198. package/src/style/default/component-theme.ts +178 -0
  199. package/src/style/default/datetime/datetime.ts +5 -0
  200. package/src/style/default/drawer/drawer.ts +10 -0
  201. package/src/style/default/dropdown/index.ts +14 -0
  202. package/src/style/default/form-item/form-item.ts +10 -0
  203. package/src/style/default/header/header.ts +6 -0
  204. package/src/style/default/index.ts +1 -0
  205. package/src/style/default/input/input.ts +46 -0
  206. package/src/style/default/menu/menu.ts +7 -0
  207. package/src/style/default/modal/modal.ts +11 -0
  208. package/src/style/default/multi-tab/multi-tab.ts +67 -0
  209. package/src/style/default/pagination/pagination.ts +9 -0
  210. package/src/style/default/popconfirm/popconfirm.ts +8 -0
  211. package/src/style/default/registry.ts +63 -0
  212. package/src/style/default/rich-text/rich-text.ts +25 -0
  213. package/src/style/default/scrollbar/scrollbar.ts +6 -0
  214. package/src/style/default/select/select.ts +49 -0
  215. package/src/style/default/switch/switch.ts +5 -0
  216. package/src/style/default/table/table.ts +44 -0
  217. package/src/style/default/tabs/tabs.ts +1 -0
  218. package/src/style/default/textarea/textarea.ts +34 -0
  219. package/src/style/default/transfer/transfer.ts +6 -0
  220. package/src/style/default/tree-select/tree-select.ts +1 -0
  221. package/src/style/default/upload/upload.ts +34 -0
  222. package/src/style/index.ts +2 -0
  223. package/src/typing.ts +31 -0
@@ -0,0 +1,3 @@
1
+ export * from './dark-vars';
2
+ export * from './default-vars';
3
+ export * from './menu-color-vars';
@@ -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,7 @@
1
+ import { ThemeType } from '../typing';
2
+
3
+ export let currentOioThemeType: ThemeType = 'default';
4
+
5
+ export function setCurrentThemeType(themeType: ThemeType) {
6
+ currentOioThemeType = themeType;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './currentTheme';
2
+ export * from './initTheme';
@@ -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,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -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
+ export * from './default';
2
+ export * from './input';
3
+ export * from './table';
4
+ export * from './menu';
5
+ export * from './pagination';
6
+ export * from './select';
7
+ export * from './tree-select';
8
+ export * from './tabs';
@@ -0,0 +1,2 @@
1
+ export * from './large';
2
+ export * from './medium';
@@ -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,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -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,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -0,0 +1,5 @@
1
+ export const largePaginationSizeVars = {
2
+ height: '32px',
3
+ 'item-height': '30px',
4
+ 'item-width': '32px'
5
+ };
@@ -0,0 +1,5 @@
1
+ export const mediumPaginationSizeVars = {
2
+ height: '32px',
3
+ 'item-height': '30px',
4
+ 'item-width': '32px'
5
+ };
@@ -0,0 +1,5 @@
1
+ export const smallPaginationSizeVars = {
2
+ height: '24px',
3
+ 'item-height': '22px',
4
+ 'item-width': '24px'
5
+ };
@@ -0,0 +1,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -0,0 +1,3 @@
1
+ export const largeSelectSizeVars = {
2
+ 'line-height': '22px'
3
+ };
@@ -0,0 +1,3 @@
1
+ export const mediumSelectSizeVars = {
2
+ 'line-height': '22px'
3
+ };
@@ -0,0 +1,3 @@
1
+ export const smallSelectSizeVars = {
2
+ 'line-height': '16px'
3
+ };
@@ -0,0 +1,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -0,0 +1,5 @@
1
+ export const largeTableSizeVars = {
2
+ 'thead-height': '54px',
3
+ 'user-prefer-top': '12px',
4
+ 'user-prefer-right': '22px'
5
+ };
@@ -0,0 +1,5 @@
1
+ export const mediumTableSizeVars = {
2
+ 'thead-height': '48px',
3
+ 'user-prefer-top': '8px',
4
+ 'user-prefer-right': '22px'
5
+ };
@@ -0,0 +1,5 @@
1
+ export const smallTableSizeVars = {
2
+ 'thead-height': '40px',
3
+ 'user-prefer-top': '4px',
4
+ 'user-prefer-right': '22px'
5
+ };
@@ -0,0 +1,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -0,0 +1,5 @@
1
+ import { DEFAULT_PREFIX } from '../../mount';
2
+
3
+ export const largeTabsSizeVars = {
4
+ 'font-size': `var(--${DEFAULT_PREFIX}-font-size-lg)`
5
+ };
@@ -0,0 +1,5 @@
1
+ import { DEFAULT_PREFIX } from '../../mount';
2
+
3
+ export const mediumTabsSizeVars = {
4
+ 'font-size': `var(--${DEFAULT_PREFIX}-font-size)`
5
+ };
@@ -0,0 +1,5 @@
1
+ import { DEFAULT_PREFIX } from '../../mount';
2
+
3
+ export const smallTabsSizeVars = {
4
+ 'font-size': `var(--${DEFAULT_PREFIX}-font-size)`
5
+ };
@@ -0,0 +1,3 @@
1
+ export * from './large';
2
+ export * from './medium';
3
+ export * from './small';
@@ -0,0 +1,4 @@
1
+ export const largeTreeSelectSizeVars = {
2
+ 'selection-height': '24px',
3
+ 'selection-line-height': '22px'
4
+ };
@@ -0,0 +1,4 @@
1
+ export const mediumTreeSelectSizeVars = {
2
+ 'selection-height': '24px',
3
+ 'selection-line-height': '22px'
4
+ };
@@ -0,0 +1,4 @@
1
+ export const smallTreeSelectSizeVars = {
2
+ 'selection-height': '16px',
3
+ 'selection-line-height': '16px'
4
+ };
@@ -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
+ };
@@ -0,0 +1,4 @@
1
+ import { DEFAULT_PREFIX } from '../../../mount';
2
+
3
+ export const component = 'button';
4
+ export const prefix = `${DEFAULT_PREFIX}-${component}`;