@mc-markets/ui 1.0.31 → 1.0.33

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.
@@ -0,0 +1,51 @@
1
+ interface DialogParam {
2
+ modelValue: boolean;
3
+ attrs?: Object;
4
+ title?: string;
5
+ width?: number | string;
6
+ draggable?: boolean;
7
+ showConfirmButton?: boolean;
8
+ showCancelButton?: boolean;
9
+ confirmButtonText?: string;
10
+ cancelButtonText?: string;
11
+ }
12
+ declare function __VLS_template(): {
13
+ attrs: Partial<{}>;
14
+ slots: {
15
+ header?(_: {
16
+ close: () => void;
17
+ titleId: string;
18
+ titleClass: string;
19
+ }): any;
20
+ default?(_: {}): any;
21
+ footer?(_: {}): any;
22
+ };
23
+ refs: {};
24
+ rootEl: any;
25
+ };
26
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
27
+ declare const __VLS_component: import('vue').DefineComponent<DialogParam, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
+ "update:modelValue": (...args: any[]) => void;
29
+ close: (...args: any[]) => void;
30
+ confirm: (...args: any[]) => void;
31
+ }, string, import('vue').PublicProps, Readonly<DialogParam> & Readonly<{
32
+ "onUpdate:modelValue"?: (...args: any[]) => any;
33
+ onClose?: (...args: any[]) => any;
34
+ onConfirm?: (...args: any[]) => any;
35
+ }>, {
36
+ modelValue: boolean;
37
+ title: string;
38
+ width: number | string;
39
+ draggable: boolean;
40
+ showConfirmButton: boolean;
41
+ showCancelButton: boolean;
42
+ confirmButtonText: string;
43
+ cancelButtonText: string;
44
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
45
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
46
+ export default _default;
47
+ type __VLS_WithTemplateSlots<T, S> = T & {
48
+ new (): {
49
+ $slots: S;
50
+ };
51
+ };
@@ -1,5 +1,5 @@
1
1
  import { App } from 'vue';
2
- import { default as Dialog } from './components/Dialog/index.vue';
2
+ import { default as TDDialog } from './components/Dialog/index.vue';
3
3
  import { Icon } from './components/Icon';
4
4
  import { default as Tab } from './components/Tab/Tab.vue';
5
5
  import { default as TabPane } from './components/Tab/TabPane.vue';
@@ -10,7 +10,7 @@ import { Pagination } from './components/Pagination';
10
10
  import { Banner } from './components/Banner';
11
11
  import { Empty } from './components/Empty';
12
12
  import { Tooltips } from './components/Tooltips';
13
- export { Dialog, Icon, Tab, TabPane, Alert, Notification, DatePicker, Pagination, Banner, Empty, Tooltips };
13
+ export { TDDialog, Icon, Tab, TabPane, Alert, Notification, DatePicker, Pagination, Banner, Empty, Tooltips };
14
14
  export * from './styles/theme-config';
15
15
  export { default as variables } from './styles/variables.scss?inline';
16
16
  export { default as styles } from './styles/index.scss?inline';
@@ -60,6 +60,8 @@ export declare class ThemeConfigManager {
60
60
  private generateLightColors;
61
61
  /** 生成深色变体 */
62
62
  private generateDarkColors;
63
+ /** 使颜色变暗 */
64
+ private darkenColor;
63
65
  /** 重置主题 */
64
66
  resetTheme(): void;
65
67
  /** 导出主题配置 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mc-markets/ui",
3
3
  "private": false,
4
- "version": "1.0.31",
4
+ "version": "1.0.33",
5
5
  "type": "module",
6
6
  "author": "chenyu",
7
7
  "description": "Element Plus 完整导出包,提供所有组件、指令和服务",
@@ -8,10 +8,9 @@
8
8
  * - 图标字体
9
9
  */
10
10
 
11
- // 导入 Element Plus 主题定制(包含所有 CSS 变量)
11
+ // 导入主题变量配置(包含所有CSS变量定义)
12
12
  @use './variables.scss';
13
- @use './element/button.scss';
14
- @use './font/iconfont.scss';
15
13
 
16
- // 导入 Element Plus 基础样式
17
- @import 'element-plus/dist/index.css';
14
+ // 导入自定义组件样式
15
+ @use './element/button.scss';
16
+ @use './font/iconfont.scss';
@@ -115,6 +115,21 @@ export class ThemeConfigManager {
115
115
  root.style.setProperty(`--el-color-${type}-light-8`, lightColors[8])
116
116
  root.style.setProperty(`--el-color-${type}-light-9`, lightColors[9])
117
117
  root.style.setProperty(`--el-color-${type}-dark-2`, darkColors[2])
118
+
119
+ // 同时更新暗色主题变量
120
+ if (this.currentTheme.dark) {
121
+ const darkBaseColor = this.darkenColor(baseColor, 0.1)
122
+ const darkLightColors = this.generateLightColors(darkBaseColor)
123
+ const darkDarkColors = this.generateDarkColors(darkBaseColor)
124
+
125
+ root.style.setProperty(`--el-color-${type}`, this.rgbToHex(darkBaseColor.r, darkBaseColor.g, darkBaseColor.b))
126
+ root.style.setProperty(`--el-color-${type}-light-3`, darkLightColors[3])
127
+ root.style.setProperty(`--el-color-${type}-light-5`, darkLightColors[5])
128
+ root.style.setProperty(`--el-color-${type}-light-7`, darkLightColors[7])
129
+ root.style.setProperty(`--el-color-${type}-light-8`, darkLightColors[8])
130
+ root.style.setProperty(`--el-color-${type}-light-9`, darkLightColors[9])
131
+ root.style.setProperty(`--el-color-${type}-dark-2`, darkDarkColors[2])
132
+ }
118
133
  }
119
134
 
120
135
  /** 应用主题 */
@@ -203,6 +218,15 @@ export class ThemeConfigManager {
203
218
  return colors
204
219
  }
205
220
 
221
+ /** 使颜色变暗 */
222
+ private darkenColor(rgb: { r: number; g: number; b: number }, factor: number): { r: number; g: number; b: number } {
223
+ return {
224
+ r: Math.round(rgb.r * (1 - factor)),
225
+ g: Math.round(rgb.g * (1 - factor)),
226
+ b: Math.round(rgb.b * (1 - factor))
227
+ }
228
+ }
229
+
206
230
  /** 重置主题 */
207
231
  resetTheme(): void {
208
232
  const root = document.documentElement
@@ -5,65 +5,10 @@
5
5
  * @see https://element-plus.org/zh-CN/guide/theming.html
6
6
  */
7
7
 
8
- // 自定义 Element Plus 变量
9
- @forward 'element-plus/theme-chalk/src/common/var.scss' with (
10
- // 自定义颜色变量
11
- $colors: (
12
- 'primary': (
13
- 'base': #FFD905,
14
- ),
15
- 'success': (
16
- 'base': #34A88B ,
17
- ),
18
- 'warning': (
19
- 'base': #FFA61F,
20
- ),
21
- 'danger': (
22
- 'base': #f14654,
23
- ),
24
- 'info': (
25
- 'base': #585660,
26
- ),
27
- ),
28
- // 自定义字体大小
29
- $font-size: (
30
- 'extra-large': 20px,
31
- 'large': 18px,
32
- 'medium': 16px,
33
- 'base': 14px,
34
- 'small': 12px,
35
- 'extra-small': 10px,
36
- ),
37
- // 自定义圆角
38
- $border-radius: (
39
- 'base': 8px,
40
- 'small': 4px,
41
- 'round': 20px,
42
- 'circle': 100%,
43
- ),
44
-
45
- // 自定义阴影
46
- $box-shadow: (
47
- 'base': (
48
- 0 2px 4px rgba(0, 0, 0, 0.12),
49
- 0 0 6px rgba(0, 0, 0, 0.04)
50
- ),
51
- 'light': (
52
- 0 2px 12px 0 rgba(0, 0, 0, 0.1)
53
- ),
54
- 'lighter': (
55
- 0 2px 12px 0 rgba(0, 0, 0, 0.06)
56
- ),
57
- 'dark': (
58
- 0 2px 4px rgba(0, 0, 0, 0.12),
59
- 0 0 6px rgba(0, 0, 0, 0.12)
60
- ),
61
- )
62
- );
63
-
64
8
  // 导入所有 Element Plus 样式
65
9
  @use "element-plus/theme-chalk/src/index.scss" as *;
66
10
  @use 'element-plus/theme-chalk/src/dark/css-vars.scss';
11
+
67
12
  // 导入项目变量
68
13
  @use './variables/border-mode.css';
69
14
  @use './variables/color-modes-dark.css';
@@ -71,3 +16,131 @@
71
16
  @use './variables/radius-mode.css';
72
17
  @use './variables/spacing-mode.css';
73
18
  @use './variables/typography-desktop.css';
19
+
20
+ // 定义主题变量映射
21
+ $theme-variables: (
22
+ // 主色调
23
+ 'primary': (
24
+ 'base': #FFD905,
25
+ 'light-3': #FFE855,
26
+ 'light-5': #FFED7A,
27
+ 'light-7': #FFF2A0,
28
+ 'light-8': #FFF5B3,
29
+ 'light-9': #FFF9D9,
30
+ 'dark-2': #E6C300
31
+ ),
32
+ // 成功色
33
+ 'success': (
34
+ 'base': #34A88B,
35
+ 'light-3': #5BB89E,
36
+ 'light-5': #7CC7B1,
37
+ 'light-7': #9DD6C4,
38
+ 'light-8': #B3E0D2,
39
+ 'light-9': #D9F0E8,
40
+ 'dark-2': #2A8A73
41
+ ),
42
+ // 警告色
43
+ 'warning': (
44
+ 'base': #FFA61F,
45
+ 'light-3': #FFB84D,
46
+ 'light-5': #FFC973,
47
+ 'light-7': #FFD999,
48
+ 'light-8': #FFE2B3,
49
+ 'light-9': #FFF0D9,
50
+ 'dark-2': #E6940C
51
+ ),
52
+ // 危险色
53
+ 'danger': (
54
+ 'base': #f14654,
55
+ 'light-3': #F46B77,
56
+ 'light-5': #F78A94,
57
+ 'light-7': #FAA9B1,
58
+ 'light-8': #FBC2C8,
59
+ 'light-9': #FDE0E3,
60
+ 'dark-2': #D63A47
61
+ ),
62
+ // 信息色
63
+ 'info': (
64
+ 'base': #585660,
65
+ 'light-3': #7A7A82,
66
+ 'light-5': #96969C,
67
+ 'light-7': #B2B2B6,
68
+ 'light-8': #C6C6C9,
69
+ 'light-9': #E0E0E2,
70
+ 'dark-2': #46464E
71
+ )
72
+ );
73
+
74
+ // 生成CSS变量
75
+ :root {
76
+ // 颜色变量
77
+ @each $color-name, $color-variants in $theme-variables {
78
+ @each $variant, $value in $color-variants {
79
+ --el-color-#{$color-name}#{if($variant != 'base', '-' + $variant, '')}: #{$value};
80
+ }
81
+ }
82
+
83
+ // 字体大小
84
+ --el-font-size-extra-large: 20px;
85
+ --el-font-size-large: 18px;
86
+ --el-font-size-medium: 16px;
87
+ --el-font-size-base: 14px;
88
+ --el-font-size-small: 12px;
89
+ --el-font-size-extra-small: 10px;
90
+
91
+ // 圆角
92
+ --el-border-radius-base: 8px;
93
+ --el-border-radius-small: 4px;
94
+ --el-border-radius-round: 20px;
95
+ --el-border-radius-circle: 100%;
96
+
97
+ // 间距
98
+ --el-spacing-base: 16px;
99
+ --el-spacing-small: 8px;
100
+ --el-spacing-large: 24px;
101
+
102
+ // 阴影
103
+ --el-box-shadow-base: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
104
+ --el-box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
105
+ --el-box-shadow-dark: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
106
+
107
+ // 过渡动画
108
+ --el-transition-base: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
109
+ --el-transition-fade: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1);
110
+ --el-transition-md-fade: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1);
111
+ --el-transition-fade-linear: opacity 0.2s linear;
112
+ --el-transition-border: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
113
+ --el-transition-box-shadow: box-shadow 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
114
+ --el-transition-color: color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
115
+ }
116
+
117
+ // 暗色主题
118
+ .dark {
119
+ // 在暗色主题中重新定义颜色变量
120
+ @each $color-name, $color-variants in $theme-variables {
121
+ @each $variant, $value in $color-variants {
122
+ --el-color-#{$color-name}#{if($variant != 'base', '-' + $variant, '')}: #{darken($value, 10%)};
123
+ }
124
+ }
125
+
126
+ // 暗色主题特殊变量
127
+ --el-bg-color: #141414;
128
+ --el-bg-color-page: #0a0a0a;
129
+ --el-text-color-primary: #e5eaf3;
130
+ --el-text-color-regular: #cfd3dc;
131
+ --el-text-color-secondary: #a3a6ad;
132
+ --el-text-color-placeholder: #8d9095;
133
+ --el-text-color-disabled: #6c6e72;
134
+ --el-border-color: #4c4d4f;
135
+ --el-border-color-light: #414243;
136
+ --el-border-color-lighter: #363637;
137
+ --el-border-color-extra-light: #2b2b2c;
138
+ --el-fill-color: #f0f2f5;
139
+ --el-fill-color-light: #f5f7fa;
140
+ --el-fill-color-lighter: #fafafa;
141
+ --el-fill-color-extra-light: #fafcff;
142
+ --el-fill-color-blank: #ffffff;
143
+ --el-fill-color-dark: #ebedf0;
144
+ --el-fill-color-darker: #e6e8eb;
145
+ --el-fill-color-darkest: #b1b3b8;
146
+ }