uview-pro 0.4.1 → 0.4.3

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/changelog.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## 0.4.3(2025-12-03)
2
+
3
+ ### 📝 Documentation | 文档
4
+
5
+ - 更新项目描述和移除冗余信息 ([3d5c105](https://github.com/anyup/uView-Pro/commit/3d5c1053873a1a1dc592e02caf62b5e5f9aba3ad))
6
+ - **readme:** 更新交流反馈和捐赠链接 ([266e788](https://github.com/anyup/uView-Pro/commit/266e7883a4e2f3ea8058e0bba0b7ce07a972bad8))
7
+
8
+ ### 🐛 Bug Fixes | Bug 修复
9
+
10
+ - **theme:** 修复不使用 u-config-privider 全局注入时,部分颜色变量不存在的问题 ([cd82d9d](https://github.com/anyup/uView-Pro/commit/cd82d9da3e8fd6066177e3b78b855583e2756a5f))
11
+
12
+ ### 👥 Contributors
13
+
14
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
15
+
16
+ ## 0.4.2(2025-12-01)
17
+
18
+ ### 📝 Documentation | 文档
19
+
20
+ - **scripts:** 更新发布指定版本说明文档 ([db6bfe8](https://github.com/anyup/uView-Pro/commit/db6bfe8a7ec2812f34738b5b707240cdfe57e8b3))
21
+
22
+ ### 🐛 Bug Fixes | Bug 修复
23
+
24
+ - **theme:** 修复npm方式加载主题包失效的问题 ([7b9c947](https://github.com/anyup/uView-Pro/commit/7b9c947581697ddbd36632919652689ca8595503))
25
+ - **dark-mode:** 修复 App 平台暗黑模式跟随系统下,切换系统暗黑模式后不即时生效问题 ([880b181](https://github.com/anyup/uView-Pro/commit/880b18153d186f6f5c5f9c81bf12307bd8f00c22))
26
+ - **initTheme:** 优化组件库 install 方法中的主题初始化默认逻辑 ([39e273b](https://github.com/anyup/uView-Pro/commit/39e273b98cd53ec2891c7e68419dd6dfbbeb30c0))
27
+
28
+ ### 👥 Contributors
29
+
30
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
31
+
1
32
  ## 0.4.1(2025-11-30)
2
33
 
3
34
  ### ✨ Features | 新功能
package/index.ts CHANGED
@@ -14,8 +14,8 @@ declare const uni: {
14
14
 
15
15
  // $u挂载到uni对象上
16
16
  const install = (app: any, options?: UViewProOptions): void => {
17
- if (options) {
18
- try {
17
+ try {
18
+ if (options) {
19
19
  // 配置主题:统一使用 useTheme 的 initTheme 初始化,避免重复初始化
20
20
  if (options.theme) {
21
21
  // 如果是数组,则为多主题配置
@@ -39,15 +39,21 @@ const install = (app: any, options?: UViewProOptions): void => {
39
39
  initTheme([mergedTheme], defaultTheme.name);
40
40
  }
41
41
  }
42
+ } else {
43
+ // 默认初始化系统主题
44
+ initTheme();
42
45
  }
43
46
  // 设置调试模式
44
47
  logger
45
48
  .setDebugMode(options?.log?.debug ?? false)
46
49
  .setPrefix(options?.log?.prefix)
47
50
  .setShowCallerInfo(options?.log?.showCallerInfo ?? true);
48
- } catch (error) {
49
- console.error('[install options] Error:', error);
51
+ } else {
52
+ // 默认初始化系统主题
53
+ initTheme();
50
54
  }
55
+ } catch (error) {
56
+ console.error('[install options] Error:', error);
51
57
  }
52
58
  uni.$u = $u;
53
59
  // 可扩展更多配置项
@@ -51,6 +51,7 @@ export class ConfigProvider {
51
51
  private debug: boolean = false;
52
52
  private systemDarkModeMediaQuery: MediaQueryList | null = null;
53
53
  private lastAppliedCssKeys: string[] = [];
54
+ private interval = 0;
54
55
 
55
56
  constructor() {
56
57
  // 默认不自动初始化,调用 init 以传入主题列表
@@ -95,8 +96,29 @@ export class ConfigProvider {
95
96
  } catch (e) {
96
97
  if (this.debug) console.warn('[ConfigProvider] uni-app system dark mode listener failed', e);
97
98
  }
99
+ this.initAppEvent();
98
100
  }
99
101
 
102
+ /**
103
+ * App 平台事件监听
104
+ * 经测试 uni.onThemeChange 在 App 平台目前没生效,暂时只能通过定时检查
105
+ */
106
+ private initAppEvent(): void {
107
+ // #ifdef APP
108
+ try {
109
+ if (this.interval) clearInterval(this.interval);
110
+
111
+ this.interval = setInterval(() => {
112
+ if (this.darkModeRef.value === 'auto') {
113
+ // 系统主题变化时,重新应用主题
114
+ this.applyTheme(this.currentThemeRef.value);
115
+ }
116
+ }, 5000);
117
+ } catch (e) {
118
+ if (this.debug) console.warn('[ConfigProvider] setInterval failed', e);
119
+ }
120
+ // #endif
121
+ }
100
122
  /**
101
123
  * 检测当前是否应该使用暗黑模式
102
124
  */
package/package.json CHANGED
@@ -1,107 +1,107 @@
1
- {
2
- "id": "uview-pro",
3
- "name": "uview-pro",
4
- "displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS全面重构的80+精选UI组件库",
5
- "version": "0.4.1",
6
- "description": "uView Pro,是全面支持Vue3的uni-app生态框架,80+精选组件已使用TypeScript重构,已全面支持uni-app Vue3.0",
7
- "main": "index.ts",
8
- "module": "index.ts",
9
- "browser": "index.ts",
10
- "keywords": [
11
- "uni-app",
12
- "library",
13
- "component",
14
- "uView",
15
- "Vue3"
16
- ],
17
- "author": "anyup",
18
- "license": "MIT",
19
- "repository": "https://github.com/anyup/uview-pro",
20
- "engines": {
21
- "HBuilderX": "^4.07",
22
- "uni-app": "^4.07",
23
- "uni-app-x": ""
24
- },
25
- "dcloudext": {
26
- "type": "component-vue",
27
- "sale": {
28
- "regular": {
29
- "price": "0.00"
30
- },
31
- "sourcecode": {
32
- "price": "0.00"
33
- }
34
- },
35
- "contact": {
36
- "qq": "491302297"
37
- },
38
- "declaration": {
39
- "ads": "无",
40
- "data": "无",
41
- "permissions": "无"
42
- },
43
- "npmurl": "https://www.npmjs.com/package/uview-pro",
44
- "darkmode": "x",
45
- "i18n": "x",
46
- "widescreen": "x"
47
- },
48
- "uni_modules": {
49
- "dependencies": [],
50
- "encrypt": [],
51
- "platforms": {
52
- "cloud": {
53
- "tcb": "√",
54
- "aliyun": "√",
55
- "alipay": "√"
56
- },
57
- "client": {
58
- "uni-app": {
59
- "vue": {
60
- "vue2": "x",
61
- "vue3": "√"
62
- },
63
- "web": {
64
- "safari": "√",
65
- "chrome": "√"
66
- },
67
- "app": {
68
- "vue": "√",
69
- "nvue": "-",
70
- "android": "√",
71
- "ios": "√",
72
- "harmony": "√"
73
- },
74
- "mp": {
75
- "weixin": "√",
76
- "alipay": "√",
77
- "toutiao": "√",
78
- "baidu": "-",
79
- "kuaishou": "-",
80
- "jd": "-",
81
- "harmony": "√",
82
- "qq": "√",
83
- "lark": "-"
84
- },
85
- "quickapp": {
86
- "huawei": "-",
87
- "union": "-"
88
- }
89
- },
90
- "uni-app-x": {
91
- "web": {
92
- "safari": "-",
93
- "chrome": "-"
94
- },
95
- "app": {
96
- "android": "-",
97
- "ios": "-",
98
- "harmony": "-"
99
- },
100
- "mp": {
101
- "weixin": "-"
102
- }
103
- }
104
- }
105
- }
106
- }
107
- }
1
+ {
2
+ "id": "uview-pro",
3
+ "name": "uview-pro",
4
+ "displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS80+精选UI组件库,支持多主题,暗黑模式",
5
+ "version": "0.4.3",
6
+ "description": "uView Pro,是全面支持Vue3+TS的uni-app生态框架,80+精选组件,支持安卓,iOS,鸿蒙,各小程序平台,支持多主题,一键暗黑模式",
7
+ "main": "index.ts",
8
+ "module": "index.ts",
9
+ "browser": "index.ts",
10
+ "keywords": [
11
+ "uni-app",
12
+ "library",
13
+ "component",
14
+ "uView",
15
+ "Vue3"
16
+ ],
17
+ "author": "anyup",
18
+ "license": "MIT",
19
+ "repository": "https://github.com/anyup/uview-pro",
20
+ "engines": {
21
+ "HBuilderX": "^4.07",
22
+ "uni-app": "^4.07",
23
+ "uni-app-x": ""
24
+ },
25
+ "dcloudext": {
26
+ "type": "component-vue",
27
+ "sale": {
28
+ "regular": {
29
+ "price": "0.00"
30
+ },
31
+ "sourcecode": {
32
+ "price": "0.00"
33
+ }
34
+ },
35
+ "contact": {
36
+ "qq": "491302297"
37
+ },
38
+ "declaration": {
39
+ "ads": "无",
40
+ "data": "无",
41
+ "permissions": "无"
42
+ },
43
+ "npmurl": "https://www.npmjs.com/package/uview-pro",
44
+ "darkmode": "",
45
+ "i18n": "x",
46
+ "widescreen": ""
47
+ },
48
+ "uni_modules": {
49
+ "dependencies": [],
50
+ "encrypt": [],
51
+ "platforms": {
52
+ "cloud": {
53
+ "tcb": "√",
54
+ "aliyun": "√",
55
+ "alipay": "√"
56
+ },
57
+ "client": {
58
+ "uni-app": {
59
+ "vue": {
60
+ "vue2": "x",
61
+ "vue3": "√"
62
+ },
63
+ "web": {
64
+ "safari": "√",
65
+ "chrome": "√"
66
+ },
67
+ "app": {
68
+ "vue": "√",
69
+ "nvue": "-",
70
+ "android": "√",
71
+ "ios": "√",
72
+ "harmony": "√"
73
+ },
74
+ "mp": {
75
+ "weixin": "√",
76
+ "alipay": "√",
77
+ "toutiao": "√",
78
+ "baidu": "-",
79
+ "kuaishou": "-",
80
+ "jd": "-",
81
+ "harmony": "√",
82
+ "qq": "√",
83
+ "lark": "-"
84
+ },
85
+ "quickapp": {
86
+ "huawei": "-",
87
+ "union": "-"
88
+ }
89
+ },
90
+ "uni-app-x": {
91
+ "web": {
92
+ "safari": "-",
93
+ "chrome": "-"
94
+ },
95
+ "app": {
96
+ "android": "-",
97
+ "ios": "-",
98
+ "harmony": "-"
99
+ },
100
+ "mp": {
101
+ "weixin": "-"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
package/readme.md CHANGED
@@ -67,20 +67,15 @@ pnpm dev
67
67
 
68
68
  ## 交流反馈
69
69
 
70
- `uView Pro` 微信交流群: [点击进入](https://uviewpro.cn/zh/resource/about.html)
70
+ 欢迎通过各种方式来交流反馈,让 uView Pro 更好的为大家服务:
71
71
 
72
- `uView Pro` QQ 交流群: [点击进入](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=98nSVDldWEbDdq4lxiP4aL7uATfMSlI6&authKey=G2yQJ5MQiKzMldaxBsIfKt17NuJuUw8Fr6zdKLggc6NZXgw4BVbqkU2U3EE994yd&noverify=0&group_code=811732166)
72
+ [欢迎交流反馈](https://uviewpro.cn/zh/resource/about.html)
73
73
 
74
- <table class="table">
75
- <tr>
76
- <td><img src="https://ik.imagekit.io/anyup/images/social/weixin-chat-cl.png" width="250" height="345" ></td>
77
- <td><img src="https://ik.imagekit.io/anyup/images/social/qq-chat.png" width="250" height="345" ></td>
78
- </tr>
79
- <tr>
80
- <td align="center"><strong>微信群</strong><br></td>
81
- <td align="center"><strong>QQ群</strong><br></td>
82
- </tr>
83
- </table>
74
+ ## 捐赠 uView Pro
75
+
76
+ 开源不易,如果您认为 `uView Pro` 帮到了您的开发工作,您可以捐赠 `uView Pro`:
77
+
78
+ [欢迎捐赠留名](https://uviewpro.cn/zh/resource/donation.html)
84
79
 
85
80
  ## 关于 PR
86
81
 
@@ -206,21 +201,6 @@ export function createApp() {
206
201
 
207
202
  请通过[快速上手](https://uviewpro.cn/zh/components/quickstart.html)了解更详细的内容
208
203
 
209
- ## 捐赠 uView Pro
210
-
211
- `uView Pro` 文档内容和框架源码基于 `uView UI` 二次开发,因此全部开源免费,如果您认为 `uView Pro` 帮到了您的开发工作,您可以捐赠 `uView Pro` 的研发工作,捐赠无门槛,哪怕是一杯可乐也好(相信这比打赏主播更有意义)。
212
-
213
- <table class="table">
214
- <tr>
215
- <td><img src="https://ik.imagekit.io/anyup/images/social/wechat-pay.png" width="250" height="345" ></td>
216
- <td><img src="https://ik.imagekit.io/anyup/images/social/ali-pay.png" width="250" height="345" ></td>
217
- </tr>
218
- <tr>
219
- <td align="center"><strong>微信</strong><br></td>
220
- <td align="center"><strong>支付宝</strong><br></td>
221
- </tr>
222
- </table>
223
-
224
204
  ## 贡献者
225
205
 
226
206
  <a href="https://github.com/anyup/uView-Pro/graphs/contributors">
package/theme.scss CHANGED
@@ -2,53 +2,115 @@
2
2
  // uni.scss中引入的样式会同时混入到全局样式文件和单独每一个页面的样式中,造成微信程序包太大,
3
3
  // 故uni.scss只建议放scss变量名相关样式,其他的样式可以通过main.js或者App.vue引入
4
4
 
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));
5
+ :root,
6
+ page {
7
+ /* 纯色 */
8
+ --u-white-color: #ffffff;
9
+ --u-black-color: #000000;
10
+
11
+ // 字体色
12
+ --u-main-color: #303133;
13
+ --u-content-color: #606266;
14
+ --u-tips-color: #909399;
15
+ --u-light-color: #c0c4cc;
16
+
17
+ // 边框色
18
+ --u-border-color: #e4e7ed;
19
+ --u-divider-color: #e4e7ed;
20
+
21
+ // 遮罩色
22
+ --u-mask-color: rgba(0, 0, 0, 0.4);
23
+ --u-shadow-color: rgba(0, 0, 0, 0.1);
24
+
25
+ /* 背景色 */
26
+ --u-bg-color: #f3f4f6;
27
+ --u-bg-white: #ffffff;
28
+ --u-bg-gray-light: #f5f7fa;
29
+ --u-bg-gray-dark: #2f343c;
30
+ --u-bg-black: #000000;
31
+
32
+ /* 主色 */
33
+ --u-type-primary: #2979ff;
34
+ --u-type-primary-light: #ecf5ff;
35
+ --u-type-primary-disabled: #a0cfff;
36
+ --u-type-primary-dark: #2b85e4;
37
+
38
+ /* 警告色 */
39
+ --u-type-warning: #ff9900;
40
+ --u-type-warning-disabled: #fcbd71;
41
+ --u-type-warning-dark: #f29100;
42
+ --u-type-warning-light: #fdf6ec;
43
+
44
+ /* 成功色 */
45
+ --u-type-success: #19be6b;
46
+ --u-type-success-disabled: #71d5a1;
47
+ --u-type-success-dark: #18b566;
48
+ --u-type-success-light: #dbf1e1;
49
+
50
+ /* 错误色 */
51
+ --u-type-error: #fa3534;
52
+ --u-type-error-disabled: #fab6b6;
53
+ --u-type-error-dark: #dd6161;
54
+ --u-type-error-light: #fef0f0;
55
+
56
+ /* 信息色 */
57
+ --u-type-info: #909399;
58
+ --u-type-info-disabled: #c8c9cc;
59
+ --u-type-info-dark: #82848a;
60
+ --u-type-info-light: #f4f4f5;
61
+ }
14
62
 
15
63
  // 纯色
16
- $u-white-color: var(--u-white-color, #ffffff);
17
- $u-black-color: var(--u-black-color, #000000);
64
+ $u-white-color: var(--u-white-color);
65
+ $u-black-color: var(--u-black-color);
66
+
67
+ // 字体色
68
+ $u-main-color: var(--u-main-color);
69
+ $u-content-color: var(--u-content-color);
70
+ $u-tips-color: var(--u-tips-color);
71
+ $u-light-color: var(--u-light-color);
72
+
73
+ // 边框色
74
+ $u-border-color: var(--u-border-color);
75
+ $u-divider-color: var(--u-divider-color);
76
+
77
+ // 遮罩色
78
+ $u-mask-color: var(--u-mask-color);
79
+ $u-shadow-color: var(--u-shadow-color);
18
80
 
19
81
  // 背景色
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);
82
+ $u-bg-color: var(--u-bg-color);
83
+ $u-bg-white: var(--u-bg-white);
84
+ $u-bg-gray-light: var(--u-bg-gray-light);
85
+ $u-bg-gray-dark: var(--u-bg-gray-dark);
86
+ $u-bg-black: var(--u-bg-black);
25
87
 
26
88
  // 主色
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);
89
+ $u-type-primary: var(--u-type-primary);
90
+ $u-type-primary-light: var(--u-type-primary-light);
91
+ $u-type-primary-disabled: var(--u-type-primary-disabled);
92
+ $u-type-primary-dark: var(--u-type-primary-dark);
31
93
 
32
94
  // 警告色
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);
95
+ $u-type-warning: var(--u-type-warning);
96
+ $u-type-warning-disabled: var(--u-type-warning-disabled);
97
+ $u-type-warning-dark: var(--u-type-warning-dark);
98
+ $u-type-warning-light: var(--u-type-warning-light);
37
99
 
38
100
  // 成功色
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);
101
+ $u-type-success: var(--u-type-success);
102
+ $u-type-success-disabled: var(--u-type-success-disabled);
103
+ $u-type-success-dark: var(--u-type-success-dark);
104
+ $u-type-success-light: var(--u-type-success-light);
43
105
 
44
106
  // 错误色
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);
107
+ $u-type-error: var(--u-type-error);
108
+ $u-type-error-disabled: var(--u-type-error-disabled);
109
+ $u-type-error-dark: var(--u-type-error-dark);
110
+ $u-type-error-light: var(--u-type-error-light);
49
111
 
50
112
  // 信息色
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);
113
+ $u-type-info: var(--u-type-info);
114
+ $u-type-info-disabled: var(--u-type-info-disabled);
115
+ $u-type-info-dark: var(--u-type-info-dark);
116
+ $u-type-info-light: var(--u-type-info-light);