ep-craft 0.1.4 → 0.1.6

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,17 @@
1
+ /**
2
+ * 国际化(i18n)语言包
3
+ *
4
+ * 直接从 ep-craft 引入 element-plus 的语言包,无需再单独依赖 element-plus 的路径。
5
+ *
6
+ * 使用方式:
7
+ * ```ts
8
+ * // 按需引入某个语言
9
+ * import { zhCn, en } from 'ep-craft/locale'
10
+ *
11
+ * import { EpConfigProvider } from 'ep-craft'
12
+ *
13
+ * // <ep-config-provider :locale="zhCn"> ... </ep-config-provider>
14
+ * ```
15
+ */
16
+ export * from 'element-plus/es/locale';
17
+ export type { Language, TranslatePair } from 'element-plus/es/locale';
@@ -0,0 +1 @@
1
+ export * from "element-plus/es/locale";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep-craft",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A Vue 3 component library based on element-plus with ep- prefix",
5
5
  "type": "module",
6
6
  "main": "./dist/ep-craft.js",
@@ -15,6 +15,10 @@
15
15
  "import": "./dist/resolver.js",
16
16
  "types": "./dist/resolver.d.ts"
17
17
  },
18
+ "./locale": {
19
+ "import": "./dist/locale/index.js",
20
+ "types": "./dist/locale/index.d.ts"
21
+ },
18
22
  "./dist/index.css": "./dist/index.css",
19
23
  "./style.css": "./dist/index.css",
20
24
  "./theme-chalk/*": "./theme-chalk/*",
@@ -1,4 +1,5 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:list';
2
3
 
3
4
  @use 'common/var' as *;
4
5
  @use 'mixins/button' as *;
@@ -20,7 +21,8 @@ $button-icon-span-gap: map.merge(
20
21
  $text-color,
21
22
  $border-color,
22
23
  $hover-bg-color,
23
- $active-bg-color
24
+ $active-bg-color,
25
+ $disabled-bg-color: getCssVar('color-white')
24
26
  ) {
25
27
  @include set-css-var-value(('button', 'text-color'), $text-color);
26
28
  @include set-css-var-value(('button', 'bg-color'), getCssVar('color-white'));
@@ -32,16 +34,67 @@ $button-icon-span-gap: map.merge(
32
34
  @include set-css-var-value(('button', 'active', 'bg-color'), $active-bg-color);
33
35
  @include set-css-var-value(('button', 'active', 'border-color'), $border-color);
34
36
  @include set-css-var-value(('button', 'disabled', 'text-color'), $text-color);
35
- @include set-css-var-value(('button', 'disabled', 'bg-color'), getCssVar('color-white'));
37
+ @include set-css-var-value(('button', 'disabled', 'bg-color'), $disabled-bg-color);
36
38
  @include set-css-var-value(('button', 'disabled', 'border-color'), $border-color);
37
39
 
40
+ // 禁用态整体 40% 透明(保持实色,符合 Figma 设计)
38
41
  @include when(disabled) {
39
42
  opacity: 0.4;
40
43
  }
41
44
  }
42
45
 
46
+ // Button 专用浅色(hover/active 背景),公共色板未覆盖,集中在此管理
47
+ $button-plain-hover-bg: (
48
+ primary: #f5f8ff,
49
+ success: #f3fbf9,
50
+ warning: #fff6eb,
51
+ danger: #fff5f5,
52
+ );
53
+ $button-plain-active-bg: (
54
+ primary: #e5edff,
55
+ success: #e7f8f3,
56
+ warning: #ffe8cc,
57
+ danger: #ffc9c9,
58
+ );
59
+ // info plain 的 hover 浅背景,公共色板未覆盖
60
+ $button-info-plain-hover-bg: #f7f8fa;
61
+
62
+ // 各类型 plain 样式配置:text/border 色、hover 背景、active 背景、禁用背景
63
+ $button-plain-config: (
64
+ primary: (
65
+ $color-primary,
66
+ $color-primary,
67
+ map.get($button-plain-hover-bg, primary),
68
+ map.get($button-plain-active-bg, primary),
69
+ transparent,
70
+ ),
71
+ success: (
72
+ $color-success,
73
+ $color-success,
74
+ map.get($button-plain-hover-bg, success),
75
+ map.get($button-plain-active-bg, success),
76
+ transparent,
77
+ ),
78
+ warning: (
79
+ $color-warning,
80
+ $color-warning,
81
+ map.get($button-plain-hover-bg, warning),
82
+ map.get($button-plain-active-bg, warning),
83
+ transparent,
84
+ ),
85
+ danger: (
86
+ $color-danger,
87
+ $color-danger,
88
+ map.get($button-plain-hover-bg, danger),
89
+ map.get($button-plain-active-bg, danger),
90
+ transparent,
91
+ ),
92
+ );
93
+
43
94
  @include b(button) {
44
95
  @include set-component-css-var('button', $button);
96
+ // 默认按钮(未指定 type)样式与 primary 保持一致
97
+ @include button-variant(primary);
45
98
  }
46
99
 
47
100
  @include b(button) {
@@ -121,17 +174,14 @@ $button-icon-span-gap: map.merge(
121
174
  }
122
175
 
123
176
  @include when(plain) {
124
- @include css-var-from-global(
125
- ('button', 'hover', 'text-color'),
126
- ('color', 'primary')
127
- );
128
- @include css-var-from-global(
129
- ('button', 'hover', 'bg-color'),
130
- ('fill-color', 'blank')
131
- );
132
- @include css-var-from-global(
133
- ('button', 'hover', 'border-color'),
134
- ('color', 'primary')
177
+ // 默认朴素按钮样式与 primary + plain 保持一致
178
+ $cfg: map.get($button-plain-config, primary);
179
+ @include button-reverse-variant(
180
+ $color-primary,
181
+ list.nth($cfg, 2),
182
+ list.nth($cfg, 3),
183
+ list.nth($cfg, 4),
184
+ list.nth($cfg, 5)
135
185
  );
136
186
  }
137
187
 
@@ -151,6 +201,14 @@ $button-icon-span-gap: map.merge(
151
201
  background-color: getCssVar('button', 'disabled', 'bg-color');
152
202
  border-color: getCssVar('button', 'disabled', 'border-color');
153
203
  }
204
+
205
+ // 非 plain 按钮禁用时删除边框
206
+ &:not(.is-plain) {
207
+ &,
208
+ &:hover {
209
+ border-color: transparent;
210
+ }
211
+ }
154
212
  }
155
213
 
156
214
  @include when(loading) {
@@ -310,35 +368,105 @@ $button-icon-span-gap: map.merge(
310
368
  }
311
369
  }
312
370
 
313
- @each $type in (primary, success, warning, danger, info) {
314
- @include m($type) {
315
- @include button-variant($type);
371
+ // default 类型样式与 primary 保持一致
372
+ @include m(default) {
373
+ @include button-variant(primary);
374
+
375
+ &.is-plain {
376
+ $cfg: map.get($button-plain-config, primary);
377
+ @include button-reverse-variant(
378
+ getCssVar('color-primary'),
379
+ list.nth($cfg, 2),
380
+ list.nth($cfg, 3),
381
+ list.nth($cfg, 4),
382
+ list.nth($cfg, 5)
383
+ );
384
+
385
+ // plain 禁用态按 Figma 设计:透明背景 + 主题色 + 整体 40% 透明
386
+ &.is-disabled {
387
+ &,
388
+ &:hover,
389
+ &:focus,
390
+ &:active {
391
+ color: getCssVar('color-primary');
392
+ background-color: transparent;
393
+ border-color: list.nth($cfg, 2);
394
+ opacity: 0.4;
395
+ }
396
+ }
316
397
  }
317
398
  }
318
399
 
319
- @include m(rePrimary) {
320
- @include button-reverse-variant(
321
- getCssVar('color-primary'),
322
- #e5e6eb,
323
- #f5f8ff,
324
- #e5edff
325
- );
326
- }
400
+ @each $type in (primary, success, warning, danger) {
401
+ @include m($type) {
402
+ @include button-variant($type);
327
403
 
328
- @include m(reSuccess) {
329
- @include button-reverse-variant(#12b886, #12b886, #f3fbf9, #e7f8f3);
330
- }
404
+ &.is-plain {
405
+ $cfg: map.get($button-plain-config, $type);
406
+ // primary 文字色沿用全局 CSS 变量,其余用配置色值
407
+ $text: list.nth($cfg, 1);
408
+ @if $type == primary {
409
+ $text: getCssVar('color-primary');
410
+ }
331
411
 
332
- @include m(reDanger) {
333
- @include button-reverse-variant(#f14646, #f14646, #fff5f5, #ffc9c9);
334
- }
412
+ @include button-reverse-variant(
413
+ $text,
414
+ list.nth($cfg, 2),
415
+ list.nth($cfg, 3),
416
+ list.nth($cfg, 4),
417
+ list.nth($cfg, 5)
418
+ );
335
419
 
336
- @include m(reWarning) {
337
- @include button-reverse-variant(#f57f00, #f57f00, #fff6eb, #ffe8cc);
420
+ // plain 禁用态按 Figma 设计:透明背景 + 主题色 + 整体 40% 透明
421
+ // 覆盖 button-plain mixin 内置的浅色禁用样式
422
+ &.is-disabled {
423
+ &,
424
+ &:hover,
425
+ &:focus,
426
+ &:active {
427
+ color: $text;
428
+ background-color: transparent;
429
+ border-color: list.nth($cfg, 2);
430
+ opacity: 0.4;
431
+ }
432
+ }
433
+ }
434
+ }
338
435
  }
339
436
 
340
- @include m(reInfo) {
341
- @include button-reverse-variant(#1d1f29, #e5e6eb, #f7f8fa, #f2f3f5);
437
+ @include m(info) {
438
+ $info-text: map.get($text-color, 'primary');
439
+ $info-border: map.get($colors, 'info', 'light-3');
440
+
441
+ @include button-variant(info);
442
+ @include set-css-var-value(('button', 'text-color'), $info-text);
443
+ @include set-css-var-value(('button', 'hover', 'text-color'), $info-text);
444
+ @include set-css-var-value(('button', 'active', 'text-color'), $info-text);
445
+ @include set-css-var-value(('button', 'disabled', 'text-color'), rgba($info-text, 0.4));
446
+
447
+ &.is-plain {
448
+ // 禁用背景保持白色,其余同 button-reverse-variant 默认(含整体 40% 透明)
449
+ @include button-reverse-variant(
450
+ $info-text,
451
+ $info-border,
452
+ $button-info-plain-hover-bg,
453
+ $color-info
454
+ );
455
+
456
+ // plain + info 禁用态按 Figma 设计:白底 + 实色 + 整体 40% 透明
457
+ // 覆盖 button-plain mixin 内置的浅色禁用样式
458
+ &.is-disabled {
459
+ &,
460
+ &:hover,
461
+ &:focus,
462
+ &:active {
463
+ color: $info-text;
464
+ background-color: getCssVar('color-white');
465
+ border-color: $info-border;
466
+ opacity: 0.4;
467
+ }
468
+ }
469
+ }
342
470
  }
343
471
 
344
472
  @each $size in (large, small, mini) {
@@ -356,6 +484,7 @@ $button-icon-span-gap: map.merge(
356
484
  }
357
485
  }
358
486
 
487
+
359
488
  & {
360
489
  @include button-size(
361
490
  map.get($button-padding-vertical, $size) - $button-border-width,