uview-pro 0.3.16 → 0.4.2

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 (140) hide show
  1. package/changelog.md +82 -0
  2. package/components/u-action-sheet-item/u-action-sheet-item.vue +1 -1
  3. package/components/u-alert-tips/u-alert-tips.vue +2 -2
  4. package/components/u-avatar/u-avatar.vue +5 -5
  5. package/components/u-avatar-cropper/u-avatar-cropper.vue +5 -5
  6. package/components/u-avatar-cropper/weCropper.js +1 -1
  7. package/components/u-avatar-cropper/weCropper.ts +1 -1
  8. package/components/u-back-top/types.ts +1 -1
  9. package/components/u-back-top/u-back-top.vue +1 -1
  10. package/components/u-badge/u-badge.vue +1 -31
  11. package/components/u-button/types.ts +1 -1
  12. package/components/u-button/u-button.vue +45 -37
  13. package/components/u-calendar/types.ts +4 -4
  14. package/components/u-calendar/u-calendar.vue +8 -8
  15. package/components/u-car-keyboard/u-car-keyboard.vue +5 -5
  16. package/components/u-card/types.ts +2 -2
  17. package/components/u-card/u-card.vue +3 -3
  18. package/components/u-cell-group/u-cell-group.vue +1 -1
  19. package/components/u-cell-item/u-cell-item.vue +2 -2
  20. package/components/u-checkbox/u-checkbox.vue +7 -7
  21. package/components/u-circle-progress/types.ts +4 -3
  22. package/components/u-circle-progress/u-circle-progress.vue +3 -3
  23. package/components/u-city-select/u-city-select.vue +1 -1
  24. package/components/u-collapse/types.ts +2 -2
  25. package/components/u-collapse/u-collapse.vue +1 -1
  26. package/components/u-collapse-item/u-collapse-item.vue +1 -1
  27. package/components/u-column-notice/u-column-notice.vue +2 -2
  28. package/components/u-config-provider/types.ts +34 -0
  29. package/components/u-config-provider/u-config-provider.vue +141 -0
  30. package/components/u-count-down/types.ts +4 -4
  31. package/components/u-count-down/u-count-down.vue +4 -4
  32. package/components/u-count-to/types.ts +1 -1
  33. package/components/u-count-to/u-count-to.vue +1 -1
  34. package/components/u-divider/types.ts +3 -3
  35. package/components/u-divider/u-divider.vue +4 -4
  36. package/components/u-dropdown/u-dropdown.vue +3 -3
  37. package/components/u-empty/types.ts +2 -2
  38. package/components/u-empty/u-empty.vue +1 -1
  39. package/components/u-field/types.ts +3 -3
  40. package/components/u-field/u-field.vue +6 -6
  41. package/components/u-form-item/u-form-item.vue +1 -1
  42. package/components/u-full-screen/u-full-screen.vue +1 -1
  43. package/components/u-gap/u-gap.vue +2 -2
  44. package/components/u-grid-item/types.ts +1 -1
  45. package/components/u-grid-item/u-grid-item.vue +3 -3
  46. package/components/u-icon/types.ts +2 -2
  47. package/components/u-icon/u-icon.vue +2 -2
  48. package/components/u-image/types.ts +4 -2
  49. package/components/u-image/u-image.vue +7 -2
  50. package/components/u-index-anchor/u-index-anchor.vue +3 -3
  51. package/components/u-index-list/u-index-list.vue +1 -1
  52. package/components/u-input/types.ts +4 -4
  53. package/components/u-input/u-input.vue +7 -7
  54. package/components/u-keyboard/u-keyboard.vue +3 -3
  55. package/components/u-lazy-load/u-lazy-load.vue +1 -1
  56. package/components/u-line/types.ts +1 -1
  57. package/components/u-line/u-line.vue +1 -1
  58. package/components/u-line-progress/types.ts +2 -2
  59. package/components/u-line-progress/u-line-progress.vue +3 -3
  60. package/components/u-link/u-link.vue +1 -1
  61. package/components/u-loading/types.ts +1 -1
  62. package/components/u-loading/u-loading.vue +3 -3
  63. package/components/u-loading-popup/types.ts +1 -1
  64. package/components/u-loading-popup/u-loading-popup.vue +2 -2
  65. package/components/u-loadmore/types.ts +2 -2
  66. package/components/u-loadmore/u-loadmore.vue +6 -6
  67. package/components/u-message-input/u-message-input.vue +5 -5
  68. package/components/u-modal/u-modal.vue +2 -2
  69. package/components/u-navbar/types.ts +4 -4
  70. package/components/u-navbar/u-navbar.vue +27 -20
  71. package/components/u-no-network/u-no-network.vue +2 -2
  72. package/components/u-number-box/types.ts +4 -4
  73. package/components/u-number-box/u-number-box.vue +6 -6
  74. package/components/u-number-keyboard/u-number-keyboard.vue +2 -2
  75. package/components/u-picker/u-picker.vue +4 -4
  76. package/components/u-popup/types.ts +1 -1
  77. package/components/u-popup/u-popup.vue +6 -6
  78. package/components/u-radio/u-radio.vue +7 -7
  79. package/components/u-rate/types.ts +2 -2
  80. package/components/u-rate/u-rate.vue +2 -2
  81. package/components/u-read-more/types.ts +1 -1
  82. package/components/u-row-notice/u-row-notice.vue +2 -2
  83. package/components/u-search/types.ts +4 -4
  84. package/components/u-search/u-search.vue +4 -4
  85. package/components/u-section/types.ts +2 -2
  86. package/components/u-section/u-section.vue +2 -2
  87. package/components/u-select/u-select.vue +6 -6
  88. package/components/u-skeleton/types.ts +2 -2
  89. package/components/u-skeleton/u-skeleton.vue +2 -2
  90. package/components/u-slider/types.ts +1 -1
  91. package/components/u-slider/u-slider.vue +4 -4
  92. package/components/u-step/u-step.vue +4 -4
  93. package/components/u-steps/u-steps.vue +3 -3
  94. package/components/u-sticky/types.ts +1 -1
  95. package/components/u-sticky/u-sticky.vue +1 -1
  96. package/components/u-subsection/types.ts +4 -4
  97. package/components/u-subsection/u-subsection.vue +7 -7
  98. package/components/u-swipe-action/types.ts +1 -1
  99. package/components/u-swipe-action/u-swipe-action.vue +2 -2
  100. package/components/u-swiper/types.ts +1 -1
  101. package/components/u-swiper/u-swiper.vue +1 -1
  102. package/components/u-switch/types.ts +1 -1
  103. package/components/u-switch/u-switch.vue +5 -5
  104. package/components/u-tabbar/types.ts +5 -4
  105. package/components/u-tabbar/u-tabbar.vue +5 -5
  106. package/components/u-table/types.ts +3 -3
  107. package/components/u-table/u-table.vue +3 -3
  108. package/components/u-tabs/types.ts +1 -1
  109. package/components/u-tabs/u-tabs.vue +2 -2
  110. package/components/u-tabs-swiper/types.ts +1 -1
  111. package/components/u-tabs-swiper/u-tabs-swiper.vue +2 -2
  112. package/components/u-tag/u-tag.vue +12 -12
  113. package/components/u-text/types.ts +1 -1
  114. package/components/u-text/u-text.vue +1 -1
  115. package/components/u-textarea/types.ts +1 -1
  116. package/components/u-textarea/u-textarea.vue +6 -6
  117. package/components/u-time-line/u-time-line.vue +1 -1
  118. package/components/u-time-line-item/types.ts +1 -1
  119. package/components/u-time-line-item/u-time-line-item.vue +2 -3
  120. package/components/u-toast/u-toast.vue +8 -8
  121. package/components/u-top-tips/u-top-tips.vue +1 -1
  122. package/components/u-upload/types.ts +2 -2
  123. package/components/u-upload/u-upload.vue +1 -1
  124. package/index.scss +1 -0
  125. package/index.ts +42 -11
  126. package/libs/config/theme-tokens.ts +101 -0
  127. package/libs/css/style.theme.scss +31 -0
  128. package/libs/css/style.vue.scss +1 -1
  129. package/libs/function/clipboard.ts +6 -11
  130. package/libs/function/color.ts +53 -22
  131. package/libs/hooks/index.ts +2 -0
  132. package/libs/hooks/useColor.ts +61 -0
  133. package/libs/hooks/useTheme.ts +162 -0
  134. package/libs/index.ts +4 -3
  135. package/libs/util/config-provider.ts +580 -0
  136. package/libs/util/system-theme.ts +25 -0
  137. package/package.json +5 -5
  138. package/theme.scss +50 -34
  139. package/types/components.d.ts +1 -0
  140. package/types/global.d.ts +47 -2
package/theme.scss CHANGED
@@ -2,37 +2,53 @@
2
2
  // uni.scss中引入的样式会同时混入到全局样式文件和单独每一个页面的样式中,造成微信程序包太大,
3
3
  // 故uni.scss只建议放scss变量名相关样式,其他的样式可以通过main.js或者App.vue引入
4
4
 
5
- $u-main-color: #303133;
6
- $u-content-color: #606266;
7
- $u-tips-color: #909399;
8
- $u-light-color: #c0c4cc;
9
- $u-border-color: #e4e7ed;
10
- $u-bg-color: #f3f4f6;
11
-
12
- $u-type-primary: #2979ff;
13
- $u-type-primary-light: #ecf5ff;
14
- $u-type-primary-disabled: #a0cfff;
15
- $u-type-primary-dark: #2b85e4;
16
-
17
- $u-type-warning: #ff9900;
18
- $u-type-warning-disabled: #fcbd71;
19
- $u-type-warning-dark: #f29100;
20
- $u-type-warning-light: #fdf6ec;
21
-
22
- $u-type-success: #19be6b;
23
- $u-type-success-disabled: #71d5a1;
24
- $u-type-success-dark: #18b566;
25
- $u-type-success-light: #dbf1e1;
26
-
27
- $u-type-error: #fa3534;
28
- $u-type-error-disabled: #fab6b6;
29
- $u-type-error-dark: #dd6161;
30
- $u-type-error-light: #fef0f0;
31
-
32
- $u-type-info: #909399;
33
- $u-type-info-disabled: #c8c9cc;
34
- $u-type-info-dark: #82848a;
35
- $u-type-info-light: #f4f4f5;
36
-
37
- $u-form-item-height: 70rpx;
38
- $u-form-item-border-color: #dcdfe6;
5
+ // 常用色
6
+ $u-main-color: var(--u-main-color, #303133);
7
+ $u-content-color: var(--u-content-color, #606266);
8
+ $u-tips-color: var(--u-tips-color, #909399);
9
+ $u-light-color: var(--u-light-color, #c0c4cc);
10
+ $u-border-color: var(--u-border-color, #e4e7ed);
11
+ $u-divider-color: var(--u-divider-color, #e4e7ed);
12
+ $u-mask-color: var(--u-mask-color, rgba(0, 0, 0, 0.4));
13
+ $u-shadow-color: var(--u-shadow-color, rgba(0, 0, 0, 0.1));
14
+
15
+ // 纯色
16
+ $u-white-color: var(--u-white-color, #ffffff);
17
+ $u-black-color: var(--u-black-color, #000000);
18
+
19
+ // 背景色
20
+ $u-bg-color: var(--u-bg-color, #f3f4f6);
21
+ $u-bg-white: var(--u-bg-white, #ffffff);
22
+ $u-bg-gray-light: var(--u-bg-gray-light, #f5f7fa);
23
+ $u-bg-gray-dark: var(--u-bg-gray-dark, #2f343c);
24
+ $u-bg-black: var(--u-bg-black, #000000);
25
+
26
+ // 主色
27
+ $u-type-primary: var(--u-type-primary, #2979ff);
28
+ $u-type-primary-light: var(--u-type-primary-light, #ecf5ff);
29
+ $u-type-primary-disabled: var(--u-type-primary-disabled, #a0cfff);
30
+ $u-type-primary-dark: var(--u-type-primary-dark, #2b85e4);
31
+
32
+ // 警告色
33
+ $u-type-warning: var(--u-type-warning, #ff9900);
34
+ $u-type-warning-disabled: var(--u-type-warning-disabled, #fcbd71);
35
+ $u-type-warning-dark: var(--u-type-warning-dark, #f29100);
36
+ $u-type-warning-light: var(--u-type-warning-light, #fdf6ec);
37
+
38
+ // 成功色
39
+ $u-type-success: var(--u-type-success, #19be6b);
40
+ $u-type-success-disabled: var(--u-type-success-disabled, #71d5a1);
41
+ $u-type-success-dark: var(--u-type-success-dark, #18b566);
42
+ $u-type-success-light: var(--u-type-success-light, #dbf1e1);
43
+
44
+ // 错误色
45
+ $u-type-error: var(--u-type-error, #fa3534);
46
+ $u-type-error-disabled: var(--u-type-error-disabled, #fab6b6);
47
+ $u-type-error-dark: var(--u-type-error-dark, #dd6161);
48
+ $u-type-error-light: var(--u-type-error-light, #fef0f0);
49
+
50
+ // 信息色
51
+ $u-type-info: var(--u-type-info, #909399);
52
+ $u-type-info-disabled: var(--u-type-info-disabled, #c8c9cc);
53
+ $u-type-info-dark: var(--u-type-info-dark, #82848a);
54
+ $u-type-info-light: var(--u-type-info-light, #f4f4f5);
@@ -97,6 +97,7 @@ declare module 'vue' {
97
97
  uTextarea: (typeof import('../components/u-textarea/u-textarea.vue'))['default'];
98
98
  uFab: (typeof import('../components/u-fab/u-fab.vue'))['default'];
99
99
  uPagination: (typeof import('../components/u-pagination/u-pagination.vue'))['default'];
100
+ uConfigProvider: (typeof import('../components/u-config-provider/u-config-provider.vue'))['default'];
100
101
  }
101
102
  }
102
103
 
package/types/global.d.ts CHANGED
@@ -312,6 +312,10 @@ export type ColorType =
312
312
  | 'primaryDisabled'
313
313
  | 'primaryLight'
314
314
  | 'bgColor'
315
+ | 'bgWhite'
316
+ | 'bgGrayLight'
317
+ | 'bgGrayDark'
318
+ | 'bgBlack'
315
319
  | 'info'
316
320
  | 'infoDark'
317
321
  | 'infoDisabled'
@@ -332,11 +336,40 @@ export type ColorType =
332
336
  | 'contentColor'
333
337
  | 'tipsColor'
334
338
  | 'lightColor'
335
- | 'borderColor';
339
+ | 'borderColor'
340
+ | 'whiteColor'
341
+ | 'blackColor'
342
+ | 'dividerColor'
343
+ | 'maskColor'
344
+ | 'shadowColor';
336
345
 
337
346
  // 自定义主题色
338
347
  export type ThemeColor = Partial<Record<ColorType, string>>;
339
348
 
349
+ export type DarkMode = 'auto' | 'light' | 'dark';
350
+
351
+ export type Theme = {
352
+ name: string;
353
+ label?: string;
354
+ description?: string;
355
+ /**
356
+ * 亮色模式下的令牌(会同步到 $u.color 和 CSS 变量)
357
+ */
358
+ color: Partial<ThemeColor>;
359
+ /**
360
+ * 暗黑模式下的令牌,未提供时回退到 color
361
+ */
362
+ darkColor?: Partial<ThemeColor>;
363
+ /**
364
+ * 需要直接注入的 CSS 变量(亮色)
365
+ */
366
+ css?: Record<string, string>;
367
+ /**
368
+ * 需要直接注入的 CSS 变量(暗黑)
369
+ */
370
+ darkCss?: Record<string, string>;
371
+ };
372
+
340
373
  export type LogConfig = Partial<{
341
374
  debug?: boolean;
342
375
  prefix?: string;
@@ -344,7 +377,7 @@ export type LogConfig = Partial<{
344
377
  }>;
345
378
 
346
379
  export interface UViewProOptions {
347
- theme?: ThemeColor;
380
+ theme?: ThemeColor | Theme[];
348
381
  log?: LogConfig;
349
382
  // 可扩展更多配置项
350
383
  }
@@ -357,3 +390,15 @@ export type PaginationChangePayload = {
357
390
  type: PaginationDirection;
358
391
  current: number;
359
392
  };
393
+
394
+ // tabbar 组件 Item
395
+ export type TabbarItem = {
396
+ text?: string;
397
+ pagePath?: string;
398
+ iconPath?: string;
399
+ selectedIconPath?: string;
400
+ count?: number;
401
+ isDot?: boolean;
402
+ customIcon?: boolean;
403
+ midButton?: boolean;
404
+ };