uview-pro 0.4.1 → 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.
- package/changelog.md +16 -0
- package/index.ts +10 -4
- package/libs/util/config-provider.ts +22 -0
- package/package.json +107 -107
package/changelog.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 0.4.2(2025-12-01)
|
|
2
|
+
|
|
3
|
+
### 📝 Documentation | 文档
|
|
4
|
+
|
|
5
|
+
- **scripts:** 更新发布指定版本说明文档 ([db6bfe8](https://github.com/anyup/uView-Pro/commit/db6bfe8a7ec2812f34738b5b707240cdfe57e8b3))
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
8
|
+
|
|
9
|
+
- **theme:** 修复npm方式加载主题包失效的问题 ([7b9c947](https://github.com/anyup/uView-Pro/commit/7b9c947581697ddbd36632919652689ca8595503))
|
|
10
|
+
- **dark-mode:** 修复 App 平台暗黑模式跟随系统下,切换系统暗黑模式后不即时生效问题 ([880b181](https://github.com/anyup/uView-Pro/commit/880b18153d186f6f5c5f9c81bf12307bd8f00c22))
|
|
11
|
+
- **initTheme:** 优化组件库 install 方法中的主题初始化默认逻辑 ([39e273b](https://github.com/anyup/uView-Pro/commit/39e273b98cd53ec2891c7e68419dd6dfbbeb30c0))
|
|
12
|
+
|
|
13
|
+
### 👥 Contributors
|
|
14
|
+
|
|
15
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
16
|
+
|
|
1
17
|
## 0.4.1(2025-11-30)
|
|
2
18
|
|
|
3
19
|
### ✨ 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
|
-
|
|
18
|
-
|
|
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
|
-
}
|
|
49
|
-
|
|
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
|
|
5
|
-
"version": "0.4.
|
|
6
|
-
"description": "uView Pro,是全面支持Vue3的uni-app生态框架,80
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "uview-pro",
|
|
3
|
+
"name": "uview-pro",
|
|
4
|
+
"displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的80+精选UI组件库,支持多主题,暗黑模式",
|
|
5
|
+
"version": "0.4.2",
|
|
6
|
+
"description": "uView Pro,是全面支持Vue3的uni-app生态框架,80+精选组件已全面使用TypeScript重构,智能多主题配置,一键暗黑模式",
|
|
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
|
+
}
|